@nathanstephenson/flow 0.1.10-beta.3 → 0.1.10-beta.4

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.
Files changed (44) hide show
  1. package/README.md +9 -1
  2. package/build/backend-worker-chunks/{chunk-LO7O6NAM.mjs → chunk-JOI2POLP.mjs} +1 -1
  3. package/build/backend-worker-chunks/{chunk-UQDH2COY.mjs → chunk-K774KOGL.mjs} +2 -7
  4. package/build/backend-worker-chunks/chunk-LAEUXDNH.mjs +130 -0
  5. package/build/backend-worker-chunks/{chunk-MLOUI3ZM.mjs → chunk-NZZME2I3.mjs} +6 -1
  6. package/build/backend-worker-chunks/claude-GY27HBAY.mjs +35739 -0
  7. package/build/backend-worker-chunks/{pi-QNU2YE4G.mjs → pi-JV6MWPW7.mjs} +1891 -35
  8. package/build/backend-worker.mjs +25 -126
  9. package/dist/backend/claude/index.js +69 -11
  10. package/dist/backend/claude/subagents.js +11 -0
  11. package/dist/backend/fake/index.js +8 -2
  12. package/dist/backend/pi/cache-warming.js +8 -0
  13. package/dist/backend/pi/canonical-json.js +120 -0
  14. package/dist/backend/pi/compaction-model.js +3 -2
  15. package/dist/backend/pi/host-auth.js +258 -0
  16. package/dist/backend/pi/index.js +37 -12
  17. package/dist/backend/pi/model-auth.js +159 -0
  18. package/dist/backend/pi/model-catalog.js +120 -0
  19. package/dist/backend/pi/model-config.js +5 -0
  20. package/dist/backend/pi/model-selection.js +32 -0
  21. package/dist/backend/pi/work.js +9 -1
  22. package/dist/backend/pi/workflow-subagent.js +4 -3
  23. package/dist/backend/worker/entry.js +13 -1
  24. package/dist/backend/worker/index.js +66 -5
  25. package/dist/build-id +1 -1
  26. package/dist/cli/bootstrap.js +1 -1
  27. package/dist/client/reduce.js +2 -0
  28. package/dist/client/tool-summary.js +26 -15
  29. package/dist/daemon/host.js +13 -2
  30. package/dist/daemon/models.js +2 -2
  31. package/dist/daemon/pi-model-cache.js +44 -0
  32. package/dist/isolation/filesystem.js +5 -1
  33. package/dist/isolation/sandbox.js +31 -4
  34. package/package.json +7 -5
  35. package/web/dist/assets/index-BWKZK5HD.css +2 -0
  36. package/web/dist/assets/index-nIc09tKZ.js +40 -0
  37. package/web/dist/assets/{settings-mcp-Vf_fCXyE.js → settings-mcp-bcNKV147.js} +1 -1
  38. package/web/dist/assets/{settings-workflows-DVKxJWQm.js → settings-workflows-C_TKOhVa.js} +2 -2
  39. package/web/dist/assets/{workflows-Dobqzjg-.js → workflows-DHG-CIo3.js} +36 -36
  40. package/web/dist/assets/{workflows-pane-KB-Q76KZ.js → workflows-pane-9u_hJvgQ.js} +1 -1
  41. package/web/dist/index.html +3 -3
  42. package/build/backend-worker-chunks/claude-6L5KCQWJ.mjs +0 -30894
  43. package/web/dist/assets/index-BGu3YSP7.css +0 -2
  44. package/web/dist/assets/index-Miy2nveb.js +0 -40
@@ -1,16 +1,16 @@
1
1
  import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{$n as a,$t as o,A as s,An as c,Bn as l,C as u,E as d,En as f,Er as p,Gn as m,Hn as h,In as g,J as _,Jn as v,K as y,Kn as b,Kt as x,Mn as S,N as C,Nn as w,O as T,Or as E,P as D,Pn as O,Q as k,Qn as A,Rn as j,S as M,T as N,Tn as P,U as F,Un as I,Vn as L,Wn as R,Xn as ee,Y as z,Yn as B,Z as te,Zn as V,_ as ne,an as re,bn as ie,cr as ae,ct as oe,dr as se,et as ce,fr as le,ft as ue,g as de,gn as fe,gt as pe,ht as me,i as he,in as ge,j as _e,jn as ve,kn as ye,kr as be,l as xe,mn as Se,mt as Ce,nt as we,on as Te,ot as Ee,q as De,rn as Oe,rt as ke,sn as Ae,sr as je,st as Me,tn as Ne,tt as Pe,ur as Fe,v as Ie,wn as Le,wr as Re,x as ze,xn as Be,y as Ve,yn as He,yr as Ue,z as We}from"./workflow-api-BfExddae.js";import{$ as Ge,A as Ke,B as qe,Ct as Je,D as Ye,Dt as Xe,E as Ze,Et as Qe,F as $e,G as et,J as tt,K as nt,M as rt,Mt as it,O as at,Ot as ot,P as st,Q as ct,St as lt,Tt as ut,X as dt,Y as ft,Z as pt,_t as mt,a as ht,at as gt,bt as _t,c as vt,ct as yt,dt as bt,et as xt,ft as St,ht as Ct,it as wt,j as Tt,k as Et,kt as Dt,lt as Ot,mt as kt,n as At,nt as jt,ot as Mt,pt as Nt,q as Pt,r as Ft,rt as It,s as Lt,st as Rt,t as zt,ut as Bt,vt as Vt,wt as Ht,xt as Ut,yt as Wt}from"./switch-DIogWclb.js";function Gt(e){if(!e)return;let{used:t,window:n}=e;return n>0?`context ${Math.round(t/n*100)}%`:`${t} tokens`}function Kt(e){if(!e||e.window<=0)return;let{used:t,window:n,spend:r}=e,i=[{label:`Context`,value:`${Math.round(t/n*100)}% · ${Jt(t)}/${Jt(n)} tokens`}];if(!r)return i;if(i.push({label:`Spent`,value:`${Jt(r.tokens)} tokens · ${qt(r.costUSD)}`}),i.push({label:`Cache reads`,value:`${Jt(r.cached)} of ${Jt(r.tokens)}`}),r.models.length>1)for(let e of r.models)i.push({label:e.id,value:`${Jt(e.tokens)} · ${qt(e.costUSD)}`,model:!0});return i}function qt(e){return e>=.01?`$${e.toFixed(2)}`:e===0?`$0.00`:`$${e.toFixed(4)}`}function Jt(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`}function Yt(e){return e.lifecycle===`live`?e.awaiting?`awaiting`:e.turnInFlight?`running`:`idle`:e.lifecycle}function Xt(e){return e===`running`||e===`awaiting`}function Zt(e){return e.status===`settled`||e.status===`ended`?`filed-away`:e.attention?.group===`needs-input`?`needs-input`:e.attention?.group===`unread`?`unread`:e.status===`running`||e.status===`awaiting`||$t(e)?`working`:e.status===`idle`?`idle`:`dormant`}function Qt(e){switch(e){case`needs-input`:return`Needs input`;case`unread`:return`Unread`;case`working`:return`Working`;case`idle`:return`Idle`;case`dormant`:return`Dormant`;case`filed-away`:return`Filed away`}}function $t(e){return e.status===`idle`&&e.activeSubagents+e.activeBackgroundCalls+(e.activeWorkflows??0)>0}function en(e){return e!==`settled`&&e!==`ended`}function tn(e){return e===`dormant`||e===`settled`}function nn(e){let t={tokens:0,cached:0,costUSD:0,models:[]};for(let n of e){t.tokens+=n.tokens,t.cached+=n.cached,t.costUSD+=n.costUSD;for(let e of n.models){let n=t.models.find(t=>t.id===e.id);n?(n.tokens+=e.tokens,n.cached+=e.cached,n.costUSD+=e.costUSD):t.models.push({...e})}}return t}function rn(){return{status:`idle`,lifecycle:`live`,turnInFlight:!1,entries:[],queue:[],activeSubagents:0,activeBackgroundCalls:0,lastSeq:0}}function an(e){return e===`running`||e===`waiting`}function on(e,t=rn()){let n=t;for(let t of e)n=cn(n,t);return n}function sn(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.kind===`user`&&r.producer===void 0)return e;if(r.kind===`assistant`&&r.producer===void 0){if(r.endedAt===t)return e;let i=e.slice();return i[n]={...r,endedAt:t},i}}return e}function cn(e,t){let n=ln(e,t.event,t.at);return n===void 0?{...e,lastSeq:t.seq}:n===e?e:{...n,status:Yt({lifecycle:n.lifecycle,turnInFlight:n.turnInFlight,awaiting:n.asking!==void 0&&n.asking.producer===void 0||n.authorising!==void 0&&n.authorising.producer===void 0}),lastSeq:t.seq}}function ln(e,t,n){switch(t.type){case`session_started`:return{...e,backend:t.backend,scope:t.scope,capabilities:t.capabilities,...t.permissionMode?{permissionMode:t.permissionMode}:{},...t.worktree===void 0?{}:{worktree:t.worktree}};case`capabilities_changed`:return{...e,capabilities:t.capabilities};case`user_message`:return{...e,spoken:!0,entries:hn(e.entries,{kind:`user`,id:t.id,...t.fromSessionId===void 0?{text:t.text}:{text:t.text.slice(t.text.indexOf(`
2
- `)+1),fromSessionId:t.fromSessionId},...t.attachments===void 0?{}:{attachments:t.attachments},at:n})};case`subagent_instruction`:return{...e,entries:hn(e.entries,{kind:`user`,id:t.id,text:t.text,producer:t.producer,at:n})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:hn(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`thinking`:return{...e,entries:hn(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`tool_started`:return{...e,entries:hn(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...mn(t)})};case`tool_updated`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&an(r.status),a=an(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:hn(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},...t.producer===void 0?{}:{producer:t.producer},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:hn(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...mn(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:hn(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?pn(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:gn(e.entries,t.callId,e=>({...e,authorisation:fn(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,entries:sn(e.entries,n),turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=nn([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?nn([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text,...t.sessionId===void 0?{}:{sessionId:t.sessionId}}]};case`compacting`:return t.active?{...e,compacting:!0}:un(e);case`compacted`:return{...un(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:dn(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`rewound`:{let n=e.entries.findIndex(e=>e.kind===`user`&&e.id===t.userMessageId),r=t.restore===`files`?`Files rewound`:t.restore===`both`?`Rewound conversation and files`:`Rewound conversation`;return{...e,entries:[...n<0||t.restore===`files`?e.entries:e.entries.map((e,t)=>t<n||e.rewound?e:{...e,rewound:!0}),{kind:`marker`,id:`rewound-${e.entries.length}`,marker:`rewound`,text:r}]}}case`forked`:return{...e,entries:[...e.entries,{kind:`marker`,id:`forked-${e.entries.length}`,marker:`forked`,text:`Forked`,fromSessionId:t.fromSessionId}]};case`revived`:return{...e,...t.scope===void 0?{}:{scope:t.scope},lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function un(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function dn(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${Jt(t)} tokens`:`${r}, ${Jt(t)} → ${Jt(n)} tokens`}function fn(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function pn(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function mn(e){return e.producer===void 0?{}:{producer:e.producer}}function hn(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function gn(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var H=e(be(),1),_n=e(E(),1);function vn(e){return`${e.kind}:${e.id}`}var U=Re();function yn(e,t){let n=/\/worktrees\/([^/]+)\/[^/]+$/.exec(e)?.[1];return n===void 0?void 0:t.find(e=>e.name===n)?.path}var bn=it(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),xn=it(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Sn=it(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Cn=it(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wn=it(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Tn=it(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),En=it(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Dn=it(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),On=it(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),kn=it(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),An=it(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),jn=it(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Mn=it(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Nn=it(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Pn=it(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Fn=it(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),In=it(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Ln=it(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Rn=it(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function zn(e){let t=e.trim();return t.startsWith(`/`)||t.startsWith(`~`)?`completion`:`search`}function Bn(e){return e.trim()!==``}function Vn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.group===n.group){e.items.push(n);continue}t.push({group:n.group,items:[n]})}return t}function Hn(e,t){if(t===void 0||t===``)return e;let n=t.endsWith(`/`)?t:`${t}/`;if(!e.startsWith(n))return e;let r=e.slice(n.length);return r===``?e:r}function Un(e,t){return t!=null&&!x(t)?0:typeof e==`function`?e():e}function Wn(e,t,n){let r=Un(e,n);return typeof r==`number`?r:r?.[t]}function Gn(e){return typeof e==`function`?e():e}function Kn(e,t){return t||e===`click`||e===`mousedown`}function qn(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jn=H.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ie,currentIdRef:{current:null},currentContextRef:{current:null}});function Yn(e,t){e.current=t.current}function Xn(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=H.useRef(n),a=H.useRef(n),o=H.useRef(null),s=H.useRef(null),c=Be();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Wn(i.current,`open`),close:Wn(n,`close`)}},[n,o,i,a]),(0,U.jsx)(Jn.Provider,{value:H.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Zn(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:f}=H.useContext(Jn),[p,m]=H.useState(!1),h=H.useRef(n);return V(()=>{h.current=n},[n]),V(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,f.clear()}if(a.current&&!n&&a.current===i){if(m(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(h.current||a.current!==t)&&f.clear()}}e()}},[n,i,a,o,s,c,l,f,r]),V(()=>{if(!n)return;let e=l.current,t=a.current;f.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:m},a.current=i,o.current={open:0,close:Wn(c.current,`close`)},t!==null&&t!==i?(m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,d(F))):(m(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,f]),V(()=>()=>{if(a.current===i){if(l.current=null,!h.current)return;a.current=null,Yn(o,c),f.clear()}},[l,a,o,i,c,f]),H.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:p}),[u,o,p])}function Qn(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function $n(e){return e!=null&&e.clientX!=null}function er(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=H.useRef(!1),u=H.useRef(null),[d,f]=H.useState(),[p,m]=H.useState([]),h=A(e=>{i.set(`positionReference`,e)}),g=A((e,t,n)=>{l.current||c.current.openEvent&&!$n(c.current.openEvent)||i.set(`positionReference`,Qn(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=A(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=x(d)?o:a;H.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=ae(o);function r(t){let n=Ae(t);Te(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||$n(c.current.openEvent)?u.current=Le(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),H.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),H.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),H.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=H.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return H.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function tr(){return new Vt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new jt,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function nr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:tr(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:L,inactiveTriggerProps:L,popupProps:L}}function rr(e,t,n=!1){return new Vt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var ir=e=>e.triggerIdProp??e.activeTriggerId,ar=e=>e.openProp??e.open,or=e=>(e.popupElement?.id??e.floatingId)||void 0;function sr(e,t){return t!==void 0&&ar(e)&&ir(e)===t}function cr(e,t){return sr(e,t)?!0:t!==void 0&&ar(e)&&ir(e)==null&&e.triggerCount===1}var lr={open:ar,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ir,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:or,isTriggerActive:(e,t)=>t!==void 0&&ir(e)===t,isOpenedByTrigger:(e,t)=>sr(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ir(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>cr(e,t)?or(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},ur=S();function dr(e){let t=H.useCallback(t=>e===void 0?h:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,ur.useSyncExternalStore)(t,n,()=>e?.serverStore)}var fr=He&&fe;function pr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=Be();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=ae(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&se(e)&&e===re(b(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return P(Le(t,`blur`,r),fr&&Le(t,`keydown`,a,!0),fr&&Le(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);Fe(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let f=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Ae(t.nativeEvent);if(Fe(a)){if(fr&&!t.relatedTarget){if(!l.current&&!Oe(a))return}else if(!ge(a))return}let o=Ne(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:p}=t,m=typeof r==`function`?r():r;if(i.select(`open`)&&o||m===0||m===void 0){i.setOpen(!0,d(De,f,p));return}u.start(m,()=>{s.current||i.setOpen(!0,d(De,f,p))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=Fe(n)&&n.hasAttribute(N(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=re(b(e));!n&&t===e||Te(o.current.floatingContext?.refs.floating.current,t)||Te(e,t)||a||Ne(n??t,i.context.triggerElements)||i.setOpen(!1,d(De,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}var mr=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ie,this.restTimeout=new ie,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},hr=new WeakMap;function gr(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&hr.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),hr.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _r(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=hr.get(n);a&&a!==e&&gr(a),gr(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,hr.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function vr(e){let t=e.context.dataRef.current,n=a(()=>t.hoverInteractionState??mr.create()).current;return t.hoverInteractionState||=n,w(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function yr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,s=a.useState(`open`),c=a.useState(`floatingElement`),l=a.useState(`domReferenceElement`),{dataRef:u}=a.context,f=Qe(),p=ut(),m=vr(a),h=Be(),g=A(()=>Kn(u.current.openEvent?.type,m.interactedInside)),v=A(()=>qn(u.current.openEvent?.type)),y=A(()=>{gr(m)});V(()=>{s||(m.pointerType=void 0,m.restTimeoutPending=!1,m.interactedInside=!1,y())},[s,m,y]),H.useEffect(()=>y,[y]),V(()=>{if(n&&s&&m.handleCloseOptions?.blockPointerEvents&&v()&&Fe(l)&&c){let e=l,t=c,n=b(c),r=f?.nodesRef.current.find(e=>e.id===p)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=m.pointerEventsScopeElement===t?null:m.pointerEventsScopeElement,a=r===t?null:r,o=m.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return _r(m,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,s,l,c,m,v,f,p,y]),H.useEffect(()=>{if(!n)return;function e(){return!!(f&&p&&Dt(f.nodesRef.current,p).length>0)}function t(e){let t=Wn(r,`close`,m.pointerType),n=()=>{a.setOpen(!1,d(_,e)),f?.events.emit(`floating.closed`,e)};t?m.openChangeTimeout.start(t,n):(m.openChangeTimeout.clear(),n())}function s(e){let t=Ae(e);if(!o(t)){m.interactedInside=!1;return}m.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function l(){m.openChangeTimeout.clear(),h.clear(),f?.events.off(`floating.closed`,x),y()}function b(n){if(e()&&f){f.events.on(`floating.closed`,x);return}if(Ne(n.relatedTarget,a.context.triggerElements))return;let r=u.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(f&&r&&Fe(o)&&Dt(f.nodesRef.current,r,!1).some(e=>Te(e.context?.elements.floating,o)))){if(m.handler){m.handler(n);return}y(),v()&&!g()&&t(n)}}function x(t){!f||!p||e()||h.start(0,()=>{f.events.off(`floating.closed`,x),a.setOpen(!1,d(_,t)),f.events.emit(`floating.closed`,t)})}let S=c;return P(S&&Le(S,`mouseenter`,l),S&&Le(S,`mouseleave`,b),S&&Le(S,`pointerdown`,s,!0),()=>{f?.events.off(`floating.closed`,x)})},[n,c,a,u,r,i,v,g,y,m,f,p,h])}var br={current:null};function xr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=br,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:v,events:y}=g.context,S=Qe(l),C=vr(g),w=H.useRef(!1),T=ot(i),E=ot(r),D=ot(o),O=ot(n),k=ot(m),j=ot(p),M=A(()=>Kn(v.current.openEvent?.type,C.interactedInside)),N=A(()=>k.current?.()!==!1),F=A((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!Te(e,t);if(!Fe(n))return!1;let i=n;return r.hasMatchingElement(e=>Te(e,i))&&(!e||!Te(e,i))}),I=A(()=>{C.handler&&=(b(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,C.handler),void 0)}),L=A(()=>{gr(C)});return u&&(C.handleCloseOptions=T.current?.__options),H.useEffect(()=>I,[I]),H.useEffect(()=>{if(!n)return;function e(e){e.open?w.current=!1:(w.current=e.reason===_,I(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return y.on(`openchange`,e),()=>{y.off(`openchange`,e)}},[n,y,C,I]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Wn(E.current,`close`,C.pointerType);n?C.openChangeTimeout.start(n,()=>{g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e)}):t&&(C.openChangeTimeout.clear(),g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!Fe(t))return;function r(e){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,a&&!x(C.pointerType))return;let t=Gn(D.current),n=Wn(E.current,`open`,C.pointerType),r=Ae(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(Fe(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(Te(e,r)){s=e;break}}Fe(i)&&Fe(o)&&!g.context.triggerElements.hasElement(i)&&Te(i,o)&&(s=o);let c=s!=null&&F(o,s,r),l=g.select(`open`),u=j.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&w.current,p=!c&&Fe(s)&&Fe(o)&&Te(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,v=!l||c;if(h){N()&&g.setOpen(!0,d(_,e,s));return}m||(n?C.openChangeTimeout.start(n,()=>{v&&N()&&g.setOpen(!0,d(_,e,s))}):v&&N()&&g.setOpen(!0,d(_,e,s)))}function i(t){if(M()){L();return}I();let n=g.select(`domReferenceElement`),r=b(n);C.restTimeout.clear(),C.restTimeoutPending=!1;let i=v.current.floatingContext??f?.();if(!Ne(t.relatedTarget,g.context.triggerElements)){if(T.current&&i){g.select(`open`)||C.openChangeTimeout.clear();let n=c.current;C.handler=T.current({...i,tree:S,x:t.clientX,y:t.clientY,onClose(){L(),I(),O.current&&!M()&&n===g.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,C.handler),C.handler(t);return}(C.pointerType!==`touch`||!Te(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Te(t,e.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}let l=h?Le(t,`mouseout`,o):void 0;return s?P(Le(t,`mousemove`,r,{once:!0}),Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l):P(Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l)},[I,L,v,E,g,n,T,C,u,F,M,a,s,D,c,S,O,f,j,N,h]),H.useMemo(()=>{if(!n)return;function e(e){C.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=F(r,n,e.target);if(a&&!x(C.pointerType))return;if(i&&o&&C.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);if(e){let t=C.handleCloseOptions?.getScope?.()??n.ownerDocument.body;_r(C,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Gn(D.current);if(i&&!o||s===0||!o&&C.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;C.restTimeout.clear();function c(){if(C.restTimeoutPending=!1,M())return;let e=g.select(`open`);!C.blockMouseMove&&(!e||o)&&N()&&g.setOpen(!0,d(_,t,n))}C.pointerType===`touch`?_n.flushSync(()=>{c()}):o&&i?c():(C.restTimeoutPending=!0,C.restTimeout.start(s,c))}}},[n,C,M,F,a,g,D,N])}var Sr=.1,Cr=Sr*Sr,wr=.5;function Tr(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Er(e,t,n,r,i,a,o,s,c,l){let u=!1;return Tr(e,t,n,r,i,a)&&(u=!u),Tr(e,t,i,a,o,s)&&(u=!u),Tr(e,t,o,s,c,l)&&(u=!u),Tr(e,t,c,l,n,r)&&(u=!u),u}function Dr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Or(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function kr(e={}){let{blockPointerEvents:t=!1}=e,n=new ie,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Cr;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Ae(r),g=r.type===`mouseleave`,_=Te(u,h),v=Te(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Fe(r.relatedTarget)&&Te(u,r.relatedTarget))return;function y(){return!!(s&&Dt(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Or(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Or(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Or(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Or(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Dr(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?wr/2:wr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+wr+1,o=C||T?S.bottom-wr:S.top,s=C?T?S.bottom-wr:S.top:S.bottom-wr;M=Er(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?wr/2:wr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-wr,o=C||T?S.top+wr:S.bottom,s=C?T?S.top+wr:S.bottom:S.top+wr;M=Er(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?wr/2:wr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+wr+1,o=w||E?S.right-wr:S.left,s=w?E?S.right-wr:S.left:S.right-wr;M=Er(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?wr/2:wr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-wr,o=w||E?S.left+wr:S.right,s=w?E?S.left+wr:S.right:S.left+wr;M=Er(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Ar(){let{config:e,refresh:t}=Ue(),{save:n,saving:r}=Ve(),i=e.projectList??[],a=e.projectCandidates??[],o=e.projects?.root??``,s=e.projects?.include??[],c=(0,H.useCallback)((e,r)=>{(async()=>{await n({projects:{include:e}},r)&&await t()})()},[n,t]),l=t=>{let n=Hn(t,e.projects?.root===void 0?void 0:e.scope);s.includes(n)||c([...s,n],`Project added.`)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jr,{included:i,onRemove:e=>c(s.filter((t,n)=>n!==e),`Project removed.`)}),(0,U.jsx)(Mr,{candidates:a,hasRoot:e.projects?.root!==void 0,onAdd:l}),(0,U.jsx)(Pr,{onAdd:l}),(0,U.jsx)(Fr,{current:o,saving:r,onSave:n,onSaved:t})]})}function jr({included:e,onRemove:t}){return(0,U.jsx)(Ie,{title:`Projects · ${e.length}`,description:e.length===0?`Nothing yet. A Project is one you have opted into — add one below, and it becomes an option in the New Agent Session view.`:`What the New Agent Session view offers, in this order.`,children:e.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,n)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b py-1.5 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.group===void 0?e.name:`${e.group}/${e.name}`}),e.missing?(0,U.jsx)(`span`,{className:`text-xs text-destructive`,children:`directory is gone`}):null]}),(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.path}),(0,U.jsx)(O,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,onClick:()=>t(n),children:(0,U.jsx)(Rn,{"aria-hidden":!0})})]})]},e.path))})})}function Mr({candidates:e,hasRoot:t,onAdd:n}){return t?(0,U.jsx)(Ie,{title:`Found beneath the Project Root · ${e.length}`,description:`Repositories Flow can see but is not offering. Add the ones you work in.`,children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing left to add. Either everything found is already a Project, or the Project Root holds no git repositories within three levels.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:Vn(e).map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.group===void 0?null:(0,U.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.group}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.items.map(e=>(0,U.jsxs)(O,{variant:`outline`,size:`sm`,className:`font-mono text-xs font-normal`,onClick:()=>n(e.path),children:[(0,U.jsx)(Nn,{"aria-hidden":!0}),e.name]},e.path))})]},e.group??``))})}):null}function Nr(e){let[t,n]=(0,H.useState)(void 0),r=(0,H.useRef)(``);return(0,H.useEffect)(()=>{if(r.current=e,!Bn(e)){n(void 0);return}let t=new AbortController,i=setTimeout(()=>{(async()=>{try{let i=await p(`/api/directories?q=${encodeURIComponent(e)}`,{signal:t.signal});if(!i.ok)return;let a=await i.json();a.query===r.current&&n(a)}catch{}})()},150);return()=>{t.abort(),clearTimeout(i)}},[e]),t}function Pr({onAdd:e}){let[t,n]=(0,H.useState)(``),r=Nr(t),i=zn(t);return(0,U.jsxs)(Ie,{title:`Add any directory`,description:(0,U.jsxs)(U.Fragment,{children:[`Type a name to search beneath the Project Root — repositories included, so`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`packages/api`}),` inside a monorepo is reachable. Start with `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`/`}),` or`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),` to complete a path anywhere on this machine instead.`]}),children:[(0,U.jsx)(he,{className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`api, or /home/you/elsewhere`,spellCheck:!1}),r===void 0?null:r.paths.length===0?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`completion`?`No directory there.`:`Nothing beneath the Project Root matches.`}):(0,U.jsxs)(`div`,{className:`flex flex-col`,children:[(0,U.jsxs)(`span`,{className:`pb-1 text-xs text-muted-foreground`,children:[i===`completion`?`Directories here`:`Found beneath the Project Root`,r.truncated?` — showing the first few, keep typing`:null]}),r.paths.map(t=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b py-1 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t}),(0,U.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:()=>{e(t),n(``)},children:[(0,U.jsx)(Nn,{"aria-hidden":!0}),`Add`]})]},t))]})]})}function Fr({current:e,saving:t,onSave:n,onSaved:r}){let[i,a]=(0,H.useState)(e);return(0,H.useEffect)(()=>a(e),[e]),(0,U.jsxs)(Ie,{title:`Project Root`,description:(0,U.jsxs)(U.Fragment,{children:[`The directory Flow looks beneath for candidates, and the one it reports as its default Scope. Absolute, or starting with`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),`. A Project outside it can still be added by path.`]}),children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Where your repositories live`}),(0,U.jsx)(he,{className:`font-mono`,value:i,onChange:e=>a(e.target.value),placeholder:`~/workspace`,spellCheck:!1})]}),(0,U.jsx)(de,{dirty:i.trim()!==e,saving:t,onSave:()=>{(async()=>{let e=i.trim()===``?`Project Root cleared.`:`Project Root saved.`;await n({projects:{root:i.trim()}},e)&&await r()})()},onReset:()=>a(e)})]})}var Ir=H.createContext(void 0);function Lr(e){let t=H.useContext(Ir);if(!e&&t===void 0)throw Error(B(27));return t}var Rr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Lr(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return j(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:tt,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),zr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...c}=e,l=Lr(),u=l.useState(`open`),{getButtonProps:f,buttonRef:p}=R({disabled:a,native:o}),m={disabled:a};function h(e){u&&l.setOpen(!1,d(s,e.nativeEvent))}return j(`button`,e,{state:m,ref:[t,p],props:[{onClick:h},c,f]})}),Br=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Lr(),c=xe(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),j(`p`,e,{ref:t,props:[{id:c},o]})}),Vr=H.createContext(void 0);function Hr(){let e=H.useContext(Vr);if(e===void 0)throw Error(B(26));return e}var Ur={...Pt,...Ee,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},Wr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Lr(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Hr(),we({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Rt(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=j(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...It,hidden:!m,onKeyDown(e){qe.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Ur});return(0,U.jsx)(Ut,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Gr=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Lr(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,U.jsx)(Vr.Provider,{value:n,children:(0,U.jsxs)(u,{ref:t,...r,children:[a&&o===!0&&(0,U.jsx)($e,{ref:i.context.internalBackdropRef,inert:Me(!s)}),e.children]})}):null});function Kr({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=H.useState(0),[u,d]=H.useState(0),f=c===0,p=Wt(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Ae(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Te(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return st(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),V(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),bt(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var qr={...lr,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Jr=class extends f{constructor(e,t,n){let r=new jt,i=Yr(e,r,t,n);super(i,Xr(r),qr)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};yt(n,e,t.trigger),this.update(n)}};function Yr(e,t,n,r=!1){let i={...nr(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=rr(t,n,r),i}function Xr(e){return{popupRef:H.createRef(),backdropRef:H.createRef(),internalBackdropRef:H.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Zr(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,h=e===`alert-dialog`,g=h?!0:c,_=h||s,v=h?`alertdialog`:`dialog`,y=Lr(!0),b={modal:g,disablePointerDismissal:_,nested:y!=null,role:v},x=St((e,t)=>new Jr({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`);Nt(x,S),Ot(x);let{forceUnmount:T}=Bt(S,x);H.useImperativeHandle(l,()=>({unmount:T,close:()=>x.setOpen(!1,d(D))}),[T,x]);let E=S||C;return(0,U.jsxs)(Ir.Provider,{value:x,children:[u&&(0,U.jsx)(wt,{handle:u,store:x}),E&&(0,U.jsx)(Kr,{store:x,parentContext:y?.context,isDrawer:m}),typeof n==`function`?n({payload:w}):n]})}function Qr(e){return Zr(`dialog`,e)}var $r=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Lr(),c=xe(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),j(`h2`,e,{ref:t,props:[{id:c},o]})}),ei=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Lr(!0),f=dr(l)??d;if(!f)throw Error(B(79));let p=xe(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=H.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=kt(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=R({disabled:a,native:o}),S=_t(m),C=rt(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return j(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[k]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:dt})});function ti({...e}){return(0,U.jsx)(Qr,{"data-slot":`dialog`,...e})}function ni({...e}){return(0,U.jsx)(ei,{"data-slot":`dialog-trigger`,...e})}function ri({...e}){return(0,U.jsx)(Gr,{"data-slot":`dialog-portal`,...e})}function ii({className:e,...t}){return(0,U.jsx)(Rr,{"data-slot":`dialog-overlay`,className:g(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function ai({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(ri,{children:[(0,U.jsx)(ii,{}),(0,U.jsxs)(Wr,{"data-slot":`dialog-content`,className:g(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,U.jsxs)(zr,{"data-slot":`dialog-close`,render:(0,U.jsx)(O,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,U.jsx)(Rn,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function oi({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:g(`flex flex-col gap-1.5`,e),...t})}function si({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:g(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(zr,{render:(0,U.jsx)(O,{variant:`outline`}),children:`Close`})]})}function ci({className:e,...t}){return(0,U.jsx)($r,{"data-slot":`dialog-title`,className:g(`font-heading text-base leading-none font-medium`,e),...t})}function li({className:e,...t}){return(0,U.jsx)(Br,{"data-slot":`dialog-description`,className:g(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function ui({session:e,onClose:t}){let{connection:n,config:r}=Ue(),[i,a]=(0,H.useState)(e.suggestedScope??``),[o,s]=(0,H.useState)(()=>yn(e.scope,r.projectList??[])??``),[c,l]=(0,H.useState)(void 0),[u,d]=(0,H.useState)(!1),f=i.trim()!==``&&(!e.worktree||o.trim()!==``),p=async()=>{d(!0),l(void 0);try{await n.command({type:`relocate`,sessionId:e.id,scope:i.trim(),...e.worktree?{repo:o.trim()}:{}}),await n.command({type:`revive`,sessionId:e.id}),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,U.jsx)(ti,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,U.jsxs)(ai,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(oi,{children:[(0,U.jsx)(ci,{children:`Relocate Agent Session`}),(0,U.jsx)(li,{children:`Its Scope no longer exists. Choose where its files are now.`})]}),(0,U.jsx)(ne,{label:`Old Scope`,children:e.scope}),(0,U.jsx)(di,{label:`Scope`,value:i,onChange:a}),e.worktree?(0,U.jsx)(di,{label:`Repository`,value:o,onChange:s}):null,c===void 0?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,U.jsxs)(si,{children:[(0,U.jsx)(O,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(O,{disabled:!f||u,onClick:()=>void p(),children:`Relocate and revive`})]})]})})}function di({label:e,value:t,onChange:n}){let r=Nr(t),i=(0,H.useId)();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),(0,U.jsx)(he,{id:i,className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`/path/to/folder`,spellCheck:!1}),r?.paths.filter(e=>e!==t).slice(0,5).map(e=>(0,U.jsx)(O,{variant:`ghost`,size:`sm`,className:`justify-start font-mono text-xs`,onClick:()=>n(e),children:e},e))]})}var fi=new Map;function pi(e,t){fi.set(e,structuredClone(t))}function mi(e){let t=fi.get(e);return t&&structuredClone(t)}function hi(e){fi.delete(e)}function gi(e){for(let t of fi.keys())e.has(t)||fi.delete(t)}var _i=2e3,vi=3e4,yi=(0,H.createContext)(void 0);function bi(){let e=(0,H.useContext)(yi);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function xi({children:e}){let{connection:t}=Ue(),[n,r]=(0,H.useState)([]),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(void 0),c=(0,H.useRef)(()=>{});(0,H.useEffect)(()=>{let e=!1,n,i,o=0,s=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++o;try{let i=await t.listSessions();if(e||n<=s)return;s=n,l=0,gi(new Set(i.map(e=>e.id))),r(i),a(!0),u(_i)}catch{if(e)return;a(!0),l+=1,u(Math.min(vi,_i*2**l))}},f=()=>{document.hidden||d()};return c.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,c.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let l=(0,H.useCallback)(()=>c.current(),[]),u=n.find(e=>e.id===o);return(0,U.jsxs)(yi.Provider,{value:{sessions:n,loaded:i,nudge:l,relocate:s},children:[e,u?(0,U.jsx)(ui,{session:u,onClose:()=>{s(void 0),l()}}):null]})}function Si(){let{connection:e}=Ue(),{nudge:t,relocate:n}=bi();return(0,H.useCallback)(async r=>{try{let n=await e.command(r);return t(),n}catch(e){if(e.code===`scope_missing`&&`sessionId`in r){n(r.sessionId),t();return}ze.error(`${r.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t,n])}var Ci=[`general`,`projects`,`permissions`,`providers`,`appearance`,`keyboard`,`workflows`,`secrets`,`mcp`],wi={sessionId:void 0};function Ti(e){let[t=``,n=``]=e.replace(/^#\/?/,``).split(`?`,2),r=t.split(`/`).filter(e=>e!==``);if(r[0]===`settings`)return{sessionId:void 0,settings:Oi(r[1])};let i=Ei(r),a=new URLSearchParams(n).get(`settings`);return a===null?i:{...i,settings:Oi(a)}}function Ei(e){if(e[0]===`schedules`){let t={sessionId:void 0,schedules:!0};if(e[1]===`occurrences`){let n=ki(e[2]??``);return n?{...t,occurrenceId:n}:t}let n=ki(e[1]??``);return n?{...t,scheduleId:n}:t}if(e[0]===`new`&&e[1])return{sessionId:void 0,backend:ki(e[1])};if(e[0]!==`s`||e[1]===void 0)return wi;let t=ki(e[1]);return{sessionId:t===``?void 0:t}}function Di(e){let t=e.schedules?`#/schedules${e.occurrenceId?`/occurrences/${encodeURIComponent(e.occurrenceId)}`:e.scheduleId?`/${encodeURIComponent(e.scheduleId)}`:``}`:e.sessionId===void 0?e.backend?`#/new/${encodeURIComponent(e.backend)}`:``:`#/s/${encodeURIComponent(e.sessionId)}`;return e.settings===void 0?t:`${t||`#/`}?settings=${e.settings}`}function Oi(e){return Ci.find(t=>t===ki(e??``))??Ci[0]}function ki(e){try{return decodeURIComponent(e)}catch{return``}}function Ai(e){return e.title||e.id}var ji=60,Mi=[{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`description`,shape:`text`},{key:`prompt`,shape:`text`}];function Ni(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of Mi){let n=t[e.key];if(e.shape===`questions`){let e=Pi(n);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Ii(n.trim()):Fi(n)}let n=Object.values(t).filter(e=>typeof e==`string`),r=n.length===1?n[0]:void 0;return r&&r.trim()!==``?Fi(r):void 0}function Pi(e){if(!Array.isArray(e)||e.length===0)return;let t=e[0];if(!t||typeof t!=`object`)return;let n=t.question;if(typeof n!=`string`||n.trim()===``)return;let r=e.length-1;return Fi(r>0?`${n} (+${r} more)`:n)}function Fi(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=ji?t:`${t.slice(0,59)}…`}function Ii(e){return e.length<=ji?e:`…${e.slice(-59)}`}var Li=H.createContext(void 0);function Ri(e){let t=H.useContext(Li);if(t===void 0&&!e)throw Error(B(33));return t}var zi=H.createContext(void 0);function Bi(e){let t=H.useContext(zi);if(t===void 0&&!e)throw Error(B(36));return t}var Vi=H.createContext(void 0);function Hi(e=!0){let t=H.useContext(Vi);if(t===void 0&&!e)throw Error(B(25));return t}function Ui(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Hi(!0),f=d!==void 0;return H.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:We})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!He&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&m(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Wi={type:`regular-item`};function Gi(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=H.useRef(null),{getButtonProps:d,buttonRef:f}=R({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Ui({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=H.useCallback(e=>ee(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=I(u,f);return H.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ki=H.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Ke({guess:!0,label:a}),f=Ri(!0),p=xe(i),{store:m}=Bi(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Gi({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Wi});return j(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),qi=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Bi(),{side:c,align:l}=Ri(),u=Et(!0)!=null,f=s.useState(`open`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`mounted`),g=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),y=s.useState(`lastOpenChangeReason`),b=s.useState(`rootId`),x=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=v.type===`context-menu`;we({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}}),H.useEffect(()=>{function e(e){s.setOpen(!1,d(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),yr(x,{enabled:w&&!T&&!D&&v.type!==`menubar`,closeDelay:C});let O=s.useStateSetter(`popupElement`),k={transitionStatus:p,side:c,align:l,open:f,nested:v.type===`menu`,instant:g},A=j(`div`,e,{state:k,ref:[t,s.context.popupRef,O],stateAttributesMapping:tt,props:[m,{onKeyDown(e){u&&qe.has(e.key)&&e.stopPropagation()}},nt(p),o,{"data-rootownerid":b}]}),M=v.type===void 0||D;return(_||v.type===`menubar`&&y!==`outside-press`)&&(M=!0),(0,U.jsx)(Ut,{context:x,openInteractionType:E,modal:D,disabled:!h,returnFocus:a===void 0?M:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Ji=H.createContext(void 0);function Yi(){let e=H.useContext(Ji);if(e===void 0)throw Error(B(32));return e}var Xi=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Bi();return i.useState(`mounted`)||n?(0,U.jsx)(Ji.Provider,{value:n,children:(0,U.jsx)(u,{ref:t,...r})}):null}),Zi=H.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=ce,style:_,...v}=e,{store:b}=Bi(),x=Yi(),S=Hi(!0),C=b.useState(`parent`),w=b.useState(`floatingRootContext`),T=b.useState(`floatingTreeRoot`),E=b.useState(`mounted`),D=b.useState(`open`),O=b.useState(`modal`),k=b.useState(`openMethod`),A=b.useState(`activeTriggerElement`),j=b.useState(`transitionStatus`),M=b.useState(`positionerElement`),N=b.useState(`instantType`),P=b.useState(`adaptiveOrigin`),F=b.useState(`lastOpenChangeReason`),I=b.useState(`floatingNodeId`),L=b.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=H.useRef(null),z=ke(M),B=n,te=c,ne=l,re=s,ie=g;C.type===`context-menu`&&(B=n??C.context?.anchor,re??=`start`,!o&&re!==`center`&&(ne=e.alignOffset??2,te=e.sideOffset??-5));let ae=o,oe=re;C.type===`menu`?(ae??=`inline-end`,oe??=`start`,ie=e.collisionAvoidance??Pe):C.type===`menubar`&&(ae??=C.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let se=C.type===`context-menu`,le=pt({anchor:B,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:ae,sideOffset:te,align:oe,alignOffset:ne,arrowPadding:se?0:p,collisionBoundary:u,collisionPadding:f,sticky:m,nodeId:I,keepMounted:x,disableAnchorTracking:h,collisionAvoidance:ie,shift:se?{crossAxis:!(`side`in ie&&ie.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P});H.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&b.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===b.select(`floatingParentNodeId`)&&b.setOpen(!1,d(y)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[b,T.events,I]),H.useEffect(()=>{if(b.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==b.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;b.setOpen(!1,d(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,b]);let ue=Be();H.useEffect(()=>{D||ue.clear()},[D,ue]),H.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==b.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=b.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{b.setOpen(!1,d(y))}):b.setOpen(!1,d(y))}else ue.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,b,ue]),H.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:b.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,b,I,L]),V(()=>{let e=R,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return z(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,z,b]);let de={open:D,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:C.type===`menu`,instant:N},fe=C.type===`menubar`&&C.context.modal;Ye(D&&(fe||O&&F!==`trigger-hover`),k===`touch`,M,A);let pe=et(e,de,{styles:le.positionerStyles,transitionStatus:j,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),me=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),he=null;return C.type===`menubar`?he=C.context.contentElement:C.type===void 0&&(he=A),(0,U.jsxs)(Li.Provider,{value:le,children:[me&&(0,U.jsx)($e,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Me(!D),cutout:he}),(0,U.jsx)(lt,{id:I,children:(0,U.jsx)(at,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:pe})})]})}),Qi=H.createContext(null);function $i(e){let t=H.useContext(Qi);if(t===null&&!e)throw Error(B(5));return t}var ea={...lr,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},ta=class extends f{constructor(e){super({...ra(),...e},na(),ea),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function na(){return{positionerRef:H.createRef(),popupRef:H.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),onOpenChangeComplete:void 0,triggerElements:new jt}}function ra(){return{...nr(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Xe,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:L,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var ia=H.createContext(void 0);function aa(){return H.useContext(ia)}var oa=ye(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:u=`vertical`,actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:_=!0}=e,v=Hi(!0),y=Bi(!0),b=$i(!0),x=aa(),S=H.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=sa({open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:S});C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,h),C.useContextCallback(`onOpenChangeComplete`,i);let w=te(),T=te(),E=C.useState(`floatingTreeRoot`),O=Ht(E),k=ut(),j=C.useState(`open`),M=C.useState(`activeTriggerElement`),N=C.useState(`positionerElement`),P=C.useState(`hoverEnabled`),F=C.useState(`disabled`),I=C.useState(`lastOpenChangeReason`),R=C.useState(`parent`),z=C.useState(`activeIndex`),B=C.useState(`payload`),ne=C.useState(`floatingParentNodeId`),re=H.useRef(null),ie=H.useRef(R.type!==`context-menu`),ae=Be(),oe=H.useRef(!0),se=Be(),ce=ne!=null,{openMethod:le,triggerProps:ue}=Tt(j);C.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:R.type===void 0?s:void 0,openMethod:le,rootId:w}),Ot(C);let{forceUnmount:de}=Bt(j,C,()=>{C.set(`allowMouseEnter`,!1)});V(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:O,floatingParentNodeId:k}):y&&C.update({floatingNodeId:O,floatingParentNodeId:k})},[v,y,O,k,C]),H.useEffect(()=>{if(j||(re.current=null),R.type===`context-menu`){if(!j){ae.clear(),ie.current=!1;return}ae.start(500,()=>{ie.current=!0})}},[ae,j,R.type]),V(()=>{!j&&!P&&C.set(`hoverEnabled`,!0)},[j,P,C]);let fe=A((e,t)=>{let n=t.reason;if(!e&&!C.select(`open`)||j===e&&t.trigger===M&&I===n)return;let i=Mt(t);if(!e&&t.trigger==null&&(t.trigger=M??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!oe.current)return;e&&n===`trigger-focus`?(oe.current=!1,se.start(300,()=>{oe.current=!0})):(oe.current=!0,se.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};re.current=t.event,yt(c,e,t.trigger,i()),C.update(c),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),pe=mt({popupStore:C,floatingId:T,nested:k!=null,onOpenChange:fe}),me=pe.context.events;V(()=>{let e=({open:e,eventDetails:t})=>fe(e,t);return me.on(`setOpen`,e),()=>{me?.off(`setOpen`,e)}},[me,fe]);let he=H.useCallback(()=>{C.setOpen(!1,d(D))},[C]);H.useImperativeHandle(f,()=>({unmount:de,close:he}),[de,he]);let ge;R.type===`context-menu`&&(ge=R.context),H.useImperativeHandle(ge?.positionerRef,()=>N,[N]),H.useImperativeHandle(ge?.actionsRef,()=>({setOpen:fe}),[fe]);let _e=Wt(pe,{enabled:!F,bubbles:{escapeKey:p&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||re.current?.type===`contextmenu`||ie.current},externalTree:ce?E:void 0}),ve=ct(),ye=H.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),be=xt(pe,{enabled:!F,listRef:C.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:c,orientation:u,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:ve===`rtl`,disabledIndices:l,onNavigate:ye,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:ce?E:void 0,focusItemOnHover:_}),xe=H.useCallback(e=>{C.context.typingRef.current=e},[C]),Se=Ge(pe,{enabled:!F,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{j&&e!==z&&C.set(`activeIndex`,e)},onTyping:xe}),Ce=H.useMemo(()=>{let e=ee(Se.reference,be.reference,_e.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=j,e},[C,Se.reference,be.reference,_e.reference,ue,j]),we=H.useMemo(()=>{let e=ee(be.trigger,_e.trigger,ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,_e.trigger,ue]),Te=H.useMemo(()=>ee(It,{id:T,role:`menu`,"aria-labelledby":M?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),R.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Se.floating,be.floating,_e.floating),[M,T,R.type,C,Se.floating,be.floating,_e.floating]),Ee=be.item??L;bt(C,{floatingRootContext:pe,activeTriggerProps:Ce,inactiveTriggerProps:we,popupProps:Te,itemProps:Ee});let De=H.useMemo(()=>({store:C,parent:S}),[C,S]),Oe=(0,U.jsxs)(zi.Provider,{value:De,children:[m&&(0,U.jsx)(wt,{handle:m,store:C}),typeof t==`function`?t({payload:B}):t]});return R.type===void 0||R.type===`context-menu`?(0,U.jsx)(Je,{externalTree:E,children:Oe}):Oe});function sa(e){return a(()=>new ta(e)).current}function ca(e){let t=Bi().store,n=H.useMemo(()=>({parentMenu:t}),[t]);return(0,U.jsx)(ia.Provider,{value:n,children:(0,U.jsx)(oa,{...e})})}function la(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=v(),{ref:i,index:a}=Ke(e),o=n===a,s=H.useRef(null),c=I(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function ua(e){let{render:t,className:n,style:r,state:i=L,props:a=l,refs:o=l,metadata:s,stateAttributesMapping:c,tag:u=`div`,...d}=e,{compositeProps:f,compositeRef:p}=la({metadata:s});return j(u,e,{state:i,ref:[p,...o],props:[f,...a,d],stateAttributesMapping:c})}function da(e){if(se(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!le(e))return da(je(e))}function fa(e,t){let n=H.useRef(null);function r(t){_n.flushSync(()=>{e.setOpen(!1,d(C,t.nativeEvent,t.currentTarget))}),me(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&pe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_n.flushSync(()=>{e.setOpen(!1,d(C,n.nativeEvent,n.currentTarget))});let i=Ce(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Te(r,i);){let e=i;if(i=ue(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function pa(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=H.useRef(!1);return H.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,b(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:L,[t,n,r])}var ma=c(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=Bi(!0),h=dr(d)??m?.store;if(!h)throw Error(B(85));let g=xe(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=h.useState(`triggerPopupId`,g),C=H.useRef(null),w=ga(),E=v(!0),D=Qe(),O=H.useMemo(()=>D??new Xe,[D]),k=Ht(O),M=ut(),{registerTrigger:N,isMountedByThisTrigger:P}=kt(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:M,keyboardEventRelay:E?.relayKeyboardEvent}),F=w.type===`menubar`,I=h.useState(`disabled`),z=a||I||F&&w.context.disabled,{getButtonProps:te,buttonRef:V}=R({disabled:z,native:o});H.useEffect(()=>{!x&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,x,w.type]);let ne=H.useRef(null),re=Be(),ie=A(e=>{if(!ne.current)return;re.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Te(ne.current,t)||Te(h.select(`positionerElement`),t)||t===ne.current||(t==null||da(t)!==h.select(`rootId`))&&(Ze(e,ne.current)||O.events.emit(`close`,{domEvent:e,reason:T}))});H.useEffect(()=>{x&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&b(ne.current).addEventListener(`mouseup`,ie,{once:!0})},[x,ie,h]);let ae=F&&w.context.hasSubmenuOpen,se=xr(y,{enabled:(c??ae)&&!z&&(!F||ae&&!P),handleClose:kr({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:O,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ce=ha(x,h.select(`lastOpenChangeReason`)),le=_t(y,{enabled:!z,event:x&&F?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&ce}),ue=pr(y,{enabled:!z&&ae}),de=pa({open:x,enabled:F,mouseDownAction:`open`}),fe=H.useMemo(()=>ee(ue.reference,le.reference),[ue.reference,le.reference]),pe=h.useState(`triggerProps`,P),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=fa(h,C),_e={disabled:z,open:x},ve=[ne,t,V,N,C],ye=[fe,se??L,pe,{"aria-haspopup":`menu`,"aria-controls":S,id:g,onMouseDown:e=>{h.select(`open`)||(re.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),b(e.currentTarget).addEventListener(`mouseup`,ie,{once:!0}))}},F?{role:`menuitem`}:{},de,p,te],be=j(`button`,e,{enabled:!F,stateAttributesMapping:ft,state:_e,ref:ve,props:ye});return F?(0,U.jsx)(ua,{tag:`button`,render:n,className:r,style:i,state:_e,refs:ve,props:ye,stateAttributesMapping:ft}):x?(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(oe,{ref:me,onFocus:he},`${g}-pre-focus-guard`),(0,U.jsx)(H.Fragment,{children:be},g),(0,U.jsx)(oe,{ref:h.context.triggerFocusTargetRef,onFocus:ge},`${g}-post-focus-guard`)]}):(0,U.jsx)(H.Fragment,{children:be},g)});function ha(e,t){let n=Be(),[r,i]=H.useState(!1);return V(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function ga(){let e=$i(!0);return H.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var _a=H.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return j(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),va={"aria-expanded":void 0},ya=H.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=aa();if(!p?.parentMenu)throw Error(B(37));let m=Ke({guess:!0,label:a}),h=Ri(),{store:g}=Bi(),_=xe(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Ct(_,g),C=H.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=H.useRef(null),T=H.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),M=E.useState(`isActive`,m.index),N=H.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:P,itemRef:F}=Gi({closeOnClick:!1,disabled:k,highlighted:M,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:h?.context.nodeId}),I=xr(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:kr({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),R=_t(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??L,ee=g.useState(`triggerProps`,!0);delete ee.id;let z={disabled:k,highlighted:M,open:v},te=g.useState(`openMethod`),V=g.useState(`lastOpenChangeReason`)===`list-navigation`||te===`keyboard`;return j(`div`,e,{state:z,stateAttributesMapping:dt,props:[R,I,ee,A,v&&V&&Se?va:void 0,{"aria-controls":x,tabIndex:v||M?0:-1,onBlur(){M&&E.set(`activeIndex`,null)}},f,P],ref:[t,m.ref,F,C,T]})});function ba({...e}){return(0,U.jsx)(oa,{"data-slot":`dropdown-menu`,...e})}function xa({className:e,...t}){return(0,U.jsx)(ma,{"data-slot":`dropdown-menu-trigger`,className:e,...t})}function Sa({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,U.jsx)(Xi,{children:(0,U.jsx)(Zi,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,U.jsx)(qi,{"data-slot":`dropdown-menu-content`,className:g(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Ca({className:e,inset:t,variant:n=`default`,...r}){return(0,U.jsx)(Ki,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:g(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function wa({...e}){return(0,U.jsx)(ca,{"data-slot":`dropdown-menu-sub`,...e})}function Ta({className:e,inset:t,children:n,...r}){return(0,U.jsxs)(ya,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:g(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,U.jsx)(Cn,{className:`ml-auto`})]})}function Ea({align:e=`start`,alignOffset:t=-3,side:n=`right`,sideOffset:r=0,className:i,...a}){return(0,U.jsx)(Sa,{"data-slot":`dropdown-menu-sub-content`,className:g(`w-auto min-w-[96px] rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,i),align:e,alignOffset:t,side:n,sideOffset:r,...a})}function Da({className:e,...t}){return(0,U.jsx)(_a,{"data-slot":`dropdown-menu-separator`,className:g(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var Oa=H.createContext(void 0);function ka(e){let t=H.useContext(Oa);if(t===void 0&&!e)throw Error(B(72));return t}var Aa={...lr,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},ja=class extends f{constructor(e,t,n){let r=new jt;super(Ma(e,r,t,n),Na(r),Aa)}setOpen=(e,t)=>{gt(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,d(z,e))}};function Ma(e,t,n,r=!1){let i={...nr(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=rr(t,n,r),i}function Na(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var Pa=ye(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:f=null,children:p}=e,m=St((e,t)=>new ja({open:n,openProp:r,activeTriggerId:f,triggerIdProp:u},e,t));m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Ot(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:x}=Bt(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=H.useRef(null);V(()=>{h&&t&&m.setOpen(!1,d(_e))},[h,t,m]),V(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),V(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]),H.useImperativeHandle(o,()=>({unmount:b,close:()=>m.setOpen(!1,d(D))}),[b,m]);let E=g||v||!t&&a!==`none`;return(0,U.jsxs)(Oa.Provider,{value:m,children:[l&&(0,U.jsx)(wt,{handle:l,store:m}),E&&(0,U.jsx)(Fa,{store:m,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:y}):p]})});function Fa({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Wt(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=er(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=H.useMemo(()=>ee(a.reference,i.reference),[a.reference,i.reference]);return bt(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??L}),null}var Ia=H.createContext(void 0);function La(){return H.useContext(Ia)}var Ra=`data-base-ui-tooltip-trigger`;function za(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(Fe(n))return n}}let t=e.target;return Fe(t)?t:null}function Ba(e){let t=e;for(;t;){let e=t.closest(`[${Ra}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&Fe(n.host)?n.host:null}return null}var Va=c(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=ka(!0),h=dr(a)??m;if(!h)throw Error(B(82));let g=xe(f),v=h.useState(`isTriggerActive`,g),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`floatingRootContext`),S=H.useRef(null),C=c??600,w=u??0,{registerTrigger:T,isMountedByThisTrigger:E}=kt(g,S,h,{payload:o,closeOnClick:l,closeDelay:w}),D=La(),{delayRef:O,isInstantPhase:k,hasProvider:A}=Zn(b,{open:y}),M=vr(b);h.useSyncedValue(`isInstantPhase`,k);let N=h.useState(`disabled`),P=s??N,F=ot(P),I=h.useState(`trackCursorAxis`),L=h.useState(`disableHoverablePopup`),R=H.useRef(!1),ee=Be(),z=H.useRef(void 0);function te(){return A?Wn(O.current,`open`)===0?0:c??D??600:C}function V(e){let t=S.current;if(!t||!e)return!1;let n=Ba(e);return n!==null&&n!==t&&Te(t,n)}function ne(e){let t=V(e);return R.current=t,t&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,ee.clear()),t}let re=xr(b,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!L&&I!==`both`?kr():null,restMs:te,delay(){return u==null&&A?{close:Wn(O.current,`close`)}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!R.current}}),ie=pr(b,{enabled:!P}).reference,ae=e=>{let t=R.current,n=za(e),r=ne(n),i=S.current,a=i&&n&&Te(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,d(_,e));return}if(t&&!r&&a&&!F.current&&!h.select(`open`)&&i&&x(z.current)){let t=()=>{!R.current&&!F.current&&!h.select(`open`)&&h.setOpen(!0,d(_,e,i))},n=te();n===0?(ee.clear(),t()):ee.start(n,t)}},oe=h.useState(`triggerProps`,E);return j(`button`,e,{state:{open:y},ref:[t,T,S],props:[re,ie,E||I!==`none`?oe:void 0,{onMouseOver(e){ae(e.nativeEvent)},onFocus(e){V(za(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){R.current=!1,ee.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,"data-trigger-disabled":P?``:void 0,[Ra]:P?void 0:``},p],stateAttributesMapping:dt})}),Ha=H.createContext(void 0);function Ua(){let e=H.useContext(Ha);if(e===void 0)throw Error(B(70));return e}var Wa=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return ka().useState(`mounted`)||n?(0,U.jsx)(Ha.Provider,{value:n,children:(0,U.jsx)(M,{ref:t,...r})}):null}),Ga=H.createContext(void 0);function Ka(){let e=H.useContext(Ga);if(e===void 0)throw Error(B(71));return e}var qa=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Pe,style:g,..._}=e,v=ka(),y=Ua(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),O=pt({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),k=H.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,S,T]),A=et(e,k,{styles:O.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,U.jsx)(Ga.Provider,{value:O,children:A})}),Ja=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=ka(),{side:s,align:c}=Ka(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);we({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),yr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return j(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[It,f,nt(d),a],stateAttributesMapping:tt})}),Ya=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=ka(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=Ka(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return j(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:Pt})}),Xa=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=H.useMemo(()=>({open:t,close:n}),[t,n]);return(0,U.jsx)(Ia.Provider,{value:t,children:(0,U.jsx)(Xn,{delay:i,timeoutMs:r,children:e.children})})};function Za({delay:e=0,...t}){return(0,U.jsx)(Xa,{"data-slot":`tooltip-provider`,delay:e,...t})}function Qa({...e}){return(0,U.jsx)(Pa,{"data-slot":`tooltip`,...e})}function $a({...e}){return(0,U.jsx)(Va,{"data-slot":`tooltip-trigger`,...e})}function eo({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,U.jsx)(Wa,{children:(0,U.jsx)(qa,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,U.jsxs)(Ja,{"data-slot":`tooltip-content`,className:g(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,U.jsx)(Ya,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function to(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.old_string==`string`?t.old_string:void 0,r=typeof t.new_string==`string`?t.new_string:typeof t.content==`string`?t.content:void 0;if(n!==void 0||r!==void 0)return{...typeof t.file_path==`string`?{path:t.file_path}:{},removed:ro(n),added:ro(r)}}function no(e,t){let n=!!t?.trim();if(!n){let t=/^--- [^\n]*\n\+\+\+ [^\n]*\n/m.test(e),n=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m.test(e);if(!t||!n)return}let r=0,i=0;return(e.match(/[^\n]*\n|[^\n]+$/g)??[]).map(e=>{let t=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/.exec(e);if(t)return r=Number(t[1]??1),i=Number(t[2]??1),{text:e,kind:`context`};let a=r>0||i>0,o=`context`;return(a||n)&&(e.startsWith(`-`)&&(a||!e.startsWith(`--- `))&&(o=`removed`),e.startsWith(`+`)&&(a||!e.startsWith(`+++ `))&&(o=`added`)),a&&((o===`removed`||e.startsWith(` `))&&(r=Math.max(0,r-1)),(o===`added`||e.startsWith(` `))&&(i=Math.max(0,i-1))),{text:e,kind:o}})}function ro(e){if(!e)return[];let t=e.split(`
3
- `);for(;t.length>0&&t[t.length-1]===``;)t.pop();return t}var io=[[/^mcp__/,`mcp`],[/^(bash|shell|exec|run_?command)$/,`shell`],[/^(read|read_?file|view|notebookread)$/,`read`],[/^(write|write_?file|create_?file|notebookedit)$/,`write`],[/^(edit|multi_?edit|str_replace(_based_edit_tool|_editor)?|apply_?patch)$/,`edit`],[/^(grep|search|ripgrep)$/,`search`],[/^(glob|ls|list|find|list_?directory)$/,`list`],[/^(web_?fetch|web_?search|fetch)$/,`web`],[/^(task|agent)$/,`agent`],[/^todo_?write$/,`todo`]];function ao(e){let t=e.toLowerCase();return io.find(([e])=>e.test(t))?.[1]??`other`}function oo(e){if(typeof e==`string`)return e;let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:void 0;if(!t)return;let n=t.flatMap(e=>typeof e==`object`&&e&&typeof e.text==`string`?[e.text]:[]);return n.length>0?n.join(`
4
- `):void 0}function so(e){if(e!==void 0)return e.split(`
5
- `).filter(e=>e.trim()!==``).length}function co(e,t){return`${e} ${t}${e===1?``:`s`}`}function lo(e){if(e.status===`error`)return`failed`;if(e.status!==`complete`)return;let t=to(e.input);if(t)return`+${t.added.length} −${t.removed.length}`;let n=so(oo(e.result));if(n!==void 0)switch(ao(e.name)){case`read`:return co(n,`line`);case`list`:return co(n,`file`);case`search`:return co(n,`result`);default:return}}var uo={shell:Fn,read:En,write:Tn,edit:wn,search:Pn,list:Dn,web:kn,agent:xn,todo:An,mcp:Mn,other:Ln};function fo({name:e,className:t}){let n=uo[ao(e)];return(0,U.jsx)(n,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,t)})}var po={scale:1,x:0,y:0};function mo(e,t,n){let r=Math.min(8,Math.max(1,e.scale));return{scale:r,x:Math.min(0,Math.max(t-t*r,e.x)),y:Math.min(0,Math.max(n-n*r,e.y))}}function ho(e,t,n,r,i,a){let o=Math.min(8,Math.max(1,e.scale*t)),s=o/e.scale;return mo({scale:o,x:n-(n-e.x)*s,y:r-(r-e.y)*s},i,a)}function go(e,t,n,r,i){return mo({...e,x:e.x+t,y:e.y+n},r,i)}function _o({src:e,alt:t,className:n}){return(0,U.jsxs)(ti,{children:[(0,U.jsx)(ni,{render:(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Open ${t}`:`Open image`,className:`cursor-zoom-in rounded-md outline-none focus-visible:ring-3 focus-visible:ring-ring/30`}),children:(0,U.jsx)(`img`,{src:e,alt:t,className:g(`block`,n)})}),(0,U.jsxs)(ai,{className:`w-auto max-w-[80vw] gap-0 p-2 sm:max-w-[80vw]`,children:[(0,U.jsx)(ci,{className:`sr-only`,children:t||`Image`}),(0,U.jsx)(vo,{src:e,alt:t})]})]})}function vo({src:e,alt:t}){let n=(0,H.useRef)(null),r=(0,H.useRef)(void 0),[i,a]=(0,H.useState)(po);(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:1,i=t.deltaX*r,o=t.deltaY*r;a(e=>t.ctrlKey?ho(e,Math.exp(-Math.max(-50,Math.min(50,o))*.01),t.clientX-n.left,t.clientY-n.top,n.width,n.height):go(e,-i,-o,n.width,n.height))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let o=()=>n.current.getBoundingClientRect(),s=()=>{r.current=void 0};return(0,U.jsx)(`div`,{ref:n,className:g(`relative touch-none overflow-hidden rounded-md select-none`,i.scale>1?`cursor-grab active:cursor-grabbing`:`cursor-zoom-in`),onPointerDown:e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),r.current={x:e.clientX,y:e.clientY})},onPointerMove:e=>{let t=r.current;if(!t)return;let{width:n,height:i}=o(),s=e.clientX-t.x,c=e.clientY-t.y;r.current={x:e.clientX,y:e.clientY},a(e=>go(e,s,c,n,i))},onPointerUp:s,onPointerCancel:s,onDoubleClick:e=>{let{left:t,top:n,width:r,height:i}=o(),s=e.clientX-t,c=e.clientY-n;a(e=>e.scale>1?po:ho(e,2,s,c,r,i))},children:(0,U.jsx)(`img`,{src:e,alt:t,draggable:!1,className:`block max-h-[calc(80dvh-1rem)] max-w-[calc(80vw-1rem)] origin-top-left will-change-transform`,style:{transform:`translate(${i.x}px, ${i.y}px) scale(${i.scale})`}})})}function yo(e){if(!e.startsWith(`/`))return;let t=/^\/([A-Za-z0-9][\w-]*(?::(?:[A-Za-z0-9][\w-]*)?)?)?/.exec(e)?.[1]??``;return{name:t,to:t.length+1}}function bo(e){let t=yo(e);if(!t||t.name===``||t.name.endsWith(`:`))return;let n=e[t.to];if(n===void 0||n===` `||n===`
6
- `)return{...t,rest:e.slice(t.to)}}function xo(e,t){let n=(t??[]).filter(t=>e.startsWith(`mcp__${t.id}__`)).sort((e,t)=>t.id.length-e.id.length)[0];return n&&{connection:n.name,tool:e.slice(`mcp__${n.id}__`.length)}}function So({name:e}){let t=xo(e,Ue().config.mcp);return t?(0,U.jsxs)(Qa,{children:[(0,U.jsxs)($a,{render:(0,U.jsx)(`span`,{}),children:[t.connection,` › `,t.tool]}),(0,U.jsx)(eo,{children:e})]}):e}var Co=[{decision:`allow`,label:`Allow once`,description:`Run it this time, and ask again next time.`},{decision:`deny`,label:`Deny`,description:`Refuse it, and stop asking for the rest of this turn.`},{decision:`always`,label:`Always allow on this machine`,description:`Run it, and never ask again in any Agent Session. Revocable in Settings.`}],wo=Co.slice(0,2);function To(e){return e===!1?wo:Co}function Eo(e){switch(e){case void 0:return;case`asked`:return`waiting to be authorised`;case`allowed`:return`authorised`;case`always`:return`always authorised on this machine`;case`denied`:return`refused`}}function Do({className:e,...t}){return(0,U.jsx)(`textarea`,{"data-slot":`textarea`,className:g(`flex field-sizing-content min-h-16 w-full resize-none rounded-2xl border border-transparent bg-input/50 px-2.5 py-2 text-base transition-[color,box-shadow] duration-200 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Oo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ko=Oo();function Ao(e){ko=e}var jo={exec:()=>null};function Mo(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function W(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Po.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var No=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Po={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Mo(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Mo(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Mo(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Mo(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Mo(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Mo(e=>RegExp(`^ {0,${e}}>`))},Fo=/^(?:[ \t]*(?:\n|$))+/,Io=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Lo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ro=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Bo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Vo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ho=W(Vo).replace(/bull/g,Bo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Uo=W(Vo).replace(/bull/g,Bo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Wo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Go=/^[^\n]+/,Ko=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qo=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ko).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jo=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Bo).getRegex(),Yo=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Xo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zo=W(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Xo).replace(`tag`,Yo).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Qo=e=>W(Wo).replace(`hr`,Ro).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Yo).getRegex(),$o=Qo(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),es=Qo(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ts={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,es).getRegex(),code:Io,def:qo,fences:Lo,heading:zo,hr:Ro,html:Zo,lheading:Ho,list:Jo,newline:Fo,paragraph:$o,table:jo,text:Go},ns=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ro).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Yo).getRegex(),rs={...ts,lheading:Uo,table:ns,paragraph:W(Wo).replace(`hr`,Ro).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ns).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Yo).getRegex()},is={...ts,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Xo).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Wo).replace(`hr`,Ro).replace(`heading`,` *#{1,6} *[^
7
- ]`).replace(`lheading`,Ho).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},as=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,os=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ss=/^( {2,}|\\)\n(?!\s*$)/,cs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ls=/[\p{P}\p{S}]/u,us=/[\s\p{P}\p{S}]/u,ds=/[^\s\p{P}\p{S}]/u,fs=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,us).getRegex(),ps=/[\p{Pi}\p{Ps}"']/u,ms=/(?!~)[\p{P}\p{S}]/u,hs=/(?!~)[\s\p{P}\p{S}]/u,gs=/(?:[^\s\p{P}\p{S}]|~)/u,_s=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,No?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),vs=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ys=W(vs,`u`).replace(/punct/g,ls).getRegex(),bs=W(vs,`u`).replace(/punct/g,ms).getRegex(),xs=W(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,ps).replace(/punct/g,ls).getRegex(),Ss=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Cs=W(Ss,`gu`).replace(/notPunctSpace/g,ds).replace(/punctSpace/g,us).replace(/punct/g,ls).getRegex(),ws=W(Ss,`gu`).replace(/notPunctSpace/g,gs).replace(/punctSpace/g,hs).replace(/punct/g,ms).getRegex(),Ts=W(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ds).replace(/punctSpace/g,us).replace(/punct/g,ls).getRegex(),Es=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ds).replace(/punctSpace/g,us).replace(/punct/g,ls).getRegex(),Ds=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ds).replace(/punctSpace/g,us).replace(/punct/g,ls).getRegex(),Os=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ls).getRegex(),ks=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ds).replace(/punctSpace/g,us).replace(/punct/g,ls).getRegex(),As=W(/\\(punct)/,`gu`).replace(/punct/g,ls).getRegex(),js=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ms=W(Xo).replace(`(?:-->|$)`,`-->`).getRegex(),Ns=W(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Ms).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ps=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Fs=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Ps).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Is=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ps).replace(`ref`,Ko).getRegex(),Ls=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ko).getRegex(),Rs=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Is).replace(`nolink`,Ls).getRegex(),zs=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bs={_backpedal:jo,anyPunctuation:As,autolink:js,blockSkip:_s,br:ss,code:os,del:jo,delLDelim:jo,delRDelim:jo,emStrongLDelim:ys,emStrongRDelimAst:Cs,emStrongRDelimUnd:Es,escape:as,link:Fs,nolink:Ls,punctuation:fs,reflink:Is,reflinkSearch:Rs,tag:Ns,text:cs,url:jo},Vs={...Bs,emStrongLDelim:xs,emStrongRDelimAst:Ts,emStrongRDelimUnd:Ds,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ps).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ps).getRegex()},Hs={...Bs,emStrongRDelimAst:ws,emStrongLDelim:bs,delLDelim:Os,delRDelim:ks,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,zs).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,zs).getRegex()},Us={...Hs,br:W(ss).replace(`{2,}`,`*`).getRegex(),text:W(Hs.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ws={normal:ts,gfm:rs,pedantic:is},Gs={normal:Bs,gfm:Hs,breaks:Us,pedantic:Vs},Ks={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},qs=e=>Ks[e];function Js(e,t){if(t){if(Po.escapeTest.test(e))return e.replace(Po.escapeReplace,qs)}else if(Po.escapeTestNoEncode.test(e))return e.replace(Po.escapeReplaceNoEncode,qs);return e}function Ys(e){try{e=encodeURI(e).replace(Po.percentDecode,`%`)}catch{return null}return e}function Xs(e,t){let n=e.replace(Po.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Po.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Po.slashPipe,`|`);return n}function Zs(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Qs(e){let t=e.split(`
8
- `),n=t.length-1;for(;n>=0&&Po.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
9
- `)}function $s(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function ec(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function tc(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function nc(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
2
+ `)+1),fromSessionId:t.fromSessionId},...t.attachments===void 0?{}:{attachments:t.attachments},at:n})};case`subagent_instruction`:return{...e,entries:hn(e.entries,{kind:`user`,id:t.id,text:t.text,producer:t.producer,at:n})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:hn(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`thinking`:return{...e,entries:hn(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...mn(t)})};case`tool_started`:return{...e,entries:hn(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...mn(t)})};case`tool_updated`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:gn(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&an(r.status),a=an(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:hn(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},...t.model===void 0?{}:{model:t.model},...t.effort===void 0?{}:{effort:t.effort},...t.producer===void 0?{}:{producer:t.producer},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:hn(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...mn(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:hn(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?pn(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:gn(e.entries,t.callId,e=>({...e,authorisation:fn(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,entries:sn(e.entries,n),turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=nn([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?nn([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text,...t.sessionId===void 0?{}:{sessionId:t.sessionId}}]};case`compacting`:return t.active?{...e,compacting:!0}:un(e);case`compacted`:return{...un(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:dn(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`rewound`:{let n=e.entries.findIndex(e=>e.kind===`user`&&e.id===t.userMessageId),r=t.restore===`files`?`Files rewound`:t.restore===`both`?`Rewound conversation and files`:`Rewound conversation`;return{...e,entries:[...n<0||t.restore===`files`?e.entries:e.entries.map((e,t)=>t<n||e.rewound?e:{...e,rewound:!0}),{kind:`marker`,id:`rewound-${e.entries.length}`,marker:`rewound`,text:r}]}}case`forked`:return{...e,entries:[...e.entries,{kind:`marker`,id:`forked-${e.entries.length}`,marker:`forked`,text:`Forked`,fromSessionId:t.fromSessionId}]};case`revived`:return{...e,...t.scope===void 0?{}:{scope:t.scope},lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function un(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function dn(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${Jt(t)} tokens`:`${r}, ${Jt(t)} → ${Jt(n)} tokens`}function fn(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function pn(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function mn(e){return e.producer===void 0?{}:{producer:e.producer}}function hn(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function gn(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var H=e(be(),1),_n=e(E(),1);function vn(e){return`${e.kind}:${e.id}`}var U=Re();function yn(e,t){let n=/\/worktrees\/([^/]+)\/[^/]+$/.exec(e)?.[1];return n===void 0?void 0:t.find(e=>e.name===n)?.path}var bn=it(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),xn=it(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Sn=it(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Cn=it(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wn=it(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Tn=it(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),En=it(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Dn=it(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),On=it(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),kn=it(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),An=it(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),jn=it(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Mn=it(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Nn=it(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Pn=it(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Fn=it(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),In=it(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ln=it(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Rn=it(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),zn=it(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Bn(e){let t=e.trim();return t.startsWith(`/`)||t.startsWith(`~`)?`completion`:`search`}function Vn(e){return e.trim()!==``}function Hn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.group===n.group){e.items.push(n);continue}t.push({group:n.group,items:[n]})}return t}function Un(e,t){if(t===void 0||t===``)return e;let n=t.endsWith(`/`)?t:`${t}/`;if(!e.startsWith(n))return e;let r=e.slice(n.length);return r===``?e:r}function Wn(e,t){return t!=null&&!x(t)?0:typeof e==`function`?e():e}function Gn(e,t,n){let r=Wn(e,n);return typeof r==`number`?r:r?.[t]}function Kn(e){return typeof e==`function`?e():e}function qn(e,t){return t||e===`click`||e===`mousedown`}function Jn(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Yn=H.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ie,currentIdRef:{current:null},currentContextRef:{current:null}});function Xn(e,t){e.current=t.current}function Zn(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=H.useRef(n),a=H.useRef(n),o=H.useRef(null),s=H.useRef(null),c=Be();return V(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Gn(i.current,`open`),close:Gn(n,`close`)}},[n,o,i,a]),(0,U.jsx)(Yn.Provider,{value:H.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Qn(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:f}=H.useContext(Yn),[p,m]=H.useState(!1),h=H.useRef(n);return V(()=>{h.current=n},[n]),V(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,f.clear()}if(a.current&&!n&&a.current===i){if(m(!1),s){let t=i;return f.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(h.current||a.current!==t)&&f.clear()}}e()}},[n,i,a,o,s,c,l,f,r]),V(()=>{if(!n)return;let e=l.current,t=a.current;f.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:m},a.current=i,o.current={open:0,close:Gn(c.current,`close`)},t!==null&&t!==i?(m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,d(F))):(m(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,f]),V(()=>()=>{if(a.current===i){if(l.current=null,!h.current)return;a.current=null,Xn(o,c),f.clear()}},[l,a,o,i,c,f]),H.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:p}),[u,o,p])}function $n(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function er(e){return e!=null&&e.clientX!=null}function tr(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=H.useRef(!1),u=H.useRef(null),[d,f]=H.useState(),[p,m]=H.useState([]),h=A(e=>{i.set(`positionReference`,e)}),g=A((e,t,n)=>{l.current||c.current.openEvent&&!er(c.current.openEvent)||i.set(`positionReference`,$n(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=A(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=x(d)?o:a;H.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=ae(o);function r(t){let n=Ae(t);Te(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||er(c.current.openEvent)?u.current=Le(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),H.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),H.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),H.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=H.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return H.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function nr(){return new Vt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new jt,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function rr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:nr(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:L,inactiveTriggerProps:L,popupProps:L}}function ir(e,t,n=!1){return new Vt({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var ar=e=>e.triggerIdProp??e.activeTriggerId,or=e=>e.openProp??e.open,sr=e=>(e.popupElement?.id??e.floatingId)||void 0;function cr(e,t){return t!==void 0&&or(e)&&ar(e)===t}function lr(e,t){return cr(e,t)?!0:t!==void 0&&or(e)&&ar(e)==null&&e.triggerCount===1}var ur={open:or,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ar,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:sr,isTriggerActive:(e,t)=>t!==void 0&&ar(e)===t,isOpenedByTrigger:(e,t)=>cr(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ar(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>lr(e,t)?sr(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},dr=S();function fr(e){let t=H.useCallback(t=>e===void 0?h:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,dr.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pr=He&&fe;function mr(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=Be();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=ae(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&se(e)&&e===re(b(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return P(Le(t,`blur`,r),pr&&Le(t,`keydown`,a,!0),pr&&Le(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);Fe(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let f=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Ae(t.nativeEvent);if(Fe(a)){if(pr&&!t.relatedTarget){if(!l.current&&!Oe(a))return}else if(!ge(a))return}let o=Ne(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:p}=t,m=typeof r==`function`?r():r;if(i.select(`open`)&&o||m===0||m===void 0){i.setOpen(!0,d(De,f,p));return}u.start(m,()=>{s.current||i.setOpen(!0,d(De,f,p))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=Fe(n)&&n.hasAttribute(N(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=re(b(e));!n&&t===e||Te(o.current.floatingContext?.refs.floating.current,t)||Te(e,t)||a||Ne(n??t,i.context.triggerElements)||i.setOpen(!1,d(De,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}var hr=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ie,this.restTimeout=new ie,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},gr=new WeakMap;function _r(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&gr.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),gr.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function vr(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=gr.get(n);a&&a!==e&&_r(a),_r(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,gr.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function yr(e){let t=e.context.dataRef.current,n=a(()=>t.hoverInteractionState??hr.create()).current;return t.hoverInteractionState||=n,w(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function br(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,s=a.useState(`open`),c=a.useState(`floatingElement`),l=a.useState(`domReferenceElement`),{dataRef:u}=a.context,f=Qe(),p=ut(),m=yr(a),h=Be(),g=A(()=>qn(u.current.openEvent?.type,m.interactedInside)),v=A(()=>Jn(u.current.openEvent?.type)),y=A(()=>{_r(m)});V(()=>{s||(m.pointerType=void 0,m.restTimeoutPending=!1,m.interactedInside=!1,y())},[s,m,y]),H.useEffect(()=>y,[y]),V(()=>{if(n&&s&&m.handleCloseOptions?.blockPointerEvents&&v()&&Fe(l)&&c){let e=l,t=c,n=b(c),r=f?.nodesRef.current.find(e=>e.id===p)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=m.pointerEventsScopeElement===t?null:m.pointerEventsScopeElement,a=r===t?null:r,o=m.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return vr(m,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,s,l,c,m,v,f,p,y]),H.useEffect(()=>{if(!n)return;function e(){return!!(f&&p&&Dt(f.nodesRef.current,p).length>0)}function t(e){let t=Gn(r,`close`,m.pointerType),n=()=>{a.setOpen(!1,d(_,e)),f?.events.emit(`floating.closed`,e)};t?m.openChangeTimeout.start(t,n):(m.openChangeTimeout.clear(),n())}function s(e){let t=Ae(e);if(!o(t)){m.interactedInside=!1;return}m.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function l(){m.openChangeTimeout.clear(),h.clear(),f?.events.off(`floating.closed`,x),y()}function b(n){if(e()&&f){f.events.on(`floating.closed`,x);return}if(Ne(n.relatedTarget,a.context.triggerElements))return;let r=u.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(f&&r&&Fe(o)&&Dt(f.nodesRef.current,r,!1).some(e=>Te(e.context?.elements.floating,o)))){if(m.handler){m.handler(n);return}y(),v()&&!g()&&t(n)}}function x(t){!f||!p||e()||h.start(0,()=>{f.events.off(`floating.closed`,x),a.setOpen(!1,d(_,t)),f.events.emit(`floating.closed`,t)})}let S=c;return P(S&&Le(S,`mouseenter`,l),S&&Le(S,`mouseleave`,b),S&&Le(S,`pointerdown`,s,!0),()=>{f?.events.off(`floating.closed`,x)})},[n,c,a,u,r,i,v,g,y,m,f,p,h])}var xr={current:null};function Sr(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=xr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:m,guardStaleOpen:h=!1}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:v,events:y}=g.context,S=Qe(l),C=yr(g),w=H.useRef(!1),T=ot(i),E=ot(r),D=ot(o),O=ot(n),k=ot(m),j=ot(p),M=A(()=>qn(v.current.openEvent?.type,C.interactedInside)),N=A(()=>k.current?.()!==!1),F=A((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!Te(e,t);if(!Fe(n))return!1;let i=n;return r.hasMatchingElement(e=>Te(e,i))&&(!e||!Te(e,i))}),I=A(()=>{C.handler&&=(b(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,C.handler),void 0)}),L=A(()=>{_r(C)});return u&&(C.handleCloseOptions=T.current?.__options),H.useEffect(()=>I,[I]),H.useEffect(()=>{if(!n)return;function e(e){e.open?w.current=!1:(w.current=e.reason===_,I(),C.openChangeTimeout.clear(),C.restTimeout.clear(),C.blockMouseMove=!0,C.restTimeoutPending=!1)}return y.on(`openchange`,e),()=>{y.off(`openchange`,e)}},[n,y,C,I]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Gn(E.current,`close`,C.pointerType);n?C.openChangeTimeout.start(n,()=>{g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e)}):t&&(C.openChangeTimeout.clear(),g.setOpen(!1,d(_,e)),S?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!Fe(t))return;function r(e){if(C.openChangeTimeout.clear(),C.blockMouseMove=!1,a&&!x(C.pointerType))return;let t=Kn(D.current),n=Gn(E.current,`open`,C.pointerType),r=Ae(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(Fe(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(Te(e,r)){s=e;break}}Fe(i)&&Fe(o)&&!g.context.triggerElements.hasElement(i)&&Te(i,o)&&(s=o);let c=s!=null&&F(o,s,r),l=g.select(`open`),u=j.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&w.current,p=!c&&Fe(s)&&Fe(o)&&Te(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,v=!l||c;if(h){N()&&g.setOpen(!0,d(_,e,s));return}m||(n?C.openChangeTimeout.start(n,()=>{v&&N()&&g.setOpen(!0,d(_,e,s))}):v&&N()&&g.setOpen(!0,d(_,e,s)))}function i(t){if(M()){L();return}I();let n=g.select(`domReferenceElement`),r=b(n);C.restTimeout.clear(),C.restTimeoutPending=!1;let i=v.current.floatingContext??f?.();if(!Ne(t.relatedTarget,g.context.triggerElements)){if(T.current&&i){g.select(`open`)||C.openChangeTimeout.clear();let n=c.current;C.handler=T.current({...i,tree:S,x:t.clientX,y:t.clientY,onClose(){L(),I(),O.current&&!M()&&n===g.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,C.handler),C.handler(t);return}(C.pointerType!==`touch`||!Te(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Te(t,e.relatedTarget)||(C.openChangeTimeout.clear(),C.restTimeout.clear(),C.restTimeoutPending=!1)}let l=h?Le(t,`mouseout`,o):void 0;return s?P(Le(t,`mousemove`,r,{once:!0}),Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l):P(Le(t,`mouseenter`,r),Le(t,`mouseleave`,i),l)},[I,L,v,E,g,n,T,C,u,F,M,a,s,D,c,S,O,f,j,N,h]),H.useMemo(()=>{if(!n)return;function e(e){C.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=F(r,n,e.target);if(a&&!x(C.pointerType))return;if(i&&o&&C.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);if(e){let t=C.handleCloseOptions?.getScope?.()??n.ownerDocument.body;vr(C,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Kn(D.current);if(i&&!o||s===0||!o&&C.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;C.restTimeout.clear();function c(){if(C.restTimeoutPending=!1,M())return;let e=g.select(`open`);!C.blockMouseMove&&(!e||o)&&N()&&g.setOpen(!0,d(_,t,n))}C.pointerType===`touch`?_n.flushSync(()=>{c()}):o&&i?c():(C.restTimeoutPending=!0,C.restTimeout.start(s,c))}}},[n,C,M,F,a,g,D,N])}var Cr=.1,wr=Cr*Cr,Tr=.5;function Er(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Dr(e,t,n,r,i,a,o,s,c,l){let u=!1;return Er(e,t,n,r,i,a)&&(u=!u),Er(e,t,i,a,o,s)&&(u=!u),Er(e,t,o,s,c,l)&&(u=!u),Er(e,t,c,l,n,r)&&(u=!u),u}function Or(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function kr(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ar(e={}){let{blockPointerEvents:t=!1}=e,n=new ie,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*wr;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Ae(r),g=r.type===`mouseleave`,_=Te(u,h),v=Te(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&Fe(r.relatedTarget)&&Te(u,r.relatedTarget))return;function y(){return!!(s&&Dt(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=kr(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=kr(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=kr(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=kr(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Or(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Tr+1,o=C||T?S.bottom-Tr:S.top,s=C?T?S.bottom-Tr:S.top:S.bottom-Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Tr/2:Tr*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Tr,o=C||T?S.top+Tr:S.bottom,s=C?T?S.top+Tr:S.bottom:S.top+Tr;M=Dr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Tr+1,o=w||E?S.right-Tr:S.left,s=w?E?S.right-Tr:S.left:S.right-Tr;M=Dr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Tr/2:Tr*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Tr,o=w||E?S.left+Tr:S.right,s=w?E?S.left+Tr:S.right:S.left+Tr;M=Dr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function jr(){let{config:e,refresh:t}=Ue(),{save:n,saving:r}=Ve(),i=e.projectList??[],a=e.projectCandidates??[],o=e.projects?.root??``,s=e.projects?.include??[],c=(0,H.useCallback)((e,r)=>{(async()=>{await n({projects:{include:e}},r)&&await t()})()},[n,t]),l=t=>{let n=Un(t,e.projects?.root===void 0?void 0:e.scope);s.includes(n)||c([...s,n],`Project added.`)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Mr,{included:i,onRemove:e=>c(s.filter((t,n)=>n!==e),`Project removed.`)}),(0,U.jsx)(Nr,{candidates:a,hasRoot:e.projects?.root!==void 0,onAdd:l}),(0,U.jsx)(Fr,{onAdd:l}),(0,U.jsx)(Ir,{current:o,saving:r,onSave:n,onSaved:t})]})}function Mr({included:e,onRemove:t}){return(0,U.jsx)(Ie,{title:`Projects · ${e.length}`,description:e.length===0?`Nothing yet. A Project is one you have opted into — add one below, and it becomes an option in the New Agent Session view.`:`What the New Agent Session view offers, in this order.`,children:e.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-col`,children:e.map((e,n)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b py-1.5 last:border-b-0`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.group===void 0?e.name:`${e.group}/${e.name}`}),e.missing?(0,U.jsx)(`span`,{className:`text-xs text-destructive`,children:`directory is gone`}):null]}),(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.path}),(0,U.jsx)(O,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,onClick:()=>t(n),children:(0,U.jsx)(zn,{"aria-hidden":!0})})]})]},e.path))})})}function Nr({candidates:e,hasRoot:t,onAdd:n}){return t?(0,U.jsx)(Ie,{title:`Found beneath the Project Root · ${e.length}`,description:`Repositories Flow can see but is not offering. Add the ones you work in.`,children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing left to add. Either everything found is already a Project, or the Project Root holds no git repositories within three levels.`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:Hn(e).map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.group===void 0?null:(0,U.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e.group}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.items.map(e=>(0,U.jsxs)(O,{variant:`outline`,size:`sm`,className:`font-mono text-xs font-normal`,onClick:()=>n(e.path),children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),e.name]},e.path))})]},e.group??``))})}):null}function Pr(e){let[t,n]=(0,H.useState)(void 0),r=(0,H.useRef)(``);return(0,H.useEffect)(()=>{if(r.current=e,!Vn(e)){n(void 0);return}let t=new AbortController,i=setTimeout(()=>{(async()=>{try{let i=await p(`/api/directories?q=${encodeURIComponent(e)}`,{signal:t.signal});if(!i.ok)return;let a=await i.json();a.query===r.current&&n(a)}catch{}})()},150);return()=>{t.abort(),clearTimeout(i)}},[e]),t}function Fr({onAdd:e}){let[t,n]=(0,H.useState)(``),r=Pr(t),i=Bn(t);return(0,U.jsxs)(Ie,{title:`Add any directory`,description:(0,U.jsxs)(U.Fragment,{children:[`Type a name to search beneath the Project Root — repositories included, so`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`packages/api`}),` inside a monorepo is reachable. Start with `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`/`}),` or`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),` to complete a path anywhere on this machine instead.`]}),children:[(0,U.jsx)(he,{className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`api, or /home/you/elsewhere`,spellCheck:!1}),r===void 0?null:r.paths.length===0?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i===`completion`?`No directory there.`:`Nothing beneath the Project Root matches.`}):(0,U.jsxs)(`div`,{className:`flex flex-col`,children:[(0,U.jsxs)(`span`,{className:`pb-1 text-xs text-muted-foreground`,children:[i===`completion`?`Directories here`:`Found beneath the Project Root`,r.truncated?` — showing the first few, keep typing`:null]}),r.paths.map(t=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b py-1 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t}),(0,U.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:()=>{e(t),n(``)},children:[(0,U.jsx)(Pn,{"aria-hidden":!0}),`Add`]})]},t))]})]})}function Ir({current:e,saving:t,onSave:n,onSaved:r}){let[i,a]=(0,H.useState)(e);return(0,H.useEffect)(()=>a(e),[e]),(0,U.jsxs)(Ie,{title:`Project Root`,description:(0,U.jsxs)(U.Fragment,{children:[`The directory Flow looks beneath for candidates, and the one it reports as its default Scope. Absolute, or starting with`,` `,(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:`~`}),`. A Project outside it can still be added by path.`]}),children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Where your repositories live`}),(0,U.jsx)(he,{className:`font-mono`,value:i,onChange:e=>a(e.target.value),placeholder:`~/workspace`,spellCheck:!1})]}),(0,U.jsx)(de,{dirty:i.trim()!==e,saving:t,onSave:()=>{(async()=>{let e=i.trim()===``?`Project Root cleared.`:`Project Root saved.`;await n({projects:{root:i.trim()}},e)&&await r()})()},onReset:()=>a(e)})]})}var Lr=H.createContext(void 0);function Rr(e){let t=H.useContext(Lr);if(!e&&t===void 0)throw Error(B(27));return t}var zr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Rr(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return j(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:tt,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Br=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...c}=e,l=Rr(),u=l.useState(`open`),{getButtonProps:f,buttonRef:p}=R({disabled:a,native:o}),m={disabled:a};function h(e){u&&l.setOpen(!1,d(s,e.nativeEvent))}return j(`button`,e,{state:m,ref:[t,p],props:[{onClick:h},c,f]})}),Vr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),j(`p`,e,{ref:t,props:[{id:c},o]})}),Hr=H.createContext(void 0);function Ur(){let e=H.useContext(Hr);if(e===void 0)throw Error(B(26));return e}var Wr={...Pt,...Ee,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},Gr=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Rr(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Ur(),we({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Rt(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=j(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...It,hidden:!m,onKeyDown(e){qe.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Wr});return(0,U.jsx)(Ut,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Kr=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Rr(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,U.jsx)(Hr.Provider,{value:n,children:(0,U.jsxs)(u,{ref:t,...r,children:[a&&o===!0&&(0,U.jsx)($e,{ref:i.context.internalBackdropRef,inert:Me(!s)}),e.children]})}):null});function qr({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=H.useState(0),[u,d]=H.useState(0),f=c===0,p=Wt(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Ae(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Te(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return st(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),V(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),bt(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Jr={...ur,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Yr=class extends f{constructor(e,t,n){let r=new jt,i=Xr(e,r,t,n);super(i,Zr(r),Jr)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};yt(n,e,t.trigger),this.update(n)}};function Xr(e,t,n,r=!1){let i={...rr(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=ir(t,n,r),i}function Zr(e){return{popupRef:H.createRef(),backdropRef:H.createRef(),internalBackdropRef:H.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Qr(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,h=e===`alert-dialog`,g=h?!0:c,_=h||s,v=h?`alertdialog`:`dialog`,y=Rr(!0),b={modal:g,disablePointerDismissal:_,nested:y!=null,role:v},x=St((e,t)=>new Yr({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`);Nt(x,S),Ot(x);let{forceUnmount:T}=Bt(S,x);H.useImperativeHandle(l,()=>({unmount:T,close:()=>x.setOpen(!1,d(D))}),[T,x]);let E=S||C;return(0,U.jsxs)(Lr.Provider,{value:x,children:[u&&(0,U.jsx)(wt,{handle:u,store:x}),E&&(0,U.jsx)(qr,{store:x,parentContext:y?.context,isDrawer:m}),typeof n==`function`?n({payload:w}):n]})}function $r(e){return Qr(`dialog`,e)}var ei=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Rr(),c=xe(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),j(`h2`,e,{ref:t,props:[{id:c},o]})}),ti=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Rr(!0),f=fr(l)??d;if(!f)throw Error(B(79));let p=xe(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=H.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=kt(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=R({disabled:a,native:o}),S=_t(m),C=rt(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return j(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[k]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:dt})});function ni({...e}){return(0,U.jsx)($r,{"data-slot":`dialog`,...e})}function ri({...e}){return(0,U.jsx)(ti,{"data-slot":`dialog-trigger`,...e})}function ii({...e}){return(0,U.jsx)(Kr,{"data-slot":`dialog-portal`,...e})}function ai({className:e,...t}){return(0,U.jsx)(zr,{"data-slot":`dialog-overlay`,className:g(`fixed inset-0 isolate z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function oi({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(ii,{children:[(0,U.jsx)(ai,{}),(0,U.jsxs)(Gr,{"data-slot":`dialog-content`,className:g(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-[min(var(--radius-4xl),24px)] bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none sm:max-w-md dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,U.jsxs)(Br,{"data-slot":`dialog-close`,render:(0,U.jsx)(O,{variant:`ghost`,className:`absolute top-4 right-4 bg-secondary`,size:`icon-sm`}),children:[(0,U.jsx)(zn,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function si({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:g(`flex flex-col gap-1.5`,e),...t})}function ci({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:g(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(Br,{render:(0,U.jsx)(O,{variant:`outline`}),children:`Close`})]})}function li({className:e,...t}){return(0,U.jsx)(ei,{"data-slot":`dialog-title`,className:g(`font-heading text-base leading-none font-medium`,e),...t})}function ui({className:e,...t}){return(0,U.jsx)(Vr,{"data-slot":`dialog-description`,className:g(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function di({session:e,onClose:t}){let{connection:n,config:r}=Ue(),[i,a]=(0,H.useState)(e.suggestedScope??``),[o,s]=(0,H.useState)(()=>yn(e.scope,r.projectList??[])??``),[c,l]=(0,H.useState)(void 0),[u,d]=(0,H.useState)(!1),f=i.trim()!==``&&(!e.worktree||o.trim()!==``),p=async()=>{d(!0),l(void 0);try{await n.command({type:`relocate`,sessionId:e.id,scope:i.trim(),...e.worktree?{repo:o.trim()}:{}}),await n.command({type:`revive`,sessionId:e.id}),t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,U.jsx)(ni,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,U.jsxs)(oi,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(si,{children:[(0,U.jsx)(li,{children:`Relocate Agent Session`}),(0,U.jsx)(ui,{children:`Its Scope no longer exists. Choose where its files are now.`})]}),(0,U.jsx)(ne,{label:`Old Scope`,children:e.scope}),(0,U.jsx)(fi,{label:`Scope`,value:i,onChange:a}),e.worktree?(0,U.jsx)(fi,{label:`Repository`,value:o,onChange:s}):null,c===void 0?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,U.jsxs)(ci,{children:[(0,U.jsx)(O,{variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(O,{disabled:!f||u,onClick:()=>void p(),children:`Relocate and revive`})]})]})})}function fi({label:e,value:t,onChange:n}){let r=Pr(t),i=(0,H.useId)();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),(0,U.jsx)(he,{id:i,className:`font-mono`,value:t,onChange:e=>n(e.target.value),placeholder:`/path/to/folder`,spellCheck:!1}),r?.paths.filter(e=>e!==t).slice(0,5).map(e=>(0,U.jsx)(O,{variant:`ghost`,size:`sm`,className:`justify-start font-mono text-xs`,onClick:()=>n(e),children:e},e))]})}var pi=new Map;function mi(e,t){pi.set(e,structuredClone(t))}function hi(e){let t=pi.get(e);return t&&structuredClone(t)}function gi(e){pi.delete(e)}function _i(e){for(let t of pi.keys())e.has(t)||pi.delete(t)}var vi=2e3,yi=3e4,bi=(0,H.createContext)(void 0);function xi(){let e=(0,H.useContext)(bi);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function Si({children:e}){let{connection:t}=Ue(),[n,r]=(0,H.useState)([]),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(void 0),c=(0,H.useRef)(()=>{});(0,H.useEffect)(()=>{let e=!1,n,i,o=0,s=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++o;try{let i=await t.listSessions();if(e||n<=s)return;s=n,l=0,_i(new Set(i.map(e=>e.id))),r(i),a(!0),u(vi)}catch{if(e)return;a(!0),l+=1,u(Math.min(yi,vi*2**l))}},f=()=>{document.hidden||d()};return c.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,c.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let l=(0,H.useCallback)(()=>c.current(),[]),u=n.find(e=>e.id===o);return(0,U.jsxs)(bi.Provider,{value:{sessions:n,loaded:i,nudge:l,relocate:s},children:[e,u?(0,U.jsx)(di,{session:u,onClose:()=>{s(void 0),l()}}):null]})}function Ci(){let{connection:e}=Ue(),{nudge:t,relocate:n}=xi();return(0,H.useCallback)(async r=>{try{let n=await e.command(r);return t(),n}catch(e){if(e.code===`scope_missing`&&`sessionId`in r){n(r.sessionId),t();return}ze.error(`${r.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t,n])}var wi=[`general`,`projects`,`permissions`,`providers`,`appearance`,`keyboard`,`workflows`,`secrets`,`mcp`],Ti={sessionId:void 0};function Ei(e){let[t=``,n=``]=e.replace(/^#\/?/,``).split(`?`,2),r=t.split(`/`).filter(e=>e!==``);if(r[0]===`settings`)return{sessionId:void 0,settings:ki(r[1])};let i=Di(r),a=new URLSearchParams(n).get(`settings`);return a===null?i:{...i,settings:ki(a)}}function Di(e){if(e[0]===`schedules`){let t={sessionId:void 0,schedules:!0};if(e[1]===`occurrences`){let n=Ai(e[2]??``);return n?{...t,occurrenceId:n}:t}let n=Ai(e[1]??``);return n?{...t,scheduleId:n}:t}if(e[0]===`new`&&e[1])return{sessionId:void 0,backend:Ai(e[1])};if(e[0]!==`s`||e[1]===void 0)return Ti;let t=Ai(e[1]);return{sessionId:t===``?void 0:t}}function Oi(e){let t=e.schedules?`#/schedules${e.occurrenceId?`/occurrences/${encodeURIComponent(e.occurrenceId)}`:e.scheduleId?`/${encodeURIComponent(e.scheduleId)}`:``}`:e.sessionId===void 0?e.backend?`#/new/${encodeURIComponent(e.backend)}`:``:`#/s/${encodeURIComponent(e.sessionId)}`;return e.settings===void 0?t:`${t||`#/`}?settings=${e.settings}`}function ki(e){return wi.find(t=>t===Ai(e??``))??wi[0]}function Ai(e){try{return decodeURIComponent(e)}catch{return``}}function ji(e){return e.title||e.id}var Mi=60,Ni=[{key:`description`,shape:`text`},{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`prompt`,shape:`text`}],Pi=Ni.filter(({key:e})=>e!==`description`);function Fi(e){return Li(e,Mi)}function Ii(e){return Li(e,1/0,Pi)}function Li(e,t,n=Ni){if(!e||typeof e!=`object`)return;let r=e;for(let e of n){let n=r[e.key];if(e.shape===`questions`){let e=Ri(n,t);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Bi(n.trim(),t):zi(n,t)}let i=Object.values(r).filter(e=>typeof e==`string`),a=i.length===1?i[0]:void 0;return a&&a.trim()!==``?zi(a,t):void 0}function Ri(e,t){if(!Array.isArray(e)||e.length===0)return;let n=e[0];if(!n||typeof n!=`object`)return;let r=n.question;if(typeof r!=`string`||r.trim()===``)return;let i=e.length-1;return zi(i>0?`${r} (+${i} more)`:r,t)}function zi(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Bi(e,t){return e.length<=t?e:`…${e.slice(-(t-1))}`}var Vi=H.createContext(void 0);function Hi(e){let t=H.useContext(Vi);if(t===void 0&&!e)throw Error(B(33));return t}var Ui=H.createContext(void 0);function Wi(e){let t=H.useContext(Ui);if(t===void 0&&!e)throw Error(B(36));return t}var Gi=H.createContext(void 0);function Ki(e=!0){let t=H.useContext(Gi);if(t===void 0&&!e)throw Error(B(25));return t}function qi(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Ki(!0),f=d!==void 0;return H.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:We})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!He&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&m(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Ji={type:`regular-item`};function Yi(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=H.useRef(null),{getButtonProps:d,buttonRef:f}=R({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=qi({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=H.useCallback(e=>ee(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=I(u,f);return H.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Xi=H.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Ke({guess:!0,label:a}),f=Hi(!0),p=xe(i),{store:m}=Wi(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Yi({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Ji});return j(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Zi=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Wi(),{side:c,align:l}=Hi(),u=Et(!0)!=null,f=s.useState(`open`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`mounted`),g=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),y=s.useState(`lastOpenChangeReason`),b=s.useState(`rootId`),x=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=v.type===`context-menu`;we({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}}),H.useEffect(()=>{function e(e){s.setOpen(!1,d(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),br(x,{enabled:w&&!T&&!D&&v.type!==`menubar`,closeDelay:C});let O=s.useStateSetter(`popupElement`),k={transitionStatus:p,side:c,align:l,open:f,nested:v.type===`menu`,instant:g},A=j(`div`,e,{state:k,ref:[t,s.context.popupRef,O],stateAttributesMapping:tt,props:[m,{onKeyDown(e){u&&qe.has(e.key)&&e.stopPropagation()}},nt(p),o,{"data-rootownerid":b}]}),M=v.type===void 0||D;return(_||v.type===`menubar`&&y!==`outside-press`)&&(M=!0),(0,U.jsx)(Ut,{context:x,openInteractionType:E,modal:D,disabled:!h,returnFocus:a===void 0?M:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Qi=H.createContext(void 0);function $i(){let e=H.useContext(Qi);if(e===void 0)throw Error(B(32));return e}var ea=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Wi();return i.useState(`mounted`)||n?(0,U.jsx)(Qi.Provider,{value:n,children:(0,U.jsx)(u,{ref:t,...r})}):null}),ta=H.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=ce,style:_,...v}=e,{store:b}=Wi(),x=$i(),S=Ki(!0),C=b.useState(`parent`),w=b.useState(`floatingRootContext`),T=b.useState(`floatingTreeRoot`),E=b.useState(`mounted`),D=b.useState(`open`),O=b.useState(`modal`),k=b.useState(`openMethod`),A=b.useState(`activeTriggerElement`),j=b.useState(`transitionStatus`),M=b.useState(`positionerElement`),N=b.useState(`instantType`),P=b.useState(`adaptiveOrigin`),F=b.useState(`lastOpenChangeReason`),I=b.useState(`floatingNodeId`),L=b.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),ee=H.useRef(null),z=ke(M),B=n,te=c,ne=l,re=s,ie=g;C.type===`context-menu`&&(B=n??C.context?.anchor,re??=`start`,!o&&re!==`center`&&(ne=e.alignOffset??2,te=e.sideOffset??-5));let ae=o,oe=re;C.type===`menu`?(ae??=`inline-end`,oe??=`start`,ie=e.collisionAvoidance??Pe):C.type===`menubar`&&(ae??=C.context.orientation===`vertical`?`inline-end`:`bottom`,oe??=`start`);let se=C.type===`context-menu`,le=pt({anchor:B,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:ae,sideOffset:te,align:oe,alignOffset:ne,arrowPadding:se?0:p,collisionBoundary:u,collisionPadding:f,sticky:m,nodeId:I,keepMounted:x,disableAnchorTracking:h,collisionAvoidance:ie,shift:se?{crossAxis:!(`side`in ie&&ie.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P});H.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&b.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===b.select(`floatingParentNodeId`)&&b.setOpen(!1,d(y)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[b,T.events,I]),H.useEffect(()=>{if(b.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==b.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;b.setOpen(!1,d(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,b]);let ue=Be();H.useEffect(()=>{D||ue.clear()},[D,ue]),H.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==b.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=b.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{b.setOpen(!1,d(y))}):b.setOpen(!1,d(y))}else ue.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,b,ue]),H.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:b.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,b,I,L]),V(()=>{let e=R,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return z(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,z,b]);let de={open:D,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:C.type===`menu`,instant:N},fe=C.type===`menubar`&&C.context.modal;Ye(D&&(fe||O&&F!==`trigger-hover`),k===`touch`,M,A);let pe=et(e,de,{styles:le.positionerStyles,transitionStatus:j,props:v,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),me=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),he=null;return C.type===`menubar`?he=C.context.contentElement:C.type===void 0&&(he=A),(0,U.jsxs)(Vi.Provider,{value:le,children:[me&&(0,U.jsx)($e,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Me(!D),cutout:he}),(0,U.jsx)(lt,{id:I,children:(0,U.jsx)(at,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:pe})})]})}),na=H.createContext(null);function ra(e){let t=H.useContext(na);if(t===null&&!e)throw Error(B(5));return t}var ia={...ur,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},aa=class extends f{constructor(e){super({...sa(),...e},oa(),ia),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function oa(){return{positionerRef:H.createRef(),popupRef:H.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),onOpenChangeComplete:void 0,triggerElements:new jt}}function sa(){return{...rr(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Xe,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:L,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var ca=H.createContext(void 0);function la(){return H.useContext(ca)}var ua=ye(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:u=`vertical`,actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:_=!0}=e,v=Ki(!0),y=Wi(!0),b=ra(!0),x=la(),S=H.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=da({open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:S});C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,h),C.useContextCallback(`onOpenChangeComplete`,i);let w=te(),T=te(),E=C.useState(`floatingTreeRoot`),O=Ht(E),k=ut(),j=C.useState(`open`),M=C.useState(`activeTriggerElement`),N=C.useState(`positionerElement`),P=C.useState(`hoverEnabled`),F=C.useState(`disabled`),I=C.useState(`lastOpenChangeReason`),R=C.useState(`parent`),z=C.useState(`activeIndex`),B=C.useState(`payload`),ne=C.useState(`floatingParentNodeId`),re=H.useRef(null),ie=H.useRef(R.type!==`context-menu`),ae=Be(),oe=H.useRef(!0),se=Be(),ce=ne!=null,{openMethod:le,triggerProps:ue}=Tt(j);C.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:R.type===void 0?s:void 0,openMethod:le,rootId:w}),Ot(C);let{forceUnmount:de}=Bt(j,C,()=>{C.set(`allowMouseEnter`,!1)});V(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:O,floatingParentNodeId:k}):y&&C.update({floatingNodeId:O,floatingParentNodeId:k})},[v,y,O,k,C]),H.useEffect(()=>{if(j||(re.current=null),R.type===`context-menu`){if(!j){ae.clear(),ie.current=!1;return}ae.start(500,()=>{ie.current=!0})}},[ae,j,R.type]),V(()=>{!j&&!P&&C.set(`hoverEnabled`,!0)},[j,P,C]);let fe=A((e,t)=>{let n=t.reason;if(!e&&!C.select(`open`)||j===e&&t.trigger===M&&I===n)return;let i=Mt(t);if(!e&&t.trigger==null&&(t.trigger=M??void 0),r?.(e,t),t.isCanceled)return;C.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!oe.current)return;e&&n===`trigger-focus`?(oe.current=!1,se.start(300,()=>{oe.current=!0})):(oe.current=!0,se.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};re.current=t.event,yt(c,e,t.trigger,i()),C.update(c),R.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):o||s?C.set(`instantType`,o?`click`:`dismiss`):C.set(`instantType`,void 0)}),pe=mt({popupStore:C,floatingId:T,nested:k!=null,onOpenChange:fe}),me=pe.context.events;V(()=>{let e=({open:e,eventDetails:t})=>fe(e,t);return me.on(`setOpen`,e),()=>{me?.off(`setOpen`,e)}},[me,fe]);let he=H.useCallback(()=>{C.setOpen(!1,d(D))},[C]);H.useImperativeHandle(f,()=>({unmount:de,close:he}),[de,he]);let ge;R.type===`context-menu`&&(ge=R.context),H.useImperativeHandle(ge?.positionerRef,()=>N,[N]),H.useImperativeHandle(ge?.actionsRef,()=>({setOpen:fe}),[fe]);let _e=Wt(pe,{enabled:!F,bubbles:{escapeKey:p&&R.type===`menu`},outsidePress(){return R.type!==`context-menu`||re.current?.type===`contextmenu`||ie.current},externalTree:ce?E:void 0}),ve=ct(),ye=H.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),be=xt(pe,{enabled:!F,listRef:C.context.itemDomElements,activeIndex:z,nested:R.type!==void 0,loopFocus:c,orientation:u,parentOrientation:R.type===`menubar`?R.context.orientation:void 0,rtl:ve===`rtl`,disabledIndices:l,onNavigate:ye,openOnArrowKeyDown:R.type!==`context-menu`,externalTree:ce?E:void 0,focusItemOnHover:_}),xe=H.useCallback(e=>{C.context.typingRef.current=e},[C]),Se=Ge(pe,{enabled:!F,listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:z,resetMs:500,onMatch:e=>{j&&e!==z&&C.set(`activeIndex`,e)},onTyping:xe}),Ce=H.useMemo(()=>{let e=ee(Se.reference,be.reference,_e.reference,{onMouseMove(){C.set(`allowMouseEnter`,!0)}},ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=j,e},[C,Se.reference,be.reference,_e.reference,ue,j]),we=H.useMemo(()=>{let e=ee(be.trigger,_e.trigger,ue);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,_e.trigger,ue]),Te=H.useMemo(()=>ee(It,{id:T,role:`menu`,"aria-labelledby":M?.id,onMouseMove(){C.set(`allowMouseEnter`,!0),R.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Se.floating,be.floating,_e.floating),[M,T,R.type,C,Se.floating,be.floating,_e.floating]),Ee=be.item??L;bt(C,{floatingRootContext:pe,activeTriggerProps:Ce,inactiveTriggerProps:we,popupProps:Te,itemProps:Ee});let De=H.useMemo(()=>({store:C,parent:S}),[C,S]),Oe=(0,U.jsxs)(Ui.Provider,{value:De,children:[m&&(0,U.jsx)(wt,{handle:m,store:C}),typeof t==`function`?t({payload:B}):t]});return R.type===void 0||R.type===`context-menu`?(0,U.jsx)(Je,{externalTree:E,children:Oe}):Oe});function da(e){return a(()=>new aa(e)).current}function fa(e){let t=Wi().store,n=H.useMemo(()=>({parentMenu:t}),[t]);return(0,U.jsx)(ca.Provider,{value:n,children:(0,U.jsx)(ua,{...e})})}function pa(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=v(),{ref:i,index:a}=Ke(e),o=n===a,s=H.useRef(null),c=I(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function ma(e){let{render:t,className:n,style:r,state:i=L,props:a=l,refs:o=l,metadata:s,stateAttributesMapping:c,tag:u=`div`,...d}=e,{compositeProps:f,compositeRef:p}=pa({metadata:s});return j(u,e,{state:i,ref:[p,...o],props:[f,...a,d],stateAttributesMapping:c})}function ha(e){if(se(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!le(e))return ha(je(e))}function ga(e,t){let n=H.useRef(null);function r(t){_n.flushSync(()=>{e.setOpen(!1,d(C,t.nativeEvent,t.currentTarget))}),me(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&pe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_n.flushSync(()=>{e.setOpen(!1,d(C,n.nativeEvent,n.currentTarget))});let i=Ce(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Te(r,i);){let e=i;if(i=ue(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function _a(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=H.useRef(!1);return H.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,b(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:L,[t,n,r])}var va=c(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=Wi(!0),h=fr(d)??m?.store;if(!h)throw Error(B(85));let g=xe(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=h.useState(`triggerPopupId`,g),C=H.useRef(null),w=ba(),E=v(!0),D=Qe(),O=H.useMemo(()=>D??new Xe,[D]),k=Ht(O),M=ut(),{registerTrigger:N,isMountedByThisTrigger:P}=kt(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:M,keyboardEventRelay:E?.relayKeyboardEvent}),F=w.type===`menubar`,I=h.useState(`disabled`),z=a||I||F&&w.context.disabled,{getButtonProps:te,buttonRef:V}=R({disabled:z,native:o});H.useEffect(()=>{!x&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,x,w.type]);let ne=H.useRef(null),re=Be(),ie=A(e=>{if(!ne.current)return;re.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Te(ne.current,t)||Te(h.select(`positionerElement`),t)||t===ne.current||(t==null||ha(t)!==h.select(`rootId`))&&(Ze(e,ne.current)||O.events.emit(`close`,{domEvent:e,reason:T}))});H.useEffect(()=>{x&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&b(ne.current).addEventListener(`mouseup`,ie,{once:!0})},[x,ie,h]);let ae=F&&w.context.hasSubmenuOpen,se=Sr(y,{enabled:(c??ae)&&!z&&(!F||ae&&!P),handleClose:Ar({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:O,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ce=ya(x,h.select(`lastOpenChangeReason`)),le=_t(y,{enabled:!z,event:x&&F?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&ce}),ue=mr(y,{enabled:!z&&ae}),de=_a({open:x,enabled:F,mouseDownAction:`open`}),fe=H.useMemo(()=>ee(ue.reference,le.reference),[ue.reference,le.reference]),pe=h.useState(`triggerProps`,P),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=ga(h,C),_e={disabled:z,open:x},ve=[ne,t,V,N,C],ye=[fe,se??L,pe,{"aria-haspopup":`menu`,"aria-controls":S,id:g,onMouseDown:e=>{h.select(`open`)||(re.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),b(e.currentTarget).addEventListener(`mouseup`,ie,{once:!0}))}},F?{role:`menuitem`}:{},de,p,te],be=j(`button`,e,{enabled:!F,stateAttributesMapping:ft,state:_e,ref:ve,props:ye});return F?(0,U.jsx)(ma,{tag:`button`,render:n,className:r,style:i,state:_e,refs:ve,props:ye,stateAttributesMapping:ft}):x?(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(oe,{ref:me,onFocus:he},`${g}-pre-focus-guard`),(0,U.jsx)(H.Fragment,{children:be},g),(0,U.jsx)(oe,{ref:h.context.triggerFocusTargetRef,onFocus:ge},`${g}-post-focus-guard`)]}):(0,U.jsx)(H.Fragment,{children:be},g)});function ya(e,t){let n=Be(),[r,i]=H.useState(!1);return V(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function ba(){let e=ra(!0);return H.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var xa=H.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return j(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),Sa={"aria-expanded":void 0},Ca=H.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=la();if(!p?.parentMenu)throw Error(B(37));let m=Ke({guess:!0,label:a}),h=Hi(),{store:g}=Wi(),_=xe(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Ct(_,g),C=H.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=H.useRef(null),T=H.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),M=E.useState(`isActive`,m.index),N=H.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:P,itemRef:F}=Yi({closeOnClick:!1,disabled:k,highlighted:M,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:N,nodeId:h?.context.nodeId}),I=Sr(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:Ar({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),R=_t(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??L,ee=g.useState(`triggerProps`,!0);delete ee.id;let z={disabled:k,highlighted:M,open:v},te=g.useState(`openMethod`),V=g.useState(`lastOpenChangeReason`)===`list-navigation`||te===`keyboard`;return j(`div`,e,{state:z,stateAttributesMapping:dt,props:[R,I,ee,A,v&&V&&Se?Sa:void 0,{"aria-controls":x,tabIndex:v||M?0:-1,onBlur(){M&&E.set(`activeIndex`,null)}},f,P],ref:[t,m.ref,F,C,T]})});function wa({...e}){return(0,U.jsx)(ua,{"data-slot":`dropdown-menu`,...e})}function Ta({className:e,...t}){return(0,U.jsx)(va,{"data-slot":`dropdown-menu-trigger`,className:e,...t})}function Ea({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,U.jsx)(ea,{children:(0,U.jsx)(ta,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,U.jsx)(Zi,{"data-slot":`dropdown-menu-content`,className:g(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Da({className:e,inset:t,variant:n=`default`,...r}){return(0,U.jsx)(Xi,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:g(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Oa({...e}){return(0,U.jsx)(fa,{"data-slot":`dropdown-menu-sub`,...e})}function ka({className:e,inset:t,children:n,...r}){return(0,U.jsxs)(Ca,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:g(`relative flex min-h-7 cursor-default items-center gap-2 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,U.jsx)(Cn,{className:`ml-auto`})]})}function Aa({align:e=`start`,alignOffset:t=-3,side:n=`right`,sideOffset:r=0,className:i,...a}){return(0,U.jsx)(Ea,{"data-slot":`dropdown-menu-sub-content`,className:g(`w-auto min-w-[96px] rounded-2xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,i),align:e,alignOffset:t,side:n,sideOffset:r,...a})}function ja({className:e,...t}){return(0,U.jsx)(xa,{"data-slot":`dropdown-menu-separator`,className:g(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var Ma=H.createContext(void 0);function Na(e){let t=H.useContext(Ma);if(t===void 0&&!e)throw Error(B(72));return t}var Pa={...ur,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Fa=class extends f{constructor(e,t,n){let r=new jt;super(Ia(e,r,t,n),La(r),Pa)}setOpen=(e,t)=>{gt(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,d(z,e))}};function Ia(e,t,n,r=!1){let i={...rr(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=ir(t,n,r),i}function La(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var Ra=ye(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:f=null,children:p}=e,m=St((e,t)=>new Fa({open:n,openProp:r,activeTriggerId:f,triggerIdProp:u},e,t));m.useControlledProp(`openProp`,r),m.useControlledProp(`triggerIdProp`,u),m.useContextCallback(`onOpenChange`,s),m.useContextCallback(`onOpenChangeComplete`,c);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),y=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Ot(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:b,transitionStatus:x}=Bt(g,m),S=m.useState(`isInstantPhase`),C=m.useState(`instantType`),w=m.useState(`lastOpenChangeReason`),T=H.useRef(null);V(()=>{h&&t&&m.setOpen(!1,d(_e))},[h,t,m]),V(()=>{x===`ending`&&w===`none`||x!==`ending`&&S?(C!==`delay`&&(T.current=C),m.set(`instantType`,`delay`)):T.current!==null&&(m.set(`instantType`,T.current),T.current=null)},[x,S,w,C,m]),V(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]),H.useImperativeHandle(o,()=>({unmount:b,close:()=>m.setOpen(!1,d(D))}),[b,m]);let E=g||v||!t&&a!==`none`;return(0,U.jsxs)(Ma.Provider,{value:m,children:[l&&(0,U.jsx)(wt,{handle:l,store:m}),E&&(0,U.jsx)(za,{store:m,disabled:t,trackCursorAxis:a}),typeof p==`function`?p({payload:y}):p]})});function za({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Wt(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=tr(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=H.useMemo(()=>ee(a.reference,i.reference),[a.reference,i.reference]);return bt(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??L}),null}var Ba=H.createContext(void 0);function Va(){return H.useContext(Ba)}var Ha=`data-base-ui-tooltip-trigger`;function Ua(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(Fe(n))return n}}let t=e.target;return Fe(t)?t:null}function Wa(e){let t=e;for(;t;){let e=t.closest(`[${Ha}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&Fe(n.host)?n.host:null}return null}var Ga=c(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=Na(!0),h=fr(a)??m;if(!h)throw Error(B(82));let g=xe(f),v=h.useState(`isTriggerActive`,g),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`floatingRootContext`),S=H.useRef(null),C=c??600,w=u??0,{registerTrigger:T,isMountedByThisTrigger:E}=kt(g,S,h,{payload:o,closeOnClick:l,closeDelay:w}),D=Va(),{delayRef:O,isInstantPhase:k,hasProvider:A}=Qn(b,{open:y}),M=yr(b);h.useSyncedValue(`isInstantPhase`,k);let N=h.useState(`disabled`),P=s??N,F=ot(P),I=h.useState(`trackCursorAxis`),L=h.useState(`disableHoverablePopup`),R=H.useRef(!1),ee=Be(),z=H.useRef(void 0);function te(){return A?Gn(O.current,`open`)===0?0:c??D??600:C}function V(e){let t=S.current;if(!t||!e)return!1;let n=Wa(e);return n!==null&&n!==t&&Te(t,n)}function ne(e){let t=V(e);return R.current=t,t&&(M.openChangeTimeout.clear(),M.restTimeout.clear(),M.restTimeoutPending=!1,ee.clear()),t}let re=Sr(b,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!L&&I!==`both`?Ar():null,restMs:te,delay(){return u==null&&A?{close:Gn(O.current,`close`)}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!R.current}}),ie=mr(b,{enabled:!P}).reference,ae=e=>{let t=R.current,n=Ua(e),r=ne(n),i=S.current,a=i&&n&&Te(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,d(_,e));return}if(t&&!r&&a&&!F.current&&!h.select(`open`)&&i&&x(z.current)){let t=()=>{!R.current&&!F.current&&!h.select(`open`)&&h.setOpen(!0,d(_,e,i))},n=te();n===0?(ee.clear(),t()):ee.start(n,t)}},oe=h.useState(`triggerProps`,E);return j(`button`,e,{state:{open:y},ref:[t,T,S],props:[re,ie,E||I!==`none`?oe:void 0,{onMouseOver(e){ae(e.nativeEvent)},onFocus(e){V(Ua(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){R.current=!1,ee.clear(),z.current=void 0},onPointerEnter(e){z.current=e.pointerType},onPointerDown(e){z.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,"data-trigger-disabled":P?``:void 0,[Ha]:P?void 0:``},p],stateAttributesMapping:dt})}),Ka=H.createContext(void 0);function qa(){let e=H.useContext(Ka);if(e===void 0)throw Error(B(70));return e}var Ja=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Na().useState(`mounted`)||n?(0,U.jsx)(Ka.Provider,{value:n,children:(0,U.jsx)(M,{ref:t,...r})}):null}),Ya=H.createContext(void 0);function Xa(){let e=H.useContext(Ya);if(e===void 0)throw Error(B(71));return e}var Za=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Pe,style:g,..._}=e,v=Na(),y=qa(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),O=pt({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),k=H.useMemo(()=>({open:b,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,O.side,O.align,O.anchorHidden,S,T]),A=et(e,k,{styles:O.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,U.jsx)(Ya.Provider,{value:O,children:A})}),Qa=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Na(),{side:s,align:c}=Xa(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);we({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),br(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return j(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[It,f,nt(d),a],stateAttributesMapping:tt})}),$a=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Na(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=Xa(),f={open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)};return j(`div`,e,{state:f,ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:Pt})}),eo=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=H.useMemo(()=>({open:t,close:n}),[t,n]);return(0,U.jsx)(Ba.Provider,{value:t,children:(0,U.jsx)(Zn,{delay:i,timeoutMs:r,children:e.children})})};function to({delay:e=0,...t}){return(0,U.jsx)(eo,{"data-slot":`tooltip-provider`,delay:e,...t})}function no({...e}){return(0,U.jsx)(Ra,{"data-slot":`tooltip`,...e})}function ro({...e}){return(0,U.jsx)(Ga,{"data-slot":`tooltip-trigger`,...e})}function io({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,U.jsx)(Ja,{children:(0,U.jsx)(Za,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,U.jsxs)(Qa,{"data-slot":`tooltip-content`,className:g(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,U.jsx)($a,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var ao=6e4,oo=60*ao,so=24*oo;function co(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<ao?`just now`:r<oo?`${Math.floor(r/ao)}m`:r<so?`${Math.floor(r/oo)}h`:new Date(n).toISOString().slice(0,10)}function lo(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.old_string==`string`?t.old_string:void 0,r=typeof t.new_string==`string`?t.new_string:typeof t.content==`string`?t.content:void 0;if(n!==void 0||r!==void 0)return{...typeof t.file_path==`string`?{path:t.file_path}:{},removed:fo(n),added:fo(r)}}function uo(e,t){let n=!!t?.trim();if(!n){let t=/^--- [^\n]*\n\+\+\+ [^\n]*\n/m.test(e),n=/^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)? @@/m.test(e);if(!t||!n)return}let r=0,i=0;return(e.match(/[^\n]*\n|[^\n]+$/g)??[]).map(e=>{let t=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/.exec(e);if(t)return r=Number(t[1]??1),i=Number(t[2]??1),{text:e,kind:`context`};let a=r>0||i>0,o=`context`;return(a||n)&&(e.startsWith(`-`)&&(a||!e.startsWith(`--- `))&&(o=`removed`),e.startsWith(`+`)&&(a||!e.startsWith(`+++ `))&&(o=`added`)),a&&((o===`removed`||e.startsWith(` `))&&(r=Math.max(0,r-1)),(o===`added`||e.startsWith(` `))&&(i=Math.max(0,i-1))),{text:e,kind:o}})}function fo(e){if(!e)return[];let t=e.split(`
3
+ `);for(;t.length>0&&t[t.length-1]===``;)t.pop();return t}var po=[[/^mcp__/,`mcp`],[/^(bash|shell|exec|run_?command)$/,`shell`],[/^(read|read_?file|view|notebookread)$/,`read`],[/^(write|write_?file|create_?file|notebookedit)$/,`write`],[/^(edit|multi_?edit|str_replace(_based_edit_tool|_editor)?|apply_?patch)$/,`edit`],[/^(grep|search|ripgrep)$/,`search`],[/^(glob|ls|list|find|list_?directory)$/,`list`],[/^(web_?fetch|web_?search|fetch)$/,`web`],[/^(task|agent)$/,`agent`],[/^todo_?write$/,`todo`]];function mo(e){let t=e.toLowerCase();return po.find(([e])=>e.test(t))?.[1]??`other`}function ho(e){if(typeof e==`string`)return e;let t=Array.isArray(e)?e:typeof e==`object`&&e&&Array.isArray(e.content)?e.content:void 0;if(!t)return;let n=t.flatMap(e=>typeof e==`object`&&e&&typeof e.text==`string`?[e.text]:[]);return n.length>0?n.join(`
4
+ `):void 0}function go(e){if(e!==void 0)return e.split(`
5
+ `).filter(e=>e.trim()!==``).length}function _o(e,t){return`${e} ${t}${e===1?``:`s`}`}function vo(e){if(e.status===`error`)return`failed`;if(e.status!==`complete`)return;let t=lo(e.input);if(t)return`+${t.added.length} −${t.removed.length}`;let n=go(ho(e.result));if(n!==void 0)switch(mo(e.name)){case`read`:return _o(n,`line`);case`list`:return _o(n,`file`);case`search`:return _o(n,`result`);default:return}}var yo={shell:In,read:En,write:Tn,edit:wn,search:Fn,list:Dn,web:kn,agent:xn,todo:An,mcp:Nn,other:Rn};function bo({name:e,className:t}){let n=yo[mo(e)];return(0,U.jsx)(n,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,t)})}var xo={scale:1,x:0,y:0};function So(e,t,n){let r=Math.min(8,Math.max(1,e.scale));return{scale:r,x:Math.min(0,Math.max(t-t*r,e.x)),y:Math.min(0,Math.max(n-n*r,e.y))}}function Co(e,t,n,r,i,a){let o=Math.min(8,Math.max(1,e.scale*t)),s=o/e.scale;return So({scale:o,x:n-(n-e.x)*s,y:r-(r-e.y)*s},i,a)}function wo(e,t,n,r,i){return So({...e,x:e.x+t,y:e.y+n},r,i)}function To({src:e,alt:t,className:n}){return(0,U.jsxs)(ni,{children:[(0,U.jsx)(ri,{render:(0,U.jsx)(`button`,{type:`button`,"aria-label":t?`Open ${t}`:`Open image`,className:`cursor-zoom-in rounded-md outline-none focus-visible:ring-3 focus-visible:ring-ring/30`}),children:(0,U.jsx)(`img`,{src:e,alt:t,className:g(`block`,n)})}),(0,U.jsxs)(oi,{className:`w-auto max-w-[80vw] gap-0 p-2 sm:max-w-[80vw]`,children:[(0,U.jsx)(li,{className:`sr-only`,children:t||`Image`}),(0,U.jsx)(Eo,{src:e,alt:t})]})]})}function Eo({src:e,alt:t}){let n=(0,H.useRef)(null),r=(0,H.useRef)(void 0),[i,a]=(0,H.useState)(xo);(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:1,i=t.deltaX*r,o=t.deltaY*r;a(e=>t.ctrlKey?Co(e,Math.exp(-Math.max(-50,Math.min(50,o))*.01),t.clientX-n.left,t.clientY-n.top,n.width,n.height):wo(e,-i,-o,n.width,n.height))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let o=()=>n.current.getBoundingClientRect(),s=()=>{r.current=void 0};return(0,U.jsx)(`div`,{ref:n,className:g(`relative touch-none overflow-hidden rounded-md select-none`,i.scale>1?`cursor-grab active:cursor-grabbing`:`cursor-zoom-in`),onPointerDown:e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),r.current={x:e.clientX,y:e.clientY})},onPointerMove:e=>{let t=r.current;if(!t)return;let{width:n,height:i}=o(),s=e.clientX-t.x,c=e.clientY-t.y;r.current={x:e.clientX,y:e.clientY},a(e=>wo(e,s,c,n,i))},onPointerUp:s,onPointerCancel:s,onDoubleClick:e=>{let{left:t,top:n,width:r,height:i}=o(),s=e.clientX-t,c=e.clientY-n;a(e=>e.scale>1?xo:Co(e,2,s,c,r,i))},children:(0,U.jsx)(`img`,{src:e,alt:t,draggable:!1,className:`block max-h-[calc(80dvh-1rem)] max-w-[calc(80vw-1rem)] origin-top-left will-change-transform`,style:{transform:`translate(${i.x}px, ${i.y}px) scale(${i.scale})`}})})}function Do(e){if(!e.startsWith(`/`))return;let t=/^\/([A-Za-z0-9][\w-]*(?::(?:[A-Za-z0-9][\w-]*)?)?)?/.exec(e)?.[1]??``;return{name:t,to:t.length+1}}function Oo(e){let t=Do(e);if(!t||t.name===``||t.name.endsWith(`:`))return;let n=e[t.to];if(n===void 0||n===` `||n===`
6
+ `)return{...t,rest:e.slice(t.to)}}function ko(e,t){let n=(t??[]).filter(t=>e.startsWith(`mcp__${t.id}__`)).sort((e,t)=>t.id.length-e.id.length)[0];return n&&{connection:n.name,tool:e.slice(`mcp__${n.id}__`.length)}}function Ao({name:e}){let t=ko(e,Ue().config.mcp);return t?(0,U.jsxs)(no,{children:[(0,U.jsxs)(ro,{render:(0,U.jsx)(`span`,{}),children:[t.connection,` › `,t.tool]}),(0,U.jsx)(io,{children:e})]}):e}var jo=[{decision:`allow`,label:`Allow once`,description:`Run it this time, and ask again next time.`},{decision:`deny`,label:`Deny`,description:`Refuse it, and stop asking for the rest of this turn.`},{decision:`always`,label:`Always allow on this machine`,description:`Run it, and never ask again in any Agent Session. Revocable in Settings.`}],Mo=jo.slice(0,2);function No(e){return e===!1?Mo:jo}function Po(e){switch(e){case void 0:return;case`asked`:return`waiting to be authorised`;case`allowed`:return`authorised`;case`always`:return`always authorised on this machine`;case`denied`:return`refused`}}function Fo({className:e,...t}){return(0,U.jsx)(`textarea`,{"data-slot":`textarea`,className:g(`flex field-sizing-content min-h-16 w-full resize-none rounded-2xl border border-transparent bg-input/50 px-2.5 py-2 text-base transition-[color,box-shadow] duration-200 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Io(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lo=Io();function Ro(e){Lo=e}var zo={exec:()=>null};function Bo(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function W(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Ho.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Vo=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Ho={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Bo(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Bo(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Bo(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Bo(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Bo(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Bo(e=>RegExp(`^ {0,${e}}>`))},Uo=/^(?:[ \t]*(?:\n|$))+/,Wo=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Go=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ko=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,qo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Jo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Yo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xo=W(Yo).replace(/bull/g,Jo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Zo=W(Yo).replace(/bull/g,Jo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Qo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,$o=/^[^\n]+/,es=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ts=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,es).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ns=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Jo).getRegex(),rs=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,as=W(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,is).replace(`tag`,rs).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),os=e=>W(Qo).replace(`hr`,Ko).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,rs).getRegex(),ss=os(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),cs=os(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ls={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,cs).getRegex(),code:Wo,def:ts,fences:Go,heading:qo,hr:Ko,html:as,lheading:Xo,list:ns,newline:Uo,paragraph:ss,table:zo,text:$o},us=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ko).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,rs).getRegex(),ds={...ls,lheading:Zo,table:us,paragraph:W(Qo).replace(`hr`,Ko).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,us).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,rs).getRegex()},fs={...ls,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,is).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:zo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Qo).replace(`hr`,Ko).replace(`heading`,` *#{1,6} *[^
7
+ ]`).replace(`lheading`,Xo).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ps=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ms=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hs=/^( {2,}|\\)\n(?!\s*$)/,gs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_s=/[\p{P}\p{S}]/u,vs=/[\s\p{P}\p{S}]/u,ys=/[^\s\p{P}\p{S}]/u,bs=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,vs).getRegex(),xs=/[\p{Pi}\p{Ps}"']/u,Ss=/(?!~)[\p{P}\p{S}]/u,Cs=/(?!~)[\s\p{P}\p{S}]/u,ws=/(?:[^\s\p{P}\p{S}]|~)/u,Ts=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Vo?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Es=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ds=W(Es,`u`).replace(/punct/g,_s).getRegex(),Os=W(Es,`u`).replace(/punct/g,Ss).getRegex(),ks=W(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,xs).replace(/punct/g,_s).getRegex(),As=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,js=W(As,`gu`).replace(/notPunctSpace/g,ys).replace(/punctSpace/g,vs).replace(/punct/g,_s).getRegex(),Ms=W(As,`gu`).replace(/notPunctSpace/g,ws).replace(/punctSpace/g,Cs).replace(/punct/g,Ss).getRegex(),Ns=W(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ys).replace(/punctSpace/g,vs).replace(/punct/g,_s).getRegex(),Ps=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ys).replace(/punctSpace/g,vs).replace(/punct/g,_s).getRegex(),Fs=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ys).replace(/punctSpace/g,vs).replace(/punct/g,_s).getRegex(),Is=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,_s).getRegex(),Ls=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ys).replace(/punctSpace/g,vs).replace(/punct/g,_s).getRegex(),Rs=W(/\\(punct)/,`gu`).replace(/punct/g,_s).getRegex(),zs=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Bs=W(is).replace(`(?:-->|$)`,`-->`).getRegex(),Vs=W(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Bs).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Us=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Hs).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ws=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Hs).replace(`ref`,es).getRegex(),Gs=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,es).getRegex(),Ks=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ws).replace(`nolink`,Gs).getRegex(),qs=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Js={_backpedal:zo,anyPunctuation:Rs,autolink:zs,blockSkip:Ts,br:hs,code:ms,del:zo,delLDelim:zo,delRDelim:zo,emStrongLDelim:Ds,emStrongRDelimAst:js,emStrongRDelimUnd:Ps,escape:ps,link:Us,nolink:Gs,punctuation:bs,reflink:Ws,reflinkSearch:Ks,tag:Vs,text:gs,url:zo},Ys={...Js,emStrongLDelim:ks,emStrongRDelimAst:Ns,emStrongRDelimUnd:Fs,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Hs).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Hs).getRegex()},Xs={...Js,emStrongRDelimAst:Ms,emStrongLDelim:Os,delLDelim:Is,delRDelim:Ls,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,qs).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,qs).getRegex()},Zs={...Xs,br:W(hs).replace(`{2,}`,`*`).getRegex(),text:W(Xs.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Qs={normal:ls,gfm:ds,pedantic:fs},$s={normal:Js,gfm:Xs,breaks:Zs,pedantic:Ys},ec={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},tc=e=>ec[e];function nc(e,t){if(t){if(Ho.escapeTest.test(e))return e.replace(Ho.escapeReplace,tc)}else if(Ho.escapeTestNoEncode.test(e))return e.replace(Ho.escapeReplaceNoEncode,tc);return e}function rc(e){try{e=encodeURI(e).replace(Ho.percentDecode,`%`)}catch{return null}return e}function ic(e,t){let n=e.replace(Ho.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ho.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Ho.slashPipe,`|`);return n}function ac(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function oc(e){let t=e.split(`
8
+ `),n=t.length-1;for(;n>=0&&Ho.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
9
+ `)}function sc(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function cc(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function lc(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function uc(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
10
10
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
11
- `)}var rc=class{options;rules;lexer;constructor(e){this.options=e||ko}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Qs(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=nc(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Zs(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Zs(t[0],`
12
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Zs(t[0],`
13
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Zs(t[0],`
11
+ `)}var dc=class{options;rules;lexer;constructor(e){this.options=e||Lo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:oc(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=uc(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=ac(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:ac(t[0],`
12
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:ac(t[0],`
13
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=ac(t[0],`
14
14
  `).split(`
15
15
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
16
16
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -22,20 +22,20 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
22
22
  ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
23
23
  `+e.join(`
24
24
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
25
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=ec(t[2].split(`
25
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=cc(t[2].split(`
26
26
  `,1)[0],t[1].length),l=e.split(`
27
27
  `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
28
28
  `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
29
29
  `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
30
30
  `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
31
31
  `+l}u=!l.trim(),r+=p+`
32
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Qs(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Zs(t[0],`
33
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Xs(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
34
- `):[],a={type:`table`,raw:Zs(t[0],`
35
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Xs(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Zs(t[0],`
32
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=oc(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:ac(t[0],`
33
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ic(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
34
+ `):[],a={type:`table`,raw:ac(t[0],`
35
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ic(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:ac(t[0],`
36
36
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
37
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Zs(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=$s(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),tc(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return tc(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},ic=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ko,this.options.tokenizer=this.options.tokenizer||new rc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Po,block:Ws.normal,inline:Gs.normal};this.options.pedantic?(t.block=Ws.pedantic,t.inline=Gs.pedantic):this.options.gfm&&(t.block=Ws.gfm,t.inline=this.options.breaks?Gs.breaks:Gs.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ws,inline:Gs}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Po.carriageReturn,`
38
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Po.tabCharGlobal,` `).replace(Po.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
37
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=ac(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=sc(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),lc(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return lc(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},fc=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Lo,this.options.tokenizer=this.options.tokenizer||new dc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Ho,block:Qs.normal,inline:$s.normal};this.options.pedantic?(t.block=Qs.pedantic,t.inline=$s.pedantic):this.options.gfm&&(t.block=Qs.gfm,t.inline=this.options.breaks?$s.breaks:$s.gfm),this.tokenizer.rules=t}static get rules(){return{block:Qs,inline:$s}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Ho.carriageReturn,`
38
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Ho.tabCharGlobal,` `).replace(Ho.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
39
39
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
40
40
  `)?``:`
41
41
  `)+i.raw,n.text+=`
@@ -48,9 +48,9 @@ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){
48
48
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
49
49
  `)?``:`
50
50
  `)+i.raw,n.text+=`
51
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,n.slice(r+1,-1)))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},ac=class{options;parser;constructor(e){this.options=e||ko}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Po.notSpaceStart)?.[0],i=e.replace(Po.endingNewline,``)+`
52
- `;return r?`<pre><code class="language-`+Js(r)+`">`+(n?i:Js(i,!0))+`</code></pre>
53
- `:`<pre><code>`+(n?i:Js(i,!0))+`</code></pre>
51
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,n.slice(r+1,-1)))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},pc=class{options;parser;constructor(e){this.options=e||Lo}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Ho.notSpaceStart)?.[0],i=e.replace(Ho.endingNewline,``)+`
52
+ `;return r?`<pre><code class="language-`+nc(r)+`">`+(n?i:nc(i,!0))+`</code></pre>
53
+ `:`<pre><code>`+(n?i:nc(i,!0))+`</code></pre>
54
54
  `}blockquote({tokens:e}){return`<blockquote>
55
55
  ${this.parser.parse(e)}</blockquote>
56
56
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -66,17 +66,17 @@ ${this.parser.parse(e)}</blockquote>
66
66
  `}tablerow({text:e}){return`<tr>
67
67
  ${e}</tr>
68
68
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
69
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Js(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ys(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Js(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ys(e);if(i===null)return Js(n);e=i;let a=`<img src="${e}" alt="${Js(n)}"`;return t&&(a+=` title="${Js(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Js(e.text)}},oc=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},sc=class e{options;renderer;textRenderer;constructor(e){this.options=e||ko,this.options.renderer=this.options.renderer||new ac,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oc}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},cc=class{options;block;constructor(e){this.options=e||ko}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ic.lex:ic.lexInline}provideParser(e=this.block){return e?sc.parse:sc.parseInline}},lc=new class{defaults=Oo();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=sc;Renderer=ac;TextRenderer=oc;Lexer=ic;Tokenizer=rc;Hooks=cc;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ac(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new rc(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new cc;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=cc.passThroughHooks.has(n)?e=>{if(this.defaults.async&&cc.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ic.lex(e,t??this.defaults)}parser(e,t){return sc.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?ic.lex:ic.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?sc.parse:sc.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?ic.lex:ic.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?sc.parse:sc.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
70
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Js(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function uc(e,t){return lc.parse(e,t)}uc.options=uc.setOptions=function(e){return lc.setOptions(e),uc.defaults=lc.defaults,Ao(uc.defaults),uc},uc.getDefaults=Oo,uc.defaults=ko;function dc(...e){return lc.use(...e),uc.defaults=lc.defaults,Ao(uc.defaults),uc}uc.use=dc,uc.walkTokens=function(e,t){return lc.walkTokens(e,t)},uc.parseInline=lc.parseInline,uc.Parser=sc,uc.parser=sc.parse,uc.Renderer=ac,uc.TextRenderer=oc,uc.Lexer=ic,uc.lexer=ic.lex,uc.Tokenizer=rc,uc.Hooks=cc,uc.parse=uc,uc.options,uc.setOptions,uc.walkTokens,uc.parseInline,sc.parse,ic.lex;function fc(e,t={}){if(e===``)return[];try{return gc(uc.lexer(e),t)}catch{return[{kind:`paragraph`,inlines:[{kind:`text`,text:e}]}]}}var pc=new Set([`http:`,`https:`,`mailto:`]);function mc(e){try{return pc.has(new URL(e).protocol)?e:void 0}catch{return}}var hc=[1,2,3,4,5,6];function gc(e,t){return e.flatMap(e=>_c(e,t))}function _c(e,t){switch(e.type){case`space`:return[];case`heading`:return[{kind:`heading`,level:hc[e.depth-1]??6,inlines:xc(e.tokens,t)??[]}];case`paragraph`:return[{kind:`paragraph`,inlines:xc(e.tokens,t)??[]}];case`text`:return[{kind:`paragraph`,inlines:xc(e.tokens,t)??Oc(e)}];case`code`:return[{kind:`code`,text:e.text,...e.lang?{lang:e.lang}:{}}];case`blockquote`:return[{kind:`quote`,blocks:gc(e.tokens??[],t)}];case`hr`:return[{kind:`rule`}];case`list`:return[vc(e,t)];case`table`:return[bc(e,t)];case`html`:return[{kind:`paragraph`,inlines:Ec(e.raw,t)}];default:return[{kind:`paragraph`,inlines:Oc(e)}]}}function vc(e,t){let n=e.ordered&&typeof e.start==`number`&&e.start!==1?e.start:void 0;return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>yc(e,t)),...n===void 0?{}:{start:n}}}function yc(e,t){let n=gc(e.tokens.filter(e=>e.type!==`checkbox`),t);if(!e.task)return n;let r={kind:`text`,text:e.checked?`[x] `:`[ ] `},[i,...a]=n;return i?.kind===`paragraph`?[{kind:`paragraph`,inlines:[r,...i.inlines]},...a]:[{kind:`paragraph`,inlines:[r]},...n]}function bc(e,t){let n=e=>e.map(e=>xc(e.tokens,t)??[]);return{kind:`table`,header:n(e.header),rows:e.rows.map(n),align:e.align.map(e=>e??void 0)}}function xc(e,t){return e?.flatMap(e=>Sc(e,t))}function Sc(e,t){switch(e.type){case`text`:return xc(e.tokens,t)??[{kind:`text`,text:e.text}];case`escape`:return[{kind:`text`,text:e.text}];case`strong`:case`em`:case`del`:return[{kind:e.type,inlines:xc(e.tokens,t)??[]}];case`codespan`:return[{kind:`code`,text:e.text}];case`br`:return[{kind:`break`}];case`link`:return[Cc(e,t)];case`image`:return[Tc(e.href,e.text,e.raw,t)];case`html`:return Ec(e.text,t);default:return Oc(e)}}function Cc(e,t){let n=wc(e.href,t.linkBase);return n===void 0?{kind:`text`,text:e.raw}:{kind:`link`,href:n,inlines:xc(e.tokens,t)??[{kind:`text`,text:e.text}]}}function wc(e,t){if(!t)return mc(e);try{return mc(new URL(e,t).href)}catch{return}}function Tc(e,t,n,r){let i=r.images&&e.trim()?wc(e,r.imageBase):void 0;if(!i||!/^https?:\/\//i.test(i))return{kind:`text`,text:n};let a=new URL(i),o=/^\/([^/]+)\/([^/]+)\/blob\/(.+)$/.exec(a.pathname);return a.hostname===`github.com`&&o&&(a.hostname=`raw.githubusercontent.com`,a.pathname=`/${o[1]}/${o[2]}/${o[3]}`),{kind:`image`,src:a.href,alt:t}}function Ec(e,t){let n=e.match(/<img\b(?:[^"'<>]|"[^"]*"|'[^']*')*\/?>/gi);return!t.images||!n||n.join(``).replace(/\s/g,``)!==e.replace(/\s/g,``)?[{kind:`text`,text:e}]:n.map(e=>{let n=new Map;for(let t of e.slice(4,-1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let e=t[1].toLowerCase();n.has(e)||n.set(e,Dc(t[2]??t[3]??t[4]??``))}return Tc(n.get(`src`)??``,n.get(`alt`)??`Screenshot`,e,t)})}function Dc(e){let t={amp:`&`,quot:`"`,apos:`'`,lt:`<`,gt:`>`};return e.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt);/gi,(e,n)=>{if(!n.startsWith(`#`))return t[n.toLowerCase()]??e;let r=n[1]?.toLowerCase()===`x`?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e})}function Oc(e){return[{kind:`text`,text:e.raw}]}function kc(e){if(e.kind===`subagent`)return[e.name,e.description].filter(e=>e!==void 0&&e!==``).join(`
69
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${nc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=rc(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+nc(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=rc(e);if(i===null)return nc(n);e=i;let a=`<img src="${e}" alt="${nc(n)}"`;return t&&(a+=` title="${nc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:nc(e.text)}},mc=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},hc=class e{options;renderer;textRenderer;constructor(e){this.options=e||Lo,this.options.renderer=this.options.renderer||new pc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mc}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},gc=class{options;block;constructor(e){this.options=e||Lo}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?fc.lex:fc.lexInline}provideParser(e=this.block){return e?hc.parse:hc.parseInline}},_c=new class{defaults=Io();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=hc;Renderer=pc;TextRenderer=mc;Lexer=fc;Tokenizer=dc;Hooks=gc;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new pc(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new dc(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new gc;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=gc.passThroughHooks.has(n)?e=>{if(this.defaults.async&&gc.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return fc.lex(e,t??this.defaults)}parser(e,t){return hc.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?fc.lex:fc.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?hc.parse:hc.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?fc.lex:fc.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?hc.parse:hc.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
70
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+nc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function vc(e,t){return _c.parse(e,t)}vc.options=vc.setOptions=function(e){return _c.setOptions(e),vc.defaults=_c.defaults,Ro(vc.defaults),vc},vc.getDefaults=Io,vc.defaults=Lo;function yc(...e){return _c.use(...e),vc.defaults=_c.defaults,Ro(vc.defaults),vc}vc.use=yc,vc.walkTokens=function(e,t){return _c.walkTokens(e,t)},vc.parseInline=_c.parseInline,vc.Parser=hc,vc.parser=hc.parse,vc.Renderer=pc,vc.TextRenderer=mc,vc.Lexer=fc,vc.lexer=fc.lex,vc.Tokenizer=dc,vc.Hooks=gc,vc.parse=vc,vc.options,vc.setOptions,vc.walkTokens,vc.parseInline,hc.parse,fc.lex;function bc(e,t={}){if(e===``)return[];try{return wc(vc.lexer(e),t)}catch{return[{kind:`paragraph`,inlines:[{kind:`text`,text:e}]}]}}var xc=new Set([`http:`,`https:`,`mailto:`]);function Sc(e){try{return xc.has(new URL(e).protocol)?e:void 0}catch{return}}var Cc=[1,2,3,4,5,6];function wc(e,t){return e.flatMap(e=>Tc(e,t))}function Tc(e,t){switch(e.type){case`space`:return[];case`heading`:return[{kind:`heading`,level:Cc[e.depth-1]??6,inlines:kc(e.tokens,t)??[]}];case`paragraph`:return[{kind:`paragraph`,inlines:kc(e.tokens,t)??[]}];case`text`:return[{kind:`paragraph`,inlines:kc(e.tokens,t)??Ic(e)}];case`code`:return[{kind:`code`,text:e.text,...e.lang?{lang:e.lang}:{}}];case`blockquote`:return[{kind:`quote`,blocks:wc(e.tokens??[],t)}];case`hr`:return[{kind:`rule`}];case`list`:return[Ec(e,t)];case`table`:return[Oc(e,t)];case`html`:return[{kind:`paragraph`,inlines:Pc(e.raw,t)}];default:return[{kind:`paragraph`,inlines:Ic(e)}]}}function Ec(e,t){let n=e.ordered&&typeof e.start==`number`&&e.start!==1?e.start:void 0;return{kind:`list`,ordered:e.ordered,items:e.items.map(e=>Dc(e,t)),...n===void 0?{}:{start:n}}}function Dc(e,t){let n=wc(e.tokens.filter(e=>e.type!==`checkbox`),t);if(!e.task)return n;let r={kind:`text`,text:e.checked?`[x] `:`[ ] `},[i,...a]=n;return i?.kind===`paragraph`?[{kind:`paragraph`,inlines:[r,...i.inlines]},...a]:[{kind:`paragraph`,inlines:[r]},...n]}function Oc(e,t){let n=e=>e.map(e=>kc(e.tokens,t)??[]);return{kind:`table`,header:n(e.header),rows:e.rows.map(n),align:e.align.map(e=>e??void 0)}}function kc(e,t){return e?.flatMap(e=>Ac(e,t))}function Ac(e,t){switch(e.type){case`text`:return kc(e.tokens,t)??[{kind:`text`,text:e.text}];case`escape`:return[{kind:`text`,text:e.text}];case`strong`:case`em`:case`del`:return[{kind:e.type,inlines:kc(e.tokens,t)??[]}];case`codespan`:return[{kind:`code`,text:e.text}];case`br`:return[{kind:`break`}];case`link`:return[jc(e,t)];case`image`:return[Nc(e.href,e.text,e.raw,t)];case`html`:return Pc(e.text,t);default:return Ic(e)}}function jc(e,t){let n=Mc(e.href,t.linkBase);return n===void 0?{kind:`text`,text:e.raw}:{kind:`link`,href:n,inlines:kc(e.tokens,t)??[{kind:`text`,text:e.text}]}}function Mc(e,t){if(!t)return Sc(e);try{return Sc(new URL(e,t).href)}catch{return}}function Nc(e,t,n,r){let i=r.images&&e.trim()?Mc(e,r.imageBase):void 0;if(!i||!/^https?:\/\//i.test(i))return{kind:`text`,text:n};let a=new URL(i),o=/^\/([^/]+)\/([^/]+)\/blob\/(.+)$/.exec(a.pathname);return a.hostname===`github.com`&&o&&(a.hostname=`raw.githubusercontent.com`,a.pathname=`/${o[1]}/${o[2]}/${o[3]}`),{kind:`image`,src:a.href,alt:t}}function Pc(e,t){let n=e.match(/<img\b(?:[^"'<>]|"[^"]*"|'[^']*')*\/?>/gi);return!t.images||!n||n.join(``).replace(/\s/g,``)!==e.replace(/\s/g,``)?[{kind:`text`,text:e}]:n.map(e=>{let n=new Map;for(let t of e.slice(4,-1).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let e=t[1].toLowerCase();n.has(e)||n.set(e,Fc(t[2]??t[3]??t[4]??``))}return Nc(n.get(`src`)??``,n.get(`alt`)??`Screenshot`,e,t)})}function Fc(e){let t={amp:`&`,quot:`"`,apos:`'`,lt:`<`,gt:`>`};return e.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt);/gi,(e,n)=>{if(!n.startsWith(`#`))return t[n.toLowerCase()]??e;let r=n[1]?.toLowerCase()===`x`?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e})}function Ic(e){return[{kind:`text`,text:e.raw}]}function Lc(e){if(e.kind===`subagent`)return[e.name,e.description].filter(e=>e!==void 0&&e!==``).join(`
71
71
  `);if(e.kind===`enquiry`)return e.questions.flatMap((t,n)=>[t.header,t.question,...t.options.map(e=>e.label),...e.answers?.[n]??[]]).filter(e=>e!==``).join(`
72
- `);if(e.kind===`background_call`)return e.tool;if(e.kind!==`tool`)return e.text;let t=to(e.input);return[e.name,Mc(e.input),Mc(e.result),t?.path].filter(e=>e!==void 0&&e!==``).join(`
73
- `)}function Ac(e,t){if(e===``)return[];if(t===``)return[{text:e,match:!1}];let n=e.toLowerCase();if(n.length!==e.length)return[{text:e,match:!1}];let r=[],i=0;for(let a=n.indexOf(t);a!==-1;a=n.indexOf(t,i)){a>i&&r.push({text:e.slice(i,a),match:!1}),i=a+t.length;let n=r[r.length-1];n?.match?n.text+=e.slice(a,i):r.push({text:e.slice(a,i),match:!0})}return i<e.length&&r.push({text:e.slice(i),match:!1}),r}function jc(){let e=new WeakMap;return{matches(t,n){if(n===``)return!0;let r=e.get(t);return r===void 0&&(r=kc(t).toLowerCase(),e.set(t,r)),r.includes(n)}}}function Mc(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)??``}catch{return``}}function Nc({text:e,query:t}){return t===``?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(U.Fragment,{children:Ac(e,t).map((e,t)=>e.match?(0,U.jsx)(`mark`,{className:`rounded-sm bg-chart-4/30 text-foreground`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})}function Pc(e){if(e===`removed`)return`bg-destructive/10 text-destructive`;if(e===`added`)return`bg-diff-added/10 text-diff-added`}function Fc({text:e,lang:t,query:n,trailing:r}){let i=no(e,t);return i?(0,U.jsxs)(`span`,{className:`inline-block min-w-full align-top`,children:[i.map((e,t)=>{let a=e.text.endsWith(`\r
72
+ `);if(e.kind===`background_call`)return e.tool;if(e.kind!==`tool`)return e.text;let t=lo(e.input);return[e.name,Bc(e.input),Bc(e.result),t?.path].filter(e=>e!==void 0&&e!==``).join(`
73
+ `)}function Rc(e,t){if(e===``)return[];if(t===``)return[{text:e,match:!1}];let n=e.toLowerCase();if(n.length!==e.length)return[{text:e,match:!1}];let r=[],i=0;for(let a=n.indexOf(t);a!==-1;a=n.indexOf(t,i)){a>i&&r.push({text:e.slice(i,a),match:!1}),i=a+t.length;let n=r[r.length-1];n?.match?n.text+=e.slice(a,i):r.push({text:e.slice(a,i),match:!0})}return i<e.length&&r.push({text:e.slice(i),match:!1}),r}function zc(){let e=new WeakMap;return{matches(t,n){if(n===``)return!0;let r=e.get(t);return r===void 0&&(r=Lc(t).toLowerCase(),e.set(t,r)),r.includes(n)}}}function Bc(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)??``}catch{return``}}function Vc({text:e,query:t}){return t===``?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(U.Fragment,{children:Rc(e,t).map((e,t)=>e.match?(0,U.jsx)(`mark`,{className:`rounded-sm bg-chart-4/30 text-foreground`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})}function Hc(e){if(e===`removed`)return`bg-destructive/10 text-destructive`;if(e===`added`)return`bg-diff-added/10 text-diff-added`}function Uc({text:e,lang:t,query:n,trailing:r}){let i=uo(e,t);return i?(0,U.jsxs)(`span`,{className:`inline-block min-w-full align-top`,children:[i.map((e,t)=>{let a=e.text.endsWith(`\r
74
74
  `)?`\r
75
75
  `:e.text.endsWith(`
76
76
  `)?`
77
- `:``,o=t===i.length-1?r:void 0;return(0,U.jsxs)(H.Fragment,{children:[(0,U.jsxs)(`span`,{className:g(`inline-block min-w-full min-h-[1lh] align-top`,Pc(e.kind)),children:[(0,U.jsx)(Nc,{text:a?e.text.slice(0,-a.length):e.text,query:n}),a?void 0:o]}),a||void 0,a?o:void 0]},t)}),i.length===0?r:void 0]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Nc,{text:e,query:n}),r]})}function Ic({blocks:e,query:t,trailing:n}){return(0,U.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,U.jsx)(Lc,{blocks:e,query:t,trailing:n})})}function Lc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(U.Fragment,{children:e.map((r,i)=>(0,U.jsx)(zc,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var Rc={1:`text-lg`,2:`text-base`};function zc({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,U.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(Uc,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,U.jsxs)(r,{className:g(Rc[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,U.jsx)(Uc,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,U.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,U.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:(0,U.jsx)(Fc,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,U.jsx)(r,{className:g(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,U.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,U.jsx)(Lc,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,U.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,U.jsx)(Lc,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,U.jsx)(Hc,{block:e,query:t,trailing:n});case`rule`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:`border-border`}),n]})}}var Bc={left:`text-left`,center:`text-center`,right:`text-right`},Vc=e=>e===void 0?`text-left`:Bc[e]??`text-left`;function Hc({block:e,query:t,trailing:n}){return(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,U.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:e.header.map((n,r)=>(0,U.jsx)(`th`,{className:g(`border-b px-2 py-1 font-semibold`,Vc(e.align[r])),children:(0,U.jsx)(Uc,{inlines:n,query:t})},r))})}),(0,U.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,U.jsx)(`tr`,{children:n.map((n,r)=>(0,U.jsx)(`td`,{className:g(`border-b border-border/50 px-2 py-1`,Vc(e.align[r])),children:(0,U.jsx)(Uc,{inlines:n,query:t})},r))},r))})]}),n]})}function Uc({inlines:e,query:t}){return(0,U.jsx)(U.Fragment,{children:e.map((e,n)=>(0,U.jsx)(Wc,{inline:e,query:t},n))})}function Wc({inline:e,query:t}){switch(e.kind){case`text`:return(0,U.jsx)(Nc,{text:e.text,query:t});case`strong`:return(0,U.jsx)(`strong`,{className:`font-semibold`,children:(0,U.jsx)(Uc,{inlines:e.inlines,query:t})});case`em`:return(0,U.jsx)(`em`,{children:(0,U.jsx)(Uc,{inlines:e.inlines,query:t})});case`del`:return(0,U.jsx)(`del`,{className:`text-muted-foreground`,children:(0,U.jsx)(Uc,{inlines:e.inlines,query:t})});case`code`:return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,U.jsx)(Nc,{text:e.text,query:t})});case`link`:return(0,U.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,U.jsx)(Uc,{inlines:e.inlines,query:t})});case`image`:return(0,U.jsx)(Gc,{src:e.src,alt:e.alt},e.src);case`break`:return(0,U.jsx)(`br`,{})}}function Gc({src:e,alt:t}){let[n,r]=(0,H.useState)(!1);return n?(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,U.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var Kc=(0,H.createContext)(void 0),qc=Kc.Provider;function Jc(){return(0,H.useContext)(Kc)}var Yc=6e4,Xc=60*Yc,Zc=24*Xc;function Qc(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<Yc?`just now`:r<Xc?`${Math.floor(r/Yc)}m`:r<Zc?`${Math.floor(r/Xc)}h`:new Date(n).toISOString().slice(0,10)}function $c(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function el(e){let t=$c(e);return t===void 0?e.status:`${e.status}, ${t}`}function tl(e,t){switch(e.status){case`running`:return{label:`started`,at:Qc(e.startedAt,t)};case`complete`:return{label:`finished`,at:Qc(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:Qc(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:Qc(e.endedAt??e.startedAt,t)}}}function nl(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function rl({input:e,query:t}){let n=to(e);return n?(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,U.jsx)(il,{path:n.path}),(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,U.jsx)(al,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,U.jsx)(al,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function il({path:e}){let t=e.lastIndexOf(`/`);return(0,U.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,U.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function al({sign:e,line:t,query:n,kind:r}){return(0,U.jsxs)(`div`,{className:g(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,Pc(r)),children:[(0,U.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,U.jsx)(`span`,{children:(0,U.jsx)(Nc,{text:t,query:n})})]})}function ol({entry:e,query:t}){let n=to(e.input)!==void 0;return(0,U.jsxs)(U.Fragment,{children:[n?null:(0,U.jsx)(cl,{label:`input`,value:e.input,query:t}),(0,U.jsx)(cl,{label:`update`,value:e.update,query:t}),(0,U.jsx)(cl,{label:`result`,value:e.result,query:t})]})}var sl=2e4;function cl({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:ul(t);if(r===``)return null;let i=e!==`input`&&r.length<=sl?ll(t):void 0;return(0,U.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,U.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,U.jsx)(cl,{label:e.label,value:e.text,query:n},e.label)):(0,U.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>sl?r:(0,U.jsx)(Fc,{text:r,query:n})})]})}function ll(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&no(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:ul(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:ul(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:ul(o)}),i}function ul(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function dl(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.toLocaleDateString(void 0,{day:`numeric`,month:`short`,...n.getFullYear()===t.getFullYear()?{}:{year:`numeric`}})}, ${r}`}var fl=(0,H.createContext)({}),pl=fl.Provider;function ml(){return(0,H.useContext)(fl).openSession}function hl({userMessageId:e}){let{rewind:t,fork:n}=(0,H.useContext)(fl);return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(gl,{icon:(0,U.jsx)(In,{"aria-hidden":!0}),label:t.blocked??`Rewind to before this message`,disabled:t.blocked!==void 0,children:[(0,U.jsx)(Ca,{onClick:()=>t.run(e,`conversation`),children:`Conversation`}),t.files?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ca,{onClick:()=>t.run(e,`files`),children:`Code`}),(0,U.jsx)(Ca,{onClick:()=>t.run(e,`both`),children:`Both`})]}):null]}):null,n?(0,U.jsxs)(gl,{icon:(0,U.jsx)(On,{"aria-hidden":!0}),label:`Fork from before this message`,children:[(0,U.jsx)(Ca,{onClick:()=>n.run(e,!1),children:`Same Scope`}),n.worktree?(0,U.jsx)(Ca,{onClick:()=>n.run(e,!0),children:`New Worktree`}):null]}):null]})}function gl({icon:e,label:t,disabled:n=!1,children:r}){return(0,U.jsxs)(ba,{children:[(0,U.jsxs)(Qa,{children:[(0,U.jsx)($a,{render:(0,U.jsx)(xa,{disabled:n,render:(0,U.jsx)(O,{variant:`ghost`,size:`icon-xs`,"aria-label":t,children:e})})}),(0,U.jsx)(eo,{children:t})]}),(0,U.jsx)(Sa,{className:`min-w-40`,children:r})]})}var _l=(0,H.memo)(function(e){return e.entry.rewound?(0,U.jsx)(`div`,{className:`opacity-50`,children:vl(e)}):vl(e)});function vl({entry:e,query:t,sessionId:n,background:r}){switch(e.kind){case`user`:return(0,U.jsx)(yl,{entry:e,query:t,sessionId:n});case`assistant`:return(0,U.jsx)(xl,{entry:e,query:t});case`thinking`:return(0,U.jsx)(wl,{entry:e,query:t});case`tool`:return(0,U.jsx)(Tl,{entry:e,query:t,background:r});case`subagent`:return(0,U.jsx)(Dl,{entry:e,query:t});case`background_call`:return(0,U.jsx)(kl,{entry:e});case`enquiry`:return(0,U.jsx)(El,{entry:e,query:t});case`notice`:return(0,U.jsx)(Il,{entry:e,query:t});case`marker`:return(0,U.jsx)(Rl,{entry:e});default:return null}}function yl({entry:e,query:t,sessionId:n}){let r=(0,H.useMemo)(()=>fc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`group/message relative flex flex-col items-end py-3 before:absolute before:inset-y-0 before:-right-[100vw] before:-left-[100vw] before:content-['']`,children:[(0,U.jsxs)(`div`,{className:g(`relative min-w-0 max-w-[90%] rounded-2xl rounded-br-sm px-4 py-3 sm:max-w-[80%]`,e.fromSessionId===void 0&&e.producer===void 0?`bg-muted`:`border border-border bg-muted/40 text-muted-foreground`),children:[e.fromSessionId===void 0?null:(0,U.jsxs)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:[`From `,(0,U.jsx)(Fl,{sessionId:e.fromSessionId,query:t}),` · not human authorization`]}),e.producer===void 0?null:(0,U.jsx)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:`From the parent agent · not human authorization`}),e.attachments?.length?(0,U.jsx)(bl,{ids:e.attachments,sessionId:n}):null,(0,U.jsx)(Ic,{blocks:r,query:t})]}),e.at?(0,U.jsx)(Sl,{at:e.at,side:`right`,children:e.rewound||e.producer?null:(0,U.jsx)(`span`,{className:`inline-flex [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100 focus-within:opacity-100 has-[[aria-expanded=true]]:opacity-100`,children:(0,U.jsx)(hl,{userMessageId:e.id})})}):null]})}function bl({ids:e,sessionId:t}){return(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,U.jsx)(_o,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function xl({entry:e,query:t}){let n=(0,H.useMemo)(()=>fc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(zl,{children:(0,U.jsx)(Ic,{blocks:n,query:t,trailing:e.final?void 0:(0,U.jsx)(Cl,{})})}),e.endedAt?(0,U.jsx)(Sl,{at:e.endedAt,side:`left`}):null]})}function Sl({at:e,side:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`relative mt-1 flex items-center gap-1 text-xs whitespace-nowrap text-muted-foreground/70`,t===`right`&&`flex-row-reverse @min-[68rem]/transcript:flex-row`,`@min-[68rem]/transcript:absolute @min-[68rem]/transcript:mt-0 @min-[68rem]/transcript:leading-[1.375rem]`,t===`right`?`text-right @min-[68rem]/transcript:bottom-6 @min-[68rem]/transcript:left-full @min-[68rem]/transcript:ml-4`:`@min-[68rem]/transcript:right-full @min-[68rem]/transcript:bottom-1 @min-[68rem]/transcript:mr-4`),children:[(0,U.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:dl(e,new Date)}),n]})}function Cl(){return(0,U.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function wl({entry:e,query:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=(0,H.useMemo)(()=>fc(e.text),[e.text]),c=e.final&&!n,l=e.text.trim()===``;return(0,H.useLayoutEffect)(()=>{let e=o.current;if(!e||!c)return;let t=new ResizeObserver(()=>a(e.scrollHeight>e.clientHeight+1));return t.observe(e),()=>t.disconnect()},[c,l]),l?null:(0,U.jsxs)(zl,{children:[(0,U.jsx)(`div`,{ref:o,className:g(`text-muted-foreground italic`,c&&`max-h-[4.5rem] overflow-hidden`),children:(0,U.jsx)(Ic,{blocks:s,query:t,trailing:e.final?void 0:(0,U.jsx)(Cl,{})})}),e.final&&(n||i)?(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})}function Tl({entry:e,query:t,background:n}){let[r,i]=(0,H.useState)(void 0),a=r??e.status===`error`,o=Ni(e.input),s=Eo(e.authorisation),c=lo(e);return(0,U.jsxs)(`details`,{open:a,onToggle:e=>i(e.currentTarget.open),className:`group/tool text-foreground`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(fo,{name:e.name,className:e.status===`error`||n?.status===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 shrink-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:(0,U.jsx)(So,{name:e.name})}),o===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80`,children:o}),s?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:s}):e.status===`running`?(0,U.jsx)(jn,{"aria-label":`running`,className:`ml-auto size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none`}):n?(0,U.jsx)(Al,{entry:n}):c?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 font-mono text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:c}):null]}),(0,U.jsxs)(`div`,{className:`my-1 ml-6 rounded-lg border p-3`,children:[(0,U.jsx)(rl,{input:e.input,query:t}),(0,U.jsx)(ol,{entry:e,query:t})]})]})}function El({entry:e,query:t}){return(0,U.jsx)(`div`,{className:`py-0.5`,children:(0,U.jsxs)(`div`,{className:`w-full rounded-lg border px-3 py-2 text-foreground [overflow-wrap:anywhere]`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Nl,{status:e.status===`asked`?`running`:e.status===`answered`?`complete`:`error`}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`?`}),(0,U.jsx)(`span`,{className:`min-w-0 font-mono text-sm`,children:e.questions.length===1?`Asked a question`:`Asked ${e.questions.length} questions`}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.status===`asked`?`waiting…`:e.status})]}),(0,U.jsx)(`dl`,{className:`mt-1 space-y-1`,children:e.questions.map((n,r)=>{let i=e.answers?.[r]??[];return(0,U.jsxs)(`div`,{className:`text-sm`,children:[(0,U.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:(0,U.jsx)(Nc,{text:n.question,query:t})}),(0,U.jsx)(`dd`,{className:g(`font-medium`,i.length===0&&`text-muted-foreground italic`),children:i.length===0?e.status===`asked`?`unanswered`:`no answer`:(0,U.jsx)(Nc,{text:i.join(`, `),query:t})})]},n.question)})})]})})}function Dl({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=Jc(),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,Ol(e.status)===`error`?`text-destructive`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere] max-sm:col-start-2 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80 max-sm:col-start-2 max-sm:col-end-4 max-sm:row-start-2`,children:(0,U.jsx)(Nc,{text:e.description,query:t})}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:col-start-3 max-sm:row-start-1`,children:[r?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,n]})]}),o=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-foreground max-sm:grid max-sm:grid-cols-[14px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return i===void 0?(0,U.jsx)(`div`,{className:o,children:a}):(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(vn(e)),className:g(o,`text-left hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`),children:a})}function Ol(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function kl({entry:e}){let t=tl(e,nl());return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-1.5 py-1 text-foreground`,children:[(0,U.jsx)(fo,{name:e.tool,className:jl(e.status)===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground/70`,children:`in background`}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,t.label,` `,t.at]})]})}function Al({entry:e}){let t=tl(e,nl());return(0,U.jsxs)(`span`,{className:g(`ml-auto flex shrink-0 items-center gap-1.5 text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,(0,U.jsx)(`span`,{className:`sr-only`,children:`in background,`}),t.label,` `,t.at]})}function jl(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var Ml={running:`text-foreground`,complete:`text-muted-foreground`,error:`text-destructive`};function Nl({status:e}){return(0,U.jsx)(`span`,{"aria-hidden":!0,className:g(`inline-block size-1.5 shrink-0 rounded-full`,Ml[e],e===`complete`?`border-[1.5px] border-current`:`bg-current`)})}var Pl={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Fl({sessionId:e,query:t}){let{sessions:n}=bi(),r=n.find(t=>t.id===e);return r?(0,U.jsx)(`a`,{href:Di({sessionId:r.id}),className:`rounded-sm font-sans font-medium text-foreground outline-none transition-[text-shadow] duration-150 hover:[text-shadow:0_0_8px_color-mix(in_srgb,currentColor_60%,transparent)] focus-visible:ring-3 focus-visible:ring-ring/30`,children:(0,U.jsx)(Nc,{text:Ai(r),query:t})}):(0,U.jsx)(`span`,{className:`text-foreground`,children:(0,U.jsx)(Nc,{text:e,query:t})})}function Il({entry:e,query:t}){let n=Pl[e.level],r=e.sessionId===void 0?-1:e.text.indexOf(e.sessionId);return(0,U.jsx)(zl,{gutter:`!`,gutterClassName:n,children:(0,U.jsx)(`p`,{className:g(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:r===-1||e.sessionId===void 0?(0,U.jsx)(Nc,{text:e.text,query:t}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Nc,{text:e.text.slice(0,r),query:t}),(0,U.jsx)(Fl,{sessionId:e.sessionId,query:t}),(0,U.jsx)(Nc,{text:e.text.slice(r+e.sessionId.length),query:t})]})})})}var Ll={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`,rewound:`text-muted-foreground`,forked:`text-muted-foreground`};function Rl({entry:e}){let t=Ll[e.marker],n=ml();return(0,U.jsxs)(`div`,{className:g(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),e.fromSessionId&&n?(0,U.jsx)(O,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-current`,onClick:()=>n(e.fromSessionId),children:`Forked from another Agent Session`}):(0,U.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function zl({gutter:e,gutterClassName:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,U.jsx)(`span`,{"aria-hidden":!0,className:g(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Bl(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Vl(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Hl(e,t=`|`){return e.map(e=>hu(e)).join(t)}function Ul(e,t){return typeof t==`bigint`?t.toString():t}var Wl=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Gl(e){return new Wl(e)}function Kl(e){return e==null}function ql(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Jl(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Yl=Symbol(`evaluating`);function Xl(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Yl)return r===void 0&&(r=Yl,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Zl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ql(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function $l(e){return Ql(e._zod.def)??e._zod.def.shape}function eu(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Zl(this,t,e),e},enumerable:!0,configurable:!0})}function tu(e,t,n){t in e?Zl(e,t,n):e[t]=n}function nu(e,t,n,r){let i=$l(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?eu(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):tu(e,a,r?r(n.value,a):n.value))}}function ru(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?eu(e,n,()=>t[n]):tu(e,n,r.value))}}function iu(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function au(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var su=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function cu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var lu=Gl(()=>{if(rd.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function uu(e){if(cu(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return cu(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function du(e){return uu(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var fu=new Set([`string`,`number`,`symbol`]);function pu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function mu(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function hu(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function gu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var _u={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},vu={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function yu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return nu(i,e,bu(e,t)),mu(e,iu(n,{shape:i,checks:[]}))}function bu(e,t){let n=$l(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function xu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(bu(e,t)),a={};return nu(a,e,Reflect.ownKeys($l(e)).filter(e=>!i.has(e))),mu(e,iu(n,{shape:a,checks:[]}))}function Su(e,t){if(!uu(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=$l(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return mu(e,iu(e._zod.def,{shape:Cu(e,t)}))}function Cu(e,t){let n={};return nu(n,e,Reflect.ownKeys($l(e))),ru(n,t),n}function wu(e,t){if(!uu(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return mu(e,iu(e._zod.def,{shape:Cu(e,t)}))}function Tu(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return nu(n,e,Reflect.ownKeys($l(e))),nu(n,t,Reflect.ownKeys($l(t))),mu(e,iu(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Eu(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(bu(t,n)):void 0,o={};return nu(o,t,Reflect.ownKeys($l(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),mu(t,iu(t._zod.def,{shape:o,checks:[]}))}function Du(e,t,n){let r=n?new Set(bu(t,n)):void 0,i={};return nu(i,t,Reflect.ownKeys($l(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),mu(t,iu(t._zod.def,{shape:i}))}function Ou(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ku(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Au(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ju(e){return typeof e==`string`?e:e?.message}function Mu(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Nu(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ju(e.inst?._zod.def?.error?.(e))??ju(a?.(e))??ju(t?.error?.(e))??ju(n.customError?.(e))??ju(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Pu=/[\uD800-\uDBFF]/;function Fu(e){let t=e.length;if(!Pu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Iu(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Lu(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ru(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function zu(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Uu(e,n,r.value)}}function Bu(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Vu(e,t,n){return Bu(e,t,n,!1)}function Hu(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Bu(this,n,r(this))},set(e){Bu(this,n,e)}})}return t}function Uu(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Bu(this,t,n.bind(this))},set(e){Bu(this,t,e)}})}function Wu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Gu,Ku=!1,qu={configurable:!0,get(){Ku=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Gu!==e._zod){Gu=void 0;return}Gu=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,qu);let e=Ku;Ku=!1;try{let r=n(this);return Ku?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ku||=e,r}catch(n){throw delete this[t],Ku||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ju(e,t,n,r){let i=Wu(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Yu=`~constantCatch`;function Xu(e){let t=()=>e;return t[Yu]=!0,t}var Zu,Qu={value:void 0,enumerable:!1},$u=`captureStackTrace`in Error?Error:null;function ed(e){let t=$u;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return $u=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Qu.value=new a(r);try{Object.defineProperty(n,"_zod",Qu)}finally{Qu.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),zu(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ed(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var td=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},nd=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Zu=globalThis).__zod_globalConfig??(Zu.__zod_globalConfig={});var rd=globalThis.__zod_globalConfig;function id(e){return e&&Object.assign(rd,e),rd}function ad(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ul,2),e.message}function od(e){this._zod.message=e}var sd={get:ad,set:od,enumerable:!0,configurable:!0},cd={value:void 0,enumerable:!1},ld=new WeakSet([Object.prototype,Error.prototype]),ud=(e,t)=>{e.name=`$ZodError`,cd.value=t,Object.defineProperty(e,"issues",cd),cd.value=void 0,Object.defineProperty(e,"message",sd);let n=Object.getPrototypeOf(e);ld.has(n)||(ld.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},dd=q(`$ZodError`,ud);q(`$ZodError`,ud,void 0,{Parent:Error});function fd(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function pd(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?fd(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function md(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function hd(e,t){return{callee:t?.callee??e,Err:t?.Err}}var gd=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new td;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Nu(e,o,id())));throw su(n,a?.callee??t),n}return s.value};return t},_d=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Nu(e,o,id())));throw su(n,a?.callee??t),n}return s.value};return t},vd=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new td;return a.issues.length?yd(e,a.issues,i):{success:!0,data:a.value}};function yd(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Nu(e,n,id()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var bd=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?yd(e,a.issues,i):{success:!0,data:a.value}},xd=Symbol.for(`zod.compile.invalid`),Sd=Symbol.for(`zod.compile.fallback`),Cd=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==xd)return!0;if(r.definite===!0&&n===void 0)return!1}return wd(e,t,n)});function wd(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Sd]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new td;return a.issues.length===0}var Td=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Ed=e=>{let t=gd(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,hd(n,a))};return n},Dd=e=>{let t=gd(e),n=(e,r,i,a)=>t(e,r,i,hd(n,a));return n},Od=e=>{let t=_d(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,hd(n,a))};return n},kd=e=>{let t=_d(e),n=async(e,r,i,a)=>await t(e,r,i,hd(n,a));return n},Ad=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vd(e)(t,n,i)},jd=e=>(t,n,r)=>vd(e)(t,n,r),Md=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bd(e)(t,n,i)},Nd=e=>async(t,n,r)=>bd(e)(t,n,r),Pd=/^[cC][0-9a-z]{6,}$/,Fd=/^[0-9a-z]+$/,Id=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ld=/^[0-9a-vA-V]{20}$/,Rd=/^[A-Za-z0-9]{27}$/,zd=/^[a-zA-Z0-9_-]{21}$/;function Bd(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ud=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Wd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Gd=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Kd(){return new RegExp(Gd,`u`)}var qd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Yd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Xd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qd=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,$d=/^https?$/,ef=/^\+[1-9]\d{6,14}$/,tf=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function nf(e){return RegExp(`^${e}$`)}var rf=nf(tf);function af(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function of(e){return RegExp(`^${af(e)}$`)}function sf(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${af({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${af({precision:e.precision})}`:n;return RegExp(`^${tf}T(?:${r})$`)}var cf=/^[\s\S]{0,}$/,lf=/^-?\d+$/,uf=/^-?\d+(?:\.\d+)?$/,df=/^(?:true|false)$/i,ff=/^null$/i,pf=/^[^A-Z]*$/,mf=/^[^a-z]*$/,hf=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gf=e=>{let t=e.value;return!Kl(t)&&t.length!==void 0},_f={number:`number`,bigint:`bigint`,object:`date`},vf=q(`$ZodCheckLessThan`,(e,t)=>{hf.init(e,t);let n=_f[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:_f[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yf=q(`$ZodCheckGreaterThan`,(e,t)=>{hf.init(e,t);let n=_f[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_f[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bf=q(`$ZodCheckMultipleOf`,(e,t)=>{hf.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Jl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xf=q(`$ZodCheckNumberFormat`,(e,t)=>{hf.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=_u[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Sf=q(`$ZodCheckMaxLength`,(e,t)=>{var n;hf.init(e,t),(n=e._zod.def).when??(n.when=gf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Fu(r):i)<=t.maximum)return;let a=Iu(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cf=q(`$ZodCheckMinLength`,(e,t)=>{var n;hf.init(e,t),(n=e._zod.def).when??(n.when=gf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Fu(r):i)>=t.minimum)return;let a=Iu(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wf=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;hf.init(e,t),(n=e._zod.def).when??(n.when=gf),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Fu(r):i;if(a===t.length)return;let o=Iu(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tf=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;hf.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ef=q(`$ZodCheckRegex`,(e,t)=>{Tf.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Df=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pf,Tf.init(e,t)}),Of=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mf,Tf.init(e,t)}),kf=q(`$ZodCheckIncludes`,(e,t)=>{hf.init(e,t);let n=pu(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Af=q(`$ZodCheckStartsWith`,(e,t)=>{hf.init(e,t);let n=RegExp(`^${pu(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jf=q(`$ZodCheckEndsWith`,(e,t)=>{hf.init(e,t);let n=RegExp(`.*${pu(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mf=q(`$ZodCheckOverwrite`,(e,t)=>{hf.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nf=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
77
+ `:``,o=t===i.length-1?r:void 0;return(0,U.jsxs)(H.Fragment,{children:[(0,U.jsxs)(`span`,{className:g(`inline-block min-w-full min-h-[1lh] align-top`,Hc(e.kind)),children:[(0,U.jsx)(Vc,{text:a?e.text.slice(0,-a.length):e.text,query:n}),a?void 0:o]}),a||void 0,a?o:void 0]},t)}),i.length===0?r:void 0]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Vc,{text:e,query:n}),r]})}function Wc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,U.jsx)(Gc,{blocks:e,query:t,trailing:n})})}function Gc({blocks:e,query:t,trailing:n}){return(0,U.jsx)(U.Fragment,{children:e.map((r,i)=>(0,U.jsx)(qc,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var Kc={1:`text-lg`,2:`text-base`};function qc({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,U.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,U.jsxs)(r,{className:g(Kc[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,U.jsx)(Zc,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,U.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,U.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:(0,U.jsx)(Uc,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,U.jsx)(r,{className:g(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,U.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,U.jsx)(Gc,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,U.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,U.jsx)(Gc,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,U.jsx)(Xc,{block:e,query:t,trailing:n});case`rule`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`hr`,{className:`border-border`}),n]})}}var Jc={left:`text-left`,center:`text-center`,right:`text-right`},Yc=e=>e===void 0?`text-left`:Jc[e]??`text-left`;function Xc({block:e,query:t,trailing:n}){return(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,U.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:e.header.map((n,r)=>(0,U.jsx)(`th`,{className:g(`border-b px-2 py-1 font-semibold`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))})}),(0,U.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,U.jsx)(`tr`,{children:n.map((n,r)=>(0,U.jsx)(`td`,{className:g(`border-b border-border/50 px-2 py-1`,Yc(e.align[r])),children:(0,U.jsx)(Zc,{inlines:n,query:t})},r))},r))})]}),n]})}function Zc({inlines:e,query:t}){return(0,U.jsx)(U.Fragment,{children:e.map((e,n)=>(0,U.jsx)(Qc,{inline:e,query:t},n))})}function Qc({inline:e,query:t}){switch(e.kind){case`text`:return(0,U.jsx)(Vc,{text:e.text,query:t});case`strong`:return(0,U.jsx)(`strong`,{className:`font-semibold`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`em`:return(0,U.jsx)(`em`,{children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`del`:return(0,U.jsx)(`del`,{className:`text-muted-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`code`:return(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,U.jsx)(Vc,{text:e.text,query:t})});case`link`:return(0,U.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,U.jsx)(Zc,{inlines:e.inlines,query:t})});case`image`:return(0,U.jsx)($c,{src:e.src,alt:e.alt},e.src);case`break`:return(0,U.jsx)(`br`,{})}}function $c({src:e,alt:t}){let[n,r]=(0,H.useState)(!1);return n?(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,U.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var el=(0,H.createContext)(void 0),tl=el.Provider;function nl(){return(0,H.useContext)(el)}function rl(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function il(e){let t=rl(e);return t===void 0?e.status:`${e.status}, ${t}`}function al(e,t){switch(e.status){case`running`:return{label:`started`,at:co(e.startedAt,t)};case`complete`:return{label:`finished`,at:co(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:co(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:co(e.endedAt??e.startedAt,t)}}}function ol(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function sl({input:e,query:t}){let n=lo(e);return n?(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,U.jsx)(cl,{path:n.path}),(0,U.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,U.jsx)(ll,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,U.jsx)(ll,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function cl({path:e}){let t=e.lastIndexOf(`/`);return(0,U.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,U.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function ll({sign:e,line:t,query:n,kind:r}){return(0,U.jsxs)(`div`,{className:g(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,Hc(r)),children:[(0,U.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,U.jsx)(`span`,{children:(0,U.jsx)(Vc,{text:t,query:n})})]})}function ul({entry:e,query:t}){let n=lo(e.input)!==void 0;return(0,U.jsxs)(U.Fragment,{children:[n?null:(0,U.jsx)(fl,{label:`input`,value:e.input,query:t}),(0,U.jsx)(fl,{label:`update`,value:e.update,query:t}),(0,U.jsx)(fl,{label:`result`,value:e.result,query:t})]})}var dl=2e4;function fl({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:ml(t);if(r===``)return null;let i=e!==`input`&&r.length<=dl?pl(t):void 0;return(0,U.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,U.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,U.jsx)(fl,{label:e.label,value:e.text,query:n},e.label)):(0,U.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>dl?r:(0,U.jsx)(Uc,{text:r,query:n})})]})}function pl(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&uo(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:ml(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:ml(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:ml(o)}),i}function ml(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function hl(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.toLocaleDateString(void 0,{day:`numeric`,month:`short`,...n.getFullYear()===t.getFullYear()?{}:{year:`numeric`}})}, ${r}`}var gl=(0,H.createContext)({}),_l=gl.Provider;function vl(){return(0,H.useContext)(gl).openSession}function yl({userMessageId:e}){let{rewind:t,fork:n}=(0,H.useContext)(gl);return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(bl,{icon:(0,U.jsx)(Ln,{"aria-hidden":!0}),label:t.blocked??`Rewind to before this message`,disabled:t.blocked!==void 0,children:[(0,U.jsx)(Da,{onClick:()=>t.run(e,`conversation`),children:`Conversation`}),t.files?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Da,{onClick:()=>t.run(e,`files`),children:`Code`}),(0,U.jsx)(Da,{onClick:()=>t.run(e,`both`),children:`Both`})]}):null]}):null,n?(0,U.jsxs)(bl,{icon:(0,U.jsx)(On,{"aria-hidden":!0}),label:`Fork from before this message`,children:[(0,U.jsx)(Da,{onClick:()=>n.run(e,!1),children:`Same Scope`}),n.worktree?(0,U.jsx)(Da,{onClick:()=>n.run(e,!0),children:`New Worktree`}):null]}):null]})}function bl({icon:e,label:t,disabled:n=!1,children:r}){return(0,U.jsxs)(wa,{children:[(0,U.jsxs)(no,{children:[(0,U.jsx)(ro,{render:(0,U.jsx)(Ta,{disabled:n,render:(0,U.jsx)(O,{variant:`ghost`,size:`icon-xs`,"aria-label":t,children:e})})}),(0,U.jsx)(io,{children:t})]}),(0,U.jsx)(Ea,{className:`min-w-40`,children:r})]})}var xl=(0,H.memo)(function(e){return e.entry.rewound?(0,U.jsx)(`div`,{className:`opacity-50`,children:Sl(e)}):Sl(e)});function Sl({entry:e,query:t,sessionId:n,background:r}){switch(e.kind){case`user`:return(0,U.jsx)(Cl,{entry:e,query:t,sessionId:n});case`assistant`:return(0,U.jsx)(Tl,{entry:e,query:t});case`thinking`:return(0,U.jsx)(Ol,{entry:e,query:t});case`tool`:return(0,U.jsx)(kl,{entry:e,query:t,background:r});case`subagent`:return(0,U.jsx)(Ml,{entry:e,query:t});case`background_call`:return(0,U.jsx)(Pl,{entry:e});case`enquiry`:return(0,U.jsx)(Al,{entry:e,query:t});case`notice`:return(0,U.jsx)(zl,{entry:e,query:t});case`marker`:return(0,U.jsx)(Vl,{entry:e});default:return null}}function Cl({entry:e,query:t,sessionId:n}){let r=(0,H.useMemo)(()=>bc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`group/message relative flex flex-col items-end py-3 before:absolute before:inset-y-0 before:-right-[100vw] before:-left-[100vw] before:content-['']`,children:[(0,U.jsxs)(`div`,{className:g(`relative min-w-0 max-w-[90%] rounded-2xl rounded-br-sm px-4 py-3 sm:max-w-[80%]`,e.fromSessionId===void 0&&e.producer===void 0?`bg-muted`:`border border-border bg-muted/40 text-muted-foreground`),children:[e.fromSessionId===void 0?null:(0,U.jsxs)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:[`From `,(0,U.jsx)(Rl,{sessionId:e.fromSessionId,query:t}),` · not human authorization`]}),e.producer===void 0?null:(0,U.jsx)(`p`,{className:`m-0 mb-2 text-xs text-muted-foreground`,children:`From the parent agent · not human authorization`}),e.attachments?.length?(0,U.jsx)(wl,{ids:e.attachments,sessionId:n}):null,(0,U.jsx)(Wc,{blocks:r,query:t})]}),e.at?(0,U.jsx)(El,{at:e.at,side:`right`,children:e.rewound||e.producer?null:(0,U.jsx)(`span`,{className:`inline-flex [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100 focus-within:opacity-100 has-[[aria-expanded=true]]:opacity-100`,children:(0,U.jsx)(yl,{userMessageId:e.id})})}):null]})}function wl({ids:e,sessionId:t}){return(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,U.jsx)(To,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function Tl({entry:e,query:t}){let n=(0,H.useMemo)(()=>bc(e.text),[e.text]);return(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Hl,{children:(0,U.jsx)(Wc,{blocks:n,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.endedAt?(0,U.jsx)(El,{at:e.endedAt,side:`left`}):null]})}function El({at:e,side:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`relative mt-1 flex items-center gap-1 text-xs whitespace-nowrap text-muted-foreground/70`,t===`right`&&`flex-row-reverse @min-[68rem]/transcript:flex-row`,`@min-[68rem]/transcript:absolute @min-[68rem]/transcript:mt-0 @min-[68rem]/transcript:leading-[1.375rem]`,t===`right`?`text-right @min-[68rem]/transcript:bottom-6 @min-[68rem]/transcript:left-full @min-[68rem]/transcript:ml-4`:`@min-[68rem]/transcript:right-full @min-[68rem]/transcript:bottom-1 @min-[68rem]/transcript:mr-4`),children:[(0,U.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:hl(e,new Date)}),n]})}function Dl(){return(0,U.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function Ol({entry:e,query:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=(0,H.useMemo)(()=>bc(e.text),[e.text]),c=e.final&&!n,l=e.text.trim()===``;return(0,H.useLayoutEffect)(()=>{let e=o.current;if(!e||!c)return;let t=new ResizeObserver(()=>a(e.scrollHeight>e.clientHeight+1));return t.observe(e),()=>t.disconnect()},[c,l]),l?null:(0,U.jsxs)(Hl,{children:[(0,U.jsx)(`div`,{ref:o,className:g(`text-muted-foreground italic`,c&&`max-h-[4.5rem] overflow-hidden`),children:(0,U.jsx)(Wc,{blocks:s,query:t,trailing:e.final?void 0:(0,U.jsx)(Dl,{})})}),e.final&&(n||i)?(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})}function kl({entry:e,query:t,background:n}){let[r,i]=(0,H.useState)(void 0),a=r??e.status===`error`,o=Fi(e.input),s=Po(e.authorisation),c=vo(e);return(0,U.jsxs)(`details`,{open:a,onToggle:e=>i(e.currentTarget.open),className:`group/tool text-foreground`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 rounded-md px-1.5 py-1 select-none hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`,children:[(0,U.jsx)(bo,{name:e.name,className:e.status===`error`||n?.status===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 shrink-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:(0,U.jsx)(Ao,{name:e.name})}),o===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80`,children:o}),s?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:s}):e.status===`running`?(0,U.jsx)(jn,{"aria-label":`running`,className:`ml-auto size-3.5 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none`}):n?(0,U.jsx)(Fl,{entry:n}):c?(0,U.jsx)(`span`,{className:g(`ml-auto shrink-0 font-mono text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:c}):null]}),(0,U.jsxs)(`div`,{className:`my-1 ml-6 rounded-lg border p-3`,children:[(0,U.jsx)(sl,{input:e.input,query:t}),(0,U.jsx)(ul,{entry:e,query:t})]})]})}function Al({entry:e,query:t}){return(0,U.jsxs)(`div`,{className:`flex items-start gap-2 px-1.5 py-1 text-foreground`,children:[(0,U.jsx)(Mn,{"aria-hidden":!0,className:`mt-[3px] size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:e.questions.map((n,r)=>(0,U.jsx)(jl,{entry:e,index:r,query:t},n.question))})]})}function jl({entry:e,index:t,query:n}){let r=e.questions[t],i=e.answers?.[t]??[],a=r.options.filter(e=>!i.includes(e.label)).map(e=>e.label);return(0,U.jsxs)(`details`,{className:`group/question`,children:[(0,U.jsxs)(`summary`,{className:`-mx-1.5 flex cursor-default items-center gap-2 rounded-md px-1.5 text-sm select-none hover:bg-muted/50`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[r.header,` `]}),i.length===0?(0,U.jsx)(`span`,{className:`text-muted-foreground italic`,children:e.status===`asked`?`waiting…`:`no answer`}):(0,U.jsx)(Vc,{text:i.join(`, `),query:n})]}),(0,U.jsx)(Cn,{"aria-hidden":!0,className:`ml-auto size-3.5 shrink-0 text-muted-foreground transition-transform group-open/question:rotate-90`})]}),(0,U.jsxs)(`div`,{className:`mt-0.5 mb-1.5 space-y-1 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`p`,{children:(0,U.jsx)(Vc,{text:r.question,query:n})}),a.length===0?null:(0,U.jsxs)(`p`,{className:`text-muted-foreground/70`,children:[i.length===0?`Options: `:`Other options: `,(0,U.jsx)(Vc,{text:a.join(` · `),query:n})]})]})]})}function Ml({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=nl(),a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xn,{"aria-hidden":!0,className:g(`size-3.5 shrink-0`,Nl(e.status)===`error`?`text-destructive`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere] max-sm:col-start-2 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,U.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground/80 max-sm:col-start-2 max-sm:col-end-4 max-sm:row-start-2`,children:(0,U.jsx)(Vc,{text:e.description,query:t})}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground max-sm:col-start-3 max-sm:row-start-1`,children:[r?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,n]})]}),o=`flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-foreground max-sm:grid max-sm:grid-cols-[14px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return i===void 0?(0,U.jsx)(`div`,{className:o,children:a}):(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(vn(e)),className:g(o,`text-left hover:bg-muted/50 cursor-tilt relative [--tilt-angle-x:10deg] [--tilt-angle-y:1.5deg] [--tilt-lift:1.005]`),children:a})}function Nl(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function Pl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-1.5 py-1 text-foreground`,children:[(0,U.jsx)(bo,{name:e.tool,className:Il(e.status)===`error`?`text-destructive`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 text-sm text-muted-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground/70`,children:`in background`}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,t.label,` `,t.at]})]})}function Fl({entry:e}){let t=al(e,ol());return(0,U.jsxs)(`span`,{className:g(`ml-auto flex shrink-0 items-center gap-1.5 text-xs`,e.status===`error`?`text-destructive`:`text-muted-foreground`),children:[e.status===`running`?(0,U.jsx)(jn,{"aria-hidden":!0,className:`size-3.5 animate-spin motion-reduce:animate-none`}):null,(0,U.jsx)(`span`,{className:`sr-only`,children:`in background,`}),t.label,` `,t.at]})}function Il(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var Ll={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Rl({sessionId:e,query:t}){let{sessions:n}=xi(),r=n.find(t=>t.id===e);return r?(0,U.jsx)(`a`,{href:Oi({sessionId:r.id}),className:`rounded-sm font-sans font-medium text-foreground outline-none transition-[text-shadow] duration-150 hover:[text-shadow:0_0_8px_color-mix(in_srgb,currentColor_60%,transparent)] focus-visible:ring-3 focus-visible:ring-ring/30`,children:(0,U.jsx)(Vc,{text:ji(r),query:t})}):(0,U.jsx)(`span`,{className:`text-foreground`,children:(0,U.jsx)(Vc,{text:e,query:t})})}function zl({entry:e,query:t}){let n=Ll[e.level],r=e.sessionId===void 0?-1:e.text.indexOf(e.sessionId);return(0,U.jsx)(Hl,{gutter:`!`,gutterClassName:n,children:(0,U.jsx)(`p`,{className:g(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:r===-1||e.sessionId===void 0?(0,U.jsx)(Vc,{text:e.text,query:t}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Vc,{text:e.text.slice(0,r),query:t}),(0,U.jsx)(Rl,{sessionId:e.sessionId,query:t}),(0,U.jsx)(Vc,{text:e.text.slice(r+e.sessionId.length),query:t})]})})})}var Bl={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`,rewound:`text-muted-foreground`,forked:`text-muted-foreground`};function Vl({entry:e}){let t=Bl[e.marker],n=vl();return(0,U.jsxs)(`div`,{className:g(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),e.fromSessionId&&n?(0,U.jsx)(O,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-current`,onClick:()=>n(e.fromSessionId),children:`Forked from another Agent Session`}):(0,U.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function Hl({gutter:e,gutterClassName:t,children:n}){return(0,U.jsxs)(`div`,{className:g(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,U.jsx)(`span`,{"aria-hidden":!0,className:g(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Ul(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Wl(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Gl(e,t=`|`){return e.map(e=>vu(e)).join(t)}function Kl(e,t){return typeof t==`bigint`?t.toString():t}var ql=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Jl(e){return new ql(e)}function Yl(e){return e==null}function Xl(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Zl(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Ql=Symbol(`evaluating`);function $l(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ql)return r===void 0&&(r=Ql,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function eu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function tu(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function nu(e){return tu(e._zod.def)??e._zod.def.shape}function ru(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return eu(this,t,e),e},enumerable:!0,configurable:!0})}function iu(e,t,n){t in e?eu(e,t,n):e[t]=n}function au(e,t,n,r){let i=nu(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ru(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):iu(e,a,r?r(n.value,a):n.value))}}function ou(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ru(e,n,()=>t[n]):iu(e,n,r.value))}}function su(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function cu(e){return JSON.stringify(e)}function lu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var uu=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function du(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var fu=Jl(()=>{if(od.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function pu(e){if(du(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return du(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mu(e){return pu(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var hu=new Set([`string`,`number`,`symbol`]);function gu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _u(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function G(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function vu(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function yu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var bu={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xu={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Su(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return au(i,e,Cu(e,t)),_u(e,su(n,{shape:i,checks:[]}))}function Cu(e,t){let n=nu(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function wu(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Cu(e,t)),a={};return au(a,e,Reflect.ownKeys(nu(e)).filter(e=>!i.has(e))),_u(e,su(n,{shape:a,checks:[]}))}function Tu(e,t){if(!pu(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=nu(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Eu(e,t){let n={};return au(n,e,Reflect.ownKeys(nu(e))),ou(n,t),n}function Du(e,t){if(!pu(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return _u(e,su(e._zod.def,{shape:Eu(e,t)}))}function Ou(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return au(n,e,Reflect.ownKeys(nu(e))),au(n,t,Reflect.ownKeys(nu(t))),_u(e,su(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ku(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Cu(t,n)):void 0,o={};return au(o,t,Reflect.ownKeys(nu(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),_u(t,su(t._zod.def,{shape:o,checks:[]}))}function Au(e,t,n){let r=n?new Set(Cu(t,n)):void 0,i={};return au(i,t,Reflect.ownKeys(nu(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),_u(t,su(t._zod.def,{shape:i}))}function ju(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Nu(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Pu(e){return typeof e==`string`?e:e?.message}function Fu(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Iu(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Pu(e.inst?._zod.def?.error?.(e))??Pu(a?.(e))??Pu(t?.error?.(e))??Pu(n.customError?.(e))??Pu(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Lu=/[\uD800-\uDBFF]/;function Ru(e){let t=e.length;if(!Lu.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function zu(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Bu(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Vu(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Hu(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ku(e,n,r.value)}}function Uu(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Wu(e,t,n){return Uu(e,t,n,!1)}function Gu(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Uu(this,n,r(this))},set(e){Uu(this,n,e)}})}return t}function Ku(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Uu(this,t,n.bind(this))},set(e){Uu(this,t,e)}})}function qu(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ju,Yu=!1,Xu={configurable:!0,get(){Yu=!0}};function K(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ju!==e._zod){Ju=void 0;return}Ju=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Xu);let e=Yu;Yu=!1;try{let r=n(this);return Yu?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Yu||=e,r}catch(n){throw delete this[t],Yu||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Zu(e,t,n,r){let i=qu(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Qu=`~constantCatch`;function $u(e){let t=()=>e;return t[Qu]=!0,t}var ed,td={value:void 0,enumerable:!1},nd=`captureStackTrace`in Error?Error:null;function rd(e){let t=nd;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){td.value=new a(r);try{Object.defineProperty(n,"_zod",td)}finally{td.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Hu(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?rd(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var id=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ad=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ed=globalThis).__zod_globalConfig??(ed.__zod_globalConfig={});var od=globalThis.__zod_globalConfig;function sd(e){return e&&Object.assign(od,e),od}function cd(){let e=this._zod;return e.message??=JSON.stringify(e.def,Kl,2),e.message}function ld(e){this._zod.message=e}var ud={get:cd,set:ld,enumerable:!0,configurable:!0},dd={value:void 0,enumerable:!1},fd=new WeakSet([Object.prototype,Error.prototype]),pd=(e,t)=>{e.name=`$ZodError`,dd.value=t,Object.defineProperty(e,"issues",dd),dd.value=void 0,Object.defineProperty(e,"message",ud);let n=Object.getPrototypeOf(e);fd.has(n)||(fd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},md=q(`$ZodError`,pd);q(`$ZodError`,pd,void 0,{Parent:Error});function hd(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function gd(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hd(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function _d(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function vd(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yd=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new id;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},bd=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Iu(e,o,sd())));throw uu(n,a?.callee??t),n}return s.value};return t},xd=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new id;return a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}};function Sd(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Iu(e,n,sd()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Cd=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Sd(e,a.issues,i):{success:!0,data:a.value}},wd=Symbol.for(`zod.compile.invalid`),Td=Symbol.for(`zod.compile.fallback`),Ed=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==wd)return!0;if(r.definite===!0&&n===void 0)return!1}return Dd(e,t,n)});function Dd(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Td]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new id;return a.issues.length===0}var Od=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},kd=e=>{let t=yd(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,vd(n,a))};return n},Ad=e=>{let t=yd(e),n=(e,r,i,a)=>t(e,r,i,vd(n,a));return n},jd=e=>{let t=bd(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,vd(n,a))};return n},Md=e=>{let t=bd(e),n=async(e,r,i,a)=>await t(e,r,i,vd(n,a));return n},Nd=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return xd(e)(t,n,i)},Pd=e=>(t,n,r)=>xd(e)(t,n,r),Fd=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Cd(e)(t,n,i)},Id=e=>async(t,n,r)=>Cd(e)(t,n,r),Ld=/^[cC][0-9a-z]{6,}$/,Rd=/^[0-9a-z]+$/,zd=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Bd=/^[0-9a-vA-V]{20}$/,Vd=/^[A-Za-z0-9]{27}$/,Hd=/^[a-zA-Z0-9_-]{21}$/;function Ud(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Wd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kd=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jd=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Yd(){return new RegExp(Jd,`u`)}var Xd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$d=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ef=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,nf=/^https?$/,rf=/^\+[1-9]\d{6,14}$/,af=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function of(e){return RegExp(`^${e}$`)}var sf=of(af);function cf(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lf(e){return RegExp(`^${cf(e)}$`)}function uf(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${cf({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${cf({precision:e.precision})}`:n;return RegExp(`^${af}T(?:${r})$`)}var df=/^[\s\S]{0,}$/,ff=/^-?\d+$/,pf=/^-?\d+(?:\.\d+)?$/,mf=/^(?:true|false)$/i,hf=/^null$/i,gf=/^[^A-Z]*$/,_f=/^[^a-z]*$/,vf=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yf=e=>{let t=e.value;return!Yl(t)&&t.length!==void 0},bf={number:`number`,bigint:`bigint`,object:`date`},xf=q(`$ZodCheckLessThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sf=q(`$ZodCheckGreaterThan`,(e,t)=>{vf.init(e,t);let n=bf[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:bf[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cf=q(`$ZodCheckMultipleOf`,(e,t)=>{vf.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Zl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),wf=q(`$ZodCheckNumberFormat`,(e,t)=>{vf.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=bu[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Tf=q(`$ZodCheckMaxLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ru(r):i)<=t.maximum)return;let a=zu(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ef=q(`$ZodCheckMinLength`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ru(r):i)>=t.minimum)return;let a=zu(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Df=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;vf.init(e,t),(n=e._zod.def).when??(n.when=yf),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ru(r):i;if(a===t.length)return;let o=zu(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Of=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;vf.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),kf=q(`$ZodCheckRegex`,(e,t)=>{Of.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Af=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gf,Of.init(e,t)}),jf=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_f,Of.init(e,t)}),Mf=q(`$ZodCheckIncludes`,(e,t)=>{vf.init(e,t);let n=gu(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Nf=q(`$ZodCheckStartsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`^${gu(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Pf=q(`$ZodCheckEndsWith`,(e,t)=>{vf.init(e,t);let n=RegExp(`.*${gu(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ff=q(`$ZodCheckOverwrite`,(e,t)=>{vf.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),If=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
78
78
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
79
- `)}\n};`)(...Object.values(this.closed))}},Pf={major:4,minor:6,patch:5},Ff=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pf;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Ou(t),a;for(let o of n){if(o._zod.def.when){if(ku(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new td;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Mu(t.issues,n,e),i||=Ou(t,n))});else{if(t.issues.length===n)continue;Mu(t.issues,n,e),i||=Ou(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ou(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new td;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new td;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Vu(this,`~standard`,Rf(this))},set"~standard"(e){Bu(this,`~standard`,e)}}),If=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Nu(e,t,id()))}:{value:e.value};async function Lf(e,t){let n={async:!0};return If(await e._zod.run({value:t,issues:[]},n),n)}function Rf(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return If(r,n)}catch{}return Lf(e,t)},vendor:`zod`,version:1}}var zf=q(`$ZodString`,(e,t)=>{Ff.init(e,t),e._zod.pattern=t.pattern??cf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Bf=q(`$ZodStringFormat`,(e,t)=>{Tf.init(e,t),zf.init(e,t)}),Vf=q(`$ZodGUID`,(e,t)=>{t.pattern??=Hd,Bf.init(e,t)}),Hf=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ud(e)}else t.pattern??=Ud();Bf.init(e,t)}),Uf=q(`$ZodEmail`,(e,t)=>{t.pattern??=Wd,Bf.init(e,t)});function Wf(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Gf(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Wf(e)||2:Kf(e,t)}function Kf(e,t){if(!t.normalize&&t.protocol?.source===$d.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var qf=/[\t\n\r]/g;function Jf(e){return e.replace(qf,``)}function Yf(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xf(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Zf=q(`$ZodURL`,(e,t)=>{Bf.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Gf(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Jf(r);return}t.hostname&&!Yf(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Xf(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Jf(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Qf=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Kd(),Bf.init(e,t)}),$f=q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?zd:Bd(t.length),Bf.init(e,t)}),ep=q(`$ZodCUID`,(e,t)=>{t.pattern??=Pd,Bf.init(e,t)}),tp=q(`$ZodCUID2`,(e,t)=>{t.pattern??=Fd,Bf.init(e,t)}),np=q(`$ZodULID`,(e,t)=>{t.pattern??=Id,Bf.init(e,t)}),rp=q(`$ZodXID`,(e,t)=>{t.pattern??=Ld,Bf.init(e,t)}),ip=q(`$ZodKSUID`,(e,t)=>{t.pattern??=Rd,Bf.init(e,t)}),ap=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=sf(t),Bf.init(e,t)}),op=q(`$ZodISODate`,(e,t)=>{t.pattern??=rf,Bf.init(e,t)}),sp=q(`$ZodISOTime`,(e,t)=>{t.pattern??=of(t),Bf.init(e,t)}),cp=q(`$ZodISODuration`,(e,t)=>{t.pattern??=Vd,Bf.init(e,t)}),lp=q(`$ZodIPv4`,(e,t)=>{t.pattern??=qd,Bf.init(e,t)}),up=/^[0-9a-fA-F:.]+$/;function dp(e){return up.test(e)?Wf(`http://[${e}]`):!1}var fp=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Jd,Bf.init(e,t),e._zod.check=n=>{dp(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),pp=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Yd,Bf.init(e,t)});function mp(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:dp(n)}var hp=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Xd,Bf.init(e,t),e._zod.check=n=>{mp(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function gp(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var _p=/^[0-9a-zA-Z+/]*={0,2}$/,vp=q(`$ZodBase64`,(e,t)=>{t.pattern??=_p,Bf.init(e,t),e._zod.check=n=>{gp(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),yp=/^[A-Za-z0-9_-]*$/;function bp(e){if(!yp.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return gp(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var xp=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=yp,Bf.init(e,t),e._zod.check=n=>{bp(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Sp=q(`$ZodE164`,(e,t)=>{t.pattern??=ef,Bf.init(e,t)});function Cp(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var wp=q(`$ZodJWT`,(e,t)=>{Bf.init(e,t),e._zod.check=n=>{Cp(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Tp=q(`$ZodNumber`,(e,t)=>{Ff.init(e,t),e._zod.pattern=uf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ep=q(`$ZodNumberFormat`,(e,t)=>{xf.init(e,t),Tp.init(e,t)}),Dp=q(`$ZodBoolean`,(e,t)=>{Ff.init(e,t),e._zod.pattern=df,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Op=q(`$ZodNull`,(e,t)=>{Ff.init(e,t),e._zod.pattern=ff,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),kp=q(`$ZodUnknown`,(e,t)=>{Ff.init(e,t),e._zod.parse=e=>e}),Ap=q(`$ZodNever`,(e,t)=>{Ff.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function jp(e,t,n){e.issues.length&&t.issues.push(...Au(n,e.issues)),t.value[n]=e.value}var Mp=q(`$ZodArray`,(e,t)=>{Ff.init(e,t);let n=rd.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>jp(t,r,e)));else if(jp(c,r,e),s&&c.issues.length!==0&&Ou(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Np(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Au(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Pp=[];function Fp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Pp,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=gu(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ip(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Ou(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Np(e,n,i,t,d,f))):Np(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Lp=q(`$ZodObject`,(e,t)=>{Ff.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Gl(()=>Fp(t));K(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Zl(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=cu,o=t.catchall,s,c=rd.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Ou(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Np(n,t,e,r,a,o))):Np(s,t,e,r,a,o)}return o?Ip(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Rp=q(`$ZodObjectJIT`,(e,t)=>{Lp.init(e,t);let n=e._zod.parse,r=Gl(()=>Fp(t)),i=rd.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Nf([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
79
+ `)}\n};`)(...Object.values(this.closed))}},Lf={major:4,minor:6,patch:5},Rf=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lf;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ju(t),a;for(let o of n){if(o._zod.def.when){if(Mu(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new id;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Fu(t.issues,n,e),i||=ju(t,n))});else{if(t.issues.length===n)continue;Fu(t.issues,n,e),i||=ju(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ju(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new id;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new id;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Wu(this,`~standard`,Vf(this))},set"~standard"(e){Uu(this,`~standard`,e)}}),zf=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Iu(e,t,sd()))}:{value:e.value};async function Bf(e,t){let n={async:!0};return zf(await e._zod.run({value:t,issues:[]},n),n)}function Vf(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return zf(r,n)}catch{}return Bf(e,t)},vendor:`zod`,version:1}}var Hf=q(`$ZodString`,(e,t)=>{Rf.init(e,t),e._zod.pattern=t.pattern??df,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Uf=q(`$ZodStringFormat`,(e,t)=>{Of.init(e,t),Hf.init(e,t)}),Wf=q(`$ZodGUID`,(e,t)=>{t.pattern??=Gd,Uf.init(e,t)}),Gf=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Kd(e)}else t.pattern??=Kd();Uf.init(e,t)}),Kf=q(`$ZodEmail`,(e,t)=>{t.pattern??=qd,Uf.init(e,t)});function qf(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Jf(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?qf(e)||2:Yf(e,t)}function Yf(e,t){if(!t.normalize&&t.protocol?.source===nf.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Xf=/[\t\n\r]/g;function Zf(e){return e.replace(Xf,``)}function Qf(e,t){return t.lastIndex=0,t.test(e.hostname)}function $f(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ep=q(`$ZodURL`,(e,t)=>{Uf.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Jf(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Zf(r);return}t.hostname&&!Qf(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!$f(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Zf(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),tp=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Yd(),Uf.init(e,t)}),np=q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Hd:Ud(t.length),Uf.init(e,t)}),rp=q(`$ZodCUID`,(e,t)=>{t.pattern??=Ld,Uf.init(e,t)}),ip=q(`$ZodCUID2`,(e,t)=>{t.pattern??=Rd,Uf.init(e,t)}),ap=q(`$ZodULID`,(e,t)=>{t.pattern??=zd,Uf.init(e,t)}),op=q(`$ZodXID`,(e,t)=>{t.pattern??=Bd,Uf.init(e,t)}),sp=q(`$ZodKSUID`,(e,t)=>{t.pattern??=Vd,Uf.init(e,t)}),cp=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=uf(t),Uf.init(e,t)}),lp=q(`$ZodISODate`,(e,t)=>{t.pattern??=sf,Uf.init(e,t)}),up=q(`$ZodISOTime`,(e,t)=>{t.pattern??=lf(t),Uf.init(e,t)}),dp=q(`$ZodISODuration`,(e,t)=>{t.pattern??=Wd,Uf.init(e,t)}),fp=q(`$ZodIPv4`,(e,t)=>{t.pattern??=Xd,Uf.init(e,t)}),pp=/^[0-9a-fA-F:.]+$/;function mp(e){return pp.test(e)?qf(`http://[${e}]`):!1}var hp=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Zd,Uf.init(e,t),e._zod.check=n=>{mp(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),gp=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Qd,Uf.init(e,t)});function _p(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:mp(n)}var vp=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=$d,Uf.init(e,t),e._zod.check=n=>{_p(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function yp(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var bp=/^[0-9a-zA-Z+/]*={0,2}$/,xp=q(`$ZodBase64`,(e,t)=>{t.pattern??=bp,Uf.init(e,t),e._zod.check=n=>{yp(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Sp=/^[A-Za-z0-9_-]*$/;function Cp(e){if(!Sp.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return yp(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var wp=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=Sp,Uf.init(e,t),e._zod.check=n=>{Cp(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Tp=q(`$ZodE164`,(e,t)=>{t.pattern??=rf,Uf.init(e,t)});function Ep(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Dp=q(`$ZodJWT`,(e,t)=>{Uf.init(e,t),e._zod.check=n=>{Ep(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Op=q(`$ZodNumber`,(e,t)=>{Rf.init(e,t),e._zod.pattern=pf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),kp=q(`$ZodNumberFormat`,(e,t)=>{wf.init(e,t),Op.init(e,t)}),Ap=q(`$ZodBoolean`,(e,t)=>{Rf.init(e,t),e._zod.pattern=mf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),jp=q(`$ZodNull`,(e,t)=>{Rf.init(e,t),e._zod.pattern=hf,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Mp=q(`$ZodUnknown`,(e,t)=>{Rf.init(e,t),e._zod.parse=e=>e}),Np=q(`$ZodNever`,(e,t)=>{Rf.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Pp(e,t,n){e.issues.length&&t.issues.push(...Nu(n,e.issues)),t.value[n]=e.value}var Fp=q(`$ZodArray`,(e,t)=>{Rf.init(e,t);let n=od.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Pp(t,r,e)));else if(Pp(c,r,e),s&&c.issues.length!==0&&ju(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Ip(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Nu(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Lp=[];function Rp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Lp,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=yu(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function zp(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ju(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ip(e,n,i,t,d,f))):Ip(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Bp=q(`$ZodObject`,(e,t)=>{Rf.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Jl(()=>Rp(t));K(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||eu(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=du,o=t.catchall,s,c=od.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ju(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ip(n,t,e,r,a,o))):Ip(s,t,e,r,a,o)}return o?zp(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Vp=q(`$ZodObjectJIT`,(e,t)=>{Bp.init(e,t);let n=e._zod.parse,r=Jl(()=>Rp(t)),i=od.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new If([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
80
80
  let ${e}_ab = false;
81
81
  for (let i = 0; i < ${e}.issues.length; i++) {
82
82
  const iss = ${e}.issues[i];
@@ -87,7 +87,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
87
87
  if (${e}_ab && ctx && ctx.abortEarly) {
88
88
  payload.value = newResult;
89
89
  return payload;
90
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:au(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
90
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:cu(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
91
91
  const ${n}_present = ${i};
92
92
  if (!${n}.issues.length || ${n}_present) {
93
93
  if (${n}.issues.length) {${c(n,r)}
@@ -126,21 +126,21 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
126
126
  newResult[${r}] = ${n}.value;
127
127
  }
128
128
 
129
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=cu,c=!rd.jitless,l=c&&lu.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ip([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function zp(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=>!Ou(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=>Nu(e,r,id())))}),t)}var Bp=q(`$ZodUnion`,(e,t)=>{Ff.init(e,t),K(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),K(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),K(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),K(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>ql(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>zp(t,r,e,i)):zp(o,r,e,i)}});function Vp(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Hp=q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Bp.init(e,t);let n=e._zod.parse;K(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Zl(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Ql(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Gl(()=>Vp(t));e._zod.parse=(i,a)=>{let o=i.value;if(!cu(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Up=q(`$ZodIntersection`,(e,t)=>{Ff.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])=>Gp(e,t,n)):Gp(e,i,a)}});function Wp(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(uu(e)&&uu(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Wp(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=Wp(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 Gp(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Wp(t.value,n.value);if(!c.valid){if(Ou(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Kp=q(`$ZodRecord`,(e,t)=>{Ff.init(e,t);let n=rd.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!uu(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Nu(e,i,id())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Au(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Au(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&uf.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Nu(e,i,id())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Au(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Au(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),qp=q(`$ZodEnum`,(e,t)=>{Ff.init(e,t);let n=Vl(t.entries),r=new Set(n);e._zod.values=r,K(e,`pattern`,e=>{let t=Vl(e.def.entries).filter(e=>fu.has(typeof e));return RegExp(t.length?`^(${t.map(e=>pu(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Jp=q(`$ZodLiteral`,(e,t)=>{Ff.init(e,t);let n=new Set(t.values);e._zod.values=n,K(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?pu(e):e?pu(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Yp=q(`$ZodTransform`,(e,t)=>{Ff.init(e,t),e._zod.optin=`optional`,rd.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new nd(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 td;return n.value=i,n}});function Xp(e,t){return e.value=t.issues.length?void 0:t.value,e}var Zp=q(`$ZodOptional`,(e,t)=>{Ff.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ql(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Xp(e,t)):Xp(e,r)}return t.innerType._zod.run(e,n)}}),Qp=q(`$ZodExactOptional`,(e,t)=>{Zp.init(e,t),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$p=q(`$ZodNullable`,(e,t)=>{Ff.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ql(t.source)}|null)$`):void 0}),K(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),em=q(`$ZodDefault`,(e,t)=>{Ff.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.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=>tm(e,t)):tm(r,t)}});function tm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var nm=q(`$ZodPrefault`,(e,t)=>{Ff.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.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))}),rm=q(`$ZodNonOptional`,(e,t)=>{Ff.init(e,t),K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>im(t,e)):im(i,e)}});function im(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function am(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Nu(e,r,id()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var om=q(`$ZodCatch`,(e,t)=>{Ff.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>am(e,r,t,n)):am(e,r,t,n)}}),sm=q(`$ZodPipe`,(e,t)=>{Ff.init(e,t),K(e,`values`,e=>e.def.in._zod.values),K(e,`optin`,e=>e.def.in._zod.optin),K(e,`optout`,e=>e.def.out._zod.optout),K(e,`propValues`,e=>e.def.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=>cm(e,t.in,n)):cm(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>cm(e,t.out,n)):cm(r,t.out,n)}});function cm(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var lm=q(`$ZodReadonly`,(e,t)=>{Ff.init(e,t),K(e,`propValues`,e=>e.def.innerType._zod.propValues),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`optin`,e=>e.def.innerType?._zod?.optin),K(e,`optout`,e=>e.def.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(um):um(r)}});function um(e){return e.memo||(e.value=Object.freeze(e.value)),e}var dm=q(`$ZodLazy`,(e,t)=>{Ff.init(e,t),Xl(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),K(e,`pattern`,e=>e.innerType?._zod?.pattern),K(e,`propValues`,e=>e.innerType?._zod?.propValues),K(e,`optin`,e=>e.innerType?._zod?.optin??void 0),K(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),fm=q(`$ZodCustom`,(e,t)=>{hf.init(e,t),Ff.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=>pm(t,n,r,e));pm(i,n,r,e)}});function pm(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(Ru(e))}}var mm=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},hm=`~memo`,gm=[];function _m(e){return typeof e==`object`&&!!e}function vm(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ym=new WeakMap,bm=0,xm=1,Sm=2;function Cm(e,t,n){let r=ym.get(e);if(r!==void 0)return r?Sm:bm;if(t.has(e))return Sm;t.add(e);let i=bm,a=e=>{if(i!==Sm&&e?._zod){let r=Cm(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=bm;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?xm:o.value?._zod?Cm(o.value,t,n):bm;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Ql(c);s(e?o(e,!0):xm),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Cm(r,t,!1):xm);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),wm(e,i)}function wm(e,t){return t!==xm&&ym.set(e,t===Sm),t}function Tm(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Em,Dm=[],Om={alloc(e,t,n){let r=Em;if(!r)return n;Em=void 0;let i={value:n,issues:null};return r.set(t.value,i),Dm.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Am(n,e.value))throw new mm;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Cm(e,new Set,!1);if(i===bm)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Sm||r?n=!0:r=!0}let l=s.value;if(!_m(l))return t(s,c);let u=c[hm];u||(u={buckets:new WeakMap,backEdges:void 0},c[hm]=u);let d;i===c?d=a:(d=Tm(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...vm(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Em=d;let p=Dm.length,m=t(s,c);Em=void 0;let h=Dm.length>p?Dm.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?vm(e.issues):gm),e)):(h&&(h.issues=m.issues.length?vm(m.issues):gm),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function km(){return Om}function Am(e,t){let n=e[hm]?.backEdges;return n!==void 0&&_m(t)&&n.has(t)}var jm=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Lu(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${hu(e.values[0])}`:`Invalid option: expected one of ${Hl(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Hl(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Mm(){return{localeError:jm()}}var Nm,Pm=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),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 Fm(){return new Pm}(Nm=globalThis).__zod_globalRegistry??(Nm.__zod_globalRegistry=Fm());var Im=globalThis.__zod_globalRegistry;function Lm(e){return e.checks&&=[...e.checks],e}function Rm(e,t){return new e(Lm({type:`string`,...G(t)}))}function zm(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function Bm(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function Vm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function Hm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function Um(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function Wm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function Gm(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function Km(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function qm(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function Jm(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function Ym(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function Xm(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function Zm(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function Qm(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function $m(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function eh(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function th(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function nh(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function rh(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function ih(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function ah(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function oh(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function sh(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function ch(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function lh(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function uh(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function dh(e,t){return new e(Lm({type:`number`,checks:[],...G(t)}))}function fh(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...G(t)})}function ph(e,t){return new e({type:`boolean`,...G(t)})}function mh(e,t){return new e({type:`null`,...G(t)})}function hh(e){return new e({type:`unknown`})}function gh(e,t){return new e({type:`never`,...G(t)})}function _h(e,t){return new vf({check:`less_than`,...G(t),value:e,inclusive:!1})}function vh(e,t){return new vf({check:`less_than`,...G(t),value:e,inclusive:!0})}function yh(e,t){return new yf({check:`greater_than`,...G(t),value:e,inclusive:!1})}function bh(e,t){return new yf({check:`greater_than`,...G(t),value:e,inclusive:!0})}function xh(e,t){return new bf({check:`multiple_of`,...G(t),value:e})}function Sh(e,t){return new Sf({check:`max_length`,...G(t),maximum:e})}function Ch(e,t){return new Cf({check:`min_length`,...G(t),minimum:e})}function wh(e,t){return new wf({check:`length_equals`,...G(t),length:e})}function Th(e,t){return new Ef({check:`string_format`,format:`regex`,...G(t),pattern:e})}function Eh(e){return new Df({check:`string_format`,format:`lowercase`,...G(e)})}function Dh(e){return new Of({check:`string_format`,format:`uppercase`,...G(e)})}function Oh(e,t){return new kf({check:`string_format`,format:`includes`,...G(t),includes:e})}function kh(e,t){return new Af({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function Ah(e,t){return new jf({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function jh(e){return new Mf({check:`overwrite`,tx:e})}function Mh(e){return jh(t=>t.normalize(e))}function Nh(){return jh(e=>e.trim())}function Ph(){return jh(e=>e.toLowerCase())}function Fh(){return jh(e=>e.toUpperCase())}function Ih(){return jh(e=>ou(e))}function Lh(e,t,n){return new e({type:`array`,element:t,...G(n)})}function Rh(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function zh(e,t){let n=Bh(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ru(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ru(r))}},e(t.value,t)),t);return n}function Bh(e,t){let n=new hf({check:`custom`,...G(t)});return n._zod.check=e,n}function Vh(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Zl(e,t,n[t]);return e}function Hh(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Im,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Uh(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Wh(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Wh(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Vh(o.schema,c),t.io===`input`&&eg(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Gh(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Kh(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Gh(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Gh(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
129
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=du,c=!od.jitless,l=c&&fu.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?zp([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Hp(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=>!ju(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=>Iu(e,r,sd())))}),t)}var Up=q(`$ZodUnion`,(e,t)=>{Rf.init(e,t),K(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),K(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),K(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),K(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Xl(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Hp(t,r,e,i)):Hp(o,r,e,i)}});function Wp(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Gp=q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Up.init(e,t);let n=e._zod.parse;K(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||eu(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=tu(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Jl(()=>Wp(t));e._zod.parse=(i,a)=>{let o=i.value;if(!du(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Kp=q(`$ZodIntersection`,(e,t)=>{Rf.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])=>Jp(e,t,n)):Jp(e,i,a)}});function qp(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pu(e)&&pu(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=qp(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=qp(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 Jp(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=qp(t.value,n.value);if(!c.valid){if(ju(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yp=q(`$ZodRecord`,(e,t)=>{Rf.init(e,t);let n=od.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!pu(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Iu(e,i,sd())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Nu(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Nu(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&pf.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Iu(e,i,sd())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Nu(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Nu(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Xp=q(`$ZodEnum`,(e,t)=>{Rf.init(e,t);let n=Wl(t.entries),r=new Set(n);e._zod.values=r,K(e,`pattern`,e=>{let t=Wl(e.def.entries).filter(e=>hu.has(typeof e));return RegExp(t.length?`^(${t.map(e=>gu(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Zp=q(`$ZodLiteral`,(e,t)=>{Rf.init(e,t);let n=new Set(t.values);e._zod.values=n,K(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?gu(e):e?gu(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Qp=q(`$ZodTransform`,(e,t)=>{Rf.init(e,t),e._zod.optin=`optional`,od.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ad(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 id;return n.value=i,n}});function $p(e,t){return e.value=t.issues.length?void 0:t.value,e}var em=q(`$ZodOptional`,(e,t)=>{Rf.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Xl(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>$p(e,t)):$p(e,r)}return t.innerType._zod.run(e,n)}}),tm=q(`$ZodExactOptional`,(e,t)=>{em.init(e,t),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),nm=q(`$ZodNullable`,(e,t)=>{Rf.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Xl(t.source)}|null)$`):void 0}),K(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),rm=q(`$ZodDefault`,(e,t)=>{Rf.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.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=>im(e,t)):im(r,t)}});function im(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var am=q(`$ZodPrefault`,(e,t)=>{Rf.init(e,t),e._zod.optin=`defaulted`,K(e,`values`,e=>e.def.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))}),om=q(`$ZodNonOptional`,(e,t)=>{Rf.init(e,t),K(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>sm(t,e)):sm(i,e)}});function sm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function cm(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Iu(e,r,sd()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var lm=q(`$ZodCatch`,(e,t)=>{Rf.init(e,t),K(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),K(e,`optout`,e=>e.def.innerType._zod.optout),K(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>cm(e,r,t,n)):cm(e,r,t,n)}}),um=q(`$ZodPipe`,(e,t)=>{Rf.init(e,t),K(e,`values`,e=>e.def.in._zod.values),K(e,`optin`,e=>e.def.in._zod.optin),K(e,`optout`,e=>e.def.out._zod.optout),K(e,`propValues`,e=>e.def.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=>dm(e,t.in,n)):dm(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>dm(e,t.out,n)):dm(r,t.out,n)}});function dm(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var fm=q(`$ZodReadonly`,(e,t)=>{Rf.init(e,t),K(e,`propValues`,e=>e.def.innerType._zod.propValues),K(e,`values`,e=>e.def.innerType._zod.values),K(e,`optin`,e=>e.def.innerType?._zod?.optin),K(e,`optout`,e=>e.def.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(pm):pm(r)}});function pm(e){return e.memo||(e.value=Object.freeze(e.value)),e}var mm=q(`$ZodLazy`,(e,t)=>{Rf.init(e,t),$l(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),K(e,`pattern`,e=>e.innerType?._zod?.pattern),K(e,`propValues`,e=>e.innerType?._zod?.propValues),K(e,`optin`,e=>e.innerType?._zod?.optin??void 0),K(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),hm=q(`$ZodCustom`,(e,t)=>{vf.init(e,t),Rf.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=>gm(t,n,r,e));gm(i,n,r,e)}});function gm(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(Vu(e))}}var _m=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},vm=`~memo`,ym=[];function bm(e){return typeof e==`object`&&!!e}function xm(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Sm=new WeakMap,Cm=0,wm=1,Tm=2;function Em(e,t,n){let r=Sm.get(e);if(r!==void 0)return r?Tm:Cm;if(t.has(e))return Tm;t.add(e);let i=Cm,a=e=>{if(i!==Tm&&e?._zod){let r=Em(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Cm;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?wm:o.value?._zod?Em(o.value,t,n):Cm;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=tu(c);s(e?o(e,!0):wm),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Em(r,t,!1):wm);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Dm(e,i)}function Dm(e,t){return t!==wm&&Sm.set(e,t===Tm),t}function Om(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var km,Am=[],jm={alloc(e,t,n){let r=km;if(!r)return n;km=void 0;let i={value:n,issues:null};return r.set(t.value,i),Am.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Nm(n,e.value))throw new _m;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Em(e,new Set,!1);if(i===Cm)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Tm||r?n=!0:r=!0}let l=s.value;if(!bm(l))return t(s,c);let u=c[vm];u||(u={buckets:new WeakMap,backEdges:void 0},c[vm]=u);let d;i===c?d=a:(d=Om(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...xm(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;km=d;let p=Am.length,m=t(s,c);km=void 0;let h=Am.length>p?Am.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?xm(e.issues):ym),e)):(h&&(h.issues=m.issues.length?xm(m.issues):ym),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Mm(){return jm}function Nm(e,t){let n=e[vm]?.backEdges;return n!==void 0&&bm(t)&&n.has(t)}var Pm=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Bu(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${vu(e.values[0])}`:`Invalid option: expected one of ${Gl(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Gl(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Fm(){return{localeError:Pm()}}var Im,Lm=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),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 Rm(){return new Lm}(Im=globalThis).__zod_globalRegistry??(Im.__zod_globalRegistry=Rm());var zm=globalThis.__zod_globalRegistry;function Bm(e){return e.checks&&=[...e.checks],e}function Vm(e,t){return new e(Bm({type:`string`,...G(t)}))}function Hm(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...G(t)})}function Um(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...G(t)})}function Wm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...G(t)})}function Gm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...G(t)})}function Km(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...G(t)})}function qm(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...G(t)})}function Jm(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...G(t)})}function Ym(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...G(t)})}function Xm(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...G(t)})}function Zm(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...G(t)})}function Qm(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...G(t)})}function $m(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...G(t)})}function eh(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...G(t)})}function th(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...G(t)})}function nh(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...G(t)})}function rh(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...G(t)})}function ih(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...G(t)})}function ah(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...G(t)})}function oh(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...G(t)})}function sh(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...G(t)})}function ch(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...G(t)})}function lh(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...G(t)})}function uh(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...G(t)})}function dh(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...G(t)})}function fh(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...G(t)})}function ph(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...G(t)})}function mh(e,t){return new e(Bm({type:`number`,checks:[],...G(t)}))}function hh(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...G(t)})}function gh(e,t){return new e({type:`boolean`,...G(t)})}function _h(e,t){return new e({type:`null`,...G(t)})}function vh(e){return new e({type:`unknown`})}function yh(e,t){return new e({type:`never`,...G(t)})}function bh(e,t){return new xf({check:`less_than`,...G(t),value:e,inclusive:!1})}function xh(e,t){return new xf({check:`less_than`,...G(t),value:e,inclusive:!0})}function Sh(e,t){return new Sf({check:`greater_than`,...G(t),value:e,inclusive:!1})}function Ch(e,t){return new Sf({check:`greater_than`,...G(t),value:e,inclusive:!0})}function wh(e,t){return new Cf({check:`multiple_of`,...G(t),value:e})}function Th(e,t){return new Tf({check:`max_length`,...G(t),maximum:e})}function Eh(e,t){return new Ef({check:`min_length`,...G(t),minimum:e})}function Dh(e,t){return new Df({check:`length_equals`,...G(t),length:e})}function Oh(e,t){return new kf({check:`string_format`,format:`regex`,...G(t),pattern:e})}function kh(e){return new Af({check:`string_format`,format:`lowercase`,...G(e)})}function Ah(e){return new jf({check:`string_format`,format:`uppercase`,...G(e)})}function jh(e,t){return new Mf({check:`string_format`,format:`includes`,...G(t),includes:e})}function Mh(e,t){return new Nf({check:`string_format`,format:`starts_with`,...G(t),prefix:e})}function Nh(e,t){return new Pf({check:`string_format`,format:`ends_with`,...G(t),suffix:e})}function Ph(e){return new Ff({check:`overwrite`,tx:e})}function Fh(e){return Ph(t=>t.normalize(e))}function Ih(){return Ph(e=>e.trim())}function Lh(){return Ph(e=>e.toLowerCase())}function Rh(){return Ph(e=>e.toUpperCase())}function zh(){return Ph(e=>lu(e))}function Bh(e,t,n){return new e({type:`array`,element:t,...G(n)})}function Vh(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...G(n)})}function Hh(e,t){let n=Uh(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Vu(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Vu(r))}},e(t.value,t)),t);return n}function Uh(e,t){let n=new vf({check:`custom`,...G(t)});return n._zod.check=e,n}function Wh(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&eu(e,t,n[t]);return e}function Gh(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??zm,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Kh(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function qh(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,qh(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Wh(o.schema,c),t.io===`input`&&rg(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Jh(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Yh(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Jh(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Jh(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
130
130
 
131
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function qh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;qh(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Jh=new Set([`type`,`properties`,`required`,`additionalProperties`]),Yh=[`oneOf`,`anyOf`];function Xh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Zh(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Jh.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Xh(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Zl(n,r,e.length===1?e[0]:Zh(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Xh(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Qh(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Jh)if(t in e)return;let n=t.filter(e=>Yh.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Zh(t);else{let e=n[0],i=Yh.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Zh([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Vh(e,r))}function $h(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Vh(i,s),Vh(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())qh(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Qh(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Vh(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Zl(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ng(t,`input`,e.processors),output:ng(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function eg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return eg(r.element,n);if(r.type===`set`)return eg(r.valueType,n);if(r.type===`lazy`)return eg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return eg(r.innerType,n);if(r.type===`intersection`)return eg(r.left,n)||eg(r.right,n);if(r.type===`record`||r.type===`map`)return eg(r.keyType,n)||eg(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:eg(r.in,n)||eg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(eg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(eg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(eg(e,n))return!0;return!!(r.rest&&eg(r.rest,n))}return!1}var tg=(e,t={})=>n=>{let r=Hh({...n,processors:t});return Wh(e,r),Kh(r,e),$h(r,e)},ng=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Hh({...i??{},target:a,io:t,processors:n});return Wh(e,o),Kh(o,e),$h(o,e)},rg=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ig=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ag=(e,t)=>{rg(e,`minimum`,t),ig(e,`maximum`,t)},og=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},sg=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},cg=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},lg=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ug=(e,t)=>rg(e,`minimum`,t.minimum),dg=(e,t)=>ig(e,`maximum`,t.maximum),fg=e=>(t,n)=>{lg(t,n.format);let[r,i]=e[n.format];rg(t,`minimum`,r),ig(t,`maximum`,i)},pg={greater_than:(e,t)=>rg(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>ig(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>og(e,t.value),number_format:fg(_u),bigint_format:fg(vu),min_length:ug,max_length:dg,length_equals:(e,t)=>ag(e,t.length),min_size:ug,max_size:dg,size_equals:(e,t)=>ag(e,t.size),string_format:(e,t)=>{lg(e,t.format),t.pattern&&sg(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>cg(e,t.mime)};function mg(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)pg[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&rg(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&rg(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&ig(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&ig(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&og(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&cg(t,i.mime);for(let e of i.patterns??[])sg(t,e);return t}var hg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},gg=new Map([[_p,Zd],[yp,Qd]]),_g=e=>gg.get(e)??e,vg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=mg(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=hg[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(_g);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},yg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=mg(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Uh(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},bg=(e,t,n,r)=>{n.type=`boolean`},xg=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Sg=(e,t,n,r)=>{n.not={}},Cg=(e,t,n,r)=>{let i=e._zod.def,a=Vl(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},wg=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Uh(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Uh(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Tg=(e,t,n,r)=>{Uh(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Eg=(e,t,n,r)=>{Uh(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Dg=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=mg(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Wh(a.element,t,{...r,path:[...r.path,`items`]})};function Og(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Og(t.out):t.type===`catch`?Og(t.innerType):e._zod.optin}var kg=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Uh(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Zl(i.properties,e,Wh(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Og(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Wh(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ag=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Wh(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},jg=(e,t,n,r)=>{let i=e._zod.def,a=Wh(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Wh(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Mg(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Mg(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Mg(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?uf:lf).source),p):p}var Ng=new WeakMap;function Pg(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ng.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Mg(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Fg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=mg(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Wh(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Zl(i.patternProperties,_g(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Wh(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ng.get(t);n||(n=[],Ng.set(t,n),t.deferred.push(()=>Pg(t))),n.push(e)}i.additionalProperties=Wh(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Og(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ig=(e,t,n,r)=>{let i=e._zod.def,a=Wh(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Lg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rg=Symbol();function zg(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Uh(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Rg):JSON.parse(o)}var Bg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=zg(i.defaultValue,e,t,n,r);o!==Rg&&(n.default=o)},Vg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=zg(i.defaultValue,e,t,n,r);o!==Rg&&(n._prefault=o)},Hg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Uh(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ug=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Wh(o,t,r);let s=t.seen.get(e);s.ref=o},Wg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Gg=(e,t,n,r)=>{let i=e._zod.def;Wh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Kg=(e,t,n,r)=>{let i=e._zod.innerType;Wh(i,t,r);let a=t.seen.get(e);a.ref=i},qg=new WeakSet([Object.prototype,Error.prototype]);function Jg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Yg=q(`ZodError`,(e,t)=>{dd.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);qg.has(n)||(qg.add(n),Jg(n,`format`,e=>t=>md(e,t)),Jg(n,`flatten`,e=>t=>pd(e,t)),Jg(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ul,2)}),Jg(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ul,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Xg=gd(Yg),Zg=_d(Yg),Qg=vd(Yg),$g=bd(Yg),e_=Ed(Yg),t_=Dd(Yg),n_=Od(Yg),r_=kd(Yg),i_=Ad(Yg),a_=jd(Yg),o_=Md(Yg),s_=Nd(Yg);function c_(){rd.localeError||id(Mm())}function l_(){rd.memoizer||id({memoizer:km()})}var u_=q(`ZodType`,(e,t)=>(c_(),Ff.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(iu(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return mu(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Nv(e,t))},superRefine(e,t){return this.check(Pv(e,t))},overwrite(e){return this.check(jh(e))},optional(){return pv(this)},exactOptional(){return hv(this)},nullable(){return _v(this)},nullish(){return pv(_v(this))},nonoptional(e){return Cv(this,e)},array(){return X_(this)},or(e){return $_([this,e])},and(e){return rv(this,e)},transform(e){return Dv(this,dv(e))},default(e){return yv(this,e)},prefault(e){return xv(this,e)},catch(e){return Tv(this,e)},pipe(e){return Dv(this,e)},readonly(){return kv(this)},describe(e){let t=this.clone();return Im.add(t,{description:e}),t},meta(...e){if(e.length===0)return Im.get(this);let t=this.clone();return Im.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Vu(this,`~standard`,{...Rf(this),jsonSchema:{input:ng(this,`input`),output:ng(this,`output`)}})},set"~standard"(e){Bu(this,`~standard`,e)},parse:function e(t,n){return Xg(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zg(this,t,n,{callee:e})},safeParse(e,t){return Qg(this,e,t)},async safeParseAsync(e,t){return $g(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Bu(this,`spa`,e)},validate(e,t){return Cd(this,e,t)},validateAsync(e,t){return Td(this,e,t)},encode:function e(t,n){return e_(this,t,n,{callee:e})},decode:function e(t,n){return t_(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await n_(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await r_(this,t,n,{callee:e})},safeEncode(e,t){return i_(this,e,t)},safeDecode(e,t){return a_(this,e,t)},async safeEncodeAsync(e,t){return o_(this,e,t)},async safeDecodeAsync(e,t){return s_(this,e,t)},toJSONSchema(e){return tg(this,{})(e)},get description(){return Im.get(this)?.description},get _def(){return this._zod.def}}),d_=q(`_ZodString`,(e,t)=>{zf.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vg(e,t,n,r)},Hu({format:e=>mg(e).format??null,minLength:e=>mg(e).minimum??null,maxLength:e=>mg(e).maximum??null},{regex(...e){return this.check(Th(...e))},includes(...e){return this.check(Oh(...e))},startsWith(...e){return this.check(kh(...e))},endsWith(...e){return this.check(Ah(...e))},min(...e){return this.check(Ch(...e))},max(...e){return this.check(Sh(...e))},length(...e){return this.check(wh(...e))},nonempty(...e){return this.check(Ch(1,...e))},lowercase(e){return this.check(Eh(e))},uppercase(e){return this.check(Dh(e))},trim(){return this.check(Nh())},normalize(...e){return this.check(Mh(...e))},toLowerCase(){return this.check(Ph())},toUpperCase(){return this.check(Fh())},slugify(){return this.check(Ih())}})),f_=q(`ZodString`,(e,t)=>{zf.init(e,t),d_.init(e,t)},{email(e){return this.check(zm(v_,e))},url(e){return this.check(Gm(x_,e))},jwt(e){return this.check(oh(I_,e))},emoji(e){return this.check(Km(S_,e))},guid(e){return this.check(Bm(y_,e))},uuid(e){return this.check(Vm(b_,e))},uuidv4(e){return this.check(Hm(b_,e))},uuidv6(e){return this.check(Um(b_,e))},uuidv7(e){return this.check(Wm(b_,e))},nanoid(e){return this.check(qm(C_,e))},cuid(e){return this.check(Jm(w_,e))},cuid2(e){return this.check(Ym(T_,e))},ulid(e){return this.check(Xm(E_,e))},base64(e){return this.check(rh(N_,e))},base64url(e){return this.check(ih(P_,e))},xid(e){return this.check(Zm(D_,e))},ksuid(e){return this.check(Qm(O_,e))},ipv4(e){return this.check($m(k_,e))},ipv6(e){return this.check(eh(A_,e))},cidrv4(e){return this.check(th(j_,e))},cidrv6(e){return this.check(nh(M_,e))},e164(e){return this.check(ah(F_,e))},datetime(e){return this.check(sh(m_,e))},date(e){return this.check(ch(h_,e))},time(e){return this.check(lh(g_,e))},duration(e){return this.check(uh(__,e))}});function J(e){return Rm(f_,e)}var p_=q(`ZodStringFormat`,(e,t)=>{Bf.init(e,t),d_.init(e,t)}),m_=q(`ZodISODateTime`,(e,t)=>{ap.init(e,t),p_.init(e,t)}),h_=q(`ZodISODate`,(e,t)=>{op.init(e,t),p_.init(e,t)}),g_=q(`ZodISOTime`,(e,t)=>{sp.init(e,t),p_.init(e,t)}),__=q(`ZodISODuration`,(e,t)=>{cp.init(e,t),p_.init(e,t)}),v_=q(`ZodEmail`,(e,t)=>{Uf.init(e,t),p_.init(e,t)}),y_=q(`ZodGUID`,(e,t)=>{Vf.init(e,t),p_.init(e,t)}),b_=q(`ZodUUID`,(e,t)=>{Hf.init(e,t),p_.init(e,t)}),x_=q(`ZodURL`,(e,t)=>{Zf.init(e,t),p_.init(e,t)}),S_=q(`ZodEmoji`,(e,t)=>{Qf.init(e,t),p_.init(e,t)}),C_=q(`ZodNanoID`,(e,t)=>{$f.init(e,t),p_.init(e,t)}),w_=q(`ZodCUID`,(e,t)=>{ep.init(e,t),p_.init(e,t)}),T_=q(`ZodCUID2`,(e,t)=>{tp.init(e,t),p_.init(e,t)}),E_=q(`ZodULID`,(e,t)=>{np.init(e,t),p_.init(e,t)}),D_=q(`ZodXID`,(e,t)=>{rp.init(e,t),p_.init(e,t)}),O_=q(`ZodKSUID`,(e,t)=>{ip.init(e,t),p_.init(e,t)}),k_=q(`ZodIPv4`,(e,t)=>{lp.init(e,t),p_.init(e,t)}),A_=q(`ZodIPv6`,(e,t)=>{fp.init(e,t),p_.init(e,t)}),j_=q(`ZodCIDRv4`,(e,t)=>{pp.init(e,t),p_.init(e,t)}),M_=q(`ZodCIDRv6`,(e,t)=>{hp.init(e,t),p_.init(e,t)}),N_=q(`ZodBase64`,(e,t)=>{vp.init(e,t),p_.init(e,t)}),P_=q(`ZodBase64URL`,(e,t)=>{xp.init(e,t),p_.init(e,t)}),F_=q(`ZodE164`,(e,t)=>{Sp.init(e,t),p_.init(e,t)}),I_=q(`ZodJWT`,(e,t)=>{wp.init(e,t),p_.init(e,t)}),L_=q(`ZodNumber`,(e,t)=>{Tp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yg(e,t,n,r),e.isFinite=!0},Hu({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=mg(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=mg(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=mg(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>mg(e).format??null},{gt(e,t){return this.check(yh(e,t))},gte(e,t){return this.check(bh(e,t))},min(e,t){return this.check(bh(e,t))},lt(e,t){return this.check(_h(e,t))},lte(e,t){return this.check(vh(e,t))},max(e,t){return this.check(vh(e,t))},int(e){return this.check(B_(e))},safe(e){return this.check(B_(e))},positive(e){return this.check(yh(0,e))},nonnegative(e){return this.check(bh(0,e))},negative(e){return this.check(_h(0,e))},nonpositive(e){return this.check(vh(0,e))},multipleOf(e,t){return this.check(xh(e,t))},step(e,t){return this.check(xh(e,t))},finite(){return this}}));function R_(e){return dh(L_,e)}var z_=q(`ZodNumberFormat`,(e,t)=>{Ep.init(e,t),L_.init(e,t)});function B_(e){return fh(z_,e)}var V_=q(`ZodBoolean`,(e,t)=>{Dp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bg(e,t,n,r)});function H_(e){return ph(V_,e)}var U_=q(`ZodNull`,(e,t)=>{Op.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xg(e,t,n,r)});function W_(e){return mh(U_,e)}var G_=q(`ZodUnknown`,(e,t)=>{kp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function K_(){return hh(G_)}var q_=q(`ZodNever`,(e,t)=>{Ap.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sg(e,t,n,r)});function J_(e){return gh(q_,e)}var Y_=q(`ZodArray`,(e,t)=>{l_(),Mp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dg(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ch(e,t))},nonempty(e){return this.check(Ch(1,e))},max(e,t){return this.check(Sh(e,t))},length(e,t){return this.check(wh(e,t))},unwrap(){return this.element}});function X_(e,t){return Lh(Y_,e,t)}var Z_=q(`ZodObject`,(e,t)=>{l_(),Rp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kg(e,t,n,r),Ju(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return sv(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(iu(this._zod.def,{catchall:e}))},passthrough(){return this.clone(iu(this._zod.def,{catchall:K_()}))},loose(){return this.clone(iu(this._zod.def,{catchall:K_()}))},strict(){return this.clone(iu(this._zod.def,{catchall:J_()}))},strip(){return this.clone(iu(this._zod.def,{catchall:void 0}))},extend(e){return Su(this,e)},safeExtend(e){return wu(this,e)},merge(e){return Tu(this,e)},pick(e){return yu(this,e)},omit(e){return xu(this,e)},partial(...e){return Eu(fv,this,e[0])},exactPartial(...e){return Eu(mv,this,e[0],`exactPartial`)},required(...e){return Du(Sv,this,e[0])}});function Y(e,t){return new Z_({type:`object`,shape:e??{},...G(t)})}var Q_=q(`ZodUnion`,(e,t)=>{Bp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ag(e,t,n,r),e.options=t.options});function $_(e,t){return new Q_({type:`union`,options:e,...G(t)})}var ev=q(`ZodDiscriminatedUnion`,(e,t)=>{Q_.init(e,t),Hp.init(e,t)});function tv(e,t,n){return new ev({type:`union`,options:t,discriminator:e,...G(n)})}var nv=q(`ZodIntersection`,(e,t)=>{Up.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jg(e,t,n,r)});function rv(e,t){return new nv({type:`intersection`,left:e,right:t})}var iv=q(`ZodRecord`,(e,t)=>{l_(),Kp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fg(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function av(e,t,n){return!t||!t._zod?new iv({type:`record`,keyType:J(),valueType:e,...G(t)}):new iv({type:`record`,keyType:e,valueType:t,...G(n)})}var ov=q(`ZodEnum`,(e,t)=>{qp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cg(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 ov({...t,checks:[],...G(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 ov({...t,checks:[],...G(r),entries:i})}});function sv(e,t){return new ov({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var cv=q(`ZodLiteral`,(e,t)=>{Jp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wg(e,t,n,r),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 lv(e,t){return new cv({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var uv=q(`ZodTransform`,(e,t)=>{l_(),Yp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new nd(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ru(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ru(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function dv(e){return new uv({type:`transform`,transform:e})}var fv=q(`ZodOptional`,(e,t)=>{Zp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pv(e){return new fv({type:`optional`,innerType:e})}var mv=q(`ZodExactOptional`,(e,t)=>{Qp.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hv(e){return new mv({type:`optional`,innerType:e})}var gv=q(`ZodNullable`,(e,t)=>{$p.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ig(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _v(e){return new gv({type:`nullable`,innerType:e})}var vv=q(`ZodDefault`,(e,t)=>{em.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yv(e,t){return new vv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():du(t)}})}var bv=q(`ZodPrefault`,(e,t)=>{nm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xv(e,t){return new bv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():du(t)}})}var Sv=q(`ZodNonOptional`,(e,t)=>{rm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cv(e,t){return new Sv({type:`nonoptional`,innerType:e,...G(t)})}var wv=q(`ZodCatch`,(e,t)=>{om.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tv(e,t){return new wv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Xu(t)})}var Ev=q(`ZodPipe`,(e,t)=>{sm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r),e.in=t.in,e.out=t.out});function Dv(e,t){return new Ev({type:`pipe`,in:e,out:t})}var Ov=q(`ZodReadonly`,(e,t)=>{lm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e){return new Ov({type:`readonly`,innerType:e})}var Av=q(`ZodLazy`,(e,t)=>{dm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function jv(e){return new Av({type:`lazy`,getter:e})}var Mv=q(`ZodCustom`,(e,t)=>{fm.init(e,t),u_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tg(e,t,n,r)});function Nv(e,t={}){return Rh(Mv,e,t)}function Pv(e,t){return zh(e,t)}function Fv(e){let t=jv(()=>$_([J(e),R_(),H_(),W_(),X_(t),av(J(),t)]));return t}var Iv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),Lv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=Iv(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),X=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=Iv(),n=Lv(),r=Iv();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=Lv();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
132
- `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-->0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),Z=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=X(),n=Iv();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),Rv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),zv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=X(),n=Z(),r=Rv();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),Bv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=zv(),n=X(),r=Rv(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Vv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),Hv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Uv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=Vv(),n=Hv(),r=zv(),i=X(),a=Z(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
131
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xh(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Zh=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qh=[`oneOf`,`anyOf`];function $h(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eg(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Zh.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$h(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}eu(n,r,e.length===1?e[0]:eg(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$h(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function tg(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Zh)if(t in e)return;let n=t.filter(e=>Qh.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eg(t);else{let e=n[0],i=Qh.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eg([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Wh(e,r))}function ng(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Wh(i,s),Wh(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xh(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])tg(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Wh(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,eu(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ag(t,`input`,e.processors),output:ag(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function rg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return rg(r.element,n);if(r.type===`set`)return rg(r.valueType,n);if(r.type===`lazy`)return rg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return rg(r.innerType,n);if(r.type===`intersection`)return rg(r.left,n)||rg(r.right,n);if(r.type===`record`||r.type===`map`)return rg(r.keyType,n)||rg(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:rg(r.in,n)||rg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(rg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(rg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(rg(e,n))return!0;return!!(r.rest&&rg(r.rest,n))}return!1}var ig=(e,t={})=>n=>{let r=Gh({...n,processors:t});return qh(e,r),Yh(r,e),ng(r,e)},ag=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Gh({...i??{},target:a,io:t,processors:n});return qh(e,o),Yh(o,e),ng(o,e)},og=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},sg=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},cg=(e,t)=>{og(e,`minimum`,t),sg(e,`maximum`,t)},lg=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ug=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},dg=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},fg=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},pg=(e,t)=>og(e,`minimum`,t.minimum),mg=(e,t)=>sg(e,`maximum`,t.maximum),hg=e=>(t,n)=>{fg(t,n.format);let[r,i]=e[n.format];og(t,`minimum`,r),sg(t,`maximum`,i)},gg={greater_than:(e,t)=>og(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>sg(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>lg(e,t.value),number_format:hg(bu),bigint_format:hg(xu),min_length:pg,max_length:mg,length_equals:(e,t)=>cg(e,t.length),min_size:pg,max_size:mg,size_equals:(e,t)=>cg(e,t.size),string_format:(e,t)=>{fg(e,t.format),t.pattern&&ug(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>dg(e,t.mime)};function _g(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)gg[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&og(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&og(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&sg(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&sg(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&lg(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&dg(t,i.mime);for(let e of i.patterns??[])ug(t,e);return t}var vg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yg=new Map([[bp,ef],[Sp,tf]]),bg=e=>yg.get(e)??e,xg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=_g(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vg[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(bg);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Sg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=_g(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Kh(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Cg=(e,t,n,r)=>{n.type=`boolean`},wg=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Tg=(e,t,n,r)=>{n.not={}},Eg=(e,t,n,r)=>{let i=e._zod.def,a=Wl(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Dg=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Kh(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Kh(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Og=(e,t,n,r)=>{Kh(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},kg=(e,t,n,r)=>{Kh(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ag=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=_g(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=qh(a.element,t,{...r,path:[...r.path,`items`]})};function jg(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?jg(t.out):t.type===`catch`?jg(t.innerType):e._zod.optin}var Mg=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Kh(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)eu(i.properties,e,qh(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?jg(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=qh(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ng=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>qh(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Pg=(e,t,n,r)=>{let i=e._zod.def,a=qh(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=qh(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Fg(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Fg(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Fg(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?pf:ff).source),p):p}var Ig=new WeakMap;function Lg(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ig.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Fg(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Rg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=_g(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=qh(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)eu(i.patternProperties,bg(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=qh(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ig.get(t);n||(n=[],Ig.set(t,n),t.deferred.push(()=>Lg(t))),n.push(e)}i.additionalProperties=qh(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&jg(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},zg=(e,t,n,r)=>{let i=e._zod.def,a=qh(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Bg=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vg=Symbol();function Hg(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Kh(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Vg):JSON.parse(o)}var Ug=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Hg(i.defaultValue,e,t,n,r);o!==Vg&&(n.default=o)},Wg=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Hg(i.defaultValue,e,t,n,r);o!==Vg&&(n._prefault=o)},Gg=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Kh(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Kg=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;qh(o,t,r);let s=t.seen.get(e);s.ref=o},qg=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Jg=(e,t,n,r)=>{let i=e._zod.def;qh(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yg=(e,t,n,r)=>{let i=e._zod.innerType;qh(i,t,r);let a=t.seen.get(e);a.ref=i},Xg=new WeakSet([Object.prototype,Error.prototype]);function Zg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Qg=q(`ZodError`,(e,t)=>{md.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Xg.has(n)||(Xg.add(n),Zg(n,`format`,e=>t=>_d(e,t)),Zg(n,`flatten`,e=>t=>gd(e,t)),Zg(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Kl,2)}),Zg(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Kl,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),$g=yd(Qg),e_=bd(Qg),t_=xd(Qg),n_=Cd(Qg),r_=kd(Qg),i_=Ad(Qg),a_=jd(Qg),o_=Md(Qg),s_=Nd(Qg),c_=Pd(Qg),l_=Fd(Qg),u_=Id(Qg);function d_(){od.localeError||sd(Fm())}function f_(){od.memoizer||sd({memoizer:Mm()})}var p_=q(`ZodType`,(e,t)=>(d_(),Rf.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(su(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return _u(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Iv(e,t))},superRefine(e,t){return this.check(Lv(e,t))},overwrite(e){return this.check(Ph(e))},optional(){return gv(this)},exactOptional(){return vv(this)},nullable(){return bv(this)},nullish(){return gv(bv(this))},nonoptional(e){return Ev(this,e)},array(){return $_(this)},or(e){return nv([this,e])},and(e){return ov(this,e)},transform(e){return Av(this,mv(e))},default(e){return Sv(this,e)},prefault(e){return wv(this,e)},catch(e){return Ov(this,e)},pipe(e){return Av(this,e)},readonly(){return Mv(this)},describe(e){let t=this.clone();return zm.add(t,{description:e}),t},meta(...e){if(e.length===0)return zm.get(this);let t=this.clone();return zm.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Wu(this,`~standard`,{...Vf(this),jsonSchema:{input:ag(this,`input`),output:ag(this,`output`)}})},set"~standard"(e){Uu(this,`~standard`,e)},parse:function e(t,n){return $g(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await e_(this,t,n,{callee:e})},safeParse(e,t){return t_(this,e,t)},async safeParseAsync(e,t){return n_(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Uu(this,`spa`,e)},validate(e,t){return Ed(this,e,t)},validateAsync(e,t){return Od(this,e,t)},encode:function e(t,n){return r_(this,t,n,{callee:e})},decode:function e(t,n){return i_(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await a_(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await o_(this,t,n,{callee:e})},safeEncode(e,t){return s_(this,e,t)},safeDecode(e,t){return c_(this,e,t)},async safeEncodeAsync(e,t){return l_(this,e,t)},async safeDecodeAsync(e,t){return u_(this,e,t)},toJSONSchema(e){return ig(this,{})(e)},get description(){return zm.get(this)?.description},get _def(){return this._zod.def}}),m_=q(`_ZodString`,(e,t)=>{Hf.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xg(e,t,n,r)},Gu({format:e=>_g(e).format??null,minLength:e=>_g(e).minimum??null,maxLength:e=>_g(e).maximum??null},{regex(...e){return this.check(Oh(...e))},includes(...e){return this.check(jh(...e))},startsWith(...e){return this.check(Mh(...e))},endsWith(...e){return this.check(Nh(...e))},min(...e){return this.check(Eh(...e))},max(...e){return this.check(Th(...e))},length(...e){return this.check(Dh(...e))},nonempty(...e){return this.check(Eh(1,...e))},lowercase(e){return this.check(kh(e))},uppercase(e){return this.check(Ah(e))},trim(){return this.check(Ih())},normalize(...e){return this.check(Fh(...e))},toLowerCase(){return this.check(Lh())},toUpperCase(){return this.check(Rh())},slugify(){return this.check(zh())}})),h_=q(`ZodString`,(e,t)=>{Hf.init(e,t),m_.init(e,t)},{email(e){return this.check(Hm(x_,e))},url(e){return this.check(Jm(w_,e))},jwt(e){return this.check(lh(z_,e))},emoji(e){return this.check(Ym(T_,e))},guid(e){return this.check(Um(S_,e))},uuid(e){return this.check(Wm(C_,e))},uuidv4(e){return this.check(Gm(C_,e))},uuidv6(e){return this.check(Km(C_,e))},uuidv7(e){return this.check(qm(C_,e))},nanoid(e){return this.check(Xm(E_,e))},cuid(e){return this.check(Zm(D_,e))},cuid2(e){return this.check(Qm(O_,e))},ulid(e){return this.check($m(k_,e))},base64(e){return this.check(oh(I_,e))},base64url(e){return this.check(sh(L_,e))},xid(e){return this.check(eh(A_,e))},ksuid(e){return this.check(th(j_,e))},ipv4(e){return this.check(nh(M_,e))},ipv6(e){return this.check(rh(N_,e))},cidrv4(e){return this.check(ih(P_,e))},cidrv6(e){return this.check(ah(F_,e))},e164(e){return this.check(ch(R_,e))},datetime(e){return this.check(uh(__,e))},date(e){return this.check(dh(v_,e))},time(e){return this.check(fh(y_,e))},duration(e){return this.check(ph(b_,e))}});function J(e){return Vm(h_,e)}var g_=q(`ZodStringFormat`,(e,t)=>{Uf.init(e,t),m_.init(e,t)}),__=q(`ZodISODateTime`,(e,t)=>{cp.init(e,t),g_.init(e,t)}),v_=q(`ZodISODate`,(e,t)=>{lp.init(e,t),g_.init(e,t)}),y_=q(`ZodISOTime`,(e,t)=>{up.init(e,t),g_.init(e,t)}),b_=q(`ZodISODuration`,(e,t)=>{dp.init(e,t),g_.init(e,t)}),x_=q(`ZodEmail`,(e,t)=>{Kf.init(e,t),g_.init(e,t)}),S_=q(`ZodGUID`,(e,t)=>{Wf.init(e,t),g_.init(e,t)}),C_=q(`ZodUUID`,(e,t)=>{Gf.init(e,t),g_.init(e,t)}),w_=q(`ZodURL`,(e,t)=>{ep.init(e,t),g_.init(e,t)}),T_=q(`ZodEmoji`,(e,t)=>{tp.init(e,t),g_.init(e,t)}),E_=q(`ZodNanoID`,(e,t)=>{np.init(e,t),g_.init(e,t)}),D_=q(`ZodCUID`,(e,t)=>{rp.init(e,t),g_.init(e,t)}),O_=q(`ZodCUID2`,(e,t)=>{ip.init(e,t),g_.init(e,t)}),k_=q(`ZodULID`,(e,t)=>{ap.init(e,t),g_.init(e,t)}),A_=q(`ZodXID`,(e,t)=>{op.init(e,t),g_.init(e,t)}),j_=q(`ZodKSUID`,(e,t)=>{sp.init(e,t),g_.init(e,t)}),M_=q(`ZodIPv4`,(e,t)=>{fp.init(e,t),g_.init(e,t)}),N_=q(`ZodIPv6`,(e,t)=>{hp.init(e,t),g_.init(e,t)}),P_=q(`ZodCIDRv4`,(e,t)=>{gp.init(e,t),g_.init(e,t)}),F_=q(`ZodCIDRv6`,(e,t)=>{vp.init(e,t),g_.init(e,t)}),I_=q(`ZodBase64`,(e,t)=>{xp.init(e,t),g_.init(e,t)}),L_=q(`ZodBase64URL`,(e,t)=>{wp.init(e,t),g_.init(e,t)}),R_=q(`ZodE164`,(e,t)=>{Tp.init(e,t),g_.init(e,t)}),z_=q(`ZodJWT`,(e,t)=>{Dp.init(e,t),g_.init(e,t)}),B_=q(`ZodNumber`,(e,t)=>{Op.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sg(e,t,n,r),e.isFinite=!0},Gu({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=_g(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=_g(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=_g(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_g(e).format??null},{gt(e,t){return this.check(Sh(e,t))},gte(e,t){return this.check(Ch(e,t))},min(e,t){return this.check(Ch(e,t))},lt(e,t){return this.check(bh(e,t))},lte(e,t){return this.check(xh(e,t))},max(e,t){return this.check(xh(e,t))},int(e){return this.check(U_(e))},safe(e){return this.check(U_(e))},positive(e){return this.check(Sh(0,e))},nonnegative(e){return this.check(Ch(0,e))},negative(e){return this.check(bh(0,e))},nonpositive(e){return this.check(xh(0,e))},multipleOf(e,t){return this.check(wh(e,t))},step(e,t){return this.check(wh(e,t))},finite(){return this}}));function V_(e){return mh(B_,e)}var H_=q(`ZodNumberFormat`,(e,t)=>{kp.init(e,t),B_.init(e,t)});function U_(e){return hh(H_,e)}var W_=q(`ZodBoolean`,(e,t)=>{Ap.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cg(e,t,n,r)});function G_(e){return gh(W_,e)}var K_=q(`ZodNull`,(e,t)=>{jp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wg(e,t,n,r)});function q_(e){return _h(K_,e)}var J_=q(`ZodUnknown`,(e,t)=>{Mp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Y_(){return vh(J_)}var X_=q(`ZodNever`,(e,t)=>{Np.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tg(e,t,n,r)});function Z_(e){return yh(X_,e)}var Q_=q(`ZodArray`,(e,t)=>{f_(),Fp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ag(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Eh(e,t))},nonempty(e){return this.check(Eh(1,e))},max(e,t){return this.check(Th(e,t))},length(e,t){return this.check(Dh(e,t))},unwrap(){return this.element}});function $_(e,t){return Bh(Q_,e,t)}var ev=q(`ZodObject`,(e,t)=>{f_(),Vp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mg(e,t,n,r),Zu(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return uv(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(su(this._zod.def,{catchall:e}))},passthrough(){return this.clone(su(this._zod.def,{catchall:Y_()}))},loose(){return this.clone(su(this._zod.def,{catchall:Y_()}))},strict(){return this.clone(su(this._zod.def,{catchall:Z_()}))},strip(){return this.clone(su(this._zod.def,{catchall:void 0}))},extend(e){return Tu(this,e)},safeExtend(e){return Du(this,e)},merge(e){return Ou(this,e)},pick(e){return Su(this,e)},omit(e){return wu(this,e)},partial(...e){return ku(hv,this,e[0])},exactPartial(...e){return ku(_v,this,e[0],`exactPartial`)},required(...e){return Au(Tv,this,e[0])}});function Y(e,t){return new ev({type:`object`,shape:e??{},...G(t)})}var tv=q(`ZodUnion`,(e,t)=>{Up.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ng(e,t,n,r),e.options=t.options});function nv(e,t){return new tv({type:`union`,options:e,...G(t)})}var rv=q(`ZodDiscriminatedUnion`,(e,t)=>{tv.init(e,t),Gp.init(e,t)});function iv(e,t,n){return new rv({type:`union`,options:t,discriminator:e,...G(n)})}var av=q(`ZodIntersection`,(e,t)=>{Kp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pg(e,t,n,r)});function ov(e,t){return new av({type:`intersection`,left:e,right:t})}var sv=q(`ZodRecord`,(e,t)=>{f_(),Yp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rg(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function cv(e,t,n){return!t||!t._zod?new sv({type:`record`,keyType:J(),valueType:e,...G(t)}):new sv({type:`record`,keyType:e,valueType:t,...G(n)})}var lv=q(`ZodEnum`,(e,t)=>{Xp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eg(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 lv({...t,checks:[],...G(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 lv({...t,checks:[],...G(r),entries:i})}});function uv(e,t){return new lv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...G(t)})}var dv=q(`ZodLiteral`,(e,t)=>{Zp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dg(e,t,n,r),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 fv(e,t){return new dv({type:`literal`,values:Array.isArray(e)?e:[e],...G(t)})}var pv=q(`ZodTransform`,(e,t)=>{f_(),Qp.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ad(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Vu(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Vu(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function mv(e){return new pv({type:`transform`,transform:e})}var hv=q(`ZodOptional`,(e,t)=>{em.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gv(e){return new hv({type:`optional`,innerType:e})}var _v=q(`ZodExactOptional`,(e,t)=>{tm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vv(e){return new _v({type:`optional`,innerType:e})}var yv=q(`ZodNullable`,(e,t)=>{nm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bv(e){return new yv({type:`nullable`,innerType:e})}var xv=q(`ZodDefault`,(e,t)=>{rm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sv(e,t){return new xv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():mu(t)}})}var Cv=q(`ZodPrefault`,(e,t)=>{am.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wv(e,t){return new Cv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():mu(t)}})}var Tv=q(`ZodNonOptional`,(e,t)=>{om.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ev(e,t){return new Tv({type:`nonoptional`,innerType:e,...G(t)})}var Dv=q(`ZodCatch`,(e,t)=>{lm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ov(e,t){return new Dv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:$u(t)})}var kv=q(`ZodPipe`,(e,t)=>{um.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.in=t.in,e.out=t.out});function Av(e,t){return new kv({type:`pipe`,in:e,out:t})}var jv=q(`ZodReadonly`,(e,t)=>{fm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mv(e){return new jv({type:`readonly`,innerType:e})}var Nv=q(`ZodLazy`,(e,t)=>{mm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yg(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Pv(e){return new Nv({type:`lazy`,getter:e})}var Fv=q(`ZodCustom`,(e,t)=>{hm.init(e,t),p_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Og(e,t,n,r)});function Iv(e,t={}){return Vh(Fv,e,t)}function Lv(e,t){return Hh(e,t)}function Rv(e){let t=Pv(()=>nv([J(e),V_(),G_(),q_(),$_(t),cv(J(),t)]));return t}var zv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),Bv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=zv(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),X=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=zv(),n=Bv(),r=zv();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var i=Bv();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
132
+ `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-->0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),Z=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=X(),n=zv();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),Vv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),Hv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=X(),n=Z(),r=Vv();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),Uv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=Hv(),n=X(),r=Vv(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),Wv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),Gv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),Kv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=Wv(),n=Gv(),r=Hv(),i=X(),a=Z(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
133
133
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
134
134
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
135
- || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),Wv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=X(),n=Z();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),Gv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=X(),n=Z(),r=Rv(),i=Z();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),Kv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=X(),n=Rv(),r=Gv(),i=zv();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),qv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=X(),n=Z();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),Jv=i(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),Yv=i(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),Xv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Z(),n=Jv(),r=Yv(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),Zv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=Bv(),n=Uv(),r=Hv(),i=Uv(),a=Wv(),o=Kv(),s=qv(),c=X(),l=Rv(),u=Xv(),d=Z(),f=zv();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function N(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>ne(e,`$ref`,h.all.$ref.definition));return}p.jtd||F(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),P(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):P(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function P(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&ne(e,n.keyword,n.definition,t.type)})}function F(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(I(e,t),e.opts.allowUnionTypes||L(e,t),R(e,e.dataTypes))}function I(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{z(e.dataTypes,t)||te(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),B(e,t)}}function L(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&te(e,`use allowUnionTypes to allow union type keyword`)}function R(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>ee(t,e))&&te(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ee(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function z(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function B(e,t){let n=[];for(let r of e.dataTypes)z(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function te(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var V=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,ae(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=V;function ne(e,t,n,r){let i=new V(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var re=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ae(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!re.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=ie.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=ae})),Qv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),$v=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Xv();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),ey=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=X(),n=Qv(),r=Rv(),i=Xv(),a=Z(),o=Zv(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),ty=r({$id:()=>ny,additionalProperties:()=>!1,default:()=>sy,description:()=>ry,properties:()=>oy,required:()=>ay,type:()=>iy}),ny,ry,iy,ay,oy,sy,cy=n((()=>{ny=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,ry=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,iy=`object`,ay=[`$data`],oy={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},sy={$id:ny,description:ry,type:iy,required:ay,properties:oy,additionalProperties:!1}})),ly=i(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),l=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)l[t]=`%`+e[t>>4]+e[t&15]}function u(e){return e<2048?l[192|e>>6]+l[128|e&63]:e<65536?l[224|e>>12]+l[128|e>>6&63]+l[128|e&63]:l[240|e>>18]+l[128|e>>12&63]+l[128|e>>6&63]+l[128|e&63]}function d(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var f=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),p=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),m=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),h=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function g(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!m(e[t])){if(e[t]===`%`&&t+2<e.length&&i(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function _(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function v(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2;continue}if(!f(n))return;a[e]=parseInt(n,16).toString(16),o++}if(t===-1)return o===8?_(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return _(s)}function y(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&p(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(b(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!g(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=v(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function b(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function x(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}var S={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},C=/[@/?#:]/g,w=/[@/?#]/g;function T(e,t){let n=t?w:C;return n.lastIndex=0,e.replace(n,e=>S[e])}function E(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function D(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}if(o(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=N(i)?r:l[i];else if(i<55296||i>57343)t+=u(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=u(65536+(i-55296<<10)+(r-56320)),n++):t+=u(65533)}else t+=u(65533)}}return t}function O(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let a=e[t];if(a===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(i(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(a===`/`&&(r=!1),o(a)&&(a!==`:`||!r))n+=a;else{let r=e.charCodeAt(t);if(r<128)n+=l[r];else if(r<55296||r>57343)n+=u(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=u(65536+(r-55296<<10)+(i-56320)),t++):n+=u(65533)}else n+=u(65533)}}return n}function k(e,t){let n=``;for(let r=0;r<e.length;r++){let a=e[r];if(a===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(i(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(a))n+=a;else{let t=e.charCodeAt(r);if(t<128)n+=l[t];else if(t<55296||t>57343)n+=u(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=u(65536+(t-55296<<10)+(i-56320)),r++):n+=u(65533)}else n+=u(65533)}}return n}function A(e){return k(e,c)}function j(e){return k(e,s)}function M(e){return k(e,s)}function N(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function P(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));a(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=N(i)?r:l[i];else if(i<55296||i>57343)t+=u(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=u(65536+(i-55296<<10)+(r-56320)),n++):t+=u(65533)}else t+=u(65533)}}return t}function F(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function I(e){let t=[];if(e.userinfo!==void 0&&(t.push(A(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let e=y(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=E(n,!0),e=y(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:T(n,!1)}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:h,recomposeAuthority:I,reescapeHostDelimiters:T,normalizePercentEncoding:E,normalizePathEncoding:D,serializePathEncoding:O,normalizeQueryFragmentEncoding:P,encodeUserinfo:A,encodeQuery:j,encodeFragment:M,escapePreservingEscapes:F,removeDotSegments:x,isIPv4:r,isUUID:n,normalizeIPv6:y,stringArrayToHexStripped:d}})),uy=i(((e,t)=>{var{isUUID:n}=ly(),r=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),dy=i(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,serializePathEncoding:s,normalizeQueryFragmentEncoding:c,encodeQuery:l,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:f,nonSimpleDomain:p}=ly(),{SCHEMES:m,getSchemeHandler:h}=uy(),g=/^[A-Za-z][A-Za-z0-9+.-]*$/u,_=`URI scheme is malformed.`;function v(e){let t=unescape(String(e));if(!g.test(t))throw TypeError(_);return t}function y(e,t){return typeof e==`string`?e=N(e,t):typeof e==`object`&&(e=M(C(e,t),t)),e}function b(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=j(e,i),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:m,malformedSchemeSpecific:g,malformedHost:_,malformedScheme:v}=j(t,i);if(o||p||s||m||c||g||l||_||u||v)throw Error(a.error||d.error||`URI is malformed.`);let y=x(a,d,i,!0),b=h(r&&r.scheme||y.scheme),S=y.host,w=S!==void 0&&S!==``&&(f(S)||n(S).isIPV6);A(y,r||{},b,w);let T=S&&S.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(S);if(y.error&&!T)throw Error(y.error);return i.skipEscape=!0,C(y,i)}function x(e,t,n,i){let a={};return i||(e=M(C(e,n),n),t=M(C(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):(a.path=(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,a.query=t.query===void 0?e.query:t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function S(e,t,n){let r=F(e,n),i=F(t,n);return r!==void 0&&i!==void 0&&r===i}function C(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},o=Object.assign({},t),c=[];n.scheme&&=v(n.scheme);let d=h(o.scheme||n.scheme);d&&d.serialize&&d.serialize(n,o);let f=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,p=!o.skipEscape&&n.scheme===void 0&&!f;n.path!==void 0&&(n.path=o.skipEscape?a(n.path):s(n.path,p)),o.reference!==`suffix`&&n.scheme&&(n.scheme=v(n.scheme),c.push(n.scheme,`:`));let m=i(n);if(m!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(m),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!d||!d.absolutePath)&&(e=r(e)),p&&(e=s(e,!0)),m===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,l(n.query)),n.fragment!==void 0&&c.push(`#`,u(n.fragment)),c.join(``)}var w=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,T=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,E=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function D(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function O(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function k(e){let t=e[4];return O(e[3])||t!==void 0&&(t[0]!==`[`||t[t.length-1]!==`]`)&&O(t)||O(e[6])||O(e[7])||O(e[8])}function A(e,t,n,r){if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&e.host[0]!==`[`&&(t.domainHost||n&&n.domainHost)&&r===!1&&p(e.host))try{e.host=new URL(`http://`+e.host).hostname}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}return!1}function j(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},s=!1,l=!1,u=!1,p=!1,v=!1,y=!1,b=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let x=e.match(T);x!==null&&x[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,s=!0);let S=e.match(E);if(S!==null){let e=S[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,s=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,s=!0))}let C=e.match(w);if(C){if(i.scheme=C[1],i.userinfo=C[3],i.host=C[4],i.port=parseInt(C[5],10),i.path=C[6]||``,i.query=C[7],i.fragment=C[8],i.scheme!==void 0){let e=unescape(i.scheme);g.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||_,y=!0)}l=k(C),l&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=C[5]);let t=D(i,C);if(t!==void 0&&(i.error=i.error||t,s=!0),i.host){if(f(i.host)===!1){let e=i.host[0]===`[`&&i.host[i.host.length-1]===`]`,t=n(i.host);b=t.isIPV6||t.isIPVFuture===!0,v=e&&t.error===!0,i.host=b?t.host:t.host.toLowerCase(),v&&(i.error=i.error||`URI host is malformed.`,s=!0)}else b=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let x=h(r.scheme||i.scheme);p=A(i,r,x,b),(!x||x&&!x.skipNormalize)&&(e.indexOf(`%`)!==-1&&i.host!==void 0&&!v&&(i.host=d(b?i.host:a(i.host,!0),b)),i.path&&=o(i.path),i.query&&=c(i.query),i.fragment&&=c(i.fragment)),x&&x.parse&&(x.parse(i,r),x===m.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:l,malformedSchemeSpecific:u,malformedHost:p,malformedScheme:y}}function M(e,t){return j(e,t).parsed}function N(e,t){return P(e,t).normalized}function P(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=j(e,t);return{normalized:r||i||a||o||s?e:C(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function F(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:C(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=P(n,t);return i||a||o||s||c?void 0:r}var I={SCHEMES:m,normalize:y,resolve:b,resolveComponent:x,equal:S,serialize:C,parse:M};t.exports=I,t.exports.default=I,t.exports.fastUri=I})),fy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dy();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),py=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var n=Zv();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var r=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var i=Qv(),a=$v(),o=Vv(),s=ey(),c=X(),l=Xv(),u=Uv(),d=Z(),f=(cy(),t(ty).default),p=fy(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=k(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new s.SchemaEnv({schema:{},schemaId:n});if(t=s.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(j.call(this,n,t),!t)return(0,d.eachItem)(n,e=>M.call(this,e)),this;P.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>M.call(this,e,r):e=>r.type.forEach(t=>M.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=I(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:o}=this.opts;if(typeof e==`object`)a=e[o];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let c=this._cache.get(e);if(c!==void 0)return c;n=(0,l.normalizeId)(a||n);let u=l.getSchemaRefs.call(this,e,n);return c=new s.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=i.default,x.MissingRefError=a.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var O={log(){},warn(){},error(){}};function k(e){if(e===!1)return O;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function M(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?N.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function N(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function P(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=I(t)),e.validateSchema=this.compile(t,!0))}var F={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function I(e){return{anyOf:[e,F]}}})),my=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),hy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=$v(),n=Gv(),r=X(),i=Rv(),a=ey(),o=Z(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),gy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=my(),n=hy();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),_y=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),vy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),yy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),by=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=yy();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),xy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gv(),n=Z(),r=X();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Sy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),Cy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gv(),n=X(),r=Z();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),wy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),Ty=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jv();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),Ey=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Uv(),n=X(),r=Z(),i=Ty();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Dy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Ty();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),Oy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Ty();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),ky=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_y(),n=vy(),r=by(),i=xy(),a=Sy(),o=Cy(),s=wy(),c=Ey(),l=Dy(),u=Oy();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Ay=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=X(),n=Z(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),jy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=X(),n=Z(),r=Gv(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),My=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jy();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Ny=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Gv(),i=Ay();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Py=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Fy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=X(),n=Z(),r=Gv();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
135
+ || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),qv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=X(),n=Z();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),Jv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=X(),n=Z(),r=Vv(),i=Z();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),Yv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=X(),n=Vv(),r=Jv(),i=Hv();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),Xv=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=X(),n=Z();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),Zv=i(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),Qv=i(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),$v=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=Z(),n=Zv(),r=Qv(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),ey=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=Uv(),n=Kv(),r=Gv(),i=Kv(),a=qv(),o=Yv(),s=Xv(),c=X(),l=Vv(),u=$v(),d=Z(),f=Hv();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function N(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>ne(e,`$ref`,h.all.$ref.definition));return}p.jtd||F(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),P(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):P(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function P(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&ne(e,n.keyword,n.definition,t.type)})}function F(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(I(e,t),e.opts.allowUnionTypes||L(e,t),R(e,e.dataTypes))}function I(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{z(e.dataTypes,t)||te(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),B(e,t)}}function L(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&te(e,`use allowUnionTypes to allow union type keyword`)}function R(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>ee(t,e))&&te(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function ee(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function z(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function B(e,t){let n=[];for(let r of e.dataTypes)z(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function te(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var V=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,ae(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=V;function ne(e,t,n,r){let i=new V(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var re=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ae(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!re.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=ie.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=ae})),ty=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),ny=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=$v();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),ry=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=X(),n=ty(),r=Vv(),i=$v(),a=Z(),o=ey(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),iy=r({$id:()=>ay,additionalProperties:()=>!1,default:()=>uy,description:()=>oy,properties:()=>ly,required:()=>cy,type:()=>sy}),ay,oy,sy,cy,ly,uy,dy=n((()=>{ay=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,oy=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,sy=`object`,cy=[`$data`],ly={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},uy={$id:ay,description:oy,type:sy,required:cy,properties:ly,additionalProperties:!1}})),fy=i(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),l=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)l[t]=`%`+e[t>>4]+e[t&15]}function u(e){return e<2048?l[192|e>>6]+l[128|e&63]:e<65536?l[224|e>>12]+l[128|e>>6&63]+l[128|e&63]:l[240|e>>18]+l[128|e>>12&63]+l[128|e>>6&63]+l[128|e&63]}function d(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var f=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),p=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),m=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),h=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function g(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!m(e[t])){if(e[t]===`%`&&t+2<e.length&&i(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function _(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function v(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2;continue}if(!f(n))return;a[e]=parseInt(n,16).toString(16),o++}if(t===-1)return o===8?_(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return _(s)}function y(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&p(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(b(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!g(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=v(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function b(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function x(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}var S={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},C=/[@/?#:]/g,w=/[@/?#]/g;function T(e,t){let n=t?w:C;return n.lastIndex=0,e.replace(n,e=>S[e])}function E(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function D(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}if(o(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=N(i)?r:l[i];else if(i<55296||i>57343)t+=u(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=u(65536+(i-55296<<10)+(r-56320)),n++):t+=u(65533)}else t+=u(65533)}}return t}function O(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let a=e[t];if(a===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(i(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(a===`/`&&(r=!1),o(a)&&(a!==`:`||!r))n+=a;else{let r=e.charCodeAt(t);if(r<128)n+=l[r];else if(r<55296||r>57343)n+=u(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=u(65536+(r-55296<<10)+(i-56320)),t++):n+=u(65533)}else n+=u(65533)}}return n}function k(e,t){let n=``;for(let r=0;r<e.length;r++){let a=e[r];if(a===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(i(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(a))n+=a;else{let t=e.charCodeAt(r);if(t<128)n+=l[t];else if(t<55296||t>57343)n+=u(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=u(65536+(t-55296<<10)+(i-56320)),r++):n+=u(65533)}else n+=u(65533)}}return n}function A(e){return k(e,c)}function j(e){return k(e,s)}function M(e){return k(e,s)}function N(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function P(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));a(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=N(i)?r:l[i];else if(i<55296||i>57343)t+=u(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=u(65536+(i-55296<<10)+(r-56320)),n++):t+=u(65533)}else t+=u(65533)}}return t}function F(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function I(e){let t=[];if(e.userinfo!==void 0&&(t.push(A(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let e=y(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=E(n,!0),e=y(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:T(n,!1)}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:h,recomposeAuthority:I,reescapeHostDelimiters:T,normalizePercentEncoding:E,normalizePathEncoding:D,serializePathEncoding:O,normalizeQueryFragmentEncoding:P,encodeUserinfo:A,encodeQuery:j,encodeFragment:M,escapePreservingEscapes:F,removeDotSegments:x,isIPv4:r,isUUID:n,normalizeIPv6:y,stringArrayToHexStripped:d}})),py=i(((e,t)=>{var{isUUID:n}=fy(),r=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),my=i(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,serializePathEncoding:s,normalizeQueryFragmentEncoding:c,encodeQuery:l,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:f,nonSimpleDomain:p}=fy(),{SCHEMES:m,getSchemeHandler:h}=py(),g=/^[A-Za-z][A-Za-z0-9+.-]*$/u,_=`URI scheme is malformed.`;function v(e){let t=unescape(String(e));if(!g.test(t))throw TypeError(_);return t}function y(e,t){return typeof e==`string`?e=N(e,t):typeof e==`object`&&(e=M(C(e,t),t)),e}function b(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=j(e,i),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:m,malformedSchemeSpecific:g,malformedHost:_,malformedScheme:v}=j(t,i);if(o||p||s||m||c||g||l||_||u||v)throw Error(a.error||d.error||`URI is malformed.`);let y=x(a,d,i,!0),b=h(r&&r.scheme||y.scheme),S=y.host,w=S!==void 0&&S!==``&&(f(S)||n(S).isIPV6);A(y,r||{},b,w);let T=S&&S.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(S);if(y.error&&!T)throw Error(y.error);return i.skipEscape=!0,C(y,i)}function x(e,t,n,i){let a={};return i||(e=M(C(e,n),n),t=M(C(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):(a.path=(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,a.query=t.query===void 0?e.query:t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function S(e,t,n){let r=F(e,n),i=F(t,n);return r!==void 0&&i!==void 0&&r===i}function C(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},o=Object.assign({},t),c=[];n.scheme&&=v(n.scheme);let d=h(o.scheme||n.scheme);d&&d.serialize&&d.serialize(n,o);let f=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,p=!o.skipEscape&&n.scheme===void 0&&!f;n.path!==void 0&&(n.path=o.skipEscape?a(n.path):s(n.path,p)),o.reference!==`suffix`&&n.scheme&&(n.scheme=v(n.scheme),c.push(n.scheme,`:`));let m=i(n);if(m!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(m),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!d||!d.absolutePath)&&(e=r(e)),p&&(e=s(e,!0)),m===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,l(n.query)),n.fragment!==void 0&&c.push(`#`,u(n.fragment)),c.join(``)}var w=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,T=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,E=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function D(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function O(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function k(e){let t=e[4];return O(e[3])||t!==void 0&&(t[0]!==`[`||t[t.length-1]!==`]`)&&O(t)||O(e[6])||O(e[7])||O(e[8])}function A(e,t,n,r){if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&e.host[0]!==`[`&&(t.domainHost||n&&n.domainHost)&&r===!1&&p(e.host))try{e.host=new URL(`http://`+e.host).hostname}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}return!1}function j(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},s=!1,l=!1,u=!1,p=!1,v=!1,y=!1,b=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let x=e.match(T);x!==null&&x[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,s=!0);let S=e.match(E);if(S!==null){let e=S[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,s=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,s=!0))}let C=e.match(w);if(C){if(i.scheme=C[1],i.userinfo=C[3],i.host=C[4],i.port=parseInt(C[5],10),i.path=C[6]||``,i.query=C[7],i.fragment=C[8],i.scheme!==void 0){let e=unescape(i.scheme);g.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||_,y=!0)}l=k(C),l&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=C[5]);let t=D(i,C);if(t!==void 0&&(i.error=i.error||t,s=!0),i.host){if(f(i.host)===!1){let e=i.host[0]===`[`&&i.host[i.host.length-1]===`]`,t=n(i.host);b=t.isIPV6||t.isIPVFuture===!0,v=e&&t.error===!0,i.host=b?t.host:t.host.toLowerCase(),v&&(i.error=i.error||`URI host is malformed.`,s=!0)}else b=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let x=h(r.scheme||i.scheme);p=A(i,r,x,b),(!x||x&&!x.skipNormalize)&&(e.indexOf(`%`)!==-1&&i.host!==void 0&&!v&&(i.host=d(b?i.host:a(i.host,!0),b)),i.path&&=o(i.path),i.query&&=c(i.query),i.fragment&&=c(i.fragment)),x&&x.parse&&(x.parse(i,r),x===m.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:l,malformedSchemeSpecific:u,malformedHost:p,malformedScheme:y}}function M(e,t){return j(e,t).parsed}function N(e,t){return P(e,t).normalized}function P(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=j(e,t);return{normalized:r||i||a||o||s?e:C(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function F(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:C(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=P(n,t);return i||a||o||s||c?void 0:r}var I={SCHEMES:m,normalize:y,resolve:b,resolveComponent:x,equal:S,serialize:C,parse:M};t.exports=I,t.exports.default=I,t.exports.fastUri=I})),hy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=my();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),gy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var n=ey();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var r=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var i=ty(),a=ny(),o=Wv(),s=ry(),c=X(),l=$v(),u=Kv(),d=Z(),f=(dy(),t(iy).default),p=hy(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=k(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new s.SchemaEnv({schema:{},schemaId:n});if(t=s.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(j.call(this,n,t),!t)return(0,d.eachItem)(n,e=>M.call(this,e)),this;P.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>M.call(this,e,r):e=>r.type.forEach(t=>M.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=I(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:o}=this.opts;if(typeof e==`object`)a=e[o];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let c=this._cache.get(e);if(c!==void 0)return c;n=(0,l.normalizeId)(a||n);let u=l.getSchemaRefs.call(this,e,n);return c=new s.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=i.default,x.MissingRefError=a.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var O={log(){},warn(){},error(){}};function k(e){if(e===!1)return O;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function M(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?N.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function N(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function P(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=I(t)),e.validateSchema=this.compile(t,!0))}var F={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function I(e){return{anyOf:[e,F]}}})),_y=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),vy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=ny(),n=Jv(),r=X(),i=Vv(),a=ry(),o=Z(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),yy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_y(),n=vy();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),by=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),xy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),Sy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),Cy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Sy();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),wy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jv(),n=Z(),r=X();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),Ty=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),Ey=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jv(),n=X(),r=Z();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),Dy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),Oy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zv();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),ky=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Kv(),n=X(),r=Z(),i=Oy();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),Ay=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Oy();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),jy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Oy();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),My=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=by(),n=xy(),r=Cy(),i=wy(),a=Ty(),o=Ey(),s=Dy(),c=ky(),l=Ay(),u=jy();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),Ny=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=X(),n=Z(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),Py=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=X(),n=Z(),r=Jv(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),Fy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Py();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),Iy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Jv(),i=Ny();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),Ly=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),Ry=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=X(),n=Z(),r=Jv();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
136
136
  missingProperty: ${i},
137
137
  depsCount: ${n},
138
- deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),Iy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),Ly=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gv(),n=X(),r=Rv(),i=Z();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Ry=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Zv(),n=Gv(),r=Z(),i=Ly();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),zy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Gv(),n=X(),r=Z(),i=Z();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),By=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),Vy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Gv().validateUnion,error:{message:`must match a schema in anyOf`}}})),Hy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Uy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),Wy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Gy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Ky=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ay(),n=My(),r=jy(),i=Ny(),a=Py(),o=Fy(),s=Iy(),c=Ly(),l=Ry(),u=zy(),d=By(),f=Vy(),p=Hy(),m=Uy(),h=Wy(),g=Gy();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),qy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Jy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[qy().default]})),Yy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Xy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=gy(),n=ky(),r=Ky(),i=Jy(),a=Yy();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Zy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),Qy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Zy(),r=ey(),i=$v(),a=Z();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),$y=r({$id:()=>tb,$schema:()=>eb,default:()=>ob,definitions:()=>rb,properties:()=>ab,title:()=>nb,type:()=>ib}),eb,tb,nb,rb,ib,ab,ob,sb=n((()=>{eb=`http://json-schema.org/draft-07/schema#`,tb=`http://json-schema.org/draft-07/schema#`,nb=`Core schema meta-schema`,rb={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},ib=[`object`,`boolean`],ab={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},ob={$schema:eb,$id:tb,title:nb,definitions:rb,type:ib,properties:ab,default:!0}})),cb=i(((e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=py(),i=Xy(),a=Qy(),o=(sb(),t($y).default),s=[`/properties`],c=`http://json-schema.org/draft-07/schema`,l=class extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(e,c,!1),this.refs[`http://json-schema.org/schema`]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=l,n.exports=e=l,n.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var u=Zv();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=Qv();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=$v();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),lb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;var t=X(),n=Rv(),r=ey(),i=hy(),a={keyword:`$dynamicAnchor`,schemaType:`string`,code:e=>o(e,e.schema)};function o(e,r){let{gen:i,it:a}=e;a.schemaEnv.root.dynamicAnchors[r]=!0;let o=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(r)}`,c=a.errSchemaPath===`#`?a.validateName:s(e);i.if((0,t._)`!${o}`,()=>i.assign(o,c))}e.dynamicAnchor=o;function s(e){let{schemaEnv:t,schema:n,self:a}=e.it,{root:o,baseId:s,localRefs:c,meta:l}=t.root,{schemaId:u}=a.opts,d=new r.SchemaEnv({schema:n,schemaId:u,root:o,baseId:s,localRefs:c,meta:l});return r.compileSchema.call(a,d),(0,i.getValidate)(e,d)}e.default=a})),ub=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;var t=X(),n=Rv(),r=hy(),i={keyword:`$dynamicRef`,schemaType:`string`,code:e=>a(e,e.schema)};function a(e,i){let{gen:a,keyword:o,it:s}=e;if(i[0]!==`#`)throw Error(`"${o}" only supports hash fragment reference`);let c=i.slice(1);if(s.allErrors)l();else{let t=a.let(`valid`,!1);l(t),e.ok(t)}function l(e){if(s.schemaEnv.root.dynamicAnchors[c]){let r=a.let(`_v`,(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(c)}`);a.if(r,u(r,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,n){return n?()=>a.block(()=>{(0,r.callRef)(e,t),a.let(n,!0)}):()=>(0,r.callRef)(e,t)}}e.dynamicRef=a,e.default=i})),db=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=lb(),n=Z();e.default={keyword:`$recursiveAnchor`,schemaType:`boolean`,code(e){e.schema?(0,t.dynamicAnchor)(e,``):(0,n.checkStrictMode)(e.it,`$recursiveAnchor: false is ignored`)}}})),fb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ub();e.default={keyword:`$recursiveRef`,schemaType:`string`,code:e=>(0,t.dynamicRef)(e,e.schema)}})),pb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=lb(),n=ub(),r=db(),i=fb();e.default=[t.default,n.default,r.default,i.default]})),mb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fy();e.default={keyword:`dependentRequired`,type:`object`,schemaType:`object`,error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}})),hb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Fy();e.default={keyword:`dependentSchemas`,type:`object`,schemaType:`object`,code:e=>(0,t.validateSchemaDeps)(e)}})),gb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:[`maxContains`,`minContains`],type:`array`,schemaType:`number`,code({keyword:e,parentSchema:n,it:r}){n.contains===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}}})),_b=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=mb(),n=hb(),r=gb();e.default=[t.default,n.default,r.default]})),vb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Rv();e.default={keyword:`unevaluatedProperties`,type:`object`,schemaType:[`boolean`,`object`],trackErrors:!0,error:{message:`must NOT have unevaluated properties`,params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:a,data:o,errsCount:s,it:c}=e;if(!s)throw Error(`ajv implementation error`);let{allErrors:l,props:u}=c;u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn(`key`,o,e=>i.if(f(u,e),()=>d(e)))):u!==!0&&i.forIn(`key`,o,e=>u===void 0?d(e):i.if(p(u,e),()=>d(e))),c.props=!0,e.ok((0,t._)`${s} === ${r.default.errors}`);function d(r){if(a===!1){e.setParams({unevaluatedProperty:r}),e.error(),l||i.break();return}if(!(0,n.alwaysValidSchema)(c,a)){let a=i.name(`valid`);e.subschema({keyword:`unevaluatedProperties`,dataProp:r,dataPropType:n.Type.Str},a),l||i.if((0,t.not)(a),()=>i.break())}}function f(e,n){return(0,t._)`!${e} || !${e}[${n}]`}function p(e,n){let r=[];for(let i in e)e[i]===!0&&r.push((0,t._)`${n} !== ${i}`);return(0,t.and)(...r)}}}})),yb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`unevaluatedItems`,type:`array`,schemaType:[`boolean`,`object`],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e,s=o.items||0;if(s===!0)return;let c=r.const(`len`,(0,t._)`${a}.length`);if(i===!1)e.setParams({len:s}),e.fail((0,t._)`${c} > ${s}`);else if(typeof i==`object`&&!(0,n.alwaysValidSchema)(o,i)){let n=r.var(`valid`,(0,t._)`${c} <= ${s}`);r.if((0,t.not)(n),()=>l(n,s)),e.ok(n)}o.items=!0;function l(i,a){r.forRange(`i`,a,c,a=>{e.subschema({keyword:`unevaluatedItems`,dataProp:a,dataPropType:n.Type.Num},i),o.allErrors||r.if((0,t.not)(i),()=>r.break())})}}}})),bb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=vb(),n=yb();e.default=[t.default,n.default]})),xb=r({$id:()=>Cb,$recursiveAnchor:()=>!0,$schema:()=>Sb,$vocabulary:()=>wb,allOf:()=>Eb,default:()=>kb,properties:()=>Ob,title:()=>Tb,type:()=>Db}),Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab=n((()=>{Sb=`https://json-schema.org/draft/2019-09/schema`,Cb=`https://json-schema.org/draft/2019-09/schema`,wb={"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},Tb=`Core and Validation specifications meta-schema`,Eb=[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format`},{$ref:`meta/content`}],Db=[`object`,`boolean`],Ob={definitions:{$comment:`While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.`,type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},dependencies:{$comment:`"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"`,type:`object`,additionalProperties:{anyOf:[{$recursiveRef:`#`},{$ref:`meta/validation#/$defs/stringArray`}]}}},kb={$schema:Sb,$id:Cb,$vocabulary:wb,$recursiveAnchor:!0,title:Tb,allOf:Eb,type:Db,properties:Ob}})),jb=r({$defs:()=>Rb,$id:()=>Nb,$recursiveAnchor:()=>!0,$schema:()=>Mb,$vocabulary:()=>Pb,default:()=>zb,properties:()=>Lb,title:()=>Fb,type:()=>Ib}),Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb=n((()=>{Mb=`https://json-schema.org/draft/2019-09/schema`,Nb=`https://json-schema.org/draft/2019-09/meta/applicator`,Pb={"https://json-schema.org/draft/2019-09/vocab/applicator":!0},Fb=`Applicator vocabulary meta-schema`,Ib=[`object`,`boolean`],Lb={additionalItems:{$recursiveRef:`#`},unevaluatedItems:{$recursiveRef:`#`},items:{anyOf:[{$recursiveRef:`#`},{$ref:`#/$defs/schemaArray`}]},contains:{$recursiveRef:`#`},additionalProperties:{$recursiveRef:`#`},unevaluatedProperties:{$recursiveRef:`#`},properties:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$recursiveRef:`#`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$recursiveRef:`#`}},propertyNames:{$recursiveRef:`#`},if:{$recursiveRef:`#`},then:{$recursiveRef:`#`},else:{$recursiveRef:`#`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$recursiveRef:`#`}},Rb={schemaArray:{type:`array`,minItems:1,items:{$recursiveRef:`#`}}},zb={$schema:Mb,$id:Nb,$vocabulary:Pb,$recursiveAnchor:!0,title:Fb,type:Ib,properties:Lb,$defs:Rb}})),Vb=r({$id:()=>Ub,$recursiveAnchor:()=>!0,$schema:()=>Hb,$vocabulary:()=>Wb,default:()=>Jb,properties:()=>qb,title:()=>Gb,type:()=>Kb}),Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb=n((()=>{Hb=`https://json-schema.org/draft/2019-09/schema`,Ub=`https://json-schema.org/draft/2019-09/meta/content`,Wb={"https://json-schema.org/draft/2019-09/vocab/content":!0},Gb=`Content vocabulary meta-schema`,Kb=[`object`,`boolean`],qb={contentMediaType:{type:`string`},contentEncoding:{type:`string`},contentSchema:{$recursiveRef:`#`}},Jb={$schema:Hb,$id:Ub,$vocabulary:Wb,$recursiveAnchor:!0,title:Gb,type:Kb,properties:qb}})),Xb=r({$id:()=>Qb,$recursiveAnchor:()=>!0,$schema:()=>Zb,$vocabulary:()=>$b,default:()=>rx,properties:()=>nx,title:()=>ex,type:()=>tx}),Zb,Qb,$b,ex,tx,nx,rx,ix=n((()=>{Zb=`https://json-schema.org/draft/2019-09/schema`,Qb=`https://json-schema.org/draft/2019-09/meta/core`,$b={"https://json-schema.org/draft/2019-09/vocab/core":!0},ex=`Core vocabulary meta-schema`,tx=[`object`,`boolean`],nx={$id:{type:`string`,format:`uri-reference`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{type:`string`,format:`uri`},$anchor:{type:`string`,pattern:`^[A-Za-z][-A-Za-z0-9.:_]*$`},$ref:{type:`string`,format:`uri-reference`},$recursiveRef:{type:`string`,format:`uri-reference`},$recursiveAnchor:{type:`boolean`,default:!1},$vocabulary:{type:`object`,propertyNames:{type:`string`,format:`uri`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}}},rx={$schema:Zb,$id:Qb,$vocabulary:$b,$recursiveAnchor:!0,title:ex,type:tx,properties:nx}})),ax=r({$id:()=>sx,$recursiveAnchor:()=>!0,$schema:()=>ox,$vocabulary:()=>cx,default:()=>fx,properties:()=>dx,title:()=>lx,type:()=>ux}),ox,sx,cx,lx,ux,dx,fx,px=n((()=>{ox=`https://json-schema.org/draft/2019-09/schema`,sx=`https://json-schema.org/draft/2019-09/meta/format`,cx={"https://json-schema.org/draft/2019-09/vocab/format":!0},lx=`Format vocabulary meta-schema`,ux=[`object`,`boolean`],dx={format:{type:`string`}},fx={$schema:ox,$id:sx,$vocabulary:cx,$recursiveAnchor:!0,title:lx,type:ux,properties:dx}})),mx=r({$id:()=>gx,$recursiveAnchor:()=>!0,$schema:()=>hx,$vocabulary:()=>_x,default:()=>xx,properties:()=>bx,title:()=>vx,type:()=>yx}),hx,gx,_x,vx,yx,bx,xx,Sx=n((()=>{hx=`https://json-schema.org/draft/2019-09/schema`,gx=`https://json-schema.org/draft/2019-09/meta/meta-data`,_x={"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},vx=`Meta-data vocabulary meta-schema`,yx=[`object`,`boolean`],bx={title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}},xx={$schema:hx,$id:gx,$vocabulary:_x,$recursiveAnchor:!0,title:vx,type:yx,properties:bx}})),Cx=r({$defs:()=>Ax,$id:()=>Tx,$recursiveAnchor:()=>!0,$schema:()=>wx,$vocabulary:()=>Ex,default:()=>jx,properties:()=>kx,title:()=>Dx,type:()=>Ox}),wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx=n((()=>{wx=`https://json-schema.org/draft/2019-09/schema`,Tx=`https://json-schema.org/draft/2019-09/meta/validation`,Ex={"https://json-schema.org/draft/2019-09/vocab/validation":!0},Dx=`Validation vocabulary meta-schema`,Ox=[`object`,`boolean`],kx={multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]}},Ax={nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},jx={$schema:wx,$id:Tx,$vocabulary:Ex,$recursiveAnchor:!0,title:Dx,type:Ox,properties:kx,$defs:Ax}})),Nx=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var n=(Ab(),t(xb).default),r=(Bb(),t(jb).default),i=(Yb(),t(Vb).default),a=(ix(),t(Xb).default),o=(px(),t(ax).default),s=(Sx(),t(mx).default),c=(Mx(),t(Cx).default),l=[`/properties`];function u(e){return[n,r,i,a,t(this,o),s,t(this,c)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function t(t,n){return e?t.$dataMetaSchema(n,l):n}}e.default=u})),Px=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;var n=py(),r=Xy(),i=pb(),a=_b(),o=bb(),s=Qy(),c=Nx(),l=`https://json-schema.org/draft/2019-09/schema`,u=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),r.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(a.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(c.default.call(this,e),this.refs[`http://json-schema.org/schema`]=l)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=Zv();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var f=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var p=Qv();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=$v();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),Fx=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=gy(),n=ky(),r=Ky(),i=pb(),a=_b(),o=bb(),s=Jy(),c=Yy();e.default=[i.default,t.default,n.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,a.default,o.default]})),Ix=r({$comment:()=>Wx,$dynamicAnchor:()=>Bx,$id:()=>Rx,$schema:()=>Lx,$vocabulary:()=>zx,allOf:()=>Hx,default:()=>Kx,properties:()=>Gx,title:()=>Vx,type:()=>Ux}),Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx=n((()=>{Lx=`https://json-schema.org/draft/2020-12/schema`,Rx=`https://json-schema.org/draft/2020-12/schema`,zx={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},Bx=`meta`,Vx=`Core and Validation specifications meta-schema`,Hx=[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],Ux=[`object`,`boolean`],Wx=`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,Gx={definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}},Kx={$schema:Lx,$id:Rx,$vocabulary:zx,$dynamicAnchor:Bx,title:Vx,allOf:Hx,type:Ux,$comment:Wx,properties:Gx}})),Jx=r({$defs:()=>nS,$dynamicAnchor:()=>Qx,$id:()=>Xx,$schema:()=>Yx,$vocabulary:()=>Zx,default:()=>rS,properties:()=>tS,title:()=>$x,type:()=>eS}),Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS=n((()=>{Yx=`https://json-schema.org/draft/2020-12/schema`,Xx=`https://json-schema.org/draft/2020-12/meta/applicator`,Zx={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},Qx=`meta`,$x=`Applicator vocabulary meta-schema`,eS=[`object`,`boolean`],tS={prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},nS={schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}},rS={$schema:Yx,$id:Xx,$vocabulary:Zx,$dynamicAnchor:Qx,title:$x,type:eS,properties:tS,$defs:nS}})),aS=r({$dynamicAnchor:()=>lS,$id:()=>sS,$schema:()=>oS,$vocabulary:()=>cS,default:()=>pS,properties:()=>fS,title:()=>uS,type:()=>dS}),oS,sS,cS,lS,uS,dS,fS,pS,mS=n((()=>{oS=`https://json-schema.org/draft/2020-12/schema`,sS=`https://json-schema.org/draft/2020-12/meta/unevaluated`,cS={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},lS=`meta`,uS=`Unevaluated applicator vocabulary meta-schema`,dS=[`object`,`boolean`],fS={unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}},pS={$schema:oS,$id:sS,$vocabulary:cS,$dynamicAnchor:lS,title:uS,type:dS,properties:fS}})),hS=r({$dynamicAnchor:()=>yS,$id:()=>_S,$schema:()=>gS,$vocabulary:()=>vS,default:()=>CS,properties:()=>SS,title:()=>bS,type:()=>xS}),gS,_S,vS,yS,bS,xS,SS,CS,wS=n((()=>{gS=`https://json-schema.org/draft/2020-12/schema`,_S=`https://json-schema.org/draft/2020-12/meta/content`,vS={"https://json-schema.org/draft/2020-12/vocab/content":!0},yS=`meta`,bS=`Content vocabulary meta-schema`,xS=[`object`,`boolean`],SS={contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}},CS={$schema:gS,$id:_S,$vocabulary:vS,$dynamicAnchor:yS,title:bS,type:xS,properties:SS}})),TS=r({$defs:()=>NS,$dynamicAnchor:()=>kS,$id:()=>DS,$schema:()=>ES,$vocabulary:()=>OS,default:()=>PS,properties:()=>MS,title:()=>AS,type:()=>jS}),ES,DS,OS,kS,AS,jS,MS,NS,PS,FS=n((()=>{ES=`https://json-schema.org/draft/2020-12/schema`,DS=`https://json-schema.org/draft/2020-12/meta/core`,OS={"https://json-schema.org/draft/2020-12/vocab/core":!0},kS=`meta`,AS=`Core vocabulary meta-schema`,jS=[`object`,`boolean`],MS={$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},NS={anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}},PS={$schema:ES,$id:DS,$vocabulary:OS,$dynamicAnchor:kS,title:AS,type:jS,properties:MS,$defs:NS}})),IS=r({$dynamicAnchor:()=>BS,$id:()=>RS,$schema:()=>LS,$vocabulary:()=>zS,default:()=>WS,properties:()=>US,title:()=>VS,type:()=>HS}),LS,RS,zS,BS,VS,HS,US,WS,GS=n((()=>{LS=`https://json-schema.org/draft/2020-12/schema`,RS=`https://json-schema.org/draft/2020-12/meta/format-annotation`,zS={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},BS=`meta`,VS=`Format vocabulary meta-schema for annotation results`,HS=[`object`,`boolean`],US={format:{type:`string`}},WS={$schema:LS,$id:RS,$vocabulary:zS,$dynamicAnchor:BS,title:VS,type:HS,properties:US}})),KS=r({$dynamicAnchor:()=>XS,$id:()=>JS,$schema:()=>qS,$vocabulary:()=>YS,default:()=>eC,properties:()=>$S,title:()=>ZS,type:()=>QS}),qS,JS,YS,XS,ZS,QS,$S,eC,tC=n((()=>{qS=`https://json-schema.org/draft/2020-12/schema`,JS=`https://json-schema.org/draft/2020-12/meta/meta-data`,YS={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},XS=`meta`,ZS=`Meta-data vocabulary meta-schema`,QS=[`object`,`boolean`],$S={title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}},eC={$schema:qS,$id:JS,$vocabulary:YS,$dynamicAnchor:XS,title:ZS,type:QS,properties:$S}})),nC=r({$defs:()=>uC,$dynamicAnchor:()=>oC,$id:()=>iC,$schema:()=>rC,$vocabulary:()=>aC,default:()=>dC,properties:()=>lC,title:()=>sC,type:()=>cC}),rC,iC,aC,oC,sC,cC,lC,uC,dC,fC=n((()=>{rC=`https://json-schema.org/draft/2020-12/schema`,iC=`https://json-schema.org/draft/2020-12/meta/validation`,aC={"https://json-schema.org/draft/2020-12/vocab/validation":!0},oC=`meta`,sC=`Validation vocabulary meta-schema`,cC=[`object`,`boolean`],lC={type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},uC={nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},dC={$schema:rC,$id:iC,$vocabulary:aC,$dynamicAnchor:oC,title:sC,type:cC,properties:lC,$defs:uC}})),pC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var n=(qx(),t(Ix).default),r=(iS(),t(Jx).default),i=(mS(),t(aS).default),a=(wS(),t(hS).default),o=(FS(),t(TS).default),s=(GS(),t(IS).default),c=(tC(),t(KS).default),l=(fC(),t(nC).default),u=[`/properties`];function d(e){return[n,r,i,a,o,t(this,s),c,t(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function t(t,n){return e?t.$dataMetaSchema(n,u):n}}e.default=d})),mC=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;var n=py(),r=Fx(),i=Qy(),a=pC(),o=`https://json-schema.org/draft/2020-12/schema`,s=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs[`http://json-schema.org/schema`]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=Zv();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var u=Qv();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=$v();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})})),hC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function E(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),gC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=cb(),n=X(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),_C=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=hC(),r=gC(),i=X(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),vC=cb(),yC=Px(),bC=mC(),xC=e(_C(),1),SC=[`example`,`externalDocs`,`xml`,`markdownDescription`,`enumDescriptions`,`enumNames`,`enumTitles`];function CC(e,t=new Set){if(e&&typeof e==`object`)for(let[n,r]of Object.entries(e))n.startsWith(`x-`)&&t.add(n),CC(r,t);return t}function wC(e,t){let n=new e({strict:!0,strictTypes:!1,strictTuples:!1,strictRequired:!1,allowUnionTypes:!0,allErrors:!0});(0,xC.default)(n);for(let e of[...SC,...CC(t)])n.addKeyword({keyword:e,valid:!0});return n}var TC=new Map;function EC(e){let t=JSON.stringify(e),n=TC.get(t);if(n)return n;let r=typeof e==`object`?e.$schema:void 0,i=wC(typeof r==`string`&&r.includes(`draft-07`)?vC.Ajv:typeof r==`string`&&r.includes(`2019-09`)?yC.Ajv2019:bC.Ajv2020,e);try{let n=i.compile(e);if(`$async`in n)throw Error(`Asynchronous schemas are not supported`);return TC.size>=200&&TC.clear(),TC.set(t,n),n}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`MCP JSON Schema cannot be validated: ${t}. Reconfigure the tool schema (supported dialects: draft-07, 2019-09, 2020-12). No validation was skipped.`)}}function DC(e,t){let n=EC(e);if(!n(t))throw Error(`MCP schema validation failed: `+(n.errors??[]).map(e=>`${e.instancePath||`/`} ${e.keyword}`).join(`; `))}function OC(e,t){if(!t.length||typeof e==`boolean`)return e;let[n,...r]=t,i=e.properties,a=i&&typeof i==`object`&&!Array.isArray(i)?i[n]:void 0;return a!==void 0&&(typeof a==`boolean`||a&&typeof a==`object`&&!Array.isArray(a))?OC(a,r):!0}function kC(e){for(let t of[`inputSchema`,`outputSchema`]){let n=e[t];if(n!==void 0)try{EC(n)}catch(n){throw Error(`MCP tool ${JSON.stringify(e.toolName)} ${t}: ${n instanceof Error?n.message:String(n)}`)}}}var AC=Fv();Y({structuredContent:AC,content:X_(Y({type:J()}).catchall(AC))}).strict();function jC(e){return typeof e==`string`&&/^[A-Za-z_][A-Za-z0-9_-]{0,127}$/.test(e)&&![`__proto__`,`constructor`,`prototype`].includes(e)}var MC=class{nodes=[{variable:1/0,choices:[]},{variable:1/0,choices:[]}];unique=new Map;cache=new Map;outcome(e,t){return this.node(e,Array.from({length:5},(e,n)=>Number(n===t)))}and(e,t){return this.apply(`and`,e,t)}or(e,t){return this.apply(`or`,e,t)}not(e){if(e<2)return 1-e;let t=`not:${e}`,n=this.cache.get(t);if(n!==void 0)return n;let r=this.nodes[e],i=this.node(r.variable,r.choices.map(e=>this.not(e)));return this.cache.set(t,i),i}implies(e,t){return this.and(e,this.not(t))===0}node(e,t){if(t.every(e=>e===t[0]))return t[0];let n=`${e}:${t.join(`,`)}`,r=this.unique.get(n);if(r!==void 0)return r;let i=this.nodes.length;return this.nodes.push({variable:e,choices:t}),this.unique.set(n,i),i}apply(e,t,n){if(t===n)return t;if(e===`and`){if(t===0||n===0)return 0;if(t===1)return n;if(n===1)return t}else{if(t===1||n===1)return 1;if(t===0)return n;if(n===0)return t}let r=`${e}:${Math.min(t,n)}:${Math.max(t,n)}`,i=this.cache.get(r);if(i!==void 0)return i;let a=this.nodes[t],o=this.nodes[n],s=Math.min(a.variable,o.variable),c=this.node(s,Array.from({length:5},(r,i)=>this.apply(e,a.variable===s?a.choices[i]:t,o.variable===s?o.choices[i]:n)));return this.cache.set(r,c),c}};function NC(e){let t=e.steps.map(e=>e.id),n=new Set(t);if(n.size!==t.length)throw Error(`Step IDs must be unique`);if(new Set(e.edges.map(e=>e.id)).size!==e.edges.length)throw Error(`Edge IDs must be unique`);let r=new Map(t.map(e=>[e,[]])),i=new Map(t.map(e=>[e,[]]));for(let t of e.edges){if(!n.has(t.from)||!n.has(t.to))throw Error(`Unknown edge endpoint`);r.get(t.to).push(t),i.get(t.from).push(t)}let a=t.filter(e=>!r.get(e).length),o=new Set(a),s=[...a];for(let e=0;e<s.length;e++)for(let t of i.get(s[e]))o.has(t.to)||(o.add(t.to),s.push(t.to));if(o.size!==n.size)throw Error(`Workflow cycle has no entry from a root`);let c=new Map(t.map(e=>[e,new Set(a.includes(e)?[e]:t)])),l=!0;for(;l;){l=!1;for(let e of s){let t=r.get(e);if(!t.length)continue;let n=new Set([...c.get(t[0].from)].filter(e=>t.every(t=>c.get(t.from).has(e))));n.add(e);let i=c.get(e);(n.size!==i.size||[...n].some(e=>!i.has(e)))&&(c.set(e,n),l=!0)}}let u=e.edges.filter(e=>c.get(e.from).has(e.to)),d=new Set(u.map(e=>e.id)),f=new Map;for(let e of u){let t=f.get(e.to)??new Set([e.to]),n=[e.from];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),n.push(...r.get(e).map(e=>e.from)))}f.set(e.to,t)}let p=[...f].map(([n,r])=>({headerId:n,memberIds:t.filter(e=>r.has(e)),backEdgeIds:u.filter(e=>e.to===n).map(e=>e.id),entryEdgeIds:e.edges.filter(e=>!r.has(e.from)&&r.has(e.to)).map(e=>e.id),exitEdgeIds:e.edges.filter(e=>r.has(e.from)&&!r.has(e.to)).map(e=>e.id)}));for(let t of p){let n=f.get(t.headerId);if(e.edges.some(e=>!n.has(e.from)&&n.has(e.to)&&e.to!==t.headerId))throw Error(`Workflow loop has multiple entry steps`);let r=[];for(let e of p){if(e===t)continue;let i=f.get(e.headerId),a=t.memberIds.filter(e=>i.has(e)).length;if(a){if(a===n.size&&n.size<i.size)r.push(e);else if(a!==i.size||n.size===i.size)throw Error(`Workflow loops overlap without strict nesting`)}}r.sort((e,t)=>e.memberIds.length-t.memberIds.length),r[0]&&(t.parentHeaderId=r[0].headerId)}let m=[],h=new Set(t);for(;h.size;){let e=[...h].filter(e=>r.get(e).every(e=>d.has(e.id)||!h.has(e.from)));if(!e.length)throw Error(`Workflow contains an irreducible or multiple-entry cycle`);for(let t of e)m.push(t),h.delete(t)}return p.sort((e,n)=>n.memberIds.length-e.memberIds.length||t.indexOf(e.headerId)-t.indexOf(n.headerId)),{loops:p,order:m}}var PC=J().refine(e=>![`__proto__`,`constructor`,`prototype`].includes(e),`Reserved dictionary key`);function FC(e){return K_().superRefine((e,t)=>{if(e&&typeof e==`object`)for(let n of Object.keys(e))PC.safeParse(n).success||t.addIssue({code:`custom`,message:`Reserved dictionary key`,path:[n]})}).pipe(av(PC,e))}var IC=jv(()=>$_([W_(),H_(),R_(),J(),X_(IC),av(J(),IC)])),LC=jv(()=>tv(`type`,[Y({type:lv(`null`)}).strict(),Y({type:lv(`json`),schema:$_([H_(),av(J(),IC)]).optional()}).strict(),Y({type:lv(`string`)}).strict(),Y({type:lv(`number`),integer:H_().optional()}).strict(),Y({type:lv(`boolean`)}).strict(),Y({type:lv(`enum`),values:X_(J()).min(1).refine(e=>new Set(e).size===e.length)}).strict(),Y({type:lv(`array`),items:LC}).strict(),Y({type:lv(`union`),variants:X_(LC).min(2)}).strict(),Y({type:lv(`object`),fields:FC(Y({schema:LC,required:H_().optional(),default:IC.optional()}).strict())}).strict()]));function RC(e){switch(e.type){case`null`:return W_();case`json`:return e.schema!==void 0&&EC(e.schema),IC.superRefine((t,n)=>{try{e.schema!==void 0&&DC(e.schema,t)}catch(e){n.addIssue({code:`custom`,message:e.message})}});case`string`:return J();case`number`:return e.integer?R_().int():R_();case`boolean`:return H_();case`enum`:return sv(e.values);case`array`:return X_(RC(e.items));case`union`:return $_(e.variants.map(RC));case`object`:return Y(Object.fromEntries(Object.entries(e.fields).map(([e,t])=>{let n=RC(t.schema);return t.default===void 0?t.required||(n=n.optional()):n=n.default(zC(t.schema,t.default)),[e,n]}))).strict()}}function zC(e,t){return IC.parse(RC(e).parse(t))}function BC(e){LC.parse(e),RC(e)}function VC(e){switch(e.type){case`json`:return`unknown`;case`enum`:return e.values.map(e=>JSON.stringify(e)).join(` | `);case`array`:return`Array<${VC(e.items)}>`;case`union`:return e.variants.map(VC).join(` | `);case`object`:return`{ ${Object.entries(e.fields).map(([e,t])=>`${JSON.stringify(e)}${t.required||t.default!==void 0?``:`?`}: ${VC(t.schema)}`).join(`; `)} }`;default:return e.type}}var HC={type:`object`,fields:{exitCode:{schema:{type:`number`,integer:!0},required:!0},stdout:{schema:{type:`string`},required:!0},stderr:{schema:{type:`string`},required:!0}}};function UC(e){if(e.kind===`workflow`)return e.contract.outputSchema;if(e.kind===`mcp`)return{type:`object`,fields:{structuredContent:{required:!0,schema:{type:`json`,...e.tool.outputSchema===void 0?{}:{schema:e.tool.outputSchema}}},content:{required:!0,schema:{type:`array`,items:{type:`json`}}}}};if(e.kind===`shell`)return HC;if(e.kind===`branch`)return{type:`boolean`};if(e.kind!==`join`)return e.outputSchema}function WC(e,t){if(!t.length)return{schema:e,optional:!1};if(e.type===`json`)return{schema:{type:`json`,schema:OC(e.schema??!0,t)},optional:!1};if(e.type===`null`)return{schema:{type:`json`},optional:!1};if(e.type===`union`){let n=e.variants.map(e=>WC(e,t));return{schema:qC(n.map(e=>e.schema)),optional:n.some(e=>e.optional)}}let[n,...r]=t;if(e.type===`object`){let t=Object.hasOwn(e.fields,n)?e.fields[n]:void 0;if(!t)throw Error(`Unknown field: ${n}`);let i=WC(t.schema,r);return{schema:i.schema,optional:i.optional||!t.required&&t.default===void 0}}if(e.type===`array`&&/^(0|[1-9]\d*)$/.test(n))return{schema:WC(e.items,r).schema,optional:!0};throw Error(`Invalid field path: ${n}`)}function GC(e,t){return t.type===`json`||e.type===`json`?!0:e.type===`union`?e.variants.every(e=>GC(e,t)):t.type===`union`?t.variants.some(t=>GC(e,t)):e.type===`enum`?t.type===`string`||t.type===`enum`&&e.values.every(e=>t.values.includes(e)):e.type===t.type?e.type===`number`&&t.type===`number`?!t.integer||!!e.integer:e.type===`array`&&t.type===`array`?GC(e.items,t.items):e.type===`object`&&t.type===`object`?Object.keys(e.fields).every(e=>Object.hasOwn(t.fields,e))&&Object.entries(t.fields).every(([t,n])=>{let r=Object.hasOwn(e.fields,t)?e.fields[t]:void 0,i=n.required&&n.default===void 0;return r?(!i||r.required||r.default!==void 0)&&GC(r.schema,n.schema):!i}):!0:!1}function KC(e){return e.type===`object`?{type:`object`,fields:Object.fromEntries(Object.entries(e.fields).map(([e,t])=>[e,{schema:KC(t.schema)}]))}:e.type===`array`?{type:`array`,items:KC(e.items)}:e.type===`union`?qC(e.variants.map(KC)):e}function qC(e){let t=[...new Map(e.map(e=>[JSON.stringify(e),e])).values()];return t.length===1?t[0]:{type:`union`,variants:t}}var JC=tv(`source`,[Y({source:lv(`input`),path:X_(J())}).strict(),Y({source:lv(`step`),stepId:J(),path:X_(J())}).strict()]),YC=jv(()=>tv(`kind`,[Y({kind:lv(`literal`),value:Fv()}).strict(),Y({kind:lv(`reference`),reference:JC}).strict(),Y({kind:lv(`object`),fields:FC(YC)}).strict(),Y({kind:lv(`array`),items:X_(YC)}).strict()])),XC=$_([H_(),av(J(),Fv())]),ZC=tv(`kind`,[Y({kind:lv(`template`),template:YC}).strict(),Y({kind:lv(`reference`),reference:JC}).strict(),Y({kind:lv(`object`),fields:FC(JC)}).strict()]),QC={id:PC.min(1),name:PC.min(1),inputSchema:LC.optional(),mapping:ZC.optional(),repeatMapping:ZC.optional(),permission:sv([`ask`,`auto-accept`]).optional(),timeoutMs:R_().int().positive().max(2147483647).optional(),secrets:FC(J().refine(jC,`Invalid secret reference`)).optional(),position:Y({x:R_(),y:R_()}).strict().optional()},$C=tv(`operator`,[Y({operator:lv(`truthy`),path:X_(J())}).strict(),Y({operator:sv([`equals`,`not-equals`]),path:X_(J()),value:Fv()}).strict(),Y({operator:sv([`greater-than`,`less-than`]),path:X_(J()),value:R_()}).strict()]),ew=Y({version:lv(1),id:J().regex(/^[a-zA-Z0-9_-]{1,128}$/),name:J().min(1),backend:J().min(1),projectId:J().optional(),permission:sv([`ask`,`auto-accept`]).optional(),inputSchema:LC.refine(e=>e.type===`object`),steps:X_(tv(`kind`,[Y({...QC,kind:lv(`agent`),instructions:J(),model:J().min(1),effort:sv([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),outputSchema:LC}).strict(),Y({...QC,kind:lv(`shell`),command:J(),acceptedExitCodes:X_(R_().int()).min(1).optional()}).strict(),Y({...QC,kind:lv(`typescript`),code:J(),outputSchema:LC}).strict(),Y({...QC,kind:lv(`branch`),condition:$C}).strict(),Y({...QC,kind:lv(`join`)}).strict(),Y({...QC,kind:lv(`workflow`),workflowId:J().regex(/^[a-zA-Z0-9_-]{1,128}$/),contract:Y({inputSchema:LC.refine(e=>e.type===`object`),outputSchema:LC}).strict()}).strict(),Y({...QC,kind:lv(`mcp`),tool:Y({connectionId:J().min(1),connectionName:J(),identity:J().regex(/^[a-f0-9]{64}$/),serverIdentity:J().regex(/^[a-f0-9]{64}$/),toolName:J().min(1),inputSchema:XC,outputSchema:XC.optional()}).strict()}).strict()])).min(1),loopSettings:FC(Y({maxTries:R_().int().min(1).max(100)}).strict()).optional(),edges:X_(Y({id:J().min(1),from:J(),to:J(),outcome:sv([`success`,`failure`,`timeout`,`true`,`false`])}).strict())}).strict();function tw(e){return rw(e)}function nw(e){return rw(e,!0)}function rw(e,t=!1){let n=ew.parse(e),r=n.steps.find(e=>e.kind===`agent`&&bo(e.instructions));if(r&&!n.projectId)throw Error(`Workflow Step ${JSON.stringify(r.name)} invokes a Skill and requires a Project binding`);BC(n.inputSchema);let i=new Map(n.steps.map(e=>[e.id,e]));if(i.size!==n.steps.length||new Set(n.steps.map(e=>e.name)).size!==i.size)throw Error(`Step IDs and names must be unique`);if(new Set(n.edges.map(e=>e.id)).size!==n.edges.length)throw Error(`Edge IDs must be unique`);let a=new Map(n.steps.map(e=>[e.id,[]])),o=new Map(n.steps.map(e=>[e.id,[]])),s=new Set;for(let e of n.edges){let t=i.get(e.from);if(!t||!i.has(e.to))throw Error(`Unknown edge endpoint`);let n=JSON.stringify([e.from,e.to,e.outcome]);if(s.has(n))throw Error(`Duplicate connection`);if(s.add(n),t.kind===`branch`?![`true`,`false`,`failure`,`timeout`].includes(e.outcome):[`true`,`false`].includes(e.outcome))throw Error(`Invalid edge outcome`);a.get(e.to).push(e),o.get(e.from).push(e)}let c=NC(n),l=c.loops.map(e=>({...e,maxTries:n.loopSettings?.[e.headerId]?.maxTries??3})),u=new Map(l.map(e=>[e.headerId,e]));for(let e of Object.keys(n.loopSettings??{}))if(!u.has(e))throw Error(`Loop settings require a loop header`);for(let e of i.values())if(e.repeatMapping&&!u.has(e.id))throw Error(`Repeat mapping requires a loop header`);let d=new Set(l.flatMap(e=>e.backEdgeIds)),f=new Map([...a].map(([e,t])=>[e,t.filter(e=>!d.has(e.id))])),p=c.order.map(e=>i.get(e)),m=new MC,h=new Map,g=new Map,_=new Map,v=new Map,y=e=>e.reduce((e,t)=>m.or(e,t),0),b=new Map,x=new Map,S=new Map,C=new Map,w=new Map,T=new Map,E={definition:n,order:p,incoming:a,outgoing:o,forwardIncoming:f,loops:l,outputSchemas:x,inputSchemas:S,firstInputSchemas:C,repeatInputSchemas:w};for(let e of p){let t=f.get(e.id),n=y(t.map(e=>v.get(e.id))),r=m.and(t.length?y(t.map(e=>_.get(e.id))):1,m.not(n)),i=m.or(y(t.map(e=>m.and(_.get(e.id),e.outcome===`failure`||e.outcome===`timeout`?1:g.get(e.from)))),u.has(e.id)?m.and(r,m.outcome(p.length+p.indexOf(e),1)):0);T.set(e.id,r),g.set(e.id,i);let a=p.indexOf(e),s=m.outcome(a,1),c=m.outcome(a,2),l=m.not(m.or(s,c));h.set(e.id,m.and(r,l));let d={success:l,failure:s,timeout:c,true:y([m.outcome(a,0),m.outcome(a,3)]),false:m.outcome(a,4)},x=o.get(e.id),S=m.or(m.and(s,x.some(e=>e.outcome===`failure`)?i:1),m.and(c,x.some(e=>e.outcome===`timeout`)?i:1));for(let e of x){let t=e.outcome===`failure`||e.outcome===`timeout`;_.set(e.id,m.and(r,m.and(d[e.outcome],t?m.not(i):1))),v.set(e.id,m.or(n,t?0:m.and(r,S)))}b.set(e.id,new Set(t.flatMap(e=>[e.from,...b.get(e.from)])))}for(let e of l){let t=y(e.backEdgeIds.map(e=>_.get(e))),n=e.memberIds.map(e=>{let t=y(o.get(e).map(e=>_.get(e.id)));return m.and(h.get(e),m.not(t))}),r=y([...e.exitEdgeIds.map(e=>_.get(e)),...n]);if(m.and(t,r)!==0)throw Error(`Loop ${e.headerId} can select exit and repeat together`)}let D=new Set,O=e=>{let t=x.get(e);if(t)return t;let n=i.get(e),r=UC(n)??n.inputSchema??A(e);return BC(r),x.set(e,r),r},k=(e,r)=>{let o=u.get(e.id),s=r?a.get(e.id).filter(e=>o.backEdgeIds.includes(e.id)):f.get(e.id),c=r?y(s.map(e=>_.get(e.id))):T.get(e.id),l=r?new Set(s.flatMap(e=>[e.from,...b.get(e.from)])):b.get(e.id),d=r?e.repeatMapping:e.mapping,p=e=>{if(e.source===`input`)return WC(n.inputSchema,e.path);let t=i.get(e.stepId);if(!t||!l.has(e.stepId))throw Error(`Mapping must reference an earlier step`);if(!m.implies(c,h.get(t.id)))throw Error(`Output is not guaranteed: ${t.name}`);return WC(O(t.id),e.path)};if(e.kind===`join`&&d)throw Error(`Joins collect selected incoming outputs without mappings`);let g;if(d?.kind===`template`){let n=e=>{e.kind===`reference`&&p(e.reference),e.kind===`object`&&Object.values(e.fields).forEach(n),e.kind===`array`&&e.items.forEach(n)};n(d.template);let r=e=>{if(e.kind===`reference`)return p(e.reference).schema;if(e.kind===`object`)return{type:`object`,fields:Object.fromEntries(Object.entries(e.fields).map(([e,t])=>[e,{schema:r(t),required:!0}]))};if(e.kind===`array`)return{type:`array`,items:e.items.length?qC(e.items.map(r)):{type:`json`}};let t=e=>e===null?{type:`null`}:typeof e==`string`?{type:`enum`,values:[e]}:typeof e==`number`?{type:`number`,integer:Number.isInteger(e)}:typeof e==`boolean`?{type:`boolean`}:Array.isArray(e)?{type:`array`,items:e.length?qC(e.map(t)):{type:`json`}}:{type:`object`,fields:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{schema:t(n),required:!0}]))};return t(e.value)};g=e.kind===`workflow`?r(d.template):{type:`json`},e.kind===`workflow`&&!t&&d.template.kind===`literal`&&zC(e.contract.inputSchema,d.template.value)}else if(d?.kind===`reference`){let e=p(d.reference);if(e.optional)throw Error(`A direct input reference must be required or have a default`);g=e.schema}else if(d?.kind===`object`)g={type:`object`,fields:Object.fromEntries(Object.entries(d.fields).map(([e,t])=>{let n=p(t);return[e,{schema:n.schema,required:!n.optional}]}))};else if(!s.length)g=n.inputSchema;else{let t=[...new Set(s.map(e=>e.from))],n=Object.fromEntries(t.map(e=>{let t=i.get(e),n=s.filter(t=>t.from===e),r=qC(n.map(t=>t.outcome===`failure`||t.outcome===`timeout`?iw(i.get(e).inputSchema??A(e),O(e)):O(e)));return[t.name,{schema:r,required:m.implies(c,y(n.map(e=>_.get(e.id))))}]})),r={type:`object`,fields:n},a=Object.values(n).filter(e=>e.required).length;g=e.kind===`join`||a>1?r:qC([...Object.values(n).map(e=>e.schema),...t.length>1?[r]:[]])}if(e.inputSchema&&(BC(e.inputSchema),!(t&&e.kind===`workflow`)&&!GC(g,e.inputSchema)))throw Error(`Input does not match the declared input schema`);if(e.kind===`workflow`){if(BC(e.contract.inputSchema),BC(e.contract.outputSchema),!t&&(!GC(g,e.contract.inputSchema)||e.inputSchema&&!GC(e.inputSchema,e.contract.inputSchema)))throw Error(`Input does not match the Workflow call input contract`);return e.contract.inputSchema}return e.inputSchema??g},A=e=>{let t=S.get(e);if(t)return t;if(D.has(e))throw Error(`Cyclic input schema at ${e}; declare a loop header inputSchema`);D.add(e);let n=i.get(e),r=k(n,!1);C.set(e,r);let a=r;if(u.has(e)){let t=k(n,!0);w.set(e,t),a=qC([r,t])}return S.set(e,a),D.delete(e),a};for(let e of p){e.kind===`mcp`&&kC(e.tool);let t=A(e.id);if(e.kind===`branch`){let n=WC(e.inputSchema??t,e.condition.path),r=e.condition.operator===`truthy`?`boolean`:[`greater-than`,`less-than`].includes(e.condition.operator)?`number`:void 0;if(r&&(n.optional||!GC(n.schema,{type:r})))throw Error(`Branch condition requires a required ${r}`)}O(e.id)}let j=p.map(e=>m.and(h.get(e.id),m.not(y(o.get(e.id).map(e=>_.get(e.id)))))),M=1;for(let e of p){let t=y(o.get(e.id).filter(e=>e.outcome===`failure`||e.outcome===`timeout`).map(e=>_.get(e.id)));M=m.and(M,m.or(m.not(T.get(e.id)),m.or(h.get(e.id),t))),l.length&&(M=m.and(M,m.not(y(o.get(e.id).filter(e=>d.has(e.id)).map(e=>_.get(e.id))))))}let N=p.map((e,t)=>({step:e,condition:j[t]})).filter(({condition:e})=>m.and(M,e)!==0),P=[],F=1,I=0,L=0;for(let{condition:e}of N)L=m.or(L,m.and(I,e)),I=m.or(m.and(I,m.not(e)),m.and(F,e)),F=m.and(F,m.not(e));if(l.length||n.edges.some(e=>e.outcome===`failure`||e.outcome===`timeout`)){let e=p.filter(e=>e.kind===`branch`?[`true`,`false`].some(t=>!o.get(e.id).some(e=>e.outcome===t)):!o.get(e.id).some(e=>e.outcome===`success`));P.push(...e.map(e=>O(e.id))),e.length>1&&P.push({type:`object`,fields:Object.fromEntries(e.map(e=>[e.name,{schema:O(e.id)}]))})}else{for(let{step:e,condition:t}of N)m.and(M,m.and(I,t))!==0&&P.push(O(e.id));let e=m.and(M,L);e!==0&&P.push({type:`object`,fields:Object.fromEntries(N.filter(({condition:t})=>m.and(e,t)!==0).map(({step:t,condition:n})=>[t.name,{schema:O(t.id),required:m.implies(e,n)}]))}),m.and(M,F)!==0&&P.push({type:`object`,fields:{}})}return{...E,resultSchema:P.length?qC(P):{type:`json`}}}function iw(e,t){return{type:`object`,fields:{input:{schema:e,required:!0},error:{required:!0,schema:{type:`object`,fields:{message:{schema:{type:`string`},required:!0},kind:{schema:{type:`enum`,values:[`failure`,`timeout`,`interrupted`]},required:!0}}}},partialOutput:{schema:KC(t)}}}}function aw(e,t){let n=1;for(;e.steps.some(e=>e.name===`${t}_${n}`);)n++;return`${t}_${n}`}function ow(e){return e&&typeof e==`object`&&`issues`in e&&Array.isArray(e.issues)?e.issues.map(e=>`${e.path?.map(String).join(`.`)||`Workflow`}: ${e.message}`).join(`; `):e instanceof Error?e.message:String(e)}function sw(e,t=[]){return[t,...e.type===`json`&&typeof e.schema==`object`&&e.schema.properties&&typeof e.schema.properties==`object`&&!Array.isArray(e.schema.properties)?Object.entries(e.schema.properties).flatMap(([e,n])=>sw({type:`json`,schema:n},[...t,e])):[],...e.type===`object`?Object.entries(e.fields).flatMap(([e,n])=>sw(n.schema,[...t,e])):[]]}function cw(e,t,n=`reference`,r=`mapping`){if(!e.steps.find(e=>e.id===t))return[];let i={...e,steps:e.steps.map(e=>{if(e.id!==t)return e;let n={...e};return delete n[r],delete n.inputSchema,n})},a;try{a=nw(i)}catch{let t=new Set(NC(e).loops.map(e=>e.headerId));i={...e,loopSettings:{},steps:e.steps.map(e=>{let n={...e};return delete n.inputSchema,n.mapping={kind:`reference`,reference:{source:`input`,path:[]}},t.has(e.id)?n.repeatMapping=n.mapping:delete n.repeatMapping,n.kind===`branch`&&(n.condition={operator:`equals`,path:[],value:null}),n.kind===`agent`&&!n.model&&(n.model=`unselected`),n.kind===`join`&&(delete n.mapping,delete n.repeatMapping),n})},a=nw(i)}let o=sw(e.inputSchema).map(e=>({label:`Workflow input${e.length?`.`+e.join(`.`):``}`,reference:{source:`input`,path:e}})),s=o.splice(0);for(let n of e.steps){if(n.id===t&&r===`mapping`)continue;let e=a.outputSchemas.get(n.id);if(e)for(let t of sw(e)){let e={source:`step`,stepId:n.id,path:t};s.push({label:`${n.name}${t.length?`.`+t.join(`.`):``}`,reference:e})}}for(let e of s){let{reference:a}=e;try{nw({...i,steps:i.steps.map(e=>e.id===t?{...e,[r]:n===`object`?{kind:`object`,fields:{value:a}}:{kind:`reference`,reference:a}}:e)}),o.push(e)}catch{}}return o}function lw(e,t,n){let r=e.steps.find(e=>e.id===t),i=tw(e),a=r?.kind===`mcp`?{type:`json`,schema:r.tool.inputSchema}:i.inputSchemas.get(t);if(!a)throw Error(`Select a step`);return zC(a,n)}function uw(e,t,n){if(n)return`The workflow slot is occupied`;if(e.backend!==t)return`Requires Backend Adapter ${e.backend}`;try{tw(e)}catch(e){return ow(e)}}function dw(e,t,n){if(!t||[`__proto__`,`constructor`,`prototype`].includes(t))throw Error(`Invalid field name`);return{...e,mapping:{kind:`object`,fields:{...e.mapping?.kind===`object`?e.mapping.fields:{},[t]:n}}}}var fw=e=>typeof e==`boolean`||typeof e==`object`&&e&&!Array.isArray(e)?e:!0;function pw(e,t,n=new Set){if(typeof e==`boolean`)return{};let r={...e};if(typeof e.$ref==`string`&&e.$ref.startsWith(`#/`)&&!n.has(e.$ref)){n.add(e.$ref);let i=t;for(let t of e.$ref.slice(2).split(`/`).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)))i=i&&typeof i==`object`&&!Array.isArray(i)?i[t]??!0:!0;r={...pw(fw(i),t,n),...r}}for(let i of Array.isArray(e.allOf)?e.allOf:[]){let e=pw(fw(i),t,new Set(n));r={...e,...r,properties:{...mw(e),...mw(r)},required:[...new Set([...Array.isArray(e.required)?e.required:[],...Array.isArray(r.required)?r.required:[]])]}}return r}function mw(e){return e.properties&&typeof e.properties==`object`&&!Array.isArray(e.properties)?e.properties:{}}function hw(e){if(e.kind===`reference`)return;if(e.kind===`literal`)return e.value;if(e.kind===`array`){let t=e.items.map(hw);return t.some(e=>e===void 0)?void 0:t}let t=Object.entries(e.fields).map(([e,t])=>[e,hw(t)]);return t.some(([,e])=>e===void 0)?void 0:Object.fromEntries(t)}function gw(e){return Array.isArray(e)?{kind:`array`,items:e.map(gw)}:e&&typeof e==`object`?{kind:`object`,fields:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gw(t)]))}:{kind:`literal`,value:e}}function _w(e,t=e){let n=pw(e,t);return n.default!==void 0||n.const!==void 0?gw(n.default??n.const??null):Array.isArray(n.enum)&&n.enum.length?gw(n.enum[0]):n.type===`object`||n.properties?{kind:`object`,fields:{}}:n.type===`array`?{kind:`array`,items:[]}:{kind:`literal`,value:n.type===`null`?null:n.type===`boolean`?!1:n.type===`number`||n.type===`integer`?0:``}}function vw(e,t,n){let r=[],i=n&&typeof n==`object`&&!Array.isArray(n)?n:{};if(e.if!==void 0&&n!==void 0){let i=!1;try{let r=fw(e.if);DC(typeof r==`boolean`?r:{...typeof t==`object`&&t.$defs?{$defs:t.$defs}:{},...typeof t==`object`&&t.definitions?{definitions:t.definitions}:{},...r},n),i=!0}catch{}r.push(fw(i?e.then:e.else))}for(let t of[`dependentSchemas`,`dependencies`]){let n=e[t];if(n&&typeof n==`object`&&!Array.isArray(n))for(let[e,t]of Object.entries(n))Object.hasOwn(i,e)&&!Array.isArray(t)&&r.push(fw(t))}return r.reduce((e,n)=>{let r=pw(n,t);return{...e,...r,properties:{...mw(e),...mw(r)},required:[...new Set([...Array.isArray(e.required)?e.required:[],...Array.isArray(r.required)?r.required:[]])]}},e)}function yw(e,t){return fw(Array.isArray(e.prefixItems)?e.prefixItems[t]??e.items:Array.isArray(e.items)?e.items[t]??e.additionalItems:e.items)}function bw({schema:e,root:t=e,template:n,onChange:r,choices:i=[],label:a=`Arguments`,depth:o=0}){let[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(0),d=vw(pw(e,t),t,hw(n)),f=Array.isArray(d.oneOf)?d.oneOf:Array.isArray(d.anyOf)?d.anyOf:Array.isArray(d.type)?d.type.map(e=>({type:e})):[],p=f.length?pw(fw(f[l]),t):{},m={...d,...p,properties:{...mw(d),...mw(p)}},h=mw(m),g=hw(n),_=n.kind===`object`?`object`:n.kind===`array`?`array`:g===null?`null`:typeof g,v=(e,n,r,a)=>(0,U.jsx)(bw,{schema:e,root:t,template:n,onChange:r,choices:i,label:a,depth:o+1});return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:a}),typeof m.description==`string`&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m.description}),i.length>0&&(0,U.jsxs)(At,{value:n.kind===`reference`?JSON.stringify(n.reference):`literal`,onValueChange:n=>{if(n===`literal`)r(_w(e,t));else{let e=i.find(e=>JSON.stringify(e.reference)===n);e&&r({kind:`reference`,reference:e.reference})}},children:[(0,U.jsx)(Lt,{"aria-label":`${a} source`,children:(0,U.jsx)(vt,{children:n.kind===`reference`?i.find(e=>JSON.stringify(e.reference)===JSON.stringify(n.reference))?.label??`Unavailable reference`:`Literal value`})}),(0,U.jsxs)(Ft,{children:[(0,U.jsx)(ht,{value:`literal`,children:`Literal value`}),i.map(e=>(0,U.jsx)(ht,{value:JSON.stringify(e.reference),children:e.label},e.label))]})]}),n.kind!==`reference`&&(0,U.jsxs)(U.Fragment,{children:[f.length>0&&(0,U.jsxs)(At,{value:l,onValueChange:e=>{e!==null&&(u(e),r(_w(fw(f[e]),t)))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} variant`,children:(0,U.jsxs)(vt,{children:[`Variant `,l+1]})}),(0,U.jsx)(Ft,{children:f.map((e,t)=>(0,U.jsxs)(ht,{value:t,children:[`Variant `,t+1]},t))})]}),(0,U.jsxs)(At,{value:_,onValueChange:e=>{e&&r(_w({type:e}))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} JSON type`,children:(0,U.jsx)(vt,{children:_})}),(0,U.jsx)(Ft,{children:[`object`,`array`,`string`,`number`,`boolean`,`null`].map(e=>(0,U.jsx)(ht,{value:e,children:e},e))})]}),Array.isArray(m.enum)&&(0,U.jsxs)(At,{value:JSON.stringify(g),onValueChange:e=>{e&&r(gw(JSON.parse(e)))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} enum`,children:(0,U.jsx)(vt,{children:JSON.stringify(g)})}),(0,U.jsx)(Ft,{children:m.enum.map((e,t)=>(0,U.jsx)(ht,{value:JSON.stringify(e),children:JSON.stringify(e)},t))})]}),n.kind===`object`&&(0,U.jsxs)(U.Fragment,{children:[[...new Set([...Object.keys(h),...Object.keys(n.fields)])].map(e=>{let i=Object.hasOwn(n.fields,e)?n.fields[e]:void 0,o=m.patternProperties&&typeof m.patternProperties==`object`&&!Array.isArray(m.patternProperties)?Object.entries(m.patternProperties).filter(([t])=>{try{return new RegExp(t).test(e)}catch{return!1}}).map(([,e])=>e):[],s=fw(Object.hasOwn(h,e)?h[e]:o.length?{allOf:o}:m.additionalProperties);return(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{"aria-label":`Include ${a}.${e}`,checked:!!i,onCheckedChange:i=>{let a={...n.fields};i?a[e]=_w(s,t):delete a[e],r({kind:`object`,fields:a})}}),e,Array.isArray(m.required)&&m.required.includes(e)?` *`:``]}),i&&v(s,i,t=>r({kind:`object`,fields:{...n.fields,[e]:t}}),`${a}.${e}`)]},e)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(he,{"aria-label":`${a} new property`,placeholder:`Additional property name`,value:s,onChange:e=>c(e.target.value)}),(0,U.jsx)(O,{variant:`outline`,size:`sm`,disabled:!s||[`__proto__`,`constructor`,`prototype`].includes(s),onClick:()=>{r({kind:`object`,fields:{...n.fields,[s]:_w(fw(m.additionalProperties),t)}}),c(``)},children:`Add property`})]})]}),n.kind===`array`&&(0,U.jsxs)(U.Fragment,{children:[n.items.map((e,t)=>(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[v(yw(m,t),e,e=>r({kind:`array`,items:n.items.map((n,r)=>r===t?e:n)}),`${a}[${t}]`),(0,U.jsx)(O,{size:`sm`,variant:`outline`,onClick:()=>r({kind:`array`,items:n.items.filter((e,n)=>n!==t)}),children:`Remove item`})]},t)),(0,U.jsx)(O,{size:`sm`,variant:`outline`,onClick:()=>{let e=n.items.length;r({kind:`array`,items:[...n.items,_w(yw(m,e),t)]})},children:`Add item`})]}),n.kind===`literal`&&_===`boolean`&&(0,U.jsx)(zt,{"aria-label":a,checked:g===!0,onCheckedChange:e=>r({kind:`literal`,value:e})}),n.kind===`literal`&&(_===`string`||_===`number`)&&(0,U.jsx)(he,{"aria-label":a,type:_===`number`?`number`:`text`,value:g,onChange:e=>r({kind:`literal`,value:_===`number`?Number(e.target.value):e.target.value})})]}),(0,U.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,U.jsx)(`summary`,{children:`Original schema and constraints`}),(0,U.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e,null,2)})]})]})}function xw({schema:e,value:t,onChange:n,label:r}){return(0,U.jsx)(bw,{schema:e,template:gw(t),label:r,onChange:e=>{let t=hw(e);t!==void 0&&n(t)}})}function Sw(e){return e===`object`?{type:e,fields:{}}:e===`array`?{type:e,items:{type:`string`}}:e===`enum`?{type:e,values:[`value`]}:e===`union`?{type:e,variants:[{type:`string`}]}:{type:e}}function Cw(e){switch(e.type){case`json`:return{};case`null`:return null;case`object`:return Object.fromEntries(Object.entries(e.fields).filter(([,e])=>e.required||e.default!==void 0).map(([e,t])=>[e,t.default??Cw(t.schema)]));case`array`:return[];case`number`:return 0;case`boolean`:return!1;case`enum`:return e.values[0]??``;case`union`:return Cw(e.variants[0]);default:return``}}function ww({schema:e,value:t,onChange:n,onClear:r,label:i=`Value`}){let[a,o]=(0,H.useState)(0);if(e.type===`json`)return(0,U.jsx)(xw,{schema:e.schema??!0,value:t??null,label:i,onChange:n});if(e.type===`null`)return(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`null`});if(e.type===`object`){let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{};return(0,U.jsx)(`div`,{className:`grid gap-3`,children:Object.entries(e.fields).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[e,t.required?` *`:``]}),!t.required&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{"aria-label":`Include ${e}`,checked:Object.hasOwn(r,e),onCheckedChange:i=>{let a={...r};i?a[e]=t.default??Cw(t.schema):delete a[e],n(a)}}),`Include`]}),(0,U.jsx)(ww,{schema:t.schema,label:i===`Value`?e:`${i}.${e}`,value:r[e]??t.default,onClear:()=>{let t={...r};delete t[e],n(t)},onChange:t=>n({...r,[e]:t})})]},e))})}return e.type===`array`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(Array.isArray(t)?t:[]).map((r,a)=>(0,U.jsxs)(`div`,{className:`grid gap-2 rounded-lg border p-3`,children:[(0,U.jsx)(ww,{schema:e.items,label:`${i} item ${a+1}`,value:r,onChange:e=>n(t.map((t,n)=>n===a?e:t))}),(0,U.jsx)(O,{size:`sm`,variant:`destructive`,className:`justify-self-start`,onClick:()=>n(t.filter((e,t)=>t!==a)),children:`Remove item`})]},a)),(0,U.jsx)(O,{size:`sm`,variant:`outline`,className:`justify-self-start`,onClick:()=>n([...Array.isArray(t)?t:[],Cw(e.items)]),children:`Add item`})]}):e.type===`union`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(At,{value:a,onValueChange:t=>{t!==null&&(o(t),n(Cw(e.variants[t])))},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":i===`Value`?`Input variant`:`${i} variant`,children:(0,U.jsx)(vt,{children:`Variant ${a+1}: ${e.variants[a]?.type??``}`})}),(0,U.jsx)(Ft,{children:e.variants.map((e,t)=>(0,U.jsxs)(ht,{value:t,children:[`Variant `,t+1,`: `,e.type]},t))})]}),(0,U.jsx)(ww,{schema:e.variants[a]??e.variants[0],label:i,value:t,onChange:n})]}):e.type===`boolean`?(0,U.jsx)(zt,{"aria-label":i,checked:t===!0,onCheckedChange:n}):e.type===`enum`?(0,U.jsxs)(At,{value:typeof t==`string`?t:``,onValueChange:e=>{e!==null&&n(e)},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":i,children:(0,U.jsx)(vt,{children:typeof t==`string`&&t?t:`Select`})}),(0,U.jsxs)(Ft,{children:[!e.values.includes(``)&&(0,U.jsx)(ht,{value:``,children:`Select`}),e.values.map(e=>(0,U.jsx)(ht,{value:e,children:e||`Empty string`},e))]})]}):(0,U.jsx)(he,{"aria-label":i,type:e.type===`number`?`number`:`text`,value:typeof t==`string`||typeof t==`number`?t:``,onChange:t=>e.type===`number`&&t.target.value===``&&r?r():n(e.type===`number`?t.target.value===``?null:Number(t.target.value):t.target.value)})}function Tw({schema:e,onChange:t,root:n=!1}){return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Schema`}),!n&&(0,U.jsxs)(At,{value:e.type,onValueChange:e=>{e!==null&&t(Sw(e))},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":`Schema type`,children:(0,U.jsx)(vt,{children:e.type})}),(0,U.jsx)(Ft,{children:[`object`,`array`,`string`,`number`,`boolean`,`enum`,`json`,`null`].map(e=>(0,U.jsx)(ht,{value:e,children:e},e))})]}),e.type===`enum`&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Values (one per line)`}),(0,U.jsx)(Do,{value:e.values.join(`
138
+ deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),zy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),By=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jv(),n=X(),r=Vv(),i=Z();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),Vy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ey(),n=Jv(),r=Z(),i=By();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),Hy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Jv(),n=X(),r=Z(),i=Z();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),Uy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),Wy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Jv().validateUnion,error:{message:`must match a schema in anyOf`}}})),Gy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),Ky=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),qy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Jy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Yy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ny(),n=Fy(),r=Py(),i=Iy(),a=Ly(),o=Ry(),s=zy(),c=By(),l=Vy(),u=Hy(),d=Uy(),f=Wy(),p=Gy(),m=Ky(),h=qy(),g=Jy();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),Xy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Zy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[Xy().default]})),Qy=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),$y=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yy(),n=My(),r=Yy(),i=Zy(),a=Qy();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),eb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),tb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=eb(),r=ry(),i=ny(),a=Z();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),nb=r({$id:()=>ib,$schema:()=>rb,default:()=>lb,definitions:()=>ob,properties:()=>cb,title:()=>ab,type:()=>sb}),rb,ib,ab,ob,sb,cb,lb,ub=n((()=>{rb=`http://json-schema.org/draft-07/schema#`,ib=`http://json-schema.org/draft-07/schema#`,ab=`Core schema meta-schema`,ob={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},sb=[`object`,`boolean`],cb={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},lb={$schema:rb,$id:ib,title:ab,definitions:ob,type:sb,properties:cb,default:!0}})),db=i(((e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=gy(),i=$y(),a=tb(),o=(ub(),t(nb).default),s=[`/properties`],c=`http://json-schema.org/draft-07/schema`,l=class extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(e,c,!1),this.refs[`http://json-schema.org/schema`]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=l,n.exports=e=l,n.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var u=ey();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=ty();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=ny();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),fb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;var t=X(),n=Vv(),r=ry(),i=vy(),a={keyword:`$dynamicAnchor`,schemaType:`string`,code:e=>o(e,e.schema)};function o(e,r){let{gen:i,it:a}=e;a.schemaEnv.root.dynamicAnchors[r]=!0;let o=(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(r)}`,c=a.errSchemaPath===`#`?a.validateName:s(e);i.if((0,t._)`!${o}`,()=>i.assign(o,c))}e.dynamicAnchor=o;function s(e){let{schemaEnv:t,schema:n,self:a}=e.it,{root:o,baseId:s,localRefs:c,meta:l}=t.root,{schemaId:u}=a.opts,d=new r.SchemaEnv({schema:n,schemaId:u,root:o,baseId:s,localRefs:c,meta:l});return r.compileSchema.call(a,d),(0,i.getValidate)(e,d)}e.default=a})),pb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;var t=X(),n=Vv(),r=vy(),i={keyword:`$dynamicRef`,schemaType:`string`,code:e=>a(e,e.schema)};function a(e,i){let{gen:a,keyword:o,it:s}=e;if(i[0]!==`#`)throw Error(`"${o}" only supports hash fragment reference`);let c=i.slice(1);if(s.allErrors)l();else{let t=a.let(`valid`,!1);l(t),e.ok(t)}function l(e){if(s.schemaEnv.root.dynamicAnchors[c]){let r=a.let(`_v`,(0,t._)`${n.default.dynamicAnchors}${(0,t.getProperty)(c)}`);a.if(r,u(r,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,n){return n?()=>a.block(()=>{(0,r.callRef)(e,t),a.let(n,!0)}):()=>(0,r.callRef)(e,t)}}e.dynamicRef=a,e.default=i})),mb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fb(),n=Z();e.default={keyword:`$recursiveAnchor`,schemaType:`boolean`,code(e){e.schema?(0,t.dynamicAnchor)(e,``):(0,n.checkStrictMode)(e.it,`$recursiveAnchor: false is ignored`)}}})),hb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=pb();e.default={keyword:`$recursiveRef`,schemaType:`string`,code:e=>(0,t.dynamicRef)(e,e.schema)}})),gb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fb(),n=pb(),r=mb(),i=hb();e.default=[t.default,n.default,r.default,i.default]})),_b=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ry();e.default={keyword:`dependentRequired`,type:`object`,schemaType:`object`,error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}})),vb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Ry();e.default={keyword:`dependentSchemas`,type:`object`,schemaType:`object`,code:e=>(0,t.validateSchemaDeps)(e)}})),yb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Z();e.default={keyword:[`maxContains`,`minContains`],type:`array`,schemaType:`number`,code({keyword:e,parentSchema:n,it:r}){n.contains===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}}})),bb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=_b(),n=vb(),r=yb();e.default=[t.default,n.default,r.default]})),xb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z(),r=Vv();e.default={keyword:`unevaluatedProperties`,type:`object`,schemaType:[`boolean`,`object`],trackErrors:!0,error:{message:`must NOT have unevaluated properties`,params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:a,data:o,errsCount:s,it:c}=e;if(!s)throw Error(`ajv implementation error`);let{allErrors:l,props:u}=c;u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn(`key`,o,e=>i.if(f(u,e),()=>d(e)))):u!==!0&&i.forIn(`key`,o,e=>u===void 0?d(e):i.if(p(u,e),()=>d(e))),c.props=!0,e.ok((0,t._)`${s} === ${r.default.errors}`);function d(r){if(a===!1){e.setParams({unevaluatedProperty:r}),e.error(),l||i.break();return}if(!(0,n.alwaysValidSchema)(c,a)){let a=i.name(`valid`);e.subschema({keyword:`unevaluatedProperties`,dataProp:r,dataPropType:n.Type.Str},a),l||i.if((0,t.not)(a),()=>i.break())}}function f(e,n){return(0,t._)`!${e} || !${e}[${n}]`}function p(e,n){let r=[];for(let i in e)e[i]===!0&&r.push((0,t._)`${n} !== ${i}`);return(0,t.and)(...r)}}}})),Sb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=X(),n=Z();e.default={keyword:`unevaluatedItems`,type:`array`,schemaType:[`boolean`,`object`],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e,s=o.items||0;if(s===!0)return;let c=r.const(`len`,(0,t._)`${a}.length`);if(i===!1)e.setParams({len:s}),e.fail((0,t._)`${c} > ${s}`);else if(typeof i==`object`&&!(0,n.alwaysValidSchema)(o,i)){let n=r.var(`valid`,(0,t._)`${c} <= ${s}`);r.if((0,t.not)(n),()=>l(n,s)),e.ok(n)}o.items=!0;function l(i,a){r.forRange(`i`,a,c,a=>{e.subschema({keyword:`unevaluatedItems`,dataProp:a,dataPropType:n.Type.Num},i),o.allErrors||r.if((0,t.not)(i),()=>r.break())})}}}})),Cb=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=xb(),n=Sb();e.default=[t.default,n.default]})),wb=r({$id:()=>Eb,$recursiveAnchor:()=>!0,$schema:()=>Tb,$vocabulary:()=>Db,allOf:()=>kb,default:()=>Mb,properties:()=>jb,title:()=>Ob,type:()=>Ab}),Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb=n((()=>{Tb=`https://json-schema.org/draft/2019-09/schema`,Eb=`https://json-schema.org/draft/2019-09/schema`,Db={"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},Ob=`Core and Validation specifications meta-schema`,kb=[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format`},{$ref:`meta/content`}],Ab=[`object`,`boolean`],jb={definitions:{$comment:`While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.`,type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},dependencies:{$comment:`"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"`,type:`object`,additionalProperties:{anyOf:[{$recursiveRef:`#`},{$ref:`meta/validation#/$defs/stringArray`}]}}},Mb={$schema:Tb,$id:Eb,$vocabulary:Db,$recursiveAnchor:!0,title:Ob,allOf:kb,type:Ab,properties:jb}})),Pb=r({$defs:()=>Vb,$id:()=>Ib,$recursiveAnchor:()=>!0,$schema:()=>Fb,$vocabulary:()=>Lb,default:()=>Hb,properties:()=>Bb,title:()=>Rb,type:()=>zb}),Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub=n((()=>{Fb=`https://json-schema.org/draft/2019-09/schema`,Ib=`https://json-schema.org/draft/2019-09/meta/applicator`,Lb={"https://json-schema.org/draft/2019-09/vocab/applicator":!0},Rb=`Applicator vocabulary meta-schema`,zb=[`object`,`boolean`],Bb={additionalItems:{$recursiveRef:`#`},unevaluatedItems:{$recursiveRef:`#`},items:{anyOf:[{$recursiveRef:`#`},{$ref:`#/$defs/schemaArray`}]},contains:{$recursiveRef:`#`},additionalProperties:{$recursiveRef:`#`},unevaluatedProperties:{$recursiveRef:`#`},properties:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$recursiveRef:`#`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$recursiveRef:`#`}},propertyNames:{$recursiveRef:`#`},if:{$recursiveRef:`#`},then:{$recursiveRef:`#`},else:{$recursiveRef:`#`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$recursiveRef:`#`}},Vb={schemaArray:{type:`array`,minItems:1,items:{$recursiveRef:`#`}}},Hb={$schema:Fb,$id:Ib,$vocabulary:Lb,$recursiveAnchor:!0,title:Rb,type:zb,properties:Bb,$defs:Vb}})),Wb=r({$id:()=>Kb,$recursiveAnchor:()=>!0,$schema:()=>Gb,$vocabulary:()=>qb,default:()=>Zb,properties:()=>Xb,title:()=>Jb,type:()=>Yb}),Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb=n((()=>{Gb=`https://json-schema.org/draft/2019-09/schema`,Kb=`https://json-schema.org/draft/2019-09/meta/content`,qb={"https://json-schema.org/draft/2019-09/vocab/content":!0},Jb=`Content vocabulary meta-schema`,Yb=[`object`,`boolean`],Xb={contentMediaType:{type:`string`},contentEncoding:{type:`string`},contentSchema:{$recursiveRef:`#`}},Zb={$schema:Gb,$id:Kb,$vocabulary:qb,$recursiveAnchor:!0,title:Jb,type:Yb,properties:Xb}})),$b=r({$id:()=>tx,$recursiveAnchor:()=>!0,$schema:()=>ex,$vocabulary:()=>nx,default:()=>ox,properties:()=>ax,title:()=>rx,type:()=>ix}),ex,tx,nx,rx,ix,ax,ox,sx=n((()=>{ex=`https://json-schema.org/draft/2019-09/schema`,tx=`https://json-schema.org/draft/2019-09/meta/core`,nx={"https://json-schema.org/draft/2019-09/vocab/core":!0},rx=`Core vocabulary meta-schema`,ix=[`object`,`boolean`],ax={$id:{type:`string`,format:`uri-reference`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{type:`string`,format:`uri`},$anchor:{type:`string`,pattern:`^[A-Za-z][-A-Za-z0-9.:_]*$`},$ref:{type:`string`,format:`uri-reference`},$recursiveRef:{type:`string`,format:`uri-reference`},$recursiveAnchor:{type:`boolean`,default:!1},$vocabulary:{type:`object`,propertyNames:{type:`string`,format:`uri`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}}},ox={$schema:ex,$id:tx,$vocabulary:nx,$recursiveAnchor:!0,title:rx,type:ix,properties:ax}})),cx=r({$id:()=>ux,$recursiveAnchor:()=>!0,$schema:()=>lx,$vocabulary:()=>dx,default:()=>hx,properties:()=>mx,title:()=>fx,type:()=>px}),lx,ux,dx,fx,px,mx,hx,gx=n((()=>{lx=`https://json-schema.org/draft/2019-09/schema`,ux=`https://json-schema.org/draft/2019-09/meta/format`,dx={"https://json-schema.org/draft/2019-09/vocab/format":!0},fx=`Format vocabulary meta-schema`,px=[`object`,`boolean`],mx={format:{type:`string`}},hx={$schema:lx,$id:ux,$vocabulary:dx,$recursiveAnchor:!0,title:fx,type:px,properties:mx}})),_x=r({$id:()=>yx,$recursiveAnchor:()=>!0,$schema:()=>vx,$vocabulary:()=>bx,default:()=>wx,properties:()=>Cx,title:()=>xx,type:()=>Sx}),vx,yx,bx,xx,Sx,Cx,wx,Tx=n((()=>{vx=`https://json-schema.org/draft/2019-09/schema`,yx=`https://json-schema.org/draft/2019-09/meta/meta-data`,bx={"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},xx=`Meta-data vocabulary meta-schema`,Sx=[`object`,`boolean`],Cx={title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}},wx={$schema:vx,$id:yx,$vocabulary:bx,$recursiveAnchor:!0,title:xx,type:Sx,properties:Cx}})),Ex=r({$defs:()=>Nx,$id:()=>Ox,$recursiveAnchor:()=>!0,$schema:()=>Dx,$vocabulary:()=>kx,default:()=>Px,properties:()=>Mx,title:()=>Ax,type:()=>jx}),Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx=n((()=>{Dx=`https://json-schema.org/draft/2019-09/schema`,Ox=`https://json-schema.org/draft/2019-09/meta/validation`,kx={"https://json-schema.org/draft/2019-09/vocab/validation":!0},Ax=`Validation vocabulary meta-schema`,jx=[`object`,`boolean`],Mx={multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]}},Nx={nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},Px={$schema:Dx,$id:Ox,$vocabulary:kx,$recursiveAnchor:!0,title:Ax,type:jx,properties:Mx,$defs:Nx}})),Ix=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var n=(Nb(),t(wb).default),r=(Ub(),t(Pb).default),i=(Qb(),t(Wb).default),a=(sx(),t($b).default),o=(gx(),t(cx).default),s=(Tx(),t(_x).default),c=(Fx(),t(Ex).default),l=[`/properties`];function u(e){return[n,r,i,a,t(this,o),s,t(this,c)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function t(t,n){return e?t.$dataMetaSchema(n,l):n}}e.default=u})),Lx=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;var n=gy(),r=$y(),i=gb(),a=bb(),o=Cb(),s=tb(),c=Ix(),l=`https://json-schema.org/draft/2019-09/schema`,u=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),r.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(a.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(c.default.call(this,e),this.refs[`http://json-schema.org/schema`]=l)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=ey();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var f=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var p=ty();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var m=ny();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),Rx=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=yy(),n=My(),r=Yy(),i=gb(),a=bb(),o=Cb(),s=Zy(),c=Qy();e.default=[i.default,t.default,n.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,a.default,o.default]})),zx=r({$comment:()=>qx,$dynamicAnchor:()=>Ux,$id:()=>Vx,$schema:()=>Bx,$vocabulary:()=>Hx,allOf:()=>Gx,default:()=>Yx,properties:()=>Jx,title:()=>Wx,type:()=>Kx}),Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx=n((()=>{Bx=`https://json-schema.org/draft/2020-12/schema`,Vx=`https://json-schema.org/draft/2020-12/schema`,Hx={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},Ux=`meta`,Wx=`Core and Validation specifications meta-schema`,Gx=[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],Kx=[`object`,`boolean`],qx=`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,Jx={definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}},Yx={$schema:Bx,$id:Vx,$vocabulary:Hx,$dynamicAnchor:Ux,title:Wx,allOf:Gx,type:Kx,$comment:qx,properties:Jx}})),Zx=r({$defs:()=>aS,$dynamicAnchor:()=>tS,$id:()=>$x,$schema:()=>Qx,$vocabulary:()=>eS,default:()=>oS,properties:()=>iS,title:()=>nS,type:()=>rS}),Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS=n((()=>{Qx=`https://json-schema.org/draft/2020-12/schema`,$x=`https://json-schema.org/draft/2020-12/meta/applicator`,eS={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},tS=`meta`,nS=`Applicator vocabulary meta-schema`,rS=[`object`,`boolean`],iS={prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},aS={schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}},oS={$schema:Qx,$id:$x,$vocabulary:eS,$dynamicAnchor:tS,title:nS,type:rS,properties:iS,$defs:aS}})),cS=r({$dynamicAnchor:()=>fS,$id:()=>uS,$schema:()=>lS,$vocabulary:()=>dS,default:()=>gS,properties:()=>hS,title:()=>pS,type:()=>mS}),lS,uS,dS,fS,pS,mS,hS,gS,_S=n((()=>{lS=`https://json-schema.org/draft/2020-12/schema`,uS=`https://json-schema.org/draft/2020-12/meta/unevaluated`,dS={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},fS=`meta`,pS=`Unevaluated applicator vocabulary meta-schema`,mS=[`object`,`boolean`],hS={unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}},gS={$schema:lS,$id:uS,$vocabulary:dS,$dynamicAnchor:fS,title:pS,type:mS,properties:hS}})),vS=r({$dynamicAnchor:()=>SS,$id:()=>bS,$schema:()=>yS,$vocabulary:()=>xS,default:()=>ES,properties:()=>TS,title:()=>CS,type:()=>wS}),yS,bS,xS,SS,CS,wS,TS,ES,DS=n((()=>{yS=`https://json-schema.org/draft/2020-12/schema`,bS=`https://json-schema.org/draft/2020-12/meta/content`,xS={"https://json-schema.org/draft/2020-12/vocab/content":!0},SS=`meta`,CS=`Content vocabulary meta-schema`,wS=[`object`,`boolean`],TS={contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}},ES={$schema:yS,$id:bS,$vocabulary:xS,$dynamicAnchor:SS,title:CS,type:wS,properties:TS}})),OS=r({$defs:()=>IS,$dynamicAnchor:()=>MS,$id:()=>AS,$schema:()=>kS,$vocabulary:()=>jS,default:()=>LS,properties:()=>FS,title:()=>NS,type:()=>PS}),kS,AS,jS,MS,NS,PS,FS,IS,LS,RS=n((()=>{kS=`https://json-schema.org/draft/2020-12/schema`,AS=`https://json-schema.org/draft/2020-12/meta/core`,jS={"https://json-schema.org/draft/2020-12/vocab/core":!0},MS=`meta`,NS=`Core vocabulary meta-schema`,PS=[`object`,`boolean`],FS={$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},IS={anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}},LS={$schema:kS,$id:AS,$vocabulary:jS,$dynamicAnchor:MS,title:NS,type:PS,properties:FS,$defs:IS}})),zS=r({$dynamicAnchor:()=>US,$id:()=>VS,$schema:()=>BS,$vocabulary:()=>HS,default:()=>qS,properties:()=>KS,title:()=>WS,type:()=>GS}),BS,VS,HS,US,WS,GS,KS,qS,JS=n((()=>{BS=`https://json-schema.org/draft/2020-12/schema`,VS=`https://json-schema.org/draft/2020-12/meta/format-annotation`,HS={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},US=`meta`,WS=`Format vocabulary meta-schema for annotation results`,GS=[`object`,`boolean`],KS={format:{type:`string`}},qS={$schema:BS,$id:VS,$vocabulary:HS,$dynamicAnchor:US,title:WS,type:GS,properties:KS}})),YS=r({$dynamicAnchor:()=>$S,$id:()=>ZS,$schema:()=>XS,$vocabulary:()=>QS,default:()=>rC,properties:()=>nC,title:()=>eC,type:()=>tC}),XS,ZS,QS,$S,eC,tC,nC,rC,iC=n((()=>{XS=`https://json-schema.org/draft/2020-12/schema`,ZS=`https://json-schema.org/draft/2020-12/meta/meta-data`,QS={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$S=`meta`,eC=`Meta-data vocabulary meta-schema`,tC=[`object`,`boolean`],nC={title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}},rC={$schema:XS,$id:ZS,$vocabulary:QS,$dynamicAnchor:$S,title:eC,type:tC,properties:nC}})),aC=r({$defs:()=>pC,$dynamicAnchor:()=>lC,$id:()=>sC,$schema:()=>oC,$vocabulary:()=>cC,default:()=>mC,properties:()=>fC,title:()=>uC,type:()=>dC}),oC,sC,cC,lC,uC,dC,fC,pC,mC,hC=n((()=>{oC=`https://json-schema.org/draft/2020-12/schema`,sC=`https://json-schema.org/draft/2020-12/meta/validation`,cC={"https://json-schema.org/draft/2020-12/vocab/validation":!0},lC=`meta`,uC=`Validation vocabulary meta-schema`,dC=[`object`,`boolean`],fC={type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},pC={nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},mC={$schema:oC,$id:sC,$vocabulary:cC,$dynamicAnchor:lC,title:uC,type:dC,properties:fC,$defs:pC}})),gC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var n=(Xx(),t(zx).default),r=(sS(),t(Zx).default),i=(_S(),t(cS).default),a=(DS(),t(vS).default),o=(RS(),t(OS).default),s=(JS(),t(zS).default),c=(iC(),t(YS).default),l=(hC(),t(aC).default),u=[`/properties`];function d(e){return[n,r,i,a,o,t(this,s),c,t(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function t(t,n){return e?t.$dataMetaSchema(n,u):n}}e.default=d})),_C=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;var n=gy(),r=Rx(),i=tb(),a=gC(),o=`https://json-schema.org/draft/2020-12/schema`,s=class extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs[`http://json-schema.org/schema`]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var c=ey();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=X();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var u=ty();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=ny();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})})),vC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:E,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function E(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),yC=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=db(),n=X(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),bC=i(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=vC(),r=yC(),i=X(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),xC=db(),SC=Lx(),CC=_C(),wC=e(bC(),1),TC=[`example`,`externalDocs`,`xml`,`markdownDescription`,`enumDescriptions`,`enumNames`,`enumTitles`];function EC(e,t=new Set){if(e&&typeof e==`object`)for(let[n,r]of Object.entries(e))n.startsWith(`x-`)&&t.add(n),EC(r,t);return t}function DC(e,t){let n=new e({strict:!0,strictTypes:!1,strictTuples:!1,strictRequired:!1,allowUnionTypes:!0,allErrors:!0});(0,wC.default)(n);for(let e of[...TC,...EC(t)])n.addKeyword({keyword:e,valid:!0});return n}var OC=new Map;function kC(e){let t=JSON.stringify(e),n=OC.get(t);if(n)return n;let r=typeof e==`object`?e.$schema:void 0,i=DC(typeof r==`string`&&r.includes(`draft-07`)?xC.Ajv:typeof r==`string`&&r.includes(`2019-09`)?SC.Ajv2019:CC.Ajv2020,e);try{let n=i.compile(e);if(`$async`in n)throw Error(`Asynchronous schemas are not supported`);return OC.size>=200&&OC.clear(),OC.set(t,n),n}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`MCP JSON Schema cannot be validated: ${t}. Reconfigure the tool schema (supported dialects: draft-07, 2019-09, 2020-12). No validation was skipped.`)}}function AC(e,t){let n=kC(e);if(!n(t))throw Error(`MCP schema validation failed: `+(n.errors??[]).map(e=>`${e.instancePath||`/`} ${e.keyword}`).join(`; `))}function jC(e,t){if(!t.length||typeof e==`boolean`)return e;let[n,...r]=t,i=e.properties,a=i&&typeof i==`object`&&!Array.isArray(i)?i[n]:void 0;return a!==void 0&&(typeof a==`boolean`||a&&typeof a==`object`&&!Array.isArray(a))?jC(a,r):!0}function MC(e){for(let t of[`inputSchema`,`outputSchema`]){let n=e[t];if(n!==void 0)try{kC(n)}catch(n){throw Error(`MCP tool ${JSON.stringify(e.toolName)} ${t}: ${n instanceof Error?n.message:String(n)}`)}}}var NC=Rv();Y({structuredContent:NC,content:$_(Y({type:J()}).catchall(NC))}).strict();function PC(e){return typeof e==`string`&&/^[A-Za-z_][A-Za-z0-9_-]{0,127}$/.test(e)&&![`__proto__`,`constructor`,`prototype`].includes(e)}var FC=class{nodes=[{variable:1/0,choices:[]},{variable:1/0,choices:[]}];unique=new Map;cache=new Map;outcome(e,t){return this.node(e,Array.from({length:5},(e,n)=>Number(n===t)))}and(e,t){return this.apply(`and`,e,t)}or(e,t){return this.apply(`or`,e,t)}not(e){if(e<2)return 1-e;let t=`not:${e}`,n=this.cache.get(t);if(n!==void 0)return n;let r=this.nodes[e],i=this.node(r.variable,r.choices.map(e=>this.not(e)));return this.cache.set(t,i),i}implies(e,t){return this.and(e,this.not(t))===0}node(e,t){if(t.every(e=>e===t[0]))return t[0];let n=`${e}:${t.join(`,`)}`,r=this.unique.get(n);if(r!==void 0)return r;let i=this.nodes.length;return this.nodes.push({variable:e,choices:t}),this.unique.set(n,i),i}apply(e,t,n){if(t===n)return t;if(e===`and`){if(t===0||n===0)return 0;if(t===1)return n;if(n===1)return t}else{if(t===1||n===1)return 1;if(t===0)return n;if(n===0)return t}let r=`${e}:${Math.min(t,n)}:${Math.max(t,n)}`,i=this.cache.get(r);if(i!==void 0)return i;let a=this.nodes[t],o=this.nodes[n],s=Math.min(a.variable,o.variable),c=this.node(s,Array.from({length:5},(r,i)=>this.apply(e,a.variable===s?a.choices[i]:t,o.variable===s?o.choices[i]:n)));return this.cache.set(r,c),c}};function IC(e){let t=e.steps.map(e=>e.id),n=new Set(t);if(n.size!==t.length)throw Error(`Step IDs must be unique`);if(new Set(e.edges.map(e=>e.id)).size!==e.edges.length)throw Error(`Edge IDs must be unique`);let r=new Map(t.map(e=>[e,[]])),i=new Map(t.map(e=>[e,[]]));for(let t of e.edges){if(!n.has(t.from)||!n.has(t.to))throw Error(`Unknown edge endpoint`);r.get(t.to).push(t),i.get(t.from).push(t)}let a=t.filter(e=>!r.get(e).length),o=new Set(a),s=[...a];for(let e=0;e<s.length;e++)for(let t of i.get(s[e]))o.has(t.to)||(o.add(t.to),s.push(t.to));if(o.size!==n.size)throw Error(`Workflow cycle has no entry from a root`);let c=new Map(t.map(e=>[e,new Set(a.includes(e)?[e]:t)])),l=!0;for(;l;){l=!1;for(let e of s){let t=r.get(e);if(!t.length)continue;let n=new Set([...c.get(t[0].from)].filter(e=>t.every(t=>c.get(t.from).has(e))));n.add(e);let i=c.get(e);(n.size!==i.size||[...n].some(e=>!i.has(e)))&&(c.set(e,n),l=!0)}}let u=e.edges.filter(e=>c.get(e.from).has(e.to)),d=new Set(u.map(e=>e.id)),f=new Map;for(let e of u){let t=f.get(e.to)??new Set([e.to]),n=[e.from];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),n.push(...r.get(e).map(e=>e.from)))}f.set(e.to,t)}let p=[...f].map(([n,r])=>({headerId:n,memberIds:t.filter(e=>r.has(e)),backEdgeIds:u.filter(e=>e.to===n).map(e=>e.id),entryEdgeIds:e.edges.filter(e=>!r.has(e.from)&&r.has(e.to)).map(e=>e.id),exitEdgeIds:e.edges.filter(e=>r.has(e.from)&&!r.has(e.to)).map(e=>e.id)}));for(let t of p){let n=f.get(t.headerId);if(e.edges.some(e=>!n.has(e.from)&&n.has(e.to)&&e.to!==t.headerId))throw Error(`Workflow loop has multiple entry steps`);let r=[];for(let e of p){if(e===t)continue;let i=f.get(e.headerId),a=t.memberIds.filter(e=>i.has(e)).length;if(a){if(a===n.size&&n.size<i.size)r.push(e);else if(a!==i.size||n.size===i.size)throw Error(`Workflow loops overlap without strict nesting`)}}r.sort((e,t)=>e.memberIds.length-t.memberIds.length),r[0]&&(t.parentHeaderId=r[0].headerId)}let m=[],h=new Set(t);for(;h.size;){let e=[...h].filter(e=>r.get(e).every(e=>d.has(e.id)||!h.has(e.from)));if(!e.length)throw Error(`Workflow contains an irreducible or multiple-entry cycle`);for(let t of e)m.push(t),h.delete(t)}return p.sort((e,n)=>n.memberIds.length-e.memberIds.length||t.indexOf(e.headerId)-t.indexOf(n.headerId)),{loops:p,order:m}}var LC=J().refine(e=>![`__proto__`,`constructor`,`prototype`].includes(e),`Reserved dictionary key`);function RC(e){return Y_().superRefine((e,t)=>{if(e&&typeof e==`object`)for(let n of Object.keys(e))LC.safeParse(n).success||t.addIssue({code:`custom`,message:`Reserved dictionary key`,path:[n]})}).pipe(cv(LC,e))}var zC=Pv(()=>nv([q_(),G_(),V_(),J(),$_(zC),cv(J(),zC)])),BC=Pv(()=>iv(`type`,[Y({type:fv(`null`)}).strict(),Y({type:fv(`json`),schema:nv([G_(),cv(J(),zC)]).optional()}).strict(),Y({type:fv(`string`)}).strict(),Y({type:fv(`number`),integer:G_().optional()}).strict(),Y({type:fv(`boolean`)}).strict(),Y({type:fv(`enum`),values:$_(J()).min(1).refine(e=>new Set(e).size===e.length)}).strict(),Y({type:fv(`array`),items:BC}).strict(),Y({type:fv(`union`),variants:$_(BC).min(2)}).strict(),Y({type:fv(`object`),fields:RC(Y({schema:BC,required:G_().optional(),default:zC.optional()}).strict())}).strict()]));function VC(e){switch(e.type){case`null`:return q_();case`json`:return e.schema!==void 0&&kC(e.schema),zC.superRefine((t,n)=>{try{e.schema!==void 0&&AC(e.schema,t)}catch(e){n.addIssue({code:`custom`,message:e.message})}});case`string`:return J();case`number`:return e.integer?V_().int():V_();case`boolean`:return G_();case`enum`:return uv(e.values);case`array`:return $_(VC(e.items));case`union`:return nv(e.variants.map(VC));case`object`:return Y(Object.fromEntries(Object.entries(e.fields).map(([e,t])=>{let n=VC(t.schema);return t.default===void 0?t.required||(n=n.optional()):n=n.default(HC(t.schema,t.default)),[e,n]}))).strict()}}function HC(e,t){return zC.parse(VC(e).parse(t))}function UC(e){BC.parse(e),VC(e)}function WC(e){switch(e.type){case`json`:return`unknown`;case`enum`:return e.values.map(e=>JSON.stringify(e)).join(` | `);case`array`:return`Array<${WC(e.items)}>`;case`union`:return e.variants.map(WC).join(` | `);case`object`:return`{ ${Object.entries(e.fields).map(([e,t])=>`${JSON.stringify(e)}${t.required||t.default!==void 0?``:`?`}: ${WC(t.schema)}`).join(`; `)} }`;default:return e.type}}var GC={type:`object`,fields:{exitCode:{schema:{type:`number`,integer:!0},required:!0},stdout:{schema:{type:`string`},required:!0},stderr:{schema:{type:`string`},required:!0}}};function KC(e){if(e.kind===`workflow`)return e.contract.outputSchema;if(e.kind===`mcp`)return{type:`object`,fields:{structuredContent:{required:!0,schema:{type:`json`,...e.tool.outputSchema===void 0?{}:{schema:e.tool.outputSchema}}},content:{required:!0,schema:{type:`array`,items:{type:`json`}}}}};if(e.kind===`shell`)return GC;if(e.kind===`branch`)return{type:`boolean`};if(e.kind!==`join`)return e.outputSchema}function qC(e,t){if(!t.length)return{schema:e,optional:!1};if(e.type===`json`)return{schema:{type:`json`,schema:jC(e.schema??!0,t)},optional:!1};if(e.type===`null`)return{schema:{type:`json`},optional:!1};if(e.type===`union`){let n=e.variants.map(e=>qC(e,t));return{schema:XC(n.map(e=>e.schema)),optional:n.some(e=>e.optional)}}let[n,...r]=t;if(e.type===`object`){let t=Object.hasOwn(e.fields,n)?e.fields[n]:void 0;if(!t)throw Error(`Unknown field: ${n}`);let i=qC(t.schema,r);return{schema:i.schema,optional:i.optional||!t.required&&t.default===void 0}}if(e.type===`array`&&/^(0|[1-9]\d*)$/.test(n))return{schema:qC(e.items,r).schema,optional:!0};throw Error(`Invalid field path: ${n}`)}function JC(e,t){return t.type===`json`||e.type===`json`?!0:e.type===`union`?e.variants.every(e=>JC(e,t)):t.type===`union`?t.variants.some(t=>JC(e,t)):e.type===`enum`?t.type===`string`||t.type===`enum`&&e.values.every(e=>t.values.includes(e)):e.type===t.type?e.type===`number`&&t.type===`number`?!t.integer||!!e.integer:e.type===`array`&&t.type===`array`?JC(e.items,t.items):e.type===`object`&&t.type===`object`?Object.keys(e.fields).every(e=>Object.hasOwn(t.fields,e))&&Object.entries(t.fields).every(([t,n])=>{let r=Object.hasOwn(e.fields,t)?e.fields[t]:void 0,i=n.required&&n.default===void 0;return r?(!i||r.required||r.default!==void 0)&&JC(r.schema,n.schema):!i}):!0:!1}function YC(e){return e.type===`object`?{type:`object`,fields:Object.fromEntries(Object.entries(e.fields).map(([e,t])=>[e,{schema:YC(t.schema)}]))}:e.type===`array`?{type:`array`,items:YC(e.items)}:e.type===`union`?XC(e.variants.map(YC)):e}function XC(e){let t=[...new Map(e.map(e=>[JSON.stringify(e),e])).values()];return t.length===1?t[0]:{type:`union`,variants:t}}var ZC=iv(`source`,[Y({source:fv(`input`),path:$_(J())}).strict(),Y({source:fv(`step`),stepId:J(),path:$_(J())}).strict()]),QC=Pv(()=>iv(`kind`,[Y({kind:fv(`literal`),value:Rv()}).strict(),Y({kind:fv(`reference`),reference:ZC}).strict(),Y({kind:fv(`object`),fields:RC(QC)}).strict(),Y({kind:fv(`array`),items:$_(QC)}).strict()])),$C=nv([G_(),cv(J(),Rv())]),ew=iv(`kind`,[Y({kind:fv(`template`),template:QC}).strict(),Y({kind:fv(`reference`),reference:ZC}).strict(),Y({kind:fv(`object`),fields:RC(ZC)}).strict()]),tw={id:LC.min(1),name:LC.min(1),inputSchema:BC.optional(),mapping:ew.optional(),repeatMapping:ew.optional(),permission:uv([`ask`,`auto-accept`]).optional(),timeoutMs:V_().int().positive().max(2147483647).optional(),secrets:RC(J().refine(PC,`Invalid secret reference`)).optional(),position:Y({x:V_(),y:V_()}).strict().optional()},nw=iv(`operator`,[Y({operator:fv(`truthy`),path:$_(J())}).strict(),Y({operator:uv([`equals`,`not-equals`]),path:$_(J()),value:Rv()}).strict(),Y({operator:uv([`greater-than`,`less-than`]),path:$_(J()),value:V_()}).strict()]),rw=Y({version:fv(1),id:J().regex(/^[a-zA-Z0-9_-]{1,128}$/),name:J().min(1),backend:J().min(1),projectId:J().optional(),permission:uv([`ask`,`auto-accept`]).optional(),inputSchema:BC.refine(e=>e.type===`object`),steps:$_(iv(`kind`,[Y({...tw,kind:fv(`agent`),instructions:J(),model:J().min(1),effort:uv([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),outputSchema:BC}).strict(),Y({...tw,kind:fv(`shell`),command:J(),acceptedExitCodes:$_(V_().int()).min(1).optional()}).strict(),Y({...tw,kind:fv(`typescript`),code:J(),outputSchema:BC}).strict(),Y({...tw,kind:fv(`branch`),condition:nw}).strict(),Y({...tw,kind:fv(`join`)}).strict(),Y({...tw,kind:fv(`workflow`),workflowId:J().regex(/^[a-zA-Z0-9_-]{1,128}$/),contract:Y({inputSchema:BC.refine(e=>e.type===`object`),outputSchema:BC}).strict()}).strict(),Y({...tw,kind:fv(`mcp`),tool:Y({connectionId:J().min(1),connectionName:J(),identity:J().regex(/^[a-f0-9]{64}$/),serverIdentity:J().regex(/^[a-f0-9]{64}$/),toolName:J().min(1),inputSchema:$C,outputSchema:$C.optional()}).strict()}).strict()])).min(1),loopSettings:RC(Y({maxTries:V_().int().min(1).max(100)}).strict()).optional(),edges:$_(Y({id:J().min(1),from:J(),to:J(),outcome:uv([`success`,`failure`,`timeout`,`true`,`false`])}).strict())}).strict();function iw(e){return ow(e)}function aw(e){return ow(e,!0)}function ow(e,t=!1){let n=rw.parse(e),r=n.steps.find(e=>e.kind===`agent`&&Oo(e.instructions));if(r&&!n.projectId)throw Error(`Workflow Step ${JSON.stringify(r.name)} invokes a Skill and requires a Project binding`);UC(n.inputSchema);let i=new Map(n.steps.map(e=>[e.id,e]));if(i.size!==n.steps.length||new Set(n.steps.map(e=>e.name)).size!==i.size)throw Error(`Step IDs and names must be unique`);if(new Set(n.edges.map(e=>e.id)).size!==n.edges.length)throw Error(`Edge IDs must be unique`);let a=new Map(n.steps.map(e=>[e.id,[]])),o=new Map(n.steps.map(e=>[e.id,[]])),s=new Set;for(let e of n.edges){let t=i.get(e.from);if(!t||!i.has(e.to))throw Error(`Unknown edge endpoint`);let n=JSON.stringify([e.from,e.to,e.outcome]);if(s.has(n))throw Error(`Duplicate connection`);if(s.add(n),t.kind===`branch`?![`true`,`false`,`failure`,`timeout`].includes(e.outcome):[`true`,`false`].includes(e.outcome))throw Error(`Invalid edge outcome`);a.get(e.to).push(e),o.get(e.from).push(e)}let c=IC(n),l=c.loops.map(e=>({...e,maxTries:n.loopSettings?.[e.headerId]?.maxTries??3})),u=new Map(l.map(e=>[e.headerId,e]));for(let e of Object.keys(n.loopSettings??{}))if(!u.has(e))throw Error(`Loop settings require a loop header`);for(let e of i.values())if(e.repeatMapping&&!u.has(e.id))throw Error(`Repeat mapping requires a loop header`);let d=new Set(l.flatMap(e=>e.backEdgeIds)),f=new Map([...a].map(([e,t])=>[e,t.filter(e=>!d.has(e.id))])),p=c.order.map(e=>i.get(e)),m=new FC,h=new Map,g=new Map,_=new Map,v=new Map,y=e=>e.reduce((e,t)=>m.or(e,t),0),b=new Map,x=new Map,S=new Map,C=new Map,w=new Map,T=new Map,E={definition:n,order:p,incoming:a,outgoing:o,forwardIncoming:f,loops:l,outputSchemas:x,inputSchemas:S,firstInputSchemas:C,repeatInputSchemas:w};for(let e of p){let t=f.get(e.id),n=y(t.map(e=>v.get(e.id))),r=m.and(t.length?y(t.map(e=>_.get(e.id))):1,m.not(n)),i=m.or(y(t.map(e=>m.and(_.get(e.id),e.outcome===`failure`||e.outcome===`timeout`?1:g.get(e.from)))),u.has(e.id)?m.and(r,m.outcome(p.length+p.indexOf(e),1)):0);T.set(e.id,r),g.set(e.id,i);let a=p.indexOf(e),s=m.outcome(a,1),c=m.outcome(a,2),l=m.not(m.or(s,c));h.set(e.id,m.and(r,l));let d={success:l,failure:s,timeout:c,true:y([m.outcome(a,0),m.outcome(a,3)]),false:m.outcome(a,4)},x=o.get(e.id),S=m.or(m.and(s,x.some(e=>e.outcome===`failure`)?i:1),m.and(c,x.some(e=>e.outcome===`timeout`)?i:1));for(let e of x){let t=e.outcome===`failure`||e.outcome===`timeout`;_.set(e.id,m.and(r,m.and(d[e.outcome],t?m.not(i):1))),v.set(e.id,m.or(n,t?0:m.and(r,S)))}b.set(e.id,new Set(t.flatMap(e=>[e.from,...b.get(e.from)])))}for(let e of l){let t=y(e.backEdgeIds.map(e=>_.get(e))),n=e.memberIds.map(e=>{let t=y(o.get(e).map(e=>_.get(e.id)));return m.and(h.get(e),m.not(t))}),r=y([...e.exitEdgeIds.map(e=>_.get(e)),...n]);if(m.and(t,r)!==0)throw Error(`Loop ${e.headerId} can select exit and repeat together`)}let D=new Set,O=e=>{let t=x.get(e);if(t)return t;let n=i.get(e),r=KC(n)??n.inputSchema??A(e);return UC(r),x.set(e,r),r},k=(e,r)=>{let o=u.get(e.id),s=r?a.get(e.id).filter(e=>o.backEdgeIds.includes(e.id)):f.get(e.id),c=r?y(s.map(e=>_.get(e.id))):T.get(e.id),l=r?new Set(s.flatMap(e=>[e.from,...b.get(e.from)])):b.get(e.id),d=r?e.repeatMapping:e.mapping,p=e=>{if(e.source===`input`)return qC(n.inputSchema,e.path);let t=i.get(e.stepId);if(!t||!l.has(e.stepId))throw Error(`Mapping must reference an earlier step`);if(!m.implies(c,h.get(t.id)))throw Error(`Output is not guaranteed: ${t.name}`);return qC(O(t.id),e.path)};if(e.kind===`join`&&d)throw Error(`Joins collect selected incoming outputs without mappings`);let g;if(d?.kind===`template`){let n=e=>{e.kind===`reference`&&p(e.reference),e.kind===`object`&&Object.values(e.fields).forEach(n),e.kind===`array`&&e.items.forEach(n)};n(d.template);let r=e=>{if(e.kind===`reference`)return p(e.reference).schema;if(e.kind===`object`)return{type:`object`,fields:Object.fromEntries(Object.entries(e.fields).map(([e,t])=>[e,{schema:r(t),required:!0}]))};if(e.kind===`array`)return{type:`array`,items:e.items.length?XC(e.items.map(r)):{type:`json`}};let t=e=>e===null?{type:`null`}:typeof e==`string`?{type:`enum`,values:[e]}:typeof e==`number`?{type:`number`,integer:Number.isInteger(e)}:typeof e==`boolean`?{type:`boolean`}:Array.isArray(e)?{type:`array`,items:e.length?XC(e.map(t)):{type:`json`}}:{type:`object`,fields:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{schema:t(n),required:!0}]))};return t(e.value)};g=e.kind===`workflow`?r(d.template):{type:`json`},e.kind===`workflow`&&!t&&d.template.kind===`literal`&&HC(e.contract.inputSchema,d.template.value)}else if(d?.kind===`reference`){let e=p(d.reference);if(e.optional)throw Error(`A direct input reference must be required or have a default`);g=e.schema}else if(d?.kind===`object`)g={type:`object`,fields:Object.fromEntries(Object.entries(d.fields).map(([e,t])=>{let n=p(t);return[e,{schema:n.schema,required:!n.optional}]}))};else if(!s.length)g=n.inputSchema;else{let t=[...new Set(s.map(e=>e.from))],n=Object.fromEntries(t.map(e=>{let t=i.get(e),n=s.filter(t=>t.from===e),r=XC(n.map(t=>t.outcome===`failure`||t.outcome===`timeout`?sw(i.get(e).inputSchema??A(e),O(e)):O(e)));return[t.name,{schema:r,required:m.implies(c,y(n.map(e=>_.get(e.id))))}]})),r={type:`object`,fields:n},a=Object.values(n).filter(e=>e.required).length;g=e.kind===`join`||a>1?r:XC([...Object.values(n).map(e=>e.schema),...t.length>1?[r]:[]])}if(e.inputSchema&&(UC(e.inputSchema),!(t&&e.kind===`workflow`)&&!JC(g,e.inputSchema)))throw Error(`Input does not match the declared input schema`);if(e.kind===`workflow`){if(UC(e.contract.inputSchema),UC(e.contract.outputSchema),!t&&(!JC(g,e.contract.inputSchema)||e.inputSchema&&!JC(e.inputSchema,e.contract.inputSchema)))throw Error(`Input does not match the Workflow call input contract`);return e.contract.inputSchema}return e.inputSchema??g},A=e=>{let t=S.get(e);if(t)return t;if(D.has(e))throw Error(`Cyclic input schema at ${e}; declare a loop header inputSchema`);D.add(e);let n=i.get(e),r=k(n,!1);C.set(e,r);let a=r;if(u.has(e)){let t=k(n,!0);w.set(e,t),a=XC([r,t])}return S.set(e,a),D.delete(e),a};for(let e of p){e.kind===`mcp`&&MC(e.tool);let t=A(e.id);if(e.kind===`branch`){let n=qC(e.inputSchema??t,e.condition.path),r=e.condition.operator===`truthy`?`boolean`:[`greater-than`,`less-than`].includes(e.condition.operator)?`number`:void 0;if(r&&(n.optional||!JC(n.schema,{type:r})))throw Error(`Branch condition requires a required ${r}`)}O(e.id)}let j=p.map(e=>m.and(h.get(e.id),m.not(y(o.get(e.id).map(e=>_.get(e.id)))))),M=1;for(let e of p){let t=y(o.get(e.id).filter(e=>e.outcome===`failure`||e.outcome===`timeout`).map(e=>_.get(e.id)));M=m.and(M,m.or(m.not(T.get(e.id)),m.or(h.get(e.id),t))),l.length&&(M=m.and(M,m.not(y(o.get(e.id).filter(e=>d.has(e.id)).map(e=>_.get(e.id))))))}let N=p.map((e,t)=>({step:e,condition:j[t]})).filter(({condition:e})=>m.and(M,e)!==0),P=[],F=1,I=0,L=0;for(let{condition:e}of N)L=m.or(L,m.and(I,e)),I=m.or(m.and(I,m.not(e)),m.and(F,e)),F=m.and(F,m.not(e));if(l.length||n.edges.some(e=>e.outcome===`failure`||e.outcome===`timeout`)){let e=p.filter(e=>e.kind===`branch`?[`true`,`false`].some(t=>!o.get(e.id).some(e=>e.outcome===t)):!o.get(e.id).some(e=>e.outcome===`success`));P.push(...e.map(e=>O(e.id))),e.length>1&&P.push({type:`object`,fields:Object.fromEntries(e.map(e=>[e.name,{schema:O(e.id)}]))})}else{for(let{step:e,condition:t}of N)m.and(M,m.and(I,t))!==0&&P.push(O(e.id));let e=m.and(M,L);e!==0&&P.push({type:`object`,fields:Object.fromEntries(N.filter(({condition:t})=>m.and(e,t)!==0).map(({step:t,condition:n})=>[t.name,{schema:O(t.id),required:m.implies(e,n)}]))}),m.and(M,F)!==0&&P.push({type:`object`,fields:{}})}return{...E,resultSchema:P.length?XC(P):{type:`json`}}}function sw(e,t){return{type:`object`,fields:{input:{schema:e,required:!0},error:{required:!0,schema:{type:`object`,fields:{message:{schema:{type:`string`},required:!0},kind:{schema:{type:`enum`,values:[`failure`,`timeout`,`interrupted`]},required:!0}}}},partialOutput:{schema:YC(t)}}}}function cw(e,t){let n=1;for(;e.steps.some(e=>e.name===`${t}_${n}`);)n++;return`${t}_${n}`}function lw(e){return e&&typeof e==`object`&&`issues`in e&&Array.isArray(e.issues)?e.issues.map(e=>`${e.path?.map(String).join(`.`)||`Workflow`}: ${e.message}`).join(`; `):e instanceof Error?e.message:String(e)}function uw(e,t=[]){return[t,...e.type===`json`&&typeof e.schema==`object`&&e.schema.properties&&typeof e.schema.properties==`object`&&!Array.isArray(e.schema.properties)?Object.entries(e.schema.properties).flatMap(([e,n])=>uw({type:`json`,schema:n},[...t,e])):[],...e.type===`object`?Object.entries(e.fields).flatMap(([e,n])=>uw(n.schema,[...t,e])):[]]}function dw(e,t,n=`reference`,r=`mapping`){if(!e.steps.find(e=>e.id===t))return[];let i={...e,steps:e.steps.map(e=>{if(e.id!==t)return e;let n={...e};return delete n[r],delete n.inputSchema,n})},a;try{a=aw(i)}catch{let t=new Set(IC(e).loops.map(e=>e.headerId));i={...e,loopSettings:{},steps:e.steps.map(e=>{let n={...e};return delete n.inputSchema,n.mapping={kind:`reference`,reference:{source:`input`,path:[]}},t.has(e.id)?n.repeatMapping=n.mapping:delete n.repeatMapping,n.kind===`branch`&&(n.condition={operator:`equals`,path:[],value:null}),n.kind===`agent`&&!n.model&&(n.model=`unselected`),n.kind===`join`&&(delete n.mapping,delete n.repeatMapping),n})},a=aw(i)}let o=uw(e.inputSchema).map(e=>({label:`Workflow input${e.length?`.`+e.join(`.`):``}`,reference:{source:`input`,path:e}})),s=o.splice(0);for(let n of e.steps){if(n.id===t&&r===`mapping`)continue;let e=a.outputSchemas.get(n.id);if(e)for(let t of uw(e)){let e={source:`step`,stepId:n.id,path:t};s.push({label:`${n.name}${t.length?`.`+t.join(`.`):``}`,reference:e})}}for(let e of s){let{reference:a}=e;try{aw({...i,steps:i.steps.map(e=>e.id===t?{...e,[r]:n===`object`?{kind:`object`,fields:{value:a}}:{kind:`reference`,reference:a}}:e)}),o.push(e)}catch{}}return o}function fw(e,t,n){let r=e.steps.find(e=>e.id===t),i=iw(e),a=r?.kind===`mcp`?{type:`json`,schema:r.tool.inputSchema}:i.inputSchemas.get(t);if(!a)throw Error(`Select a step`);return HC(a,n)}function pw(e,t,n){if(n)return`The workflow slot is occupied`;if(e.backend!==t)return`Requires Backend Adapter ${e.backend}`;try{iw(e)}catch(e){return lw(e)}}function mw(e,t,n){if(!t||[`__proto__`,`constructor`,`prototype`].includes(t))throw Error(`Invalid field name`);return{...e,mapping:{kind:`object`,fields:{...e.mapping?.kind===`object`?e.mapping.fields:{},[t]:n}}}}var hw=e=>typeof e==`boolean`||typeof e==`object`&&e&&!Array.isArray(e)?e:!0;function gw(e,t,n=new Set){if(typeof e==`boolean`)return{};let r={...e};if(typeof e.$ref==`string`&&e.$ref.startsWith(`#/`)&&!n.has(e.$ref)){n.add(e.$ref);let i=t;for(let t of e.$ref.slice(2).split(`/`).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)))i=i&&typeof i==`object`&&!Array.isArray(i)?i[t]??!0:!0;r={...gw(hw(i),t,n),...r}}for(let i of Array.isArray(e.allOf)?e.allOf:[]){let e=gw(hw(i),t,new Set(n));r={...e,...r,properties:{..._w(e),..._w(r)},required:[...new Set([...Array.isArray(e.required)?e.required:[],...Array.isArray(r.required)?r.required:[]])]}}return r}function _w(e){return e.properties&&typeof e.properties==`object`&&!Array.isArray(e.properties)?e.properties:{}}function vw(e){if(e.kind===`reference`)return;if(e.kind===`literal`)return e.value;if(e.kind===`array`){let t=e.items.map(vw);return t.some(e=>e===void 0)?void 0:t}let t=Object.entries(e.fields).map(([e,t])=>[e,vw(t)]);return t.some(([,e])=>e===void 0)?void 0:Object.fromEntries(t)}function yw(e){return Array.isArray(e)?{kind:`array`,items:e.map(yw)}:e&&typeof e==`object`?{kind:`object`,fields:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,yw(t)]))}:{kind:`literal`,value:e}}function bw(e,t=e){let n=gw(e,t);return n.default!==void 0||n.const!==void 0?yw(n.default??n.const??null):Array.isArray(n.enum)&&n.enum.length?yw(n.enum[0]):n.type===`object`||n.properties?{kind:`object`,fields:{}}:n.type===`array`?{kind:`array`,items:[]}:{kind:`literal`,value:n.type===`null`?null:n.type===`boolean`?!1:n.type===`number`||n.type===`integer`?0:``}}function xw(e,t,n){let r=[],i=n&&typeof n==`object`&&!Array.isArray(n)?n:{};if(e.if!==void 0&&n!==void 0){let i=!1;try{let r=hw(e.if);AC(typeof r==`boolean`?r:{...typeof t==`object`&&t.$defs?{$defs:t.$defs}:{},...typeof t==`object`&&t.definitions?{definitions:t.definitions}:{},...r},n),i=!0}catch{}r.push(hw(i?e.then:e.else))}for(let t of[`dependentSchemas`,`dependencies`]){let n=e[t];if(n&&typeof n==`object`&&!Array.isArray(n))for(let[e,t]of Object.entries(n))Object.hasOwn(i,e)&&!Array.isArray(t)&&r.push(hw(t))}return r.reduce((e,n)=>{let r=gw(n,t);return{...e,...r,properties:{..._w(e),..._w(r)},required:[...new Set([...Array.isArray(e.required)?e.required:[],...Array.isArray(r.required)?r.required:[]])]}},e)}function Sw(e,t){return hw(Array.isArray(e.prefixItems)?e.prefixItems[t]??e.items:Array.isArray(e.items)?e.items[t]??e.additionalItems:e.items)}function Cw({schema:e,root:t=e,template:n,onChange:r,choices:i=[],label:a=`Arguments`,depth:o=0}){let[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(0),d=xw(gw(e,t),t,vw(n)),f=Array.isArray(d.oneOf)?d.oneOf:Array.isArray(d.anyOf)?d.anyOf:Array.isArray(d.type)?d.type.map(e=>({type:e})):[],p=f.length?gw(hw(f[l]),t):{},m={...d,...p,properties:{..._w(d),..._w(p)}},h=_w(m),g=vw(n),_=n.kind===`object`?`object`:n.kind===`array`?`array`:g===null?`null`:typeof g,v=(e,n,r,a)=>(0,U.jsx)(Cw,{schema:e,root:t,template:n,onChange:r,choices:i,label:a,depth:o+1});return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:a}),typeof m.description==`string`&&(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:m.description}),i.length>0&&(0,U.jsxs)(At,{value:n.kind===`reference`?JSON.stringify(n.reference):`literal`,onValueChange:n=>{if(n===`literal`)r(bw(e,t));else{let e=i.find(e=>JSON.stringify(e.reference)===n);e&&r({kind:`reference`,reference:e.reference})}},children:[(0,U.jsx)(Lt,{"aria-label":`${a} source`,children:(0,U.jsx)(vt,{children:n.kind===`reference`?i.find(e=>JSON.stringify(e.reference)===JSON.stringify(n.reference))?.label??`Unavailable reference`:`Literal value`})}),(0,U.jsxs)(Ft,{children:[(0,U.jsx)(ht,{value:`literal`,children:`Literal value`}),i.map(e=>(0,U.jsx)(ht,{value:JSON.stringify(e.reference),children:e.label},e.label))]})]}),n.kind!==`reference`&&(0,U.jsxs)(U.Fragment,{children:[f.length>0&&(0,U.jsxs)(At,{value:l,onValueChange:e=>{e!==null&&(u(e),r(bw(hw(f[e]),t)))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} variant`,children:(0,U.jsxs)(vt,{children:[`Variant `,l+1]})}),(0,U.jsx)(Ft,{children:f.map((e,t)=>(0,U.jsxs)(ht,{value:t,children:[`Variant `,t+1]},t))})]}),(0,U.jsxs)(At,{value:_,onValueChange:e=>{e&&r(bw({type:e}))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} JSON type`,children:(0,U.jsx)(vt,{children:_})}),(0,U.jsx)(Ft,{children:[`object`,`array`,`string`,`number`,`boolean`,`null`].map(e=>(0,U.jsx)(ht,{value:e,children:e},e))})]}),Array.isArray(m.enum)&&(0,U.jsxs)(At,{value:JSON.stringify(g),onValueChange:e=>{e&&r(yw(JSON.parse(e)))},children:[(0,U.jsx)(Lt,{"aria-label":`${a} enum`,children:(0,U.jsx)(vt,{children:JSON.stringify(g)})}),(0,U.jsx)(Ft,{children:m.enum.map((e,t)=>(0,U.jsx)(ht,{value:JSON.stringify(e),children:JSON.stringify(e)},t))})]}),n.kind===`object`&&(0,U.jsxs)(U.Fragment,{children:[[...new Set([...Object.keys(h),...Object.keys(n.fields)])].map(e=>{let i=Object.hasOwn(n.fields,e)?n.fields[e]:void 0,o=m.patternProperties&&typeof m.patternProperties==`object`&&!Array.isArray(m.patternProperties)?Object.entries(m.patternProperties).filter(([t])=>{try{return new RegExp(t).test(e)}catch{return!1}}).map(([,e])=>e):[],s=hw(Object.hasOwn(h,e)?h[e]:o.length?{allOf:o}:m.additionalProperties);return(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{"aria-label":`Include ${a}.${e}`,checked:!!i,onCheckedChange:i=>{let a={...n.fields};i?a[e]=bw(s,t):delete a[e],r({kind:`object`,fields:a})}}),e,Array.isArray(m.required)&&m.required.includes(e)?` *`:``]}),i&&v(s,i,t=>r({kind:`object`,fields:{...n.fields,[e]:t}}),`${a}.${e}`)]},e)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(he,{"aria-label":`${a} new property`,placeholder:`Additional property name`,value:s,onChange:e=>c(e.target.value)}),(0,U.jsx)(O,{variant:`outline`,size:`sm`,disabled:!s||[`__proto__`,`constructor`,`prototype`].includes(s),onClick:()=>{r({kind:`object`,fields:{...n.fields,[s]:bw(hw(m.additionalProperties),t)}}),c(``)},children:`Add property`})]})]}),n.kind===`array`&&(0,U.jsxs)(U.Fragment,{children:[n.items.map((e,t)=>(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[v(Sw(m,t),e,e=>r({kind:`array`,items:n.items.map((n,r)=>r===t?e:n)}),`${a}[${t}]`),(0,U.jsx)(O,{size:`sm`,variant:`outline`,onClick:()=>r({kind:`array`,items:n.items.filter((e,n)=>n!==t)}),children:`Remove item`})]},t)),(0,U.jsx)(O,{size:`sm`,variant:`outline`,onClick:()=>{let e=n.items.length;r({kind:`array`,items:[...n.items,bw(Sw(m,e),t)]})},children:`Add item`})]}),n.kind===`literal`&&_===`boolean`&&(0,U.jsx)(zt,{"aria-label":a,checked:g===!0,onCheckedChange:e=>r({kind:`literal`,value:e})}),n.kind===`literal`&&(_===`string`||_===`number`)&&(0,U.jsx)(he,{"aria-label":a,type:_===`number`?`number`:`text`,value:g,onChange:e=>r({kind:`literal`,value:_===`number`?Number(e.target.value):e.target.value})})]}),(0,U.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,U.jsx)(`summary`,{children:`Original schema and constraints`}),(0,U.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e,null,2)})]})]})}function ww({schema:e,value:t,onChange:n,label:r}){return(0,U.jsx)(Cw,{schema:e,template:yw(t),label:r,onChange:e=>{let t=vw(e);t!==void 0&&n(t)}})}function Tw(e){return e===`object`?{type:e,fields:{}}:e===`array`?{type:e,items:{type:`string`}}:e===`enum`?{type:e,values:[`value`]}:e===`union`?{type:e,variants:[{type:`string`}]}:{type:e}}function Ew(e){switch(e.type){case`json`:return{};case`null`:return null;case`object`:return Object.fromEntries(Object.entries(e.fields).filter(([,e])=>e.required||e.default!==void 0).map(([e,t])=>[e,t.default??Ew(t.schema)]));case`array`:return[];case`number`:return 0;case`boolean`:return!1;case`enum`:return e.values[0]??``;case`union`:return Ew(e.variants[0]);default:return``}}function Dw({schema:e,value:t,onChange:n,onClear:r,label:i=`Value`}){let[a,o]=(0,H.useState)(0);if(e.type===`json`)return(0,U.jsx)(ww,{schema:e.schema??!0,value:t??null,label:i,onChange:n});if(e.type===`null`)return(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`null`});if(e.type===`object`){let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{};return(0,U.jsx)(`div`,{className:`grid gap-3`,children:Object.entries(e.fields).map(([e,t])=>(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[e,t.required?` *`:``]}),!t.required&&(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{"aria-label":`Include ${e}`,checked:Object.hasOwn(r,e),onCheckedChange:i=>{let a={...r};i?a[e]=t.default??Ew(t.schema):delete a[e],n(a)}}),`Include`]}),(0,U.jsx)(Dw,{schema:t.schema,label:i===`Value`?e:`${i}.${e}`,value:r[e]??t.default,onClear:()=>{let t={...r};delete t[e],n(t)},onChange:t=>n({...r,[e]:t})})]},e))})}return e.type===`array`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(Array.isArray(t)?t:[]).map((r,a)=>(0,U.jsxs)(`div`,{className:`grid gap-2 rounded-lg border p-3`,children:[(0,U.jsx)(Dw,{schema:e.items,label:`${i} item ${a+1}`,value:r,onChange:e=>n(t.map((t,n)=>n===a?e:t))}),(0,U.jsx)(O,{size:`sm`,variant:`destructive`,className:`justify-self-start`,onClick:()=>n(t.filter((e,t)=>t!==a)),children:`Remove item`})]},a)),(0,U.jsx)(O,{size:`sm`,variant:`outline`,className:`justify-self-start`,onClick:()=>n([...Array.isArray(t)?t:[],Ew(e.items)]),children:`Add item`})]}):e.type===`union`?(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsxs)(At,{value:a,onValueChange:t=>{t!==null&&(o(t),n(Ew(e.variants[t])))},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":i===`Value`?`Input variant`:`${i} variant`,children:(0,U.jsx)(vt,{children:`Variant ${a+1}: ${e.variants[a]?.type??``}`})}),(0,U.jsx)(Ft,{children:e.variants.map((e,t)=>(0,U.jsxs)(ht,{value:t,children:[`Variant `,t+1,`: `,e.type]},t))})]}),(0,U.jsx)(Dw,{schema:e.variants[a]??e.variants[0],label:i,value:t,onChange:n})]}):e.type===`boolean`?(0,U.jsx)(zt,{"aria-label":i,checked:t===!0,onCheckedChange:n}):e.type===`enum`?(0,U.jsxs)(At,{value:typeof t==`string`?t:``,onValueChange:e=>{e!==null&&n(e)},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":i,children:(0,U.jsx)(vt,{children:typeof t==`string`&&t?t:`Select`})}),(0,U.jsxs)(Ft,{children:[!e.values.includes(``)&&(0,U.jsx)(ht,{value:``,children:`Select`}),e.values.map(e=>(0,U.jsx)(ht,{value:e,children:e||`Empty string`},e))]})]}):(0,U.jsx)(he,{"aria-label":i,type:e.type===`number`?`number`:`text`,value:typeof t==`string`||typeof t==`number`?t:``,onChange:t=>e.type===`number`&&t.target.value===``&&r?r():n(e.type===`number`?t.target.value===``?null:Number(t.target.value):t.target.value)})}function Ow({schema:e,onChange:t,root:n=!1}){return(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Schema`}),!n&&(0,U.jsxs)(At,{value:e.type,onValueChange:e=>{e!==null&&t(Tw(e))},children:[(0,U.jsx)(Lt,{className:`w-full`,"aria-label":`Schema type`,children:(0,U.jsx)(vt,{children:e.type})}),(0,U.jsx)(Ft,{children:[`object`,`array`,`string`,`number`,`boolean`,`enum`,`json`,`null`].map(e=>(0,U.jsx)(ht,{value:e,children:e},e))})]}),e.type===`enum`&&(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Values (one per line)`}),(0,U.jsx)(Fo,{value:e.values.join(`
139
139
  `),onChange:n=>t({...e,values:n.target.value.split(`
140
- `)})})]}),e.type===`array`&&(0,U.jsx)(Tw,{schema:e.items,onChange:n=>t({...e,items:n})}),e.type===`object`&&(0,U.jsxs)(U.Fragment,{children:[Object.entries(e.fields).map(([n,r])=>(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:n}),(0,U.jsx)(O,{size:`sm`,variant:`destructive`,className:`justify-self-start`,onClick:()=>t({...e,fields:Object.fromEntries(Object.entries(e.fields).filter(([e])=>e!==n))}),children:`Remove field`}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{checked:!!r.required,onCheckedChange:i=>t({...e,fields:{...e.fields,[n]:{...r,required:i}}})}),`Required`]}),(0,U.jsx)(Tw,{schema:r.schema,onChange:i=>t({...e,fields:{...e.fields,[n]:{...r,schema:i}}})}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{checked:r.default!==void 0,onCheckedChange:i=>{let a={...r};i?a.default=Cw(r.schema):delete a.default,t({...e,fields:{...e.fields,[n]:a}})}}),`Default`]}),r.default!==void 0&&(0,U.jsx)(ww,{schema:r.schema,value:r.default,onChange:i=>t({...e,fields:{...e.fields,[n]:{...r,default:i}}})})]},n)),(0,U.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:n=>{n.preventDefault();let r=n.currentTarget,i=String(new FormData(r).get(`field`));i&&![`__proto__`,`constructor`,`prototype`].includes(i)&&!e.fields[i]&&(t({...e,fields:{...e.fields,[i]:{schema:{type:`string`}}}}),r.reset())},children:[(0,U.jsx)(he,{className:`min-w-0 flex-1`,name:`field`,"aria-label":`New field name`,placeholder:`Field name`,required:!0}),(0,U.jsx)(O,{type:`submit`,size:`sm`,variant:`outline`,children:`Add field`})]})]})]})}function Ew(e,t){return{...e,workflowId:t.id,contract:structuredClone(t.contract)}}function Dw(e,t){let n=[],r=new Set;for(let i=t||void 0;i!==void 0;){let t=e.invocations?.[i];if(!t||r.has(i))break;r.add(i);let a=t.parentInvocationId?e.invocations?.[t.parentInvocationId]:void 0,o=a?e.retainedDefinitions?.[a.definitionId]:e.definition;n.unshift({id:i,name:e.retainedDefinitions?.[t.definitionId]?.name??t.definitionId,call:o?.steps.find(e=>e.id===t.callStepId)?.name??t.callStepId,attempt:t.callAttempt}),i=t.parentInvocationId}return n}function Ow(e,t,n,r){return`stepId=${encodeURIComponent(e)}${n?``:`&attempt=${t}`}${r?`&invocationId=${encodeURIComponent(r)}`:``}`}var kw=e(ve(),1);function Aw(e){return{x:e%3*286,y:Math.floor(e/3)*270}}function jw(e){let t;try{t=new Set(NC(e).loops.map(e=>e.headerId))}catch{t=new Set(e.steps.filter(t=>{let n=e.edges.filter(e=>e.from===t.id).map(e=>e.to),r=new Set;for(;n.length;){let i=n.pop();if(i===t.id)return!0;r.has(i)||(r.add(i),n.push(...e.edges.filter(e=>e.from===i).map(e=>e.to)))}return!1}).map(e=>e.id))}return{...e,loopSettings:Object.fromEntries(Object.entries(e.loopSettings??{}).filter(([e])=>t.has(e))),steps:e.steps.map(e=>{if(t.has(e.id)||!e.repeatMapping)return e;let n={...e};return delete n.repeatMapping,n})}}function Mw(e,{orientation:t=`horizontal`}={}){let n=NC(e).loops,r=new Map(e.steps.map((e,t)=>[e.id,e.position??Aw(t)])),i=new Map;for(let e of[...n].reverse()){let a=n.filter(t=>t.parentHeaderId===e.headerId),o=[...e.memberIds.filter(e=>!a.some(t=>t.memberIds.includes(e))).map(e=>({...r.get(e),width:208,height:192})),...a.map(e=>i.get(e.headerId))],s=Math.min(...o.map(e=>e.x)),c=Math.min(...o.map(e=>e.y)),l=Math.max(...o.map(e=>e.x+e.width)),u=Math.max(...o.map(e=>e.y+e.height)),d=t===`vertical`,f=s-(d?264:24),p=c-(d?24:112);i.set(e.headerId,{x:f,y:p,width:d?l+24-f:Math.max(360,l+24-f),height:u+24-p})}let a=`loop:`;for(;e.steps.some(e=>e.id.startsWith(a));)a+=`:`;let o=e=>`${a}${e}`,s=(e,t)=>{let n=t?i.get(t):{x:0,y:0};return{x:e.x-n.x,y:e.y-n.y}};return[...n.map(e=>({id:o(e.headerId),type:`loop`,...e.parentHeaderId?{parentId:o(e.parentHeaderId)}:{},position:s(i.get(e.headerId),e.parentHeaderId),style:{width:i.get(e.headerId).width,height:i.get(e.headerId).height},selectable:!1,deletable:!1,draggable:!1,connectable:!1,zIndex:1,data:{headerId:e.headerId,orientation:t}})),...e.steps.map(e=>{let t=[...n].reverse().find(t=>t.memberIds.includes(e.id));return{id:e.id,type:`workflow`,...t?{parentId:o(t.headerId)}:{},position:s(r.get(e.id),t?.headerId),zIndex:2,data:{step:e}}})]}function Nw(e,t){let n=t.find(t=>t.id===e.parentId),r=n?Nw(n,t):{x:0,y:0};return{x:e.position.x+r.x,y:e.position.y+r.y}}function Pw(e,t){let n=t+e.grants.filter(t=>t.activation===e.activation).length,r=e.try;return`${e.phase===`inactive`?`Not started`:`Try ${r} of ${n}`} · ${e.phase===`limit`?`Loop limit reached`:e.phase}`}function Fw(e){return Object.entries(e.loops??{}).filter(([,e])=>e.phase===`limit`)}function Iw(e,t){if(t===void 0)return`In progress`;let n=Math.max(0,Math.floor((t-e)/1e3));return[[Math.floor(n/3600),`h`],[Math.floor(n/60)%60,`m`],[n%60,`s`]].filter(([e])=>e!==0).map(([e,t])=>`${e}${t}`).join(` `)||`0s`}var Lw=.1,Rw=.05;function zw(e,t){let n=NC(e),r=new Set(n.loops.flatMap(e=>e.backEdgeIds)),i=new Map(e.steps.map(e=>[e.id,[]]));for(let t of e.edges)r.has(t.id)||i.get(t.to).push(t.from);let a=new Map,o=new Map(e.edges.map(e=>[e.id,e]));for(let e of n.loops)for(let t of e.exitEdgeIds){if(r.has(t))continue;let n=o.get(t)?.to;n&&a.set(n,[...a.get(n)??[],e])}let s=new Map,c=!0;for(;c;){c=!1;for(let e of n.order){let t=Math.max(-1,...i.get(e).map(e=>s.get(e)??-1),...(a.get(e)??[]).flatMap(e=>e.memberIds.map(e=>s.get(e)??-1)))+1;(s.get(e)??-1)<t&&(s.set(e,t),c=!0)}}let l=new Map(n.loops.map(e=>[e.headerId,e])),u=e=>{let t=0,r=[...n.loops].reverse().find(t=>t.memberIds.includes(e));for(;r;)t++,r=r.parentHeaderId?l.get(r.parentHeaderId):void 0;return t},d=Math.max(0,...e.steps.map(e=>u(e.id))),f=new Map,p=(t,r)=>{let i=n.loops.filter(e=>e.parentHeaderId===t),a=new Set(i.flatMap(e=>e.memberIds)),o=t?l.get(t):void 0,c=e.steps.filter(e=>(o?o.memberIds.includes(e.id):u(e.id)===0)&&!a.has(e.id)),d=new Map;for(let e of c){let t=s.get(e.id)??0,n=d.get(t)??0;f.set(e.id,r+n),d.set(t,n+1)}let m=r+Math.max(1,...d.values());for(let e of i)m+=p(e.headerId,m);return m-r};p(void 0,0);let m=t?310+d*288:270+d*136,h=t?220+d*2*24:350+d*2*24;return{...e,steps:e.steps.map(e=>{let n=s.get(e.id)??0,r=f.get(e.id)??0;return{...e,position:t?{x:r*m,y:n*h}:{x:n*h,y:r*m}}})}}function Bw(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=Bw(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var Vw={value:()=>{}};function Hw(){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 Uw(n)}function Uw(e){this._=e}function Ww(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}})}Uw.prototype=Hw.prototype={constructor:Uw,on:function(e,t){var n=this._,r=Ww(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Gw(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]=Kw(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Kw(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 Uw(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 Gw(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Kw(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Vw,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var qw={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 Jw(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),qw.hasOwnProperty(t)?{space:qw[t],local:e}:e}function Yw(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 Xw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zw(e){var t=Jw(e);return(t.local?Xw:Yw)(t)}function Qw(){}function $w(e){return e==null?Qw:function(){return this.querySelector(e)}}function eT(e){typeof e!=`function`&&(e=$w(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 HE(r,this._parents)}function tT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function nT(){return[]}function rT(e){return e==null?nT:function(){return this.querySelectorAll(e)}}function iT(e){return function(){return tT(e.apply(this,arguments))}}function aT(e){e=typeof e==`function`?iT(e):rT(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 HE(r,i)}function oT(e){return function(){return this.matches(e)}}function sT(e){return function(t){return t.matches(e)}}var cT=Array.prototype.find;function lT(e){return function(){return cT.call(this.children,e)}}function uT(){return this.firstElementChild}function dT(e){return this.select(e==null?uT:lT(typeof e==`function`?e:sT(e)))}var fT=Array.prototype.filter;function pT(){return Array.from(this.children)}function mT(e){return function(){return fT.call(this.children,e)}}function hT(e){return this.selectAll(e==null?pT:mT(typeof e==`function`?e:sT(e)))}function gT(e){typeof e!=`function`&&(e=oT(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 HE(r,this._parents)}function _T(e){return Array(e.length)}function vT(){return new HE(this._enter||this._groups.map(_T),this._parents)}function yT(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yT.prototype={constructor:yT,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 bT(e){return function(){return e}}function xT(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 yT(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function ST(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 yT(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function CT(e){return e.__data__}function wT(e,t){if(!arguments.length)return Array.from(this,CT);var n=t?ST:xT,r=this._parents,i=this._groups;typeof e!=`function`&&(e=bT(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=TT(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 HE(o,r),o._enter=s,o._exit=c,o}function TT(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function ET(){return new HE(this._exit||this._groups.map(_T),this._parents)}function DT(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 OT(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 HE(s,this._parents)}function kT(){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 AT(e){e||=jT;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 HE(i,this._parents).order()}function jT(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function MT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function NT(){return Array.from(this)}function PT(){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 FT(){let e=0;for(let t of this)++e;return e}function IT(){return!this.node()}function LT(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 RT(e){return function(){this.removeAttribute(e)}}function zT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BT(e,t){return function(){this.setAttribute(e,t)}}function VT(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function HT(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function UT(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 WT(e,t){var n=Jw(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?zT:RT:typeof t==`function`?n.local?UT:HT:n.local?VT:BT)(n,t))}function GT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function KT(e){return function(){this.style.removeProperty(e)}}function qT(e,t,n){return function(){this.style.setProperty(e,t,n)}}function JT(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function YT(e,t,n){return arguments.length>1?this.each((t==null?KT:typeof t==`function`?JT:qT)(e,t,n??``)):XT(this.node(),e)}function XT(e,t){return e.style.getPropertyValue(t)||GT(e).getComputedStyle(e,null).getPropertyValue(t)}function ZT(e){return function(){delete this[e]}}function QT(e,t){return function(){this[e]=t}}function $T(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eE(e,t){return arguments.length>1?this.each((t==null?ZT:typeof t==`function`?$T:QT)(e,t)):this.node()[e]}function tE(e){return e.trim().split(/^|\s+/)}function nE(e){return e.classList||new rE(e)}function rE(e){this._node=e,this._names=tE(e.getAttribute(`class`)||``)}rE.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 iE(e,t){for(var n=nE(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function aE(e,t){for(var n=nE(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function oE(e){return function(){iE(this,e)}}function sE(e){return function(){aE(this,e)}}function cE(e,t){return function(){(t.apply(this,arguments)?iE:aE)(this,e)}}function lE(e,t){var n=tE(e+``);if(arguments.length<2){for(var r=nE(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?cE:t?oE:sE)(n,t))}function uE(){this.textContent=``}function dE(e){return function(){this.textContent=e}}function fE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function pE(e){return arguments.length?this.each(e==null?uE:(typeof e==`function`?fE:dE)(e)):this.node().textContent}function mE(){this.innerHTML=``}function hE(e){return function(){this.innerHTML=e}}function gE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function _E(e){return arguments.length?this.each(e==null?mE:(typeof e==`function`?gE:hE)(e)):this.node().innerHTML}function vE(){this.nextSibling&&this.parentNode.appendChild(this)}function yE(){return this.each(vE)}function bE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xE(){return this.each(bE)}function SE(e){var t=typeof e==`function`?e:Zw(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function CE(){return null}function wE(e,t){var n=typeof e==`function`?e:Zw(e),r=t==null?CE:typeof t==`function`?t:$w(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function TE(){var e=this.parentNode;e&&e.removeChild(this)}function EE(){return this.each(TE)}function DE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function OE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kE(e){return this.select(e?OE:DE)}function AE(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function jE(e){return function(t){e.call(this,t,this.__data__)}}function ME(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 NE(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 PE(e,t,n){return function(){var r=this.__on,i,a=jE(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 FE(e,t,n){var r=ME(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?PE:NE,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function IE(e,t,n){var r=GT(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 LE(e,t){return function(){return IE(this,e,t)}}function RE(e,t){return function(){return IE(this,e,t.apply(this,arguments))}}function zE(e,t){return this.each((typeof t==`function`?RE:LE)(e,t))}function*BE(){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 VE=[null];function HE(e,t){this._groups=e,this._parents=t}function UE(){return new HE([[document.documentElement]],VE)}function WE(){return this}HE.prototype=UE.prototype={constructor:HE,select:eT,selectAll:aT,selectChild:dT,selectChildren:hT,filter:gT,data:wT,enter:vT,exit:ET,join:DT,merge:OT,selection:WE,order:kT,sort:AT,call:MT,nodes:NT,node:PT,size:FT,empty:IT,each:LT,attr:WT,style:YT,property:eE,classed:lE,text:pE,html:_E,raise:yE,lower:xE,append:SE,insert:wE,remove:EE,clone:kE,datum:AE,on:FE,dispatch:zE,[Symbol.iterator]:BE};function GE(e){return typeof e==`string`?new HE([[document.querySelector(e)]],[document.documentElement]):new HE([[e]],VE)}function KE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function qE(e,t){if(e=KE(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 JE={passive:!1},YE={capture:!0,passive:!1};function XE(e){e.stopImmediatePropagation()}function ZE(e){e.preventDefault(),e.stopImmediatePropagation()}function QE(e){var t=e.document.documentElement,n=GE(e).on(`dragstart.drag`,ZE,YE);`onselectstart`in t?n.on(`selectstart.drag`,ZE,YE):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function $E(e,t){var n=e.document.documentElement,r=GE(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,ZE,YE),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 eD=e=>()=>e;function tD(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}})}tD.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function nD(e){return!e.ctrlKey&&!e.button}function rD(){return this.parentNode}function iD(e,t){return t??{x:e.x,y:e.y}}function aD(){return navigator.maxTouchPoints||`ontouchstart`in this}function oD(){var e=nD,t=rD,n=iD,r=aD,i={},a=Hw(`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`,_,JE).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&&(GE(n.view).on(`mousemove.drag`,m,YE).on(`mouseup.drag`,h,YE),QE(n.view),XE(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(ZE(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){GE(e.view).on(`mousemove.drag mouseup.drag`,null),$E(e.view,l),ZE(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]))&&(XE(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])&&(ZE(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])&&(XE(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=qE(l||r,t),p,m,h;if((h=n.call(e,new tD(`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=qE(l||a,t),_=o}u.call(r,e,new tD(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:eD(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:eD(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:eD(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:eD(!!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 sD(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function cD(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function lD(){}var uD=.7,dD=1/uD,fD=`\\s*([+-]?\\d+)\\s*`,pD=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,mD=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,hD=/^#([0-9a-f]{3,8})$/,gD=RegExp(`^rgb\\(${fD},${fD},${fD}\\)$`),_D=RegExp(`^rgb\\(${mD},${mD},${mD}\\)$`),vD=RegExp(`^rgba\\(${fD},${fD},${fD},${pD}\\)$`),yD=RegExp(`^rgba\\(${mD},${mD},${mD},${pD}\\)$`),bD=RegExp(`^hsl\\(${pD},${mD},${mD}\\)$`),xD=RegExp(`^hsla\\(${pD},${mD},${mD},${pD}\\)$`),SD={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};sD(lD,DD,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:CD,formatHex:CD,formatHex8:wD,formatHsl:TD,formatRgb:ED,toString:ED});function CD(){return this.rgb().formatHex()}function wD(){return this.rgb().formatHex8()}function TD(){return BD(this).formatHsl()}function ED(){return this.rgb().formatRgb()}function DD(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=hD.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?OD(t):n===3?new MD(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kD(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kD(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=gD.exec(e))?new MD(t[1],t[2],t[3],1):(t=_D.exec(e))?new MD(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vD.exec(e))?kD(t[1],t[2],t[3],t[4]):(t=yD.exec(e))?kD(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bD.exec(e))?zD(t[1],t[2]/100,t[3]/100,1):(t=xD.exec(e))?zD(t[1],t[2]/100,t[3]/100,t[4]):SD.hasOwnProperty(e)?OD(SD[e]):e===`transparent`?new MD(NaN,NaN,NaN,0):null}function OD(e){return new MD(e>>16&255,e>>8&255,e&255,1)}function kD(e,t,n,r){return r<=0&&(e=t=n=NaN),new MD(e,t,n,r)}function AD(e){return e instanceof lD||(e=DD(e)),e?(e=e.rgb(),new MD(e.r,e.g,e.b,e.opacity)):new MD}function jD(e,t,n,r){return arguments.length===1?AD(e):new MD(e,t,n,r??1)}function MD(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}sD(MD,jD,cD(lD,{brighter(e){return e=e==null?dD:dD**+e,new MD(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?uD:uD**+e,new MD(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new MD(LD(this.r),LD(this.g),LD(this.b),ID(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:ND,formatHex:ND,formatHex8:PD,formatRgb:FD,toString:FD}));function ND(){return`#${RD(this.r)}${RD(this.g)}${RD(this.b)}`}function PD(){return`#${RD(this.r)}${RD(this.g)}${RD(this.b)}${RD((isNaN(this.opacity)?1:this.opacity)*255)}`}function FD(){let e=ID(this.opacity);return`${e===1?`rgb(`:`rgba(`}${LD(this.r)}, ${LD(this.g)}, ${LD(this.b)}${e===1?`)`:`, ${e})`}`}function ID(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function LD(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function RD(e){return e=LD(e),(e<16?`0`:``)+e.toString(16)}function zD(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new HD(e,t,n,r)}function BD(e){if(e instanceof HD)return new HD(e.h,e.s,e.l,e.opacity);if(e instanceof lD||(e=DD(e)),!e)return new HD;if(e instanceof HD)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 HD(o,s,c,e.opacity)}function VD(e,t,n,r){return arguments.length===1?BD(e):new HD(e,t,n,r??1)}function HD(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}sD(HD,VD,cD(lD,{brighter(e){return e=e==null?dD:dD**+e,new HD(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?uD:uD**+e,new HD(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 MD(GD(e>=240?e-240:e+120,i,r),GD(e,i,r),GD(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new HD(UD(this.h),WD(this.s),WD(this.l),ID(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=ID(this.opacity);return`${e===1?`hsl(`:`hsla(`}${UD(this.h)}, ${WD(this.s)*100}%, ${WD(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function UD(e){return e=(e||0)%360,e<0?e+360:e}function WD(e){return Math.max(0,Math.min(1,e||0))}function GD(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 KD=e=>()=>e;function qD(e,t){return function(n){return e+n*t}}function JD(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function YD(e){return(e=+e)==1?XD:function(t,n){return n-t?JD(t,n,e):KD(isNaN(t)?n:t)}}function XD(e,t){var n=t-e;return n?qD(e,n):KD(isNaN(e)?t:e)}var ZD=(function e(t){var n=YD(t);function r(e,t){var r=n((e=jD(e)).r,(t=jD(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=XD(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 QD(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 $D(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function eO(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]=lO(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 tO(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function nO(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function rO(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]=lO(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var iO=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,aO=new RegExp(iO.source,`g`);function oO(e){return function(){return e}}function sO(e){return function(t){return e(t)+``}}function cO(e,t){var n=iO.lastIndex=aO.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=iO.exec(e))&&(i=aO.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:nO(r,i)})),n=aO.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?sO(c[0].x):oO(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 lO(e,t){var n=typeof t,r;return t==null||n===`boolean`?KD(t):(n===`number`?nO:n===`string`?(r=DD(t))?(t=r,ZD):cO:t instanceof DD?ZD:t instanceof Date?tO:$D(t)?QD:Array.isArray(t)?eO:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?rO:nO)(e,t)}var uO=180/Math.PI,dO={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function fO(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)*uO,skewX:Math.atan(c)*uO,scaleX:o,scaleY:s}}var pO;function mO(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?dO:fO(t.a,t.b,t.c,t.d,t.e,t.f)}function hO(e){return e==null||(pO||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),pO.setAttribute(`transform`,e),!(e=pO.transform.baseVal.consolidate()))?dO:(e=e.matrix,fO(e.a,e.b,e.c,e.d,e.e,e.f))}function gO(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:nO(e,i)},{i:c-2,x:nO(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:nO(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:nO(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:nO(e,n)},{i:s-2,x:nO(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 _O=gO(mO,`px, `,`px)`,`deg)`),vO=gO(hO,`, `,`)`,`)`),yO=1e-12;function bO(e){return((e=Math.exp(e))+1/e)/2}function xO(e){return((e=Math.exp(e))-1/e)/2}function SO(e){return((e=Math.exp(2*e))-1)/(e+1)}var CO=(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<yO)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=bO(y),c=s/(n*g)*(i*SO(t*r+y)-xO(y));return[a+c*d,o+c*f,s*i/bO(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),wO=0,TO=0,EO=0,DO=1e3,OO,kO,AO=0,jO=0,MO=0,NO=typeof performance==`object`&&performance.now?performance:Date,PO=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function FO(){return jO||=(PO(IO),NO.now()+MO)}function IO(){jO=0}function LO(){this._call=this._time=this._next=null}LO.prototype=RO.prototype={constructor:LO,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?FO():+n)+(t==null?0:+t),!this._next&&kO!==this&&(kO?kO._next=this:OO=this,kO=this),this._call=e,this._time=n,UO()},stop:function(){this._call&&(this._call=null,this._time=1/0,UO())}};function RO(e,t,n){var r=new LO;return r.restart(e,t,n),r}function zO(){FO(),++wO;for(var e=OO,t;e;)(t=jO-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wO}function BO(){jO=(AO=NO.now())+MO,wO=TO=0;try{zO()}finally{wO=0,HO(),jO=0}}function VO(){var e=NO.now(),t=e-AO;t>DO&&(MO-=t,AO=e)}function HO(){for(var e,t=OO,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:OO=n);kO=e,UO(r)}function UO(e){wO||(TO&&=clearTimeout(TO),e-jO>24?(e<1/0&&(TO=setTimeout(BO,e-NO.now()-MO)),EO&&=clearInterval(EO)):(EO||=(AO=NO.now(),setInterval(VO,DO)),wO=1,PO(BO)))}function WO(e,t,n){var r=new LO;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var GO=Hw(`start`,`end`,`cancel`,`interrupt`),KO=[];function qO(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;ZO(e,n,{name:t,index:r,group:i,on:GO,tween:KO,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function JO(e,t){var n=XO(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function YO(e,t){var n=XO(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function XO(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function ZO(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=RO(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 WO(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(WO(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 QO(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 $O(e){return this.each(function(){QO(this,e)})}function ek(e,t){var n,r;return function(){var i=YO(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 tk(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=YO(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 nk(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=XO(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?ek:tk)(n,e,t))}function rk(e,t,n){var r=e._id;return e.each(function(){var e=YO(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return XO(e,r).value[t]}}function ik(e,t){var n;return(typeof t==`number`?nO:t instanceof DD?ZD:(n=DD(t))?(t=n,ZD):cO)(e,t)}function ak(e){return function(){this.removeAttribute(e)}}function ok(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sk(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 ck(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 lk(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 uk(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 dk(e,t){var n=Jw(e),r=n===`transform`?vO:ik;return this.attrTween(e,typeof t==`function`?(n.local?uk:lk)(n,r,rk(this,`attr.`+e,t)):t==null?(n.local?ok:ak)(n):(n.local?ck:sk)(n,r,t))}function fk(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function pk(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function mk(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&pk(e,i)),n}return i._value=t,i}function hk(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&fk(e,i)),n}return i._value=t,i}function gk(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=Jw(e);return this.tween(n,(r.local?mk:hk)(r,t))}function _k(e,t){return function(){JO(this,e).delay=+t.apply(this,arguments)}}function vk(e,t){return t=+t,function(){JO(this,e).delay=t}}function yk(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_k:vk)(t,e)):XO(this.node(),t).delay}function bk(e,t){return function(){YO(this,e).duration=+t.apply(this,arguments)}}function xk(e,t){return t=+t,function(){YO(this,e).duration=t}}function Sk(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?bk:xk)(t,e)):XO(this.node(),t).duration}function Ck(e,t){if(typeof t!=`function`)throw Error();return function(){YO(this,e).ease=t}}function wk(e){var t=this._id;return arguments.length?this.each(Ck(t,e)):XO(this.node(),t).ease}function Tk(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();YO(this,e).ease=n}}function Ek(e){if(typeof e!=`function`)throw Error();return this.each(Tk(this._id,e))}function Dk(e){typeof e!=`function`&&(e=oT(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 nA(r,this._parents,this._name,this._id)}function Ok(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 nA(o,this._parents,this._name,this._id)}function kk(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 Ak(e,t,n){var r,i,a=kk(t)?JO:YO;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function jk(e,t){var n=this._id;return arguments.length<2?XO(this.node(),n).on.on(e):this.each(Ak(n,e,t))}function Mk(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Nk(){return this.on(`end.remove`,Mk(this._id))}function Pk(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=$w(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,qO(l[f],t,n,f,l,XO(u,n)));return new nA(a,this._parents,t,n)}function Fk(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=rT(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=XO(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&qO(p,t,n,h,f,m);a.push(f),o.push(u)}return new nA(a,o,t,n)}var Ik=UE.prototype.constructor;function Lk(){return new Ik(this._groups,this._parents)}function Rk(e,t){var n,r,i;return function(){var a=XT(this,e),o=(this.style.removeProperty(e),XT(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function zk(e){return function(){this.style.removeProperty(e)}}function Bk(e,t,n){var r,i=n+``,a;return function(){var o=XT(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Vk(e,t,n){var r,i,a;return function(){var o=XT(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),XT(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Hk(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=YO(this,e),l=c.on,u=c.value[a]==null?s||=zk(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Uk(e,t,n){var r=(e+=``)==`transform`?_O:ik;return t==null?this.styleTween(e,Rk(e,r)).on(`end.style.`+e,zk(e)):typeof t==`function`?this.styleTween(e,Vk(e,r,rk(this,`style.`+e,t))).each(Hk(this._id,e)):this.styleTween(e,Bk(e,r,t),n).on(`end.style.`+e,null)}function Wk(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Gk(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Wk(e,a,n)),r}return a._value=t,a}function Kk(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,Gk(e,t,n??``))}function qk(e){return function(){this.textContent=e}}function Jk(e){return function(){var t=e(this);this.textContent=t??``}}function Yk(e){return this.tween(`text`,typeof e==`function`?Jk(rk(this,`text`,e)):qk(e==null?``:e+``))}function Xk(e){return function(t){this.textContent=e.call(this,t)}}function Zk(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Xk(r)),t}return r._value=e,r}function Qk(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,Zk(e))}function $k(){for(var e=this._name,t=this._id,n=rA(),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=XO(c,t);qO(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new nA(r,this._parents,e,n)}function eA(){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=YO(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 tA=0;function nA(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function rA(){return++tA}var iA=UE.prototype;nA.prototype={constructor:nA,select:Pk,selectAll:Fk,selectChild:iA.selectChild,selectChildren:iA.selectChildren,filter:Dk,merge:Ok,selection:Lk,transition:$k,call:iA.call,nodes:iA.nodes,node:iA.node,size:iA.size,empty:iA.empty,each:iA.each,on:jk,attr:dk,attrTween:gk,style:Uk,styleTween:Kk,text:Yk,textTween:Qk,remove:Nk,tween:nk,delay:yk,duration:Sk,ease:wk,easeVarying:Ek,end:eA,[Symbol.iterator]:iA[Symbol.iterator]};function aA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var oA={time:null,delay:0,duration:250,ease:aA};function sA(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function cA(e){var t,n;e instanceof nA?(t=e._id,e=e._name):(t=rA(),(n=oA).time=FO(),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])&&qO(c,e,t,l,o,n||sA(c,t));return new nA(r,this._parents,e,t)}UE.prototype.interrupt=$O,UE.prototype.transition=cA;var lA=e=>()=>e;function uA(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 dA(e,t,n){this.k=e,this.x=t,this.y=n}dA.prototype={constructor:dA,scale:function(e){return e===1?this:new dA(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new dA(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 fA=new dA(1,0,0);pA.prototype=dA.prototype;function pA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fA;return e.__zoom}function mA(e){e.stopImmediatePropagation()}function hA(e){e.preventDefault(),e.stopImmediatePropagation()}function gA(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function _A(){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 vA(){return this.__zoom||fA}function yA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bA(){return navigator.maxTouchPoints||`ontouchstart`in this}function xA(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 SA(){var e=gA,t=_A,n=xA,r=yA,i=bA,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=CO,l=Hw(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,vA).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`,vA),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(fA.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 dA(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 dA(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 dA(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=GE(this.that).datum();l.call(e,this.that,new uA(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=qE(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)],QO(this),s.start();hA(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=GE(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=qE(t,i),l=t.clientX,u=t.clientY;QE(t.view),mA(t),a.mouse=[c,this.__zoom.invert(c)],QO(this),a.start();function d(e){if(hA(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]=qE(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),$E(e.view,a.moved),hA(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=qE(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);hA(r),s>0?GE(this).transition().duration(s).call(x,d,c,r):GE(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(mA(t),s=0;s<i;++s)c=r[s],l=qE(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)),QO(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(hA(e),s=0;s<a;++s)c=i[s],l=qE(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(mA(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=qE(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=GE(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:lA(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:lA(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:lA(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:lA([[+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 CA={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.`},wA=[[-1/0,-1/0],[1/0,1/0]],TA=[`Enter`,` `,`Escape`],EA={"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`},DA;(function(e){e.Strict=`strict`,e.Loose=`loose`})(DA||={});var OA;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(OA||={});var kA;(function(e){e.Partial=`partial`,e.Full=`full`})(kA||={});var AA={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},jA;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(jA||={});var MA;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(MA||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var NA={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},PA=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,FA=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),IA=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),LA=(e,t=[0,0])=>{let{width:n,height:r}=_j(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},RA=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):IA(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,ZA(e,tj(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?$A(r):{x:0,y:0,width:0,height:0}},zA=(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=ZA(n,tj(e)),r=!0)}),r?$A(n):{x:0,y:0,width:0,height:0}},BA=(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=rj(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},VA=(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 HA(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}=_j(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 UA({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=mj(zA(HA(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 WA({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`,CA.error005());else{let{width:e,height:t}=_j(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&gj(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=gj(d)?qA(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,CA.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 GA({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=VA(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 KA=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),qA=(e={x:0,y:0},t,n)=>({x:KA(e.x,t[0][0],t[1][0]-(n?.width??0)),y:KA(e.y,t[0][1],t[1][1]-(n?.height??0))});function JA(e,t,n){let{width:r,height:i}=_j(n),{x:a,y:o}=n.internals.positionAbsolute;return qA(e,[[a,o],[a+r,o+i]],t)}var YA=(e,t,n)=>e<t?KA(Math.abs(e-t),1,t)/t:e>n?-KA(Math.abs(e-n),1,t)/t:0,XA=(e,t,n=15,r=40)=>[YA(e.x,r,t.width-r)*n,YA(e.y,r,t.height-r)*n],ZA=(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)}),QA=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),$A=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),ej=(e,t=[0,0])=>{let{x:n,y:r}=IA(e)?e.internals.positionAbsolute:LA(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}},tj=(e,t=[0,0])=>{let{x:n,y:r}=IA(e)?e.internals.positionAbsolute:LA(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)}},nj=(e,t)=>$A(ZA(QA(e),QA(t))),rj=(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)},ij=(e,t)=>rj(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),aj=e=>oj(e.width)&&oj(e.height)&&oj(e.x)&&oj(e.y),oj=e=>!isNaN(e)&&isFinite(e),sj=(e,t)=>(e,t)=>{},cj=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lj=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?cj(s,o):s},uj=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function dj(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 fj(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=dj(e,n),i=dj(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=dj(e.top??e.y??0,n),i=dj(e.bottom??e.y??0,n),a=dj(e.left??e.x??0,t),o=dj(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 pj(e,t,n,r,i,a){let{x:o,y:s}=uj(e,[t,n,r]),{x:c,y:l}=uj({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 mj=(e,t,n,r,i,a)=>{let o=fj(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=KA(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=pj(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}},hj=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function gj(e){return e!=null&&e!==`parent`}function _j(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function vj(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function yj(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 bj(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function xj(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Sj(e){return{...EA,...e||{}}}function Cj(e){return e===null?null:e?`valid`:`invalid`}function wj(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Aj(e),s=lj({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?cj(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Tj=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ej=e=>e?.getRootNode?.()||window?.document,Dj=[`INPUT`,`SELECT`,`TEXTAREA`];function Oj(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Dj.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var kj=e=>`clientX`in e,Aj=(e,t)=>{let n=kj(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)}},jj=(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,...Tj(t)}})};function Mj({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 Nj(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Pj({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Nj(t-r,a),n];case Q.Right:return[t+Nj(r-t,a),n];case Q.Top:return[t,n-Nj(n-i,a)];case Q.Bottom:return[t,n+Nj(i-n,a)]}}function Fj({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Pj({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Pj({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Mj({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 Ij({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 Lj({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 Rj({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=ZA(tj(e),tj(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),ij({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},$A(a))>0}var zj=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Bj=(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)),Vj=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,CA.error006()),t;let r=n.getEdgeId||zj,i;return i=PA(e)?{...e}:{...e,id:r(e)},Bj(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Hj({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Ij({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Uj={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Wj=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},Gj=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Kj({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Uj[t],c=Uj[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=Wj({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]=Ij({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 qj(e,t,n,r){let i=Math.min(Gj(e,t)/2,Gj(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 Jj({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Kj({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+=qj(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 Yj(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Xj(e){let{sourceNode:t,targetNode:n}=e;if(!Yj(t)||!Yj(n))return null;let r=t.internals.handleBounds||Zj(t.handles),i=n.internals.handleBounds||Zj(n.handles),a=$j(r?.source??[],e.sourceHandle),o=$j(e.connectionMode===DA.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,CA.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=Qj(t,a,s),u=Qj(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function Zj(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 Qj(e,t,n=Q.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??_j(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function $j(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function eM(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function tM(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=eM(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 nM=1e3,rM=10,iM={nodeOrigin:[0,0],nodeExtent:wA,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},aM={...iM,checkEquality:!0};function oM(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function sM(e,t,n){let r=oM(iM,n);for(let n of e.values())if(n.parentId)fM(n,e,t,r);else{let e=qA(LA(n,r.nodeOrigin),gj(n.extent)?n.extent:r.nodeExtent,_j(n));n.internals.positionAbsolute=e}}function cM(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 lM(e){return e===`manual`}function uM(e,t,n,r={}){let i=oM(aM,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!lM(i.zIndexMode)?nM: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=qA(LA(u,i.nodeOrigin),gj(u.extent)?u.extent:i.nodeExtent,_j(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:cM(u,e),z:pM(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&&fM(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function dM(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 fM(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=oM(iM,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}dM(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*rM),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=mM(e,u,o,s,a&&!lM(c)?nM: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 pM(e,t,n){let r=oj(e.zIndex)?e.zIndex:0;return lM(n)?r:r+(e.selected?t:0)}function mM(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=_j(e),l=LA(e,n),u=gj(e.extent)?qA(l,e.extent,c):l,d=qA({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=JA(d,c,t));let f=pM(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function hM(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=nj(a.get(n.parentId)?.expandedRect??ej(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=_j(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 gM(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=Tj(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=gj(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=JA(h,s,n))}else m&&(h=qA(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:jj(`source`,r.nodeElement,p,d,e.id),target:jj(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&fM(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:ej(g,i)}))}}if(f.length>0){let e=hM(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function _M({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 vM(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 yM(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}`;vM(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),vM(`target`,s,c,e,i,o),t.set(r.id,r)}}function bM(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:bM(n,t):!1}function xM(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 SM(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!bM(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 CM({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 wM({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=cj(a,t);return{x:o.x-a.x,y:o.y-a.y}}function TM({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=GE(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?QA(zA(s)):null,x=v&&l?wM({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)}:cj(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}=WA({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]=CM({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]=XA(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=wj(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=SM(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=CM({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=oD().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=wj(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Aj(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=wj(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=Aj(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=Aj(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]=CM({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||!xM(t,`.${g}`,v))&&(!_||xM(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function EM(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())ij(i,ej(e))>0&&r.push(e);return r}var DM=250;function OM(e,t,n,r){let i=[],a=1/0,o=EM(e,n,t+DM);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}=Qj(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 kM(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,...Qj(o,c,c.position,!0)}:c}function AM(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function jM(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var MM=()=>!0;function NM(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:_=MM,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Ej(e.target),E=0,D,{x:O,y:k}=Aj(e),A=AM(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=kM(i,A,r,c,t);if(!N)return;let P=Aj(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=XA(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),te={inProgress:!0,isValid:null,from:Qj(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:NA[z.position],toNode:null,pointer:P};function V(){M=!0,y(te),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=Aj(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=Aj(e,j),D=OM(lj(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=PM(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=jM(!!D,s.isValid);let u=c.get(i),f=u?Qj(u,z,Q.Left,!0):te.from,p={...te,from:f,isValid:L,to:s.toHandle&&L?uj({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:NA[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),te=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=te,r={...n,toPosition:te.toHandle?te.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function PM(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=MM,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}=Aj(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=AM(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===DA.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=kM(t,e,a,u,n,!0)}return _}var FM={onPointerDown:NM,isValid:PM};function IM({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=GE(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&&hj()?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=SA().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:qE}}var LM=e=>({x:e.x,y:e.y,zoom:e.k}),RM=({x:e,y:t,zoom:n})=>fA.translate(e,t).scale(n),zM=(e,t)=>e.target.closest(`.${t}`),BM=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),VM=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,HM=(e,t=0,n=VM,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},UM=e=>{let t=e.ctrlKey&&hj()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function WM({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(zM(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=qE(u),t=d*2**UM(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===OA.Vertical?0:u.deltaX*f,m=i===OA.Horizontal?0:u.deltaY*f;!hj()&&u.shiftKey&&i!==OA.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=LM(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 GM({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=zM(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function KM({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=LM(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 qM({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&BM(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,LM(a.transform))}}function JM({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&BM(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=LM(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function YM({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(zM(f,`${u}-flow__node`)||zM(f,`${u}-flow__edge`)||zM(f,`${u}-flow__selection`)||zM(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||zM(f,c)&&h||zM(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function XM({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=SA().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=GE(e).call(f);y({x:i.x,y:i.y,zoom:KA(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(UM);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?lO:CO).transform(HM(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,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!oj(D)||D<0?0:D);let A=k?WM({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):GM({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=KM({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=qM({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=JM({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=YM({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),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=RM(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=RM(e);return await g(n,t),n}function x(e){if(p){let t=RM(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?pA(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`?lO:CO).scaleTo(HM(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?lO:CO).scaleBy(HM(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=!oj(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 ZM;(function(e){e.Line=`line`,e.Handle=`handle`})(ZM||={});function QM({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 $M(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 eN(e,t){return Math.max(0,t-e)}function tN(e,t){return Math.max(0,e-t)}function nN(e,t,n){return Math.max(0,t-e,e-n)}function rN(e,t){return e?!t:t}function iN(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=nN(E,h,g),j=nN(D,_,v);if(o){let e=0,t=0;c&&w<0?e=eN(y+w+O,o[0][0]):!c&&w>0&&(e=tN(y+E+O,o[1][0])),l&&T<0?t=eN(b+T+k,o[0][1]):!l&&T>0&&(t=tN(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=tN(y+w,s[0][0]):!c&&w<0&&(e=eN(y+E,s[1][0])),l&&T>0?t=tN(b+T,s[0][1]):!l&&T<0&&(t=eN(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=nN(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?tN(b+k+E/C,o[1][1])*C:eN(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?eN(b+E/C,s[1][1])*C:tN(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=nN(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?tN(y+D*C+O,o[1][0])/C:eN(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?eN(y+D*C,s[1][0])/C:tN(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=(rN(c,l)?-w:w)/C:w=(rN(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 aN={width:0,height:0,x:0,y:0},oN={...aN,pointerX:0,pointerY:0,aspectRatio:1};function sN(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 cN({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=GE(e),o={controlDirection:$M(`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={...aN},h={...oN};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:$M(e)};let g,_=null,v=[],y,b,x,S=!1,C=oD().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}=wj(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=gj(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=sN(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=wj(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}=iN(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=QM({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 lN=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},uN=e=>e?lN(e):lN,{useDebugValue:dN}=H.default,{useSyncExternalStoreWithSelector:fN}=kw.default,pN=e=>e;function mN(e,t=pN,n){let r=fN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dN(r),r}var hN=(e,t)=>{let n=uN(e),r=(e,r=t)=>mN(n,e,r);return Object.assign(r,n),r},gN=(e,t)=>e?hN(e,t):hN;function _N(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 vN=(0,H.createContext)(null),yN=vN.Provider,bN=CA.error001(`react`);function $(e,t){let n=(0,H.useContext)(vN);if(n===null)throw Error(bN);return mN(n,e,t)}function xN(){let e=(0,H.useContext)(vN);if(e===null)throw Error(bN);return(0,H.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var SN={display:`none`},CN={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},wN=`react-flow__node-desc`,TN=`react-flow__edge-desc`,EN=`react-flow__aria-live`,DN=e=>e.ariaLiveMessage,ON=e=>e.ariaLabelConfig;function kN({rfId:e}){let t=$(DN);return(0,U.jsx)(`div`,{id:`${EN}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:CN,children:t})}function AN({rfId:e,disableKeyboardA11y:t}){let n=$(ON);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{id:`${wN}-${e}`,style:SN,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,U.jsx)(`div`,{id:`${TN}-${e}`,style:SN,children:n[`edge.a11yDescription.default`]}),!t&&(0,U.jsx)(kN,{rfId:e})]})}var jN=(0,H.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,U.jsx)(`div`,{className:Bw([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});jN.displayName=`Panel`;var MN=`https://reactflow.dev?utm_source=attribution`;function NN({proOptions:e,position:t=`bottom-right`}){return(0,H.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,U.jsx)(jN,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${MN}`,children:(0,U.jsx)(`a`,{href:MN,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var PN=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}},FN=e=>e.id;function IN(e,t){return _N(e.selectedNodes.map(FN),t.selectedNodes.map(FN))&&_N(e.selectedEdges.map(FN),t.selectedEdges.map(FN))}function LN({onSelectionChange:e}){let t=xN(),{selectedNodes:n,selectedEdges:r}=$(PN,IN);return(0,H.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var RN=e=>!!e.onSelectionChangeHandlers;function zN({onSelectionChange:e}){let t=$(RN);return e||t?(0,U.jsx)(LN,{onSelectionChange:e}):null}var BN=[0,0],VN={x:0,y:0,zoom:1},HN=[...`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`],UN=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}),WN={translateExtent:wA,nodeOrigin:BN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function GN(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(UN,_N),l=xN();(0,H.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=WN,s()}),[]);let u=(0,H.useRef)(WN);return(0,H.useEffect)(()=>{for(let s of HN){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:Sj(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},HN.map(t=>e[t])),null}function KN(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function qN(e){let[t,n]=(0,H.useState)(e===`system`?null:e);return(0,H.useEffect)(()=>{if(e!==`system`){n(e);return}let t=KN(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?KN()?.matches?`dark`:`light`:t}var JN=typeof document<`u`?document:null;function YN(e=null,t={target:JN,actInsideInputWithModifier:!0}){let[n,r]=(0,H.useState)(!1),i=(0,H.useRef)(!1),a=(0,H.useRef)(new Set([])),[o,s]=(0,H.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
140
+ `)})})]}),e.type===`array`&&(0,U.jsx)(Ow,{schema:e.items,onChange:n=>t({...e,items:n})}),e.type===`object`&&(0,U.jsxs)(U.Fragment,{children:[Object.entries(e.fields).map(([n,r])=>(0,U.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 rounded-lg border p-3`,children:[(0,U.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:n}),(0,U.jsx)(O,{size:`sm`,variant:`destructive`,className:`justify-self-start`,onClick:()=>t({...e,fields:Object.fromEntries(Object.entries(e.fields).filter(([e])=>e!==n))}),children:`Remove field`}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{checked:!!r.required,onCheckedChange:i=>t({...e,fields:{...e.fields,[n]:{...r,required:i}}})}),`Required`]}),(0,U.jsx)(Ow,{schema:r.schema,onChange:i=>t({...e,fields:{...e.fields,[n]:{...r,schema:i}}})}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(zt,{checked:r.default!==void 0,onCheckedChange:i=>{let a={...r};i?a.default=Ew(r.schema):delete a.default,t({...e,fields:{...e.fields,[n]:a}})}}),`Default`]}),r.default!==void 0&&(0,U.jsx)(Dw,{schema:r.schema,value:r.default,onChange:i=>t({...e,fields:{...e.fields,[n]:{...r,default:i}}})})]},n)),(0,U.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:n=>{n.preventDefault();let r=n.currentTarget,i=String(new FormData(r).get(`field`));i&&![`__proto__`,`constructor`,`prototype`].includes(i)&&!e.fields[i]&&(t({...e,fields:{...e.fields,[i]:{schema:{type:`string`}}}}),r.reset())},children:[(0,U.jsx)(he,{className:`min-w-0 flex-1`,name:`field`,"aria-label":`New field name`,placeholder:`Field name`,required:!0}),(0,U.jsx)(O,{type:`submit`,size:`sm`,variant:`outline`,children:`Add field`})]})]})]})}function kw(e,t){return{...e,workflowId:t.id,contract:structuredClone(t.contract)}}function Aw(e,t){let n=[],r=new Set;for(let i=t||void 0;i!==void 0;){let t=e.invocations?.[i];if(!t||r.has(i))break;r.add(i);let a=t.parentInvocationId?e.invocations?.[t.parentInvocationId]:void 0,o=a?e.retainedDefinitions?.[a.definitionId]:e.definition;n.unshift({id:i,name:e.retainedDefinitions?.[t.definitionId]?.name??t.definitionId,call:o?.steps.find(e=>e.id===t.callStepId)?.name??t.callStepId,attempt:t.callAttempt}),i=t.parentInvocationId}return n}function jw(e,t,n,r){return`stepId=${encodeURIComponent(e)}${n?``:`&attempt=${t}`}${r?`&invocationId=${encodeURIComponent(r)}`:``}`}var Mw=e(ve(),1);function Nw(e){return{x:e%3*286,y:Math.floor(e/3)*270}}function Pw(e){let t;try{t=new Set(IC(e).loops.map(e=>e.headerId))}catch{t=new Set(e.steps.filter(t=>{let n=e.edges.filter(e=>e.from===t.id).map(e=>e.to),r=new Set;for(;n.length;){let i=n.pop();if(i===t.id)return!0;r.has(i)||(r.add(i),n.push(...e.edges.filter(e=>e.from===i).map(e=>e.to)))}return!1}).map(e=>e.id))}return{...e,loopSettings:Object.fromEntries(Object.entries(e.loopSettings??{}).filter(([e])=>t.has(e))),steps:e.steps.map(e=>{if(t.has(e.id)||!e.repeatMapping)return e;let n={...e};return delete n.repeatMapping,n})}}function Fw(e,{orientation:t=`horizontal`}={}){let n=IC(e).loops,r=new Map(e.steps.map((e,t)=>[e.id,e.position??Nw(t)])),i=new Map;for(let e of[...n].reverse()){let a=n.filter(t=>t.parentHeaderId===e.headerId),o=[...e.memberIds.filter(e=>!a.some(t=>t.memberIds.includes(e))).map(e=>({...r.get(e),width:208,height:192})),...a.map(e=>i.get(e.headerId))],s=Math.min(...o.map(e=>e.x)),c=Math.min(...o.map(e=>e.y)),l=Math.max(...o.map(e=>e.x+e.width)),u=Math.max(...o.map(e=>e.y+e.height)),d=t===`vertical`,f=s-(d?264:24),p=c-(d?24:112);i.set(e.headerId,{x:f,y:p,width:d?l+24-f:Math.max(360,l+24-f),height:u+24-p})}let a=`loop:`;for(;e.steps.some(e=>e.id.startsWith(a));)a+=`:`;let o=e=>`${a}${e}`,s=(e,t)=>{let n=t?i.get(t):{x:0,y:0};return{x:e.x-n.x,y:e.y-n.y}};return[...n.map(e=>({id:o(e.headerId),type:`loop`,...e.parentHeaderId?{parentId:o(e.parentHeaderId)}:{},position:s(i.get(e.headerId),e.parentHeaderId),style:{width:i.get(e.headerId).width,height:i.get(e.headerId).height},selectable:!1,deletable:!1,draggable:!1,connectable:!1,zIndex:1,data:{headerId:e.headerId,orientation:t}})),...e.steps.map(e=>{let t=[...n].reverse().find(t=>t.memberIds.includes(e.id));return{id:e.id,type:`workflow`,...t?{parentId:o(t.headerId)}:{},position:s(r.get(e.id),t?.headerId),zIndex:2,data:{step:e}}})]}function Iw(e,t){let n=t.find(t=>t.id===e.parentId),r=n?Iw(n,t):{x:0,y:0};return{x:e.position.x+r.x,y:e.position.y+r.y}}function Lw(e,t){let n=t+e.grants.filter(t=>t.activation===e.activation).length,r=e.try;return`${e.phase===`inactive`?`Not started`:`Try ${r} of ${n}`} · ${e.phase===`limit`?`Loop limit reached`:e.phase}`}function Rw(e){return Object.entries(e.loops??{}).filter(([,e])=>e.phase===`limit`)}function zw(e,t){if(t===void 0)return`In progress`;let n=Math.max(0,Math.floor((t-e)/1e3));return[[Math.floor(n/3600),`h`],[Math.floor(n/60)%60,`m`],[n%60,`s`]].filter(([e])=>e!==0).map(([e,t])=>`${e}${t}`).join(` `)||`0s`}var Bw=.1,Vw=.05;function Hw(e,t){let n=IC(e),r=new Set(n.loops.flatMap(e=>e.backEdgeIds)),i=new Map(e.steps.map(e=>[e.id,[]]));for(let t of e.edges)r.has(t.id)||i.get(t.to).push(t.from);let a=new Map,o=new Map(e.edges.map(e=>[e.id,e]));for(let e of n.loops)for(let t of e.exitEdgeIds){if(r.has(t))continue;let n=o.get(t)?.to;n&&a.set(n,[...a.get(n)??[],e])}let s=new Map,c=!0;for(;c;){c=!1;for(let e of n.order){let t=Math.max(-1,...i.get(e).map(e=>s.get(e)??-1),...(a.get(e)??[]).flatMap(e=>e.memberIds.map(e=>s.get(e)??-1)))+1;(s.get(e)??-1)<t&&(s.set(e,t),c=!0)}}let l=new Map(n.loops.map(e=>[e.headerId,e])),u=e=>{let t=0,r=[...n.loops].reverse().find(t=>t.memberIds.includes(e));for(;r;)t++,r=r.parentHeaderId?l.get(r.parentHeaderId):void 0;return t},d=Math.max(0,...e.steps.map(e=>u(e.id))),f=new Map,p=(t,r)=>{let i=n.loops.filter(e=>e.parentHeaderId===t),a=new Set(i.flatMap(e=>e.memberIds)),o=t?l.get(t):void 0,c=e.steps.filter(e=>(o?o.memberIds.includes(e.id):u(e.id)===0)&&!a.has(e.id)),d=new Map;for(let e of c){let t=s.get(e.id)??0,n=d.get(t)??0;f.set(e.id,r+n),d.set(t,n+1)}let m=r+Math.max(1,...d.values());for(let e of i)m+=p(e.headerId,m);return m-r};p(void 0,0);let m=t?310+d*288:270+d*136,h=t?220+d*2*24:350+d*2*24;return{...e,steps:e.steps.map(e=>{let n=s.get(e.id)??0,r=f.get(e.id)??0;return{...e,position:t?{x:r*m,y:n*h}:{x:n*h,y:r*m}}})}}function Uw(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=Uw(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var Ww={value:()=>{}};function Gw(){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 Kw(n)}function Kw(e){this._=e}function qw(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}})}Kw.prototype=Gw.prototype={constructor:Kw,on:function(e,t){var n=this._,r=qw(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=Jw(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]=Yw(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Yw(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 Kw(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 Jw(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Yw(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Ww,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Xw={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 Zw(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Xw.hasOwnProperty(t)?{space:Xw[t],local:e}:e}function Qw(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 $w(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eT(e){var t=Zw(e);return(t.local?$w:Qw)(t)}function tT(){}function nT(e){return e==null?tT:function(){return this.querySelector(e)}}function rT(e){typeof e!=`function`&&(e=nT(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 GE(r,this._parents)}function iT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aT(){return[]}function oT(e){return e==null?aT:function(){return this.querySelectorAll(e)}}function sT(e){return function(){return iT(e.apply(this,arguments))}}function cT(e){e=typeof e==`function`?sT(e):oT(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 GE(r,i)}function lT(e){return function(){return this.matches(e)}}function uT(e){return function(t){return t.matches(e)}}var dT=Array.prototype.find;function fT(e){return function(){return dT.call(this.children,e)}}function pT(){return this.firstElementChild}function mT(e){return this.select(e==null?pT:fT(typeof e==`function`?e:uT(e)))}var hT=Array.prototype.filter;function gT(){return Array.from(this.children)}function _T(e){return function(){return hT.call(this.children,e)}}function vT(e){return this.selectAll(e==null?gT:_T(typeof e==`function`?e:uT(e)))}function yT(e){typeof e!=`function`&&(e=lT(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 GE(r,this._parents)}function bT(e){return Array(e.length)}function xT(){return new GE(this._enter||this._groups.map(bT),this._parents)}function ST(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ST.prototype={constructor:ST,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 CT(e){return function(){return e}}function wT(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 ST(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function TT(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 ST(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function ET(e){return e.__data__}function DT(e,t){if(!arguments.length)return Array.from(this,ET);var n=t?TT:wT,r=this._parents,i=this._groups;typeof e!=`function`&&(e=CT(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=OT(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 GE(o,r),o._enter=s,o._exit=c,o}function OT(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function kT(){return new GE(this._exit||this._groups.map(bT),this._parents)}function AT(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 jT(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 GE(s,this._parents)}function MT(){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 NT(e){e||=PT;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 GE(i,this._parents).order()}function PT(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function FT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function IT(){return Array.from(this)}function LT(){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 RT(){let e=0;for(let t of this)++e;return e}function zT(){return!this.node()}function BT(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 VT(e){return function(){this.removeAttribute(e)}}function HT(e){return function(){this.removeAttributeNS(e.space,e.local)}}function UT(e,t){return function(){this.setAttribute(e,t)}}function WT(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function GT(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function KT(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 qT(e,t){var n=Zw(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?HT:VT:typeof t==`function`?n.local?KT:GT:n.local?WT:UT)(n,t))}function JT(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function YT(e){return function(){this.style.removeProperty(e)}}function XT(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ZT(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function QT(e,t,n){return arguments.length>1?this.each((t==null?YT:typeof t==`function`?ZT:XT)(e,t,n??``)):$T(this.node(),e)}function $T(e,t){return e.style.getPropertyValue(t)||JT(e).getComputedStyle(e,null).getPropertyValue(t)}function eE(e){return function(){delete this[e]}}function tE(e,t){return function(){this[e]=t}}function nE(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rE(e,t){return arguments.length>1?this.each((t==null?eE:typeof t==`function`?nE:tE)(e,t)):this.node()[e]}function iE(e){return e.trim().split(/^|\s+/)}function aE(e){return e.classList||new oE(e)}function oE(e){this._node=e,this._names=iE(e.getAttribute(`class`)||``)}oE.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 sE(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function cE(e,t){for(var n=aE(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function lE(e){return function(){sE(this,e)}}function uE(e){return function(){cE(this,e)}}function dE(e,t){return function(){(t.apply(this,arguments)?sE:cE)(this,e)}}function fE(e,t){var n=iE(e+``);if(arguments.length<2){for(var r=aE(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?dE:t?lE:uE)(n,t))}function pE(){this.textContent=``}function mE(e){return function(){this.textContent=e}}function hE(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function gE(e){return arguments.length?this.each(e==null?pE:(typeof e==`function`?hE:mE)(e)):this.node().textContent}function _E(){this.innerHTML=``}function vE(e){return function(){this.innerHTML=e}}function yE(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function bE(e){return arguments.length?this.each(e==null?_E:(typeof e==`function`?yE:vE)(e)):this.node().innerHTML}function xE(){this.nextSibling&&this.parentNode.appendChild(this)}function SE(){return this.each(xE)}function CE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wE(){return this.each(CE)}function TE(e){var t=typeof e==`function`?e:eT(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function EE(){return null}function DE(e,t){var n=typeof e==`function`?e:eT(e),r=t==null?EE:typeof t==`function`?t:nT(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function OE(){var e=this.parentNode;e&&e.removeChild(this)}function kE(){return this.each(OE)}function AE(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jE(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ME(e){return this.select(e?jE:AE)}function NE(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function PE(e){return function(t){e.call(this,t,this.__data__)}}function FE(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 IE(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 LE(e,t,n){return function(){var r=this.__on,i,a=PE(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 RE(e,t,n){var r=FE(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?LE:IE,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function zE(e,t,n){var r=JT(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 BE(e,t){return function(){return zE(this,e,t)}}function VE(e,t){return function(){return zE(this,e,t.apply(this,arguments))}}function HE(e,t){return this.each((typeof t==`function`?VE:BE)(e,t))}function*UE(){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 WE=[null];function GE(e,t){this._groups=e,this._parents=t}function KE(){return new GE([[document.documentElement]],WE)}function qE(){return this}GE.prototype=KE.prototype={constructor:GE,select:rT,selectAll:cT,selectChild:mT,selectChildren:vT,filter:yT,data:DT,enter:xT,exit:kT,join:AT,merge:jT,selection:qE,order:MT,sort:NT,call:FT,nodes:IT,node:LT,size:RT,empty:zT,each:BT,attr:qT,style:QT,property:rE,classed:fE,text:gE,html:bE,raise:SE,lower:wE,append:TE,insert:DE,remove:kE,clone:ME,datum:NE,on:RE,dispatch:HE,[Symbol.iterator]:UE};function JE(e){return typeof e==`string`?new GE([[document.querySelector(e)]],[document.documentElement]):new GE([[e]],WE)}function YE(e){let t;for(;t=e.sourceEvent;)e=t;return e}function XE(e,t){if(e=YE(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 ZE={passive:!1},QE={capture:!0,passive:!1};function $E(e){e.stopImmediatePropagation()}function eD(e){e.preventDefault(),e.stopImmediatePropagation()}function tD(e){var t=e.document.documentElement,n=JE(e).on(`dragstart.drag`,eD,QE);`onselectstart`in t?n.on(`selectstart.drag`,eD,QE):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function nD(e,t){var n=e.document.documentElement,r=JE(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,eD,QE),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 rD=e=>()=>e;function iD(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}})}iD.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function aD(e){return!e.ctrlKey&&!e.button}function oD(){return this.parentNode}function sD(e,t){return t??{x:e.x,y:e.y}}function cD(){return navigator.maxTouchPoints||`ontouchstart`in this}function lD(){var e=aD,t=oD,n=sD,r=cD,i={},a=Gw(`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`,_,ZE).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&&(JE(n.view).on(`mousemove.drag`,m,QE).on(`mouseup.drag`,h,QE),tD(n.view),$E(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(eD(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){JE(e.view).on(`mousemove.drag mouseup.drag`,null),nD(e.view,l),eD(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]))&&($E(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])&&(eD(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])&&($E(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=XE(l||r,t),p,m,h;if((h=n.call(e,new iD(`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=XE(l||a,t),_=o}u.call(r,e,new iD(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:rD(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:rD(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:rD(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:rD(!!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 uD(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function dD(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function fD(){}var pD=.7,mD=1/pD,hD=`\\s*([+-]?\\d+)\\s*`,gD=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,_D=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,vD=/^#([0-9a-f]{3,8})$/,yD=RegExp(`^rgb\\(${hD},${hD},${hD}\\)$`),bD=RegExp(`^rgb\\(${_D},${_D},${_D}\\)$`),xD=RegExp(`^rgba\\(${hD},${hD},${hD},${gD}\\)$`),SD=RegExp(`^rgba\\(${_D},${_D},${_D},${gD}\\)$`),CD=RegExp(`^hsl\\(${gD},${_D},${_D}\\)$`),wD=RegExp(`^hsla\\(${gD},${_D},${_D},${gD}\\)$`),TD={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};uD(fD,AD,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ED,formatHex:ED,formatHex8:DD,formatHsl:OD,formatRgb:kD,toString:kD});function ED(){return this.rgb().formatHex()}function DD(){return this.rgb().formatHex8()}function OD(){return UD(this).formatHsl()}function kD(){return this.rgb().formatRgb()}function AD(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=vD.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jD(t):n===3?new FD(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?MD(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?MD(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=yD.exec(e))?new FD(t[1],t[2],t[3],1):(t=bD.exec(e))?new FD(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xD.exec(e))?MD(t[1],t[2],t[3],t[4]):(t=SD.exec(e))?MD(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CD.exec(e))?HD(t[1],t[2]/100,t[3]/100,1):(t=wD.exec(e))?HD(t[1],t[2]/100,t[3]/100,t[4]):TD.hasOwnProperty(e)?jD(TD[e]):e===`transparent`?new FD(NaN,NaN,NaN,0):null}function jD(e){return new FD(e>>16&255,e>>8&255,e&255,1)}function MD(e,t,n,r){return r<=0&&(e=t=n=NaN),new FD(e,t,n,r)}function ND(e){return e instanceof fD||(e=AD(e)),e?(e=e.rgb(),new FD(e.r,e.g,e.b,e.opacity)):new FD}function PD(e,t,n,r){return arguments.length===1?ND(e):new FD(e,t,n,r??1)}function FD(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}uD(FD,PD,dD(fD,{brighter(e){return e=e==null?mD:mD**+e,new FD(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pD:pD**+e,new FD(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new FD(BD(this.r),BD(this.g),BD(this.b),zD(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:ID,formatHex:ID,formatHex8:LD,formatRgb:RD,toString:RD}));function ID(){return`#${VD(this.r)}${VD(this.g)}${VD(this.b)}`}function LD(){return`#${VD(this.r)}${VD(this.g)}${VD(this.b)}${VD((isNaN(this.opacity)?1:this.opacity)*255)}`}function RD(){let e=zD(this.opacity);return`${e===1?`rgb(`:`rgba(`}${BD(this.r)}, ${BD(this.g)}, ${BD(this.b)}${e===1?`)`:`, ${e})`}`}function zD(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function BD(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function VD(e){return e=BD(e),(e<16?`0`:``)+e.toString(16)}function HD(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new GD(e,t,n,r)}function UD(e){if(e instanceof GD)return new GD(e.h,e.s,e.l,e.opacity);if(e instanceof fD||(e=AD(e)),!e)return new GD;if(e instanceof GD)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 GD(o,s,c,e.opacity)}function WD(e,t,n,r){return arguments.length===1?UD(e):new GD(e,t,n,r??1)}function GD(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}uD(GD,WD,dD(fD,{brighter(e){return e=e==null?mD:mD**+e,new GD(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pD:pD**+e,new GD(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 FD(JD(e>=240?e-240:e+120,i,r),JD(e,i,r),JD(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new GD(KD(this.h),qD(this.s),qD(this.l),zD(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=zD(this.opacity);return`${e===1?`hsl(`:`hsla(`}${KD(this.h)}, ${qD(this.s)*100}%, ${qD(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function KD(e){return e=(e||0)%360,e<0?e+360:e}function qD(e){return Math.max(0,Math.min(1,e||0))}function JD(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 YD=e=>()=>e;function XD(e,t){return function(n){return e+n*t}}function ZD(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function QD(e){return(e=+e)==1?$D:function(t,n){return n-t?ZD(t,n,e):YD(isNaN(t)?n:t)}}function $D(e,t){var n=t-e;return n?XD(e,n):YD(isNaN(e)?t:e)}var eO=(function e(t){var n=QD(t);function r(e,t){var r=n((e=PD(e)).r,(t=PD(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$D(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 tO(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 nO(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function rO(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]=fO(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 iO(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function aO(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function oO(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]=fO(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var sO=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,cO=new RegExp(sO.source,`g`);function lO(e){return function(){return e}}function uO(e){return function(t){return e(t)+``}}function dO(e,t){var n=sO.lastIndex=cO.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=sO.exec(e))&&(i=cO.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:aO(r,i)})),n=cO.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?uO(c[0].x):lO(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 fO(e,t){var n=typeof t,r;return t==null||n===`boolean`?YD(t):(n===`number`?aO:n===`string`?(r=AD(t))?(t=r,eO):dO:t instanceof AD?eO:t instanceof Date?iO:nO(t)?tO:Array.isArray(t)?rO:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?oO:aO)(e,t)}var pO=180/Math.PI,mO={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hO(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)*pO,skewX:Math.atan(c)*pO,scaleX:o,scaleY:s}}var gO;function _O(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?mO:hO(t.a,t.b,t.c,t.d,t.e,t.f)}function vO(e){return e==null||(gO||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),gO.setAttribute(`transform`,e),!(e=gO.transform.baseVal.consolidate()))?mO:(e=e.matrix,hO(e.a,e.b,e.c,e.d,e.e,e.f))}function yO(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:aO(e,i)},{i:c-2,x:aO(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:aO(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:aO(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:aO(e,n)},{i:s-2,x:aO(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 bO=yO(_O,`px, `,`px)`,`deg)`),xO=yO(vO,`, `,`)`,`)`),SO=1e-12;function CO(e){return((e=Math.exp(e))+1/e)/2}function wO(e){return((e=Math.exp(e))-1/e)/2}function TO(e){return((e=Math.exp(2*e))-1)/(e+1)}var EO=(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<SO)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=CO(y),c=s/(n*g)*(i*TO(t*r+y)-wO(y));return[a+c*d,o+c*f,s*i/CO(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),DO=0,OO=0,kO=0,AO=1e3,jO,MO,NO=0,PO=0,FO=0,IO=typeof performance==`object`&&performance.now?performance:Date,LO=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function RO(){return PO||=(LO(zO),IO.now()+FO)}function zO(){PO=0}function BO(){this._call=this._time=this._next=null}BO.prototype=VO.prototype={constructor:BO,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?RO():+n)+(t==null?0:+t),!this._next&&MO!==this&&(MO?MO._next=this:jO=this,MO=this),this._call=e,this._time=n,KO()},stop:function(){this._call&&(this._call=null,this._time=1/0,KO())}};function VO(e,t,n){var r=new BO;return r.restart(e,t,n),r}function HO(){RO(),++DO;for(var e=jO,t;e;)(t=PO-e._time)>=0&&e._call.call(void 0,t),e=e._next;--DO}function UO(){PO=(NO=IO.now())+FO,DO=OO=0;try{HO()}finally{DO=0,GO(),PO=0}}function WO(){var e=IO.now(),t=e-NO;t>AO&&(FO-=t,NO=e)}function GO(){for(var e,t=jO,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:jO=n);MO=e,KO(r)}function KO(e){DO||(OO&&=clearTimeout(OO),e-PO>24?(e<1/0&&(OO=setTimeout(UO,e-IO.now()-FO)),kO&&=clearInterval(kO)):(kO||=(NO=IO.now(),setInterval(WO,AO)),DO=1,LO(UO)))}function qO(e,t,n){var r=new BO;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var JO=Gw(`start`,`end`,`cancel`,`interrupt`),YO=[];function XO(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;ek(e,n,{name:t,index:r,group:i,on:JO,tween:YO,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ZO(e,t){var n=$O(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function QO(e,t){var n=$O(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function $O(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function ek(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=VO(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 qO(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(qO(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 tk(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 nk(e){return this.each(function(){tk(this,e)})}function rk(e,t){var n,r;return function(){var i=QO(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 ik(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=QO(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 ak(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=$O(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?rk:ik)(n,e,t))}function ok(e,t,n){var r=e._id;return e.each(function(){var e=QO(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return $O(e,r).value[t]}}function sk(e,t){var n;return(typeof t==`number`?aO:t instanceof AD?eO:(n=AD(t))?(t=n,eO):dO)(e,t)}function ck(e){return function(){this.removeAttribute(e)}}function lk(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uk(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 dk(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 fk(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 pk(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 mk(e,t){var n=Zw(e),r=n===`transform`?xO:sk;return this.attrTween(e,typeof t==`function`?(n.local?pk:fk)(n,r,ok(this,`attr.`+e,t)):t==null?(n.local?lk:ck)(n):(n.local?dk:uk)(n,r,t))}function hk(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gk(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function _k(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&gk(e,i)),n}return i._value=t,i}function vk(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&hk(e,i)),n}return i._value=t,i}function yk(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=Zw(e);return this.tween(n,(r.local?_k:vk)(r,t))}function bk(e,t){return function(){ZO(this,e).delay=+t.apply(this,arguments)}}function xk(e,t){return t=+t,function(){ZO(this,e).delay=t}}function Sk(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?bk:xk)(t,e)):$O(this.node(),t).delay}function Ck(e,t){return function(){QO(this,e).duration=+t.apply(this,arguments)}}function wk(e,t){return t=+t,function(){QO(this,e).duration=t}}function Tk(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ck:wk)(t,e)):$O(this.node(),t).duration}function Ek(e,t){if(typeof t!=`function`)throw Error();return function(){QO(this,e).ease=t}}function Dk(e){var t=this._id;return arguments.length?this.each(Ek(t,e)):$O(this.node(),t).ease}function Ok(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();QO(this,e).ease=n}}function kk(e){if(typeof e!=`function`)throw Error();return this.each(Ok(this._id,e))}function Ak(e){typeof e!=`function`&&(e=lT(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 aA(r,this._parents,this._name,this._id)}function jk(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 aA(o,this._parents,this._name,this._id)}function Mk(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 Nk(e,t,n){var r,i,a=Mk(t)?ZO:QO;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Pk(e,t){var n=this._id;return arguments.length<2?$O(this.node(),n).on.on(e):this.each(Nk(n,e,t))}function Fk(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ik(){return this.on(`end.remove`,Fk(this._id))}function Lk(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=nT(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,XO(l[f],t,n,f,l,$O(u,n)));return new aA(a,this._parents,t,n)}function Rk(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=oT(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=$O(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&XO(p,t,n,h,f,m);a.push(f),o.push(u)}return new aA(a,o,t,n)}var zk=KE.prototype.constructor;function Bk(){return new zk(this._groups,this._parents)}function Vk(e,t){var n,r,i;return function(){var a=$T(this,e),o=(this.style.removeProperty(e),$T(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function Hk(e){return function(){this.style.removeProperty(e)}}function Uk(e,t,n){var r,i=n+``,a;return function(){var o=$T(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Wk(e,t,n){var r,i,a;return function(){var o=$T(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),$T(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Gk(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=QO(this,e),l=c.on,u=c.value[a]==null?s||=Hk(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Kk(e,t,n){var r=(e+=``)==`transform`?bO:sk;return t==null?this.styleTween(e,Vk(e,r)).on(`end.style.`+e,Hk(e)):typeof t==`function`?this.styleTween(e,Wk(e,r,ok(this,`style.`+e,t))).each(Gk(this._id,e)):this.styleTween(e,Uk(e,r,t),n).on(`end.style.`+e,null)}function qk(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Jk(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&qk(e,a,n)),r}return a._value=t,a}function Yk(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,Jk(e,t,n??``))}function Xk(e){return function(){this.textContent=e}}function Zk(e){return function(){var t=e(this);this.textContent=t??``}}function Qk(e){return this.tween(`text`,typeof e==`function`?Zk(ok(this,`text`,e)):Xk(e==null?``:e+``))}function $k(e){return function(t){this.textContent=e.call(this,t)}}function eA(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&$k(r)),t}return r._value=e,r}function tA(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,eA(e))}function nA(){for(var e=this._name,t=this._id,n=oA(),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=$O(c,t);XO(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new aA(r,this._parents,e,n)}function rA(){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=QO(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 iA=0;function aA(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function oA(){return++iA}var sA=KE.prototype;aA.prototype={constructor:aA,select:Lk,selectAll:Rk,selectChild:sA.selectChild,selectChildren:sA.selectChildren,filter:Ak,merge:jk,selection:Bk,transition:nA,call:sA.call,nodes:sA.nodes,node:sA.node,size:sA.size,empty:sA.empty,each:sA.each,on:Pk,attr:mk,attrTween:yk,style:Kk,styleTween:Yk,text:Qk,textTween:tA,remove:Ik,tween:ak,delay:Sk,duration:Tk,ease:Dk,easeVarying:kk,end:rA,[Symbol.iterator]:sA[Symbol.iterator]};function cA(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var lA={time:null,delay:0,duration:250,ease:cA};function uA(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function dA(e){var t,n;e instanceof aA?(t=e._id,e=e._name):(t=oA(),(n=lA).time=RO(),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])&&XO(c,e,t,l,o,n||uA(c,t));return new aA(r,this._parents,e,t)}KE.prototype.interrupt=nk,KE.prototype.transition=dA;var fA=e=>()=>e;function pA(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 mA(e,t,n){this.k=e,this.x=t,this.y=n}mA.prototype={constructor:mA,scale:function(e){return e===1?this:new mA(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new mA(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 hA=new mA(1,0,0);gA.prototype=mA.prototype;function gA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return hA;return e.__zoom}function _A(e){e.stopImmediatePropagation()}function vA(e){e.preventDefault(),e.stopImmediatePropagation()}function yA(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function bA(){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 xA(){return this.__zoom||hA}function SA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function CA(){return navigator.maxTouchPoints||`ontouchstart`in this}function wA(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 TA(){var e=yA,t=bA,n=wA,r=SA,i=CA,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=EO,l=Gw(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,xA).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`,xA),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(hA.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 mA(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 mA(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 mA(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=JE(this.that).datum();l.call(e,this.that,new pA(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=XE(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)],tk(this),s.start();vA(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=JE(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=XE(t,i),l=t.clientX,u=t.clientY;tD(t.view),_A(t),a.mouse=[c,this.__zoom.invert(c)],tk(this),a.start();function d(e){if(vA(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]=XE(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),nD(e.view,a.moved),vA(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=XE(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);vA(r),s>0?JE(this).transition().duration(s).call(x,d,c,r):JE(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(_A(t),s=0;s<i;++s)c=r[s],l=XE(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)),tk(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(vA(e),s=0;s<a;++s)c=i[s],l=XE(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(_A(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=XE(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=JE(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:fA(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:fA(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:fA(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:fA([[+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 EA={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.`},DA=[[-1/0,-1/0],[1/0,1/0]],OA=[`Enter`,` `,`Escape`],kA={"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`},AA;(function(e){e.Strict=`strict`,e.Loose=`loose`})(AA||={});var jA;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(jA||={});var MA;(function(e){e.Partial=`partial`,e.Full=`full`})(MA||={});var NA={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},PA;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(PA||={});var FA;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(FA||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var IA={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},LA=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,RA=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),zA=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),BA=(e,t=[0,0])=>{let{width:n,height:r}=bj(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},VA=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):zA(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,ej(e,ij(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?nj(r):{x:0,y:0,width:0,height:0}},HA=(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=ej(n,ij(e)),r=!0)}),r?nj(n):{x:0,y:0,width:0,height:0}},UA=(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=oj(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},WA=(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 GA(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}=bj(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 KA({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=_j(HA(GA(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 qA({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`,EA.error005());else{let{width:e,height:t}=bj(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&yj(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=yj(d)?XA(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,EA.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 JA({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=WA(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 YA=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),XA=(e={x:0,y:0},t,n)=>({x:YA(e.x,t[0][0],t[1][0]-(n?.width??0)),y:YA(e.y,t[0][1],t[1][1]-(n?.height??0))});function ZA(e,t,n){let{width:r,height:i}=bj(n),{x:a,y:o}=n.internals.positionAbsolute;return XA(e,[[a,o],[a+r,o+i]],t)}var QA=(e,t,n)=>e<t?YA(Math.abs(e-t),1,t)/t:e>n?-YA(Math.abs(e-n),1,t)/t:0,$A=(e,t,n=15,r=40)=>[QA(e.x,r,t.width-r)*n,QA(e.y,r,t.height-r)*n],ej=(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)}),tj=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nj=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),rj=(e,t=[0,0])=>{let{x:n,y:r}=zA(e)?e.internals.positionAbsolute:BA(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}},ij=(e,t=[0,0])=>{let{x:n,y:r}=zA(e)?e.internals.positionAbsolute:BA(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)}},aj=(e,t)=>nj(ej(tj(e),tj(t))),oj=(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)},sj=(e,t)=>oj(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),cj=e=>lj(e.width)&&lj(e.height)&&lj(e.x)&&lj(e.y),lj=e=>!isNaN(e)&&isFinite(e),uj=(e,t)=>(e,t)=>{},dj=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),fj=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?dj(s,o):s},pj=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function mj(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 hj(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=mj(e,n),i=mj(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=mj(e.top??e.y??0,n),i=mj(e.bottom??e.y??0,n),a=mj(e.left??e.x??0,t),o=mj(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 gj(e,t,n,r,i,a){let{x:o,y:s}=pj(e,[t,n,r]),{x:c,y:l}=pj({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 _j=(e,t,n,r,i,a)=>{let o=hj(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=YA(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=gj(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}},vj=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function yj(e){return e!=null&&e!==`parent`}function bj(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function xj(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Sj(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 Cj(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function wj(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Tj(e){return{...kA,...e||{}}}function Ej(e){return e===null?null:e?`valid`:`invalid`}function Dj(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Nj(e),s=fj({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?dj(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Oj=e=>({width:e.offsetWidth,height:e.offsetHeight}),kj=e=>e?.getRootNode?.()||window?.document,Aj=[`INPUT`,`SELECT`,`TEXTAREA`];function jj(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Aj.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Mj=e=>`clientX`in e,Nj=(e,t)=>{let n=Mj(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)}},Pj=(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,...Oj(t)}})};function Fj({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 Ij(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Lj({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Ij(t-r,a),n];case Q.Right:return[t+Ij(r-t,a),n];case Q.Top:return[t,n-Ij(n-i,a)];case Q.Bottom:return[t,n+Ij(i-n,a)]}}function Rj({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Lj({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Lj({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Fj({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 zj({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 Bj({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 Vj({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=ej(ij(e),ij(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),sj({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},nj(a))>0}var Hj=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Uj=(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)),Wj=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,EA.error006()),t;let r=n.getEdgeId||Hj,i;return i=LA(e)?{...e}:{...e,id:r(e)},Uj(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Gj({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=zj({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Kj={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},qj=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},Jj=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Yj({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Kj[t],c=Kj[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=qj({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]=zj({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 Xj(e,t,n,r){let i=Math.min(Jj(e,t)/2,Jj(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 Zj({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Yj({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+=Xj(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 Qj(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function $j(e){let{sourceNode:t,targetNode:n}=e;if(!Qj(t)||!Qj(n))return null;let r=t.internals.handleBounds||eM(t.handles),i=n.internals.handleBounds||eM(n.handles),a=nM(r?.source??[],e.sourceHandle),o=nM(e.connectionMode===AA.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,EA.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=tM(t,a,s),u=tM(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function eM(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 tM(e,t,n=Q.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??bj(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function nM(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function rM(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function iM(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=rM(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 aM=1e3,oM=10,sM={nodeOrigin:[0,0],nodeExtent:DA,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},cM={...sM,checkEquality:!0};function lM(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function uM(e,t,n){let r=lM(sM,n);for(let n of e.values())if(n.parentId)hM(n,e,t,r);else{let e=XA(BA(n,r.nodeOrigin),yj(n.extent)?n.extent:r.nodeExtent,bj(n));n.internals.positionAbsolute=e}}function dM(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 fM(e){return e===`manual`}function pM(e,t,n,r={}){let i=lM(cM,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!fM(i.zIndexMode)?aM: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=XA(BA(u,i.nodeOrigin),yj(u.extent)?u.extent:i.nodeExtent,bj(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:dM(u,e),z:gM(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&&hM(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function mM(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 hM(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=lM(sM,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}mM(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*oM),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=_M(e,u,o,s,a&&!fM(c)?aM: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 gM(e,t,n){let r=lj(e.zIndex)?e.zIndex:0;return fM(n)?r:r+(e.selected?t:0)}function _M(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=bj(e),l=BA(e,n),u=yj(e.extent)?XA(l,e.extent,c):l,d=XA({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=ZA(d,c,t));let f=gM(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function vM(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=aj(a.get(n.parentId)?.expandedRect??rj(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=bj(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 yM(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=Oj(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=yj(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=ZA(h,s,n))}else m&&(h=XA(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:Pj(`source`,r.nodeElement,p,d,e.id),target:Pj(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&hM(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:rj(g,i)}))}}if(f.length>0){let e=vM(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function bM({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 xM(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 SM(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}`;xM(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),xM(`target`,s,c,e,i,o),t.set(r.id,r)}}function CM(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:CM(n,t):!1}function wM(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 TM(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!CM(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 EM({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 DM({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=dj(a,t);return{x:o.x-a.x,y:o.y-a.y}}function OM({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=JE(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?tj(HA(s)):null,x=v&&l?DM({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)}:dj(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}=qA({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]=EM({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]=$A(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=Dj(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=TM(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=EM({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=lD().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=Dj(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Nj(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Dj(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=Nj(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=Nj(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]=EM({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||!wM(t,`.${g}`,v))&&(!_||wM(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function kM(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())sj(i,rj(e))>0&&r.push(e);return r}var AM=250;function jM(e,t,n,r){let i=[],a=1/0,o=kM(e,n,t+AM);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}=tM(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 MM(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,...tM(o,c,c.position,!0)}:c}function NM(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function PM(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var FM=()=>!0;function IM(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:_=FM,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=kj(e.target),E=0,D,{x:O,y:k}=Nj(e),A=NM(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=MM(i,A,r,c,t);if(!N)return;let P=Nj(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=$A(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),te={inProgress:!0,isValid:null,from:tM(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:IA[z.position],toNode:null,pointer:P};function V(){M=!0,y(te),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=Nj(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=Nj(e,j),D=jM(fj(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=LM(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=PM(!!D,s.isValid);let u=c.get(i),f=u?tM(u,z,Q.Left,!0):te.from,p={...te,from:f,isValid:L,to:s.toHandle&&L?pj({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:IA[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),te=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=te,r={...n,toPosition:te.toHandle?te.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function LM(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=FM,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}=Nj(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=NM(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===AA.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=MM(t,e,a,u,n,!0)}return _}var RM={onPointerDown:IM,isValid:LM};function zM({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=JE(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&&vj()?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=TA().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:XE}}var BM=e=>({x:e.x,y:e.y,zoom:e.k}),VM=({x:e,y:t,zoom:n})=>hA.translate(e,t).scale(n),HM=(e,t)=>e.target.closest(`.${t}`),UM=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),WM=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,GM=(e,t=0,n=WM,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},KM=e=>{let t=e.ctrlKey&&vj()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function qM({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(HM(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=XE(u),t=d*2**KM(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===jA.Vertical?0:u.deltaX*f,m=i===jA.Horizontal?0:u.deltaY*f;!vj()&&u.shiftKey&&i!==jA.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=BM(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 JM({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=HM(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function YM({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=BM(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 XM({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&UM(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,BM(a.transform))}}function ZM({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&UM(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=BM(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function QM({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(HM(f,`${u}-flow__node`)||HM(f,`${u}-flow__edge`)||HM(f,`${u}-flow__selection`)||HM(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||HM(f,c)&&h||HM(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function $M({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=TA().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=JE(e).call(f);y({x:i.x,y:i.y,zoom:YA(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(KM);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?fO:EO).transform(GM(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,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!lj(D)||D<0?0:D);let A=k?qM({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):JM({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=YM({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=XM({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=ZM({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=QM({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),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=VM(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=VM(e);return await g(n,t),n}function x(e){if(p){let t=VM(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?gA(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`?fO:EO).scaleTo(GM(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?fO:EO).scaleBy(GM(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=!lj(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 eN;(function(e){e.Line=`line`,e.Handle=`handle`})(eN||={});function tN({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 nN(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 rN(e,t){return Math.max(0,t-e)}function iN(e,t){return Math.max(0,e-t)}function aN(e,t,n){return Math.max(0,t-e,e-n)}function oN(e,t){return e?!t:t}function sN(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=aN(E,h,g),j=aN(D,_,v);if(o){let e=0,t=0;c&&w<0?e=rN(y+w+O,o[0][0]):!c&&w>0&&(e=iN(y+E+O,o[1][0])),l&&T<0?t=rN(b+T+k,o[0][1]):!l&&T>0&&(t=iN(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=iN(y+w,s[0][0]):!c&&w<0&&(e=rN(y+E,s[1][0])),l&&T>0?t=iN(b+T,s[0][1]):!l&&T<0&&(t=rN(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=aN(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?iN(b+k+E/C,o[1][1])*C:rN(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?rN(b+E/C,s[1][1])*C:iN(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=aN(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?iN(y+D*C+O,o[1][0])/C:rN(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?rN(y+D*C,s[1][0])/C:iN(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=(oN(c,l)?-w:w)/C:w=(oN(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 cN={width:0,height:0,x:0,y:0},lN={...cN,pointerX:0,pointerY:0,aspectRatio:1};function uN(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 dN({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=JE(e),o={controlDirection:nN(`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={...cN},h={...lN};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:nN(e)};let g,_=null,v=[],y,b,x,S=!1,C=lD().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}=Dj(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=yj(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=uN(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=Dj(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}=sN(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=tN({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 fN=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},pN=e=>e?fN(e):fN,{useDebugValue:mN}=H.default,{useSyncExternalStoreWithSelector:hN}=Mw.default,gN=e=>e;function _N(e,t=gN,n){let r=hN(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return mN(r),r}var vN=(e,t)=>{let n=pN(e),r=(e,r=t)=>_N(n,e,r);return Object.assign(r,n),r},yN=(e,t)=>e?vN(e,t):vN;function bN(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 xN=(0,H.createContext)(null),SN=xN.Provider,CN=EA.error001(`react`);function $(e,t){let n=(0,H.useContext)(xN);if(n===null)throw Error(CN);return _N(n,e,t)}function wN(){let e=(0,H.useContext)(xN);if(e===null)throw Error(CN);return(0,H.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var TN={display:`none`},EN={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},DN=`react-flow__node-desc`,ON=`react-flow__edge-desc`,kN=`react-flow__aria-live`,AN=e=>e.ariaLiveMessage,jN=e=>e.ariaLabelConfig;function MN({rfId:e}){let t=$(AN);return(0,U.jsx)(`div`,{id:`${kN}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:EN,children:t})}function NN({rfId:e,disableKeyboardA11y:t}){let n=$(jN);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{id:`${DN}-${e}`,style:TN,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,U.jsx)(`div`,{id:`${ON}-${e}`,style:TN,children:n[`edge.a11yDescription.default`]}),!t&&(0,U.jsx)(MN,{rfId:e})]})}var PN=(0,H.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,U.jsx)(`div`,{className:Uw([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});PN.displayName=`Panel`;var FN=`https://reactflow.dev?utm_source=attribution`;function IN({proOptions:e,position:t=`bottom-right`}){return(0,H.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,U.jsx)(PN,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${FN}`,children:(0,U.jsx)(`a`,{href:FN,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var LN=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}},RN=e=>e.id;function zN(e,t){return bN(e.selectedNodes.map(RN),t.selectedNodes.map(RN))&&bN(e.selectedEdges.map(RN),t.selectedEdges.map(RN))}function BN({onSelectionChange:e}){let t=wN(),{selectedNodes:n,selectedEdges:r}=$(LN,zN);return(0,H.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var VN=e=>!!e.onSelectionChangeHandlers;function HN({onSelectionChange:e}){let t=$(VN);return e||t?(0,U.jsx)(BN,{onSelectionChange:e}):null}var UN=[0,0],WN={x:0,y:0,zoom:1},GN=[...`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`],KN=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}),qN={translateExtent:DA,nodeOrigin:UN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function JN(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(KN,bN),l=wN();(0,H.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=qN,s()}),[]);let u=(0,H.useRef)(qN);return(0,H.useEffect)(()=>{for(let s of GN){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:Tj(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},GN.map(t=>e[t])),null}function YN(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function XN(e){let[t,n]=(0,H.useState)(e===`system`?null:e);return(0,H.useEffect)(()=>{if(e!==`system`){n(e);return}let t=YN(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?YN()?.matches?`dark`:`light`:t}var ZN=typeof document<`u`?document:null;function QN(e=null,t={target:ZN,actInsideInputWithModifier:!0}){let[n,r]=(0,H.useState)(!1),i=(0,H.useRef)(!1),a=(0,H.useRef)(new Set([])),[o,s]=(0,H.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
141
141
  `).replace(`
142
142
 
143
143
  `,`
144
144
  +`).split(`
145
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,H.useEffect)(()=>{let n=t?.target??JN,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)&&Oj(e))return!1;let n=ZN(e.code,s);if(a.current.add(e[n]),XN(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=ZN(e.code,s);XN(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 XN(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function ZN(e,t){return t.includes(e)?`code`:`key`}var QN=()=>{let e=xN();return(0,H.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=mj(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 lj(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=uj(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function $N(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)eP(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 eP(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)}}function tP(e,t){return $N(e,t)}function nP(e,t){return $N(e,t)}function rP(e,t){return{id:e,type:`select`,selected:t}}function iP(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(rP(a.id,e)))}return r}function aP({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 oP(e){return{id:e.id,type:`remove`}}var sP=sj(`React Flow`,`https://reactflow.dev/`);function cP(e,t,n={}){return Vj(e,t,{...n,onError:n.onError??sP})}var lP=e=>FA(e),uP=e=>PA(e);function dP(e){return(0,H.forwardRef)(e)}var fP=typeof window<`u`?H.useLayoutEffect:H.useEffect;function pP(e){let[t,n]=(0,H.useState)(BigInt(0)),[r]=(0,H.useState)(()=>mP(()=>n(e=>e+BigInt(1))));return fP(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function mP(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var hP=(0,H.createContext)(null);function gP({children:e}){let t=xN(),n=pP((0,H.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=aP({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=pP((0,H.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(aP({items:s,lookup:o}))},[])),i=(0,H.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,U.jsx)(hP.Provider,{value:i,children:e})}function _P(){let e=(0,H.useContext)(hP);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var vP=e=>!!e.panZoom;function yP(){let e=QN(),t=xN(),n=_P(),r=$(vP),i=(0,H.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=lP(e)?e:n.get(e.id),a=i.parentId?yj(i.position,i.measured,i.parentId,n,r):i.position;return ej({...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&&lP(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&&uP(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 GA({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(oP);o?.(f),c(e)}if(m){let e=d.map(oP);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=aj(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=ej(s?r:a),l=ij(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=aj(e)?e:a(e);if(!r)return!1;let i=ij(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 RA(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??xj();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,H.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var bP=e=>e.selected,xP=typeof window<`u`?window:void 0;function SP({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=xN(),{deleteElements:r}=yP(),i=YN(e,{actInsideInputWithModifier:!1}),a=YN(t,{target:xP});(0,H.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(bP),edges:e.filter(bP)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,H.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function CP(e){let t=xN();(0,H.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Tj(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,CA.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 wP={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},TP=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function EP({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=OA.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=xN(),C=(0,H.useRef)(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=$(TP,_N),D=YN(p),O=(0,H.useRef)();CP(C);let k=(0,H.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return(0,H.useEffect)(()=>{if(C.current){O.current=XM({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),(0,H.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),(0,U.jsx)(`div`,{className:`react-flow__renderer`,ref:C,style:wP,children:h})}var DP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function OP(){let{userSelectionActive:e,userSelectionRect:t}=$(DP,_N);return e&&t?(0,U.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 kP=(e,t)=>n=>{n.target===t.current&&e?.(n)},AP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function jP({isSelecting:e,selectionKeyPressed:t,selectionMode:n=kA.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,H.useRef)(0),_=xN(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(AP,_N),C=y&&(e||v),w=(0,H.useRef)(null),T=(0,H.useRef)(),E=(0,H.useRef)(new Set),D=(0,H.useRef)(new Set),O=(0,H.useRef)(!1),k=(0,H.useRef)(!1),A=(0,H.useRef)({x:0,y:0}),j=(0,H.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=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Aj(n.nativeEvent,T.current),u=lj({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(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}=uj(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(BA(a,m,i,n===kA.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)}}bj(h,E.current)||c(iP(a,E.current,!0)),bj(g,D.current)||l(iP(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=XA(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let ee=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,H.useEffect)(()=>()=>ee(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Aj(e.nativeEvent,T.current);A.current={x:o,y:c};let l=uj({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||=(R(),!0),L(o,c)},B=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})),ee())},te=e=>{e.target?.releasePointerCapture?.(e.pointerId),ee()},V=r===!0||Array.isArray(r)&&r.includes(0);return(0,U.jsxs)(`div`,{className:Bw([`react-flow__pane`,{draggable:V,dragging:b,selection:e}]),onClick:C?void 0:kP(M,w),onContextMenu:kP(N,w),onWheel:kP(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?te:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:wP,children:[h,(0,U.jsx)(OP,{})]})}function MP({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`,CA.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function NP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=xN(),[c,l]=(0,H.useState)(!1),u=(0,H.useRef)();return(0,H.useEffect)(()=>{if(!t)return u.current=TM({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{MP({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,H.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 PP=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function FP(){let e=xN();return(0,H.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=PP(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=cj(t,i));let{position:a,positionAbsolute:s}=WA({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 IP=(0,H.createContext)(null),LP=IP.Provider;IP.Consumer;var RP=()=>(0,H.useContext)(IP),zP=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),BP=(0,H.createContext)(null);function VP({children:e}){let t=$(zP,_N);return(0,U.jsx)(BP.Provider,{value:t,children:e})}function HP(){let e=(0,H.useContext)(BP);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var UP={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},WP=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return UP;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===DA.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function GP({type:e=`source`,position:t=Q.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=xN(),_=RP(),{connectOnClick:v,noPanClassName:y,rfId:b}=HP(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(WP(_,m,e),_N);_||g.getState().onError?.(`010`,CA.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(cP(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=kj(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();FM.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,U.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Bw([`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=Ej(t.target),h=n||c,{connection:v,isValid:y}=FM.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 KP=(0,H.memo)(dP(GP));function qP({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[e?.label,(0,U.jsx)(KP,{type:`source`,position:n,isConnectable:t})]})}function JP({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{type:`target`,position:n,isConnectable:t}),e?.label,(0,U.jsx)(KP,{type:`source`,position:r,isConnectable:t})]})}function YP(){return null}function XP({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{type:`target`,position:n,isConnectable:t}),e?.label]})}var ZP={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},QP={input:qP,default:JP,output:XP,group:YP};function $P(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 eF=e=>{let{width:t,height:n,x:r,y:i}=zA(e.nodeLookup,{filter:e=>!!e.selected});return{width:oj(t)?t:null,height:oj(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 tF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=xN(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(eF,_N),c=FP(),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(NP({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,U.jsx)(`div`,{className:Bw([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,U.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(ZP,e.key)&&(e.preventDefault(),c({direction:ZP[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var nF=typeof window<`u`?window:void 0,rF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function iF({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:R}=$(rF,_N),ee=YN(l,{target:nF}),z=YN(h,{target:nF}),B=z||w,te=z||b,V=u&&B!==!0,ne=ee||R||V;return SP({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,U.jsx)(EP,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panActivationKeyPressed:z,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!ee&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:V,children:(0,U.jsxs)(jP,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:ee,paneClickDistance:s,selectionOnDrag:V,children:[e,L&&(0,U.jsx)(tF,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}iF.displayName=`FlowRenderer`;var aF=(0,H.memo)(iF),oF=e=>t=>e?BA(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 sF(e){return $((0,H.useCallback)(oF(e),[e]),_N)}var cF=e=>e.updateNodeInternals;function lF(){let e=$(cF),[t]=(0,H.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,H.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function uF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=xN(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(e.sourcePosition),c=(0,H.useRef)(e.targetPosition),l=(0,H.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,H.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,H.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,H.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 dF({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}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},_N),S=y.type||`default`,C=g?.[S]||QP[S];C===void 0&&(v?.(`003`,CA.error003(S)),S=`default`,C=g?.default||QP.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=xN(),k=vj(y),A=uF({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=NP({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=FP();if(y.hidden)return null;let N=_j(y),P=$P(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,R=i?e=>i(e,{...b.userNode}):void 0,ee=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&MP({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},te=t=>{if(!(Oj(t.nativeEvent)||m)){if(TA.includes(t.key)&&T){let n=t.key===`Escape`;MP({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(ZP,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:ZP[t.key],factor:t.shiftKey?4:1})}}},V=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(BA(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,U.jsx)(`div`,{className:Bw([`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:R,onContextMenu:ee,onClick:B,onDoubleClick:z,onKeyDown:D?te:void 0,tabIndex:D?0:void 0,onFocus:D?V:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${wN}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,U.jsx)(LP,{value:e,children:(0,U.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 fF=(0,H.memo)(dF),pF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mF(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=$(pF,_N),a=sF(e.onlyRenderVisibleElements),o=lF();return(0,U.jsx)(`div`,{className:`react-flow__nodes`,style:wP,children:a.map(a=>(0,U.jsx)(fF,{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))})}mF.displayName=`NodeRenderer`;var hF=(0,H.memo)(mF);function gF(e){return $((0,H.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&&Rj({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),_N)}var _F=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,U.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},vF=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,U.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},yF={[MA.Arrow]:_F,[MA.ArrowClosed]:vF};function bF(e){let t=xN();return(0,H.useMemo)(()=>Object.prototype.hasOwnProperty.call(yF,e)?yF[e]:(t.getState().onError?.(`009`,CA.error009(e)),null),[e])}var xF=({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=bF(t);return c?(0,U.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,U.jsx)(c,{color:n,strokeWidth:o})}):null},SF=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,H.useMemo)(()=>tM(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,U.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,U.jsx)(`defs`,{children:i.map(e=>(0,U.jsx)(xF,{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};SF.displayName=`MarkerDefinitions`;var CF=(0,H.memo)(SF);function wF({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,H.useState)({x:1,y:0,width:0,height:0}),p=Bw([`react-flow__edge-textwrapper`,l]),m=(0,H.useRef)(null);return(0,H.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,U.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,U.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,U.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}wF.displayName=`EdgeText`;var TF=(0,H.memo)(wF);function EF({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{...u,d:e,fill:`none`,className:Bw([`react-flow__edge-path`,u.className])}),l?(0,U.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&oj(t)&&oj(n)?(0,U.jsx)(TF,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function DF({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function OF({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=DF({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=DF({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Mj({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 kF(e){return(0,H.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]=OF({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,U.jsx)(EF,{id:x,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 AF=kF({isInternal:!1}),jF=kF({isInternal:!0});AF.displayName=`SimpleBezierEdge`,jF.displayName=`SimpleBezierEdgeInternal`;function MF(e){return(0,H.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=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Jj({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,U.jsx)(EF,{id:S,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 NF=MF({isInternal:!1}),PF=MF({isInternal:!0});NF.displayName=`SmoothStepEdge`,PF.displayName=`SmoothStepEdgeInternal`;function FF(e){return(0,H.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,U.jsx)(NF,{...n,id:r,pathOptions:(0,H.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var IF=FF({isInternal:!1}),LF=FF({isInternal:!0});IF.displayName=`StepEdge`,LF.displayName=`StepEdgeInternal`;function RF(e){return(0,H.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]=Hj({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,U.jsx)(EF,{id:y,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 zF=RF({isInternal:!1}),BF=RF({isInternal:!0});zF.displayName=`StraightEdge`,BF.displayName=`StraightEdgeInternal`;function VF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.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]=Fj({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,U.jsx)(EF,{id:S,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 HF=VF({isInternal:!1}),UF=VF({isInternal:!0});HF.displayName=`BezierEdge`,UF.displayName=`BezierEdgeInternal`;var WF={default:UF,straight:BF,step:LF,smoothstep:PF,simplebezier:jF},GF={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},KF=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,qF=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,JF=`react-flow__edgeupdater`;function YF({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,U.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Bw([JF,`${JF}-${s}`]),cx:KF(t,r,e),cy:qF(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function XF({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=xN(),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`;FM.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,U.jsxs)(U.Fragment,{children:[(e===!0||e===`source`)&&(0,U.jsx)(YF,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,U.jsx)(YF,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function ZF({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=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||WF[x];S===void 0&&(_?.(`011`,CA.error011(x)),x=`default`,S=h?.default||WF.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,H.useRef)(null),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(!1),j=xN(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,H.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return GF;let i=Xj({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Lj({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||GF,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),_N),ee=(0,H.useMemo)(()=>y.markerStart?`url('#${eM(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,H.useMemo)(()=>y.markerEnd?`url('#${eM(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let B=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)},te=a?e=>{a(e,{...y})}:void 0,V=o?e=>{o(e,{...y})}:void 0,ne=s?e=>{s(e,{...y})}:void 0,re=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,U.jsx)(`svg`,{style:{zIndex:M},children:(0,U.jsxs)(`g`,{className:Bw([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:te,onContextMenu:V,onMouseEnter:ne,onMouseMove:re,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&TA.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?`${TN}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,U.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:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ee,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,U.jsx)(XF,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var QF=(0,H.memo)(ZF),$F=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function eI({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}=$($F,_N),b=gF(t);return(0,U.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,U.jsx)(CF,{defaultColor:e,rfId:n}),b.map(e=>(0,U.jsx)(QF,{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))]})}eI.displayName=`EdgeRenderer`;var tI=(0,H.memo)(eI),nI=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function rI({children:e}){let t=xN(),n=(0,H.useRef)(null),[r]=(0,H.useState)(()=>t.getState().transform);return fP(()=>{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=nI(r)))};return r(),t.subscribe(r)},[t]),(0,U.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:nI(r)},children:e})}function iI(e){let t=yP(),n=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var aI=e=>e.panZoom?.syncViewport;function oI(e){let t=$(aI),n=xN();return(0,H.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function sI(e){return e.connection.inProgress?{...e.connection,to:lj(e.connection.to,e.transform)}:{...e.connection}}function cI(e){return e?t=>e(sI(t)):sI}function lI(e){return $(cI(e),_N)}var uI=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dI({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(uI,_N);return a&&i&&c?(0,U.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,U.jsx)(`g`,{className:Bw([`react-flow__connection`,Cj(s)]),children:(0,U.jsx)(fI,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var fI=({style:e,type:t=jA.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}=lI();if(!i)return;if(n)return(0,U.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:Cj(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 jA.Bezier:[m]=Fj(h);break;case jA.SimpleBezier:[m]=OF(h);break;case jA.Step:[m]=Jj({...h,borderRadius:0});break;case jA.SmoothStep:[m]=Jj(h);break;default:[m]=Hj(h)}return(0,U.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};fI.displayName=`ConnectionLine`;var pI={};function mI(e=pI){(0,H.useRef)(e),xN(),(0,H.useEffect)(()=>{},[e])}function hI(){xN(),(0,H.useRef)(!1),(0,H.useEffect)(()=>{},[])}function gI({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:R,panOnDrag:ee,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:ie,paneClickDistance:ae,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,viewport:xe,onViewportChange:Se,nodesDraggable:Ce}){return mI(e),mI(t),hI(),iI(n),oI(xe),(0,U.jsx)(aF,{onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneContextMenu:ie,onPaneScroll:re,paneClickDistance:ae,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:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:ee,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,onViewportChange:Se,isControlledViewport:!!xe,children:(0,U.jsxs)(rI,{children:[(0,U.jsx)(tI,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,defaultMarkerColor:M,noPanClassName:_e,disableKeyboardA11y:ve,rfId:be}),(0,U.jsx)(dI,{style:h,type:m,component:g,containerStyle:_}),(0,U.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,U.jsx)(hF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,nodesDraggable:Ce}),(0,U.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}gI.displayName=`GraphView`;var _I=(0,H.memo)(gI),vI=sj(`React Flow`,`https://reactflow.dev/`),yI=({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??wA;yM(h,g,_);let{nodesInitialized:x}=uM(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=mj(zA(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:wA,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:DA.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:{...AA},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:vI,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:EA,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},bI=({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})=>gN((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 UA({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...yI({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,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=uM(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();yM(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}=gM(e,n,r,i,a,o,l);d&&(sM(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=Qj(e,o.fromHandle,Q.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=hM(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(tP(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(nP(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=>rP(e,!0)));return}i(iP(r,new Set([...e]),!0)),a(iP(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>rP(e,!0)));return}a(iP(n,new Set([...e]))),i(iP(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(rP(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(rP(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,rP(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,rP(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])&&(uM(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 _M({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:{...AA}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...yI()})}},Object.is);function xI({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,H.useState)(()=>bI({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,U.jsx)(yN,{value:m,children:(0,U.jsx)(gP,{children:(0,U.jsx)(VP,{children:p})})})}function SI({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,H.useContext)(vN)?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(xI,{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 CI={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function wI({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:R=jA.Bezier,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:te=`Backspace`,selectionKeyCode:V=`Shift`,selectionOnDrag:ne=!1,selectionMode:re=kA.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=hj()?`Meta`:`Control`,zoomActivationKeyCode:oe=hj()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,nodeOrigin:he=BN,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve=!0,defaultViewport:ye=VN,minZoom:be=.5,maxZoom:xe=2,translateExtent:Se=wA,preventScrolling:Ce=!0,nodeExtent:we,defaultMarkerColor:Te=`#b1b1b7`,zoomOnScroll:Ee=!0,zoomOnPinch:De=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Ae=OA.Free,zoomOnDoubleClick:je=!0,panOnDrag:Me=!0,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:Ve,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:ot,defaultEdgeOptions:st,elevateNodesOnSelect:ct=!0,elevateEdgesOnSelect:lt=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanOnSelection:pt=!0,autoPanSpeed:mt,connectionRadius:ht,isValidConnection:gt,onError:_t,style:vt,id:yt,nodeDragThreshold:bt,connectionDragThreshold:xt,viewport:St,onViewportChange:Ct,width:wt,height:Tt,colorMode:Et=`light`,debug:Dt,onScroll:Ot,ariaLabelConfig:kt,zIndexMode:At=`basic`,...jt},Mt){let Nt=yt||`1`,Pt=qN(Et),Ft=(0,H.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ot?.(e)},[Ot]);return(0,U.jsx)(`div`,{"data-testid":`rf__wrapper`,...jt,onScroll:Ft,style:{...vt,...CI},ref:Mt,className:Bw([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,U.jsxs)(SI,{nodes:e,edges:t,width:wt,height:Tt,fitView:nt,fitViewOptions:rt,minZoom:be,maxZoom:xe,nodeOrigin:he,nodeExtent:we,zIndexMode:At,children:[(0,U.jsx)(GN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve,elevateNodesOnSelect:ct,elevateEdgesOnSelect:lt,minZoom:be,maxZoom:xe,nodeExtent:we,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:Se,connectOnClick:it,defaultEdgeOptions:st,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:he,rfId:Nt,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanSpeed:mt,onError:_t,connectionRadius:ht,isValidConnection:gt,selectNodesOnDrag:ue,nodeDragThreshold:bt,connectionDragThreshold:xt,onBeforeDelete:I,debug:Dt,ariaLabelConfig:kt,zIndexMode:At}),(0,U.jsx)(_I,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:te,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ye,translateExtent:Se,minZoom:be,maxZoom:xe,preventScrolling:Ce,zoomOnScroll:Ee,zoomOnPinch:De,zoomOnDoubleClick:je,panOnScroll:Oe,panOnScrollSpeed:ke,panOnScrollMode:Ae,panOnDrag:Me,autoPanOnSelection:pt,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,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:Te,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Nt,disableKeyboardA11y:ut,nodeExtent:we,viewport:St,onViewportChange:Ct,nodesDraggable:de}),(0,U.jsx)(zN,{onSelectionChange:k}),Ve,(0,U.jsx)(NN,{proOptions:ot,position:at}),(0,U.jsx)(AN,{rfId:Nt,disableKeyboardA11y:ut})]})})}var TI=dP(wI);CA.error014();function EI({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,U.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Bw([`react-flow__background-pattern`,n,r])})}function DI({radius:e,className:t}){return(0,U.jsx)(`circle`,{cx:e,cy:e,r:e,className:Bw([`react-flow__background-pattern`,`dots`,t])})}var OI;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(OI||={});var kI={[OI.Dots]:1,[OI.Lines]:1,[OI.Cross]:6},AI=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jI({id:e,variant:t=OI.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,H.useRef)(null),{transform:f,patternId:p}=$(AI,_N),m=r||kI[t],h=t===OI.Dots,g=t===OI.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]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return(0,U.jsxs)(`svg`,{className:Bw([`react-flow__background`,l]),style:{...c,...wP,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,U.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,U.jsx)(DI,{radius:y/2,className:u}):(0,U.jsx)(EI,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,U.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}jI.displayName=`Background`;var MI=(0,H.memo)(jI);function NI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,U.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function PI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,U.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function FI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,U.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 II(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.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 LI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.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 RI({children:e,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:Bw([`react-flow__controls-button`,t]),...n,children:e})}var zI=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function BI({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=xN(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(zI,_N),{zoomIn:y,zoomOut:b,fitView:x}=yP();return(0,U.jsxs)(jN,{className:Bw([`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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(RI,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,U.jsx)(NI,{})}),(0,U.jsx)(RI,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,U.jsx)(PI,{})})]}),n&&(0,U.jsx)(RI,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,U.jsx)(FI,{})}),r&&(0,U.jsx)(RI,{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,U.jsx)(LI,{}):(0,U.jsx)(II,{})}),u]})}BI.displayName=`Controls`;var VI=(0,H.memo)(BI);function HI({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,U.jsx)(`rect`,{className:Bw([`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 UI=(0,H.memo)(HI),WI=e=>e.nodes.map(e=>e.id),GI=e=>e instanceof Function?e:()=>e;function KI({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=UI,onClick:o}){let s=$(WI,_N),c=GI(t),l=GI(e),u=GI(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,U.jsx)(U.Fragment,{children:s.map(e=>(0,U.jsx)(JI,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function qI({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}=$(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}=_j(r);return{node:r,x:i,y:a,width:o,height:s}},_N);return!l||l.hidden||!vj(l)?null:(0,U.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 JI=(0,H.memo)(qI),YI=(0,H.memo)(KI),XI=200,ZI=150,QI=e=>!e.hidden,$I=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]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?nj(zA(e.nodeLookup,{filter:QI}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},eL=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,tL=(e,t)=>eL(e.viewBB,t.viewBB)&&eL(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,nL=`react-flow__minimap-desc`;function rL({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=xN(),S=(0,H.useRef)(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$($I,tL),j=e?.width??XI,M=e?.height??ZI,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,ee=C.x-(I-C.width)/2-R,z=C.y-(L-C.height)/2-R,B=I+R*2,te=L+R*2,V=`${nL}-${E}`,ne=(0,H.useRef)(0),re=(0,H.useRef)();ne.current=F,(0,H.useEffect)(()=>{let e=x.getState().panZoom;if(S.current&&e)return re.current=IM({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>ne.current}),()=>{re.current?.destroy()}},[w]),(0,H.useEffect)(()=>{re.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=re.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=(0,H.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),oe=m?ae:void 0,se=_??A[`minimap.ariaLabel`];return(0,U.jsx)(jN,{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:Bw([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,U.jsxs)(`svg`,{width:j,height:M,viewBox:`${ee} ${z} ${B} ${te}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":V,ref:S,onClick:ie,children:[se&&(0,U.jsx)(`title`,{id:V,children:se}),(0,U.jsx)(YI,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,U.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ee-R},${z-R}h${B+R*2}v${te+R*2}h${-B-R*2}z
146
- M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}rL.displayName=`MiniMap`,(0,H.memo)(rL);var iL=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,aL={[ZM.Line]:`right`,[ZM.Handle]:`bottom-right`};function oL({nodeId:e,position:t,variant:n=ZM.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=RP(),y=typeof e==`string`?e:v,b=xN(),x=(0,H.useRef)(null),S=n===ZM.Handle,C=$((0,H.useCallback)(iL(S&&p),[S,p]),_N),w=(0,H.useRef)(null),T=t??aL[n];(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=cN({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=hM([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...yj({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]);let E=T.split(`-`);return(0,U.jsx)(`div`,{className:Bw([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(oL);var sL={workflow:pL,loop:fL},cL=[],lL={padding:.08,maxZoom:1},uL=[`true`,`false`,`failure`,`timeout`],dL=[`success`,`failure`,`timeout`];function fL({data:e}){return(0,U.jsx)(`div`,{className:`workflow-loop h-full rounded-lg border border-primary/40 bg-primary/5 p-3 text-xs`,"data-orientation":e.orientation,children:(0,U.jsxs)(`div`,{className:`workflow-loop__summary`,children:[(0,U.jsxs)(`div`,{className:`workflow-loop__heading nodrag nopan`,children:[(0,U.jsxs)(`strong`,{title:e.title,className:`line-clamp-2 min-w-0 text-sm`,children:[`Loop · `,e.title]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Max tries`}),(0,U.jsxs)(At,{value:e.maxTries,disabled:!e.change,onValueChange:t=>t!==null&&e.change?.(t),children:[(0,U.jsx)(Lt,{size:`sm`,"aria-label":`Max tries · ${e.title}`,children:(0,U.jsx)(vt,{children:e.maxTries})}),(0,U.jsx)(Ft,{children:Array.from({length:100},(e,t)=>(0,U.jsx)(ht,{value:t+1,children:t+1},t+1))})]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.progress??`First check included. Inner limits reset on each outer try.`})]})})}function pL({data:e}){let{step:t}=e,n=t.kind===`branch`?uL:dL,r=e.vertical?Q.Bottom:Q.Right;return(0,U.jsxs)(`div`,{"data-status":e.status,"data-orientation":e.vertical?`vertical`:`horizontal`,className:`workflow-step relative rounded-lg border bg-card p-3 text-xs text-card-foreground`,style:{width:208,height:192},children:[(0,U.jsx)(KP,{type:`target`,position:e.vertical?Q.Top:Q.Left}),(0,U.jsx)(`strong`,{title:t.name,className:`block text-sm font-semibold ${e.execution?`line-clamp-2 whitespace-normal`:`truncate`}`,children:t.name}),(0,U.jsxs)(`div`,{className:`text-muted-foreground`,children:[t.kind,` · `,e.permission]}),e.status&&(0,U.jsx)(`div`,{children:e.status.replaceAll(`-`,` `)}),(0,U.jsx)(`div`,{className:`workflow-step__outcomes ${e.vertical?`workflow-step__outcomes--vertical`:`workflow-step__outcomes--horizontal`}`,children:n.map(e=>(0,U.jsxs)(`div`,{className:`workflow-step__outcome`,"data-outcome":e,children:[(0,U.jsx)(`span`,{children:e}),(0,U.jsx)(KP,{id:e,type:`source`,position:r})]},e))})]})}function mL({definition:e,onChange:t,onSelect:n,execution:r,awaitingSteps:i=cL,selectedStepId:a,orientation:o=`horizontal`}){let[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)([]),d=a!==void 0,f=(0,H.useCallback)(({nodes:e})=>{let t=e.find(e=>e.type===`workflow`);t?n(t.id):d||n(``)},[n,d]),p=r?.id??e,m=(0,H.useMemo)(()=>{let t;try{t=Mw(r?zw(e,o===`vertical`):e,{orientation:o})}catch{t=e.steps.map((e,t)=>({id:e.id,type:`workflow`,position:e.position??Aw(t),data:{step:e}}))}return{layout:t,edges:e.edges.map(e=>({id:e.id,source:e.from,target:e.to,sourceHandle:e.outcome,label:e.outcome,zIndex:0})),steps:new Map(e.steps.map(e=>[e.id,e]))}},[p,e.id,o]);return(0,H.useEffect)(()=>{let n=new Set(i);c(i=>{let s=new Map(i.map(e=>[e.id,e]));return m.layout.map(i=>{if(i.type===`loop`){let n=i.data.headerId,a=e.loopSettings?.[n]?.maxTries??3;return{...i,data:{title:m.steps.get(n).name,maxTries:a,orientation:o,progress:r?.loops?.[n]?Pw(r.loops[n],a):void 0,change:t?r=>t({...e,loopSettings:{...e.loopSettings,[n]:{maxTries:r}}}):void 0}}}let c=i.data.step;return{...i,selected:a===void 0?s.get(c.id)?.selected:a===c.id,data:{step:c,vertical:!!r&&o===`vertical`,execution:!!r,permission:c.permission??e.permission??`auto-accept`,status:n.has(c.id)?`awaiting-input`:r?.steps[c.id]?.status}}})})},[m,r,a,i,e,t,o]),(0,H.useEffect)(()=>{u(e=>{let t=new Set(e.filter(e=>e.selected).map(e=>e.id));return m.edges.map(e=>({...e,selected:t.has(e.id)}))})},[m]),(0,U.jsx)(`div`,{className:`workflow-canvas overflow-hidden rounded-lg border`,children:(0,U.jsxs)(TI,{nodes:s,edges:l,nodeTypes:sL,onNodesChange:e=>c(t=>tP(e,t)),onEdgesChange:e=>u(t=>nP(e,t)),onConnect:n=>{n.source&&n.target&&t?.({...e,edges:[...e.edges,{id:crypto.randomUUID(),from:n.source,to:n.target,outcome:n.sourceHandle??`success`}]})},onNodeClick:(e,t)=>t.type===`workflow`&&n(t.id),onPaneClick:t&&d?()=>n(``):void 0,onSelectionChange:r||d?void 0:f,onNodeDragStop:(n,r,i)=>t?.({...e,steps:e.steps.map(e=>{let t=(i.length?i:[r]).find(t=>t.id===e.id);return t?{...e,position:Nw(t,s)}:e})}),onDelete:({nodes:n,edges:r})=>t?.(jw({...e,steps:e.steps.filter(e=>!n.some(t=>t.type===`workflow`&&t.id===e.id)),edges:e.edges.filter(e=>!r.some(t=>t.id===e.id)&&!n.some(t=>t.type===`workflow`&&(t.id===e.from||t.id===e.to)))})),nodesDraggable:!!t,nodesConnectable:!!t,deleteKeyCode:t?[`Backspace`,`Delete`]:null,defaultViewport:{x:32,y:e.loopSettings&&Object.keys(e.loopSettings).length?120:24,zoom:1},minZoom:r?Rw:Lw,fitView:!0,fitViewOptions:lL,zIndexMode:`manual`,children:[(0,U.jsx)(MI,{}),(0,U.jsx)(VI,{fitViewOptions:lL})]})})}export{wa as $,pl as A,Rn as At,So as B,rn as Bt,zC as C,Gr as Ct,DC as D,Rr as Dt,NC as E,zr as Et,Ic as F,On as Ft,Qa as G,Xt as Gt,yo as H,on as Ht,jc as I,Sn as It,$a as J,$t as Jt,eo as K,Zt as Kt,fc as L,xn as Lt,el as M,Pn as Mt,Qc as N,Nn as Nt,Bl as O,Ar as Ot,qc as P,jn as Pt,Da as Q,Do as R,bn as Rt,tw as S,Zr as St,VC as T,Br as Tt,_o as U,tn as Ut,bo as V,cn as Vt,fo as W,en as Wt,Sa as X,Gt as Xt,ba as Y,Kt as Yt,Ca as Z,sw as _,ai as _t,Pw as a,Ai as at,dw as b,$r as bt,Ow as c,Di as ct,Cw as d,bi as dt,Ea as et,bw as f,Si as ft,aw as g,ti as gt,cw as h,mi as ht,Fw as i,Ni as it,nl as j,Fn as jt,_l as k,Vn as kt,Tw as l,Ti as lt,hw as m,pi as mt,Iw as n,xa as nt,Dw as o,wi as ot,_w as p,hi as pt,Za as q,Qt as qt,jw as r,la as rt,Ew as s,Ci as st,mL as t,Ta as tt,ww as u,xi as ut,uw as v,ci as vt,WC as w,Wr as wt,ow as x,Qr as xt,lw as y,ei as yt,To as z,vn as zt};
145
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,H.useEffect)(()=>{let n=t?.target??ZN,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)&&jj(e))return!1;let n=eP(e.code,s);if(a.current.add(e[n]),$N(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=eP(e.code,s);$N(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 $N(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function eP(e,t){return t.includes(e)?`code`:`key`}var tP=()=>{let e=wN();return(0,H.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=_j(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 fj(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=pj(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function nP(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)rP(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 rP(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)}}function iP(e,t){return nP(e,t)}function aP(e,t){return nP(e,t)}function oP(e,t){return{id:e,type:`select`,selected:t}}function sP(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(oP(a.id,e)))}return r}function cP({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 lP(e){return{id:e.id,type:`remove`}}var uP=uj(`React Flow`,`https://reactflow.dev/`);function dP(e,t,n={}){return Wj(e,t,{...n,onError:n.onError??uP})}var fP=e=>RA(e),pP=e=>LA(e);function mP(e){return(0,H.forwardRef)(e)}var hP=typeof window<`u`?H.useLayoutEffect:H.useEffect;function gP(e){let[t,n]=(0,H.useState)(BigInt(0)),[r]=(0,H.useState)(()=>_P(()=>n(e=>e+BigInt(1))));return hP(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function _P(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var vP=(0,H.createContext)(null);function yP({children:e}){let t=wN(),n=gP((0,H.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=cP({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=gP((0,H.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(cP({items:s,lookup:o}))},[])),i=(0,H.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,U.jsx)(vP.Provider,{value:i,children:e})}function bP(){let e=(0,H.useContext)(vP);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var xP=e=>!!e.panZoom;function SP(){let e=tP(),t=wN(),n=bP(),r=$(xP),i=(0,H.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=fP(e)?e:n.get(e.id),a=i.parentId?Sj(i.position,i.measured,i.parentId,n,r):i.position;return rj({...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&&fP(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&&pP(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 JA({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(lP);o?.(f),c(e)}if(m){let e=d.map(lP);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=cj(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=rj(s?r:a),l=sj(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=cj(e)?e:a(e);if(!r)return!1;let i=sj(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 VA(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??wj();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,H.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var CP=e=>e.selected,wP=typeof window<`u`?window:void 0;function TP({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=wN(),{deleteElements:r}=SP(),i=QN(e,{actInsideInputWithModifier:!1}),a=QN(t,{target:wP});(0,H.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(CP),edges:e.filter(CP)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,H.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function EP(e){let t=wN();(0,H.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Oj(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,EA.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 DP={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},OP=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function kP({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=jA.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=wN(),C=(0,H.useRef)(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=$(OP,bN),D=QN(p),O=(0,H.useRef)();EP(C);let k=(0,H.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return(0,H.useEffect)(()=>{if(C.current){O.current=$M({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),(0,H.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),(0,U.jsx)(`div`,{className:`react-flow__renderer`,ref:C,style:DP,children:h})}var AP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function jP(){let{userSelectionActive:e,userSelectionRect:t}=$(AP,bN);return e&&t?(0,U.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 MP=(e,t)=>n=>{n.target===t.current&&e?.(n)},NP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function PP({isSelecting:e,selectionKeyPressed:t,selectionMode:n=MA.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,H.useRef)(0),_=wN(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(NP,bN),C=y&&(e||v),w=(0,H.useRef)(null),T=(0,H.useRef)(),E=(0,H.useRef)(new Set),D=(0,H.useRef)(new Set),O=(0,H.useRef)(!1),k=(0,H.useRef)(!1),A=(0,H.useRef)({x:0,y:0}),j=(0,H.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=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Nj(n.nativeEvent,T.current),u=fj({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(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}=pj(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(UA(a,m,i,n===MA.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)}}Cj(h,E.current)||c(sP(a,E.current,!0)),Cj(g,D.current)||l(sP(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=$A(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let ee=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,H.useEffect)(()=>()=>ee(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Nj(e.nativeEvent,T.current);A.current={x:o,y:c};let l=pj({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||=(R(),!0),L(o,c)},B=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})),ee())},te=e=>{e.target?.releasePointerCapture?.(e.pointerId),ee()},V=r===!0||Array.isArray(r)&&r.includes(0);return(0,U.jsxs)(`div`,{className:Uw([`react-flow__pane`,{draggable:V,dragging:b,selection:e}]),onClick:C?void 0:MP(M,w),onContextMenu:MP(N,w),onWheel:MP(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?te:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:DP,children:[h,(0,U.jsx)(jP,{})]})}function FP({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`,EA.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function IP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=wN(),[c,l]=(0,H.useState)(!1),u=(0,H.useRef)();return(0,H.useEffect)(()=>{if(!t)return u.current=OM({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{FP({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,H.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 LP=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function RP(){let e=wN();return(0,H.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=LP(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=dj(t,i));let{position:a,positionAbsolute:s}=qA({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 zP=(0,H.createContext)(null),BP=zP.Provider;zP.Consumer;var VP=()=>(0,H.useContext)(zP),HP=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),UP=(0,H.createContext)(null);function WP({children:e}){let t=$(HP,bN);return(0,U.jsx)(UP.Provider,{value:t,children:e})}function GP(){let e=(0,H.useContext)(UP);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var KP={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},qP=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return KP;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===AA.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function JP({type:e=`source`,position:t=Q.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=wN(),_=VP(),{connectOnClick:v,noPanClassName:y,rfId:b}=GP(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(qP(_,m,e),bN);_||g.getState().onError?.(`010`,EA.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(dP(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Mj(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();RM.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,U.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Uw([`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=kj(t.target),h=n||c,{connection:v,isValid:y}=RM.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 YP=(0,H.memo)(mP(JP));function XP({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[e?.label,(0,U.jsx)(YP,{type:`source`,position:n,isConnectable:t})]})}function ZP({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YP,{type:`target`,position:n,isConnectable:t}),e?.label,(0,U.jsx)(YP,{type:`source`,position:r,isConnectable:t})]})}function QP(){return null}function $P({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YP,{type:`target`,position:n,isConnectable:t}),e?.label]})}var eF={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},tF={input:XP,default:ZP,output:$P,group:QP};function nF(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 rF=e=>{let{width:t,height:n,x:r,y:i}=HA(e.nodeLookup,{filter:e=>!!e.selected});return{width:lj(t)?t:null,height:lj(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 iF({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=wN(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(rF,bN),c=RP(),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(IP({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,U.jsx)(`div`,{className:Uw([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,U.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(eF,e.key)&&(e.preventDefault(),c({direction:eF[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var aF=typeof window<`u`?window:void 0,oF=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sF({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:R}=$(oF,bN),ee=QN(l,{target:aF}),z=QN(h,{target:aF}),B=z||w,te=z||b,V=u&&B!==!0,ne=ee||R||V;return TP({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,U.jsx)(kP,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panActivationKeyPressed:z,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!ee&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:V,children:(0,U.jsxs)(PP,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:ee,paneClickDistance:s,selectionOnDrag:V,children:[e,L&&(0,U.jsx)(iF,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}sF.displayName=`FlowRenderer`;var cF=(0,H.memo)(sF),lF=e=>t=>e?UA(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 uF(e){return $((0,H.useCallback)(lF(e),[e]),bN)}var dF=e=>e.updateNodeInternals;function fF(){let e=$(dF),[t]=(0,H.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,H.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function pF({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=wN(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(e.sourcePosition),c=(0,H.useRef)(e.targetPosition),l=(0,H.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,H.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,H.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,H.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 mF({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}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},bN),S=y.type||`default`,C=g?.[S]||tF[S];C===void 0&&(v?.(`003`,EA.error003(S)),S=`default`,C=g?.default||tF.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=wN(),k=xj(y),A=pF({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=IP({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=RP();if(y.hidden)return null;let N=bj(y),P=nF(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,R=i?e=>i(e,{...b.userNode}):void 0,ee=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&FP({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},te=t=>{if(!(jj(t.nativeEvent)||m)){if(OA.includes(t.key)&&T){let n=t.key===`Escape`;FP({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(eF,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:eF[t.key],factor:t.shiftKey?4:1})}}},V=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(UA(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,U.jsx)(`div`,{className:Uw([`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:R,onContextMenu:ee,onClick:B,onDoubleClick:z,onKeyDown:D?te:void 0,tabIndex:D?0:void 0,onFocus:D?V:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${DN}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,U.jsx)(BP,{value:e,children:(0,U.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 hF=(0,H.memo)(mF),gF=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _F(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=$(gF,bN),a=uF(e.onlyRenderVisibleElements),o=fF();return(0,U.jsx)(`div`,{className:`react-flow__nodes`,style:DP,children:a.map(a=>(0,U.jsx)(hF,{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))})}_F.displayName=`NodeRenderer`;var vF=(0,H.memo)(_F);function yF(e){return $((0,H.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&&Vj({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),bN)}var bF=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,U.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},xF=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,U.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},SF={[FA.Arrow]:bF,[FA.ArrowClosed]:xF};function CF(e){let t=wN();return(0,H.useMemo)(()=>Object.prototype.hasOwnProperty.call(SF,e)?SF[e]:(t.getState().onError?.(`009`,EA.error009(e)),null),[e])}var wF=({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=CF(t);return c?(0,U.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,U.jsx)(c,{color:n,strokeWidth:o})}):null},TF=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,H.useMemo)(()=>iM(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,U.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,U.jsx)(`defs`,{children:i.map(e=>(0,U.jsx)(wF,{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};TF.displayName=`MarkerDefinitions`;var EF=(0,H.memo)(TF);function DF({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,H.useState)({x:1,y:0,width:0,height:0}),p=Uw([`react-flow__edge-textwrapper`,l]),m=(0,H.useRef)(null);return(0,H.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,U.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,U.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,U.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}DF.displayName=`EdgeText`;var OF=(0,H.memo)(DF);function kF({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{...u,d:e,fill:`none`,className:Uw([`react-flow__edge-path`,u.className])}),l?(0,U.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&lj(t)&&lj(n)?(0,U.jsx)(OF,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function AF({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function jF({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=AF({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=AF({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Fj({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 MF(e){return(0,H.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]=jF({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:x,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 NF=MF({isInternal:!1}),PF=MF({isInternal:!0});NF.displayName=`SimpleBezierEdge`,PF.displayName=`SimpleBezierEdgeInternal`;function FF(e){return(0,H.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=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Zj({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:S,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 IF=FF({isInternal:!1}),LF=FF({isInternal:!0});IF.displayName=`SmoothStepEdge`,LF.displayName=`SmoothStepEdgeInternal`;function RF(e){return(0,H.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,U.jsx)(IF,{...n,id:r,pathOptions:(0,H.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var zF=RF({isInternal:!1}),BF=RF({isInternal:!0});zF.displayName=`StepEdge`,BF.displayName=`StepEdgeInternal`;function VF(e){return(0,H.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]=Gj({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:y,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 HF=VF({isInternal:!1}),UF=VF({isInternal:!0});HF.displayName=`StraightEdge`,UF.displayName=`StraightEdgeInternal`;function WF(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.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]=Rj({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,U.jsx)(kF,{id:S,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 GF=WF({isInternal:!1}),KF=WF({isInternal:!0});GF.displayName=`BezierEdge`,KF.displayName=`BezierEdgeInternal`;var qF={default:KF,straight:UF,step:BF,smoothstep:LF,simplebezier:PF},JF={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},YF=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,XF=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,ZF=`react-flow__edgeupdater`;function QF({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,U.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Uw([ZF,`${ZF}-${s}`]),cx:YF(t,r,e),cy:XF(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function $F({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=wN(),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`;RM.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,U.jsxs)(U.Fragment,{children:[(e===!0||e===`source`)&&(0,U.jsx)(QF,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,U.jsx)(QF,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function eI({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=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||qF[x];S===void 0&&(_?.(`011`,EA.error011(x)),x=`default`,S=h?.default||qF.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,H.useRef)(null),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(!1),j=wN(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,H.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return JF;let i=$j({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Bj({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||JF,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),bN),ee=(0,H.useMemo)(()=>y.markerStart?`url('#${rM(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,H.useMemo)(()=>y.markerEnd?`url('#${rM(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let B=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)},te=a?e=>{a(e,{...y})}:void 0,V=o?e=>{o(e,{...y})}:void 0,ne=s?e=>{s(e,{...y})}:void 0,re=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,U.jsx)(`svg`,{style:{zIndex:M},children:(0,U.jsxs)(`g`,{className:Uw([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:te,onContextMenu:V,onMouseEnter:ne,onMouseMove:re,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&OA.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?`${ON}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,U.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:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ee,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,U.jsx)($F,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var tI=(0,H.memo)(eI),nI=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function rI({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}=$(nI,bN),b=yF(t);return(0,U.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,U.jsx)(EF,{defaultColor:e,rfId:n}),b.map(e=>(0,U.jsx)(tI,{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))]})}rI.displayName=`EdgeRenderer`;var iI=(0,H.memo)(rI),aI=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function oI({children:e}){let t=wN(),n=(0,H.useRef)(null),[r]=(0,H.useState)(()=>t.getState().transform);return hP(()=>{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=aI(r)))};return r(),t.subscribe(r)},[t]),(0,U.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:aI(r)},children:e})}function sI(e){let t=SP(),n=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var cI=e=>e.panZoom?.syncViewport;function lI(e){let t=$(cI),n=wN();return(0,H.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function uI(e){return e.connection.inProgress?{...e.connection,to:fj(e.connection.to,e.transform)}:{...e.connection}}function dI(e){return e?t=>e(uI(t)):uI}function fI(e){return $(dI(e),bN)}var pI=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mI({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(pI,bN);return a&&i&&c?(0,U.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,U.jsx)(`g`,{className:Uw([`react-flow__connection`,Ej(s)]),children:(0,U.jsx)(hI,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var hI=({style:e,type:t=PA.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}=fI();if(!i)return;if(n)return(0,U.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:Ej(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 PA.Bezier:[m]=Rj(h);break;case PA.SimpleBezier:[m]=jF(h);break;case PA.Step:[m]=Zj({...h,borderRadius:0});break;case PA.SmoothStep:[m]=Zj(h);break;default:[m]=Gj(h)}return(0,U.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};hI.displayName=`ConnectionLine`;var gI={};function _I(e=gI){(0,H.useRef)(e),wN(),(0,H.useEffect)(()=>{},[e])}function vI(){wN(),(0,H.useRef)(!1),(0,H.useEffect)(()=>{},[])}function yI({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:R,panOnDrag:ee,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:ie,paneClickDistance:ae,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,viewport:xe,onViewportChange:Se,nodesDraggable:Ce}){return _I(e),_I(t),vI(),sI(n),lI(xe),(0,U.jsx)(cF,{onPaneClick:B,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:ne,onPaneContextMenu:ie,onPaneScroll:re,paneClickDistance:ae,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:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:ee,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,onViewportChange:Se,isControlledViewport:!!xe,children:(0,U.jsxs)(oI,{children:[(0,U.jsx)(iI,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,defaultMarkerColor:M,noPanClassName:_e,disableKeyboardA11y:ve,rfId:be}),(0,U.jsx)(mI,{style:h,type:m,component:g,containerStyle:_}),(0,U.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,U.jsx)(vF,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,nodesDraggable:Ce}),(0,U.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}yI.displayName=`GraphView`;var bI=(0,H.memo)(yI),xI=uj(`React Flow`,`https://reactflow.dev/`),SI=({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??DA;SM(h,g,_);let{nodesInitialized:x}=pM(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=_j(HA(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:DA,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:AA.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:{...NA},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xI,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:kA,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},CI=({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})=>yN((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 KA({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...SI({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,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=pM(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();SM(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}=yM(e,n,r,i,a,o,l);d&&(uM(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=tM(e,o.fromHandle,Q.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=vM(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(iP(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(aP(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=>oP(e,!0)));return}i(sP(r,new Set([...e]),!0)),a(sP(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>oP(e,!0)));return}a(sP(n,new Set([...e]))),i(sP(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(oP(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(oP(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,oP(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,oP(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])&&(pM(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 bM({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:{...NA}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...SI()})}},Object.is);function wI({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,H.useState)(()=>CI({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,U.jsx)(SN,{value:m,children:(0,U.jsx)(yP,{children:(0,U.jsx)(WP,{children:p})})})}function TI({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,H.useContext)(xN)?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(wI,{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 EI={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function DI({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:R=PA.Bezier,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:te=`Backspace`,selectionKeyCode:V=`Shift`,selectionOnDrag:ne=!1,selectionMode:re=MA.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=vj()?`Meta`:`Control`,zoomActivationKeyCode:oe=vj()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,nodeOrigin:he=UN,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve=!0,defaultViewport:ye=WN,minZoom:be=.5,maxZoom:xe=2,translateExtent:Se=DA,preventScrolling:Ce=!0,nodeExtent:we,defaultMarkerColor:Te=`#b1b1b7`,zoomOnScroll:Ee=!0,zoomOnPinch:De=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Ae=jA.Free,zoomOnDoubleClick:je=!0,panOnDrag:Me=!0,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:Ve,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:ot,defaultEdgeOptions:st,elevateNodesOnSelect:ct=!0,elevateEdgesOnSelect:lt=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanOnSelection:pt=!0,autoPanSpeed:mt,connectionRadius:ht,isValidConnection:gt,onError:_t,style:vt,id:yt,nodeDragThreshold:bt,connectionDragThreshold:xt,viewport:St,onViewportChange:Ct,width:wt,height:Tt,colorMode:Et=`light`,debug:Dt,onScroll:Ot,ariaLabelConfig:kt,zIndexMode:At=`basic`,...jt},Mt){let Nt=yt||`1`,Pt=XN(Et),Ft=(0,H.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ot?.(e)},[Ot]);return(0,U.jsx)(`div`,{"data-testid":`rf__wrapper`,...jt,onScroll:Ft,style:{...vt,...EI},ref:Mt,className:Uw([`react-flow`,i,Pt]),id:yt,role:`application`,children:(0,U.jsxs)(TI,{nodes:e,edges:t,width:wt,height:Tt,fitView:nt,fitViewOptions:rt,minZoom:be,maxZoom:xe,nodeOrigin:he,nodeExtent:we,zIndexMode:At,children:[(0,U.jsx)(JN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve,elevateNodesOnSelect:ct,elevateEdgesOnSelect:lt,minZoom:be,maxZoom:xe,nodeExtent:we,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:Se,connectOnClick:it,defaultEdgeOptions:st,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:he,rfId:Nt,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanSpeed:mt,onError:_t,connectionRadius:ht,isValidConnection:gt,selectNodesOnDrag:ue,nodeDragThreshold:bt,connectionDragThreshold:xt,onBeforeDelete:I,debug:Dt,ariaLabelConfig:kt,zIndexMode:At}),(0,U.jsx)(bI,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:V,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:te,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ye,translateExtent:Se,minZoom:be,maxZoom:xe,preventScrolling:Ce,zoomOnScroll:Ee,zoomOnPinch:De,zoomOnDoubleClick:je,panOnScroll:Oe,panOnScrollSpeed:ke,panOnScrollMode:Ae,panOnDrag:Me,autoPanOnSelection:pt,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,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:Te,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Nt,disableKeyboardA11y:ut,nodeExtent:we,viewport:St,onViewportChange:Ct,nodesDraggable:de}),(0,U.jsx)(HN,{onSelectionChange:k}),Ve,(0,U.jsx)(IN,{proOptions:ot,position:at}),(0,U.jsx)(NN,{rfId:Nt,disableKeyboardA11y:ut})]})})}var OI=mP(DI);EA.error014();function kI({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,U.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Uw([`react-flow__background-pattern`,n,r])})}function AI({radius:e,className:t}){return(0,U.jsx)(`circle`,{cx:e,cy:e,r:e,className:Uw([`react-flow__background-pattern`,`dots`,t])})}var jI;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jI||={});var MI={[jI.Dots]:1,[jI.Lines]:1,[jI.Cross]:6},NI=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function PI({id:e,variant:t=jI.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,H.useRef)(null),{transform:f,patternId:p}=$(NI,bN),m=r||MI[t],h=t===jI.Dots,g=t===jI.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]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return(0,U.jsxs)(`svg`,{className:Uw([`react-flow__background`,l]),style:{...c,...DP,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,U.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,U.jsx)(AI,{radius:y/2,className:u}):(0,U.jsx)(kI,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,U.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}PI.displayName=`Background`;var FI=(0,H.memo)(PI);function II(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,U.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function LI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,U.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function RI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,U.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 zI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.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 BI(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.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 VI({children:e,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:Uw([`react-flow__controls-button`,t]),...n,children:e})}var HI=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function UI({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=wN(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(HI,bN),{zoomIn:y,zoomOut:b,fitView:x}=SP();return(0,U.jsxs)(PN,{className:Uw([`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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(VI,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,U.jsx)(II,{})}),(0,U.jsx)(VI,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,U.jsx)(LI,{})})]}),n&&(0,U.jsx)(VI,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,U.jsx)(RI,{})}),r&&(0,U.jsx)(VI,{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,U.jsx)(BI,{}):(0,U.jsx)(zI,{})}),u]})}UI.displayName=`Controls`;var WI=(0,H.memo)(UI);function GI({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,U.jsx)(`rect`,{className:Uw([`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 KI=(0,H.memo)(GI),qI=e=>e.nodes.map(e=>e.id),JI=e=>e instanceof Function?e:()=>e;function YI({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=KI,onClick:o}){let s=$(qI,bN),c=JI(t),l=JI(e),u=JI(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,U.jsx)(U.Fragment,{children:s.map(e=>(0,U.jsx)(ZI,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function XI({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}=$(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}=bj(r);return{node:r,x:i,y:a,width:o,height:s}},bN);return!l||l.hidden||!xj(l)?null:(0,U.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 ZI=(0,H.memo)(XI),QI=(0,H.memo)(YI),$I=200,eL=150,tL=e=>!e.hidden,nL=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]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?aj(HA(e.nodeLookup,{filter:tL}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rL=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,iL=(e,t)=>rL(e.viewBB,t.viewBB)&&rL(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,aL=`react-flow__minimap-desc`;function oL({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=wN(),S=(0,H.useRef)(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nL,iL),j=e?.width??$I,M=e?.height??eL,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,ee=C.x-(I-C.width)/2-R,z=C.y-(L-C.height)/2-R,B=I+R*2,te=L+R*2,V=`${aL}-${E}`,ne=(0,H.useRef)(0),re=(0,H.useRef)();ne.current=F,(0,H.useEffect)(()=>{let e=x.getState().panZoom;if(S.current&&e)return re.current=zM({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>ne.current}),()=>{re.current?.destroy()}},[w]),(0,H.useEffect)(()=>{re.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=re.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=(0,H.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),oe=m?ae:void 0,se=_??A[`minimap.ariaLabel`];return(0,U.jsx)(PN,{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:Uw([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,U.jsxs)(`svg`,{width:j,height:M,viewBox:`${ee} ${z} ${B} ${te}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":V,ref:S,onClick:ie,children:[se&&(0,U.jsx)(`title`,{id:V,children:se}),(0,U.jsx)(QI,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,U.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ee-R},${z-R}h${B+R*2}v${te+R*2}h${-B-R*2}z
146
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}oL.displayName=`MiniMap`,(0,H.memo)(oL);var sL=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,cL={[eN.Line]:`right`,[eN.Handle]:`bottom-right`};function lL({nodeId:e,position:t,variant:n=eN.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=VP(),y=typeof e==`string`?e:v,b=wN(),x=(0,H.useRef)(null),S=n===eN.Handle,C=$((0,H.useCallback)(sL(S&&p),[S,p]),bN),w=(0,H.useRef)(null),T=t??cL[n];(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=dN({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=vM([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Sj({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]);let E=T.split(`-`);return(0,U.jsx)(`div`,{className:Uw([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(lL);var uL={workflow:gL,loop:hL},dL=[],fL={padding:.08,maxZoom:1},pL=[`true`,`false`,`failure`,`timeout`],mL=[`success`,`failure`,`timeout`];function hL({data:e}){return(0,U.jsx)(`div`,{className:`workflow-loop h-full rounded-lg border border-primary/40 bg-primary/5 p-3 text-xs`,"data-orientation":e.orientation,children:(0,U.jsxs)(`div`,{className:`workflow-loop__summary`,children:[(0,U.jsxs)(`div`,{className:`workflow-loop__heading nodrag nopan`,children:[(0,U.jsxs)(`strong`,{title:e.title,className:`line-clamp-2 min-w-0 text-sm`,children:[`Loop · `,e.title]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Max tries`}),(0,U.jsxs)(At,{value:e.maxTries,disabled:!e.change,onValueChange:t=>t!==null&&e.change?.(t),children:[(0,U.jsx)(Lt,{size:`sm`,"aria-label":`Max tries · ${e.title}`,children:(0,U.jsx)(vt,{children:e.maxTries})}),(0,U.jsx)(Ft,{children:Array.from({length:100},(e,t)=>(0,U.jsx)(ht,{value:t+1,children:t+1},t+1))})]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.progress??`First check included. Inner limits reset on each outer try.`})]})})}function gL({data:e}){let{step:t}=e,n=t.kind===`branch`?pL:mL,r=e.vertical?Q.Bottom:Q.Right;return(0,U.jsxs)(`div`,{"data-status":e.status,"data-orientation":e.vertical?`vertical`:`horizontal`,className:`workflow-step relative rounded-lg border bg-card p-3 text-xs text-card-foreground`,style:{width:208,height:192},children:[(0,U.jsx)(YP,{type:`target`,position:e.vertical?Q.Top:Q.Left}),(0,U.jsx)(`strong`,{title:t.name,className:`block text-sm font-semibold ${e.execution?`line-clamp-2 whitespace-normal`:`truncate`}`,children:t.name}),(0,U.jsxs)(`div`,{className:`text-muted-foreground`,children:[t.kind,` · `,e.permission]}),e.status&&(0,U.jsx)(`div`,{children:e.status.replaceAll(`-`,` `)}),(0,U.jsx)(`div`,{className:`workflow-step__outcomes ${e.vertical?`workflow-step__outcomes--vertical`:`workflow-step__outcomes--horizontal`}`,children:n.map(e=>(0,U.jsxs)(`div`,{className:`workflow-step__outcome`,"data-outcome":e,children:[(0,U.jsx)(`span`,{children:e}),(0,U.jsx)(YP,{id:e,type:`source`,position:r})]},e))})]})}function _L({definition:e,onChange:t,onSelect:n,execution:r,awaitingSteps:i=dL,selectedStepId:a,orientation:o=`horizontal`}){let[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)([]),d=a!==void 0,f=(0,H.useCallback)(({nodes:e})=>{let t=e.find(e=>e.type===`workflow`);t?n(t.id):d||n(``)},[n,d]),p=r?.id??e,m=(0,H.useMemo)(()=>{let t;try{t=Fw(r?Hw(e,o===`vertical`):e,{orientation:o})}catch{t=e.steps.map((e,t)=>({id:e.id,type:`workflow`,position:e.position??Nw(t),data:{step:e}}))}return{layout:t,edges:e.edges.map(e=>({id:e.id,source:e.from,target:e.to,sourceHandle:e.outcome,label:e.outcome,zIndex:0})),steps:new Map(e.steps.map(e=>[e.id,e]))}},[p,e.id,o]);return(0,H.useEffect)(()=>{let n=new Set(i);c(i=>{let s=new Map(i.map(e=>[e.id,e]));return m.layout.map(i=>{if(i.type===`loop`){let n=i.data.headerId,a=e.loopSettings?.[n]?.maxTries??3;return{...i,data:{title:m.steps.get(n).name,maxTries:a,orientation:o,progress:r?.loops?.[n]?Lw(r.loops[n],a):void 0,change:t?r=>t({...e,loopSettings:{...e.loopSettings,[n]:{maxTries:r}}}):void 0}}}let c=i.data.step;return{...i,selected:a===void 0?s.get(c.id)?.selected:a===c.id,data:{step:c,vertical:!!r&&o===`vertical`,execution:!!r,permission:c.permission??e.permission??`auto-accept`,status:n.has(c.id)?`awaiting-input`:r?.steps[c.id]?.status}}})})},[m,r,a,i,e,t,o]),(0,H.useEffect)(()=>{u(e=>{let t=new Set(e.filter(e=>e.selected).map(e=>e.id));return m.edges.map(e=>({...e,selected:t.has(e.id)}))})},[m]),(0,U.jsx)(`div`,{className:`workflow-canvas overflow-hidden rounded-lg border`,children:(0,U.jsxs)(OI,{nodes:s,edges:l,nodeTypes:uL,onNodesChange:e=>c(t=>iP(e,t)),onEdgesChange:e=>u(t=>aP(e,t)),onConnect:n=>{n.source&&n.target&&t?.({...e,edges:[...e.edges,{id:crypto.randomUUID(),from:n.source,to:n.target,outcome:n.sourceHandle??`success`}]})},onNodeClick:(e,t)=>t.type===`workflow`&&n(t.id),onPaneClick:t&&d?()=>n(``):void 0,onSelectionChange:r||d?void 0:f,onNodeDragStop:(n,r,i)=>t?.({...e,steps:e.steps.map(e=>{let t=(i.length?i:[r]).find(t=>t.id===e.id);return t?{...e,position:Iw(t,s)}:e})}),onDelete:({nodes:n,edges:r})=>t?.(Pw({...e,steps:e.steps.filter(e=>!n.some(t=>t.type===`workflow`&&t.id===e.id)),edges:e.edges.filter(e=>!r.some(t=>t.id===e.id)&&!n.some(t=>t.type===`workflow`&&(t.id===e.from||t.id===e.to)))})),nodesDraggable:!!t,nodesConnectable:!!t,deleteKeyCode:t?[`Backspace`,`Delete`]:null,defaultViewport:{x:32,y:e.loopSettings&&Object.keys(e.loopSettings).length?120:24,zoom:1},minZoom:r?Vw:Bw,fitView:!0,fitViewOptions:fL,zIndexMode:`manual`,children:[(0,U.jsx)(FI,{}),(0,U.jsx)(WI,{fitViewOptions:fL})]})})}export{Oa as $,_l as A,Hn as At,Oo as B,vn as Bt,HC as C,Qr as Ct,AC as D,Br as Dt,IC as E,Vr as Et,zc as F,jn as Ft,no as G,en as Gt,To as H,cn as Ht,bc as I,On as It,ro as J,Qt as Jt,io as K,Xt as Kt,Fo as L,Sn as Lt,il as M,In as Mt,tl as N,Fn as Nt,Ul as O,zr as Ot,Wc as P,Pn as Pt,ja as Q,No as R,xn as Rt,iw as S,$r as St,WC as T,Gr as Tt,bo as U,on as Ut,Do as V,rn as Vt,co as W,tn as Wt,Ea as X,Kt as Xt,wa as Y,$t as Yt,Da as Z,Gt as Zt,uw as _,ni as _t,Lw as a,Fi as at,mw as b,ti as bt,jw as c,wi as ct,Ew as d,Si as dt,Aa as et,Cw as f,xi as ft,cw as g,hi as gt,dw as h,mi as ht,Rw as i,Ii as it,ol as j,zn as jt,xl as k,jr as kt,Ow as l,Oi as lt,vw as m,gi as mt,zw as n,Ta as nt,Aw as o,ji as ot,bw as p,Ci as pt,to as q,Zt as qt,Pw as r,pa as rt,kw as s,Ti as st,_L as t,ka as tt,Dw as u,Ei as ut,pw as v,oi as vt,qC as w,Kr as wt,lw as x,ei as xt,fw as y,li as yt,Ao as z,bn as zt};