onepipeline-ui 0.7.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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`,...Y(t)})}function Gw(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Y(t)})}function Kw(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Y(t)})}function qw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Y(t)})}function Jw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Y(t)})}function Yw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Y(t)})}function Xw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Y(t)})}function Zw(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Y(t)})}function Qw(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Y(t)})}function $w(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Y(t)})}function eT(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Y(t)})}function tT(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Y(t)})}function nT(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Y(t)})}function rT(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Y(t)})}function iT(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Y(t)})}function aT(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Y(t)})}function oT(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Y(t)})}function sT(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Y(t)})}function cT(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Y(t)})}function lT(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Y(t)})}function uT(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Y(t)})}function dT(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Y(t)})}function fT(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Y(t)})}function pT(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Y(t)})}function mT(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Y(t)})}function hT(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Y(t)})}function gT(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Y(t)})}function _T(e,t){return new e({type:`number`,checks:[],...Y(t)})}function vT(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Y(t)})}function yT(e,t){return new e({type:`boolean`,...Y(t)})}function bT(e){return new e({type:`unknown`})}function xT(e,t){return new e({type:`never`,...Y(t)})}function ST(e,t){return new pC({check:`less_than`,...Y(t),value:e,inclusive:!1})}function CT(e,t){return new pC({check:`less_than`,...Y(t),value:e,inclusive:!0})}function wT(e,t){return new mC({check:`greater_than`,...Y(t),value:e,inclusive:!1})}function TT(e,t){return new mC({check:`greater_than`,...Y(t),value:e,inclusive:!0})}function ET(e,t){return new hC({check:`multiple_of`,...Y(t),value:e})}function DT(e,t){return new _C({check:`max_length`,...Y(t),maximum:e})}function OT(e,t){return new vC({check:`min_length`,...Y(t),minimum:e})}function kT(e,t){return new yC({check:`length_equals`,...Y(t),length:e})}function AT(e,t){return new xC({check:`string_format`,format:`regex`,...Y(t),pattern:e})}function jT(e){return new SC({check:`string_format`,format:`lowercase`,...Y(e)})}function MT(e){return new CC({check:`string_format`,format:`uppercase`,...Y(e)})}function NT(e,t){return new wC({check:`string_format`,format:`includes`,...Y(t),includes:e})}function PT(e,t){return new TC({check:`string_format`,format:`starts_with`,...Y(t),prefix:e})}function FT(e,t){return new EC({check:`string_format`,format:`ends_with`,...Y(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,...Y(n)})}function HT(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Y(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`,...Y(t)});return n._zod.check=e,n}var GT=J(`ZodISODateTime`,(e,t)=>{WC.init(e,t),gE.init(e,t)});function KT(e){return pT(GT,e)}var qT=J(`ZodISODate`,(e,t)=>{GC.init(e,t),gE.init(e,t)});function JT(e){return mT(qT,e)}var YT=J(`ZodISOTime`,(e,t)=>{KC.init(e,t),gE.init(e,t)});function XT(e){return hT(YT,e)}var ZT=J(`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}}})};J(`ZodError`,$T);var eE=J(`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=J(`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(wD(t,n)),e.superRefine=t=>e.check(TD(t)),e.overwrite=t=>e.check(IT(t)),e.optional=()=>cD(e),e.nullable=()=>uD(e),e.nullish=()=>cD(uD(e)),e.nonoptional=t=>gD(e,t),e.array=()=>Z(e),e.or=t=>XE([e,t]),e.and=t=>QE(e,t),e.transform=t=>bD(e,oD(t)),e.default=t=>fD(e,t),e.prefault=t=>mD(e,t),e.catch=t=>vD(e,t),e.pipe=t=>bD(e,t),e.readonly=()=>SD(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=J(`_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=J(`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 X(e){return Ww(hE,e)}var gE=J(`ZodStringFormat`,(e,t)=>{MC.init(e,t),mE.init(e,t)}),_E=J(`ZodEmail`,(e,t)=>{FC.init(e,t),gE.init(e,t)}),vE=J(`ZodGUID`,(e,t)=>{NC.init(e,t),gE.init(e,t)}),yE=J(`ZodUUID`,(e,t)=>{PC.init(e,t),gE.init(e,t)}),bE=J(`ZodURL`,(e,t)=>{IC.init(e,t),gE.init(e,t)}),xE=J(`ZodEmoji`,(e,t)=>{LC.init(e,t),gE.init(e,t)}),SE=J(`ZodNanoID`,(e,t)=>{RC.init(e,t),gE.init(e,t)}),CE=J(`ZodCUID`,(e,t)=>{zC.init(e,t),gE.init(e,t)}),wE=J(`ZodCUID2`,(e,t)=>{BC.init(e,t),gE.init(e,t)}),TE=J(`ZodULID`,(e,t)=>{VC.init(e,t),gE.init(e,t)}),EE=J(`ZodXID`,(e,t)=>{HC.init(e,t),gE.init(e,t)}),DE=J(`ZodKSUID`,(e,t)=>{UC.init(e,t),gE.init(e,t)}),OE=J(`ZodIPv4`,(e,t)=>{JC.init(e,t),gE.init(e,t)}),kE=J(`ZodIPv6`,(e,t)=>{YC.init(e,t),gE.init(e,t)}),AE=J(`ZodCIDRv4`,(e,t)=>{XC.init(e,t),gE.init(e,t)}),jE=J(`ZodCIDRv6`,(e,t)=>{ZC.init(e,t),gE.init(e,t)}),ME=J(`ZodBase64`,(e,t)=>{$C.init(e,t),gE.init(e,t)}),NE=J(`ZodBase64URL`,(e,t)=>{tw.init(e,t),gE.init(e,t)}),PE=J(`ZodE164`,(e,t)=>{nw.init(e,t),gE.init(e,t)}),FE=J(`ZodJWT`,(e,t)=>{iw.init(e,t),gE.init(e,t)}),IE=J(`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=J(`ZodNumberFormat`,(e,t)=>{ow.init(e,t),IE.init(e,t)});function zE(e){return vT(RE,e)}var BE=J(`ZodBoolean`,(e,t)=>{sw.init(e,t),pE.init(e,t)});function VE(e){return yT(BE,e)}var HE=J(`ZodUnknown`,(e,t)=>{cw.init(e,t),pE.init(e,t)});function UE(){return bT(HE)}var WE=J(`ZodNever`,(e,t)=>{lw.init(e,t),pE.init(e,t)});function GE(e){return xT(WE,e)}var KE=J(`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 Z(e,t){return VT(KE,e,t)}var qE=J(`ZodObject`,(e,t)=>{gw.init(e,t),pE.init(e,t),Hx(e,`shape`,()=>t.shape),e.keyof=()=>nD(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(sD,e,t[0]),e.required=(...t)=>cS(hD,e,t[0])});function JE(e,t){return new qE({type:`object`,shape:e??{},...Y(t)})}var YE=J(`ZodUnion`,(e,t)=>{vw.init(e,t),pE.init(e,t),e.options=t.options});function XE(e,t){return new YE({type:`union`,options:e,...Y(t)})}var ZE=J(`ZodIntersection`,(e,t)=>{yw.init(e,t),pE.init(e,t)});function QE(e,t){return new ZE({type:`intersection`,left:e,right:t})}var $E=J(`ZodRecord`,(e,t)=>{Sw.init(e,t),pE.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function eD(e,t,n){return new $E({type:`record`,keyType:e,valueType:t,...Y(n)})}var tD=J(`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 tD({...t,checks:[],...Y(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 tD({...t,checks:[],...Y(r),entries:i})}});function nD(e,t){return new tD({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y(t)})}var rD=J(`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 iD(e,t){return new rD({type:`literal`,values:Array.isArray(e)?e:[e],...Y(t)})}var aD=J(`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 oD(e){return new aD({type:`transform`,transform:e})}var sD=J(`ZodOptional`,(e,t)=>{Dw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cD(e){return new sD({type:`optional`,innerType:e})}var lD=J(`ZodNullable`,(e,t)=>{Ow.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uD(e){return new lD({type:`nullable`,innerType:e})}var dD=J(`ZodDefault`,(e,t)=>{kw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fD(e,t){return new dD({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var pD=J(`ZodPrefault`,(e,t)=>{jw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mD(e,t){return new pD({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var hD=J(`ZodNonOptional`,(e,t)=>{Mw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gD(e,t){return new hD({type:`nonoptional`,innerType:e,...Y(t)})}var _D=J(`ZodCatch`,(e,t)=>{Pw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vD(e,t){return new _D({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yD=J(`ZodPipe`,(e,t)=>{Fw.init(e,t),pE.init(e,t),e.in=t.in,e.out=t.out});function bD(e,t){return new yD({type:`pipe`,in:e,out:t})}var xD=J(`ZodReadonly`,(e,t)=>{Lw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function SD(e){return new xD({type:`readonly`,innerType:e})}var CD=J(`ZodCustom`,(e,t)=>{zw.init(e,t),pE.init(e,t)});function wD(e,t={}){return HT(CD,e,t)}function TD(e){return UT(e)}var ED=_(),DD=LE().finite().nonnegative(),OD=LE().int().nonnegative(),kD=KT({offset:!0}),AD=X().min(1).nullable(),Q=e=>JE(e).catchall(UE()),jD={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`},MD={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,select:`select`,node:`node`,scope:`scope`,filter:`filter`},ND={run:`run`,node:`node`},PD={planner:`planner`,monitor:`monitor`},FD=nD([`complete`,`partial`,`legacy`]),ID=nD([`native`,`labelled`,`inferred`]),LD=Q({agent_model_ms:VE(),judge_model_ms:VE(),llmlint_model_ms:VE(),tool_ms:VE()}),RD=DD.nullable(),zD=OD.nullable(),BD=Q({agent_seconds:RD,judge_seconds:RD,llmlint_seconds:RD,gate_seconds:RD,publication_wait_seconds:RD,lock_wait_seconds:RD,setup_seconds:RD,scheduling_seconds:RD,wall_seconds:RD,agent_model_ms:zD,judge_model_ms:zD,llmlint_model_ms:zD,tool_ms:zD,idle_orchestration_ms:zD,unattributed_ms:zD,wall_ms:zD,fractions:Q({agent_model:RD,judge_model:RD,llmlint_model:RD,tool:RD,idle_orchestration:RD,lock_wait:RD,setup:RD,scheduling:RD})}),VD=nD([`orchestrator`,`worker`,`judge`,`check-in`,`pr-author`]),HD=nD([`agent`,`judge`,`llmlint`]),UD=DD.nullable(),WD=Q({input_tokens:UD,output_tokens:UD,cache_read_tokens:UD,cache_write_tokens:UD,cost_usd:UD}),GD=Q({agent:WD,judge:WD,llmlint:WD,total:WD}),KD=Q({session_id:X().min(1),history_id:X().min(1).nullable().optional(),role:HD,agent_role:VD.optional(),turn_index:OD.nullable().optional(),started_at:kD.optional(),finished_at:kD.nullable().optional()}),qD=eD(X(),UE()),JD=nD([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),YD=nD([`agent`,`judge`,`llmlint`]),XD=nD([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),ZD=Q({side:YD.optional(),harness:X().optional(),variant:X().optional(),identity:X().optional(),cause:XD.optional(),raw_tail:X().optional(),reset_time:X().optional(),missing_session_id:X().optional(),wait_seconds:LE().nonnegative().optional(),failure_kind:X().optional(),structured_error:qD.optional(),judge_unrecorded:VE().optional()}).extend({class:JD,detail:X().optional()}),QD=Q({node:X().min(1),status:X().min(1),outcome:X().min(1).optional(),branch:X().min(1).optional(),comparison_remote:X().min(1).optional(),comparison_base:X().min(1).optional(),checkpoint:X().min(1).optional(),commit:X().min(1).optional(),retry_lineage:qD.optional(),gate_attestation:qD.optional(),failure:ZD.optional(),timing:BD.optional(),usage:GD.optional(),sessions:Z(KD),tool_commands:eD(X(),OD).optional(),turns:OD,lint:OD,timing_quality:FD,linkage_quality:ID,timing_presence:LD}),$D=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:AD,last_progress_at:DD.optional(),timing:BD,nodes:Z(QD),providers:Z(qD).optional(),failure:ZD.optional(),check_rollup:qD.optional(),usage:GD,timing_quality:FD,linkage_quality:ID,timing_presence:LD,sources:Z(X()),node_work_ms:Q({agent_model_ms:zD,judge_model_ms:zD,llmlint_model_ms:zD,tool_ms:zD,wall_ms:zD}),turns:OD,lint:OD}),eO=Q({schema_version:XE([X(),LE()]).optional(),observed_at:X().optional(),identities:Z(qD)}),tO=Q({launch_id:X().min(1),launcher:nD([`claude-code`,`codex`,`unknown`]),session_key:X().min(1).optional(),launcher_session_id:X().min(1).optional()}),nO=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:AD,last_progress_at:DD.optional(),timing_quality:FD,linkage_quality:ID,timing:BD,node_counts:eD(X(),OD),launch:tO.optional()}),rO=Q({path:X().min(1),reason:X().min(1)}),iO=Q({api_version:iD(2),telemetry_schema_version:iD(16),observed_at:kD,runs:Z(nO),next_cursor:X().min(1).optional(),unreadable:Z(rO).optional(),missing:Z(X().min(1)).optional(),provider_health:eO.optional()}),aO=Q({id:X().min(1),kind:nD([`agent`,`human`]).optional(),persona:X().min(1).optional(),task:X().min(1),deps:Z(X().min(1)).optional(),max_turns:OD.positive().optional(),expects_no_diff:VE().optional()}),oO=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X().min(1),checkpoint:X().min(1),completed_steps:Z(X()).optional(),pr:X().nullable().optional(),mode:nD([`pause`,`retry`,`continue`]).optional(),attempts:OD.optional()}),sO=Q({branch:X().min(1),repo:X().min(1).optional(),identity:X().min(1).optional(),base_branch:X().min(1).optional(),pr:X().min(1).optional(),pr_base:X().min(1).optional()}),cO=aO.extend({task:X().min(1).optional(),repo:X().min(1).optional(),steps:Z(aO).min(1).optional(),session:X().min(1).optional(),project_dir:X().min(1).optional(),base_branch:X().min(1).optional(),branch:X().min(1).optional(),title:X().min(1).optional(),verify_cmd:X().min(1).optional(),skip_verify:VE().optional(),verify_via_ci:VE().optional(),merge_policy:nD([`auto`,`direct`,`none`]).optional(),workflow:nD([`local`,`remote`]).optional(),repo_type:nD([`single-owner`,`team`]).optional(),execution_checkout:X().min(1).optional(),stack_bases:Z(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:X().optional(),worker_report:X().optional(),oneharness_session:X().optional()}),uO=Q({id:X().min(1),kind:X().min(1),persona:X().nullable(),status:X().min(1),telemetry:qD.optional(),artifacts:lO.optional()}),dO=Q({ref:X().min(1),task:X(),unblocks:Z(X()),unblocks_publication:VE()}),fO=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X(),checkpoint:X().min(1),completed_steps:Z(X()),pr:X().nullable(),mode:X().optional()}),pO=Q({identity:X().min(1),target:X().min(1),style:X().min(1).optional(),version:X().min(1)}),mO=Q({kind:X().optional(),status:X().optional(),task:X().optional(),unblocks:Z(X()).optional(),blocked_by:Z(X()).optional(),human_actions:Z(dO).optional(),completed:VE().optional(),exit_code:LE().int().nullable().optional(),verdicts:Z(UE()).optional(),usage:qD.optional(),telemetry:qD.optional(),repo:X().optional(),branch:X().optional(),commit:X().optional(),base_branch:X().optional(),pr_base:X().optional(),synthetic_stack_base:X().nullable().optional(),stack_bases:Z(qD).optional(),repository_type:nD([`single-owner`,`team`]).nullable().optional(),repo_type:nD([`single-owner`,`team`]).nullable().optional(),publication_workflow:nD([`local`,`remote`]).nullable().optional(),workflow:nD([`local`,`remote`]).nullable().optional(),merge_policy:nD([`auto`,`direct`,`none`]).nullable().optional(),outcome:X().optional(),ok:VE().optional(),pr:X().nullable().optional(),release:pO.nullable().optional(),detail:X().optional(),follow_ups:X().nullable().optional(),steps:Z(uO).optional(),waiting_steps:Z(X()).optional(),resume:fO.nullable().optional(),error:X().nullable().optional(),retry_lineage:qD.optional(),deferred_cleanup:Z(X()).optional(),artifacts:lO.optional()}),hO=Q({ok:VE().optional(),state:X().optional(),started_order:Z(X()).optional(),results:eD(X(),mO).optional(),schema_version:OD.optional()}),gO=nD([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),_O=nD([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),vO=Q({addressable:VE(),member:X().min(1).optional(),reason:X().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:X().min(1),kind:X(),unblocks:Z(X().min(1))}),bO=Q({run_id:X().min(1),plan:Q({tasks:Z(cO),schema_version:OD.optional(),concurrency:OD.positive().optional(),name:X().min(1).optional(),goal:Q({id:X().min(1),text:X().min(1)}).optional()}),node_states:eD(X(),gO),node_status:eD(X(),_O),node_gated_by:eD(X(),Z(X().min(1))),node_control:eD(X(),vO),node_results:eD(X(),mO),decisions:Z(yO),attestations:Z(X()),result:hO.nullable(),last_seq:OD}).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:UD.optional(),cacheWriteTokens:UD.optional(),costUsd:UD.optional(),inputTokens:UD.optional(),outputTokens:UD.optional()}),SO=Q({index:OD,input:UE().optional(),kind:X(),name:X().nullable().optional(),output:X().nullable().optional()}),CO=Q({judge:X(),kind:X(),decision:X(),reason:X()}),wO=Q({assistant:X().nullable(),durationMs:UD.optional(),failureKind:X().nullable(),finishedAt:kD.nullable().optional(),harness:X(),id:X(),judges:Z(CO).optional(),model:X().nullable(),modelMs:UD.optional(),reasoning:X().nullable(),startedAt:kD.nullable().optional(),status:X(),timestamp:kD,toolMs:UD.optional(),tools:Z(SO),unknown:qD,usage:xO,user:X()}),TO=Q({conversation:Q({canContinue:VE(),harnesses:Z(X()),id:X().min(1),name:X(),project:X(),startedAt:kD,state:X(),turns:Z(wO)}),attribution:Q({runId:X().optional(),nodeId:X().optional(),stepId:X().optional(),launchId:X().optional(),launcher:nD([`claude-code`,`codex`,`unknown`]).optional(),transportRole:HD,agentRole:VD,parentConversationId:X().optional(),persona:X().optional(),finishedAt:kD.nullable().optional(),inferred:iD(!0).optional(),timing:BD.optional()})}),EO=Q({node:X().optional(),conversations:Z(TO)}),DO=XE([Z(TO),Z(EO).transform(e=>e.flatMap(e=>e.conversations))]),OO=Q({name:X(),state:X(),required:VE(),url:X().url().optional()}),kO=Q({ok:VE(),output_tail:X(),artifact_id:X().min(1).optional()}),AO=Q({verification:Q({pre_push_hook:VE().optional(),required_checks:Z(X()).optional(),required_checks_status:X().optional(),expected_gate:Z(X()).optional(),checks:Z(OO).optional(),records:Z(kO)}),publication:Q({pr_url:X().url().optional(),branch:X().optional(),branch_url:X().url().optional(),merged:VE(),base_branch:X().optional(),commit:X().optional(),commit_url:X().url().optional()}).optional()}),jO=Q({api_version:iD(2),telemetry_schema_version:iD(16),observed_at:kD,run:$D,graph:bO.nullable(),conversations:DO,node_details:eD(X(),AO).optional().default({}),launch:tO.optional(),provider_health:eO.optional()}),MO=nD([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),NO=nD([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),PO=nD([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),FO=Q({kind:MO,value:X().min(1)}),IO=Q({delivered:VE(),delivery:nD([`live`,`deferred`]).optional(),reached:nD([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),member:X().min(1).optional(),input_bytes:OD.optional(),reason:X().min(1).optional(),node_id:X().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"})}),LO=Q({dep:X().min(1),identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),action:X().min(1).optional(),since:kD.optional(),waited_seconds:OD.optional(),last_answer:X().min(1).optional()}),RO=Q({identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),version:X().min(1).optional(),landing_commit:X().min(1).optional(),actor:X().min(1).optional(),superseded:VE().optional(),form:X().min(1).optional(),outcome:X().min(1).optional(),elapsed_ms:OD.optional(),dep:X().min(1).optional(),delivery:X().min(1).optional(),awaiting:Z(LO).min(1).optional(),versions:Z(Q({identity:X().min(1),target:X().min(1),version:X().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`})}),zO=Q({id:X().min(1),kind:X().min(1),at:kD,node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),author:X().min(1).optional(),redirection:IO.optional(),release:RO.optional(),reference:FO.optional()}),BO=Q({started_at:kD,ended_at:kD}),VO=Q({kind:X().min(1),blocking:Z(X().min(1)).min(1).optional(),ahead:Z(X().min(1)).min(1).optional(),limit:OD.optional(),reference:X().min(1).optional(),awaiting:Z(X().min(1)).min(1).optional()}),HO=Q({id:X().min(1),kind:NO,label:X(),started_at:kD,ended_at:kD.nullable(),events:Z(zO),parent_id:X().min(1).optional(),node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),count:OD.optional(),total_duration_ms:OD.optional(),intervals:Z(BO).optional(),agent_role:VD.optional(),transport_role:HD.optional(),dispatch_id:X().min(1).optional(),reference:FO.optional(),detail:Q({ok:VE().optional(),output_tail:X().optional(),artifact_id:X().optional()}).optional(),phase:PO.optional(),reasons:Z(VO).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),UO=Q({id:X().min(1),kind:MO,content:X(),truncated:VE()}),WO=Q({api_version:iD(2),timeline_schema_version:iD(8),observed_at:kD,run_id:X().min(1),spans:Z(HO)}),GO=Q({error:Q({code:X(),message:X()})});Q({schema_version:iD(1),launch_id:X().min(1),launcher:nD([`claude-code`,`codex`]),launcher_session_id:X().min(1),started_at:kD,repository_identity:X().min(1)});var KO=nD([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),qO=qD,JO=Z(JE({node:X().min(1),step:X().min(1).optional(),at:LE().finite(),kind:X(),name:X(),detail:X(),events:LE().int().nonnegative()})),YO=e=>iO.parse(e),XO=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},ZO=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=ZO){let r=this.#r(jD.runs);return r.searchParams.set(MD.includeSettled,String(e)),r.searchParams.set(MD.limit,String(n)),t!==void 0&&r.searchParams.set(MD.cursor,t),this.#i(r,iO.parse)}async selectRuns(e){if(e.length===0)throw new XO(`Invalid selection`);for(let t of e)if($O(t,`run ID`),t.includes(`,`))throw new XO(`Invalid run ID`);let t=this.#r(jD.runs);return t.searchParams.set(MD.select,e.join(`,`)),this.#i(t,iO.parse)}async getRun(e,t={}){$O(e,`run ID`);let n=this.#r(jD.run(e));return t.includeConversations!==void 0&&n.searchParams.set(MD.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(MD.filter,t.filter),this.#i(n,jO.parse)}async getTimeline(e,t,n){$O(e,`run ID`);let r=this.#r(jD.timeline(e));return n!==void 0&&r.searchParams.set(MD.filter,n),t===void 0?r.searchParams.set(MD.scope,ND.run):(r.searchParams.set(MD.scope,ND.node),r.searchParams.set(MD.node,t)),this.#i(r,WO.parse)}async getConversation(e,t){return $O(e,`run ID`),$O(t,`conversation ID`),this.#i(this.#r(jD.conversation(e,t)),TO.parse)}async getArtifact(e,t){return $O(e,`run ID`),$O(t,`artifact ID`),this.#i(this.#r(jD.artifact(e,t)),UO.parse)}subscribe(e){e.runId!==void 0&&$O(e.runId,`run ID`),e.after!==void 0&&$O(e.after,`cursor`);let t=this.#r(jD.events);e.runId!==void 0&&t.searchParams.set(MD.runId,e.runId),e.after!==void 0&&t.searchParams.set(MD.after,e.after),e.filter!==void 0&&t.searchParams.set(MD.filter,e.filter);let n=(this.#n??(e=>{if(typeof EventSource>`u`)throw new XO(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(t.toString());for(let t of KO.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?iO.parse(i):qO.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 XO(`Telemetry request failed`,void 0,void 0,{cause:e})}let r=await n.json().catch(e=>{throw new XO(`Telemetry server returned invalid JSON`,n.status,void 0,{cause:e})});if(!n.ok){let e=GO.safeParse(r);throw new XO(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 XO(`Telemetry response failed contract validation`,n.status,void 0,{cause:e})}}};function $O(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new XO(`Invalid ${t}`)}var ek=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})),tk=o(((e,t)=>{t.exports=`2.2.4`})),nk=o(((e,t)=>{t.exports={Graph:ek(),version:tk()}})),rk=o(((e,t)=>{var n=ek();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}})),ik=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}})),ak=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}}})),ok=o(((e,t)=>{var n=ak();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}})),sk=o(((e,t)=>{var n=ok();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),ck=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}})),lk=o(((e,t)=>{var n=ck();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])})}})),uk=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}})),dk=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})),fk=o(((e,t)=>{var n=dk();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),pk=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}})),mk=o(((e,t)=>{var n=pk();t.exports=r;function r(e,t){return n(e,t,`post`)}})),hk=o(((e,t)=>{var n=pk();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),gk=o(((e,t)=>{var n=ek(),r=ak();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}})),_k=o(((e,t)=>{t.exports={components:ik(),dijkstra:ok(),dijkstraAll:sk(),findCycles:lk(),floydWarshall:uk(),isAcyclic:fk(),postorder:mk(),preorder:hk(),prim:gk(),tarjan:ck(),topsort:dk()}})),vk=o(((e,t)=>{var n=nk();t.exports={Graph:n.Graph,json:rk(),alg:_k(),version:n.version}})),yk=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})),bk=o(((e,t)=>{var n=vk().Graph,r=yk();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}})),xk=o(((e,t)=>{var n=vk().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),{})}})),Sk=o(((e,t)=>{var n=bk(),r=xk().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)}})}})),Ck=o(((e,t)=>{var n=xk();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)})}})),wk=o(((e,t)=>{var{applyWithChunking:n}=xk();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}})),Tk=o(((e,t)=>{var n=vk().Graph,r=wk().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)}})),Ek=o(((e,t)=>{var n=Tk(),r=wk().slack,i=wk().longestPath,a=vk().alg.preorder,o=vk().alg.postorder,s=xk().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}})),Dk=o(((e,t)=>{var n=wk().longestPath,r=Tk(),i=Ek();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)}})),Ok=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}})),kk=o(((e,t)=>{var n=xk();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)})}})),Ak=o(((e,t)=>{var n=xk();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})}})),jk=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}})),Mk=o(((e,t)=>{var n=xk();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}})),Nk=o(((e,t)=>{var n=xk().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}})),Pk=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}})}})),Fk=o(((e,t)=>{var n=xk();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}})),Ik=o(((e,t)=>{var n=xk();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}})),Lk=o(((e,t)=>{var n=Pk(),r=Fk(),i=Ik();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)}})),Rk=o(((e,t)=>{var n=vk().Graph,r=xk();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}})),zk=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}})}})),Bk=o(((e,t)=>{var n=Mk(),r=Nk(),i=Lk(),a=Rk(),o=zk(),s=vk().Graph,c=xk();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))}})),Vk=o(((e,t)=>{var n=vk().Graph,r=xk();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}})),Hk=o(((e,t)=>{var n=xk(),r=Vk().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})}})),Uk=o(((e,t)=>{var n=Sk(),r=Ck(),i=Dk(),a=xk().normalizeRanks,o=Ok(),s=xk().removeEmptyRanks,c=kk(),l=Ak(),u=jk(),d=Bk(),f=Hk(),p=xk(),m=vk().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`,()=>I(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`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>ee(e)),t(` removeBorderNodes`,()=>F(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 F(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 I(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 L(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 ee(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}})),Wk=o(((e,t)=>{var n=xk(),r=vk().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}})),Gk=o(((e,t)=>{t.exports=`1.1.5`})),Kk=l(o(((e,t)=>{t.exports={graphlib:vk(),layout:Uk(),debug:Wk(),util:{time:xk().time,notime:xk().notime},version:Gk()}}))(),1),qk=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],Jk=200,Yk=72,Xk=80,Zk=32,Qk=new Set(qk),$k={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},eA=(e,t)=>e<t?-1:+(e>t);function tA(e){let t=[...e.nodes].sort((e,t)=>eA(e.id,t.id)),n=[...e.edges].sort((e,t)=>eA(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 Kk.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:Xk,nodesep:Zk,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:Jk,height:Yk});for(let e of n)u.setEdge(e.source,e.target,{},e.id);Kk.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)||eA(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:Jk,height:Yk,style:$k[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 nA(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=nA(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var rA={value:()=>{}};function iA(){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 aA(n)}function aA(e){this._=e}function oA(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}})}aA.prototype=iA.prototype={constructor:aA,on:function(e,t){var n=this._,r=oA(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=sA(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]=cA(n[i],e.name,t);else if(t==null)for(i in n)n[i]=cA(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 aA(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 sA(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function cA(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=rA,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var lA={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 uA(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),lA.hasOwnProperty(t)?{space:lA[t],local:e}:e}function dA(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 fA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pA(e){var t=uA(e);return(t.local?fA:dA)(t)}function mA(){}function hA(e){return e==null?mA:function(){return this.querySelector(e)}}function gA(e){typeof e!=`function`&&(e=hA(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 iM(r,this._parents)}function _A(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function vA(){return[]}function yA(e){return e==null?vA:function(){return this.querySelectorAll(e)}}function bA(e){return function(){return _A(e.apply(this,arguments))}}function xA(e){e=typeof e==`function`?bA(e):yA(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 iM(r,i)}function SA(e){return function(){return this.matches(e)}}function CA(e){return function(t){return t.matches(e)}}var wA=Array.prototype.find;function TA(e){return function(){return wA.call(this.children,e)}}function EA(){return this.firstElementChild}function DA(e){return this.select(e==null?EA:TA(typeof e==`function`?e:CA(e)))}var OA=Array.prototype.filter;function kA(){return Array.from(this.children)}function AA(e){return function(){return OA.call(this.children,e)}}function jA(e){return this.selectAll(e==null?kA:AA(typeof e==`function`?e:CA(e)))}function MA(e){typeof e!=`function`&&(e=SA(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 iM(r,this._parents)}function NA(e){return Array(e.length)}function PA(){return new iM(this._enter||this._groups.map(NA),this._parents)}function FA(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}FA.prototype={constructor:FA,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 IA(e){return function(){return e}}function LA(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 FA(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function RA(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 FA(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function zA(e){return e.__data__}function BA(e,t){if(!arguments.length)return Array.from(this,zA);var n=t?RA:LA,r=this._parents,i=this._groups;typeof e!=`function`&&(e=IA(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=VA(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 iM(o,r),o._enter=s,o._exit=c,o}function VA(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function HA(){return new iM(this._exit||this._groups.map(NA),this._parents)}function UA(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 WA(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 iM(s,this._parents)}function GA(){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 KA(e){e||=qA;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 iM(i,this._parents).order()}function qA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function JA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function YA(){return Array.from(this)}function XA(){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 ZA(){let e=0;for(let t of this)++e;return e}function QA(){return!this.node()}function $A(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 ej(e){return function(){this.removeAttribute(e)}}function tj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nj(e,t){return function(){this.setAttribute(e,t)}}function rj(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ij(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function aj(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 oj(e,t){var n=uA(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?tj:ej:typeof t==`function`?n.local?aj:ij:n.local?rj:nj)(n,t))}function sj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cj(e){return function(){this.style.removeProperty(e)}}function lj(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uj(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function dj(e,t,n){return arguments.length>1?this.each((t==null?cj:typeof t==`function`?uj:lj)(e,t,n??``)):fj(this.node(),e)}function fj(e,t){return e.style.getPropertyValue(t)||sj(e).getComputedStyle(e,null).getPropertyValue(t)}function pj(e){return function(){delete this[e]}}function mj(e,t){return function(){this[e]=t}}function hj(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function gj(e,t){return arguments.length>1?this.each((t==null?pj:typeof t==`function`?hj:mj)(e,t)):this.node()[e]}function _j(e){return e.trim().split(/^|\s+/)}function vj(e){return e.classList||new yj(e)}function yj(e){this._node=e,this._names=_j(e.getAttribute(`class`)||``)}yj.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 bj(e,t){for(var n=vj(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function xj(e,t){for(var n=vj(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Sj(e){return function(){bj(this,e)}}function Cj(e){return function(){xj(this,e)}}function wj(e,t){return function(){(t.apply(this,arguments)?bj:xj)(this,e)}}function Tj(e,t){var n=_j(e+``);if(arguments.length<2){for(var r=vj(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?wj:t?Sj:Cj)(n,t))}function Ej(){this.textContent=``}function Dj(e){return function(){this.textContent=e}}function Oj(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function kj(e){return arguments.length?this.each(e==null?Ej:(typeof e==`function`?Oj:Dj)(e)):this.node().textContent}function Aj(){this.innerHTML=``}function jj(e){return function(){this.innerHTML=e}}function Mj(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Nj(e){return arguments.length?this.each(e==null?Aj:(typeof e==`function`?Mj:jj)(e)):this.node().innerHTML}function Pj(){this.nextSibling&&this.parentNode.appendChild(this)}function Fj(){return this.each(Pj)}function Ij(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Lj(){return this.each(Ij)}function Rj(e){var t=typeof e==`function`?e:pA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zj(){return null}function Bj(e,t){var n=typeof e==`function`?e:pA(e),r=t==null?zj:typeof t==`function`?t:hA(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Vj(){var e=this.parentNode;e&&e.removeChild(this)}function Hj(){return this.each(Vj)}function Uj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Wj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gj(e){return this.select(e?Wj:Uj)}function Kj(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function qj(e){return function(t){e.call(this,t,this.__data__)}}function Jj(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 Yj(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 Xj(e,t,n){return function(){var r=this.__on,i,a=qj(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 Zj(e,t,n){var r=Jj(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?Xj:Yj,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function Qj(e,t,n){var r=sj(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 $j(e,t){return function(){return Qj(this,e,t)}}function eM(e,t){return function(){return Qj(this,e,t.apply(this,arguments))}}function tM(e,t){return this.each((typeof t==`function`?eM:$j)(e,t))}function*nM(){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 rM=[null];function iM(e,t){this._groups=e,this._parents=t}function aM(){return new iM([[document.documentElement]],rM)}function oM(){return this}iM.prototype=aM.prototype={constructor:iM,select:gA,selectAll:xA,selectChild:DA,selectChildren:jA,filter:MA,data:BA,enter:PA,exit:HA,join:UA,merge:WA,selection:oM,order:GA,sort:KA,call:JA,nodes:YA,node:XA,size:ZA,empty:QA,each:$A,attr:oj,style:dj,property:gj,classed:Tj,text:kj,html:Nj,raise:Fj,lower:Lj,append:Rj,insert:Bj,remove:Hj,clone:Gj,datum:Kj,on:Zj,dispatch:tM,[Symbol.iterator]:nM};function sM(e){return typeof e==`string`?new iM([[document.querySelector(e)]],[document.documentElement]):new iM([[e]],rM)}function cM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function lM(e,t){if(e=cM(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 uM={passive:!1},dM={capture:!0,passive:!1};function fM(e){e.stopImmediatePropagation()}function pM(e){e.preventDefault(),e.stopImmediatePropagation()}function mM(e){var t=e.document.documentElement,n=sM(e).on(`dragstart.drag`,pM,dM);`onselectstart`in t?n.on(`selectstart.drag`,pM,dM):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function hM(e,t){var n=e.document.documentElement,r=sM(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,pM,dM),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 gM=e=>()=>e;function _M(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}})}_M.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function vM(e){return!e.ctrlKey&&!e.button}function yM(){return this.parentNode}function bM(e,t){return t??{x:e.x,y:e.y}}function xM(){return navigator.maxTouchPoints||`ontouchstart`in this}function SM(){var e=vM,t=yM,n=bM,r=xM,i={},a=iA(`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`,_,uM).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&&(sM(n.view).on(`mousemove.drag`,m,dM).on(`mouseup.drag`,h,dM),mM(n.view),fM(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(pM(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){sM(e.view).on(`mousemove.drag mouseup.drag`,null),hM(e.view,l),pM(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]))&&(fM(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])&&(pM(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])&&(fM(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=lM(l||r,t),p,m,h;if((h=n.call(e,new _M(`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=lM(l||a,t),_=o;break}u.call(r,e,new _M(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:gM(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:gM(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:gM(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:gM(!!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 CM(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function TM(){}var EM=.7,DM=1/EM,OM=`\\s*([+-]?\\d+)\\s*`,kM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,AM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,jM=/^#([0-9a-f]{3,8})$/,MM=RegExp(`^rgb\\(${OM},${OM},${OM}\\)$`),NM=RegExp(`^rgb\\(${AM},${AM},${AM}\\)$`),PM=RegExp(`^rgba\\(${OM},${OM},${OM},${kM}\\)$`),FM=RegExp(`^rgba\\(${AM},${AM},${AM},${kM}\\)$`),IM=RegExp(`^hsl\\(${kM},${AM},${AM}\\)$`),LM=RegExp(`^hsla\\(${kM},${AM},${AM},${kM}\\)$`),RM={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};CM(TM,UM,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zM,formatHex:zM,formatHex8:BM,formatHsl:VM,formatRgb:HM,toString:HM});function zM(){return this.rgb().formatHex()}function BM(){return this.rgb().formatHex8()}function VM(){return nN(this).formatHsl()}function HM(){return this.rgb().formatRgb()}function UM(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=jM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?WM(t):n===3?new JM(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?GM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?GM(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=MM.exec(e))?new JM(t[1],t[2],t[3],1):(t=NM.exec(e))?new JM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PM.exec(e))?GM(t[1],t[2],t[3],t[4]):(t=FM.exec(e))?GM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=IM.exec(e))?tN(t[1],t[2]/100,t[3]/100,1):(t=LM.exec(e))?tN(t[1],t[2]/100,t[3]/100,t[4]):RM.hasOwnProperty(e)?WM(RM[e]):e===`transparent`?new JM(NaN,NaN,NaN,0):null}function WM(e){return new JM(e>>16&255,e>>8&255,e&255,1)}function GM(e,t,n,r){return r<=0&&(e=t=n=NaN),new JM(e,t,n,r)}function KM(e){return e instanceof TM||(e=UM(e)),e?(e=e.rgb(),new JM(e.r,e.g,e.b,e.opacity)):new JM}function qM(e,t,n,r){return arguments.length===1?KM(e):new JM(e,t,n,r??1)}function JM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}CM(JM,qM,wM(TM,{brighter(e){return e=e==null?DM:DM**+e,new JM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?EM:EM**+e,new JM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new JM($M(this.r),$M(this.g),$M(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:YM,formatHex:YM,formatHex8:XM,formatRgb:ZM,toString:ZM}));function YM(){return`#${eN(this.r)}${eN(this.g)}${eN(this.b)}`}function XM(){return`#${eN(this.r)}${eN(this.g)}${eN(this.b)}${eN((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZM(){let e=QM(this.opacity);return`${e===1?`rgb(`:`rgba(`}${$M(this.r)}, ${$M(this.g)}, ${$M(this.b)}${e===1?`)`:`, ${e})`}`}function QM(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $M(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function eN(e){return e=$M(e),(e<16?`0`:``)+e.toString(16)}function tN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new iN(e,t,n,r)}function nN(e){if(e instanceof iN)return new iN(e.h,e.s,e.l,e.opacity);if(e instanceof TM||(e=UM(e)),!e)return new iN;if(e instanceof iN)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 iN(o,s,c,e.opacity)}function rN(e,t,n,r){return arguments.length===1?nN(e):new iN(e,t,n,r??1)}function iN(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}CM(iN,rN,wM(TM,{brighter(e){return e=e==null?DM:DM**+e,new iN(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?EM:EM**+e,new iN(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 JM(sN(e>=240?e-240:e+120,i,r),sN(e,i,r),sN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new iN(aN(this.h),oN(this.s),oN(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(`}${aN(this.h)}, ${oN(this.s)*100}%, ${oN(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function aN(e){return e=(e||0)%360,e<0?e+360:e}function oN(e){return Math.max(0,Math.min(1,e||0))}function sN(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 cN=e=>()=>e;function lN(e,t){return function(n){return e+n*t}}function uN(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function dN(e){return(e=+e)==1?fN:function(t,n){return n-t?uN(t,n,e):cN(isNaN(t)?n:t)}}function fN(e,t){var n=t-e;return n?lN(e,n):cN(isNaN(e)?t:e)}var pN=(function e(t){var n=dN(t);function r(e,t){var r=n((e=qM(e)).r,(t=qM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=fN(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 mN(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 hN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gN(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]=TN(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 _N(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function vN(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yN(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]=TN(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var bN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xN=new RegExp(bN.source,`g`);function SN(e){return function(){return e}}function CN(e){return function(t){return e(t)+``}}function wN(e,t){var n=bN.lastIndex=xN.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=bN.exec(e))&&(i=xN.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:vN(r,i)})),n=xN.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?CN(c[0].x):SN(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 TN(e,t){var n=typeof t,r;return t==null||n===`boolean`?cN(t):(n===`number`?vN:n===`string`?(r=UM(t))?(t=r,pN):wN:t instanceof UM?pN:t instanceof Date?_N:hN(t)?mN:Array.isArray(t)?gN:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?yN:vN)(e,t)}var EN=180/Math.PI,DN={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ON(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)*EN,skewX:Math.atan(c)*EN,scaleX:o,scaleY:s}}var kN;function AN(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?DN:ON(t.a,t.b,t.c,t.d,t.e,t.f)}function jN(e){return e==null||(kN||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),kN.setAttribute(`transform`,e),!(e=kN.transform.baseVal.consolidate()))?DN:(e=e.matrix,ON(e.a,e.b,e.c,e.d,e.e,e.f))}function MN(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:vN(e,i)},{i:c-2,x:vN(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:vN(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:vN(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:vN(e,n)},{i:s-2,x:vN(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 NN=MN(AN,`px, `,`px)`,`deg)`),PN=MN(jN,`, `,`)`,`)`),FN=1e-12;function IN(e){return((e=Math.exp(e))+1/e)/2}function LN(e){return((e=Math.exp(e))-1/e)/2}function RN(e){return((e=Math.exp(2*e))-1)/(e+1)}var zN=(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<FN)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=IN(y),c=s/(n*g)*(i*RN(t*r+y)-LN(y));return[a+c*d,o+c*f,s*i/IN(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),BN=0,VN=0,HN=0,UN=1e3,WN,GN,KN=0,qN=0,JN=0,YN=typeof performance==`object`&&performance.now?performance:Date,XN=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ZN(){return qN||=(XN(QN),YN.now()+JN)}function QN(){qN=0}function $N(){this._call=this._time=this._next=null}$N.prototype=eP.prototype={constructor:$N,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?ZN():+n)+(t==null?0:+t),!this._next&&GN!==this&&(GN?GN._next=this:WN=this,GN=this),this._call=e,this._time=n,aP()},stop:function(){this._call&&(this._call=null,this._time=1/0,aP())}};function eP(e,t,n){var r=new $N;return r.restart(e,t,n),r}function tP(){ZN(),++BN;for(var e=WN,t;e;)(t=qN-e._time)>=0&&e._call.call(void 0,t),e=e._next;--BN}function nP(){qN=(KN=YN.now())+JN,BN=VN=0;try{tP()}finally{BN=0,iP(),qN=0}}function rP(){var e=YN.now(),t=e-KN;t>UN&&(JN-=t,KN=e)}function iP(){for(var e,t=WN,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:WN=n);GN=e,aP(r)}function aP(e){BN||(VN&&=clearTimeout(VN),e-qN>24?(e<1/0&&(VN=setTimeout(nP,e-YN.now()-JN)),HN&&=clearInterval(HN)):(HN||=(KN=YN.now(),setInterval(rP,UN)),BN=1,XN(nP)))}function oP(e,t,n){var r=new $N;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var sP=iA(`start`,`end`,`cancel`,`interrupt`),cP=[];function lP(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;pP(e,n,{name:t,index:r,group:i,on:sP,tween:cP,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function uP(e,t){var n=fP(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function dP(e,t){var n=fP(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function fP(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function pP(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=eP(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 oP(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(oP(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 mP(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 hP(e){return this.each(function(){mP(this,e)})}function gP(e,t){var n,r;return function(){var i=dP(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 _P(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=dP(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 vP(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=fP(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?gP:_P)(n,e,t))}function yP(e,t,n){var r=e._id;return e.each(function(){var e=dP(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return fP(e,r).value[t]}}function bP(e,t){var n;return(typeof t==`number`?vN:t instanceof UM?pN:(n=UM(t))?(t=n,pN):wN)(e,t)}function xP(e){return function(){this.removeAttribute(e)}}function SP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function CP(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 wP(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 TP(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 EP(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 DP(e,t){var n=uA(e),r=n===`transform`?PN:bP;return this.attrTween(e,typeof t==`function`?(n.local?EP:TP)(n,r,yP(this,`attr.`+e,t)):t==null?(n.local?SP:xP)(n):(n.local?wP:CP)(n,r,t))}function OP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function kP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function AP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&kP(e,i)),n}return i._value=t,i}function jP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&OP(e,i)),n}return i._value=t,i}function MP(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=uA(e);return this.tween(n,(r.local?AP:jP)(r,t))}function NP(e,t){return function(){uP(this,e).delay=+t.apply(this,arguments)}}function PP(e,t){return t=+t,function(){uP(this,e).delay=t}}function FP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?NP:PP)(t,e)):fP(this.node(),t).delay}function IP(e,t){return function(){dP(this,e).duration=+t.apply(this,arguments)}}function LP(e,t){return t=+t,function(){dP(this,e).duration=t}}function RP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?IP:LP)(t,e)):fP(this.node(),t).duration}function zP(e,t){if(typeof t!=`function`)throw Error();return function(){dP(this,e).ease=t}}function BP(e){var t=this._id;return arguments.length?this.each(zP(t,e)):fP(this.node(),t).ease}function VP(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();dP(this,e).ease=n}}function HP(e){if(typeof e!=`function`)throw Error();return this.each(VP(this._id,e))}function UP(e){typeof e!=`function`&&(e=SA(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 vF(r,this._parents,this._name,this._id)}function WP(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 vF(o,this._parents,this._name,this._id)}function GP(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 KP(e,t,n){var r,i,a=GP(t)?uP:dP;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function qP(e,t){var n=this._id;return arguments.length<2?fP(this.node(),n).on.on(e):this.each(KP(n,e,t))}function JP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function YP(){return this.on(`end.remove`,JP(this._id))}function XP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=hA(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,lP(l[f],t,n,f,l,fP(u,n)));return new vF(a,this._parents,t,n)}function ZP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=yA(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=fP(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&lP(p,t,n,h,f,m);a.push(f),o.push(u)}return new vF(a,o,t,n)}var QP=aM.prototype.constructor;function $P(){return new QP(this._groups,this._parents)}function eF(e,t){var n,r,i;return function(){var a=fj(this,e),o=(this.style.removeProperty(e),fj(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function tF(e){return function(){this.style.removeProperty(e)}}function nF(e,t,n){var r,i=n+``,a;return function(){var o=fj(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function rF(e,t,n){var r,i,a;return function(){var o=fj(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),fj(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function iF(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=dP(this,e),l=c.on,u=c.value[a]==null?s||=tF(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function aF(e,t,n){var r=(e+=``)==`transform`?NN:bP;return t==null?this.styleTween(e,eF(e,r)).on(`end.style.`+e,tF(e)):typeof t==`function`?this.styleTween(e,rF(e,r,yP(this,`style.`+e,t))).each(iF(this._id,e)):this.styleTween(e,nF(e,r,t),n).on(`end.style.`+e,null)}function oF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function sF(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&oF(e,a,n)),r}return a._value=t,a}function cF(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,sF(e,t,n??``))}function lF(e){return function(){this.textContent=e}}function uF(e){return function(){var t=e(this);this.textContent=t??``}}function dF(e){return this.tween(`text`,typeof e==`function`?uF(yP(this,`text`,e)):lF(e==null?``:e+``))}function fF(e){return function(t){this.textContent=e.call(this,t)}}function pF(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&fF(r)),t}return r._value=e,r}function mF(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,pF(e))}function hF(){for(var e=this._name,t=this._id,n=bF(),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=fP(c,t);lP(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new vF(r,this._parents,e,n)}function gF(){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=dP(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 _F=0;function vF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function yF(e){return aM().transition(e)}function bF(){return++_F}var xF=aM.prototype;vF.prototype=yF.prototype={constructor:vF,select:XP,selectAll:ZP,selectChild:xF.selectChild,selectChildren:xF.selectChildren,filter:UP,merge:WP,selection:$P,transition:hF,call:xF.call,nodes:xF.nodes,node:xF.node,size:xF.size,empty:xF.empty,each:xF.each,on:qP,attr:DP,attrTween:MP,style:aF,styleTween:cF,text:dF,textTween:mF,remove:YP,tween:vP,delay:FP,duration:RP,ease:BP,easeVarying:HP,end:gF,[Symbol.iterator]:xF[Symbol.iterator]};function SF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var CF={time:null,delay:0,duration:250,ease:SF};function wF(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function TF(e){var t,n;e instanceof vF?(t=e._id,e=e._name):(t=bF(),(n=CF).time=ZN(),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])&&lP(c,e,t,l,o,n||wF(c,t));return new vF(r,this._parents,e,t)}aM.prototype.interrupt=hP,aM.prototype.transition=TF;var EF=e=>()=>e;function DF(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 OF(e,t,n){this.k=e,this.x=t,this.y=n}OF.prototype={constructor:OF,scale:function(e){return e===1?this:new OF(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new OF(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 kF=new OF(1,0,0);AF.prototype=OF.prototype;function AF(e){for(;!e.__zoom;)if(!(e=e.parentNode))return kF;return e.__zoom}function jF(e){e.stopImmediatePropagation()}function MF(e){e.preventDefault(),e.stopImmediatePropagation()}function NF(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function PF(){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 FF(){return this.__zoom||kF}function IF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function LF(){return navigator.maxTouchPoints||`ontouchstart`in this}function RF(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 zF(){var e=NF,t=PF,n=RF,r=IF,i=LF,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=zN,l=iA(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,FF).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`,FF),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(kF.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 OF(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 OF(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 OF(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=sM(this.that).datum();l.call(e,this.that,new DF(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=lM(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)],mP(this),s.start();MF(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=sM(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=lM(t,i),l=t.clientX,u=t.clientY;mM(t.view),jF(t),a.mouse=[c,this.__zoom.invert(c)],mP(this),a.start();function d(e){if(MF(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]=lM(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),hM(e.view,a.moved),MF(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=lM(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);MF(r),s>0?sM(this).transition().duration(s).call(x,d,c,r):sM(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(jF(t),s=0;s<i;++s)c=r[s],l=lM(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)),mP(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(MF(e),s=0;s<a;++s)c=i[s],l=lM(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(jF(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=lM(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=sM(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:EF(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:EF(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:EF(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:EF([[+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 BF={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.`},VF=[[-1/0,-1/0],[1/0,1/0]],HF=[`Enter`,` `,`Escape`],UF={"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`},WF;(function(e){e.Strict=`strict`,e.Loose=`loose`})(WF||={});var GF;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(GF||={});var KF;(function(e){e.Partial=`partial`,e.Full=`full`})(KF||={});var qF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},JF;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(JF||={});var YF;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(YF||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var XF={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function ZF(e){return e===null?null:e?`valid`:`invalid`}var QF=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,$F=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),eI=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),tI=(e,t=[0,0])=>{let{width:n,height:r}=FI(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},nI=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:_I(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):eI(n)?n:t.nodeLookup.get(n.id)),hI(e,i?yI(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),rI=(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=hI(n,yI(e)),r=!0)}),r?_I(n):{x:0,y:0,width:0,height:0}},iI=(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=xI(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},aI=(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 oI(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}=FI(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 sI({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=MI(rI(oI(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 cI({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`,BF.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&PI(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=PI(d)?dI(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,BF.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 lI({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=aI(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 uI=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),dI=(e={x:0,y:0},t,n)=>({x:uI(e.x,t[0][0],t[1][0]-(n?.width??0)),y:uI(e.y,t[0][1],t[1][1]-(n?.height??0))});function fI(e,t,n){let{width:r,height:i}=FI(n),{x:a,y:o}=n.internals.positionAbsolute;return dI(e,[[a,o],[a+r,o+i]],t)}var pI=(e,t,n)=>e<t?uI(Math.abs(e-t),1,t)/t:e>n?-uI(Math.abs(e-n),1,t)/t:0,mI=(e,t,n=15,r=40)=>[pI(e.x,r,t.width-r)*n,pI(e.y,r,t.height-r)*n],hI=(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)}),gI=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),_I=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),vI=(e,t=[0,0])=>{let{x:n,y:r}=eI(e)?e.internals.positionAbsolute:tI(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}},yI=(e,t=[0,0])=>{let{x:n,y:r}=eI(e)?e.internals.positionAbsolute:tI(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)}},bI=(e,t)=>_I(hI(gI(e),gI(t))),xI=(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)},SI=(e,t)=>xI(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),CI=e=>wI(e.width)&&wI(e.height)&&wI(e.x)&&wI(e.y),wI=e=>!isNaN(e)&&isFinite(e),TI=(e,t)=>(e,t)=>{},EI=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),DI=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?EI(s,o):s},OI=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function kI(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 AI(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=kI(e,n),i=kI(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=kI(e.top??e.y??0,n),i=kI(e.bottom??e.y??0,n),a=kI(e.left??e.x??0,t),o=kI(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 jI(e,t,n,r,i,a){let{x:o,y:s}=OI(e,[t,n,r]),{x:c,y:l}=OI({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 MI=(e,t,n,r,i,a)=>{let o=AI(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=uI(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=jI(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}},NI=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function PI(e){return e!=null&&e!==`parent`}function FI(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function II(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function LI(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 RI(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function zI(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function BI(e){return{...UF,...e||{}}}function VI(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=qI(e),s=DI({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?EI(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var HI=e=>({width:e.offsetWidth,height:e.offsetHeight}),UI=e=>e?.getRootNode?.()||window?.document,WI=[`INPUT`,`SELECT`,`TEXTAREA`];function GI(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?WI.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var KI=e=>`clientX`in e,qI=(e,t)=>{let n=KI(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)}},JI=(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,...HI(t)}})};function YI({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 XI(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ZI({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-XI(t-r,a),n];case $.Right:return[t+XI(r-t,a),n];case $.Top:return[t,n-XI(n-i,a)];case $.Bottom:return[t,n+XI(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]=ZI({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=ZI({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=YI({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 $I({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 eL({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 tL({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=hI(yI(e),yI(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),SI({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},_I(a))>0}var nL=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,rL=(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)),iL=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,BF.error006()),t;let r=n.getEdgeId||nL,i;return i=QF(e)?{...e}:{...e,id:r(e)},rL(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function aL({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=$I({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var oL={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},sL=({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},cL=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function lL({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=oL[t],c=oL[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=sL({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]=$I({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 uL(e,t,n,r){let i=Math.min(cL(e,t)/2,cL(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 dL({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]=lL({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+=uL(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 fL(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pL(e){let{sourceNode:t,targetNode:n}=e;if(!fL(t)||!fL(n))return null;let r=t.internals.handleBounds||mL(t.handles),i=n.internals.handleBounds||mL(n.handles),a=gL(r?.source??[],e.sourceHandle),o=gL(e.connectionMode===WF.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,BF.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=hL(t,a,s),u=hL(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function mL(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 hL(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??FI(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 gL(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function _L(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function vL(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=_L(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 yL=1e3,bL=10,xL={nodeOrigin:[0,0],nodeExtent:VF,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},SL={...xL,checkEquality:!0};function CL(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function wL(e,t,n){let r=CL(xL,n);for(let n of e.values())if(n.parentId)kL(n,e,t,r);else{let e=dI(tI(n,r.nodeOrigin),PI(n.extent)?n.extent:r.nodeExtent,FI(n));n.internals.positionAbsolute=e}}function TL(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 EL(e){return e===`manual`}function DL(e,t,n,r={}){let i=CL(SL,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!EL(i.zIndexMode)?yL: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=dI(tI(u,i.nodeOrigin),PI(u.extent)?u.extent:i.nodeExtent,FI(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:TL(u,e),z:AL(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&&kL(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function OL(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 kL(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=CL(xL,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}OL(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*bL),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=jL(e,u,o,s,a&&!EL(c)?yL: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 AL(e,t,n){let r=wI(e.zIndex)?e.zIndex:0;return EL(n)?r:r+(e.selected?t:0)}function jL(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=FI(e),l=tI(e,n),u=PI(e.extent)?dI(l,e.extent,c):l,d=dI({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=fI(d,c,t));let f=AL(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function ML(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=bI(a.get(n.parentId)?.expandedRect??vI(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=FI(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 NL(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=HI(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=PI(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=fI(h,s,n))}else m&&(h=dI(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:JI(`source`,r.nodeElement,p,d,e.id),target:JI(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&kL(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:vI(g,i)}))}}if(f.length>0){let e=ML(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function PL({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 FL(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 IL(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}`;FL(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),FL(`target`,s,c,e,i,o),t.set(r.id,r)}}function LL(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:LL(n,t):!1}function RL(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 zL(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!LL(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 BL({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 VL({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=EI(a,t);return{x:o.x-a.x,y:o.y-a.y}}function HL({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=sM(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?gI(rI(s)):null,x=v&&l?VL({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)}:EI(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}=cI({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]=BL({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]=mI(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=VI(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=zL(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=BL({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=SM().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=VI(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=qI(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=VI(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=qI(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=qI(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]=BL({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||!RL(t,`.${g}`,v))&&(!_||RL(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function UL(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())SI(i,vI(e))>0&&r.push(e);return r}var WL=250;function GL(e,t,n,r){let i=[],a=1/0,o=UL(e,n,t+WL);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}=hL(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 KL(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,...hL(o,c,c.position,!0)}:c}function qL(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function JL(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var YL=()=>!0;function XL(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:_=YL,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=UI(e.target),E=0,D,{x:O,y:k}=qI(e),A=qL(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=KL(i,A,r,c,t);if(!N)return;let P=qI(e,j),F=!1,I=null,L=!1,ee=null;function te(){if(!u||!j)return;let[e,t]=mI(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:hL(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:XF[ne.position],toNode:null,pointer:P};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=qI(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();P=qI(e,j),D=GL(DI(P,a,!1,[1,1]),n,c,ne),F||=(te(),!0);let s=ZL(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ee=s.handleDomNode,I=s.connection,L=JL(!!D,s.isValid);let u=c.get(i),f=u?hL(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:L,to:s.toHandle&&L?OI({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:XF[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ee)&&I&&L&&h?.(I);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,ee=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function ZL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=YL,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}=qI(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=qL(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===WF.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=KL(t,e,a,u,n,!0)}return _}var QL={onPointerDown:XL,isValid:ZL};function $L({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=sM(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&&NI()?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=zF().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:lM}}var eR=e=>({x:e.x,y:e.y,zoom:e.k}),tR=({x:e,y:t,zoom:n})=>kF.translate(e,t).scale(n),nR=(e,t)=>e.target.closest(`.${t}`),rR=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),iR=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,aR=(e,t=0,n=iR,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},oR=e=>{let t=e.ctrlKey&&NI()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function sR({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(nR(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=lM(u),t=d*2**oR(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===GF.Vertical?0:u.deltaX*f,m=i===GF.Horizontal?0:u.deltaY*f;!NI()&&u.shiftKey&&i!==GF.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=eR(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 cR({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=nR(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function lR({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=eR(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 uR({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&rR(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,eR(a.transform))}}function dR({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&rR(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=eR(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function fR({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`&&(nR(d,`${l}-flow__node`)||nR(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||nR(d,s)&&m||nR(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 pR({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=zF().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=sM(e).call(f);y({x:i.x,y:i.y,zoom:uI(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(oR);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?TN:zN).transform(aR(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:!wI(E)||E<0?0:E);let k=O?sR({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):cR({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=lR({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=uR({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=dR({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=fR({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=tR(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=tR(e);return await g(n,t),n}function x(e){if(p){let t=tR(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?AF(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`?TN:zN).scaleTo(aR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?TN:zN).scaleBy(aR(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=!wI(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 mR;(function(e){e.Line=`line`,e.Handle=`handle`})(mR||={});function hR({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 gR(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 _R(e,t){return Math.max(0,t-e)}function vR(e,t){return Math.max(0,e-t)}function yR(e,t,n){return Math.max(0,t-e,e-n)}function bR(e,t){return e?!t:t}function xR(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=yR(E,h,g),j=yR(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_R(y+w+O,o[0][0]):!c&&w>0&&(e=vR(y+E+O,o[1][0])),l&&T<0?t=_R(b+T+k,o[0][1]):!l&&T>0&&(t=vR(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=vR(y+w,s[0][0]):!c&&w<0&&(e=_R(y+E,s[1][0])),l&&T>0?t=vR(b+T,s[0][1]):!l&&T<0&&(t=_R(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=yR(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?vR(b+k+E/C,o[1][1])*C:_R(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?_R(b+E/C,s[1][1])*C:vR(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=yR(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?vR(y+D*C+O,o[1][0])/C:_R(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?_R(y+D*C,s[1][0])/C:vR(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=(bR(c,l)?-w:w)/C:w=(bR(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 SR={width:0,height:0,x:0,y:0},CR={...SR,pointerX:0,pointerY:0,aspectRatio:1};function wR(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 TR({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=sM(e),o={controlDirection:gR(`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={...SR},h={...CR};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:gR(e)};let g,_=null,v=[],y,b,x,S=!1,C=SM().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}=VI(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=PI(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=wR(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=VI(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}=xR(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 F=hR({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),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 ER=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})),DR=o(((e,t)=>{t.exports=ER()})),OR=o((e=>{var t=d(),n=DR();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}})),kR=l(o(((e,t)=>{t.exports=OR()}))(),1),AR=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},jR=e=>e?AR(e):AR,{useDebugValue:MR}=U.default,{useSyncExternalStoreWithSelector:NR}=kR.default,PR=e=>e;function FR(e,t=PR,n){let r=NR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return MR(r),r}var IR=(e,t)=>{let n=jR(e),r=(e,r=t)=>FR(n,e,r);return Object.assign(r,n),r},LR=(e,t)=>e?IR(e,t):IR;function RR(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 zR=(0,U.createContext)(null),BR=zR.Provider,VR=BF.error001(`react`);function HR(e,t){let n=(0,U.useContext)(zR);if(n===null)throw Error(VR);return FR(n,e,t)}function UR(){let e=(0,U.useContext)(zR);if(e===null)throw Error(VR);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var WR={display:`none`},GR={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},KR=`react-flow__node-desc`,qR=`react-flow__edge-desc`,JR=`react-flow__aria-live`,YR=e=>e.ariaLiveMessage,XR=e=>e.ariaLabelConfig;function ZR({rfId:e}){let t=HR(YR);return(0,W.jsx)(`div`,{id:`${JR}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:GR,children:t})}function QR({rfId:e,disableKeyboardA11y:t}){let n=HR(XR);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{id:`${KR}-${e}`,style:WR,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,W.jsx)(`div`,{id:`${qR}-${e}`,style:WR,children:n[`edge.a11yDescription.default`]}),!t&&(0,W.jsx)(ZR,{rfId:e})]})}var $R=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,W.jsx)(`div`,{className:nA([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));$R.displayName=`Panel`;var ez=`https://reactflow.dev?utm_source=attribution`;function tz({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,W.jsx)($R,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ez}`,children:(0,W.jsx)(`a`,{href:ez,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var nz=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}},rz=e=>e.id;function iz(e,t){return RR(e.selectedNodes.map(rz),t.selectedNodes.map(rz))&&RR(e.selectedEdges.map(rz),t.selectedEdges.map(rz))}function az({onSelectionChange:e}){let t=UR(),{selectedNodes:n,selectedEdges:r}=HR(nz,iz);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var oz=e=>!!e.onSelectionChangeHandlers;function sz({onSelectionChange:e}){let t=HR(oz);return e||t?(0,W.jsx)(az,{onSelectionChange:e}):null}var cz=[0,0],lz={x:0,y:0,zoom:1},uz=[...`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`],dz=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}),fz={translateExtent:VF,nodeOrigin:cz,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function pz(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=HR(dz,RR),l=UR();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=fz,s()}),[]);let u=(0,U.useRef)(fz);return(0,U.useEffect)(()=>{for(let s of uz){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:BI(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},uz.map(t=>e[t])),null}function mz(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function hz(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=mz(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?mz()?.matches?`dark`:`light`:t}var gz=typeof document<`u`?document:null;function _z(e=null,t={target:gz,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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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=J(`$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`,...Y(t)})}function Gw(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Y(t)})}function Kw(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Y(t)})}function qw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Y(t)})}function Jw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Y(t)})}function Yw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Y(t)})}function Xw(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Y(t)})}function Zw(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Y(t)})}function Qw(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Y(t)})}function $w(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Y(t)})}function eT(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Y(t)})}function tT(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Y(t)})}function nT(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Y(t)})}function rT(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Y(t)})}function iT(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Y(t)})}function aT(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Y(t)})}function oT(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Y(t)})}function sT(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Y(t)})}function cT(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Y(t)})}function lT(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Y(t)})}function uT(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Y(t)})}function dT(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Y(t)})}function fT(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Y(t)})}function pT(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Y(t)})}function mT(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Y(t)})}function hT(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Y(t)})}function gT(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Y(t)})}function _T(e,t){return new e({type:`number`,checks:[],...Y(t)})}function vT(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Y(t)})}function yT(e,t){return new e({type:`boolean`,...Y(t)})}function bT(e){return new e({type:`unknown`})}function xT(e,t){return new e({type:`never`,...Y(t)})}function ST(e,t){return new pC({check:`less_than`,...Y(t),value:e,inclusive:!1})}function CT(e,t){return new pC({check:`less_than`,...Y(t),value:e,inclusive:!0})}function wT(e,t){return new mC({check:`greater_than`,...Y(t),value:e,inclusive:!1})}function TT(e,t){return new mC({check:`greater_than`,...Y(t),value:e,inclusive:!0})}function ET(e,t){return new hC({check:`multiple_of`,...Y(t),value:e})}function DT(e,t){return new _C({check:`max_length`,...Y(t),maximum:e})}function OT(e,t){return new vC({check:`min_length`,...Y(t),minimum:e})}function kT(e,t){return new yC({check:`length_equals`,...Y(t),length:e})}function AT(e,t){return new xC({check:`string_format`,format:`regex`,...Y(t),pattern:e})}function jT(e){return new SC({check:`string_format`,format:`lowercase`,...Y(e)})}function MT(e){return new CC({check:`string_format`,format:`uppercase`,...Y(e)})}function NT(e,t){return new wC({check:`string_format`,format:`includes`,...Y(t),includes:e})}function PT(e,t){return new TC({check:`string_format`,format:`starts_with`,...Y(t),prefix:e})}function FT(e,t){return new EC({check:`string_format`,format:`ends_with`,...Y(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,...Y(n)})}function HT(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Y(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`,...Y(t)});return n._zod.check=e,n}var GT=J(`ZodISODateTime`,(e,t)=>{WC.init(e,t),gE.init(e,t)});function KT(e){return pT(GT,e)}var qT=J(`ZodISODate`,(e,t)=>{GC.init(e,t),gE.init(e,t)});function JT(e){return mT(qT,e)}var YT=J(`ZodISOTime`,(e,t)=>{KC.init(e,t),gE.init(e,t)});function XT(e){return hT(YT,e)}var ZT=J(`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}}})};J(`ZodError`,$T);var eE=J(`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=J(`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(wD(t,n)),e.superRefine=t=>e.check(TD(t)),e.overwrite=t=>e.check(IT(t)),e.optional=()=>cD(e),e.nullable=()=>uD(e),e.nullish=()=>cD(uD(e)),e.nonoptional=t=>gD(e,t),e.array=()=>Z(e),e.or=t=>XE([e,t]),e.and=t=>QE(e,t),e.transform=t=>bD(e,oD(t)),e.default=t=>fD(e,t),e.prefault=t=>mD(e,t),e.catch=t=>vD(e,t),e.pipe=t=>bD(e,t),e.readonly=()=>SD(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=J(`_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=J(`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 X(e){return Ww(hE,e)}var gE=J(`ZodStringFormat`,(e,t)=>{MC.init(e,t),mE.init(e,t)}),_E=J(`ZodEmail`,(e,t)=>{FC.init(e,t),gE.init(e,t)}),vE=J(`ZodGUID`,(e,t)=>{NC.init(e,t),gE.init(e,t)}),yE=J(`ZodUUID`,(e,t)=>{PC.init(e,t),gE.init(e,t)}),bE=J(`ZodURL`,(e,t)=>{IC.init(e,t),gE.init(e,t)}),xE=J(`ZodEmoji`,(e,t)=>{LC.init(e,t),gE.init(e,t)}),SE=J(`ZodNanoID`,(e,t)=>{RC.init(e,t),gE.init(e,t)}),CE=J(`ZodCUID`,(e,t)=>{zC.init(e,t),gE.init(e,t)}),wE=J(`ZodCUID2`,(e,t)=>{BC.init(e,t),gE.init(e,t)}),TE=J(`ZodULID`,(e,t)=>{VC.init(e,t),gE.init(e,t)}),EE=J(`ZodXID`,(e,t)=>{HC.init(e,t),gE.init(e,t)}),DE=J(`ZodKSUID`,(e,t)=>{UC.init(e,t),gE.init(e,t)}),OE=J(`ZodIPv4`,(e,t)=>{JC.init(e,t),gE.init(e,t)}),kE=J(`ZodIPv6`,(e,t)=>{YC.init(e,t),gE.init(e,t)}),AE=J(`ZodCIDRv4`,(e,t)=>{XC.init(e,t),gE.init(e,t)}),jE=J(`ZodCIDRv6`,(e,t)=>{ZC.init(e,t),gE.init(e,t)}),ME=J(`ZodBase64`,(e,t)=>{$C.init(e,t),gE.init(e,t)}),NE=J(`ZodBase64URL`,(e,t)=>{tw.init(e,t),gE.init(e,t)}),PE=J(`ZodE164`,(e,t)=>{nw.init(e,t),gE.init(e,t)}),FE=J(`ZodJWT`,(e,t)=>{iw.init(e,t),gE.init(e,t)}),IE=J(`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=J(`ZodNumberFormat`,(e,t)=>{ow.init(e,t),IE.init(e,t)});function zE(e){return vT(RE,e)}var BE=J(`ZodBoolean`,(e,t)=>{sw.init(e,t),pE.init(e,t)});function VE(e){return yT(BE,e)}var HE=J(`ZodUnknown`,(e,t)=>{cw.init(e,t),pE.init(e,t)});function UE(){return bT(HE)}var WE=J(`ZodNever`,(e,t)=>{lw.init(e,t),pE.init(e,t)});function GE(e){return xT(WE,e)}var KE=J(`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 Z(e,t){return VT(KE,e,t)}var qE=J(`ZodObject`,(e,t)=>{gw.init(e,t),pE.init(e,t),Hx(e,`shape`,()=>t.shape),e.keyof=()=>nD(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(sD,e,t[0]),e.required=(...t)=>cS(hD,e,t[0])});function JE(e,t){return new qE({type:`object`,shape:e??{},...Y(t)})}var YE=J(`ZodUnion`,(e,t)=>{vw.init(e,t),pE.init(e,t),e.options=t.options});function XE(e,t){return new YE({type:`union`,options:e,...Y(t)})}var ZE=J(`ZodIntersection`,(e,t)=>{yw.init(e,t),pE.init(e,t)});function QE(e,t){return new ZE({type:`intersection`,left:e,right:t})}var $E=J(`ZodRecord`,(e,t)=>{Sw.init(e,t),pE.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function eD(e,t,n){return new $E({type:`record`,keyType:e,valueType:t,...Y(n)})}var tD=J(`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 tD({...t,checks:[],...Y(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 tD({...t,checks:[],...Y(r),entries:i})}});function nD(e,t){return new tD({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y(t)})}var rD=J(`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 iD(e,t){return new rD({type:`literal`,values:Array.isArray(e)?e:[e],...Y(t)})}var aD=J(`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 oD(e){return new aD({type:`transform`,transform:e})}var sD=J(`ZodOptional`,(e,t)=>{Dw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cD(e){return new sD({type:`optional`,innerType:e})}var lD=J(`ZodNullable`,(e,t)=>{Ow.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uD(e){return new lD({type:`nullable`,innerType:e})}var dD=J(`ZodDefault`,(e,t)=>{kw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fD(e,t){return new dD({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var pD=J(`ZodPrefault`,(e,t)=>{jw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mD(e,t){return new pD({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xx(t)}})}var hD=J(`ZodNonOptional`,(e,t)=>{Mw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gD(e,t){return new hD({type:`nonoptional`,innerType:e,...Y(t)})}var _D=J(`ZodCatch`,(e,t)=>{Pw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vD(e,t){return new _D({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yD=J(`ZodPipe`,(e,t)=>{Fw.init(e,t),pE.init(e,t),e.in=t.in,e.out=t.out});function bD(e,t){return new yD({type:`pipe`,in:e,out:t})}var xD=J(`ZodReadonly`,(e,t)=>{Lw.init(e,t),pE.init(e,t),e.unwrap=()=>e._zod.def.innerType});function SD(e){return new xD({type:`readonly`,innerType:e})}var CD=J(`ZodCustom`,(e,t)=>{zw.init(e,t),pE.init(e,t)});function wD(e,t={}){return HT(CD,e,t)}function TD(e){return UT(e)}var ED=_(),DD=LE().finite().nonnegative(),OD=LE().int().nonnegative(),kD=KT({offset:!0}),AD=X().min(1).nullable(),Q=e=>JE(e).catchall(UE()),jD={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`},MD={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,select:`select`,node:`node`,scope:`scope`,filter:`filter`},ND={run:`run`,node:`node`},PD={planner:`planner`,detailed:`detailed`},FD=nD([`complete`,`partial`,`legacy`]),ID=nD([`native`,`labelled`,`inferred`]),LD=Q({agent_model_ms:VE(),judge_model_ms:VE(),llmlint_model_ms:VE(),tool_ms:VE()}),RD=DD.nullable(),zD=OD.nullable(),BD=Q({agent_seconds:RD,judge_seconds:RD,llmlint_seconds:RD,gate_seconds:RD,publication_wait_seconds:RD,lock_wait_seconds:RD,setup_seconds:RD,scheduling_seconds:RD,wall_seconds:RD,agent_model_ms:zD,judge_model_ms:zD,llmlint_model_ms:zD,tool_ms:zD,idle_orchestration_ms:zD,unattributed_ms:zD,wall_ms:zD,fractions:Q({agent_model:RD,judge_model:RD,llmlint_model:RD,tool:RD,idle_orchestration:RD,lock_wait:RD,setup:RD,scheduling:RD})}),VD=X().regex(/^[A-Za-z0-9_-]+$/,`a member name: letters, digits, hyphens and underscores`),HD=nD([`agent`,`judge`,`llmlint`]),UD=DD.nullable(),WD=Q({input_tokens:UD,output_tokens:UD,cache_read_tokens:UD,cache_write_tokens:UD,cost_usd:UD}),GD=Q({agent:WD,judge:WD,llmlint:WD,total:WD}),KD=Q({session_id:X().min(1),history_id:X().min(1).nullable().optional(),role:HD,agent_role:VD.optional(),turn_index:OD.nullable().optional(),started_at:kD.optional(),finished_at:kD.nullable().optional()}),qD=eD(X(),UE()),JD=nD([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),YD=nD([`agent`,`judge`,`llmlint`]),XD=nD([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),ZD=Q({side:YD.optional(),harness:X().optional(),variant:X().optional(),identity:X().optional(),cause:XD.optional(),raw_tail:X().optional(),reset_time:X().optional(),missing_session_id:X().optional(),wait_seconds:LE().nonnegative().optional(),failure_kind:X().optional(),structured_error:qD.optional(),judge_unrecorded:VE().optional()}).extend({class:JD,detail:X().optional()}),QD=Q({node:X().min(1),status:X().min(1),outcome:X().min(1).optional(),branch:X().min(1).optional(),comparison_remote:X().min(1).optional(),comparison_base:X().min(1).optional(),checkpoint:X().min(1).optional(),commit:X().min(1).optional(),retry_lineage:qD.optional(),gate_attestation:qD.optional(),failure:ZD.optional(),timing:BD.optional(),usage:GD.optional(),sessions:Z(KD),tool_commands:eD(X(),OD).optional(),turns:OD,lint:OD,timing_quality:FD,linkage_quality:ID,timing_presence:LD}),$D=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:AD,last_progress_at:DD.optional(),timing:BD,nodes:Z(QD),providers:Z(qD).optional(),failure:ZD.optional(),check_rollup:qD.optional(),usage:GD,timing_quality:FD,linkage_quality:ID,timing_presence:LD,sources:Z(X()),node_work_ms:Q({agent_model_ms:zD,judge_model_ms:zD,llmlint_model_ms:zD,tool_ms:zD,wall_ms:zD}),turns:OD,lint:OD}),eO=Q({schema_version:XE([X(),LE()]).optional(),observed_at:X().optional(),identities:Z(qD)}),tO=Q({launch_id:X().min(1),launcher:nD([`claude-code`,`codex`,`unknown`]),session_key:X().min(1).optional(),launcher_session_id:X().min(1).optional()}),nO=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:AD,last_progress_at:DD.optional(),timing_quality:FD,linkage_quality:ID,timing:BD,node_counts:eD(X(),OD),launch:tO.optional()}),rO=Q({path:X().min(1),reason:X().min(1)}),iO=Q({api_version:iD(2),telemetry_schema_version:iD(17),observed_at:kD,runs:Z(nO),next_cursor:X().min(1).optional(),unreadable:Z(rO).optional(),missing:Z(X().min(1)).optional(),provider_health:eO.optional()}),aO=Q({id:X().min(1),kind:nD([`agent`,`human`]).optional(),persona:X().min(1).optional(),task:X().min(1),deps:Z(X().min(1)).optional(),max_turns:OD.positive().optional(),expects_no_diff:VE().optional()}),oO=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X().min(1),checkpoint:X().min(1),completed_steps:Z(X()).optional(),pr:X().nullable().optional(),mode:nD([`pause`,`retry`,`continue`]).optional(),attempts:OD.optional()}),sO=Q({branch:X().min(1),repo:X().min(1).optional(),identity:X().min(1).optional(),base_branch:X().min(1).optional(),pr:X().min(1).optional(),pr_base:X().min(1).optional()}),cO=aO.extend({task:X().min(1).optional(),repo:X().min(1).optional(),steps:Z(aO).min(1).optional(),session:X().min(1).optional(),project_dir:X().min(1).optional(),base_branch:X().min(1).optional(),branch:X().min(1).optional(),title:X().min(1).optional(),verify_cmd:X().min(1).optional(),skip_verify:VE().optional(),verify_via_ci:VE().optional(),merge_policy:nD([`auto`,`direct`,`none`]).optional(),workflow:nD([`local`,`remote`]).optional(),repo_type:nD([`single-owner`,`team`]).optional(),execution_checkout:X().min(1).optional(),stack_bases:Z(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:X().optional(),worker_report:X().optional(),oneharness_session:X().optional()}),uO=Q({id:X().min(1),kind:X().min(1),persona:X().nullable(),status:X().min(1),telemetry:qD.optional(),artifacts:lO.optional()}),dO=Q({ref:X().min(1),task:X(),unblocks:Z(X()),unblocks_publication:VE()}),fO=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X(),checkpoint:X().min(1),completed_steps:Z(X()),pr:X().nullable(),mode:X().optional()}),pO=Q({identity:X().min(1),target:X().min(1),style:X().min(1).optional(),version:X().min(1)}),mO=Q({kind:X().optional(),status:X().optional(),task:X().optional(),unblocks:Z(X()).optional(),blocked_by:Z(X()).optional(),human_actions:Z(dO).optional(),completed:VE().optional(),exit_code:LE().int().nullable().optional(),verdicts:Z(UE()).optional(),usage:qD.optional(),telemetry:qD.optional(),repo:X().optional(),branch:X().optional(),commit:X().optional(),base_branch:X().optional(),pr_base:X().optional(),synthetic_stack_base:X().nullable().optional(),stack_bases:Z(qD).optional(),repository_type:nD([`single-owner`,`team`]).nullable().optional(),repo_type:nD([`single-owner`,`team`]).nullable().optional(),publication_workflow:nD([`local`,`remote`]).nullable().optional(),workflow:nD([`local`,`remote`]).nullable().optional(),merge_policy:nD([`auto`,`direct`,`none`]).nullable().optional(),outcome:X().optional(),ok:VE().optional(),pr:X().nullable().optional(),release:pO.nullable().optional(),detail:X().optional(),follow_ups:X().nullable().optional(),steps:Z(uO).optional(),waiting_steps:Z(X()).optional(),resume:fO.nullable().optional(),error:X().nullable().optional(),retry_lineage:qD.optional(),deferred_cleanup:Z(X()).optional(),artifacts:lO.optional()}),hO=Q({ok:VE().optional(),state:X().optional(),started_order:Z(X()).optional(),results:eD(X(),mO).optional(),schema_version:OD.optional()}),gO=nD([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),_O=nD([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),vO=Q({addressable:VE(),member:X().min(1).optional(),reason:X().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:X().min(1),kind:X(),unblocks:Z(X().min(1))}),bO=Q({run_id:X().min(1),plan:Q({tasks:Z(cO),schema_version:OD.optional(),concurrency:OD.positive().optional(),name:X().min(1).optional(),goal:Q({id:X().min(1),text:X().min(1)}).optional()}),node_states:eD(X(),gO),node_status:eD(X(),_O),node_gated_by:eD(X(),Z(X().min(1))),node_control:eD(X(),vO),node_results:eD(X(),mO),decisions:Z(yO),attestations:Z(X()),result:hO.nullable(),last_seq:OD}).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:UD.optional(),cacheWriteTokens:UD.optional(),costUsd:UD.optional(),inputTokens:UD.optional(),outputTokens:UD.optional()}),SO=Q({index:OD,input:UE().optional(),kind:X(),name:X().nullable().optional(),output:X().nullable().optional()}),CO=Q({judge:X(),kind:X(),decision:X(),reason:X()}),wO=Q({assistant:X().nullable(),durationMs:UD.optional(),failureKind:X().nullable(),finishedAt:kD.nullable().optional(),harness:X(),id:X(),judges:Z(CO).optional(),model:X().nullable(),modelMs:UD.optional(),reasoning:X().nullable(),startedAt:kD.nullable().optional(),status:X(),timestamp:kD,toolMs:UD.optional(),tools:Z(SO),unknown:qD,usage:xO,user:X()}),TO=Q({conversation:Q({canContinue:VE(),harnesses:Z(X()),id:X().min(1),name:X(),project:X(),startedAt:kD,state:X(),turns:Z(wO)}),attribution:Q({runId:X().optional(),nodeId:X().optional(),stepId:X().optional(),launchId:X().optional(),launcher:nD([`claude-code`,`codex`,`unknown`]).optional(),transportRole:HD,agentRole:VD.optional(),parentConversationId:X().optional(),persona:X().optional(),finishedAt:kD.nullable().optional(),inferred:iD(!0).optional(),timing:BD.optional()})}),EO=Q({node:X().optional(),conversations:Z(TO)}),DO=XE([Z(TO),Z(EO).transform(e=>e.flatMap(e=>e.conversations))]),OO=Q({name:X(),state:X(),required:VE(),url:X().url().optional()}),kO=Q({ok:VE(),output_tail:X(),artifact_id:X().min(1).optional()}),AO=Q({verification:Q({pre_push_hook:VE().optional(),required_checks:Z(X()).optional(),required_checks_status:X().optional(),expected_gate:Z(X()).optional(),checks:Z(OO).optional(),records:Z(kO)}),publication:Q({pr_url:X().url().optional(),branch:X().optional(),branch_url:X().url().optional(),merged:VE(),base_branch:X().optional(),commit:X().optional(),commit_url:X().url().optional()}).optional()}),jO=Q({api_version:iD(2),telemetry_schema_version:iD(17),observed_at:kD,run:$D,graph:bO.nullable(),conversations:DO,node_details:eD(X(),AO).optional().default({}),launch:tO.optional(),provider_health:eO.optional()}),MO=nD([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),NO=nD([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),PO=nD([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),FO=Q({kind:MO,value:X().min(1)}),IO=Q({delivered:VE(),delivery:nD([`live`,`deferred`]).optional(),reached:nD([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),member:X().min(1).optional(),input_bytes:OD.optional(),reason:X().min(1).optional(),node_id:X().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"})}),LO=Q({dep:X().min(1),identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),action:X().min(1).optional(),since:kD.optional(),waited_seconds:OD.optional(),last_answer:X().min(1).optional()}),RO=Q({kind:X().min(1).optional(),message:X().min(1).optional(),source:X().min(1).optional(),blocking:VE().optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a surface record carries at least one recorded fact`})}),zO=Q({identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),version:X().min(1).optional(),landing_commit:X().min(1).optional(),actor:X().min(1).optional(),superseded:VE().optional(),form:X().min(1).optional(),outcome:X().min(1).optional(),elapsed_ms:OD.optional(),dep:X().min(1).optional(),delivery:X().min(1).optional(),awaiting:Z(LO).min(1).optional(),versions:Z(Q({identity:X().min(1),target:X().min(1),version:X().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`})}),BO=Q({id:X().min(1),kind:X().min(1),at:kD,node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),author:X().min(1).optional(),redirection:IO.optional(),release:zO.optional(),surface:RO.optional(),reference:FO.optional()}),VO=Q({started_at:kD,ended_at:kD}),HO=Q({kind:X().min(1),blocking:Z(X().min(1)).min(1).optional(),ahead:Z(X().min(1)).min(1).optional(),limit:OD.optional(),reference:X().min(1).optional(),awaiting:Z(X().min(1)).min(1).optional()}),UO=Q({id:X().min(1),kind:NO,label:X(),started_at:kD,ended_at:kD.nullable(),events:Z(BO),parent_id:X().min(1).optional(),node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),count:OD.optional(),total_duration_ms:OD.optional(),intervals:Z(VO).optional(),agent_role:VD.optional(),transport_role:HD.optional(),dispatch_id:X().min(1).optional(),reference:FO.optional(),detail:Q({ok:VE().optional(),output_tail:X().optional(),artifact_id:X().optional()}).optional(),phase:PO.optional(),reasons:Z(HO).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),WO=Q({id:X().min(1),kind:MO,content:X(),truncated:VE()}),GO=Q({api_version:iD(2),timeline_schema_version:iD(10),observed_at:kD,run_id:X().min(1),spans:Z(UO)}),KO=Q({error:Q({code:X(),message:X()})});Q({schema_version:iD(1),launch_id:X().min(1),launcher:nD([`claude-code`,`codex`]),launcher_session_id:X().min(1),started_at:kD,repository_identity:X().min(1)});var qO=nD([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),JO=qD,YO=Z(JE({node:X().min(1),step:X().min(1).optional(),at:LE().finite(),kind:X(),name:X(),detail:X(),events:LE().int().nonnegative()})),XO=e=>iO.parse(e),ZO=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},QO=50,$O=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=QO){let r=this.#r(jD.runs);return r.searchParams.set(MD.includeSettled,String(e)),r.searchParams.set(MD.limit,String(n)),t!==void 0&&r.searchParams.set(MD.cursor,t),this.#i(r,iO.parse)}async selectRuns(e){if(e.length===0)throw new ZO(`Invalid selection`);for(let t of e)if(ek(t,`run ID`),t.includes(`,`))throw new ZO(`Invalid run ID`);let t=this.#r(jD.runs);return t.searchParams.set(MD.select,e.join(`,`)),this.#i(t,iO.parse)}async getRun(e,t={}){ek(e,`run ID`);let n=this.#r(jD.run(e));return t.includeConversations!==void 0&&n.searchParams.set(MD.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(MD.filter,t.filter),this.#i(n,jO.parse)}async getTimeline(e,t,n){ek(e,`run ID`);let r=this.#r(jD.timeline(e));return n!==void 0&&r.searchParams.set(MD.filter,n),t===void 0?r.searchParams.set(MD.scope,ND.run):(r.searchParams.set(MD.scope,ND.node),r.searchParams.set(MD.node,t)),this.#i(r,GO.parse)}async getConversation(e,t){return ek(e,`run ID`),ek(t,`conversation ID`),this.#i(this.#r(jD.conversation(e,t)),TO.parse)}async getArtifact(e,t){return ek(e,`run ID`),ek(t,`artifact ID`),this.#i(this.#r(jD.artifact(e,t)),WO.parse)}subscribe(e){e.runId!==void 0&&ek(e.runId,`run ID`),e.after!==void 0&&ek(e.after,`cursor`);let t=this.#r(jD.events);e.runId!==void 0&&t.searchParams.set(MD.runId,e.runId),e.after!==void 0&&t.searchParams.set(MD.after,e.after),e.filter!==void 0&&t.searchParams.set(MD.filter,e.filter);let n=(this.#n??(e=>{if(typeof EventSource>`u`)throw new ZO(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(t.toString());for(let t of qO.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?iO.parse(i):JO.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 ZO(`Telemetry request failed`,void 0,void 0,{cause:e})}let r=await n.json().catch(e=>{throw new ZO(`Telemetry server returned invalid JSON`,n.status,void 0,{cause:e})});if(!n.ok){let e=KO.safeParse(r);throw new ZO(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 ZO(`Telemetry response failed contract validation`,n.status,void 0,{cause:e})}}};function ek(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new ZO(`Invalid ${t}`)}var tk=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})),nk=o(((e,t)=>{t.exports=`2.2.4`})),rk=o(((e,t)=>{t.exports={Graph:tk(),version:nk()}})),ik=o(((e,t)=>{var n=tk();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}})),ak=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}})),ok=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}}})),sk=o(((e,t)=>{var n=ok();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}})),ck=o(((e,t)=>{var n=sk();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),lk=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}})),uk=o(((e,t)=>{var n=lk();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])})}})),dk=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}})),fk=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})),pk=o(((e,t)=>{var n=fk();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),mk=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}})),hk=o(((e,t)=>{var n=mk();t.exports=r;function r(e,t){return n(e,t,`post`)}})),gk=o(((e,t)=>{var n=mk();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),_k=o(((e,t)=>{var n=tk(),r=ok();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}})),vk=o(((e,t)=>{t.exports={components:ak(),dijkstra:sk(),dijkstraAll:ck(),findCycles:uk(),floydWarshall:dk(),isAcyclic:pk(),postorder:hk(),preorder:gk(),prim:_k(),tarjan:lk(),topsort:fk()}})),yk=o(((e,t)=>{var n=rk();t.exports={Graph:n.Graph,json:ik(),alg:vk(),version:n.version}})),bk=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})),xk=o(((e,t)=>{var n=yk().Graph,r=bk();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}})),Sk=o(((e,t)=>{var n=yk().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),{})}})),Ck=o(((e,t)=>{var n=xk(),r=Sk().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)}})}})),wk=o(((e,t)=>{var n=Sk();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)})}})),Tk=o(((e,t)=>{var{applyWithChunking:n}=Sk();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}})),Ek=o(((e,t)=>{var n=yk().Graph,r=Tk().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)}})),Dk=o(((e,t)=>{var n=Ek(),r=Tk().slack,i=Tk().longestPath,a=yk().alg.preorder,o=yk().alg.postorder,s=Sk().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}})),Ok=o(((e,t)=>{var n=Tk().longestPath,r=Ek(),i=Dk();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)}})),kk=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}})),Ak=o(((e,t)=>{var n=Sk();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)})}})),jk=o(((e,t)=>{var n=Sk();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})}})),Mk=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}})),Nk=o(((e,t)=>{var n=Sk();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}})),Pk=o(((e,t)=>{var n=Sk().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}})),Fk=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}})}})),Ik=o(((e,t)=>{var n=Sk();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}})),Lk=o(((e,t)=>{var n=Sk();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}})),Rk=o(((e,t)=>{var n=Fk(),r=Ik(),i=Lk();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)}})),zk=o(((e,t)=>{var n=yk().Graph,r=Sk();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}})),Bk=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}})}})),Vk=o(((e,t)=>{var n=Nk(),r=Pk(),i=Rk(),a=zk(),o=Bk(),s=yk().Graph,c=Sk();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))}})),Hk=o(((e,t)=>{var n=yk().Graph,r=Sk();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}})),Uk=o(((e,t)=>{var n=Sk(),r=Hk().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})}})),Wk=o(((e,t)=>{var n=Ck(),r=wk(),i=Ok(),a=Sk().normalizeRanks,o=kk(),s=Sk().removeEmptyRanks,c=Ak(),l=jk(),u=Mk(),d=Vk(),f=Uk(),p=Sk(),m=yk().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`,()=>I(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`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>ee(e)),t(` removeBorderNodes`,()=>F(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 F(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 I(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 L(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 ee(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}})),Gk=o(((e,t)=>{var n=Sk(),r=yk().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}})),Kk=o(((e,t)=>{t.exports=`1.1.5`})),qk=l(o(((e,t)=>{t.exports={graphlib:yk(),layout:Wk(),debug:Gk(),util:{time:Sk().time,notime:Sk().notime},version:Kk()}}))(),1),Jk=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],Yk=200,Xk=72,Zk=80,Qk=32,$k=new Set(Jk),eA={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},tA=(e,t)=>e<t?-1:+(e>t);function nA(e){let t=[...e.nodes].sort((e,t)=>tA(e.id,t.id)),n=[...e.edges].sort((e,t)=>tA(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(!$k.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 qk.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:Zk,nodesep:Qk,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:Yk,height:Xk});for(let e of n)u.setEdge(e.source,e.target,{},e.id);qk.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)||tA(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:Yk,height:Xk,style:eA[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 rA(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=rA(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var iA={value:()=>{}};function aA(){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 oA(n)}function oA(e){this._=e}function sA(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}})}oA.prototype=aA.prototype={constructor:oA,on:function(e,t){var n=this._,r=sA(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=cA(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]=lA(n[i],e.name,t);else if(t==null)for(i in n)n[i]=lA(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 oA(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 cA(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function lA(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=iA,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var uA={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 dA(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),uA.hasOwnProperty(t)?{space:uA[t],local:e}:e}function fA(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 pA(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mA(e){var t=dA(e);return(t.local?pA:fA)(t)}function hA(){}function gA(e){return e==null?hA:function(){return this.querySelector(e)}}function _A(e){typeof e!=`function`&&(e=gA(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 aM(r,this._parents)}function vA(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yA(){return[]}function bA(e){return e==null?yA:function(){return this.querySelectorAll(e)}}function xA(e){return function(){return vA(e.apply(this,arguments))}}function SA(e){e=typeof e==`function`?xA(e):bA(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 aM(r,i)}function CA(e){return function(){return this.matches(e)}}function wA(e){return function(t){return t.matches(e)}}var TA=Array.prototype.find;function EA(e){return function(){return TA.call(this.children,e)}}function DA(){return this.firstElementChild}function OA(e){return this.select(e==null?DA:EA(typeof e==`function`?e:wA(e)))}var kA=Array.prototype.filter;function AA(){return Array.from(this.children)}function jA(e){return function(){return kA.call(this.children,e)}}function MA(e){return this.selectAll(e==null?AA:jA(typeof e==`function`?e:wA(e)))}function NA(e){typeof e!=`function`&&(e=CA(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 aM(r,this._parents)}function PA(e){return Array(e.length)}function FA(){return new aM(this._enter||this._groups.map(PA),this._parents)}function IA(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}IA.prototype={constructor:IA,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 LA(e){return function(){return e}}function RA(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 IA(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function zA(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 IA(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function BA(e){return e.__data__}function VA(e,t){if(!arguments.length)return Array.from(this,BA);var n=t?zA:RA,r=this._parents,i=this._groups;typeof e!=`function`&&(e=LA(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=HA(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 aM(o,r),o._enter=s,o._exit=c,o}function HA(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function UA(){return new aM(this._exit||this._groups.map(PA),this._parents)}function WA(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 GA(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 aM(s,this._parents)}function KA(){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 qA(e){e||=JA;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 aM(i,this._parents).order()}function JA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function YA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XA(){return Array.from(this)}function ZA(){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 QA(){let e=0;for(let t of this)++e;return e}function $A(){return!this.node()}function ej(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 tj(e){return function(){this.removeAttribute(e)}}function nj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rj(e,t){return function(){this.setAttribute(e,t)}}function ij(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aj(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oj(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 sj(e,t){var n=dA(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?nj:tj:typeof t==`function`?n.local?oj:aj:n.local?ij:rj)(n,t))}function cj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lj(e){return function(){this.style.removeProperty(e)}}function uj(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dj(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function fj(e,t,n){return arguments.length>1?this.each((t==null?lj:typeof t==`function`?dj:uj)(e,t,n??``)):pj(this.node(),e)}function pj(e,t){return e.style.getPropertyValue(t)||cj(e).getComputedStyle(e,null).getPropertyValue(t)}function mj(e){return function(){delete this[e]}}function hj(e,t){return function(){this[e]=t}}function gj(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _j(e,t){return arguments.length>1?this.each((t==null?mj:typeof t==`function`?gj:hj)(e,t)):this.node()[e]}function vj(e){return e.trim().split(/^|\s+/)}function yj(e){return e.classList||new bj(e)}function bj(e){this._node=e,this._names=vj(e.getAttribute(`class`)||``)}bj.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 xj(e,t){for(var n=yj(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Sj(e,t){for(var n=yj(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Cj(e){return function(){xj(this,e)}}function wj(e){return function(){Sj(this,e)}}function Tj(e,t){return function(){(t.apply(this,arguments)?xj:Sj)(this,e)}}function Ej(e,t){var n=vj(e+``);if(arguments.length<2){for(var r=yj(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Tj:t?Cj:wj)(n,t))}function Dj(){this.textContent=``}function Oj(e){return function(){this.textContent=e}}function kj(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Aj(e){return arguments.length?this.each(e==null?Dj:(typeof e==`function`?kj:Oj)(e)):this.node().textContent}function jj(){this.innerHTML=``}function Mj(e){return function(){this.innerHTML=e}}function Nj(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Pj(e){return arguments.length?this.each(e==null?jj:(typeof e==`function`?Nj:Mj)(e)):this.node().innerHTML}function Fj(){this.nextSibling&&this.parentNode.appendChild(this)}function Ij(){return this.each(Fj)}function Lj(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Rj(){return this.each(Lj)}function zj(e){var t=typeof e==`function`?e:mA(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Bj(){return null}function Vj(e,t){var n=typeof e==`function`?e:mA(e),r=t==null?Bj:typeof t==`function`?t:gA(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Hj(){var e=this.parentNode;e&&e.removeChild(this)}function Uj(){return this.each(Hj)}function Wj(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Gj(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kj(e){return this.select(e?Gj:Wj)}function qj(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Jj(e){return function(t){e.call(this,t,this.__data__)}}function Yj(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 Xj(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 Zj(e,t,n){return function(){var r=this.__on,i,a=Jj(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 Qj(e,t,n){var r=Yj(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?Zj:Xj,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function $j(e,t,n){var r=cj(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 eM(e,t){return function(){return $j(this,e,t)}}function tM(e,t){return function(){return $j(this,e,t.apply(this,arguments))}}function nM(e,t){return this.each((typeof t==`function`?tM:eM)(e,t))}function*rM(){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 iM=[null];function aM(e,t){this._groups=e,this._parents=t}function oM(){return new aM([[document.documentElement]],iM)}function sM(){return this}aM.prototype=oM.prototype={constructor:aM,select:_A,selectAll:SA,selectChild:OA,selectChildren:MA,filter:NA,data:VA,enter:FA,exit:UA,join:WA,merge:GA,selection:sM,order:KA,sort:qA,call:YA,nodes:XA,node:ZA,size:QA,empty:$A,each:ej,attr:sj,style:fj,property:_j,classed:Ej,text:Aj,html:Pj,raise:Ij,lower:Rj,append:zj,insert:Vj,remove:Uj,clone:Kj,datum:qj,on:Qj,dispatch:nM,[Symbol.iterator]:rM};function cM(e){return typeof e==`string`?new aM([[document.querySelector(e)]],[document.documentElement]):new aM([[e]],iM)}function lM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function uM(e,t){if(e=lM(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 dM={passive:!1},fM={capture:!0,passive:!1};function pM(e){e.stopImmediatePropagation()}function mM(e){e.preventDefault(),e.stopImmediatePropagation()}function hM(e){var t=e.document.documentElement,n=cM(e).on(`dragstart.drag`,mM,fM);`onselectstart`in t?n.on(`selectstart.drag`,mM,fM):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function gM(e,t){var n=e.document.documentElement,r=cM(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,mM,fM),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 _M=e=>()=>e;function vM(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}})}vM.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yM(e){return!e.ctrlKey&&!e.button}function bM(){return this.parentNode}function xM(e,t){return t??{x:e.x,y:e.y}}function SM(){return navigator.maxTouchPoints||`ontouchstart`in this}function CM(){var e=yM,t=bM,n=xM,r=SM,i={},a=aA(`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`,_,dM).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&&(cM(n.view).on(`mousemove.drag`,m,fM).on(`mouseup.drag`,h,fM),hM(n.view),pM(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(mM(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){cM(e.view).on(`mousemove.drag mouseup.drag`,null),gM(e.view,l),mM(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]))&&(pM(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])&&(mM(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])&&(pM(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=uM(l||r,t),p,m,h;if((h=n.call(e,new vM(`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=uM(l||a,t),_=o;break}u.call(r,e,new vM(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:_M(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:_M(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:_M(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:_M(!!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 wM(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function TM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function EM(){}var DM=.7,OM=1/DM,kM=`\\s*([+-]?\\d+)\\s*`,AM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,jM=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,MM=/^#([0-9a-f]{3,8})$/,NM=RegExp(`^rgb\\(${kM},${kM},${kM}\\)$`),PM=RegExp(`^rgb\\(${jM},${jM},${jM}\\)$`),FM=RegExp(`^rgba\\(${kM},${kM},${kM},${AM}\\)$`),IM=RegExp(`^rgba\\(${jM},${jM},${jM},${AM}\\)$`),LM=RegExp(`^hsl\\(${AM},${jM},${jM}\\)$`),RM=RegExp(`^hsla\\(${AM},${jM},${jM},${AM}\\)$`),zM={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};wM(EM,WM,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:BM,formatHex:BM,formatHex8:VM,formatHsl:HM,formatRgb:UM,toString:UM});function BM(){return this.rgb().formatHex()}function VM(){return this.rgb().formatHex8()}function HM(){return rN(this).formatHsl()}function UM(){return this.rgb().formatRgb()}function WM(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=MM.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?GM(t):n===3?new YM(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?KM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?KM(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=NM.exec(e))?new YM(t[1],t[2],t[3],1):(t=PM.exec(e))?new YM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=FM.exec(e))?KM(t[1],t[2],t[3],t[4]):(t=IM.exec(e))?KM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=LM.exec(e))?nN(t[1],t[2]/100,t[3]/100,1):(t=RM.exec(e))?nN(t[1],t[2]/100,t[3]/100,t[4]):zM.hasOwnProperty(e)?GM(zM[e]):e===`transparent`?new YM(NaN,NaN,NaN,0):null}function GM(e){return new YM(e>>16&255,e>>8&255,e&255,1)}function KM(e,t,n,r){return r<=0&&(e=t=n=NaN),new YM(e,t,n,r)}function qM(e){return e instanceof EM||(e=WM(e)),e?(e=e.rgb(),new YM(e.r,e.g,e.b,e.opacity)):new YM}function JM(e,t,n,r){return arguments.length===1?qM(e):new YM(e,t,n,r??1)}function YM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}wM(YM,JM,TM(EM,{brighter(e){return e=e==null?OM:OM**+e,new YM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?DM:DM**+e,new YM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new YM(eN(this.r),eN(this.g),eN(this.b),$M(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:XM,formatHex:XM,formatHex8:ZM,formatRgb:QM,toString:QM}));function XM(){return`#${tN(this.r)}${tN(this.g)}${tN(this.b)}`}function ZM(){return`#${tN(this.r)}${tN(this.g)}${tN(this.b)}${tN((isNaN(this.opacity)?1:this.opacity)*255)}`}function QM(){let e=$M(this.opacity);return`${e===1?`rgb(`:`rgba(`}${eN(this.r)}, ${eN(this.g)}, ${eN(this.b)}${e===1?`)`:`, ${e})`}`}function $M(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function eN(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tN(e){return e=eN(e),(e<16?`0`:``)+e.toString(16)}function nN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new aN(e,t,n,r)}function rN(e){if(e instanceof aN)return new aN(e.h,e.s,e.l,e.opacity);if(e instanceof EM||(e=WM(e)),!e)return new aN;if(e instanceof aN)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 aN(o,s,c,e.opacity)}function iN(e,t,n,r){return arguments.length===1?rN(e):new aN(e,t,n,r??1)}function aN(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wM(aN,iN,TM(EM,{brighter(e){return e=e==null?OM:OM**+e,new aN(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?DM:DM**+e,new aN(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 YM(cN(e>=240?e-240:e+120,i,r),cN(e,i,r),cN(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new aN(oN(this.h),sN(this.s),sN(this.l),$M(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=$M(this.opacity);return`${e===1?`hsl(`:`hsla(`}${oN(this.h)}, ${sN(this.s)*100}%, ${sN(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function oN(e){return e=(e||0)%360,e<0?e+360:e}function sN(e){return Math.max(0,Math.min(1,e||0))}function cN(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 lN=e=>()=>e;function uN(e,t){return function(n){return e+n*t}}function dN(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function fN(e){return(e=+e)==1?pN:function(t,n){return n-t?dN(t,n,e):lN(isNaN(t)?n:t)}}function pN(e,t){var n=t-e;return n?uN(e,n):lN(isNaN(e)?t:e)}var mN=(function e(t){var n=fN(t);function r(e,t){var r=n((e=JM(e)).r,(t=JM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=pN(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 hN(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 gN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _N(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]=EN(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 vN(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function yN(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function bN(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]=EN(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var xN=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,SN=new RegExp(xN.source,`g`);function CN(e){return function(){return e}}function wN(e){return function(t){return e(t)+``}}function TN(e,t){var n=xN.lastIndex=SN.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=xN.exec(e))&&(i=SN.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:yN(r,i)})),n=SN.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?wN(c[0].x):CN(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 EN(e,t){var n=typeof t,r;return t==null||n===`boolean`?lN(t):(n===`number`?yN:n===`string`?(r=WM(t))?(t=r,mN):TN:t instanceof WM?mN:t instanceof Date?vN:gN(t)?hN:Array.isArray(t)?_N:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?bN:yN)(e,t)}var DN=180/Math.PI,ON={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kN(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)*DN,skewX:Math.atan(c)*DN,scaleX:o,scaleY:s}}var AN;function jN(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ON:kN(t.a,t.b,t.c,t.d,t.e,t.f)}function MN(e){return e==null||(AN||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),AN.setAttribute(`transform`,e),!(e=AN.transform.baseVal.consolidate()))?ON:(e=e.matrix,kN(e.a,e.b,e.c,e.d,e.e,e.f))}function NN(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:yN(e,i)},{i:c-2,x:yN(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:yN(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:yN(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:yN(e,n)},{i:s-2,x:yN(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 PN=NN(jN,`px, `,`px)`,`deg)`),FN=NN(MN,`, `,`)`,`)`),IN=1e-12;function LN(e){return((e=Math.exp(e))+1/e)/2}function RN(e){return((e=Math.exp(e))-1/e)/2}function zN(e){return((e=Math.exp(2*e))-1)/(e+1)}var BN=(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<IN)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=LN(y),c=s/(n*g)*(i*zN(t*r+y)-RN(y));return[a+c*d,o+c*f,s*i/LN(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),VN=0,HN=0,UN=0,WN=1e3,GN,KN,qN=0,JN=0,YN=0,XN=typeof performance==`object`&&performance.now?performance:Date,ZN=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function QN(){return JN||=(ZN($N),XN.now()+YN)}function $N(){JN=0}function eP(){this._call=this._time=this._next=null}eP.prototype=tP.prototype={constructor:eP,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?QN():+n)+(t==null?0:+t),!this._next&&KN!==this&&(KN?KN._next=this:GN=this,KN=this),this._call=e,this._time=n,oP()},stop:function(){this._call&&(this._call=null,this._time=1/0,oP())}};function tP(e,t,n){var r=new eP;return r.restart(e,t,n),r}function nP(){QN(),++VN;for(var e=GN,t;e;)(t=JN-e._time)>=0&&e._call.call(void 0,t),e=e._next;--VN}function rP(){JN=(qN=XN.now())+YN,VN=HN=0;try{nP()}finally{VN=0,aP(),JN=0}}function iP(){var e=XN.now(),t=e-qN;t>WN&&(YN-=t,qN=e)}function aP(){for(var e,t=GN,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:GN=n);KN=e,oP(r)}function oP(e){VN||(HN&&=clearTimeout(HN),e-JN>24?(e<1/0&&(HN=setTimeout(rP,e-XN.now()-YN)),UN&&=clearInterval(UN)):(UN||=(qN=XN.now(),setInterval(iP,WN)),VN=1,ZN(rP)))}function sP(e,t,n){var r=new eP;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var cP=aA(`start`,`end`,`cancel`,`interrupt`),lP=[];function uP(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;mP(e,n,{name:t,index:r,group:i,on:cP,tween:lP,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function dP(e,t){var n=pP(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function fP(e,t){var n=pP(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function pP(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function mP(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=tP(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 sP(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(sP(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 hP(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 gP(e){return this.each(function(){hP(this,e)})}function _P(e,t){var n,r;return function(){var i=fP(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 vP(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=fP(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 yP(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=pP(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?_P:vP)(n,e,t))}function bP(e,t,n){var r=e._id;return e.each(function(){var e=fP(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return pP(e,r).value[t]}}function xP(e,t){var n;return(typeof t==`number`?yN:t instanceof WM?mN:(n=WM(t))?(t=n,mN):TN)(e,t)}function SP(e){return function(){this.removeAttribute(e)}}function CP(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wP(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 TP(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 EP(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 DP(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 OP(e,t){var n=dA(e),r=n===`transform`?FN:xP;return this.attrTween(e,typeof t==`function`?(n.local?DP:EP)(n,r,bP(this,`attr.`+e,t)):t==null?(n.local?CP:SP)(n):(n.local?TP:wP)(n,r,t))}function kP(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function AP(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function jP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&AP(e,i)),n}return i._value=t,i}function MP(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&kP(e,i)),n}return i._value=t,i}function NP(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=dA(e);return this.tween(n,(r.local?jP:MP)(r,t))}function PP(e,t){return function(){dP(this,e).delay=+t.apply(this,arguments)}}function FP(e,t){return t=+t,function(){dP(this,e).delay=t}}function IP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?PP:FP)(t,e)):pP(this.node(),t).delay}function LP(e,t){return function(){fP(this,e).duration=+t.apply(this,arguments)}}function RP(e,t){return t=+t,function(){fP(this,e).duration=t}}function zP(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?LP:RP)(t,e)):pP(this.node(),t).duration}function BP(e,t){if(typeof t!=`function`)throw Error();return function(){fP(this,e).ease=t}}function VP(e){var t=this._id;return arguments.length?this.each(BP(t,e)):pP(this.node(),t).ease}function HP(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();fP(this,e).ease=n}}function UP(e){if(typeof e!=`function`)throw Error();return this.each(HP(this._id,e))}function WP(e){typeof e!=`function`&&(e=CA(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 yF(r,this._parents,this._name,this._id)}function GP(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 yF(o,this._parents,this._name,this._id)}function KP(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 qP(e,t,n){var r,i,a=KP(t)?dP:fP;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function JP(e,t){var n=this._id;return arguments.length<2?pP(this.node(),n).on.on(e):this.each(qP(n,e,t))}function YP(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function XP(){return this.on(`end.remove`,YP(this._id))}function ZP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=gA(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,uP(l[f],t,n,f,l,pP(u,n)));return new yF(a,this._parents,t,n)}function QP(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=bA(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=pP(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&uP(p,t,n,h,f,m);a.push(f),o.push(u)}return new yF(a,o,t,n)}var $P=oM.prototype.constructor;function eF(){return new $P(this._groups,this._parents)}function tF(e,t){var n,r,i;return function(){var a=pj(this,e),o=(this.style.removeProperty(e),pj(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function nF(e){return function(){this.style.removeProperty(e)}}function rF(e,t,n){var r,i=n+``,a;return function(){var o=pj(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function iF(e,t,n){var r,i,a;return function(){var o=pj(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),pj(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function aF(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=fP(this,e),l=c.on,u=c.value[a]==null?s||=nF(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function oF(e,t,n){var r=(e+=``)==`transform`?PN:xP;return t==null?this.styleTween(e,tF(e,r)).on(`end.style.`+e,nF(e)):typeof t==`function`?this.styleTween(e,iF(e,r,bP(this,`style.`+e,t))).each(aF(this._id,e)):this.styleTween(e,rF(e,r,t),n).on(`end.style.`+e,null)}function sF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function cF(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&sF(e,a,n)),r}return a._value=t,a}function lF(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,cF(e,t,n??``))}function uF(e){return function(){this.textContent=e}}function dF(e){return function(){var t=e(this);this.textContent=t??``}}function fF(e){return this.tween(`text`,typeof e==`function`?dF(bP(this,`text`,e)):uF(e==null?``:e+``))}function pF(e){return function(t){this.textContent=e.call(this,t)}}function mF(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&pF(r)),t}return r._value=e,r}function hF(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,mF(e))}function gF(){for(var e=this._name,t=this._id,n=xF(),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=pP(c,t);uP(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new yF(r,this._parents,e,n)}function _F(){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=fP(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 vF=0;function yF(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function bF(e){return oM().transition(e)}function xF(){return++vF}var SF=oM.prototype;yF.prototype=bF.prototype={constructor:yF,select:ZP,selectAll:QP,selectChild:SF.selectChild,selectChildren:SF.selectChildren,filter:WP,merge:GP,selection:eF,transition:gF,call:SF.call,nodes:SF.nodes,node:SF.node,size:SF.size,empty:SF.empty,each:SF.each,on:JP,attr:OP,attrTween:NP,style:oF,styleTween:lF,text:fF,textTween:hF,remove:XP,tween:yP,delay:IP,duration:zP,ease:VP,easeVarying:UP,end:_F,[Symbol.iterator]:SF[Symbol.iterator]};function CF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var wF={time:null,delay:0,duration:250,ease:CF};function TF(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function EF(e){var t,n;e instanceof yF?(t=e._id,e=e._name):(t=xF(),(n=wF).time=QN(),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])&&uP(c,e,t,l,o,n||TF(c,t));return new yF(r,this._parents,e,t)}oM.prototype.interrupt=gP,oM.prototype.transition=EF;var DF=e=>()=>e;function OF(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 kF(e,t,n){this.k=e,this.x=t,this.y=n}kF.prototype={constructor:kF,scale:function(e){return e===1?this:new kF(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new kF(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 AF=new kF(1,0,0);jF.prototype=kF.prototype;function jF(e){for(;!e.__zoom;)if(!(e=e.parentNode))return AF;return e.__zoom}function MF(e){e.stopImmediatePropagation()}function NF(e){e.preventDefault(),e.stopImmediatePropagation()}function PF(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function FF(){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 IF(){return this.__zoom||AF}function LF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function RF(){return navigator.maxTouchPoints||`ontouchstart`in this}function zF(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 BF(){var e=PF,t=FF,n=zF,r=LF,i=RF,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=BN,l=aA(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,IF).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`,IF),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(AF.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 kF(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 kF(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 kF(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=cM(this.that).datum();l.call(e,this.that,new OF(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=uM(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)],hP(this),s.start();NF(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=cM(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=uM(t,i),l=t.clientX,u=t.clientY;hM(t.view),MF(t),a.mouse=[c,this.__zoom.invert(c)],hP(this),a.start();function d(e){if(NF(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]=uM(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),gM(e.view,a.moved),NF(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=uM(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);NF(r),s>0?cM(this).transition().duration(s).call(x,d,c,r):cM(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(MF(t),s=0;s<i;++s)c=r[s],l=uM(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)),hP(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(NF(e),s=0;s<a;++s)c=i[s],l=uM(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(MF(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=uM(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=cM(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:DF(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:DF(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:DF(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:DF([[+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 VF={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.`},HF=[[-1/0,-1/0],[1/0,1/0]],UF=[`Enter`,` `,`Escape`],WF={"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`},GF;(function(e){e.Strict=`strict`,e.Loose=`loose`})(GF||={});var KF;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(KF||={});var qF;(function(e){e.Partial=`partial`,e.Full=`full`})(qF||={});var JF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},YF;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(YF||={});var XF;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(XF||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var ZF={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function QF(e){return e===null?null:e?`valid`:`invalid`}var $F=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,eI=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),tI=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),nI=(e,t=[0,0])=>{let{width:n,height:r}=II(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},rI=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:vI(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):tI(n)?n:t.nodeLookup.get(n.id)),gI(e,i?bI(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),iI=(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=gI(n,bI(e)),r=!0)}),r?vI(n):{x:0,y:0,width:0,height:0}},aI=(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=SI(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},oI=(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 sI(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}=II(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 cI({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=NI(iI(sI(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 lI({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`,VF.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&FI(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=FI(d)?fI(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,VF.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 uI({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=oI(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 dI=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),fI=(e={x:0,y:0},t,n)=>({x:dI(e.x,t[0][0],t[1][0]-(n?.width??0)),y:dI(e.y,t[0][1],t[1][1]-(n?.height??0))});function pI(e,t,n){let{width:r,height:i}=II(n),{x:a,y:o}=n.internals.positionAbsolute;return fI(e,[[a,o],[a+r,o+i]],t)}var mI=(e,t,n)=>e<t?dI(Math.abs(e-t),1,t)/t:e>n?-dI(Math.abs(e-n),1,t)/t:0,hI=(e,t,n=15,r=40)=>[mI(e.x,r,t.width-r)*n,mI(e.y,r,t.height-r)*n],gI=(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)}),_I=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),vI=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),yI=(e,t=[0,0])=>{let{x:n,y:r}=tI(e)?e.internals.positionAbsolute:nI(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}},bI=(e,t=[0,0])=>{let{x:n,y:r}=tI(e)?e.internals.positionAbsolute:nI(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)}},xI=(e,t)=>vI(gI(_I(e),_I(t))),SI=(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)},CI=(e,t)=>SI(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),wI=e=>TI(e.width)&&TI(e.height)&&TI(e.x)&&TI(e.y),TI=e=>!isNaN(e)&&isFinite(e),EI=(e,t)=>(e,t)=>{},DI=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),OI=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?DI(s,o):s},kI=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function AI(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 jI(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=AI(e,n),i=AI(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=AI(e.top??e.y??0,n),i=AI(e.bottom??e.y??0,n),a=AI(e.left??e.x??0,t),o=AI(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 MI(e,t,n,r,i,a){let{x:o,y:s}=kI(e,[t,n,r]),{x:c,y:l}=kI({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 NI=(e,t,n,r,i,a)=>{let o=jI(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=dI(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=MI(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}},PI=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function FI(e){return e!=null&&e!==`parent`}function II(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function LI(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function RI(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 zI(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function BI(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function VI(e){return{...WF,...e||{}}}function HI(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=JI(e),s=OI({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?DI(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var UI=e=>({width:e.offsetWidth,height:e.offsetHeight}),WI=e=>e?.getRootNode?.()||window?.document,GI=[`INPUT`,`SELECT`,`TEXTAREA`];function KI(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?GI.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var qI=e=>`clientX`in e,JI=(e,t)=>{let n=qI(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)}},YI=(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,...UI(t)}})};function XI({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 ZI(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function QI({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-ZI(t-r,a),n];case $.Right:return[t+ZI(r-t,a),n];case $.Top:return[t,n-ZI(n-i,a)];case $.Bottom:return[t,n+ZI(i-n,a)]}}function $I({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=QI({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=QI({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=XI({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 eL({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 tL({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 nL({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=gI(bI(e),bI(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),CI({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},vI(a))>0}var rL=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,iL=(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)),aL=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,VF.error006()),t;let r=n.getEdgeId||rL,i;return i=$F(e)?{...e}:{...e,id:r(e)},iL(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function oL({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=eL({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var sL={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},cL=({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},lL=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function uL({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=sL[t],c=sL[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=cL({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]=eL({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 dL(e,t,n,r){let i=Math.min(lL(e,t)/2,lL(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 fL({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]=uL({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+=dL(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 pL(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function mL(e){let{sourceNode:t,targetNode:n}=e;if(!pL(t)||!pL(n))return null;let r=t.internals.handleBounds||hL(t.handles),i=n.internals.handleBounds||hL(n.handles),a=_L(r?.source??[],e.sourceHandle),o=_L(e.connectionMode===GF.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,VF.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=gL(t,a,s),u=gL(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function hL(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 gL(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??II(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 _L(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function vL(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function yL(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=vL(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 bL=1e3,xL=10,SL={nodeOrigin:[0,0],nodeExtent:HF,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},CL={...SL,checkEquality:!0};function wL(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function TL(e,t,n){let r=wL(SL,n);for(let n of e.values())if(n.parentId)AL(n,e,t,r);else{let e=fI(nI(n,r.nodeOrigin),FI(n.extent)?n.extent:r.nodeExtent,II(n));n.internals.positionAbsolute=e}}function EL(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 DL(e){return e===`manual`}function OL(e,t,n,r={}){let i=wL(CL,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!DL(i.zIndexMode)?bL: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=fI(nI(u,i.nodeOrigin),FI(u.extent)?u.extent:i.nodeExtent,II(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:EL(u,e),z:jL(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&&AL(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function kL(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 AL(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=wL(SL,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}kL(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*xL),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=ML(e,u,o,s,a&&!DL(c)?bL: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 jL(e,t,n){let r=TI(e.zIndex)?e.zIndex:0;return DL(n)?r:r+(e.selected?t:0)}function ML(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=II(e),l=nI(e,n),u=FI(e.extent)?fI(l,e.extent,c):l,d=fI({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=pI(d,c,t));let f=jL(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function NL(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=xI(a.get(n.parentId)?.expandedRect??yI(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=II(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 PL(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=UI(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=FI(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=pI(h,s,n))}else m&&(h=fI(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:YI(`source`,r.nodeElement,p,d,e.id),target:YI(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&AL(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:yI(g,i)}))}}if(f.length>0){let e=NL(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function FL({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 IL(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 LL(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}`;IL(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),IL(`target`,s,c,e,i,o),t.set(r.id,r)}}function RL(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:RL(n,t):!1}function zL(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 BL(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!RL(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 VL({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 HL({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=DI(a,t);return{x:o.x-a.x,y:o.y-a.y}}function UL({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=cM(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?_I(iI(s)):null,x=v&&l?HL({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)}:DI(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}=lI({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]=VL({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]=hI(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=HI(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=BL(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=VL({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=CM().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=HI(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=JI(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=HI(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=JI(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=JI(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]=VL({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||!zL(t,`.${g}`,v))&&(!_||zL(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function WL(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())CI(i,yI(e))>0&&r.push(e);return r}var GL=250;function KL(e,t,n,r){let i=[],a=1/0,o=WL(e,n,t+GL);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}=gL(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 qL(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,...gL(o,c,c.position,!0)}:c}function JL(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function YL(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var XL=()=>!0;function ZL(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:_=XL,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=WI(e.target),E=0,D,{x:O,y:k}=JI(e),A=JL(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=qL(i,A,r,c,t);if(!N)return;let P=JI(e,j),F=!1,I=null,L=!1,ee=null;function te(){if(!u||!j)return;let[e,t]=hI(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:gL(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:ZF[ne.position],toNode:null,pointer:P};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=JI(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();P=JI(e,j),D=KL(OI(P,a,!1,[1,1]),n,c,ne),F||=(te(),!0);let s=QL(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ee=s.handleDomNode,I=s.connection,L=YL(!!D,s.isValid);let u=c.get(i),f=u?gL(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:L,to:s.toHandle&&L?kI({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:ZF[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ee)&&I&&L&&h?.(I);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,ee=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function QL(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=XL,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}=JI(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=JL(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===GF.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=qL(t,e,a,u,n,!0)}return _}var $L={onPointerDown:ZL,isValid:QL};function eR({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=cM(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&&PI()?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=BF().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:uM}}var tR=e=>({x:e.x,y:e.y,zoom:e.k}),nR=({x:e,y:t,zoom:n})=>AF.translate(e,t).scale(n),rR=(e,t)=>e.target.closest(`.${t}`),iR=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),aR=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,oR=(e,t=0,n=aR,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},sR=e=>{let t=e.ctrlKey&&PI()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cR({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(rR(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=uM(u),t=d*2**sR(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===KF.Vertical?0:u.deltaX*f,m=i===KF.Horizontal?0:u.deltaY*f;!PI()&&u.shiftKey&&i!==KF.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=tR(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 lR({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=rR(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function uR({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=tR(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 dR({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&iR(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,tR(a.transform))}}function fR({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&iR(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=tR(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function pR({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`&&(rR(d,`${l}-flow__node`)||rR(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||rR(d,s)&&m||rR(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 mR({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=BF().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=cM(e).call(f);y({x:i.x,y:i.y,zoom:dI(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(sR);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?EN:BN).transform(oR(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:!TI(E)||E<0?0:E);let k=O?cR({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):lR({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=uR({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=dR({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=fR({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=pR({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=nR(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=nR(e);return await g(n,t),n}function x(e){if(p){let t=nR(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?jF(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`?EN:BN).scaleTo(oR(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?EN:BN).scaleBy(oR(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=!TI(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 hR;(function(e){e.Line=`line`,e.Handle=`handle`})(hR||={});function gR({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 _R(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 vR(e,t){return Math.max(0,t-e)}function yR(e,t){return Math.max(0,e-t)}function bR(e,t,n){return Math.max(0,t-e,e-n)}function xR(e,t){return e?!t:t}function SR(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=bR(E,h,g),j=bR(D,_,v);if(o){let e=0,t=0;c&&w<0?e=vR(y+w+O,o[0][0]):!c&&w>0&&(e=yR(y+E+O,o[1][0])),l&&T<0?t=vR(b+T+k,o[0][1]):!l&&T>0&&(t=yR(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=yR(y+w,s[0][0]):!c&&w<0&&(e=vR(y+E,s[1][0])),l&&T>0?t=yR(b+T,s[0][1]):!l&&T<0&&(t=vR(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=bR(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?yR(b+k+E/C,o[1][1])*C:vR(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?vR(b+E/C,s[1][1])*C:yR(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=bR(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?yR(y+D*C+O,o[1][0])/C:vR(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?vR(y+D*C,s[1][0])/C:yR(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=(xR(c,l)?-w:w)/C:w=(xR(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 CR={width:0,height:0,x:0,y:0},wR={...CR,pointerX:0,pointerY:0,aspectRatio:1};function TR(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 ER({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=cM(e),o={controlDirection:_R(`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={...CR},h={...wR};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:_R(e)};let g,_=null,v=[],y,b,x,S=!1,C=CM().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}=HI(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=FI(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=TR(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=HI(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}=SR(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 F=gR({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),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 DR=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})),OR=o(((e,t)=>{t.exports=DR()})),kR=o((e=>{var t=d(),n=OR();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}})),AR=l(o(((e,t)=>{t.exports=kR()}))(),1),jR=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},MR=e=>e?jR(e):jR,{useDebugValue:NR}=U.default,{useSyncExternalStoreWithSelector:PR}=AR.default,FR=e=>e;function IR(e,t=FR,n){let r=PR(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return NR(r),r}var LR=(e,t)=>{let n=MR(e),r=(e,r=t)=>IR(n,e,r);return Object.assign(r,n),r},RR=(e,t)=>e?LR(e,t):LR;function zR(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 BR=(0,U.createContext)(null),VR=BR.Provider,HR=VF.error001(`react`);function UR(e,t){let n=(0,U.useContext)(BR);if(n===null)throw Error(HR);return IR(n,e,t)}function WR(){let e=(0,U.useContext)(BR);if(e===null)throw Error(HR);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var GR={display:`none`},KR={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},qR=`react-flow__node-desc`,JR=`react-flow__edge-desc`,YR=`react-flow__aria-live`,XR=e=>e.ariaLiveMessage,ZR=e=>e.ariaLabelConfig;function QR({rfId:e}){let t=UR(XR);return(0,W.jsx)(`div`,{id:`${YR}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:KR,children:t})}function $R({rfId:e,disableKeyboardA11y:t}){let n=UR(ZR);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{id:`${qR}-${e}`,style:GR,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,W.jsx)(`div`,{id:`${JR}-${e}`,style:GR,children:n[`edge.a11yDescription.default`]}),!t&&(0,W.jsx)(QR,{rfId:e})]})}var ez=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,W.jsx)(`div`,{className:rA([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));ez.displayName=`Panel`;var tz=`https://reactflow.dev?utm_source=attribution`;function nz({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,W.jsx)(ez,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${tz}`,children:(0,W.jsx)(`a`,{href:tz,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var rz=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}},iz=e=>e.id;function az(e,t){return zR(e.selectedNodes.map(iz),t.selectedNodes.map(iz))&&zR(e.selectedEdges.map(iz),t.selectedEdges.map(iz))}function oz({onSelectionChange:e}){let t=WR(),{selectedNodes:n,selectedEdges:r}=UR(rz,az);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var sz=e=>!!e.onSelectionChangeHandlers;function cz({onSelectionChange:e}){let t=UR(sz);return e||t?(0,W.jsx)(oz,{onSelectionChange:e}):null}var lz=[0,0],uz={x:0,y:0,zoom:1},dz=[...`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`],fz=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}),pz={translateExtent:HF,nodeOrigin:lz,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function mz(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=UR(fz,zR),l=WR();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=pz,s()}),[]);let u=(0,U.useRef)(pz);return(0,U.useEffect)(()=>{for(let s of dz){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:VI(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},dz.map(t=>e[t])),null}function hz(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function gz(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=hz(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?hz()?.matches?`dark`:`light`:t}var _z=typeof document<`u`?document:null;function vz(e=null,t={target:_z,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??gz,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)&&GI(e))return!1;let n=yz(e.code,s);if(a.current.add(e[n]),vz(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=yz(e.code,s);vz(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 vz(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function yz(e,t){return t.includes(e)?`code`:`key`}var bz=()=>{let e=UR();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=MI(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 DI(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=OI(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function xz(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)Sz(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 Sz(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 Cz(e,t){return xz(e,t)}function wz(e,t){return xz(e,t)}function Tz(e,t){return{id:e,type:`select`,selected:t}}function Ez(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(Tz(a.id,e)))}return r}function Dz({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 Oz(e){return{id:e.id,type:`remove`}}var kz=TI(`React Flow`,`https://reactflow.dev/`);function Az(e,t,n={}){return iL(e,t,{...n,onError:n.onError??kz})}var jz=e=>$F(e),Mz=e=>QF(e);function Nz(e){return(0,U.forwardRef)(e)}var Pz=typeof window<`u`?U.useLayoutEffect:U.useEffect;function Fz(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>Iz(()=>n(e=>e+BigInt(1))));return Pz(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Iz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Lz=(0,U.createContext)(null);function Rz({children:e}){let t=UR(),n=Fz((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=Dz({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=Fz((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(Dz({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,W.jsx)(Lz.Provider,{value:i,children:e})}function zz(){let e=(0,U.useContext)(Lz);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Bz=e=>!!e.panZoom;function Vz(){let e=bz(),t=UR(),n=zz(),r=HR(Bz),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=jz(e)?e:n.get(e.id),a=i.parentId?LI(i.position,i.measured,i.parentId,n,r):i.position;return vI({...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&&jz(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&&Mz(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 lI({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Oz);o?.(f),c(e)}if(m){let e=d.map(Oz);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=CI(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=vI(s?r:a),l=SI(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=CI(e)?e:a(e);if(!r)return!1;let i=SI(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 nI(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??zI();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 Hz=e=>e.selected,Uz=typeof window<`u`?window:void 0;function Wz({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=UR(),{deleteElements:r}=Vz(),i=_z(e,{actInsideInputWithModifier:!1}),a=_z(t,{target:Uz});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Hz),edges:e.filter(Hz)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Gz(e){let t=UR();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=HI(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,BF.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 Kz={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},qz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Jz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=GF.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=UR(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=HR(qz,RR),E=_z(f),D=(0,U.useRef)();Gz(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=pR({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:Kz,children:m})}var Yz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Xz(){let{userSelectionActive:e,userSelectionRect:t}=HR(Yz,RR);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 Zz=(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 $z({isSelecting:e,selectionKeyPressed:t,selectionMode:n=KF.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),_=UR(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=HR(Qz,RR),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,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=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}=qI(n.nativeEvent,T.current),l=DI({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 L(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}=OI(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(iI(a,m,i,n===KF.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)}}RI(h,E.current)||c(Ez(a,E.current,!0)),RI(g,D.current)||l(Ez(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!i||!T.current)return;let[e,t]=mI(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(ee);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(ee)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,W.jsxs)(`div`,{className:nA([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:Zz(M,w),onContextMenu:Zz(N,w),onWheel:Zz(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}=qI(e.nativeEvent,T.current);A.current={x:o,y:c};let l=OI({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||=(ee(),!0),L(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?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:Kz,children:[h,(0,W.jsx)(Xz,{})]})}function eB({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`,BF.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function tB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=UR(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=HL({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{eB({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 nB=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function rB(){let e=UR();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=nB(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=EI(t,i));let{position:a,positionAbsolute:s}=cI({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 iB=(0,U.createContext)(null),aB=iB.Provider;iB.Consumer;var oB=()=>(0,U.useContext)(iB),sB=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),cB=(0,U.createContext)(null);function lB({children:e}){let t=HR(sB,RR);return(0,W.jsx)(cB.Provider,{value:t,children:e})}function uB(){let e=(0,U.useContext)(cB);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var dB={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},fB=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return dB;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===WF.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function pB({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=UR(),_=oB(),{connectOnClick:v,noPanClassName:y,rfId:b}=uB(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=HR(fB(_,m,e),RR);_||g.getState().onError?.(`010`,BF.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(Az(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=KI(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:nA([`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=UI(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 mB=(0,U.memo)(Nz(pB));function hB({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[e?.label,(0,W.jsx)(mB,{type:`source`,position:n,isConnectable:t})]})}function gB({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(mB,{type:`target`,position:n,isConnectable:t}),e?.label,(0,W.jsx)(mB,{type:`source`,position:r,isConnectable:t})]})}function _B(){return null}function vB({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(mB,{type:`target`,position:n,isConnectable:t}),e?.label]})}var yB={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bB={input:hB,default:gB,output:vB,group:_B};function xB(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 SB=e=>{let{width:t,height:n,x:r,y:i}=rI(e.nodeLookup,{filter:e=>!!e.selected});return{width:wI(t)?t:null,height:wI(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 CB({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=UR(),{width:i,height:a,transformString:o,userSelectionActive:s}=HR(SB,RR),c=rB(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(tB({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:nA([`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(yB,e.key)&&(e.preventDefault(),c({direction:yB[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var wB=typeof window<`u`?window:void 0,TB=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function EB({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:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:ee}=HR(TB,RR),te=_z(l,{target:wB}),ne=_z(h,{target:wB}),re=ne||w,R=ne||b,ie=u&&re!==!0,ae=te||ee||ie;return Wz({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,W.jsx)(Jz,{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:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:ie,children:(0,W.jsxs)($z,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:ie,children:[e,L&&(0,W.jsx)(CB,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}EB.displayName=`FlowRenderer`;var DB=(0,U.memo)(EB),OB=e=>t=>e?iI(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 kB(e){return HR((0,U.useCallback)(OB(e),[e]),RR)}var AB=e=>e.updateNodeInternals;function jB(){let e=HR(AB),[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 MB({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=UR(),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 NB({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}=HR(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},RR),S=y.type||`default`,C=g?.[S]||bB[S];C===void 0&&(v?.(`003`,BF.error003(S)),S=`default`,C=g?.default||bB.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=UR(),k=II(y),A=MB({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=tB({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=rB();if(y.hidden)return null;let N=FI(y),P=xB(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,ee=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)&&eB({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(GI(t.nativeEvent)||m)){if(HF.includes(t.key)&&T){let n=t.key===`Escape`;eB({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(yB,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:yB[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(iI(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:nA([`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:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:ee,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${KR}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,W.jsx)(aB,{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 PB=(0,U.memo)(NB),FB=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function IB(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=HR(FB,RR),a=kB(e.onlyRenderVisibleElements),o=jB();return(0,W.jsx)(`div`,{className:`react-flow__nodes`,style:Kz,children:a.map(a=>(0,W.jsx)(PB,{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))})}IB.displayName=`NodeRenderer`;var LB=(0,U.memo)(IB);function RB(e){return HR((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&&tL({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),RR)}var zB=({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`}),BB=({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`}),VB={[YF.Arrow]:zB,[YF.ArrowClosed]:BB};function HB(e){let t=UR();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(VB,e)?VB[e]:(t.getState().onError?.(`009`,BF.error009(e)),null),[e])}var UB=({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=HB(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},WB=({defaultColor:e,rfId:t})=>{let n=HR(e=>e.edges),r=HR(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>vL(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)(UB,{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};WB.displayName=`MarkerDefinitions`;var GB=(0,U.memo)(WB);function KB({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=nA([`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}KB.displayName=`EdgeText`;var qB=(0,U.memo)(KB);function JB({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:nA([`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&&wI(t)&&wI(n)?(0,W.jsx)(qB,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function YB({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function XB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=YB({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=YB({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=YI({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 ZB(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]=XB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,W.jsx)(JB,{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=ZB({isInternal:!1}),$B=ZB({isInternal:!0});QB.displayName=`SimpleBezierEdge`,$B.displayName=`SimpleBezierEdgeInternal`;function eV(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]=dL({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,W.jsx)(JB,{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 tV=eV({isInternal:!1}),nV=eV({isInternal:!0});tV.displayName=`SmoothStepEdge`,nV.displayName=`SmoothStepEdgeInternal`;function rV(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,W.jsx)(tV,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var iV=rV({isInternal:!1}),aV=rV({isInternal:!0});iV.displayName=`StepEdge`,aV.displayName=`StepEdgeInternal`;function oV(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]=aL({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,W.jsx)(JB,{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 sV=oV({isInternal:!1}),cV=oV({isInternal:!0});sV.displayName=`StraightEdge`,cV.displayName=`StraightEdgeInternal`;function lV(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)(JB,{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 uV=lV({isInternal:!1}),dV=lV({isInternal:!0});uV.displayName=`BezierEdge`,dV.displayName=`BezierEdgeInternal`;var fV={default:dV,straight:cV,step:aV,smoothstep:nV,simplebezier:$B},pV={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},mV=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,hV=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,gV=`react-flow__edgeupdater`;function _V({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:nA([gV,`${gV}-${s}`]),cx:mV(t,r,e),cy:hV(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function vV({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=UR(),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)(_V,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,W.jsx)(_V,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function yV({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=HR(t=>t.edgeLookup.get(e)),b=HR(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||fV[x];S===void 0&&(_?.(`011`,BF.error011(x)),x=`default`,S=h?.default||fV.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=UR(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee}=HR((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return pV;let i=pL({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=eL({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||pV,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),RR),te=(0,U.useMemo)(()=>y.markerStart?`url('#${_L(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${_L(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===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,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,W.jsx)(`svg`,{style:{zIndex:M},children:(0,W.jsxs)(`g`,{className:nA([`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:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&HF.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?`${qR}-${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:F,targetY:I,sourcePosition:L,targetPosition:ee,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)(vV,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,setUpdateHover:O,setReconnecting:A})]})})}var bV=(0,U.memo)(yV),xV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function SV({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}=HR(xV,RR),b=RB(t);return(0,W.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,W.jsx)(GB,{defaultColor:e,rfId:n}),b.map(e=>(0,W.jsx)(bV,{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))]})}SV.displayName=`EdgeRenderer`;var CV=(0,U.memo)(SV),wV=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function TV({children:e}){let t=UR(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return Pz(()=>{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=wV(r)))};return r(),t.subscribe(r)},[t]),(0,W.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:wV(r)},children:e})}function EV(e){let t=Vz(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var DV=e=>e.panZoom?.syncViewport;function OV(e){let t=HR(DV),n=UR();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function kV(e){return e.connection.inProgress?{...e.connection,to:DI(e.connection.to,e.transform)}:{...e.connection}}function AV(e){return e?t=>e(kV(t)):kV}function jV(e){return HR(AV(e),RR)}var MV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function NV({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=HR(MV,RR);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:nA([`react-flow__connection`,ZF(s)]),children:(0,W.jsx)(PV,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var PV=({style:e,type:t=JF.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}=jV();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:ZF(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 JF.Bezier:[m]=QI(h);break;case JF.SimpleBezier:[m]=XB(h);break;case JF.Step:[m]=dL({...h,borderRadius:0});break;case JF.SmoothStep:[m]=dL(h);break;default:[m]=aL(h)}return(0,W.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};PV.displayName=`ConnectionLine`;var FV={};function IV(e=FV){(0,U.useRef)(e),UR(),(0,U.useEffect)(()=>{},[e])}function LV(){UR(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function RV({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:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:ee,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:z,onViewportChange:we,nodesDraggable:Te}){return IV(e),IV(t),LV(),EV(n),OV(z),(0,W.jsx)(DB,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,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:ee,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:we,isControlledViewport:!!z,children:(0,W.jsxs)(TV,{children:[(0,W.jsx)(CV,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,W.jsx)(NV,{style:h,type:m,component:g,containerStyle:_}),(0,W.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,W.jsx)(LB,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Te}),(0,W.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}RV.displayName=`GraphView`;var zV=(0,U.memo)(RV),BV=TI(`React Flow`,`https://reactflow.dev/`),VV=({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??VF;IL(h,g,_);let{nodesInitialized:x}=DL(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=MI(rI(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:VF,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:WF.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:{...qF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:BV,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:UF,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},HV=({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})=>LR((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 sI({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...VV({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}=DL(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();IL(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}=NL(e,n,r,i,a,o,l);d&&(wL(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=hL(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=ML(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(Cz(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(wz(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=>Tz(e,!0)));return}i(Ez(r,new Set([...e]),!0)),a(Ez(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Tz(e,!0)));return}a(Ez(n,new Set([...e]))),i(Ez(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(Tz(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Tz(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,Tz(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Tz(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]||(DL(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 PL({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:{...qF}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...VV()})}},Object.is);function UV({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)(()=>HV({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)(BR,{value:m,children:(0,W.jsx)(Rz,{children:(0,W.jsx)(lB,{children:p})})})}function WV({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)(zR)?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(UV,{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 GV={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function KV({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:F,onBeforeDelete:I,connectionMode:L,connectionLineType:ee=JF.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=KF.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=NI()?`Meta`:`Control`,zoomActivationKeyCode:le=NI()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=cz,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=lz,minZoom:Ce=.5,maxZoom:z=2,translateExtent:we=VF,preventScrolling:Te=!0,nodeExtent:Ee,defaultMarkerColor:De=`#b1b1b7`,zoomOnScroll:Oe=!0,zoomOnPinch:ke=!0,panOnScroll:Ae=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Me=GF.Free,zoomOnDoubleClick:Ne=!0,panOnDrag:Pe=!0,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:V,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:H,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=hz(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,...GV},ref:jt,className:nA([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,W.jsxs)(WV,{nodes:e,edges:t,width:Ct,height:wt,fitView:nt,fitViewOptions:rt,minZoom:Ce,maxZoom:z,nodeOrigin:ve,nodeExtent:Ee,zIndexMode:kt,children:[(0,W.jsx)(pz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Ce,maxZoom:z,nodeExtent:Ee,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:ue,snapGrid:de,connectionMode:L,translateExtent:we,connectOnClick:it,defaultEdgeOptions:ot,fitView:nt,fitViewOptions:rt,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:tt,nodeOrigin:ve,rfId:Mt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:pe,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:I,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,W.jsx)(zV,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:ee,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:R,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:we,minZoom:Ce,maxZoom:z,preventScrolling:Te,zoomOnScroll:Oe,zoomOnPinch:ke,zoomOnDoubleClick:Ne,panOnScroll:Ae,panOnScrollSpeed:je,panOnScrollMode:Me,panOnDrag:Pe,autoPanOnSelection:ft,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:De,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Mt,disableKeyboardA11y:lt,nodeExtent:Ee,viewport:xt,onViewportChange:St,nodesDraggable:me}),(0,W.jsx)(sz,{onSelectionChange:k}),V,(0,W.jsx)(tz,{proOptions:H,position:at}),(0,W.jsx)(QR,{rfId:Mt,disableKeyboardA11y:lt})]})})}var qV=Nz(KV);BF.error014();function JV({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:nA([`react-flow__background-pattern`,n,r])})}function YV({radius:e,className:t}){return(0,W.jsx)(`circle`,{cx:e,cy:e,r:e,className:nA([`react-flow__background-pattern`,`dots`,t])})}var XV;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(XV||={});var ZV={[XV.Dots]:1,[XV.Lines]:1,[XV.Cross]:6},QV=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function $V({id:e,variant:t=XV.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}=HR(QV,RR),m=r||ZV[t],h=t===XV.Dots,g=t===XV.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:nA([`react-flow__background`,l]),style:{...c,...Kz,"--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)(YV,{radius:y/2,className:u}):(0,W.jsx)(JV,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}$V.displayName=`Background`;var eH=(0,U.memo)($V);function tH(){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 nH(){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 rH(){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 iH(){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 aH(){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 oH({children:e,className:t,...n}){return(0,W.jsx)(`button`,{type:`button`,className:nA([`react-flow__controls-button`,t]),...n,children:e})}var sH=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function cH({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=UR(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=HR(sH,RR),{zoomIn:y,zoomOut:b,fitView:x}=Vz();return(0,W.jsxs)($R,{className:nA([`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)(oH,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,W.jsx)(tH,{})}),(0,W.jsx)(oH,{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)(nH,{})})]}),n&&(0,W.jsx)(oH,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,W.jsx)(rH,{})}),r&&(0,W.jsx)(oH,{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)(aH,{}):(0,W.jsx)(iH,{})}),u]})}cH.displayName=`Controls`;var lH=(0,U.memo)(cH);function uH({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:nA([`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 dH=(0,U.memo)(uH),fH=e=>e.nodes.map(e=>e.id),pH=e=>e instanceof Function?e:()=>e;function mH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=dH,onClick:o}){let s=HR(fH,RR),c=pH(t),l=pH(e),u=pH(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsx)(gH,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function hH({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}=HR(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}=FI(r);return{node:r,x:i,y:a,width:o,height:s}},RR);return!l||l.hidden||!II(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 gH=(0,U.memo)(hH),_H=(0,U.memo)(mH),vH=200,yH=150,bH=e=>!e.hidden,xH=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?bI(rI(e.nodeLookup,{filter:bH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},SH=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,CH=(e,t)=>SH(e.viewBB,t.viewBB)&&SH(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,wH=`react-flow__minimap-desc`;function TH({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=UR(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=HR(xH,CH),j=e?.width??vH,M=e?.height??yH,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,ee=b*F,te=C.x-(I-C.width)/2-ee,ne=C.y-(L-C.height)/2-ee,re=I+ee*2,R=L+ee*2,ie=`${wH}-${T}`,ae=(0,U.useRef)(0),oe=(0,U.useRef)();ae.current=F,(0,U.useEffect)(()=>{if(S.current&&E)return oe.current=$L({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,U.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,W.jsx)($R,{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*F: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:nA([`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":ie,ref:S,onClick:se,children:[le&&(0,W.jsx)(`title`,{id:ie,children:le}),(0,W.jsx)(_H,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,W.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-ee},${ne-ee}h${re+ee*2}v${R+ee*2}h${-re-ee*2}z
54
- M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}TH.displayName=`MiniMap`,(0,U.memo)(TH);var EH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,DH={[mR.Line]:`right`,[mR.Handle]:`bottom-right`};function OH({nodeId:e,position:t,variant:n=mR.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=oB(),y=typeof e==`string`?e:v,b=UR(),x=(0,U.useRef)(null),S=n===mR.Handle,C=HR((0,U.useCallback)(EH(S&&p),[S,p]),RR),w=(0,U.useRef)(null),T=t??DH[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=TR({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=ML([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...LI({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:nA([`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)(OH);function kH(e){return e.graph??void 0}function AH(e){let t=kH(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=zH(r,`kind`)===`human`?`human`:BH(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:zH(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 jH(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function MH(e){let t=jH(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${VH(e.launch_id)}`:`${t} session · ${VH(e.session_key)}`}function NH(e){if(e.blockers.length>0&&FH.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(IH.has(e.status))return PH(e)??`${e.status}, with no reason recorded`}function PH(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var FH=new Set([`blocked`,`skipped`,`waiting`]),IH=new Set([`failed`,`not-completed`,`cancelled`]);function LH(e){let t=qk,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 RH(e){return IH.has(e)||e===`blocked`||e===`skipped`}function zH(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function BH(e){return`repo`in e||`steps`in e}function VH(e){return e.length>12?`${e.slice(0,8)}…`:e}function HH({data:e}){let t=e.style===`success`?yt:e.style===`danger`||e.style===`muted`?Yt:e.style===`active`?Ct:Et;return(0,W.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:H(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,W.jsx)(mB,{type:`target`,position:$.Left}),(0,W.jsxs)(`div`,{className:`node-heading`,children:[(0,W.jsx)(va,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,W.jsx)(t,{className:H(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)(mB,{type:`source`,position:$.Right})]})}function UH({data:e,id:t,markerEnd:n,style:r}){return(0,W.jsx)(JB,{id:t,path:WH(e?.points??[]),markerEnd:n,style:r})}function WH(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var GH={dagNode:HH},KH={routed:UH};function qH({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)RH(n.status)&&t.set(n.id,NH(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=tA({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)(qV,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:GH,edgeTypes:KH,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)(eH,{color:`var(--border)`,gap:22}),(0,W.jsx)(lH,{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 JH({className:e,state:t}){let n=YH(t);return(0,W.jsxs)(va,{className:H(`gap-1.5 tracking-[.03em] uppercase`,n&&ZH[n],e),variant:`outline`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function YH(e){return rU[e]}var XH=e=>{let t=YH(e);return H(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:QH[t])},ZH={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},QH={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},$H=`success`,eU=`destructive`,tU=`warning`,nU={blocked:tU,cancelled:eU,done:$H,failed:eU,"not-completed":eU,parked:void 0,pending:void 0,running:`info`,skipped:tU,unknown:void 0,waiting:void 0},rU={...nU,complete:nU.done,settled:nU.done,active:nU.running};function iU({runs:e,selectedRunId:t,liveRunIds:n,onSelect:r,hasMore:i,loadingMore:a,onLoadMore:o}){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&&o()},children:(0,W.jsx)(_l,{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)(Al,{className:`my-[22px]`}),(0,W.jsx)(`div`,{className:`run-list`,children:e.map(e=>{let i=t===e.run_id,a=n.has(e.run_id),o=LH(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:[a?(0,W.jsxs)(xd,{children:[(0,W.jsx)(Sd,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":`Live`,className:H(`run-dot`,XH(e.state)),"data-live":`true`,role:`img`})}),(0,W.jsx)(Cd,{children:`Live`})]}):(0,W.jsx)(`span`,{"aria-label":`Historical`,className:H(`run-dot`,XH(e.state)),role:`img`}),(0,W.jsx)(`span`,{children:e.run_id})]}),(0,W.jsx)(xt,{"aria-hidden":`true`,size:14}),(0,W.jsx)(`span`,{className:`run-link-counts`,title:o,children:[e.state,o].filter(Boolean).join(` · `)}),(0,W.jsxs)(`span`,{className:`run-link-tag`,children:[(0,W.jsx)(vt,{"aria-hidden":`true`,size:11}),MH(e.launch)]})]},e.run_id)})}),i&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{className:`sr-only`,onClick:()=>void o(),type:`button`,children:`Load more runs`}),(0,W.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:a?`Loading more runs…`:``})]})]})})})}function aU(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)(),[v,y]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=i===void 0?void 0:i.runs.some(({run_id:e})=>e===t)?t:i.runs.at(0)?.run_id,C=n===void 0?void 0:n.nodeId??`run`,w=(0,U.useRef)(S);(0,U.useEffect)(()=>{w.current=S},[S]);let T=(0,U.useRef)(void 0),E=(0,U.useRef)(void 0),D=(0,U.useRef)(!1),O=(0,U.useCallback)(()=>{h(void 0),_(void 0)},[]),k=(0,U.useCallback)(async()=>{a(await e.listRuns(!0))},[e]),A=(0,U.useRef)(void 0),j=(0,U.useCallback)(async()=>{let t=i?.next_cursor;if(!(t===void 0||A.current===t)){A.current=t,x(!0);try{let n=await e.listRuns(!0,t);a(e=>e===void 0?n:{...n,runs:[...e.runs,...n.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),O()}catch(e){h(lU(e))}finally{A.current=void 0,x(!1)}}},[e,i,O]),M=(0,U.useCallback)(async t=>{let n=await e.selectRuns([t]);a(e=>{if(e===void 0)return e;if(n.missing?.includes(t)===!0)return{...e,runs:e.runs.filter(e=>e.run_id!==t)};let r=n.runs.find(e=>e.run_id===t);return r===void 0?e:{...e,runs:e.runs.some(e=>e.run_id===t)?e.runs.map(e=>e.run_id===t?r:e):[r,...e.runs]}})},[e]),N=(0,U.useCallback)(async()=>{try{await k(),O()}catch(e){h(lU(e))}finally{l(!1)}},[k,O]),P=(0,U.useCallback)(async()=>{await N(),y(e=>e+1)},[N]);(0,U.useEffect)(()=>{if(S===void 0){s(void 0),E.current=void 0;return}let t=e=>e.runId===S&&e.timelineScope===C&&e.filter===r,i=sU(S,C,r);T.current=i,s(e=>{if(e!==void 0&&t(e))return e;let n=e?.runId===S&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:S,filter:r,timelineScope:C,...n===void 0?{}:{detail:n}}});let a=e=>{s(n=>n!==void 0&&t(n)?e(n):n)},o=e=>{T.current===i&&e()},c=E.current;if(c?.key===i){c.again=!0;return}let l=()=>{E.current={key:i,again:!1};let t=()=>{let e=E.current;if(e?.key===i){if(e.again){l();return}E.current=void 0}},s=e.getRun(S,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),o(O)}).catch(oU).catch(e=>{o(()=>h(lU(e)))}),c=n===void 0?Promise.resolve():e.getTimeline(S,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(oU).catch(e=>a(t=>({...t,timelineError:lU(e)})));Promise.all([s,c]).then(t,t)};l()},[e,S,v,n?.nodeId,C,r]),(0,U.useEffect)(()=>{N();let t=e.subscribe({onEvent:e=>{if(d(new Date().toISOString()),_(void 0),e.event===`snapshot`){a(YO(e.data)),D.current&&y(e=>e+1),D.current=!0;return}let t=cU(e);t!==void 0&&(M(t).catch(e=>h(lU(e))),t===w.current&&y(e=>e+1))},onError:e=>{_(lU(e))}});return()=>t.close()},[e,M,N]),(0,U.useEffect)(()=>{if(S===void 0){p([]);return}let t=e.subscribe({runId:S,filter:r,onEvent:e=>{if(d(new Date().toISOString()),_(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;p(JO.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&y(e=>e+1)}},onError:e=>_(lU(e))});return()=>t.close()},[e,S,r]);let F=o!==void 0&&o.runId===S&&o.filter===r?o:void 0;return(0,U.useMemo)(()=>({list:i,runId:S,detail:F?.detail,timeline:F?.timeline,timelineError:F?.timelineError,loading:c,lastUpdated:u,activity:f,error:m??g,refresh:P,loadMore:j,hasMore:i?.next_cursor!==void 0,loadingMore:b}),[i,S,F,c,u,f,m,g,P,j,b])}function oU(e){if(!(e instanceof XO&&e.code===`run_not_found`))throw e}function sU(e,t,n){return[e,t??``,n??``].join(`\0`)}function cU(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 lU(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var uU=365.2425,dU=6048e5,fU=864e5,pU=6e4,mU=36e5,hU=1e3,gU=525600,_U=43200,vU=1440,yU=3600*24;yU*7,yU*uU/12*3;var bU=Symbol.for(`constructDateFrom`);function xU(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&bU in e?e[bU](t):e instanceof Date?new e.constructor(t):new Date(t)}function SU(e,t){return xU(t||e,e)}var CU={};function wU(){return CU}function TU(e,t){let n=wU(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=SU(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 EU(e,t){return TU(e,{...t,weekStartsOn:1})}function DU(e,t){let n=SU(e,t?.in),r=n.getFullYear(),i=xU(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=EU(i),o=xU(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=EU(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function OU(e){let t=SU(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 kU(e,...t){let n=xU.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function AU(e,t){let n=SU(e,t?.in);return n.setHours(0,0,0,0),n}function jU(e,t,n){let[r,i]=kU(n?.in,e,t),a=AU(r),o=AU(i),s=+a-OU(a),c=+o-OU(o);return Math.round((s-c)/fU)}function MU(e,t){let n=DU(e,t),r=xU(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),EU(r)}function NU(e,t){let n=SU(e)-+SU(t);return n<0?-1:n>0?1:n}function PU(e){return xU(e,Date.now())}function FU(e,t,n){let[r,i]=kU(n?.in,e,t);return+AU(r)==+AU(i)}function IU(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function LU(e){return!(!IU(e)&&typeof e!=`number`||isNaN(+SU(e)))}function RU(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function zU(e,t){let n=SU(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var BU={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`}},VU=(e,t,n)=>{let r,i=BU[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 HU(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var UU={date:HU({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:HU({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:HU({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},WU={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},GU=(e,t,n,r)=>WU[e];function KU(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 qU={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:KU({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:KU({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:KU({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:KU({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:KU({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 JU(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)?XU(s,e=>e.test(o)):YU(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 YU(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function XU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ZU(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 QU={code:`en-US`,formatDistance:VU,formatLong:UU,formatRelative:GU,localize:qU,match:{ordinalNumber:ZU({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:JU({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:JU({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:JU({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:JU({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:JU({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 $U(e,t){let n=SU(e,t?.in);return jU(n,zU(n))+1}function eW(e,t){let n=SU(e,t?.in),r=EU(n)-+MU(n);return Math.round(r/dU)+1}function tW(e,t){let n=SU(e,t?.in),r=n.getFullYear(),i=wU(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=xU(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=TU(o,t),c=xU(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=TU(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function nW(e,t){let n=wU(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=tW(e,t),a=xU(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),TU(a,t)}function rW(e,t){let n=SU(e,t?.in),r=TU(n,t)-+nW(n,t);return Math.round(r/dU)+1}function iW(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var aW={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return iW(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):iW(n+1,2)},d(e,t){return iW(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 iW(e.getHours()%12||12,t.length)},H(e,t){return iW(e.getHours(),t.length)},m(e,t){return iW(e.getMinutes(),t.length)},s(e,t){return iW(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return iW(Math.trunc(r*10**(n-3)),t.length)}},oW={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},sW={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 aW.y(e,t)},Y:function(e,t,n,r){let i=tW(e,r),a=i>0?i:1-i;return t===`YY`?iW(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):iW(a,t.length)},R:function(e,t){return iW(DU(e),t.length)},u:function(e,t){return iW(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 iW(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 iW(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 aW.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 iW(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=rW(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):iW(i,t.length)},I:function(e,t,n){let r=eW(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):iW(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):aW.d(e,t)},D:function(e,t,n){let r=$U(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):iW(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 iW(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 iW(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 iW(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?oW.noon:r===0?oW.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?oW.evening:r>=12?oW.afternoon:r>=4?oW.morning:oW.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 aW.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):aW.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):iW(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):iW(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):aW.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):aW.s(e,t)},S:function(e,t){return aW.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return lW(r);case`XXXX`:case`XX`:return uW(r);default:return uW(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return lW(r);case`xxxx`:case`xx`:return uW(r);default:return uW(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+cW(r,`:`);default:return`GMT`+uW(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+cW(r,`:`);default:return`GMT`+uW(r,`:`)}},t:function(e,t,n){return iW(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return iW(+e,t.length)}};function cW(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+iW(a,2)}function lW(e,t){return e%60==0?(e>0?`-`:`+`)+iW(Math.abs(e)/60,2):uW(e,t)}function uW(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=iW(Math.trunc(r/60),2),a=iW(r%60,2);return n+i+t+a}var dW=(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`})}},fW=(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`})}},pW={p:fW,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return dW(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}}`,dW(r,t)).replace(`{{time}}`,fW(i,t))}},mW=/^D+$/,hW=/^Y+$/,gW=[`D`,`DD`,`YY`,`YYYY`];function _W(e){return mW.test(e)}function vW(e){return hW.test(e)}function yW(e,t,n){let r=bW(e,t,n);if(console.warn(r),gW.includes(e))throw RangeError(r)}function bW(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 xW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,SW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,CW=/^'([^]*?)'?$/,wW=/''/g,TW=/[a-zA-Z]/;function EW(e,t,n){let r=wU(),i=n?.locale??r.locale??QU,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=SU(e,n?.in);if(!LU(s))throw RangeError(`Invalid time value`);let c=t.match(SW).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=pW[t];return n(e,i.formatLong)}return e}).join(``).match(xW).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:DW(e)};if(sW[t])return{isToken:!0,value:e};if(t.match(TW))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&&vW(a)||!n?.useAdditionalDayOfYearTokens&&_W(a))&&yW(a,t,String(e));let o=sW[a[0]];return o(s,a,i.localize,l)}).join(``)}function DW(e){let t=e.match(CW);return t?t[1].replace(wW,`'`):e}function OW(e,t,n){let r=wU(),i=n?.locale??r.locale??QU,a=NU(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=kU(n?.in,...a>0?[t,e]:[e,t]),l=RU(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/pU,f=(u-(OU(c)-OU(s)))/pU,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/vU);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/_U);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/gU);return i.formatDistance(`xYears`,e,o)}}function kW(e,t){return OW(e,PU(e),t)}function AW(e){return Math.trunc(e*mU)}function jW(e,t,n){let[r,i]=kU(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function MW(e,t){return jW(xU(t?.in||e,e),PU(t?.in||e))}function NW(e,t){return FU(xU(t?.in||e,e),PU(t?.in||e))}function PW(e){let t=e/mU;return Math.trunc(t)}function FW(e){let t=e/pU;return Math.trunc(t)}function IW(e){let t=e/hU;return Math.trunc(t)}function LW(e){return Math.trunc(e*pU)}function RW(e,t){let n=()=>xU(t?.in,NaN),r=t?.additionalDigits??2,i=UW(e),a;if(i.date){let e=WW(i.date,r);a=GW(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=qW(i.time),isNaN(s)))return n();if(i.timezone){if(c=YW(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=SU(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return SU(o+s+c,t?.in)}var zW={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},BW=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,VW=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,HW=/^([+-])(\d{2})(?::?(\d{2}))?$/;function UW(e){let t={},n=e.split(zW.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],zW.timeZoneDelimiter.test(t.date)&&(t.date=e.split(zW.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=zW.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function WW(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 GW(e,t){if(t===null)return new Date(NaN);let n=e.match(BW);if(!n)return new Date(NaN);let r=!!n[4],i=KW(n[1]),a=KW(n[2])-1,o=KW(n[3]),s=KW(n[4]),c=KW(n[5])-1;if(r)return tG(t,s,c)?XW(t,s,c):new Date(NaN);{let e=new Date(0);return!$W(t,a,o)||!eG(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function KW(e){return e?parseInt(e):1}function qW(e){let t=e.match(VW);if(!t)return NaN;let n=JW(t[1]),r=JW(t[2]),i=JW(t[3]);return nG(n,r,i)?n*mU+r*pU+i*1e3:NaN}function JW(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function YW(e){if(e===`Z`)return 0;let t=e.match(HW);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return rG(r,i)?n*(r*mU+i*pU):NaN}function XW(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 ZW=[31,null,31,30,31,30,31,31,30,31,30,31];function QW(e){return e%400==0||e%4==0&&e%100!=0}function $W(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(ZW[t]||(QW(e)?29:28))}function eG(e,t){return t>=1&&t<=(QW(e)?366:365)}function tG(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function nG(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function rG(e,t){return t>=0&&t<=59}function iG(e){return e*hU}function aG(e){let t=Math.max(0,Math.round(e));if(t<iG(1))return`${t}ms`;let n=PW(t),r=FW(t-AW(n)),i=IW(t-AW(n)-LW(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function oG(e){return aG(iG(e))}function sG(e){let t=RW(e);return LU(t)?t:void 0}function cG(e){let t=sG(e);return t===void 0?e:NW(t)?EW(t,`HH:mm:ss`):MW(t)?EW(t,`MMM d, HH:mm:ss`):EW(t,`MMM d yyyy, HH:mm:ss`)}function lG(e){let t=sG(e);return t===void 0?e:EW(t,`PPpp zzzz`)}function uG(e){let t=sG(e);return t===void 0?e:kW(t,{addSuffix:!0})}function dG({at:e,className:t,relative:n=!1}){let r=sG(e);return r===void 0?(0,W.jsx)(`span`,{className:t,children:e}):(0,W.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:lG(e),children:n?uG(e):cG(e)})}var fG={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:PD.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:PD.monitor}};function pG(e){return e!==null&&Object.hasOwn(fG,e)}var mG={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,pr:`PR`,checks:`Checks`};function hG(e){return e!==null&&Object.hasOwn(mG,e)}function gG(){let e=(0,U.useSyncExternalStore)(_G,vG,vG),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=pG(s)?s:`activity`,l=hG(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 _G(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function vG(){return window.location.search}function yG({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)(va,{"aria-label":`${t}: ${n}`,className:H(`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]})}function bG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var xG=[[`recovery`,[`retry`,`retried`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`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`]]],SG={"completion-requested":`lifecycle`,"command-accepted":`planning`,"body-not-drafted":`publication`,"criterion-checked":`verification`};function CG(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function wG(e){let t=SG[e];if(t!==void 0)return t;let n=CG(e);return xG.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var TG={recovery:Vt,failure:Kt,human:qt,planning:Tt,contention:jt,verification:Wt,publication:At,repository:kt,session:Lt,lifecycle:Rt,activity:wt};function EG({category:e,className:t=`size-3`}){let n=TG[e];return(0,W.jsx)(n,{"aria-hidden":`true`,className:t})}function DG(e){return e===`human-step`?`human step`:e}function OG(e){return e.style===`human-step`}function kG(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 AG(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function jG(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 MG(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function NG({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:DG(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`,AG(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,jG(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:[OG(e)?(0,W.jsxs)(qi,{children:[(0,W.jsx)(qt,{}),(0,W.jsxs)(Ji,{children:[`Waiting on a person · `,MG(e)]}),(0,W.jsx)(Yi,{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 · `,MG(e)]}),(0,W.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:kG(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 PG({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:DG(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function FG(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:aG(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`,...e.status?{status:e.status}:{}}}function IG({row:e}){let t=FG(e);return(0,W.jsxs)(`header`,{className:`detail-title`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(va,{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)(dG,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,W.jsx)(va,{variant:`secondary`,children:t.status})]})}function LG(e){let t=FG(e);return[t.kind,t.label,cG(t.startedAt),bG(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function RG({row:e}){return(0,W.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":LG(e),children:(0,W.jsx)(EG,{category:e.category})})}var zG=`data-timeline-reading`;function BG(e){let t=e.closest(`[${zG}]`)??e.closest(`button`)?.querySelector(`[${zG}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(zG)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var VG={rows:[],total:0},HG={queued:`Queued`,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`},UG=Object.entries(HG).map(([e,t])=>({id:e,label:t})),WG={run:null,node:null,step:null,dispatch:`worker`,verification:`verification`,publication:`publication`,"pr-drafting":`pr-author`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`},GG=`llmlint`,KG={worker:`worker`,judge:`judge`,llmlint:`lint`,orchestrator:`orchestrator`,"check-in":`check-in`,"pr-author":`pr-author`},qG={worker:!0,orchestrator:!0,"check-in":!0,"pr-author":!0,judge:!1,llmlint:!1};function JG(e){return HG[KG[e]]}var YG={"lock-wait":`Lock waits`};function XG(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):QG(e)<QG(n)?i.has(n.id)?o.push(e):o[o.indexOf(n)]=e:ZG(e,n,a)||o.push(e)}return o}function ZG(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function QG(e){let t=e.laneId??``,n=UG.findIndex(({id:e})=>e===t);return n<0?UG.length:n}function $G(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 eK(e,t){let n=oK(e,t).rows,r=rK(n),i=rK(n,!1).flatMap(e=>{let t=iK(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}]}),a=r.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)(RG,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:UG,rows:r,tree:n}}function tK(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function nK(e,t){return`${e} more ${t} events`}function rK(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 iK(e){if(e.rowKind===`event`)return null;let t=aK(e.role);return t===null?WG[e.rowKind===`span`?e.span.kind:e.kind]??null:t}function aK(e){return e===void 0?null:KG[e]??null}function oK(e,t){if(e===void 0)return VG;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=AK(e.spans,new Set,t);return n.length===0?VG:{rows:bK(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=bK(EK(TK([...o===void 0?[]:dK(o,i),...a.filter(e=>e!==o).map(e=>fK(e,i)),...AK(e.spans,r,t)].sort(MK))));return{span:o,rows:s,total:jK(s)}}function sK(e){return fK(e,new Map)}function cK(e){return yK(e)}function lK(e,t){return uK(e,t).at(-1)}function uK(e,t){for(let n of e){if(n.id===t)return[n];let e=uK(n.children,t);if(e.length>0)return[n,...e]}return[]}function dK(e,t){return[...(t.get(e.id)??[]).map(e=>fK(e,t)),...e.events.map(yK)].sort(MK)}function fK(e,t){let n=pK(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??NK(e.started_at,e.ended_at),children:bK(dK(e,t)),displayLabel:wK(e,n),displayKind:xK(e,n),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function pK(e){return e.kind===`dispatch`?mK(e):void 0}function mK(e){if(e.agent_role!==void 0)return e.transport_role===`llmlint`?GG:e.agent_role}function hK(e){let t=mK(e);return t===void 0?WG[e.kind===`rollup`?e.label:e.kind]??null:KG[t]??null}function gK(e){return HG[e]}function _K(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var vK=`Redirection`;function yK(e){let t=_K(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`:vK,category:wG(e.kind)}}function bK(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&&kK(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||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:NK(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind}),n=i}return t}function xK(e,t){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return YG[e.label]??e.label;let n=aK(t)??WG[e.kind];return n==null?e.kind:HG[n]}function SK(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function CK(e){return e.map(SK).join(` and `)}function wK(e,t){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${CK(e.reasons??[])}`.trim();let n=xK(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 TK(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=TK(e.children);return e.role!==`worker`||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function EK(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(DK(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 DK(e){return e!==void 0&&qG[e]===!0}function OK(e){return e!==void 0&&qG[e]===!1}function kK(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind}function AK(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(yK)}function jK(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+jK(t.children),0)}function MK(e,t){return e.startedAt.localeCompare(t.startedAt)}function NK(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 PK(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 FK=32;function IK(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function LK(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<=FK)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=IK(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 RK=25,zK=4e3;function BK({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:rq(r),a=i?.kind===`conversation`?i.value:void 0,o=PK(e,t,a,r===void 0?void 0:$K(r));return(0,W.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,W.jsx)(_l,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:LK(a,eq(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)(IG,{row:r}),(0,W.jsx)(Al,{className:`my-4`}),(0,W.jsx)(VK,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function VK({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=tq(n);if(o!==void 0)return(0,W.jsx)(XK,{redirection:o,row:n});let s=nq(n);return s===void 0?i?.kind===`conversation`?(0,W.jsx)(UK,{row:n,transcript:a}):aq(n)?(0,W.jsx)(WK,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&JK(i.value)!==void 0?(0,W.jsx)(GK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&JK(i.value)!==void 0?(0,W.jsx)(KK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):oq(n,i)&&r!==void 0?(0,W.jsx)(YK,{node:r,reference:i}):(0,W.jsx)(ZK,{reference:i,row:n}):(0,W.jsx)(NG,{release:s})}function HK({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,W.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function UK({row:e,transcript:t}){let[n,r]=(0,U.useState)(RK),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)(jl,{className:`h-2 w-40`}),(0,W.jsx)(jl,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,W.jsxs)(qi,{variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Transcript unavailable`}),(0,W.jsx)(Yi,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=sq(c.agentRole,c.transportRole);return(0,W.jsx)(xa,{className:`gap-0 py-3`,children:(0,W.jsxs)(Sa,{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)(Al,{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.jsxs)(`div`,{ref:t=>o.register(e.id,t),children:[(0,W.jsx)(Ax,{author:{label:l},turn:e}),(0,W.jsx)(HK,{turn:e})]},e.id))}),a.length>n&&(0,W.jsxs)(ba,{onClick:()=>r(n+RK),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function WK({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)(qK,{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 GK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(qK,{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)(ZK,{reference:n,row:r})]})}function KK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(qK,{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)(ZK,{reference:n,row:r})]})}function qK({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=JK(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>zK&&(0,W.jsx)(ba,{onClick:()=>f(!d),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function JK(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function YK({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)(QK,{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)(QK,{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 XK({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)(dG,{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 ZK({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,i=(e.rowKind===`span`?e.span.reasons: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)(dG,{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)(dG,{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`:aG(e.durationMs)})]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Aggregated`}),(0,W.jsx)(`dd`,{children:r})]}),i.length>0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Waiting on`}),(0,W.jsx)(`dd`,{children:i.map(SK).join(` and `)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Step`}),(0,W.jsx)(`dd`,{children:iq(n)??`None`})]})]}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,W.jsx)(QK,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function QK({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 $K(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 eq(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function tq(e){return e.rowKind===`event`?e.event.redirection:void 0}function nq(e){return e.rowKind===`event`?e.event.release:void 0}function rq(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function iq(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function aq(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function oq(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function sq(e,t){return JG(t===`llmlint`?GG:e)}function cq({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)(()=>oK(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)(ba,{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)(JH,{className:`node-view-state`,state:n.status}),(0,W.jsx)(yG,{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)(_q,{node:n}),(0,W.jsxs)(Au,{className:`node-tabs`,onValueChange:e=>{hG(e)&&l(e)},value:c,children:[(0,W.jsx)(Mu,{"aria-label":`Node details`,variant:`line`,children:Object.entries(mG).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:mq(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:vq(n.result?.detail)})]})})]}),(0,W.jsx)(Pu,{className:`node-tab-panel`,value:`criteria`,children:(0,W.jsx)(`pre`,{children:hq(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)(gq,{node:n})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Release`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(PG,{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)(xa,{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)(lq,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,W.jsxs)(qi,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Timeline unavailable`}),(0,W.jsx)(Yi,{children:i.message})]})})]})]})}function lq({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>eK(a,t.id),[a,t.id]),[s,c]=(0,U.useState)(()=>new Set),l=(0,U.useMemo)(()=>{if(i!==void 0)return uK(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,U.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,U.useMemo)(()=>tK(o.tree,u),[o.tree,u]),f=Pd((0,U.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>XG(o.items),[o.items]),g=(0,U.useMemo)(()=>$G(o.markers,o.items,i),[o.items,o.markers,i]),_=(0,U.useMemo)(()=>uq(o.items),[o.items]),v=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,_[0]),_[1]),y=i===void 0?void 0:lK(o.rows,i),b=e=>{n(e),f.scrollTo(e)};return(0,U.useEffect)(()=>{i!==void 0&&f.scrollTo(i)},[i,f]),(0,W.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,W.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,W.jsx)(ln,{axis:{origin:_[0]},cursor:v,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:h,lanes:o.lanes,markers:g,onExpandedChange:m,onSelect:e=>b(e.id),selectedId:i})}),(0,W.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:dq(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,W.jsx)(pq,{onOpen:b,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,W.jsx)(fq,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.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)})}),y!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(ba,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Yt,{})}),(0,W.jsx)(BK,{client:e,node:t,row:y,runId:r})]})]})}function uq(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 dq(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function fq({entry:e,onToggle:t}){let n=nK(e.hidden,e.group.kind);return(0,W.jsx)(`p`,{className:`transcript-collapsed`,children:(0,W.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function pq({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)(EG,{category:e.category}),e.displayKind]}),(0,W.jsx)(`strong`,{children:e.displayLabel}),(0,W.jsxs)(`span`,{className:`transcript-facts`,children:[(0,W.jsx)(dG,{at:e.startedAt}),e.durationMs!==null&&` · ${aG(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function mq(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??_z,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)&&KI(e))return!1;let n=bz(e.code,s);if(a.current.add(e[n]),yz(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=bz(e.code,s);yz(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 yz(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function bz(e,t){return t.includes(e)?`code`:`key`}var xz=()=>{let e=WR();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=NI(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 OI(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=kI(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Sz(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)Cz(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 Cz(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 wz(e,t){return Sz(e,t)}function Tz(e,t){return Sz(e,t)}function Ez(e,t){return{id:e,type:`select`,selected:t}}function Dz(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(Ez(a.id,e)))}return r}function Oz({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 kz(e){return{id:e.id,type:`remove`}}var Az=EI(`React Flow`,`https://reactflow.dev/`);function jz(e,t,n={}){return aL(e,t,{...n,onError:n.onError??Az})}var Mz=e=>eI(e),Nz=e=>$F(e);function Pz(e){return(0,U.forwardRef)(e)}var Fz=typeof window<`u`?U.useLayoutEffect:U.useEffect;function Iz(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>Lz(()=>n(e=>e+BigInt(1))));return Fz(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Lz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Rz=(0,U.createContext)(null);function zz({children:e}){let t=WR(),n=Iz((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=Oz({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=Iz((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(Oz({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,W.jsx)(Rz.Provider,{value:i,children:e})}function Bz(){let e=(0,U.useContext)(Rz);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Vz=e=>!!e.panZoom;function Hz(){let e=xz(),t=WR(),n=Bz(),r=UR(Vz),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=Mz(e)?e:n.get(e.id),a=i.parentId?RI(i.position,i.measured,i.parentId,n,r):i.position;return yI({...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&&Mz(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&&Nz(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 uI({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(kz);o?.(f),c(e)}if(m){let e=d.map(kz);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=wI(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=yI(s?r:a),l=CI(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=wI(e)?e:a(e);if(!r)return!1;let i=CI(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 rI(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??BI();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 Uz=e=>e.selected,Wz=typeof window<`u`?window:void 0;function Gz({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=WR(),{deleteElements:r}=Hz(),i=vz(e,{actInsideInputWithModifier:!1}),a=vz(t,{target:Wz});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Uz),edges:e.filter(Uz)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Kz(e){let t=WR();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=UI(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,VF.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 qz={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Jz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Yz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=KF.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=WR(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=UR(Jz,zR),E=vz(f),D=(0,U.useRef)();Kz(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=mR({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:qz,children:m})}var Xz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Zz(){let{userSelectionActive:e,userSelectionRect:t}=UR(Xz,zR);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 Qz=(e,t)=>n=>{n.target===t.current&&e?.(n)},$z=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function eB({isSelecting:e,selectionKeyPressed:t,selectionMode:n=qF.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),_=WR(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=UR($z,zR),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,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=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}=JI(n.nativeEvent,T.current),l=OI({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 L(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}=kI(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(aI(a,m,i,n===qF.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)}}zI(h,E.current)||c(Dz(a,E.current,!0)),zI(g,D.current)||l(Dz(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!i||!T.current)return;let[e,t]=hI(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(ee);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(ee)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,W.jsxs)(`div`,{className:rA([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:Qz(M,w),onContextMenu:Qz(N,w),onWheel:Qz(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}=JI(e.nativeEvent,T.current);A.current={x:o,y:c};let l=kI({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||=(ee(),!0),L(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?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:qz,children:[h,(0,W.jsx)(Zz,{})]})}function tB({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`,VF.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function nB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=WR(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=UL({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{tB({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 rB=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function iB(){let e=WR();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=rB(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=DI(t,i));let{position:a,positionAbsolute:s}=lI({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 aB=(0,U.createContext)(null),oB=aB.Provider;aB.Consumer;var sB=()=>(0,U.useContext)(aB),cB=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lB=(0,U.createContext)(null);function uB({children:e}){let t=UR(cB,zR);return(0,W.jsx)(lB.Provider,{value:t,children:e})}function dB(){let e=(0,U.useContext)(lB);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var fB={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},pB=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return fB;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===GF.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function mB({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=WR(),_=sB(),{connectOnClick:v,noPanClassName:y,rfId:b}=dB(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=UR(pB(_,m,e),zR);_||g.getState().onError?.(`010`,VF.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(jz(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=qI(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();$L.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:rA([`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=WI(t.target),h=n||c,{connection:v,isValid:y}=$L.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 hB=(0,U.memo)(Pz(mB));function gB({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[e?.label,(0,W.jsx)(hB,{type:`source`,position:n,isConnectable:t})]})}function _B({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(hB,{type:`target`,position:n,isConnectable:t}),e?.label,(0,W.jsx)(hB,{type:`source`,position:r,isConnectable:t})]})}function vB(){return null}function yB({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(hB,{type:`target`,position:n,isConnectable:t}),e?.label]})}var bB={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xB={input:gB,default:_B,output:yB,group:vB};function SB(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 CB=e=>{let{width:t,height:n,x:r,y:i}=iI(e.nodeLookup,{filter:e=>!!e.selected});return{width:TI(t)?t:null,height:TI(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 wB({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=WR(),{width:i,height:a,transformString:o,userSelectionActive:s}=UR(CB,zR),c=iB(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(nB({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:rA([`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(bB,e.key)&&(e.preventDefault(),c({direction:bB[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var TB=typeof window<`u`?window:void 0,EB=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function DB({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:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:ee}=UR(EB,zR),te=vz(l,{target:TB}),ne=vz(h,{target:TB}),re=ne||w,R=ne||b,ie=u&&re!==!0,ae=te||ee||ie;return Gz({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,W.jsx)(Yz,{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:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:ie,children:(0,W.jsxs)(eB,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:ie,children:[e,L&&(0,W.jsx)(wB,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}DB.displayName=`FlowRenderer`;var OB=(0,U.memo)(DB),kB=e=>t=>e?aI(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 AB(e){return UR((0,U.useCallback)(kB(e),[e]),zR)}var jB=e=>e.updateNodeInternals;function MB(){let e=UR(jB),[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 NB({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=WR(),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 PB({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}=UR(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},zR),S=y.type||`default`,C=g?.[S]||xB[S];C===void 0&&(v?.(`003`,VF.error003(S)),S=`default`,C=g?.default||xB.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=WR(),k=LI(y),A=NB({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=nB({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=iB();if(y.hidden)return null;let N=II(y),P=SB(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,ee=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)&&tB({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(KI(t.nativeEvent)||m)){if(UF.includes(t.key)&&T){let n=t.key===`Escape`;tB({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(bB,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:bB[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(aI(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:rA([`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:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:ee,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${qR}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,W.jsx)(oB,{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 FB=(0,U.memo)(PB),IB=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function LB(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=UR(IB,zR),a=AB(e.onlyRenderVisibleElements),o=MB();return(0,W.jsx)(`div`,{className:`react-flow__nodes`,style:qz,children:a.map(a=>(0,W.jsx)(FB,{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))})}LB.displayName=`NodeRenderer`;var RB=(0,U.memo)(LB);function zB(e){return UR((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&&nL({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),zR)}var BB=({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`}),VB=({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`}),HB={[XF.Arrow]:BB,[XF.ArrowClosed]:VB};function UB(e){let t=WR();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(HB,e)?HB[e]:(t.getState().onError?.(`009`,VF.error009(e)),null),[e])}var WB=({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=UB(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},GB=({defaultColor:e,rfId:t})=>{let n=UR(e=>e.edges),r=UR(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>yL(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)(WB,{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};GB.displayName=`MarkerDefinitions`;var KB=(0,U.memo)(GB);function qB({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=rA([`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}qB.displayName=`EdgeText`;var JB=(0,U.memo)(qB);function YB({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:rA([`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&&TI(t)&&TI(n)?(0,W.jsx)(JB,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function XB({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function ZB({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=XB({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=XB({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=XI({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 QB(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]=ZB({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,W.jsx)(YB,{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 $B=QB({isInternal:!1}),eV=QB({isInternal:!0});$B.displayName=`SimpleBezierEdge`,eV.displayName=`SimpleBezierEdgeInternal`;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,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=fL({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,W.jsx)(YB,{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 nV=tV({isInternal:!1}),rV=tV({isInternal:!0});nV.displayName=`SmoothStepEdge`,rV.displayName=`SmoothStepEdgeInternal`;function iV(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,W.jsx)(nV,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var aV=iV({isInternal:!1}),oV=iV({isInternal:!0});aV.displayName=`StepEdge`,oV.displayName=`StepEdgeInternal`;function sV(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]=oL({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,W.jsx)(YB,{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 cV=sV({isInternal:!1}),lV=sV({isInternal:!0});cV.displayName=`StraightEdge`,lV.displayName=`StraightEdgeInternal`;function uV(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]=$I({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,W.jsx)(YB,{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 dV=uV({isInternal:!1}),fV=uV({isInternal:!0});dV.displayName=`BezierEdge`,fV.displayName=`BezierEdgeInternal`;var pV={default:fV,straight:lV,step:oV,smoothstep:rV,simplebezier:eV},mV={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},hV=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,gV=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,_V=`react-flow__edgeupdater`;function vV({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:rA([_V,`${_V}-${s}`]),cx:hV(t,r,e),cy:gV(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function yV({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=WR(),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`;$L.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)(vV,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,W.jsx)(vV,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function bV({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=UR(t=>t.edgeLookup.get(e)),b=UR(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||pV[x];S===void 0&&(_?.(`011`,VF.error011(x)),x=`default`,S=h?.default||pV.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=WR(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee}=UR((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return mV;let i=mL({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=tL({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||mV,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),zR),te=(0,U.useMemo)(()=>y.markerStart?`url('#${vL(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${vL(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===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,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,W.jsx)(`svg`,{style:{zIndex:M},children:(0,W.jsxs)(`g`,{className:rA([`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:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&UF.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?`${JR}-${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:F,targetY:I,sourcePosition:L,targetPosition:ee,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)(yV,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,setUpdateHover:O,setReconnecting:A})]})})}var xV=(0,U.memo)(bV),SV=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function CV({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}=UR(SV,zR),b=zB(t);return(0,W.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,W.jsx)(KB,{defaultColor:e,rfId:n}),b.map(e=>(0,W.jsx)(xV,{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))]})}CV.displayName=`EdgeRenderer`;var wV=(0,U.memo)(CV),TV=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function EV({children:e}){let t=WR(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return Fz(()=>{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=TV(r)))};return r(),t.subscribe(r)},[t]),(0,W.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:TV(r)},children:e})}function DV(e){let t=Hz(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var OV=e=>e.panZoom?.syncViewport;function kV(e){let t=UR(OV),n=WR();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function AV(e){return e.connection.inProgress?{...e.connection,to:OI(e.connection.to,e.transform)}:{...e.connection}}function jV(e){return e?t=>e(AV(t)):AV}function MV(e){return UR(jV(e),zR)}var NV=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function PV({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=UR(NV,zR);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:rA([`react-flow__connection`,QF(s)]),children:(0,W.jsx)(FV,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var FV=({style:e,type:t=YF.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}=MV();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:QF(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 YF.Bezier:[m]=$I(h);break;case YF.SimpleBezier:[m]=ZB(h);break;case YF.Step:[m]=fL({...h,borderRadius:0});break;case YF.SmoothStep:[m]=fL(h);break;default:[m]=oL(h)}return(0,W.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};FV.displayName=`ConnectionLine`;var IV={};function LV(e=IV){(0,U.useRef)(e),WR(),(0,U.useEffect)(()=>{},[e])}function RV(){WR(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function zV({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:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:ee,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:z,onViewportChange:we,nodesDraggable:Te}){return LV(e),LV(t),RV(),DV(n),kV(z),(0,W.jsx)(OB,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,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:ee,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:we,isControlledViewport:!!z,children:(0,W.jsxs)(EV,{children:[(0,W.jsx)(wV,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,W.jsx)(PV,{style:h,type:m,component:g,containerStyle:_}),(0,W.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,W.jsx)(RB,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Te}),(0,W.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}zV.displayName=`GraphView`;var BV=(0,U.memo)(zV),VV=EI(`React Flow`,`https://reactflow.dev/`),HV=({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??HF;LL(h,g,_);let{nodesInitialized:x}=OL(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=NI(iI(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:HF,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:GF.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:{...JF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:VV,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:WF,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},UV=({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})=>RR((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 cI({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...HV({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}=OL(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();LL(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}=PL(e,n,r,i,a,o,l);d&&(TL(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=gL(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=NL(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(wz(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(Tz(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=>Ez(e,!0)));return}i(Dz(r,new Set([...e]),!0)),a(Dz(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>Ez(e,!0)));return}a(Dz(n,new Set([...e]))),i(Dz(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(Ez(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(Ez(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,Ez(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Ez(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]||(OL(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 FL({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:{...JF}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...HV()})}},Object.is);function WV({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)(()=>UV({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)(VR,{value:m,children:(0,W.jsx)(zz,{children:(0,W.jsx)(uB,{children:p})})})}function GV({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)(BR)?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(WV,{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 KV={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function qV({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:F,onBeforeDelete:I,connectionMode:L,connectionLineType:ee=YF.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=qF.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=PI()?`Meta`:`Control`,zoomActivationKeyCode:le=PI()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=lz,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=uz,minZoom:Ce=.5,maxZoom:z=2,translateExtent:we=HF,preventScrolling:Te=!0,nodeExtent:Ee,defaultMarkerColor:De=`#b1b1b7`,zoomOnScroll:Oe=!0,zoomOnPinch:ke=!0,panOnScroll:Ae=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Me=KF.Free,zoomOnDoubleClick:Ne=!0,panOnDrag:Pe=!0,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:V,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:H,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=gz(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,...KV},ref:jt,className:rA([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,W.jsxs)(GV,{nodes:e,edges:t,width:Ct,height:wt,fitView:nt,fitViewOptions:rt,minZoom:Ce,maxZoom:z,nodeOrigin:ve,nodeExtent:Ee,zIndexMode:kt,children:[(0,W.jsx)(mz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Ce,maxZoom:z,nodeExtent:Ee,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:ue,snapGrid:de,connectionMode:L,translateExtent:we,connectOnClick:it,defaultEdgeOptions:ot,fitView:nt,fitViewOptions:rt,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:tt,nodeOrigin:ve,rfId:Mt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:pe,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:I,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,W.jsx)(BV,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:ee,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:R,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:we,minZoom:Ce,maxZoom:z,preventScrolling:Te,zoomOnScroll:Oe,zoomOnPinch:ke,zoomOnDoubleClick:Ne,panOnScroll:Ae,panOnScrollSpeed:je,panOnScrollMode:Me,panOnDrag:Pe,autoPanOnSelection:ft,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:De,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Mt,disableKeyboardA11y:lt,nodeExtent:Ee,viewport:xt,onViewportChange:St,nodesDraggable:me}),(0,W.jsx)(cz,{onSelectionChange:k}),V,(0,W.jsx)(nz,{proOptions:H,position:at}),(0,W.jsx)($R,{rfId:Mt,disableKeyboardA11y:lt})]})})}var JV=Pz(qV);VF.error014();function YV({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:rA([`react-flow__background-pattern`,n,r])})}function XV({radius:e,className:t}){return(0,W.jsx)(`circle`,{cx:e,cy:e,r:e,className:rA([`react-flow__background-pattern`,`dots`,t])})}var ZV;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(ZV||={});var QV={[ZV.Dots]:1,[ZV.Lines]:1,[ZV.Cross]:6},$V=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function eH({id:e,variant:t=ZV.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}=UR($V,zR),m=r||QV[t],h=t===ZV.Dots,g=t===ZV.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:rA([`react-flow__background`,l]),style:{...c,...qz,"--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)(XV,{radius:y/2,className:u}):(0,W.jsx)(YV,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,W.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}eH.displayName=`Background`;var tH=(0,U.memo)(eH);function nH(){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 rH(){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 iH(){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 aH(){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 oH(){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 sH({children:e,className:t,...n}){return(0,W.jsx)(`button`,{type:`button`,className:rA([`react-flow__controls-button`,t]),...n,children:e})}var cH=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lH({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=WR(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=UR(cH,zR),{zoomIn:y,zoomOut:b,fitView:x}=Hz();return(0,W.jsxs)(ez,{className:rA([`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)(sH,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,W.jsx)(nH,{})}),(0,W.jsx)(sH,{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)(rH,{})})]}),n&&(0,W.jsx)(sH,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,W.jsx)(iH,{})}),r&&(0,W.jsx)(sH,{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)(oH,{}):(0,W.jsx)(aH,{})}),u]})}lH.displayName=`Controls`;var uH=(0,U.memo)(lH);function dH({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:rA([`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 fH=(0,U.memo)(dH),pH=e=>e.nodes.map(e=>e.id),mH=e=>e instanceof Function?e:()=>e;function hH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=fH,onClick:o}){let s=UR(pH,zR),c=mH(t),l=mH(e),u=mH(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsx)(_H,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function gH({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}=UR(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}=II(r);return{node:r,x:i,y:a,width:o,height:s}},zR);return!l||l.hidden||!LI(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 _H=(0,U.memo)(gH),vH=(0,U.memo)(hH),yH=200,bH=150,xH=e=>!e.hidden,SH=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?xI(iI(e.nodeLookup,{filter:xH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},CH=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wH=(e,t)=>CH(e.viewBB,t.viewBB)&&CH(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,TH=`react-flow__minimap-desc`;function EH({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=WR(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=UR(SH,wH),j=e?.width??yH,M=e?.height??bH,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,ee=b*F,te=C.x-(I-C.width)/2-ee,ne=C.y-(L-C.height)/2-ee,re=I+ee*2,R=L+ee*2,ie=`${TH}-${T}`,ae=(0,U.useRef)(0),oe=(0,U.useRef)();ae.current=F,(0,U.useEffect)(()=>{if(S.current&&E)return oe.current=eR({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,U.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,W.jsx)(ez,{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*F: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:rA([`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":ie,ref:S,onClick:se,children:[le&&(0,W.jsx)(`title`,{id:ie,children:le}),(0,W.jsx)(vH,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,W.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-ee},${ne-ee}h${re+ee*2}v${R+ee*2}h${-re-ee*2}z
54
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}EH.displayName=`MiniMap`,(0,U.memo)(EH);var DH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,OH={[hR.Line]:`right`,[hR.Handle]:`bottom-right`};function kH({nodeId:e,position:t,variant:n=hR.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=sB(),y=typeof e==`string`?e:v,b=WR(),x=(0,U.useRef)(null),S=n===hR.Handle,C=UR((0,U.useCallback)(DH(S&&p),[S,p]),zR),w=(0,U.useRef)(null),T=t??OH[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=ER({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=NL([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...RI({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:rA([`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)(kH);function AH(e){return e.graph??void 0}function jH(e){let t=AH(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=BH(r,`kind`)===`human`?`human`:VH(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:BH(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 MH(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function NH(e){let t=MH(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${HH(e.launch_id)}`:`${t} session · ${HH(e.session_key)}`}function PH(e){if(e.blockers.length>0&&IH.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(LH.has(e.status))return FH(e)??`${e.status}, with no reason recorded`}function FH(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var IH=new Set([`blocked`,`skipped`,`waiting`]),LH=new Set([`failed`,`not-completed`,`cancelled`]);function RH(e){let t=Jk,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 zH(e){return LH.has(e)||e===`blocked`||e===`skipped`}function BH(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function VH(e){return`repo`in e||`steps`in e}function HH(e){return e.length>12?`${e.slice(0,8)}…`:e}function UH({data:e}){let t=e.style===`success`?yt:e.style===`danger`||e.style===`muted`?Yt:e.style===`active`?Ct:Et;return(0,W.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:H(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,W.jsx)(hB,{type:`target`,position:$.Left}),(0,W.jsxs)(`div`,{className:`node-heading`,children:[(0,W.jsx)(va,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,W.jsx)(t,{className:H(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)(hB,{type:`source`,position:$.Right})]})}function WH({data:e,id:t,markerEnd:n,style:r}){return(0,W.jsx)(YB,{id:t,path:GH(e?.points??[]),markerEnd:n,style:r})}function GH(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var KH={dagNode:UH},qH={routed:WH};function JH({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)zH(n.status)&&t.set(n.id,PH(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=nA({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)(JV,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:KH,edgeTypes:qH,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)(tH,{color:`var(--border)`,gap:22}),(0,W.jsx)(uH,{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 YH({className:e,state:t}){let n=XH(t);return(0,W.jsxs)(va,{className:H(`gap-1.5 tracking-[.03em] uppercase`,n&&QH[n],e),variant:`outline`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function XH(e){return iU[e]}var ZH=e=>{let t=XH(e);return H(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:$H[t])},QH={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},$H={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},eU=`success`,tU=`destructive`,nU=`warning`,rU={blocked:nU,cancelled:tU,done:eU,failed:tU,"not-completed":tU,parked:void 0,pending:void 0,running:`info`,skipped:nU,unknown:void 0,waiting:void 0},iU={...rU,complete:rU.done,settled:rU.done,active:rU.running};function aU({runs:e,selectedRunId:t,liveRunIds:n,onSelect:r,hasMore:i,loadingMore:a,onLoadMore:o}){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&&o()},children:(0,W.jsx)(_l,{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)(Al,{className:`my-[22px]`}),(0,W.jsx)(`div`,{className:`run-list`,children:e.map(e=>{let i=t===e.run_id,a=n.has(e.run_id),o=RH(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:[a?(0,W.jsxs)(xd,{children:[(0,W.jsx)(Sd,{asChild:!0,children:(0,W.jsx)(`span`,{"aria-label":`Live`,className:H(`run-dot`,ZH(e.state)),"data-live":`true`,role:`img`})}),(0,W.jsx)(Cd,{children:`Live`})]}):(0,W.jsx)(`span`,{"aria-label":`Historical`,className:H(`run-dot`,ZH(e.state)),role:`img`}),(0,W.jsx)(`span`,{children:e.run_id})]}),(0,W.jsx)(xt,{"aria-hidden":`true`,size:14}),(0,W.jsx)(`span`,{className:`run-link-counts`,title:o,children:[e.state,o].filter(Boolean).join(` · `)}),(0,W.jsxs)(`span`,{className:`run-link-tag`,children:[(0,W.jsx)(vt,{"aria-hidden":`true`,size:11}),NH(e.launch)]})]},e.run_id)})}),i&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{className:`sr-only`,onClick:()=>void o(),type:`button`,children:`Load more runs`}),(0,W.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:a?`Loading more runs…`:``})]})]})})})}function oU(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)(),[v,y]=(0,U.useState)(0),[b,x]=(0,U.useState)(!1),S=i===void 0?void 0:i.runs.some(({run_id:e})=>e===t)?t:i.runs.at(0)?.run_id,C=n===void 0?void 0:n.nodeId??`run`,w=(0,U.useRef)(S);(0,U.useEffect)(()=>{w.current=S},[S]);let T=(0,U.useRef)(void 0),E=(0,U.useRef)(void 0),D=(0,U.useRef)(!1),O=(0,U.useCallback)(()=>{h(void 0),_(void 0)},[]),k=(0,U.useCallback)(async()=>{a(await e.listRuns(!0))},[e]),A=(0,U.useRef)(void 0),j=(0,U.useCallback)(async()=>{let t=i?.next_cursor;if(!(t===void 0||A.current===t)){A.current=t,x(!0);try{let n=await e.listRuns(!0,t);a(e=>e===void 0?n:{...n,runs:[...e.runs,...n.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),O()}catch(e){h(uU(e))}finally{A.current=void 0,x(!1)}}},[e,i,O]),M=(0,U.useCallback)(async t=>{let n=await e.selectRuns([t]);a(e=>{if(e===void 0)return e;if(n.missing?.includes(t)===!0)return{...e,runs:e.runs.filter(e=>e.run_id!==t)};let r=n.runs.find(e=>e.run_id===t);return r===void 0?e:{...e,runs:e.runs.some(e=>e.run_id===t)?e.runs.map(e=>e.run_id===t?r:e):[r,...e.runs]}})},[e]),N=(0,U.useCallback)(async()=>{try{await k(),O()}catch(e){h(uU(e))}finally{l(!1)}},[k,O]),P=(0,U.useCallback)(async()=>{await N(),y(e=>e+1)},[N]);(0,U.useEffect)(()=>{if(S===void 0){s(void 0),E.current=void 0;return}let t=e=>e.runId===S&&e.timelineScope===C&&e.filter===r,i=cU(S,C,r);T.current=i,s(e=>{if(e!==void 0&&t(e))return e;let n=e?.runId===S&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:S,filter:r,timelineScope:C,...n===void 0?{}:{detail:n}}});let a=e=>{s(n=>n!==void 0&&t(n)?e(n):n)},o=e=>{T.current===i&&e()},c=E.current;if(c?.key===i){c.again=!0;return}let l=()=>{E.current={key:i,again:!1};let t=()=>{let e=E.current;if(e?.key===i){if(e.again){l();return}E.current=void 0}},s=e.getRun(S,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),o(O)}).catch(sU).catch(e=>{o(()=>h(uU(e)))}),c=n===void 0?Promise.resolve():e.getTimeline(S,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(sU).catch(e=>a(t=>({...t,timelineError:uU(e)})));Promise.all([s,c]).then(t,t)};l()},[e,S,v,n?.nodeId,C,r]),(0,U.useEffect)(()=>{N();let t=e.subscribe({onEvent:e=>{if(d(new Date().toISOString()),_(void 0),e.event===`snapshot`){a(XO(e.data)),D.current&&y(e=>e+1),D.current=!0;return}let t=lU(e);t!==void 0&&(M(t).catch(e=>h(uU(e))),t===w.current&&y(e=>e+1))},onError:e=>{_(uU(e))}});return()=>t.close()},[e,M,N]),(0,U.useEffect)(()=>{if(S===void 0){p([]);return}let t=e.subscribe({runId:S,filter:r,onEvent:e=>{if(d(new Date().toISOString()),_(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;p(YO.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&y(e=>e+1)}},onError:e=>_(uU(e))});return()=>t.close()},[e,S,r]);let F=o!==void 0&&o.runId===S&&o.filter===r?o:void 0;return(0,U.useMemo)(()=>({list:i,runId:S,detail:F?.detail,timeline:F?.timeline,timelineError:F?.timelineError,loading:c,lastUpdated:u,activity:f,error:m??g,refresh:P,loadMore:j,hasMore:i?.next_cursor!==void 0,loadingMore:b}),[i,S,F,c,u,f,m,g,P,j,b])}function sU(e){if(!(e instanceof ZO&&e.code===`run_not_found`))throw e}function cU(e,t,n){return[e,t??``,n??``].join(`\0`)}function lU(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 uU(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var dU=365.2425,fU=6048e5,pU=864e5,mU=6e4,hU=36e5,gU=1e3,_U=525600,vU=43200,yU=1440,bU=3600*24;bU*7,bU*dU/12*3;var xU=Symbol.for(`constructDateFrom`);function SU(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&xU in e?e[xU](t):e instanceof Date?new e.constructor(t):new Date(t)}function CU(e,t){return SU(t||e,e)}var wU={};function TU(){return wU}function EU(e,t){let n=TU(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=CU(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 DU(e,t){return EU(e,{...t,weekStartsOn:1})}function OU(e,t){let n=CU(e,t?.in),r=n.getFullYear(),i=SU(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=DU(i),o=SU(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=DU(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function kU(e){let t=CU(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 AU(e,...t){let n=SU.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function jU(e,t){let n=CU(e,t?.in);return n.setHours(0,0,0,0),n}function MU(e,t,n){let[r,i]=AU(n?.in,e,t),a=jU(r),o=jU(i),s=+a-kU(a),c=+o-kU(o);return Math.round((s-c)/pU)}function NU(e,t){let n=OU(e,t),r=SU(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),DU(r)}function PU(e,t){let n=CU(e)-+CU(t);return n<0?-1:n>0?1:n}function FU(e){return SU(e,Date.now())}function IU(e,t,n){let[r,i]=AU(n?.in,e,t);return+jU(r)==+jU(i)}function LU(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function RU(e){return!(!LU(e)&&typeof e!=`number`||isNaN(+CU(e)))}function zU(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function BU(e,t){let n=CU(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var VU={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`}},HU=(e,t,n)=>{let r,i=VU[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 UU(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var WU={date:UU({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:UU({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:UU({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},GU={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},KU=(e,t,n,r)=>GU[e];function qU(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 JU={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:qU({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:qU({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:qU({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:qU({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:qU({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 YU(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)?ZU(s,e=>e.test(o)):XU(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 XU(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ZU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function QU(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 $U={code:`en-US`,formatDistance:HU,formatLong:WU,formatRelative:KU,localize:JU,match:{ordinalNumber:QU({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:YU({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:YU({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:YU({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:YU({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:YU({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 eW(e,t){let n=CU(e,t?.in);return MU(n,BU(n))+1}function tW(e,t){let n=CU(e,t?.in),r=DU(n)-+NU(n);return Math.round(r/fU)+1}function nW(e,t){let n=CU(e,t?.in),r=n.getFullYear(),i=TU(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=SU(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=EU(o,t),c=SU(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=EU(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function rW(e,t){let n=TU(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=nW(e,t),a=SU(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),EU(a,t)}function iW(e,t){let n=CU(e,t?.in),r=EU(n,t)-+rW(n,t);return Math.round(r/fU)+1}function aW(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var oW={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return aW(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):aW(n+1,2)},d(e,t){return aW(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 aW(e.getHours()%12||12,t.length)},H(e,t){return aW(e.getHours(),t.length)},m(e,t){return aW(e.getMinutes(),t.length)},s(e,t){return aW(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return aW(Math.trunc(r*10**(n-3)),t.length)}},sW={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},cW={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 oW.y(e,t)},Y:function(e,t,n,r){let i=nW(e,r),a=i>0?i:1-i;return t===`YY`?aW(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):aW(a,t.length)},R:function(e,t){return aW(OU(e),t.length)},u:function(e,t){return aW(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 aW(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 aW(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 oW.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 aW(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=iW(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):aW(i,t.length)},I:function(e,t,n){let r=tW(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):aW(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):oW.d(e,t)},D:function(e,t,n){let r=eW(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):aW(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 aW(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 aW(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 aW(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?sW.noon:r===0?sW.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?sW.evening:r>=12?sW.afternoon:r>=4?sW.morning:sW.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 oW.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):oW.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):aW(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):aW(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):oW.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):oW.s(e,t)},S:function(e,t){return oW.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return uW(r);case`XXXX`:case`XX`:return dW(r);default:return dW(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return uW(r);case`xxxx`:case`xx`:return dW(r);default:return dW(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+lW(r,`:`);default:return`GMT`+dW(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+lW(r,`:`);default:return`GMT`+dW(r,`:`)}},t:function(e,t,n){return aW(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return aW(+e,t.length)}};function lW(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+aW(a,2)}function uW(e,t){return e%60==0?(e>0?`-`:`+`)+aW(Math.abs(e)/60,2):dW(e,t)}function dW(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=aW(Math.trunc(r/60),2),a=aW(r%60,2);return n+i+t+a}var fW=(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`})}},pW=(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`})}},mW={p:pW,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return fW(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}}`,fW(r,t)).replace(`{{time}}`,pW(i,t))}},hW=/^D+$/,gW=/^Y+$/,_W=[`D`,`DD`,`YY`,`YYYY`];function vW(e){return hW.test(e)}function yW(e){return gW.test(e)}function bW(e,t,n){let r=xW(e,t,n);if(console.warn(r),_W.includes(e))throw RangeError(r)}function xW(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 SW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,CW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,wW=/^'([^]*?)'?$/,TW=/''/g,EW=/[a-zA-Z]/;function DW(e,t,n){let r=TU(),i=n?.locale??r.locale??$U,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=CU(e,n?.in);if(!RU(s))throw RangeError(`Invalid time value`);let c=t.match(CW).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=mW[t];return n(e,i.formatLong)}return e}).join(``).match(SW).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:OW(e)};if(cW[t])return{isToken:!0,value:e};if(t.match(EW))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&&yW(a)||!n?.useAdditionalDayOfYearTokens&&vW(a))&&bW(a,t,String(e));let o=cW[a[0]];return o(s,a,i.localize,l)}).join(``)}function OW(e){let t=e.match(wW);return t?t[1].replace(TW,`'`):e}function kW(e,t,n){let r=TU(),i=n?.locale??r.locale??$U,a=PU(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=AU(n?.in,...a>0?[t,e]:[e,t]),l=zU(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/mU,f=(u-(kU(c)-kU(s)))/mU,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/yU);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/vU);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/_U);return i.formatDistance(`xYears`,e,o)}}function AW(e,t){return kW(e,FU(e),t)}function jW(e){return Math.trunc(e*hU)}function MW(e,t,n){let[r,i]=AU(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function NW(e,t){return MW(SU(t?.in||e,e),FU(t?.in||e))}function PW(e,t){return IU(SU(t?.in||e,e),FU(t?.in||e))}function FW(e){let t=e/hU;return Math.trunc(t)}function IW(e){let t=e/mU;return Math.trunc(t)}function LW(e){let t=e/gU;return Math.trunc(t)}function RW(e){return Math.trunc(e*mU)}function zW(e,t){let n=()=>SU(t?.in,NaN),r=t?.additionalDigits??2,i=WW(e),a;if(i.date){let e=GW(i.date,r);a=KW(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=JW(i.time),isNaN(s)))return n();if(i.timezone){if(c=XW(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=CU(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return CU(o+s+c,t?.in)}var BW={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},VW=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,HW=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,UW=/^([+-])(\d{2})(?::?(\d{2}))?$/;function WW(e){let t={},n=e.split(BW.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],BW.timeZoneDelimiter.test(t.date)&&(t.date=e.split(BW.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=BW.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function GW(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 KW(e,t){if(t===null)return new Date(NaN);let n=e.match(VW);if(!n)return new Date(NaN);let r=!!n[4],i=qW(n[1]),a=qW(n[2])-1,o=qW(n[3]),s=qW(n[4]),c=qW(n[5])-1;if(r)return nG(t,s,c)?ZW(t,s,c):new Date(NaN);{let e=new Date(0);return!eG(t,a,o)||!tG(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function qW(e){return e?parseInt(e):1}function JW(e){let t=e.match(HW);if(!t)return NaN;let n=YW(t[1]),r=YW(t[2]),i=YW(t[3]);return rG(n,r,i)?n*hU+r*mU+i*1e3:NaN}function YW(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function XW(e){if(e===`Z`)return 0;let t=e.match(UW);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return iG(r,i)?n*(r*hU+i*mU):NaN}function ZW(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 QW=[31,null,31,30,31,30,31,31,30,31,30,31];function $W(e){return e%400==0||e%4==0&&e%100!=0}function eG(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(QW[t]||($W(e)?29:28))}function tG(e,t){return t>=1&&t<=($W(e)?366:365)}function nG(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function rG(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function iG(e,t){return t>=0&&t<=59}function aG(e){return e*gU}function oG(e){let t=Math.max(0,Math.round(e));if(t<aG(1))return`${t}ms`;let n=FW(t),r=IW(t-jW(n)),i=LW(t-jW(n)-RW(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function sG(e){return oG(aG(e))}function cG(e){let t=zW(e);return RU(t)?t:void 0}function lG(e){let t=cG(e);return t===void 0?e:PW(t)?DW(t,`HH:mm:ss`):NW(t)?DW(t,`MMM d, HH:mm:ss`):DW(t,`MMM d yyyy, HH:mm:ss`)}function uG(e){let t=cG(e);return t===void 0?e:DW(t,`PPpp zzzz`)}function dG(e){let t=cG(e);return t===void 0?e:AW(t,{addSuffix:!0})}function fG({at:e,className:t,relative:n=!1}){let r=cG(e);return r===void 0?(0,W.jsx)(`span`,{className:t,children:e}):(0,W.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:uG(e),children:n?dG(e):lG(e)})}var pG={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:PD.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:PD.detailed}};function mG(e){return e!==null&&Object.hasOwn(pG,e)}var hG={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,pr:`PR`,checks:`Checks`};function gG(e){return e!==null&&Object.hasOwn(hG,e)}function _G(){let e=(0,U.useSyncExternalStore)(vG,yG,yG),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=mG(s)?s:`activity`,l=gG(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 vG(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function yG(){return window.location.search}function bG({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)(va,{"aria-label":`${t}: ${n}`,className:H(`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]})}function xG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var SG=[[`recovery`,[`retry`,`retried`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`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`]]],CG={"completion-requested":`lifecycle`,"command-accepted":`planning`,"body-not-drafted":`publication`,"criterion-checked":`verification`};function wG(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function TG(e){let t=CG[e];if(t!==void 0)return t;let n=wG(e);return SG.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var EG={recovery:Vt,failure:Kt,human:qt,planning:Tt,contention:jt,verification:Wt,publication:At,repository:kt,session:Lt,lifecycle:Rt,activity:wt};function DG({category:e,className:t=`size-3`}){let n=EG[e];return(0,W.jsx)(n,{"aria-hidden":`true`,className:t})}function OG(e){return e===`human-step`?`human step`:e}function kG(e){return e.style===`human-step`}function AG(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 jG(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function MG(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 NG(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function PG({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:OG(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`,jG(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,MG(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:[kG(e)?(0,W.jsxs)(qi,{children:[(0,W.jsx)(qt,{}),(0,W.jsxs)(Ji,{children:[`Waiting on a person · `,NG(e)]}),(0,W.jsx)(Yi,{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 · `,NG(e)]}),(0,W.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:AG(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 FG({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:OG(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function IG(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:oG(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`,...e.status?{status:e.status}:{}}}function LG({row:e}){let t=IG(e);return(0,W.jsxs)(`header`,{className:`detail-title`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(va,{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)(fG,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,W.jsx)(va,{variant:`secondary`,children:t.status})]})}function RG(e){let t=IG(e);return[t.kind,t.label,lG(t.startedAt),xG(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function zG({row:e}){return(0,W.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":RG(e),children:(0,W.jsx)(DG,{category:e.category})})}var BG=`data-timeline-reading`;function VG(e){let t=e.closest(`[${BG}]`)??e.closest(`button`)?.querySelector(`[${BG}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(BG)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var HG={rows:[],total:0},UG={queued:`Queued`,dispatch:`Dispatch`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},WG=`idle`,GG=new Set([...Object.keys(UG),WG]),KG=`member:`;function qG(e){return GG.has(e)?`${KG}${e}`:e}var JG=Object.entries(UG).map(([e,t])=>({id:e,label:t}));function YG(e){let t=e?.spans??[],n=[];for(let e of t){let t=e.agent_role;t!==void 0&&!n.includes(t)&&n.push(t)}let r=t.some(e=>vK(e)===`dispatch`),[i,...a]=JG;return[...i===void 0?[]:[i],...n.map(e=>({id:qG(e),label:e})),...a.filter(({id:e})=>r||e!==`dispatch`)]}var XG={run:null,node:null,step:null,dispatch:`dispatch`,verification:`verification`,publication:`publication`,"pr-drafting":`dispatch`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`};function ZG(e){return e===`agent`}function QG(e,t){return e===void 0?t===void 0?UG.dispatch:$G(t):FK(t)&&t!==e?`${e} · ${t}`:e}function $G(e){return e===`llmlint`?`Lint`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}var eK={"lock-wait":`Lock waits`};function tK(e,t=JG){let n=[...e].sort((e,t)=>e.start-t.start),r=n.at(0)?.start??0,i=Math.max(r+1,...n.map(e=>e.end??e.start)),a=new Set([n.at(0),n.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)),o=(i-r)*.02,s=[];for(let e of n){let n=Math.max(e.end??e.start,e.start+o),r=s.findLast(t=>{let r=Math.max(t.end??t.start,t.start+o);return e.start<=r&&t.start<=n});r===void 0||a.has(e.id)?s.push(e):rK(e,t)<rK(r,t)?a.has(r.id)?s.push(e):s[s.indexOf(r)]=e:nK(e,r,o)||s.push(e)}return s}function nK(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function rK(e,t){let n=e.laneId??``,r=t.findIndex(({id:e})=>e===n);return r<0?t.length:r}function iK(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 aK(e,t){let n=uK(e,t).rows,r=cK(n),i=cK(n,!1).flatMap(e=>{let t=lK(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}]}),a=r.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)(zG,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:YG(e),rows:r,tree:n}}function oK(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function sK(e,t){return`${e} more ${t} events`}function cK(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 lK(e){return e.rowKind===`event`?null:e.role===void 0?XG[e.rowKind===`span`?e.span.kind:e.kind]??null:qG(e.role)}function uK(e,t){if(e===void 0)return HG;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=LK(e.spans,new Set,t);return n.length===0?HG:{rows:OK(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=OK(PK(NK([...o===void 0?[]:hK(o,i),...a.filter(e=>e!==o).map(e=>gK(e,i)),...LK(e.spans,r,t)].sort(zK))));return{span:o,rows:s,total:RK(s)}}function dK(e){return gK(e,new Map)}function fK(e){return DK(e)}function pK(e,t){return mK(e,t).at(-1)}function mK(e,t){for(let n of e){if(n.id===t)return[n];let e=mK(n.children,t);if(e.length>0)return[n,...e]}return[]}function hK(e,t){return[...(t.get(e.id)??[]).map(e=>gK(e,t)),...e.events.map(DK)].sort(zK)}function gK(e,t){let n=_K(e),r=e.kind===`dispatch`?e.transport_role:void 0;return{rowKind:`span`,span:e,id:e.id,kind:e.kind,...n===void 0?{}:{role:n},...r===void 0?{}:{transport:r},label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??BK(e.started_at,e.ended_at),children:OK(hK(e,t)),displayLabel:MK(e,n,r),displayKind:kK(e,n,r),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function _K(e){return e.kind===`dispatch`?e.agent_role:void 0}function vK(e){return e.agent_role===void 0?XG[e.kind===`rollup`?e.label:e.kind]??null:qG(e.agent_role)}function yK(e,t=[]){let n=t.find(({id:t})=>t===e);return n===void 0?UG[e]??(e.startsWith(KG)?e.slice(7):e):n.label}function bK(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var xK=`Redirection`;function SK(e){if(e.surface===void 0)return;let t=[e.surface.kind,e.surface.message].filter(e=>e!==void 0);return t.length===0?void 0:t.join(`: `)}var CK=`Surface`,wK=`Blocking surface`;function TK(e){return e.kind.startsWith(`edit-`)?e.author:void 0}function EK(e,t){let n=TK(t);return n===void 0?e:`${e} · by ${n}`}function DK(e){let t=bK(e),n=SK(e),r=t===void 0?e.surface===void 0?`Event`:e.surface.blocking===!0?wK:CK:xK;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:EK(t??n??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),e),displayKind:r,category:TG(e.kind)}}function OK(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&&IK(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||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:BK(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind}),n=i}return t}function kK(e,t,n){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return eK[e.label]??e.label;if(e.kind===`dispatch`)return QG(t,n);let r=XG[e.kind];return r===null?e.kind:yK(r)}function AK(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function jK(e){return e.map(AK).join(` and `)}function MK(e,t,n){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${jK(e.reasons??[])}`.trim();let r=kK(e,t,n);return e.kind===`rollup`?`${r}: ${e.count??0} recorded`:!e.label||e.label===r?r:e.kind===`dispatch`?`${r} (${e.label})`:`${r}: ${e.label}`}function NK(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=NK(e.children);return!ZG(e.transport)||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function PK(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(ZG(a.transport)){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(FK(a.transport)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function FK(e){return e===`judge`||e===`llmlint`}function IK(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind}function LK(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(DK)}function RK(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+RK(t.children),0)}function zK(e,t){return e.startedAt.localeCompare(t.startedAt)}function BK(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 VK(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 HK=32;function UK(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function WK(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<=HK)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=UK(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,KK=4e3;function qK({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:pq(r),a=i?.kind===`conversation`?i.value:void 0,o=VK(e,t,a,r===void 0?void 0:cq(r));return(0,W.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,W.jsx)(_l,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:WK(a,lq(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)(LG,{row:r}),(0,W.jsx)(Al,{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=uq(n);if(o!==void 0)return(0,W.jsx)(rq,{redirection:o,row:n});let s=dq(n);if(s!==void 0)return(0,W.jsx)(PG,{release:s});let c=fq(n);return c===void 0?i?.kind===`conversation`?(0,W.jsx)(XK,{row:n,transcript:a}):hq(n)?(0,W.jsx)(ZK,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&tq(i.value)!==void 0?(0,W.jsx)(QK,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&tq(i.value)!==void 0?(0,W.jsx)($K,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):gq(n,i)&&r!==void 0?(0,W.jsx)(nq,{node:r,reference:i}):(0,W.jsx)(oq,{reference:i,row:n}):(0,W.jsx)(aq,{row:n,surface:c})}function YK({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,W.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function XK({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)(jl,{className:`h-2 w-40`}),(0,W.jsx)(jl,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,W.jsxs)(qi,{variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Transcript unavailable`}),(0,W.jsx)(Yi,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=_q(c.agentRole,c.transportRole);return(0,W.jsx)(xa,{className:`gap-0 py-3`,children:(0,W.jsxs)(Sa,{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)(Al,{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.jsxs)(`div`,{ref:t=>o.register(e.id,t),children:[(0,W.jsx)(Ax,{author:{label:l},turn:e}),(0,W.jsx)(YK,{turn:e})]},e.id))}),a.length>n&&(0,W.jsxs)(ba,{onClick:()=>r(n+GK),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function ZK({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)(eq,{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 QK({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(eq,{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)(oq,{reference:n,row:r})]})}function $K({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(eq,{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)(oq,{reference:n,row:r})]})}function eq({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=tq(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)(ba,{onClick:()=>f(!d),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function tq(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}function nq({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)(sq,{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)(sq,{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 rq({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)(fG,{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`]})]}),(0,W.jsx)(iq,{row:t})]}),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 iq({row:e}){let t=e.rowKind===`event`?TK(e.event):void 0;return t===void 0?null:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Author`}),(0,W.jsx)(`dd`,{children:t})]})}function aq({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==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)(fG,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:e}),(0,W.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,W.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function oq({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,i=(e.rowKind===`span`?e.span.reasons: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)(fG,{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)(fG,{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`:oG(e.durationMs)})]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Aggregated`}),(0,W.jsx)(`dd`,{children:r})]}),i.length>0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Waiting on`}),(0,W.jsx)(`dd`,{children:i.map(AK).join(` and `)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Step`}),(0,W.jsx)(`dd`,{children:mq(n)??`None`})]}),(0,W.jsx)(iq,{row:e})]}),(0,W.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,W.jsx)(sq,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function sq({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 cq(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 lq(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function uq(e){return e.rowKind===`event`?e.event.redirection:void 0}function dq(e){return e.rowKind===`event`?e.event.release:void 0}function fq(e){return e.rowKind===`event`?e.event.surface:void 0}function pq(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function mq(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function hq(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function gq(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function _q(e,t){return QG(e,t)}function vq({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)(()=>uK(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)(ba,{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)(YH,{className:`node-view-state`,state:n.status}),(0,W.jsx)(bG,{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)(Dq,{node:n}),(0,W.jsxs)(Au,{className:`node-tabs`,onValueChange:e=>{gG(e)&&l(e)},value:c,children:[(0,W.jsx)(Mu,{"aria-label":`Node details`,variant:`line`,children:Object.entries(hG).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:wq(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:Tq(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)(Eq,{node:n})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{children:`Release`}),(0,W.jsx)(`dd`,{children:(0,W.jsx)(FG,{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)(xa,{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)(yq,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,W.jsxs)(qi,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Timeline unavailable`}),(0,W.jsx)(Yi,{children:i.message})]})})]})]})}function yq({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>aK(a,t.id),[a,t.id]),[s,c]=(0,U.useState)(()=>new Set),l=(0,U.useMemo)(()=>{if(i!==void 0)return mK(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,U.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,U.useMemo)(()=>oK(o.tree,u),[o.tree,u]),f=Pd((0,U.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>tK(o.items,o.lanes),[o.items,o.lanes]),g=(0,U.useMemo)(()=>iK(o.markers,o.items,i),[o.items,o.markers,i]),_=(0,U.useMemo)(()=>bq(o.items),[o.items]),v=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,_[0]),_[1]),y=i===void 0?void 0:pK(o.rows,i),b=e=>{n(e),f.scrollTo(e)};return(0,U.useEffect)(()=>{i!==void 0&&f.scrollTo(i)},[i,f]),(0,W.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,W.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,W.jsx)(ln,{axis:{origin:_[0]},cursor:v,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:h,lanes:o.lanes,markers:g,onExpandedChange:m,onSelect:e=>b(e.id),selectedId:i})}),(0,W.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:xq(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,W.jsx)(Cq,{onOpen:b,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,W.jsx)(Sq,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.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)})}),y!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(ba,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Yt,{})}),(0,W.jsx)(qK,{client:e,node:t,row:y,runId:r})]})]})}function bq(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 xq(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function Sq({entry:e,onToggle:t}){let n=sK(e.hidden,e.group.kind);return(0,W.jsx)(`p`,{className:`transcript-collapsed`,children:(0,W.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function Cq({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)(DG,{category:e.category}),e.displayKind]}),(0,W.jsx)(`strong`,{children:e.displayLabel}),(0,W.jsxs)(`span`,{className:`transcript-facts`,children:[(0,W.jsx)(fG,{at:e.startedAt}),e.durationMs!==null&&` · ${oG(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function wq(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 hq(e){let t=mq(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 gq({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 _q({node:e}){if(!RH(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=PH(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,W.jsxs)(qi,{className:H(`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)(Kt,{}),(0,W.jsx)(Ji,{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)(Yi,{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 vq(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}var yq=`idle`,bq=`idle-`,xq=`row:run`,Sq=e=>`row:node:${e}`,Cq={id:yq,label:`Idle`},wq=[...UG,Cq],Tq=.005;function Eq(e,t){let n=e?.spans??[],r=Dq(e),i=[Oq({id:xq,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0)}),...t.map(e=>Oq({id:Sq(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:[...Mq(r,a,void 0),...XG(a)],markers:$G(i.flatMap(e=>[...e.markers]),a),lanes:wq}}}function Dq(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 Oq({id:e,kind:t,label:n,nodeId:r,range:i,spans:a}){let o=a.flatMap(t=>{let a=hK(t);if(a===null)return[];let o=Date.parse(t.started_at),s=kq(t,a,o,i),c=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${gK(a)}${Aq(t)}`,laneId:a,start:o,end:s,duration:s-o,status:t.status,payload:{id:t.id,kind:`work`,label:`${n} · ${gK(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=Mq(i,o,{rowId:e,nodeId:r}),c=jq(o).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:wq.filter(({id:e})=>[...o,...s].some(t=>t.laneId===e)),items:[...s,...o],line:[...s,...XG(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 kq(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 jq(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 Mq(e,t,n){let r=jq(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>=Tq).map(([e,t],r)=>{let i=`${bq}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${aG(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:yq,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function Nq({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)(()=>Eq(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:cK(f):sK(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)(_l,{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)(Iq,{icon:(0,W.jsx)(gt,{}),label:`Status`,value:t.run.state}),(0,W.jsx)(Iq,{icon:(0,W.jsx)(Mt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,W.jsx)(Iq,{icon:(0,W.jsx)(Et,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:oG(t.run.timing.wall_seconds)}),(0,W.jsx)(Iq,{icon:(0,W.jsx)(Dt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,W.jsx)(xa,{className:`gap-0 py-[15px]`,children:(0,W.jsxs)(Sa,{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)(Pq,{graph:l,onOpenNode:a,onOpenItem:s,selectedItemId:o}):(0,W.jsxs)(qi,{variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Timeline unavailable`}),(0,W.jsx)(Yi,{children:i.message})]})]})})]})}),p!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(ba,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Yt,{})}),(0,W.jsx)(BK,{client:e,row:p,runId:c})]})]})}function Pq({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)(ln,{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)(Fq,{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 Fq({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:[aG(e.workedMs),` recorded · `,aG(e.idleMs),` `,`idle`]})]}),(0,W.jsx)(ln,{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 Iq({icon:e,label:t,value:n}){return(0,W.jsxs)(xa,{"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 Lq=6,Rq=8,zq=`[aria-describedby^="timeline-detail-"]`,Bq=e=>{if(!(e instanceof Element))return;let t=BG(e);if(t!==void 0)return t;let n=e.closest(zq);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},Vq=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function Hq(){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=>Vq(t,Bq(e.target))),t=e=>i(t=>Vq(t,Bq(e.target))),r=e=>i(t=>Vq(t,Bq(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-Rq,s=Math.min(Math.max(n.left,Rq),Math.max(Rq,i)),c=n.bottom+Lq,l=n.top-r.height-Lq,u=Math.max(Rq,window.innerHeight-r.height-Rq),d=c+r.height<=window.innerHeight-Rq?c:l,f=Math.min(Math.max(d,Rq),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,_r.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 Uq=new QO(window.location.origin,{fetch:window.fetch.bind(window)}),Wq=Object.entries(fG);function Gq({client:e=Uq}){let t=gG(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=fG[t.detail].profile,i=aU(e,t.runId,n,r),a=i.list?.runs??[],o=i.runId,s=i.detail,c=(0,U.useMemo)(()=>s?AH(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)(Hq,{}),(0,W.jsxs)(`div`,{className:`app-shell`,children:[(0,W.jsx)(iU,{runs:a,selectedRunId:o,liveRunIds:u,hasMore:i.hasMore,loadingMore:i.loadingMore,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)(Ut,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,W.jsxs)(W.Fragment,{children:[`Last updated`,` `,(0,W.jsx)(dG,{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)(ba,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,W.jsx)(Bt,{size:14}),` Refresh`]})]})]}),i.error&&(0,W.jsxs)(qi,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Live telemetry issue`}),(0,W.jsx)(Yi,{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)(Jt,{size:15}),` Graph`]}),(0,W.jsxs)(Nu,{value:`overall`,children:[(0,W.jsx)(Ht,{size:15}),` Overall`]})]}),(0,W.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),Wq.map(([e,{label:n,description:r}])=>(0,W.jsx)(ba,{"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)(jl,{className:`h-2 w-48`}),(0,W.jsx)(jl,{className:`h-2 w-32`}),`Loading execution history…`]}):s&&o?t.view===`overall`?(0,W.jsx)(Nq,{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)(cq,{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)(qH,{nodes:c,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,W.jsxs)(`div`,{className:`empty-state`,children:[(0,W.jsx)(Jt,{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 Kq=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)(ba,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},qq=document.getElementById(`root`);if(!qq)throw Error(`DAG UI root element is missing`);(0,ED.createRoot)(qq).render((0,W.jsx)(U.StrictMode,{children:(0,W.jsx)(Kq,{children:(0,W.jsx)(Gq,{})})}));
56
+ `)}function Tq(e){let t=wq(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 Eq({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 Dq({node:e}){if(!zH(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=FH(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,W.jsxs)(qi,{className:H(`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)(Kt,{}),(0,W.jsx)(Ji,{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)(Yi,{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 kq=`idle-`,Aq=`row:run`,jq=e=>`row:node:${e}`,Mq={id:WG,label:`Idle`};function Nq(e){return[...YG(e),Mq]}var Pq=.005;function Fq(e,t){let n=e?.spans??[],r=Iq(e),i=Nq(e),a=[Lq({id:Aq,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0),lanes:i}),...t.map(e=>Lq({id:jq(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id),lanes:i}))],o=a.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`));return{range:r,live:n.some(e=>e.ended_at===null),rows:a,line:{items:[...Vq(r,o,void 0),...tK(o,i)],markers:iK(a.flatMap(e=>[...e.markers]),o),lanes:i}}}function Iq(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 Lq({id:e,kind:t,label:n,nodeId:r,range:i,spans:a,lanes:o}){let s=a.flatMap(t=>{let a=vK(t);if(a===null)return[];let s=Date.parse(t.started_at),c=Rq(t,a,s,i),l=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${yK(a,o)}${zq(t)}`,laneId:a,start:s,end:c,duration:c-s,status:t.status,payload:{id:t.id,kind:`work`,label:`${n} · ${yK(a,o)}`,rowId:e,...r===void 0?{}:{nodeId:r},...l===void 0?{}:{conversationId:l},startedAt:t.started_at,endedAt:t.ended_at,durationMs:c-s}}]}),c=Vq(i,s,{rowId:e,nodeId:r}),l=Bq(s).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:o.filter(({id:e})=>[...s,...c].some(t=>t.laneId===e)),items:[...c,...s],line:[...c,...tK(s,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:l,idleMs:c.reduce((e,t)=>e+t.payload.durationMs,0)}}function Rq(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 zq(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function Bq(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 Vq(e,t,n){let r=Bq(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=`${kq}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${oG(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:WG,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function Hq({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)(()=>Fq(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:fK(f):dK(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)(_l,{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)(Gq,{icon:(0,W.jsx)(gt,{}),label:`Status`,value:t.run.state}),(0,W.jsx)(Gq,{icon:(0,W.jsx)(Mt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,W.jsx)(Gq,{icon:(0,W.jsx)(Et,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:sG(t.run.timing.wall_seconds)}),(0,W.jsx)(Gq,{icon:(0,W.jsx)(Dt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,W.jsx)(xa,{className:`gap-0 py-[15px]`,children:(0,W.jsxs)(Sa,{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)(Uq,{graph:l,onOpenNode:a,onOpenItem:s,selectedItemId:o}):(0,W.jsxs)(qi,{variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Timeline unavailable`}),(0,W.jsx)(Yi,{children:i.message})]})]})})]})}),p!==void 0&&(0,W.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,W.jsx)(ba,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,W.jsx)(Yt,{})}),(0,W.jsx)(qK,{client:e,row:p,runId:c})]})]})}function Uq({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)(ln,{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)(Wq,{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 Wq({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:[oG(e.workedMs),` recorded · `,oG(e.idleMs),` `,`idle`]})]}),(0,W.jsx)(ln,{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 Gq({icon:e,label:t,value:n}){return(0,W.jsxs)(xa,{"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 Kq=6,qq=8,Jq=`[aria-describedby^="timeline-detail-"]`,Yq=e=>{if(!(e instanceof Element))return;let t=VG(e);if(t!==void 0)return t;let n=e.closest(Jq);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},Xq=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function Zq(){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=>Xq(t,Yq(e.target))),t=e=>i(t=>Xq(t,Yq(e.target))),r=e=>i(t=>Xq(t,Yq(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-qq,s=Math.min(Math.max(n.left,qq),Math.max(qq,i)),c=n.bottom+Kq,l=n.top-r.height-Kq,u=Math.max(qq,window.innerHeight-r.height-qq),d=c+r.height<=window.innerHeight-qq?c:l,f=Math.min(Math.max(d,qq),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,_r.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 Qq=new $O(window.location.origin,{fetch:window.fetch.bind(window)}),$q=Object.entries(pG);function eJ({client:e=Qq}){let t=_G(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=pG[t.detail].profile,i=oU(e,t.runId,n,r),a=i.list?.runs??[],o=i.runId,s=i.detail,c=(0,U.useMemo)(()=>s?jH(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)(Zq,{}),(0,W.jsxs)(`div`,{className:`app-shell`,children:[(0,W.jsx)(aU,{runs:a,selectedRunId:o,liveRunIds:u,hasMore:i.hasMore,loadingMore:i.loadingMore,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)(Ut,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,W.jsxs)(W.Fragment,{children:[`Last updated`,` `,(0,W.jsx)(fG,{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)(ba,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,W.jsx)(Bt,{size:14}),` Refresh`]})]})]}),i.error&&(0,W.jsxs)(qi,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,W.jsx)(Kt,{}),(0,W.jsx)(Ji,{children:`Live telemetry issue`}),(0,W.jsx)(Yi,{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)(Jt,{size:15}),` Graph`]}),(0,W.jsxs)(Nu,{value:`overall`,children:[(0,W.jsx)(Ht,{size:15}),` Overall`]})]}),(0,W.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,W.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),$q.map(([e,{label:n,description:r}])=>(0,W.jsx)(ba,{"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)(jl,{className:`h-2 w-48`}),(0,W.jsx)(jl,{className:`h-2 w-32`}),`Loading execution history…`]}):s&&o?t.view===`overall`?(0,W.jsx)(Hq,{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)(vq,{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)(JH,{nodes:c,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,W.jsxs)(`div`,{className:`empty-state`,children:[(0,W.jsx)(Jt,{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 tJ=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)(ba,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},nJ=document.getElementById(`root`);if(!nJ)throw Error(`DAG UI root element is missing`);(0,ED.createRoot)(nJ).render((0,W.jsx)(U.StrictMode,{children:(0,W.jsx)(tJ,{children:(0,W.jsx)(eJ,{})})}));