onepipeline-ui 0.6.1 → 0.6.3

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.
@@ -45,12 +45,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
45
45
  newResult[${r}] = ${n}.value;
46
46
  }
47
47
 
48
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=qx,s=!Nx.jitless,c=s&&Jx.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?mw([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function _w(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!lS(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>fS(e,r,Px())))}),t)}var vw=Y(`$ZodUnion`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Hx(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Hx(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Hx(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>zx(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>_w(t,i,e,a)):_w(s,i,e,a)}}),yw=Y(`$ZodIntersection`,(e,t)=>{AC.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xw(e,t,n)):xw(e,i,a)}});function bw(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Yx(e)&&Yx(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=bw(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bw(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xw(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),lS(e))return e;let r=bw(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var Sw=Y(`$ZodRecord`,(e,t)=>{AC.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Yx(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...uS(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...uS(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>fS(e,r,Px())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...uS(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...uS(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Cw=Y(`$ZodEnum`,(e,t)=>{AC.init(e,t);let n=Fx(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Zx.has(typeof e)).map(e=>typeof e==`string`?Qx(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ww=Y(`$ZodLiteral`,(e,t)=>{if(AC.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Qx(e):e?Qx(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),Tw=Y(`$ZodTransform`,(e,t)=>{AC.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mx(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new jx;return n.value=i,n}});function Ew(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Dw=Y(`$ZodOptional`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Hx(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zx(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ew(t,e.value)):Ew(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ow=Y(`$ZodNullable`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),Hx(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zx(e.source)}|null)$`):void 0}),Hx(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),kw=Y(`$ZodDefault`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Aw(e,t)):Aw(r,t)}});function Aw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var jw=Y(`$ZodPrefault`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mw=Y(`$ZodNonOptional`,(e,t)=>{AC.init(e,t),Hx(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Nw(t,e)):Nw(i,e)}});function Nw(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Pw=Y(`$ZodCatch`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>fS(e,n,Px()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>fS(e,n,Px()))},input:e.value}),e.issues=[]),e)}}),Fw=Y(`$ZodPipe`,(e,t)=>{AC.init(e,t),Hx(e._zod,`values`,()=>t.in._zod.values),Hx(e._zod,`optin`,()=>t.in._zod.optin),Hx(e._zod,`optout`,()=>t.out._zod.optout),Hx(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Iw(e,t.in,n)):Iw(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Iw(e,t.out,n)):Iw(r,t.out,n)}});function Iw(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Lw=Y(`$ZodReadonly`,(e,t)=>{AC.init(e,t),Hx(e._zod,`propValues`,()=>t.innerType._zod.propValues),Hx(e._zod,`values`,()=>t.innerType._zod.values),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Rw):Rw(r)}});function Rw(e){return e.value=Object.freeze(e.value),e}var zw=Y(`$ZodCustom`,(e,t)=>{dC.init(e,t),AC.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Bw(t,n,r,e));Bw(i,n,r,e)}});function Bw(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mS(e))}}var Vw=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Hw(){return new Vw}var Uw=Hw();function Ww(e,t){return new e({type:`string`,...X(t)})}function Gw(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...X(t)})}function Kw(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...X(t)})}function qw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...X(t)})}function Jw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...X(t)})}function Yw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...X(t)})}function Xw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...X(t)})}function Zw(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...X(t)})}function Qw(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...X(t)})}function $w(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...X(t)})}function eT(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...X(t)})}function tT(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...X(t)})}function nT(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...X(t)})}function rT(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...X(t)})}function iT(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...X(t)})}function aT(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...X(t)})}function oT(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...X(t)})}function sT(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...X(t)})}function cT(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...X(t)})}function lT(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...X(t)})}function uT(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...X(t)})}function dT(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...X(t)})}function fT(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...X(t)})}function pT(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...X(t)})}function mT(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...X(t)})}function hT(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...X(t)})}function gT(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...X(t)})}function _T(e,t){return new e({type:`number`,checks:[],...X(t)})}function vT(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...X(t)})}function yT(e,t){return new e({type:`boolean`,...X(t)})}function bT(e){return new e({type:`unknown`})}function xT(e,t){return new e({type:`never`,...X(t)})}function ST(e,t){return new pC({check:`less_than`,...X(t),value:e,inclusive:!1})}function CT(e,t){return new pC({check:`less_than`,...X(t),value:e,inclusive:!0})}function wT(e,t){return new mC({check:`greater_than`,...X(t),value:e,inclusive:!1})}function TT(e,t){return new mC({check:`greater_than`,...X(t),value:e,inclusive:!0})}function ET(e,t){return new hC({check:`multiple_of`,...X(t),value:e})}function DT(e,t){return new _C({check:`max_length`,...X(t),maximum:e})}function OT(e,t){return new vC({check:`min_length`,...X(t),minimum:e})}function kT(e,t){return new yC({check:`length_equals`,...X(t),length:e})}function AT(e,t){return new xC({check:`string_format`,format:`regex`,...X(t),pattern:e})}function jT(e){return new SC({check:`string_format`,format:`lowercase`,...X(e)})}function MT(e){return new CC({check:`string_format`,format:`uppercase`,...X(e)})}function NT(e,t){return new wC({check:`string_format`,format:`includes`,...X(t),includes:e})}function PT(e,t){return new TC({check:`string_format`,format:`starts_with`,...X(t),prefix:e})}function FT(e,t){return new EC({check:`string_format`,format:`ends_with`,...X(t),suffix:e})}function IT(e){return new DC({check:`overwrite`,tx:e})}function LT(e){return IT(t=>t.normalize(e))}function RT(){return IT(e=>e.trim())}function zT(){return IT(e=>e.toLowerCase())}function BT(){return IT(e=>e.toUpperCase())}function VT(e,t,n){return new e({type:`array`,element:t,...X(n)})}function HT(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...X(n)})}function UT(e){let t=WT(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(mS(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(mS(r))}},e(n.value,n)));return t}function WT(e,t){let n=new dC({check:`custom`,...X(t)});return n._zod.check=e,n}var GT=Y(`ZodISODateTime`,(e,t)=>{WC.init(e,t),gE.init(e,t)});function KT(e){return pT(GT,e)}var qT=Y(`ZodISODate`,(e,t)=>{GC.init(e,t),gE.init(e,t)});function JT(e){return mT(qT,e)}var YT=Y(`ZodISOTime`,(e,t)=>{KC.init(e,t),gE.init(e,t)});function XT(e){return hT(YT,e)}var ZT=Y(`ZodISODuration`,(e,t)=>{qC.init(e,t),gE.init(e,t)});function QT(e){return gT(ZT,e)}var $T=(e,t)=>{gS.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>yS(e,t)},flatten:{value:t=>vS(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ix,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ix,2)}},isEmpty:{get(){return e.issues.length===0}}})};Y(`ZodError`,$T);var eE=Y(`ZodError`,$T,{Parent:Error}),tE=bS(eE),nE=xS(eE),rE=SS(eE),iE=wS(eE),aE=ES(eE),oE=DS(eE),sE=OS(eE),cE=kS(eE),lE=AS(eE),uE=jS(eE),dE=MS(eE),fE=NS(eE),pE=Y(`ZodType`,(e,t)=>(AC.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Wx(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>$x(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>tE(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>rE(e,t,n),e.parseAsync=async(t,n)=>nE(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>iE(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>aE(e,t,n),e.decode=(t,n)=>oE(e,t,n),e.encodeAsync=async(t,n)=>sE(e,t,n),e.decodeAsync=async(t,n)=>cE(e,t,n),e.safeEncode=(t,n)=>lE(e,t,n),e.safeDecode=(t,n)=>uE(e,t,n),e.safeEncodeAsync=async(t,n)=>dE(e,t,n),e.safeDecodeAsync=async(t,n)=>fE(e,t,n),e.refine=(t,n)=>e.check(TD(t,n)),e.superRefine=t=>e.check(ED(t)),e.overwrite=t=>e.check(IT(t)),e.optional=()=>lD(e),e.nullable=()=>dD(e),e.nullish=()=>lD(dD(e)),e.nonoptional=t=>_D(e,t),e.array=()=>qE(e),e.or=t=>ZE([e,t]),e.and=t=>$E(e,t),e.transform=t=>xD(e,sD(t)),e.default=t=>pD(e,t),e.prefault=t=>hD(e,t),e.catch=t=>yD(e,t),e.pipe=t=>xD(e,t),e.readonly=()=>CD(e),e.describe=t=>{let n=e.clone();return Uw.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Uw.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Uw.get(e);let n=e.clone();return Uw.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),mE=Y(`_ZodString`,(e,t)=>{jC.init(e,t),pE.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(AT(...t)),e.includes=(...t)=>e.check(NT(...t)),e.startsWith=(...t)=>e.check(PT(...t)),e.endsWith=(...t)=>e.check(FT(...t)),e.min=(...t)=>e.check(OT(...t)),e.max=(...t)=>e.check(DT(...t)),e.length=(...t)=>e.check(kT(...t)),e.nonempty=(...t)=>e.check(OT(1,...t)),e.lowercase=t=>e.check(jT(t)),e.uppercase=t=>e.check(MT(t)),e.trim=()=>e.check(RT()),e.normalize=(...t)=>e.check(LT(...t)),e.toLowerCase=()=>e.check(zT()),e.toUpperCase=()=>e.check(BT())}),hE=Y(`ZodString`,(e,t)=>{jC.init(e,t),mE.init(e,t),e.email=t=>e.check(Gw(_E,t)),e.url=t=>e.check(Zw(bE,t)),e.jwt=t=>e.check(fT(FE,t)),e.emoji=t=>e.check(Qw(xE,t)),e.guid=t=>e.check(Kw(vE,t)),e.uuid=t=>e.check(qw(yE,t)),e.uuidv4=t=>e.check(Jw(yE,t)),e.uuidv6=t=>e.check(Yw(yE,t)),e.uuidv7=t=>e.check(Xw(yE,t)),e.nanoid=t=>e.check($w(SE,t)),e.guid=t=>e.check(Kw(vE,t)),e.cuid=t=>e.check(eT(CE,t)),e.cuid2=t=>e.check(tT(wE,t)),e.ulid=t=>e.check(nT(TE,t)),e.base64=t=>e.check(lT(ME,t)),e.base64url=t=>e.check(uT(NE,t)),e.xid=t=>e.check(rT(EE,t)),e.ksuid=t=>e.check(iT(DE,t)),e.ipv4=t=>e.check(aT(OE,t)),e.ipv6=t=>e.check(oT(kE,t)),e.cidrv4=t=>e.check(sT(AE,t)),e.cidrv6=t=>e.check(cT(jE,t)),e.e164=t=>e.check(dT(PE,t)),e.datetime=t=>e.check(KT(t)),e.date=t=>e.check(JT(t)),e.time=t=>e.check(XT(t)),e.duration=t=>e.check(QT(t))});function Z(e){return Ww(hE,e)}var gE=Y(`ZodStringFormat`,(e,t)=>{MC.init(e,t),mE.init(e,t)}),_E=Y(`ZodEmail`,(e,t)=>{FC.init(e,t),gE.init(e,t)}),vE=Y(`ZodGUID`,(e,t)=>{NC.init(e,t),gE.init(e,t)}),yE=Y(`ZodUUID`,(e,t)=>{PC.init(e,t),gE.init(e,t)}),bE=Y(`ZodURL`,(e,t)=>{IC.init(e,t),gE.init(e,t)}),xE=Y(`ZodEmoji`,(e,t)=>{LC.init(e,t),gE.init(e,t)}),SE=Y(`ZodNanoID`,(e,t)=>{RC.init(e,t),gE.init(e,t)}),CE=Y(`ZodCUID`,(e,t)=>{zC.init(e,t),gE.init(e,t)}),wE=Y(`ZodCUID2`,(e,t)=>{BC.init(e,t),gE.init(e,t)}),TE=Y(`ZodULID`,(e,t)=>{VC.init(e,t),gE.init(e,t)}),EE=Y(`ZodXID`,(e,t)=>{HC.init(e,t),gE.init(e,t)}),DE=Y(`ZodKSUID`,(e,t)=>{UC.init(e,t),gE.init(e,t)}),OE=Y(`ZodIPv4`,(e,t)=>{JC.init(e,t),gE.init(e,t)}),kE=Y(`ZodIPv6`,(e,t)=>{YC.init(e,t),gE.init(e,t)}),AE=Y(`ZodCIDRv4`,(e,t)=>{XC.init(e,t),gE.init(e,t)}),jE=Y(`ZodCIDRv6`,(e,t)=>{ZC.init(e,t),gE.init(e,t)}),ME=Y(`ZodBase64`,(e,t)=>{$C.init(e,t),gE.init(e,t)}),NE=Y(`ZodBase64URL`,(e,t)=>{tw.init(e,t),gE.init(e,t)}),PE=Y(`ZodE164`,(e,t)=>{nw.init(e,t),gE.init(e,t)}),FE=Y(`ZodJWT`,(e,t)=>{iw.init(e,t),gE.init(e,t)}),IE=Y(`ZodNumber`,(e,t)=>{aw.init(e,t),pE.init(e,t),e.gt=(t,n)=>e.check(wT(t,n)),e.gte=(t,n)=>e.check(TT(t,n)),e.min=(t,n)=>e.check(TT(t,n)),e.lt=(t,n)=>e.check(ST(t,n)),e.lte=(t,n)=>e.check(CT(t,n)),e.max=(t,n)=>e.check(CT(t,n)),e.int=t=>e.check(zE(t)),e.safe=t=>e.check(zE(t)),e.positive=t=>e.check(wT(0,t)),e.nonnegative=t=>e.check(TT(0,t)),e.negative=t=>e.check(ST(0,t)),e.nonpositive=t=>e.check(CT(0,t)),e.multipleOf=(t,n)=>e.check(ET(t,n)),e.step=(t,n)=>e.check(ET(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function LE(e){return _T(IE,e)}var RE=Y(`ZodNumberFormat`,(e,t)=>{ow.init(e,t),IE.init(e,t)});function zE(e){return vT(RE,e)}var BE=Y(`ZodBoolean`,(e,t)=>{sw.init(e,t),pE.init(e,t)});function VE(e){return yT(BE,e)}var HE=Y(`ZodUnknown`,(e,t)=>{cw.init(e,t),pE.init(e,t)});function UE(){return bT(HE)}var WE=Y(`ZodNever`,(e,t)=>{lw.init(e,t),pE.init(e,t)});function GE(e){return xT(WE,e)}var KE=Y(`ZodArray`,(e,t)=>{dw.init(e,t),pE.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(OT(t,n)),e.nonempty=t=>e.check(OT(1,t)),e.max=(t,n)=>e.check(DT(t,n)),e.length=(t,n)=>e.check(kT(t,n)),e.unwrap=()=>e.element});function qE(e,t){return VT(KE,e,t)}var JE=Y(`ZodObject`,(e,t)=>{gw.init(e,t),pE.init(e,t),Hx(e,`shape`,()=>t.shape),e.keyof=()=>rD(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:UE()}),e.loose=()=>e.clone({...e._zod.def,catchall:UE()}),e.strict=()=>e.clone({...e._zod.def,catchall:GE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>iS(e,t),e.safeExtend=t=>aS(e,t),e.merge=t=>oS(e,t),e.pick=t=>nS(e,t),e.omit=t=>rS(e,t),e.partial=(...t)=>sS(cD,e,t[0]),e.required=(...t)=>cS(gD,e,t[0])});function YE(e,t){return new JE({type:`object`,shape:e??{},...X(t)})}var XE=Y(`ZodUnion`,(e,t)=>{vw.init(e,t),pE.init(e,t),e.options=t.options});function ZE(e,t){return new XE({type:`union`,options:e,...X(t)})}var QE=Y(`ZodIntersection`,(e,t)=>{yw.init(e,t),pE.init(e,t)});function $E(e,t){return new QE({type:`intersection`,left:e,right:t})}var eD=Y(`ZodRecord`,(e,t)=>{Sw.init(e,t),pE.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tD(e,t,n){return new eD({type:`record`,keyType:e,valueType:t,...X(n)})}var nD=Y(`ZodEnum`,(e,t)=>{Cw.init(e,t),pE.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nD({...t,checks:[],...X(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nD({...t,checks:[],...X(r),entries:i})}});function rD(e,t){return new nD({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...X(t)})}var iD=Y(`ZodLiteral`,(e,t)=>{ww.init(e,t),pE.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function aD(e,t){return new iD({type:`literal`,values:Array.isArray(e)?e:[e],...X(t)})}var oD=Y(`ZodTransform`,(e,t)=>{Tw.init(e,t),pE.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mx(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mS(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(mS(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function sD(e){return new oD({type:`transform`,transform:e})}var cD=Y(`ZodOptional`,(e,t)=>{Dw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lD(e){return new cD({type:`optional`,innerType:e})}var uD=Y(`ZodNullable`,(e,t)=>{Ow.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dD(e){return new uD({type:`nullable`,innerType:e})}var fD=Y(`ZodDefault`,(e,t)=>{kw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pD(e,t){return new fD({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var mD=Y(`ZodPrefault`,(e,t)=>{jw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hD(e,t){return new mD({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var gD=Y(`ZodNonOptional`,(e,t)=>{Mw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _D(e,t){return new gD({type:`nonoptional`,innerType:e,...X(t)})}var vD=Y(`ZodCatch`,(e,t)=>{Pw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yD(e,t){return new vD({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bD=Y(`ZodPipe`,(e,t)=>{Fw.init(e,t),pE.init(e,t),e.in=t.in,e.out=t.out});function xD(e,t){return new bD({type:`pipe`,in:e,out:t})}var SD=Y(`ZodReadonly`,(e,t)=>{Lw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function CD(e){return new SD({type:`readonly`,innerType:e})}var wD=Y(`ZodCustom`,(e,t)=>{zw.init(e,t),pE.init(e,t)});function TD(e,t={}){return HT(wD,e,t)}function ED(e){return UT(e)}var DD=_(),OD=LE().finite().nonnegative(),kD=LE().int().nonnegative(),AD=KT({offset:!0}),jD=Z().min(1).nullable(),Q=e=>YE(e).catchall(UE()),MD={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,events:`/api/v2/events`},ND={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,node:`node`,scope:`scope`,filter:`filter`},PD={run:`run`,node:`node`},FD={planner:`planner`,monitor:`monitor`},ID=rD([`complete`,`partial`,`legacy`]),LD=rD([`native`,`labelled`,`inferred`]),RD=Q({agent_model_ms:VE(),judge_model_ms:VE(),llmlint_model_ms:VE(),tool_ms:VE()}),zD=OD.nullable(),BD=kD.nullable(),VD=Q({agent_seconds:zD,judge_seconds:zD,llmlint_seconds:zD,gate_seconds:zD,publication_wait_seconds:zD,lock_wait_seconds:zD,setup_seconds:zD,scheduling_seconds:zD,wall_seconds:zD,agent_model_ms:BD,judge_model_ms:BD,llmlint_model_ms:BD,tool_ms:BD,idle_orchestration_ms:BD,unattributed_ms:BD,wall_ms:BD,fractions:Q({agent_model:zD,judge_model:zD,llmlint_model:zD,tool:zD,idle_orchestration:zD,lock_wait:zD,setup:zD,scheduling:zD})}),HD=rD([`orchestrator`,`worker`,`judge`,`check-in`,`pr-author`]),UD=rD([`agent`,`judge`,`llmlint`]),WD=OD.nullable(),GD=Q({input_tokens:WD,output_tokens:WD,cache_read_tokens:WD,cache_write_tokens:WD,cost_usd:WD}),KD=Q({agent:GD,judge:GD,llmlint:GD,total:GD}),qD=Q({session_id:Z().min(1),history_id:Z().min(1).nullable().optional(),role:UD,agent_role:HD.optional(),turn_index:kD.nullable().optional(),started_at:AD.optional(),finished_at:AD.nullable().optional()}),JD=tD(Z(),UE()),YD=rD([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),XD=rD([`agent`,`judge`,`llmlint`]),ZD=rD([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),QD=Q({side:XD.optional(),harness:Z().optional(),variant:Z().optional(),identity:Z().optional(),cause:ZD.optional(),raw_tail:Z().optional(),reset_time:Z().optional(),missing_session_id:Z().optional(),wait_seconds:LE().nonnegative().optional(),failure_kind:Z().optional(),structured_error:JD.optional(),judge_unrecorded:VE().optional()}).extend({class:YD,detail:Z().optional()}),$D=Q({node:Z().min(1),status:Z().min(1),outcome:Z().min(1).optional(),branch:Z().min(1).optional(),comparison_remote:Z().min(1).optional(),comparison_base:Z().min(1).optional(),checkpoint:Z().min(1).optional(),commit:Z().min(1).optional(),retry_lineage:JD.optional(),gate_attestation:JD.optional(),failure:QD.optional(),timing:VD.optional(),usage:KD.optional(),sessions:qE(qD),tool_commands:tD(Z(),kD).optional(),turns:kD,lint:kD,timing_quality:ID,linkage_quality:LD,timing_presence:RD}),eO=Q({run_id:Z().min(1),state:Z().min(1),phase:Z().min(1),last_event:jD,last_progress_at:OD.optional(),timing:VD,nodes:qE($D),providers:qE(JD).optional(),failure:QD.optional(),check_rollup:JD.optional(),usage:KD,timing_quality:ID,linkage_quality:LD,timing_presence:RD,sources:qE(Z()),node_work_ms:Q({agent_model_ms:BD,judge_model_ms:BD,llmlint_model_ms:BD,tool_ms:BD,wall_ms:BD}),turns:kD,lint:kD}),tO=Q({schema_version:ZE([Z(),LE()]).optional(),observed_at:Z().optional(),identities:qE(JD)}),nO=Q({launch_id:Z().min(1),launcher:rD([`claude-code`,`codex`,`unknown`]),session_key:Z().min(1).optional(),launcher_session_id:Z().min(1).optional()}),rO=Q({run_id:Z().min(1),state:Z().min(1),phase:Z().min(1),last_event:jD,last_progress_at:OD.optional(),timing_quality:ID,linkage_quality:LD,timing:VD,node_counts:tD(Z(),kD),launch:nO.optional()}),iO=Q({api_version:aD(2),telemetry_schema_version:aD(14),observed_at:AD,runs:qE(rO),next_cursor:Z().min(1).optional(),provider_health:tO.optional()}),aO=Q({id:Z().min(1),kind:rD([`agent`,`human`]).optional(),persona:Z().min(1).optional(),task:Z().min(1),deps:qE(Z().min(1)).optional(),max_turns:kD.positive().optional(),expects_no_diff:VE().optional()}),oO=Q({branch:Z().min(1),base_branch:Z().min(1),pr_base:Z().min(1),checkpoint:Z().min(1),completed_steps:qE(Z()).optional(),pr:Z().nullable().optional(),mode:rD([`pause`,`retry`,`continue`]).optional(),attempts:kD.optional()}),sO=Q({branch:Z().min(1),repo:Z().min(1).optional(),identity:Z().min(1).optional(),base_branch:Z().min(1).optional(),pr:Z().min(1).optional(),pr_base:Z().min(1).optional()}),cO=aO.extend({task:Z().min(1).optional(),repo:Z().min(1).optional(),steps:qE(aO).min(1).optional(),session:Z().min(1).optional(),project_dir:Z().min(1).optional(),base_branch:Z().min(1).optional(),branch:Z().min(1).optional(),title:Z().min(1).optional(),verify_cmd:Z().min(1).optional(),skip_verify:VE().optional(),verify_via_ci:VE().optional(),merge_policy:rD([`auto`,`direct`,`none`]).optional(),workflow:rD([`local`,`remote`]).optional(),repo_type:rD([`single-owner`,`team`]).optional(),execution_checkout:Z().min(1).optional(),stack_bases:qE(sO).optional(),resume:oO.optional()}).superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),lO=Q({gate_log:Z().optional(),worker_report:Z().optional(),oneharness_session:Z().optional()}),uO=Q({id:Z().min(1),kind:Z().min(1),persona:Z().nullable(),status:Z().min(1),telemetry:JD.optional(),artifacts:lO.optional()}),dO=Q({ref:Z().min(1),task:Z(),unblocks:qE(Z()),unblocks_publication:VE()}),fO=Q({branch:Z().min(1),base_branch:Z().min(1),pr_base:Z(),checkpoint:Z().min(1),completed_steps:qE(Z()),pr:Z().nullable(),mode:Z().optional()}),pO=Q({kind:Z().optional(),status:Z().optional(),task:Z().optional(),unblocks:qE(Z()).optional(),blocked_by:qE(Z()).optional(),human_actions:qE(dO).optional(),completed:VE().optional(),exit_code:LE().int().nullable().optional(),verdicts:qE(UE()).optional(),usage:JD.optional(),telemetry:JD.optional(),repo:Z().optional(),branch:Z().optional(),commit:Z().optional(),base_branch:Z().optional(),pr_base:Z().optional(),synthetic_stack_base:Z().nullable().optional(),stack_bases:qE(JD).optional(),repository_type:rD([`single-owner`,`team`]).nullable().optional(),repo_type:rD([`single-owner`,`team`]).nullable().optional(),publication_workflow:rD([`local`,`remote`]).nullable().optional(),workflow:rD([`local`,`remote`]).nullable().optional(),merge_policy:rD([`auto`,`direct`,`none`]).nullable().optional(),outcome:Z().optional(),ok:VE().optional(),pr:Z().nullable().optional(),detail:Z().optional(),follow_ups:Z().nullable().optional(),steps:qE(uO).optional(),waiting_steps:qE(Z()).optional(),resume:fO.nullable().optional(),error:Z().nullable().optional(),retry_lineage:JD.optional(),deferred_cleanup:qE(Z()).optional(),artifacts:lO.optional()}),mO=Q({ok:VE().optional(),state:Z().optional(),started_order:qE(Z()).optional(),results:tD(Z(),pO).optional(),schema_version:kD.optional()}),hO=rD([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),gO=rD([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),_O=Q({addressable:VE(),member:Z().min(1).optional(),reason:Z().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),vO=Q({id:Z().min(1),kind:Z(),unblocks:qE(Z().min(1))}),yO=Q({run_id:Z().min(1),plan:Q({tasks:qE(cO),schema_version:kD.optional(),concurrency:kD.positive().optional(),name:Z().min(1).optional(),goal:Q({id:Z().min(1),text:Z().min(1)}).optional()}),node_states:tD(Z(),hO),node_status:tD(Z(),gO),node_gated_by:tD(Z(),qE(Z().min(1))),node_control:tD(Z(),_O),node_results:tD(Z(),pO),decisions:qE(vO),attestations:qE(Z()),result:mO.nullable(),last_seq:kD}).superRefine((e,t)=>{let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}),bO=Q({cacheReadTokens:WD.optional(),cacheWriteTokens:WD.optional(),costUsd:WD.optional(),inputTokens:WD.optional(),outputTokens:WD.optional()}),xO=Q({index:kD,input:UE().optional(),kind:Z(),name:Z().nullable().optional(),output:Z().nullable().optional()}),SO=Q({assistant:Z().nullable(),durationMs:WD.optional(),failureKind:Z().nullable(),finishedAt:AD.nullable().optional(),harness:Z(),id:Z(),model:Z().nullable(),modelMs:WD.optional(),reasoning:Z().nullable(),startedAt:AD.nullable().optional(),status:Z(),timestamp:AD,toolMs:WD.optional(),tools:qE(xO),unknown:JD,usage:bO,user:Z()}),CO=Q({conversation:Q({canContinue:VE(),harnesses:qE(Z()),id:Z().min(1),name:Z(),project:Z(),startedAt:AD,state:Z(),turns:qE(SO)}),attribution:Q({runId:Z().optional(),nodeId:Z().optional(),stepId:Z().optional(),launchId:Z().optional(),launcher:rD([`claude-code`,`codex`,`unknown`]).optional(),transportRole:UD,agentRole:HD,parentConversationId:Z().optional(),persona:Z().optional(),finishedAt:AD.nullable().optional(),inferred:aD(!0).optional(),timing:VD.optional()})}),wO=Q({node:Z().optional(),conversations:qE(CO)}),TO=ZE([qE(CO),qE(wO).transform(e=>e.flatMap(e=>e.conversations))]),EO=Q({name:Z(),state:Z(),required:VE(),url:Z().url().optional()}),DO=Q({ok:VE(),output_tail:Z(),artifact_id:Z().min(1).optional()}),OO=Q({verification:Q({pre_push_hook:VE().optional(),required_checks:qE(Z()).optional(),required_checks_status:Z().optional(),expected_gate:qE(Z()).optional(),checks:qE(EO).optional(),records:qE(DO)}),publication:Q({pr_url:Z().url().optional(),branch:Z().optional(),branch_url:Z().url().optional(),merged:VE(),base_branch:Z().optional(),commit:Z().optional(),commit_url:Z().url().optional()}).optional()}),kO=Q({api_version:aD(2),telemetry_schema_version:aD(14),observed_at:AD,run:eO,graph:yO.nullable(),conversations:TO,node_details:tD(Z(),OO).optional().default({}),launch:nO.optional(),provider_health:tO.optional()}),AO=rD([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),jO=rD([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`]),MO=rD([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),NO=Q({kind:AO,value:Z().min(1)}),PO=Q({delivered:VE(),delivery:rD([`live`,`deferred`]).optional(),member:Z().min(1).optional(),input_bytes:kD.optional(),reason:Z().min(1).optional(),node_id:Z().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),FO=Q({id:Z().min(1),kind:Z().min(1),at:AD,node_id:Z().min(1).optional(),step_id:Z().min(1).optional(),status:Z().min(1).optional(),author:Z().min(1).optional(),redirection:PO.optional(),reference:NO.optional()}),IO=Q({started_at:AD,ended_at:AD}),LO=Q({id:Z().min(1),kind:jO,label:Z(),started_at:AD,ended_at:AD.nullable(),events:qE(FO),parent_id:Z().min(1).optional(),node_id:Z().min(1).optional(),step_id:Z().min(1).optional(),status:Z().min(1).optional(),count:kD.optional(),total_duration_ms:kD.optional(),intervals:qE(IO).optional(),agent_role:HD.optional(),transport_role:UD.optional(),dispatch_id:Z().min(1).optional(),reference:NO.optional(),detail:Q({ok:VE().optional(),output_tail:Z().optional(),artifact_id:Z().optional()}).optional(),phase:MO.optional()}),RO=Q({id:Z().min(1),kind:AO,content:Z(),truncated:VE()}),zO=Q({api_version:aD(2),timeline_schema_version:aD(6),observed_at:AD,run_id:Z().min(1),spans:qE(LO)}),BO=Q({error:Q({code:Z(),message:Z()})});Q({schema_version:aD(1),launch_id:Z().min(1),launcher:rD([`claude-code`,`codex`]),launcher_session_id:Z().min(1),started_at:AD,repository_identity:Z().min(1)});var VO=rD([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),HO=JD,UO=qE(YE({node:Z().min(1),step:Z().min(1).optional(),at:LE().finite(),kind:Z(),name:Z(),detail:Z(),events:LE().int().nonnegative()})),WO=e=>iO.parse(e),GO=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},KO=50,qO=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=KO){let r=this.#r(MD.runs);return r.searchParams.set(ND.includeSettled,String(e)),r.searchParams.set(ND.limit,String(n)),t!==void 0&&r.searchParams.set(ND.cursor,t),this.#i(r,iO.parse)}async getRun(e,t={}){JO(e,`run ID`);let n=this.#r(MD.run(e));return t.includeConversations!==void 0&&n.searchParams.set(ND.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(ND.filter,t.filter),this.#i(n,kO.parse)}async getTimeline(e,t,n){JO(e,`run ID`);let r=this.#r(MD.timeline(e));return n!==void 0&&r.searchParams.set(ND.filter,n),t===void 0?r.searchParams.set(ND.scope,PD.run):(r.searchParams.set(ND.scope,PD.node),r.searchParams.set(ND.node,t)),this.#i(r,zO.parse)}async getConversation(e,t){return JO(e,`run ID`),JO(t,`conversation ID`),this.#i(this.#r(MD.conversation(e,t)),CO.parse)}async getArtifact(e,t){return JO(e,`run ID`),JO(t,`artifact ID`),this.#i(this.#r(MD.artifact(e,t)),RO.parse)}subscribe(e){e.runId!==void 0&&JO(e.runId,`run ID`),e.after!==void 0&&JO(e.after,`cursor`);let t=this.#r(MD.events);e.runId!==void 0&&t.searchParams.set(ND.runId,e.runId),e.after!==void 0&&t.searchParams.set(ND.after,e.after),e.filter!==void 0&&t.searchParams.set(ND.filter,e.filter);let n=(this.#n??(e=>{if(typeof EventSource>`u`)throw new GO(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(t.toString());for(let t of VO.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?iO.parse(i):HO.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}#r(e){return new URL(e,this.#e)}async#i(e,t){let n;try{n=await this.#t(e)}catch(e){throw new GO(`Telemetry request failed`,void 0,void 0,{cause:e})}let r=await n.json().catch(e=>{throw new GO(`Telemetry server returned invalid JSON`,n.status,void 0,{cause:e})});if(!n.ok){let e=BO.safeParse(r);throw new GO(e.success?e.data.error.message:`Telemetry request failed with status ${n.status}`,n.status,e.success?e.data.error.code:void 0)}try{return t(r)}catch(e){throw new GO(`Telemetry response failed contract validation`,n.status,void 0,{cause:e})}}};function JO(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new GO(`Invalid ${t}`)}var YO=o(((e,t)=>{var n=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,s=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?i:this._defaultEdgeLabelFn(e,t,n);var u=o(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n),o=this._edgeObjs[r];return o&&(e=o.v,t=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function a(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=n})),XO=o(((e,t)=>{t.exports=`2.2.4`})),ZO=o(((e,t)=>{t.exports={Graph:YO(),version:XO()}})),QO=o(((e,t)=>{var n=YO();t.exports={write:r,read:o};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function o(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),$O=o(((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}})),ek=o(((e,t)=>{t.exports=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}})),tk=o(((e,t)=>{var n=ek();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}})),nk=o(((e,t)=>{var n=tk();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),rk=o(((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}})),ik=o(((e,t)=>{var n=rk();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),ak=o(((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),ok=o(((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r})),sk=o(((e,t)=>{var n=ok();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),ck=o(((e,t)=>{t.exports=n;function n(e,t,n){Array.isArray(t)||(t=[t]);var a=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?r:i,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,a,c,s)}),s}function r(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),a(t(o[0]),e=>i.push([e,!1])))}}function i(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),a(t(o),e=>i.push(e)))}}function a(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),lk=o(((e,t)=>{var n=ck();t.exports=r;function r(e,t){return n(e,t,`post`)}})),uk=o(((e,t)=>{var n=ck();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),dk=o(((e,t)=>{var n=YO(),r=ek();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return i}})),fk=o(((e,t)=>{t.exports={components:$O(),dijkstra:tk(),dijkstraAll:nk(),findCycles:ik(),floydWarshall:ak(),isAcyclic:sk(),postorder:lk(),preorder:uk(),prim:dk(),tarjan:rk(),topsort:ok()}})),pk=o(((e,t)=>{var n=ZO();t.exports={Graph:n.Graph,json:QO(),alg:fk(),version:n.version}})),mk=o(((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n})),hk=o(((e,t)=>{var n=pk().Graph,r=mk();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),gk=o(((e,t)=>{var n=pk().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),_k=o(((e,t)=>{var n=hk(),r=gk().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),vk=o(((e,t)=>{var n=gk();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),yk=o(((e,t)=>{var{applyWithChunking:n}=gk();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),bk=o(((e,t)=>{var n=pk().Graph,r=yk().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),xk=o(((e,t)=>{var n=bk(),r=yk().slack,i=yk().longestPath,a=pk().alg.preorder,o=pk().alg.postorder,s=gk().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),Sk=o(((e,t)=>{var n=yk().longestPath,r=bk(),i=xk();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}})),Ck=o(((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}})),wk=o(((e,t)=>{var n=gk();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),Tk=o(((e,t)=>{var n=gk();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),Ek=o(((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}})),Dk=o(((e,t)=>{var n=gk();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}})),Ok=o(((e,t)=>{var n=gk().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),kk=o(((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),Ak=o(((e,t)=>{var n=gk();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),jk=o(((e,t)=>{var n=gk();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),Mk=o(((e,t)=>{var n=kk(),r=Ak(),i=jk();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),Nk=o(((e,t)=>{var n=pk().Graph,r=gk();t.exports=i;function i(e,t,r){let i=a(e),o=new n({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return e.nodes().forEach(n=>{let a=e.node(n),s=e.parent(n);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(n),o.setParent(n,s||i),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=o.edge(r,n),a=i===void 0?0:i.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(a,`minRank`)&&o.setNode(n,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),Pk=o(((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),Fk=o(((e,t)=>{var n=Dk(),r=Ok(),i=Mk(),a=Nk(),o=Pk(),s=pk().Graph,c=gk();t.exports=l;function l(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t&&t.disableOptimalOrderHeuristic)return;let p=1/0,m;for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<p&&(n=0,m=Object.assign({},s),p=i)}f(e,m)}function u(e,t,n){return t.map(function(t){return a(e,t,n)})}function d(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),Ik=o(((e,t)=>{var n=pk().Graph,r=gk();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}})),Lk=o(((e,t)=>{var n=gk(),r=Ik().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),Rk=o(((e,t)=>{var n=_k(),r=vk(),i=Sk(),a=gk().normalizeRanks,o=Ck(),s=gk().removeEmptyRanks,c=wk(),l=Tk(),u=Ek(),d=Fk(),f=Lk(),p=gk(),m=pk().Graph;t.exports=h;function h(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r))})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>F(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>I(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>L(e)),t(` removeBorderNodes`,()=>ee(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},b=[`acyclicer`,`ranker`,`rankdir`,`align`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=ne(e.graph());return t.setGraph(Object.assign({},y,te(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=te(ne(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=ne(e.edge(n));t.setEdge(n,Object.assign({},w,te(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function ee(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function F(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function I(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function L(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function te(e,t){return p.mapValues(p.pick(e,t),Number)}function ne(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),zk=o(((e,t)=>{var n=gk(),r=pk().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),Bk=o(((e,t)=>{t.exports=`1.1.5`})),Vk=l(o(((e,t)=>{t.exports={graphlib:pk(),layout:Rk(),debug:zk(),util:{time:gk().time,notime:gk().notime},version:Bk()}}))(),1),Hk=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],Uk=200,Wk=72,Gk=80,Kk=32,qk=new Set(Hk),Jk={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},Yk=(e,t)=>e<t?-1:+(e>t);function Xk(e){let t=[...e.nodes].sort((e,t)=>Yk(e.id,t.id)),n=[...e.edges].sort((e,t)=>Yk(e.id,t.id)),r=new Map(t.map(e=>[e.id,e]));if(r.size!==t.length)throw Error(`DAG node IDs must be unique`);for(let e of t)if(!qk.has(e.state))throw Error(`DAG node ${e.id} has unsupported state ${e.state}`);let i=new Map(t.map(e=>[e.id,0])),a=new Map(t.map(e=>[e.id,[]])),o=new Set;for(let e of n){if(o.has(e.id))throw Error(`DAG edge IDs must be unique`);if(o.add(e.id),!r.has(e.source)||!r.has(e.target))throw Error(`DAG edge ${e.id} has a missing endpoint`);if(e.source===e.target)throw Error(`DAG edge ${e.id} is a self-edge`);i.set(e.target,(i.get(e.target)??0)+1),a.get(e.source)?.push(e.target)}let s=new Map,c=t.filter(e=>i.get(e.id)===0).map(e=>e.id),l=0;for(;c.length>0;){let e=c;c=[];for(let t of e){l+=1;let e=s.get(t)??0;for(let n of a.get(t)??[]){s.set(n,Math.max(s.get(n)??0,e+1));let t=(i.get(n)??0)-1;i.set(n,t),t===0&&c.push(n)}}c.sort()}if(l!==t.length)throw Error(`DAG contains a cycle`);let u=new Vk.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:Gk,nodesep:Kk,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:Uk,height:Wk});for(let e of n)u.setEdge(e.source,e.target,{},e.id);Vk.default.layout(u);let d=new Map;for(let e of t){let t=s.get(e.id)??0,n=d.get(t)??[];n.push(e.id),d.set(t,n)}for(let e of d.values())e.sort((e,t)=>(u.node(e)?.y??0)-(u.node(t)?.y??0)||Yk(e,t));let f=t.map(e=>{let t=s.get(e.id)??0,n=d.get(t)?.indexOf(e.id)??0;return{...e,x:t*280,y:n*104,width:Uk,height:Wk,style:Jk[e.state]}}),p=new Map(f.map(e=>[e.id,e])),m=n.map(e=>{let t=p.get(e.source),n=p.get(e.target);if(!t||!n)throw Error(`DAG layout lost an edge endpoint`);let r={x:t.x+t.width,y:t.y+t.height/2},i={x:n.x,y:n.y+n.height/2},a=Math.round((r.x+i.x)/2);return{...e,points:[r,{x:a,y:r.y},{x:a,y:i.y},i]}});return{width:f.length===0?0:Math.max(...f.map(e=>e.x+e.width)),height:f.length===0?0:Math.max(...f.map(e=>e.y+e.height)),nodes:f,edges:m}}function Zk(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Zk(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var Qk={value:()=>{}};function $k(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new eA(n)}function eA(e){this._=e}function tA(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}eA.prototype=$k.prototype={constructor:eA,on:function(e,t){var n=this._,r=tA(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=nA(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=rA(n[i],e.name,t);else if(t==null)for(i in n)n[i]=rA(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new eA(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function nA(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function rA(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Qk,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var iA={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function aA(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),iA.hasOwnProperty(t)?{space:iA[t],local:e}:e}function oA(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function sA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cA(e){var t=aA(e);return(t.local?sA:oA)(t)}function lA(){}function uA(e){return e==null?lA:function(){return this.querySelector(e)}}function dA(e){typeof e!=`function`&&(e=uA(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new $j(r,this._parents)}function fA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pA(){return[]}function mA(e){return e==null?pA:function(){return this.querySelectorAll(e)}}function hA(e){return function(){return fA(e.apply(this,arguments))}}function gA(e){e=typeof e==`function`?hA(e):mA(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new $j(r,i)}function _A(e){return function(){return this.matches(e)}}function vA(e){return function(t){return t.matches(e)}}var yA=Array.prototype.find;function bA(e){return function(){return yA.call(this.children,e)}}function xA(){return this.firstElementChild}function SA(e){return this.select(e==null?xA:bA(typeof e==`function`?e:vA(e)))}var CA=Array.prototype.filter;function wA(){return Array.from(this.children)}function TA(e){return function(){return CA.call(this.children,e)}}function EA(e){return this.selectAll(e==null?wA:TA(typeof e==`function`?e:vA(e)))}function DA(e){typeof e!=`function`&&(e=_A(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new $j(r,this._parents)}function OA(e){return Array(e.length)}function kA(){return new $j(this._enter||this._groups.map(OA),this._parents)}function AA(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}AA.prototype={constructor:AA,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function jA(e){return function(){return e}}function MA(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new AA(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function NA(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new AA(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function PA(e){return e.__data__}function FA(e,t){if(!arguments.length)return Array.from(this,PA);var n=t?NA:MA,r=this._parents,i=this._groups;typeof e!=`function`&&(e=jA(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=IA(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new $j(o,r),o._enter=s,o._exit=c,o}function IA(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function LA(){return new $j(this._exit||this._groups.map(OA),this._parents)}function RA(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function zA(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new $j(s,this._parents)}function BA(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function VA(e){e||=HA;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new $j(i,this._parents).order()}function HA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function UA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WA(){return Array.from(this)}function GA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function KA(){let e=0;for(let t of this)++e;return e}function qA(){return!this.node()}function JA(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function YA(e){return function(){this.removeAttribute(e)}}function XA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ZA(e,t){return function(){this.setAttribute(e,t)}}function QA(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $A(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ej(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function tj(e,t){var n=aA(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?XA:YA:typeof t==`function`?n.local?ej:$A:n.local?QA:ZA)(n,t))}function nj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rj(e){return function(){this.style.removeProperty(e)}}function ij(e,t,n){return function(){this.style.setProperty(e,t,n)}}function aj(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function oj(e,t,n){return arguments.length>1?this.each((t==null?rj:typeof t==`function`?aj:ij)(e,t,n??``)):sj(this.node(),e)}function sj(e,t){return e.style.getPropertyValue(t)||nj(e).getComputedStyle(e,null).getPropertyValue(t)}function cj(e){return function(){delete this[e]}}function lj(e,t){return function(){this[e]=t}}function uj(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function dj(e,t){return arguments.length>1?this.each((t==null?cj:typeof t==`function`?uj:lj)(e,t)):this.node()[e]}function fj(e){return e.trim().split(/^|\s+/)}function pj(e){return e.classList||new mj(e)}function mj(e){this._node=e,this._names=fj(e.getAttribute(`class`)||``)}mj.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function hj(e,t){for(var n=pj(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function gj(e,t){for(var n=pj(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function _j(e){return function(){hj(this,e)}}function vj(e){return function(){gj(this,e)}}function yj(e,t){return function(){(t.apply(this,arguments)?hj:gj)(this,e)}}function bj(e,t){var n=fj(e+``);if(arguments.length<2){for(var r=pj(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?yj:t?_j:vj)(n,t))}function xj(){this.textContent=``}function Sj(e){return function(){this.textContent=e}}function Cj(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function wj(e){return arguments.length?this.each(e==null?xj:(typeof e==`function`?Cj:Sj)(e)):this.node().textContent}function Tj(){this.innerHTML=``}function Ej(e){return function(){this.innerHTML=e}}function Dj(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Oj(e){return arguments.length?this.each(e==null?Tj:(typeof e==`function`?Dj:Ej)(e)):this.node().innerHTML}function kj(){this.nextSibling&&this.parentNode.appendChild(this)}function Aj(){return this.each(kj)}function jj(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mj(){return this.each(jj)}function Nj(e){var t=typeof e==`function`?e:cA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pj(){return null}function Fj(e,t){var n=typeof e==`function`?e:cA(e),r=t==null?Pj:typeof t==`function`?t:uA(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Ij(){var e=this.parentNode;e&&e.removeChild(this)}function Lj(){return this.each(Ij)}function Rj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bj(e){return this.select(e?zj:Rj)}function Vj(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Hj(e){return function(t){e.call(this,t,this.__data__)}}function Uj(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Wj(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Gj(e,t,n){return function(){var r=this.__on,i,a=Hj(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Kj(e,t,n){var r=Uj(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Gj:Wj,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function qj(e,t,n){var r=nj(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Jj(e,t){return function(){return qj(this,e,t)}}function Yj(e,t){return function(){return qj(this,e,t.apply(this,arguments))}}function Xj(e,t){return this.each((typeof t==`function`?Yj:Jj)(e,t))}function*Zj(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Qj=[null];function $j(e,t){this._groups=e,this._parents=t}function eM(){return new $j([[document.documentElement]],Qj)}function tM(){return this}$j.prototype=eM.prototype={constructor:$j,select:dA,selectAll:gA,selectChild:SA,selectChildren:EA,filter:DA,data:FA,enter:kA,exit:LA,join:RA,merge:zA,selection:tM,order:BA,sort:VA,call:UA,nodes:WA,node:GA,size:KA,empty:qA,each:JA,attr:tj,style:oj,property:dj,classed:bj,text:wj,html:Oj,raise:Aj,lower:Mj,append:Nj,insert:Fj,remove:Lj,clone:Bj,datum:Vj,on:Kj,dispatch:Xj,[Symbol.iterator]:Zj};function nM(e){return typeof e==`string`?new $j([[document.querySelector(e)]],[document.documentElement]):new $j([[e]],Qj)}function rM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function iM(e,t){if(e=rM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var aM={passive:!1},oM={capture:!0,passive:!1};function sM(e){e.stopImmediatePropagation()}function cM(e){e.preventDefault(),e.stopImmediatePropagation()}function lM(e){var t=e.document.documentElement,n=nM(e).on(`dragstart.drag`,cM,oM);`onselectstart`in t?n.on(`selectstart.drag`,cM,oM):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function uM(e,t){var n=e.document.documentElement,r=nM(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,cM,oM),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var dM=e=>()=>e;function fM(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}fM.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pM(e){return!e.ctrlKey&&!e.button}function mM(){return this.parentNode}function hM(e,t){return t??{x:e.x,y:e.y}}function gM(){return navigator.maxTouchPoints||`ontouchstart`in this}function _M(){var e=pM,t=mM,n=hM,r=gM,i={},a=$k(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,aM).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(nM(n.view).on(`mousemove.drag`,m,oM).on(`mouseup.drag`,h,oM),lM(n.view),sM(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(cM(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){nM(e.view).on(`mousemove.drag mouseup.drag`,null),uM(e.view,l),cM(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(sM(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(cM(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(sM(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=iM(l||r,t),p,m,h;if((h=n.call(e,new fM(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=iM(l||a,t),_=o;break}u.call(r,e,new fM(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:dM(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:dM(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:dM(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:dM(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function vM(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function yM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function bM(){}var xM=.7,SM=1/xM,CM=`\\s*([+-]?\\d+)\\s*`,wM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,TM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,EM=/^#([0-9a-f]{3,8})$/,DM=RegExp(`^rgb\\(${CM},${CM},${CM}\\)$`),OM=RegExp(`^rgb\\(${TM},${TM},${TM}\\)$`),kM=RegExp(`^rgba\\(${CM},${CM},${CM},${wM}\\)$`),AM=RegExp(`^rgba\\(${TM},${TM},${TM},${wM}\\)$`),jM=RegExp(`^hsl\\(${wM},${TM},${TM}\\)$`),MM=RegExp(`^hsla\\(${wM},${TM},${TM},${wM}\\)$`),NM={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};vM(bM,RM,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:PM,formatHex:PM,formatHex8:FM,formatHsl:IM,formatRgb:LM,toString:LM});function PM(){return this.rgb().formatHex()}function FM(){return this.rgb().formatHex8()}function IM(){return ZM(this).formatHsl()}function LM(){return this.rgb().formatRgb()}function RM(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=EM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?zM(t):n===3?new UM(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?BM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?BM(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=DM.exec(e))?new UM(t[1],t[2],t[3],1):(t=OM.exec(e))?new UM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kM.exec(e))?BM(t[1],t[2],t[3],t[4]):(t=AM.exec(e))?BM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jM.exec(e))?XM(t[1],t[2]/100,t[3]/100,1):(t=MM.exec(e))?XM(t[1],t[2]/100,t[3]/100,t[4]):NM.hasOwnProperty(e)?zM(NM[e]):e===`transparent`?new UM(NaN,NaN,NaN,0):null}function zM(e){return new UM(e>>16&255,e>>8&255,e&255,1)}function BM(e,t,n,r){return r<=0&&(e=t=n=NaN),new UM(e,t,n,r)}function VM(e){return e instanceof bM||(e=RM(e)),e?(e=e.rgb(),new UM(e.r,e.g,e.b,e.opacity)):new UM}function HM(e,t,n,r){return arguments.length===1?VM(e):new UM(e,t,n,r??1)}function UM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}vM(UM,HM,yM(bM,{brighter(e){return e=e==null?SM:SM**+e,new UM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xM:xM**+e,new UM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new UM(JM(this.r),JM(this.g),JM(this.b),qM(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:WM,formatHex:WM,formatHex8:GM,formatRgb:KM,toString:KM}));function WM(){return`#${YM(this.r)}${YM(this.g)}${YM(this.b)}`}function GM(){return`#${YM(this.r)}${YM(this.g)}${YM(this.b)}${YM((isNaN(this.opacity)?1:this.opacity)*255)}`}function KM(){let e=qM(this.opacity);return`${e===1?`rgb(`:`rgba(`}${JM(this.r)}, ${JM(this.g)}, ${JM(this.b)}${e===1?`)`:`, ${e})`}`}function qM(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function JM(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function YM(e){return e=JM(e),(e<16?`0`:``)+e.toString(16)}function XM(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $M(e,t,n,r)}function ZM(e){if(e instanceof $M)return new $M(e.h,e.s,e.l,e.opacity);if(e instanceof bM||(e=RM(e)),!e)return new $M;if(e instanceof $M)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new $M(o,s,c,e.opacity)}function QM(e,t,n,r){return arguments.length===1?ZM(e):new $M(e,t,n,r??1)}function $M(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}vM($M,QM,yM(bM,{brighter(e){return e=e==null?SM:SM**+e,new $M(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xM:xM**+e,new $M(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new UM(nN(e>=240?e-240:e+120,i,r),nN(e,i,r),nN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new $M(eN(this.h),tN(this.s),tN(this.l),qM(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(){let e=qM(this.opacity);return`${e===1?`hsl(`:`hsla(`}${eN(this.h)}, ${tN(this.s)*100}%, ${tN(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function eN(e){return e=(e||0)%360,e<0?e+360:e}function tN(e){return Math.max(0,Math.min(1,e||0))}function nN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var rN=e=>()=>e;function iN(e,t){return function(n){return e+n*t}}function aN(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function oN(e){return(e=+e)==1?sN:function(t,n){return n-t?aN(t,n,e):rN(isNaN(t)?n:t)}}function sN(e,t){var n=t-e;return n?iN(e,n):rN(isNaN(e)?t:e)}var cN=(function e(t){var n=oN(t);function r(e,t){var r=n((e=HM(e)).r,(t=HM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=sN(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function lN(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function uN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dN(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=bN(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function fN(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function pN(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mN(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=bN(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var hN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gN=new RegExp(hN.source,`g`);function _N(e){return function(){return e}}function vN(e){return function(t){return e(t)+``}}function yN(e,t){var n=hN.lastIndex=gN.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=hN.exec(e))&&(i=gN.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:pN(r,i)})),n=gN.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?vN(c[0].x):_N(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function bN(e,t){var n=typeof t,r;return t==null||n===`boolean`?rN(t):(n===`number`?pN:n===`string`?(r=RM(t))?(t=r,cN):yN:t instanceof RM?cN:t instanceof Date?fN:uN(t)?lN:Array.isArray(t)?dN:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?mN:pN)(e,t)}var xN=180/Math.PI,SN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CN(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*xN,skewX:Math.atan(c)*xN,scaleX:o,scaleY:s}}var wN;function TN(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?SN:CN(t.a,t.b,t.c,t.d,t.e,t.f)}function EN(e){return e==null||(wN||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),wN.setAttribute(`transform`,e),!(e=wN.transform.baseVal.consolidate()))?SN:(e=e.matrix,CN(e.a,e.b,e.c,e.d,e.e,e.f))}function DN(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:pN(e,i)},{i:c-2,x:pN(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:pN(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:pN(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:pN(e,n)},{i:s-2,x:pN(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ON=DN(TN,`px, `,`px)`,`deg)`),kN=DN(EN,`, `,`)`,`)`),AN=1e-12;function jN(e){return((e=Math.exp(e))+1/e)/2}function MN(e){return((e=Math.exp(e))-1/e)/2}function NN(e){return((e=Math.exp(2*e))-1)/(e+1)}var PN=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<AN)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=jN(y),c=s/(n*g)*(i*NN(t*r+y)-MN(y));return[a+c*d,o+c*f,s*i/jN(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),FN=0,IN=0,LN=0,RN=1e3,zN,BN,VN=0,HN=0,UN=0,WN=typeof performance==`object`&&performance.now?performance:Date,GN=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function KN(){return HN||=(GN(qN),WN.now()+UN)}function qN(){HN=0}function JN(){this._call=this._time=this._next=null}JN.prototype=YN.prototype={constructor:JN,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?KN():+n)+(t==null?0:+t),!this._next&&BN!==this&&(BN?BN._next=this:zN=this,BN=this),this._call=e,this._time=n,eP()},stop:function(){this._call&&(this._call=null,this._time=1/0,eP())}};function YN(e,t,n){var r=new JN;return r.restart(e,t,n),r}function XN(){KN(),++FN;for(var e=zN,t;e;)(t=HN-e._time)>=0&&e._call.call(void 0,t),e=e._next;--FN}function ZN(){HN=(VN=WN.now())+UN,FN=IN=0;try{XN()}finally{FN=0,$N(),HN=0}}function QN(){var e=WN.now(),t=e-VN;t>RN&&(UN-=t,VN=e)}function $N(){for(var e,t=zN,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:zN=n);BN=e,eP(r)}function eP(e){FN||(IN&&=clearTimeout(IN),e-HN>24?(e<1/0&&(IN=setTimeout(ZN,e-WN.now()-UN)),LN&&=clearInterval(LN)):(LN||=(VN=WN.now(),setInterval(QN,RN)),FN=1,GN(ZN)))}function tP(e,t,n){var r=new JN;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var nP=$k(`start`,`end`,`cancel`,`interrupt`),rP=[];function iP(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;cP(e,n,{name:t,index:r,group:i,on:nP,tween:rP,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function aP(e,t){var n=sP(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function oP(e,t){var n=sP(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function sP(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function cP(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=YN(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return tP(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(tP(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function lP(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function uP(e){return this.each(function(){lP(this,e)})}function dP(e,t){var n,r;return function(){var i=oP(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function fP(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=oP(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function pP(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=sP(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?dP:fP)(n,e,t))}function mP(e,t,n){var r=e._id;return e.each(function(){var e=oP(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return sP(e,r).value[t]}}function hP(e,t){var n;return(typeof t==`number`?pN:t instanceof RM?cN:(n=RM(t))?(t=n,cN):yN)(e,t)}function gP(e){return function(){this.removeAttribute(e)}}function _P(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vP(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function yP(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function bP(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function xP(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function SP(e,t){var n=aA(e),r=n===`transform`?kN:hP;return this.attrTween(e,typeof t==`function`?(n.local?xP:bP)(n,r,mP(this,`attr.`+e,t)):t==null?(n.local?_P:gP)(n):(n.local?yP:vP)(n,r,t))}function CP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function wP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function TP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&wP(e,i)),n}return i._value=t,i}function EP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&CP(e,i)),n}return i._value=t,i}function DP(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=aA(e);return this.tween(n,(r.local?TP:EP)(r,t))}function OP(e,t){return function(){aP(this,e).delay=+t.apply(this,arguments)}}function kP(e,t){return t=+t,function(){aP(this,e).delay=t}}function AP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?OP:kP)(t,e)):sP(this.node(),t).delay}function jP(e,t){return function(){oP(this,e).duration=+t.apply(this,arguments)}}function MP(e,t){return t=+t,function(){oP(this,e).duration=t}}function NP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?jP:MP)(t,e)):sP(this.node(),t).duration}function PP(e,t){if(typeof t!=`function`)throw Error();return function(){oP(this,e).ease=t}}function FP(e){var t=this._id;return arguments.length?this.each(PP(t,e)):sP(this.node(),t).ease}function IP(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();oP(this,e).ease=n}}function LP(e){if(typeof e!=`function`)throw Error();return this.each(IP(this._id,e))}function RP(e){typeof e!=`function`&&(e=_A(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new pF(r,this._parents,this._name,this._id)}function zP(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new pF(o,this._parents,this._name,this._id)}function BP(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function VP(e,t,n){var r,i,a=BP(t)?aP:oP;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function HP(e,t){var n=this._id;return arguments.length<2?sP(this.node(),n).on.on(e):this.each(VP(n,e,t))}function UP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function WP(){return this.on(`end.remove`,UP(this._id))}function GP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=uA(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,iP(l[f],t,n,f,l,sP(u,n)));return new pF(a,this._parents,t,n)}function KP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=mA(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=sP(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&iP(p,t,n,h,f,m);a.push(f),o.push(u)}return new pF(a,o,t,n)}var qP=eM.prototype.constructor;function JP(){return new qP(this._groups,this._parents)}function YP(e,t){var n,r,i;return function(){var a=sj(this,e),o=(this.style.removeProperty(e),sj(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function XP(e){return function(){this.style.removeProperty(e)}}function ZP(e,t,n){var r,i=n+``,a;return function(){var o=sj(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function QP(e,t,n){var r,i,a;return function(){var o=sj(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),sj(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function $P(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=oP(this,e),l=c.on,u=c.value[a]==null?s||=XP(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function eF(e,t,n){var r=(e+=``)==`transform`?ON:hP;return t==null?this.styleTween(e,YP(e,r)).on(`end.style.`+e,XP(e)):typeof t==`function`?this.styleTween(e,QP(e,r,mP(this,`style.`+e,t))).each($P(this._id,e)):this.styleTween(e,ZP(e,r,t),n).on(`end.style.`+e,null)}function tF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function nF(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&tF(e,a,n)),r}return a._value=t,a}function rF(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,nF(e,t,n??``))}function iF(e){return function(){this.textContent=e}}function aF(e){return function(){var t=e(this);this.textContent=t??``}}function oF(e){return this.tween(`text`,typeof e==`function`?aF(mP(this,`text`,e)):iF(e==null?``:e+``))}function sF(e){return function(t){this.textContent=e.call(this,t)}}function cF(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&sF(r)),t}return r._value=e,r}function lF(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,cF(e))}function uF(){for(var e=this._name,t=this._id,n=hF(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=sP(c,t);iP(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new pF(r,this._parents,e,n)}function dF(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=oP(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var fF=0;function pF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function mF(e){return eM().transition(e)}function hF(){return++fF}var gF=eM.prototype;pF.prototype=mF.prototype={constructor:pF,select:GP,selectAll:KP,selectChild:gF.selectChild,selectChildren:gF.selectChildren,filter:RP,merge:zP,selection:JP,transition:uF,call:gF.call,nodes:gF.nodes,node:gF.node,size:gF.size,empty:gF.empty,each:gF.each,on:HP,attr:SP,attrTween:DP,style:eF,styleTween:rF,text:oF,textTween:lF,remove:WP,tween:pP,delay:AP,duration:NP,ease:FP,easeVarying:LP,end:dF,[Symbol.iterator]:gF[Symbol.iterator]};function _F(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vF={time:null,delay:0,duration:250,ease:_F};function yF(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function bF(e){var t,n;e instanceof pF?(t=e._id,e=e._name):(t=hF(),(n=vF).time=KN(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&iP(c,e,t,l,o,n||yF(c,t));return new pF(r,this._parents,e,t)}eM.prototype.interrupt=uP,eM.prototype.transition=bF;var xF=e=>()=>e;function SF(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function CF(e,t,n){this.k=e,this.x=t,this.y=n}CF.prototype={constructor:CF,scale:function(e){return e===1?this:new CF(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new CF(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var wF=new CF(1,0,0);TF.prototype=CF.prototype;function TF(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wF;return e.__zoom}function EF(e){e.stopImmediatePropagation()}function DF(e){e.preventDefault(),e.stopImmediatePropagation()}function OF(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function kF(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function AF(){return this.__zoom||wF}function jF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function MF(){return navigator.maxTouchPoints||`ontouchstart`in this}function NF(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function PF(){var e=OF,t=kF,n=NF,r=jF,i=MF,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=PN,l=$k(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,AF).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,AF),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(wF.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new CF(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new CF(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new CF(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=nM(this.that).datum();l.call(e,this.that,new SF(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=iM(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],lP(this),s.start();DF(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=nM(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=iM(t,i),l=t.clientX,u=t.clientY;lM(t.view),EF(t),a.mouse=[c,this.__zoom.invert(c)],lP(this),a.start();function d(e){if(DF(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=iM(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),uM(e.view,a.moved),DF(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=iM(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);DF(r),s>0?nM(this).transition().duration(s).call(x,d,c,r):nM(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(EF(t),s=0;s<i;++s)c=r[s],l=iM(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),lP(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(DF(e),s=0;s<a;++s)c=i[s],l=iM(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(EF(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=iM(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=nM(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:xF(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:xF(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:xF(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:xF([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var FF={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},IF=[[-1/0,-1/0],[1/0,1/0]],LF=[`Enter`,` `,`Escape`],RF={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},zF;(function(e){e.Strict=`strict`,e.Loose=`loose`})(zF||={});var BF;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(BF||={});var VF;(function(e){e.Partial=`partial`,e.Full=`full`})(VF||={});var HF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},UF;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(UF||={});var WF;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(WF||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var GF={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function KF(e){return e===null?null:e?`valid`:`invalid`}var qF=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,JF=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),YF=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),XF=(e,t=[0,0])=>{let{width:n,height:r}=AI(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ZF=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:fI(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):YF(n)?n:t.nodeLookup.get(n.id)),uI(e,i?mI(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),QF=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=uI(n,mI(e)),r=!0)}),r?fI(n):{x:0,y:0,width:0,height:0}},$F=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=gI(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},eI=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function tI(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=AI(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function nI({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=DI(QF(tI(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function rI({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,FF.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&kI(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=kI(d)?oI(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,FF.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function iI({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=eI(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var aI=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),oI=(e={x:0,y:0},t,n)=>({x:aI(e.x,t[0][0],t[1][0]-(n?.width??0)),y:aI(e.y,t[0][1],t[1][1]-(n?.height??0))});function sI(e,t,n){let{width:r,height:i}=AI(n),{x:a,y:o}=n.internals.positionAbsolute;return oI(e,[[a,o],[a+r,o+i]],t)}var cI=(e,t,n)=>e<t?aI(Math.abs(e-t),1,t)/t:e>n?-aI(Math.abs(e-n),1,t)/t:0,lI=(e,t,n=15,r=40)=>[cI(e.x,r,t.width-r)*n,cI(e.y,r,t.height-r)*n],uI=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),dI=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),fI=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),pI=(e,t=[0,0])=>{let{x:n,y:r}=YF(e)?e.internals.positionAbsolute:XF(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},mI=(e,t=[0,0])=>{let{x:n,y:r}=YF(e)?e.internals.positionAbsolute:XF(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},hI=(e,t)=>fI(uI(dI(e),dI(t))),gI=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},_I=(e,t)=>gI(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),vI=e=>yI(e.width)&&yI(e.height)&&yI(e.x)&&yI(e.y),yI=e=>!isNaN(e)&&isFinite(e),bI=(e,t)=>(e,t)=>{},xI=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),SI=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?xI(s,o):s},CI=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function wI(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function TI(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=wI(e,n),i=wI(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=wI(e.top??e.y??0,n),i=wI(e.bottom??e.y??0,n),a=wI(e.left??e.x??0,t),o=wI(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function EI(e,t,n,r,i,a){let{x:o,y:s}=CI(e,[t,n,r]),{x:c,y:l}=CI({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var DI=(e,t,n,r,i,a)=>{let o=TI(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=aI(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=EI(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},OI=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function kI(e){return e!=null&&e!==`parent`}function AI(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function jI(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function MI(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function NI(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function PI(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function FI(e){return{...RF,...e||{}}}function II(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=HI(e),s=SI({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?xI(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var LI=e=>({width:e.offsetWidth,height:e.offsetHeight}),RI=e=>e?.getRootNode?.()||window?.document,zI=[`INPUT`,`SELECT`,`TEXTAREA`];function BI(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?zI.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var VI=e=>`clientX`in e,HI=(e,t)=>{let n=VI(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},UI=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...LI(t)}})};function WI({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function GI(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function KI({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-GI(t-r,a),n];case $.Right:return[t+GI(r-t,a),n];case $.Top:return[t,n-GI(n-i,a)];case $.Bottom:return[t,n+GI(i-n,a)]}}function qI({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=KI({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=KI({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=WI({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function JI({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function YI({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function XI({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=uI(mI(e),mI(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),_I({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},fI(a))>0}var ZI=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,QI=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),$I=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,FF.error006()),t;let r=n.getEdgeId||ZI,i;return i=qF(e)?{...e}:{...e,id:r(e)},QI(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function eL({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=JI({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var tL={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},nL=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},rL=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function iL({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=tL[t],c=tL[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=nL({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=JI({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function aL(e,t,n,r){let i=Math.min(rL(e,t)/2,rL(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function oL({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=iL({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=aL(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function sL(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function cL(e){let{sourceNode:t,targetNode:n}=e;if(!sL(t)||!sL(n))return null;let r=t.internals.handleBounds||lL(t.handles),i=n.internals.handleBounds||lL(n.handles),a=dL(r?.source??[],e.sourceHandle),o=dL(e.connectionMode===zF.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,FF.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=uL(t,a,s),u=uL(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function lL(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function uL(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??AI(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function dL(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function fL(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function pL(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=fL(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var mL=1e3,hL=10,gL={nodeOrigin:[0,0],nodeExtent:IF,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},_L={...gL,checkEquality:!0};function vL(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function yL(e,t,n){let r=vL(gL,n);for(let n of e.values())if(n.parentId)wL(n,e,t,r);else{let e=oI(XF(n,r.nodeOrigin),kI(n.extent)?n.extent:r.nodeExtent,AI(n));n.internals.positionAbsolute=e}}function bL(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function xL(e){return e===`manual`}function SL(e,t,n,r={}){let i=vL(_L,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!xL(i.zIndexMode)?mL:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=oI(XF(u,i.nodeOrigin),kI(u.extent)?u.extent:i.nodeExtent,AI(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:bL(u,e),z:TL(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&wL(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function CL(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function wL(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=vL(gL,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}CL(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*hL),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=EL(e,u,o,s,a&&!xL(c)?mL:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function TL(e,t,n){let r=yI(e.zIndex)?e.zIndex:0;return xL(n)?r:r+(e.selected?t:0)}function EL(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=AI(e),l=XF(e,n),u=kI(e.extent)?oI(l,e.extent,c):l,d=oI({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=sI(d,c,t));let f=TL(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function DL(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=hI(a.get(n.parentId)?.expandedRect??pI(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=AI(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function OL(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=LI(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=kI(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=sI(h,s,n))}else m&&(h=oI(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:UI(`source`,r.nodeElement,p,d,e.id),target:UI(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&wL(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:pI(g,i)}))}}if(f.length>0){let e=DL(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function kL({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function AL(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function jL(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;AL(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),AL(`target`,s,c,e,i,o),t.set(r.id,r)}}function ML(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:ML(n,t):!1}function NL(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function PL(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!ML(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function FL({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function IL({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=xI(a,t);return{x:o.x-a.x,y:o.y-a.y}}function LL({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=nM(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?dI(QF(s)):null,x=v&&l?IL({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:xI(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=rI({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=FL({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=lI(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=II(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=PL(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=FL({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=_M().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=II(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=HI(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=II(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=HI(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=HI(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=FL({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!NL(t,`.${g}`,v))&&(!_||NL(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function RL(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())_I(i,pI(e))>0&&r.push(e);return r}var zL=250;function BL(e,t,n,r){let i=[],a=1/0,o=RL(e,n,t+zL);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=uL(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function VL(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...uL(o,c,c.position,!0)}:c}function HL(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function UL(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var WL=()=>!0;function GL(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=WL,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=RI(e.target),E=0,D,{x:O,y:k}=HI(e),A=HL(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=VL(i,A,r,c,t);if(!N)return;let P=HI(e,j),ee=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=lI(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:uL(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:GF[ne.position],toNode:null,pointer:P};function z(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!M){let{x:t,y:n}=HI(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!ne){ae(e);return}let a=b();P=HI(e,j),D=BL(SI(P,a,!1,[1,1]),n,c,ne),ee||=(te(),!0);let s=KL(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=UL(!!D,s.isValid);let u=c.get(i),f=u?uL(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?CI({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:GF[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function ae(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,ae),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,ae)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,ae),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,ae)}function KL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=WL,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=HI(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=HL(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===zF.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=VL(t,e,a,u,n,!0)}return _}var qL={onPointerDown:GL,isValid:KL};function JL({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=nM(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&OI()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=PF().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:iM}}var YL=e=>({x:e.x,y:e.y,zoom:e.k}),XL=({x:e,y:t,zoom:n})=>wF.translate(e,t).scale(n),ZL=(e,t)=>e.target.closest(`.${t}`),QL=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$L=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,eR=(e,t=0,n=$L,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},tR=e=>{let t=e.ctrlKey&&OI()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nR({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(ZL(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=iM(u),t=d*2**tR(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===BF.Vertical?0:u.deltaX*f,m=i===BF.Horizontal?0:u.deltaY*f;!OI()&&u.shiftKey&&i!==BF.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=YL(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function rR({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=ZL(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function iR({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=YL(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function aR({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&QL(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,YL(a.transform))}}function oR({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&QL(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=YL(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function sR({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(ZL(d,`${l}-flow__node`)||ZL(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||ZL(d,s)&&m||ZL(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function cR({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=PF().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=nM(e).call(f);y({x:i.x,y:i.y,zoom:aI(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(tR);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bN:PN).transform(eR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!yI(E)||E<0?0:E);let k=O?nR({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):rR({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=iR({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=aR({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=oR({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=sR({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=XL(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=XL(e);return await g(n,t),n}function x(e){if(p){let t=XL(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?TF(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bN:PN).scaleTo(eR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bN:PN).scaleBy(eR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!yI(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var lR;(function(e){e.Line=`line`,e.Handle=`handle`})(lR||={});function uR({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function dR(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function fR(e,t){return Math.max(0,t-e)}function pR(e,t){return Math.max(0,e-t)}function mR(e,t,n){return Math.max(0,t-e,e-n)}function hR(e,t){return e?!t:t}function gR(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=mR(E,h,g),j=mR(D,_,v);if(o){let e=0,t=0;c&&w<0?e=fR(y+w+O,o[0][0]):!c&&w>0&&(e=pR(y+E+O,o[1][0])),l&&T<0?t=fR(b+T+k,o[0][1]):!l&&T>0&&(t=pR(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=pR(y+w,s[0][0]):!c&&w<0&&(e=fR(y+E,s[1][0])),l&&T>0?t=pR(b+T,s[0][1]):!l&&T<0&&(t=fR(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=mR(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?pR(b+k+E/C,o[1][1])*C:fR(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?fR(b+E/C,s[1][1])*C:pR(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=mR(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?pR(y+D*C+O,o[1][0])/C:fR(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?fR(y+D*C,s[1][0])/C:pR(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(hR(c,l)?-w:w)/C:w=(hR(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var _R={width:0,height:0,x:0,y:0},vR={..._R,pointerX:0,pointerY:0,aspectRatio:1};function yR(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function bR({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=nM(e),o={controlDirection:dR(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={..._R},h={...vR};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:dR(e)};let g,_=null,v=[],y,b,x,S=!1,C=_M().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=II(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=kI(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=yR(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=II(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=gR(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=uR({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)!==!1&&(S=!0,d?.(e,F),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var xR=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),SR=o(((e,t)=>{t.exports=xR()})),CR=o((e=>{var t=d(),n=SR();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),wR=l(o(((e,t)=>{t.exports=CR()}))(),1),TR=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},ER=e=>e?TR(e):TR,{useDebugValue:DR}=U.default,{useSyncExternalStoreWithSelector:OR}=wR.default,kR=e=>e;function AR(e,t=kR,n){let r=OR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return DR(r),r}var jR=(e,t)=>{let n=ER(e),r=(e,r=t)=>AR(n,e,r);return Object.assign(r,n),r},MR=(e,t)=>e?jR(e,t):jR;function NR(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var PR=(0,U.createContext)(null),FR=PR.Provider,IR=FF.error001(`react`);function LR(e,t){let n=(0,U.useContext)(PR);if(n===null)throw Error(IR);return AR(n,e,t)}function RR(){let e=(0,U.useContext)(PR);if(e===null)throw Error(IR);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var zR={display:`none`},BR={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},VR=`react-flow__node-desc`,HR=`react-flow__edge-desc`,UR=`react-flow__aria-live`,WR=e=>e.ariaLiveMessage,GR=e=>e.ariaLabelConfig;function KR({rfId:e}){let t=LR(WR);return(0,W.jsx)(`div`,{id:`${UR}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:BR,children:t})}function qR({rfId:e,disableKeyboardA11y:t}){let n=LR(GR);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{id:`${VR}-${e}`,style:zR,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,W.jsx)(`div`,{id:`${HR}-${e}`,style:zR,children:n[`edge.a11yDescription.default`]}),!t&&(0,W.jsx)(KR,{rfId:e})]})}var JR=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,W.jsx)(`div`,{className:Zk([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));JR.displayName=`Panel`;var YR=`https://reactflow.dev?utm_source=attribution`;function XR({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,W.jsx)(JR,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${YR}`,children:(0,W.jsx)(`a`,{href:YR,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ZR=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},QR=e=>e.id;function $R(e,t){return NR(e.selectedNodes.map(QR),t.selectedNodes.map(QR))&&NR(e.selectedEdges.map(QR),t.selectedEdges.map(QR))}function ez({onSelectionChange:e}){let t=RR(),{selectedNodes:n,selectedEdges:r}=LR(ZR,$R);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var tz=e=>!!e.onSelectionChangeHandlers;function nz({onSelectionChange:e}){let t=LR(tz);return e||t?(0,W.jsx)(ez,{onSelectionChange:e}):null}var rz=[0,0],iz={x:0,y:0,zoom:1},az=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],oz=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),sz={translateExtent:IF,nodeOrigin:rz,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function cz(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=LR(oz,NR),l=RR();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=sz,s()}),[]);let u=(0,U.useRef)(sz);return(0,U.useEffect)(()=>{for(let s of az){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:FI(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},az.map(t=>e[t])),null}function lz(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function uz(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=lz(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?lz()?.matches?`dark`:`light`:t}var dz=typeof document<`u`?document:null;function fz(e=null,t={target:dz,actInsideInputWithModifier:!0}){let[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(!1),a=(0,U.useRef)(new Set([])),[o,s]=(0,U.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
48
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=qx,s=!Nx.jitless,c=s&&Jx.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?mw([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function _w(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!lS(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>fS(e,r,Px())))}),t)}var vw=Y(`$ZodUnion`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Hx(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Hx(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Hx(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>zx(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>_w(t,i,e,a)):_w(s,i,e,a)}}),yw=Y(`$ZodIntersection`,(e,t)=>{AC.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xw(e,t,n)):xw(e,i,a)}});function bw(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Yx(e)&&Yx(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=bw(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bw(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xw(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),lS(e))return e;let r=bw(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var Sw=Y(`$ZodRecord`,(e,t)=>{AC.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Yx(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...uS(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...uS(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>fS(e,r,Px())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...uS(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...uS(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Cw=Y(`$ZodEnum`,(e,t)=>{AC.init(e,t);let n=Fx(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Zx.has(typeof e)).map(e=>typeof e==`string`?Qx(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ww=Y(`$ZodLiteral`,(e,t)=>{if(AC.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Qx(e):e?Qx(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),Tw=Y(`$ZodTransform`,(e,t)=>{AC.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mx(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new jx;return n.value=i,n}});function Ew(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Dw=Y(`$ZodOptional`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Hx(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zx(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ew(t,e.value)):Ew(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ow=Y(`$ZodNullable`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),Hx(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${zx(e.source)}|null)$`):void 0}),Hx(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),kw=Y(`$ZodDefault`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Aw(e,t)):Aw(r,t)}});function Aw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var jw=Y(`$ZodPrefault`,(e,t)=>{AC.init(e,t),e._zod.optin=`optional`,Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mw=Y(`$ZodNonOptional`,(e,t)=>{AC.init(e,t),Hx(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Nw(t,e)):Nw(i,e)}});function Nw(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Pw=Y(`$ZodCatch`,(e,t)=>{AC.init(e,t),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),Hx(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>fS(e,n,Px()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>fS(e,n,Px()))},input:e.value}),e.issues=[]),e)}}),Fw=Y(`$ZodPipe`,(e,t)=>{AC.init(e,t),Hx(e._zod,`values`,()=>t.in._zod.values),Hx(e._zod,`optin`,()=>t.in._zod.optin),Hx(e._zod,`optout`,()=>t.out._zod.optout),Hx(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Iw(e,t.in,n)):Iw(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Iw(e,t.out,n)):Iw(r,t.out,n)}});function Iw(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Lw=Y(`$ZodReadonly`,(e,t)=>{AC.init(e,t),Hx(e._zod,`propValues`,()=>t.innerType._zod.propValues),Hx(e._zod,`values`,()=>t.innerType._zod.values),Hx(e._zod,`optin`,()=>t.innerType._zod.optin),Hx(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Rw):Rw(r)}});function Rw(e){return e.value=Object.freeze(e.value),e}var zw=Y(`$ZodCustom`,(e,t)=>{dC.init(e,t),AC.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Bw(t,n,r,e));Bw(i,n,r,e)}});function Bw(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mS(e))}}var Vw=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Hw(){return new Vw}var Uw=Hw();function Ww(e,t){return new e({type:`string`,...X(t)})}function Gw(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...X(t)})}function Kw(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...X(t)})}function qw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...X(t)})}function Jw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...X(t)})}function Yw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...X(t)})}function Xw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...X(t)})}function Zw(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...X(t)})}function Qw(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...X(t)})}function $w(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...X(t)})}function eT(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...X(t)})}function tT(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...X(t)})}function nT(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...X(t)})}function rT(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...X(t)})}function iT(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...X(t)})}function aT(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...X(t)})}function oT(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...X(t)})}function sT(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...X(t)})}function cT(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...X(t)})}function lT(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...X(t)})}function uT(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...X(t)})}function dT(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...X(t)})}function fT(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...X(t)})}function pT(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...X(t)})}function mT(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...X(t)})}function hT(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...X(t)})}function gT(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...X(t)})}function _T(e,t){return new e({type:`number`,checks:[],...X(t)})}function vT(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...X(t)})}function yT(e,t){return new e({type:`boolean`,...X(t)})}function bT(e){return new e({type:`unknown`})}function xT(e,t){return new e({type:`never`,...X(t)})}function ST(e,t){return new pC({check:`less_than`,...X(t),value:e,inclusive:!1})}function CT(e,t){return new pC({check:`less_than`,...X(t),value:e,inclusive:!0})}function wT(e,t){return new mC({check:`greater_than`,...X(t),value:e,inclusive:!1})}function TT(e,t){return new mC({check:`greater_than`,...X(t),value:e,inclusive:!0})}function ET(e,t){return new hC({check:`multiple_of`,...X(t),value:e})}function DT(e,t){return new _C({check:`max_length`,...X(t),maximum:e})}function OT(e,t){return new vC({check:`min_length`,...X(t),minimum:e})}function kT(e,t){return new yC({check:`length_equals`,...X(t),length:e})}function AT(e,t){return new xC({check:`string_format`,format:`regex`,...X(t),pattern:e})}function jT(e){return new SC({check:`string_format`,format:`lowercase`,...X(e)})}function MT(e){return new CC({check:`string_format`,format:`uppercase`,...X(e)})}function NT(e,t){return new wC({check:`string_format`,format:`includes`,...X(t),includes:e})}function PT(e,t){return new TC({check:`string_format`,format:`starts_with`,...X(t),prefix:e})}function FT(e,t){return new EC({check:`string_format`,format:`ends_with`,...X(t),suffix:e})}function IT(e){return new DC({check:`overwrite`,tx:e})}function LT(e){return IT(t=>t.normalize(e))}function RT(){return IT(e=>e.trim())}function zT(){return IT(e=>e.toLowerCase())}function BT(){return IT(e=>e.toUpperCase())}function VT(e,t,n){return new e({type:`array`,element:t,...X(n)})}function HT(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...X(n)})}function UT(e){let t=WT(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(mS(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(mS(r))}},e(n.value,n)));return t}function WT(e,t){let n=new dC({check:`custom`,...X(t)});return n._zod.check=e,n}var GT=Y(`ZodISODateTime`,(e,t)=>{WC.init(e,t),gE.init(e,t)});function KT(e){return pT(GT,e)}var qT=Y(`ZodISODate`,(e,t)=>{GC.init(e,t),gE.init(e,t)});function JT(e){return mT(qT,e)}var YT=Y(`ZodISOTime`,(e,t)=>{KC.init(e,t),gE.init(e,t)});function XT(e){return hT(YT,e)}var ZT=Y(`ZodISODuration`,(e,t)=>{qC.init(e,t),gE.init(e,t)});function QT(e){return gT(ZT,e)}var $T=(e,t)=>{gS.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>yS(e,t)},flatten:{value:t=>vS(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ix,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ix,2)}},isEmpty:{get(){return e.issues.length===0}}})};Y(`ZodError`,$T);var eE=Y(`ZodError`,$T,{Parent:Error}),tE=bS(eE),nE=xS(eE),rE=SS(eE),iE=wS(eE),aE=ES(eE),oE=DS(eE),sE=OS(eE),cE=kS(eE),lE=AS(eE),uE=jS(eE),dE=MS(eE),fE=NS(eE),pE=Y(`ZodType`,(e,t)=>(AC.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Wx(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>$x(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>tE(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>rE(e,t,n),e.parseAsync=async(t,n)=>nE(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>iE(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>aE(e,t,n),e.decode=(t,n)=>oE(e,t,n),e.encodeAsync=async(t,n)=>sE(e,t,n),e.decodeAsync=async(t,n)=>cE(e,t,n),e.safeEncode=(t,n)=>lE(e,t,n),e.safeDecode=(t,n)=>uE(e,t,n),e.safeEncodeAsync=async(t,n)=>dE(e,t,n),e.safeDecodeAsync=async(t,n)=>fE(e,t,n),e.refine=(t,n)=>e.check(TD(t,n)),e.superRefine=t=>e.check(ED(t)),e.overwrite=t=>e.check(IT(t)),e.optional=()=>lD(e),e.nullable=()=>dD(e),e.nullish=()=>lD(dD(e)),e.nonoptional=t=>_D(e,t),e.array=()=>qE(e),e.or=t=>ZE([e,t]),e.and=t=>$E(e,t),e.transform=t=>xD(e,sD(t)),e.default=t=>pD(e,t),e.prefault=t=>hD(e,t),e.catch=t=>yD(e,t),e.pipe=t=>xD(e,t),e.readonly=()=>CD(e),e.describe=t=>{let n=e.clone();return Uw.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Uw.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Uw.get(e);let n=e.clone();return Uw.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),mE=Y(`_ZodString`,(e,t)=>{jC.init(e,t),pE.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(AT(...t)),e.includes=(...t)=>e.check(NT(...t)),e.startsWith=(...t)=>e.check(PT(...t)),e.endsWith=(...t)=>e.check(FT(...t)),e.min=(...t)=>e.check(OT(...t)),e.max=(...t)=>e.check(DT(...t)),e.length=(...t)=>e.check(kT(...t)),e.nonempty=(...t)=>e.check(OT(1,...t)),e.lowercase=t=>e.check(jT(t)),e.uppercase=t=>e.check(MT(t)),e.trim=()=>e.check(RT()),e.normalize=(...t)=>e.check(LT(...t)),e.toLowerCase=()=>e.check(zT()),e.toUpperCase=()=>e.check(BT())}),hE=Y(`ZodString`,(e,t)=>{jC.init(e,t),mE.init(e,t),e.email=t=>e.check(Gw(_E,t)),e.url=t=>e.check(Zw(bE,t)),e.jwt=t=>e.check(fT(FE,t)),e.emoji=t=>e.check(Qw(xE,t)),e.guid=t=>e.check(Kw(vE,t)),e.uuid=t=>e.check(qw(yE,t)),e.uuidv4=t=>e.check(Jw(yE,t)),e.uuidv6=t=>e.check(Yw(yE,t)),e.uuidv7=t=>e.check(Xw(yE,t)),e.nanoid=t=>e.check($w(SE,t)),e.guid=t=>e.check(Kw(vE,t)),e.cuid=t=>e.check(eT(CE,t)),e.cuid2=t=>e.check(tT(wE,t)),e.ulid=t=>e.check(nT(TE,t)),e.base64=t=>e.check(lT(ME,t)),e.base64url=t=>e.check(uT(NE,t)),e.xid=t=>e.check(rT(EE,t)),e.ksuid=t=>e.check(iT(DE,t)),e.ipv4=t=>e.check(aT(OE,t)),e.ipv6=t=>e.check(oT(kE,t)),e.cidrv4=t=>e.check(sT(AE,t)),e.cidrv6=t=>e.check(cT(jE,t)),e.e164=t=>e.check(dT(PE,t)),e.datetime=t=>e.check(KT(t)),e.date=t=>e.check(JT(t)),e.time=t=>e.check(XT(t)),e.duration=t=>e.check(QT(t))});function Z(e){return Ww(hE,e)}var gE=Y(`ZodStringFormat`,(e,t)=>{MC.init(e,t),mE.init(e,t)}),_E=Y(`ZodEmail`,(e,t)=>{FC.init(e,t),gE.init(e,t)}),vE=Y(`ZodGUID`,(e,t)=>{NC.init(e,t),gE.init(e,t)}),yE=Y(`ZodUUID`,(e,t)=>{PC.init(e,t),gE.init(e,t)}),bE=Y(`ZodURL`,(e,t)=>{IC.init(e,t),gE.init(e,t)}),xE=Y(`ZodEmoji`,(e,t)=>{LC.init(e,t),gE.init(e,t)}),SE=Y(`ZodNanoID`,(e,t)=>{RC.init(e,t),gE.init(e,t)}),CE=Y(`ZodCUID`,(e,t)=>{zC.init(e,t),gE.init(e,t)}),wE=Y(`ZodCUID2`,(e,t)=>{BC.init(e,t),gE.init(e,t)}),TE=Y(`ZodULID`,(e,t)=>{VC.init(e,t),gE.init(e,t)}),EE=Y(`ZodXID`,(e,t)=>{HC.init(e,t),gE.init(e,t)}),DE=Y(`ZodKSUID`,(e,t)=>{UC.init(e,t),gE.init(e,t)}),OE=Y(`ZodIPv4`,(e,t)=>{JC.init(e,t),gE.init(e,t)}),kE=Y(`ZodIPv6`,(e,t)=>{YC.init(e,t),gE.init(e,t)}),AE=Y(`ZodCIDRv4`,(e,t)=>{XC.init(e,t),gE.init(e,t)}),jE=Y(`ZodCIDRv6`,(e,t)=>{ZC.init(e,t),gE.init(e,t)}),ME=Y(`ZodBase64`,(e,t)=>{$C.init(e,t),gE.init(e,t)}),NE=Y(`ZodBase64URL`,(e,t)=>{tw.init(e,t),gE.init(e,t)}),PE=Y(`ZodE164`,(e,t)=>{nw.init(e,t),gE.init(e,t)}),FE=Y(`ZodJWT`,(e,t)=>{iw.init(e,t),gE.init(e,t)}),IE=Y(`ZodNumber`,(e,t)=>{aw.init(e,t),pE.init(e,t),e.gt=(t,n)=>e.check(wT(t,n)),e.gte=(t,n)=>e.check(TT(t,n)),e.min=(t,n)=>e.check(TT(t,n)),e.lt=(t,n)=>e.check(ST(t,n)),e.lte=(t,n)=>e.check(CT(t,n)),e.max=(t,n)=>e.check(CT(t,n)),e.int=t=>e.check(zE(t)),e.safe=t=>e.check(zE(t)),e.positive=t=>e.check(wT(0,t)),e.nonnegative=t=>e.check(TT(0,t)),e.negative=t=>e.check(ST(0,t)),e.nonpositive=t=>e.check(CT(0,t)),e.multipleOf=(t,n)=>e.check(ET(t,n)),e.step=(t,n)=>e.check(ET(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function LE(e){return _T(IE,e)}var RE=Y(`ZodNumberFormat`,(e,t)=>{ow.init(e,t),IE.init(e,t)});function zE(e){return vT(RE,e)}var BE=Y(`ZodBoolean`,(e,t)=>{sw.init(e,t),pE.init(e,t)});function VE(e){return yT(BE,e)}var HE=Y(`ZodUnknown`,(e,t)=>{cw.init(e,t),pE.init(e,t)});function UE(){return bT(HE)}var WE=Y(`ZodNever`,(e,t)=>{lw.init(e,t),pE.init(e,t)});function GE(e){return xT(WE,e)}var KE=Y(`ZodArray`,(e,t)=>{dw.init(e,t),pE.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(OT(t,n)),e.nonempty=t=>e.check(OT(1,t)),e.max=(t,n)=>e.check(DT(t,n)),e.length=(t,n)=>e.check(kT(t,n)),e.unwrap=()=>e.element});function qE(e,t){return VT(KE,e,t)}var JE=Y(`ZodObject`,(e,t)=>{gw.init(e,t),pE.init(e,t),Hx(e,`shape`,()=>t.shape),e.keyof=()=>rD(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:UE()}),e.loose=()=>e.clone({...e._zod.def,catchall:UE()}),e.strict=()=>e.clone({...e._zod.def,catchall:GE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>iS(e,t),e.safeExtend=t=>aS(e,t),e.merge=t=>oS(e,t),e.pick=t=>nS(e,t),e.omit=t=>rS(e,t),e.partial=(...t)=>sS(cD,e,t[0]),e.required=(...t)=>cS(gD,e,t[0])});function YE(e,t){return new JE({type:`object`,shape:e??{},...X(t)})}var XE=Y(`ZodUnion`,(e,t)=>{vw.init(e,t),pE.init(e,t),e.options=t.options});function ZE(e,t){return new XE({type:`union`,options:e,...X(t)})}var QE=Y(`ZodIntersection`,(e,t)=>{yw.init(e,t),pE.init(e,t)});function $E(e,t){return new QE({type:`intersection`,left:e,right:t})}var eD=Y(`ZodRecord`,(e,t)=>{Sw.init(e,t),pE.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tD(e,t,n){return new eD({type:`record`,keyType:e,valueType:t,...X(n)})}var nD=Y(`ZodEnum`,(e,t)=>{Cw.init(e,t),pE.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nD({...t,checks:[],...X(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nD({...t,checks:[],...X(r),entries:i})}});function rD(e,t){return new nD({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...X(t)})}var iD=Y(`ZodLiteral`,(e,t)=>{ww.init(e,t),pE.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function aD(e,t){return new iD({type:`literal`,values:Array.isArray(e)?e:[e],...X(t)})}var oD=Y(`ZodTransform`,(e,t)=>{Tw.init(e,t),pE.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mx(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mS(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(mS(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function sD(e){return new oD({type:`transform`,transform:e})}var cD=Y(`ZodOptional`,(e,t)=>{Dw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lD(e){return new cD({type:`optional`,innerType:e})}var uD=Y(`ZodNullable`,(e,t)=>{Ow.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dD(e){return new uD({type:`nullable`,innerType:e})}var fD=Y(`ZodDefault`,(e,t)=>{kw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pD(e,t){return new fD({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var mD=Y(`ZodPrefault`,(e,t)=>{jw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hD(e,t){return new mD({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var gD=Y(`ZodNonOptional`,(e,t)=>{Mw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _D(e,t){return new gD({type:`nonoptional`,innerType:e,...X(t)})}var vD=Y(`ZodCatch`,(e,t)=>{Pw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yD(e,t){return new vD({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bD=Y(`ZodPipe`,(e,t)=>{Fw.init(e,t),pE.init(e,t),e.in=t.in,e.out=t.out});function xD(e,t){return new bD({type:`pipe`,in:e,out:t})}var SD=Y(`ZodReadonly`,(e,t)=>{Lw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function CD(e){return new SD({type:`readonly`,innerType:e})}var wD=Y(`ZodCustom`,(e,t)=>{zw.init(e,t),pE.init(e,t)});function TD(e,t={}){return HT(wD,e,t)}function ED(e){return UT(e)}var DD=_(),OD=LE().finite().nonnegative(),kD=LE().int().nonnegative(),AD=KT({offset:!0}),jD=Z().min(1).nullable(),Q=e=>YE(e).catchall(UE()),MD={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,events:`/api/v2/events`},ND={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,node:`node`,scope:`scope`,filter:`filter`},PD={run:`run`,node:`node`},FD={planner:`planner`,monitor:`monitor`},ID=rD([`complete`,`partial`,`legacy`]),LD=rD([`native`,`labelled`,`inferred`]),RD=Q({agent_model_ms:VE(),judge_model_ms:VE(),llmlint_model_ms:VE(),tool_ms:VE()}),zD=OD.nullable(),BD=kD.nullable(),VD=Q({agent_seconds:zD,judge_seconds:zD,llmlint_seconds:zD,gate_seconds:zD,publication_wait_seconds:zD,lock_wait_seconds:zD,setup_seconds:zD,scheduling_seconds:zD,wall_seconds:zD,agent_model_ms:BD,judge_model_ms:BD,llmlint_model_ms:BD,tool_ms:BD,idle_orchestration_ms:BD,unattributed_ms:BD,wall_ms:BD,fractions:Q({agent_model:zD,judge_model:zD,llmlint_model:zD,tool:zD,idle_orchestration:zD,lock_wait:zD,setup:zD,scheduling:zD})}),HD=rD([`orchestrator`,`worker`,`judge`,`check-in`,`pr-author`]),UD=rD([`agent`,`judge`,`llmlint`]),WD=OD.nullable(),GD=Q({input_tokens:WD,output_tokens:WD,cache_read_tokens:WD,cache_write_tokens:WD,cost_usd:WD}),KD=Q({agent:GD,judge:GD,llmlint:GD,total:GD}),qD=Q({session_id:Z().min(1),history_id:Z().min(1).nullable().optional(),role:UD,agent_role:HD.optional(),turn_index:kD.nullable().optional(),started_at:AD.optional(),finished_at:AD.nullable().optional()}),JD=tD(Z(),UE()),YD=rD([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),XD=rD([`agent`,`judge`,`llmlint`]),ZD=rD([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),QD=Q({side:XD.optional(),harness:Z().optional(),variant:Z().optional(),identity:Z().optional(),cause:ZD.optional(),raw_tail:Z().optional(),reset_time:Z().optional(),missing_session_id:Z().optional(),wait_seconds:LE().nonnegative().optional(),failure_kind:Z().optional(),structured_error:JD.optional(),judge_unrecorded:VE().optional()}).extend({class:YD,detail:Z().optional()}),$D=Q({node:Z().min(1),status:Z().min(1),outcome:Z().min(1).optional(),branch:Z().min(1).optional(),comparison_remote:Z().min(1).optional(),comparison_base:Z().min(1).optional(),checkpoint:Z().min(1).optional(),commit:Z().min(1).optional(),retry_lineage:JD.optional(),gate_attestation:JD.optional(),failure:QD.optional(),timing:VD.optional(),usage:KD.optional(),sessions:qE(qD),tool_commands:tD(Z(),kD).optional(),turns:kD,lint:kD,timing_quality:ID,linkage_quality:LD,timing_presence:RD}),eO=Q({run_id:Z().min(1),state:Z().min(1),phase:Z().min(1),last_event:jD,last_progress_at:OD.optional(),timing:VD,nodes:qE($D),providers:qE(JD).optional(),failure:QD.optional(),check_rollup:JD.optional(),usage:KD,timing_quality:ID,linkage_quality:LD,timing_presence:RD,sources:qE(Z()),node_work_ms:Q({agent_model_ms:BD,judge_model_ms:BD,llmlint_model_ms:BD,tool_ms:BD,wall_ms:BD}),turns:kD,lint:kD}),tO=Q({schema_version:ZE([Z(),LE()]).optional(),observed_at:Z().optional(),identities:qE(JD)}),nO=Q({launch_id:Z().min(1),launcher:rD([`claude-code`,`codex`,`unknown`]),session_key:Z().min(1).optional(),launcher_session_id:Z().min(1).optional()}),rO=Q({run_id:Z().min(1),state:Z().min(1),phase:Z().min(1),last_event:jD,last_progress_at:OD.optional(),timing_quality:ID,linkage_quality:LD,timing:VD,node_counts:tD(Z(),kD),launch:nO.optional()}),iO=Q({api_version:aD(2),telemetry_schema_version:aD(14),observed_at:AD,runs:qE(rO),next_cursor:Z().min(1).optional(),provider_health:tO.optional()}),aO=Q({id:Z().min(1),kind:rD([`agent`,`human`]).optional(),persona:Z().min(1).optional(),task:Z().min(1),deps:qE(Z().min(1)).optional(),max_turns:kD.positive().optional(),expects_no_diff:VE().optional()}),oO=Q({branch:Z().min(1),base_branch:Z().min(1),pr_base:Z().min(1),checkpoint:Z().min(1),completed_steps:qE(Z()).optional(),pr:Z().nullable().optional(),mode:rD([`pause`,`retry`,`continue`]).optional(),attempts:kD.optional()}),sO=Q({branch:Z().min(1),repo:Z().min(1).optional(),identity:Z().min(1).optional(),base_branch:Z().min(1).optional(),pr:Z().min(1).optional(),pr_base:Z().min(1).optional()}),cO=aO.extend({task:Z().min(1).optional(),repo:Z().min(1).optional(),steps:qE(aO).min(1).optional(),session:Z().min(1).optional(),project_dir:Z().min(1).optional(),base_branch:Z().min(1).optional(),branch:Z().min(1).optional(),title:Z().min(1).optional(),verify_cmd:Z().min(1).optional(),skip_verify:VE().optional(),verify_via_ci:VE().optional(),merge_policy:rD([`auto`,`direct`,`none`]).optional(),workflow:rD([`local`,`remote`]).optional(),repo_type:rD([`single-owner`,`team`]).optional(),execution_checkout:Z().min(1).optional(),stack_bases:qE(sO).optional(),resume:oO.optional()}).superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),lO=Q({gate_log:Z().optional(),worker_report:Z().optional(),oneharness_session:Z().optional()}),uO=Q({id:Z().min(1),kind:Z().min(1),persona:Z().nullable(),status:Z().min(1),telemetry:JD.optional(),artifacts:lO.optional()}),dO=Q({ref:Z().min(1),task:Z(),unblocks:qE(Z()),unblocks_publication:VE()}),fO=Q({branch:Z().min(1),base_branch:Z().min(1),pr_base:Z(),checkpoint:Z().min(1),completed_steps:qE(Z()),pr:Z().nullable(),mode:Z().optional()}),pO=Q({identity:Z().min(1),target:Z().min(1),style:Z().min(1).optional(),version:Z().min(1)}),mO=Q({kind:Z().optional(),status:Z().optional(),task:Z().optional(),unblocks:qE(Z()).optional(),blocked_by:qE(Z()).optional(),human_actions:qE(dO).optional(),completed:VE().optional(),exit_code:LE().int().nullable().optional(),verdicts:qE(UE()).optional(),usage:JD.optional(),telemetry:JD.optional(),repo:Z().optional(),branch:Z().optional(),commit:Z().optional(),base_branch:Z().optional(),pr_base:Z().optional(),synthetic_stack_base:Z().nullable().optional(),stack_bases:qE(JD).optional(),repository_type:rD([`single-owner`,`team`]).nullable().optional(),repo_type:rD([`single-owner`,`team`]).nullable().optional(),publication_workflow:rD([`local`,`remote`]).nullable().optional(),workflow:rD([`local`,`remote`]).nullable().optional(),merge_policy:rD([`auto`,`direct`,`none`]).nullable().optional(),outcome:Z().optional(),ok:VE().optional(),pr:Z().nullable().optional(),release:pO.nullable().optional(),detail:Z().optional(),follow_ups:Z().nullable().optional(),steps:qE(uO).optional(),waiting_steps:qE(Z()).optional(),resume:fO.nullable().optional(),error:Z().nullable().optional(),retry_lineage:JD.optional(),deferred_cleanup:qE(Z()).optional(),artifacts:lO.optional()}),hO=Q({ok:VE().optional(),state:Z().optional(),started_order:qE(Z()).optional(),results:tD(Z(),mO).optional(),schema_version:kD.optional()}),gO=rD([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),_O=rD([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),vO=Q({addressable:VE(),member:Z().min(1).optional(),reason:Z().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),yO=Q({id:Z().min(1),kind:Z(),unblocks:qE(Z().min(1))}),bO=Q({run_id:Z().min(1),plan:Q({tasks:qE(cO),schema_version:kD.optional(),concurrency:kD.positive().optional(),name:Z().min(1).optional(),goal:Q({id:Z().min(1),text:Z().min(1)}).optional()}),node_states:tD(Z(),gO),node_status:tD(Z(),_O),node_gated_by:tD(Z(),qE(Z().min(1))),node_control:tD(Z(),vO),node_results:tD(Z(),mO),decisions:qE(yO),attestations:qE(Z()),result:hO.nullable(),last_seq:kD}).superRefine((e,t)=>{let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}),xO=Q({cacheReadTokens:WD.optional(),cacheWriteTokens:WD.optional(),costUsd:WD.optional(),inputTokens:WD.optional(),outputTokens:WD.optional()}),SO=Q({index:kD,input:UE().optional(),kind:Z(),name:Z().nullable().optional(),output:Z().nullable().optional()}),CO=Q({assistant:Z().nullable(),durationMs:WD.optional(),failureKind:Z().nullable(),finishedAt:AD.nullable().optional(),harness:Z(),id:Z(),model:Z().nullable(),modelMs:WD.optional(),reasoning:Z().nullable(),startedAt:AD.nullable().optional(),status:Z(),timestamp:AD,toolMs:WD.optional(),tools:qE(SO),unknown:JD,usage:xO,user:Z()}),wO=Q({conversation:Q({canContinue:VE(),harnesses:qE(Z()),id:Z().min(1),name:Z(),project:Z(),startedAt:AD,state:Z(),turns:qE(CO)}),attribution:Q({runId:Z().optional(),nodeId:Z().optional(),stepId:Z().optional(),launchId:Z().optional(),launcher:rD([`claude-code`,`codex`,`unknown`]).optional(),transportRole:UD,agentRole:HD,parentConversationId:Z().optional(),persona:Z().optional(),finishedAt:AD.nullable().optional(),inferred:aD(!0).optional(),timing:VD.optional()})}),TO=Q({node:Z().optional(),conversations:qE(wO)}),EO=ZE([qE(wO),qE(TO).transform(e=>e.flatMap(e=>e.conversations))]),DO=Q({name:Z(),state:Z(),required:VE(),url:Z().url().optional()}),OO=Q({ok:VE(),output_tail:Z(),artifact_id:Z().min(1).optional()}),kO=Q({verification:Q({pre_push_hook:VE().optional(),required_checks:qE(Z()).optional(),required_checks_status:Z().optional(),expected_gate:qE(Z()).optional(),checks:qE(DO).optional(),records:qE(OO)}),publication:Q({pr_url:Z().url().optional(),branch:Z().optional(),branch_url:Z().url().optional(),merged:VE(),base_branch:Z().optional(),commit:Z().optional(),commit_url:Z().url().optional()}).optional()}),AO=Q({api_version:aD(2),telemetry_schema_version:aD(14),observed_at:AD,run:eO,graph:bO.nullable(),conversations:EO,node_details:tD(Z(),kO).optional().default({}),launch:nO.optional(),provider_health:tO.optional()}),jO=rD([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),MO=rD([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`]),NO=rD([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),PO=Q({kind:jO,value:Z().min(1)}),FO=Q({delivered:VE(),delivery:rD([`live`,`deferred`]).optional(),member:Z().min(1).optional(),input_bytes:kD.optional(),reason:Z().min(1).optional(),node_id:Z().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),IO=Q({dep:Z().min(1),identity:Z().min(1).optional(),target:Z().min(1).optional(),style:Z().min(1).optional(),action:Z().min(1).optional(),since:AD.optional(),waited_seconds:kD.optional(),last_answer:Z().min(1).optional()}),LO=Q({identity:Z().min(1).optional(),target:Z().min(1).optional(),style:Z().min(1).optional(),version:Z().min(1).optional(),landing_commit:Z().min(1).optional(),actor:Z().min(1).optional(),superseded:VE().optional(),form:Z().min(1).optional(),outcome:Z().min(1).optional(),elapsed_ms:kD.optional(),dep:Z().min(1).optional(),delivery:Z().min(1).optional(),awaiting:qE(IO).min(1).optional(),versions:qE(Q({identity:Z().min(1),target:Z().min(1),version:Z().min(1)})).min(1).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a release record carries at least one recorded fact`})}),RO=Q({id:Z().min(1),kind:Z().min(1),at:AD,node_id:Z().min(1).optional(),step_id:Z().min(1).optional(),status:Z().min(1).optional(),author:Z().min(1).optional(),redirection:FO.optional(),release:LO.optional(),reference:PO.optional()}),zO=Q({started_at:AD,ended_at:AD}),BO=Q({id:Z().min(1),kind:MO,label:Z(),started_at:AD,ended_at:AD.nullable(),events:qE(RO),parent_id:Z().min(1).optional(),node_id:Z().min(1).optional(),step_id:Z().min(1).optional(),status:Z().min(1).optional(),count:kD.optional(),total_duration_ms:kD.optional(),intervals:qE(zO).optional(),agent_role:HD.optional(),transport_role:UD.optional(),dispatch_id:Z().min(1).optional(),reference:PO.optional(),detail:Q({ok:VE().optional(),output_tail:Z().optional(),artifact_id:Z().optional()}).optional(),phase:NO.optional()}),VO=Q({id:Z().min(1),kind:jO,content:Z(),truncated:VE()}),HO=Q({api_version:aD(2),timeline_schema_version:aD(7),observed_at:AD,run_id:Z().min(1),spans:qE(BO)}),UO=Q({error:Q({code:Z(),message:Z()})});Q({schema_version:aD(1),launch_id:Z().min(1),launcher:rD([`claude-code`,`codex`]),launcher_session_id:Z().min(1),started_at:AD,repository_identity:Z().min(1)});var WO=rD([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),GO=JD,KO=qE(YE({node:Z().min(1),step:Z().min(1).optional(),at:LE().finite(),kind:Z(),name:Z(),detail:Z(),events:LE().int().nonnegative()})),qO=e=>iO.parse(e),JO=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},YO=50,XO=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=YO){let r=this.#r(MD.runs);return r.searchParams.set(ND.includeSettled,String(e)),r.searchParams.set(ND.limit,String(n)),t!==void 0&&r.searchParams.set(ND.cursor,t),this.#i(r,iO.parse)}async getRun(e,t={}){ZO(e,`run ID`);let n=this.#r(MD.run(e));return t.includeConversations!==void 0&&n.searchParams.set(ND.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(ND.filter,t.filter),this.#i(n,AO.parse)}async getTimeline(e,t,n){ZO(e,`run ID`);let r=this.#r(MD.timeline(e));return n!==void 0&&r.searchParams.set(ND.filter,n),t===void 0?r.searchParams.set(ND.scope,PD.run):(r.searchParams.set(ND.scope,PD.node),r.searchParams.set(ND.node,t)),this.#i(r,HO.parse)}async getConversation(e,t){return ZO(e,`run ID`),ZO(t,`conversation ID`),this.#i(this.#r(MD.conversation(e,t)),wO.parse)}async getArtifact(e,t){return ZO(e,`run ID`),ZO(t,`artifact ID`),this.#i(this.#r(MD.artifact(e,t)),VO.parse)}subscribe(e){e.runId!==void 0&&ZO(e.runId,`run ID`),e.after!==void 0&&ZO(e.after,`cursor`);let t=this.#r(MD.events);e.runId!==void 0&&t.searchParams.set(ND.runId,e.runId),e.after!==void 0&&t.searchParams.set(ND.after,e.after),e.filter!==void 0&&t.searchParams.set(ND.filter,e.filter);let n=(this.#n??(e=>{if(typeof EventSource>`u`)throw new JO(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(t.toString());for(let t of WO.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?iO.parse(i):GO.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}#r(e){return new URL(e,this.#e)}async#i(e,t){let n;try{n=await this.#t(e)}catch(e){throw new JO(`Telemetry request failed`,void 0,void 0,{cause:e})}let r=await n.json().catch(e=>{throw new JO(`Telemetry server returned invalid JSON`,n.status,void 0,{cause:e})});if(!n.ok){let e=UO.safeParse(r);throw new JO(e.success?e.data.error.message:`Telemetry request failed with status ${n.status}`,n.status,e.success?e.data.error.code:void 0)}try{return t(r)}catch(e){throw new JO(`Telemetry response failed contract validation`,n.status,void 0,{cause:e})}}};function ZO(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new JO(`Invalid ${t}`)}var QO=o(((e,t)=>{var n=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,s=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?i:this._defaultEdgeLabelFn(e,t,n);var u=o(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n),o=this._edgeObjs[r];return o&&(e=o.v,t=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function a(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=n})),$O=o(((e,t)=>{t.exports=`2.2.4`})),ek=o(((e,t)=>{t.exports={Graph:QO(),version:$O()}})),tk=o(((e,t)=>{var n=QO();t.exports={write:r,read:o};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function o(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),nk=o(((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}})),rk=o(((e,t)=>{t.exports=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}})),ik=o(((e,t)=>{var n=rk();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}})),ak=o(((e,t)=>{var n=ik();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),ok=o(((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}})),sk=o(((e,t)=>{var n=ok();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),ck=o(((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),lk=o(((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r})),uk=o(((e,t)=>{var n=lk();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),dk=o(((e,t)=>{t.exports=n;function n(e,t,n){Array.isArray(t)||(t=[t]);var a=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?r:i,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,a,c,s)}),s}function r(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),a(t(o[0]),e=>i.push([e,!1])))}}function i(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),a(t(o),e=>i.push(e)))}}function a(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),fk=o(((e,t)=>{var n=dk();t.exports=r;function r(e,t){return n(e,t,`post`)}})),pk=o(((e,t)=>{var n=dk();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),mk=o(((e,t)=>{var n=QO(),r=rk();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return i}})),hk=o(((e,t)=>{t.exports={components:nk(),dijkstra:ik(),dijkstraAll:ak(),findCycles:sk(),floydWarshall:ck(),isAcyclic:uk(),postorder:fk(),preorder:pk(),prim:mk(),tarjan:ok(),topsort:lk()}})),gk=o(((e,t)=>{var n=ek();t.exports={Graph:n.Graph,json:tk(),alg:hk(),version:n.version}})),_k=o(((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n})),vk=o(((e,t)=>{var n=gk().Graph,r=_k();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),yk=o(((e,t)=>{var n=gk().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),bk=o(((e,t)=>{var n=vk(),r=yk().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),xk=o(((e,t)=>{var n=yk();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),Sk=o(((e,t)=>{var{applyWithChunking:n}=yk();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),Ck=o(((e,t)=>{var n=gk().Graph,r=Sk().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),wk=o(((e,t)=>{var n=Ck(),r=Sk().slack,i=Sk().longestPath,a=gk().alg.preorder,o=gk().alg.postorder,s=yk().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),Tk=o(((e,t)=>{var n=Sk().longestPath,r=Ck(),i=wk();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}})),Ek=o(((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}})),Dk=o(((e,t)=>{var n=yk();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),Ok=o(((e,t)=>{var n=yk();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),kk=o(((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}})),Ak=o(((e,t)=>{var n=yk();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}})),jk=o(((e,t)=>{var n=yk().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),Mk=o(((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),Nk=o(((e,t)=>{var n=yk();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),Pk=o(((e,t)=>{var n=yk();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),Fk=o(((e,t)=>{var n=Mk(),r=Nk(),i=Pk();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),Ik=o(((e,t)=>{var n=gk().Graph,r=yk();t.exports=i;function i(e,t,r){let i=a(e),o=new n({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return e.nodes().forEach(n=>{let a=e.node(n),s=e.parent(n);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(n),o.setParent(n,s||i),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=o.edge(r,n),a=i===void 0?0:i.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(a,`minRank`)&&o.setNode(n,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),Lk=o(((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),Rk=o(((e,t)=>{var n=Ak(),r=jk(),i=Fk(),a=Ik(),o=Lk(),s=gk().Graph,c=yk();t.exports=l;function l(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t&&t.disableOptimalOrderHeuristic)return;let p=1/0,m;for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<p&&(n=0,m=Object.assign({},s),p=i)}f(e,m)}function u(e,t,n){return t.map(function(t){return a(e,t,n)})}function d(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),zk=o(((e,t)=>{var n=gk().Graph,r=yk();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}})),Bk=o(((e,t)=>{var n=yk(),r=zk().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),Vk=o(((e,t)=>{var n=bk(),r=xk(),i=Tk(),a=yk().normalizeRanks,o=Ek(),s=yk().removeEmptyRanks,c=Dk(),l=Ok(),u=kk(),d=Rk(),f=Bk(),p=yk(),m=gk().Graph;t.exports=h;function h(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r))})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>F(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>I(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>L(e)),t(` removeBorderNodes`,()=>ee(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},b=[`acyclicer`,`ranker`,`rankdir`,`align`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=ne(e.graph());return t.setGraph(Object.assign({},y,te(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=te(ne(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=ne(e.edge(n));t.setEdge(n,Object.assign({},w,te(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function ee(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function F(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function I(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function L(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function te(e,t){return p.mapValues(p.pick(e,t),Number)}function ne(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),Hk=o(((e,t)=>{var n=yk(),r=gk().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),Uk=o(((e,t)=>{t.exports=`1.1.5`})),Wk=l(o(((e,t)=>{t.exports={graphlib:gk(),layout:Vk(),debug:Hk(),util:{time:yk().time,notime:yk().notime},version:Uk()}}))(),1),Gk=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],Kk=200,qk=72,Jk=80,Yk=32,Xk=new Set(Gk),Zk={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},Qk=(e,t)=>e<t?-1:+(e>t);function $k(e){let t=[...e.nodes].sort((e,t)=>Qk(e.id,t.id)),n=[...e.edges].sort((e,t)=>Qk(e.id,t.id)),r=new Map(t.map(e=>[e.id,e]));if(r.size!==t.length)throw Error(`DAG node IDs must be unique`);for(let e of t)if(!Xk.has(e.state))throw Error(`DAG node ${e.id} has unsupported state ${e.state}`);let i=new Map(t.map(e=>[e.id,0])),a=new Map(t.map(e=>[e.id,[]])),o=new Set;for(let e of n){if(o.has(e.id))throw Error(`DAG edge IDs must be unique`);if(o.add(e.id),!r.has(e.source)||!r.has(e.target))throw Error(`DAG edge ${e.id} has a missing endpoint`);if(e.source===e.target)throw Error(`DAG edge ${e.id} is a self-edge`);i.set(e.target,(i.get(e.target)??0)+1),a.get(e.source)?.push(e.target)}let s=new Map,c=t.filter(e=>i.get(e.id)===0).map(e=>e.id),l=0;for(;c.length>0;){let e=c;c=[];for(let t of e){l+=1;let e=s.get(t)??0;for(let n of a.get(t)??[]){s.set(n,Math.max(s.get(n)??0,e+1));let t=(i.get(n)??0)-1;i.set(n,t),t===0&&c.push(n)}}c.sort()}if(l!==t.length)throw Error(`DAG contains a cycle`);let u=new Wk.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:Jk,nodesep:Yk,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:Kk,height:qk});for(let e of n)u.setEdge(e.source,e.target,{},e.id);Wk.default.layout(u);let d=new Map;for(let e of t){let t=s.get(e.id)??0,n=d.get(t)??[];n.push(e.id),d.set(t,n)}for(let e of d.values())e.sort((e,t)=>(u.node(e)?.y??0)-(u.node(t)?.y??0)||Qk(e,t));let f=t.map(e=>{let t=s.get(e.id)??0,n=d.get(t)?.indexOf(e.id)??0;return{...e,x:t*280,y:n*104,width:Kk,height:qk,style:Zk[e.state]}}),p=new Map(f.map(e=>[e.id,e])),m=n.map(e=>{let t=p.get(e.source),n=p.get(e.target);if(!t||!n)throw Error(`DAG layout lost an edge endpoint`);let r={x:t.x+t.width,y:t.y+t.height/2},i={x:n.x,y:n.y+n.height/2},a=Math.round((r.x+i.x)/2);return{...e,points:[r,{x:a,y:r.y},{x:a,y:i.y},i]}});return{width:f.length===0?0:Math.max(...f.map(e=>e.x+e.width)),height:f.length===0?0:Math.max(...f.map(e=>e.y+e.height)),nodes:f,edges:m}}function eA(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=eA(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var tA={value:()=>{}};function nA(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new rA(n)}function rA(e){this._=e}function iA(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}rA.prototype=nA.prototype={constructor:rA,on:function(e,t){var n=this._,r=iA(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=aA(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=oA(n[i],e.name,t);else if(t==null)for(i in n)n[i]=oA(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new rA(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function aA(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function oA(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=tA,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var sA={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function cA(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),sA.hasOwnProperty(t)?{space:sA[t],local:e}:e}function lA(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function uA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dA(e){var t=cA(e);return(t.local?uA:lA)(t)}function fA(){}function pA(e){return e==null?fA:function(){return this.querySelector(e)}}function mA(e){typeof e!=`function`&&(e=pA(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new nM(r,this._parents)}function hA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gA(){return[]}function _A(e){return e==null?gA:function(){return this.querySelectorAll(e)}}function vA(e){return function(){return hA(e.apply(this,arguments))}}function yA(e){e=typeof e==`function`?vA(e):_A(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new nM(r,i)}function bA(e){return function(){return this.matches(e)}}function xA(e){return function(t){return t.matches(e)}}var SA=Array.prototype.find;function CA(e){return function(){return SA.call(this.children,e)}}function wA(){return this.firstElementChild}function TA(e){return this.select(e==null?wA:CA(typeof e==`function`?e:xA(e)))}var EA=Array.prototype.filter;function DA(){return Array.from(this.children)}function OA(e){return function(){return EA.call(this.children,e)}}function kA(e){return this.selectAll(e==null?DA:OA(typeof e==`function`?e:xA(e)))}function AA(e){typeof e!=`function`&&(e=bA(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new nM(r,this._parents)}function jA(e){return Array(e.length)}function MA(){return new nM(this._enter||this._groups.map(jA),this._parents)}function NA(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}NA.prototype={constructor:NA,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function PA(e){return function(){return e}}function FA(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new NA(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function IA(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new NA(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function LA(e){return e.__data__}function RA(e,t){if(!arguments.length)return Array.from(this,LA);var n=t?IA:FA,r=this._parents,i=this._groups;typeof e!=`function`&&(e=PA(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=zA(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new nM(o,r),o._enter=s,o._exit=c,o}function zA(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function BA(){return new nM(this._exit||this._groups.map(jA),this._parents)}function VA(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function HA(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new nM(s,this._parents)}function UA(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function WA(e){e||=GA;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new nM(i,this._parents).order()}function GA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qA(){return Array.from(this)}function JA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function YA(){let e=0;for(let t of this)++e;return e}function XA(){return!this.node()}function ZA(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function QA(e){return function(){this.removeAttribute(e)}}function $A(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ej(e,t){return function(){this.setAttribute(e,t)}}function tj(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function nj(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function rj(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ij(e,t){var n=cA(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?$A:QA:typeof t==`function`?n.local?rj:nj:n.local?tj:ej)(n,t))}function aj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oj(e){return function(){this.style.removeProperty(e)}}function sj(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cj(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lj(e,t,n){return arguments.length>1?this.each((t==null?oj:typeof t==`function`?cj:sj)(e,t,n??``)):uj(this.node(),e)}function uj(e,t){return e.style.getPropertyValue(t)||aj(e).getComputedStyle(e,null).getPropertyValue(t)}function dj(e){return function(){delete this[e]}}function fj(e,t){return function(){this[e]=t}}function pj(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mj(e,t){return arguments.length>1?this.each((t==null?dj:typeof t==`function`?pj:fj)(e,t)):this.node()[e]}function hj(e){return e.trim().split(/^|\s+/)}function gj(e){return e.classList||new _j(e)}function _j(e){this._node=e,this._names=hj(e.getAttribute(`class`)||``)}_j.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function vj(e,t){for(var n=gj(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function yj(e,t){for(var n=gj(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function bj(e){return function(){vj(this,e)}}function xj(e){return function(){yj(this,e)}}function Sj(e,t){return function(){(t.apply(this,arguments)?vj:yj)(this,e)}}function Cj(e,t){var n=hj(e+``);if(arguments.length<2){for(var r=gj(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Sj:t?bj:xj)(n,t))}function wj(){this.textContent=``}function Tj(e){return function(){this.textContent=e}}function Ej(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Dj(e){return arguments.length?this.each(e==null?wj:(typeof e==`function`?Ej:Tj)(e)):this.node().textContent}function Oj(){this.innerHTML=``}function kj(e){return function(){this.innerHTML=e}}function Aj(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function jj(e){return arguments.length?this.each(e==null?Oj:(typeof e==`function`?Aj:kj)(e)):this.node().innerHTML}function Mj(){this.nextSibling&&this.parentNode.appendChild(this)}function Nj(){return this.each(Mj)}function Pj(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fj(){return this.each(Pj)}function Ij(e){var t=typeof e==`function`?e:dA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Lj(){return null}function Rj(e,t){var n=typeof e==`function`?e:dA(e),r=t==null?Lj:typeof t==`function`?t:pA(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zj(){var e=this.parentNode;e&&e.removeChild(this)}function Bj(){return this.each(zj)}function Vj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Uj(e){return this.select(e?Hj:Vj)}function Wj(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Gj(e){return function(t){e.call(this,t,this.__data__)}}function Kj(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function qj(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Jj(e,t,n){return function(){var r=this.__on,i,a=Gj(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Yj(e,t,n){var r=Kj(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Jj:qj,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function Xj(e,t,n){var r=aj(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Zj(e,t){return function(){return Xj(this,e,t)}}function Qj(e,t){return function(){return Xj(this,e,t.apply(this,arguments))}}function $j(e,t){return this.each((typeof t==`function`?Qj:Zj)(e,t))}function*eM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var tM=[null];function nM(e,t){this._groups=e,this._parents=t}function rM(){return new nM([[document.documentElement]],tM)}function iM(){return this}nM.prototype=rM.prototype={constructor:nM,select:mA,selectAll:yA,selectChild:TA,selectChildren:kA,filter:AA,data:RA,enter:MA,exit:BA,join:VA,merge:HA,selection:iM,order:UA,sort:WA,call:KA,nodes:qA,node:JA,size:YA,empty:XA,each:ZA,attr:ij,style:lj,property:mj,classed:Cj,text:Dj,html:jj,raise:Nj,lower:Fj,append:Ij,insert:Rj,remove:Bj,clone:Uj,datum:Wj,on:Yj,dispatch:$j,[Symbol.iterator]:eM};function aM(e){return typeof e==`string`?new nM([[document.querySelector(e)]],[document.documentElement]):new nM([[e]],tM)}function oM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function sM(e,t){if(e=oM(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var cM={passive:!1},lM={capture:!0,passive:!1};function uM(e){e.stopImmediatePropagation()}function dM(e){e.preventDefault(),e.stopImmediatePropagation()}function fM(e){var t=e.document.documentElement,n=aM(e).on(`dragstart.drag`,dM,lM);`onselectstart`in t?n.on(`selectstart.drag`,dM,lM):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function pM(e,t){var n=e.document.documentElement,r=aM(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,dM,lM),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var mM=e=>()=>e;function hM(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}hM.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gM(e){return!e.ctrlKey&&!e.button}function _M(){return this.parentNode}function vM(e,t){return t??{x:e.x,y:e.y}}function yM(){return navigator.maxTouchPoints||`ontouchstart`in this}function bM(){var e=gM,t=_M,n=vM,r=yM,i={},a=nA(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,cM).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(aM(n.view).on(`mousemove.drag`,m,lM).on(`mouseup.drag`,h,lM),fM(n.view),uM(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(dM(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){aM(e.view).on(`mousemove.drag mouseup.drag`,null),pM(e.view,l),dM(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(uM(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(dM(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(uM(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=sM(l||r,t),p,m,h;if((h=n.call(e,new hM(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=sM(l||a,t),_=o;break}u.call(r,e,new hM(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:mM(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:mM(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:mM(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:mM(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function xM(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function SM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function CM(){}var wM=.7,TM=1/wM,EM=`\\s*([+-]?\\d+)\\s*`,DM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,OM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,kM=/^#([0-9a-f]{3,8})$/,AM=RegExp(`^rgb\\(${EM},${EM},${EM}\\)$`),jM=RegExp(`^rgb\\(${OM},${OM},${OM}\\)$`),MM=RegExp(`^rgba\\(${EM},${EM},${EM},${DM}\\)$`),NM=RegExp(`^rgba\\(${OM},${OM},${OM},${DM}\\)$`),PM=RegExp(`^hsl\\(${DM},${OM},${OM}\\)$`),FM=RegExp(`^hsla\\(${DM},${OM},${OM},${DM}\\)$`),IM={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};xM(CM,VM,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:LM,formatHex:LM,formatHex8:RM,formatHsl:zM,formatRgb:BM,toString:BM});function LM(){return this.rgb().formatHex()}function RM(){return this.rgb().formatHex8()}function zM(){return eN(this).formatHsl()}function BM(){return this.rgb().formatRgb()}function VM(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=kM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?HM(t):n===3?new KM(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?UM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?UM(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=AM.exec(e))?new KM(t[1],t[2],t[3],1):(t=jM.exec(e))?new KM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=MM.exec(e))?UM(t[1],t[2],t[3],t[4]):(t=NM.exec(e))?UM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=PM.exec(e))?$M(t[1],t[2]/100,t[3]/100,1):(t=FM.exec(e))?$M(t[1],t[2]/100,t[3]/100,t[4]):IM.hasOwnProperty(e)?HM(IM[e]):e===`transparent`?new KM(NaN,NaN,NaN,0):null}function HM(e){return new KM(e>>16&255,e>>8&255,e&255,1)}function UM(e,t,n,r){return r<=0&&(e=t=n=NaN),new KM(e,t,n,r)}function WM(e){return e instanceof CM||(e=VM(e)),e?(e=e.rgb(),new KM(e.r,e.g,e.b,e.opacity)):new KM}function GM(e,t,n,r){return arguments.length===1?WM(e):new KM(e,t,n,r??1)}function KM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}xM(KM,GM,SM(CM,{brighter(e){return e=e==null?TM:TM**+e,new KM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wM:wM**+e,new KM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new KM(ZM(this.r),ZM(this.g),ZM(this.b),XM(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:qM,formatHex:qM,formatHex8:JM,formatRgb:YM,toString:YM}));function qM(){return`#${QM(this.r)}${QM(this.g)}${QM(this.b)}`}function JM(){return`#${QM(this.r)}${QM(this.g)}${QM(this.b)}${QM((isNaN(this.opacity)?1:this.opacity)*255)}`}function YM(){let e=XM(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ZM(this.r)}, ${ZM(this.g)}, ${ZM(this.b)}${e===1?`)`:`, ${e})`}`}function XM(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ZM(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function QM(e){return e=ZM(e),(e<16?`0`:``)+e.toString(16)}function $M(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new nN(e,t,n,r)}function eN(e){if(e instanceof nN)return new nN(e.h,e.s,e.l,e.opacity);if(e instanceof CM||(e=VM(e)),!e)return new nN;if(e instanceof nN)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new nN(o,s,c,e.opacity)}function tN(e,t,n,r){return arguments.length===1?eN(e):new nN(e,t,n,r??1)}function nN(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}xM(nN,tN,SM(CM,{brighter(e){return e=e==null?TM:TM**+e,new nN(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wM:wM**+e,new nN(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new KM(aN(e>=240?e-240:e+120,i,r),aN(e,i,r),aN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new nN(rN(this.h),iN(this.s),iN(this.l),XM(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(){let e=XM(this.opacity);return`${e===1?`hsl(`:`hsla(`}${rN(this.h)}, ${iN(this.s)*100}%, ${iN(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function rN(e){return e=(e||0)%360,e<0?e+360:e}function iN(e){return Math.max(0,Math.min(1,e||0))}function aN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var oN=e=>()=>e;function sN(e,t){return function(n){return e+n*t}}function cN(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function lN(e){return(e=+e)==1?uN:function(t,n){return n-t?cN(t,n,e):oN(isNaN(t)?n:t)}}function uN(e,t){var n=t-e;return n?sN(e,n):oN(isNaN(e)?t:e)}var dN=(function e(t){var n=lN(t);function r(e,t){var r=n((e=GM(e)).r,(t=GM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=uN(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function fN(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function pN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function mN(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=CN(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function hN(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function gN(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _N(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=CN(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var vN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yN=new RegExp(vN.source,`g`);function bN(e){return function(){return e}}function xN(e){return function(t){return e(t)+``}}function SN(e,t){var n=vN.lastIndex=yN.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=vN.exec(e))&&(i=yN.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:gN(r,i)})),n=yN.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?xN(c[0].x):bN(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function CN(e,t){var n=typeof t,r;return t==null||n===`boolean`?oN(t):(n===`number`?gN:n===`string`?(r=VM(t))?(t=r,dN):SN:t instanceof VM?dN:t instanceof Date?hN:pN(t)?fN:Array.isArray(t)?mN:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?_N:gN)(e,t)}var wN=180/Math.PI,TN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function EN(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*wN,skewX:Math.atan(c)*wN,scaleX:o,scaleY:s}}var DN;function ON(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?TN:EN(t.a,t.b,t.c,t.d,t.e,t.f)}function kN(e){return e==null||(DN||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),DN.setAttribute(`transform`,e),!(e=DN.transform.baseVal.consolidate()))?TN:(e=e.matrix,EN(e.a,e.b,e.c,e.d,e.e,e.f))}function AN(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:gN(e,i)},{i:c-2,x:gN(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:gN(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:gN(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:gN(e,n)},{i:s-2,x:gN(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var jN=AN(ON,`px, `,`px)`,`deg)`),MN=AN(kN,`, `,`)`,`)`),NN=1e-12;function PN(e){return((e=Math.exp(e))+1/e)/2}function FN(e){return((e=Math.exp(e))-1/e)/2}function IN(e){return((e=Math.exp(2*e))-1)/(e+1)}var LN=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<NN)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=PN(y),c=s/(n*g)*(i*IN(t*r+y)-FN(y));return[a+c*d,o+c*f,s*i/PN(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),RN=0,zN=0,BN=0,VN=1e3,HN,UN,WN=0,GN=0,KN=0,qN=typeof performance==`object`&&performance.now?performance:Date,JN=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function YN(){return GN||=(JN(XN),qN.now()+KN)}function XN(){GN=0}function ZN(){this._call=this._time=this._next=null}ZN.prototype=QN.prototype={constructor:ZN,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?YN():+n)+(t==null?0:+t),!this._next&&UN!==this&&(UN?UN._next=this:HN=this,UN=this),this._call=e,this._time=n,rP()},stop:function(){this._call&&(this._call=null,this._time=1/0,rP())}};function QN(e,t,n){var r=new ZN;return r.restart(e,t,n),r}function $N(){YN(),++RN;for(var e=HN,t;e;)(t=GN-e._time)>=0&&e._call.call(void 0,t),e=e._next;--RN}function eP(){GN=(WN=qN.now())+KN,RN=zN=0;try{$N()}finally{RN=0,nP(),GN=0}}function tP(){var e=qN.now(),t=e-WN;t>VN&&(KN-=t,WN=e)}function nP(){for(var e,t=HN,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:HN=n);UN=e,rP(r)}function rP(e){RN||(zN&&=clearTimeout(zN),e-GN>24?(e<1/0&&(zN=setTimeout(eP,e-qN.now()-KN)),BN&&=clearInterval(BN)):(BN||=(WN=qN.now(),setInterval(tP,VN)),RN=1,JN(eP)))}function iP(e,t,n){var r=new ZN;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var aP=nA(`start`,`end`,`cancel`,`interrupt`),oP=[];function sP(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;dP(e,n,{name:t,index:r,group:i,on:aP,tween:oP,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function cP(e,t){var n=uP(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function lP(e,t){var n=uP(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function uP(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function dP(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=QN(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return iP(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(iP(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function fP(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function pP(e){return this.each(function(){fP(this,e)})}function mP(e,t){var n,r;return function(){var i=lP(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function hP(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=lP(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function gP(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=uP(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?mP:hP)(n,e,t))}function _P(e,t,n){var r=e._id;return e.each(function(){var e=lP(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return uP(e,r).value[t]}}function vP(e,t){var n;return(typeof t==`number`?gN:t instanceof VM?dN:(n=VM(t))?(t=n,dN):SN)(e,t)}function yP(e){return function(){this.removeAttribute(e)}}function bP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xP(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function SP(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function CP(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function wP(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function TP(e,t){var n=cA(e),r=n===`transform`?MN:vP;return this.attrTween(e,typeof t==`function`?(n.local?wP:CP)(n,r,_P(this,`attr.`+e,t)):t==null?(n.local?bP:yP)(n):(n.local?SP:xP)(n,r,t))}function EP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function DP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function OP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&DP(e,i)),n}return i._value=t,i}function kP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&EP(e,i)),n}return i._value=t,i}function AP(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=cA(e);return this.tween(n,(r.local?OP:kP)(r,t))}function jP(e,t){return function(){cP(this,e).delay=+t.apply(this,arguments)}}function MP(e,t){return t=+t,function(){cP(this,e).delay=t}}function NP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?jP:MP)(t,e)):uP(this.node(),t).delay}function PP(e,t){return function(){lP(this,e).duration=+t.apply(this,arguments)}}function FP(e,t){return t=+t,function(){lP(this,e).duration=t}}function IP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?PP:FP)(t,e)):uP(this.node(),t).duration}function LP(e,t){if(typeof t!=`function`)throw Error();return function(){lP(this,e).ease=t}}function RP(e){var t=this._id;return arguments.length?this.each(LP(t,e)):uP(this.node(),t).ease}function zP(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();lP(this,e).ease=n}}function BP(e){if(typeof e!=`function`)throw Error();return this.each(zP(this._id,e))}function VP(e){typeof e!=`function`&&(e=bA(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new gF(r,this._parents,this._name,this._id)}function HP(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new gF(o,this._parents,this._name,this._id)}function UP(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function WP(e,t,n){var r,i,a=UP(t)?cP:lP;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function GP(e,t){var n=this._id;return arguments.length<2?uP(this.node(),n).on.on(e):this.each(WP(n,e,t))}function KP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qP(){return this.on(`end.remove`,KP(this._id))}function JP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=pA(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,sP(l[f],t,n,f,l,uP(u,n)));return new gF(a,this._parents,t,n)}function YP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=_A(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=uP(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&sP(p,t,n,h,f,m);a.push(f),o.push(u)}return new gF(a,o,t,n)}var XP=rM.prototype.constructor;function ZP(){return new XP(this._groups,this._parents)}function QP(e,t){var n,r,i;return function(){var a=uj(this,e),o=(this.style.removeProperty(e),uj(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function $P(e){return function(){this.style.removeProperty(e)}}function eF(e,t,n){var r,i=n+``,a;return function(){var o=uj(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function tF(e,t,n){var r,i,a;return function(){var o=uj(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),uj(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function nF(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=lP(this,e),l=c.on,u=c.value[a]==null?s||=$P(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function rF(e,t,n){var r=(e+=``)==`transform`?jN:vP;return t==null?this.styleTween(e,QP(e,r)).on(`end.style.`+e,$P(e)):typeof t==`function`?this.styleTween(e,tF(e,r,_P(this,`style.`+e,t))).each(nF(this._id,e)):this.styleTween(e,eF(e,r,t),n).on(`end.style.`+e,null)}function iF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function aF(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&iF(e,a,n)),r}return a._value=t,a}function oF(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,aF(e,t,n??``))}function sF(e){return function(){this.textContent=e}}function cF(e){return function(){var t=e(this);this.textContent=t??``}}function lF(e){return this.tween(`text`,typeof e==`function`?cF(_P(this,`text`,e)):sF(e==null?``:e+``))}function uF(e){return function(t){this.textContent=e.call(this,t)}}function dF(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&uF(r)),t}return r._value=e,r}function fF(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,dF(e))}function pF(){for(var e=this._name,t=this._id,n=vF(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=uP(c,t);sP(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new gF(r,this._parents,e,n)}function mF(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=lP(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var hF=0;function gF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function _F(e){return rM().transition(e)}function vF(){return++hF}var yF=rM.prototype;gF.prototype=_F.prototype={constructor:gF,select:JP,selectAll:YP,selectChild:yF.selectChild,selectChildren:yF.selectChildren,filter:VP,merge:HP,selection:ZP,transition:pF,call:yF.call,nodes:yF.nodes,node:yF.node,size:yF.size,empty:yF.empty,each:yF.each,on:GP,attr:TP,attrTween:AP,style:rF,styleTween:oF,text:lF,textTween:fF,remove:qP,tween:gP,delay:NP,duration:IP,ease:RP,easeVarying:BP,end:mF,[Symbol.iterator]:yF[Symbol.iterator]};function bF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xF={time:null,delay:0,duration:250,ease:bF};function SF(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function CF(e){var t,n;e instanceof gF?(t=e._id,e=e._name):(t=vF(),(n=xF).time=YN(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&sP(c,e,t,l,o,n||SF(c,t));return new gF(r,this._parents,e,t)}rM.prototype.interrupt=pP,rM.prototype.transition=CF;var wF=e=>()=>e;function TF(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function EF(e,t,n){this.k=e,this.x=t,this.y=n}EF.prototype={constructor:EF,scale:function(e){return e===1?this:new EF(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new EF(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var DF=new EF(1,0,0);OF.prototype=EF.prototype;function OF(e){for(;!e.__zoom;)if(!(e=e.parentNode))return DF;return e.__zoom}function kF(e){e.stopImmediatePropagation()}function AF(e){e.preventDefault(),e.stopImmediatePropagation()}function jF(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function MF(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function NF(){return this.__zoom||DF}function PF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function FF(){return navigator.maxTouchPoints||`ontouchstart`in this}function IF(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function LF(){var e=jF,t=MF,n=IF,r=PF,i=FF,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=LN,l=nA(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,NF).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,NF),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(DF.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new EF(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new EF(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new EF(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=aM(this.that).datum();l.call(e,this.that,new TF(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=sM(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],fP(this),s.start();AF(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=aM(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=sM(t,i),l=t.clientX,u=t.clientY;fM(t.view),kF(t),a.mouse=[c,this.__zoom.invert(c)],fP(this),a.start();function d(e){if(AF(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=sM(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),pM(e.view,a.moved),AF(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=sM(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);AF(r),s>0?aM(this).transition().duration(s).call(x,d,c,r):aM(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(kF(t),s=0;s<i;++s)c=r[s],l=sM(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),fP(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(AF(e),s=0;s<a;++s)c=i[s],l=sM(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(kF(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=sM(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=aM(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:wF(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:wF(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:wF(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:wF([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var RF={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},zF=[[-1/0,-1/0],[1/0,1/0]],BF=[`Enter`,` `,`Escape`],VF={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},HF;(function(e){e.Strict=`strict`,e.Loose=`loose`})(HF||={});var UF;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(UF||={});var WF;(function(e){e.Partial=`partial`,e.Full=`full`})(WF||={});var GF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},KF;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(KF||={});var qF;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(qF||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var JF={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function YF(e){return e===null?null:e?`valid`:`invalid`}var XF=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,ZF=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),QF=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),$F=(e,t=[0,0])=>{let{width:n,height:r}=NI(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},eI=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:hI(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):QF(n)?n:t.nodeLookup.get(n.id)),pI(e,i?_I(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),tI=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=pI(n,_I(e)),r=!0)}),r?hI(n):{x:0,y:0,width:0,height:0}},nI=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=yI(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},rI=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function iI(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=NI(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function aI({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=AI(tI(iI(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function oI({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,RF.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&MI(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=MI(d)?lI(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,RF.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function sI({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=rI(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var cI=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lI=(e={x:0,y:0},t,n)=>({x:cI(e.x,t[0][0],t[1][0]-(n?.width??0)),y:cI(e.y,t[0][1],t[1][1]-(n?.height??0))});function uI(e,t,n){let{width:r,height:i}=NI(n),{x:a,y:o}=n.internals.positionAbsolute;return lI(e,[[a,o],[a+r,o+i]],t)}var dI=(e,t,n)=>e<t?cI(Math.abs(e-t),1,t)/t:e>n?-cI(Math.abs(e-n),1,t)/t:0,fI=(e,t,n=15,r=40)=>[dI(e.x,r,t.width-r)*n,dI(e.y,r,t.height-r)*n],pI=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),mI=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),hI=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),gI=(e,t=[0,0])=>{let{x:n,y:r}=QF(e)?e.internals.positionAbsolute:$F(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_I=(e,t=[0,0])=>{let{x:n,y:r}=QF(e)?e.internals.positionAbsolute:$F(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},vI=(e,t)=>hI(pI(mI(e),mI(t))),yI=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},bI=(e,t)=>yI(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),xI=e=>SI(e.width)&&SI(e.height)&&SI(e.x)&&SI(e.y),SI=e=>!isNaN(e)&&isFinite(e),CI=(e,t)=>(e,t)=>{},wI=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),TI=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?wI(s,o):s},EI=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function DI(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function OI(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=DI(e,n),i=DI(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=DI(e.top??e.y??0,n),i=DI(e.bottom??e.y??0,n),a=DI(e.left??e.x??0,t),o=DI(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kI(e,t,n,r,i,a){let{x:o,y:s}=EI(e,[t,n,r]),{x:c,y:l}=EI({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var AI=(e,t,n,r,i,a)=>{let o=OI(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=cI(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=kI(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},jI=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function MI(e){return e!=null&&e!==`parent`}function NI(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function PI(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function FI(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function II(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function LI(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function RI(e){return{...VF,...e||{}}}function zI(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=GI(e),s=TI({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?wI(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var BI=e=>({width:e.offsetWidth,height:e.offsetHeight}),VI=e=>e?.getRootNode?.()||window?.document,HI=[`INPUT`,`SELECT`,`TEXTAREA`];function UI(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?HI.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var WI=e=>`clientX`in e,GI=(e,t)=>{let n=WI(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},KI=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...BI(t)}})};function qI({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function JI(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function YI({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-JI(t-r,a),n];case $.Right:return[t+JI(r-t,a),n];case $.Top:return[t,n-JI(n-i,a)];case $.Bottom:return[t,n+JI(i-n,a)]}}function XI({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=YI({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=YI({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=qI({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function ZI({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function QI({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function $I({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=pI(_I(e),_I(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),bI({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},hI(a))>0}var eL=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,tL=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),nL=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,RF.error006()),t;let r=n.getEdgeId||eL,i;return i=XF(e)?{...e}:{...e,id:r(e)},tL(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function rL({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=ZI({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var iL={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},aL=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},oL=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function sL({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=iL[t],c=iL[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=aL({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=ZI({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function cL(e,t,n,r){let i=Math.min(oL(e,t)/2,oL(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function lL({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=sL({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=cL(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function uL(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function dL(e){let{sourceNode:t,targetNode:n}=e;if(!uL(t)||!uL(n))return null;let r=t.internals.handleBounds||fL(t.handles),i=n.internals.handleBounds||fL(n.handles),a=mL(r?.source??[],e.sourceHandle),o=mL(e.connectionMode===HF.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,RF.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=pL(t,a,s),u=pL(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function fL(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function pL(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??NI(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function mL(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function hL(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function gL(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=hL(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var _L=1e3,vL=10,yL={nodeOrigin:[0,0],nodeExtent:zF,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},bL={...yL,checkEquality:!0};function xL(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function SL(e,t,n){let r=xL(yL,n);for(let n of e.values())if(n.parentId)DL(n,e,t,r);else{let e=lI($F(n,r.nodeOrigin),MI(n.extent)?n.extent:r.nodeExtent,NI(n));n.internals.positionAbsolute=e}}function CL(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function wL(e){return e===`manual`}function TL(e,t,n,r={}){let i=xL(bL,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!wL(i.zIndexMode)?_L:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=lI($F(u,i.nodeOrigin),MI(u.extent)?u.extent:i.nodeExtent,NI(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:CL(u,e),z:OL(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&DL(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function EL(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function DL(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=xL(yL,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}EL(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*vL),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=kL(e,u,o,s,a&&!wL(c)?_L:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function OL(e,t,n){let r=SI(e.zIndex)?e.zIndex:0;return wL(n)?r:r+(e.selected?t:0)}function kL(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=NI(e),l=$F(e,n),u=MI(e.extent)?lI(l,e.extent,c):l,d=lI({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=uI(d,c,t));let f=OL(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function AL(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=vI(a.get(n.parentId)?.expandedRect??gI(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=NI(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function jL(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=BI(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=MI(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=uI(h,s,n))}else m&&(h=lI(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:KI(`source`,r.nodeElement,p,d,e.id),target:KI(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&DL(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:gI(g,i)}))}}if(f.length>0){let e=AL(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function ML({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function NL(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function PL(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;NL(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),NL(`target`,s,c,e,i,o),t.set(r.id,r)}}function FL(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:FL(n,t):!1}function IL(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function LL(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!FL(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function RL({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function zL({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=wI(a,t);return{x:o.x-a.x,y:o.y-a.y}}function BL({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=aM(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?mI(tI(s)):null,x=v&&l?zL({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:wI(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=oI({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=RL({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=fI(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=zI(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=LL(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=RL({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=bM().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=zI(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=GI(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=zI(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=GI(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=GI(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=RL({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!IL(t,`.${g}`,v))&&(!_||IL(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function VL(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())bI(i,gI(e))>0&&r.push(e);return r}var HL=250;function UL(e,t,n,r){let i=[],a=1/0,o=VL(e,n,t+HL);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=pL(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function WL(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...pL(o,c,c.position,!0)}:c}function GL(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function KL(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var qL=()=>!0;function JL(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=qL,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=VI(e.target),E=0,D,{x:O,y:k}=GI(e),A=GL(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=WL(i,A,r,c,t);if(!N)return;let P=GI(e,j),ee=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=fI(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:pL(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:JF[ne.position],toNode:null,pointer:P};function z(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&z();function ie(e){if(!M){let{x:t,y:n}=GI(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;z()}if(!x()||!ne){ae(e);return}let a=b();P=GI(e,j),D=UL(TI(P,a,!1,[1,1]),n,c,ne),ee||=(te(),!0);let s=YL(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=KL(!!D,s.isValid);let u=c.get(i),f=u?pL(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?EI({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:JF[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function ae(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ie),T.removeEventListener(`mouseup`,ae),T.removeEventListener(`touchmove`,ie),T.removeEventListener(`touchend`,ae)}}T.addEventListener(`mousemove`,ie),T.addEventListener(`mouseup`,ae),T.addEventListener(`touchmove`,ie),T.addEventListener(`touchend`,ae)}function YL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=qL,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=GI(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=GL(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===HF.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=WL(t,e,a,u,n,!0)}return _}var XL={onPointerDown:JL,isValid:YL};function ZL({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=aM(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&jI()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=LF().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:sM}}var QL=e=>({x:e.x,y:e.y,zoom:e.k}),$L=({x:e,y:t,zoom:n})=>DF.translate(e,t).scale(n),eR=(e,t)=>e.target.closest(`.${t}`),tR=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),nR=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,rR=(e,t=0,n=nR,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},iR=e=>{let t=e.ctrlKey&&jI()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function aR({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(eR(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=sM(u),t=d*2**iR(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===UF.Vertical?0:u.deltaX*f,m=i===UF.Horizontal?0:u.deltaY*f;!jI()&&u.shiftKey&&i!==UF.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=QL(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function oR({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=eR(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function sR({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=QL(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function cR({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&tR(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,QL(a.transform))}}function lR({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&tR(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=QL(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function uR({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(eR(d,`${l}-flow__node`)||eR(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||eR(d,s)&&m||eR(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function dR({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=LF().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=aM(e).call(f);y({x:i.x,y:i.y,zoom:cI(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(iR);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?CN:LN).transform(rR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!SI(E)||E<0?0:E);let k=O?aR({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):oR({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=sR({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=cR({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=lR({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=uR({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=$L(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=$L(e);return await g(n,t),n}function x(e){if(p){let t=$L(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?OF(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?CN:LN).scaleTo(rR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?CN:LN).scaleBy(rR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!SI(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var fR;(function(e){e.Line=`line`,e.Handle=`handle`})(fR||={});function pR({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function mR(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function hR(e,t){return Math.max(0,t-e)}function gR(e,t){return Math.max(0,e-t)}function _R(e,t,n){return Math.max(0,t-e,e-n)}function vR(e,t){return e?!t:t}function yR(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=_R(E,h,g),j=_R(D,_,v);if(o){let e=0,t=0;c&&w<0?e=hR(y+w+O,o[0][0]):!c&&w>0&&(e=gR(y+E+O,o[1][0])),l&&T<0?t=hR(b+T+k,o[0][1]):!l&&T>0&&(t=gR(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=gR(y+w,s[0][0]):!c&&w<0&&(e=hR(y+E,s[1][0])),l&&T>0?t=gR(b+T,s[0][1]):!l&&T<0&&(t=hR(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=_R(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?gR(b+k+E/C,o[1][1])*C:hR(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?hR(b+E/C,s[1][1])*C:gR(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=_R(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?gR(y+D*C+O,o[1][0])/C:hR(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?hR(y+D*C,s[1][0])/C:gR(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(vR(c,l)?-w:w)/C:w=(vR(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var bR={width:0,height:0,x:0,y:0},xR={...bR,pointerX:0,pointerY:0,aspectRatio:1};function SR(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function CR({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=aM(e),o={controlDirection:mR(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...bR},h={...xR};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:mR(e)};let g,_=null,v=[],y,b,x,S=!1,C=bM().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=zI(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=MI(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=SR(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=zI(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=yR(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=pR({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)!==!1&&(S=!0,d?.(e,F),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var wR=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),TR=o(((e,t)=>{t.exports=wR()})),ER=o((e=>{var t=d(),n=TR();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),DR=l(o(((e,t)=>{t.exports=ER()}))(),1),OR=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},kR=e=>e?OR(e):OR,{useDebugValue:AR}=U.default,{useSyncExternalStoreWithSelector:jR}=DR.default,MR=e=>e;function NR(e,t=MR,n){let r=jR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return AR(r),r}var PR=(e,t)=>{let n=kR(e),r=(e,r=t)=>NR(n,e,r);return Object.assign(r,n),r},FR=(e,t)=>e?PR(e,t):PR;function IR(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var LR=(0,U.createContext)(null),RR=LR.Provider,zR=RF.error001(`react`);function BR(e,t){let n=(0,U.useContext)(LR);if(n===null)throw Error(zR);return NR(n,e,t)}function VR(){let e=(0,U.useContext)(LR);if(e===null)throw Error(zR);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var HR={display:`none`},UR={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},WR=`react-flow__node-desc`,GR=`react-flow__edge-desc`,KR=`react-flow__aria-live`,qR=e=>e.ariaLiveMessage,JR=e=>e.ariaLabelConfig;function YR({rfId:e}){let t=BR(qR);return(0,W.jsx)(`div`,{id:`${KR}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:UR,children:t})}function XR({rfId:e,disableKeyboardA11y:t}){let n=BR(JR);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{id:`${WR}-${e}`,style:HR,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,W.jsx)(`div`,{id:`${GR}-${e}`,style:HR,children:n[`edge.a11yDescription.default`]}),!t&&(0,W.jsx)(YR,{rfId:e})]})}var ZR=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,W.jsx)(`div`,{className:eA([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));ZR.displayName=`Panel`;var QR=`https://reactflow.dev?utm_source=attribution`;function $R({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,W.jsx)(ZR,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${QR}`,children:(0,W.jsx)(`a`,{href:QR,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ez=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},tz=e=>e.id;function nz(e,t){return IR(e.selectedNodes.map(tz),t.selectedNodes.map(tz))&&IR(e.selectedEdges.map(tz),t.selectedEdges.map(tz))}function rz({onSelectionChange:e}){let t=VR(),{selectedNodes:n,selectedEdges:r}=BR(ez,nz);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var iz=e=>!!e.onSelectionChangeHandlers;function az({onSelectionChange:e}){let t=BR(iz);return e||t?(0,W.jsx)(rz,{onSelectionChange:e}):null}var oz=[0,0],sz={x:0,y:0,zoom:1},cz=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],lz=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),uz={translateExtent:zF,nodeOrigin:oz,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function dz(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=BR(lz,IR),l=VR();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=uz,s()}),[]);let u=(0,U.useRef)(uz);return(0,U.useEffect)(()=>{for(let s of cz){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:RI(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},cz.map(t=>e[t])),null}function fz(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function pz(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=fz(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?fz()?.matches?`dark`:`light`:t}var mz=typeof document<`u`?document:null;function hz(e=null,t={target:mz,actInsideInputWithModifier:!0}){let[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(!1),a=(0,U.useRef)(new Set([])),[o,s]=(0,U.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
49
49
  `).replace(`
50
50
 
51
51
  `,`
52
52
  +`).split(`
53
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,U.useEffect)(()=>{let n=t?.target??dz,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&BI(e))return!1;let n=mz(e.code,s);if(a.current.add(e[n]),pz(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=mz(e.code,s);pz(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function pz(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function mz(e,t){return t.includes(e)?`code`:`key`}var hz=()=>{let e=RR();return(0,U.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=DI(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return SI(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=CI(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function gz(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)_z(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function _z(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function vz(e,t){return gz(e,t)}function yz(e,t){return gz(e,t)}function bz(e,t){return{id:e,type:`select`,selected:t}}function xz(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(bz(a.id,e)))}return r}function Sz({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Cz(e){return{id:e.id,type:`remove`}}var wz=bI(`React Flow`,`https://reactflow.dev/`);function Tz(e,t,n={}){return $I(e,t,{...n,onError:n.onError??wz})}var Ez=e=>JF(e),Dz=e=>qF(e);function Oz(e){return(0,U.forwardRef)(e)}var kz=typeof window<`u`?U.useLayoutEffect:U.useEffect;function Az(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>jz(()=>n(e=>e+BigInt(1))));return kz(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function jz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Mz=(0,U.createContext)(null);function Nz({children:e}){let t=RR(),n=Az((0,U.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=Sz({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Az((0,U.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(Sz({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,W.jsx)(Mz.Provider,{value:i,children:e})}function Pz(){let e=(0,U.useContext)(Mz);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Fz=e=>!!e.panZoom;function Iz(){let e=hz(),t=RR(),n=Pz(),r=LR(Fz),i=(0,U.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Ez(e)?e:n.get(e.id),a=i.parentId?MI(i.position,i.measured,i.parentId,n,r):i.position;return pI({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Ez(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Dz(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await iI({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Cz);o?.(f),c(e)}if(m){let e=d.map(Cz);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=vI(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=pI(s?r:a),l=_I(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=vI(e)?e:a(e);if(!r)return!1;let i=_I(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return ZF(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??PI();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,U.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Lz=e=>e.selected,Rz=typeof window<`u`?window:void 0;function zz({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=RR(),{deleteElements:r}=Iz(),i=fz(e,{actInsideInputWithModifier:!1}),a=fz(t,{target:Rz});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Lz),edges:e.filter(Lz)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Bz(e){let t=RR();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=LI(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,FF.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Vz={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Hz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Uz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=BF.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=RR(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=LR(Hz,NR),E=fz(f),D=(0,U.useRef)();Bz(S);let O=(0,U.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,U.useEffect)(()=>{if(S.current){D.current=cR({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,U.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,W.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Vz,children:m})}var Wz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Gz(){let{userSelectionActive:e,userSelectionRect:t}=LR(Wz,NR);return e&&t?(0,W.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Kz=(e,t)=>n=>{n.target===t.current&&e?.(n)},qz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Jz({isSelecting:e,selectionKeyPressed:t,selectionMode:n=VF.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,U.useRef)(0),_=RR(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=LR(qz,NR),C=y&&(e||v),w=(0,U.useRef)(null),T=(0,U.useRef)(),E=(0,U.useRef)(new Set),D=(0,U.useRef)(new Set),O=(0,U.useRef)(!1),k=(0,U.useRef)(!1),A=(0,U.useRef)({x:0,y:0}),j=(0,U.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},F=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=HI(n.nativeEvent,T.current),l=SI({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=CI(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set($F(a,m,i,n===VF.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}NI(h,E.current)||c(xz(a,E.current,!0)),NI(g,D.current)||l(xz(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=lI(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,W.jsxs)(`div`,{className:Zk([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:Kz(M,w),onContextMenu:Kz(N,w),onWheel:Kz(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=HI(e.nativeEvent,T.current);A.current={x:o,y:c};let l=CI({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),te())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:C?F:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:Vz,children:[h,(0,W.jsx)(Gz,{})]})}function Yz({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,FF.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Xz({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=RR(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=LL({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Yz({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,U.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var Zz=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Qz(){let e=RR();return(0,U.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Zz(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=xI(t,i));let{position:a,positionAbsolute:s}=rI({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var $z=(0,U.createContext)(null),eB=$z.Provider;$z.Consumer;var tB=()=>(0,U.useContext)($z),nB=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),rB=(0,U.createContext)(null);function iB({children:e}){let t=LR(nB,NR);return(0,W.jsx)(rB.Provider,{value:t,children:e})}function aB(){let e=(0,U.useContext)(rB);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var oB={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},sB=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return oB;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===zF.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function cB({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=RR(),_=tB(),{connectOnClick:v,noPanClassName:y,rfId:b}=aB(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=LR(sB(_,m,e),NR);_||g.getState().onError?.(`010`,FF.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Tz(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=VI(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();qL.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,W.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Zk([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=RI(t.target),h=n||c,{connection:v,isValid:y}=qL.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var lB=(0,U.memo)(Oz(cB));function uB({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[e?.label,(0,W.jsx)(lB,{type:`source`,position:n,isConnectable:t})]})}function dB({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lB,{type:`target`,position:n,isConnectable:t}),e?.label,(0,W.jsx)(lB,{type:`source`,position:r,isConnectable:t})]})}function fB(){return null}function pB({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(lB,{type:`target`,position:n,isConnectable:t}),e?.label]})}var mB={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hB={input:uB,default:dB,output:pB,group:fB};function gB(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var _B=e=>{let{width:t,height:n,x:r,y:i}=QF(e.nodeLookup,{filter:e=>!!e.selected});return{width:yI(t)?t:null,height:yI(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function vB({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=RR(),{width:i,height:a,transformString:o,userSelectionActive:s}=LR(_B,NR),c=Qz(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Xz({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,W.jsx)(`div`,{className:Zk([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,W.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(mB,e.key)&&(e.preventDefault(),c({direction:mB[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var yB=typeof window<`u`?window:void 0,bB=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function xB({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=LR(bB,NR),te=fz(l,{target:yB}),ne=fz(h,{target:yB}),re=ne||w,R=ne||b,z=u&&re!==!0,ie=te||L||z;return zz({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,W.jsx)(Uz,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:F,paneClickDistance:s,selectionOnDrag:z,children:(0,W.jsxs)(Jz,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:z,children:[e,I&&(0,W.jsx)(vB,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}xB.displayName=`FlowRenderer`;var SB=(0,U.memo)(xB),CB=e=>t=>e?$F(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function wB(e){return LR((0,U.useCallback)(CB(e),[e]),NR)}var TB=e=>e.updateNodeInternals;function EB(){let e=LR(TB),[t]=(0,U.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,U.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function DB({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=RR(),a=(0,U.useRef)(null),o=(0,U.useRef)(null),s=(0,U.useRef)(e.sourcePosition),c=(0,U.useRef)(e.targetPosition),l=(0,U.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,U.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,U.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,U.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function OB({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=LR(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},NR),S=y.type||`default`,C=g?.[S]||hB[S];C===void 0&&(v?.(`003`,FF.error003(S)),S=`default`,C=g?.default||hB.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=RR(),k=jI(y),A=DB({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Xz({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Qz();if(y.hidden)return null;let N=AI(y),P=gB(y),ee=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Yz({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(BI(t.nativeEvent)||m)){if(LF.includes(t.key)&&T){let n=t.key===`Escape`;Yz({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(mB,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:mB[t.key],factor:t.shiftKey?4:1})}}},z=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&($F(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,W.jsx)(`div`,{className:Zk([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?z:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${VR}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,W.jsx)(eB,{value:e,children:(0,W.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var kB=(0,U.memo)(OB),AB=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jB(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=LR(AB,NR),a=wB(e.onlyRenderVisibleElements),o=EB();return(0,W.jsx)(`div`,{className:`react-flow__nodes`,style:Vz,children:a.map(a=>(0,W.jsx)(kB,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}jB.displayName=`NodeRenderer`;var MB=(0,U.memo)(jB);function NB(e){return LR((0,U.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&XI({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),NR)}var PB=({color:e=`none`,strokeWidth:t=1})=>(0,W.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),FB=({color:e=`none`,strokeWidth:t=1})=>(0,W.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),IB={[WF.Arrow]:PB,[WF.ArrowClosed]:FB};function LB(e){let t=RR();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(IB,e)?IB[e]:(t.getState().onError?.(`009`,FF.error009(e)),null),[e])}var RB=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=LB(t);return c?(0,W.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,W.jsx)(c,{color:n,strokeWidth:o})}):null},zB=({defaultColor:e,rfId:t})=>{let n=LR(e=>e.edges),r=LR(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>pL(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,W.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,W.jsx)(`defs`,{children:i.map(e=>(0,W.jsx)(RB,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};zB.displayName=`MarkerDefinitions`;var BB=(0,U.memo)(zB);function VB({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,U.useState)({x:1,y:0,width:0,height:0}),p=Zk([`react-flow__edge-textwrapper`,l]),m=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,W.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,W.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,W.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}VB.displayName=`EdgeText`;var HB=(0,U.memo)(VB);function UB({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{...u,d:e,fill:`none`,className:Zk([`react-flow__edge-path`,u.className])}),l?(0,W.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&yI(t)&&yI(n)?(0,W.jsx)(HB,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function WB({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function GB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=WB({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=WB({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=WI({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function KB(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=GB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,W.jsx)(UB,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var qB=KB({isInternal:!1}),JB=KB({isInternal:!0});qB.displayName=`SimpleBezierEdge`,JB.displayName=`SimpleBezierEdgeInternal`;function YB(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=oL({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,W.jsx)(UB,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var XB=YB({isInternal:!1}),ZB=YB({isInternal:!0});XB.displayName=`SmoothStepEdge`,ZB.displayName=`SmoothStepEdgeInternal`;function QB(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,W.jsx)(XB,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var $B=QB({isInternal:!1}),eV=QB({isInternal:!0});$B.displayName=`StepEdge`,eV.displayName=`StepEdgeInternal`;function tV(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=eL({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,W.jsx)(UB,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var nV=tV({isInternal:!1}),rV=tV({isInternal:!0});nV.displayName=`StraightEdge`,rV.displayName=`StraightEdgeInternal`;function iV(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=qI({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,W.jsx)(UB,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var aV=iV({isInternal:!1}),oV=iV({isInternal:!0});aV.displayName=`BezierEdge`,oV.displayName=`BezierEdgeInternal`;var sV={default:oV,straight:rV,step:eV,smoothstep:ZB,simplebezier:JB},cV={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},lV=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,uV=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,dV=`react-flow__edgeupdater`;function fV({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,W.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Zk([dV,`${dV}-${s}`]),cx:lV(t,r,e),cy:uV(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function pV({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=RR(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;qL.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,W.jsxs)(W.Fragment,{children:[(e===!0||e===`source`)&&(0,W.jsx)(fV,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,W.jsx)(fV,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function mV({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=LR(t=>t.edgeLookup.get(e)),b=LR(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||sV[x];S===void 0&&(_?.(`011`,FF.error011(x)),x=`default`,S=h?.default||sV.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,U.useRef)(null),[D,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),j=RR(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L}=LR((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return cV;let i=cL({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=YI({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||cV,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),NR),te=(0,U.useMemo)(()=>y.markerStart?`url('#${fL(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${fL(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||F===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},R=a?e=>{a(e,{...y})}:void 0,z=o?e=>{o(e,{...y})}:void 0,ie=s?e=>{s(e,{...y})}:void 0,ae=c?e=>{c(e,{...y})}:void 0,oe=l?e=>{l(e,{...y})}:void 0;return(0,W.jsx)(`svg`,{style:{zIndex:M},children:(0,W.jsxs)(`g`,{className:Zk([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:R,onContextMenu:z,onMouseEnter:ie,onMouseMove:ae,onMouseLeave:oe,onKeyDown:C?t=>{if(!v&&LF.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${HR}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,W.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,W.jsx)(pV,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var hV=(0,U.memo)(mV),gV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _V({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=LR(gV,NR),b=NB(t);return(0,W.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,W.jsx)(BB,{defaultColor:e,rfId:n}),b.map(e=>(0,W.jsx)(hV,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}_V.displayName=`EdgeRenderer`;var vV=(0,U.memo)(_V),yV=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function bV({children:e}){let t=RR(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return kz(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=yV(r)))};return r(),t.subscribe(r)},[t]),(0,W.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:yV(r)},children:e})}function xV(e){let t=Iz(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var SV=e=>e.panZoom?.syncViewport;function CV(e){let t=LR(SV),n=RR();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function wV(e){return e.connection.inProgress?{...e.connection,to:SI(e.connection.to,e.transform)}:{...e.connection}}function TV(e){return e?t=>e(wV(t)):wV}function EV(e){return LR(TV(e),NR)}var DV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function OV({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=LR(DV,NR);return a&&i&&c?(0,W.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,W.jsx)(`g`,{className:Zk([`react-flow__connection`,KF(s)]),children:(0,W.jsx)(kV,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var kV=({style:e,type:t=UF.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=EV();if(!i)return;if(n)return(0,W.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:KF(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case UF.Bezier:[m]=qI(h);break;case UF.SimpleBezier:[m]=GB(h);break;case UF.Step:[m]=oL({...h,borderRadius:0});break;case UF.SmoothStep:[m]=oL(h);break;default:[m]=eL(h)}return(0,W.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};kV.displayName=`ConnectionLine`;var AV={};function jV(e=AV){(0,U.useRef)(e),RR(),(0,U.useEffect)(()=>{},[e])}function MV(){RR(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function NV({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneScroll:ae,onPaneContextMenu:oe,paneClickDistance:se,nodeClickDistance:ce,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se,viewport:B,onViewportChange:Ce,nodesDraggable:we}){return jV(e),jV(t),MV(),xV(n),CV(B),(0,W.jsx)(SB,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneContextMenu:oe,onPaneScroll:ae,paneClickDistance:se,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,onViewportChange:Ce,isControlledViewport:!!B,children:(0,W.jsxs)(bV,{children:[(0,W.jsx)(vV,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,onlyRenderVisibleElements:T,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,defaultMarkerColor:M,noPanClassName:ye,disableKeyboardA11y:be,rfId:Se}),(0,W.jsx)(OV,{style:h,type:m,component:g,containerStyle:_}),(0,W.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,W.jsx)(MB,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ce,onlyRenderVisibleElements:T,noPanClassName:ye,noDragClassName:_e,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se,nodesDraggable:we}),(0,W.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}NV.displayName=`GraphView`;var PV=(0,U.memo)(NV),FV=bI(`React Flow`,`https://reactflow.dev/`),IV=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??IF;jL(h,g,_);let{nodesInitialized:x}=SL(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=DI(QF(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:IF,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:zF.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...HF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:FV,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:RF,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},LV=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>MR((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await nI({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...IV({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=SL(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();jL(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=OL(e,n,r,i,a,o,l);d&&(yL(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=uL(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=DL(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(vz(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(yz(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>bz(e,!0)));return}i(xz(r,new Set([...e]),!0)),a(xz(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>bz(e,!0)));return}a(xz(n,new Set([...e]))),i(xz(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(bz(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(bz(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,bz(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,bz(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(SL(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return kL({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...HF}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...IV()})}},Object.is);function RV({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,U.useState)(()=>LV({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,W.jsx)(FR,{value:m,children:(0,W.jsx)(Nz,{children:(0,W.jsx)(iB,{children:p})})})}function zV({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,U.useContext)(PR)?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(RV,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var BV={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function VV({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:F,connectionMode:I,connectionLineType:L=UF.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:z=`Shift`,selectionOnDrag:ie=!1,selectionMode:ae=VF.Full,panActivationKeyCode:oe=`Space`,multiSelectionKeyCode:se=OI()?`Meta`:`Control`,zoomActivationKeyCode:ce=OI()?`Meta`:`Control`,snapToGrid:le,snapGrid:ue,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:fe,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:he,nodesFocusable:ge,nodeOrigin:_e=rz,edgesFocusable:ve,edgesReconnectable:ye,elementsSelectable:be=!0,defaultViewport:xe=iz,minZoom:Se=.5,maxZoom:B=2,translateExtent:Ce=IF,preventScrolling:we=!0,nodeExtent:Te,defaultMarkerColor:Ee=`#b1b1b7`,zoomOnScroll:De=!0,zoomOnPinch:Oe=!0,panOnScroll:ke=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:je=BF.Free,zoomOnDoubleClick:Me=!0,panOnDrag:Ne=!0,onPaneClick:V,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:H,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye=10,onNodesChange:Xe,onEdgesChange:Ze,noDragClassName:Qe=`nodrag`,noWheelClassName:$e=`nowheel`,noPanClassName:et=`nopan`,fitView:tt,fitViewOptions:nt,connectOnClick:rt,attributionPosition:it,proOptions:at,defaultEdgeOptions:ot,elevateNodesOnSelect:st=!0,elevateEdgesOnSelect:ct=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanOnSelection:ft=!0,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:vt,nodeDragThreshold:yt,connectionDragThreshold:bt,viewport:xt,onViewportChange:St,width:Ct,height:wt,colorMode:Tt=`light`,debug:Et,onScroll:Dt,ariaLabelConfig:Ot,zIndexMode:kt=`basic`,...At},jt){let Mt=vt||`1`,Nt=uz(Tt),Pt=(0,U.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Dt?.(e)},[Dt]);return(0,W.jsx)(`div`,{"data-testid":`rf__wrapper`,...At,onScroll:Pt,style:{..._t,...BV},ref:jt,className:Zk([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,W.jsxs)(zV,{nodes:e,edges:t,width:Ct,height:wt,fitView:tt,fitViewOptions:nt,minZoom:Se,maxZoom:B,nodeOrigin:_e,nodeExtent:Te,zIndexMode:kt,children:[(0,W.jsx)(cz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:he,nodesFocusable:ge,edgesFocusable:ve,edgesReconnectable:ye,elementsSelectable:be,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Se,maxZoom:B,nodeExtent:Te,onNodesChange:Xe,onEdgesChange:Ze,snapToGrid:le,snapGrid:ue,connectionMode:I,translateExtent:Ce,connectOnClick:rt,defaultEdgeOptions:ot,fitView:tt,fitViewOptions:nt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:et,nodeOrigin:_e,rfId:Mt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:fe,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:F,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,W.jsx)(PV,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:z,selectionOnDrag:ie,selectionMode:ae,deleteKeyCode:R,multiSelectionKeyCode:se,panActivationKeyCode:oe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:de,defaultViewport:xe,translateExtent:Ce,minZoom:Se,maxZoom:B,preventScrolling:we,zoomOnScroll:De,zoomOnPinch:Oe,zoomOnDoubleClick:Me,panOnScroll:ke,panOnScrollSpeed:Ae,panOnScrollMode:je,panOnDrag:Ne,autoPanOnSelection:ft,onPaneClick:V,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye,defaultMarkerColor:Ee,noDragClassName:Qe,noWheelClassName:$e,noPanClassName:et,rfId:Mt,disableKeyboardA11y:lt,nodeExtent:Te,viewport:xt,onViewportChange:St,nodesDraggable:pe}),(0,W.jsx)(nz,{onSelectionChange:k}),H,(0,W.jsx)(XR,{proOptions:at,position:it}),(0,W.jsx)(qR,{rfId:Mt,disableKeyboardA11y:lt})]})})}var HV=Oz(VV);FF.error014();function UV({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,W.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Zk([`react-flow__background-pattern`,n,r])})}function WV({radius:e,className:t}){return(0,W.jsx)(`circle`,{cx:e,cy:e,r:e,className:Zk([`react-flow__background-pattern`,`dots`,t])})}var GV;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(GV||={});var KV={[GV.Dots]:1,[GV.Lines]:1,[GV.Cross]:6},qV=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JV({id:e,variant:t=GV.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,U.useRef)(null),{transform:f,patternId:p}=LR(qV,NR),m=r||KV[t],h=t===GV.Dots,g=t===GV.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,W.jsxs)(`svg`,{className:Zk([`react-flow__background`,l]),style:{...c,...Vz,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,W.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,W.jsx)(WV,{radius:y/2,className:u}):(0,W.jsx)(UV,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}JV.displayName=`Background`;var YV=(0,U.memo)(JV);function XV(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,W.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function ZV(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,W.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function QV(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,W.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function $V(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,W.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function eH(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,W.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function tH({children:e,className:t,...n}){return(0,W.jsx)(`button`,{type:`button`,className:Zk([`react-flow__controls-button`,t]),...n,children:e})}var nH=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function rH({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=RR(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=LR(nH,NR),{zoomIn:y,zoomOut:b,fitView:x}=Iz();return(0,W.jsxs)(JR,{className:Zk([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(tH,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,W.jsx)(XV,{})}),(0,W.jsx)(tH,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,W.jsx)(ZV,{})})]}),n&&(0,W.jsx)(tH,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,W.jsx)(QV,{})}),r&&(0,W.jsx)(tH,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,W.jsx)(eH,{}):(0,W.jsx)($V,{})}),u]})}rH.displayName=`Controls`;var iH=(0,U.memo)(rH);function aH({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,W.jsx)(`rect`,{className:Zk([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var oH=(0,U.memo)(aH),sH=e=>e.nodes.map(e=>e.id),cH=e=>e instanceof Function?e:()=>e;function lH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=oH,onClick:o}){let s=LR(sH,NR),c=cH(t),l=cH(e),u=cH(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsx)(dH,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function uH({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=LR(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=AI(r);return{node:r,x:i,y:a,width:o,height:s}},NR);return!l||l.hidden||!jI(l)?null:(0,W.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var dH=(0,U.memo)(uH),fH=(0,U.memo)(lH),pH=200,mH=150,hH=e=>!e.hidden,gH=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?hI(QF(e.nodeLookup,{filter:hH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},_H=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,vH=(e,t)=>_H(e.viewBB,t.viewBB)&&_H(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,yH=`react-flow__minimap-desc`;function bH({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=RR(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=LR(gH,vH),j=e?.width??pH,M=e?.height??mH,N=C.width/j,P=C.height/M,ee=Math.max(N,P),F=ee*j,I=ee*M,L=b*ee,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,re=F+L*2,R=I+L*2,z=`${yH}-${T}`,ie=(0,U.useRef)(0),ae=(0,U.useRef)();ie.current=ee,(0,U.useEffect)(()=>{if(S.current&&E)return ae.current=JL({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ie.current}),()=>{ae.current?.destroy()}},[E]),(0,U.useEffect)(()=>{ae.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let oe=p?e=>{let[t,n]=ae.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,se=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ce=_??A[`minimap.ariaLabel`];return(0,W.jsx)(JR,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:Zk([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,W.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${R}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":z,ref:S,onClick:oe,children:[ce&&(0,W.jsx)(`title`,{id:z,children:ce}),(0,W.jsx)(fH,{onClick:se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,W.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${re+L*2}v${R+L*2}h${-re-L*2}z
54
- M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}bH.displayName=`MiniMap`,(0,U.memo)(bH);var xH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,SH={[lR.Line]:`right`,[lR.Handle]:`bottom-right`};function CH({nodeId:e,position:t,variant:n=lR.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=tB(),y=typeof e==`string`?e:v,b=RR(),x=(0,U.useRef)(null),S=n===lR.Handle,C=LR((0,U.useCallback)(xH(S&&p),[S,p]),NR),w=(0,U.useRef)(null),T=t??SH[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=bR({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=DL([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...MI({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,W.jsx)(`div`,{className:Zk([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,U.memo)(CH);function wH(e){return e.graph??void 0}function TH(e){let t=wH(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=FH(r,`kind`)===`human`?`human`:IH(r)?`lifecycle`:`agent`,a=t.node_results[r.id]??t.result?.results?.[r.id],o=t.node_status[r.id];return o===void 0?[]:[{id:r.id,label:FH(r,`name`)??r.id,status:o,kind:i,task:r,telemetry:n.get(r.id),result:a,detail:e.node_details[r.id],control:t.node_control[r.id],failure:n.get(r.id)?.failure,blockers:[...t.node_gated_by[r.id]??[],...a?.blocked_by??[]]}]})}function EH(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function DH(e){let t=EH(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${LH(e.launch_id)}`:`${t} session · ${LH(e.session_key)}`}function OH(e){if(e.blockers.length>0&&AH.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(jH.has(e.status))return kH(e)??`${e.status}, with no reason recorded`}function kH(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var AH=new Set([`blocked`,`skipped`,`waiting`]),jH=new Set([`failed`,`not-completed`,`cancelled`]);function MH(e){let t=Hk,n=t=>(e[t]??0)>0;return[...t.filter(n),...Object.keys(e).filter(e=>!t.includes(e)).sort().filter(n)].map(t=>`${e[t]} ${t}`).join(` · `)}function NH(e){return jH.has(e)||e===`blocked`||e===`skipped`}function PH(e){let t=new Map;for(let n of e){let e=n.launch?.session_key,r=e===void 0?`run:${n.run_id}`:`session:${n.launch?.launcher}:${e}`,i=t.get(r);t.set(r,{id:r,launcher:EH(n.launch),label:DH(n.launch),runs:[...i?.runs??[],n]})}return[...t.values()]}function FH(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function IH(e){return`repo`in e||`steps`in e}function LH(e){return e.length>12?`${e.slice(0,8)}…`:e}function RH({data:e}){let t=e.style===`success`?yt:e.style===`danger`||e.style===`muted`?Xt:e.style===`active`?Ct:Et;return(0,W.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:at(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,W.jsx)(lB,{type:`target`,position:$.Left}),(0,W.jsxs)(`div`,{className:`node-heading`,children:[(0,W.jsx)(ya,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,W.jsx)(t,{className:at(e.style===`active`&&`spin`),size:17})]}),(0,W.jsx)(`strong`,{children:e.label}),(0,W.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,W.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),(0,W.jsx)(lB,{type:`source`,position:$.Right})]})}function zH({data:e,id:t,markerEnd:n,style:r}){return(0,W.jsx)(UB,{id:t,path:BH(e?.points??[]),markerEnd:n,style:r})}function BH(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var VH={dagNode:RH},HH={routed:zH};function UH({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)NH(n.status)&&t.set(n.id,OH(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=Xk({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status})),edges:e.flatMap(e=>(e.task.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:i.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...r.get(e.id)===void 0?{}:{reason:r.get(e.id)}},style:{width:e.width,height:e.height}})),edges:i.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,r,t]);return(0,W.jsxs)(`div`,{className:`graph-wrap`,children:[(0,W.jsxs)(HV,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:VH,edgeTypes:HH,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,W.jsx)(YV,{color:`var(--border)`,gap:22}),(0,W.jsx)(iH,{showInteractive:!1})]}),(0,W.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,r.get(e.id)===void 0?``:` — ${r.get(e.id)}`]})},e.id))})]})}function WH({className:e,state:t}){return(0,W.jsxs)(ya,{className:at(`gap-1.5 tracking-[.03em] uppercase`,YH[t],e),variant:`outline`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:at(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}var GH=`border-success bg-success-surface text-success`,KH=`border-destructive bg-destructive-surface text-destructive`,qH=`border-warning bg-warning-surface text-warning`,JH={blocked:qH,cancelled:KH,done:GH,failed:KH,"not-completed":KH,parked:void 0,pending:void 0,running:`border-info bg-info-surface text-info`,skipped:qH,unknown:void 0,waiting:void 0},YH={...JH,complete:JH.done,settled:JH.done,active:JH.running};function XH({groups:e,selectedRunId:t,liveRunIds:n,onSelect:r,hasMore:i,onLoadMore:a}){return(0,W.jsx)(`nav`,{"aria-label":`DAG runs`,className:`run-nav`,onScrollCapture:e=>{let t=e.target;i&&t.scrollHeight-t.scrollTop<=t.clientHeight+80&&a()},children:(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,W.jsxs)(`div`,{className:`brand`,children:[(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,W.jsx)(gt,{size:20})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,W.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,W.jsx)(jl,{className:`my-[22px]`}),(0,W.jsx)(`div`,{className:`run-groups`,children:e.map(e=>(0,W.jsxs)(`section`,{"aria-labelledby":`group-${e.id}`,children:[(0,W.jsxs)(`h2`,{id:`group-${e.id}`,children:[(0,W.jsx)(vt,{"aria-hidden":`true`,size:14}),e.label]}),e.runs.map(e=>{let i=t===e.run_id,a=MH(e.node_counts);return(0,W.jsxs)(`button`,{"aria-current":i?`page`:void 0,className:`run-link`,"data-active":i,onClick:()=>r(e.run_id),type:`button`,children:[(0,W.jsxs)(`span`,{className:`run-link-main`,children:[n.has(e.run_id)?(0,W.jsxs)(xd,{children:[(0,W.jsx)(Sd,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":`Live`,className:`live-dot`,role:`img`})}),(0,W.jsx)(Cd,{children:`Live`})]}):(0,W.jsx)(Vt,{"aria-label":`Historical`,size:13}),(0,W.jsx)(`span`,{children:e.run_id})]}),(0,W.jsx)(WH,{className:`px-[5px] py-px text-[9px]`,state:e.state}),(0,W.jsx)(xt,{"aria-hidden":`true`,size:14}),a!==``&&(0,W.jsx)(`span`,{className:`run-link-counts`,title:a,children:a})]},e.run_id)})]},e.id))}),i&&(0,W.jsx)(`button`,{className:`sr-only`,onClick:()=>void a(),type:`button`,children:`Load more runs`})]})})})}function ZH(e,t,n,r){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(),[c,l]=(0,U.useState)(!0),[u,d]=(0,U.useState)(),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(),[g,_]=(0,U.useState)(0),v=i===void 0?void 0:i.runs.some(({run_id:e})=>e===t)?t:i.runs.at(0)?.run_id,y=n===void 0?void 0:n.nodeId??`run`,b=(0,U.useRef)(v);(0,U.useEffect)(()=>{b.current=v},[v]);let x=(0,U.useCallback)(async()=>{a(await e.listRuns(!0))},[e]),S=(0,U.useCallback)(async()=>{if(i?.next_cursor!==void 0)try{let t=await e.listRuns(!0,i.next_cursor);a(e=>e===void 0?t:{...t,runs:[...e.runs,...t.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),h(void 0)}catch(e){h(eU(e))}},[e,i]),C=(0,U.useCallback)(async()=>{try{await x(),h(void 0)}catch(e){h(eU(e))}finally{l(!1)}_(e=>e+1)},[x]);(0,U.useEffect)(()=>{if(v===void 0){s(void 0);return}let t=!0,i=e=>e.runId===v&&e.timelineScope===y&&e.filter===r;s(e=>{if(e!==void 0&&i(e))return e;let t=e?.runId===v&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:v,filter:r,timelineScope:y,...t===void 0?{}:{detail:t}}});let a=e=>{t&&s(t=>t!==void 0&&i(t)?e(t):t)};return e.getRun(v,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),t&&h(void 0)}).catch(QH).catch(e=>{t&&h(eU(e))}),n!==void 0&&e.getTimeline(v,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(QH).catch(e=>a(t=>({...t,timelineError:eU(e)}))),()=>{t=!1}},[e,v,g,n?.nodeId,y,r]),(0,U.useEffect)(()=>{C();let t=e.subscribe({onEvent:e=>{if(d(new Date().toISOString()),h(void 0),e.event===`snapshot`){a(WO(e.data)),_(e=>e+1);return}let t=$H(e);t!==void 0&&(x().catch(e=>h(eU(e))),t===b.current&&_(e=>e+1))},onError:e=>{h(eU(e))}});return()=>t.close()},[e,x,C]),(0,U.useEffect)(()=>{if(v===void 0){p([]);return}let t=e.subscribe({runId:v,filter:r,onEvent:e=>{if(d(new Date().toISOString()),h(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;p(UO.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&_(e=>e+1)}},onError:e=>h(eU(e))});return()=>t.close()},[e,v,r]);let w=o!==void 0&&o.runId===v&&o.filter===r?o:void 0;return(0,U.useMemo)(()=>({list:i,runId:v,detail:w?.detail,timeline:w?.timeline,timelineError:w?.timelineError,loading:c,lastUpdated:u,activity:f,error:m,refresh:C,loadMore:S,hasMore:i?.next_cursor!==void 0}),[i,v,w,c,u,f,m,C,S])}function QH(e){if(!(e instanceof GO&&e.code===`run_not_found`))throw e}function $H(e){let t=`run_id`in e.data?e.data.run_id:void 0;return typeof t==`string`&&t.length>0?t:void 0}function eU(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var tU=365.2425,nU=6048e5,rU=864e5,iU=6e4,aU=36e5,oU=1e3,sU=525600,cU=43200,lU=1440,uU=3600*24;uU*7,uU*tU/12*3;var dU=Symbol.for(`constructDateFrom`);function fU(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&dU in e?e[dU](t):e instanceof Date?new e.constructor(t):new Date(t)}function pU(e,t){return fU(t||e,e)}var mU={};function hU(){return mU}function gU(e,t){let n=hU(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=pU(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function _U(e,t){return gU(e,{...t,weekStartsOn:1})}function vU(e,t){let n=pU(e,t?.in),r=n.getFullYear(),i=fU(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=_U(i),o=fU(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=_U(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function yU(e){let t=pU(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function bU(e,...t){let n=fU.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function xU(e,t){let n=pU(e,t?.in);return n.setHours(0,0,0,0),n}function SU(e,t,n){let[r,i]=bU(n?.in,e,t),a=xU(r),o=xU(i),s=+a-yU(a),c=+o-yU(o);return Math.round((s-c)/rU)}function CU(e,t){let n=vU(e,t),r=fU(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),_U(r)}function wU(e,t){let n=pU(e)-+pU(t);return n<0?-1:n>0?1:n}function TU(e){return fU(e,Date.now())}function EU(e,t,n){let[r,i]=bU(n?.in,e,t);return+xU(r)==+xU(i)}function DU(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function OU(e){return!(!DU(e)&&typeof e!=`number`||isNaN(+pU(e)))}function kU(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function AU(e,t){let n=pU(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var jU={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},MU=(e,t,n)=>{let r,i=jU[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function NU(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var PU={date:NU({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:NU({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:NU({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},FU={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},IU=(e,t,n,r)=>FU[e];function LU(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var RU={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:LU({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:LU({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:LU({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:LU({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:LU({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function zU(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?VU(s,e=>e.test(o)):BU(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function BU(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function VU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function HU(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var UU={code:`en-US`,formatDistance:MU,formatLong:PU,formatRelative:IU,localize:RU,match:{ordinalNumber:HU({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:zU({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:zU({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:zU({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:zU({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:zU({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function WU(e,t){let n=pU(e,t?.in);return SU(n,AU(n))+1}function GU(e,t){let n=pU(e,t?.in),r=_U(n)-+CU(n);return Math.round(r/nU)+1}function KU(e,t){let n=pU(e,t?.in),r=n.getFullYear(),i=hU(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=fU(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=gU(o,t),c=fU(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=gU(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function qU(e,t){let n=hU(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=KU(e,t),a=fU(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),gU(a,t)}function JU(e,t){let n=pU(e,t?.in),r=gU(n,t)-+qU(n,t);return Math.round(r/nU)+1}function YU(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var XU={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return YU(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):YU(n+1,2)},d(e,t){return YU(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return YU(e.getHours()%12||12,t.length)},H(e,t){return YU(e.getHours(),t.length)},m(e,t){return YU(e.getMinutes(),t.length)},s(e,t){return YU(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return YU(Math.trunc(r*10**(n-3)),t.length)}},ZU={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},QU={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return XU.y(e,t)},Y:function(e,t,n,r){let i=KU(e,r),a=i>0?i:1-i;return t===`YY`?YU(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):YU(a,t.length)},R:function(e,t){return YU(vU(e),t.length)},u:function(e,t){return YU(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return YU(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return YU(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return XU.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return YU(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=JU(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):YU(i,t.length)},I:function(e,t,n){let r=GU(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):YU(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):XU.d(e,t)},D:function(e,t,n){let r=WU(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):YU(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return YU(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return YU(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return YU(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?ZU.noon:r===0?ZU.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?ZU.evening:r>=12?ZU.afternoon:r>=4?ZU.morning:ZU.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return XU.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):XU.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):YU(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):YU(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):XU.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):XU.s(e,t)},S:function(e,t){return XU.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return eW(r);case`XXXX`:case`XX`:return tW(r);default:return tW(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return eW(r);case`xxxx`:case`xx`:return tW(r);default:return tW(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+$U(r,`:`);default:return`GMT`+tW(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+$U(r,`:`);default:return`GMT`+tW(r,`:`)}},t:function(e,t,n){return YU(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return YU(+e,t.length)}};function $U(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+YU(a,2)}function eW(e,t){return e%60==0?(e>0?`-`:`+`)+YU(Math.abs(e)/60,2):tW(e,t)}function tW(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=YU(Math.trunc(r/60),2),a=YU(r%60,2);return n+i+t+a}var nW=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},rW=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},iW={p:rW,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return nW(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,nW(r,t)).replace(`{{time}}`,rW(i,t))}},aW=/^D+$/,oW=/^Y+$/,sW=[`D`,`DD`,`YY`,`YYYY`];function cW(e){return aW.test(e)}function lW(e){return oW.test(e)}function uW(e,t,n){let r=dW(e,t,n);if(console.warn(r),sW.includes(e))throw RangeError(r)}function dW(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var fW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mW=/^'([^]*?)'?$/,hW=/''/g,gW=/[a-zA-Z]/;function _W(e,t,n){let r=hU(),i=n?.locale??r.locale??UU,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=pU(e,n?.in);if(!OU(s))throw RangeError(`Invalid time value`);let c=t.match(pW).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=iW[t];return n(e,i.formatLong)}return e}).join(``).match(fW).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:vW(e)};if(QU[t])return{isToken:!0,value:e};if(t.match(gW))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&lW(a)||!n?.useAdditionalDayOfYearTokens&&cW(a))&&uW(a,t,String(e));let o=QU[a[0]];return o(s,a,i.localize,l)}).join(``)}function vW(e){let t=e.match(mW);return t?t[1].replace(hW,`'`):e}function yW(e,t,n){let r=hU(),i=n?.locale??r.locale??UU,a=wU(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=bU(n?.in,...a>0?[t,e]:[e,t]),l=kU(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/iU,f=(u-(yU(c)-yU(s)))/iU,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/lU);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/cU);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/sU);return i.formatDistance(`xYears`,e,o)}}function bW(e,t){return yW(e,TU(e),t)}function xW(e){return Math.trunc(e*aU)}function SW(e,t,n){let[r,i]=bU(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function CW(e,t){return SW(fU(t?.in||e,e),TU(t?.in||e))}function wW(e,t){return EU(fU(t?.in||e,e),TU(t?.in||e))}function TW(e){let t=e/aU;return Math.trunc(t)}function EW(e){let t=e/iU;return Math.trunc(t)}function DW(e){let t=e/oU;return Math.trunc(t)}function OW(e){return Math.trunc(e*iU)}function kW(e,t){let n=()=>fU(t?.in,NaN),r=t?.additionalDigits??2,i=PW(e),a;if(i.date){let e=FW(i.date,r);a=IW(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=RW(i.time),isNaN(s)))return n();if(i.timezone){if(c=BW(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=pU(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return pU(o+s+c,t?.in)}var AW={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},jW=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,MW=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,NW=/^([+-])(\d{2})(?::?(\d{2}))?$/;function PW(e){let t={},n=e.split(AW.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],AW.timeZoneDelimiter.test(t.date)&&(t.date=e.split(AW.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=AW.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function FW(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function IW(e,t){if(t===null)return new Date(NaN);let n=e.match(jW);if(!n)return new Date(NaN);let r=!!n[4],i=LW(n[1]),a=LW(n[2])-1,o=LW(n[3]),s=LW(n[4]),c=LW(n[5])-1;if(r)return KW(t,s,c)?VW(t,s,c):new Date(NaN);{let e=new Date(0);return!WW(t,a,o)||!GW(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function LW(e){return e?parseInt(e):1}function RW(e){let t=e.match(MW);if(!t)return NaN;let n=zW(t[1]),r=zW(t[2]),i=zW(t[3]);return qW(n,r,i)?n*aU+r*iU+i*1e3:NaN}function zW(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function BW(e){if(e===`Z`)return 0;let t=e.match(NW);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return JW(r,i)?n*(r*aU+i*iU):NaN}function VW(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var HW=[31,null,31,30,31,30,31,31,30,31,30,31];function UW(e){return e%400==0||e%4==0&&e%100!=0}function WW(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(HW[t]||(UW(e)?29:28))}function GW(e,t){return t>=1&&t<=(UW(e)?366:365)}function KW(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function qW(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function JW(e,t){return t>=0&&t<=59}function YW(e){return e*oU}function XW(e){let t=Math.max(0,Math.round(e));if(t<YW(1))return`${t}ms`;let n=TW(t),r=EW(t-xW(n)),i=DW(t-xW(n)-OW(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function ZW(e){return XW(YW(e))}function QW(e){let t=kW(e);return OU(t)?t:void 0}function $W(e){let t=QW(e);return t===void 0?e:wW(t)?_W(t,`HH:mm:ss`):CW(t)?_W(t,`MMM d, HH:mm:ss`):_W(t,`MMM d yyyy, HH:mm:ss`)}function eG(e){let t=QW(e);return t===void 0?e:_W(t,`PPpp zzzz`)}function tG(e){let t=QW(e);return t===void 0?e:bW(t,{addSuffix:!0})}function nG({at:e,className:t,relative:n=!1}){let r=QW(e);return r===void 0?(0,W.jsx)(`span`,{className:t,children:e}):(0,W.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:eG(e),children:n?tG(e):$W(e)})}var rG={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:FD.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:FD.monitor}};function iG(e){return e!==null&&Object.hasOwn(rG,e)}var aG={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,pr:`PR`,checks:`Checks`};function oG(e){return e!==null&&Object.hasOwn(aG,e)}function sG(){let e=(0,U.useSyncExternalStore)(cG,lG,lG),t=new URLSearchParams(e),n=t.get(`run`)??void 0,r=t.get(`node`)??void 0,i=t.get(`event`)??void 0,a=t.get(`view`),o=t.get(`tab`),s=t.get(`detail`),c=iG(s)?s:`activity`,l=oG(o)?o:`timeline`,u=a===`graph`||a===`overall`?a:r===void 0?`overall`:`graph`,d=(0,U.useCallback)(e=>{let t=new URLSearchParams(window.location.search);e(t),window.history.pushState(null,``,`${window.location.pathname}?${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{runId:n,nodeId:r,itemId:i,view:u,detail:c,nodeTab:l,selectRun:e=>d(t=>{t.set(`run`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>d(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>d(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>d(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>d(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>d(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)})}}function cG(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function lG(){return window.location.search}function uG({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?It:Ft;return(0,W.jsxs)(ya,{"aria-label":`${t}: ${n}`,className:at(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,W.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}var dG={recovery:Ht,failure:qt,human:Jt,planning:Tt,contention:jt,verification:Gt,publication:At,repository:kt,session:Lt,lifecycle:Rt,activity:wt};Object.keys(dG);function fG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var pG=[[`recovery`,[`retry`,`retried`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`]],[`contention`,[`lock`,`concurrent`,`quiet`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`]],[`publication`,[`pr`,`publication`,`published`,`merge`,`merged`,`change`,`drafting`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],mG={"completion-requested":`lifecycle`,"body-not-drafted":`publication`};function hG(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function gG(e){let t=mG[e];if(t!==void 0)return t;let n=hG(e);return pG.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}function _G({category:e,className:t=`size-3`}){let n=dG[e];return(0,W.jsx)(n,{"aria-hidden":`true`,className:t})}function vG(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:XW(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`,...e.status?{status:e.status}:{}}}function yG({row:e}){let t=vG(e);return(0,W.jsxs)(`header`,{className:`detail-title`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(ya,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,W.jsx)(`h2`,{children:t.label}),(0,W.jsxs)(`p`,{className:`detail-when`,children:[(0,W.jsx)(nG,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,W.jsx)(ya,{variant:`secondary`,children:t.status})]})}function bG(e){let t=vG(e);return[t.kind,t.label,$W(t.startedAt),fG(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function xG({row:e}){return(0,W.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":bG(e),children:(0,W.jsx)(_G,{category:e.category})})}var SG=`data-timeline-reading`;function CG(e){let t=e.closest(`[${SG}]`)??e.closest(`button`)?.querySelector(`[${SG}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(SG)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var wG={rows:[],total:0},TG={worker:`Worker`,judge:`Judge`,lint:`Lint`,orchestrator:`Orchestrator`,"check-in":`Check-in`,"pr-author":`PR author`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},EG=Object.entries(TG).map(([e,t])=>({id:e,label:t})),DG={run:null,node:null,step:null,dispatch:`worker`,verification:`verification`,publication:`publication`,"pr-drafting":`pr-author`,"conflict-resolution":`publication`,"human-wait":`human-wait`,rollup:`lock-waits`},OG=`llmlint`,kG={worker:`worker`,judge:`judge`,llmlint:`lint`,orchestrator:`orchestrator`,"check-in":`check-in`,"pr-author":`pr-author`},AG={worker:!0,orchestrator:!0,"check-in":!0,"pr-author":!0,judge:!1,llmlint:!1};function jG(e){return TG[kG[e]]}var MG={"lock-wait":`Lock waits`};function NG(e){let t=[...e].sort((e,t)=>e.start-t.start),n=t.at(0)?.start??0,r=Math.max(n+1,...t.map(e=>e.end??e.start)),i=new Set([t.at(0),t.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),a=(r-n)*.02,o=[];for(let e of t){let t=Math.max(e.end??e.start,e.start+a),n=o.findLast(n=>{let r=Math.max(n.end??n.start,n.start+a);return e.start<=r&&n.start<=t});n===void 0||i.has(e.id)?o.push(e):FG(e)<FG(n)?i.has(n.id)?o.push(e):o[o.indexOf(n)]=e:PG(e,n,a)||o.push(e)}return o}function PG(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function FG(e){let t=e.laneId??``,n=EG.findIndex(({id:e})=>e===t);return n<0?EG.length:n}function IG(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function LG(e,t){let n=VG(e,t).rows,r=RG(n),i=RG(n,!1),a=i.flatMap(e=>{let t=zG(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),o=i.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,U.createElement)(xG,{row:e})}]:[]),s=Math.max(...a.map(e=>e.end??e.start),...o.map(e=>e.at));return{items:a.map(e=>e.end===null?{...e,end:s,duration:s-e.start}:e),markers:o,lanes:EG,rows:r}}function RG(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function zG(e){if(e.rowKind===`event`)return null;let t=BG(e.role);return t===null?DG[e.rowKind===`span`?e.span.kind:e.kind]??null:t}function BG(e){return e===void 0?null:kG[e]??null}function VG(e,t){if(e===void 0)return wG;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=cK(e.spans,new Set,t);return n.length===0?wG:{rows:eK(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=eK(iK(rK(eK([...o===void 0?[]:GG(o,i),...a.filter(e=>e!==o).map(e=>KG(e,i)),...cK(e.spans,r,t)].sort(uK)))));return{span:o,rows:s,total:lK(s)}}function HG(e){return KG(e,new Map)}function UG(e,t){return WG(e,t).at(-1)}function WG(e,t){for(let n of e){if(n.id===t)return[n];let e=WG(n.children,t);if(e.length>0)return[n,...e]}return[]}function GG(e,t){return[...(t.get(e.id)??[]).map(e=>KG(e,t)),...e.events.map($G)].sort(uK)}function KG(e,t){let n=qG(e);return{rowKind:`span`,span:e,id:e.id,kind:e.kind,role:n,label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??dK(e.started_at,e.ended_at),children:eK(GG(e,t)),displayLabel:nK(e,n),displayKind:tK(e,n),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function qG(e){return e.kind===`dispatch`?JG(e):void 0}function JG(e){if(e.agent_role!==void 0)return e.transport_role===`llmlint`?OG:e.agent_role}function YG(e){let t=JG(e);return t===void 0?DG[e.kind===`rollup`?e.label:e.kind]??null:kG[t]??null}function XG(e){return TG[e]}function ZG(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var QG=`Redirection`;function $G(e){let t=ZG(e);return{rowKind:`event`,event:e,id:e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:t??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),displayKind:t===void 0?`Event`:QG,category:gG(e.kind)}}function eK(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&sK(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<8||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:dK(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind}),n=i}return t}function tK(e,t){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return MG[e.label]??e.label;let n=BG(t)??DG[e.kind];return n==null?e.kind:TG[n]}function nK(e,t){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;let n=tK(e,t);return e.kind===`rollup`?`${n}: ${e.count??0} recorded`:!e.label||e.label===n?n:e.kind===`dispatch`?`${n} (${e.label})`:`${n}: ${e.label}`}function rK(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=rK(e.children);return e.role!==`worker`||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function iK(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(aK(a.role)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(oK(a.role)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function aK(e){return e!==void 0&&AG[e]===!0}function oK(e){return e!==void 0&&AG[e]===!1}function sK(e,t){return t!==void 0&&e.rowKind===`span`&&t.rowKind===`span`&&e.kind===t.kind}function cK(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map($G)}function lK(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+lK(t.children),0)}function uK(e,t){return e.startedAt.localeCompare(t.startedAt)}function dK(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function fK(e,t,n,r){let[i,a]=(0,U.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,U.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,U.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var pK=32;function mK(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function hK(e,t){let n=(0,U.useRef)(null),r=(0,U.useRef)(!0),i=(0,U.useRef)({key:e,count:t}),a=(0,U.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=pK)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=mK(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,U.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var gK=25,_K=4e3;function vK({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:NK(r),a=i?.kind===`conversation`?i.value:void 0,o=fK(e,t,a,r===void 0?void 0:AK(r));return(0,W.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:hK(a,jK(r,o)),children:r===void 0?(0,W.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,W.jsx)(Nt,{size:30}),(0,W.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(yG,{row:r}),(0,W.jsx)(jl,{className:`my-4`}),(0,W.jsx)(yK,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function yK({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=MK(n);return o===void 0?i?.kind===`conversation`?(0,W.jsx)(bK,{row:n,transcript:a}):FK(n)?(0,W.jsx)(xK,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&TK(i.value)!==void 0?(0,W.jsx)(SK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&TK(i.value)!==void 0?(0,W.jsx)(CK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):IK(n,i)&&r!==void 0?(0,W.jsx)(EK,{node:r,reference:i}):(0,W.jsx)(OK,{reference:i,row:n}):(0,W.jsx)(DK,{redirection:o,row:n})}function bK({row:e,transcript:t}){let[n,r]=(0,U.useState)(gK),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?i.filter(({id:t})=>t===e.event.id):i,o=Pd(a.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,W.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,W.jsx)(Ml,{className:`h-2 w-40`}),(0,W.jsx)(Ml,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,W.jsxs)(Ji,{variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Transcript unavailable`}),(0,W.jsx)(Xi,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=LK(c.agentRole,c.transportRole);return(0,W.jsx)(Sa,{className:`gap-0 py-3`,children:(0,W.jsxs)(Ca,{className:`px-3`,children:[(0,W.jsxs)(`header`,{className:`transcript-header`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,l,c.persona?` · ${c.persona}`:``]}),(0,W.jsx)(`h4`,{children:s.name})]}),(0,W.jsx)(Id,{state:s.state})]}),(0,W.jsx)(jl,{className:`my-2.5`}),(0,W.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,W.jsx)(Nd,{cursor:o.cursor,onSelectTurn:o.scrollTo,turns:[...a]})}),a.length===0?(0,W.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:o.containerRef,children:a.slice(0,n).map(e=>(0,W.jsx)(`div`,{ref:t=>o.register(e.id,t),children:(0,W.jsx)(Ax,{author:{label:l},turn:e})},e.id))}),a.length>n&&(0,W.jsxs)(xa,{onClick:()=>r(n+gK),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function xK({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Result`}),(0,W.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,W.jsx)(`pre`,{children:i.output_tail})]}),(0,W.jsx)(wK,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,W.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function SK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(wK,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,W.jsx)(OK,{reference:n,row:r})]})}function CK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(wK,{artifactId:e,client:t,heading:`Oneharness conversation`,missing:`This record named no conversation.`,noun:`conversation`,runId:i,unreadable:`The history store holds no readable copy of that conversation.`}),(0,W.jsx)(OK,{reference:n,row:r})]})}function wK({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let[s,c]=(0,U.useState)(),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),p=TK(e);return(0,U.useEffect)(()=>{let e=!0;if(c(void 0),u(!1),f(!1),p!==void 0)return t.getArtifact(a,p).then(t=>{e&&c(t.content)}).catch(()=>{e&&(u(!0),c(null))}),()=>{e=!1}},[t,a,p]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:n}),p===void 0?(0,W.jsx)(`p`,{className:`detail-note`,children:r}):s===void 0?(0,W.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l||s===null?(0,W.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`pre`,{children:d?s:s.slice(-4e3)}),s.length>_K&&(0,W.jsx)(xa,{onClick:()=>f(!d),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function TK(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function EK({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,W.jsx)(kK,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,W.jsx)(Ot,{size:13})]})}):r?.branch_url?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,W.jsx)(Ot,{size:13})]})}):!r?.pr_url&&(0,W.jsx)(kK,{fallback:`No publication was recorded.`,reference:t}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,W.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,W.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e.name}),(0,W.jsx)(`dd`,{children:e.url?(0,W.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function DK({redirection:e,row:t}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Delivery`}),(0,W.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Redirected at`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(nG,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Member`}),(0,W.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Note`}),(0,W.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]})]}),e.reason!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,W.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function OK({row:e,reference:t}){let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Recorded at`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(nG,{at:e.startedAt,relative:!0})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Ended`}),(0,W.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,W.jsx)(nG,{at:e.endedAt,relative:!0})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Status`}),(0,W.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Duration`}),(0,W.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:XW(e.durationMs)})]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Aggregated`}),(0,W.jsx)(`dd`,{children:r})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Step`}),(0,W.jsx)(`dd`,{children:PK(n)??`None`})]})]}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,W.jsx)(kK,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function kK({reference:e,fallback:t}){return e===void 0?(0,W.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,W.jsx)(Ot,{size:13})]})}):(0,W.jsxs)(`p`,{className:`detail-note`,children:[(0,W.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,W.jsx)(`code`,{children:e.value})]})}function AK(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function jK(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function MK(e){return e.rowKind===`event`?e.event.redirection:void 0}function NK(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function PK(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function FK(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function IK(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function LK(e,t){return jG(t===`llmlint`?OG:e)}function RK({client:e,runId:t,node:n,timeline:r,timelineError:i,selectedItemId:a,onSelectItem:o,onBack:s,selectedTab:c,onSelectTab:l}){let u=(0,U.useMemo)(()=>VG(r,n.id),[r,n.id]);(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(a===void 0?s():o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o,a]);let d=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,W.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,W.jsxs)(`header`,{className:`node-view-head`,children:[(0,W.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,W.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,W.jsx)(`li`,{children:(0,W.jsxs)(xa,{onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:[(0,W.jsx)(_t,{size:14}),` Graph`]})}),(0,W.jsx)(`li`,{"aria-current":`page`,children:(0,W.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,W.jsxs)(`div`,{className:`node-view-facts`,children:[(0,W.jsx)(WH,{className:`node-view-state`,state:n.status}),(0,W.jsx)(uG,{control:n.control}),(0,W.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),d!==void 0&&(0,W.jsxs)(`a`,{className:`node-view-pr`,href:d,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,W.jsx)(Ot,{size:12})]})]})]}),(0,W.jsx)(KK,{node:n}),(0,W.jsxs)(Au,{className:`node-tabs`,onValueChange:e=>{oG(e)&&l(e)},value:c,children:[(0,W.jsx)(Mu,{"aria-label":`Node details`,variant:`line`,children:Object.entries(aG).map(([e,t])=>(0,W.jsx)(Nu,{value:e,children:t},e))}),(0,W.jsxs)(Pu,{className:`node-tab-panel`,value:`task`,children:[(0,W.jsx)(`pre`,{children:UK(n.task)}),(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Outcome`}),(0,W.jsx)(`dd`,{children:qK(n.result?.detail)})]})})]}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`criteria`,children:(0,W.jsx)(`pre`,{children:WK(n.task)})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`dependencies`,children:(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Dependencies`}),(0,W.jsx)(`dd`,{children:n.task.deps?.join(`, `)||`None`})]})})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`pr`,children:(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Publication`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(GK,{node:n})})]})})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`checks`,children:(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Verification coverage`}),(0,W.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Observed checks`}),(0,W.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:n.detail?.verification.checks?.map((e,t)=>(0,W.jsxs)(`span`,{children:[t>0&&` · `,e.url?(0,W.jsxs)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:[e.name,`: `,e.state]}):`${e.name}: ${e.state}`]},e.name))})]})]})}),(0,W.jsx)(Pu,{className:`node-timeline-panel`,value:`timeline`,children:i===void 0?r===void 0?(0,W.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):u.rows.length===0?(0,W.jsxs)(Sa,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,W.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,W.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,W.jsx)(zK,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,W.jsxs)(Ji,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Timeline unavailable`}),(0,W.jsx)(Xi,{children:i.message})]})})]})]})}function zK({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>LG(a,t.id),[a,t.id]),s=Pd((0,U.useMemo)(()=>o.rows.map(e=>({id:e.id,time:Date.parse(e.startedAt)})),[o.rows])),[c,l]=(0,U.useState)(!1),u=(0,U.useMemo)(()=>NG(o.items),[o.items]),d=(0,U.useMemo)(()=>IG(o.markers,o.items,i),[o.items,o.markers,i]),f=(0,U.useMemo)(()=>BK(o.items),[o.items]),p=s.cursor===void 0?void 0:Math.min(Math.max(s.cursor,f[0]),f[1]),m=i===void 0?void 0:UG(o.rows,i),h=e=>{n(e),s.scrollTo(e)};return(0,U.useEffect)(()=>{i!==void 0&&s.scrollTo(i)},[i,s]),(0,W.jsxs)(`div`,{className:`node-execution`,"data-expanded":c,children:[(0,W.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,W.jsx)(un,{axis:{origin:f[0]},cursor:p,expanded:c,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:c?o.items:u,lanes:o.lanes,markers:d,onExpandedChange:l,onSelect:e=>h(e.id),selectedId:i})}),(0,W.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:s.containerRef,children:VK(o.rows).map(e=>{let t=e.rows.map(e=>(0,W.jsx)(HK,{onOpen:h,register:s.register,row:e,selected:e.id===i},e.id));return e.dispatch===void 0?(0,W.jsx)(U.Fragment,{children:t},e.id):(0,W.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,W.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),m!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(xa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Xt,{})}),(0,W.jsx)(vK,{client:e,node:t,row:m,runId:r})]})]})}function BK(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function VK(e){let t=[];for(let n of e){let e=t.at(-1);n.dispatch!==void 0&&e?.dispatch!==void 0&&e.dispatch.id===n.dispatch.id?e.rows.push(n):t.push({id:n.id,dispatch:n.dispatch,rows:[n]})}return t}function HK({row:e,selected:t,register:n,onOpen:r}){return(0,W.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-selected":t,ref:t=>n(e.id,t),children:(0,W.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,W.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,W.jsx)(_G,{category:e.category}),e.displayKind]}),(0,W.jsx)(`strong`,{children:e.displayLabel}),(0,W.jsxs)(`span`,{className:`transcript-facts`,children:[(0,W.jsx)(nG,{at:e.startedAt}),e.durationMs!==null&&` · ${XW(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function UK(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
53
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,U.useEffect)(()=>{let n=t?.target??mz,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&UI(e))return!1;let n=_z(e.code,s);if(a.current.add(e[n]),gz(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=_z(e.code,s);gz(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function gz(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function _z(e,t){return t.includes(e)?`code`:`key`}var vz=()=>{let e=VR();return(0,U.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=AI(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return TI(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=EI(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function yz(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)bz(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function bz(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function xz(e,t){return yz(e,t)}function Sz(e,t){return yz(e,t)}function Cz(e,t){return{id:e,type:`select`,selected:t}}function wz(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(Cz(a.id,e)))}return r}function Tz({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Ez(e){return{id:e.id,type:`remove`}}var Dz=CI(`React Flow`,`https://reactflow.dev/`);function Oz(e,t,n={}){return nL(e,t,{...n,onError:n.onError??Dz})}var kz=e=>ZF(e),Az=e=>XF(e);function jz(e){return(0,U.forwardRef)(e)}var Mz=typeof window<`u`?U.useLayoutEffect:U.useEffect;function Nz(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>Pz(()=>n(e=>e+BigInt(1))));return Mz(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Pz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Fz=(0,U.createContext)(null);function Iz({children:e}){let t=VR(),n=Nz((0,U.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=Tz({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Nz((0,U.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(Tz({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,W.jsx)(Fz.Provider,{value:i,children:e})}function Lz(){let e=(0,U.useContext)(Fz);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Rz=e=>!!e.panZoom;function zz(){let e=vz(),t=VR(),n=Lz(),r=BR(Rz),i=(0,U.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=kz(e)?e:n.get(e.id),a=i.parentId?FI(i.position,i.measured,i.parentId,n,r):i.position;return gI({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&kz(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Az(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await sI({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Ez);o?.(f),c(e)}if(m){let e=d.map(Ez);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=xI(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=gI(s?r:a),l=bI(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=xI(e)?e:a(e);if(!r)return!1;let i=bI(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return eI(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??LI();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,U.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Bz=e=>e.selected,Vz=typeof window<`u`?window:void 0;function Hz({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=VR(),{deleteElements:r}=zz(),i=hz(e,{actInsideInputWithModifier:!1}),a=hz(t,{target:Vz});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Bz),edges:e.filter(Bz)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Uz(e){let t=VR();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=BI(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,RF.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Wz={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Gz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Kz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=UF.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=VR(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=BR(Gz,IR),E=hz(f),D=(0,U.useRef)();Uz(S);let O=(0,U.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,U.useEffect)(()=>{if(S.current){D.current=dR({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,U.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,W.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Wz,children:m})}var qz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Jz(){let{userSelectionActive:e,userSelectionRect:t}=BR(qz,IR);return e&&t?(0,W.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Yz=(e,t)=>n=>{n.target===t.current&&e?.(n)},Xz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Zz({isSelecting:e,selectionKeyPressed:t,selectionMode:n=WF.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,U.useRef)(0),_=VR(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=BR(Xz,IR),C=y&&(e||v),w=(0,U.useRef)(null),T=(0,U.useRef)(),E=(0,U.useRef)(new Set),D=(0,U.useRef)(new Set),O=(0,U.useRef)(!1),k=(0,U.useRef)(!1),A=(0,U.useRef)({x:0,y:0}),j=(0,U.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},F=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=GI(n.nativeEvent,T.current),l=TI({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=EI(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(nI(a,m,i,n===WF.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}II(h,E.current)||c(wz(a,E.current,!0)),II(g,D.current)||l(wz(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=fI(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,W.jsxs)(`div`,{className:eA([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:Yz(M,w),onContextMenu:Yz(N,w),onWheel:Yz(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=GI(e.nativeEvent,T.current);A.current={x:o,y:c};let l=EI({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),te())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:C?F:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:Wz,children:[h,(0,W.jsx)(Jz,{})]})}function Qz({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,RF.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function $z({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=VR(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=BL({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Qz({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,U.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var eB=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function tB(){let e=VR();return(0,U.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=eB(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=wI(t,i));let{position:a,positionAbsolute:s}=oI({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var nB=(0,U.createContext)(null),rB=nB.Provider;nB.Consumer;var iB=()=>(0,U.useContext)(nB),aB=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),oB=(0,U.createContext)(null);function sB({children:e}){let t=BR(aB,IR);return(0,W.jsx)(oB.Provider,{value:t,children:e})}function cB(){let e=(0,U.useContext)(oB);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var lB={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},uB=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return lB;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===HF.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function dB({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=VR(),_=iB(),{connectOnClick:v,noPanClassName:y,rfId:b}=cB(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=BR(uB(_,m,e),IR);_||g.getState().onError?.(`010`,RF.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Oz(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=WI(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();XL.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,W.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:eA([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=VI(t.target),h=n||c,{connection:v,isValid:y}=XL.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var fB=(0,U.memo)(jz(dB));function pB({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[e?.label,(0,W.jsx)(fB,{type:`source`,position:n,isConnectable:t})]})}function mB({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fB,{type:`target`,position:n,isConnectable:t}),e?.label,(0,W.jsx)(fB,{type:`source`,position:r,isConnectable:t})]})}function hB(){return null}function gB({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fB,{type:`target`,position:n,isConnectable:t}),e?.label]})}var _B={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},vB={input:pB,default:mB,output:gB,group:hB};function yB(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var bB=e=>{let{width:t,height:n,x:r,y:i}=tI(e.nodeLookup,{filter:e=>!!e.selected});return{width:SI(t)?t:null,height:SI(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function xB({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=VR(),{width:i,height:a,transformString:o,userSelectionActive:s}=BR(bB,IR),c=tB(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if($z({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,W.jsx)(`div`,{className:eA([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,W.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(_B,e.key)&&(e.preventDefault(),c({direction:_B[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var SB=typeof window<`u`?window:void 0,CB=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function wB({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=BR(CB,IR),te=hz(l,{target:SB}),ne=hz(h,{target:SB}),re=ne||w,R=ne||b,z=u&&re!==!0,ie=te||L||z;return Hz({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,W.jsx)(Kz,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:F,paneClickDistance:s,selectionOnDrag:z,children:(0,W.jsxs)(Zz,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:z,children:[e,I&&(0,W.jsx)(xB,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}wB.displayName=`FlowRenderer`;var TB=(0,U.memo)(wB),EB=e=>t=>e?nI(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function DB(e){return BR((0,U.useCallback)(EB(e),[e]),IR)}var OB=e=>e.updateNodeInternals;function kB(){let e=BR(OB),[t]=(0,U.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,U.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function AB({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=VR(),a=(0,U.useRef)(null),o=(0,U.useRef)(null),s=(0,U.useRef)(e.sourcePosition),c=(0,U.useRef)(e.targetPosition),l=(0,U.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,U.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,U.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,U.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function jB({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=BR(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},IR),S=y.type||`default`,C=g?.[S]||vB[S];C===void 0&&(v?.(`003`,RF.error003(S)),S=`default`,C=g?.default||vB.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=VR(),k=PI(y),A=AB({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=$z({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=tB();if(y.hidden)return null;let N=NI(y),P=yB(y),ee=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Qz({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(UI(t.nativeEvent)||m)){if(BF.includes(t.key)&&T){let n=t.key===`Escape`;Qz({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(_B,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:_B[t.key],factor:t.shiftKey?4:1})}}},z=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(nI(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,W.jsx)(`div`,{className:eA([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?z:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${WR}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,W.jsx)(rB,{value:e,children:(0,W.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var MB=(0,U.memo)(jB),NB=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function PB(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=BR(NB,IR),a=DB(e.onlyRenderVisibleElements),o=kB();return(0,W.jsx)(`div`,{className:`react-flow__nodes`,style:Wz,children:a.map(a=>(0,W.jsx)(MB,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}PB.displayName=`NodeRenderer`;var FB=(0,U.memo)(PB);function IB(e){return BR((0,U.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&$I({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),IR)}var LB=({color:e=`none`,strokeWidth:t=1})=>(0,W.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),RB=({color:e=`none`,strokeWidth:t=1})=>(0,W.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),zB={[qF.Arrow]:LB,[qF.ArrowClosed]:RB};function BB(e){let t=VR();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(zB,e)?zB[e]:(t.getState().onError?.(`009`,RF.error009(e)),null),[e])}var VB=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=BB(t);return c?(0,W.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,W.jsx)(c,{color:n,strokeWidth:o})}):null},HB=({defaultColor:e,rfId:t})=>{let n=BR(e=>e.edges),r=BR(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>gL(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,W.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,W.jsx)(`defs`,{children:i.map(e=>(0,W.jsx)(VB,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};HB.displayName=`MarkerDefinitions`;var UB=(0,U.memo)(HB);function WB({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,U.useState)({x:1,y:0,width:0,height:0}),p=eA([`react-flow__edge-textwrapper`,l]),m=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,W.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,W.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,W.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}WB.displayName=`EdgeText`;var GB=(0,U.memo)(WB);function KB({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{...u,d:e,fill:`none`,className:eA([`react-flow__edge-path`,u.className])}),l?(0,W.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&SI(t)&&SI(n)?(0,W.jsx)(GB,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function qB({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function JB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=qB({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=qB({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=qI({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function YB(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=JB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,W.jsx)(KB,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var XB=YB({isInternal:!1}),ZB=YB({isInternal:!0});XB.displayName=`SimpleBezierEdge`,ZB.displayName=`SimpleBezierEdgeInternal`;function QB(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=lL({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,W.jsx)(KB,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var $B=QB({isInternal:!1}),eV=QB({isInternal:!0});$B.displayName=`SmoothStepEdge`,eV.displayName=`SmoothStepEdgeInternal`;function tV(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,W.jsx)($B,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var nV=tV({isInternal:!1}),rV=tV({isInternal:!0});nV.displayName=`StepEdge`,rV.displayName=`StepEdgeInternal`;function iV(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=rL({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,W.jsx)(KB,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var aV=iV({isInternal:!1}),oV=iV({isInternal:!0});aV.displayName=`StraightEdge`,oV.displayName=`StraightEdgeInternal`;function sV(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=XI({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,W.jsx)(KB,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var cV=sV({isInternal:!1}),lV=sV({isInternal:!0});cV.displayName=`BezierEdge`,lV.displayName=`BezierEdgeInternal`;var uV={default:lV,straight:oV,step:rV,smoothstep:eV,simplebezier:ZB},dV={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},fV=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,pV=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,mV=`react-flow__edgeupdater`;function hV({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,W.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:eA([mV,`${mV}-${s}`]),cx:fV(t,r,e),cy:pV(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function gV({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=VR(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;XL.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,W.jsxs)(W.Fragment,{children:[(e===!0||e===`source`)&&(0,W.jsx)(hV,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,W.jsx)(hV,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function _V({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=BR(t=>t.edgeLookup.get(e)),b=BR(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||uV[x];S===void 0&&(_?.(`011`,RF.error011(x)),x=`default`,S=h?.default||uV.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,U.useRef)(null),[D,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),j=VR(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L}=BR((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return dV;let i=dL({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=QI({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||dV,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),IR),te=(0,U.useMemo)(()=>y.markerStart?`url('#${hL(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${hL(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||F===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},R=a?e=>{a(e,{...y})}:void 0,z=o?e=>{o(e,{...y})}:void 0,ie=s?e=>{s(e,{...y})}:void 0,ae=c?e=>{c(e,{...y})}:void 0,oe=l?e=>{l(e,{...y})}:void 0;return(0,W.jsx)(`svg`,{style:{zIndex:M},children:(0,W.jsxs)(`g`,{className:eA([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:R,onContextMenu:z,onMouseEnter:ie,onMouseMove:ae,onMouseLeave:oe,onKeyDown:C?t=>{if(!v&&BF.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${GR}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,W.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,W.jsx)(gV,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var vV=(0,U.memo)(_V),yV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function bV({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=BR(yV,IR),b=IB(t);return(0,W.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,W.jsx)(UB,{defaultColor:e,rfId:n}),b.map(e=>(0,W.jsx)(vV,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}bV.displayName=`EdgeRenderer`;var xV=(0,U.memo)(bV),SV=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function CV({children:e}){let t=VR(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return Mz(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=SV(r)))};return r(),t.subscribe(r)},[t]),(0,W.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:SV(r)},children:e})}function wV(e){let t=zz(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var TV=e=>e.panZoom?.syncViewport;function EV(e){let t=BR(TV),n=VR();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function DV(e){return e.connection.inProgress?{...e.connection,to:TI(e.connection.to,e.transform)}:{...e.connection}}function OV(e){return e?t=>e(DV(t)):DV}function kV(e){return BR(OV(e),IR)}var AV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function jV({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=BR(AV,IR);return a&&i&&c?(0,W.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,W.jsx)(`g`,{className:eA([`react-flow__connection`,YF(s)]),children:(0,W.jsx)(MV,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var MV=({style:e,type:t=KF.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=kV();if(!i)return;if(n)return(0,W.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:YF(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case KF.Bezier:[m]=XI(h);break;case KF.SimpleBezier:[m]=JB(h);break;case KF.Step:[m]=lL({...h,borderRadius:0});break;case KF.SmoothStep:[m]=lL(h);break;default:[m]=rL(h)}return(0,W.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};MV.displayName=`ConnectionLine`;var NV={};function PV(e=NV){(0,U.useRef)(e),VR(),(0,U.useEffect)(()=>{},[e])}function FV(){VR(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function IV({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneScroll:ae,onPaneContextMenu:oe,paneClickDistance:se,nodeClickDistance:ce,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se,viewport:B,onViewportChange:Ce,nodesDraggable:we}){return PV(e),PV(t),FV(),wV(n),EV(B),(0,W.jsx)(TB,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:z,onPaneMouseLeave:ie,onPaneContextMenu:oe,onPaneScroll:ae,paneClickDistance:se,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,onViewportChange:Ce,isControlledViewport:!!B,children:(0,W.jsxs)(CV,{children:[(0,W.jsx)(xV,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,onlyRenderVisibleElements:T,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,defaultMarkerColor:M,noPanClassName:ye,disableKeyboardA11y:be,rfId:Se}),(0,W.jsx)(jV,{style:h,type:m,component:g,containerStyle:_}),(0,W.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,W.jsx)(FB,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ce,onlyRenderVisibleElements:T,noPanClassName:ye,noDragClassName:_e,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se,nodesDraggable:we}),(0,W.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}IV.displayName=`GraphView`;var LV=(0,U.memo)(IV),RV=CI(`React Flow`,`https://reactflow.dev/`),zV=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??zF;PL(h,g,_);let{nodesInitialized:x}=TL(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=AI(tI(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:zF,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:HF.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...GF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:RV,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:VF,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},BV=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>FR((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await aI({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...zV({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=TL(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();PL(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=jL(e,n,r,i,a,o,l);d&&(SL(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=pL(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=AL(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(xz(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(Sz(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>Cz(e,!0)));return}i(wz(r,new Set([...e]),!0)),a(wz(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Cz(e,!0)));return}a(wz(n,new Set([...e]))),i(wz(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(Cz(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Cz(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,Cz(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Cz(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(TL(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ML({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...GF}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...zV()})}},Object.is);function VV({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,U.useState)(()=>BV({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,W.jsx)(RR,{value:m,children:(0,W.jsx)(Iz,{children:(0,W.jsx)(sB,{children:p})})})}function HV({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,U.useContext)(LR)?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(VV,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var UV={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function WV({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:F,connectionMode:I,connectionLineType:L=KF.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:z=`Shift`,selectionOnDrag:ie=!1,selectionMode:ae=WF.Full,panActivationKeyCode:oe=`Space`,multiSelectionKeyCode:se=jI()?`Meta`:`Control`,zoomActivationKeyCode:ce=jI()?`Meta`:`Control`,snapToGrid:le,snapGrid:ue,onlyRenderVisibleElements:de=!1,selectNodesOnDrag:fe,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:he,nodesFocusable:ge,nodeOrigin:_e=oz,edgesFocusable:ve,edgesReconnectable:ye,elementsSelectable:be=!0,defaultViewport:xe=sz,minZoom:Se=.5,maxZoom:B=2,translateExtent:Ce=zF,preventScrolling:we=!0,nodeExtent:Te,defaultMarkerColor:Ee=`#b1b1b7`,zoomOnScroll:De=!0,zoomOnPinch:Oe=!0,panOnScroll:ke=!1,panOnScrollSpeed:Ae=.5,panOnScrollMode:je=UF.Free,zoomOnDoubleClick:Me=!0,panOnDrag:Ne=!0,onPaneClick:V,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:H,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye=10,onNodesChange:Xe,onEdgesChange:Ze,noDragClassName:Qe=`nodrag`,noWheelClassName:$e=`nowheel`,noPanClassName:et=`nopan`,fitView:tt,fitViewOptions:nt,connectOnClick:rt,attributionPosition:it,proOptions:at,defaultEdgeOptions:ot,elevateNodesOnSelect:st=!0,elevateEdgesOnSelect:ct=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanOnSelection:ft=!0,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:vt,nodeDragThreshold:yt,connectionDragThreshold:bt,viewport:xt,onViewportChange:St,width:Ct,height:wt,colorMode:Tt=`light`,debug:Et,onScroll:Dt,ariaLabelConfig:Ot,zIndexMode:kt=`basic`,...At},jt){let Mt=vt||`1`,Nt=pz(Tt),Pt=(0,U.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Dt?.(e)},[Dt]);return(0,W.jsx)(`div`,{"data-testid":`rf__wrapper`,...At,onScroll:Pt,style:{..._t,...UV},ref:jt,className:eA([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,W.jsxs)(HV,{nodes:e,edges:t,width:Ct,height:wt,fitView:tt,fitViewOptions:nt,minZoom:Se,maxZoom:B,nodeOrigin:_e,nodeExtent:Te,zIndexMode:kt,children:[(0,W.jsx)(dz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:pe,autoPanOnNodeFocus:me,nodesConnectable:he,nodesFocusable:ge,edgesFocusable:ve,edgesReconnectable:ye,elementsSelectable:be,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Se,maxZoom:B,nodeExtent:Te,onNodesChange:Xe,onEdgesChange:Ze,snapToGrid:le,snapGrid:ue,connectionMode:I,translateExtent:Ce,connectOnClick:rt,defaultEdgeOptions:ot,fitView:tt,fitViewOptions:nt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:et,nodeOrigin:_e,rfId:Mt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:fe,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:F,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,W.jsx)(LV,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:z,selectionOnDrag:ie,selectionMode:ae,deleteKeyCode:R,multiSelectionKeyCode:se,panActivationKeyCode:oe,zoomActivationKeyCode:ce,onlyRenderVisibleElements:de,defaultViewport:xe,translateExtent:Ce,minZoom:Se,maxZoom:B,preventScrolling:we,zoomOnScroll:De,zoomOnPinch:Oe,zoomOnDoubleClick:Me,panOnScroll:ke,panOnScrollSpeed:Ae,panOnScrollMode:je,panOnDrag:Ne,autoPanOnSelection:ft,onPaneClick:V,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye,defaultMarkerColor:Ee,noDragClassName:Qe,noWheelClassName:$e,noPanClassName:et,rfId:Mt,disableKeyboardA11y:lt,nodeExtent:Te,viewport:xt,onViewportChange:St,nodesDraggable:pe}),(0,W.jsx)(az,{onSelectionChange:k}),H,(0,W.jsx)($R,{proOptions:at,position:it}),(0,W.jsx)(XR,{rfId:Mt,disableKeyboardA11y:lt})]})})}var GV=jz(WV);RF.error014();function KV({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,W.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:eA([`react-flow__background-pattern`,n,r])})}function qV({radius:e,className:t}){return(0,W.jsx)(`circle`,{cx:e,cy:e,r:e,className:eA([`react-flow__background-pattern`,`dots`,t])})}var JV;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(JV||={});var YV={[JV.Dots]:1,[JV.Lines]:1,[JV.Cross]:6},XV=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ZV({id:e,variant:t=JV.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,U.useRef)(null),{transform:f,patternId:p}=BR(XV,IR),m=r||YV[t],h=t===JV.Dots,g=t===JV.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,W.jsxs)(`svg`,{className:eA([`react-flow__background`,l]),style:{...c,...Wz,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,W.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,W.jsx)(qV,{radius:y/2,className:u}):(0,W.jsx)(KV,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}ZV.displayName=`Background`;var QV=(0,U.memo)(ZV);function $V(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,W.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function eH(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,W.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function tH(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,W.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function nH(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,W.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function rH(){return(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,W.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function iH({children:e,className:t,...n}){return(0,W.jsx)(`button`,{type:`button`,className:eA([`react-flow__controls-button`,t]),...n,children:e})}var aH=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function oH({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=VR(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=BR(aH,IR),{zoomIn:y,zoomOut:b,fitView:x}=zz();return(0,W.jsxs)(ZR,{className:eA([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(iH,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,W.jsx)($V,{})}),(0,W.jsx)(iH,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,W.jsx)(eH,{})})]}),n&&(0,W.jsx)(iH,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,W.jsx)(tH,{})}),r&&(0,W.jsx)(iH,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,W.jsx)(rH,{}):(0,W.jsx)(nH,{})}),u]})}oH.displayName=`Controls`;var sH=(0,U.memo)(oH);function cH({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,W.jsx)(`rect`,{className:eA([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var lH=(0,U.memo)(cH),uH=e=>e.nodes.map(e=>e.id),dH=e=>e instanceof Function?e:()=>e;function fH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=lH,onClick:o}){let s=BR(uH,IR),c=dH(t),l=dH(e),u=dH(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsx)(mH,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function pH({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=BR(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=NI(r);return{node:r,x:i,y:a,width:o,height:s}},IR);return!l||l.hidden||!PI(l)?null:(0,W.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var mH=(0,U.memo)(pH),hH=(0,U.memo)(fH),gH=200,_H=150,vH=e=>!e.hidden,yH=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?vI(tI(e.nodeLookup,{filter:vH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bH=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xH=(e,t)=>bH(e.viewBB,t.viewBB)&&bH(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,SH=`react-flow__minimap-desc`;function CH({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=VR(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=BR(yH,xH),j=e?.width??gH,M=e?.height??_H,N=C.width/j,P=C.height/M,ee=Math.max(N,P),F=ee*j,I=ee*M,L=b*ee,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,re=F+L*2,R=I+L*2,z=`${SH}-${T}`,ie=(0,U.useRef)(0),ae=(0,U.useRef)();ie.current=ee,(0,U.useEffect)(()=>{if(S.current&&E)return ae.current=ZL({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ie.current}),()=>{ae.current?.destroy()}},[E]),(0,U.useEffect)(()=>{ae.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let oe=p?e=>{let[t,n]=ae.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,se=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ce=_??A[`minimap.ariaLabel`];return(0,W.jsx)(ZR,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:eA([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,W.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${R}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":z,ref:S,onClick:oe,children:[ce&&(0,W.jsx)(`title`,{id:z,children:ce}),(0,W.jsx)(hH,{onClick:se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,W.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${re+L*2}v${R+L*2}h${-re-L*2}z
54
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}CH.displayName=`MiniMap`,(0,U.memo)(CH);var wH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,TH={[fR.Line]:`right`,[fR.Handle]:`bottom-right`};function EH({nodeId:e,position:t,variant:n=fR.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=iB(),y=typeof e==`string`?e:v,b=VR(),x=(0,U.useRef)(null),S=n===fR.Handle,C=BR((0,U.useCallback)(wH(S&&p),[S,p]),IR),w=(0,U.useRef)(null),T=t??TH[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=CR({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=AL([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...FI({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,W.jsx)(`div`,{className:eA([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,U.memo)(EH);function DH(e){return e.graph??void 0}function OH(e){let t=DH(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=RH(r,`kind`)===`human`?`human`:zH(r)?`lifecycle`:`agent`,a=t.node_results[r.id]??t.result?.results?.[r.id],o=t.node_status[r.id];return o===void 0?[]:[{id:r.id,label:RH(r,`name`)??r.id,status:o,kind:i,task:r,telemetry:n.get(r.id),result:a,detail:e.node_details[r.id],control:t.node_control[r.id],failure:n.get(r.id)?.failure,blockers:[...t.node_gated_by[r.id]??[],...a?.blocked_by??[]]}]})}function kH(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function AH(e){let t=kH(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${BH(e.launch_id)}`:`${t} session · ${BH(e.session_key)}`}function jH(e){if(e.blockers.length>0&&NH.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(PH.has(e.status))return MH(e)??`${e.status}, with no reason recorded`}function MH(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var NH=new Set([`blocked`,`skipped`,`waiting`]),PH=new Set([`failed`,`not-completed`,`cancelled`]);function FH(e){let t=Gk,n=t=>(e[t]??0)>0;return[...t.filter(n),...Object.keys(e).filter(e=>!t.includes(e)).sort().filter(n)].map(t=>`${e[t]} ${t}`).join(` · `)}function IH(e){return PH.has(e)||e===`blocked`||e===`skipped`}function LH(e){let t=new Map;for(let n of e){let e=n.launch?.session_key,r=e===void 0?`run:${n.run_id}`:`session:${n.launch?.launcher}:${e}`,i=t.get(r);t.set(r,{id:r,launcher:kH(n.launch),label:AH(n.launch),runs:[...i?.runs??[],n]})}return[...t.values()]}function RH(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function zH(e){return`repo`in e||`steps`in e}function BH(e){return e.length>12?`${e.slice(0,8)}…`:e}function VH({data:e}){let t=e.style===`success`?yt:e.style===`danger`||e.style===`muted`?Xt:e.style===`active`?Ct:Et;return(0,W.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:at(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,W.jsx)(fB,{type:`target`,position:$.Left}),(0,W.jsxs)(`div`,{className:`node-heading`,children:[(0,W.jsx)(ya,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,W.jsx)(t,{className:at(e.style===`active`&&`spin`),size:17})]}),(0,W.jsx)(`strong`,{children:e.label}),(0,W.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,W.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),(0,W.jsx)(fB,{type:`source`,position:$.Right})]})}function HH({data:e,id:t,markerEnd:n,style:r}){return(0,W.jsx)(KB,{id:t,path:UH(e?.points??[]),markerEnd:n,style:r})}function UH(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var WH={dagNode:VH},GH={routed:HH};function KH({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)IH(n.status)&&t.set(n.id,jH(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=$k({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status})),edges:e.flatMap(e=>(e.task.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:i.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...r.get(e.id)===void 0?{}:{reason:r.get(e.id)}},style:{width:e.width,height:e.height}})),edges:i.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,r,t]);return(0,W.jsxs)(`div`,{className:`graph-wrap`,children:[(0,W.jsxs)(GV,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:WH,edgeTypes:GH,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,W.jsx)(QV,{color:`var(--border)`,gap:22}),(0,W.jsx)(sH,{showInteractive:!1})]}),(0,W.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,r.get(e.id)===void 0?``:` — ${r.get(e.id)}`]})},e.id))})]})}function qH({className:e,state:t}){return(0,W.jsxs)(ya,{className:at(`gap-1.5 tracking-[.03em] uppercase`,QH[t],e),variant:`outline`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:at(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}var JH=`border-success bg-success-surface text-success`,YH=`border-destructive bg-destructive-surface text-destructive`,XH=`border-warning bg-warning-surface text-warning`,ZH={blocked:XH,cancelled:YH,done:JH,failed:YH,"not-completed":YH,parked:void 0,pending:void 0,running:`border-info bg-info-surface text-info`,skipped:XH,unknown:void 0,waiting:void 0},QH={...ZH,complete:ZH.done,settled:ZH.done,active:ZH.running};function $H({groups:e,selectedRunId:t,liveRunIds:n,onSelect:r,hasMore:i,onLoadMore:a}){return(0,W.jsx)(`nav`,{"aria-label":`DAG runs`,className:`run-nav`,onScrollCapture:e=>{let t=e.target;i&&t.scrollHeight-t.scrollTop<=t.clientHeight+80&&a()},children:(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,W.jsxs)(`div`,{className:`brand`,children:[(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,W.jsx)(gt,{size:20})}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,W.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,W.jsx)(jl,{className:`my-[22px]`}),(0,W.jsx)(`div`,{className:`run-groups`,children:e.map(e=>(0,W.jsxs)(`section`,{"aria-labelledby":`group-${e.id}`,children:[(0,W.jsxs)(`h2`,{id:`group-${e.id}`,children:[(0,W.jsx)(vt,{"aria-hidden":`true`,size:14}),e.label]}),e.runs.map(e=>{let i=t===e.run_id,a=FH(e.node_counts);return(0,W.jsxs)(`button`,{"aria-current":i?`page`:void 0,className:`run-link`,"data-active":i,onClick:()=>r(e.run_id),type:`button`,children:[(0,W.jsxs)(`span`,{className:`run-link-main`,children:[n.has(e.run_id)?(0,W.jsxs)(xd,{children:[(0,W.jsx)(Sd,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":`Live`,className:`live-dot`,role:`img`})}),(0,W.jsx)(Cd,{children:`Live`})]}):(0,W.jsx)(Vt,{"aria-label":`Historical`,size:13}),(0,W.jsx)(`span`,{children:e.run_id})]}),(0,W.jsx)(qH,{className:`px-[5px] py-px text-[9px]`,state:e.state}),(0,W.jsx)(xt,{"aria-hidden":`true`,size:14}),a!==``&&(0,W.jsx)(`span`,{className:`run-link-counts`,title:a,children:a})]},e.run_id)})]},e.id))}),i&&(0,W.jsx)(`button`,{className:`sr-only`,onClick:()=>void a(),type:`button`,children:`Load more runs`})]})})})}function eU(e,t,n,r){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(),[c,l]=(0,U.useState)(!0),[u,d]=(0,U.useState)(),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(),[g,_]=(0,U.useState)(0),v=i===void 0?void 0:i.runs.some(({run_id:e})=>e===t)?t:i.runs.at(0)?.run_id,y=n===void 0?void 0:n.nodeId??`run`,b=(0,U.useRef)(v);(0,U.useEffect)(()=>{b.current=v},[v]);let x=(0,U.useCallback)(async()=>{a(await e.listRuns(!0))},[e]),S=(0,U.useCallback)(async()=>{if(i?.next_cursor!==void 0)try{let t=await e.listRuns(!0,i.next_cursor);a(e=>e===void 0?t:{...t,runs:[...e.runs,...t.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),h(void 0)}catch(e){h(rU(e))}},[e,i]),C=(0,U.useCallback)(async()=>{try{await x(),h(void 0)}catch(e){h(rU(e))}finally{l(!1)}_(e=>e+1)},[x]);(0,U.useEffect)(()=>{if(v===void 0){s(void 0);return}let t=!0,i=e=>e.runId===v&&e.timelineScope===y&&e.filter===r;s(e=>{if(e!==void 0&&i(e))return e;let t=e?.runId===v&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:v,filter:r,timelineScope:y,...t===void 0?{}:{detail:t}}});let a=e=>{t&&s(t=>t!==void 0&&i(t)?e(t):t)};return e.getRun(v,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),t&&h(void 0)}).catch(tU).catch(e=>{t&&h(rU(e))}),n!==void 0&&e.getTimeline(v,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(tU).catch(e=>a(t=>({...t,timelineError:rU(e)}))),()=>{t=!1}},[e,v,g,n?.nodeId,y,r]),(0,U.useEffect)(()=>{C();let t=e.subscribe({onEvent:e=>{if(d(new Date().toISOString()),h(void 0),e.event===`snapshot`){a(qO(e.data)),_(e=>e+1);return}let t=nU(e);t!==void 0&&(x().catch(e=>h(rU(e))),t===b.current&&_(e=>e+1))},onError:e=>{h(rU(e))}});return()=>t.close()},[e,x,C]),(0,U.useEffect)(()=>{if(v===void 0){p([]);return}let t=e.subscribe({runId:v,filter:r,onEvent:e=>{if(d(new Date().toISOString()),h(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;p(KO.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&_(e=>e+1)}},onError:e=>h(rU(e))});return()=>t.close()},[e,v,r]);let w=o!==void 0&&o.runId===v&&o.filter===r?o:void 0;return(0,U.useMemo)(()=>({list:i,runId:v,detail:w?.detail,timeline:w?.timeline,timelineError:w?.timelineError,loading:c,lastUpdated:u,activity:f,error:m,refresh:C,loadMore:S,hasMore:i?.next_cursor!==void 0}),[i,v,w,c,u,f,m,C,S])}function tU(e){if(!(e instanceof JO&&e.code===`run_not_found`))throw e}function nU(e){let t=`run_id`in e.data?e.data.run_id:void 0;return typeof t==`string`&&t.length>0?t:void 0}function rU(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var iU=365.2425,aU=6048e5,oU=864e5,sU=6e4,cU=36e5,lU=1e3,uU=525600,dU=43200,fU=1440,pU=3600*24;pU*7,pU*iU/12*3;var mU=Symbol.for(`constructDateFrom`);function hU(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&mU in e?e[mU](t):e instanceof Date?new e.constructor(t):new Date(t)}function gU(e,t){return hU(t||e,e)}var _U={};function vU(){return _U}function yU(e,t){let n=vU(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=gU(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function bU(e,t){return yU(e,{...t,weekStartsOn:1})}function xU(e,t){let n=gU(e,t?.in),r=n.getFullYear(),i=hU(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=bU(i),o=hU(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=bU(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function SU(e){let t=gU(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function CU(e,...t){let n=hU.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function wU(e,t){let n=gU(e,t?.in);return n.setHours(0,0,0,0),n}function TU(e,t,n){let[r,i]=CU(n?.in,e,t),a=wU(r),o=wU(i),s=+a-SU(a),c=+o-SU(o);return Math.round((s-c)/oU)}function EU(e,t){let n=xU(e,t),r=hU(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),bU(r)}function DU(e,t){let n=gU(e)-+gU(t);return n<0?-1:n>0?1:n}function OU(e){return hU(e,Date.now())}function kU(e,t,n){let[r,i]=CU(n?.in,e,t);return+wU(r)==+wU(i)}function AU(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function jU(e){return!(!AU(e)&&typeof e!=`number`||isNaN(+gU(e)))}function MU(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function NU(e,t){let n=gU(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var PU={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},FU=(e,t,n)=>{let r,i=PU[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function IU(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var LU={date:IU({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:IU({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:IU({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},RU={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},zU=(e,t,n,r)=>RU[e];function BU(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var VU={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:BU({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:BU({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:BU({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:BU({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:BU({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function HU(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?WU(s,e=>e.test(o)):UU(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function UU(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function WU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function GU(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var KU={code:`en-US`,formatDistance:FU,formatLong:LU,formatRelative:zU,localize:VU,match:{ordinalNumber:GU({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:HU({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:HU({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:HU({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:HU({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:HU({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function qU(e,t){let n=gU(e,t?.in);return TU(n,NU(n))+1}function JU(e,t){let n=gU(e,t?.in),r=bU(n)-+EU(n);return Math.round(r/aU)+1}function YU(e,t){let n=gU(e,t?.in),r=n.getFullYear(),i=vU(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=hU(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=yU(o,t),c=hU(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=yU(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function XU(e,t){let n=vU(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=YU(e,t),a=hU(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),yU(a,t)}function ZU(e,t){let n=gU(e,t?.in),r=yU(n,t)-+XU(n,t);return Math.round(r/aU)+1}function QU(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var $U={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return QU(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):QU(n+1,2)},d(e,t){return QU(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return QU(e.getHours()%12||12,t.length)},H(e,t){return QU(e.getHours(),t.length)},m(e,t){return QU(e.getMinutes(),t.length)},s(e,t){return QU(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return QU(Math.trunc(r*10**(n-3)),t.length)}},eW={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},tW={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return $U.y(e,t)},Y:function(e,t,n,r){let i=YU(e,r),a=i>0?i:1-i;return t===`YY`?QU(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):QU(a,t.length)},R:function(e,t){return QU(xU(e),t.length)},u:function(e,t){return QU(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return QU(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return QU(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return $U.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return QU(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=ZU(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):QU(i,t.length)},I:function(e,t,n){let r=JU(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):QU(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):$U.d(e,t)},D:function(e,t,n){let r=qU(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):QU(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return QU(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return QU(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return QU(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?eW.noon:r===0?eW.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?eW.evening:r>=12?eW.afternoon:r>=4?eW.morning:eW.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return $U.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):$U.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):QU(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):QU(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):$U.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):$U.s(e,t)},S:function(e,t){return $U.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return rW(r);case`XXXX`:case`XX`:return iW(r);default:return iW(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return rW(r);case`xxxx`:case`xx`:return iW(r);default:return iW(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+nW(r,`:`);default:return`GMT`+iW(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+nW(r,`:`);default:return`GMT`+iW(r,`:`)}},t:function(e,t,n){return QU(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return QU(+e,t.length)}};function nW(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+QU(a,2)}function rW(e,t){return e%60==0?(e>0?`-`:`+`)+QU(Math.abs(e)/60,2):iW(e,t)}function iW(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=QU(Math.trunc(r/60),2),a=QU(r%60,2);return n+i+t+a}var aW=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},oW=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},sW={p:oW,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return aW(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,aW(r,t)).replace(`{{time}}`,oW(i,t))}},cW=/^D+$/,lW=/^Y+$/,uW=[`D`,`DD`,`YY`,`YYYY`];function dW(e){return cW.test(e)}function fW(e){return lW.test(e)}function pW(e,t,n){let r=mW(e,t,n);if(console.warn(r),uW.includes(e))throw RangeError(r)}function mW(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var hW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_W=/^'([^]*?)'?$/,vW=/''/g,yW=/[a-zA-Z]/;function bW(e,t,n){let r=vU(),i=n?.locale??r.locale??KU,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=gU(e,n?.in);if(!jU(s))throw RangeError(`Invalid time value`);let c=t.match(gW).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=sW[t];return n(e,i.formatLong)}return e}).join(``).match(hW).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:xW(e)};if(tW[t])return{isToken:!0,value:e};if(t.match(yW))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&fW(a)||!n?.useAdditionalDayOfYearTokens&&dW(a))&&pW(a,t,String(e));let o=tW[a[0]];return o(s,a,i.localize,l)}).join(``)}function xW(e){let t=e.match(_W);return t?t[1].replace(vW,`'`):e}function SW(e,t,n){let r=vU(),i=n?.locale??r.locale??KU,a=DU(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=CU(n?.in,...a>0?[t,e]:[e,t]),l=MU(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/sU,f=(u-(SU(c)-SU(s)))/sU,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/fU);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/dU);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/uU);return i.formatDistance(`xYears`,e,o)}}function CW(e,t){return SW(e,OU(e),t)}function wW(e){return Math.trunc(e*cU)}function TW(e,t,n){let[r,i]=CU(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function EW(e,t){return TW(hU(t?.in||e,e),OU(t?.in||e))}function DW(e,t){return kU(hU(t?.in||e,e),OU(t?.in||e))}function OW(e){let t=e/cU;return Math.trunc(t)}function kW(e){let t=e/sU;return Math.trunc(t)}function AW(e){let t=e/lU;return Math.trunc(t)}function jW(e){return Math.trunc(e*sU)}function MW(e,t){let n=()=>hU(t?.in,NaN),r=t?.additionalDigits??2,i=LW(e),a;if(i.date){let e=RW(i.date,r);a=zW(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=VW(i.time),isNaN(s)))return n();if(i.timezone){if(c=UW(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=gU(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return gU(o+s+c,t?.in)}var NW={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},PW=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,FW=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,IW=/^([+-])(\d{2})(?::?(\d{2}))?$/;function LW(e){let t={},n=e.split(NW.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],NW.timeZoneDelimiter.test(t.date)&&(t.date=e.split(NW.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=NW.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function RW(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function zW(e,t){if(t===null)return new Date(NaN);let n=e.match(PW);if(!n)return new Date(NaN);let r=!!n[4],i=BW(n[1]),a=BW(n[2])-1,o=BW(n[3]),s=BW(n[4]),c=BW(n[5])-1;if(r)return YW(t,s,c)?WW(t,s,c):new Date(NaN);{let e=new Date(0);return!qW(t,a,o)||!JW(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function BW(e){return e?parseInt(e):1}function VW(e){let t=e.match(FW);if(!t)return NaN;let n=HW(t[1]),r=HW(t[2]),i=HW(t[3]);return XW(n,r,i)?n*cU+r*sU+i*1e3:NaN}function HW(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function UW(e){if(e===`Z`)return 0;let t=e.match(IW);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return ZW(r,i)?n*(r*cU+i*sU):NaN}function WW(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var GW=[31,null,31,30,31,30,31,31,30,31,30,31];function KW(e){return e%400==0||e%4==0&&e%100!=0}function qW(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(GW[t]||(KW(e)?29:28))}function JW(e,t){return t>=1&&t<=(KW(e)?366:365)}function YW(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function XW(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function ZW(e,t){return t>=0&&t<=59}function QW(e){return e*lU}function $W(e){let t=Math.max(0,Math.round(e));if(t<QW(1))return`${t}ms`;let n=OW(t),r=kW(t-wW(n)),i=AW(t-wW(n)-jW(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function eG(e){return $W(QW(e))}function tG(e){let t=MW(e);return jU(t)?t:void 0}function nG(e){let t=tG(e);return t===void 0?e:DW(t)?bW(t,`HH:mm:ss`):EW(t)?bW(t,`MMM d, HH:mm:ss`):bW(t,`MMM d yyyy, HH:mm:ss`)}function rG(e){let t=tG(e);return t===void 0?e:bW(t,`PPpp zzzz`)}function iG(e){let t=tG(e);return t===void 0?e:CW(t,{addSuffix:!0})}function aG({at:e,className:t,relative:n=!1}){let r=tG(e);return r===void 0?(0,W.jsx)(`span`,{className:t,children:e}):(0,W.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:rG(e),children:n?iG(e):nG(e)})}var oG={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:FD.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:FD.monitor}};function sG(e){return e!==null&&Object.hasOwn(oG,e)}var cG={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,pr:`PR`,checks:`Checks`};function lG(e){return e!==null&&Object.hasOwn(cG,e)}function uG(){let e=(0,U.useSyncExternalStore)(dG,fG,fG),t=new URLSearchParams(e),n=t.get(`run`)??void 0,r=t.get(`node`)??void 0,i=t.get(`event`)??void 0,a=t.get(`view`),o=t.get(`tab`),s=t.get(`detail`),c=sG(s)?s:`activity`,l=lG(o)?o:`timeline`,u=a===`graph`||a===`overall`?a:r===void 0?`overall`:`graph`,d=(0,U.useCallback)(e=>{let t=new URLSearchParams(window.location.search);e(t),window.history.pushState(null,``,`${window.location.pathname}?${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{runId:n,nodeId:r,itemId:i,view:u,detail:c,nodeTab:l,selectRun:e=>d(t=>{t.set(`run`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>d(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>d(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>d(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>d(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>d(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)})}}function dG(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function fG(){return window.location.search}function pG({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?It:Ft;return(0,W.jsxs)(ya,{"aria-label":`${t}: ${n}`,className:at(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,W.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}var mG={recovery:Ht,failure:qt,human:Jt,planning:Tt,contention:jt,verification:Gt,publication:At,repository:kt,session:Lt,lifecycle:Rt,activity:wt};Object.keys(mG);function hG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var gG=[[`recovery`,[`retry`,`retried`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`]],[`publication`,[`pr`,`publication`,`published`,`release`,`merge`,`merged`,`change`,`drafting`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],_G={"completion-requested":`lifecycle`,"body-not-drafted":`publication`};function vG(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function yG(e){let t=_G[e];if(t!==void 0)return t;let n=vG(e);return gG.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}function bG({category:e,className:t=`size-3`}){let n=mG[e];return(0,W.jsx)(n,{"aria-hidden":`true`,className:t})}function xG(e){return e===`human-step`?`human step`:e}function SG(e){return e.style===`human-step`}function CG(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function wG(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function TG(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`deferred`?`Deferred — onto the node's next dispatch`:e}function EG(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function DG({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:xG(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,wG(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,TG(e.delivery)]].filter(([,e])=>e!==void 0);return(0,W.jsxs)(W.Fragment,{children:[t.length>0&&(0,W.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e}),(0,W.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,W.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,W.jsxs)(`li`,{children:[SG(e)?(0,W.jsxs)(Ji,{children:[(0,W.jsx)(Jt,{}),(0,W.jsxs)(Yi,{children:[`Waiting on a person · `,EG(e)]}),(0,W.jsx)(Xi,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,W.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,EG(e)]}),(0,W.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:CG(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,W.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function OG({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,W.jsx)(W.Fragment,{children:`Not recorded`});let n=t.identity!==e.task.repo;return(0,W.jsx)(W.Fragment,{children:[t.target,t.style===void 0?void 0:xG(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function kG(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:$W(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`,...e.status?{status:e.status}:{}}}function AG({row:e}){let t=kG(e);return(0,W.jsxs)(`header`,{className:`detail-title`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(ya,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,W.jsx)(`h2`,{children:t.label}),(0,W.jsxs)(`p`,{className:`detail-when`,children:[(0,W.jsx)(aG,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,W.jsx)(ya,{variant:`secondary`,children:t.status})]})}function jG(e){let t=kG(e);return[t.kind,t.label,nG(t.startedAt),hG(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function MG({row:e}){return(0,W.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":jG(e),children:(0,W.jsx)(bG,{category:e.category})})}var NG=`data-timeline-reading`;function PG(e){let t=e.closest(`[${NG}]`)??e.closest(`button`)?.querySelector(`[${NG}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(NG)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var FG={rows:[],total:0},IG={worker:`Worker`,judge:`Judge`,lint:`Lint`,orchestrator:`Orchestrator`,"check-in":`Check-in`,"pr-author":`PR author`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},LG=Object.entries(IG).map(([e,t])=>({id:e,label:t})),RG={run:null,node:null,step:null,dispatch:`worker`,verification:`verification`,publication:`publication`,"pr-drafting":`pr-author`,"conflict-resolution":`publication`,"human-wait":`human-wait`,rollup:`lock-waits`},zG=`llmlint`,BG={worker:`worker`,judge:`judge`,llmlint:`lint`,orchestrator:`orchestrator`,"check-in":`check-in`,"pr-author":`pr-author`},VG={worker:!0,orchestrator:!0,"check-in":!0,"pr-author":!0,judge:!1,llmlint:!1};function HG(e){return IG[BG[e]]}var UG={"lock-wait":`Lock waits`};function WG(e){let t=[...e].sort((e,t)=>e.start-t.start),n=t.at(0)?.start??0,r=Math.max(n+1,...t.map(e=>e.end??e.start)),i=new Set([t.at(0),t.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),a=(r-n)*.02,o=[];for(let e of t){let t=Math.max(e.end??e.start,e.start+a),n=o.findLast(n=>{let r=Math.max(n.end??n.start,n.start+a);return e.start<=r&&n.start<=t});n===void 0||i.has(e.id)?o.push(e):KG(e)<KG(n)?i.has(n.id)?o.push(e):o[o.indexOf(n)]=e:GG(e,n,a)||o.push(e)}return o}function GG(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function KG(e){let t=e.laneId??``,n=LG.findIndex(({id:e})=>e===t);return n<0?LG.length:n}function qG(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function JG(e,t){let n=QG(e,t).rows,r=YG(n),i=YG(n,!1),a=i.flatMap(e=>{let t=XG(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),o=i.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,U.createElement)(MG,{row:e})}]:[]),s=Math.max(...a.map(e=>e.end??e.start),...o.map(e=>e.at));return{items:a.map(e=>e.end===null?{...e,end:s,duration:s-e.start}:e),markers:o,lanes:LG,rows:r}}function YG(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function XG(e){if(e.rowKind===`event`)return null;let t=ZG(e.role);return t===null?RG[e.rowKind===`span`?e.span.kind:e.kind]??null:t}function ZG(e){return e===void 0?null:BG[e]??null}function QG(e,t){if(e===void 0)return FG;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=bK(e.spans,new Set,t);return n.length===0?FG:{rows:fK(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=fK(gK(hK(fK([...o===void 0?[]:rK(o,i),...a.filter(e=>e!==o).map(e=>iK(e,i)),...bK(e.spans,r,t)].sort(SK)))));return{span:o,rows:s,total:xK(s)}}function $G(e){return iK(e,new Map)}function eK(e){return dK(e)}function tK(e,t){return nK(e,t).at(-1)}function nK(e,t){for(let n of e){if(n.id===t)return[n];let e=nK(n.children,t);if(e.length>0)return[n,...e]}return[]}function rK(e,t){return[...(t.get(e.id)??[]).map(e=>iK(e,t)),...e.events.map(dK)].sort(SK)}function iK(e,t){let n=aK(e);return{rowKind:`span`,span:e,id:e.id,kind:e.kind,role:n,label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??CK(e.started_at,e.ended_at),children:fK(rK(e,t)),displayLabel:mK(e,n),displayKind:pK(e,n),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function aK(e){return e.kind===`dispatch`?oK(e):void 0}function oK(e){if(e.agent_role!==void 0)return e.transport_role===`llmlint`?zG:e.agent_role}function sK(e){let t=oK(e);return t===void 0?RG[e.kind===`rollup`?e.label:e.kind]??null:BG[t]??null}function cK(e){return IG[e]}function lK(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var uK=`Redirection`;function dK(e){let t=lK(e);return{rowKind:`event`,event:e,id:e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:t??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),displayKind:t===void 0?`Event`:uK,category:yG(e.kind)}}function fK(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&yK(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<8||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:CK(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind}),n=i}return t}function pK(e,t){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return UG[e.label]??e.label;let n=ZG(t)??RG[e.kind];return n==null?e.kind:IG[n]}function mK(e,t){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;let n=pK(e,t);return e.kind===`rollup`?`${n}: ${e.count??0} recorded`:!e.label||e.label===n?n:e.kind===`dispatch`?`${n} (${e.label})`:`${n}: ${e.label}`}function hK(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=hK(e.children);return e.role!==`worker`||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function gK(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(_K(a.role)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(vK(a.role)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function _K(e){return e!==void 0&&VG[e]===!0}function vK(e){return e!==void 0&&VG[e]===!1}function yK(e,t){return t!==void 0&&e.rowKind===`span`&&t.rowKind===`span`&&e.kind===t.kind}function bK(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(dK)}function xK(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+xK(t.children),0)}function SK(e,t){return e.startedAt.localeCompare(t.startedAt)}function CK(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function wK(e,t,n,r){let[i,a]=(0,U.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,U.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,U.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var TK=32;function EK(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function DK(e,t){let n=(0,U.useRef)(null),r=(0,U.useRef)(!0),i=(0,U.useRef)({key:e,count:t}),a=(0,U.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=TK)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=EK(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,U.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var OK=25,kK=4e3;function AK({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:KK(r),a=i?.kind===`conversation`?i.value:void 0,o=wK(e,t,a,r===void 0?void 0:HK(r));return(0,W.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:DK(a,UK(r,o)),children:r===void 0?(0,W.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,W.jsx)(Nt,{size:30}),(0,W.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(AG,{row:r}),(0,W.jsx)(jl,{className:`my-4`}),(0,W.jsx)(jK,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function jK({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=WK(n);if(o!==void 0)return(0,W.jsx)(zK,{redirection:o,row:n});let s=GK(n);return s===void 0?i?.kind===`conversation`?(0,W.jsx)(MK,{row:n,transcript:a}):JK(n)?(0,W.jsx)(NK,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&LK(i.value)!==void 0?(0,W.jsx)(PK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&LK(i.value)!==void 0?(0,W.jsx)(FK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):YK(n,i)&&r!==void 0?(0,W.jsx)(RK,{node:r,reference:i}):(0,W.jsx)(BK,{reference:i,row:n}):(0,W.jsx)(DG,{release:s})}function MK({row:e,transcript:t}){let[n,r]=(0,U.useState)(OK),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?i.filter(({id:t})=>t===e.event.id):i,o=Pd(a.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,W.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,W.jsx)(Ml,{className:`h-2 w-40`}),(0,W.jsx)(Ml,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,W.jsxs)(Ji,{variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Transcript unavailable`}),(0,W.jsx)(Xi,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=XK(c.agentRole,c.transportRole);return(0,W.jsx)(Sa,{className:`gap-0 py-3`,children:(0,W.jsxs)(Ca,{className:`px-3`,children:[(0,W.jsxs)(`header`,{className:`transcript-header`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,l,c.persona?` · ${c.persona}`:``]}),(0,W.jsx)(`h4`,{children:s.name})]}),(0,W.jsx)(Id,{state:s.state})]}),(0,W.jsx)(jl,{className:`my-2.5`}),(0,W.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,W.jsx)(Nd,{cursor:o.cursor,onSelectTurn:o.scrollTo,turns:[...a]})}),a.length===0?(0,W.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:o.containerRef,children:a.slice(0,n).map(e=>(0,W.jsx)(`div`,{ref:t=>o.register(e.id,t),children:(0,W.jsx)(Ax,{author:{label:l},turn:e})},e.id))}),a.length>n&&(0,W.jsxs)(xa,{onClick:()=>r(n+OK),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function NK({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Result`}),(0,W.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,W.jsx)(`pre`,{children:i.output_tail})]}),(0,W.jsx)(IK,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,W.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function PK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(IK,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,W.jsx)(BK,{reference:n,row:r})]})}function FK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(IK,{artifactId:e,client:t,heading:`Oneharness conversation`,missing:`This record named no conversation.`,noun:`conversation`,runId:i,unreadable:`The history store holds no readable copy of that conversation.`}),(0,W.jsx)(BK,{reference:n,row:r})]})}function IK({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let[s,c]=(0,U.useState)(),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),p=LK(e);return(0,U.useEffect)(()=>{let e=!0;if(c(void 0),u(!1),f(!1),p!==void 0)return t.getArtifact(a,p).then(t=>{e&&c(t.content)}).catch(()=>{e&&(u(!0),c(null))}),()=>{e=!1}},[t,a,p]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:n}),p===void 0?(0,W.jsx)(`p`,{className:`detail-note`,children:r}):s===void 0?(0,W.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):l||s===null?(0,W.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`pre`,{children:d?s:s.slice(-4e3)}),s.length>kK&&(0,W.jsx)(xa,{onClick:()=>f(!d),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function LK(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function RK({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,W.jsx)(VK,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,W.jsx)(Ot,{size:13})]})}):r?.branch_url?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,W.jsx)(Ot,{size:13})]})}):!r?.pr_url&&(0,W.jsx)(VK,{fallback:`No publication was recorded.`,reference:t}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,W.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,W.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e.name}),(0,W.jsx)(`dd`,{children:e.url?(0,W.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function zK({redirection:e,row:t}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Delivery`}),(0,W.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Redirected at`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(aG,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Member`}),(0,W.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Note`}),(0,W.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]})]}),e.reason!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,W.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function BK({row:e,reference:t}){let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Recorded at`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(aG,{at:e.startedAt,relative:!0})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Ended`}),(0,W.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,W.jsx)(aG,{at:e.endedAt,relative:!0})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Status`}),(0,W.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Duration`}),(0,W.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:$W(e.durationMs)})]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Aggregated`}),(0,W.jsx)(`dd`,{children:r})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Step`}),(0,W.jsx)(`dd`,{children:qK(n)??`None`})]})]}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,W.jsx)(VK,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function VK({reference:e,fallback:t}){return e===void 0?(0,W.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,W.jsx)(`p`,{className:`detail-link`,children:(0,W.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,W.jsx)(Ot,{size:13})]})}):(0,W.jsxs)(`p`,{className:`detail-note`,children:[(0,W.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,W.jsx)(`code`,{children:e.value})]})}function HK(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function UK(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function WK(e){return e.rowKind===`event`?e.event.redirection:void 0}function GK(e){return e.rowKind===`event`?e.event.release:void 0}function KK(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function qK(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function JK(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function YK(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function XK(e,t){return HG(t===`llmlint`?zG:e)}function ZK({client:e,runId:t,node:n,timeline:r,timelineError:i,selectedItemId:a,onSelectItem:o,onBack:s,selectedTab:c,onSelectTab:l}){let u=(0,U.useMemo)(()=>QG(r,n.id),[r,n.id]);(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(a===void 0?s():o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o,a]);let d=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,W.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,W.jsxs)(`header`,{className:`node-view-head`,children:[(0,W.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,W.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,W.jsx)(`li`,{children:(0,W.jsxs)(xa,{onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:[(0,W.jsx)(_t,{size:14}),` Graph`]})}),(0,W.jsx)(`li`,{"aria-current":`page`,children:(0,W.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,W.jsxs)(`div`,{className:`node-view-facts`,children:[(0,W.jsx)(qH,{className:`node-view-state`,state:n.status}),(0,W.jsx)(pG,{control:n.control}),(0,W.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),d!==void 0&&(0,W.jsxs)(`a`,{className:`node-view-pr`,href:d,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,W.jsx)(Ot,{size:12})]})]})]}),(0,W.jsx)(aq,{node:n}),(0,W.jsxs)(Au,{className:`node-tabs`,onValueChange:e=>{lG(e)&&l(e)},value:c,children:[(0,W.jsx)(Mu,{"aria-label":`Node details`,variant:`line`,children:Object.entries(cG).map(([e,t])=>(0,W.jsx)(Nu,{value:e,children:t},e))}),(0,W.jsxs)(Pu,{className:`node-tab-panel`,value:`task`,children:[(0,W.jsx)(`pre`,{children:nq(n.task)}),(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Outcome`}),(0,W.jsx)(`dd`,{children:oq(n.result?.detail)})]})})]}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`criteria`,children:(0,W.jsx)(`pre`,{children:rq(n.task)})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`dependencies`,children:(0,W.jsx)(`dl`,{className:`facts`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Dependencies`}),(0,W.jsx)(`dd`,{children:n.task.deps?.join(`, `)||`None`})]})})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`pr`,children:(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Publication`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(iq,{node:n})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Release`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(OG,{node:n})})]})]})}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`checks`,children:(0,W.jsxs)(`dl`,{className:`facts`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Verification coverage`}),(0,W.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Observed checks`}),(0,W.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:n.detail?.verification.checks?.map((e,t)=>(0,W.jsxs)(`span`,{children:[t>0&&` · `,e.url?(0,W.jsxs)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:[e.name,`: `,e.state]}):`${e.name}: ${e.state}`]},e.name))})]})]})}),(0,W.jsx)(Pu,{className:`node-timeline-panel`,value:`timeline`,children:i===void 0?r===void 0?(0,W.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):u.rows.length===0?(0,W.jsxs)(Sa,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,W.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,W.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,W.jsx)(QK,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,W.jsxs)(Ji,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Timeline unavailable`}),(0,W.jsx)(Xi,{children:i.message})]})})]})]})}function QK({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>JG(a,t.id),[a,t.id]),s=Pd((0,U.useMemo)(()=>o.rows.map(e=>({id:e.id,time:Date.parse(e.startedAt)})),[o.rows])),[c,l]=(0,U.useState)(!1),u=(0,U.useMemo)(()=>WG(o.items),[o.items]),d=(0,U.useMemo)(()=>qG(o.markers,o.items,i),[o.items,o.markers,i]),f=(0,U.useMemo)(()=>$K(o.items),[o.items]),p=s.cursor===void 0?void 0:Math.min(Math.max(s.cursor,f[0]),f[1]),m=i===void 0?void 0:tK(o.rows,i),h=e=>{n(e),s.scrollTo(e)};return(0,U.useEffect)(()=>{i!==void 0&&s.scrollTo(i)},[i,s]),(0,W.jsxs)(`div`,{className:`node-execution`,"data-expanded":c,children:[(0,W.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,W.jsx)(un,{axis:{origin:f[0]},cursor:p,expanded:c,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:c?o.items:u,lanes:o.lanes,markers:d,onExpandedChange:l,onSelect:e=>h(e.id),selectedId:i})}),(0,W.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:s.containerRef,children:eq(o.rows).map(e=>{let t=e.rows.map(e=>(0,W.jsx)(tq,{onOpen:h,register:s.register,row:e,selected:e.id===i},e.id));return e.dispatch===void 0?(0,W.jsx)(U.Fragment,{children:t},e.id):(0,W.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,W.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),m!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(xa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Xt,{})}),(0,W.jsx)(AK,{client:e,node:t,row:m,runId:r})]})]})}function $K(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function eq(e){let t=[];for(let n of e){let e=t.at(-1);n.dispatch!==void 0&&e?.dispatch!==void 0&&e.dispatch.id===n.dispatch.id?e.rows.push(n):t.push({id:n.id,dispatch:n.dispatch,rows:[n]})}return t}function tq({row:e,selected:t,register:n,onOpen:r}){return(0,W.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-selected":t,ref:t=>n(e.id,t),children:(0,W.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,W.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,W.jsx)(bG,{category:e.category}),e.displayKind]}),(0,W.jsx)(`strong`,{children:e.displayLabel}),(0,W.jsxs)(`span`,{className:`transcript-facts`,children:[(0,W.jsx)(aG,{at:e.startedAt}),e.durationMs!==null&&` · ${$W(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function nq(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
55
55
 
56
- `)}function WK(e){let t=UK(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function GK({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,W.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,W.jsx)(Ot,{size:12})]}):(0,W.jsx)(W.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,W.jsx)(W.Fragment,{children:`Not recorded`}):(0,W.jsx)(W.Fragment,{children:n.map(([e,t],n)=>(0,W.jsxs)(`span`,{children:[n>0&&` · `,(0,W.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,W.jsx)(Ot,{size:12})]})]},e))})}function KK({node:e}){if(!NH(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=kH(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,W.jsxs)(Ji,{className:at(`m-5 w-auto`,t&&`border-warning bg-warning-surface text-warning`),variant:t?`default`:`destructive`,children:[t?(0,W.jsx)(zt,{}):(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:t?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,W.jsx)(Xi,{children:(0,W.jsxs)(`dl`,{className:`facts`,children:[t&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,W.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),!t&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Detail`}),(0,W.jsx)(`dd`,{children:n??`No reason was recorded for this outcome.`})]}),r!==void 0&&r!==n&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Error`}),(0,W.jsx)(`dd`,{children:r})]}),typeof i==`number`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Exit code`}),(0,W.jsx)(`dd`,{children:i})]})]})})]})}function qK(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}var JK=`idle`,YK=`idle-`,XK=`row:run`,ZK=e=>`row:node:${e}`,QK={id:JK,label:`Idle`},$K=[...EG,QK],eq=.005;function tq(e,t){let n=e?.spans??[],r=nq(e),i=[rq({id:XK,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0)}),...t.map(e=>rq({id:ZK(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id)}))],a=i.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`));return{range:r,live:n.some(e=>e.ended_at===null),rows:i,line:{items:[...sq(r,a,void 0),...NG(a)],markers:IG(i.flatMap(e=>[...e.markers]),a),lanes:$K}}}function nq(e){let t=e?.spans??[],n=t.map(e=>Date.parse(e.started_at));if(n.length===0)return[0,1];let r=Math.min(...n),i=Math.max(...t.map(e=>e.ended_at===null?Date.parse(e.started_at):Date.parse(e.ended_at))),a=Date.parse(e?.observed_at??``),o=t.some(e=>e.ended_at===null)&&Number.isFinite(a)?Math.max(i,a):i;return[r,o>r?o:r+1]}function rq({id:e,kind:t,label:n,nodeId:r,range:i,spans:a}){let o=a.flatMap(t=>{let a=YG(t);if(a===null)return[];let o=Date.parse(t.started_at),s=iq(t,a,o,i),c=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${XG(a)}${aq(t)}`,laneId:a,start:o,end:s,duration:s-o,status:t.status,payload:{id:t.id,kind:`work`,label:`${n} · ${XG(a)}`,rowId:e,...r===void 0?{}:{nodeId:r},...c===void 0?{}:{conversationId:c},startedAt:t.started_at,endedAt:t.ended_at,durationMs:s-o}}]}),s=sq(i,o,{rowId:e,nodeId:r}),c=oq(o).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:$K.filter(({id:e})=>[...o,...s].some(t=>t.laneId===e)),items:[...s,...o],line:[...s,...NG(o)],markers:a.flatMap(t=>t.events.map(t=>({id:t.id,label:`${n} · ${t.step_id??t.kind}`,at:Date.parse(t.at),status:t.status,payload:{id:t.id,kind:`work`,label:t.kind,rowId:e,...r===void 0?{}:{nodeId:r},startedAt:t.at,endedAt:null,durationMs:0}}))),workedMs:c,idleMs:s.reduce((e,t)=>e+t.payload.durationMs,0)}}function iq(e,t,n,r){return t===`lock-waits`&&e.total_duration_ms!==void 0?n+e.total_duration_ms:e.ended_at===null?r[1]:Date.parse(e.ended_at)}function aq(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function oq(e){let t=e.map(e=>[e.start,Math.max(e.end??e.start,e.start)]).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t)).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function sq(e,t,n){let r=oq(t),i=[],a=e[0];for(let[e,t]of r)e>a&&i.push([a,e]),a=Math.max(a,t);a<e[1]&&i.push([a,e[1]]);let o=Math.max(1,e[1]-e[0]);return i.filter(([e,t],n)=>n===0||n===i.length-1||(t-e)/o>=eq).map(([e,t],r)=>{let i=`${YK}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${XW(t-e)}`,...n===void 0?{}:{rowId:n.rowId},...n?.nodeId===void 0?{}:{nodeId:n.nodeId},startedAt:new Date(e).toISOString(),endedAt:new Date(t).toISOString(),durationMs:t-e};return{id:i,label:a.label,laneId:JK,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function cq({client:e,detail:t,nodes:n,timeline:r,timelineError:i,onSelectNode:a,selectedItemId:o,onSelectItem:s}){let c=t.run.run_id,l=(0,U.useMemo)(()=>tq(r,n),[r,n]),u=(r?.spans??[]).find(e=>e.id===o&&e.node_id===void 0);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o!==void 0&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o]),(0,W.jsxs)(`div`,{className:`overall-view`,children:[(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,W.jsxs)(`section`,{className:`overall-hero`,children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,W.jsx)(`h2`,{children:c}),t.graph?.plan.goal?.text&&(0,W.jsx)(`p`,{className:`run-goal`,children:t.graph.plan.goal.text}),(0,W.jsxs)(`p`,{children:[t.run.phase,` ·`,` `,t.run.last_event?`last event ${t.run.last_event}`:`no events recorded yet`]})]}),(0,W.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,W.jsx)(dq,{icon:(0,W.jsx)(gt,{}),label:`Status`,value:t.run.state}),(0,W.jsx)(dq,{icon:(0,W.jsx)(Mt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,W.jsx)(dq,{icon:(0,W.jsx)(Et,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:ZW(t.run.timing.wall_seconds)}),(0,W.jsx)(dq,{icon:(0,W.jsx)(Dt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,W.jsx)(Sa,{className:`gap-0 py-[15px]`,children:(0,W.jsxs)(Ca,{className:`px-[15px]`,children:[(0,W.jsxs)(`div`,{className:`section-heading`,children:[(0,W.jsx)(gt,{size:16}),(0,W.jsx)(`h3`,{children:`Graph timeline`})]}),i===void 0?r===void 0?(0,W.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):r.spans.length===0?(0,W.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,W.jsx)(lq,{graph:l,onOpenNode:a,onOpenSession:s,selectedItemId:o}):(0,W.jsxs)(Ji,{variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Timeline unavailable`}),(0,W.jsx)(Xi,{children:i.message})]})]})})]})}),u!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(xa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Xt,{})}),(0,W.jsx)(vK,{client:e,row:HG(u),runId:c})]})]})}function lq({graph:e,onOpenNode:t,onOpenSession:n,selectedItemId:r}){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(new Set),u=i??e.range,d=e=>{e.nodeId===void 0?e.conversationId!==void 0&&n(e.id):t(e.nodeId)},f=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,W.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":o,children:[(0,W.jsx)(un,{axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:f,markers:e.line.markers,onExpandedChange:s,onRangeChange:a,onSelect:e=>d(e.payload),range:u,selectedId:r}),o&&(0,W.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(n=>(0,W.jsx)(uq,{onOpen:d,onOpenNode:t,onExpandedChange:e=>l(t=>{let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r}),expanded:c.has(n.id),origin:e.range[0],range:u,onRangeChange:a,row:n,selectedItemId:r},n.id))})]})}function uq({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,W.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,W.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,W.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,W.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,W.jsxs)(`span`,{className:`graph-row-facts`,children:[XW(e.workedMs),` recorded · `,XW(e.idleMs),` `,`idle`]})]}),(0,W.jsx)(un,{axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function dq({icon:e,label:t,value:n}){return(0,W.jsxs)(Sa,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:t}),(0,W.jsx)(`strong`,{children:n})]})]})}var fq=6,pq=8,mq=`[aria-describedby^="timeline-detail-"]`,hq=e=>{if(!(e instanceof Element))return;let t=CG(e);if(t!==void 0)return t;let n=e.closest(mq);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},gq=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function _q(){let e=(0,U.useRef)(null),[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(),a=t??r,o=(0,U.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,U.useEffect)(()=>{let e=e=>n(t=>gq(t,hq(e.target))),t=e=>i(t=>gq(t,hq(e.target))),r=e=>i(t=>gq(t,hq(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,U.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-pq,s=Math.min(Math.max(n.left,pq),Math.max(pq,i)),c=n.bottom+fq,l=n.top-r.height-fq,u=Math.max(pq,window.innerHeight-r.height-pq),d=c+r.height<=window.innerHeight-pq?c:l,f=Math.min(Math.max(d,pq),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,U.useLayoutEffect)(s,[s]),(0,U.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,vr.createPortal)((0,W.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var vq=new qO(window.location.origin,{fetch:window.fetch.bind(window)}),yq=Object.entries(rG);function bq({client:e=vq}){let t=sG(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=rG[t.detail].profile,i=ZH(e,t.runId,n,r),a=(0,U.useMemo)(()=>PH(i.list?.runs??[]),[i.list]),o=i.runId,s=i.detail,c=(0,U.useMemo)(()=>s?TH(s):[],[s]),l=c.find(({id:e})=>e===t.nodeId),u=(0,U.useMemo)(()=>new Set((i.list?.runs??[]).filter(({state:e})=>![`complete`,`failed`,`cancelled`].includes(e)).map(({run_id:e})=>e)),[i.list]);return(0,U.useEffect)(()=>{if(o&&t.runId&&t.runId!==o){let e=new URLSearchParams(window.location.search);e.set(`run`,o),e.delete(`node`),e.delete(`event`),e.set(`view`,t.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[t.runId,o,t.view]),(0,W.jsxs)(bd,{children:[(0,W.jsx)(_q,{}),(0,W.jsxs)(`div`,{className:`app-shell`,children:[(0,W.jsx)(XH,{groups:a,selectedRunId:o,liveRunIds:u,hasMore:i.hasMore,onLoadMore:i.loadMore,onSelect:t.selectRun}),(0,W.jsxs)(`main`,{className:`workspace`,children:[(0,W.jsxs)(`header`,{className:`topbar`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,W.jsx)(`h2`,{children:o??`No DAG selected`})]}),(0,W.jsxs)(`div`,{className:`topbar-actions`,children:[(0,W.jsxs)(`span`,{className:`connection`,children:[(0,W.jsx)(Wt,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,W.jsxs)(W.Fragment,{children:[`Last updated`,` `,(0,W.jsx)(nG,{at:i.lastUpdated,relative:!0})]})]}),i.activity.at(-1)!==void 0&&(0,W.jsxs)(`span`,{className:`connection`,"aria-live":`polite`,children:[i.activity.at(-1)?.node,`:`,` `,[i.activity.at(-1)?.name,i.activity.at(-1)?.detail].filter(Boolean).join(` `)||i.activity.at(-1)?.kind]}),(0,W.jsxs)(xa,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,W.jsx)(Bt,{size:14}),` Refresh`]})]})]}),i.error&&(0,W.jsxs)(Ji,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Live telemetry issue`}),(0,W.jsx)(Xi,{children:i.error.message})]}),(0,W.jsxs)(Au,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?t.showOverall():t.selectNode(void 0),value:t.view,children:[(0,W.jsxs)(`div`,{className:`view-tabs`,children:[(0,W.jsxs)(Mu,{"aria-label":`DAG views`,variant:`line`,children:[(0,W.jsxs)(Nu,{value:`graph`,children:[(0,W.jsx)(Yt,{size:15}),` Graph`]}),(0,W.jsxs)(Nu,{value:`overall`,children:[(0,W.jsx)(Ut,{size:15}),` Overall`]})]}),(0,W.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),yq.map(([e,{label:n,description:r}])=>(0,W.jsx)(xa,{"aria-pressed":t.detail===e,onClick:()=>t.selectDetail(e),size:`sm`,title:r,type:`button`,variant:t.detail===e?`default`:`outline`,children:n},e))]})]}),(0,W.jsx)(Pu,{className:`min-h-0`,value:t.view,children:!s&&(i.loading||o!==void 0)?(0,W.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,W.jsx)(Ml,{className:`h-2 w-48`}),(0,W.jsx)(Ml,{className:`h-2 w-32`}),`Loading execution history…`]}):s&&o?t.view===`overall`?(0,W.jsx)(cq,{client:e,detail:s,nodes:c,timeline:i.timeline,timelineError:i.timelineError,onSelectNode:t.selectNode,onSelectItem:t.selectItem,selectedItemId:t.itemId}):l?(0,W.jsx)(RK,{client:e,node:l,onBack:()=>t.selectNode(void 0),onSelectItem:t.selectItem,runId:o,selectedItemId:t.itemId,selectedTab:t.nodeTab,onSelectTab:t.selectNodeTab,timeline:i.timeline,timelineError:i.timelineError}):(0,W.jsx)(UH,{nodes:c,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,W.jsxs)(`div`,{className:`empty-state`,children:[(0,W.jsx)(Yt,{size:34}),(0,W.jsx)(`h2`,{children:`No DAG runs found`}),(0,W.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]})]})]})}var xq=class extends U.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,W.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,W.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,W.jsx)(`p`,{children:this.state.error.message}),(0,W.jsx)(xa,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},Sq=document.getElementById(`root`);if(!Sq)throw Error(`DAG UI root element is missing`);(0,DD.createRoot)(Sq).render((0,W.jsx)(U.StrictMode,{children:(0,W.jsx)(xq,{children:(0,W.jsx)(bq,{})})}));
56
+ `)}function rq(e){let t=nq(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function iq({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,W.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,W.jsx)(Ot,{size:12})]}):(0,W.jsx)(W.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,W.jsx)(W.Fragment,{children:`Not recorded`}):(0,W.jsx)(W.Fragment,{children:n.map(([e,t],n)=>(0,W.jsxs)(`span`,{children:[n>0&&` · `,(0,W.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,W.jsx)(Ot,{size:12})]})]},e))})}function aq({node:e}){if(!IH(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=MH(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,W.jsxs)(Ji,{className:at(`m-5 w-auto`,t&&`border-warning bg-warning-surface text-warning`),variant:t?`default`:`destructive`,children:[t?(0,W.jsx)(zt,{}):(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:t?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,W.jsx)(Xi,{children:(0,W.jsxs)(`dl`,{className:`facts`,children:[t&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,W.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),!t&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Detail`}),(0,W.jsx)(`dd`,{children:n??`No reason was recorded for this outcome.`})]}),r!==void 0&&r!==n&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Error`}),(0,W.jsx)(`dd`,{children:r})]}),typeof i==`number`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Exit code`}),(0,W.jsx)(`dd`,{children:i})]})]})})]})}function oq(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}var sq=`idle`,cq=`idle-`,lq=`row:run`,uq=e=>`row:node:${e}`,dq={id:sq,label:`Idle`},fq=[...LG,dq],pq=.005;function mq(e,t){let n=e?.spans??[],r=hq(e),i=[gq({id:lq,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0)}),...t.map(e=>gq({id:uq(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id)}))],a=i.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`));return{range:r,live:n.some(e=>e.ended_at===null),rows:i,line:{items:[...bq(r,a,void 0),...WG(a)],markers:qG(i.flatMap(e=>[...e.markers]),a),lanes:fq}}}function hq(e){let t=e?.spans??[],n=t.map(e=>Date.parse(e.started_at));if(n.length===0)return[0,1];let r=Math.min(...n),i=Math.max(...t.map(e=>e.ended_at===null?Date.parse(e.started_at):Date.parse(e.ended_at))),a=Date.parse(e?.observed_at??``),o=t.some(e=>e.ended_at===null)&&Number.isFinite(a)?Math.max(i,a):i;return[r,o>r?o:r+1]}function gq({id:e,kind:t,label:n,nodeId:r,range:i,spans:a}){let o=a.flatMap(t=>{let a=sK(t);if(a===null)return[];let o=Date.parse(t.started_at),s=_q(t,a,o,i),c=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${cK(a)}${vq(t)}`,laneId:a,start:o,end:s,duration:s-o,status:t.status,payload:{id:t.id,kind:`work`,label:`${n} · ${cK(a)}`,rowId:e,...r===void 0?{}:{nodeId:r},...c===void 0?{}:{conversationId:c},startedAt:t.started_at,endedAt:t.ended_at,durationMs:s-o}}]}),s=bq(i,o,{rowId:e,nodeId:r}),c=yq(o).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:fq.filter(({id:e})=>[...o,...s].some(t=>t.laneId===e)),items:[...s,...o],line:[...s,...WG(o)],markers:a.flatMap(t=>t.events.map(t=>({id:t.id,label:`${n} · ${t.step_id??t.kind}`,at:Date.parse(t.at),status:t.status,payload:{id:t.id,kind:`record`,label:t.kind,rowId:e,...r===void 0?{}:{nodeId:r},startedAt:t.at,endedAt:null,durationMs:0}}))),workedMs:c,idleMs:s.reduce((e,t)=>e+t.payload.durationMs,0)}}function _q(e,t,n,r){return t===`lock-waits`&&e.total_duration_ms!==void 0?n+e.total_duration_ms:e.ended_at===null?r[1]:Date.parse(e.ended_at)}function vq(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function yq(e){let t=e.map(e=>[e.start,Math.max(e.end??e.start,e.start)]).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t)).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function bq(e,t,n){let r=yq(t),i=[],a=e[0];for(let[e,t]of r)e>a&&i.push([a,e]),a=Math.max(a,t);a<e[1]&&i.push([a,e[1]]);let o=Math.max(1,e[1]-e[0]);return i.filter(([e,t],n)=>n===0||n===i.length-1||(t-e)/o>=pq).map(([e,t],r)=>{let i=`${cq}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${$W(t-e)}`,...n===void 0?{}:{rowId:n.rowId},...n?.nodeId===void 0?{}:{nodeId:n.nodeId},startedAt:new Date(e).toISOString(),endedAt:new Date(t).toISOString(),durationMs:t-e};return{id:i,label:a.label,laneId:sq,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function xq({client:e,detail:t,nodes:n,timeline:r,timelineError:i,onSelectNode:a,selectedItemId:o,onSelectItem:s}){let c=t.run.run_id,l=(0,U.useMemo)(()=>mq(r,n),[r,n]),u=(r?.spans??[]).filter(e=>e.node_id===void 0),d=u.find(e=>e.id===o),f=u.flatMap(e=>e.events).find(e=>e.id===o),p=d===void 0?f===void 0?void 0:eK(f):$G(d);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o!==void 0&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o]),(0,W.jsxs)(`div`,{className:`overall-view`,children:[(0,W.jsx)(vl,{className:`h-full`,children:(0,W.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,W.jsxs)(`section`,{className:`overall-hero`,children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,W.jsx)(`h2`,{children:c}),t.graph?.plan.goal?.text&&(0,W.jsx)(`p`,{className:`run-goal`,children:t.graph.plan.goal.text}),(0,W.jsxs)(`p`,{children:[t.run.phase,` ·`,` `,t.run.last_event?`last event ${t.run.last_event}`:`no events recorded yet`]})]}),(0,W.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,W.jsx)(wq,{icon:(0,W.jsx)(gt,{}),label:`Status`,value:t.run.state}),(0,W.jsx)(wq,{icon:(0,W.jsx)(Mt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,W.jsx)(wq,{icon:(0,W.jsx)(Et,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:eG(t.run.timing.wall_seconds)}),(0,W.jsx)(wq,{icon:(0,W.jsx)(Dt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,W.jsx)(Sa,{className:`gap-0 py-[15px]`,children:(0,W.jsxs)(Ca,{className:`px-[15px]`,children:[(0,W.jsxs)(`div`,{className:`section-heading`,children:[(0,W.jsx)(gt,{size:16}),(0,W.jsx)(`h3`,{children:`Graph timeline`})]}),i===void 0?r===void 0?(0,W.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):r.spans.length===0?(0,W.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,W.jsx)(Sq,{graph:l,onOpenNode:a,onOpenItem:s,selectedItemId:o}):(0,W.jsxs)(Ji,{variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Timeline unavailable`}),(0,W.jsx)(Xi,{children:i.message})]})]})})]})}),p!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(xa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Xt,{})}),(0,W.jsx)(AK,{client:e,row:p,runId:c})]})]})}function Sq({graph:e,onOpenNode:t,onOpenItem:n,selectedItemId:r}){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(new Set),u=i??e.range,d=e=>{e.kind===`record`&&e.nodeId===void 0?n(e.id):e.nodeId===void 0?e.conversationId!==void 0&&n(e.id):t(e.nodeId)},f=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,W.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":o,children:[(0,W.jsx)(un,{axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:f,markers:e.line.markers,onExpandedChange:s,onRangeChange:a,onSelect:e=>d(e.payload),range:u,selectedId:r}),o&&(0,W.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(n=>(0,W.jsx)(Cq,{onOpen:d,onOpenNode:t,onExpandedChange:e=>l(t=>{let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r}),expanded:c.has(n.id),origin:e.range[0],range:u,onRangeChange:a,row:n,selectedItemId:r},n.id))})]})}function Cq({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,W.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,W.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,W.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,W.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,W.jsxs)(`span`,{className:`graph-row-facts`,children:[$W(e.workedMs),` recorded · `,$W(e.idleMs),` `,`idle`]})]}),(0,W.jsx)(un,{axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function wq({icon:e,label:t,value:n}){return(0,W.jsxs)(Sa,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:t}),(0,W.jsx)(`strong`,{children:n})]})]})}var Tq=6,Eq=8,Dq=`[aria-describedby^="timeline-detail-"]`,Oq=e=>{if(!(e instanceof Element))return;let t=PG(e);if(t!==void 0)return t;let n=e.closest(Dq);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},kq=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function Aq(){let e=(0,U.useRef)(null),[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(),a=t??r,o=(0,U.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,U.useEffect)(()=>{let e=e=>n(t=>kq(t,Oq(e.target))),t=e=>i(t=>kq(t,Oq(e.target))),r=e=>i(t=>kq(t,Oq(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,U.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-Eq,s=Math.min(Math.max(n.left,Eq),Math.max(Eq,i)),c=n.bottom+Tq,l=n.top-r.height-Tq,u=Math.max(Eq,window.innerHeight-r.height-Eq),d=c+r.height<=window.innerHeight-Eq?c:l,f=Math.min(Math.max(d,Eq),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,U.useLayoutEffect)(s,[s]),(0,U.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,vr.createPortal)((0,W.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var jq=new XO(window.location.origin,{fetch:window.fetch.bind(window)}),Mq=Object.entries(oG);function Nq({client:e=jq}){let t=uG(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=oG[t.detail].profile,i=eU(e,t.runId,n,r),a=(0,U.useMemo)(()=>LH(i.list?.runs??[]),[i.list]),o=i.runId,s=i.detail,c=(0,U.useMemo)(()=>s?OH(s):[],[s]),l=c.find(({id:e})=>e===t.nodeId),u=(0,U.useMemo)(()=>new Set((i.list?.runs??[]).filter(({state:e})=>![`complete`,`failed`,`cancelled`].includes(e)).map(({run_id:e})=>e)),[i.list]);return(0,U.useEffect)(()=>{if(o&&t.runId&&t.runId!==o){let e=new URLSearchParams(window.location.search);e.set(`run`,o),e.delete(`node`),e.delete(`event`),e.set(`view`,t.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[t.runId,o,t.view]),(0,W.jsxs)(bd,{children:[(0,W.jsx)(Aq,{}),(0,W.jsxs)(`div`,{className:`app-shell`,children:[(0,W.jsx)($H,{groups:a,selectedRunId:o,liveRunIds:u,hasMore:i.hasMore,onLoadMore:i.loadMore,onSelect:t.selectRun}),(0,W.jsxs)(`main`,{className:`workspace`,children:[(0,W.jsxs)(`header`,{className:`topbar`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,W.jsx)(`h2`,{children:o??`No DAG selected`})]}),(0,W.jsxs)(`div`,{className:`topbar-actions`,children:[(0,W.jsxs)(`span`,{className:`connection`,children:[(0,W.jsx)(Wt,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,W.jsxs)(W.Fragment,{children:[`Last updated`,` `,(0,W.jsx)(aG,{at:i.lastUpdated,relative:!0})]})]}),i.activity.at(-1)!==void 0&&(0,W.jsxs)(`span`,{className:`connection`,"aria-live":`polite`,children:[i.activity.at(-1)?.node,`:`,` `,[i.activity.at(-1)?.name,i.activity.at(-1)?.detail].filter(Boolean).join(` `)||i.activity.at(-1)?.kind]}),(0,W.jsxs)(xa,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,W.jsx)(Bt,{size:14}),` Refresh`]})]})]}),i.error&&(0,W.jsxs)(Ji,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,W.jsx)(qt,{}),(0,W.jsx)(Yi,{children:`Live telemetry issue`}),(0,W.jsx)(Xi,{children:i.error.message})]}),(0,W.jsxs)(Au,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?t.showOverall():t.selectNode(void 0),value:t.view,children:[(0,W.jsxs)(`div`,{className:`view-tabs`,children:[(0,W.jsxs)(Mu,{"aria-label":`DAG views`,variant:`line`,children:[(0,W.jsxs)(Nu,{value:`graph`,children:[(0,W.jsx)(Yt,{size:15}),` Graph`]}),(0,W.jsxs)(Nu,{value:`overall`,children:[(0,W.jsx)(Ut,{size:15}),` Overall`]})]}),(0,W.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),Mq.map(([e,{label:n,description:r}])=>(0,W.jsx)(xa,{"aria-pressed":t.detail===e,onClick:()=>t.selectDetail(e),size:`sm`,title:r,type:`button`,variant:t.detail===e?`default`:`outline`,children:n},e))]})]}),(0,W.jsx)(Pu,{className:`min-h-0`,value:t.view,children:!s&&(i.loading||o!==void 0)?(0,W.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,W.jsx)(Ml,{className:`h-2 w-48`}),(0,W.jsx)(Ml,{className:`h-2 w-32`}),`Loading execution history…`]}):s&&o?t.view===`overall`?(0,W.jsx)(xq,{client:e,detail:s,nodes:c,timeline:i.timeline,timelineError:i.timelineError,onSelectNode:t.selectNode,onSelectItem:t.selectItem,selectedItemId:t.itemId}):l?(0,W.jsx)(ZK,{client:e,node:l,onBack:()=>t.selectNode(void 0),onSelectItem:t.selectItem,runId:o,selectedItemId:t.itemId,selectedTab:t.nodeTab,onSelectTab:t.selectNodeTab,timeline:i.timeline,timelineError:i.timelineError}):(0,W.jsx)(KH,{nodes:c,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,W.jsxs)(`div`,{className:`empty-state`,children:[(0,W.jsx)(Yt,{size:34}),(0,W.jsx)(`h2`,{children:`No DAG runs found`}),(0,W.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]})]})]})}var Pq=class extends U.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,W.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,W.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,W.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,W.jsx)(`p`,{children:this.state.error.message}),(0,W.jsx)(xa,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},Fq=document.getElementById(`root`);if(!Fq)throw Error(`DAG UI root element is missing`);(0,DD.createRoot)(Fq).render((0,W.jsx)(U.StrictMode,{children:(0,W.jsx)(Pq,{children:(0,W.jsx)(Nq,{})})}));