@pikku/cli 0.12.25 → 0.12.26

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 (115) hide show
  1. package/console-app/assets/{index-D4DgafuS.js → index-Ba9K10XZ.js} +4 -4
  2. package/console-app/index.html +1 -1
  3. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  4. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  5. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  6. package/dist/.pikku/cli/pikku-cli-channel.js +6 -1
  7. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  8. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  9. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  10. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +9 -0
  11. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  12. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  14. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  15. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  16. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  17. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  18. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  19. package/dist/.pikku/function/pikku-functions-meta.gen.json +116 -101
  20. package/dist/.pikku/function/pikku-functions.gen.js +3 -1
  21. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  22. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  23. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  24. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  25. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  26. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  27. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  28. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  29. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  30. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  31. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  32. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  33. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-types.gen.js +1 -1
  35. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  36. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  37. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  38. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  39. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  40. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  41. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +10 -9
  42. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  43. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  44. package/dist/.pikku/schemas/register.gen.js +7 -5
  45. package/dist/.pikku/schemas/schemas/DbAuditInput.schema.json +1 -0
  46. package/dist/.pikku/schemas/schemas/PikkuTestsCoverageInput.schema.json +1 -1
  47. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  48. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  49. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  50. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  51. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  52. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  53. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  54. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  55. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  56. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  57. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  58. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  59. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  60. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  61. package/dist/bin/pikku-bin.mjs +2 -2
  62. package/dist/src/cli.wiring.js +8 -0
  63. package/dist/src/fabric/functions/validate.function.js +1 -1
  64. package/dist/src/functions/commands/db-audit.d.ts +1 -0
  65. package/dist/src/functions/commands/db-audit.js +67 -0
  66. package/dist/src/functions/commands/db-migrate.js +5 -8
  67. package/dist/src/functions/commands/db-reset.js +9 -8
  68. package/dist/src/functions/commands/db-seed.js +9 -8
  69. package/dist/src/functions/commands/db-shared.d.ts +2 -4
  70. package/dist/src/functions/commands/db-shared.js +15 -5
  71. package/dist/src/functions/commands/dev.js +14 -8
  72. package/dist/src/functions/commands/new-addon.js +2 -2
  73. package/dist/src/functions/commands/tests-coverage.d.ts +3 -0
  74. package/dist/src/functions/commands/tests-coverage.js +34 -0
  75. package/dist/src/functions/db/annotation-parser.d.ts +31 -0
  76. package/dist/src/functions/db/annotation-parser.js +93 -0
  77. package/dist/src/functions/db/db-codegen.d.ts +24 -0
  78. package/dist/src/functions/db/db-codegen.js +276 -0
  79. package/dist/src/functions/db/db-introspector.d.ts +15 -0
  80. package/dist/src/functions/db/db-introspector.js +1 -0
  81. package/dist/src/functions/db/db-migrator.d.ts +32 -0
  82. package/dist/src/functions/db/db-migrator.js +65 -0
  83. package/dist/src/functions/db/local-db.d.ts +27 -33
  84. package/dist/src/functions/db/local-db.js +100 -53
  85. package/dist/src/functions/db/postgres/postgres-introspector.d.ts +10 -0
  86. package/dist/src/functions/db/postgres/postgres-introspector.js +54 -0
  87. package/dist/src/functions/db/postgres/postgres-migrator.d.ts +9 -0
  88. package/dist/src/functions/db/postgres/postgres-migrator.js +32 -0
  89. package/dist/src/functions/db/sqlite/sqlite-introspector.d.ts +9 -0
  90. package/dist/src/functions/db/sqlite/sqlite-introspector.js +35 -0
  91. package/dist/src/functions/db/sqlite/sqlite-migrator.d.ts +10 -0
  92. package/dist/src/functions/db/sqlite/sqlite-migrator.js +36 -0
  93. package/dist/src/functions/validate/workspace-validate.js +3 -2
  94. package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +2 -1
  95. package/dist/src/functions/wirings/console/serialize-console-functions.js +4 -4
  96. package/dist/src/functions/wirings/functions/serialize-addon-types.js +1 -1
  97. package/dist/src/scaffold/rpc-remote.gen.js +1 -1
  98. package/dist/src/services.js +2 -0
  99. package/dist/tsconfig.tsbuildinfo +1 -1
  100. package/package.json +5 -3
  101. package/skills/pikku-testing/SKILL.md +208 -0
  102. package/dist/src/functions/db/sql-migrator.d.ts +0 -26
  103. package/dist/src/functions/db/sql-migrator.js +0 -104
  104. package/dist/src/functions/db/sqlite-codegen.d.ts +0 -45
  105. package/dist/src/functions/db/sqlite-codegen.js +0 -294
  106. /package/dist/src/functions/db/{seed.d.ts → sqlite/seed.d.ts} +0 -0
  107. /package/dist/src/functions/db/{seed.js → sqlite/seed.js} +0 -0
  108. /package/dist/src/functions/db/{sqlite-kysely.d.ts → sqlite/sqlite-kysely.d.ts} +0 -0
  109. /package/dist/src/functions/db/{sqlite-kysely.js → sqlite/sqlite-kysely.js} +0 -0
  110. /package/dist/src/functions/db/{sqlite-runtime-bun.d.ts → sqlite/sqlite-runtime-bun.d.ts} +0 -0
  111. /package/dist/src/functions/db/{sqlite-runtime-bun.js → sqlite/sqlite-runtime-bun.js} +0 -0
  112. /package/dist/src/functions/db/{sqlite-runtime-node.d.ts → sqlite/sqlite-runtime-node.d.ts} +0 -0
  113. /package/dist/src/functions/db/{sqlite-runtime-node.js → sqlite/sqlite-runtime-node.js} +0 -0
  114. /package/dist/src/functions/db/{sqlite-runtime.d.ts → sqlite/sqlite-runtime.d.ts} +0 -0
  115. /package/dist/src/functions/db/{sqlite-runtime.js → sqlite/sqlite-runtime.js} +0 -0
@@ -136,7 +136,7 @@ ${o?`${s(`light`)}{${o}}`:``}`}function gs({color:e,theme:t,autoContrast:n}){ret
136
136
  }`,{label:`interface`,detail:`definition`,type:`keyword`}),QR("type ${name} = ${type}",{label:`type`,detail:`definition`,type:`keyword`}),QR(`enum \${name} {
137
137
  \${}
138
138
  }`,{label:`enum`,detail:`definition`,type:`keyword`})]),TVe=new HF,EVe=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function lB(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var DVe=[`FunctionDeclaration`],OVe={FunctionDeclaration:lB(`function`),ClassDeclaration:lB(`class`),ClassExpression:()=>!0,EnumDeclaration:lB(`constant`),TypeAliasDeclaration:lB(`type`),NamespaceDeclaration:lB(`namespace`),VariableDefinition(e,t){e.matchContext(DVe)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function uB(e,t){let n=TVe.get(t);if(n)return n;let r=[],i=!0;function a(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(AF.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=OVe[t.name];if(e&&e(t,a)||EVe.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of uB(e,t.node))r.push(n);return!1}}),TVe.set(t,r),r}var kVe=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,AVe=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function dB(e){let t=mI(e.state).resolveInner(e.pos,-1);if(AVe.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&kVe.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)EVe.has(n.name)&&(r=r.concat(uB(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:kVe}}var fB=QFe.define({name:`javascript`,parser:cB.configure({props:[CI.add({IfStatement:mIe({except:/^\s*({|else\b)/}),TryStatement:mIe({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:pIe,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:dIe({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":mIe({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),kI.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":_Ie,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name==`JSXSelfClosingTag`)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){let t=e.firstChild?.nextSibling,n=e.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),jVe={test:e=>/^JSX/.test(e.name),facet:dI({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},pB=fB.configure({dialect:`ts`},`typescript`),MVe=fB.configure({dialect:`jsx`,props:[ZFe.add(e=>e.isTop?[jVe]:void 0)]}),mB=fB.configure({dialect:`jsx ts`,props:[ZFe.add(e=>e.isTop?[jVe]:void 0)]},`typescript`),NVe=e=>({label:e,type:`keyword`}),hB=`break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield`.split(` `).map(NVe),PVe=hB.concat([`declare`,`implements`,`private`,`protected`,`public`].map(NVe));function FVe(e={}){let t=e.jsx?e.typescript?mB:MVe:e.typescript?pB:fB,n=e.typescript?wVe.concat(PVe):CVe.concat(hB);return new aIe(t,[fB.data.of({autocomplete:OR(AVe,aze(n))}),fB.data.of({autocomplete:dB}),e.jsx?RVe:[]])}function gB(e){for(;;){if(e.name==`JSXOpenTag`||e.name==`JSXSelfClosingTag`||e.name==`JSXFragmentTag`)return e;if(e.name==`JSXEscape`||!e.parent)return null;e=e.parent}}function IVe(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name==`JSXIdentifier`||r.name==`JSXBuiltin`||r.name==`JSXNamespacedName`||r.name==`JSXMemberExpression`)return e.sliceString(r.from,Math.min(r.to,n));return``}var LVe=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),RVe=vP.inputHandler.of((e,t,n,r,i)=>{if((LVe?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!fB.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=mI(o).resolveInner(t-1,-1),i;if(n.name==`JSXStartTag`&&(n=n.parent),!(o.doc.sliceString(t-1,t)!=r||n.name==`JSXAttributeValue`&&n.to>t)){if(r==`>`&&n.name==`JSXFragmentTag`)return{range:e,changes:{from:t,insert:`</>`}};if(r==`/`&&n.name==`JSXStartCloseTag`){let e=n.parent,r=e.parent;if(r&&e.from==t-2&&((i=IVe(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:RA.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=gB(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=IVe(o.doc,r,t)))return{range:e,changes:{from:t,insert:`</${i}>`}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});function zVe(){let{meta:e}=R();return(0,D.useMemo)(()=>{let t={};for(let n of e.functions??[])for(let e of n.tags??[])t[e]||(t[e]={tag:e,functionCount:0,hasMiddleware:!1,hasPermissions:!1}),t[e].functionCount++;for(let[,n]of Object.entries(e.agentsMeta??{}))for(let e of n.tags??[])t[e]||(t[e]={tag:e,functionCount:0,hasMiddleware:!1,hasPermissions:!1});let n=e.middlewareGroupsMeta?.tagGroups??{};for(let e of Object.keys(n))t[e]||(t[e]={tag:e,functionCount:0,hasMiddleware:!1,hasPermissions:!1}),t[e].hasMiddleware=!0;let r=e.permissionsGroupsMeta?.tagGroups??{};for(let e of Object.keys(r))t[e]||(t[e]={tag:e,functionCount:0,hasMiddleware:!1,hasPermissions:!1}),t[e].hasPermissions=!0;return Object.values(t).sort((e,t)=>e.tag.localeCompare(t.tag))},[e])}function _B(){let e=zVe();return(0,D.useMemo)(()=>e.map(e=>{let t=[];e.functionCount>0&&t.push(`${e.functionCount} func${e.functionCount>1?`s`:``}`),e.hasMiddleware&&t.push(`middleware`),e.hasPermissions&&t.push(`permissions`);let n=t.length>0?` (${t.join(`, `)})`:``;return{value:e.tag,label:`${e.tag}${n}`}}),[e])}const BVe=({functionName:e,sourceFile:t,exportedName:n,onClose:r})=>{let{data:i,isLoading:a}=JAe(t,n,!0),o=aA(),s=_B(),c=oA(),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)([]),[_,v]=(0,D.useState)(!1),[y,b]=(0,D.useState)(!1),[x,S]=(0,D.useState)(!1),[C,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(!1),[O,k]=(0,D.useState)(``),[ee,te]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(i){let e=i.config||{};u(e.title||``),f(e.description||``),m(e.summary||``),g(e.tags||[]),v(e.expose===!0),b(e.remote===!0),S(e.mcp===!0),w(e.readonly===!0),E(e.approvalRequired===!0),k(i.body||``)}},[i]);let ne=async()=>{let e=i?.config||{},a={};l!==(e.title||``)&&(a.title=l||null),d!==(e.description||``)&&(a.description=d||null),p!==(e.summary||``)&&(a.summary=p||null);let s=e.tags||[];if(JSON.stringify(h)!==JSON.stringify(s)&&(a.tags=h.length>0?h:null),_!==(e.expose===!0)&&(a.expose=_||null),y!==(e.remote===!0)&&(a.remote=y||null),x!==(e.mcp===!0)&&(a.mcp=x||null),C!==(e.readonly===!0)&&(a.readonly=C||null),T!==(e.approvalRequired===!0)&&(a.approvalRequired=T||null),Object.keys(a).length===0&&O===(i?.body||``)){r();return}try{Object.keys(a).length>0&&await o.mutateAsync({sourceFile:t,exportedName:n,changes:a}),O!==(i?.body||``)&&await c.mutateAsync({sourceFile:t,exportedName:n,body:O}),te(`Saved and rebuilt successfully`),setTimeout(()=>{te(null),r()},1500)}catch{}};if(a)return null;let re=o.isPending||c.isPending,ie=o.error||c.error;return(0,A.jsxs)(Bh,{gap:`md`,children:[ee&&(0,A.jsx)(If,{color:`green`,icon:(0,A.jsx)(rb,{size:16}),withCloseButton:!0,onClose:()=>te(null),children:ee}),ie&&(0,A.jsx)(If,{color:`red`,icon:(0,A.jsx)(zb,{size:16}),children:ie.message}),(0,A.jsx)(mA,{children:`Metadata`}),(0,A.jsx)(ig,{label:`Title`,value:l,onChange:e=>u(e.currentTarget.value),size:`sm`}),(0,A.jsx)(im,{label:`Description`,value:d,onChange:e=>f(e.currentTarget.value),autosize:!0,minRows:2,maxRows:6,size:`sm`}),(0,A.jsx)(ig,{label:`Summary`,value:p,onChange:e=>m(e.currentTarget.value),size:`sm`}),(0,A.jsx)(Sm,{label:`Tags`,data:s,value:h,onChange:g,searchable:!0,clearable:!0,size:`sm`,placeholder:`Search tags...`}),(0,A.jsx)(mA,{children:`Flags`}),(0,A.jsxs)(Sf,{gap:`lg`,children:[(0,A.jsx)(qh,{label:`expose`,checked:_,onChange:e=>v(e.currentTarget.checked),size:`sm`}),(0,A.jsx)(qh,{label:`remote`,checked:y,onChange:e=>b(e.currentTarget.checked),size:`sm`}),(0,A.jsx)(qh,{label:`mcp`,checked:x,onChange:e=>S(e.currentTarget.checked),size:`sm`}),(0,A.jsx)(qh,{label:`readonly`,checked:C,onChange:e=>w(e.currentTarget.checked),size:`sm`}),(0,A.jsx)(qh,{label:`approvalRequired`,checked:T,onChange:e=>E(e.currentTarget.checked),size:`sm`})]}),i?.body!=null&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mA,{children:`Function Body`}),(0,A.jsx)(FBe,{value:O,onChange:k,extensions:[FVe({typescript:!0})],theme:`dark`,basicSetup:{lineNumbers:!0,foldGutter:!1,highlightActiveLine:!0},style:{fontSize:`13px`,border:`1px solid var(--app-border)`,borderRadius:`4px`,overflow:`hidden`}})]}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:r,disabled:re,leftSection:(0,A.jsx)(Hb,{size:14}),size:`sm`,children:`Cancel`}),(0,A.jsx)(Xf,{onClick:ne,loading:re,leftSection:(0,A.jsx)(jb,{size:14}),size:`sm`,children:`Save & Rebuild`})]})]})},vB=({functionName:e,metadata:t})=>{let{data:n,isLoading:r}=Yk(e),i=t||n||{},[a,o]=(0,D.useState)(!1);if(r&&!t)return(0,A.jsx)(ep,{py:`xl`,children:(0,A.jsx)(mf,{size:`sm`})});let s=!!i.sourceFile&&!!i.exportedName;if(a&&s)return(0,A.jsx)(BVe,{functionName:e,sourceFile:i.sourceFile,exportedName:i.exportedName,onClose:()=>o(!1)});let c=i.services?.services||[],l=i.middleware||[],u=i.permissions||[],d=i.expose===!0,f=i.sessionless!==!0;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(Sf,{gap:`xs`,children:s&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>o(!0),title:`Edit function`,children:(0,A.jsx)(Tb,{size:14})})}),(0,A.jsxs)(Sf,{gap:`xs`,children:[Zx[i.funcWrapper]&&(0,A.jsx)(eS,{type:`funcWrapper`,value:i.funcWrapper}),f&&(0,A.jsx)(eS,{type:`flag`,flag:`auth`}),u.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`}),d&&(0,A.jsx)(eS,{type:`flag`,flag:`exposed`}),i.internal===!0&&(0,A.jsx)(eS,{type:`flag`,flag:`internal`})]}),(0,A.jsx)(vA,{description:i.description,services:c,wires:i.wires,middleware:l,permissions:u,tags:i.tags||[],errors:i.errors||[],functionName:e,inputSchemaName:i.inputSchemaName,outputSchemaName:i.outputSchemaName})]})},VVe=({functionName:e,metadata:t})=>{let{data:n}=Yk(e);return(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Fb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:e})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:(t||n||{}).summary||`No summary`})]})},yB=({functionName:e,metadata:t})=>{let{data:n,isLoading:r}=Yk(e),i=t||n||{};return r&&!t?(0,A.jsx)(ep,{py:`xl`,children:(0,A.jsx)(mf,{size:`sm`})}):i.tests?(0,A.jsx)(UVe,{tests:i.tests,sourceFile:i.sourceFile,exportedName:i.exportedName}):(0,A.jsx)(N,{c:`dimmed`,children:`No test data yet.`})},HVe=({functionName:e,metadata:t})=>(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(VVe,{functionName:e,metadata:t})}),(0,A.jsxs)(rg,{defaultValue:`overview`,children:[(0,A.jsxs)(rg.List,{grow:!0,children:[(0,A.jsx)(rg.Tab,{value:`overview`,children:`Overview`}),(0,A.jsx)(rg.Tab,{value:`tests`,children:`Tests`})]}),(0,A.jsx)(rg.Panel,{value:`overview`,pt:`md`,px:`md`,children:(0,A.jsx)(vB,{functionName:e,metadata:t})}),(0,A.jsx)(rg.Panel,{value:`tests`,pt:`md`,px:`md`,children:(0,A.jsx)(yB,{functionName:e,metadata:t})})]})]});function UVe({tests:e,sourceFile:t,exportedName:n}){let r=Array.isArray(e.missedLines)?e.missedLines:[],{data:i,isLoading:a}=JAe(t,n,!!t&&!!n);return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:`md`,bg:`rgba(255,255,255,0.02)`,children:(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`sm`,wrap:`wrap`,children:[(0,A.jsx)(Jf,{variant:`light`,color:e.status===`covered`?`green`:e.status===`partial`?`yellow`:e.status===`uncovered`?`red`:`gray`,children:e.status===`covered`?`${e.coveredLines}/${e.totalLines}`:`${Math.round((e.ratio??0)*100)}%`}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.scenarios?.length===0?`No linked scenarios yet`:`${e.scenarios?.length??0} linked scenarios`})]}),(0,A.jsx)(ah,{value:(e.ratio??0)*100,color:e.status===`covered`?`green`:e.status===`partial`?`yellow`:e.status===`uncovered`?`red`:`gray`,radius:`xl`})]})}),(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{gap:`sm`,align:`center`,children:[(0,A.jsx)(N,{ff:`monospace`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.12em`,c:`dimmed`,children:`Scenarios`}),(0,A.jsxs)(N,{ff:`monospace`,size:`xs`,c:`dimmed`,children:[e.scenarios?.length??0,` linked`]})]}),!e.scenarios||e.scenarios.length===0?(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:`md`,bg:`rgba(248,113,113,0.08)`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No scenarios are linked to this function yet.`})}):(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:0,bg:`rgba(255,255,255,0.02)`,children:(0,A.jsx)(Bh,{gap:0,children:e.scenarios.map((t,n)=>(0,A.jsxs)(j,{p:`md`,children:[(0,A.jsxs)(Bh,{gap:8,children:[(0,A.jsxs)(Sf,{gap:`xs`,wrap:`wrap`,children:[(0,A.jsx)(Jf,{variant:`light`,color:t.status===`fail`?`red`:`green`,children:t.status===`fail`?`Failing`:`Passing`}),(0,A.jsx)(N,{ff:`monospace`,size:`sm`,fw:600,c:`white`,children:t.scenarioName}),t.duration&&(0,A.jsx)(Jf,{variant:`light`,color:`gray`,children:t.duration})]}),t.featureName&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:t.featureName}),(0,A.jsx)(Bh,{gap:2,pl:8,children:(t.steps??[]).map((e,t)=>(0,A.jsx)(bB,{step:e},t))})]}),n<e.scenarios.length-1&&(0,A.jsx)(kp,{my:`md`,color:`rgba(255,255,255,0.06)`})]},`${t.scenarioName}-${n}`))})})]}),(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{gap:`sm`,align:`center`,children:[(0,A.jsx)(N,{ff:`monospace`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.12em`,c:`dimmed`,children:`Coverage Gaps`}),(0,A.jsx)(N,{ff:`monospace`,size:`xs`,c:`dimmed`,children:r.length===0?`clean`:`${r.length} uncovered`})]}),r.length===0?(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:`md`,bg:`rgba(52,211,153,0.08)`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`All executable lines are covered for this function.`})}):a?(0,A.jsx)(ep,{py:`md`,children:(0,A.jsx)(mf,{size:`sm`})}):i&&typeof i==`object`&&`body`in i&&typeof i.body==`string`&&`bodyStartLine`in i&&typeof i.bodyStartLine==`number`?(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:0,bg:`rgba(255,255,255,0.02)`,style:{overflow:`hidden`},children:(0,A.jsx)(WVe,{body:i.body,bodyStartLine:i.bodyStartLine,missedLines:r})}):(0,A.jsx)(Kd,{withBorder:!0,radius:`lg`,p:`md`,bg:`rgba(255,255,255,0.02)`,children:(0,A.jsx)(Bh,{gap:8,children:r.map(e=>(0,A.jsxs)(Sf,{gap:`sm`,align:`center`,wrap:`nowrap`,style:{borderLeft:`2px solid var(--mantine-color-red-6)`,background:`rgba(248,113,113,0.08)`,borderRadius:8,padding:`8px 10px`},children:[(0,A.jsx)(N,{ff:`monospace`,size:`xs`,c:`dimmed`,w:42,children:e}),(0,A.jsxs)(N,{ff:`monospace`,size:`sm`,c:`white`,children:[`branch on line `,e,` is still not exercised`]})]},e))})})]})]})}function WVe({body:e,bodyStartLine:t,missedLines:n}){let r=new Set(n);return(0,A.jsx)(j,{ff:`monospace`,fz:`sm`,children:e.replace(/\n$/,``).split(`
139
- `).map((e,n)=>{let i=t+n,a=r.has(i);return(0,A.jsxs)(Sf,{gap:0,align:`stretch`,wrap:`nowrap`,style:{borderLeft:a?`2px solid var(--mantine-color-red-6)`:`2px solid transparent`,background:a?`rgba(248,113,113,0.08)`:`transparent`},children:[(0,A.jsx)(N,{ff:`monospace`,size:`xs`,c:`dimmed`,px:`sm`,py:6,style:{width:64,textAlign:`right`,borderRight:`1px solid rgba(255,255,255,0.06)`,userSelect:`none`},children:i}),(0,A.jsx)(N,{ff:`monospace`,size:`sm`,c:`white`,px:`sm`,py:6,style:{whiteSpace:`pre-wrap`,flex:1},children:e||` `})]},i)})})}function bB({step:e}){let t=e.match(/^(Given|When|Then|And)\b/)?.[1]??``,n=t?e.slice(t.length).trimStart():e;return(0,A.jsxs)(N,{ff:`monospace`,size:`sm`,c:`white`,pl:t===`And`?16:0,children:[t&&(0,A.jsx)(N,{component:`span`,inherit:!0,c:`var(--mantine-color-violet-4)`,fw:600,children:t}),t?` ${n}`:e]})}const xB=()=>(0,A.jsx)(N,{c:`dimmed`,size:`sm`,ta:`center`,children:`Not available`});var GVe=({type:e,isHoverable:t,onMouseEnter:n,onMouseLeave:r})=>(0,A.jsx)(eS,{type:`workflowInputType`,value:e,className:t?fx.clickableText:void 0,onMouseEnter:n,onMouseLeave:r}),KVe=e=>{if(e==null)return{type:`$static`,displayValue:(0,A.jsx)(N,{c:`dimmed`,size:`sm`,children:`null`})};if(typeof e==`object`&&e.$template){let t=e.$template,n=[];for(let e=0;e<t.parts.length;e++)if(t.parts[e]&&n.push((0,A.jsx)(N,{span:!0,size:`sm`,ff:`monospace`,children:t.parts[e]},`part-${e}`)),e<t.expressions.length){let r=t.expressions[e];if(typeof r==`object`&&r.$ref){let t=r.$ref===`trigger`?`$trigger`:`$ref`,i=r.path?`.${r.path}`:``;n.push((0,A.jsx)(eS,{type:`label`,color:wme[t]?.color||`gray`,children:r.$ref+i},`expr-${e}`))}else n.push((0,A.jsx)(eS,{type:`label`,color:wme.$expression?.color||`cyan`,children:String(r)},`expr-${e}`))}return{type:`$template`,displayValue:(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:n})}}if(typeof e==`object`&&e.$ref){let t=e.$ref===`trigger`||e.$ref===`$item`,n=e.$ref===`trigger`?`$trigger`:`$ref`,r=e.path?`.${e.path}`:``;return{type:n,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$ref+r}),isHoverable:!t,hoverRef:e.$ref}}return typeof e==`object`&&e.$state?{type:`$state`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$state})}:typeof e==`object`&&e.$expression?{type:`$expression`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$expression})}:typeof e==`object`?{type:`$static`,displayValue:(0,A.jsx)(iA,{code:JSON.stringify(e,null,2),language:`json`})}:{type:`$static`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:String(e)})}};const qVe=({stepId:e})=>{let t=qk(e);return t?.flow||t?.rpcName,(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Options`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.options?(0,A.jsx)(iA,{code:JSON.stringify(t.options,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},JVe=({stepId:e})=>{let t=qk(e),{findNodeByOutputVar:n,setReferencedNode:r}=Gk(),i=t?.input,a=i&&Object.keys(i).length>0,o=e=>{r(e&&n(e)||null)};return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Input Parameters`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:a?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Parameter`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Value`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(i).map(([e,t])=>{let n=KVe(t);return(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(GVe,{type:n.type,isHoverable:n.isHoverable,onMouseEnter:n.isHoverable&&n.hoverRef?()=>o(n.hoverRef):void 0,onMouseLeave:n.isHoverable?()=>o(null):void 0})}),(0,A.jsx)(eg.Td,{children:n.displayValue})]},e)})})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var YVe=e=>e?e.type===`array`&&e.items?`${YVe(e.items)}[]`:e.$ref?e.$ref.replace(`#/definitions/`,``):e.type||`unknown`:`unknown`;const XVe=({stepId:e,showOutputs:t=!1})=>{let n=qk(e),r=n?.outputs,i=n?.outputVar,a=n?.rpcName,o=r&&typeof r==`object`&&Object.keys(r).length>0,{data:s,isLoading:c}=FAe(a);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output Schema`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:c?(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(mf,{size:`sm`})}):s?.properties?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Property`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(s.properties).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e}),s.required?.includes(e)&&(0,A.jsx)(eS,{type:`flag`,flag:`required`})]})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:YVe(t)})})]},e))})]})}):s?(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(ZAe,{schema:s})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output Variable`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:i?(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{ff:`monospace`,children:i}),c&&(0,A.jsx)(mf,{size:`sm`})]}):(0,A.jsx)(xB,{})})})]}),t&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Outputs`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:o?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Output`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Source`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(r).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsxs)(eg.Td,{children:[t?.from&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:t.from}),t.name&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.name}),t.expression&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.expression}),t.path&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`.`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.path})]})]}),!t?.from&&(0,A.jsx)(tp,{children:JSON.stringify(t,null,2)})]})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})]})},ZVe=({stepId:e})=>{let t=qk(e),n=t?.flow;return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:n===`branch`?`Branches`:n===`switch`?`Cases`:n===`parallel`?`Children`:n===`fanout`?`Fanout`:`Flow`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:n===`branch`&&t?.branches?(0,A.jsx)(Bh,{gap:`xs`,children:t.branches.map((e,t)=>(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,mb:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:t===0?`if`:`else if`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.condition?.expression||`true`})]}),e.entry&&(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:e.entry})]})]},t))}):n===`switch`&&t?.cases?(0,A.jsxs)(Bh,{gap:`xs`,children:[t.cases.map((e,t)=>(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,mb:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:`case`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.value})]}),e.entry&&(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:e.entry})]})]},t)),t.defaultEntry&&(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsx)(Sf,{gap:`xs`,mb:`xs`,children:(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`default`})}),(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:t.defaultEntry})]})]})]}):n===`parallel`&&t?.children?(0,A.jsx)(Bh,{gap:`xs`,children:t.children.map((e,t)=>(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e},t))}):n===`fanout`?(0,A.jsxs)(Bh,{gap:`xs`,children:[t?.sourceVar&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Source:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.sourceVar})]}),t?.itemVar&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Item:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.itemVar})]}),t?.mode&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Mode:`}),(0,A.jsx)(eS,{type:`label`,children:t.mode})]}),t?.childEntry&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Child Entry:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.childEntry})]})]}):(0,A.jsx)(xB,{})})})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Next Step`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.next?(0,A.jsx)(N,{ff:`monospace`,children:t.next}):(0,A.jsx)(xB,{})})})]})]})};var SB=e=>e?new Date(e).toLocaleString():`—`,CB=(e,t)=>{if(!e||!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`};const wB=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);if(!t)return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(gA,{children:`Execution`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]});let n=t.succeededAt||t.failedAt,r=CB(t.runningAt||t.createdAt,n);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(gA,{children:`Execution`}),(0,A.jsx)(eS,{type:`status`,value:t.status,variant:`filled`})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Timing`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsx)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:(0,A.jsxs)(eg.Tbody,{children:[(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Created`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.createdAt)})})]}),t.runningAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Started`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.runningAt)})})]}),t.succeededAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Succeeded`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.succeededAt)})})]}),t.failedAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Failed`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.failedAt)})})]}),r&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Duration`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:r})})]}),(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Attempts`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.attemptCount})})]})]})})})})]})]})},QVe=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Input Data`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.data?(0,A.jsx)(iA,{code:JSON.stringify(t.data,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},$Ve=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Output Data`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.result?(0,A.jsx)(iA,{code:JSON.stringify(t.result,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},TB=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return t?.error?(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(gA,{children:`Error`}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Message`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`red`,children:typeof t.error.message==`string`?t.error.message:JSON.stringify(t.error.message,null,2)})})})]}),t.error.code&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Code`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(eS,{type:`label`,color:`red`,children:t.error.code})})})]}),t.error.stack&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Stack Trace`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(iA,{code:t.error.stack,language:`text`})})})]})]}):(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Error`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})},EB=({stepId:e})=>{let{data:t}=Hk(Wk()?.selectedRunId??null),n=D.useMemo(()=>!t||!Array.isArray(t)?[]:t.filter(t=>t.stepName===e),[t,e]);return n.length<=1?(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Retry History`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{c:`dimmed`,size:`sm`,ta:`center`,children:`No retries`})})})]}):(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(gA,{children:`Retry History`}),(0,A.jsxs)(eS,{type:`label`,children:[n.length,` attempts`]})]}),(0,A.jsx)(sg,{active:n.length-1,bulletSize:24,lineWidth:2,children:n.map((e,t)=>{let n=e.status===`succeeded`?(0,A.jsx)(rb,{size:14}):e.status===`failed`?(0,A.jsx)(zb,{size:14}):e.status===`running`?(0,A.jsx)(Eb,{size:14}):(0,A.jsx)(ab,{size:14});return(0,A.jsxs)(sg.Item,{bullet:n,color:Eme[e.status]?.color||`gray`,title:`Attempt ${e.attemptCount}`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`status`,value:e.status}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:SB(e.createdAt)})]}),e.error&&(0,A.jsx)(N,{size:`sm`,c:`red`,mt:4,children:typeof e.error.message==`string`?e.error.message:JSON.stringify(e.error.message,null,2)})]},t)})})]})};var DB={http:`/apis?tab=http`,channel:`/apis?tab=channels`,mcp:`/apis?tab=mcp`,cli:`/apis?tab=cli`,rpc:`/apis?tab=http`,scheduler:`/jobs?tab=schedulers`,queue:`/jobs?tab=queues`,trigger:`/jobs?tab=triggers`,triggerSource:`/jobs?tab=triggers`,agent:`/apis/agents`};const eHe=({workflowId:e})=>{let{workflow:t}=Gk();return(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(db,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e}),t?.graphHash&&(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:[`#`,t.graphHash]})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t?.summary||`No summary`})]})};var tHe=({wiredTo:e})=>{let t=Hy();return e.transports.length===0&&e.jobs.length===0?null:(0,A.jsxs)(Bh,{gap:`sm`,children:[e.transports.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wired To`}),(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:e.transports.map(e=>(0,A.jsx)(Lf,{component:t,to:DB[e.type]||`#`,underline:`never`,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(e.type),className:fx.clickableText,children:e.name})},e.id))})]}),e.jobs.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Jobs`}),(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:e.jobs.map(e=>(0,A.jsx)(Lf,{component:t,to:DB[e.type]||`#`,underline:`never`,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(e.type),className:fx.clickableText,children:e.name})},e.id))})]})]})};const nHe=({workflowId:e})=>{let{workflow:t}=Gk(),n=t?.middleware||[],r=t?.permissions||[],i=t?.tags||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[r.length>0&&(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})}),t?.wiredTo&&(0,A.jsx)(tHe,{wiredTo:t.wiredTo}),t?.pikkuFuncId&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Handler Function`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.pikkuFuncId})]}),(0,A.jsx)(vA,{description:t?.description,middleware:n,permissions:r,tags:i})]})},OB=({workflowId:e})=>{let{workflow:t,setFocusedNode:n}=Gk(),r=t?.nodes,i=r&&Object.keys(r).length>0;return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Nodes`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:i?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,highlightOnHover:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(r).map(([e,t])=>(0,A.jsxs)(eg.Tr,{onMouseEnter:()=>n(e),onMouseLeave:()=>n(null),children:[(0,A.jsxs)(eg.Td,{children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:t.stepName||e}),t.stepName&&t.stepName!==e&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e})]}),(0,A.jsxs)(eg.Td,{children:[t.flow&&(0,A.jsx)(eS,{type:`label`,children:t.flow}),t.rpcName&&(0,A.jsx)(eS,{type:`label`,color:`green`,children:`RPC`})]})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var kB=({workflowId:e})=>{let{workflow:t,setFocusedNode:n}=Gk(),r=Wk(),{openWorkflowStep:i}=_x(),a=t?.nodes,o=r?.stepStates,s=a?Object.entries(a).filter(([e])=>o?.has(e)):[];return s.length===0?null:(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Nodes`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,highlightOnHover:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Status`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Runs`})]})}),(0,A.jsx)(eg.Tbody,{children:s.map(([e,t])=>{let r=o.get(e);return(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onMouseEnter:()=>n(e),onMouseLeave:()=>n(null),onClick:()=>i(e,t.flow||`rpc`),children:[(0,A.jsxs)(eg.Td,{children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:t.stepName||e}),t.stepName&&t.stepName!==e&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e})]}),(0,A.jsxs)(eg.Td,{children:[t.flow&&(0,A.jsx)(eS,{type:`label`,children:t.flow}),t.rpcName&&(0,A.jsx)(eS,{type:`label`,color:`green`,children:t.rpcName})]}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(eS,{type:`status`,value:r.status})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:r.attemptCount})})]},e)})})]})})})]})};const rHe=({workflowId:e})=>{let{workflow:t}=Gk(),n=t?.context,r=n&&Object.keys(n).length>0;return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`State Variables`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:r?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Variable`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Default`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(n).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(eS,{type:`label`,children:t.type||`unknown`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:t.default===void 0?`—`:String(t.default)})})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var iHe=e=>e?new Date(e).toLocaleString():`—`,aHe=(e,t)=>{if(!e||!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`},oHe=({input:e})=>{let{schema:t}=LAe();return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Input`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t&&e&&typeof e==`object`?(0,A.jsx)(Vk,{schema:t,initialData:e,readOnly:!0}):(0,A.jsx)(iA,{code:JSON.stringify(e,null,2),language:`json`})})})]})};const sHe=({workflowId:e})=>{let t=Wk()?.runData;if(!t)return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Run`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]});let n=t.status===`completed`||t.status===`failed`||t.status===`cancelled`?t.updatedAt:void 0,r=aHe(t.createdAt,n);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(mA,{children:`Run`}),(0,A.jsx)(eS,{type:`status`,value:t.status,variant:`filled`})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Details`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsx)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:(0,A.jsxs)(eg.Tbody,{children:[(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Run ID`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.id})})]}),(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Started`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:iHe(t.createdAt)})})]}),n&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Ended`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:iHe(n)})})]}),r&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Duration`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:r})})]}),t.wire&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Wire`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(t.wire.type),children:t.wire.type}),t.wire.id&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.wire.id})]})})]}),t.graphHash&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Graph Hash`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.graphHash})})]})]})})})})]}),(0,A.jsx)(kB,{workflowId:e}),t.input&&(0,A.jsx)(oHe,{input:t.input}),t.output&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(iA,{code:JSON.stringify(t.output,null,2),language:`json`})})})]}),t.error&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Error`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`red`,children:typeof t.error.message==`string`?t.error.message:JSON.stringify(t.error.message??t.error,null,2)})})})]})]})};var cHe=u(s(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.locale,m=p===void 0?null:p,h=r.logicalAndDayFields,g={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,locale:m,logicalAndDayFields:h===void 0?!1:h};return g.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,g).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;return n&&(l=`:${(`00`+n).substring(n.length)}`),`${c?s:``}${(`00`+a.toString()).substring(a.toString().length)}:${(`00`+o.toString()).substring(o.toString().length)}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())}))(),1);const lHe=({pikkuFuncId:e,label:t})=>{let{data:n}=Yk(e??``),{navigateInPanel:r}=_x();if(!e)return null;let i=n?.name||e;return(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:t||`Handler Function`}),(0,A.jsx)(Sf,{gap:6,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,leftSection:(0,A.jsx)(gb,{size:10}),style:{cursor:`pointer`},onClick:()=>r(`function`,e,i,n),children:i})})]})},uHe=({wireId:e,metadata:t={}})=>{let n=t?.method?.toUpperCase()||`GET`,r=t?.route||e,i=t?.middleware||[],a=t?.permissions||[],o=t?.auth!==!1;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(pb,{size:20}),(0,A.jsx)(eS,{type:`httpMethod`,value:n,variant:`filled`}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:r})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[o&&(0,A.jsx)(eS,{type:`flag`,flag:`auth`}),a.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`}),t?.sse&&(0,A.jsx)(eS,{type:`flag`,flag:`sse`})]}),(t?.params&&t.params.length>0||t?.query&&t.query.length>0)&&(0,A.jsxs)(Sf,{gap:`xs`,children:[t?.params?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`param`,value:`:${e}`},`p-${e}`)),t?.query?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`query`,value:`?${e}`},`q-${e}`))]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:i,permissions:a,tags:t?.tags||[],errors:t?.errors||[],inputSchemaName:t?.inputSchemaName,outputSchemaName:t?.outputSchemaName})]})},dHe=({wireId:e,metadata:t={}})=>{let{navigateInPanel:n}=_x(),r=t?.middleware||[],i=t?.permissions||[],a=t?.channelMiddleware||[],o=t?.auth!==!1,s=t?.messageWirings;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(kb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.route&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.route}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`channel`}),o&&(0,A.jsx)(eS,{type:`flag`,flag:`auth`}),i.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(t?.params&&t.params.length>0||t?.query&&t.query.length>0)&&(0,A.jsxs)(Sf,{gap:`xs`,children:[t?.params?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`param`,value:`:${e}`},`p-${e}`)),t?.query?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`query`,value:`?${e}`},`q-${e}`))]}),(0,A.jsxs)(vA,{description:t?.description,middleware:r,permissions:i,tags:t?.tags||[],errors:t?.errors||[],children:[t?.input&&(0,A.jsx)(_A,{label:`Input Schema`,schemaName:t.input}),(0,A.jsx)(lHe,{pikkuFuncId:t?.connect?.pikkuFuncId,label:`Connect Handler`}),(0,A.jsx)(lHe,{pikkuFuncId:t?.disconnect?.pikkuFuncId,label:`Disconnect Handler`}),(0,A.jsx)(lHe,{pikkuFuncId:t?.message?.pikkuFuncId,label:`Message Handler`}),a.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Channel Middleware`}),(0,A.jsx)(Sf,{gap:6,children:a.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),s&&Object.keys(s).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Message Wirings`}),(0,A.jsx)(Bh,{gap:`sm`,children:Object.entries(s).map(([e,t])=>(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:600,mb:4,children:e}),(0,A.jsx)(Sf,{gap:6,children:Object.entries(t).map(([e,t])=>(0,A.jsx)(eS,{type:`dynamic`,badge:`actions`,value:e,className:t?.pikkuFuncId?fx.clickableText:void 0,onClick:t?.pikkuFuncId?()=>n(`function`,t.pikkuFuncId,e,t):void 0},e))})]},e))})]})]})]})},fHe=({wireId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Fb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:e})]})}),(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`wiringType`,value:`rpc`})}),(0,A.jsx)(vA,{pikkuFuncId:t?.pikkuFuncId})]}),AB=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(ab,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`scheduler`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),t?.schedule&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Schedule`}),(0,A.jsx)(N,{size:`sm`,children:cHe.default.toString(t.schedule)}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,mt:2,children:t.schedule})]}),t?.timezone&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Timezone`}),(0,A.jsx)(N,{size:`sm`,children:t.timezone})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[]})]})},pHe=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[],i=t?.config;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(vb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`queue`}),t?.concurrency!==void 0&&(0,A.jsx)(eS,{type:`dynamic`,badge:`concurrency`,value:t.concurrency,variant:`outline`,color:`gray`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[],children:i&&Object.keys(i).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Config`}),(0,A.jsx)(Sf,{gap:6,children:Object.entries(i).map(([e,t])=>(0,A.jsxs)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,children:[e,`: `,String(t)]},e))})]})})]})};var jB=({options:e})=>{let t=Object.entries(e);return t.length===0?null:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Option`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Description`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Default`})]})}),(0,A.jsx)(eg.Tbody,{children:t.map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,children:[`--`,e,t.short?`, -${t.short}`:``]})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,children:t.description||``})}),(0,A.jsx)(eg.Td,{children:t.required?(0,A.jsx)(eS,{type:`flag`,flag:`required`}):t.default===void 0?(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`-`}):(0,A.jsx)(tp,{children:String(t.default)})})]},e))})]})},MB=({commands:e,depth:t=0})=>{let{navigateInPanel:n}=_x();return(0,A.jsx)(Bh,{gap:`xs`,children:Object.entries(e).map(([e,r])=>(0,A.jsxs)(j,{ml:t*16,children:[(0,A.jsxs)(Sf,{gap:6,mb:4,children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:600,children:e}),r.isDefault&&(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`light`,color:`gray`,children:`default`}),r.pikkuFuncId&&(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,className:fx.clickableText,onClick:()=>n(`function`,r.pikkuFuncId,r.pikkuFuncId,r),children:r.pikkuFuncId})]}),r.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mb:4,children:r.description}),r.positionals&&r.positionals.length>0&&(0,A.jsx)(Sf,{gap:6,mb:4,children:r.positionals.map(e=>(0,A.jsxs)(eS,{type:`label`,size:`sm`,variant:`outline`,color:e.required?`red`:`gray`,children:[e.variadic?`...${e.name}`:e.name,e.required?`*`:``]},e.name))}),r.options&&Object.keys(r.options).length>0&&(0,A.jsx)(jB,{options:r.options}),r.subcommands&&Object.keys(r.subcommands).length>0&&(0,A.jsx)(MB,{commands:r.subcommands,depth:t+1})]},e))})};const mHe=({wireId:e,metadata:t={}})=>{let n=t?.program||e,r=t?.commands,i=t?.options;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ib,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:n})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`cli`}),t?.defaultRenderName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`format`,value:t.defaultRenderName})]}),(0,A.jsxs)(vA,{description:t?.description,children:[i&&Object.keys(i).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Global Options`}),(0,A.jsx)(jB,{options:i})]}),r&&Object.keys(r).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Commands`}),(0,A.jsx)(MB,{commands:r})]})]})]})},hHe=({wireId:e,metadata:t={}})=>{let n=t?.method||`unknown`,r=t?.middleware||[],i=t?.permissions||[],a=t?.arguments;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(lb,{size:20}),(0,A.jsx)(eS,{type:`mcpType`,value:n,variant:`filled`}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),t?.uri&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`URI`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.uri})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:r,permissions:i,tags:t?.tags||[],errors:t?.errors||[],inputSchemaName:t?.inputSchemaName,outputSchemaName:t?.outputSchemaName,children:a&&a.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Arguments`}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Description`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Required`})]})}),(0,A.jsx)(eg.Tbody,{children:a.map(e=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.name})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,children:e.description||``})}),(0,A.jsx)(eg.Td,{children:e.required&&(0,A.jsx)(eS,{type:`flag`,flag:`required`})})]},e.name))})]})]})})]})},gHe=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ub,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`trigger`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[]})]})},_He=({wireId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ub,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`triggerSource`}),t?.packageName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.packageName})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId})]});var vHe=({defId:e,def:t})=>{let{meta:n}=R(),r=n.middlewareGroupsMeta?.instances||{},i=n.middlewareGroupsMeta?.httpGroups||{},a=n.middlewareGroupsMeta?.tagGroups||{},o=Object.entries(r).filter(([,t])=>t.definitionId===e),s=new Set(o.map(([e])=>e)),c=[];for(let[e,t]of Object.entries(i))t.instanceIds?.some(e=>s.has(e))&&c.push({type:`http`,key:e,group:t});for(let[e,t]of Object.entries(a))t.instanceIds?.some(e=>s.has(e))&&c.push({type:`tag`,key:e,group:t});return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(hb,{size:20}),(0,A.jsx)(N,{size:`lg`,fw:600,children:t.name||t.exportedName||e})]}),t.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsxs)(Sf,{gap:4,children:[t.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`}),t.exportedName===null&&(0,A.jsx)(eS,{type:`flag`,flag:`local`}),t.exportedName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`exportedName`,value:t.exportedName}),t.package&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.package})]}),t.services?.services?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Services`}),(0,A.jsx)(Sf,{gap:4,children:t.services.services.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`service`,value:e},e))})]}),t.wires&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wires`}),t.wires.wires?.length>0?(0,A.jsxs)(Sf,{gap:4,children:[t.wires.wires.some(e=>[`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e))&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),t.wires.wires.filter(e=>![`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e)).map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e))]}):(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`None`})]}),o.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kp,{}),(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Instances (`,o.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`ID`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:o.map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:e}),(0,A.jsx)(eg.Td,{children:t.isFactoryCall&&(0,A.jsx)(eS,{type:`flag`,flag:`factoryCall`})})]},e))})]})]})]}),c.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Used in Groups`}),(0,A.jsx)(Sf,{gap:4,children:c.map(e=>(0,A.jsx)(eS,{type:`label`,color:e.type===`http`?`blue`:`green`,leftSection:(0,A.jsx)(hb,{size:10}),children:e.type===`http`?`HTTP ${e.key}`:`Tag: ${e.key}`},`${e.type}::${e.key}`))})]})]})},yHe=({groupType:e,groupKey:t})=>{let{meta:n}=R(),{openMiddleware:r}=_x(),i=(e===`http`?n.middlewareGroupsMeta?.httpGroups||{}:n.middlewareGroupsMeta?.tagGroups||{})[t],a=n.middlewareGroupsMeta?.instances||{},o=n.middlewareGroupsMeta?.definitions||{},s=[],c=new Set;for(let e of i?.instanceIds||[]){let t=a[e];t?.definitionId&&!c.has(t.definitionId)&&(c.add(t.definitionId),s.push({defId:t.definitionId,def:o[t.definitionId],instanceId:e,instance:t}))}return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsx)(eS,{type:`label`,color:e===`http`?`blue`:`green`,children:e===`http`?`HTTP ${t}`:`Tag: ${t}`})}),i?.exportName&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Export`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:i.exportName})]}),s.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Middleware (`,s.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`Definition`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:s.map(({defId:e,def:t,instance:n})=>(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onClick:()=>r(e,{...t,_id:e}),children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:t?.name||t?.exportedName||e}),(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:4,children:[n?.isFactoryCall&&(0,A.jsx)(eS,{type:`flag`,flag:`factoryCall`}),t?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})]})})]},e))})]})]})]})};const NB=({middlewareId:e,metadata:t={}})=>t._groupType?(0,A.jsx)(yHe,{groupType:t._groupType,groupKey:t._groupKey}):(0,A.jsx)(vHe,{defId:t._id||e,def:t});var PB=({defId:e,def:t})=>{let{meta:n}=R(),r=n.permissionsGroupsMeta?.httpGroups||{},i=n.permissionsGroupsMeta?.tagGroups||{},a=[];for(let[t,n]of Object.entries(r))n.instanceIds?.includes(e)&&a.push({type:`http`,key:t,group:n});for(let[t,n]of Object.entries(i))n.instanceIds?.includes(e)&&a.push({type:`tag`,key:t,group:n});return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Pb,{size:20}),(0,A.jsx)(N,{size:`lg`,fw:600,children:t.name||t.exportedName||e})]}),t.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsxs)(Sf,{gap:4,children:[t.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`}),t.exportedName===null&&(0,A.jsx)(eS,{type:`flag`,flag:`local`}),t.exportedName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`exportedName`,value:t.exportedName}),t.package&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.package})]}),t.services?.services?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Services`}),(0,A.jsx)(Sf,{gap:4,children:t.services.services.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`service`,value:e},e))})]}),t.wires&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wires`}),t.wires.wires?.length>0?(0,A.jsxs)(Sf,{gap:4,children:[t.wires.wires.some(e=>[`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e))&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),t.wires.wires.filter(e=>![`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e)).map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e))]}):(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`None`})]}),a.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kp,{}),(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Used in Groups`}),(0,A.jsx)(Sf,{gap:4,children:a.map(e=>(0,A.jsx)(eS,{type:`label`,color:e.type===`http`?`blue`:`green`,leftSection:(0,A.jsx)(hb,{size:10}),children:e.type===`http`?`HTTP ${e.key}`:`Tag: ${e.key}`},`${e.type}::${e.key}`))})]})]})]})},FB=({groupType:e,groupKey:t})=>{let{meta:n}=R(),{openPermission:r}=_x(),i=(e===`http`?n.permissionsGroupsMeta?.httpGroups||{}:n.permissionsGroupsMeta?.tagGroups||{})[t],a=n.permissionsGroupsMeta?.definitions||{},o=[],s=new Set;for(let e of i?.instanceIds||[])!s.has(e)&&a[e]&&(s.add(e),o.push({defId:e,def:a[e]}));return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsx)(eS,{type:`label`,color:e===`http`?`blue`:`green`,children:e===`http`?`HTTP ${t}`:`Tag: ${t}`})}),i?.exportName&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Export`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:i.exportName})]}),o.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Permissions (`,o.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`Definition`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:o.map(({defId:e,def:t})=>(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onClick:()=>r(e,{...t,_id:e}),children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:t?.name||t?.exportedName||e}),(0,A.jsx)(eg.Td,{children:t?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})})]},e))})]})]})]})};const bHe=({permissionId:e,metadata:t={}})=>t._groupType?(0,A.jsx)(FB,{groupType:t._groupType,groupKey:t._groupKey}):(0,A.jsx)(PB,{defId:t._id||e,def:t});function xHe(e,t=!0){let n=By();return Rr({queryKey:[`agent-threads`,e],queryFn:async()=>await n.invoke(`console:getAgentThreads`,{agentName:e,limit:50,offset:0}),enabled:!!e,refetchInterval:t?5e3:!1})}function SHe(e,t=!0){let n=By();return Rr({queryKey:[`agent-thread-messages`,e],queryFn:async()=>await n.invoke(`console:getAgentThreadMessages`,{threadId:e}),enabled:!!e,refetchInterval:t?5e3:!1})}function IB(){let e=By(),t=Dr();return zr({mutationFn:async t=>await e.invoke(`console:deleteAgentThread`,{threadId:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`agent-threads`]})}})}const CHe=(0,D.createContext)(void 0),wHe=()=>{let e=(0,D.useContext)(CHe);if(!e)throw Error(`useAgentPlayground must be used within AgentPlaygroundProvider`);return e};var THe=e=>({id:e.id,status:`completed`,createdAt:e.createdAt,label:e.title||e.id.slice(0,8)});const LB=({children:e,agentId:t})=>{let[n,r]=Gy(),[i,a]=(0,D.useState)(n.get(`threadId`)),[o,s]=(0,D.useState)(),[c,l]=(0,D.useState)(),{data:u,refetch:d}=xHe(t),{data:f}=SHe(i),p=(u||[]).map(THe),m=(0,D.useCallback)(e=>{a(e),r(t=>{let n=new URLSearchParams(t);return e?n.set(`threadId`,e):n.delete(`threadId`),n},{replace:!0})},[r]);(0,D.useEffect)(()=>{let e=n.get(`threadId`);e!==i&&a(e)},[n]);let h=(0,D.useCallback)(()=>{m(crypto.randomUUID())},[m]);return(0,A.jsx)(CHe.Provider,{value:{agentId:t,threadId:i,setThreadId:m,threads:p,createNewThread:h,refetchThreads:()=>{d()},dbMessages:f,model:o,setModel:s,temperature:c,setTemperature:l},children:e})};function RB(){let e=By();return Rr({queryKey:[`addon-functions`],queryFn:async()=>{let t=await e.invoke(`console:getInstalledAddons`),n=[];return await Promise.all(t.filter(e=>e.namespace!==`console`).map(async t=>{try{let r=(await e.invoke(`console:getAddonInstalledPackage`,{packageName:t.packageName}))?.functions||{};for(let e of Object.keys(r))n.push({namespace:t.namespace,funcId:`${t.namespace}:${e}`})}catch{}})),n}})}const EHe=({wireId:e,sourceFile:t,exportedName:n,metadata:r,onClose:i})=>{let{data:a,isLoading:o}=sA(t,n,!0),s=cA(),{meta:c}=R(),{data:l}=RB(),u=_B(),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)(``),[_,v]=(0,D.useState)(``),[y,b]=(0,D.useState)(null),[x,S]=(0,D.useState)(``),[C,w]=(0,D.useState)(``),[T,E]=(0,D.useState)(null),[O,k]=(0,D.useState)([]),[ee,te]=(0,D.useState)([]),[ne,re]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(a){let e=a.config||{};f(e.description||``),m(e.role||``),g(e.personality||``),v(e.goal||``),b(e.model||null),S(typeof e.maxSteps==`number`?e.maxSteps:``),w(typeof e.temperature==`number`?e.temperature:``),E(e.toolChoice||null),k(r?.tools||[]),te(r?.tags||[])}},[a]);let ie=async()=>{let e=a?.config||{},o={};d!==(e.description||``)&&(o.description=d||null),p!==(e.role||``)&&(o.role=p||null),h!==(e.personality||``)&&(o.personality=h||null),_!==(e.goal||``)&&(o.goal=_||null),y!==(e.model||null)&&(o.model=y||void 0),x!==(typeof e.maxSteps==`number`?e.maxSteps:``)&&(o.maxSteps=typeof x==`number`?x:null),C!==(typeof e.temperature==`number`?e.temperature:``)&&(o.temperature=typeof C==`number`?C:null),T!==(e.toolChoice||null)&&(o.toolChoice=T||null);let c=r?.tools||[];JSON.stringify(O)!==JSON.stringify(c)&&(o.tools=O.length>0?O:null);let l=r?.tags||[];if(JSON.stringify(ee)!==JSON.stringify(l)&&(o.tags=ee.length>0?ee:null),Object.keys(o).length===0){i();return}try{await s.mutateAsync({sourceFile:t,exportedName:n,changes:o}),re(`Saved and rebuilt successfully`),setTimeout(()=>{re(null),i()},1500)}catch{}};if(o)return null;let ae=c.functions??[],oe={};for(let e of ae){if(e.functionType!==`user`)continue;let t=e.pikkuFuncId;oe.Local||=[],oe.Local.push(t)}for(let e of l??[])oe[e.namespace]||(oe[e.namespace]=[]),oe[e.namespace].push(e.funcId);let se=Object.entries(oe).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({group:e,items:t.sort()}));return(0,A.jsxs)(Bh,{gap:`md`,children:[ne&&(0,A.jsx)(If,{color:`green`,icon:(0,A.jsx)(rb,{size:16}),withCloseButton:!0,onClose:()=>re(null),children:ne}),s.error&&(0,A.jsx)(If,{color:`red`,icon:(0,A.jsx)(zb,{size:16}),children:s.error.message}),(0,A.jsx)(mA,{children:`Configuration`}),(0,A.jsx)(im,{label:`Description`,value:d,onChange:e=>f(e.currentTarget.value),autosize:!0,minRows:2,maxRows:4,size:`xs`}),(0,A.jsx)(ig,{label:`Model`,description:`Provider-qualified, e.g. openai/gpt-4o`,placeholder:`provider/model`,value:y??``,onChange:e=>b(e.currentTarget.value||null),size:`xs`}),(0,A.jsxs)(Sf,{grow:!0,gap:`xs`,wrap:`wrap`,children:[(0,A.jsx)(rh,{label:`Max Steps`,style:{minWidth:100},value:x,onChange:e=>S(typeof e==`number`?e:``),min:1,max:100,size:`xs`}),(0,A.jsx)(rh,{label:`Temperature`,style:{minWidth:100},value:C,onChange:e=>w(typeof e==`number`?e:``),min:0,max:2,step:.1,decimalScale:1,size:`xs`}),(0,A.jsx)(Th,{label:`Tool Choice`,style:{minWidth:120},data:[`auto`,`required`,`none`],value:T,onChange:E,clearable:!0,size:`xs`})]}),(0,A.jsx)(Sm,{label:`Tools`,data:se,value:O,onChange:k,searchable:!0,clearable:!0,size:`xs`,placeholder:`Search functions...`}),(0,A.jsx)(Sm,{label:`Tags`,data:u,value:ee,onChange:te,searchable:!0,clearable:!0,size:`xs`,placeholder:`Search tags...`}),(0,A.jsx)(mA,{children:`Role`}),(0,A.jsx)(im,{value:p,onChange:e=>m(e.currentTarget.value),placeholder:`Who the agent is -- role, expertise, domain context`,autosize:!0,minRows:2,maxRows:6,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsx)(mA,{children:`Personality`}),(0,A.jsx)(im,{value:h,onChange:e=>g(e.currentTarget.value),placeholder:`Defines how the agent behaves -- tone, style, constraints`,autosize:!0,minRows:3,maxRows:10,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsx)(mA,{children:`Goal`}),(0,A.jsx)(im,{value:_,onChange:e=>v(e.currentTarget.value),placeholder:`Defines what the agent is trying to accomplish`,autosize:!0,minRows:3,maxRows:10,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:i,disabled:s.isPending,leftSection:(0,A.jsx)(Hb,{size:14}),size:`xs`,children:`Cancel`}),(0,A.jsx)(Xf,{onClick:ie,loading:s.isPending,leftSection:(0,A.jsx)(jb,{size:14}),size:`xs`,children:`Save & Rebuild`})]})]})};var DHe=(0,D.createContext)(!0);function zB(){return(0,D.useContext)(DHe)}const OHe=({wireId:e,metadata:t={}})=>{let{navigateInPanel:n}=_x(),r=(0,D.useContext)(CHe),i=zB(),[a,o]=(0,D.useState)(!1),s=i&&!!t?.sourceFile&&!!t?.exportedName;if(a&&s)return(0,A.jsx)(EHe,{wireId:e,sourceFile:t.sourceFile,exportedName:t.exportedName,metadata:t,onClose:()=>o(!1)});let c=t?.middleware||[],l=t?.channelMiddleware||[],u=t?.aiMiddleware||[],d=t?.permissions||[],f=t?.tools||[],p=t?.agents||[],m=t?.memory;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Qy,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e}),t?.model&&(0,A.jsx)(eS,{type:`dynamic`,badge:`model`,value:t.model})]}),s&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>o(!0),title:`Edit agent`,children:(0,A.jsx)(Tb,{size:14})})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`agent`}),t?.maxSteps&&(0,A.jsx)(eS,{type:`dynamic`,badge:`maxSteps`,value:t.maxSteps,variant:`outline`,color:`gray`}),t?.toolChoice&&(0,A.jsx)(eS,{type:`dynamic`,badge:`toolChoice`,value:t.toolChoice,variant:`outline`,color:`gray`}),d.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),r&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Playground Overrides`}),(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(ig,{size:`xs`,label:`Model${t?.model?` (default: ${t.model})`:``}`,placeholder:t?.model??`provider/model`,value:r.model??``,onChange:e=>r.setModel(e.currentTarget.value||void 0)}),(0,A.jsx)(rh,{size:`xs`,label:`Temperature${t?.temperature==null?``:` (default: ${t.temperature})`}`,placeholder:t?.temperature==null?`default`:String(t.temperature),value:r.temperature??``,onChange:e=>r.setTemperature(typeof e==`number`?e:void 0),min:0,max:2,step:.1,decimalScale:1})]})]}),(0,A.jsxs)(vA,{description:t?.description,middleware:c,permissions:d,tags:t?.tags,children:[t?.role&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Role`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.role})]}),t?.personality&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Personality`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.personality})]}),t?.goal&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Goal`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.goal})]}),f.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Tools (`,f.length,`)`]}),(0,A.jsx)(Sf,{gap:6,children:f.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`tool`,value:e,className:fx.clickableText,onClick:()=>n(`function`,e,e)},e))})]}),p.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Sub-Agents (`,p.length,`)`]}),(0,A.jsx)(Sf,{gap:6,children:p.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`agent`,value:e,className:fx.clickableText,onClick:()=>n(`agent`,e,e)},e))})]}),l.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Channel Middleware`}),(0,A.jsx)(Sf,{gap:6,children:l.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),u.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`AI Middleware`}),(0,A.jsx)(Sf,{gap:6,children:u.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),m&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Memory`}),(0,A.jsxs)(Sf,{gap:6,children:[m.storage&&(0,A.jsx)(eS,{type:`dynamic`,badge:`storage`,value:m.storage,variant:`outline`,color:`gray`}),m.lastMessages!==void 0&&(0,A.jsx)(eS,{type:`dynamic`,badge:`lastMessages`,value:m.lastMessages,variant:`outline`,color:`gray`})]})]}),(0,A.jsx)(_A,{label:`Input Schema`,schemaName:t?.inputSchema}),(0,A.jsx)(_A,{label:`Output Schema`,schemaName:t?.outputSchema}),(0,A.jsx)(_A,{label:`Working Memory Schema`,schemaName:t?.workingMemorySchema})]})]})};function kHe(e,t){let n=By();return Rr({queryKey:[`secret-value`,e],queryFn:async()=>await n.invoke(`pikkuConsoleGetSecret`,{secretId:e}),enabled:!!e&&t})}function AHe(){let e=By(),t=Dr();return zr({mutationFn:({secretId:t,value:n})=>e.invoke(`pikkuConsoleSetSecret`,{secretId:t,value:n}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`secret-value`,n.secretId]})}})}function jHe(e,t){let n=By();return Rr({queryKey:[`oauth-status`,e],queryFn:async()=>await n.invoke(`console:oauthStatus`,{credentialName:e}),enabled:!!e&&t})}function MHe(){let e=By();return zr({mutationFn:({credentialName:t,callbackUrl:n})=>e.invoke(`console:oauthConnect`,{credentialName:t,callbackUrl:n})})}function BB(){let e=By(),t=Dr();return zr({mutationFn:({credentialName:t})=>e.invoke(`console:oauthDisconnect`,{credentialName:t}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`oauth-status`,n.credentialName]})}})}function VB(){let e=By();return zr({mutationFn:({credentialName:t})=>e.invoke(`console:oauthTestToken`,{credentialName:t})})}var HB={type:`object`,properties:{clientId:{type:`string`,title:`Client ID`},clientSecret:{type:`string`,title:`Client Secret`}},required:[`clientId`]};const UB=({secretId:e,schemaName:t,isOAuth2:n})=>{let r=zB(),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(!1),[c,l]=(0,D.useState)(`form`),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(null),[m,h]=(0,D.useState)(null),{data:g,isLoading:_}=kHe(e,i),{data:v}=Zk(t),y=AHe(),b=v||(n?HB:void 0),x=!!b,S=g?.exists?g.value:null;if((0,D.useEffect)(()=>{g&&d(S==null?``:JSON.stringify(S,null,2))},[g,S]),!e)return null;let C=e=>{h(e),setTimeout(()=>h(null),3e3)},w=t=>{y.mutate({secretId:e,value:t},{onSuccess:()=>{C(`Secret saved successfully`),s(!1)}})},T=()=>{p(null);let t;try{t=JSON.parse(u)}catch{p(`Invalid JSON`);return}y.mutate({secretId:e,value:t},{onSuccess:()=>{C(`Secret saved successfully`),s(!1)}})};if(!i)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsx)(Xf,{variant:`light`,leftSection:(0,A.jsx)(Tfe,{size:16}),onClick:()=>a(!0),size:`sm`,children:`Retrieve secret value`})]});if(_)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsx)(mf,{size:`sm`})]});let E=x?c:`json`;return(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsxs)(Sf,{gap:`xs`,align:`center`,children:[!o&&r&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>s(!0),title:`Edit secret value`,children:(0,A.jsx)(Tb,{size:14})}),x&&(0,A.jsx)(wh,{value:E,onChange:l,data:[{label:`Form`,value:`form`},{label:`JSON`,value:`json`}],size:`sm`,style:{width:`auto`}})]})]}),m&&(0,A.jsx)(If,{icon:(0,A.jsx)(rb,{size:16}),color:`green`,variant:`light`,children:m}),y.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to save secret`}),!g?.exists&&!o&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No value set yet.`}),o?(0,A.jsx)(Bh,{gap:`sm`,children:E===`form`&&x?(0,A.jsx)(Vk,{schema:b,onSubmit:w,submitting:y.isPending,submitLabel:`Save`,initialData:S??void 0,children:(0,A.jsxs)(Sf,{mt:`sm`,gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>s(!1),children:`Cancel`}),(0,A.jsx)(Xf,{type:`submit`,leftSection:(0,A.jsx)(jb,{size:16}),loading:y.isPending,children:`Save`})]})}):(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(im,{value:u,onChange:e=>{d(e.currentTarget.value),p(null)},placeholder:`{"key": "value"}`,autosize:!0,minRows:4,maxRows:12,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),f&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:f}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>s(!1),children:`Cancel`}),(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(jb,{size:16}),loading:y.isPending,onClick:T,children:`Save`})]})]})}):(0,A.jsx)(Bh,{gap:`xs`,children:g?.exists&&(E===`form`&&x?(0,A.jsx)(j,{style:{pointerEvents:`none`,opacity:.8},children:(0,A.jsx)(Vk,{schema:b,onSubmit:()=>{},initialData:S??void 0,children:(0,A.jsx)(A.Fragment,{})})}):(0,A.jsx)(tp,{block:!0,style:{whiteSpace:`pre-wrap`,maxHeight:300,overflow:`auto`},children:JSON.stringify(S,null,2)}))})]})};function NHe(e,t){let n=By();return Rr({queryKey:[`variable-value`,e],queryFn:async()=>await n.invoke(`pikkuConsoleGetVariable`,{variableId:e}),enabled:!!e&&t})}function PHe(){let e=By(),t=Dr();return zr({mutationFn:({variableId:t,value:n})=>e.invoke(`pikkuConsoleSetVariable`,{variableId:t,value:n}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`variable-value`,n.variableId]})}})}const FHe=({variableId:e,schemaName:t})=>{let n=zB(),[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(`form`),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(null),{data:h,isLoading:g}=NHe(e,r),{data:_}=Zk(t),v=PHe(),y=!!_,b=h?.exists?h.value:null;if((0,D.useEffect)(()=>{h&&u(b==null?``:JSON.stringify(b,null,2))},[h,b]),!e)return null;let x=e=>{m(e),setTimeout(()=>m(null),3e3)},S=t=>{v.mutate({variableId:e,value:t},{onSuccess:()=>{x(`Variable saved successfully`),o(!1)}})},C=()=>{f(null);let t;try{t=JSON.parse(l)}catch{f(`Invalid JSON`);return}v.mutate({variableId:e,value:t},{onSuccess:()=>{x(`Variable saved successfully`),o(!1)}})};if(!r)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsx)(Xf,{variant:`light`,leftSection:(0,A.jsx)(Tfe,{size:16}),onClick:()=>i(!0),size:`sm`,children:`Retrieve variable value`})]});if(g)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsx)(mf,{size:`sm`})]});let w=y?s:`json`;return(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsxs)(Sf,{gap:`xs`,align:`center`,children:[!a&&n&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>o(!0),title:`Edit variable value`,children:(0,A.jsx)(Tb,{size:14})}),y&&(0,A.jsx)(wh,{value:w,onChange:c,data:[{label:`Form`,value:`form`},{label:`JSON`,value:`json`}],size:`sm`,style:{width:`auto`}})]})]}),p&&(0,A.jsx)(If,{icon:(0,A.jsx)(rb,{size:16}),color:`green`,variant:`light`,children:p}),v.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to save variable`}),!h?.exists&&!a&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No value set yet.`}),a?(0,A.jsx)(Bh,{gap:`sm`,children:w===`form`&&y?(0,A.jsx)(Vk,{schema:_,onSubmit:S,submitting:v.isPending,submitLabel:`Save`,initialData:b??void 0,children:(0,A.jsxs)(Sf,{mt:`sm`,gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>o(!1),children:`Cancel`}),(0,A.jsx)(Xf,{type:`submit`,leftSection:(0,A.jsx)(jb,{size:16}),loading:v.isPending,children:`Save`})]})}):(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(im,{value:l,onChange:e=>{u(e.currentTarget.value),f(null)},placeholder:`{"key": "value"}`,autosize:!0,minRows:4,maxRows:12,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),d&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:d}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>o(!1),children:`Cancel`}),(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(jb,{size:16}),loading:v.isPending,onClick:C,children:`Save`})]})]})}):(0,A.jsx)(Bh,{gap:`xs`,children:h?.exists&&(w===`form`&&y?(0,A.jsx)(j,{style:{pointerEvents:`none`,opacity:.8},children:(0,A.jsx)(Vk,{schema:_,onSubmit:()=>{},initialData:b??void 0,children:(0,A.jsx)(A.Fragment,{})})}):(0,A.jsx)(tp,{block:!0,style:{whiteSpace:`pre-wrap`,maxHeight:300,overflow:`auto`},children:JSON.stringify(b,null,2)}))})]})},IHe=({secretId:e,metadata:t={}})=>{let n=!!t?.oauth2;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(mb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.displayName||e})]}),t?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsx)(Sf,{gap:`xs`,children:n?(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`OAuth2`}):(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Secret`})}),(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Secret ID`}),(0,A.jsx)(tp,{children:t?.secretId})]}),n&&(0,A.jsxs)(A.Fragment,{children:[t.oauth2.tokenSecretId&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Token Secret ID`}),(0,A.jsx)(tp,{children:t.oauth2.tokenSecretId})]}),t.oauth2.authorizationUrl&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Authorization URL`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.oauth2.authorizationUrl})]}),t.oauth2.tokenUrl&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Token URL`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.oauth2.tokenUrl})]}),t.oauth2.scopes?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Scopes`}),(0,A.jsx)(Sf,{gap:6,children:t.oauth2.scopes.map(e=>(0,A.jsx)(eS,{type:`label`,color:`gray`,children:e},e))})]})]}),(0,A.jsx)(_A,{label:`Fields`,schemaName:t?.schema}),t?.installed!==!1&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(UB,{secretId:t?.secretId,schemaName:t?.schema,isOAuth2:n}),n&&(0,A.jsx)(LHe,{credentialName:t.name})]})]})};var LHe=({credentialName:e})=>{let t=Dr(),n=(0,D.useRef)(null),{data:r,isLoading:i}=jHe(e,!0),a=MHe(),o=BB(),s=VB(),c=(0,D.useCallback)(n=>{n.data?.type===`oauth-callback-success`&&(t.invalidateQueries({queryKey:[`oauth-status`,e]}),window.removeEventListener(`message`,c))},[e,t]),l=(0,D.useCallback)(()=>{let t=`${window.location.origin}/oauth/callback`;a.mutate({credentialName:e,callbackUrl:t},{onSuccess:e=>{window.addEventListener(`message`,c),n.current=window.open(e.authUrl,`oauth-popup`,`width=600,height=700,popup=yes`)}})},[e,a,c]),u=(0,D.useCallback)(()=>{o.mutate({credentialName:e})},[e,o]),d=(0,D.useCallback)(()=>{s.mutate({credentialName:e})},[e,s]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`OAuth2 Connection`}),(0,A.jsxs)(Bh,{gap:`sm`,children:[i?(0,A.jsx)(mf,{size:`sm`}):r?.connected?(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`label`,color:`green`,children:`Connected`}),r.hasRefreshToken&&(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Has Refresh Token`})]}),r.expiresAt&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:r.isExpired?`Token expired at ${new Date(r.expiresAt).toLocaleString()}`:`Token expires at ${new Date(r.expiresAt).toLocaleString()}`})]}):(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Not Connected`}),a.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to start OAuth flow`}),o.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to disconnect`}),s.isSuccess&&(0,A.jsx)(If,{icon:s.data?.valid?(0,A.jsx)(rb,{size:16}):(0,A.jsx)(zb,{size:16}),color:s.data?.valid?`green`:`red`,variant:`light`,children:s.data?.valid?`Token is valid`:`Token invalid: ${s.data?.error||`unknown error`}`}),s.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to test token`}),(0,A.jsx)(Sf,{gap:`xs`,children:r?.connected?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Xf,{variant:`default`,size:`sm`,leftSection:(0,A.jsx)(Hfe,{size:14}),loading:s.isPending,onClick:d,children:`Test Token`}),(0,A.jsx)(Xf,{variant:`light`,color:`red`,size:`sm`,leftSection:(0,A.jsx)(Gfe,{size:14}),loading:o.isPending,onClick:u,children:`Disconnect`})]}):(0,A.jsx)(Xf,{variant:`light`,color:`green`,size:`sm`,leftSection:(0,A.jsx)(_b,{size:14}),loading:a.isPending,onClick:l,children:`Connect`})})]})]})};const RHe=({variableId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Bfe,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.displayName||e})]}),t?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`label`,color:`teal`,children:`Variable`})}),(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Variable ID`}),(0,A.jsx)(tp,{children:t?.variableId})]}),(0,A.jsx)(_A,{label:`Fields`,schemaName:t?.schema}),t?.installed!==!1&&(0,A.jsx)(FHe,{variableId:t?.variableId,schemaName:t?.schema})]}),zHe=({userId:e,metadata:t})=>{let n=By(),r=Dr(),i=t?.credentialsMeta??[],a=t?.credentials??{},o=i.filter(e=>a[e.name]),s=i.filter(e=>!a[e.name]),c=zr({mutationFn:async t=>{await n.invoke(`console:credentialDelete`,{name:t,userId:e})},onSuccess:()=>{r.invalidateQueries({queryKey:[`credential-list-users`]})}}),l=zr({mutationFn:async t=>{let r=await n.invoke(`console:oauthConnect`,{credentialName:t,userId:e});window.open(r.authUrl,`oauth-connect`,`width=600,height=700`)||(window.location.href=r.authUrl)}});return(0,A.jsxs)(Bh,{gap:`md`,pt:`md`,children:[(0,A.jsxs)(Jf,{size:`sm`,variant:`light`,color:o.length>0?`teal`:`gray`,children:[o.length,` of `,i.length,` credentials connected`]}),o.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:`xs`,children:`Connected`}),(0,A.jsx)(Bh,{gap:`xs`,children:o.map(e=>(0,A.jsxs)(Sf,{justify:`space-between`,p:`xs`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[e.isOAuth2?(0,A.jsx)(gb,{size:14,color:`var(--mantine-color-dimmed)`}):(0,A.jsx)(mb,{size:14,color:`var(--mantine-color-dimmed)`}),(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:e.displayName}),(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:e.isOAuth2?`violet`:`blue`,children:e.isOAuth2?`OAuth2`:`API Key`})]})]}),(0,A.jsx)(Xf,{size:`compact-xs`,variant:`subtle`,color:`red`,leftSection:(0,A.jsx)(Rb,{size:12}),onClick:()=>c.mutate(e.name),loading:c.isPending,children:`Revoke`})]},e.name))})]}),s.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:`xs`,c:`dimmed`,children:`Not Connected`}),(0,A.jsx)(Bh,{gap:`xs`,children:s.map(e=>(0,A.jsxs)(Sf,{justify:`space-between`,p:`xs`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,opacity:.7},children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[e.isOAuth2?(0,A.jsx)(gb,{size:14,color:`var(--mantine-color-dimmed)`}):(0,A.jsx)(mb,{size:14,color:`var(--mantine-color-dimmed)`}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.displayName})]}),e.isOAuth2&&(0,A.jsx)(Xf,{size:`compact-xs`,variant:`light`,leftSection:(0,A.jsx)(gb,{size:12}),onClick:()=>l.mutate(e.name),loading:l.isPending,children:`Connect`})]},e.name))})]}),o.length===0&&!s.some(e=>e.isOAuth2)&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`This user hasn't connected any credentials yet.`}),(c.isError||l.isError)&&(0,A.jsx)(If,{color:`red`,variant:`light`,icon:(0,A.jsx)(zb,{size:14}),children:String(c.error?.message||l.error?.message||`An error occurred`)})]})};var BHe=({stepId:e,metadata:t})=>{let n=Wk(),r=qk(e),i=!!n?.selectedRunId,a=t?.stepType,o=a===`trigger`,s=[`branch`,`switch`,`parallel`,`fanout`,`filter`,`arrayPredicate`].includes(a)?(0,A.jsx)(ZVe,{stepId:e}):a===`return`?(0,A.jsx)(XVe,{stepId:e,showOutputs:!0}):(0,A.jsxs)(Bh,{gap:`xl`,children:[!o&&(0,A.jsx)(JVe,{stepId:e}),(0,A.jsx)(XVe,{stepId:e}),(0,A.jsx)(qVe,{stepId:e})]}),c=(0,A.jsxs)(Bh,{gap:`xl`,children:[(0,A.jsx)(wB,{stepId:e}),(0,A.jsx)(QVe,{stepId:e}),(0,A.jsx)($Ve,{stepId:e}),(0,A.jsx)(TB,{stepId:e}),(0,A.jsx)(EB,{stepId:e})]});return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,children:[(0,A.jsx)(db,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,children:r?.stepName||r?.nodeId||e}),(0,A.jsx)(eS,{type:`label`,color:`gray`,children:a})]}),(0,A.jsxs)(rg,{defaultValue:i?`run`:`overview`,children:[(0,A.jsxs)(rg.List,{grow:!0,children:[(0,A.jsx)(rg.Tab,{value:`overview`,children:`Overview`}),(0,A.jsx)(rg.Tab,{value:`run`,disabled:!i,children:`Run`})]}),(0,A.jsx)(rg.Panel,{value:`overview`,pt:`md`,px:`md`,children:s}),(0,A.jsx)(rg.Panel,{value:`run`,pt:`md`,px:`md`,children:c})]},i?`with-run`:`no-run`)]})},VHe=({workflowId:e})=>{let t=Wk(),n=DAe(),{schema:r,isLoading:i}=LAe(),a=(0,D.useCallback)(r=>{n.mutate({workflowName:e,input:r},{onSuccess:e=>{e?.runId&&t?.setSelectedRunId(e.runId),t?.setIsCreatingRun(!1)}})},[e,n,t]);return(0,A.jsxs)(Bh,{gap:`md`,children:[i?(0,A.jsx)(mf,{size:`sm`}):r?(0,A.jsx)(Vk,{schema:r,onSubmit:a,submitting:n.isPending}):(0,A.jsx)(Sf,{justify:`flex-end`,children:(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(Eb,{size:16}),onClick:()=>a({}),loading:n.isPending,children:`Run`})}),n.isError&&(0,A.jsx)(N,{size:`sm`,c:`red`,children:typeof n.error?.message==`string`?n.error.message:JSON.stringify(n.error?.message??n.error,null,2)||`Failed to start workflow`})]})},HHe=({workflowId:e})=>{let t=Wk(),n=!!t?.selectedRunId,r=!!t?.isCreatingRun,i=`${r?`creating`:``}${n?`with-run`:`no-run`}`;return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(eHe,{workflowId:e})}),(0,A.jsxs)(rg,{defaultValue:`overview`,children:[(0,A.jsxs)(rg.List,{grow:!0,children:[(0,A.jsx)(rg.Tab,{value:`overview`,children:`Overview`}),(0,A.jsx)(rg.Tab,{value:`run`,children:n&&!r?`Run`:`New Run`})]}),(0,A.jsx)(rg.Panel,{value:`overview`,pt:`md`,px:`md`,children:(0,A.jsxs)(Bh,{gap:`xl`,children:[(0,A.jsx)(nHe,{workflowId:e}),(0,A.jsx)(OB,{workflowId:e}),(0,A.jsx)(rHe,{workflowId:e})]})}),(0,A.jsx)(rg.Panel,{value:`run`,pt:`md`,px:`md`,children:r?(0,A.jsx)(VHe,{workflowId:e}):n?(0,A.jsx)(sHe,{workflowId:e}):(0,A.jsx)(VHe,{workflowId:e})})]},i)]})};const UHe=e=>{switch(e.type){case`function`:return[{id:`configuration`,title:`Function`,content:(0,A.jsx)(HVe,{functionName:e.id,metadata:e.metadata})}];case`workflowStep`:return[{id:`step`,title:`Step`,content:(0,A.jsx)(BHe,{stepId:e.id,metadata:e.metadata})}];case`workflow`:return[{id:`workflow`,title:`Workflow`,content:(0,A.jsx)(HHe,{workflowId:e.id})}];case`http`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(uHe,{wireId:e.id,metadata:e.metadata})})}];case`channel`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(dHe,{wireId:e.id,metadata:e.metadata})})}];case`rpc`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(fHe,{wireId:e.id,metadata:e.metadata})})}];case`scheduler`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(AB,{wireId:e.id,metadata:e.metadata})})}];case`queue`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(pHe,{wireId:e.id,metadata:e.metadata})})}];case`cli`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(mHe,{wireId:e.id,metadata:e.metadata})})}];case`mcp`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(hHe,{wireId:e.id,metadata:e.metadata})})}];case`trigger`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(gHe,{wireId:e.id,metadata:e.metadata})})}];case`triggerSource`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(_He,{wireId:e.id,metadata:e.metadata})})}];case`middleware`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(NB,{middlewareId:e.id,metadata:e.metadata})})}];case`permission`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(bHe,{permissionId:e.id,metadata:e.metadata})})}];case`agent`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(OHe,{wireId:e.id,metadata:e.metadata})})}];case`secret`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(IHe,{secretId:e.id,metadata:e.metadata})})}];case`variable`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(RHe,{variableId:e.id,metadata:e.metadata})})}];case`credentialUser`:return[{id:`configuration`,title:`Credentials`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(zHe,{userId:e.id,metadata:e.metadata})})}];default:return[]}},WHe=({showTabs:e=!0,emptyMessage:t})=>{let{panels:n,activePanel:r,setActivePanel:i,closePanel:a,goBack:o,goBackTo:s}=_x(),c=Array.from(n.values()),l=r?n.get(r):null,u=(0,D.useMemo)(()=>l?UHe(l.data):[],[l]);return!e&&(c.length===0||u.length===0)?(0,A.jsx)(ep,{h:`100%`,p:`xl`,children:(0,A.jsx)(N,{c:`dimmed`,ta:`center`,children:t||`Select an item to view details`})}):c.length===0||u.length===0?null:(0,A.jsxs)(Bh,{gap:0,className:`${fx.flexColumn} ${fx.overflowHidden}`,children:[e&&(0,A.jsx)(j,{style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(Sf,{gap:0,wrap:`nowrap`,style:{overflowX:`auto`},children:c.map(e=>(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,px:`md`,py:`xs`,className:fx.noShrink,style:{cursor:`pointer`,borderLeft:`1px solid var(--mantine-color-default-border)`,borderRight:`1px solid var(--mantine-color-default-border)`,borderBottom:r===e.id?`2px solid var(--mantine-color-blue-6)`:`2px solid transparent`,backgroundColor:r===e.id?`var(--mantine-color-gray-1)`:`transparent`,transition:`all 0.2s`},onClick:()=>i(e.id),children:[(0,A.jsx)(N,{size:`sm`,fw:r===e.id?600:400,children:e.title}),(0,A.jsx)(bf,{size:`sm`,onClick:t=>{t.stopPropagation(),a(e.id)}})]},e.id))})}),l&&l.history.length>0&&(0,A.jsx)(j,{px:`md`,py:`xs`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,align:`center`,children:[(0,A.jsx)(Ud,{onClick:o,style:{display:`flex`,alignItems:`center`},children:(0,A.jsx)(bfe,{size:18,color:`var(--mantine-color-dimmed)`})}),l.history.map((e,t)=>(0,A.jsxs)(D.Fragment,{children:[(0,A.jsx)(Ud,{onClick:()=>s(t),children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:e.title})}),(0,A.jsx)(nb,{size:14,color:`var(--mantine-color-dimmed)`})]},t)),(0,A.jsx)(N,{size:`sm`,fw:600,style:{whiteSpace:`nowrap`},children:l.title})]})}),(0,A.jsx)(j,{py:`md`,className:`${fx.flexGrow} ${fx.overflowAuto}`,children:(0,A.jsx)(Bh,{gap:`xl`,children:u.map(e=>(0,A.jsx)(j,{children:e.content},e.id))})})]})},WB=({children:e,header:t,minSize:n=267,emptyPanelMessage:r,showTabs:i=!1,hidePanel:a=!1})=>{let{panels:o}=_x(),s=!a&&(!i||o.size!==0);return(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[t,(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(0,A.jsxs)(Yx,{defaultSizes:[840,267],children:[(0,A.jsx)(Yx.Pane,{children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:e})}),(0,A.jsx)(Yx.Pane,{visible:s,minSize:n,maxSize:500,preferredSize:267,children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:(0,A.jsx)(WHe,{showTabs:i,emptyMessage:r})})})]},s?`with-panel`:`no-panel`)})]})},GHe=({icon:e,title:t,description:n,docsHref:r})=>(0,A.jsxs)(Bh,{align:`center`,justify:`center`,gap:`md`,className:fx.emptyState,py:`xl`,style:{minHeight:`60vh`},children:[(0,A.jsx)(e,{size:48,strokeWidth:1}),(0,A.jsx)(N,{size:`xl`,fw:600,children:t}),n&&(0,A.jsx)(N,{c:`dimmed`,ta:`center`,maw:500,children:n}),(0,A.jsx)(Xf,{component:`a`,href:r,target:`_blank`,rel:`noopener noreferrer`,variant:`default`,leftSection:(0,A.jsx)(ub,{size:16}),children:`Docs`})]}),GB=({icon:e,title:t,docsHref:n,data:r,columns:i,getKey:a,onRowClick:o,searchPlaceholder:s=`Search...`,searchFilter:c,emptyMessage:l=`No items found.`,emptyTitle:u,emptyDescription:d,loading:f=!1,description:p,headerRight:m})=>{let[h,g]=(0,D.useState)(``),_=(0,D.useMemo)(()=>{if(!h||!c)return r;let e=h.toLowerCase();return r.filter(t=>c(t,e))},[r,h,c]);return f?(0,A.jsx)(ep,{h:`100%`,children:(0,A.jsx)(mf,{})}):r.length===0?(0,A.jsx)(GHe,{icon:e,title:u||`No ${t} found`,description:d??`No ${t.toLowerCase()} exist yet.`,docsHref:n}):(0,A.jsxs)(Bh,{gap:0,className:fx.flexColumn,children:[p&&(0,A.jsx)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:p}),(0,A.jsxs)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,display:`flex`,gap:8,alignItems:`center`},children:[(0,A.jsx)(ig,{placeholder:s,leftSection:(0,A.jsx)(Mb,{size:16}),value:h,onChange:e=>g(e.target.value),className:fx.flexGrow}),m]}),_.length===0?(0,A.jsx)(j,{p:`xl`,children:(0,A.jsx)(N,{c:`dimmed`,ta:`center`,children:h?`No results found for "${h}"`:l})}):(0,A.jsx)(j,{style:{overflowX:`auto`},children:(0,A.jsxs)(eg,{highlightOnHover:!0,withRowBorders:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsx)(eg.Tr,{children:i.map((e,t)=>(0,A.jsx)(eg.Th,{pl:t===0?`md`:void 0,pr:t===i.length-1?`md`:void 0,fw:600,fz:`xs`,style:e.width?{width:e.width}:void 0,children:e.header},e.key))})}),(0,A.jsx)(eg.Tbody,{children:_.map((e,t)=>(0,A.jsx)(eg.Tr,{className:fx.clickableText,style:{height:`3.75rem`},onClick:()=>o(e),children:i.map((n,r)=>(0,A.jsx)(eg.Td,{pl:r===0?`md`:void 0,pr:r===i.length-1?`md`:void 0,style:n.width?{width:n.width}:void 0,children:n.render(e,t)},n.key))},a(e,t)))})]})})]})};var KB={covered:`green`,partial:`yellow`,uncovered:`red`,unknown:`gray`};function KHe(e){return Array.isArray(e.tags)&&e.tags.includes(`pikku`)}var qHe=({functions:e,extraColumns:t=[],headerRight:n,testsByFunction:r})=>{let{openFunction:i}=_x(),{functionUsedBy:a}=R(),[o,s]=(0,D.useState)(!1),c=(0,D.useMemo)(()=>!!r||e.some(e=>!!e.tests),[e,r]);return(0,A.jsx)(GB,{title:`Functions`,icon:Fb,docsHref:`https://pikku.dev/docs/core-features/functions`,data:(0,D.useMemo)(()=>e.filter(e=>o||!KHe(e)),[e,o]),columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,width:320,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,ff:`monospace`,children:e.pikkuFuncName||e.pikkuFuncId}),(e.summary||e.description)&&(0,A.jsx)(N,{size:`xs`,c:`dimmed`,truncate:!0,children:e.summary||e.description})]})},{key:`version`,header:`VERSION`,width:80,render:e=>(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,children:e.version==null?`—`:`v${e.version}`})},{key:`type`,header:`TYPE`,width:140,render:e=>{let t=Zx[e.funcWrapper];return t?(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,tt:`none`,children:t.label}):null}},{key:`auth`,header:`AUTH`,width:60,render:e=>{let t=e.sessionless!==!0;return(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:t?`#86efac`:`var(--app-text-muted)`,children:t?`Auth`:`—`})}},{key:`wirings`,header:`WIRINGS`,width:80,render:e=>{let t=e.pikkuFuncName||e.pikkuFuncId,n=a.get(t),r=n?n.transports.length+n.jobs.length:0;return(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:r>0?`var(--app-service-color)`:`var(--app-text-muted)`,children:r>0?String(r):`—`})}},...c?[{key:`tests`,header:`TESTS`,width:180,render:e=>{let t=e.pikkuFuncName||e.pikkuFuncId,n=e.tests??r?.[t];if(!n)return(0,A.jsx)(Ud,{onClick:n=>{n.stopPropagation(),i(t,e)},children:(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,children:`unknown`})});let a=n.status,o=n.status===`covered`?`${n.coveredLines}/${n.totalLines}`:n.status===`unknown`?`unknown`:`${Math.round(n.ratio*100)}%`;return(0,A.jsx)(Ud,{onClick:r=>{r.stopPropagation(),i(t,{...e,tests:n})},style:{display:`block`,textAlign:`left`},children:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,children:[(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:KB[a],children:o}),(0,A.jsx)(N,{size:`xs`,c:`dimmed`,children:n.scenarios.length===0?`No tests`:`${n.scenarios.length} linked`})]})})}}]:[],...t.map(e=>({key:e.label,header:e.label.toUpperCase(),width:e.width,align:e.align,render:t=>e.render(t.pikkuFuncName||t.pikkuFuncId)}))],[a,t,c,i,r]),getKey:e=>e.pikkuFuncName||e.pikkuFuncId,onRowClick:e=>i(e.pikkuFuncName||e.pikkuFuncId,e),searchPlaceholder:`Search functions...`,searchFilter:(e,t)=>e.pikkuFuncId?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||!1,emptyMessage:`No functions found.`,headerRight:(0,A.jsxs)(Sf,{gap:`sm`,wrap:`nowrap`,children:[(0,A.jsx)(qh,{size:`sm`,label:`Show Pikku`,checked:o,onChange:e=>s(e.currentTarget.checked)}),n]})})};const JHe=({extraColumns:e,headerRight:t,testsByFunction:n})=>{let r=By(),{data:i,isLoading:a}=Rr({queryKey:[`functions-meta`],queryFn:()=>r.invoke(`console:getFunctionsMeta`)});return(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{emptyPanelMessage:`Select a function to view details`,hidePanel:a||!i||i.length===0,children:(0,A.jsx)(qHe,{functions:i??[],extraColumns:e,headerRight:t,testsByFunction:n})})})};var YHe=(0,D.createContext)(null);function XHe(){let e=(0,D.useContext)(YHe);if(!e)throw Error(`useConsoleNavigator must be used within a navigator provider`);return e}var ZHe={workflows:`/workflow`};const QHe=({children:e})=>{let[t]=Gy(),n=Uy();return(0,A.jsx)(YHe.Provider,{value:{workflowId:t.get(`id`),navigateTo:(e,t)=>{let r=ZHe[e];n(t?`${r}?id=${encodeURIComponent(t)}`:r)}},children:e})};var $He=[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(N,{fw:500,children:[e.name,e.source===`dynamic-workflow`&&(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`violet`,ml:8,children:`Dynamic`})]})},{key:`steps`,header:`STEPS`,align:`right`,render:e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`steps`,value:Object.keys(e.nodes||{}).length})}];const eUe=({workflows:e,aiWorkflows:t,extraColumns:n=[],headerRight:r})=>{let[i,a]=(0,D.useState)(`all`),{navigateTo:o}=XHe(),s=(0,D.useMemo)(()=>{let n=e?Object.values(e):[];if(t){let e=new Set(n.map(e=>e.name));for(let r of t)e.has(r.workflowName)||n.push({name:r.workflowName,pikkuFuncId:r.workflowName,steps:[],source:`dynamic-workflow`,nodes:r.graph?.nodes})}return n.sort((e,t)=>(e.name||``).localeCompare(t.name||``))},[e,t]);return(0,A.jsx)(GB,{title:`Workflows`,icon:db,docsHref:`https://pikku.dev/docs/wiring/workflows`,data:(0,D.useMemo)(()=>i===`dsl`?s.filter(e=>e.dsl===!0):i===`graph`?s.filter(e=>e.dsl!==!0&&e.source!==`dynamic-workflow`):i===`dynamic-workflow`?s.filter(e=>e.source===`dynamic-workflow`):s,[s,i]),columns:[...$He,...n.map(e=>({key:e.label,header:e.label.toUpperCase(),width:e.width,render:t=>e.render(t.name)}))],getKey:e=>e.name,onRowClick:e=>o(`workflows`,e.name),searchPlaceholder:`Search workflows...`,searchFilter:(e,t)=>(e.name?.toLowerCase().includes(t)||e.pikkuFuncId?.toLowerCase().includes(t))??!1,emptyMessage:`No workflows found.`,headerRight:(0,A.jsxs)(Sf,{gap:4,children:[r,(0,A.jsx)(Ch,{label:`Workflows docs`,children:(0,A.jsx)(_f,{component:`a`,href:`https://pikku.dev/docs/wiring/workflows`,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})})};function qB(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=qB(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var tUe=s((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),nUe=s(((e,t)=>{t.exports=tUe()})),rUe=s((e=>{var t=g(),n=nUe();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),iUe=s(((e,t)=>{t.exports=rUe()})),aUe=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},oUe=e=>e?aUe(e):aUe,sUe=u(iUe(),1),{useDebugValue:cUe}=D.default,{useSyncExternalStoreWithSelector:JB}=sUe.default,lUe=e=>e;function uUe(e,t=lUe,n){let r=JB(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cUe(r),r}var YB=(e,t)=>{let n=oUe(e),r=(e,r=t)=>uUe(n,e,r);return Object.assign(r,n),r},dUe=(e,t)=>e?YB(e,t):YB;function XB(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 ZB={value:()=>{}};function fUe(){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 QB(n)}function QB(e){this._=e}function $B(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}})}QB.prototype=fUe.prototype={constructor:QB,on:function(e,t){var n=this._,r=$B(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=pUe(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]=mUe(n[i],e.name,t);else if(t==null)for(i in n)n[i]=mUe(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 QB(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 pUe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function mUe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ZB,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var eV=fUe,hUe={value:()=>{}};function gUe(){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 tV(n)}function tV(e){this._=e}function _Ue(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}})}tV.prototype=gUe.prototype={constructor:tV,on:function(e,t){var n=this._,r=_Ue(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=vUe(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]=yUe(n[i],e.name,t);else if(t==null)for(i in n)n[i]=yUe(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 tV(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 vUe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function yUe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=hUe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var bUe=gUe,xUe={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 SUe(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),xUe.hasOwnProperty(t)?{space:xUe[t],local:e}:e}function CUe(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 nV(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rV(e){var t=SUe(e);return(t.local?nV:CUe)(t)}function wUe(){}function iV(e){return e==null?wUe:function(){return this.querySelector(e)}}function TUe(e){typeof e!=`function`&&(e=iV(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 jV(r,this._parents)}function aV(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function EUe(){return[]}function oV(e){return e==null?EUe:function(){return this.querySelectorAll(e)}}function sV(e){return function(){return aV(e.apply(this,arguments))}}function DUe(e){e=typeof e==`function`?sV(e):oV(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 jV(r,i)}function OUe(e){return function(){return this.matches(e)}}function kUe(e){return function(t){return t.matches(e)}}var AUe=Array.prototype.find;function jUe(e){return function(){return AUe.call(this.children,e)}}function cV(){return this.firstElementChild}function lV(e){return this.select(e==null?cV:jUe(typeof e==`function`?e:kUe(e)))}var MUe=Array.prototype.filter;function NUe(){return Array.from(this.children)}function PUe(e){return function(){return MUe.call(this.children,e)}}function FUe(e){return this.selectAll(e==null?NUe:PUe(typeof e==`function`?e:kUe(e)))}function IUe(e){typeof e!=`function`&&(e=OUe(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 jV(r,this._parents)}function LUe(e){return Array(e.length)}function RUe(){return new jV(this._enter||this._groups.map(LUe),this._parents)}function uV(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}uV.prototype={constructor:uV,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 dV(e){return function(){return e}}function fV(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 uV(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function pV(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 uV(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function zUe(e){return e.__data__}function mV(e,t){if(!arguments.length)return Array.from(this,zUe);var n=t?pV:fV,r=this._parents,i=this._groups;typeof e!=`function`&&(e=dV(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=hV(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 jV(o,r),o._enter=s,o._exit=c,o}function hV(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function BUe(){return new jV(this._exit||this._groups.map(LUe),this._parents)}function VUe(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 HUe(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 jV(s,this._parents)}function UUe(){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 WUe(e){e||=GUe;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 jV(i,this._parents).order()}function GUe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KUe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qUe(){return Array.from(this)}function gV(){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 JUe(){let e=0;for(let t of this)++e;return e}function _V(){return!this.node()}function YUe(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 XUe(e){return function(){this.removeAttribute(e)}}function ZUe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QUe(e,t){return function(){this.setAttribute(e,t)}}function $Ue(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function eWe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function vV(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 tWe(e,t){var n=SUe(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?ZUe:XUe:typeof t==`function`?n.local?vV:eWe:n.local?$Ue:QUe)(n,t))}function nWe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rWe(e){return function(){this.style.removeProperty(e)}}function iWe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function bV(e,t,n){return arguments.length>1?this.each((t==null?rWe:typeof t==`function`?yV:iWe)(e,t,n??``)):xV(this.node(),e)}function xV(e,t){return e.style.getPropertyValue(t)||nWe(e).getComputedStyle(e,null).getPropertyValue(t)}function SV(e){return function(){delete this[e]}}function aWe(e,t){return function(){this[e]=t}}function oWe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sWe(e,t){return arguments.length>1?this.each((t==null?SV:typeof t==`function`?oWe:aWe)(e,t)):this.node()[e]}function CV(e){return e.trim().split(/^|\s+/)}function cWe(e){return e.classList||new wV(e)}function wV(e){this._node=e,this._names=CV(e.getAttribute(`class`)||``)}wV.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 lWe(e,t){for(var n=cWe(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function TV(e,t){for(var n=cWe(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function uWe(e){return function(){lWe(this,e)}}function dWe(e){return function(){TV(this,e)}}function fWe(e,t){return function(){(t.apply(this,arguments)?lWe:TV)(this,e)}}function pWe(e,t){var n=CV(e+``);if(arguments.length<2){for(var r=cWe(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?fWe:t?uWe:dWe)(n,t))}function mWe(){this.textContent=``}function hWe(e){return function(){this.textContent=e}}function EV(e){return function(){this.textContent=e.apply(this,arguments)??``}}function DV(e){return arguments.length?this.each(e==null?mWe:(typeof e==`function`?EV:hWe)(e)):this.node().textContent}function gWe(){this.innerHTML=``}function OV(e){return function(){this.innerHTML=e}}function kV(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function _We(e){return arguments.length?this.each(e==null?gWe:(typeof e==`function`?kV:OV)(e)):this.node().innerHTML}function vWe(){this.nextSibling&&this.parentNode.appendChild(this)}function yWe(){return this.each(vWe)}function bWe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xWe(){return this.each(bWe)}function SWe(e){var t=typeof e==`function`?e:rV(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function CWe(){return null}function wWe(e,t){var n=typeof e==`function`?e:rV(e),r=t==null?CWe:typeof t==`function`?t:iV(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function TWe(){var e=this.parentNode;e&&e.removeChild(this)}function EWe(){return this.each(TWe)}function DWe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function OWe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kWe(e){return this.select(e?OWe:DWe)}function AV(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function AWe(e){return function(t){e.call(this,t,this.__data__)}}function jWe(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 MWe(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 NWe(e,t,n){return function(){var r=this.__on,i,a=AWe(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 PWe(e,t,n){var r=jWe(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?NWe:MWe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function FWe(e,t,n){var r=nWe(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 IWe(e,t){return function(){return FWe(this,e,t)}}function LWe(e,t){return function(){return FWe(this,e,t.apply(this,arguments))}}function RWe(e,t){return this.each((typeof t==`function`?LWe:IWe)(e,t))}function*zWe(){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 BWe=[null];function jV(e,t){this._groups=e,this._parents=t}function VWe(){return new jV([[document.documentElement]],BWe)}function HWe(){return this}jV.prototype=VWe.prototype={constructor:jV,select:TUe,selectAll:DUe,selectChild:lV,selectChildren:FUe,filter:IUe,data:mV,enter:RUe,exit:BUe,join:VUe,merge:HUe,selection:HWe,order:UUe,sort:WUe,call:KUe,nodes:qUe,node:gV,size:JUe,empty:_V,each:YUe,attr:tWe,style:bV,property:sWe,classed:pWe,text:DV,html:_We,raise:yWe,lower:xWe,append:SWe,insert:wWe,remove:EWe,clone:kWe,datum:AV,on:PWe,dispatch:RWe,[Symbol.iterator]:zWe};var MV=VWe;function NV(e){return typeof e==`string`?new jV([[document.querySelector(e)]],[document.documentElement]):new jV([[e]],BWe)}function UWe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function PV(e,t){if(e=UWe(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]}const WWe={passive:!1},FV={capture:!0,passive:!1};function GWe(e){e.stopImmediatePropagation()}function IV(e){e.preventDefault(),e.stopImmediatePropagation()}function KWe(e){var t=e.document.documentElement,n=NV(e).on(`dragstart.drag`,IV,FV);`onselectstart`in t?n.on(`selectstart.drag`,IV,FV):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function qWe(e,t){var n=e.document.documentElement,r=NV(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,IV,FV),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 LV=e=>()=>e;function JWe(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}})}JWe.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function YWe(e){return!e.ctrlKey&&!e.button}function XWe(){return this.parentNode}function ZWe(e,t){return t??{x:e.x,y:e.y}}function QWe(){return navigator.maxTouchPoints||`ontouchstart`in this}function RV(){var e=YWe,t=XWe,n=ZWe,r=QWe,i={},a=bUe(`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`,_,WWe).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&&(NV(n.view).on(`mousemove.drag`,m,FV).on(`mouseup.drag`,h,FV),KWe(n.view),GWe(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(IV(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){NV(e.view).on(`mousemove.drag mouseup.drag`,null),qWe(e.view,l),IV(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]))&&(GWe(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])&&(IV(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])&&(GWe(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=PV(l||r,t),p,m,h;if((h=n.call(e,new JWe(`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=PV(l||a,t),_=o;break}u.call(r,e,new JWe(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:LV(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:LV(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:LV(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:LV(!!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 zV(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $We(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function BV(){}var VV=.7,eGe=1/VV,HV=`\\s*([+-]?\\d+)\\s*`,UV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,WV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,tGe=/^#([0-9a-f]{3,8})$/,nGe=RegExp(`^rgb\\(${HV},${HV},${HV}\\)$`),rGe=RegExp(`^rgb\\(${WV},${WV},${WV}\\)$`),iGe=RegExp(`^rgba\\(${HV},${HV},${HV},${UV}\\)$`),aGe=RegExp(`^rgba\\(${WV},${WV},${WV},${UV}\\)$`),oGe=RegExp(`^hsl\\(${UV},${WV},${WV}\\)$`),sGe=RegExp(`^hsla\\(${UV},${WV},${WV},${UV}\\)$`),GV={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};zV(BV,qV,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cGe,formatHex:cGe,formatHex8:lGe,formatHsl:KV,formatRgb:uGe,toString:uGe});function cGe(){return this.rgb().formatHex()}function lGe(){return this.rgb().formatHex8()}function KV(){return _Ge(this).formatHsl()}function uGe(){return this.rgb().formatRgb()}function qV(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=tGe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?dGe(t):n===3?new YV(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?JV(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?JV(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=nGe.exec(e))?new YV(t[1],t[2],t[3],1):(t=rGe.exec(e))?new YV(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iGe.exec(e))?JV(t[1],t[2],t[3],t[4]):(t=aGe.exec(e))?JV(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oGe.exec(e))?$V(t[1],t[2]/100,t[3]/100,1):(t=sGe.exec(e))?$V(t[1],t[2]/100,t[3]/100,t[4]):GV.hasOwnProperty(e)?dGe(GV[e]):e===`transparent`?new YV(NaN,NaN,NaN,0):null}function dGe(e){return new YV(e>>16&255,e>>8&255,e&255,1)}function JV(e,t,n,r){return r<=0&&(e=t=n=NaN),new YV(e,t,n,r)}function fGe(e){return e instanceof BV||(e=qV(e)),e?(e=e.rgb(),new YV(e.r,e.g,e.b,e.opacity)):new YV}function pGe(e,t,n,r){return arguments.length===1?fGe(e):new YV(e,t,n,r??1)}function YV(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}zV(YV,pGe,$We(BV,{brighter(e){return e=e==null?eGe:eGe**+e,new YV(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?VV:VV**+e,new YV(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new YV(ZV(this.r),ZV(this.g),ZV(this.b),gGe(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:mGe,formatHex:mGe,formatHex8:hGe,formatRgb:XV,toString:XV}));function mGe(){return`#${QV(this.r)}${QV(this.g)}${QV(this.b)}`}function hGe(){return`#${QV(this.r)}${QV(this.g)}${QV(this.b)}${QV((isNaN(this.opacity)?1:this.opacity)*255)}`}function XV(){let e=gGe(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ZV(this.r)}, ${ZV(this.g)}, ${ZV(this.b)}${e===1?`)`:`, ${e})`}`}function gGe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ZV(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function QV(e){return e=ZV(e),(e<16?`0`:``)+e.toString(16)}function $V(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new eH(e,t,n,r)}function _Ge(e){if(e instanceof eH)return new eH(e.h,e.s,e.l,e.opacity);if(e instanceof BV||(e=qV(e)),!e)return new eH;if(e instanceof eH)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 eH(o,s,c,e.opacity)}function vGe(e,t,n,r){return arguments.length===1?_Ge(e):new eH(e,t,n,r??1)}function eH(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}zV(eH,vGe,$We(BV,{brighter(e){return e=e==null?eGe:eGe**+e,new eH(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?VV:VV**+e,new eH(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 YV(xGe(e>=240?e-240:e+120,i,r),xGe(e,i,r),xGe(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new eH(yGe(this.h),bGe(this.s),bGe(this.l),gGe(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=gGe(this.opacity);return`${e===1?`hsl(`:`hsla(`}${yGe(this.h)}, ${bGe(this.s)*100}%, ${bGe(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function yGe(e){return e=(e||0)%360,e<0?e+360:e}function bGe(e){return Math.max(0,Math.min(1,e||0))}function xGe(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 SGe=e=>()=>e;function tH(e,t){return function(n){return e+n*t}}function nH(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function CGe(e){return(e=+e)==1?wGe:function(t,n){return n-t?nH(t,n,e):SGe(isNaN(t)?n:t)}}function wGe(e,t){var n=t-e;return n?tH(e,n):SGe(isNaN(e)?t:e)}var TGe=(function e(t){var n=CGe(t);function r(e,t){var r=n((e=pGe(e)).r,(t=pGe(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=wGe(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 rH(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var iH=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,aH=new RegExp(iH.source,`g`);function oH(e){return function(){return e}}function EGe(e){return function(t){return e(t)+``}}function DGe(e,t){var n=iH.lastIndex=aH.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=iH.exec(e))&&(i=aH.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:rH(r,i)})),n=aH.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?EGe(c[0].x):oH(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(``)})}var OGe=180/Math.PI,sH={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kGe(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)*OGe,skewX:Math.atan(c)*OGe,scaleX:o,scaleY:s}}var AGe;function cH(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?sH:kGe(t.a,t.b,t.c,t.d,t.e,t.f)}function lH(e){return e==null||(AGe||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),AGe.setAttribute(`transform`,e),!(e=AGe.transform.baseVal.consolidate()))?sH:(e=e.matrix,kGe(e.a,e.b,e.c,e.d,e.e,e.f))}function jGe(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:rH(e,i)},{i:c-2,x:rH(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:rH(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:rH(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:rH(e,n)},{i:s-2,x:rH(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 MGe=jGe(cH,`px, `,`px)`,`deg)`),NGe=jGe(lH,`, `,`)`,`)`),PGe=1e-12;function FGe(e){return((e=Math.exp(e))+1/e)/2}function IGe(e){return((e=Math.exp(e))-1/e)/2}function LGe(e){return((e=Math.exp(2*e))-1)/(e+1)}var RGe=(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<PGe)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=FGe(y),c=s/(n*g)*(i*LGe(t*r+y)-IGe(y));return[a+c*d,o+c*f,s*i/FGe(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),uH=0,dH=0,zGe=0,BGe=1e3,VGe,fH,pH=0,mH=0,hH=0,gH=typeof performance==`object`&&performance.now?performance:Date,_H=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function HGe(){return mH||=(_H(UGe),gH.now()+hH)}function UGe(){mH=0}function WGe(){this._call=this._time=this._next=null}WGe.prototype=GGe.prototype={constructor:WGe,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?HGe():+n)+(t==null?0:+t),!this._next&&fH!==this&&(fH?fH._next=this:VGe=this,fH=this),this._call=e,this._time=n,YGe()},stop:function(){this._call&&(this._call=null,this._time=1/0,YGe())}};function GGe(e,t,n){var r=new WGe;return r.restart(e,t,n),r}function vH(){HGe(),++uH;for(var e=VGe,t;e;)(t=mH-e._time)>=0&&e._call.call(void 0,t),e=e._next;--uH}function KGe(){mH=(pH=gH.now())+hH,uH=dH=0;try{vH()}finally{uH=0,JGe(),mH=0}}function qGe(){var e=gH.now(),t=e-pH;t>BGe&&(hH-=t,pH=e)}function JGe(){for(var e,t=VGe,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:VGe=n);fH=e,YGe(r)}function YGe(e){uH||(dH&&=clearTimeout(dH),e-mH>24?(e<1/0&&(dH=setTimeout(KGe,e-gH.now()-hH)),zGe&&=clearInterval(zGe)):(zGe||=(pH=gH.now(),setInterval(qGe,BGe)),uH=1,_H(KGe)))}function XGe(e,t,n){var r=new WGe;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var ZGe=eV(`start`,`end`,`cancel`,`interrupt`),QGe=[];function yH(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;$Ge(e,n,{name:t,index:r,group:i,on:ZGe,tween:QGe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function bH(e,t){var n=SH(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xH(e,t){var n=SH(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function SH(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function $Ge(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=GGe(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 XGe(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(XGe(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 CH(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 eKe(e){return this.each(function(){CH(this,e)})}function tKe(e,t){var n,r;return function(){var i=xH(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 nKe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xH(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 rKe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=SH(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?tKe:nKe)(n,e,t))}function wH(e,t,n){var r=e._id;return e.each(function(){var e=xH(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return SH(e,r).value[t]}}function iKe(e,t){var n;return(typeof t==`number`?rH:t instanceof qV?TGe:(n=qV(t))?(t=n,TGe):DGe)(e,t)}function aKe(e){return function(){this.removeAttribute(e)}}function oKe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sKe(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 cKe(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 TH(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 lKe(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 uKe(e,t){var n=SUe(e),r=n===`transform`?NGe:iKe;return this.attrTween(e,typeof t==`function`?(n.local?lKe:TH)(n,r,wH(this,`attr.`+e,t)):t==null?(n.local?oKe:aKe)(n):(n.local?cKe:sKe)(n,r,t))}function EH(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dKe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fKe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&dKe(e,i)),n}return i._value=t,i}function DH(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&EH(e,i)),n}return i._value=t,i}function pKe(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=SUe(e);return this.tween(n,(r.local?fKe:DH)(r,t))}function mKe(e,t){return function(){bH(this,e).delay=+t.apply(this,arguments)}}function hKe(e,t){return t=+t,function(){bH(this,e).delay=t}}function gKe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?mKe:hKe)(t,e)):SH(this.node(),t).delay}function _Ke(e,t){return function(){xH(this,e).duration=+t.apply(this,arguments)}}function vKe(e,t){return t=+t,function(){xH(this,e).duration=t}}function yKe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_Ke:vKe)(t,e)):SH(this.node(),t).duration}function bKe(e,t){if(typeof t!=`function`)throw Error();return function(){xH(this,e).ease=t}}function xKe(e){var t=this._id;return arguments.length?this.each(bKe(t,e)):SH(this.node(),t).ease}function SKe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xH(this,e).ease=n}}function CKe(e){if(typeof e!=`function`)throw Error();return this.each(SKe(this._id,e))}function wKe(e){typeof e!=`function`&&(e=OUe(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 jH(r,this._parents,this._name,this._id)}function OH(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 jH(o,this._parents,this._name,this._id)}function TKe(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 EKe(e,t,n){var r,i,a=TKe(t)?bH:xH;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function kH(e,t){var n=this._id;return arguments.length<2?SH(this.node(),n).on.on(e):this.each(EKe(n,e,t))}function DKe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function OKe(){return this.on(`end.remove`,DKe(this._id))}function kKe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=iV(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,yH(l[f],t,n,f,l,SH(u,n)));return new jH(a,this._parents,t,n)}function AKe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=oV(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=SH(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&yH(p,t,n,h,f,m);a.push(f),o.push(u)}return new jH(a,o,t,n)}var jKe=MV.prototype.constructor;function MKe(){return new jKe(this._groups,this._parents)}function NKe(e,t){var n,r,i;return function(){var a=xV(this,e),o=(this.style.removeProperty(e),xV(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function PKe(e){return function(){this.style.removeProperty(e)}}function FKe(e,t,n){var r,i=n+``,a;return function(){var o=xV(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function IKe(e,t,n){var r,i,a;return function(){var o=xV(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),xV(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function LKe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xH(this,e),l=c.on,u=c.value[a]==null?s||=PKe(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function RKe(e,t,n){var r=(e+=``)==`transform`?MGe:iKe;return t==null?this.styleTween(e,NKe(e,r)).on(`end.style.`+e,PKe(e)):typeof t==`function`?this.styleTween(e,IKe(e,r,wH(this,`style.`+e,t))).each(LKe(this._id,e)):this.styleTween(e,FKe(e,r,t),n).on(`end.style.`+e,null)}function zKe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function BKe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&zKe(e,a,n)),r}return a._value=t,a}function VKe(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,BKe(e,t,n??``))}function HKe(e){return function(){this.textContent=e}}function UKe(e){return function(){this.textContent=e(this)??``}}function WKe(e){return this.tween(`text`,typeof e==`function`?UKe(wH(this,`text`,e)):HKe(e==null?``:e+``))}function GKe(e){return function(t){this.textContent=e.call(this,t)}}function KKe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&GKe(r)),t}return r._value=e,r}function qKe(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,KKe(e))}function AH(){for(var e=this._name,t=this._id,n=MH(),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=SH(c,t);yH(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new jH(r,this._parents,e,n)}function JKe(){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=xH(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 YKe=0;function jH(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function XKe(e){return MV().transition(e)}function MH(){return++YKe}var NH=MV.prototype;jH.prototype=XKe.prototype={constructor:jH,select:kKe,selectAll:AKe,selectChild:NH.selectChild,selectChildren:NH.selectChildren,filter:wKe,merge:OH,selection:MKe,transition:AH,call:NH.call,nodes:NH.nodes,node:NH.node,size:NH.size,empty:NH.empty,each:NH.each,on:kH,attr:uKe,attrTween:pKe,style:RKe,styleTween:VKe,text:WKe,textTween:qKe,remove:OKe,tween:rKe,delay:gKe,duration:yKe,ease:xKe,easeVarying:CKe,end:JKe,[Symbol.iterator]:NH[Symbol.iterator]};function ZKe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QKe={time:null,delay:0,duration:250,ease:ZKe};function $Ke(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function eqe(e){var t,n;e instanceof jH?(t=e._id,e=e._name):(t=MH(),(n=QKe).time=HGe(),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])&&yH(c,e,t,l,o,n||$Ke(c,t));return new jH(r,this._parents,e,t)}MV.prototype.interrupt=eKe,MV.prototype.transition=eqe;var PH=e=>()=>e;function tqe(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 FH(e,t,n){this.k=e,this.x=t,this.y=n}FH.prototype={constructor:FH,scale:function(e){return e===1?this:new FH(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new FH(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 IH=new FH(1,0,0);nqe.prototype=FH.prototype;function nqe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return IH;return e.__zoom}function rqe(e){e.stopImmediatePropagation()}function LH(e){e.preventDefault(),e.stopImmediatePropagation()}function RH(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function iqe(){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 aqe(){return this.__zoom||IH}function oqe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function sqe(){return navigator.maxTouchPoints||`ontouchstart`in this}function cqe(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 lqe(){var e=RH,t=iqe,n=cqe,r=oqe,i=sqe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=RGe,l=eV(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,aqe).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`,aqe),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(IH.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 FH(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 FH(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 FH(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=NV(this.that).datum();l.call(e,this.that,new tqe(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=PV(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)],CH(this),s.start();LH(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=NV(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=PV(t,i),l=t.clientX,u=t.clientY;KWe(t.view),rqe(t),a.mouse=[c,this.__zoom.invert(c)],CH(this),a.start();function d(e){if(LH(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]=PV(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),qWe(e.view,a.moved),LH(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=PV(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);LH(r),s>0?NV(this).transition().duration(s).call(x,d,c,r):NV(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(rqe(t),s=0;s<i;++s)c=r[s],l=PV(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)),CH(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(LH(e),s=0;s<a;++s)c=i[s],l=PV(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(rqe(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=PV(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=NV(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:PH(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:PH(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:PH(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:PH([[+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 uqe=b(),zH=(0,D.createContext)(null),BH=zH.Provider,VH={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?`target`:`source`} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,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.`},dqe=VH.error001();function HH(e,t){let n=(0,D.useContext)(zH);if(n===null)throw Error(dqe);return uUe(n,e,t)}var UH=()=>{let e=(0,D.useContext)(zH);if(e===null)throw Error(dqe);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},WH=e=>e.userSelectionActive?`none`:`all`;function fqe({position:e,children:t,className:n,style:r,...i}){let a=HH(WH),o=`${e}`.split(`-`);return D.createElement(`div`,{className:qB([`react-flow__panel`,n,...o]),style:{...r,pointerEvents:a},...i},t)}function pqe({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:D.createElement(fqe,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro`},D.createElement(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`},`React Flow`))}var mqe=(0,D.memo)(({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=(0,D.useRef)(null),[f,p]=(0,D.useState)({x:0,y:0,width:0,height:0}),m=qB([`react-flow__edge-textwrapper`,l]);return(0,D.useEffect)(()=>{if(d.current){let e=d.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n===void 0||!n?null:D.createElement(`g`,{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?`visible`:`hidden`,...u},i&&D.createElement(`rect`,{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),D.createElement(`text`,{className:`react-flow__edge-text`,y:f.height/2,dy:`0.3em`,ref:d,style:r},n),c)}),hqe=e=>({width:e.offsetWidth,height:e.offsetHeight}),GH=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),gqe=(e={x:0,y:0},t)=>({x:GH(e.x,t[0][0],t[1][0]),y:GH(e.y,t[0][1],t[1][1])}),KH=(e,t,n)=>e<t?GH(Math.abs(e-t),1,50)/50:e>n?-GH(Math.abs(e-n),1,50)/50:0,_qe=(e,t)=>[KH(e.x,35,t.width-35)*20,KH(e.y,35,t.height-35)*20],vqe=e=>e.getRootNode?.()||window?.document,qH=(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)}),JH=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yqe=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),YH=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),bqe=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},XH=e=>ZH(e.width)&&ZH(e.height)&&ZH(e.x)&&ZH(e.y),ZH=e=>!isNaN(e)&&isFinite(e),QH=Symbol.for(`internals`),xqe=[`Enter`,` `,`Escape`],Sqe=(e,t)=>{},Cqe=e=>`nativeEvent`in e;function wqe(e){let t=(Cqe(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return[`INPUT`,`SELECT`,`TEXTAREA`].includes(t?.nodeName)||t?.hasAttribute(`contenteditable`)||!!t?.closest(`.nokey`)}var Tqe=e=>`clientX`in e,$H=(e,t)=>{let n=Tqe(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)}},eU=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0,tU=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p=20})=>D.createElement(D.Fragment,null,D.createElement(`path`,{id:e,style:u,d:t,fill:`none`,className:`react-flow__edge-path`,markerEnd:d,markerStart:f}),p&&D.createElement(`path`,{d:t,fill:`none`,strokeOpacity:0,strokeWidth:p,className:`react-flow__edge-interaction`}),i&&ZH(n)&&ZH(r)?D.createElement(mqe,{x:n,y:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l}):null);tU.displayName=`BaseEdge`;function nU(e,t,n){return n===void 0?n:r=>{let i=t().edges.find(t=>t.id===e);i&&n(r,{...i})}}function Eqe({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 Dqe({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)]}var rU;(function(e){e.Strict=`strict`,e.Loose=`loose`})(rU||={});var iU;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(iU||={});var aU;(function(e){e.Partial=`partial`,e.Full=`full`})(aU||={});var oU;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(oU||={});var sU;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(sU||={});var cU;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(cU||={});function Oqe({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===cU.Left||e===cU.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function kqe({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top}){let[o,s]=Oqe({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Oqe({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Dqe({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]}var Aqe=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=cU.Bottom,targetPosition:a=cU.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=kqe({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a});return D.createElement(tU,{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})});Aqe.displayName=`SimpleBezierEdge`;var jqe={[cU.Left]:{x:-1,y:0},[cU.Right]:{x:1,y:0},[cU.Top]:{x:0,y:-1},[cU.Bottom]:{x:0,y:1}},Mqe=({source:e,sourcePosition:t=cU.Bottom,target:n})=>t===cU.Left||t===cU.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},Nqe=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Pqe({source:e,sourcePosition:t=cU.Bottom,target:n,targetPosition:r=cU.Top,center:i,offset:a}){let o=jqe[t],s=jqe[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=Mqe({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p=[],m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=Eqe({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function Fqe(e,t,n,r){let i=Math.min(Nqe(e,t)/2,Nqe(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 lU({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20}){let[u,d,f,p,m]=Pqe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l});return[u.reduce((e,t,n)=>{let r=``;return r=n>0&&n<u.length-1?Fqe(u[n-1],t,u[n+1],o):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),d,f,p,m]}var uU=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,sourcePosition:d=cU.Bottom,targetPosition:f=cU.Top,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=lU({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:h?.borderRadius,offset:h?.offset});return D.createElement(tU,{path:_,labelX:v,labelY:y,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:p,markerStart:m,interactionWidth:g})});uU.displayName=`SmoothStepEdge`;var Iqe=(0,D.memo)(e=>D.createElement(uU,{...e,pathOptions:(0,D.useMemo)(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Iqe.displayName=`StepEdge`;function Lqe({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Eqe({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Rqe=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})=>{let[m,h,g]=Lqe({sourceX:e,sourceY:t,targetX:n,targetY:r});return D.createElement(tU,{path:m,labelX:h,labelY:g,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})});Rqe.displayName=`StraightEdge`;function zqe(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Bqe({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case cU.Left:return[t-zqe(t-r,a),n];case cU.Right:return[t+zqe(r-t,a),n];case cU.Top:return[t,n-zqe(n-i,a)];case cU.Bottom:return[t,n+zqe(i-n,a)]}}function Vqe({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top,curvature:o=.25}){let[s,c]=Bqe({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Bqe({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Dqe({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]}var dU=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=cU.Bottom,targetPosition:a=cU.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=Vqe({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a,curvature:h?.curvature});return D.createElement(tU,{path:_,labelX:v,labelY:y,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:g})});dU.displayName=`BezierEdge`;var fU=(0,D.createContext)(null),Hqe=fU.Provider;fU.Consumer;var Uqe=()=>(0,D.useContext)(fU),Wqe=e=>`id`in e&&`source`in e&&`target`in e,Gqe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||``}-${n}${r||``}`,pU=(e,t)=>e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`,Kqe=(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)),qqe=(e,t)=>{if(!e.source||!e.target)return VH.error006(),t;let n;return n=Wqe(e)?{...e}:{...e,id:Gqe(e)},Kqe(n,t)?t:t.concat(n)},mU=({x:e,y:t},[n,r,i],a,[o,s])=>{let c={x:(e-n)/i,y:(t-r)/i};return a?{x:o*Math.round(c.x/o),y:s*Math.round(c.y/s)}:c},Jqe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),hU=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};let n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},Yqe=(e,t=[0,0])=>e.length===0?{x:0,y:0,width:0,height:0}:yqe(e.reduce((e,n)=>{let{x:r,y:i}=hU(n,t).positionAbsolute;return qH(e,JH({x:r,y:i,width:n.width||0,height:n.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Xqe=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{let c={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(e=>{let{width:t,height:n,selectable:r=!0,hidden:i=!1}=e;if(o&&!r||i)return!1;let{positionAbsolute:u}=hU(e,s),d=bqe(c,{x:u.x,y:u.y,width:t||0,height:n||0}),f=t===void 0||n===void 0||t===null||n===null,p=a&&d>0,m=(t||0)*(n||0);(f||p||d>=m||e.dragging)&&l.push(e)}),l},Zqe=(e,t)=>{let n=e.map(e=>e.id);return t.filter(e=>n.includes(e.source)||n.includes(e.target))},Qqe=(e,t,n,r,i,a=.1)=>{let o=t/(e.width*(1+a)),s=n/(e.height*(1+a)),c=GH(Math.min(o,s),r,i),l=e.x+e.width/2,u=e.y+e.height/2;return{x:t/2-l*c,y:n/2-u*c,zoom:c}},gU=(e,t=0)=>e.transition().duration(t);function $qe(e,t,n,r){return(t[n]||[]).reduce((t,i)=>(`${e.id}-${i.id}-${n}`!==r&&t.push({id:i.id||null,type:n,nodeId:e.id,x:(e.positionAbsolute?.x??0)+i.x+i.width/2,y:(e.positionAbsolute?.y??0)+i.y+i.height/2}),t),[])}function _U(e,t,n,r,i,a){let{x:o,y:s}=$H(e),c=t.elementsFromPoint(o,s).find(e=>e.classList.contains(`react-flow__handle`));if(c){let e=c.getAttribute(`data-nodeid`);if(e){let t=iJe(void 0,c),r=c.getAttribute(`data-handleid`),o=a({nodeId:e,id:r,type:t});if(o){let a=i.find(n=>n.nodeId===e&&n.type===t&&n.id===r);return{handle:{id:r,type:t,nodeId:e,x:a?.x||n.x,y:a?.y||n.y},validHandleResult:o}}}}let l=[],u=1/0;if(i.forEach(e=>{let t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=r){let n=a(e);t<=u&&(t<u?l=[{handle:e,validHandleResult:n}]:t===u&&l.push({handle:e,validHandleResult:n}),u=t)}}),!l.length)return{handle:null,validHandleResult:tJe()};if(l.length===1)return l[0];let d=l.some(({validHandleResult:e})=>e.isValid),f=l.some(({handle:e})=>e.type===`target`);return l.find(({handle:e,validHandleResult:t})=>f?e.type===`target`:d?t.isValid:!0)||l[0]}var eJe={source:null,target:null,sourceHandle:null,targetHandle:null},tJe=()=>({handleDomNode:null,isValid:!1,connection:eJe,endHandle:null});function nJe(e,t,n,r,i,a,o){let s=i===`target`,c=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tJe(),handleDomNode:c};if(c){let e=iJe(void 0,c),i=c.getAttribute(`data-nodeid`),o=c.getAttribute(`data-handleid`),u=c.classList.contains(`connectable`),d=c.classList.contains(`connectableend`),f={source:s?i:n,sourceHandle:s?o:r,target:s?n:i,targetHandle:s?r:o};l.connection=f,u&&d&&(t===rU.Strict?s&&e===`source`||!s&&e===`target`:i!==n||o!==r)&&(l.endHandle={nodeId:i,handleId:o,type:e},l.isValid=a(f))}return l}function rJe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((e,i)=>{if(i[QH]){let{handleBounds:a}=i[QH],o=[],s=[];a&&(o=$qe(i,a,`source`,`${t}-${n}-${r}`),s=$qe(i,a,`target`,`${t}-${n}-${r}`)),e.push(...o,...s)}return e},[])}function iJe(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function vU(e){e?.classList.remove(`valid`,`connecting`,`react-flow__handle-valid`,`react-flow__handle-connecting`)}function aJe(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function oJe({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:c,onReconnectEnd:l}){let u=vqe(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:p,connectionRadius:m,onConnectStart:h,panBy:g,getNodes:_,cancelConnection:v}=a(),y=0,b,{x,y:S}=$H(e),C=u?.elementFromPoint(x,S),w=iJe(c,C),T=f?.getBoundingClientRect();if(!T||!w)return;let E,D=$H(e,T),O=!1,k=null,ee=!1,te=null,ne=rJe({nodes:_(),nodeId:n,handleId:t,handleType:w}),re=()=>{if(!p)return;let[e,t]=_qe(D,T);g({x:e,y:t}),y=requestAnimationFrame(re)};o({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:w,connectionStartHandle:{nodeId:n,handleId:t,type:w},connectionEndHandle:null}),h?.(e,{nodeId:n,handleId:t,handleType:w});function ie(e){let{transform:r}=a();D=$H(e,T);let{handle:c,validHandleResult:l}=_U(e,u,mU(D,r,!1,[1,1]),m,ne,e=>nJe(e,d,n,t,i?`target`:`source`,s,u));if(b=c,O||=(re(),!0),te=l.handleDomNode,k=l.connection,ee=l.isValid,o({connectionPosition:b&&ee?Jqe({x:b.x,y:b.y},r):D,connectionStatus:aJe(!!b,ee),connectionEndHandle:l.endHandle}),!b&&!ee&&!te)return vU(E);k.source!==k.target&&te&&(vU(E),E=te,te.classList.add(`connecting`,`react-flow__handle-connecting`),te.classList.toggle(`valid`,ee),te.classList.toggle(`react-flow__handle-valid`,ee))}function ae(e){(b||te)&&k&&ee&&r?.(k),a().onConnectEnd?.(e),c&&l?.(e),vU(E),v(),cancelAnimationFrame(y),O=!1,ee=!1,k=null,te=null,u.removeEventListener(`mousemove`,ie),u.removeEventListener(`mouseup`,ae),u.removeEventListener(`touchmove`,ie),u.removeEventListener(`touchend`,ae)}u.addEventListener(`mousemove`,ie),u.addEventListener(`mouseup`,ae),u.addEventListener(`touchmove`,ie),u.addEventListener(`touchend`,ae)}var yU=()=>!0,sJe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),cJe=(e,t,n)=>r=>{let{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=r;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===n||a?.nodeId===e&&a?.handleId===t&&a?.type===n,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===n}},lJe=(0,D.forwardRef)(({type:e=`source`,position:t=cU.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=UH(),_=Uqe(),{connectOnClick:v,noPanClassName:y}=HH(sJe,XB),{connecting:b,clickConnecting:x}=HH(cJe(_,m,e),XB);_||g.getState().onError?.(`010`,VH.error010());let S=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(qqe(i,e))}n?.(i),s?.(i)},C=e=>{if(!_)return;let t=Tqe(e);i&&(t&&e.button===0||!t)&&oJe({event:e,handleId:m,nodeId:_,onConnect:S,isTarget:h,getState:g.getState,setState:g.setState,isValidConnection:n||g.getState().isValidConnection||yU}),t?u?.(e):d?.(e)},w=t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:m}});return}let l=vqe(t.target),u=n||c||yU,{connection:d,isValid:f}=nJe({nodeId:_,id:m,type:e},s,o.nodeId,o.handleId||null,o.type,u,l);f&&S(d),a?.(t),g.setState({connectionClickStartHandle:null})};return D.createElement(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${m}-${e}`,className:qB([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,connecting:x,connectionindicator:r&&(i&&!b||a&&b)}]),onMouseDown:C,onTouchStart:C,onClick:v?w:void 0,ref:p,...f},c)});lJe.displayName=`Handle`;var bU=(0,D.memo)(lJe),uJe=({data:e,isConnectable:t,targetPosition:n=cU.Top,sourcePosition:r=cU.Bottom})=>D.createElement(D.Fragment,null,D.createElement(bU,{type:`target`,position:n,isConnectable:t}),e?.label,D.createElement(bU,{type:`source`,position:r,isConnectable:t}));uJe.displayName=`DefaultNode`;var dJe=(0,D.memo)(uJe),fJe=({data:e,isConnectable:t,sourcePosition:n=cU.Bottom})=>D.createElement(D.Fragment,null,e?.label,D.createElement(bU,{type:`source`,position:n,isConnectable:t}));fJe.displayName=`InputNode`;var pJe=(0,D.memo)(fJe),mJe=({data:e,isConnectable:t,targetPosition:n=cU.Top})=>D.createElement(D.Fragment,null,D.createElement(bU,{type:`target`,position:n,isConnectable:t}),e?.label);mJe.displayName=`OutputNode`;var hJe=(0,D.memo)(mJe),gJe=()=>null;gJe.displayName=`GroupNode`;var _Je=e=>({selectedNodes:e.getNodes().filter(e=>e.selected),selectedEdges:e.edges.filter(e=>e.selected).map(e=>({...e}))}),xU=e=>e.id;function SU(e,t){return XB(e.selectedNodes.map(xU),t.selectedNodes.map(xU))&&XB(e.selectedEdges.map(xU),t.selectedEdges.map(xU))}var vJe=(0,D.memo)(({onSelectionChange:e})=>{let t=UH(),{selectedNodes:n,selectedEdges:r}=HH(_Je,SU);return(0,D.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChange.forEach(e=>e(i))},[n,r,e]),null});vJe.displayName=`SelectionListener`;var yJe=e=>!!e.onSelectionChange;function bJe({onSelectionChange:e}){let t=HH(yJe);return e||t?D.createElement(vJe,{onSelectionChange:e}):null}var xJe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function CU(e,t){(0,D.useEffect)(()=>{e!==void 0&&t(e)},[e])}function wU(e,t,n){(0,D.useEffect)(()=>{t!==void 0&&n({[e]:t})},[t])}var SJe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:c,nodesDraggable:l,nodesConnectable:u,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:m,minZoom:h,maxZoom:g,nodeExtent:_,onNodesChange:v,onEdgesChange:y,elementsSelectable:b,connectionMode:x,snapGrid:S,snapToGrid:C,translateExtent:w,connectOnClick:T,defaultEdgeOptions:E,fitView:O,fitViewOptions:k,onNodesDelete:ee,onEdgesDelete:te,onNodeDrag:ne,onNodeDragStart:re,onNodeDragStop:ie,onSelectionDrag:ae,onSelectionDragStart:oe,onSelectionDragStop:se,noPanClassName:ce,nodeOrigin:le,rfId:ue,autoPanOnConnect:de,autoPanOnNodeDrag:fe,onError:pe,connectionRadius:me,isValidConnection:he,nodeDragThreshold:ge})=>{let{setNodes:_e,setEdges:ve,setDefaultNodesAndEdges:ye,setMinZoom:be,setMaxZoom:xe,setTranslateExtent:Se,setNodeExtent:Ce,reset:we}=HH(xJe,XB),Te=UH();return(0,D.useEffect)(()=>{let e=r?.map(e=>({...e,...E}));return ye(n,e),()=>{we()}},[]),wU(`defaultEdgeOptions`,E,Te.setState),wU(`connectionMode`,x,Te.setState),wU(`onConnect`,i,Te.setState),wU(`onConnectStart`,a,Te.setState),wU(`onConnectEnd`,o,Te.setState),wU(`onClickConnectStart`,s,Te.setState),wU(`onClickConnectEnd`,c,Te.setState),wU(`nodesDraggable`,l,Te.setState),wU(`nodesConnectable`,u,Te.setState),wU(`nodesFocusable`,d,Te.setState),wU(`edgesFocusable`,f,Te.setState),wU(`edgesUpdatable`,p,Te.setState),wU(`elementsSelectable`,b,Te.setState),wU(`elevateNodesOnSelect`,m,Te.setState),wU(`snapToGrid`,C,Te.setState),wU(`snapGrid`,S,Te.setState),wU(`onNodesChange`,v,Te.setState),wU(`onEdgesChange`,y,Te.setState),wU(`connectOnClick`,T,Te.setState),wU(`fitViewOnInit`,O,Te.setState),wU(`fitViewOnInitOptions`,k,Te.setState),wU(`onNodesDelete`,ee,Te.setState),wU(`onEdgesDelete`,te,Te.setState),wU(`onNodeDrag`,ne,Te.setState),wU(`onNodeDragStart`,re,Te.setState),wU(`onNodeDragStop`,ie,Te.setState),wU(`onSelectionDrag`,ae,Te.setState),wU(`onSelectionDragStart`,oe,Te.setState),wU(`onSelectionDragStop`,se,Te.setState),wU(`noPanClassName`,ce,Te.setState),wU(`nodeOrigin`,le,Te.setState),wU(`rfId`,ue,Te.setState),wU(`autoPanOnConnect`,de,Te.setState),wU(`autoPanOnNodeDrag`,fe,Te.setState),wU(`onError`,pe,Te.setState),wU(`connectionRadius`,me,Te.setState),wU(`isValidConnection`,he,Te.setState),wU(`nodeDragThreshold`,ge,Te.setState),CU(e,_e),CU(t,ve),CU(h,be),CU(g,xe),CU(w,Se),CU(_,Ce),null},CJe={display:`none`},wJe={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},TJe=`react-flow__node-desc`,TU=`react-flow__edge-desc`,EJe=`react-flow__aria-live`,EU=e=>e.ariaLiveMessage;function DJe({rfId:e}){let t=HH(EU);return D.createElement(`div`,{id:`${EJe}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:wJe},t)}function OJe({rfId:e,disableKeyboardA11y:t}){return D.createElement(D.Fragment,null,D.createElement(`div`,{id:`${TJe}-${e}`,style:CJe},`Press enter or space to select a node.`,!t&&`You can then use the arrow keys to move the node around.`,` Press delete to remove it and escape to cancel.`,` `),D.createElement(`div`,{id:`${TU}-${e}`,style:CJe},`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`),!t&&D.createElement(DJe,{rfId:e}))}var DU=(e=null,t={actInsideInputWithModifier:!0})=>{let[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(!1),a=(0,D.useRef)(new Set([])),[o,s]=(0,D.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.split(`+`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,D.useEffect)(()=>{let n=typeof document<`u`?document:null,c=t?.target||n;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&wqe(e))return!1;let n=kU(e.code,s);a.current.add(e[n]),OU(o,a.current,!1)&&(e.preventDefault(),r(!0))},n=e=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&wqe(e))return!1;let n=kU(e.code,s);OU(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[n]),e.key===`Meta`&&a.current.clear(),i.current=!1},l=()=>{a.current.clear(),r(!1)};return c?.addEventListener(`keydown`,e),c?.addEventListener(`keyup`,n),window.addEventListener(`blur`,l),()=>{c?.removeEventListener(`keydown`,e),c?.removeEventListener(`keyup`,n),window.removeEventListener(`blur`,l)}}},[e,r]),n};function OU(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function kU(e,t){return t.includes(e)?`code`:`key`}function kJe(e,t,n,r){let i=e.parentNode||e.parentId;if(!i)return n;let a=t.get(i),o=hU(a,r);return kJe(a,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(a[QH]?.z??0)>(n.z??0)?a[QH]?.z??0:n.z??0},r)}function AJe(e,t,n){e.forEach(r=>{let i=r.parentNode||r.parentId;if(i&&!e.has(i))throw Error(`Parent node ${i} not found`);if(i||n?.[r.id]){let{x:i,y:a,z:o}=kJe(r,e,{...r.position,z:r[QH]?.z??0},t);r.positionAbsolute={x:i,y:a},r[QH].z=o,n?.[r.id]&&(r[QH].isParent=!0)}})}function jJe(e,t,n,r){let i=new Map,a={},o=r?1e3:0;return e.forEach(e=>{let n=(ZH(e.zIndex)?e.zIndex:0)+(e.selected?o:0),r=t.get(e.id),s={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);let l=r?.type&&r?.type!==e.type;Object.defineProperty(s,QH,{enumerable:!1,value:{handleBounds:l?void 0:r?.[QH]?.handleBounds,z:n}}),i.set(e.id,s)}),AJe(i,n,a),i}function MJe(e,t={}){let{getNodes:n,width:r,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:c,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:d}=e(),f=t.initial&&!l&&u;if(s&&c&&(f||!t.initial)){let e=n().filter(e=>{let n=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return t.nodes?.length?n&&t.nodes.some(t=>t.id===e.id):n}),l=e.every(e=>e.width&&e.height);if(e.length>0&&l){let{x:n,y:l,zoom:u}=Qqe(Yqe(e,d),r,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),f=IH.translate(n,l).scale(u);return typeof t.duration==`number`&&t.duration>0?s.transform(gU(c,t.duration),f):s.transform(c,f),!0}}return!1}function AU(e,t){return e.forEach(e=>{let n=t.get(e.id);n&&t.set(n.id,{...n,[QH]:n[QH],selected:e.selected})}),new Map(t)}function NJe(e,t){return t.map(t=>{let n=e.find(e=>e.id===t.id);return n&&(t.selected=n.selected),t})}function jU({changedNodes:e,changedEdges:t,get:n,set:r}){let{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:c,hasDefaultEdges:l}=n();e?.length&&(c&&r({nodeInternals:AU(e,i)}),o?.(e)),t?.length&&(l&&r({edges:NJe(t,a)}),s?.(t))}var MU=()=>{},NU={zoomIn:MU,zoomOut:MU,zoomTo:MU,getZoom:()=>1,setViewport:MU,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:MU,fitBounds:MU,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},PJe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),FJe=()=>{let e=UH(),{d3Zoom:t,d3Selection:n}=HH(PJe,XB);return(0,D.useMemo)(()=>n&&t?{zoomIn:e=>t.scaleBy(gU(n,e?.duration),1.2),zoomOut:e=>t.scaleBy(gU(n,e?.duration),1/1.2),zoomTo:(e,r)=>t.scaleTo(gU(n,r?.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(r,i)=>{let[a,o,s]=e.getState().transform,c=IH.translate(r.x??a,r.y??o).scale(r.zoom??s);t.transform(gU(n,i?.duration),c)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>MJe(e.getState,t),setCenter:(r,i,a)=>{let{width:o,height:s,maxZoom:c}=e.getState(),l=a?.zoom===void 0?c:a.zoom,u=o/2-r*l,d=s/2-i*l,f=IH.translate(u,d).scale(l);t.transform(gU(n,a?.duration),f)},fitBounds:(r,i)=>{let{width:a,height:o,minZoom:s,maxZoom:c}=e.getState(),{x:l,y:u,zoom:d}=Qqe(r,a,o,s,c,i?.padding??.1),f=IH.translate(l,u).scale(d);t.transform(gU(n,i?.duration),f)},project:t=>{let{transform:n,snapToGrid:r,snapGrid:i}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),mU(t,n,r,i)},screenToFlowPosition:t=>{let{transform:n,snapToGrid:r,snapGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:o,y:s}=a.getBoundingClientRect();return mU({x:t.x-o,y:t.y-s},n,r,i)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=Jqe(t,n);return{x:o.x+i,y:o.y+a}},viewportInitialized:!0}:NU,[t,n])};function PU(){let e=FJe(),t=UH(),n=(0,D.useCallback)(()=>t.getState().getNodes().map(e=>({...e})),[]),r=(0,D.useCallback)(e=>t.getState().nodeInternals.get(e),[]),i=(0,D.useCallback)(()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},[]),a=(0,D.useCallback)(e=>{let{edges:n=[]}=t.getState();return n.find(t=>t.id===e)},[]),o=(0,D.useCallback)(e=>{let{getNodes:n,setNodes:r,hasDefaultNodes:i,onNodesChange:a}=t.getState(),o=n(),s=typeof e==`function`?e(o):e;i?r(s):a&&a(s.length===0?o.map(e=>({type:`remove`,id:e.id})):s.map(e=>({item:e,type:`reset`})))},[]),s=(0,D.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a}=t.getState(),o=typeof e==`function`?e(n):e;i?r(o):a&&a(o.length===0?n.map(e=>({type:`remove`,id:e.id})):o.map(e=>({item:e,type:`reset`})))},[]),c=(0,D.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{getNodes:r,setNodes:i,hasDefaultNodes:a,onNodesChange:o}=t.getState();a?i([...r(),...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),l=(0,D.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{edges:r=[],setEdges:i,hasDefaultEdges:a,onEdgesChange:o}=t.getState();a?i([...r,...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),u=(0,D.useCallback)(()=>{let{getNodes: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}}},[]),d=(0,D.useCallback)(({nodes:e,edges:n})=>{let{nodeInternals:r,getNodes:i,edges:a,hasDefaultNodes:o,hasDefaultEdges:s,onNodesDelete:c,onEdgesDelete:l,onNodesChange:u,onEdgesChange:d}=t.getState(),f=(e||[]).map(e=>e.id),p=(n||[]).map(e=>e.id),m=i().reduce((e,t)=>{let n=t.parentNode||t.parentId,r=!f.includes(t.id)&&n&&e.find(e=>e.id===n);return(typeof t.deletable!=`boolean`||t.deletable)&&(f.includes(t.id)||r)&&e.push(t),e},[]),h=a.filter(e=>typeof e.deletable==`boolean`?e.deletable:!0),g=h.filter(e=>p.includes(e.id));if(m||g){let e=Zqe(m,h),n=[...g,...e],i=n.reduce((e,t)=>(e.includes(t.id)||e.push(t.id),e),[]);(s||o)&&(s&&t.setState({edges:a.filter(e=>!i.includes(e.id))}),o&&(m.forEach(e=>{r.delete(e.id)}),t.setState({nodeInternals:new Map(r)}))),i.length>0&&(l?.(n),d&&d(i.map(e=>({id:e,type:`remove`})))),m.length>0&&(c?.(m),u&&u(m.map(e=>({id:e.id,type:`remove`}))))}},[]),f=(0,D.useCallback)(e=>{let n=XH(e),r=n?null:t.getState().nodeInternals.get(e.id);return!n&&!r?[null,null,n]:[n?e:YH(r),r,n]},[]),p=(0,D.useCallback)((e,n=!0,r)=>{let[i,a,o]=f(e);return i?(r||t.getState().getNodes()).filter(e=>{if(!o&&(e.id===a.id||!e.positionAbsolute))return!1;let t=bqe(YH(e),i);return n&&t>0||t>=i.width*i.height}):[]},[]),m=(0,D.useCallback)((e,t,n=!0)=>{let[r]=f(e);if(!r)return!1;let i=bqe(r,t);return n&&i>0||i>=r.width*r.height},[]);return(0,D.useMemo)(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:c,addEdges:l,toObject:u,deleteElements:d,getIntersectingNodes:p,isNodeIntersecting:m}),[e,n,r,i,a,o,s,c,l,u,d,p,m])}var IJe={actInsideInputWithModifier:!1},LJe=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{let n=UH(),{deleteElements:r}=PU(),i=DU(e,IJe),a=DU(t);(0,D.useEffect)(()=>{if(i){let{edges:e,getNodes:t}=n.getState();r({nodes:t().filter(e=>e.selected),edges:e.filter(e=>e.selected)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,D.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])};function RJe(e){let t=UH();(0,D.useEffect)(()=>{let n,r=()=>{if(!e.current)return;let n=hqe(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,VH.error004()),t.setState({width:n.width||500,height:n.height||500})};return r(),window.addEventListener(`resize`,r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener(`resize`,r),n&&e.current&&n.unobserve(e.current)}},[])}var FU={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},zJe=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,BJe=e=>({x:e.x,y:e.y,zoom:e.k}),IU=(e,t)=>e.target.closest(`.${t}`),VJe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),HJe=e=>{let t=e.ctrlKey&&eU()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},UJe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),WJe=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:c=iU.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:d=!0,defaultViewport:f,translateExtent:p,minZoom:m,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:_=!0,children:v,noWheelClassName:y,noPanClassName:b})=>{let x=(0,D.useRef)(),S=UH(),C=(0,D.useRef)(!1),w=(0,D.useRef)(!1),T=(0,D.useRef)(null),E=(0,D.useRef)({x:0,y:0,zoom:0}),{d3Zoom:O,d3Selection:k,d3ZoomHandler:ee,userSelectionActive:te}=HH(UJe,XB),ne=DU(g),re=(0,D.useRef)(0),ie=(0,D.useRef)(!1),ae=(0,D.useRef)();return RJe(T),(0,D.useEffect)(()=>{if(T.current){let e=T.current.getBoundingClientRect(),t=lqe().scaleExtent([m,h]).translateExtent(p),n=NV(T.current).call(t),r=IH.translate(f.x,f.y).scale(GH(f.zoom,m,h)),i=[[0,0],[e.width,e.height]],a=t.constrain()(r,i,p);t.transform(n,a),t.wheelDelta(HJe),S.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on(`wheel.zoom`),transform:[a.x,a.y,a.k],domNode:T.current.closest(`.react-flow`)})}},[]),(0,D.useEffect)(()=>{k&&O&&(o&&!ne&&!te?k.on(`wheel.zoom`,r=>{if(IU(r,y))return!1;r.preventDefault(),r.stopImmediatePropagation();let i=k.property(`__zoom`).k||1;if(r.ctrlKey&&a){let e=PV(r),t=i*2**HJe(r);O.scaleTo(k,t,e,r);return}let o=r.deltaMode===1?20:1,l=c===iU.Vertical?0:r.deltaX*o,u=c===iU.Horizontal?0:r.deltaY*o;!eU()&&r.shiftKey&&c!==iU.Vertical&&(l=r.deltaY*o,u=0),O.translateBy(k,-(l/i)*s,-(u/i)*s,{internal:!0});let d=BJe(k.property(`__zoom`)),{onViewportChangeStart:f,onViewportChange:p,onViewportChangeEnd:m}=S.getState();clearTimeout(ae.current),ie.current||(ie.current=!0,t?.(r,d),f?.(d)),ie.current&&(e?.(r,d),p?.(d),ae.current=setTimeout(()=>{n?.(r,d),m?.(d),ie.current=!1},150))},{passive:!1}):ee!==void 0&&k.on(`wheel.zoom`,function(e,t){if(!_&&e.type===`wheel`&&!e.ctrlKey||IU(e,y))return null;e.preventDefault(),ee.call(this,e,t)},{passive:!1}))},[te,o,c,k,O,ee,ne,a,_,y,t,e,n]),(0,D.useEffect)(()=>{O&&O.on(`start`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;re.current=e.sourceEvent?.button;let{onViewportChangeStart:n}=S.getState(),r=BJe(e.transform);C.current=!0,E.current=r,e.sourceEvent?.type===`mousedown`&&S.setState({paneDragging:!0}),n?.(r),t?.(e.sourceEvent,r)})},[O,t]),(0,D.useEffect)(()=>{O&&(te&&!C.current?O.on(`zoom`,null):te||O.on(`zoom`,t=>{let{onViewportChange:n}=S.getState();if(S.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),w.current=!!(r&&VJe(d,re.current??0)),(e||n)&&!t.sourceEvent?.internal){let r=BJe(t.transform);n?.(r),e?.(t.sourceEvent,r)}}))},[te,O,e,d,r]),(0,D.useEffect)(()=>{O&&O.on(`end`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;let{onViewportChangeEnd:t}=S.getState();if(C.current=!1,S.setState({paneDragging:!1}),r&&VJe(d,re.current??0)&&!w.current&&r(e.sourceEvent),w.current=!1,(n||t)&&zJe(E.current,e.transform)){let r=BJe(e.transform);E.current=r,clearTimeout(x.current),x.current=setTimeout(()=>{t?.(r),n?.(e.sourceEvent,r)},o?150:0)}})},[O,o,d,n,r]),(0,D.useEffect)(()=>{O&&O.filter(e=>{let t=ne||i,n=a&&e.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&e.button===1&&e.type===`mousedown`&&(IU(e,`react-flow__node`)||IU(e,`react-flow__edge`)))return!0;if(!d&&!t&&!o&&!l&&!a||te||!l&&e.type===`dblclick`||IU(e,y)&&e.type===`wheel`||IU(e,b)&&(e.type!==`wheel`||o&&e.type===`wheel`&&!ne)||!a&&e.ctrlKey&&e.type===`wheel`||!t&&!o&&!n&&e.type===`wheel`||!d&&(e.type===`mousedown`||e.type===`touchstart`)||Array.isArray(d)&&!d.includes(e.button)&&e.type===`mousedown`)return!1;let r=Array.isArray(d)&&d.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||e.type===`wheel`)&&r})},[te,O,i,a,o,l,d,u,ne]),D.createElement(`div`,{className:`react-flow__renderer`,ref:T,style:FU},v)},GJe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function KJe(){let{userSelectionActive:e,userSelectionRect:t}=HH(GJe,XB);return e&&t?D.createElement(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function qJe(e,t){let n=t.parentNode||t.parentId,r=e.find(e=>e.id===n);if(r){let e=t.position.x+t.width-r.width,n=t.position.y+t.height-r.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,e>0&&(r.style.width+=e),n>0&&(r.style.height+=n),t.position.x<0){let e=Math.abs(t.position.x);r.position.x=r.position.x-e,r.style.width+=e,t.position.x=0}if(t.position.y<0){let e=Math.abs(t.position.y);r.position.y=r.position.y-e,r.style.height+=e,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function JJe(e,t){if(e.some(e=>e.type===`reset`))return e.filter(e=>e.type===`reset`).map(e=>e.item);let n=e.filter(e=>e.type===`add`).map(e=>e.item);return t.reduce((t,n)=>{let r=e.filter(e=>e.id===n.id);if(r.length===0)return t.push(n),t;let i={...n};for(let e of r)if(e)switch(e.type){case`select`:i.selected=e.selected;break;case`position`:e.position!==void 0&&(i.position=e.position),e.positionAbsolute!==void 0&&(i.positionAbsolute=e.positionAbsolute),e.dragging!==void 0&&(i.dragging=e.dragging),i.expandParent&&qJe(t,i);break;case`dimensions`:e.dimensions!==void 0&&(i.width=e.dimensions.width,i.height=e.dimensions.height),e.updateStyle!==void 0&&(i.style={...i.style||{},...e.dimensions}),typeof e.resizing==`boolean`&&(i.resizing=e.resizing),i.expandParent&&qJe(t,i);break;case`remove`:return t}return t.push(i),t},n)}function YJe(e,t){return JJe(e,t)}function XJe(e,t){return JJe(e,t)}var LU=(e,t)=>({id:e,type:`select`,selected:t});function RU(e,t){return e.reduce((e,n)=>{let r=t.includes(n.id);return!n.selected&&r?(n.selected=!0,e.push(LU(n.id,!0))):n.selected&&!r&&(n.selected=!1,e.push(LU(n.id,!1))),e},[])}var Y=(e,t)=>n=>{n.target===t.current&&e?.(n)},zU=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),ZJe=(0,D.memo)(({isSelecting:e,selectionMode:t=aU.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:c,onPaneMouseMove:l,onPaneMouseLeave:u,children:d})=>{let f=(0,D.useRef)(null),p=UH(),m=(0,D.useRef)(0),h=(0,D.useRef)(0),g=(0,D.useRef)(),{userSelectionActive:_,elementsSelectable:v,dragging:y}=HH(zU,XB),b=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,h.current=0},x=e=>{a?.(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},S=e=>{if(Array.isArray(n)&&n?.includes(2)){e.preventDefault();return}o?.(e)},C=s?e=>s(e):void 0,w=t=>{let{resetSelectedElements:n,domNode:i}=p.getState();if(g.current=i?.getBoundingClientRect(),!v||!e||t.button!==0||t.target!==f.current||!g.current)return;let{x:a,y:o}=$H(t,g.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:o,x:a,y:o}}),r?.(t)},T=n=>{let{userSelectionRect:r,nodeInternals:i,edges:a,transform:o,onNodesChange:s,onEdgesChange:c,nodeOrigin:l,getNodes:u}=p.getState();if(!e||!g.current||!r)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});let d=$H(n,g.current),f=r.startX??0,_=r.startY??0,v={...r,x:d.x<f?d.x:f,y:d.y<_?d.y:_,width:Math.abs(d.x-f),height:Math.abs(d.y-_)},y=u(),b=Xqe(i,v,o,t===aU.Partial,!0,l),x=Zqe(b,a).map(e=>e.id),S=b.map(e=>e.id);if(m.current!==S.length){m.current=S.length;let e=RU(y,S);e.length&&s?.(e)}if(h.current!==x.length){h.current=x.length;let e=RU(a,x);e.length&&c?.(e)}p.setState({userSelectionRect:v})},E=e=>{if(e.button!==0)return;let{userSelectionRect:t}=p.getState();!_&&t&&e.target===f.current&&x?.(e),p.setState({nodesSelectionActive:m.current>0}),b(),i?.(e)},O=e=>{_&&(p.setState({nodesSelectionActive:m.current>0}),i?.(e)),b()},k=v&&(e||_);return D.createElement(`div`,{className:qB([`react-flow__pane`,{dragging:y,selection:e}]),onClick:k?void 0:Y(x,f),onContextMenu:Y(S,f),onWheel:Y(C,f),onMouseEnter:k?void 0:c,onMouseDown:k?w:void 0,onMouseMove:k?T:l,onMouseUp:k?E:void 0,onMouseLeave:k?O:u,ref:f,style:FU},d,D.createElement(KJe,null))});ZJe.displayName=`Pane`;function QJe(e,t){let n=e.parentNode||e.parentId;if(!n)return!1;let r=t.get(n);return r?r.selected?!0:QJe(r,t):!1}function $Je(e,t,n){let r=e;do{if(r?.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function BU(e,t,n,r){return Array.from(e.values()).filter(n=>(n.selected||n.id===r)&&(!n.parentNode||n.parentId||!QJe(n,e))&&(n.draggable||t&&n.draggable===void 0)).map(e=>({id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-(e.positionAbsolute?.x??0),y:n.y-(e.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}))}function VU(e,t){return!t||t===`parent`?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function eYe(e,t,n,r,i=[0,0],a){let o=VU(e,e.extent||r),s=o,c=e.parentNode||e.parentId;if(e.extent===`parent`&&!e.expandParent)if(c&&e.width&&e.height){let t=n.get(c),{x:r,y:a}=hU(t,i).positionAbsolute;s=t&&ZH(r)&&ZH(a)&&ZH(t.width)&&ZH(t.height)?[[r+e.width*i[0],a+e.height*i[1]],[r+t.width-e.width+e.width*i[0],a+t.height-e.height+e.height*i[1]]]:s}else a?.(`005`,VH.error005()),s=o;else if(e.extent&&c&&e.extent!==`parent`){let{x:t,y:r}=hU(n.get(c),i).positionAbsolute;s=[[e.extent[0][0]+t,e.extent[0][1]+r],[e.extent[1][0]+t,e.extent[1][1]+r]]}let l={x:0,y:0};c&&(l=hU(n.get(c),i).positionAbsolute);let u=s&&s!==`parent`?gqe(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function tYe({nodeId:e,dragItems:t,nodeInternals:n}){let r=t.map(e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute}));return[e?r.find(t=>t.id===e):r[0],r]}var HU=(e,t,n,r)=>{let i=t.querySelectorAll(e);if(!i||!i.length)return null;let a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*r[0],y:o.height*r[1]};return a.map(e=>{let t=e.getBoundingClientRect();return{id:e.getAttribute(`data-handleid`),position:e.getAttribute(`data-handlepos`),x:(t.left-o.left-s.x)/n,y:(t.top-o.top-s.y)/n,...hqe(e)}})};function UU(e,t,n){return n===void 0?n:r=>{let i=t().nodeInternals.get(e);i&&n(r,{...i})}}function WU({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,VH.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function nYe(){let e=UH();return(0,D.useCallback)(({sourceEvent:t})=>{let{transform:n,snapGrid:r,snapToGrid:i}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,s={x:(a-n[0])/n[2],y:(o-n[1])/n[2]};return{xSnapped:i?r[0]*Math.round(s.x/r[0]):s.x,ySnapped:i?r[1]*Math.round(s.y/r[1]):s.y,...s}},[])}function GU(e){return(t,n,r)=>e?.(t,r)}function rYe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){let s=UH(),[c,l]=(0,D.useState)(!1),u=(0,D.useRef)([]),d=(0,D.useRef)({x:null,y:null}),f=(0,D.useRef)(0),p=(0,D.useRef)(null),m=(0,D.useRef)({x:0,y:0}),h=(0,D.useRef)(null),g=(0,D.useRef)(!1),_=(0,D.useRef)(!1),v=(0,D.useRef)(!1),y=nYe();return(0,D.useEffect)(()=>{if(e?.current){let c=NV(e.current),b=({x:e,y:t})=>{let{nodeInternals:n,onNodeDrag:r,onSelectionDrag:a,updateNodePositions:o,nodeExtent:c,snapGrid:f,snapToGrid:p,nodeOrigin:m,onError:g}=s.getState();d.current={x:e,y:t};let _=!1,v={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&c&&(v=JH(Yqe(u.current,m))),u.current=u.current.map(r=>{let i={x:e-r.distance.x,y:t-r.distance.y};p&&(i.x=f[0]*Math.round(i.x/f[0]),i.y=f[1]*Math.round(i.y/f[1]));let a=[[c[0][0],c[0][1]],[c[1][0],c[1][1]]];u.current.length>1&&c&&!r.extent&&(a[0][0]=r.positionAbsolute.x-v.x+c[0][0],a[1][0]=r.positionAbsolute.x+(r.width??0)-v.x2+c[1][0],a[0][1]=r.positionAbsolute.y-v.y+c[0][1],a[1][1]=r.positionAbsolute.y+(r.height??0)-v.y2+c[1][1]);let o=eYe(r,i,n,a,m,g);return _=_||r.position.x!==o.position.x||r.position.y!==o.position.y,r.position=o.position,r.positionAbsolute=o.positionAbsolute,r}),!_)return;o(u.current,!0,!0),l(!0);let y=i?r:GU(a);if(y&&h.current){let[e,t]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});y(h.current,e,t)}},x=()=>{if(!p.current)return;let[e,t]=_qe(m.current,p.current);if(e!==0||t!==0){let{transform:n,panBy:r}=s.getState();d.current.x=(d.current.x??0)-e/n[2],d.current.y=(d.current.y??0)-t/n[2],r({x:e,y:t})&&b(d.current)}f.current=requestAnimationFrame(x)},S=t=>{let{nodeInternals:n,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:l,onNodeDragStart:f,onSelectionDragStart:p}=s.getState();_.current=!0;let m=i?f:GU(p);(!o||!a)&&!r&&i&&(n.get(i)?.selected||l()),i&&a&&o&&WU({id:i,store:s,nodeRef:e});let h=y(t);if(d.current=h,u.current=BU(n,c,h,i),m&&u.current){let[e,r]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});m(t.sourceEvent,e,r)}};if(t)c.on(`.drag`,null);else{let t=RV().on(`start`,e=>{let{domNode:t,nodeDragThreshold:n}=s.getState();n===0&&S(e),v.current=!1,d.current=y(e),p.current=t?.getBoundingClientRect()||null,m.current=$H(e.sourceEvent,p.current)}).on(`drag`,e=>{let t=y(e),{autoPanOnNodeDrag:n,nodeDragThreshold:r}=s.getState();if(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1&&(v.current=!0),!v.current){if(!g.current&&_.current&&n&&(g.current=!0,x()),!_.current){let n=t.xSnapped-(d?.current?.x??0),i=t.ySnapped-(d?.current?.y??0);Math.sqrt(n*n+i*i)>r&&S(e)}(d.current.x!==t.xSnapped||d.current.y!==t.ySnapped)&&u.current&&_.current&&(h.current=e.sourceEvent,m.current=$H(e.sourceEvent,p.current),b(t))}}).on(`end`,e=>{if(!(!_.current||v.current)&&(l(!1),g.current=!1,_.current=!1,cancelAnimationFrame(f.current),u.current)){let{updateNodePositions:t,nodeInternals:n,onNodeDragStop:r,onSelectionDragStop:a}=s.getState(),o=i?r:GU(a);if(t(u.current,!1,!1),o){let[t,r]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});o(e.sourceEvent,t,r)}}}).filter(t=>{let i=t.target;return!t.button&&(!n||!$Je(i,`.${n}`,e))&&(!r||$Je(i,r,e))});return c.call(t),()=>{c.on(`.drag`,null)}}}},[e,t,n,r,a,s,i,o,y]),c}function iYe(){let e=UH();return(0,D.useCallback)(t=>{let{nodeInternals:n,nodeExtent:r,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:s,onError:c,nodesDraggable:l}=e.getState(),u=a().filter(e=>e.selected&&(e.draggable||l&&e.draggable===void 0)),d=o?s[0]:5,f=o?s[1]:5,p=t.isShiftPressed?4:1,m=t.x*d*p,h=t.y*f*p;i(u.map(e=>{if(e.positionAbsolute){let t={x:e.positionAbsolute.x+m,y:e.positionAbsolute.y+h};o&&(t.x=s[0]*Math.round(t.x/s[0]),t.y=s[1]*Math.round(t.y/s[1]));let{positionAbsolute:i,position:a}=eYe(e,t,n,r,void 0,c);e.position=a,e.positionAbsolute=i}return e}),!0,!1)},[])}var KU={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},qU=e=>{let t=({id:t,type:n,data:r,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:s,selected:c,onClick:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onContextMenu:p,onDoubleClick:m,style:h,className:g,isDraggable:_,isSelectable:v,isConnectable:y,isFocusable:b,selectNodesOnDrag:x,sourcePosition:S,targetPosition:C,hidden:w,resizeObserver:T,dragHandle:E,zIndex:O,isParent:k,noDragClassName:ee,noPanClassName:te,initialized:ne,disableKeyboardA11y:re,ariaLabel:ie,rfId:ae,hasHandleBounds:oe})=>{let se=UH(),ce=(0,D.useRef)(null),le=(0,D.useRef)(null),ue=(0,D.useRef)(S),de=(0,D.useRef)(C),fe=(0,D.useRef)(n),pe=v||_||l||u||d||f,me=iYe(),he=UU(t,se.getState,u),ge=UU(t,se.getState,d),_e=UU(t,se.getState,f),ve=UU(t,se.getState,p),ye=UU(t,se.getState,m),be=e=>{let{nodeDragThreshold:n}=se.getState();if(v&&(!x||!_||n>0)&&WU({id:t,store:se,nodeRef:ce}),l){let n=se.getState().nodeInternals.get(t);n&&l(e,{...n})}},xe=e=>{wqe(e)||re||(xqe.includes(e.key)&&v?WU({id:t,store:se,unselect:e.key===`Escape`,nodeRef:ce}):_&&c&&Object.prototype.hasOwnProperty.call(KU,e.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),me({x:KU[e.key].x,y:KU[e.key].y,isShiftPressed:e.shiftKey})))};(0,D.useEffect)(()=>()=>{le.current&&=(T?.unobserve(le.current),null)},[]),(0,D.useEffect)(()=>{if(ce.current&&!w){let e=ce.current;(!ne||!oe||le.current!==e)&&(le.current&&T?.unobserve(le.current),T?.observe(e),le.current=e)}},[w,ne,oe]),(0,D.useEffect)(()=>{let e=fe.current!==n,r=ue.current!==S,i=de.current!==C;ce.current&&(e||r||i)&&(e&&(fe.current=n),r&&(ue.current=S),i&&(de.current=C),se.getState().updateNodeDimensions([{id:t,nodeElement:ce.current,forceUpdate:!0}]))},[t,n,S,C]);let Se=rYe({nodeRef:ce,disabled:w||!_,noDragClassName:ee,handleSelector:E,nodeId:t,isSelectable:v,selectNodesOnDrag:x});return w?null:D.createElement(`div`,{className:qB([`react-flow__node`,`react-flow__node-${n}`,{[te]:_},g,{selected:c,selectable:v,parent:k,dragging:Se}]),ref:ce,style:{zIndex:O,transform:`translate(${o}px,${s}px)`,pointerEvents:pe?`all`:`none`,visibility:ne?`visible`:`hidden`,...h},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:he,onMouseMove:ge,onMouseLeave:_e,onContextMenu:ve,onClick:be,onDoubleClick:ye,onKeyDown:b?xe:void 0,tabIndex:b?0:void 0,role:b?`button`:void 0,"aria-describedby":re?void 0:`${TJe}-${ae}`,"aria-label":ie},D.createElement(Hqe,{value:t},D.createElement(e,{id:t,data:r,type:n,xPos:i,yPos:a,selected:c,isConnectable:y,sourcePosition:S,targetPosition:C,dragging:Se,dragHandle:E,zIndex:O})))};return t.displayName=`NodeWrapper`,(0,D.memo)(t)},aYe=e=>({...Yqe(e.getNodes().filter(e=>e.selected),e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive});function oYe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=UH(),{width:i,height:a,x:o,y:s,transformString:c,userSelectionActive:l}=HH(aYe,XB),u=iYe(),d=(0,D.useRef)(null);if((0,D.useEffect)(()=>{n||d.current?.focus({preventScroll:!0})},[n]),rYe({nodeRef:d}),l||!i||!a)return null;let f=e?t=>{e(t,r.getState().getNodes().filter(e=>e.selected))}:void 0;return D.createElement(`div`,{className:qB([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:c}},D.createElement(`div`,{ref:d,className:`react-flow__nodesselection-rect`,onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(KU,e.key)&&u({x:KU[e.key].x,y:KU[e.key].y,isShiftPressed:e.shiftKey})},style:{width:i,height:a,top:s,left:o}}))}var JU=(0,D.memo)(oYe),sYe=e=>e.nodesSelectionActive,cYe=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:c,onMoveStart:l,onMoveEnd:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:p,onSelectionStart:m,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:_,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:E,defaultViewport:O,translateExtent:k,minZoom:ee,maxZoom:te,preventScrolling:ne,onSelectionContextMenu:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:oe})=>{let se=HH(sYe),ce=DU(d),le=DU(_),ue=le||E,de=le||S,fe=ce||f&&ue!==!0;return LJe({deleteKeyCode:s,multiSelectionKeyCode:g}),D.createElement(WJe,{onMove:c,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:a,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:de,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:!ce&&ue,defaultViewport:O,translateExtent:k,minZoom:ee,maxZoom:te,zoomActivationKeyCode:v,preventScrolling:ne,noWheelClassName:ie,noPanClassName:ae},D.createElement(ZJe,{onSelectionStart:m,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ue,isSelecting:!!fe,selectionMode:p},e,se&&D.createElement(JU,{onSelectionContextMenu:re,noPanClassName:ae,disableKeyboardA11y:oe})))};cYe.displayName=`FlowRenderer`;var lYe=(0,D.memo)(cYe);function uYe(e){return HH((0,D.useCallback)(t=>e?Xqe(t.nodeInternals,{x:0,y:0,width:t.width,height:t.height},t.transform,!0):t.getNodes(),[e]))}function dYe(e){let t={input:qU(e.input||pJe),default:qU(e.default||dJe),output:qU(e.output||hJe),group:qU(e.group||gJe)},n=Object.keys(e).filter(e=>![`input`,`default`,`output`,`group`].includes(e)).reduce((t,n)=>(t[n]=qU(e[n]||dJe),t),{});return{...t,...n}}var fYe=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r||i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},pYe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),mYe=e=>{let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:a,onError:o}=HH(pYe,XB),s=uYe(e.onlyRenderVisibleElements),c=(0,D.useRef)(),l=(0,D.useMemo)(()=>{if(typeof ResizeObserver>`u`)return null;let e=new ResizeObserver(e=>{a(e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0})))});return c.current=e,e},[]);return(0,D.useEffect)(()=>()=>{c?.current?.disconnect()},[]),D.createElement(`div`,{className:`react-flow__nodes`,style:FU},s.map(a=>{let s=a.type||`default`;e.nodeTypes[s]||(o?.(`003`,VH.error003(s)),s=`default`);let c=e.nodeTypes[s]||e.nodeTypes.default,u=!!(a.draggable||t&&a.draggable===void 0),d=!!(a.selectable||i&&a.selectable===void 0),f=!!(a.connectable||n&&a.connectable===void 0),p=!!(a.focusable||r&&a.focusable===void 0),m=e.nodeExtent?gqe(a.positionAbsolute,e.nodeExtent):a.positionAbsolute,h=m?.x??0,g=m?.y??0,_=fYe({x:h,y:g,width:a.width??0,height:a.height??0,origin:e.nodeOrigin});return D.createElement(c,{key:a.id,id:a.id,className:a.className,style:a.style,type:s,data:a.data,sourcePosition:a.sourcePosition||cU.Bottom,targetPosition:a.targetPosition||cU.Top,hidden:a.hidden,xPos:h,yPos:g,xPosOrigin:_.x,yPosOrigin:_.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!a.selected,isDraggable:u,isSelectable:d,isConnectable:f,isFocusable:p,resizeObserver:l,dragHandle:a.dragHandle,zIndex:a[QH]?.z??0,isParent:!!a[QH]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!a.width&&!!a.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:a.ariaLabel,hasHandleBounds:!!a[QH]?.handleBounds})}))};mYe.displayName=`NodeRenderer`;var hYe=(0,D.memo)(mYe),YU=(e,t,n)=>n===cU.Left?e-t:n===cU.Right?e+t:e,gYe=(e,t,n)=>n===cU.Top?e-t:n===cU.Bottom?e+t:e,_Ye=`react-flow__edgeupdater`,vYe=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>D.createElement(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:qB([_Ye,`${_Ye}-${s}`]),cx:YU(t,r,e),cy:gYe(n,r,e),r,stroke:`transparent`,fill:`transparent`}),yYe=()=>!0,XU=e=>{let t=({id:t,className:n,type:r,data:i,onClick:a,onEdgeDoubleClick:o,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:h,source:g,target:_,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,elementsSelectable:w,hidden:T,sourceHandleId:E,targetHandleId:O,onContextMenu:k,onMouseEnter:ee,onMouseMove:te,onMouseLeave:ne,reconnectRadius:re,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,markerEnd:se,markerStart:ce,rfId:le,ariaLabel:ue,isFocusable:de,isReconnectable:fe,pathOptions:pe,interactionWidth:me,disableKeyboardA11y:he})=>{let ge=(0,D.useRef)(null),[_e,ve]=(0,D.useState)(!1),[ye,be]=(0,D.useState)(!1),xe=UH(),Se=(0,D.useMemo)(()=>`url('#${pU(ce,le)}')`,[ce,le]),Ce=(0,D.useMemo)(()=>`url('#${pU(se,le)}')`,[se,le]);if(T)return null;let we=e=>{let{edges:n,addSelectedEdges:r,unselectNodesAndEdges:i,multiSelectionActive:o}=xe.getState(),s=n.find(e=>e.id===t);s&&(w&&(xe.setState({nodesSelectionActive:!1}),s.selected&&o?(i({nodes:[],edges:[s]}),ge.current?.blur()):r([t])),a&&a(e,s))},Te=nU(t,xe.getState,o),Ee=nU(t,xe.getState,k),De=nU(t,xe.getState,ee),Oe=nU(t,xe.getState,te),ke=nU(t,xe.getState,ne),Ae=(e,n)=>{if(e.button!==0)return;let{edges:r,isValidConnection:i}=xe.getState(),a=n?_:g,o=(n?O:E)||null,s=n?`target`:`source`,c=i||yYe,l=n,u=r.find(e=>e.id===t);be(!0),ae?.(e,u,s),oJe({event:e,handleId:o,nodeId:a,onConnect:e=>ie?.(u,e),isTarget:l,getState:xe.getState,setState:xe.setState,isValidConnection:c,edgeUpdaterType:s,onReconnectEnd:e=>{be(!1),oe?.(e,u,s)}})},je=e=>Ae(e,!0),Me=e=>Ae(e,!1),Ne=()=>ve(!0),Pe=()=>ve(!1),Fe=!w&&!a;return D.createElement(`g`,{className:qB([`react-flow__edge`,`react-flow__edge-${r}`,n,{selected:s,animated:c,inactive:Fe,updating:_e}]),onClick:we,onDoubleClick:Te,onContextMenu:Ee,onMouseEnter:De,onMouseMove:Oe,onMouseLeave:ke,onKeyDown:de?e=>{if(!he&&xqe.includes(e.key)&&w){let{unselectNodesAndEdges:n,addSelectedEdges:r,edges:i}=xe.getState();e.key===`Escape`?(ge.current?.blur(),n({edges:[i.find(e=>e.id===t)]})):r([t])}}:void 0,tabIndex:de?0:void 0,role:de?`button`:`img`,"data-testid":`rf__edge-${t}`,"aria-label":ue===null?void 0:ue||`Edge from ${g} to ${_}`,"aria-describedby":de?`${TU}-${le}`:void 0,ref:ge},!ye&&D.createElement(e,{id:t,source:g,target:_,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,data:i,style:h,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,sourceHandleId:E,targetHandleId:O,markerStart:Se,markerEnd:Ce,pathOptions:pe,interactionWidth:me}),fe&&D.createElement(D.Fragment,null,(fe===`source`||fe===!0)&&D.createElement(vYe,{position:S,centerX:v,centerY:y,radius:re,onMouseDown:je,onMouseEnter:Ne,onMouseOut:Pe,type:`source`}),(fe===`target`||fe===!0)&&D.createElement(vYe,{position:C,centerX:b,centerY:x,radius:re,onMouseDown:Me,onMouseEnter:Ne,onMouseOut:Pe,type:`target`})))};return t.displayName=`EdgeWrapper`,(0,D.memo)(t)};function bYe(e){let t={default:XU(e.default||dU),straight:XU(e.bezier||Rqe),step:XU(e.step||Iqe),smoothstep:XU(e.step||uU),simplebezier:XU(e.simplebezier||Aqe)},n=Object.keys(e).filter(e=>![`default`,`bezier`].includes(e)).reduce((t,n)=>(t[n]=XU(e[n]||dU),t),{});return{...t,...n}}function xYe(e,t,n=null){let r=(n?.x||0)+t.x,i=(n?.y||0)+t.y,a=n?.width||t.width,o=n?.height||t.height;switch(e){case cU.Top:return{x:r+a/2,y:i};case cU.Right:return{x:r+a,y:i+o/2};case cU.Bottom:return{x:r+a/2,y:i+o};case cU.Left:return{x:r,y:i+o/2}}}function SYe(e,t){return e?e.length===1||!t?e[0]:t&&e.find(e=>e.id===t)||null:null}var CYe=(e,t,n,r,i,a)=>{let o=xYe(n,e,t),s=xYe(a,r,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function wYe({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,transform:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=JH({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:o/c[2],height:s/c[2]}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function TYe(e){let t=e?.[QH]?.handleBounds||null,n=t&&e?.width&&e?.height&&e?.positionAbsolute?.x!==void 0&&e?.positionAbsolute?.y!==void 0;return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!n]}var EYe=[{level:0,isMaxLevel:!0,edges:[]}];function ZU(e,t,n=!1){let r=-1,i=e.reduce((e,i)=>{let a=ZH(i.zIndex),o=a?i.zIndex:0;if(n){let e=t.get(i.target),n=t.get(i.source),r=i.selected||e?.selected||n?.selected,s=Math.max(n?.[QH]?.z||0,e?.[QH]?.z||0,1e3);o=(a?i.zIndex:0)+(r?s:0)}return e[o]?e[o].push(i):e[o]=[i],r=o>r?o:r,e},{}),a=Object.entries(i).map(([e,t])=>{let n=+e;return{edges:t,level:n,isMaxLevel:n===r}});return a.length===0?EYe:a}function DYe(e,t,n){return ZU(HH((0,D.useCallback)(n=>e?n.edges.filter(e=>{let r=t.get(e.source),i=t.get(e.target);return r?.width&&r?.height&&i?.width&&i?.height&&wYe({sourcePos:r.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:r.width,sourceHeight:r.height,targetWidth:i.width,targetHeight:i.height,width:n.width,height:n.height,transform:n.transform})}):n.edges,[e,t])),t,n)}var OYe=({color:e=`none`,strokeWidth:t=1})=>D.createElement(`polyline`,{style:{stroke:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,points:`-5,-4 0,0 -5,4`}),kYe=({color:e=`none`,strokeWidth:t=1})=>D.createElement(`polyline`,{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),AYe={[sU.Arrow]:OYe,[sU.ArrowClosed]:kYe};function QU(e){let t=UH();return(0,D.useMemo)(()=>Object.prototype.hasOwnProperty.call(AYe,e)?AYe[e]:(t.getState().onError?.(`009`,VH.error009(e)),null),[e])}var jYe=({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=QU(t);return c?D.createElement(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`},D.createElement(c,{color:n,strokeWidth:o})):null},MYe=({defaultColor:e,rfId:t})=>n=>{let r=[];return n.edges.reduce((n,i)=>([i.markerStart,i.markerEnd].forEach(i=>{if(i&&typeof i==`object`){let a=pU(i,t);r.includes(a)||(n.push({id:a,color:i.color||e,...i}),r.push(a))}}),n),[]).sort((e,t)=>e.id.localeCompare(t.id))},NYe=({defaultColor:e,rfId:t})=>{let n=HH((0,D.useCallback)(MYe({defaultColor:e,rfId:t}),[e,t]),(e,t)=>!(e.length!==t.length||e.some((e,n)=>e.id!==t[n].id)));return D.createElement(`defs`,null,n.map(e=>D.createElement(jYe,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient})))};NYe.displayName=`MarkerDefinitions`;var PYe=(0,D.memo)(NYe),FYe=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),IYe=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,children:g,disableKeyboardA11y:_})=>{let{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:b,width:x,height:S,connectionMode:C,nodeInternals:w,onError:T}=HH(FYe,XB),E=DYe(t,w,n);return x?D.createElement(D.Fragment,null,E.map(({level:t,edges:n,isMaxLevel:g})=>D.createElement(`svg`,{key:t,style:{zIndex:t},width:x,height:S,className:`react-flow__edges react-flow__container`},g&&D.createElement(PYe,{defaultColor:e,rfId:r}),D.createElement(`g`,null,n.map(e=>{let[t,n,g]=TYe(w.get(e.source)),[x,S,E]=TYe(w.get(e.target));if(!g||!E)return null;let O=e.type||`default`;i[O]||(T?.(`011`,VH.error011(O)),O=`default`);let k=i[O]||i.default,ee=C===rU.Strict?S.target:(S.target??[]).concat(S.source??[]),te=SYe(n.source,e.sourceHandle),ne=SYe(ee,e.targetHandle),re=te?.position||cU.Bottom,ie=ne?.position||cU.Top,ae=!!(e.focusable||v&&e.focusable===void 0),oe=e.reconnectable||e.updatable,se=f!==void 0&&(oe||y&&oe===void 0);if(!te||!ne)return T?.(`008`,VH.error008(te,e)),null;let{sourceX:ce,sourceY:le,targetX:ue,targetY:de}=CYe(t,te,re,x,ne,ie);return D.createElement(k,{key:e.id,id:e.id,className:qB([e.className,a]),type:O,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:ce,sourceY:le,targetX:ue,targetY:de,sourcePosition:re,targetPosition:ie,elementsSelectable:b,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,rfId:r,ariaLabel:e.ariaLabel,isFocusable:ae,isReconnectable:se,pathOptions:`pathOptions`in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:_})})))),g):null};IYe.displayName=`EdgeRenderer`;var LYe=(0,D.memo)(IYe),RYe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zYe({children:e}){let t=HH(RYe);return D.createElement(`div`,{className:`react-flow__viewport react-flow__container`,style:{transform:t}},e)}function BYe(e){let t=PU(),n=(0,D.useRef)(!1);(0,D.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var VYe={[cU.Left]:cU.Right,[cU.Right]:cU.Left,[cU.Top]:cU.Bottom,[cU.Bottom]:cU.Top},HYe=({nodeId:e,handleType:t,style:n,type:r=oU.Bezier,CustomComponent:i,connectionStatus:a})=>{let{fromNode:o,handleId:s,toX:c,toY:l,connectionMode:u}=HH((0,D.useCallback)(t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode}),[e]),XB),d=o?.[QH]?.handleBounds,f=d?.[t];if(u===rU.Loose&&(f||=d?.[t===`source`?`target`:`source`]),!o||!f)return null;let p=s?f.find(e=>e.id===s):f[0],m=p?p.x+p.width/2:(o.width??0)/2,h=p?p.y+p.height/2:o.height??0,g=(o.positionAbsolute?.x??0)+m,_=(o.positionAbsolute?.y??0)+h,v=p?.position,y=v?VYe[v]:null;if(!v||!y)return null;if(i)return D.createElement(i,{connectionLineType:r,connectionLineStyle:n,fromNode:o,fromHandle:p,fromX:g,fromY:_,toX:c,toY:l,fromPosition:v,toPosition:y,connectionStatus:a});let b=``,x={sourceX:g,sourceY:_,sourcePosition:v,targetX:c,targetY:l,targetPosition:y};return r===oU.Bezier?[b]=Vqe(x):r===oU.Step?[b]=lU({...x,borderRadius:0}):r===oU.SmoothStep?[b]=lU(x):r===oU.SimpleBezier?[b]=kqe(x):b=`M${g},${_} ${c},${l}`,D.createElement(`path`,{d:b,fill:`none`,className:`react-flow__connection-path`,style:n})};HYe.displayName=`ConnectionLine`;var $U=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function UYe({containerStyle:e,style:t,type:n,component:r}){let{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:c,connectionStatus:l}=HH($U,XB);return i&&a&&s&&o?D.createElement(`svg`,{style:e,width:s,height:c,className:`react-flow__edges react-flow__connectionline react-flow__container`},D.createElement(`g`,{className:qB([`react-flow__connection`,l])},D.createElement(HYe,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:r,connectionStatus:l}))):null}function WYe(e,t){return(0,D.useRef)(null),UH(),(0,D.useMemo)(()=>t(e),[e])}var GYe=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:c,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:h,onSelectionEnd:g,connectionLineType:_,connectionLineStyle:v,connectionLineComponent:y,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,deleteKeyCode:O,onlyRenderVisibleElements:k,elementsSelectable:ee,selectNodesOnDrag:te,defaultViewport:ne,translateExtent:re,minZoom:ie,maxZoom:ae,preventScrolling:oe,defaultMarkerColor:se,zoomOnScroll:ce,zoomOnPinch:le,panOnScroll:ue,panOnScrollSpeed:de,panOnScrollMode:fe,zoomOnDoubleClick:pe,panOnDrag:me,onPaneClick:he,onPaneMouseEnter:ge,onPaneMouseMove:_e,onPaneMouseLeave:ve,onPaneScroll:ye,onPaneContextMenu:be,onEdgeContextMenu:xe,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:Te,onReconnectStart:Ee,onReconnectEnd:De,reconnectRadius:Oe,noDragClassName:ke,noWheelClassName:Ae,noPanClassName:je,elevateEdgesOnSelect:Me,disableKeyboardA11y:Ne,nodeOrigin:Pe,nodeExtent:Fe,rfId:Ie})=>{let Le=WYe(e,dYe),Re=WYe(t,bYe);return BYe(a),D.createElement(lYe,{onPaneClick:he,onPaneMouseEnter:ge,onPaneMouseMove:_e,onPaneMouseLeave:ve,onPaneContextMenu:be,onPaneScroll:ye,deleteKeyCode:O,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:ce,zoomOnPinch:le,zoomOnDoubleClick:pe,panOnScroll:ue,panOnScrollSpeed:de,panOnScrollMode:fe,panOnDrag:me,defaultViewport:ne,translateExtent:re,minZoom:ie,maxZoom:ae,onSelectionContextMenu:m,preventScrolling:oe,noDragClassName:ke,noWheelClassName:Ae,noPanClassName:je,disableKeyboardA11y:Ne},D.createElement(zYe,null,D.createElement(LYe,{edgeTypes:Re,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:k,onEdgeContextMenu:xe,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:Te,onReconnectStart:Ee,onReconnectEnd:De,reconnectRadius:Oe,defaultMarkerColor:se,noPanClassName:je,elevateEdgesOnSelect:!!Me,disableKeyboardA11y:Ne,rfId:Ie},D.createElement(UYe,{style:v,type:_,component:y,containerStyle:b})),D.createElement(`div`,{className:`react-flow__edgelabel-renderer`}),D.createElement(hYe,{nodeTypes:Le,onNodeClick:o,onNodeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:te,onlyRenderVisibleElements:k,noPanClassName:je,noDragClassName:ke,disableKeyboardA11y:Ne,nodeOrigin:Pe,nodeExtent:Fe,rfId:Ie})))};GYe.displayName=`GraphView`;var KYe=(0,D.memo)(GYe),eW=[[-1/0,-1/0],[1/0,1/0]],tW={rfId:`1`,width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:eW,nodeExtent:eW,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:`source`,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:rU.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Sqe,isValidConnection:void 0},qYe=()=>dUe((e,t)=>({...tW,setNodes:n=>{let{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:jJe(n,r,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{let{defaultEdgeOptions:r={}}=t();e({edges:n.map(e=>({...r,...e}))})},setDefaultNodesAndEdges:(n,r)=>{let i=n!==void 0,a=r!==void 0;e({nodeInternals:i?jJe(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map,edges:a?r:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{let{onNodesChange:r,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:c,nodeOrigin:l}=t(),u=c?.querySelector(`.react-flow__viewport`);if(!u)return;let d=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(d.transform),p=n.reduce((e,t)=>{let n=i.get(t.id);if(n?.hidden)i.set(n.id,{...n,[QH]:{...n[QH],handleBounds:void 0}});else if(n){let r=hqe(t.nodeElement);r.width&&r.height&&(n.width!==r.width||n.height!==r.height||t.forceUpdate)&&(i.set(n.id,{...n,[QH]:{...n[QH],handleBounds:{source:HU(`.source`,t.nodeElement,f,l),target:HU(`.target`,t.nodeElement,f,l)}},...r}),e.push({id:n.id,type:`dimensions`,dimensions:r}))}return e},[]);AJe(i,l);let m=o||a&&!o&&MJe(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:m}),p?.length>0&&r?.(p)},updateNodePositions:(e,n=!0,r=!1)=>{let{triggerNodeChanges:i}=t();i(e.map(e=>{let t={id:e.id,type:`position`,dragging:r};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t}))},triggerNodeChanges:n=>{let{onNodesChange:r,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:c}=t();n?.length&&(a&&e({nodeInternals:jJe(YJe(n,s()),i,o,c)}),r?.(n))},addSelectedNodes:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>LU(e,!0)):(o=RU(a(),n),s=RU(i,[])),jU({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>LU(e,!0)):(o=RU(i,n),s=RU(a(),[])),jU({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{let{edges:i,getNodes:a}=t(),o=n||a(),s=r||i;jU({changedNodes:o.map(e=>(e.selected=!1,LU(e.id,!1))),changedEdges:s.map(e=>LU(e.id,!1)),get:t,set:e})},setMinZoom:n=>{let{d3Zoom:r,maxZoom:i}=t();r?.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{let{d3Zoom:r,minZoom:i}=t();r?.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{t().d3Zoom?.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{let{edges:n,getNodes:r}=t();jU({changedNodes:r().filter(e=>e.selected).map(e=>LU(e.id,!1)),changedEdges:n.filter(e=>e.selected).map(e=>LU(e.id,!1)),get:t,set:e})},setNodeExtent:n=>{let{nodeInternals:r}=t();r.forEach(e=>{e.positionAbsolute=gqe(e.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:e=>{let{transform:n,width:r,height:i,d3Zoom:a,d3Selection:o,translateExtent:s}=t();if(!a||!o||!e.x&&!e.y)return!1;let c=IH.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),l=[[0,0],[r,i]],u=a?.constrain()(c,l,s);return a.transform(o,u),n[0]!==u.x||n[1]!==u.y||n[2]!==u.k},cancelConnection:()=>e({connectionNodeId:tW.connectionNodeId,connectionHandleId:tW.connectionHandleId,connectionHandleType:tW.connectionHandleType,connectionStatus:tW.connectionStatus,connectionStartHandle:tW.connectionStartHandle,connectionEndHandle:tW.connectionEndHandle}),reset:()=>e({...tW})}),Object.is),nW=({children:e})=>{let t=(0,D.useRef)(null);return t.current||=qYe(),D.createElement(BH,{value:t.current},e)};nW.displayName=`ReactFlowProvider`;var JYe=({children:e})=>(0,D.useContext)(zH)?D.createElement(D.Fragment,null,e):D.createElement(nW,null,e);JYe.displayName=`ReactFlowWrapper`;var rW={input:pJe,default:dJe,output:hJe,group:gJe},YYe={default:dU,straight:Rqe,step:Iqe,smoothstep:uU,simplebezier:Aqe},XYe=[0,0],ZYe=[15,15],QYe={x:0,y:0,zoom:1},$Ye={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0},iW=(0,D.forwardRef)(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a=rW,edgeTypes:o=YYe,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:O,onSelectionChange:k,onSelectionDragStart:ee,onSelectionDrag:te,onSelectionDragStop:ne,onSelectionContextMenu:re,onSelectionStart:ie,onSelectionEnd:ae,connectionMode:oe=rU.Strict,connectionLineType:se=oU.Bezier,connectionLineStyle:ce,connectionLineComponent:le,connectionLineContainerStyle:ue,deleteKeyCode:de=`Backspace`,selectionKeyCode:fe=`Shift`,selectionOnDrag:pe=!1,selectionMode:me=aU.Full,panActivationKeyCode:he=`Space`,multiSelectionKeyCode:ge=eU()?`Meta`:`Control`,zoomActivationKeyCode:_e=eU()?`Meta`:`Control`,snapToGrid:ve=!1,snapGrid:ye=ZYe,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:xe=!0,nodesDraggable:Se,nodesConnectable:Ce,nodesFocusable:we,nodeOrigin:Te=XYe,edgesFocusable:Ee,edgesUpdatable:De,elementsSelectable:Oe,defaultViewport:ke=QYe,minZoom:Ae=.5,maxZoom:je=2,translateExtent:Me=eW,preventScrolling:Ne=!0,nodeExtent:Pe,defaultMarkerColor:Fe=`#b1b1b7`,zoomOnScroll:Ie=!0,zoomOnPinch:Le=!0,panOnScroll:Re=!1,panOnScrollSpeed:ze=.5,panOnScrollMode:Be=iU.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:He=!0,onPaneClick:Ue,onPaneMouseEnter:We,onPaneMouseMove:Ge,onPaneMouseLeave:Ke,onPaneScroll:qe,onPaneContextMenu:Je,children:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,onEdgeUpdate:tt,onEdgeUpdateStart:nt,onEdgeUpdateEnd:rt,onReconnect:it,onReconnectStart:at,onReconnectEnd:ot,reconnectRadius:st=10,edgeUpdaterRadius:ct=10,onNodesChange:lt,onEdgesChange:ut,noDragClassName:dt=`nodrag`,noWheelClassName:ft=`nowheel`,noPanClassName:pt=`nopan`,fitView:mt=!1,fitViewOptions:ht,connectOnClick:gt=!0,attributionPosition:_t,proOptions:vt,defaultEdgeOptions:yt,elevateNodesOnSelect:bt=!0,elevateEdgesOnSelect:xt=!1,disableKeyboardA11y:St=!1,autoPanOnConnect:Ct=!0,autoPanOnNodeDrag:wt=!0,connectionRadius:Tt=20,isValidConnection:Et,onError:Dt,style:Ot,id:kt,nodeDragThreshold:At,...jt},Mt)=>{let Nt=kt||`1`;return D.createElement(`div`,{...jt,style:{...Ot,...$Ye},ref:Mt,className:qB([`react-flow`,i]),"data-testid":`rf__wrapper`,id:kt},D.createElement(JYe,null,D.createElement(KYe,{onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:se,connectionLineStyle:ce,connectionLineComponent:le,connectionLineContainerStyle:ue,selectionKeyCode:fe,selectionOnDrag:pe,selectionMode:me,deleteKeyCode:de,multiSelectionKeyCode:ge,panActivationKeyCode:he,zoomActivationKeyCode:_e,onlyRenderVisibleElements:be,selectNodesOnDrag:xe,defaultViewport:ke,translateExtent:Me,minZoom:Ae,maxZoom:je,preventScrolling:Ne,zoomOnScroll:Ie,zoomOnPinch:Le,zoomOnDoubleClick:Ve,panOnScroll:Re,panOnScrollSpeed:ze,panOnScrollMode:Be,panOnDrag:He,onPaneClick:Ue,onPaneMouseEnter:We,onPaneMouseMove:Ge,onPaneMouseLeave:Ke,onPaneScroll:qe,onPaneContextMenu:Je,onSelectionContextMenu:re,onSelectionStart:ie,onSelectionEnd:ae,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,onReconnect:it??tt,onReconnectStart:at??nt,onReconnectEnd:ot??rt,reconnectRadius:st??ct,defaultMarkerColor:Fe,noDragClassName:dt,noWheelClassName:ft,noPanClassName:pt,elevateEdgesOnSelect:xt,rfId:Nt,disableKeyboardA11y:St,nodeOrigin:Te,nodeExtent:Pe}),D.createElement(SJe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:Se,nodesConnectable:Ce,nodesFocusable:we,edgesFocusable:Ee,edgesUpdatable:De,elementsSelectable:Oe,elevateNodesOnSelect:bt,minZoom:Ae,maxZoom:je,nodeExtent:Pe,onNodesChange:lt,onEdgesChange:ut,snapToGrid:ve,snapGrid:ye,connectionMode:oe,translateExtent:Me,connectOnClick:gt,defaultEdgeOptions:yt,fitView:mt,fitViewOptions:ht,onNodesDelete:E,onEdgesDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:te,onSelectionDragStart:ee,onSelectionDragStop:ne,noPanClassName:pt,nodeOrigin:Te,rfId:Nt,autoPanOnConnect:Ct,autoPanOnNodeDrag:wt,onError:Dt,connectionRadius:Tt,isValidConnection:Et,nodeDragThreshold:At}),D.createElement(bJe,{onSelectionChange:k}),Ye,D.createElement(pqe,{proOptions:vt,position:_t}),D.createElement(OJe,{rfId:Nt,disableKeyboardA11y:St})))});iW.displayName=`ReactFlow`;var eXe=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function tXe({children:e}){let t=HH(eXe);return t?(0,uqe.createPortal)(e,t):null}function nXe(e){return t=>{let[n,r]=(0,D.useState)(t);return[n,r,(0,D.useCallback)(t=>r(n=>e(t,n)),[])]}}var rXe=nXe(YJe),iXe=nXe(XJe),aW;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(aW||={});function aXe({color:e,dimensions:t,lineWidth:n}){return D.createElement(`path`,{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function oXe({color:e,radius:t}){return D.createElement(`circle`,{cx:t,cy:t,r:t,fill:e})}var sXe={[aW.Dots]:`#91919a`,[aW.Lines]:`#eee`,[aW.Cross]:`#e2e2e2`},cXe={[aW.Dots]:1,[aW.Lines]:1,[aW.Cross]:6},lXe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function uXe({id:e,variant:t=aW.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=2,color:o,style:s,className:c}){let l=(0,D.useRef)(null),{transform:u,patternId:d}=HH(lXe,XB),f=o||sXe[t],p=r||cXe[t],m=t===aW.Dots,h=t===aW.Cross,g=Array.isArray(n)?n:[n,n],_=[g[0]*u[2]||1,g[1]*u[2]||1],v=p*u[2],y=h?[v,v]:_,b=m?[v/a,v/a]:[y[0]/a,y[1]/a];return D.createElement(`svg`,{className:qB([`react-flow__background`,c]),style:{...s,position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},ref:l,"data-testid":`rf__background`},D.createElement(`pattern`,{id:d+e,x:u[0]%_[0],y:u[1]%_[1],width:_[0],height:_[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${b[0]},-${b[1]})`},m?D.createElement(oXe,{color:f,radius:v/a}):D.createElement(aXe,{dimensions:y,color:f,lineWidth:i})),D.createElement(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${d+e})`}))}uXe.displayName=`Background`;var dXe=(0,D.memo)(uXe),fXe=(0,D.createContext)(void 0);const pXe=()=>{let e=(0,D.useContext)(fXe);if(!e)throw Error(`useCanvasDrawerContext must be used within CanvasDrawerProvider`);return e},oW=({children:e})=>{let[t,n]=(0,D.useState)(null),r=(0,D.useCallback)(e=>{n({id:`add-step`,data:{type:`addStep`,metadata:e}})},[]),i=(0,D.useCallback)(()=>{n(null)},[]);return(0,A.jsx)(fXe.Provider,{value:{canvasDrawer:t,openAddStep:r,closeCanvasDrawer:i},children:e})},sW=({icon:e,category:t,docsHref:n,categoryPath:r,currentItem:i,items:a,onItemSelect:o,subtitle:s,tabs:c,rightSection:l})=>{let u=Hy(),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``),h=(0,D.useMemo)(()=>{if(!a)return[];if(!p)return a;let e=p.toLowerCase();return a.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[a,p]),g=e=>{f(!1),m(``),o?.(e)};return(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,h:50,className:fx.noShrink,style:{zIndex:9999,borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-body)`},children:[r?(0,A.jsx)(u,{to:r,style:{textDecoration:`none`},children:(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:t})}):i?(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:t}):null,i&&!a&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:`/`}),(0,A.jsx)(N,{size:`md`,fw:500,children:i})]}),i&&a&&o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:`/`}),(0,A.jsxs)(df,{opened:d,onChange:f,width:300,position:`bottom-start`,shadow:`md`,zIndex:1e4,children:[(0,A.jsx)(df.Target,{children:(0,A.jsxs)(Ud,{onClick:()=>f(e=>!e),style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,A.jsx)(N,{size:`md`,fw:500,children:i}),(0,A.jsx)(tb,{size:14})]})}),(0,A.jsxs)(df.Dropdown,{p:0,children:[(0,A.jsx)(ig,{placeholder:`Search ${t.toLowerCase()}...`,leftSection:(0,A.jsx)(Mb,{size:14}),value:p,onChange:e=>m(e.currentTarget.value),styles:{input:{border:`none`,borderBottom:`1px solid var(--mantine-color-default-border)`,borderRadius:0}}}),(0,A.jsx)(Hd.Autosize,{mah:300,children:(0,A.jsxs)(Bh,{gap:0,children:[h.map(e=>(0,A.jsxs)(Ud,{onClick:()=>g(e.name),py:`xs`,px:`sm`,style:{display:`flex`,alignItems:`center`,gap:8,backgroundColor:e.name===i?`var(--mantine-color-green-light)`:void 0},children:[e.name===i&&(0,A.jsx)(eb,{size:14,color:`var(--mantine-color-green-6)`}),(0,A.jsxs)(`div`,{style:{marginLeft:e.name===i?0:22},children:[(0,A.jsx)(N,{size:`sm`,fw:e.name===i?500:400,children:e.name}),e.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description})]})]},e.name)),h.length===0&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ta:`center`,py:`md`,children:`No results`})]})})]})]})]}),s,c&&(0,A.jsx)(j,{ml:`md`,children:c}),(0,A.jsxs)(Sf,{ml:`auto`,gap:`sm`,children:[l,(0,A.jsx)(Ch,{label:`${t} docs`,children:(0,A.jsx)(_f,{component:`a`,href:n,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})]})};var mXe=({id:e,size:t=20})=>{let n=By(),{data:r}=Rr({queryKey:[`addon`,`icon`,e],queryFn:()=>n.invoke(`console:getAddonIcon`,{alias:e})});return r?(0,A.jsx)(`img`,{src:`data:image/svg+xml,${encodeURIComponent(r)}`,alt:``,width:t,height:t,style:{display:`block`}}):(0,A.jsx)(j,{style:{width:t,height:t}})},hXe=[{id:`startWorkflow`,name:`Start Workflow`,description:`Start another workflow`,icon:Eb},{id:`branch`,name:`If`,description:`Route items to different branches (true/false)`,icon:Wfe},{id:`switch`,name:`Switch`,description:`Route items depending on defined expression or rules`,icon:fb},{id:`fanout`,name:`Loop Over Items (Split in Batches)`,description:`Split data into batches and iterate over each batch`,icon:Ife},{id:`parallel`,name:`Parallel`,description:`Execute multiple branches concurrently`,icon:Bb},{id:`sleep`,name:`Wait`,description:`Wait before continuing with execution`,icon:ab},{id:`return`,name:`Return`,description:`Return a value from the workflow`,icon:cb},{id:`cancel`,name:`Stop and Error`,description:`Throw an error in the workflow`,icon:xfe}],gXe=[{id:`http`,name:`HTTP`,description:`REST API endpoints and webhooks`,icon:pb},{id:`channel`,name:`Channel`,description:`Real-time WebSocket communication`,icon:kb},{id:`cli`,name:`CLI`,description:`Command-line interface commands`,icon:Ib},{id:`mcp`,name:`MCP`,description:`AI assistant tools (Model Context Protocol)`,icon:Qy},{id:`scheduler`,name:`Scheduler`,description:`Time-based scheduled tasks`,icon:$y},{id:`queue`,name:`Queue`,description:`Background job processing`,icon:yb}],_Xe={http:[{id:`httpSetHeader`,name:`Set Header`,description:`Set an HTTP response header`},{id:`httpSetStatus`,name:`Set Status`,description:`Set HTTP response status code`},{id:`httpRedirect`,name:`Redirect`,description:`Redirect to another URL`},{id:`httpSetCookie`,name:`Set Cookie`,description:`Set a response cookie`}],channel:[{id:`channelSend`,name:`Send Message`,description:`Send a message to the channel`},{id:`channelBroadcast`,name:`Broadcast`,description:`Broadcast to all channel subscribers`},{id:`channelClose`,name:`Close Connection`,description:`Close the WebSocket connection`}],mcp:[{id:`mcpDisableTool`,name:`Disable Tool`,description:`Disable an MCP tool`},{id:`mcpEnableTool`,name:`Enable Tool`,description:`Enable an MCP tool`}],session:[{id:`sessionGet`,name:`Get Session`,description:`Get the current user session`},{id:`sessionSet`,name:`Set Session`,description:`Set/update the user session`},{id:`sessionClear`,name:`Clear Session`,description:`Clear the user session`}]},cW=({icon:e,title:t,description:n,onClick:r,showArrow:i=!0})=>{let[a,o]=(0,D.useState)(!1);return(0,A.jsx)(Ud,{onClick:r,p:`md`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:fx.drawerButton,style:{backgroundColor:a?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,children:[(0,A.jsx)(j,{className:fx.drawerIconBox,children:(0,A.jsx)(e,{size:20})}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:t}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:n})]})]}),i&&(0,A.jsx)(nb,{size:16,color:`var(--mantine-color-default-border)`})]})})},lW=({title:e,iconId:t,onClick:n})=>(0,A.jsx)(Ud,{onClick:n,p:`md`,className:fx.drawerButton,children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Yy,{size:16}),t&&(0,A.jsx)(mXe,{id:t,size:16}),(0,A.jsx)(N,{size:`sm`,fw:600,children:e})]})}),uW=({icon:e,name:t,description:n,onClick:r})=>{let[i,a]=(0,D.useState)(!1);return(0,A.jsx)(Ud,{onClick:r,p:`md`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:fx.drawerButton,style:{backgroundColor:i?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,children:[e&&(0,A.jsx)(j,{className:fx.drawerIconBox,children:(0,A.jsx)(e,{size:20})}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:t}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:n})]})]})})},vXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Flow`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:hXe.map(e=>(0,A.jsx)(uW,{icon:e.icon,name:e.name,description:e.description},e.id))})]}),yXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Triggers`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:gXe.map(e=>(0,A.jsx)(uW,{icon:e.icon,name:e.name,description:e.description},e.id))})]}),bXe=[{key:`http`,title:`HTTP`,icon:pb},{key:`channel`,title:`Channel`,icon:kb},{key:`mcp`,title:`MCP`,icon:Qy},{key:`session`,title:`Session`,icon:Kfe}],xXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Wire`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:bXe.map(({key:e,title:t})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(j,{px:`md`,py:`xs`,bg:`var(--mantine-color-default-hover)`,children:(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,tt:`uppercase`,children:t})}),_Xe[e].map(e=>(0,A.jsx)(uW,{name:e.name,description:e.description},e.id))]},e))})]}),SXe=({onBack:e})=>{let{isLoading:t,isError:n}=Xk();return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Transform`,onClick:e}),t&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load transforms`})}),!t&&!n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No transforms available`})})]})},CXe=({onBack:e})=>{let{data:t,isLoading:n,isError:r}=Jk(),{data:i}=Xk(),a=D.useMemo(()=>{if(!t)return[];let e=new Set;if(i)for(let t of i)for(let n of Object.keys(t.functions??{}))e.add(n);return Object.values(t).filter(t=>!e.has(t.name))},[t,i]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Functions`,onClick:e}),n&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),r&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load functions`})}),a.length===0&&!n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No functions available`})}),a.length>0&&(0,A.jsx)(Bh,{gap:0,children:a.map(e=>(0,A.jsx)(uW,{icon:ob,name:e.name,description:e.summary||e.description||``},e.name))})]})},wXe=({addon:e,onSelect:t})=>{let[n,r]=(0,D.useState)(!1),i=Object.keys(e.functions??{}).length;return(0,A.jsx)(Ud,{onClick:t,p:`md`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:fx.drawerButton,style:{backgroundColor:n?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,className:fx.flexGrow,children:[(0,A.jsx)(mXe,{id:e.id,size:20}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:e.displayName}),(0,A.jsx)(eS,{type:`dynamic`,badge:`functions`,value:i})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description})]})]}),(0,A.jsx)(nb,{size:16,color:`var(--mantine-color-default-border)`})]})})},TXe=({onBack:e,onSelectAddon:t})=>{let{data:n,isLoading:r,isError:i}=Xk(),a=D.useMemo(()=>n?n.filter(e=>e.id!==`pikku`):[],[n]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Addons`,onClick:e}),r&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),i&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load addons`})}),a.length===0&&!r&&!i&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No addons available`})}),a.length>0&&(0,A.jsx)(Bh,{gap:0,children:a.map(e=>(0,A.jsx)(wXe,{addon:e,onSelect:()=>t(e)},e.id))})]})},EXe=({addon:e,onBack:t})=>{let n=Object.entries(e.functions??{}),r=Object.keys(e.secrets??{});return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:e.displayName,iconId:e.id,onClick:t}),(0,A.jsxs)(j,{p:`md`,className:fx.drawerButton,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description}),r.length>0&&(0,A.jsxs)(j,{mt:`sm`,children:[(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,mb:`xs`,children:`Secrets`}),(0,A.jsx)(Bh,{gap:`xs`,children:r.map(e=>(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)(jfe,{size:14,color:`var(--mantine-color-default-border)`}),(0,A.jsx)(N,{size:`sm`,children:e})]},e))})]})]}),(0,A.jsx)(Bh,{gap:0,children:n.map(([e,t])=>(0,A.jsx)(uW,{name:t?.displayName??e,description:t?.description??``},e))})]})},DXe=()=>{let[e,t]=(0,D.useState)(`main`);return e===`functions`?(0,A.jsx)(CXe,{onBack:()=>t(`main`)}):e===`flow`?(0,A.jsx)(vXe,{onBack:()=>t(`main`)}):e===`triggers`?(0,A.jsx)(yXe,{onBack:()=>t(`main`)}):e===`wire`?(0,A.jsx)(xXe,{onBack:()=>t(`main`)}):e===`transform`?(0,A.jsx)(SXe,{onBack:()=>t(`main`)}):e===`addons`?(0,A.jsx)(TXe,{onBack:()=>t(`main`),onSelectAddon:e=>t({type:`addonDetail`,addon:e})}):typeof e==`object`&&e.type===`addonDetail`?(0,A.jsx)(EXe,{addon:e.addon,onBack:()=>t(`addons`)}):(0,A.jsxs)(j,{children:[(0,A.jsx)(j,{p:`md`,className:fx.drawerButton,children:(0,A.jsx)(N,{size:`sm`,fw:600,children:`Add a node`})}),(0,A.jsxs)(Bh,{gap:0,children:[(0,A.jsx)(cW,{icon:ob,title:`Function`,description:`Call an internal function or RPC`,onClick:()=>t(`functions`)}),(0,A.jsx)(cW,{icon:fb,title:`Flow`,description:`Branch, merge or loop the flow, etc.`,onClick:()=>t(`flow`)}),(0,A.jsx)(cW,{icon:Yfe,title:`Transform`,description:`Edit, filter, and transform data`,onClick:()=>t(`transform`)}),(0,A.jsx)(cW,{icon:Db,title:`Addons`,description:`Third-party services and APIs`,onClick:()=>t(`addons`)}),(0,A.jsx)(cW,{icon:kb,title:`Triggers`,description:`HTTP, WebSocket, CLI, MCP, Queue, Scheduler`,onClick:()=>t(`triggers`)}),(0,A.jsx)(cW,{icon:yfe,title:`Wire`,description:`HTTP headers, session, channel, MCP tools`,onClick:()=>t(`wire`)})]})]})};const OXe=e=>{switch(e.type){case`addStep`:return(0,A.jsx)(DXe,{});default:return null}};var kXe={running:`blue`,completed:`green`,failed:`red`,cancelled:`gray`},dW=e=>new Date(e).toLocaleString(),fW=({run:e,selected:t,onSelect:n,onDelete:r})=>{let[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(!1);return i?(0,A.jsxs)(j,{py:`sm`,px:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-red-light)`},children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:6,children:`Delete this run? This can't be undone.`}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Xf,{size:`compact-xs`,color:`red`,leftSection:(0,A.jsx)(eb,{size:12}),onClick:()=>{r?.(e.id),a(!1)},children:`Yes`}),(0,A.jsx)(Xf,{size:`compact-xs`,variant:`default`,leftSection:(0,A.jsx)(Hb,{size:12}),onClick:()=>a(!1),children:`No`})]})]}):(0,A.jsx)(j,{py:`sm`,px:`sm`,style:{backgroundColor:t?`var(--mantine-color-blue-light)`:void 0,borderBottom:`1px solid var(--mantine-color-default-border)`,cursor:`pointer`},onClick:n,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,A.jsxs)(Sf,{gap:`xs`,justify:`space-between`,wrap:`nowrap`,align:`center`,children:[(0,A.jsxs)(Bh,{gap:2,style:{minWidth:0,flex:1},children:[(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,style:{minWidth:0},children:[(0,A.jsx)(Jf,{size:`sm`,color:kXe[e.status]||`gray`,variant:`filled`,circle:!0,children:` `}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,truncate:!0,children:e.label||e.id.slice(0,8)}),e.wire&&(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,children:e.wire.type})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,pl:18,children:dW(e.createdAt)})]}),r&&o&&(0,A.jsx)(_f,{variant:`subtle`,size:`md`,color:`gray`,onClick:e=>{e.stopPropagation(),a(!0)},title:`Delete run`,children:(0,A.jsx)(Hb,{size:16})})]})})};const pW=({runs:e,selectedId:t,onSelect:n,onClear:r,loading:i=!1,statusFilters:a=[`running`,`completed`,`failed`],title:o,emptyMessage:s=`No runs found`,onNewClick:c,newButtonLabel:l=`New`,onStatusFilterChange:u,onDelete:d})=>{let[f,p]=(0,D.useState)(`all`),m=(0,D.useMemo)(()=>f===`all`?e:e.filter(e=>e.status===f),[e,f]),h=e=>{p(e),u?.(e===`all`?void 0:e)},g=[{value:`all`,label:`All`},...a.map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))];return(0,A.jsxs)(Bh,{gap:0,className:fx.flexColumn,children:[a.length>0&&(0,A.jsx)(j,{px:`sm`,py:`xs`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(wh,{size:`sm`,fullWidth:!0,value:f,onChange:h,data:g})}),(0,A.jsxs)(Hd,{className:fx.flexGrow,children:[c&&(0,A.jsx)(j,{py:`sm`,px:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,cursor:`pointer`},onClick:c,children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ob,{size:16,color:`var(--mantine-color-primary-6)`}),(0,A.jsx)(N,{size:`sm`,fw:500,c:`primary`,children:l})]})}),i?(0,A.jsx)(j,{p:`md`,ta:`center`,children:(0,A.jsx)(mf,{size:`sm`})}):m.length===0?(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ta:`center`,py:`md`,children:s}):(0,A.jsx)(Bh,{gap:0,children:m.map(e=>(0,A.jsx)(fW,{run:e,selected:e.id===t,onSelect:()=>n(e.id),onDelete:d},e.id))})]})]})};var AXe={succeeded:`var(--pikku-status-succeeded, var(--mantine-color-green-4))`,failed:`var(--pikku-status-failed, var(--mantine-color-red-4))`,running:`var(--pikku-status-running, var(--mantine-color-blue-4))`,scheduled:`var(--pikku-status-scheduled, var(--mantine-color-orange-4))`,pending:`var(--pikku-status-pending, var(--mantine-color-gray-4))`,suspended:`var(--pikku-status-suspended, var(--mantine-color-yellow-4))`,cancelled:`var(--pikku-status-cancelled, var(--mantine-color-gray-5))`,skipped:`var(--pikku-status-skipped, var(--mantine-color-gray-4))`},jXe=(e,t,n)=>{let r=n||t.colors.gray[5],i=t.radius.md;switch(e){case`left`:return{left:0,top:0,bottom:0,width:4,height:`auto`,backgroundColor:r,borderTopLeftRadius:i,borderBottomLeftRadius:i};case`top`:return{left:0,right:0,top:0,width:`auto`,height:4,backgroundColor:r,borderTopLeftRadius:i,borderTopRightRadius:i};case`right`:default:return{right:0,top:0,bottom:0,width:4,height:`auto`,backgroundColor:r,borderTopRightRadius:i,borderBottomRightRadius:i}}},mW=(e,t)=>e?e===`focused`?t.colors?.primary?.[5]??t.colors?.blue?.[5]??`#228be6`:t.colors?.referencedNode?.[5]??t.colors?.violet?.[5]??`#7950f2`:null;const hW=({icon:e,colorKey:t,hasInput:n=!1,outputHandles:r=[],size:i=80,label:a,labelDimmed:o=!0,subtitle:s,onClick:c,borderPosition:l=`right`,showBorder:u=!0,borderColor:d,highlightType:f=null,nodeId:p})=>{let m=ds(),h=mW(f,m),g=Wk(),_=D.useMemo(()=>{if(!g?.selectedRunId||!p)return null;let e=g.stepStates.get(p)?.status;return!e&&!n&&g.stepStates.size===0&&g.runData?.status===`failed`&&(e=`failed`),e?AXe[e]??null:null},[g?.selectedRunId,g?.stepStates,g?.runData?.status,p,n]),v=h||(_?`white`:m.colors.gray[5]||t);return(0,A.jsxs)(j,{style:{width:i,overflow:`visible`},children:[(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:i,h:i,pos:`relative`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:c?`pointer`:`default`,..._?{background:_}:{}},onClick:c,children:[n&&(0,A.jsx)(bU,{type:`target`,position:cU.Left,style:{cursor:`default`}}),(0,A.jsx)(j,{style:{verticalAlign:`middle`,color:v},children:(0,A.jsx)(e,{size:50})}),u&&(0,A.jsx)(j,{pos:`absolute`,style:jXe(l,m,d)}),r.length>0&&r.map((e,t)=>{let n=r.length,i=n===1?50:25+50/(n-1)*t,a=e.label&&n>1;return(0,A.jsxs)(D.Fragment,{children:[(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:e.id,style:{top:`${i}%`,cursor:`default`}}),a&&(0,A.jsx)(N,{size:`10px`,c:`dimmed`,pos:`absolute`,style:{right:-4,top:`${i}%`,transform:`translate(100%, -50%)`,whiteSpace:`nowrap`,backgroundColor:`var(--mantine-color-body)`,padding:`2px 5px`,borderRadius:2},children:e.label})]},e.id)})]}),(a||s)&&(0,A.jsxs)(j,{style:{position:`absolute`,top:i+12,left:`50%`,transform:`translateX(-50%)`,textAlign:`center`,width:i*2},children:[a&&(0,A.jsx)(N,{size:`sm`,fw:600,c:h||(o?`dimmed`:void 0),children:a}),s&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:s})]})]})};var MXe={http:`http`,queue:`queue`,cli:`cli`,"mcp-tool":`mcp`,"mcp-prompt":`mcp`,"mcp-resource":`mcp`,schedule:`scheduler`,trigger:`trigger`},NXe={http:Xfe,queue:yb,cli:Ib,"mcp-tool":Vb,"mcp-prompt":Dfe,"mcp-resource":Ofe,schedule:ab,trigger:Ub};const gW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=Wk(),a=ds(),o=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),s=D.useCallback(()=>{n(t,`trigger`)},[t,n]),c=NXe[e.triggerType]||Ub,l={http:`HTTP`,queue:`Queue`,cli:`CLI`,"mcp-tool":`MCP Tool`,"mcp-prompt":`MCP Prompt`,"mcp-resource":`MCP Resource`,schedule:`Schedule`,trigger:`Trigger`}[e.triggerType]||`Trigger`,u=D.useMemo(()=>{let t=i?.runData?.wire;if(!t)return;let n=MXe[e.triggerType];if(t.type===n)return e.wireId&&t.id?t.id===e.wireId?a.colors[e.colorKey]?.[5]:void 0:a.colors[e.colorKey]?.[5]},[i?.runData?.wire,e.triggerType,e.wireId,e.colorKey,a]);return(0,A.jsx)(hW,{icon:c,colorKey:e.colorKey,hasInput:!1,outputHandles:e.outputHandles,size:80,label:l,subtitle:e.label===l?void 0:e.label,onClick:s,borderPosition:`left`,borderColor:u,highlightType:o,nodeId:t})},PXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`http`,triggerType:`http`,label:`${n.method?.toUpperCase()||`GET`} ${n.route||``}`,wireId:`${n.method?.toLowerCase()||`get`}:${n.route||``}`,outputHandles:r,nodeType:`wiring`}}},FXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`queue`,triggerType:`queue`,label:n.name||`Queue`,wireId:n.name,outputHandles:r,nodeType:`wiring`}}},IXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`cli`,triggerType:`cli`,label:n.command||`CLI`,wireId:n.command,outputHandles:r,nodeType:`wiring`}}},LXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-tool`,label:n.name||`MCP Tool`,wireId:n.name?`tool:${n.name}`:void 0,outputHandles:r,nodeType:`wiring`}}},RXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-prompt`,label:n.name||`MCP Prompt`,wireId:n.name?`prompt:${n.name}`:void 0,outputHandles:r,nodeType:`wiring`}}},zXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-resource`,label:n.uri||`MCP Resource`,wireId:n.uri?`resource:${n.uri}`:void 0,outputHandles:r,nodeType:`wiring`}}},BXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`schedule`,triggerType:`schedule`,label:n.cron||n.interval||`Schedule`,wireId:n.cron||n.interval,outputHandles:r,nodeType:`wiring`}}},VXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`trigger`,triggerType:`trigger`,label:n.name||`Trigger`,wireId:n.name,outputHandles:r,nodeType:`wiring`}}},HXe=({size:e=40})=>(0,A.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 48 48`,fill:`currentColor`,children:[(0,A.jsx)(`path`,{d:`M24,25.9a14.7,14.7,0,0,1,3.5-9.6,2,2,0,0,0-3-2.6A18.2,18.2,0,0,0,20,25.9a18.4,18.4,0,0,0,4.5,12.5A2.2,2.2,0,0,0,26,39a2.4,2.4,0,0,0,1.4-.5,2.2,2.2,0,0,0,.1-2.9A14.2,14.2,0,0,1,24,25.9Z`}),(0,A.jsx)(`path`,{d:`M41.5,13.7a2,2,0,0,0-3,2.6A14.7,14.7,0,0,1,42,25.9a14.2,14.2,0,0,1-3.5,9.7,2.2,2.2,0,0,0,.1,2.9A2.4,2.4,0,0,0,40,39a2.2,2.2,0,0,0,1.5-.6A18.4,18.4,0,0,0,46,25.9,18.2,18.2,0,0,0,41.5,13.7Z`}),(0,A.jsx)(`path`,{d:`M38.7,30.9,35.4,26l3.3-4.9a2,2,0,1,0-3.4-2.2L33,22.4l-2.3-3.5a2,2,0,1,0-3.4,2.2L30.6,26l-3.3,4.9a2.1,2.1,0,0,0,.6,2.8A2,2,0,0,0,29,34a2.1,2.1,0,0,0,1.7-.9L33,29.6l2.3,3.5A2.1,2.1,0,0,0,37,34a2,2,0,0,0,1.1-.3A2.1,2.1,0,0,0,38.7,30.9Z`}),(0,A.jsx)(`path`,{d:`M18,15H15.8l.5-3.5A3.9,3.9,0,0,1,20.2,8H22a2,2,0,0,0,0-4H20.2a8.1,8.1,0,0,0-7.9,6.9L11.7,15H9a2,2,0,0,0,0,4h2.2L8.7,36.5A3.9,3.9,0,0,1,4.8,40H4a2,2,0,0,0,0,4h.8a8.1,8.1,0,0,0,7.9-6.9L15.2,19H18a2,2,0,0,0,0-4Z`})]}),UXe=({data:e,id:t,inFlow:n=!0})=>{let{data:r}=Yk(e.title),{openFunction:i,openWorkflowStep:a}=_x(),o=Kk(),s=D.useMemo(()=>!o||!e.inWorkflow?null:o.focusedNodeId===t?`focused`:o.referencedNodeId===t?`referenced`:null,[o,e.inWorkflow,t]),c=D.useCallback(()=>{e.inWorkflow?a(t,`rpc`):i(e.title,r)},[e.title,e.inWorkflow,t,r,i,a]),l=!!e.stepName,u=e.stepName||e.description||e.title,d=l?e.title:void 0;return(0,A.jsx)(hW,{icon:HXe,colorKey:e.colorKey,hasInput:n,outputHandles:e.terminal?[]:[{id:`default`,label:``}],size:80,label:u,labelDimmed:!l,subtitle:d,onClick:c,showBorder:!1,highlightType:s,nodeId:t})},WXe=(e,t,n,r,i,a,o)=>({id:e,type:`functionNode`,position:n,data:{type:`Function`,title:t,stepName:r,colorKey:`function`,nodeType:`rpc`,inWorkflow:o!==void 0}}),_W=({data:e,hasInput:t=!1,hasOutput:n=!0,outputHandles:r,additionalBody:i,width:a=200,hideMetadataIndicators:o=!1,inFlow:s=!0})=>(ds(),(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:a,pos:`relative`,children:[s&&t&&(0,A.jsx)(bU,{type:`target`,position:cU.Left,style:{cursor:`default`}}),(0,A.jsx)(j,{p:`sm`,className:`nodrag`,style:{cursor:e.onClick?`pointer`:`default`},onClick:e.onClick,children:(0,A.jsxs)(Bh,{gap:4,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,lineClamp:2,children:e.title}),e.description&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:e.description}),e.tags&&e.tags.length>0&&(0,A.jsx)(Sf,{gap:4,children:e.tags.map(t=>(0,A.jsx)(eS,{type:`dynamic`,badge:`tag`,value:t,size:`sm`,variant:`light`,color:e.colorKey},t))}),!o&&(e.auth!==void 0||e.permissionsCount&&e.permissionsCount>0||e.middlewareCount&&e.middlewareCount>0)&&(0,A.jsxs)(Sf,{gap:6,children:[e.auth!==void 0&&(e.auth?(0,A.jsx)(bb,{size:12,strokeWidth:2}):(0,A.jsx)(Mfe,{size:12,strokeWidth:2})),e.permissionsCount!==void 0&&e.permissionsCount>0&&(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(Pb,{size:12,strokeWidth:2}),(0,A.jsx)(N,{size:`sm`,fw:500,children:e.permissionsCount})]}),e.middlewareCount!==void 0&&e.middlewareCount>0&&(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(hb,{size:12,strokeWidth:2}),(0,A.jsx)(N,{size:`sm`,fw:500,children:e.middlewareCount})]})]}),i]})}),s&&(r&&r.length>0?r.map((e,t)=>{let n=r.length;return(0,A.jsxs)(j,{pos:`absolute`,right:-12,style:{top:`${n===1?50:25+50/(n-1)*t}%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,fw:500,children:e.label||e.id}),(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:e.id,style:{position:`relative`,right:0,transform:`none`,cursor:`default`}})]},e.id)}):n&&(0,A.jsx)(bU,{type:`source`,position:cU.Right,style:{cursor:`default`}}))]})),GXe=({data:e})=>(0,A.jsx)(_W,{data:e,hasInput:!1,hasOutput:!0,width:250}),KXe=({data:e})=>(0,A.jsx)(_W,{data:e,hasInput:!0,hasOutput:!0,width:200}),qXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`sleep`)},[t,n]);return(0,A.jsx)(hW,{icon:wb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Sleep`,subtitle:e.description,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},JXe=(e,t,n)=>({id:e,type:`sleepNode`,position:t,data:{colorKey:`workflow`,title:n.duration,description:n.stepName,nodeType:`flow`}}),vW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`inline`)},[t,n]);return(0,A.jsx)(_W,{data:{...e,onClick:r},hasInput:!0,hasOutput:!0,width:200,additionalBody:e.inWorkflow?(0,A.jsxs)(kh,{cols:2,px:`1rem`,c:`dimmed`,mt:`xs`,style:{alignItems:`center`},children:[(0,A.jsxs)(j,{pos:`relative`,style:{justifySelf:`center`},children:[(0,A.jsx)(Rfe,{size:16,strokeWidth:2}),e.workflowRetries!==void 0&&e.workflowRetries>0&&(0,A.jsx)(eS,{type:`label`,size:`sm`,pos:`absolute`,top:-8,right:-8,circle:!0,style:{minWidth:12,height:12,padding:2,width:`fit-content`},children:e.workflowRetries})]}),(0,A.jsxs)(j,{pos:`relative`,style:{justifySelf:`center`},children:[(0,A.jsx)(Lb,{size:16,strokeWidth:2}),e.workflowRetryDelay!==void 0&&e.workflowRetryDelay>0&&(0,A.jsx)(eS,{type:`label`,size:`sm`,pos:`absolute`,top:-8,right:-8,circle:!0,style:{minWidth:12,height:12,padding:2,width:`fit-content`},children:e.workflowRetryDelay})]})]}):void 0})},YXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[{id:`true`,label:`if`}];if(e.branchCount&&e.branchCount>1)for(let n=1;n<e.branchCount;n++)t.push({id:`branch-${n}`,label:`elif ${n}`});return e.hasElse&&t.push({id:`false`,label:`else`}),t.push({id:`after`,label:`next`}),t},[e.hasElse,e.branchCount]),o=D.useCallback(()=>{n(t,`branch`)},[t,n]);return(0,A.jsx)(hW,{icon:Wfe,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Branch`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},XXe=(e,t,n)=>{let r=!!n.elseEntry,i=n.branches?.length||(n.thenEntry?1:0);return{id:e,type:`branchNode`,position:t,data:{colorKey:`workflow`,condition:n.condition||`condition`,hasElse:r,branchCount:i,stepName:n.stepName,nodeType:`flow`}}},yW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=[{id:`each`,label:`each`},{id:`done`,label:`done`}],o=D.useCallback(()=>{n(t,`fanout`)},[t,n]);return(0,A.jsx)(hW,{icon:Ife,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Loop`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},bW=(e,t,n)=>({id:e,type:`fanoutNode`,position:t,data:{colorKey:`workflow`,childRpc:n.childRpc||n.eachRpc,stepName:n.stepName,nodeType:`flow`}}),ZXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`return`)},[t,n]);return(0,A.jsx)(hW,{icon:Lfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[],size:80,label:`Return`,subtitle:e.stepName,onClick:a,highlightType:i,nodeId:t})},QXe=(e,t,n)=>({id:e,type:`returnNode`,position:t,data:{colorKey:`workflow`,stepName:n.stepName,nodeType:`flow`}}),$Xe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`cancel`)},[t,n]);return(0,A.jsx)(hW,{icon:xfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[],size:80,label:`Cancel`,subtitle:e.stepName,onClick:r,nodeId:t})},eZe=(e,t,n)=>({id:e,type:`cancelNode`,position:t,data:{colorKey:`workflow`,stepName:n.stepName,nodeType:`flow`}}),tZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[];return e.cases&&e.cases.length>0&&e.cases.forEach(e=>{t.push({id:`case-${e.value}`,label:e.value})}),t.push({id:`default`,label:`default`}),t.push({id:`after`,label:`after`}),t},[e.cases]),o=D.useCallback(()=>{n(t,`switch`)},[t,n]);return(0,A.jsx)(hW,{icon:fb,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Switch`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},xW=(e,t,n)=>({id:e,type:`switchNode`,position:t,data:{colorKey:`workflow`,expression:n.expression,cases:n.cases,stepName:n.stepName,nodeType:`flow`}}),nZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`arrayPredicate`)},[t,n]),o=e.mode===`some`?`Some`:e.mode===`every`?`Every`:`Check`;return(0,A.jsx)(hW,{icon:rb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:o,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},SW=(e,t,n)=>({id:e,type:`arrayPredicateNode`,position:t,data:{colorKey:`workflow`,mode:n.mode,sourceVar:n.sourceVar,itemVar:n.itemVar,outputVar:n.outputVar,stepName:n.stepName,nodeType:`flow`}}),rZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`filter`)},[t,n]);return(0,A.jsx)(hW,{icon:kfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Filter`,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},iZe=(e,t,n)=>({id:e,type:`filterNode`,position:t,data:{colorKey:`workflow`,sourceVar:n.sourceVar,itemVar:n.itemVar,outputVar:n.outputVar,stepName:n.stepName,nodeType:`flow`}}),aZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[],n=e.childrenCount||0;for(let e=0;e<n;e++)t.push({id:`child-${e}`,label:`${e+1}`});return t.push({id:`done`,label:`done`}),t},[e.childrenCount]),o=D.useCallback(()=>{n(t,`parallel`)},[t,n]);return(0,A.jsx)(hW,{icon:Bb,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Parallel`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},oZe=(e,t,n)=>({id:e,type:`parallelNode`,position:t,data:{colorKey:`workflow`,childrenCount:n.children?.length||0,stepName:n.stepName,nodeType:`flow`}});var CW=({label:e,handleId:t,hasTarget:n})=>(0,A.jsxs)(j,{px:`xs`,pl:`md`,py:4,style:{position:`relative`,opacity:n?1:.4,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e}),n&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(vfe,{size:12}),(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:t,style:{background:`var(--mantine-color-teal-6)`,width:8,height:8,right:-4}})]})]});const sZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=ds(),i=D.useCallback(()=>{n(t,`trigger`)},[t,n]),a=e.onMessageRoute?Object.entries(e.onMessageRoute):[];return(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:180,style:{cursor:`pointer`,overflow:`hidden`,position:`relative`},onClick:i,children:[(0,A.jsx)(j,{pos:`absolute`,left:0,top:0,bottom:0,w:4,style:{backgroundColor:r.colors.gray[5],borderTopLeftRadius:r.radius.md,borderBottomLeftRadius:r.radius.md}}),(0,A.jsxs)(Bh,{gap:0,py:4,children:[(0,A.jsx)(CW,{label:`onConnect`,handleId:`onConnect`,hasTarget:!!e.onConnect}),(0,A.jsx)(CW,{label:`onMessage`,handleId:`onMessage`,hasTarget:!!e.onMessage}),a.map(([e,t])=>(0,A.jsx)(CW,{label:`→ ${e}`,handleId:`route-${e}`,hasTarget:!!t},e)),(0,A.jsx)(CW,{label:`onDisconnect`,handleId:`onDisconnect`,hasTarget:!!e.onDisconnect})]})]})},cZe=(e,t,n)=>({id:e,type:`channelWiringNode`,position:t,data:{colorKey:`teal`,channelName:n.name||`Channel`,onConnect:n.onConnect,onDisconnect:n.onDisconnect,onMessage:n.onMessage,onMessageRoute:n.onMessageRoute,nodeType:`wiring`}}),lZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`set`)},[t,n]);return(0,A.jsx)(hW,{icon:Tb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Set`,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},uZe=(e,t,n)=>({id:e,type:`setNode`,position:t,data:{colorKey:`workflow`,variable:n.variable,stepName:n.stepName,nodeType:`flow`}}),dZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`generic`)},[t,n]);return(0,A.jsx)(_W,{data:{...e,onClick:r},hasInput:!0,hasOutput:!0,width:200})},fZe=(e,t,n)=>({id:e,type:`genericNode`,position:t,data:{icon:Sfe,colorKey:`generic`,title:`Generic Node (Implementation Needed)`,description:n.stepName,nodeType:`internal`}});function wW(e,t,n,r,i){let a={id:e,source:t,target:n,...i&&{sourceHandle:i}};return r&&(a.label=r,a.labelStyle={fontSize:10,fill:`rgba(255,255,255,0.4)`,fontFamily:`monospace`},a.labelBgStyle={fill:`rgba(255,255,255,0.05)`,fillOpacity:1}),a}function TW(e){return e.rpcName?`rpc`:e.flow?e.flow:`unknown`}function pZe(e,t,n,r){let i=[],a=[],o=TW(e);switch(o){case`rpc`:{let a=WXe(t,e.rpcName,n,e.stepName,r,void 0,e);i.push(a);break}case`sleep`:{let r=JXe(t,n,e);i.push(r);break}case`inline`:{let a=WXe(t,`inline`,n,e.stepName,r,void 0,e);i.push(a);break}case`branch`:{let r=XXe(t,n,e);i.push(r);break}case`switch`:{let r=xW(t,n,e);i.push(r);break}case`fanout`:{let r=bW(t,n,e);i.push(r);break}case`arrayPredicate`:{let r=SW(t,n,e);i.push(r);break}case`filter`:{let r=iZe(t,n,e);i.push(r);break}case`parallel`:{let r=oZe(t,n,e);i.push(r);break}case`return`:{let r=QXe(t,n,e);i.push(r);break}case`cancel`:{let r=eZe(t,n,e);i.push(r);break}case`set`:{let r=uZe(t,n,e);i.push(r);break}default:{let r=fZe(t,n,e);i.push(r);break}}return{nodes:i,edges:a,stepType:o}}function EW(e,t){if(t===`next`){if(e===`fanout`||e===`parallel`)return`done`;if(e===`branch`||e===`switch`)return`after`}if(t===`then`)return`true`;if(t===`child`)return`each`;if(t.startsWith(`case-`))return t;if(t===`default`)return`default`;if(t.startsWith(`parallel-`))return`child-${t.replace(`parallel-`,``)}`}function mZe(e){let t=[],n=[],r=e.nodes,i=e.entryNodeIds,a=e.wires;if(!r||Object.keys(r).length===0)return{nodes:t,edges:n};let o=new Set,s=new Map,c=new Map,l=0,u=0;Object.values(r).forEach(e=>{if(e.flow===`parallel`&&e.children){let t=new Set(e.children);e.children.forEach(e=>{c.set(e,t)})}});function d(e,i=0){if(o.has(e))return;let a=r[e];if(!a)return;o.add(e);let u={x:325+i*250,y:l};s.set(e,u),l+=100;let f=TW(a),p=pZe(a,e,u);if(t.push(...p.nodes),n.push(...p.edges),f===`branch`&&(a.thenEntry&&(n.push(wW(`${e}-to-${a.thenEntry}`,e,a.thenEntry,void 0,EW(f,`then`))),d(a.thenEntry,i+1)),a.elseEntry&&(n.push(wW(`${e}-to-${a.elseEntry}`,e,a.elseEntry,void 0,`false`)),d(a.elseEntry,i+1)),a.branches&&Array.isArray(a.branches)&&a.branches.forEach((t,r)=>{t.entry&&(n.push(wW(`${e}-branch-${r}-to-${t.entry}`,e,t.entry,void 0,r===0?`true`:`branch-${r}`)),d(t.entry,i+1))})),f===`switch`&&(a.cases&&a.cases.forEach((t,r)=>{t.entry&&(n.push(wW(`${e}-case-${r}-to-${t.entry}`,e,t.entry,void 0,EW(f,`case-${t.value}`))),d(t.entry,i+1))}),a.defaultEntry&&(n.push(wW(`${e}-default-to-${a.defaultEntry}`,e,a.defaultEntry,void 0,EW(f,`default`))),d(a.defaultEntry,i+1))),f===`fanout`&&a.childEntry&&(n.push(wW(`${e}-to-${a.childEntry}`,e,a.childEntry,void 0,EW(f,`child`))),d(a.childEntry,i+1)),f===`parallel`&&a.children&&a.children.forEach((t,r)=>{n.push(wW(`${e}-parallel-${r}-to-${t}`,e,t,void 0,EW(f,`parallel-${r}`))),d(t,i+1)}),a.next){let t=Array.isArray(a.next)?a.next:[a.next],r=c.get(e);t.forEach(t=>{r&&r.has(t)||n.push(wW(`${e}-to-${t}`,e,t,void 0,EW(f,`next`))),d(t,i)})}}if(i&&i.length>0)i.forEach(e=>{d(e)});else{let e=Object.keys(r)[0];e&&d(e)}return a&&(a.http&&Array.isArray(a.http)&&a.http.forEach((e,r)=>{let i=`http-trigger-${r}`,a={x:50,y:u};u+=120;let o=PXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.channel&&Array.isArray(a.channel)&&a.channel.forEach((e,r)=>{let i=`channel-trigger-${r}`,a={x:50,y:u},o=e.onMessageRoute?Object.keys(e.onMessageRoute).length:0;u+=100+o*30;let s=cZe(i,a,e);t.push(s),e.onConnect&&n.push(wW(`${i}-onConnect-to-${e.onConnect}`,i,e.onConnect,void 0,`onConnect`)),e.onMessage&&n.push(wW(`${i}-onMessage-to-${e.onMessage}`,i,e.onMessage,void 0,`onMessage`)),e.onMessageRoute&&Object.entries(e.onMessageRoute).forEach(([e,t])=>{t&&n.push(wW(`${i}-route-${e}-to-${t}`,i,t,void 0,`route-${e}`))}),e.onDisconnect&&n.push(wW(`${i}-onDisconnect-to-${e.onDisconnect}`,i,e.onDisconnect,void 0,`onDisconnect`))}),a.queue&&Array.isArray(a.queue)&&a.queue.forEach((e,r)=>{let i=`queue-trigger-${r}`,a={x:50,y:u};u+=120;let o=FXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.cli&&Array.isArray(a.cli)&&a.cli.forEach((e,r)=>{let i=`cli-trigger-${r}`,a={x:50,y:u};u+=120;let o=IXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp&&(a.mcp.tool&&Array.isArray(a.mcp.tool)&&a.mcp.tool.forEach((e,r)=>{let i=`mcp-tool-trigger-${r}`,a={x:50,y:u};u+=120;let o=LXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp.prompt&&Array.isArray(a.mcp.prompt)&&a.mcp.prompt.forEach((e,r)=>{let i=`mcp-prompt-trigger-${r}`,a={x:50,y:u};u+=120;let o=RXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp.resource&&Array.isArray(a.mcp.resource)&&a.mcp.resource.forEach((e,r)=>{let i=`mcp-resource-trigger-${r}`,a={x:50,y:u};u+=120;let o=zXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))})),a.schedule&&Array.isArray(a.schedule)&&a.schedule.forEach((e,r)=>{let i=`schedule-trigger-${r}`,a={x:50,y:u};u+=120;let o=BXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.trigger&&Array.isArray(a.trigger)&&a.trigger.forEach((e,r)=>{let i=`named-trigger-${r}`,a={x:50,y:u};u+=120;let o=VXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))})),{nodes:t,edges:n}}var hZe=new(u(s(((e,t)=>{(function(n){if(typeof e==`object`&&t!==void 0)t.exports=n();else if(typeof define==`function`&&define.amd)define([],n);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.ELK=n()}})(function(){return(function(){function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof f==`function`&&f;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=Error(`Cannot find module '`+o+`'`);throw l.code=`MODULE_NOT_FOUND`,l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a=typeof f==`function`&&f,o=0;o<r.length;o++)i(r[o]);return i}return e})()({1:[function(e,t,n){Object.defineProperty(n,`__esModule`,{value:!0}),n.default=void 0;function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function s(e){var t=c(e,`string`);return r(t)==`symbol`?t:t+``}function c(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}n.default=function(){function e(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=n.defaultLayoutOptions,a=r===void 0?{}:r,o=n.algorithms,s=o===void 0?[`layered`,`stress`,`mrtree`,`radial`,`force`,`disco`,`sporeOverlap`,`sporeCompaction`,`rectpacking`,`vertiflex`]:o,c=n.workerFactory,u=n.workerUrl;if(i(this,e),this.defaultLayoutOptions=a,this.initialized=!1,u===void 0&&c===void 0)throw Error(`Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.`);var d=c;u!==void 0&&c===void 0&&(d=function(e){return new Worker(e)});var f=d(u);if(typeof f.postMessage!=`function`)throw TypeError(`Created worker does not provide the required 'postMessage' function.`);this.worker=new l(f),this.worker.postMessage({cmd:`register`,algorithms:s}).then(function(e){return t.initialized=!0}).catch(console.err)}return o(e,[{key:`layout`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.layoutOptions,r=n===void 0?this.defaultLayoutOptions:n,i=t.logging,a=i===void 0?!1:i,o=t.measureExecutionTime,s=o===void 0?!1:o;return e?this.worker.postMessage({cmd:`layout`,graph:e,layoutOptions:r,options:{logging:a,measureExecutionTime:s}}):Promise.reject(Error(`Missing mandatory parameter 'graph'.`))}},{key:`knownLayoutAlgorithms`,value:function(){return this.worker.postMessage({cmd:`algorithms`})}},{key:`knownLayoutOptions`,value:function(){return this.worker.postMessage({cmd:`options`})}},{key:`knownLayoutCategories`,value:function(){return this.worker.postMessage({cmd:`categories`})}},{key:`terminateWorker`,value:function(){this.worker&&this.worker.terminate()}}])}();var l=function(){function e(t){var n=this;if(i(this,e),t===void 0)throw Error(`Missing mandatory parameter 'worker'.`);this.resolvers={},this.worker=t,this.worker.onmessage=function(e){setTimeout(function(){n.receive(n,e)},0)}}return o(e,[{key:`postMessage`,value:function(e){var t=this.id||0;this.id=t+1,e.id=t;var n=this;return new Promise(function(r,i){n.resolvers[t]=function(e,t){e?(n.convertGwtStyleError(e),i(e)):r(t)},n.worker.postMessage(e)})}},{key:`receive`,value:function(e,t){var n=t.data,r=e.resolvers[n.id];r&&(delete e.resolvers[n.id],n.error?r(n.error):r(null,n.data))}},{key:`terminate`,value:function(){this.worker&&this.worker.terminate()}},{key:`convertGwtStyleError`,value:function(e){if(e){var t=e.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(e.cause=t.cause.backingJsObject,this.convertGwtStyleError(e.cause)),delete e.__java$exception)}}}])}()},{}],2:[function(e,t,n){(function(e){(function(){var r;typeof window<`u`?r=window:e===void 0?typeof self<`u`&&(r=self):r=e;var i;function a(){}function o(){}function s(){}function c(){}function l(){}function u(){}function d(){}function f(){}function p(){}function m(){}function h(){}function g(){}function _(){}function v(){}function y(){}function b(){}function x(){}function S(){}function C(){}function w(){}function T(){}function E(){}function D(){}function O(){}function k(){}function ee(){}function te(){}function ne(){}function re(){}function ie(){}function ae(){}function oe(){}function se(){}function ce(){}function le(){}function ue(){}function de(){}function fe(){}function pe(){}function me(){}function he(){}function ge(){}function _e(){}function ve(){}function ye(){}function be(){}function xe(){}function Se(){}function Ce(){}function we(){}function Te(){}function Ee(){}function De(){}function Oe(){}function ke(){}function Ae(){}function je(){}function Me(){}function Ne(){}function Pe(){}function Fe(){}function Ie(){}function Le(){}function Re(){}function ze(){}function Be(){}function Ve(){}function He(){}function Ue(){}function We(){}function Ge(){}function Ke(){}function qe(){}function Je(){}function Ye(){}function Xe(){}function Ze(){}function Qe(){}function $e(){}function et(){}function tt(){}function nt(){}function rt(){}function it(){}function at(){}function ot(){}function st(){}function ct(){}function lt(){}function ut(){}function dt(){}function ft(){}function pt(){}function mt(){}function ht(){}function gt(){}function _t(){}function vt(){}function yt(){}function bt(){}function xt(){}function St(){}function Ct(){}function wt(){}function Tt(){}function Et(){}function Dt(){}function Ot(){}function kt(){}function At(){}function jt(){}function Mt(){}function Nt(){}function Pt(){}function eee(){}function tee(){}function Ft(){}function It(){}function Lt(){}function Rt(){}function nee(){}function zt(){}function Bt(){}function ree(){}function Vt(){}function Ht(){}function Ut(){}function Wt(){}function iee(){}function Gt(){}function Kt(){}function aee(){}function oee(){}function qt(){}function see(){}function Jt(){}function cee(){}function Yt(){}function Xt(){}function lee(){}function Zt(){}function Qt(){}function $t(){}function en(){}function tn(){}function nn(){}function uee(){}function rn(){}function dee(){}function an(){}function on(){}function sn(){}function cn(){}function ln(){}function un(){}function dn(){}function fn(){}function pn(){}function mn(){}function hn(){}function gn(){}function _n(){}function vn(){}function yn(){}function fee(){}function bn(){}function xn(){}function Sn(){}function Cn(){}function wn(){}function pee(){}function Tn(){}function mee(){}function hee(){}function En(){}function gee(){}function _ee(){}function vee(){}function yee(){}function Dn(){}function bee(){}function xee(){}function On(){}function kn(){}function An(){}function See(){}function Cee(){}function jn(){}function Mn(){}function wee(){}function Nn(){}function Tee(){}function Pn(){}function Fn(){}function Eee(){}function In(){}function Dee(){}function Ln(){}function Rn(){}function zn(){}function Bn(){}function Vn(){}function Hn(){}function Un(){}function Wn(){}function Gn(){}function Kn(){}function qn(){}function Jn(){}function Yn(){}function Xn(){}function Zn(){}function Oee(){}function kee(){}function Qn(){}function Aee(){}function $n(){}function er(){}function tr(){}function nr(){}function rr(){}function jee(){}function ir(){}function ar(){}function Mee(){}function or(){}function sr(){}function cr(){}function lr(){}function Nee(){}function ur(){}function dr(){}function fr(){}function Pee(){}function pr(){}function mr(){}function hr(){}function gr(){}function _r(){}function Fee(){}function Iee(){}function vr(){}function Lee(){}function yr(){}function br(){}function xr(){}function Sr(){}function Cr(){}function wr(){}function Tr(){}function A(){}function Er(){}function Dr(){}function Ree(){}function Or(){}function kr(){}function zee(){}function Ar(){}function jr(){}function Mr(){}function Nr(){}function Pr(){}function Fr(){}function Ir(){}function Bee(){}function Lr(){}function Vee(){}function Rr(){}function zr(){}function Br(){}function Vr(){}function Hr(){}function Ur(){}function Wr(){}function Gr(){}function Kr(){}function qr(){}function Jr(){}function Yr(){}function Xr(){}function Zr(){}function Qr(){}function $r(){}function ei(){}function ti(){}function ni(){}function ri(){}function ii(){}function ai(){}function oi(){}function si(){}function ci(){}function li(){}function ui(){}function di(){}function fi(){}function pi(){}function mi(){}function hi(){}function gi(){}function _i(){}function vi(){}function yi(){}function bi(){}function xi(){}function Si(){}function Ci(){}function wi(){}function Hee(){}function Ti(){}function Ei(){}function Di(){}function Oi(){}function ki(){}function Ai(){}function ji(){}function Mi(){}function Ni(){}function Uee(){}function Pi(){}function Wee(){}function Gee(){}function Fi(){}function Ii(){}function Li(){}function Ri(){}function zi(){}function Bi(){}function Vi(){}function Hi(){}function Kee(){}function qee(){}function Ui(){}function Wi(){}function Gi(){}function Ki(){}function qi(){}function Ji(){}function Yi(){}function Xi(){}function Zi(){}function Qi(){}function $i(){}function ea(){}function ta(){}function na(){}function ra(){}function ia(){}function aa(){}function oa(){}function sa(){}function ca(){}function la(){}function ua(){}function Jee(){}function da(){}function fa(){}function pa(){}function ma(){}function ha(){}function ga(){}function _a(){}function va(){}function ya(){}function ba(){}function xa(){}function Sa(){}function Ca(){}function wa(){}function Ta(){}function Ea(){}function Da(){}function Oa(){}function ka(){}function Aa(){}function ja(){}function Ma(){}function Na(){}function Pa(){}function Fa(){}function Yee(){}function Ia(){}function La(){}function Ra(){}function Xee(){}function za(){}function Zee(){}function Ba(){}function Va(){}function Ha(){}function Ua(){}function Wa(){}function Ga(){}function Ka(){}function qa(){}function Ja(){}function Ya(){}function Xa(){}function Za(){}function Qa(){}function $a(){}function Qee(){}function $ee(){}function eo(){}function to(){}function no(){}function ro(){}function io(){}function ao(){}function oo(){}function so(){}function ete(){}function co(){}function lo(){}function uo(){}function fo(){}function po(){}function mo(){}function tte(){}function ho(){}function go(){}function _o(){}function vo(){}function yo(){}function bo(){}function xo(){}function nte(){}function So(){}function Co(){}function wo(){}function To(){}function Eo(){}function Do(){}function Oo(){}function ko(){}function Ao(){}function rte(){}function jo(){}function ite(){}function Mo(){}function No(){}function Po(){}function Fo(){}function Io(){}function ate(){}function Lo(){}function Ro(){}function ote(){}function zo(){}function Bo(){}function Vo(){}function Ho(){}function ste(){}function Uo(){}function cte(){}function Wo(){}function Go(){}function Ko(){}function qo(){}function Jo(){}function lte(){}function Yo(){}function Xo(){}function Zo(){}function Qo(){}function $o(){}function es(){}function ts(){}function ute(){}function dte(){}function fte(){}function ns(){}function rs(){}function is(){}function pte(){}function as(){}function os(){}function ss(){}function cs(){}function ls(){}function us(){}function ds(){}function fs(){}function ps(){}function ms(){}function hs(){}function gs(){}function _s(){}function vs(){}function ys(){}function bs(){}function xs(){}function Ss(){}function Cs(){}function ws(){}function Ts(){}function Es(){}function Ds(){}function Os(){}function ks(){}function As(){}function js(){}function Ms(){}function Ns(){}function Ps(){}function Fs(){}function Is(){}function Ls(){}function mte(){}function Rs(){}function hte(){}function zs(){}function Bs(){}function gte(){}function Vs(){}function Hs(){}function Us(){}function Ws(){}function Gs(){}function Ks(){}function qs(){}function Js(){}function Ys(){}function _te(){}function Xs(){}function Zs(){}function Qs(){}function vte(){}function $s(){}function ec(){}function yte(){}function tc(){}function nc(){}function rc(){}function ic(){}function ac(){}function bte(){}function oc(){}function xte(){}function sc(){}function cc(){}function lc(){}function Ste(){}function uc(){}function dc(){}function fc(){}function pc(){}function mc(){}function hc(){}function gc(){}function _c(){}function vc(){}function yc(){}function bc(){}function xc(){}function Sc(){}function Cte(){}function Cc(){}function wc(){}function wte(){}function Tc(){}function j(){}function Tte(){}function Ec(){}function Dc(){}function Oc(){}function kc(){}function Ac(){}function jc(){}function Mc(){}function Nc(){}function Pc(){}function Fc(){}function Ic(){}function Lc(){}function Rc(){}function zc(){}function Bc(){}function Vc(){}function Hc(){}function Uc(){}function Wc(){}function Gc(){}function Kc(){}function qc(){}function Jc(){}function Yc(){}function Xc(){}function Zc(){}function Qc(){}function $c(){}function el(){}function tl(){}function nl(){}function rl(){}function il(){}function al(){}function ol(){}function sl(){}function cl(){}function ll(){}function ul(){}function dl(){}function fl(){}function pl(){}function ml(){}function hl(){}function gl(){}function _l(){}function vl(){}function Ete(){}function yl(){}function bl(){}function xl(){}function Sl(){}function Cl(){}function wl(){}function Tl(){}function El(){}function Dl(){}function Ol(){}function Dte(){}function Ote(){}function kl(){}function Al(){}function jl(){}function Ml(){}function kte(){}function Ate(){}function Nl(){}function Pl(){}function jte(){}function Fl(){}function Il(){}function Mte(){}function Nte(){}function Ll(){}function Rl(){}function zl(){}function Bl(){}function Vl(){}function Hl(){}function Ul(){}function Wl(){}function Gl(){}function Pte(){}function Kl(){}function Fte(){}function Ite(){}function Lte(){}function ql(){}function Rte(){}function Jl(){}function Yl(){}function Xl(){}function Zl(){}function Ql(){}function $l(){}function eu(){}function tu(){}function nu(){lm()}function ru(){LYe()}function zte(){Bg()}function iu(){xq()}function au(){FGe()}function ou(){vH()}function su(){qC()}function Bte(){Ig()}function Vte(){zg()}function Hte(){uI()}function Ute(){Xje()}function Wte(){zL()}function Gte(){JU()}function cu(){mF()}function lu(){hF()}function uu(){uFe()}function du(){Ug()}function fu(){krt()}function Kte(){nDe()}function pu(){yMe()}function mu(){cFe()}function hu(){$Ee()}function gu(){QEe()}function _u(){eDe()}function vu(){aDe()}function yu(){nY()}function qte(){dFe()}function bu(){tke()}function Jte(){gF()}function Yte(){sDe()}function Xte(){SP()}function Zte(){dIe()}function xu(){K3e()}function Qte(){rW()}function $te(){iDe()}function Su(){BGe()}function ene(){A6e()}function Cu(){d$e()}function wu(){Lq()}function Tu(){HK()}function Eu(){v8e()}function tne(){aBe()}function Du(){CP()}function Ou(){BU()}function nne(){W4e()}function ku(){EWe()}function rne(){QBe()}function Au(){_U()}function ju(){IM()}function ine(){VU()}function Mu(){oY()}function Nu(){iR()}function ane(){SB()}function Pu(){Qq()}function Fu(){lI()}function Iu(){b_e()}function Lu(){Cq()}function Ru(e){NE(e)}function zu(e){this.a=e}function Bu(e){this.a=e}function Vu(e){this.a=e}function one(e){this.a=e}function sne(e){this.a=e}function Hu(e){this.a=e}function Uu(e){this.a=e}function Wu(e){this.a=e}function Gu(e){this.a=e}function cne(e){this.a=e}function Ku(e){this.a=e}function qu(e){this.a=e}function Ju(e){this.a=e}function Yu(e){this.c=e}function Xu(e){this.a=e}function Zu(e){this.a=e}function Qu(e){this.a=e}function $u(e){this.a=e}function lne(e){this.a=e}function ed(e){this.a=e}function une(e){this.a=e}function dne(e){this.a=e}function td(e){this.a=e}function fne(e){this.a=e}function nd(e){this.a=e}function rd(e){this.a=e}function id(e){this.a=e}function pne(e){this.a=e}function ad(e){this.a=e}function mne(e){this.a=e}function hne(e){this.a=e}function gne(e){this.a=e}function od(e){this.a=e}function sd(e){this.a=e}function cd(e){this.a=e}function ld(e){this.a=e}function ud(e){this.a=e}function dd(e){this.a=e}function fd(e){this.a=e}function _ne(e){this.a=e}function pd(e){this.a=e}function md(e){this.a=e}function hd(e){this.a=e}function gd(e){this.b=e}function _d(){this.a=[]}function vd(e,t){e.a=t}function yd(e,t){e.a=t}function bd(e,t){e.b=t}function xd(e,t){e.c=t}function Sd(e,t){e.c=t}function Cd(e,t){e.d=t}function wd(e,t){e.d=t}function Td(e,t){e.k=t}function Ed(e,t){e.j=t}function Dd(e,t){e.c=t}function vne(e,t){e.c=t}function Od(e,t){e.a=t}function kd(e,t){e.a=t}function yne(e,t){e.f=t}function Ad(e,t){e.a=t}function jd(e,t){e.b=t}function Md(e,t){e.d=t}function Nd(e,t){e.i=t}function Pd(e,t){e.o=t}function bne(e,t){e.r=t}function Fd(e,t){e.a=t}function Id(e,t){e.b=t}function Ld(e,t){e.e=t}function xne(e,t){e.f=t}function Rd(e,t){e.g=t}function Sne(e,t){e.e=t}function Cne(e,t){e.f=t}function zd(e,t){e.f=t}function Bd(e,t){e.b=t}function wne(e,t){e.b=t}function Vd(e,t){e.a=t}function Tne(e,t){e.n=t}function Ene(e,t){e.a=t}function Dne(e,t){e.c=t}function One(e,t){e.c=t}function kne(e,t){e.c=t}function Ane(e,t){e.a=t}function jne(e,t){e.a=t}function Mne(e,t){e.d=t}function Nne(e,t){e.d=t}function Pne(e,t){e.e=t}function Fne(e,t){e.e=t}function Ine(e,t){e.g=t}function Lne(e,t){e.f=t}function Rne(e,t){e.j=t}function Hd(e,t){e.a=t}function zne(e,t){e.a=t}function Bne(e,t){e.b=t}function Vne(e){e.b=e.a}function Ud(e){e.c=e.d.d}function Hne(e){this.a=e}function Wd(e){this.a=e}function Gd(e){this.a=e}function Une(e){this.a=e}function Kd(e){this.a=e}function qd(e){this.a=e}function Jd(e){this.a=e}function Wne(e){this.a=e}function Gne(e){this.a=e}function Yd(e){this.a=e}function Xd(e){this.a=e}function Zd(e){this.a=e}function Qd(e){this.a=e}function Kne(e){this.a=e}function $d(e){this.a=e}function qne(e){this.a=e}function Jne(e){this.a=e}function ef(e){this.a=e}function tf(e){this.d=e}function nf(e){this.b=e}function rf(e){this.b=e}function af(e){this.b=e}function of(e){this.c=e}function M(e){this.c=e}function Yne(e){this.c=e}function Xne(e){this.a=e}function Zne(e){this.a=e}function sf(e){this.a=e}function Qne(e){this.a=e}function $ne(e){this.a=e}function ere(e){this.a=e}function cf(e){this.a=e}function lf(e){this.a=e}function tre(e){this.a=e}function nre(e){this.a=e}function uf(e){this.a=e}function rre(e){this.a=e}function ire(e){this.a=e}function are(e){this.a=e}function ore(e){this.a=e}function sre(e){this.a=e}function df(e){this.a=e}function ff(e){this.a=e}function cre(e){this.a=e}function lre(e){this.a=e}function pf(e){this.a=e}function ure(e){this.a=e}function dre(e){this.a=e}function fre(e){this.a=e}function mf(e){this.a=e}function hf(e){this.a=e}function pre(e){this.a=e}function mre(e){this.a=e}function gf(e){this.a=e}function hre(e){this.a=e}function gre(e){this.a=e}function _re(e){this.a=e}function _f(e){this.a=e}function vre(e){this.a=e}function yre(e){this.a=e}function vf(e){this.a=e}function yf(e){this.e=e}function bf(e){this.a=e}function bre(e){this.a=e}function xf(e){this.a=e}function xre(e){this.a=e}function Sre(e){this.a=e}function Sf(e){this.a=e}function Cre(e){this.a=e}function Cf(e){this.a=e}function wre(e){this.a=e}function Tre(e){this.a=e}function Ere(e){this.a=e}function wf(e){this.a=e}function Dre(e){this.a=e}function Ore(e){this.a=e}function kre(e){this.a=e}function Tf(e){this.a=e}function Are(e){this.a=e}function jre(e){this.a=e}function Mre(e){this.a=e}function Nre(e){this.a=e}function Pre(e){this.a=e}function Fre(e){this.a=e}function Ire(e){this.a=e}function Lre(e){this.a=e}function Rre(e){this.a=e}function Ef(e){this.a=e}function zre(e){this.a=e}function Bre(e){this.a=e}function Vre(e){this.a=e}function Hre(e){this.a=e}function Df(e){this.a=e}function Ure(e){this.a=e}function Of(e){this.a=e}function Wre(e){this.a=e}function kf(e){this.a=e}function Gre(e){this.a=e}function Kre(e){this.a=e}function Af(e){this.a=e}function qre(e){this.a=e}function Jre(e){this.a=e}function Yre(e){this.a=e}function Xre(e){this.a=e}function jf(e){this.a=e}function Zre(e){this.a=e}function Qre(e){this.a=e}function Mf(e){this.a=e}function $re(e){this.a=e}function eie(e){this.a=e}function Nf(e){this.a=e}function tie(e){this.a=e}function nie(e){this.a=e}function Pf(e){this.a=e}function rie(e){this.a=e}function iie(e){this.a=e}function aie(e){this.a=e}function oie(e){this.a=e}function sie(e){this.a=e}function Ff(e){this.a=e}function cie(e){this.c=e}function lie(e){this.b=e}function If(e){this.a=e}function uie(e){this.a=e}function die(e){this.a=e}function fie(e){this.a=e}function pie(e){this.a=e}function N(e){this.a=e}function mie(e){this.a=e}function hie(e){this.a=e}function Lf(e){this.a=e}function gie(e){this.a=e}function _ie(e){this.a=e}function vie(e){this.a=e}function Rf(e){this.a=e}function yie(e){this.a=e}function bie(e){this.a=e}function xie(e){this.a=e}function Sie(e){this.a=e}function zf(e){this.a=e}function Cie(e){this.a=e}function wie(e){this.a=e}function Tie(e){this.a=e}function Eie(e){this.a=e}function Die(e){this.a=e}function Oie(e){this.a=e}function kie(e){this.a=e}function Aie(e){this.a=e}function jie(e){this.a=e}function Bf(e){this.a=e}function Vf(e){this.a=e}function Mie(e){this.a=e}function Nie(e){this.a=e}function Pie(e){this.a=e}function Fie(e){this.a=e}function Iie(e){this.a=e}function Lie(e){this.a=e}function Rie(e){this.a=e}function zie(e){this.a=e}function Bie(e){this.a=e}function Vie(e){this.a=e}function Hie(e){this.a=e}function Uie(e){this.a=e}function Wie(e){this.a=e}function Hf(e){this.a=e}function Gie(e){this.a=e}function Kie(e){this.a=e}function Uf(e){this.a=e}function qie(e){this.a=e}function Jie(e){this.a=e}function Yie(e){this.a=e}function Xie(e){this.a=e}function Zie(e){this.a=e}function Qie(e){this.a=e}function $ie(e){this.a=e}function eae(e){this.a=e}function tae(e){this.a=e}function nae(e){this.a=e}function Wf(e){this.a=e}function rae(e){this.f=e}function Gf(e){this.a=e}function iae(e){this.a=e}function aae(e){this.a=e}function oae(e){this.a=e}function sae(e){this.a=e}function cae(e){this.a=e}function lae(e){this.a=e}function uae(e){this.a=e}function Kf(e){this.a=e}function qf(e){this.a=e}function dae(e){this.a=e}function fae(e){this.a=e}function pae(e){this.a=e}function mae(e){this.a=e}function hae(e){this.a=e}function gae(e){this.a=e}function _ae(e){this.a=e}function vae(e){this.a=e}function Jf(e){this.a=e}function Yf(e){this.a=e}function yae(e){this.a=e}function bae(e){this.a=e}function xae(e){this.a=e}function Sae(e){this.a=e}function Cae(e){this.a=e}function wae(e){this.a=e}function Tae(e){this.a=e}function Xf(e){this.a=e}function Eae(e){this.a=e}function Zf(e){this.b=e}function Dae(e){this.a=e}function Qf(e){this.a=e}function Oae(e){this.a=e}function $f(e){this.a=e}function kae(e){this.a=e}function ep(e){this.a=e}function Aae(e){this.a=e}function jae(e){this.a=e}function tp(e){this.a=e}function Mae(e){this.a=e}function Nae(e){this.b=e}function Pae(e){this.c=e}function np(e){this.e=e}function Fae(e){this.a=e}function rp(e){this.a=e}function ip(e){this.a=e}function ap(e){this.a=e}function op(e){this.d=e}function sp(e){this.a=e}function Iae(e){this.a=e}function Lae(e){this.a=e}function cp(e){this.e=e}function lp(){this.a=0}function up(){zb(this)}function dp(){wT(this)}function fp(){qCe(this)}function Rae(){}function pp(){this.c=sUt}function zae(e,t){e.b+=t}function Bae(e,t){t.Wb(e)}function Vae(e){return e.a}function mp(e){return e.a}function hp(e){return e.a}function Hae(e){return e.a}function Uae(e){return e.a}function P(e){return e.e}function Wae(){return null}function gp(){return null}function Gae(e){throw P(e)}function _p(e){this.a=gE(e)}function vp(){this.a=this}function yp(){pme.call(this)}function Kae(e){e.b.Mf(e.e)}function qae(e){e.b=new Nse}function bp(e,t){e.b=t-e.b}function xp(e,t){e.a=t-e.a}function Jae(e,t){t.gd(e.a)}function Yae(e,t){AW(t,e)}function Sp(e,t){e.push(t)}function Xae(e,t){e.sort(t)}function Zae(e,t,n){e.Wd(n,t)}function Cp(e,t){e.e=t,t.b=e}function Qae(){Pce(),Dnt()}function $ae(e){QD(),vgt.je(e)}function eoe(){pme.call(this)}function wp(){yp.call(this)}function Tp(){yp.call(this)}function toe(){yp.call(this)}function Ep(){yp.call(this)}function Dp(){yp.call(this)}function Op(){yp.call(this)}function kp(){yp.call(this)}function Ap(){yp.call(this)}function noe(){yp.call(this)}function jp(){yp.call(this)}function Mp(){yp.call(this)}function Np(){this.Bb|=256}function Pp(){this.b=new gfe}function Fp(){Fp=E,new dp}function Ip(){wp.call(this)}function Lp(e,t){e.length=t}function Rp(e,t){hx(e.a,t)}function roe(e,t){tXe(e.c,t)}function ioe(e,t){BT(e.b,t)}function aoe(e,t){DV(e.a,t)}function ooe(e,t){yz(e.a,t)}function zp(e,t){II(e.e,t)}function Bp(e){aG(e.c,e.b)}function soe(e,t){e.kc().Nb(t)}function coe(e){this.a=ABe(e)}function Vp(){this.a=new dp}function loe(){this.a=new dp}function Hp(){this.a=new up}function Up(){this.a=new up}function uoe(){this.a=new up}function Wp(){this.a=new Fe}function Gp(){this.a=new Jje}function doe(){this.a=new Ple}function foe(){this.a=new HEe}function poe(){this.a=new _ge}function Kp(){this.a=new tt}function moe(){this.a=new OOe}function hoe(){this.a=new up}function goe(){this.a=new up}function _oe(){this.a=new up}function qp(){this.a=new up}function voe(){this.d=new up}function yoe(){this.a=new Vp}function boe(){this.a=new dp}function xoe(){this.b=new dp}function Soe(){this.b=new up}function Jp(){this.e=new up}function Coe(){this.d=new up}function woe(){this.a=new Gte}function Toe(){PTe.call(this)}function Yp(){PTe.call(this)}function Eoe(){Yoe.call(this)}function Doe(){Yoe.call(this)}function Ooe(){Yoe.call(this)}function koe(){up.call(this)}function Aoe(){qp.call(this)}function Xp(){Hp.call(this)}function joe(){dC.call(this)}function Zp(){Rae.call(this)}function Qp(){Zp.call(this)}function $p(){Rae.call(this)}function Moe(){$p.call(this)}function em(){Sg.call(this)}function Noe(){am.call(this)}function tm(){Us.call(this)}function Poe(){Us.call(this)}function Foe(){sm.call(this)}function nm(){sm.call(this)}function Ioe(){dp.call(this)}function Loe(){dp.call(this)}function Roe(){dp.call(this)}function zoe(){iFe.call(this)}function Boe(){Vp.call(this)}function Voe(){Np.call(this)}function Hoe(){Lx.call(this)}function rm(){dp.call(this)}function Uoe(){Lx.call(this)}function Woe(){dp.call(this)}function Goe(){dp.call(this)}function Koe(){rc.call(this)}function qoe(){Koe.call(this)}function Joe(){rc.call(this)}function im(){$l.call(this)}function Yoe(){this.a=new Vp}function Xoe(){this.a=new dp}function am(){this.a=new dp}function om(){this.a=new Sg}function Zoe(){this.a=new up}function Qoe(){this.j=new up}function sm(){this.a=new ec}function cm(){this.a=new ko}function $oe(){this.a=new Gce}function lm(){lm=E,Xht=new o}function um(){um=E,$ht=new pm}function dm(){dm=E,egt=new fm}function fm(){td.call(this,``)}function pm(){td.call(this,``)}function mm(e){$Ne.call(this,e)}function ese(e){$Ne.call(this,e)}function tse(e){Hu.call(this,e)}function hm(e){Cle.call(this,e)}function nse(e){Cle.call(this,e)}function rse(e){hm.call(this,e)}function ise(e){hm.call(this,e)}function ase(e){hm.call(this,e)}function ose(e){KAe.call(this,e)}function gm(e){KAe.call(this,e)}function sse(e){jpe.call(this,e)}function cse(e){Ele.call(this,e)}function _m(e){fg.call(this,e)}function lse(e){fg.call(this,e)}function use(e){fg.call(this,e)}function vm(e){nSe.call(this,e)}function dse(e){vm.call(this,e)}function ym(){hd.call(this,{})}function fse(e){mx(),this.a=e}function bm(e){e.b=null,e.c=0}function pse(e,t){e.e=t,x2e(e,t)}function mse(e,t){e.a=t,nZe(e)}function xm(e,t,n){e.a[t.g]=n}function hse(e,t,n){JKe(n,e,t)}function gse(e,t){t_e(t.i,e.n)}function _se(e,t){xRe(e).Ad(t)}function vse(e,t){return e*e/t}function yse(e,t){return e.g-t.g}function Sm(e,t){e.a.ec().Kc(t)}function bse(e){return new md(e)}function xse(e){return new _E(e)}function Cm(){Cm=E,dgt=new a}function Sse(){Sse=E,_gt=new v}function wm(){wm=E,w1=new x}function Tm(){Tm=E,rgt=new kpe}function Cse(){Cse=E,Cgt=new C}function Em(e){uIe(),this.a=e}function Dm(e){y_e(),this.a=e}function Om(e){nT(),this.f=e}function km(e){nT(),this.f=e}function Am(e){vm.call(this,e)}function jm(e){vm.call(this,e)}function wse(e){vm.call(this,e)}function Tse(e){nSe.call(this,e)}function Mm(e){vm.call(this,e)}function Nm(e){vm.call(this,e)}function Pm(e){vm.call(this,e)}function Ese(e){vm.call(this,e)}function Fm(e){vm.call(this,e)}function Im(e){vm.call(this,e)}function Lm(e){NE(e),this.a=e}function Rm(e){KSe(e,e.length)}function Dse(e){return FL(e),e}function zm(e){return!!e&&e.b}function Ose(e){return!!e&&e.k}function kse(e){return!!e&&e.j}function Bm(e){return e.b==e.c}function Vm(e){return NE(e),e}function F(e){return NE(e),e}function Hm(e){return NE(e),e}function Ase(e){return NE(e),e}function jse(e){return NE(e),e}function Um(e){vm.call(this,e)}function Wm(e){vm.call(this,e)}function Gm(e){vm.call(this,e)}function Km(e){vm.call(this,e)}function qm(e){vm.call(this,e)}function Mse(e){cS.call(this,e,0)}function Nse(){aOe.call(this,12,3)}function Pse(){this.a=BS(gE(SY))}function Fse(){throw P(new kp)}function Ise(){throw P(new kp)}function Lse(){throw P(new kp)}function Rse(){throw P(new kp)}function zse(){throw P(new kp)}function Bse(){throw P(new kp)}function Jm(){Jm=E,QD()}function Ym(){qd.call(this,``)}function Xm(){qd.call(this,``)}function Zm(){qd.call(this,``)}function Qm(){qd.call(this,``)}function $m(e){jm.call(this,e)}function eh(e){jm.call(this,e)}function th(e){Nm.call(this,e)}function nh(e){rf.call(this,e)}function Vse(e){nh.call(this,e)}function Hse(e){Jx.call(this,e)}function Use(e,t,n){e.c.Cf(t,n)}function Wse(e,t,n){t.Ad(e.a[n])}function rh(e,t,n){t.Ne(e.a[n])}function Gse(e,t){return e.a-t.a}function Kse(e,t){return e.a-t.a}function qse(e,t){return e.a-t.a}function ih(e,t){return gN(e,t)}function I(e,t){return JEe(e,t)}function Jse(e,t){return t in e.a}function Yse(e){return e.a?e.b:0}function Xse(e){return e.a?e.b:0}function Zse(e,t){return e.f=t,e}function Qse(e,t){return e.b=t,e}function $se(e,t){return e.c=t,e}function ece(e,t){return e.g=t,e}function ah(e,t){return e.a=t,e}function tce(e,t){return e.f=t,e}function nce(e,t){return e.k=t,e}function rce(e,t){return e.e=t,e}function ice(e,t){return e.e=t,e}function ace(e,t){return e.a=t,e}function oce(e,t){return e.f=t,e}function sce(e,t){e.b=new wb(t)}function cce(e,t){e._d(t),t.$d(e)}function lce(e,t){KC(),t.n.a+=e}function uce(e,t){JU(),IO(t,e)}function dce(e){Lwe.call(this,e)}function fce(e){Lwe.call(this,e)}function pce(){upe.call(this,``)}function mce(){this.b=0,this.a=0}function hce(){hce=E,p_t=Eqe()}function oh(e,t){return e.b=t,e}function sh(e,t){return e.a=t,e}function ch(e,t){return e.c=t,e}function lh(e,t){return e.d=t,e}function uh(e,t){return e.e=t,e}function dh(e,t){return e.f=t,e}function fh(e,t){return e.a=t,e}function ph(e,t){return e.b=t,e}function mh(e,t){return e.c=t,e}function hh(e,t){return e.c=t,e}function gh(e,t){return e.b=t,e}function _h(e,t){return e.d=t,e}function vh(e,t){return e.e=t,e}function gce(e,t){return e.f=t,e}function yh(e,t){return e.g=t,e}function bh(e,t){return e.a=t,e}function xh(e,t){return e.i=t,e}function Sh(e,t){return e.j=t,e}function _ce(e,t){return e.g-t.g}function vce(e,t){return e.b-t.b}function Ch(e,t){return e.s-t.s}function yce(e,t){return e?0:t-1}function bce(e,t){return e?0:t-1}function xce(e,t){return e?t-1:0}function wh(e,t){return t.pg(e)}function Sce(e,t){return e.k=t,e}function Th(e,t){return e.j=t,e}function Eh(){this.a=0,this.b=0}function Dh(e){g_e.call(this,e)}function Oh(e){cP.call(this,e)}function Cce(e){Kwe.call(this,e)}function wce(e){Kwe.call(this,e)}function Tce(e,t){e.b=0,WP(e,t)}function Ece(e,t){e.c=t,e.b=!0}function kh(e,t,n){zxe(e.a,t,n)}function Dce(e,t){return e.c._b(t)}function Ah(e){return e.e&&e.e()}function jh(e){return e?e.d:null}function Oce(e,t){return Wze(e.b,t)}function kce(e){return e?e.g:null}function Ace(e){return e?e.i:null}function jce(e,t){return gue(e.a,t)}function Mce(e,t){for(;e.zd(t););}function Nce(){throw P(new kp)}function Mh(){Mh=E,KVt=DKe()}function Nh(){Nh=E,S7=oJe()}function Pce(){Pce=E,P7=eF()}function Ph(){Ph=E,KHt=OKe()}function Fce(){Fce=E,LUt=kKe()}function Ice(){Ice=E,C9=$Xe()}function Fh(e){return RS(e),e.o}function Ih(e,t){return e.a+=t,e}function Lce(e,t){return e.a+=t,e}function Lh(e,t){return e.a+=t,e}function Rh(e,t){return e.a+=t,e}function Rce(e){Dtt(),qnt(this,e)}function zh(e){this.a=new bg(e)}function Bh(e){this.a=new pSe(e)}function zce(){throw P(new kp)}function Bce(){throw P(new kp)}function Vce(){throw P(new kp)}function Vh(){throw P(new kp)}function Hh(){throw P(new kp)}function Hce(){this.b=new xK(rMt)}function Uce(){this.a=new xK(RNt)}function Uh(e){this.a=0,this.b=e}function Wce(){this.a=new xK(XPt)}function Wh(){this.b=new xK(SIt)}function Gce(){this.b=new xK(SIt)}function Kce(){this.a=new xK(LLt)}function qce(e,t){return b2e(e,t)}function Jce(e,t){return yJ(t,e)}function Gh(e,t){return e.d[t.p]}function Kh(e){return e.b!=e.d.c}function Yce(e){return e.l|e.m<<22}function qh(e){return IE(e),e.a}function Xce(e){e.c?p4e(e):m4e(e)}function Jh(e,t){for(;e.Pe(t););}function Yh(e,t,n){e.splice(t,n)}function Zce(){throw P(new kp)}function Xh(){throw P(new kp)}function Qce(){throw P(new kp)}function $ce(){throw P(new kp)}function Zh(){throw P(new kp)}function ele(){throw P(new kp)}function tle(){throw P(new kp)}function nle(){throw P(new kp)}function rle(){throw P(new kp)}function ile(){throw P(new kp)}function ale(){throw P(new jp)}function ole(){throw P(new jp)}function Qh(e){this.a=new sle(e)}function sle(e){CF(this,e,VYe())}function $h(e){return!e||VCe(e)}function eg(e){return N9[e]!=-1}function cle(){mgt!=0&&(mgt=0),ggt=-1}function lle(){Uht??=[]}function tg(e,t){Mx.call(this,e,t)}function ng(e,t){tg.call(this,e,t)}function ule(e,t){this.a=e,this.b=t}function dle(e,t){this.a=e,this.b=t}function fle(e,t){this.a=e,this.b=t}function ple(e,t){this.a=e,this.b=t}function mle(e,t){this.a=e,this.b=t}function rg(e,t){this.a=e,this.b=t}function ig(e,t){this.a=e,this.b=t}function ag(e,t){this.e=e,this.d=t}function hle(e,t){this.b=e,this.c=t}function og(e,t){this.b=e,this.a=t}function gle(e,t){this.b=e,this.a=t}function _le(e,t){this.b=e,this.a=t}function vle(e,t){this.b=e,this.a=t}function yle(e,t){this.a=e,this.b=t}function ble(e,t){this.a=e,this.b=t}function xle(e,t){this.a=e,this.b=t}function sg(e,t){this.a=e,this.f=t}function cg(e,t){this.g=e,this.i=t}function lg(e,t){this.f=e,this.g=t}function Sle(e,t){this.b=e,this.c=t}function Cle(e){Px(e.dc()),this.c=e}function wle(e,t){this.a=e,this.b=t}function Tle(e,t){this.a=e,this.b=t}function ug(e){this.a=B(gE(e),16)}function Ele(e){this.a=B(gE(e),16)}function Dle(e){this.a=B(gE(e),93)}function dg(e){this.b=B(gE(e),93)}function fg(e){this.b=B(gE(e),51)}function pg(){this.q=new r.Date}function mg(e,t){this.a=e,this.b=t}function Ole(e,t){return IT(e.b,t)}function hg(e,t){return e.b.Gc(t)}function gg(e,t){return e.b.Hc(t)}function kle(e,t){return e.b.Oc(t)}function _g(e,t){return e.b.Gc(t)}function Ale(e,t){return e.c.uc(t)}function jle(e,t){return ZR(e.c,t)}function vg(e,t){return e.a._b(t)}function Mle(e,t){return e>t&&t<ZY}function yg(e){return e.f.c+e.i.c}function Nle(e){return uE(),e?Sgt:xgt}function bg(e){sRe.call(this,e,0)}function Ple(){pSe.call(this,null)}function xg(e){this.c=e,jNe(this)}function Sg(){cpe(this),AD(this)}function Cg(){Cg=E,Hgt=new D}function wg(){wg=E,W1=new te}function Tg(){Tg=E,y_t=new _fe}function Eg(){Eg=E,b_t=new Jy}function Dg(){Dg=E,P_t=new he}function Og(){Og=E,J1=new be}function Fle(){sM.call(this,null)}function kg(e,t){IE(e),e.a.Nb(t)}function Ile(e,t){return e.a.Vc(t)}function Lle(e,t){return e.a.Wc(t)}function Rle(e,t){return e.a.Yc(t)}function zle(e,t){return e.a.Zc(t)}function Ag(e,t){return e.Fc(t),e}function Ble(e,t){dG(ID(e.a),t)}function Vle(e,t){dG(ID(e.a),t)}function jg(e,t){return e.a.e=t,e}function Mg(e,t){return e.a.a=t,e}function Ng(e,t){return e.a.d=t,e}function Hle(e,t){return e.a.d=t,e}function Ule(e,t){return e.a.f=t,e}function Wle(e,t){return e.a.g=t,e}function Gle(e,t){return e.a.j=t,e}function Pg(e,t){return e.a.g=t,e}function Fg(e,t){return e.a.f=t,e}function Kle(e){return e.b=!1,e}function qle(){qle=E,abt=new yt}function Jle(){Jle=E,lbt=new Pxe}function Yle(){Yle=E,J_t=new ke}function Xle(){Xle=E,ibt=new ct}function Ig(){Ig=E,Bbt=new cee}function Lg(){Lg=E,ybt=new pt}function Zle(){Zle=E,Tbt=new Dt}function Rg(){Rg=E,Dbt=new Ot}function zg(){zg=E,qxt=new hee}function Bg(){Bg=E,zbt=new Eh}function Vg(){Vg=E,kkt=new Fs}function Hg(){Hg=E,lSt=new Vee}function Ug(){Ug=E,Q0=new ci}function Wg(){Wg=E,wIt=new $le}function Gg(){Gg=E,DIt=new Zme}function Kg(){Kg=E,A6=new YCe}function qg(){qg=E,QLt=new Exe}function Jg(){Jg=E,tRt=new Txe}function Yg(){Yg=E,iRt=new ASe}function Qle(){lFe(),this.c=new Nse}function $le(){lg.call(this,Oot,0)}function eue(e,t,n,r){YUe(e,r,t,n)}function tue(e,t,n,r){cK(r,e,t,n)}function nue(e,t,n,r){Ctt(r,e,t,n)}function rue(e,t,n){LO(e.d,t.f,n)}function Xg(e,t){ZB(e.c.b,t.c,t)}function Zg(e,t){ZB(e.c.c,t.b,t)}function Qg(e,t){return e.a=t.g,e}function iue(e){return e.e.a+e.f.a}function aue(e){return e.e.b+e.f.b}function oue(e){return(e.c+e.a)/2}function sue(e){return e.b?e.b:e.a}function $g(e,t){return WGe(e.a,t)}function cue(){cue=E,GHt=new Goe}function e_(){e_=E,cUt=new Dpe}function t_(){t_=E,h9=new Ope}function n_(){n_=E,WVt=new Hs}function lue(){lue=E,iHt=new nc}function uue(){uue=E,HHt=new Loe}function r_(){r_=E,WHt=new Roe}function i_(){i_=E,q7=new rm}function a_(){a_=E,EHt=new dp}function o_(){o_=E,yUt=new up}function s_(){s_=E,G9=new tu}function c_(){c_=E,OUt=new ul}function l_(){l_=E,AUt=new dl}function due(e){aD(),FYe.call(this,e)}function u_(e){aD(),due.call(this,e)}function fue(e){Aw(),jpe.call(this,e)}function pue(e,t){UEe.call(this,e,t)}function d_(e,t){this.d=e,this.e=t}function mue(e,t){return NR(e,t)>0}function hue(e,t){return NR(e,t)<0}function f_(e,t){return Zw(e.a,t)}function gue(e,t){return e.a.a.cc(t)}function p_(e){return e.b<e.d.gc()}function m_(e,t){return e.a.get(t)}function _ue(e,t){return t.split(e)}function vue(e,t){return IT(e.e,t)}function h_(e){return B(e,45).jd()}function g_(e){return NE(e),!1}function yue(e){this.a=B(gE(e),231)}function __(e){ZO.call(this,e,21)}function v_(e,t){lg.call(this,e,t)}function bue(e,t){lg.call(this,e,t)}function xue(e,t){this.b=e,this.a=t}function Sue(e,t){this.a=e,this.b=t}function Cue(e,t){this.a=e,this.b=t}function y_(e,t){this.a=e,this.b=t}function wue(e,t){this.a=e,this.b=t}function Tue(e,t){this.b=e,this.a=t}function Eue(e,t){Yw(e,e.length,t)}function b_(e,t){aCe(e,e.length,t)}function x_(e,t,n){t.Ne(e.a.We(n))}function Due(e,t,n){t.Bd(e.a.Xe(n))}function Oue(e,t,n){t.Ad(e.a.Kb(n))}function S_(e,t,n){e.Mb(n)&&t.Ad(n)}function C_(e,t,n){e.splice(t,0,n)}function w_(e,t){lg.call(this,e,t)}function T_(e,t){lg.call(this,e,t)}function E_(e,t){lg.call(this,e,t)}function D_(e,t){lg.call(this,e,t)}function O_(e,t){lg.call(this,e,t)}function k_(e,t){lg.call(this,e,t)}function A_(e,t){lg.call(this,e,t)}function j_(e,t){this.a=e,this.b=t}function kue(e,t){this.b=e,this.a=t}function Aue(e,t){this.b=e,this.a=t}function jue(e,t){this.b=e,this.a=t}function M_(e,t){this.b=e,this.a=t}function N_(e,t){this.c=e,this.d=t}function Mue(e,t){this.e=e,this.d=t}function P_(e,t){this.a=e,this.b=t}function F_(e,t){lg.call(this,e,t)}function I_(e,t){lg.call(this,e,t)}function L_(e,t){lg.call(this,e,t)}function R_(e,t){lg.call(this,e,t)}function z_(e,t){lg.call(this,e,t)}function B_(e,t){lg.call(this,e,t)}function V_(e,t){this.a=e,this.b=t}function H_(e,t){this.a=e,this.b=t}function Nue(e,t){this.a=e,this.b=t}function U_(e,t){this.a=e,this.b=t}function W_(e,t){this.a=e,this.b=t}function Pue(e,t){this.a=e,this.b=t}function Fue(e,t){this.a=e,this.b=t}function Iue(e,t){this.a=e,this.b=t}function Lue(e,t){this.b=e,this.a=t}function Rue(e,t){this.b=e,this.a=t}function zue(e,t){this.b=t,this.c=e}function G_(e,t){lg.call(this,e,t)}function K_(e,t){lg.call(this,e,t)}function q_(e,t){lg.call(this,e,t)}function J_(e,t){lg.call(this,e,t)}function Bue(e,t){lg.call(this,e,t)}function Y_(e,t){lg.call(this,e,t)}function Vue(e,t){lg.call(this,e,t)}function X_(e,t){lg.call(this,e,t)}function Z_(e,t){lg.call(this,e,t)}function Q_(e,t){lg.call(this,e,t)}function $_(e,t){lg.call(this,e,t)}function Hue(e,t){lg.call(this,e,t)}function ev(e,t){lg.call(this,e,t)}function tv(e,t){lg.call(this,e,t)}function nv(e,t){lg.call(this,e,t)}function Uue(e,t){lg.call(this,e,t)}function Wue(e,t){lg.call(this,e,t)}function Gue(e,t){lg.call(this,e,t)}function Kue(e,t){lg.call(this,e,t)}function rv(e,t){lg.call(this,e,t)}function iv(e,t){lg.call(this,e,t)}function av(e,t){lg.call(this,e,t)}function ov(e,t){lg.call(this,e,t)}function sv(e,t){lg.call(this,e,t)}function cv(e,t){lg.call(this,e,t)}function lv(e,t){lg.call(this,e,t)}function uv(e,t){lg.call(this,e,t)}function que(e,t){lg.call(this,e,t)}function Jue(e,t){lg.call(this,e,t)}function Yue(e,t){lg.call(this,e,t)}function dv(e,t){lg.call(this,e,t)}function Xue(e,t){lg.call(this,e,t)}function Zue(e,t){lg.call(this,e,t)}function Que(e,t){lg.call(this,e,t)}function $ue(e,t){this.b=e,this.a=t}function ede(e,t){return Vx(e.e,t)}function tde(e,t){return Vx(e.c,t)}function nde(e,t){return Vx(t.b,e)}function rde(e,t){return GC(),t!=e}function fv(e){return SS(e.a),e.b}function ide(e){return e$e(e,e.c),e}function ade(){return hce(),new p_t}function ode(){JC(),this.a=new lC}function pv(e,t){this.a=e,this.b=t}function sde(e,t){this.a=e,this.b=t}function cde(e,t){this.a=e,this.b=t}function lde(e,t){this.b=e,this.a=t}function ude(e,t){this.a=e,this.b=t}function dde(e,t){lg.call(this,e,t)}function mv(e,t){lg.call(this,e,t)}function hv(e,t){lg.call(this,e,t)}function gv(e,t){lg.call(this,e,t)}function _v(e,t){lg.call(this,e,t)}function fde(e,t){lg.call(this,e,t)}function pde(e,t){this.a=e,this.b=t}function mde(e,t){this.a=e,this.b=t}function hde(e,t){this.a=e,this.b=t}function gde(e,t){this.b=e,this.d=t}function _de(e,t){this.b=e,this.a=t}function vv(e,t){lg.call(this,e,t)}function yv(e,t){lg.call(this,e,t)}function vde(e,t){lg.call(this,e,t)}function bv(e,t){lg.call(this,e,t)}function yde(e,t){lg.call(this,e,t)}function bde(e,t){this.b=e,this.a=t}function xv(e,t){this.b=e,this.a=t}function Sv(e,t){this.b=e,this.a=t}function Cv(e,t){this.b=e,this.a=t}function xde(e,t){lg.call(this,e,t)}function wv(e,t){lg.call(this,e,t)}function Sde(e,t){lg.call(this,e,t)}function Cde(e,t){lg.call(this,e,t)}function Tv(e,t){lg.call(this,e,t)}function wde(e,t){lg.call(this,e,t)}function Tde(e,t){lg.call(this,e,t)}function Ev(e,t){lg.call(this,e,t)}function Ede(e,t){lg.call(this,e,t)}function Dde(e,t){lg.call(this,e,t)}function Ode(e,t){lg.call(this,e,t)}function kde(e,t){lg.call(this,e,t)}function Dv(e,t){lg.call(this,e,t)}function Ov(e,t){lg.call(this,e,t)}function Ade(e,t){lg.call(this,e,t)}function kv(e,t){lg.call(this,e,t)}function jde(e,t){lg.call(this,e,t)}function Mde(e,t){lg.call(this,e,t)}function Av(e,t){lg.call(this,e,t)}function Nde(e,t){lg.call(this,e,t)}function jv(e,t){this.a=e,this.b=t}function Pde(e,t){this.a=e,this.b=t}function Fde(e,t){this.a=e,this.b=t}function Mv(e,t){lg.call(this,e,t)}function Nv(e,t){lg.call(this,e,t)}function Pv(e,t){this.a=e,this.b=t}function Fv(e,t){lg.call(this,e,t)}function Iv(e,t){lg.call(this,e,t)}function Lv(e,t){lg.call(this,e,t)}function Rv(e,t){lg.call(this,e,t)}function zv(e,t){lg.call(this,e,t)}function Bv(e,t){lg.call(this,e,t)}function Vv(e,t){lg.call(this,e,t)}function Hv(e,t){lg.call(this,e,t)}function Uv(e,t){lg.call(this,e,t)}function Wv(e,t){lg.call(this,e,t)}function Gv(e,t){lg.call(this,e,t)}function Kv(e,t){lg.call(this,e,t)}function qv(e,t){lg.call(this,e,t)}function Jv(e,t){lg.call(this,e,t)}function Yv(e,t){lg.call(this,e,t)}function Xv(e,t){lg.call(this,e,t)}function Zv(e,t){lg.call(this,e,t)}function Qv(e,t){lg.call(this,e,t)}function Ide(e,t){lg.call(this,e,t)}function $v(e,t){lg.call(this,e,t)}function Lde(e,t){this.a=e,this.b=t}function Rde(e,t){this.a=e,this.b=t}function zde(e,t){this.a=e,this.b=t}function Bde(e,t){this.a=e,this.b=t}function Vde(e,t){this.a=e,this.b=t}function ey(e,t){this.a=e,this.b=t}function ty(e,t){lg.call(this,e,t)}function ny(e,t){this.a=e,this.b=t}function ry(){EK(),this.a=new Vp}function iy(){oDe(),this.b=new Vp}function ay(){tDe(),Ixe.call(this)}function oy(){rDe(),NTe.call(this)}function sy(){rDe(),NTe.call(this)}function cy(e,t){rNe(e.a,B(t,12))}function ly(e,t,n){lqe(t,LXe(e,n))}function uy(e,t,n){lqe(t,LXe(e,n))}function dy(e,t){return Vx(e.g,t)}function Hde(e,t){return-e.b.$e(t)}function Ude(e,t){this.a=e,this.b=t}function Wde(e,t){this.a=e,this.b=t}function Gde(e,t){this.a=e,this.b=t}function Kde(e,t){this.a=e,this.b=t}function qde(e,t){this.a=e,this.b=t}function Jde(e,t){this.a=e,this.b=t}function Yde(e,t){this.a=e,this.b=t}function Xde(e,t){this.a=e,this.b=t}function Zde(e,t){this.a=e,this.b=t}function fy(e,t){this.a=e,this.b=t}function py(e,t){this.b=e,this.a=t}function my(e,t){this.b=e,this.a=t}function Qde(e,t){this.b=e,this.a=t}function $de(e,t){this.b=e,this.a=t}function hy(e,t){this.f=e,this.c=t}function gy(e,t){this.i=e,this.g=t}function _y(e,t){this.a=e,this.b=t}function efe(e,t){this.a=e,this.b=t}function vy(e,t){this.a=e,this.b=t}function yy(e,t){this.a=e,this.b=t}function by(e,t){this.d=e,this.e=t}function tfe(e,t){this.d=e,this.b=t}function nfe(e,t){this.a=e,this.b=t}function rfe(e,t){this.e=e,this.a=t}function xy(e,t){this.b=e,this.c=t}function Sy(e,t){lg.call(this,e,t)}function ife(e,t){e&&WE(M7,e,t)}function afe(e,t){e.i=null,TF(e,t)}function ofe(e,t){return MVe(e.a,t)}function Cy(e){return hB(e.c,e.b)}function wy(e){return e?e.kd():null}function L(e){return e??null}function Ty(e){return typeof e===hY}function Ey(e){return typeof e===Irt}function Dy(e){return typeof e===gY}function Oy(e,t){return NR(e,t)==0}function ky(e,t){return NR(e,t)>=0}function Ay(e,t){return NR(e,t)!=0}function jy(e,t){return e.Pd().Xb(t)}function My(e,t){return iIe(e.Jc(),t)}function sfe(e){return``+(NE(e),e)}function Ny(e,t){return e.a+=``+t,e}function Py(e,t){return e.a+=``+t,e}function Fy(e,t){return e.a+=``+t,e}function Iy(e,t){return e.a+=``+t,e}function Ly(e,t){return e.a+=``+t,e}function Ry(e,t){return e.a+=``+t,e}function zy(e){return Dw(e==null),e}function cfe(e){return YO(e,0),null}function By(e){return Xz(e),e.d.gc()}function lfe(e){r.clearTimeout(e)}function ufe(e,t){e.q.setTime(Tk(t))}function Vy(e,t){RNe(new jx(e),t)}function Hy(e,t){mSe.call(this,e,t)}function Uy(e,t){mSe.call(this,e,t)}function Wy(e,t){mSe.call(this,e,t)}function Gy(e,t){bA(e,t,e.c.b,e.c)}function Ky(e,t){bA(e,t,e.a,e.a.a)}function dfe(e,t){return e.j[t.p]==2}function ffe(e,t){return e.a=t.g+1,e}function qy(e){return e.a=0,e.b=0,e}function pfe(){pfe=E,Nvt=CR(QB())}function mfe(){mfe=E,Kxt=CR(I0e())}function hfe(){hfe=E,yMt=CR(gIe())}function gfe(){this.b=new bg(zI(12))}function _fe(){this.b=0,this.a=!1}function Jy(){this.b=0,this.a=!1}function Yy(e){this.a=e,nu.call(this)}function vfe(e){this.a=e,nu.call(this)}function Xy(e,t){qS.call(this,e,t)}function Zy(e,t){hC.call(this,e,t)}function Qy(e,t){gy.call(this,e,t)}function yfe(e,t){oS.call(this,e,t)}function $y(e,t){YI.call(this,e,t)}function eb(e,t){a_(),WE(EHt,e,t)}function tb(e,t){return tO(e.a,0,t)}function bfe(e,t){return L(e)===L(t)}function nb(e,t){return _z(e.a,t.a)}function rb(e,t){return Yb(e.a,t.a)}function xfe(e,t){return nCe(e.a,t.a)}function ib(e){return wO((NE(e),e))}function ab(e){return wO((NE(e),e))}function ob(e){return Xb(e.l,e.m,e.h)}function Sfe(e){return gE(e),new Yy(e)}function sb(e,t){return e.indexOf(t)}function cb(e){return typeof e===Irt}function lb(e){return e<10?`0`+e:``+e}function Cfe(e){return e==b0||e==C0}function ub(e){return e==b0||e==x0}function wfe(e,t){return Yb(e.g,t.g)}function Tfe(e){return uN(e.b.b,e,0)}function Efe(e){wT(this),gI(this,e)}function Dfe(e){this.a=ade(),this.b=e}function Ofe(e){this.a=ade(),this.b=e}function kfe(e,t){return hx(e.a,t),t}function db(e,t){VM(e,0,e.length,t)}function fb(e,t){return Yb(e.g,t.g)}function pb(e,t){return _z(t.f,e.f)}function Afe(e,t){return KC(),t.a+=e}function mb(e,t){return KC(),t.a+=e}function jfe(e,t){return KC(),t.c+=e}function hb(e,t){return AI(e.a,t),e}function gb(e,t){return hx(e.c,t),e}function _b(e){return AI(new RE,e)}function vb(e){return e==B8||e==V8}function yb(e){return e==U8||e==z8}function Mfe(e){return e==v3||e==_3}function bb(e){return e!=C5&&e!=w5}function xb(e){return e.sh()&&e.th()}function Nfe(e){return Swe(B(e,127))}function Sb(){yD.call(this,0,0,0,0)}function Pfe(){Bw.call(this,0,0,0,0)}function Cb(){Zne.call(this,new DA)}function Ffe(e){hy.call(this,e,!0)}function wb(e){this.a=e.a,this.b=e.b}function Tb(e,t){ZL(e,t),KP(e,e.D)}function Eb(e,t,n){HP(e,t),PP(e,n)}function Db(e,t,n){LP(e,t),NP(e,n)}function Ob(e,t,n){RP(e,t),zP(e,n)}function kb(e,t,n){FP(e,t),IP(e,n)}function Ab(e,t,n){BP(e,t),VP(e,n)}function Ife(e,t,n){Ahe.call(this,e,t,n)}function Lfe(){v_.call(this,`Head`,1)}function Rfe(){v_.call(this,`Tail`,3)}function jb(e){rq(),vI.call(this,e)}function Mb(e){return e==null?0:JF(e)}function Nb(e,t){return new YI(t,e)}function zfe(e,t){return new YI(t,e)}function Bfe(e,t){return pP(t,_O(e))}function Vfe(e,t){return pP(t,_O(e))}function Hfe(e,t){return e[e.length]=t}function Pb(e,t){return e[e.length]=t}function Ufe(e){return Wye(e.b.Jc(),e.a)}function Wfe(e,t){return dF(pE(e.f),t)}function Fb(e,t){return dF(pE(e.n),t)}function Ib(e,t){return dF(pE(e.p),t)}function Lb(e,t){qS.call(this,e.b,t)}function Rb(e){Bw.call(this,e,e,e,e)}function zb(e){e.c=G(v1,CY,1,0,5,1)}function Gfe(e,t,n){yE(e.c[t.g],t.g,n)}function Kfe(e,t,n){B(e.c,72).Ei(t,n)}function qfe(e,t,n){Ob(n,n.i+e,n.j+t)}function Jfe(e,t){gM($k(e.a),_De(t))}function Yfe(e,t){gM(EN(e.a),vDe(t))}function Xfe(e,t){G1||(e.b=t)}function Bb(e,t,n){return yE(e,t,n),n}function Vb(e){hP(e.Qf(),new mf(e))}function Hb(){Hb=E,Njt=new Qz(OBt)}function Ub(){Ub=E,Fp(),ygt=new dp}function Wb(){Wb=E,new Zfe,new up}function Zfe(){new dp,new dp,new dp}function Qfe(){throw P(new Im(Rht))}function $fe(){throw P(new Im(Rht))}function Gb(){throw P(new Im(zht))}function epe(){throw P(new Im(zht))}function Kb(e){cY(),cp.call(this,e)}function tpe(e){this.a=e,qye.call(this,e)}function qb(e){this.a=e,dg.call(this,e)}function npe(e){this.a=e,dg.call(this,e)}function rpe(e){return e==null?0:JF(e)}function Jb(e){return e.a<e.c.c.length}function ipe(e){return e.a<e.c.a.length}function ape(e,t){return NR(e,t)>0?e:t}function Yb(e,t){return e<t?-1:e>t?1:0}function ope(e,t){return e.a?e.b:t.Ue()}function Xb(e,t,n){return{l:e,m:t,h:n}}function spe(e,t){e.a!=null&&cy(t,e.a)}function Zb(e,t){gE(t),lD(e).Ic(new h)}function Qb(e,t){Jw(e.c,e.c.length,t)}function cpe(e){e.a=new ce,e.c=new ce}function $b(e){this.b=e,this.a=new up}function lpe(e){this.b=new $e,this.a=e}function upe(e){cC.call(this),this.a=e}function dpe(e){FTe.call(this),this.b=e}function fpe(){v_.call(this,`Range`,2)}function ppe(){FKe(),this.a=new xK(nbt)}function ex(){ex=E,r.Math.log(2)}function tx(){tx=E,_9=(lue(),iHt)}function nx(e){e.j=G(Vgt,LY,325,0,0,1)}function mpe(e){e.a=new dp,e.e=new dp}function rx(e){return new Pv(e.c,e.d)}function hpe(e){return new Pv(e.c,e.d)}function ix(e){return new Pv(e.a,e.b)}function gpe(e,t){return WE(e.a,t.a,t)}function ax(e,t,n){return WE(e.g,n,t)}function _pe(e,t,n){return WE(e.k,n,t)}function ox(e,t,n){return eHe(t,n,e.c)}function sx(e,t){return Eet(e.a,t,null)}function cx(e,t){return z(bE(e.i,t))}function vpe(e,t){return z(bE(e.j,t))}function ype(e,t){SJ(e),e.Fc(B(t,16))}function bpe(e,t,n){e.c._c(t,B(n,138))}function xpe(e,t,n){e.c.Si(t,B(n,138))}function Spe(e,t,n){return MJ(e,t,n),n}function Cpe(e,t){return zO(),t.n.b+=e}function lx(e,t){return u9e(e.c,e.b,t)}function ux(e,t){return vL(e.Jc(),t)!=-1}function R(e,t){return e!=null&&XUe(e,t)}function wpe(e,t){return new lme(e.Jc(),t)}function dx(e){return e.Ob()?e.Pb():null}function Tpe(e){return AB(e,0,e.length)}function fx(e){NO(e,null),PO(e,null)}function Epe(e){UO(e,null),fDe(e,null)}function Dpe(){oS.call(this,null,null)}function Ope(){sS.call(this,null,null)}function kpe(){lg.call(this,`INSTANCE`,0)}function px(){this.a=G(v1,CY,1,8,5,1)}function Ape(e){this.a=e,dp.call(this)}function jpe(e){this.a=(ND(),new nh(e))}function Mpe(e){this.b=(ND(),new of(e))}function mx(){mx=E,v_t=new fse(null)}function Npe(){Npe=E,Npe(),w_t=new de}function hx(e,t){return Sp(e.c,t),!0}function Ppe(e,t){e.c&&(Obe(t),vEe(t))}function Fpe(e,t){e.q.setHours(t),Wq(e,t)}function Ipe(e,t){return e.a.Ac(t)!=null}function gx(e,t){return e.a.Ac(t)!=null}function _x(e,t){return e.a[t.c.p][t.p]}function vx(e,t){return e.c[t.c.p][t.p]}function yx(e,t){return e.e[t.c.p][t.p]}function bx(e,t,n){return e.a[t.g][n.g]}function xx(e,t){return e.j[t.p]=z1e(t)}function Sx(e,t){return e.a*t.a+e.b*t.b}function Lpe(e,t){return e.a<h_e(t)?-1:1}function Rpe(e,t){return Vje(e.b,t.Og())}function zpe(e,t){return Vje(e.f,t.Og())}function Bpe(e,t){return F(z(t.a))<=e}function Vpe(e,t){return F(z(t.a))>=e}function Hpe(e,t,n){return n?t!=0:t!=e-1}function Upe(e,t,n){e.a=t^1502,e.b=n^Git}function Wpe(e,t,n){return e.a=t,e.b=n,e}function Cx(e,t){return e.a*=t,e.b*=t,e}function wx(e,t,n){return yE(e.g,t,n),n}function Tx(e,t,n,r){yE(e.a[t.g],n.g,r)}function Ex(e,t,n){fw.call(this,e,t,n)}function Dx(e,t,n){Ex.call(this,e,t,n)}function Ox(e,t,n){Ex.call(this,e,t,n)}function Gpe(e,t,n){Dx.call(this,e,t,n)}function Kpe(e,t,n){fw.call(this,e,t,n)}function kx(e,t,n){fw.call(this,e,t,n)}function qpe(e,t,n){Ype.call(this,e,t,n)}function Jpe(e,t,n){Kpe.call(this,e,t,n)}function Ype(e,t,n){pw.call(this,e,t,n)}function Xpe(e,t,n){pw.call(this,e,t,n)}function Ax(e){this.c=e,this.a=this.c.a}function jx(e){this.i=e,this.f=this.i.j}function Mx(e,t){this.a=e,dg.call(this,t)}function Zpe(e,t){this.a=e,Mse.call(this,t)}function Qpe(e,t){this.a=e,Mse.call(this,t)}function $pe(e,t){this.a=e,Mse.call(this,t)}function eme(e){this.a=e,Yu.call(this,e.d)}function tme(e){e.b.Qb(),--e.d.f.d,aT(e.d)}function Nx(e){e.a=B(VI(e.b.a,4),131)}function nme(e){e.a=B(VI(e.b.a,4),131)}function rme(e){XD(e,opt),rK(e,Vtt(e))}function ime(e){td.call(this,B(gE(e),34))}function ame(e){td.call(this,B(gE(e),34))}function Px(e){if(!e)throw P(new Ep)}function Fx(e){if(!e)throw P(new Dp)}function ome(e,t){return Uz(e,new Zm,t).a}function sme(e,t){return new RXe(e.a,e.b,t)}function Ix(e,t){return gE(t),new cme(e,t)}function cme(e,t){this.a=t,fg.call(this,e)}function lme(e,t){this.a=t,fg.call(this,e)}function ume(e,t){this.a=t,Mse.call(this,e)}function dme(e,t){this.a=t,KAe.call(this,e)}function fme(e,t){this.a=e,KAe.call(this,t)}function pme(){nx(this),kD(this),this.he()}function Lx(){this.Bb|=256,this.Bb|=512}function Rx(){Rx=E,E1=!1,D1=!0}function mme(){mme=E,c_(),kUt=new Lu}function hme(e){return Kh(e.a)?yDe(e):null}function gme(e){return e.l+e.m*vX+e.h*yX}function _me(e){return e==null?null:e.name}function zx(e){return e==null?wY:Jz(e)}function Bx(e,t){return e.lastIndexOf(t)}function vme(e,t,n){return e.indexOf(t,n)}function Vx(e,t){return!!t&&e.b[t.g]==t}function Hx(e){return e.a==null?null:e.a}function Ux(e){return SS(e.a!=null),e.a}function Wx(e,t,n){return PI(e,t,t,n),e}function yme(e,t){return hx(t.a,e.a),e.a}function Gx(e,t){return hx(t.b,e.a),e.a}function Kx(e,t){return++e.b,hx(e.a,t)}function bme(e,t){return++e.b,dN(e.a,t)}function qx(e,t){return hx(t.a,e.a),e.a}function Jx(e){rf.call(this,e),this.a=e}function xme(e){af.call(this,e),this.a=e}function Yx(e){nh.call(this,e),this.a=e}function Sme(e){doe.call(this),YF(this,e)}function Xx(e){qd.call(this,(NE(e),e))}function Zx(e){qd.call(this,(NE(e),e))}function Qx(e){Zne.call(this,new lM(e))}function Cme(e,t){WB.call(this,e,t,null)}function wme(e,t){return _z(e.n.a,t.n.a)}function Tme(e,t){return _z(e.c.d,t.c.d)}function Eme(e,t){return _z(e.c.c,t.c.c)}function $x(e,t){return B($A(e.b,t),16)}function Dme(e,t){return e.n.b=(NE(t),t)}function Ome(e,t){return e.n.b=(NE(t),t)}function kme(e,t){return _z(e.e.b,t.e.b)}function Ame(e,t){return _z(e.e.a,t.e.a)}function jme(e,t,n){return mAe(e,t,n,e.b)}function Mme(e,t,n){return mAe(e,t,n,e.c)}function eS(e){return KC(),!!e&&!e.dc()}function tS(){Hg(),this.b=new kf(this)}function Nme(e){this.a=e,nf.call(this,e)}function nS(e){this.c=e,iS.call(this,e)}function rS(e){this.c=e,jx.call(this,e)}function iS(e){this.d=e,jx.call(this,e)}function aS(e,t){nT(),this.f=t,this.d=e}function oS(e,t){e_(),this.a=e,this.b=t}function sS(e,t){t_(),this.b=e,this.c=t}function cS(e,t){Uje(t,e),this.c=e,this.b=t}function lS(e){var t=e.a;e.a=e.b,e.b=t}function uS(e){return Jb(e.a)||Jb(e.b)}function dS(e){return e.$H||=++W_t}function fS(e,t){return new i_e(e,e.gc(),t)}function Pme(e,t){return $xe(e.c).Kd().Xb(t)}function pS(e,t,n){e.dd(t).Rb(n)}function mS(e,t,n){B(xN(e,t),24).Ec(n)}function Fme(e,t,n){yz(e.a,n),DV(e.a,t)}function Ime(e,t,n,r){iSe.call(this,e,t,n,r)}function hS(e,t,n){return vme(e,AU(t),n)}function Lme(e){return Tm(),QP((ZEe(),agt),e)}function gS(e){return++W9,new Jk(3,e)}function _S(e){return lF(e,QY),new MM(e)}function vS(e){return SS(e.b!=0),e.a.a.c}function yS(e){return SS(e.b!=0),e.c.b.c}function Rme(e,t){return PI(e,t,t+1,``),e}function zme(e){if(!e)throw P(new Ap)}function bS(e){e.d=new kS(e),e.e=new dp}function xS(e){if(!e)throw P(new Ep)}function Bme(e){if(!e)throw P(new Tp)}function SS(e){if(!e)throw P(new jp)}function CS(e){if(!e)throw P(new Dp)}function wS(e){return e.b=B(eTe(e.a),45)}function TS(e,t){return!!e.q&&IT(e.q,t)}function Vme(e,t){return e>0?t*t/e:t*t*100}function Hme(e,t){return e>0?t/(e*e):t*100}function ES(e,t){return B(RN(e.a,t),34)}function Ume(e){return e.f==null?``+e.g:e.f}function Wme(e){return e.f==null?``+e.g:e.f}function Gme(e){return QD(),parseInt(e)||-1}function Kme(e){return CP(),e.e.a+e.f.a/2}function qme(e,t,n){return CP(),n.e.a-e*t}function DS(e,t,n){return Vg(),n.Lg(e,t)}function Jme(e,t,n){return CP(),n.e.b-e*t}function Yme(e){return CP(),e.e.b+e.f.b/2}function Xme(e,t){return JU(),qW(e,t.e,t)}function OS(e){R(e,162)&&B(e,162).mi()}function kS(e){Jye.call(this,e,null,null)}function Zme(){lg.call(this,`GROW_TREE`,0)}function Qme(e){this.c=e,this.a=1,this.b=1}function $me(e){Tg(),this.b=e,this.a=!0}function ehe(e){Eg(),this.b=e,this.a=!0}function the(e){$J(),qae(this),this.Df(e)}function nhe(e){Sg.call(this),aF(this,e)}function rhe(e){this.c=e,RP(e,0),zP(e,0)}function AS(e){return e.a=-e.a,e.b=-e.b,e}function jS(e,t){return e.a=t.a,e.b=t.b,e}function MS(e,t,n){return e.a+=t,e.b+=n,e}function ihe(e,t,n){return e.a-=t,e.b-=n,e}function ahe(e,t,n){IM(),e.nf(t)&&n.Ad(e)}function NS(e,t,n){sz($k(e.a),t,_De(n))}function ohe(e,t,n){return hx(t,mVe(e,n))}function she(e,t){return B(bE(e.e,t),19)}function che(e,t){return B(bE(e.e,t),19)}function lhe(e,t){return e.c.Ec(B(t,138))}function uhe(e,t){e_(),oS.call(this,e,t)}function dhe(e,t){t_(),sS.call(this,e,t)}function fhe(e,t){t_(),sS.call(this,e,t)}function phe(e,t){t_(),dhe.call(this,e,t)}function mhe(e,t){tx(),Gw.call(this,e,t)}function hhe(e,t){tx(),mhe.call(this,e,t)}function ghe(e,t){tx(),mhe.call(this,e,t)}function PS(e,t){tx(),ghe.call(this,e,t)}function FS(e,t){tx(),Gw.call(this,e,t)}function _he(e,t){tx(),Gw.call(this,e,t)}function vhe(e,t){tx(),FS.call(this,e,t)}function IS(e,t,n){wM.call(this,e,t,n,2)}function yhe(e,t,n){sz(EN(e.a),t,vDe(n))}function bhe(e,t){return IR(e.e,B(t,52))}function xhe(e,t,n){return t.xl(e.e,e.c,n)}function She(e,t,n){return t.yl(e.e,e.c,n)}function Che(e,t,n){return gJ(CN(e,t),n)}function whe(e,t){return(NE(e),e)+h_e(t)}function LS(e){return e==null?null:Jz(e)}function The(e){return e==null?null:Jz(e)}function Ehe(e){return e==null?null:ktt(e)}function Dhe(e){return e==null?null:tW(e)}function RS(e){e.o??l1e(e)}function zS(e){return Dw(e==null||Ty(e)),e}function z(e){return Dw(e==null||Ey(e)),e}function BS(e){return Dw(e==null||Dy(e)),e}function Ohe(){this.a=new mO,this.b=new mO}function khe(e,t){this.d=e,Ud(this),this.b=t}function VS(e,t){this.c=e,ag.call(this,e,t)}function HS(e,t){this.a=e,VS.call(this,e,t)}function Ahe(e,t,n){Oj.call(this,e,t,n,null)}function US(e,t,n){Oj.call(this,e,t,n,null)}function jhe(){iFe.call(this),this.Bb|=OX}function Mhe(e,t){sM.call(this,e),this.a=t}function Nhe(e,t){sM.call(this,e),this.a=t}function Phe(e,t){G1||hx(e.a,t)}function Fhe(e,t){return AWe(e,t),new gwe(e,t)}function Ihe(e,t,n){return e.Le(t,n)<=0?n:t}function Lhe(e,t,n){return e.Le(t,n)<=0?t:n}function Rhe(e){return NE(e),e?1231:1237}function zhe(e){return B(Pw(e.a,e.b),296)}function Bhe(e){return zO(),Mfe(B(e,205))}function Vhe(e,t){return B(RN(e.b,t),144)}function Hhe(e,t){return B(RN(e.c,t),236)}function WS(e){return new Pv(e.c,e.d+e.a)}function GS(e,t){return uI(),new k3e(t,e)}function KS(e,t){return Bg(),LI(t.d.i,e)}function Uhe(e,t){t.a?o$e(e,t):gx(e.a,t.b)}function Whe(e,t){return B(bE(e.b,t),280)}function qS(e,t){Zf.call(this,e),this.a=t}function Ghe(e,t,n){return n=_q(e,t,3,n),n}function Khe(e,t,n){return n=_q(e,t,6,n),n}function qhe(e,t,n){return n=_q(e,t,9,n),n}function JS(e,t){return XD(t,Tat),e.f=t,e}function Jhe(e,t){return(t&vY)%e.d.length}function Yhe(e,t,n){++e.j,e.oj(t,e.Xi(t,n))}function YS(e,t,n){++e.j,e.rj(),nM(e,t,n)}function Xhe(e,t,n){e.dd(t).Rb(n)}function Zhe(e,t){this.c=e,cP.call(this,t)}function Qhe(e,t){this.a=e,Nae.call(this,t)}function XS(e,t){this.a=e,Nae.call(this,t)}function ZS(e){this.q=new r.Date(Tk(e))}function $he(e){this.a=(lF(e,QY),new MM(e))}function ege(e){this.a=(lF(e,QY),new MM(e))}function tge(e){this.a=(ND(),new Xd(gE(e)))}function QS(){QS=E,Fvt=new qS(kat,0)}function $S(){$S=E,f6=new Zf(`root`)}function eC(){eC=E,F7=new Foe,new nm}function tC(){tC=E,Pvt=Bz((jB(),r7))}function nge(e){return tT(bT(e,32))^tT(e)}function rge(e){return String.fromCharCode(e)}function ige(e){return e==null?null:e.message}function age(e,t,n){return e.apply(t,n)}function oge(e,t,n){return oJ(e.c,e.b,t,n)}function sge(e,t,n){return HT(e,B(t,23),n)}function nC(e,t){return Rx(),e==t?0:e?1:-1}function cge(e,t){var n=t;return!!e.De(n)}function rC(e,t){var n=e.e;return e.e=t,n}function lge(e,t){e[Wit].call(e,t)}function uge(e,t){e[Wit].call(e,t)}function iC(e,t){e.a._c(e.b,t),++e.b,e.c=-1}function dge(e){wT(e.e),e.d.b=e.d,e.d.a=e.d}function aC(e){e.b?aC(e.b):e.f.c.yc(e.e,e.d)}function oC(e){return!e.a&&(e.a=new w),e.a}function fge(e,t,n){return e.a+=AB(t,0,n),e}function pge(e,t,n){Og(),vd(e,t.Te(e.a,n))}function mge(e,t,n,r){Bw.call(this,e,t,n,r)}function hge(e,t){Pae.call(this,e),this.a=t}function gge(e,t){Pae.call(this,e),this.a=t}function sC(){dC.call(this),this.a=new Eh}function cC(){this.n=new Eh,this.o=new Eh}function _ge(){this.b=new Eh,this.c=new up}function vge(){this.a=new up,this.b=new up}function yge(){this.a=new tt,this.b=new Pp}function lC(){this.b=new DA,this.a=new DA}function bge(){this.b=new Vp,this.a=new Vp}function xge(){this.b=new dp,this.a=new dp}function Sge(){this.a=new up,this.d=new up}function Cge(){this.a=new du,this.b=new di}function uC(){this.b=new Hce,this.a=new wa}function dC(){this.n=new $p,this.i=new Sb}function fC(e,t){return e.a+=t.a,e.b+=t.b,e}function pC(e,t){return e.a-=t.a,e.b-=t.b,e}function wge(e){return Lp(e.j.c,0),e.a=-1,e}function Tge(e,t,n){return n=_q(e,t,11,n),n}function Ege(e,t,n){n!=null&&xF(t,zV(e,n))}function Dge(e,t,n){n!=null&&SF(t,zV(e,n))}function mC(e,t,n,r){V.call(this,e,t,n,r)}function hC(e,t){jm.call(this,L$+e+j$+t)}function Oge(e,t,n,r){V.call(this,e,t,n,r)}function kge(e,t,n,r){Oge.call(this,e,t,n,r)}function Age(e,t,n,r){jT.call(this,e,t,n,r)}function jge(e,t,n,r){jT.call(this,e,t,n,r)}function Mge(e,t,n,r){jge.call(this,e,t,n,r)}function Nge(e,t,n,r){jT.call(this,e,t,n,r)}function gC(e,t,n,r){Nge.call(this,e,t,n,r)}function Pge(e,t,n,r){jge.call(this,e,t,n,r)}function Fge(e,t,n,r){Pge.call(this,e,t,n,r)}function Ige(e,t,n,r){PSe.call(this,e,t,n,r)}function Lge(e,t){return e.hk().ti().oi(e,t)}function Rge(e,t){return e.hk().ti().qi(e,t)}function zge(e,t){return e.n.a=(NE(t),t)+10}function Bge(e,t){return e.n.a=(NE(t),t)+10}function _C(e,t){return e.e=B(e.d.Kb(t),163)}function Vge(e,t){return t==e||IH($G(t),e)}function vC(e,t){return ih(Array(t),e)}function Hge(e,t){return NE(e),L(e)===L(t)}function yC(e,t){return NE(e),L(e)===L(t)}function Uge(e,t){return WE(e.a,t,``)==null}function Wge(e,t,n){return e.lastIndexOf(t,n)}function Gge(e,t){return e.b.zd(new Cue(e,t))}function Kge(e,t){return e.b.zd(new y_(e,t))}function qge(e,t){return e.b.zd(new wue(e,t))}function Jge(e){return e<100?null:new Oh(e)}function Yge(e,t){return J(t,(nY(),w4),e)}function Xge(e,t,n){return _z(e[t.a],e[n.a])}function Zge(e,t){return Yb(e.a.d.p,t.a.d.p)}function Qge(e,t){return Yb(t.a.d.p,e.a.d.p)}function $ge(e,t){return Bg(),!LI(t.d.i,e)}function e_e(e,t){G1||t&&(e.d=t)}function t_e(e,t){vb(e.f)?Z$e(e,t):yJe(e,t)}function bC(e,t){Yye.call(this,e,e.length,t)}function n_e(e){this.c=e,Wy.call(this,HY,0)}function r_e(e,t){this.c=e,GT.call(this,e,t)}function i_e(e,t,n){this.a=e,cS.call(this,t,n)}function a_e(e,t,n){this.c=t,this.b=n,this.a=e}function xC(e){GC(),this.d=e,this.a=new px}function SC(e,t){return t.ni(e.a)}function o_e(e,t){return _z(e.c-e.s,t.c-t.s)}function s_e(e,t){return _z(e.c.e.a,t.c.e.a)}function c_e(e,t){return _z(e.b.e.a,t.b.e.a)}function CC(e,t){return R(t,16)&&A4e(e.c,t)}function l_e(e,t,n){return B(e.c,72).Uk(t,n)}function wC(e,t,n){return B(e.c,72).Vk(t,n)}function u_e(e,t,n){return xhe(e,B(t,345),n)}function d_e(e,t,n){return She(e,B(t,345),n)}function f_e(e,t,n){return Rqe(e,B(t,345),n)}function p_e(e,t,n){return FJe(e,B(t,345),n)}function TC(e,t){return t==null?null:jR(e.b,t)}function EC(e){return e==y5||e==x5||e==b5}function m_e(e){return e.c?uN(e.c.a,e,0):-1}function h_e(e){return Ey(e)?(NE(e),e):e.se()}function DC(e){return!isNaN(e)&&!isFinite(e)}function g_e(e){cpe(this),AD(this),YF(this,e)}function OC(e){zb(this),wbe(this.c,0,e.Nc())}function __e(e){LE(e.a),rM(e.c,e.b),e.b=null}function v_e(){v_e=E,g_t=new le,__t=new ue}function y_e(){y_e=E,CHt=G(v1,CY,1,0,5,1)}function b_e(){b_e=E,nUt=G(v1,CY,1,0,5,1)}function x_e(){x_e=E,rUt=G(v1,CY,1,0,5,1)}function S_e(e){return qM(),QP((VMe(),j_t),e)}function C_e(e){return nR(),QP((Aj(),H_t),e)}function w_e(e){return vP(),QP((nMe(),nvt),e)}function T_e(e){return KM(),QP((rMe(),ovt),e)}function E_e(e){return kN(),QP((jj(),lvt),e)}function D_e(e){return lY(),QP((pfe(),Nvt),e)}function O_e(e,t){if(!e)throw P(new Nm(t))}function kC(e){if(!e)throw P(new Pm(zrt))}function k_e(e,t){if(e!=t)throw P(new Ap)}function AC(e,t,n){this.a=e,this.b=t,this.c=n}function A_e(e,t,n){this.a=e,this.b=t,this.c=n}function j_e(e,t,n){this.a=e,this.b=t,this.c=n}function M_e(e,t,n){this.b=e,this.c=t,this.a=n}function jC(e,t,n){this.d=e,this.b=n,this.a=t}function N_e(e,t,n){return Og(),e.a.Wd(t,n),t}function MC(e){var t=new He;return t.e=e,t}function NC(e){var t=new voe;return t.b=e,t}function PC(e,t,n){this.e=t,this.b=e,this.d=n}function FC(e,t,n){this.b=e,this.a=t,this.c=n}function IC(e){this.a=e,Cg(),BI(Date.now())}function P_e(e,t,n){this.a=e,this.b=t,this.c=n}function F_e(e){Bw.call(this,e.d,e.c,e.a,e.b)}function I_e(e){Bw.call(this,e.d,e.c,e.a,e.b)}function L_e(e){return UG(),QP((fIe(),Abt),e)}function R_e(e){return $I(),QP((HMe(),zvt),e)}function z_e(e){return bL(),QP((UMe(),pbt),e)}function B_e(e){return KN(),QP((ZAe(),nyt),e)}function V_e(e){return ON(),QP((Mj(),Qyt),e)}function H_e(e){return zU(),QP((DNe(),rbt),e)}function U_e(e){return HB(),QP((JM(),wbt),e)}function W_e(e){return PF(),QP((fA(),Ubt),e)}function LC(e){return sY(),QP((mfe(),Kxt),e)}function G_e(e){return yL(),QP((YM(),eSt),e)}function RC(e){return nL(),QP((XM(),hSt),e)}function K_e(e){return lU(),QP((eP(),xSt),e)}function q_e(e){return Yj(),QP((mA(),HSt),e)}function J_e(e){return gW(),QP((EPe(),RSt),e)}function Y_e(e){return IF(),QP((Wj(),DSt),e)}function X_e(e){return UK(),QP((pIe(),LSt),e)}function Z_e(e){return eB(),QP((QM(),KSt),e)}function Q_e(e){return nF(),QP((Pj(),ZSt),e)}function $_e(e){return WG(),QP((WIe(),sCt),e)}function zC(e){return bP(),QP((pA(),dCt),e)}function eve(e){return SL(),QP((Fj(),mCt),e)}function tve(e){return QU(),QP((TPe(),SCt),e)}function nve(e){return oN(),QP((hA(),ECt),e)}function rve(e){return BH(),QP((CPe(),PCt),e)}function ive(e){return YU(),QP((wPe(),VCt),e)}function ave(e){return RK(),QP((wLe(),KCt),e)}function ove(e){return tL(),QP((aMe(),XCt),e)}function sve(e){return xL(),QP((iMe(),$Ct),e)}function cve(e){return AN(),QP((Nj(),twt),e)}function lve(e){return kk(),QP((QAe(),awt),e)}function uve(e){return $z(),QP((nP(),Pwt),e)}function dve(e){return sA(),QP((gA(),Rwt),e)}function BC(e){return yV(),QP((GMe(),Xkt),e)}function VC(e){return bR(),QP((cMe(),qkt),e)}function fve(e){return dV(),QP((rP(),tAt),e)}function pve(e){return aq(),QP((CLe(),lAt),e)}function mve(e){return _K(),QP((GIe(),Hkt),e)}function hve(e){return MB(),QP((ZM(),mAt),e)}function gve(e){return jN(),QP((_A(),vAt),e)}function _ve(e){return rF(),QP((Ij(),bAt),e)}function vve(e){return eL(),QP((oMe(),TAt),e)}function yve(e){return tR(),QP((Lj(),kAt),e)}function bve(e){return xR(),QP((Rj(),NAt),e)}function xve(e){return tF(),QP((sMe(),RAt),e)}function Sve(e){return rL(),QP((zj(),VAt),e)}function HC(e){return yR(),QP((WMe(),ujt),e)}function Cve(e){return oA(),QP(($Ae(),vjt),e)}function wve(e){return oO(),QP((eje(),kjt),e)}function UC(e){return hO(),QP((tje(),jjt),e)}function Tve(e){return _j(),QP((nje(),Jjt),e)}function Eve(e,t){return(NE(e),e)+(NE(t),t)}function Dve(e){return aO(),QP((vA(),tMt),e)}function Ove(e){return fV(),QP((tN(),iMt),e)}function kve(e){return oq(),QP((hfe(),yMt),e)}function Ave(e){return BL(),QP((uMe(),CMt),e)}function jve(e){return $L(),QP((KMe(),ONt),e)}function Mve(e){return nk(),QP((rje(),MNt),e)}function Nve(e){return FF(),QP((ije(),zNt),e)}function Pve(e){return vU(),QP((tP(),KNt),e)}function Fve(e){return RM(),QP((aje(),XNt),e)}function Ive(e){return eR(),QP((dMe(),tPt),e)}function Lve(e){return RV(),QP(($M(),HPt),e)}function Rve(e){return OI(),QP((Bj(),qPt),e)}function WC(e){return CB(),QP((lMe(),ZPt),e)}function zve(e){return MU(),QP((eN(),rFt),e)}function Bve(e){return tB(),QP((fMe(),mFt),e)}function GC(){GC=E,pjt=(GJ(),Z5),mjt=j5}function KC(){KC=E,uSt=new Tr,dSt=new A}function qC(){qC=E,Wbt=new pn,Gbt=new mn}function JC(){JC=E,nSt=new See,tSt=new Cee}function Vve(e){return!e.e&&(e.e=new up),e.e}function Hve(e){return aK(),QP((GNe(),vIt),e)}function YC(e){return Wg(),QP((wke(),EIt),e)}function Uve(e){return lz(),QP((Vj(),CIt),e)}function Wve(e){return Gg(),QP((Tke(),kIt),e)}function XC(e){return gj(),QP((sje(),NIt),e)}function Gve(e){return eW(),QP((KNe(),BIt),e)}function Kve(e){return yA(),QP((oje(),aIt),e)}function qve(e){return sN(),QP((Hj(),uIt),e)}function ZC(e){return BR(),QP((Uj(),hIt),e)}function Jve(e){return Kg(),QP((Eke(),SLt),e)}function Yve(e){return iL(),QP((cje(),ELt),e)}function Xve(e){return aA(),QP((lje(),ALt),e)}function Zve(e){return AH(),QP((qMe(),RLt),e)}function Qve(e){return qg(),QP((Dke(),eRt),e)}function $ve(e){return Jg(),QP((Oke(),rRt),e)}function QC(e){return Yg(),QP((kke(),oRt),e)}function eye(e){return xP(),QP((uje(),uRt),e)}function $C(e){return eV(),QP(($N(),SRt),e)}function tye(e){return fW(),QP((mIe(),TRt),e)}function nye(e){return bV(),QP((OPe(),NRt),e)}function rye(e){return eU(),QP((AP(),YRt),e)}function iye(e){return cz(),QP((WN(),yBt),e)}function aye(e){return RR(),QP((JMe(),wBt),e)}function oye(e){return yP(),QP((Kj(),EBt),e)}function sye(e){return rB(),QP((nN(),kBt),e)}function cye(e){return NU(),QP((DPe(),LBt),e)}function lye(e){return rR(),QP((Gj(),KBt),e)}function ew(e){return pH(),QP((rN(),YBt),e)}function uye(e){return vG(),QP((UIe(),XBt),e)}function dye(e){return nV(),QP((WNe(),$Bt),e)}function fye(e){return mU(),QP((jP(),tVt),e)}function pye(e){return NW(),QP((kPe(),rVt),e)}function mye(e){return MP(),QP((Jj(),pVt),e)}function hye(e){return GJ(),QP((UN(),iVt),e)}function gye(e){return jB(),QP((aN(),mVt),e)}function _ye(e){return dq(),QP((HIe(),xVt),e)}function vye(e){return zR(),QP((qj(),TVt),e)}function yye(e){return cA(),QP((iN(),AVt),e)}function bye(e){return nB(),QP((YMe(),IVt),e)}function xye(e){return QL(),QP((XMe(),UVt),e)}function Sye(e,t){this.c=e,this.a=t,this.b=t-e}function tw(e,t,n){this.c=e,this.a=t,this.b=n}function Cye(e,t,n){this.a=e,this.c=t,this.b=n}function wye(e,t,n){this.a=e,this.c=t,this.b=n}function Tye(e,t,n){this.a=e,this.b=t,this.c=n}function Eye(e,t,n){this.a=e,this.b=t,this.c=n}function Dye(e,t,n){this.a=e,this.b=t,this.c=n}function Oye(e,t,n){this.a=e,this.b=t,this.c=n}function kye(e,t,n){this.a=e,this.b=t,this.c=n}function Aye(e,t,n){this.a=e,this.b=t,this.c=n}function jye(e,t,n){this.a=e,this.b=t,this.c=n}function Mye(e,t,n){this.b=e,this.a=t,this.c=n}function nw(e,t,n){this.e=e,this.a=t,this.c=n}function Nye(e,t,n){tx(),pO.call(this,e,t,n)}function Pye(e,t,n){tx(),LCe.call(this,e,t,n)}function Fye(e,t,n){tx(),LCe.call(this,e,t,n)}function Iye(e,t,n){tx(),LCe.call(this,e,t,n)}function Lye(e,t,n){tx(),Pye.call(this,e,t,n)}function Rye(e,t,n){tx(),Pye.call(this,e,t,n)}function zye(e,t,n){tx(),Rye.call(this,e,t,n)}function Bye(e,t,n){tx(),Fye.call(this,e,t,n)}function Vye(e,t,n){tx(),Iye.call(this,e,t,n)}function Hye(e){return mG(),QP((hIe(),gHt),e)}function rw(e,t){return gE(e),gE(t),new dle(e,t)}function iw(e,t){return gE(e),gE(t),new xbe(e,t)}function Uye(e,t){return gE(e),gE(t),new Sbe(e,t)}function Wye(e,t){return gE(e),gE(t),new vle(e,t)}function Gye(e,t){wle.call(this,e,Pz(new Lm(t)))}function Kye(e,t){this.c=e,this.b=t,this.a=!1}function qye(e){this.d=e,Ud(this),this.b=Zxe(e.d)}function Jye(e,t,n){this.c=e,d_.call(this,t,n)}function Yye(e,t,n){hSe.call(this,t,n),this.a=e}function Xye(){this.a=`;,;`,this.b=``,this.c=``}function Zye(e,t,n){this.b=e,Hy.call(this,t,n)}function Qye(e,t){t&&(e.b=t,e.a=(IE(t),t.a))}function $ye(e){return SS(e.b!=0),mP(e,e.a.a)}function ebe(e){return SS(e.b!=0),mP(e,e.c.b)}function tbe(e){return!e.c&&(e.c=new xc),e.c}function nbe(e){var t=new doe;return WF(t,e),t}function aw(e){var t=new Sg;return WF(t,e),t}function ow(e){var t=new up;return gNe(t,e),t}function rbe(e){var t=new Vp;return gNe(t,e),t}function B(e,t){return Dw(e==null||XUe(e,t)),e}function sw(e,t){return t&&AE(e,t.d)?t:null}function cw(e,t){if(!e)throw P(new Nm(t))}function ibe(e,t){if(!e)throw P(new wse(t))}function lw(e,t){if(!e)throw P(new Pm(t))}function abe(e,t){return Ug(),Yb(e.d.p,t.d.p)}function obe(e,t){return CP(),_z(e.e.b,t.e.b)}function sbe(e,t){return CP(),_z(e.e.a,t.e.a)}function cbe(e,t){return Yb(Lbe(e.d),Lbe(t.d))}function lbe(e,t){return t==(GJ(),Z5)?e.c:e.d}function ube(e){return new Pv(e.c+e.b,e.d+e.a)}function dbe(e){var t,n=e.d;t=e.a,e.d=t,e.a=n}function fbe(e){var t=e.b;e.b=e.c,e.c=t}function uw(e,t,n,r,i){e.b=t,e.c=n,e.d=r,e.a=i}function pbe(e,t,n,r,i){e.d=t,e.c=n,e.a=r,e.b=i}function mbe(e,t,n,r,i){e.c=t,e.d=n,e.b=r,e.a=i}function dw(e,t){return mPe(e),e.a*=t,e.b*=t,e}function hbe(e,t){return t<0?e.g=-1:e.g=t,e}function fw(e,t,n){by.call(this,e,t),this.c=n}function gbe(e,t,n){N_.call(this,e,t),this.b=n}function _be(e){x_e(),rc.call(this),this._h(e)}function pw(e,t,n){by.call(this,e,t),this.c=n}function vbe(e,t,n){this.a=e,Qy.call(this,t,n)}function ybe(e,t,n){this.a=e,Qy.call(this,t,n)}function bbe(e){this.b=e,this.a=fT(this.b.a).Md()}function xbe(e,t){this.b=e,this.a=t,nu.call(this)}function Sbe(e,t){this.a=e,this.b=t,nu.call(this)}function Cbe(e){cS.call(this,e.length,0),this.a=e}function wbe(e,t,n){IQe(n,0,e,t,n.length,!1)}function mw(e,t,n){ZN(e,t,new _E(n))}function Tbe(e,t){var n=e.c;return hFe(e,t),n}function Ebe(e,t){return(az(e)<<4|az(t))&uX}function Dbe(e){return e!=null&&!nVe(e,I7,L7)}function hw(e){return e==0||isNaN(e)?e:e<0?-1:1}function Obe(e){e.a.b=e.b,e.b.a=e.a,e.a=e.b=null}function gw(e,t){return bA(e,t,e.c.b,e.c),!0}function _w(e){return gN(e.slice(),e)}function vw(e){var t=e.n;return e.a.b+t.d+t.a}function kbe(e){var t=e.n;return e.e.b+t.d+t.a}function Abe(e){var t=e.n;return e.e.a+t.b+t.c}function yw(e){return cY(),++W9,new Ww(0,e)}function jbe(){jbe=E,jUt=(ND(),new Xd(Zmt))}function bw(){bw=E,new aWe((dm(),egt),(um(),$ht))}function Mbe(){mj(),PCe.call(this,(i_(),q7))}function Nbe(e,t){hSe.call(this,t,1040),this.a=e}function xw(e,t){return OH(e,new N_(t.a,t.b))}function Pbe(e){return!NA(e)&&e.c.i.c==e.d.i.c}function Fbe(e,t){return e.c<t.c?-1:e.c==t.c?0:1}function Ibe(e){return e.b.c.length-e.e.c.length}function Lbe(e){return e.e.c.length-e.g.c.length}function Rbe(e){return e.e.c.length+e.g.c.length}function zbe(e){return SP(),G(oMt,Ilt,41,e,0,1)}function Bbe(){Bbe=E,Ngt=G(N1,LY,15,256,0,1)}function Vbe(){this.b=F(z(iV((xq(),Cyt))))}function Hbe(e){return zO(),(GJ(),I5).Gc(e.j)}function Ube(e,t,n){return CP(),n.e.a+n.f.a+e*t}function Wbe(e,t,n){return CP(),n.e.b+n.f.b+e*t}function Gbe(e,t,n){return WE(e.b,B(n.b,17),t)}function Kbe(e,t,n){return WE(e.b,B(n.b,17),t)}function qbe(e,t){return hx(e,new Pv(t.a,t.b))}function Jbe(e,t){vF(e,t==null?null:(NE(t),t))}function Ybe(e,t){_Fe(e,t==null?null:(NE(t),t))}function Xbe(e,t){_Fe(e,t==null?null:(NE(t),t))}function Zbe(e,t,n,r){vHe.call(this,e,t,n,r,0,0)}function Sw(e,t){xy.call(this,e,t),this.a=this}function Qbe(e){x_e(),_be.call(this,e),this.a=-1}function $be(){Ide.call(this,`COUNT_CHILDREN`,0)}function exe(e){this.c=e,this.b=this.c.d.vc().Jc()}function txe(e){return e.e.Pd().gc()*e.c.Pd().gc()}function Cw(e,t,n){return new a_e(UCe(e).Ze(),n,t)}function ww(e,t,n){return e.a=-1,mS(e,t.g,n),e}function nxe(e,t,n){var r=e[t];return e[t]=n,r}function Tw(e,t){var n=bCe(e,t);return n.i=2,n}function Ew(e,t){var n;return++e.j,n=e.Aj(t),n}function rxe(e){return e.a?e.a:zwe(e)}function Dw(e){if(!e)throw P(new Mm(null))}function ixe(e){if(e.c.e!=e.a)throw P(new Ap)}function axe(e){if(e.e.c!=e.b)throw P(new Ap)}function Ow(e){for(gE(e);e.Ob();)e.Pb(),e.Qb()}function oxe(e){e.a.jd(),B(e.a.kd(),18).gc(),Ise()}function kw(){kw=E,sgt=new mOe((ND(),ND(),H1))}function Aw(){Aw=E,lgt=new fue((ND(),ND(),a_t))}function sxe(){sxe=E,Agt=G(k1,LY,224,256,0,1)}function cxe(){cxe=E,Mgt=G(A1,LY,183,128,0,1)}function lxe(){lxe=E,Fgt=G(P1,LY,192,256,0,1)}function uxe(){uxe=E,Bgt=G(F1,LY,193,256,0,1)}function dxe(){uw(this,!1,!1,!1,!1)}function jw(e){Zne.call(this,new DA),YF(this,e)}function Mw(e){this.a=new bg(e.gc()),YF(this,e)}function fxe(e){this.c=e,this.a=new xg(this.c.a)}function Nw(e,t){Og(),sM.call(this,e),this.a=t}function Pw(e,t){return YO(t,e.c.length),e.c[t]}function pxe(e,t){return YO(t,e.a.length),e.a[t]}function mxe(e,t){return e.a+=AB(t,0,t.length),e}function hxe(e,t){return e.a??J4e(e),e.a[t]}function gxe(e,t,n){return Yb(t.d[e.g],n.d[e.g])}function _xe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function vxe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function Fw(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function yxe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function Iw(e,t){return NE(e),TI(e,(NE(t),t))}function bxe(e,t){return NE(t),TI(t,(NE(e),e))}function xxe(e){return e.q?e.q:(ND(),ND(),U1)}function Sxe(e){return e.c-B(Pw(e.a,e.b),296).b}function Lw(e,t){return e?0:r.Math.max(0,t-1)}function Rw(e,t,n){return r.Math.min(n/e,1/t)}function zw(e,t,n,r,i,a){return hqe(e,t,n,r,i,0,a)}function Bw(e,t,n,r){pbe(this,e,t,n,r)}function Cxe(e,t){var n;for(n=0;n<t;++n)e[n]=-1}function wxe(e){var t=bqe(e);return t?wxe(t):e}function Vw(e){return e.c?e.c.f:e.e.b}function Hw(e){return e.c?e.c.g:e.e.a}function Uw(e){cP.call(this,e.gc()),aE(this,e)}function Txe(){lg.call(this,`SIMPLE_X_PLACING`,0)}function Exe(){lg.call(this,`SIMPLE_Y_PLACING`,0)}function Dxe(e){this.a=e,this.c=new dp,TLe(this)}function Oxe(e){this.b=new Sg,this.a=e,this.c=-1}function Ww(e,t){cY(),cp.call(this,e),this.a=t}function Gw(e,t){tx(),np.call(this,t),this.a=e}function Kw(e,t,n){this.a=e,Ex.call(this,t,n,2)}function qw(e,t,n){JO(t,e.c.length),C_(e.c,t,n)}function kxe(e,t){return!e&&(e=[]),e[e.length]=t,e}function Jw(e,t,n){HRe(0,t,e.length),VM(e,0,t,n)}function Yw(e,t,n){var r;for(r=0;r<t;++r)e[r]=n}function Xw(e,t){var n=Bz(e);return GLe(n,t),n}function Zw(e,t){return R(t,23)&&Vx(e,B(t,23))}function Axe(e,t){return R(t,23)&&cPe(e,B(t,23))}function Qw(e,t){return JRe(e,t,vje(e,e.b.Ae(t)))}function jxe(e,t){return e.a.get(t)!==void 0}function $w(e,t){return e==null?t==null:yC(e,t)}function Mxe(e,t){return e==null?t==null:BB(e,t)}function eT(e,t){return cY(),++W9,new $Se(e,t)}function tT(e){return cb(e)?e|0:Yce(e)}function nT(){nT=E,GVt=new Lb((oY(),E8),0)}function Nxe(){Nxe=E,ngt=new Cbe(G(v1,CY,1,0,5,1))}function Pxe(){this.b=new St,this.c=new LTe(this)}function rT(){this.d=new Ne,this.e=new ITe(this)}function Fxe(e,t){this.b=new Sg,this.a=e,this.c=t}function Ixe(){tDe(),this.g=new Sg,this.f=new Sg}function Lxe(e,t){iT(e,pC(new Pv(t.a,t.b),e.c))}function iT(e,t){fC(e.c,t),e.b.c+=t.a,e.b.d+=t.b}function aT(e){e.b?aT(e.b):e.d.dc()&&e.f.c.Ac(e.e)}function Rxe(e){return Array.isArray(e)&&e.Rm===T}function oT(e){return YG(e,26)*IX+YG(e,27)*LX}function zxe(e,t,n){return BT(e,new j_(t.a,n.a))}function sT(e,t,n){return-Yb(e.f[t.p],e.f[n.p])}function cT(e,t,n){var r;e&&(r=e.i,r.c=t,r.b=n)}function lT(e,t,n){var r;e&&(r=e.i,r.d=t,r.a=n)}function uT(e,t,n){return e.a=-1,mS(e,t.g+1,n),e}function Bxe(e,t,n){return n=_q(e,B(t,52),7,n),n}function Vxe(e,t,n){return n=_q(e,B(t,52),3,n),n}function Hxe(e,t,n){G$e(n,e,1),hx(t,new U_(n,e))}function Uxe(e,t,n){DH(n,e,1),hx(t,new Rue(n,e))}function Wxe(e,t,n){this.a=e,Dx.call(this,t,n,22)}function Gxe(e,t,n){this.a=e,Dx.call(this,t,n,14)}function Kxe(e,t,n,r){tx(),BOe.call(this,e,t,n,r)}function qxe(e,t,n,r){tx(),BOe.call(this,e,t,n,r)}function Jxe(e,t){(t.Bb&h$)!=0&&!e.a.o&&(e.a.o=t)}function Yxe(e){return e!=null&&RSe(e)&&e.Rm!==T}function Xxe(e){return!Array.isArray(e)&&e.Rm===T}function Zxe(e){return R(e,16)?B(e,16).cd():e.Jc()}function Qxe(e){return e.Oc(G(v1,CY,1,e.gc(),5,1))}function dT(e,t){return NHe(CN(e,t))?t.wi():null}function fT(e){return e.c?e.c:e.c=e.Qd()}function $xe(e){return e.d?e.d:e.d=e.Rd()}function pT(e){return e.i||=e.bc()}function eSe(e){return e.f||=e.Cc()}function tSe(e){return cY(),++W9,new fO(10,e,0)}function mT(e){s_(),this.a=0,this.b=e-1,this.c=1}function nSe(e){nx(this),this.g=e,kD(this),this.he()}function rSe(){zO(),this.k=new dp,this.d=new Vp}function iSe(e,t,n,r){this.a=e,Oj.call(this,e,t,n,r)}function hT(e){this.a=(Nxe(),ngt),this.d=B(gE(e),51)}function gT(e){if(e.e.j!=e.d)throw P(new Ap)}function _T(e){return cb(e)?``+e:T4e(e)}function vT(e,t){return RI(EYe(cb(e)?qI(e):e,t))}function yT(e,t){return RI(gG(cb(e)?qI(e):e,t))}function bT(e,t){return RI(cXe(cb(e)?qI(e):e,t))}function aSe(e,t){return nC((NE(e),e),(NE(t),t))}function oSe(e,t){return _z((NE(e),e),(NE(t),t))}function sSe(e,t){return gE(t),e.a.Hd(t)&&!e.b.Hd(t)}function cSe(e,t){return Xb(e.l&t.l,e.m&t.m,e.h&t.h)}function lSe(e,t){return Xb(e.l|t.l,e.m|t.m,e.h|t.h)}function uSe(e,t){return Xb(e.l^t.l,e.m^t.m,e.h^t.h)}function xT(e,t){return XR(e,(NE(t),new tre(t)))}function ST(e,t){return XR(e,(NE(t),new nre(t)))}function dSe(e,t,n){e.a.Mb(n)&&(e.b=!0,t.Ad(n))}function fSe(e){e.d||(e.d=e.b.Jc(),e.c=e.b.gc())}function CT(e,t){if(e<0||e>=t)throw P(new Ip)}function wT(e){e.f=new Dfe(e),e.i=new Ofe(e),++e.g}function TT(e){this.b=new MM(11),this.a=(PD(),e)}function pSe(e){this.b=null,this.a=(PD(),e||o_t)}function mSe(e,t){this.e=e,this.d=t&64?t|RY:t}function hSe(e,t){this.c=0,this.d=e,this.b=t|64|RY}function gSe(e){this.a=$Ue(e.a),this.b=new OC(e.b)}function ET(e,t,n,r){var i=e.i;i.i=t,i.a=n,i.b=r}function _Se(e){for(var t=e;t.f;)t=t.f;return t}function vSe(e){return e.e?bj(e.e):null}function ySe(e,t){return uI(),_z(t.a.o.a,e.a.o.a)}function bSe(e,t,n){return zK(),CI(e,t)&&CI(e,n)}function DT(e){return NW(),!e.Gc(D5)&&!e.Gc(k5)}function xSe(e,t,n){return Drt(e,B(t,12),B(n,12))}function SSe(e){return dI(),B(e,12).g.c.length!=0}function CSe(e){return dI(),B(e,12).e.c.length!=0}function OT(e){return new Pv(e.c+e.b/2,e.d+e.a/2)}function wSe(e,t){return t.Sh()?IR(e.b,B(t,52)):t}function TSe(e,t,n){t.of(n,F(z(bE(e.b,n)))*e.a)}function ESe(e,t){t.Tg(`General 'Rotator`,1),utt(e)}function kT(e,t,n,r,i){TM.call(this,e,t,n,r,i,-1)}function AT(e,t,n,r,i){EM.call(this,e,t,n,r,i,-1)}function V(e,t,n,r){Ex.call(this,e,t,n),this.b=r}function jT(e,t,n,r){fw.call(this,e,t,n),this.b=r}function DSe(e){hy.call(this,e,!1),this.a=!1}function OSe(){Ide.call(this,`LOOKAHEAD_LAYOUT`,1)}function kSe(){Ide.call(this,`LAYOUT_NEXT_LEVEL`,3)}function ASe(){lg.call(this,`ABSOLUTE_XPLACING`,0)}function jSe(e){this.b=e,iS.call(this,e),Nx(this)}function MSe(e){this.b=e,nS.call(this,e),nme(this)}function NSe(e,t){this.b=e,Yu.call(this,e.b),this.a=t}function MT(e,t,n){this.a=e,mC.call(this,t,n,5,6)}function PSe(e,t,n,r){this.b=e,Ex.call(this,t,n,r)}function NT(e,t,n){rq(),this.e=e,this.d=t,this.a=n}function PT(e,t){for(NE(t);e.Ob();)t.Ad(e.Pb())}function FT(e,t){return cY(),++W9,new TE(e,t,0)}function FSe(e,t){return cY(),++W9,new TE(6,e,t)}function ISe(e,t){return yC(e.substr(0,t.length),t)}function IT(e,t){return Dy(t)?VD(e,t):!!Qw(e.f,t)}function LSe(e){return Xb(~e.l&hX,~e.m&hX,~e.h&gX)}function RSe(e){return typeof e===mY||typeof e===_Y}function LT(e){return new hT(new ume(e.a.length,e.a))}function zSe(e){return new Nw(null,tCe(e,e.length))}function BSe(e){if(!e)throw P(new jp);return e.d}function RT(e){var t=jL(e);return SS(t!=null),t}function VSe(e){var t=dz(e);return SS(t!=null),t}function zT(e,t){var n=e.a.gc();return Uje(t,n),n-t}function BT(e,t){return e.a.yc(t,e)==null}function VT(e,t){return e.a.yc(t,(Rx(),E1))==null}function HSe(e,t){return e>0?r.Math.log(e/t):-100}function USe(e,t){return t?YF(e,t):!1}function HT(e,t,n){return OF(e.a,t),nxe(e.b,t.g,n)}function WSe(e,t,n){CT(n,e.a.c.length),TA(e.a,n,t)}function H(e,t,n,r){HRe(t,n,e.length),GSe(e,t,n,r)}function GSe(e,t,n,r){var i;for(i=t;i<n;++i)e[i]=r}function KSe(e,t){var n;for(n=0;n<t;++n)e[n]=!1}function qSe(e,t){if(e==null)throw P(new Fm(t))}function UT(e,t){ype(e,R(t,164)?t:B(t,2015).Pl())}function JSe(e,t,n){htt(e.a,e.b,e.d,e.c,B(t,171),n)}function WT(e,t,n){return VRe(e,t.g,n),OF(e.c,t),e}function YSe(e){return RJ(e,(cz(),B8)),e.d=!0,e}function XSe(e){return!e.j&&Rne(e,i6e(e.g,e.b)),e.j}function ZSe(e,t,n){var r=HN(e,t);return BAe(e,t,n),r}function QSe(e,t,n){this.c=e,this.a=t,ND(),this.b=n}function GT(e,t){this.d=e,jx.call(this,e),this.e=t}function $Se(e,t){cp.call(this,1),this.a=e,this.b=t}function KT(e){CS(e.b!=-1),ij(e.c,e.a=e.b),e.b=-1}function eCe(e){e.a=null,e.e=null,wT(e.b),e.d=0,++e.c}function qT(e){return e.e==0?e:new NT(-e.e,e.d,e.a)}function tCe(e,t){return ePe(t,e.length),new Nbe(e,t)}function nCe(e,t){return NR(e,t)<0?-1:NR(e,t)>0?1:0}function rCe(e,t){return _z(e.c.c+e.c.b,t.c.c+t.c.b)}function JT(e,t){bA(e.d,t,e.b.b,e.b),++e.a,e.c=null}function YT(e,t){return e.c?YT(e.c,t):hx(e.b,t),e}function XT(e,t){kg(dD(e.Mc(),new Ur),new Mf(t))}function ZT(e,t,n,r,i){TU(e,B($A(t.k,n),16),n,r,i)}function iCe(e,t,n,r,i){for(;t<n;)r[i++]=YE(e,t++)}function aCe(e,t,n){var r;for(r=0;r<t;++r)yE(e,r,n)}function QT(e){e.s=NaN,e.c=NaN,a$e(e,e.e),a$e(e,e.j)}function oCe(e){return r.Math.abs(e.d.e-e.e.e)-e.a}function $T(e,t){return _z(e.e.a+e.f.a,t.e.a+t.f.a)}function eE(e,t){return _z(e.e.b+e.f.b,t.e.b+t.f.b)}function tE(e,t){this.d=uBe(e),this.c=t,this.a=.5*t}function nE(e){this.d=(NE(e),e),this.a=0,this.c=HY}function rE(e){FTe.call(this),this.a=e,hx(e.a,this)}function iE(e){e?eJe(e,(Cg(),Hgt),``):mEe((Cg(),e))}function sCe(e,t){OE(e,new _E(t.f==null?``+t.g:t.f))}function cCe(e,t){OE(e,new _E(t.f==null?``+t.g:t.f))}function aE(e,t){return e.Qi()&&(t=DO(e,t)),e.Di(t)}function oE(e,t){return t=e.Wk(null,t),CU(e,null,t)}function lCe(e,t,n){return cY(),++W9,new iOe(e,t,n)}function sE(e,t,n){return B(e.c.fd(t,B(n,138)),45)}function uCe(){return Tm(),q(I(igt,1),$Y,541,0,[rgt])}function dCe(e){return e==wX?d1:e==TX?`-INF`:``+e}function fCe(e){return e==wX?d1:e==TX?`-INF`:``+e}function cE(e){return(e.i??Rq(e),e.i).length}function lE(){lE=E,Q7=_Qe(),(uY(),e9)&&bKe()}function uE(){uE=E,xgt=new pd(!1),Sgt=new pd(!0)}function dE(e){var t;return t=e.g,t||(e.g=new Hu(e))}function fE(e){var t;return t=e.k,t||(e.k=new Uu(e))}function pCe(e){var t;return t=e.k,t||(e.k=new Uu(e))}function mCe(e){var t;return t=e.i,t||(e.i=new cne(e))}function hCe(e){return e.j||=new cd(e)}function gCe(e){return e.f||=new eme(e)}function pE(e){return e.d||=new nd(e)}function _Ce(e){return R(e,613)?e:new EEe(e)}function vCe(e,t){return wk(t,e.c.b.c.gc()),new ule(e,t)}function yCe(e,t){var n=e.a.gc();return wk(t,n),n-1-t}function U(e,t,n){var r=bCe(e,t);return HPe(n,r),r}function bCe(e,t){var n=new PLe;return n.j=e,n.d=t,n}function mE(e,t){return e.a+=String.fromCharCode(t),e}function hE(e,t){return e.a+=String.fromCharCode(t),e}function gE(e){if(e==null)throw P(new Op);return e}function _E(e){if(e==null)throw P(new Op);this.a=e}function xCe(e){Fp(),this.b=new up,this.a=e,H9e(this,e)}function SCe(e){this.b=e,this.a=B(ME(this.b.a.e),229)}function CCe(e){this.d=e,this.c=e.a.d.a,this.b=e.a.e.g}function wCe(e){this.b=new up,this.a=new up,this.c=e}function vE(e){this.c=new Eh,this.a=new up,this.b=e}function TCe(){DA.call(this),this.a=!0,this.b=!0}function ECe(e,t){return XO(t,e.length+1),e.substr(t)}function yE(e,t,n){return Bme(n==null||d8e(e,n)),e[t]=n}function DCe(e,t,n){return l3e(e,FFe(e,t,n))}function OCe(e,t){console[e].call(console,t)}function bE(e,t){return Dy(t)?sO(e,t):wy(Qw(e.f,t))}function kCe(e,t){return B(fT(e.a).Kd().Xb(t),45).jd()}function xE(e,t){return B(Y(t,(nY(),K4)),15).a<e}function ACe(e,t){return uI(),B(ZE(e,t.d),16).Ec(t)}function jCe(e,t,n,r){return n==0||(n-r)/n<e.e||t>=e.g}function SE(e){return r.Math.sqrt(e.a*e.a+e.b*e.b)}function CE(e){return R(e,104)&&(B(e,20).Bb&h$)!=0}function wE(e){return!e.d&&(e.d=new Ex(G7,e,1)),e.d}function MCe(e){return!e.a&&(e.a=new Ex(d7,e,4)),e.a}function NCe(e){this.c=e,this.a=new Sg,this.b=new Sg}function PCe(e){this.a=(NE(Y$),Y$),this.b=e,new rm}function FCe(e,t,n){this.a=e,Fke.call(this,8,t,null,n)}function ICe(e,t,n){this.a=e,Pae.call(this,t),this.b=n}function TE(e,t,n){cp.call(this,e),this.a=t,this.b=n}function LCe(e,t,n){np.call(this,t),this.a=e,this.b=n}function EE(e,t,n){B(t.b,68),hP(t.a,new Eye(e,n,t))}function DE(e,t){for(NE(t);e.c<e.d;)e.Qe(t,e.c++)}function RCe(e,t){++e.j,yU(e,e.i,t),vQe(e,B(t,345))}function zCe(e,t){var n;++e.j,n=e.Cj(),e.pj(e.Xi(n,t))}function OE(e,t){var n=e.a.length;HN(e,n),BAe(e,n,t)}function kE(e,t){return CT(t,e.a.c.length),Pw(e.a,t)}function AE(e,t){return sH(e.c,e.f,t,e.b,e.a,e.e,e.d)}function jE(e,t){return L(e)===L(t)||e!=null&&ZR(e,t)}function BCe(e){return ME(e),R(e,475)?B(e,475):Jz(e)}function VCe(e){return e?e.dc():!e.Jc().Ob()}function HCe(e){return B9?VD(B9,e):!1}function UCe(e){return 0>=e?new Fle:yFe(e-1)}function ME(e){if(e==null)throw P(new Op);return e}function NE(e){if(e==null)throw P(new Op);return e}function PE(e){return!e.a&&e.c?e.c.b:e.a}function WCe(e){return e.c.i.c==e.d.i.c}function GCe(e,t){return Yb(t.j.c.length,e.j.c.length)}function KCe(e){kwe(e.a),e.b=G(v1,CY,1,e.b.length,5,1)}function FE(e){e.c?e.c.Ye():(e.d=!0,dK(e))}function IE(e){e.c?IE(e.c):(zz(e),e.d=!0)}function LE(e){CS(e.c!=-1),e.d.ed(e.c),e.b=e.c,e.c=-1}function qCe(e){e.b=!1,e.c=!1,e.d=!1,e.a=!1}function JCe(e){this.c=e,this.b=this.c.a,this.a=this.c.e}function RE(){Qoe.call(this),Lp(this.j.c,0),this.a=-1}function YCe(){lg.call(this,`DELAUNAY_TRIANGULATION`,0)}function XCe(e){for(;e.a.b!=0;)Vet(e,B(yEe(e.a),9))}function ZCe(e,t){gM((!e.a&&(e.a=new XS(e,e)),e.a),t)}function QCe(e,t){e.c<0||e.b.b<e.c?Gy(e.b,t):e.a.vf(t)}function zE(e,t){var n=e.Fh(t);n>=0?e.hi(n):HZe(e,t)}function $Ce(e,t){this.b=e,GT.call(this,e,t),Nx(this)}function ewe(e,t){this.b=e,r_e.call(this,e,t),nme(this)}function twe(){XJe.call(this,Q$,(Ph(),KHt)),u7e(this)}function nwe(e){return!e.b&&(e.b=new rp(new Woe)),e.b}function BE(e){if(e.p!=3)throw P(new Dp);return e.e}function rwe(e){if(e.p!=4)throw P(new Dp);return e.e}function iwe(e){if(e.p!=4)throw P(new Dp);return e.j}function awe(e){if(e.p!=3)throw P(new Dp);return e.j}function owe(e){if(e.p!=6)throw P(new Dp);return e.f}function swe(e){if(e.p!=6)throw P(new Dp);return e.k}function VE(e){return e.c==-2&&kne(e,BJe(e.g,e.b)),e.c}function HE(e,t){var n=bCe(``,e);return n.n=t,n.i=1,n}function UE(e,t){for(;t-- >0;)e=e<<1|(e<0?1:0);return e}function cwe(e,t){iT(B(t.b,68),e),hP(t.a,new gf(e))}function lwe(e,t){return bw(),new aWe(new ame(e),new ime(t))}function uwe(e,t,n){return CL(),n.Kg(e,B(t.jd(),149))}function dwe(e){return lF(e,eit),XN(jz(jz(5,e),e/10|0))}function fwe(e){return ND(),e?e.Me():(PD(),PD(),c_t)}function WE(e,t,n){return Dy(t)?LO(e,t,n):xW(e.f,t,n)}function pwe(e){return String.fromCharCode.apply(null,e)}function mwe(e){return!e.d&&(e.d=new rf(e.c.Bc())),e.d}function GE(e){return!e.a&&(e.a=new Vse(e.c.vc())),e.a}function hwe(e){return!e.b&&(e.b=new nh(e.c.ec())),e.b}function gwe(e,t){Mpe.call(this,bFe(gE(e),gE(t))),this.a=t}function _we(e,t,n,r){cg.call(this,e,t),this.d=n,this.a=r}function KE(e,t,n,r){cg.call(this,e,n),this.a=t,this.f=r}function qE(e){this.d=e,this.a=this.d.b,this.b=this.d.c}function vwe(){XJe.call(this,s1,(Fce(),LUt)),h9e(this)}function JE(){vm.call(this,`There is no more element.`)}function YE(e,t){return XO(t,e.length),e.charCodeAt(t)}function ywe(e,t){e.u.Gc((NW(),D5))&&sQe(e,t),tMe(e,t)}function XE(e,t){return L(e)===L(t)||e!=null&&ZR(e,t)}function ZE(e,t){return Zw(e.a,t)?e.b[B(t,23).g]:null}function bwe(e,t){var n=new vE(e);return Sp(t.c,n),n}function QE(e){return e.j.c.length=0,kwe(e.c),wge(e.a),e}function xwe(e){return!e.b&&(e.b=new gC(g7,e,4,7)),e.b}function $E(e){return!e.c&&(e.c=new gC(g7,e,5,8)),e.c}function eD(e){return!e.c&&(e.c=new V(E7,e,9,9)),e.c}function Swe(e){return!e.n&&(e.n=new V(w7,e,1,7)),e.n}function tD(e,t,n,r){return cIe(e,t,n,!1),rz(e,r),e}function nD(e,t){kz(e,F(JP(t,`x`)),F(JP(t,`y`)))}function Cwe(e,t){kz(e,F(JP(t,`x`)),F(JP(t,`y`)))}function wwe(){return qg(),q(I($Lt,1),$Y,557,0,[QLt])}function rD(){return Jg(),q(I(nRt,1),$Y,558,0,[tRt])}function iD(){return Yg(),q(I(aRt,1),$Y,559,0,[iRt])}function Twe(){return Gg(),q(I(OIt,1),$Y,550,0,[DIt])}function Ewe(){return Wg(),q(I(TIt,1),$Y,480,0,[wIt])}function Dwe(){return Kg(),q(I(xLt,1),$Y,531,0,[A6])}function aD(){aD=E,cgt=new u_(q(I(S1,1),GY,45,0,[]))}function oD(e,t){return new wTe(B(gE(e),50),B(gE(t),50))}function Owe(e){return e!=null&&hg(zHt,e.toLowerCase())}function sD(e){return e.e==c1&&Fne(e,BHe(e.g,e.b)),e.e}function cD(e){return e.f==c1&&Lne(e,rKe(e.g,e.b)),e.f}function lD(e){var t=e.b;return!t&&(e.b=t=new Wu(e)),t}function kwe(e){var t;for(t=e.Jc();t.Ob();)t.Pb(),t.Qb()}function uD(e,t,n){var r=B(e.d.Kb(n),163);r&&r.Nb(t)}function Awe(e,t){return _z(e.d.c+e.d.b/2,t.d.c+t.d.b/2)}function jwe(e,t){return _z(e.g.c+e.g.b/2,t.g.c+t.g.b/2)}function Mwe(e,t){return Lg(),_z((NE(e),e),(NE(t),t))}function dD(e,t){return zz(e),new Nw(e,new Kje(t,e.a))}function fD(e,t){return zz(e),new Nw(e,new AM(t,e.a))}function pD(e,t){return zz(e),new Mhe(e,new Wje(t,e.a))}function mD(e,t){return zz(e),new Nhe(e,new Gje(t,e.a))}function Nwe(e,t){this.b=e,this.c=t,this.a=new xg(this.b)}function hD(e,t,n,r){this.a=e,this.e=t,this.d=n,this.c=r}function gD(e,t,n){this.a=sit,this.d=e,this.b=t,this.c=n}function _D(e,t,n,r){this.a=e,this.c=t,this.b=n,this.d=r}function vD(e,t,n,r){this.c=e,this.b=t,this.a=n,this.d=r}function Pwe(e,t,n,r){this.c=e,this.b=t,this.d=n,this.a=r}function Fwe(e,t,n,r){this.a=e,this.d=t,this.c=n,this.b=r}function yD(e,t,n,r){this.c=e,this.d=t,this.b=n,this.a=r}function bD(e,t,n,r){lg.call(this,e,t),this.a=n,this.b=r}function Iwe(e,t,n,r){RL.call(this,e,n,r,!1),this.f=t}function xD(e,t){this.d=(NE(e),e),this.a=16449,this.c=t}function Lwe(e){this.a=new up,this.e=G(q9,LY,54,e,0,2)}function Rwe(e){e.Tg(`No crossing minimization`,1),e.Ug()}function SD(e){var t,n=(t=new pp,t);return OP(n,e),n}function CD(e){var t,n=(t=new pp,t);return qU(n,e),n}function wD(e,t,n){var r=qtt(e);return t.qi(n,r)}function zwe(e){return CFe(e)||null}function Bwe(e){return!e.b&&(e.b=new V(_7,e,12,3)),e.b}function TD(e){if(Xz(e.d),e.d.d!=e.c)throw P(new Ap)}function Vwe(e,t,n,r){this.a=e,this.c=t,this.d=n,this.b=r}function Hwe(e,t,n,r){this.a=e,this.b=t,this.d=n,this.c=r}function Uwe(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function ED(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function DD(e,t,n,r){this.e=e,this.a=t,this.c=n,this.d=r}function Wwe(e,t,n,r){tx(),qje.call(this,t,n,r),this.a=e}function Gwe(e,t,n,r){tx(),qje.call(this,t,n,r),this.a=e}function OD(e,t){this.a=e,khe.call(this,e,B(e.d,16).dd(t))}function Kwe(e){this.f=e,this.c=this.f.e,e.f>0&&WKe(this)}function kD(e){return e.n&&(e.e!==nit&&e.he(),e.j=null),e}function qwe(e){return Dw(e==null||RSe(e)&&e.Rm!==T),e}function Jwe(e,t,n){return hx(e.a,(AWe(t,n),new cg(t,n))),e}function Ywe(e,t,n){t7e(e.a,n),oLe(n),A$e(e.b,n),M7e(t,n)}function Xwe(e,t){return _z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function Zwe(e,t){return _z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function Qwe(e){KC();var t=B(e.g,9);t.n.a=e.d.c+t.d.b}function AD(e){e.a.a=e.c,e.c.b=e.a,e.a.b=e.c.a=null,e.b=0}function $we(e,t){return e.b=t.b,e.c=t.c,e.d=t.d,e.a=t.a,e}function eTe(e){return SS(e.b<e.d.gc()),e.d.Xb(e.c=e.b++)}function tTe(e){return e.length>0?nj(e):new up}function nTe(e,t){return B(Y(e,(aY(),R2)),16).Ec(t),t}function rTe(e,t){return qW(e,B(Y(t,(nY(),K4)),15),t)}function iTe(e){return GW(e)&&Vm(zS(Z(e,(nY(),P4))))}function jD(e){var t;return t=e.f,t||(e.f=new ag(e,e.c))}function aTe(e,t,n){return Hg(),WBe(B(bE(e.e,t),520),n)}function oTe(e,t,n){e.i=0,e.e=0,t!=n&&rRe(e,t,n)}function sTe(e,t,n){e.i=0,e.e=0,t!=n&&iRe(e,t,n)}function cTe(e,t,n,r){this.b=e,this.c=r,Wy.call(this,t,n)}function lTe(e,t){this.g=e,this.d=q(I(O0,1),QZ,9,0,[t])}function uTe(e,t){e.d&&!e.d.a&&(zae(e.d,t),uTe(e.d,t))}function dTe(e,t){e.e&&!e.e.a&&(zae(e.e,t),dTe(e.e,t))}function fTe(e,t){return KR(e.j,t.s,t.c)+KR(t.e,e.s,e.c)}function pTe(e){return B(e.jd(),149).Og()+`:`+Jz(e.kd())}function mTe(e,t){return-_z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function hTe(e,t){return hR(e),hR(t),yse(B(e,23),B(t,23))}function MD(e,t,n){ZN(e,t,new md(h_e(n)))}function gTe(e){Jm(),r.setTimeout(function(){throw e},0)}function _Te(e){this.b=new up,uL(this.b,this.b),this.a=e}function vTe(e){this.b=new Fi,this.a=e,r.Math.random()}function yTe(e,t){new Sg,this.a=new em,this.b=e,this.c=t}function bTe(e,t,n,r){by.call(this,t,n),this.b=e,this.a=r}function xTe(e,t,n,r,i,a){EM.call(this,e,t,n,r,i,a?-2:-1)}function STe(){yYe(this,new Pu),this.wb=(lE(),Q7),Ph()}function CTe(){CTe=E,Y_t=new Ae,Z_t=new rT,X_t=new je}function ND(){ND=E,H1=new ee,U1=new ne,a_t=new k}function PD(){PD=E,o_t=new ie,s_t=new ie,c_t=new ae}function FD(e){return!e.q&&(e.q=new V(K7,e,11,10)),e.q}function ID(e){return!e.s&&(e.s=new V(B7,e,21,17)),e.s}function LD(e){return!e.a&&(e.a=new V(T7,e,10,11)),e.a}function RD(e,t){if(e==null)throw P(new Fm(t));return e}function wTe(e,t){rse.call(this,new pSe(e)),this.a=e,this.b=t}function TTe(e){this.b=e,this.c=e,e.e=null,e.c=null,this.a=1}function ETe(e){return e&&e.hashCode?e.hashCode():dS(e)}function DTe(e){return new Zpe(e,e.e.Pd().gc()*e.c.Pd().gc())}function zD(e){return new Qpe(e,e.e.Pd().gc()*e.c.Pd().gc())}function OTe(e){return R(e,18)?new Mw(B(e,18)):rbe(e.Jc())}function BD(e){return ND(),R(e,59)?new Hse(e):new Jx(e)}function kTe(e){return gE(e),BWe(new hT(Ix(e.a.Jc(),new f)))}function VD(e,t){return t==null?!!Qw(e.f,null):jxe(e.i,t)}function ATe(e,t){var n=Ipe(e.a,t);return n&&(t.d=null),n}function jTe(e,t,n){return e.f?e.f.cf(t,n):!1}function HD(e,t,n,r){yE(e.c[t.g],n.g,r),yE(e.c[n.g],t.g,r)}function UD(e,t,n,r){yE(e.c[t.g],t.g,n),yE(e.b[t.g],t.g,r)}function MTe(e,t,n){return F(z(n.a))<=e&&F(z(n.b))>=t}function NTe(){this.d=new Sg,this.b=new dp,this.c=new up}function PTe(){this.b=new Vp,this.d=new Sg,this.e=new Xp}function FTe(){this.c=new Eh,this.d=new Eh,this.e=new Eh}function WD(){this.a=new em,this.b=(lF(3,QY),new MM(3))}function ITe(e){this.c=e,this.b=new Bh(B(gE(new Me),50))}function LTe(e){this.c=e,this.b=new Bh(B(gE(new xt),50))}function RTe(e){this.b=e,this.a=new Bh(B(gE(new Qe),50))}function GD(e,t){this.e=e,this.a=v1,this.b=u3e(t),this.c=t}function KD(e){this.c=e.c,this.d=e.d,this.b=e.b,this.a=e.a}function zTe(e,t,n,r,i,a){this.a=e,fF.call(this,t,n,r,i,a)}function BTe(e,t,n,r,i,a){this.a=e,fF.call(this,t,n,r,i,a)}function qD(e,t,n,r,i,a,o){return new GAe(e.e,t,n,r,i,a,o)}function VTe(e,t,n){return n>=0&&yC(e.substr(n,t.length),t)}function HTe(e,t){return R(t,149)&&yC(e.b,B(t,149).Og())}function JD(e,t){return e.a?t.Dh().Jc():B(t.Dh(),72).Gi()}function YD(e,t){var n=e.b.Oc(t);return IAe(n,e.b.gc()),n}function XD(e,t){if(e==null)throw P(new Fm(t));return e}function ZD(e){return e.u||=(BA(e),new Qhe(e,e)),e.u}function QD(){QD=E;var e,t=!pHe();e=new b,vgt=t?new y:e}function $D(e){return B(VI(e,16),29)||e.fi()}function eO(e,t){var n=Fh(e.Pm);return t==null?n:n+`: `+t}function tO(e,t,n){return oM(t,n,e.length),e.substr(t,n-t)}function UTe(e,t){dC.call(this),hPe(this),this.a=e,this.c=t}function WTe(){Ide.call(this,`FIXED_INTEGER_RATIO_BOXES`,2)}function GTe(){return kk(),q(I(iwt,1),$Y,425,0,[nwt,rwt])}function KTe(){return sA(),q(I(Lwt,1),$Y,428,0,[Iwt,Fwt])}function qTe(){return jN(),q(I(_At,1),$Y,426,0,[hAt,gAt])}function JTe(){return Yj(),q(I(VSt,1),$Y,427,0,[zSt,BSt])}function YTe(){return bP(),q(I(uCt,1),$Y,424,0,[cCt,lCt])}function XTe(){return oN(),q(I(TCt,1),$Y,479,0,[wCt,CCt])}function ZTe(){return hO(),q(I(Ajt,1),$Y,512,0,[B3,V3])}function QTe(){return oO(),q(I(Ojt,1),$Y,513,0,[z3,R3])}function $Te(){return _j(),q(I(qjt,1),$Y,519,0,[W3,U3])}function eEe(){return oA(),q(I(_jt,1),$Y,522,0,[L3,I3])}function tEe(){return aO(),q(I(eMt,1),$Y,457,0,[G3,K3])}function nEe(){return nk(),q(I(jNt,1),$Y,430,0,[ANt,kNt])}function rEe(){return FF(),q(I(RNt,1),$Y,490,0,[LNt,p6])}function iEe(){return RM(),q(I(YNt,1),$Y,431,0,[qNt,JNt])}function aEe(){return gj(),q(I(MIt,1),$Y,433,0,[jIt,AIt])}function oEe(){return yA(),q(I(iIt,1),$Y,481,0,[nIt,rIt])}function sEe(){return iL(),q(I(TLt,1),$Y,432,0,[wLt,CLt])}function cEe(){return xP(),q(I(lRt,1),$Y,498,0,[cRt,sRt])}function lEe(){return aA(),q(I(kLt,1),$Y,389,0,[OLt,DLt])}function uEe(){return KN(),q(I(tyt,1),$Y,429,0,[$vt,eyt])}function dEe(){return PF(),q(I(Hbt,1),$Y,506,0,[L0,Vbt])}function nO(e,t,n,r){return n>=0?e.Rh(t,n,r):e.zh(null,n,r)}function rO(e){return e.b.b==0?e.a.uf():$ye(e.b)}function fEe(e){if(e.p!=5)throw P(new Dp);return tT(e.f)}function pEe(e){if(e.p!=5)throw P(new Dp);return tT(e.k)}function iO(e){return L(e.a)===L((lI(),aUt))&&l9e(e),e.a}function mEe(e){!e||eO(e,e.ge())}function hEe(e,t){Fd(this,new Pv(e.a,e.b)),Id(this,aw(t))}function aO(){aO=E,G3=new fde(ZX,0),K3=new fde(QX,1)}function oO(){oO=E,z3=new dde(QX,0),R3=new dde(ZX,1)}function gEe(e,t){e.c=t,e.c>0&&e.b>0&&(e.g=Rw(e.c,e.b,e.a))}function _Ee(e,t){e.b=t,e.c>0&&e.b>0&&(e.g=Rw(e.c,e.b,e.a))}function vEe(e){var t=e.c.d.b;e.b=t,e.a=e.c.d,t.a=e.c.d.b=e}function yEe(e){return e.b==0?null:(SS(e.b!=0),mP(e,e.a.a))}function sO(e,t){return t==null?wy(Qw(e.f,null)):m_(e.i,t)}function bEe(e,t,n,r,i){return new eXe(e,(qM(),O_t),t,n,r,i)}function cO(e,t){return zAe(t),UPe(e,G(q9,pX,30,t,15,1),t)}function lO(e,t){return RD(e,`set1`),RD(t,`set2`),new Tle(e,t)}function xEe(e,t){return pgt[e.charCodeAt(0)]??e}function SEe(e,t){var n=t,r=new fe;return NJ(e,n,r),r.d}function CEe(e,t,n,r){var i=new sC;t.a[n.g]=i,HT(e.b,r,i)}function wEe(e,t){return fC(AS(xPe(e.f,t)),e.f.d)}function uO(e){var t;tFe(e.a),Vb(e.a),t=new hf(e.a),oVe(t)}function TEe(e,t){B4e(e,!0),hP(e.e.Pf(),new M_e(e,!0,t))}function EEe(e){this.a=B(gE(e),279),this.b=(ND(),new Yx(e))}function DEe(e,t,n){this.i=new up,this.b=e,this.g=t,this.a=n}function dO(e,t,n){this.c=new up,this.e=e,this.f=t,this.b=n}function OEe(e,t,n){this.a=new up,this.e=e,this.f=t,this.c=n}function fO(e,t,n){cY(),cp.call(this,e),this.b=t,this.a=n}function pO(e,t,n){tx(),np.call(this,t),this.a=e,this.b=n}function kEe(e){dC.call(this),hPe(this),this.a=e,this.c=!0}function mO(){ise.call(this,new bg(zI(12))),Px(!0),this.a=2}function hO(){hO=E,B3=new mv(Aat,0),V3=new mv(`UP`,1)}function gO(e){return e.Db>>16==3?B(e.Cb,19):null}function _O(e){return e.Db>>16==9?B(e.Cb,19):null}function AEe(e){return e.Db>>16==6?B(e.Cb,74):null}function jEe(e){if(e.ye())return null;var t=e.n;return Hht[t]}function MEe(e){function t(){}return t.prototype=e||{},new t}function NEe(e){var t=new zh(zI(e.length));return GLe(t,e),t}function vO(e,t){var n=e.q.getHours();e.q.setDate(t),Wq(e,n)}function PEe(e,t,n){var r=e.Fh(t);r>=0?e.$h(r,n):W1e(e,t,n)}function yO(e,t,n){BO(),e&&WE(bHt,e,t),e&&WE(M7,e,n)}function FEe(e,t){return CP(),B(Y(t,(Lq(),d6)),15).a==e}function IEe(e,t){return JC(),Rx(),B(t.b,15).a<e}function LEe(e,t){return JC(),Rx(),B(t.a,15).a<e}function REe(e,t){return nLe(e,t)?(eFe(e),!0):!1}function bO(e,t){if(t==null)throw P(new Op);return yHe(e,t)}function zEe(e,t){return e.b+=t.b,e.c+=t.c,e.d+=t.d,e.a+=t.a,e}function xO(e,t){var n;for(gE(t),n=e.a;n;n=n.c)t.Wd(n.g,n.i)}function BEe(e,t){var n=e.Fh(t);return n>=0?e.Th(n):gQe(e,t)}function SO(e,t,n){e.b=new QF(qLe(e,t,n).c.length)}function VEe(e){this.a=e,this.b=G(djt,LY,2022,e.e.length,0,2)}function HEe(){this.a=new Cb,this.e=new Vp,this.g=0,this.i=0}function UEe(e,t){nx(this),this.f=t,this.g=e,kD(this),this.he()}function CO(e,t){return r.Math.abs(e)<r.Math.abs(t)?e:t}function wO(e){return Math.max(Math.min(e,vY),-2147483648)|0}function TO(e){return!e.a&&(e.a=new V(T7,e,10,11)),e.a.i>0}function EO(e){var t=e.d;return t=e._i(e.f),gM(e,t),t.Ob()}function DO(e,t){var n=new jw(t);return IU(n,e),new OC(n)}function WEe(e){if(e.p!=0)throw P(new Dp);return Ay(e.f,0)}function GEe(e){if(e.p!=0)throw P(new Dp);return Ay(e.k,0)}function KEe(e){return e.Db>>16==7?B(e.Cb,244):null}function OO(e){return e.Db>>16==6?B(e.Cb,244):null}function kO(e){return e.Db>>16==7?B(e.Cb,176):null}function AO(e){return e.Db>>16==11?B(e.Cb,19):null}function jO(e){return e.Db>>16==17?B(e.Cb,29):null}function qEe(e){return e.Db>>16==3?B(e.Cb,159):null}function MO(e){var t;return zz(e),t=new Vp,fD(e,new df(t))}function JEe(e,t){var n=e.a=e.a||[];return n[t]||(n[t]=e.te(t))}function YEe(e,t){var n=e.q.getHours();e.q.setMonth(t),Wq(e,n)}function NO(e,t){e.c&&dN(e.c.g,e),e.c=t,e.c&&hx(e.c.g,e)}function PO(e,t){e.d&&dN(e.d.e,e),e.d=t,e.d&&hx(e.d.e,e)}function FO(e,t){e.c&&dN(e.c.a,e),e.c=t,e.c&&hx(e.c.a,e)}function IO(e,t){e.i&&dN(e.i.j,e),e.i=t,e.i&&hx(e.i.j,e)}function LO(e,t,n){return t==null?xW(e.f,null,n):Oz(e.i,t,n)}function RO(e,t,n,r,i,a){return new bN(e.e,t,e.Jj(),n,r,i,a)}function XEe(e){return IRe(),Rx(),B(e.a,84).d.e!=0}function ZEe(){ZEe=E,agt=CR((Tm(),q(I(igt,1),$Y,541,0,[rgt])))}function QEe(){QEe=E,HAt=uT(new RE,(zU(),v0),(sY(),U0))}function $Ee(){$Ee=E,UAt=uT(new RE,(zU(),v0),(sY(),U0))}function eDe(){eDe=E,WAt=uT(new RE,(zU(),v0),(sY(),U0))}function tDe(){tDe=E,GAt=uT(new RE,(zU(),v0),(sY(),U0))}function nDe(){nDe=E,qAt=uT(new RE,(zU(),v0),(sY(),U0))}function rDe(){rDe=E,JAt=uT(new RE,(zU(),v0),(sY(),U0))}function iDe(){iDe=E,yjt=ww(new RE,(zU(),v0),(sY(),z0))}function zO(){zO=E,wjt=ww(new RE,(zU(),v0),(sY(),z0))}function aDe(){aDe=E,Djt=ww(new RE,(zU(),v0),(sY(),z0))}function oDe(){oDe=E,Mjt=ww(new RE,(zU(),v0),(sY(),z0))}function sDe(){sDe=E,NNt=uT(new RE,(fV(),J3),(oq(),cMt))}function BO(){BO=E,bHt=new dp,M7=new dp,ife(d_t,new Qs)}function cDe(e,t,n){this.a=t,this.c=e,this.b=(gE(n),new OC(n))}function lDe(e,t,n){this.a=t,this.c=e,this.b=(gE(n),new OC(n))}function uDe(e,t){this.a=e,this.c=ix(this.a),this.b=new KD(t)}function VO(e,t,n,r){this.c=e,this.d=r,UO(this,t),fDe(this,n)}function HO(e){this.c=new Sg,this.b=e.b,this.d=e.c,this.a=e.a}function dDe(e){this.a=r.Math.cos(e),this.b=r.Math.sin(e)}function UO(e,t){e.a&&dN(e.a.k,e),e.a=t,e.a&&hx(e.a.k,e)}function fDe(e,t){e.b&&dN(e.b.f,e),e.b=t,e.b&&hx(e.b.f,e)}function pDe(e,t){EE(e,e.b,e.c),B(e.b.b,68),t&&B(t.b,68).b}function WO(e,t){EBe(e,t),R(e.Cb,89)&&DW(BA(B(e.Cb,89)),2)}function mDe(e,t){R(e.Cb,89)&&DW(BA(B(e.Cb,89)),4),VF(e,t)}function GO(e,t){R(e.Cb,187)&&(B(e.Cb,187).tb=null),VF(e,t)}function hDe(e,t){var n=B(jR(jD(e.a),t),18);return n?n.gc():0}function gDe(e,t){t.c!=null&&OE(e,new _E(t.c))}function _De(e){var t,n=(Ph(),t=new pp,t);return OP(n,e),n}function vDe(e){var t,n=(Ph(),t=new pp,t);return OP(n,e),n}function yDe(e){for(var t;;)if(t=e.Pb(),!e.Ob())return t}function KO(e,t){return l_(),IN(t)?new Sw(t,e):new xy(t,e)}function bDe(e,t){return _z(B(e.c,65).c.e.b,B(t.c,65).c.e.b)}function xDe(e,t){return _z(B(e.c,65).c.e.a,B(t.c,65).c.e.a)}function SDe(e,t,n){return new eXe(e,(qM(),k_t),t,n,null,!1)}function CDe(e,t,n){return new eXe(e,(qM(),D_t),null,!1,t,n)}function qO(e){return rq(),NR(e,0)>=0?bB(e):qT(bB(lN(e)))}function wDe(){return nR(),q(I(q1,1),$Y,132,0,[B_t,K1,V_t])}function TDe(){return vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])}function EDe(){return KM(),q(I(avt,1),$Y,464,0,[e0,$1,t0])}function DDe(){return kN(),q(I(cvt,1),$Y,465,0,[i0,r0,n0])}function ODe(e,t){Upe(e,tT(ok(yT(t,24),zX)),tT(ok(t,zX)))}function JO(e,t){if(e<0||e>t)throw P(new jm(iat+e+aat+t))}function YO(e,t){if(e<0||e>=t)throw P(new jm(iat+e+aat+t))}function XO(e,t){if(e<0||e>=t)throw P(new $m(iat+e+aat+t))}function ZO(e,t){this.b=(NE(e),e),this.a=(t&EX)==0?t|64|RY:t}function QO(e,t,n){qze(t,n,e.gc()),this.c=e,this.a=t,this.b=n-t}function kDe(e,t,n){var r;qze(t,n,e.c.length),r=n-t,Yh(e.c,t,r)}function ADe(e,t,n){var r=new wb(n.d);fC(r,e),kz(t,r.a,r.b)}function jDe(e){var t;return zz(e),t=(PD(),PD(),s_t),sP(e,t)}function $O(e){return Hg(),R(e.g,9)?B(e.g,9):null}function ek(e){return PL(q(I(e8,1),LY,8,0,[e.i.n,e.n,e.a]))}function MDe(){return ON(),q(I(Zyt,1),$Y,385,0,[Yyt,Jyt,Xyt])}function NDe(){return xL(),q(I(QCt,1),$Y,330,0,[x2,ZCt,b2])}function PDe(){return AN(),q(I(ewt,1),$Y,316,0,[C2,w2,S2])}function FDe(){return tL(),q(I(YCt,1),$Y,303,0,[qCt,JCt,y2])}function IDe(){return nF(),q(I(XSt,1),$Y,351,0,[qSt,YSt,JSt])}function LDe(){return SL(),q(I(pCt,1),$Y,452,0,[fCt,l2,u2])}function RDe(){return rF(),q(I(yAt,1),$Y,455,0,[k3,D3,O3])}function zDe(){return eL(),q(I(wAt,1),$Y,382,0,[xAt,SAt,CAt])}function BDe(){return tR(),q(I(OAt,1),$Y,349,0,[DAt,EAt,A3])}function VDe(){return xR(),q(I(MAt,1),$Y,350,0,[AAt,jAt,j3])}function HDe(){return bR(),q(I(Kkt,1),$Y,353,0,[Ukt,Wkt,Gkt])}function UDe(){return tF(),q(I(LAt,1),$Y,352,0,[IAt,PAt,FAt])}function WDe(){return rL(),q(I(BAt,1),$Y,383,0,[zAt,N3,M3])}function GDe(){return BL(),q(I(SMt,1),$Y,386,0,[xMt,bMt,X3])}function KDe(){return eR(),q(I(ePt,1),$Y,387,0,[ZNt,QNt,$Nt])}function qDe(){return tB(),q(I(pFt,1),$Y,388,0,[dFt,fFt,uFt])}function JDe(){return IF(),q(I(ESt,1),$Y,369,0,[Z0,X0,Y0])}function YDe(){return BR(),q(I(mIt,1),$Y,435,0,[dIt,pIt,fIt])}function XDe(){return sN(),q(I(lIt,1),$Y,434,0,[oIt,cIt,sIt])}function ZDe(){return lz(),q(I(SIt,1),$Y,440,0,[yIt,bIt,xIt])}function QDe(){return CB(),q(I(XPt,1),$Y,441,0,[h6,JPt,YPt])}function $De(){return OI(),q(I(KPt,1),$Y,304,0,[WPt,GPt,UPt])}function eOe(){return MP(),q(I(fVt,1),$Y,301,0,[$5,uVt,dVt])}function tOe(){return yP(),q(I(TBt,1),$Y,281,0,[K8,q8,J8])}function nOe(){return zR(),q(I(wVt,1),$Y,283,0,[SVt,l7,CVt])}function rOe(){return rR(),q(I(GBt,1),$Y,348,0,[WBt,$8,e5])}function tk(e){cY(),cp.call(this,e),this.c=!1,this.a=!1}function iOe(e,t,n){cp.call(this,25),this.b=e,this.a=t,this.c=n}function aOe(e,t){nse.call(this,new bg(zI(e))),lF(t,Krt),this.a=t}function oOe(e,t){var n=(NE(e),e).g;return xS(!!n),NE(t),n(t)}function sOe(e,t){var n,r=zT(e,t);return n=e.a.dd(r),new Sle(e,n)}function cOe(e,t,n){var r=nJ(e,t,!1);return r.b<=t&&r.a<=n}function lOe(e,t,n){var r=new oa;r.b=t,r.a=n,++t.b,hx(e.d,r)}function nk(){nk=E,ANt=new yde(`DFS`,0),kNt=new yde(`BFS`,1)}function uOe(e){if(e.p!=2)throw P(new Dp);return tT(e.f)&uX}function dOe(e){if(e.p!=2)throw P(new Dp);return tT(e.k)&uX}function fOe(e){return e.Db>>16==6?B(fG(e),244):null}function W(e){return SS(e.a<e.c.c.length),e.b=e.a++,e.c.c[e.b]}function pOe(e){return e.a==(mj(),EUt)&&jne(e,M4e(e.g,e.b)),e.a}function rk(e){return e.d==(mj(),EUt)&&Nne(e,Q8e(e.g,e.b)),e.d}function mOe(e){kw(),this.a=(ND(),R(e,59)?new Hse(e):new Jx(e))}function ik(e){return gE(e),R(e,18)?new OC(B(e,18)):ow(e.Jc())}function ak(e,t){return Axe(e.a,t)?nxe(e.b,B(t,23).g,null):null}function ok(e,t){return RI(cSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function sk(e,t){return RI(lSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function ck(e,t){return RI(uSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function lk(e){return jz(vT(BI(YG(e,32)),32),BI(YG(e,32)))}function hOe(e){var t=B(_w(e.b),10);return new AC(e.a,t,e.c)}function gOe(e,t){snt(e,t,F(z(e.a.mf((oY(),rBt)))))}function _Oe(e,t){return GN(),e.c==t.c?_z(t.d,e.d):_z(e.c,t.c)}function vOe(e,t){return GN(),e.c==t.c?_z(e.d,t.d):_z(e.c,t.c)}function yOe(e,t){return GN(),e.c==t.c?_z(e.d,t.d):_z(t.c,e.c)}function bOe(e,t){return GN(),e.c==t.c?_z(t.d,e.d):_z(t.c,e.c)}function uk(e,t){e.b|=t.b,e.c|=t.c,e.d|=t.d,e.a|=t.a}function xOe(e,t,n){var r=e.d[t.p];e.d[t.p]=e.d[n.p],e.d[n.p]=r}function SOe(e,t){var n=_N(t);return B(bE(e.c,n),15).a}function COe(e,t){var n=lGe(e),r=lGe(t);return n<r?-1:n>r?1:0}function wOe(e,t){var n=B(bE(e.g,t),60);hP(t.d,new Fue(e,n))}function dk(e,t){for(var n=e+``;n.length<t;)n=`0`+n;return n}function fk(e){return e.c==null||e.c.length==0?`n_`+e.g:`n_`+e.c}function pk(e){return e.b==null||e.b.length==0?`n_`+e.a:`n_`+e.b}function mk(e){return B(JB(e,G(O0,QZ,9,e.c.length,0,1)),201)}function hk(e,t){return e&&e.equals?e.equals(t):L(e)===L(t)}function TOe(e,t){return t==0?!!e.o&&e.o.f!=0:rV(e,t)}function EOe(e){return!!e.u&&$k(e.u.a).i!=0&&!(e.n&&yWe(e.n))}function DOe(e,t,n){var r;e.n&&t&&n&&(r=new zs,hx(e.e,r))}function gk(e,t){if(BT(e.a,t),t.d)throw P(new vm(cat));t.d=e}function _k(e,t){this.a=new up,this.d=new up,this.f=e,this.c=t}function OOe(){this.c=new ppe,this.a=new Yje,this.b=new xoe,Zle()}function kOe(){CL(),this.b=new dp,this.a=new dp,this.c=new up}function AOe(e,t,n){this.d=e,this.j=t,this.e=n,this.o=-1,this.p=3}function jOe(e,t,n){this.d=e,this.k=t,this.f=n,this.o=-1,this.p=5}function MOe(e,t,n,r,i,a){PPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function NOe(e,t,n,r,i,a){FPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function POe(e,t,n,r,i,a){qA.call(this,e,t,n,r,i),a&&(this.o=-2)}function FOe(e,t,n,r,i,a){RPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function IOe(e,t,n,r,i,a){Nje.call(this,e,t,n,r,i),a&&(this.o=-2)}function LOe(e,t,n,r,i,a){IPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function ROe(e,t,n,r,i,a){LPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function zOe(e,t,n,r,i,a){Pje.call(this,e,t,n,r,i),a&&(this.o=-2)}function BOe(e,t,n,r){np.call(this,n),this.b=e,this.c=t,this.d=r}function VOe(e,t){this.f=e,this.a=(mj(),TUt),this.c=TUt,this.b=t}function HOe(e,t){this.g=e,this.d=(mj(),EUt),this.a=EUt,this.b=t}function UOe(e,t){!e.c&&(e.c=new MI(e,0)),hJ(e.c,(OJ(),D9),t)}function WOe(e,t){return f1e(e,t,R(t,104)&&(B(t,20).Bb&OX)!=0)}function GOe(e,t){return nCe(BI(e.q.getTime()),BI(t.q.getTime()))}function KOe(e){return Cw(e.e.Pd().gc()*e.c.Pd().gc(),16,new qu(e))}function qOe(e){return!!e.a&&EN(e.a.a).i!=0&&!(e.b&&bWe(e.b))}function vk(e){for(;e.d>0&&e.a[--e.d]==0;);e.a[e.d++]==0&&(e.e=0)}function JOe(e){return e.a?e.e.length==0?e.a.a:e.a.a+(``+e.e):e.c}function YOe(e){return SS(e.b.b!=e.d.a),e.c=e.b=e.b.b,--e.a,e.c.c}function XOe(e,t){var n=1-t;return e.a[n]=kF(e.a[n],n),kF(e,t)}function ZOe(e,t){var n,r=ok(e,jX);return n=vT(t,32),sk(n,r)}function QOe(e,t,n){var r=B(e.Zb().xc(t),18);return!!r&&r.Gc(n)}function $Oe(e,t,n){var r=B(e.Zb().xc(t),18);return!!r&&r.Kc(n)}function eke(e,t,n){MGe(new cDe((gE(e),new OC(e)),t,n))}function yk(e,t,n){NGe(new lDe((gE(e),new OC(e)),t,n))}function tke(){tke=E,tjt=lwe(UR(1),UR(4)),ejt=lwe(UR(1),UR(2))}function nke(e){ZF.call(this,e,(qM(),E_t),null,!1,null,!1)}function rke(e,t){NT.call(this,1,2,q(I(q9,1),pX,30,15,[e,t]))}function bk(e,t){this.a=e,tf.call(this,e),JO(t,e.gc()),this.b=t}function ike(e,t){var n;e.e=new cm,n=IK(t),Qb(n,e.c),u4e(e,n,0)}function ake(e,t,n){e.a=t,e.c=n,e.b.a.$b(),AD(e.d),Lp(e.e.a.c,0)}function xk(e,t,n,r){var i=new os;i.a=t,i.b=n,i.c=r,gw(e.a,i)}function Sk(e,t,n,r){var i=new os;i.a=t,i.b=n,i.c=r,gw(e.b,i)}function oke(e,t,n,r){return e.a+=``+tO(t==null?wY:Jz(t),n,r),e}function Ck(e,t,n,r,i,a){return cIe(e,t,n,a),Jze(e,r),Yze(e,i),e}function ske(){var e,t=(n=(e=new pp,e),n),n;return hx(yUt,t),t}function wk(e,t){if(e<0||e>=t)throw P(new jm(TZe(e,t)));return e}function cke(e,t,n){if(e<0||t<e||t>n)throw P(new jm(_Xe(e,t,n)))}function lke(e){if(!(`stack`in e))try{throw e}catch{}return e}function uke(e){return lD(e).dc()?!1:(Zb(e,new g),!0)}function Tk(e){var t;return cb(e)?(t=e,t==-0?0:t):bNe(e)}function dke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function fke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function pke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function mke(e,t){return SP(),B(Y(t,(Lq(),u6)),15).a>=e.gc()}function hke(e){return zO(),!NA(e)&&!(!NA(e)&&e.c.i.c==e.d.i.c)}function Ek(e){return B(JB(e,G(D0,ZZ,17,e.c.length,0,1)),324)}function Dk(e){return new MM((lF(e,eit),XN(jz(jz(5,e),e/10|0))))}function gke(e,t){return new Oye(t,ihe(ix(t.e),e,e),(Rx(),!0))}function _ke(e){return Cw(e.e.Pd().gc()*e.c.Pd().gc(),273,new Ku(e))}function vke(e){return B(JB(e,G(Rbt,oot,12,e.c.length,0,1)),2021)}function yke(e){this.a=G(v1,CY,1,BLe(r.Math.max(8,e))<<1,5,1)}function bke(e){var t;return IE(e),t=new oe,Jh(e.a,new are(t)),t}function Ok(e){var t;return IE(e),t=new se,Jh(e.a,new ore(t)),t}function xke(e,t){return e.a<=e.b?(t.Bd(e.a++),!0):!1}function Ske(e,t,n){e.d&&dN(e.d.e,e),e.d=t,e.d&&qw(e.d.e,n,e)}function Cke(e,t,n){this.d=new sie(this),this.e=e,this.i=t,this.f=n}function kk(){kk=E,nwt=new Kue(XX,0),rwt=new Kue(`TOP_LEFT`,1)}function wke(){wke=E,EIt=CR((Wg(),q(I(TIt,1),$Y,480,0,[wIt])))}function Tke(){Tke=E,kIt=CR((Gg(),q(I(OIt,1),$Y,550,0,[DIt])))}function Eke(){Eke=E,SLt=CR((Kg(),q(I(xLt,1),$Y,531,0,[A6])))}function Dke(){Dke=E,eRt=CR((qg(),q(I($Lt,1),$Y,557,0,[QLt])))}function Oke(){Oke=E,rRt=CR((Jg(),q(I(nRt,1),$Y,558,0,[tRt])))}function kke(){kke=E,oRt=CR((Yg(),q(I(aRt,1),$Y,559,0,[iRt])))}function Ake(e){aVe((!e.a&&(e.a=new V(T7,e,10,11)),e.a),new Mo)}function Ak(e,t){Ant(t,e),fbe(e.d),fbe(B(Y(e,(nY(),zOt)),216))}function jke(e,t){jnt(t,e),dbe(e.d),dbe(B(Y(e,(nY(),zOt)),216))}function jk(e,t){var n=bO(e,t),r=null;return n&&(r=n.ne()),r}function Mk(e,t){var n=bO(e,t),r=null;return n&&(r=n.qe()),r}function Nk(e,t){var n=HN(e,t),r=null;return n&&(r=n.qe()),r}function Pk(e,t){var n=bO(e,t),r=null;return n&&(r=wXe(n)),r}function Mke(e,t,n){var r=NB(n);return iq(e.n,r,t),iq(e.o,t,n),t}function Nke(e,t,n){var r=YHe();try{return age(e,t,n)}finally{AA(r)}}function Pke(e,t,n,r){return R(n,59)?new Ime(e,t,n,r):new iSe(e,t,n,r)}function Fke(e,t,n,r){this.d=e,this.n=t,this.g=n,this.o=r,this.p=-1}function Ike(e,t,n,r){this.e=null,this.c=e,this.d=t,this.a=n,this.b=r}function Lke(e){var t=e.Dh();this.a=R(t,72)?B(t,72).Gi():t.Jc()}function Rke(e){return new ZO(yPe(B(e.a.kd(),18).gc(),e.a.jd()),16)}function Fk(e){return R(e,18)?B(e,18).dc():!e.Jc().Ob()}function Ik(e){if(e.e.g!=e.b)throw P(new Ap);return!!e.c&&e.d>0}function Lk(e){return SS(e.b!=e.d.c),e.c=e.b,e.b=e.b.a,++e.a,e.c.c}function zke(e,t){NE(t),yE(e.a,e.c,t),e.c=e.c+1&e.a.length-1,xGe(e)}function Rk(e,t){NE(t),e.b=e.b-1&e.a.length-1,yE(e.a,e.b,t),xGe(e)}function Bke(e,t){var n=B(RN(e.b,t),66);return!n&&(n=new Sg),n}function Vke(e,t){var n=t.a;NO(n,t.c.d),PO(n,t.d.d),wI(n.a,e.n)}function Hke(e,t){return B(Ux(xT(B($A(e.k,t),16).Mc(),Q0)),114)}function Uke(e,t){return B(Ux(ST(B($A(e.k,t),16).Mc(),Q0)),114)}function Wke(){return bL(),q(I(fbt,1),$Y,413,0,[b0,C0,x0,S0])}function Gke(){return $I(),q(I(Rvt,1),$Y,414,0,[o0,a0,Ivt,Lvt])}function Kke(){return qM(),q(I(A_t,1),$Y,310,0,[E_t,D_t,O_t,k_t])}function qke(){return HB(),q(I(Cbt,1),$Y,384,0,[T0,xbt,bbt,Sbt])}function Jke(){return yL(),q(I($xt,1),$Y,368,0,[Qxt,Xxt,Zxt,W0])}function Yke(){return nL(),q(I(mSt,1),$Y,418,0,[G0,K0,q0,pSt])}function Xke(){return yR(),q(I(ljt,1),$Y,409,0,[P3,F3,cjt,sjt])}function Zke(){return yV(),q(I(Ykt,1),$Y,205,0,[y3,Jkt,v3,_3])}function Qke(){return MB(),q(I(pAt,1),$Y,270,0,[E3,uAt,dAt,fAt])}function $ke(){return eB(),q(I(GSt,1),$Y,302,0,[s2,USt,o2,WSt])}function eAe(){return $L(),q(I(DNt,1),$Y,354,0,[ENt,wNt,TNt,CNt])}function tAe(){return RV(),q(I(VPt,1),$Y,355,0,[BPt,RPt,zPt,LPt])}function nAe(){return MU(),q(I(nFt,1),$Y,406,0,[tFt,QPt,eFt,$Pt])}function rAe(){return fV(),q(I(rMt,1),$Y,402,0,[nMt,q3,J3,Y3])}function iAe(){return AH(),q(I(LLt,1),$Y,396,0,[NLt,PLt,FLt,ILt])}function aAe(){return RR(),q(I(CBt,1),$Y,280,0,[G8,bBt,xBt,SBt])}function oAe(){return rB(),q(I(OBt,1),$Y,225,0,[DBt,X8,Y8,Z8])}function sAe(){return pH(),q(I(JBt,1),$Y,293,0,[i5,t5,n5,r5])}function cAe(){return jB(),q(I(i7,1),$Y,381,0,[n7,r7,t7,e7])}function lAe(){return cA(),q(I(u7,1),$Y,290,0,[EVt,kVt,DVt,OVt])}function uAe(){return nB(),q(I(FVt,1),$Y,327,0,[PVt,jVt,NVt,MVt])}function dAe(){return QL(),q(I(HVt,1),$Y,412,0,[zVt,BVt,RVt,VVt])}function fAe(e){var t;return e.j==(GJ(),Y5)&&(t=lG(e),Vx(t,j5))}function pAe(e,t){var n;for(n=e.j.c.length;n<t;n++)hx(e.j,e.Mg())}function mAe(e,t,n,r){var i=r[t.g][n.g];return F(z(Y(e.a,i)))}function hAe(e,t,n){var r=NB(n);return iq(e.f,r,t),WE(e.g,t,n),t}function gAe(e,t,n){var r=NB(n);return iq(e.p,r,t),WE(e.q,t,n),t}function _Ae(e){var t=(Mh(),n=new Ws,n),n;return e&&rK(t,e),t}function vAe(e){var t=e.$i(e.i);return e.i>0&&Fq(e.g,0,t,0,e.i),t}function zk(e){return Hg(),R(e.g,157)?B(e.g,157):null}function yAe(e){return BO(),IT(bHt,e)?B(bE(bHt,e),343).Pg():null}function Bk(e,t,n){return t<0?gQe(e,n):B(n,69).uk().zk(e,e.ei(),t)}function bAe(e,t){return Sx(new Pv(t.e.a+t.f.a/2,t.e.b+t.f.b/2),e)}function xAe(e,t){return L(t)===L(e)?`(this Map)`:t==null?wY:Jz(t)}function SAe(e,t){a_();var n=B(bE(EHt,e),58);return!n||n.dk(t)}function Vk(e){if(e.p!=1)throw P(new Dp);return tT(e.f)<<24>>24}function CAe(e){if(e.p!=1)throw P(new Dp);return tT(e.k)<<24>>24}function wAe(e){if(e.p!=7)throw P(new Dp);return tT(e.k)<<16>>16}function TAe(e){if(e.p!=7)throw P(new Dp);return tT(e.f)<<16>>16}function Hk(e,t){return t.e==0||e.e==0?R1:(BK(),gK(e,t))}function EAe(e,t,n){if(n){var r=n.me();e.a[t]=r(n)}else delete e.a[t]}function DAe(e,t){var n=new Qm;return e.Ed(n),n.a+=`..`,t.Fd(n),n.a}function Uk(e){for(var t=0;e.Ob();)e.Pb(),t=jz(t,1);return XN(t)}function OAe(e,t,n){var r=B(bE(e.g,n),60);hx(e.a.c,new ny(t,r))}function kAe(e,t,n,r,i){hx(t,wW(i,O1e(i,n,r))),dYe(e,i,t)}function Wk(e,t,n){e.i=0,e.e=0,t!=n&&(iRe(e,t,n),rRe(e,t,n))}function AAe(e){e.a=null,e.e=null,Lp(e.b.c,0),Lp(e.f.c,0),e.c=null}function jAe(e,t){return B(t==null?wy(Qw(e.f,null)):m_(e.i,t),291)}function MAe(e,t,n){return oSe(z(wy(Qw(e.f,t))),z(wy(Qw(e.f,n))))}function Gk(e,t,n){return Bq(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function Kk(e,t,n){return Kq(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function qk(e,t,n){return b1e(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function NAe(e,t){return e==(UG(),P0)&&t==P0?4:e==P0||t==P0?8:32}function PAe(e,t){FTe.call(this),this.a=e,this.b=t,hx(this.a.b,this)}function Jk(e,t){cY(),cp.call(this,e),this.a=t,this.c=-1,this.b=-1}function Yk(e,t,n,r,i){this.i=e,this.a=t,this.e=n,this.j=r,this.f=i}function Xk(e,t){rq(),NT.call(this,e,1,q(I(q9,1),pX,30,15,[t]))}function Zk(e,t){l_();var n=B(e,69).tk();return RYe(n,t),n.vl(t)}function FAe(e,t){for(var n=t;n;)MS(e,n.i,n.j),n=AO(n);return e}function IAe(e,t){var n;for(n=0;n<t;++n)yE(e,n,new qne(B(e[n],45)))}function LAe(e,t){var n=e.q.getHours();e.q.setFullYear(t+fX),Wq(e,n)}function RAe(e,t){zL();var n=e.j.g-t.j.g;return n==0?0:n}function Qk(e){return SS(e.a<e.c.a.length),e.b=e.a,jNe(e),e.c.b[e.b]}function $k(e){return e.n||(BA(e),e.n=new Wxe(e,G7,e),ZD(e)),e.n}function zAe(e){if(e<0)throw P(new Ese(`Negative array size: `+e))}function BAe(e,t,n){n=n?n.me()(n):void 0,e.a[t]=n}function VAe(e,t){var n;return n=t==null?wy(Qw(e.f,t)):sO(e,t),zy(n)}function HAe(e,t){var n;return n=t==null?wy(Qw(e.f,t)):sO(e,t),zy(n)}function UAe(e){return e.c&&e.d?pk(e.c)+`->`+pk(e.d):`e_`+dS(e)}function eA(e){R(e,209)&&!Vm(zS(e.mf((oY(),Ozt))))&&G8e(B(e,19))}function WAe(e){e.b!=e.c&&(e.a=G(v1,CY,1,8,5,1),e.b=0,e.c=0)}function tA(e,t,n){this.e=e,this.a=v1,this.b=u3e(t),this.c=t,this.d=n}function nA(e,t,n,r){AOe.call(this,1,n,r),this.c=e,this.b=t}function rA(e,t,n,r){jOe.call(this,1,n,r),this.c=e,this.b=t}function GAe(e,t,n,r,i,a,o){fF.call(this,t,r,i,a,o),this.c=e,this.a=n}function KAe(e){this.e=e,this.c=this.e.a,this.b=this.e.g,this.d=this.e.i}function iA(e){this.c=e,this.a=B(EH(e),160),this.b=this.a.hk().ti()}function qAe(e,t){return Cg(),gM(ID(e.a),t)}function JAe(e,t){return Cg(),gM(ID(e.a),t)}function aA(){aA=E,OLt=new Mde(`STRAIGHT`,0),DLt=new Mde(`BEND`,1)}function oA(){oA=E,L3=new gv(`UPPER`,0),I3=new gv(`LOWER`,1)}function sA(){sA=E,Iwt=new iv(KZ,0),Fwt=new iv(`ALTERNATING`,1)}function cA(){cA=E,EVt=new $be,kVt=new OSe,DVt=new WTe,OVt=new kSe}function lA(e){var t;return e?new jw(e):(t=new Cb,WF(t,e),t)}function YAe(e,t){var n;for(n=e.d-1;n>=0&&e.a[n]===t[n];n--);return n<0}function XAe(e,t){var n;return zAe(t),n=e.slice(0,t),n.length=t,gN(n,e)}function uA(e,t){var n;return t.b.Kb(hN(e,t.c.Ve(),(n=new cre(t),n)))}function dA(e){pJe(),Upe(this,tT(ok(yT(e,24),zX)),tT(ok(e,zX)))}function ZAe(){ZAe=E,nyt=CR((KN(),q(I(tyt,1),$Y,429,0,[$vt,eyt])))}function fA(){fA=E,Ubt=CR((PF(),q(I(Hbt,1),$Y,506,0,[L0,Vbt])))}function pA(){pA=E,dCt=CR((bP(),q(I(uCt,1),$Y,424,0,[cCt,lCt])))}function mA(){mA=E,HSt=CR((Yj(),q(I(VSt,1),$Y,427,0,[zSt,BSt])))}function hA(){hA=E,ECt=CR((oN(),q(I(TCt,1),$Y,479,0,[wCt,CCt])))}function QAe(){QAe=E,awt=CR((kk(),q(I(iwt,1),$Y,425,0,[nwt,rwt])))}function gA(){gA=E,Rwt=CR((sA(),q(I(Lwt,1),$Y,428,0,[Iwt,Fwt])))}function _A(){_A=E,vAt=CR((jN(),q(I(_At,1),$Y,426,0,[hAt,gAt])))}function $Ae(){$Ae=E,vjt=CR((oA(),q(I(_jt,1),$Y,522,0,[L3,I3])))}function eje(){eje=E,kjt=CR((oO(),q(I(Ojt,1),$Y,513,0,[z3,R3])))}function tje(){tje=E,jjt=CR((hO(),q(I(Ajt,1),$Y,512,0,[B3,V3])))}function nje(){nje=E,Jjt=CR((_j(),q(I(qjt,1),$Y,519,0,[W3,U3])))}function vA(){vA=E,tMt=CR((aO(),q(I(eMt,1),$Y,457,0,[G3,K3])))}function rje(){rje=E,MNt=CR((nk(),q(I(jNt,1),$Y,430,0,[ANt,kNt])))}function ije(){ije=E,zNt=CR((FF(),q(I(RNt,1),$Y,490,0,[LNt,p6])))}function aje(){aje=E,XNt=CR((RM(),q(I(YNt,1),$Y,431,0,[qNt,JNt])))}function yA(){yA=E,nIt=new Dde(Dot,0),rIt=new Dde(`TARGET_WIDTH`,1)}function oje(){oje=E,aIt=CR((yA(),q(I(iIt,1),$Y,481,0,[nIt,rIt])))}function sje(){sje=E,NIt=CR((gj(),q(I(MIt,1),$Y,433,0,[jIt,AIt])))}function cje(){cje=E,ELt=CR((iL(),q(I(TLt,1),$Y,432,0,[wLt,CLt])))}function lje(){lje=E,ALt=CR((aA(),q(I(kLt,1),$Y,389,0,[OLt,DLt])))}function uje(){uje=E,uRt=CR((xP(),q(I(lRt,1),$Y,498,0,[cRt,sRt])))}function dje(){return cz(),q(I(W8,1),$Y,87,0,[H8,V8,B8,z8,U8])}function fje(){return GJ(),q(I(Q5,1),qZ,64,0,[X5,M5,j5,Y5,Z5])}function pje(e){return(e.k==(UG(),P0)||e.k==A0)&&TS(e,(aY(),k2))}function mje(e,t,n){return B(t==null?xW(e.f,null,n):Oz(e.i,t,n),291)}function hje(e,t,n){e.a.c.length=0,m9e(e,t,n),e.a.c.length==0||M6e(e,t)}function bA(e,t,n,r){var i=new ce;i.c=t,i.b=n,i.a=r,r.b=n.a=i,++e.b}function xA(e,t){for(var n=t,r=0;n>0;)r+=e.a[n],n-=n&-n;return r}function SA(e,t){for(var n=t;n;)MS(e,-n.i,-n.j),n=AO(n);return e}function gje(e,t){var n,r=!1;do n=ALe(e,t),r|=n;while(n);return r}function CA(e,t){var n,r;for(NE(t),r=e.Jc();r.Ob();)n=r.Pb(),t.Ad(n)}function _je(e,t){var n=t.jd(),r=e.De(n);return!!r&&XE(r.e,t.kd())}function wA(e,t){var n=t.jd();return new cg(n,e.e.pc(n,B(t.kd(),18)))}function vje(e,t){return e.a.get(t)??G(v1,CY,1,0,5,1)}function TA(e,t,n){var r=(YO(t,e.c.length),e.c[t]);return e.c[t]=n,r}function yje(e,t){this.c=0,this.b=t,Uy.call(this,e,17493),this.a=this.c}function EA(e){this.d=e,this.b=this.d.a.entries(),this.a=this.b.next()}function DA(){dp.call(this),bS(this),this.d.b=this.d,this.d.a=this.d}function bje(e){MA(),!G1&&(this.c=e,this.e=!0,this.a=new up)}function xje(e){mrt(),qae(this),this.a=new Sg,bRe(this,e),gw(this.a,e)}function OA(){zb(this),this.b=new Pv(wX,wX),this.a=new Pv(TX,TX)}function kA(e){pue.call(this,e==null?wY:Jz(e),R(e,81)?B(e,81):null)}function AA(e){e&&LNe((Sse(),_gt)),--mgt,e&&ggt!=-1&&(lfe(ggt),ggt=-1)}function jA(e){e.i=0,b_(e.b,null),b_(e.c,null),e.a=null,e.e=null,++e.g}function MA(){MA=E,G1=!0,I_t=!1,L_t=!1,z_t=!1,R_t=!1}function NA(e){return!e.c||!e.d?!1:!!e.c.i&&e.c.i==e.d.i}function PA(e,t){return R(t,144)?yC(e.c,B(t,144).c):!1}function FA(e,t){return B(RN(e.d,t),21)||B(RN(e.e,t),21)}function IA(e,t){return(zz(e),qh(new Nw(e,new AM(t,e.a)))).zd(J1)}function Sje(){return zU(),q(I(nbt,1),$Y,364,0,[m0,h0,g0,_0,v0])}function Cje(){return vU(),q(I(GNt,1),$Y,365,0,[UNt,BNt,WNt,VNt,HNt])}function wje(){return lU(),q(I(bSt,1),$Y,372,0,[J0,vSt,ySt,_St,gSt])}function LA(){return aK(),q(I(_It,1),$Y,370,0,[E6,T6,O6,D6,k6])}function Tje(){return eW(),q(I(zIt,1),$Y,331,0,[PIt,FIt,RIt,IIt,LIt])}function RA(){return dV(),q(I(eAt,1),$Y,329,0,[$kt,Zkt,Qkt,b3,x3])}function Eje(){return $z(),q(I(Nwt,1),$Y,166,0,[p4,l4,u4,d4,f4])}function Dje(){return eV(),q(I(G6,1),$Y,161,0,[U6,H6,B6,W6,V6])}function zA(){return nV(),q(I(v5,1),$Y,260,0,[g5,_5,ZBt,h5,QBt])}function Oje(e){return Jm(),function(){return Nke(e,this,arguments)}}function BA(e){return e.t||(e.t=new ep(e),sz(new Dm(e),0,e.t)),e.t}function kje(e){var t;return e.c||(t=e.r,R(t,89)&&(e.c=B(t,29))),e.c}function Aje(e){return e.e=3,e.d=e.Yb(),e.e==2?!1:(e.e=0,!0)}function jje(e){return Xb(e&hX,e>>22&hX,e<0?gX:0)}function VA(e){var t=e.length;return yC(DX.substr(DX.length-t,t),e)}function HA(e){if(hG(e))return e.c=e.a,e.a.Pb();throw P(new jp)}function UA(e,t){return t==0||e.e==0?e:t>0?nHe(e,t):jK(e,-t)}function WA(e,t){return t==0||e.e==0?e:t>0?jK(e,t):nHe(e,-t)}function GA(e){this.b=e,jx.call(this,e),this.a=B(VI(this.b.a,4),131)}function Mje(e){this.b=e,rS.call(this,e),this.a=B(VI(this.b.a,4),131)}function KA(e,t,n,r,i){cj.call(this,t,r,i),this.c=e,this.b=n}function qA(e,t,n,r,i){AOe.call(this,t,r,i),this.c=e,this.a=n}function Nje(e,t,n,r,i){jOe.call(this,t,r,i),this.c=e,this.a=n}function Pje(e,t,n,r,i){cj.call(this,t,r,i),this.c=e,this.a=n}function JA(e,t,n){return _z(Sx($B(e),ix(t.b)),Sx($B(e),ix(n.b)))}function Fje(e,t,n){return _z(Sx($B(e),ix(t.e)),Sx($B(e),ix(n.e)))}function Ije(e,t){return r.Math.min(yM(t.a,e.d.d.c),yM(t.b,e.d.d.c))}function YA(e,t,n){var r;return r=e.Fh(t),r>=0?e.Ih(r,n,!0):XW(e,t,n)}function Lje(e,t){var n=B(MR(e.c,t),18),r;n&&(r=n.gc(),n.$b(),e.d-=r)}function Rje(e){var t=e.c.i,n=e.d.i;return t.k==(UG(),A0)&&n.k==A0}function XA(e){var t,n;++e.j,t=e.g,n=e.i,e.g=null,e.i=0,e.Mi(n,t),e.Li()}function ZA(e,t){e.Zi(e.i+1),wx(e,e.i,e.Xi(e.i,t)),e.Ki(e.i++,t),e.Li()}function zje(e,t,n){var r=new Ape(e.a);gI(r,e.a.a),xW(r.f,t,n),e.a.a=r}function QA(e,t,n,r){var i;for(i=0;i<ivt;i++)cT(e.a[i][t.g],n,r[t.g])}function Bje(e,t,n,r){var i;for(i=0;i<rvt;i++)lT(e.a[t.g][i],n,r[t.g])}function $A(e,t){var n=B(e.c.xc(t),18);return!n&&(n=e.ic(t)),e.pc(t,n)}function ej(e){var t=(gE(e),e?new OC(e):ow(e.Jc()));return yW(t),Pz(t)}function tj(e){var t=new WD;return JI(t,e),J(t,(nY(),F4),null),t}function nj(e){var t,n;return gE(e),t=dwe(e.length),n=new MM(t),GLe(n,e),n}function rj(e,t,n,r){var i=G(q9,pX,30,t,15,1);return dJe(i,e,t,n,r),i}function ij(e,t){var n=(YO(t,e.c.length),e.c[t]);return Yh(e.c,t,1),n}function Vje(e,t){var n=(NE(e),e),r=(NE(t),t);return n==r?0:n<r?-1:1}function Hje(e){var t=e.e+e.f;return isNaN(t)&&DC(e.d)?e.d:t}function aj(e,t){return e.a?Ry(e.a,e.b):e.a=new Zx(e.d),Iy(e.a,t),e}function Uje(e,t){if(e<0||e>t)throw P(new jm(cZe(e,t,`index`)));return e}function oj(e,t){var n=e.q.getHours()+(t/60|0);e.q.setMinutes(t),Wq(e,n)}function sj(e,t){return Dy(t)?t==null?pG(e.f,null):MIe(e.i,t):pG(e.f,t)}function Wje(e,t){Hy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function Gje(e,t){Uy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function Kje(e,t){Wy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function qje(e,t,n){np.call(this,n),this.b=e,this.c=t,this.d=(ZVe(),_Ut)}function cj(e,t,n){this.d=e,this.k=t?1:0,this.f=n?1:0,this.o=-1,this.p=0}function lj(e,t,n){this.a=e,this.c=t,this.d=n,hx(t.e,this),hx(n.b,this)}function uj(e){this.c=e,this.a=new M(this.c.a),this.b=new M(this.c.b)}function dj(){this.e=new up,this.c=new up,this.d=new up,this.b=new up}function Jje(){this.g=new uoe,this.b=new uoe,this.a=new up,this.k=new up}function Yje(){this.a=new qp,this.b=new Aoe,this.d=new Tt,this.e=new wt}function fj(e,t,n){this.a=e,this.b=t,this.c=n,hx(e.t,this),hx(t.i,this)}function pj(){this.b=new Sg,this.a=new Sg,this.b=new Sg,this.a=new Sg}function mj(){mj=E;var e,t;TUt=(Ph(),t=new Np,t),EUt=(e=new zoe,e)}function hj(){hj=E,$6=new Zf(`org.eclipse.elk.labels.labelManager`)}function Xje(){Xje=E,Yxt=new qS(`separateLayerConnections`,(yL(),Qxt))}function gj(){gj=E,jIt=new Ade(`FIXED`,0),AIt=new Ade(`CENTER_NODE`,1)}function _j(){_j=E,W3=new _v(`REGULAR`,0),U3=new _v(`CRITICAL`,1)}function Zje(e,t){var n=B9e(e,t);return e.b=new QF(n.c.length),K7e(e,n)}function vj(e,t,n){var r;return++e.e,--e.f,r=B(e.d[t].ed(n),138),r.kd()}function Qje(e){var t=e.jd();return rw(B(e.kd(),18).Lc(),new sne(t))}function yj(e){var t=e.b;return t.b==0?null:B(hV(t,0),65).b}function bj(e){if(e.a){if(e.e)return bj(e.e)}else return e;return null}function xj(e,t){return e.p<t.p?1:e.p>t.p?-1:0}function Sj(e,t){return NE(t),e.c<e.d?(e.Qe(t,e.c++),!0):!1}function Cj(e,t){return IT(e.a,t)?(sj(e.a,t),!0):!1}function wj(e,t,n){return wk(t,e.e.Pd().gc()),wk(n,e.c.Pd().gc()),e.a[t][n]}function Tj(e){var t;return e.a||(t=e.r,R(t,160)&&(e.a=B(t,160))),e.a}function $je(e){var t;for(IE(e),t=0;e.a.zd(new xe);)t=jz(t,1);return t}function eMe(e){var t;return zz(e),t=new Zye(e,e.a.e,e.a.d|4),new Mhe(e,t)}function tMe(e,t){var n;e.C&&(n=B(ZE(e.b,t),129).n,n.d=e.C.d,n.a=e.C.a)}function Ej(e){var t,n,r,i=e.d;t=e.a,n=e.b,r=e.c,e.d=n,e.a=r,e.b=i,e.c=t}function Dj(e,t,n){var r=0,i;for(i=0;i<t.length;i++)r+=e.sg(t[i],r,n)}function Oj(e,t,n,r){this.f=e,this.e=t,this.d=n,this.b=r,this.c=r?r.d:null}function kj(e,t){t.Tg(`Label management`,1),zy(Y(e,(hj(),$6))),t.Ug()}function Aj(){Aj=E,H_t=CR((nR(),q(I(q1,1),$Y,132,0,[B_t,K1,V_t])))}function nMe(){nMe=E,nvt=CR((vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])))}function rMe(){rMe=E,ovt=CR((KM(),q(I(avt,1),$Y,464,0,[e0,$1,t0])))}function jj(){jj=E,lvt=CR((kN(),q(I(cvt,1),$Y,465,0,[i0,r0,n0])))}function Mj(){Mj=E,Qyt=CR((ON(),q(I(Zyt,1),$Y,385,0,[Yyt,Jyt,Xyt])))}function iMe(){iMe=E,$Ct=CR((xL(),q(I(QCt,1),$Y,330,0,[x2,ZCt,b2])))}function Nj(){Nj=E,twt=CR((AN(),q(I(ewt,1),$Y,316,0,[C2,w2,S2])))}function aMe(){aMe=E,XCt=CR((tL(),q(I(YCt,1),$Y,303,0,[qCt,JCt,y2])))}function Pj(){Pj=E,ZSt=CR((nF(),q(I(XSt,1),$Y,351,0,[qSt,YSt,JSt])))}function Fj(){Fj=E,mCt=CR((SL(),q(I(pCt,1),$Y,452,0,[fCt,l2,u2])))}function Ij(){Ij=E,bAt=CR((rF(),q(I(yAt,1),$Y,455,0,[k3,D3,O3])))}function oMe(){oMe=E,TAt=CR((eL(),q(I(wAt,1),$Y,382,0,[xAt,SAt,CAt])))}function Lj(){Lj=E,kAt=CR((tR(),q(I(OAt,1),$Y,349,0,[DAt,EAt,A3])))}function Rj(){Rj=E,NAt=CR((xR(),q(I(MAt,1),$Y,350,0,[AAt,jAt,j3])))}function sMe(){sMe=E,RAt=CR((tF(),q(I(LAt,1),$Y,352,0,[IAt,PAt,FAt])))}function zj(){zj=E,VAt=CR((rL(),q(I(BAt,1),$Y,383,0,[zAt,N3,M3])))}function cMe(){cMe=E,qkt=CR((bR(),q(I(Kkt,1),$Y,353,0,[Ukt,Wkt,Gkt])))}function Bj(){Bj=E,qPt=CR((OI(),q(I(KPt,1),$Y,304,0,[WPt,GPt,UPt])))}function lMe(){lMe=E,ZPt=CR((CB(),q(I(XPt,1),$Y,441,0,[h6,JPt,YPt])))}function Vj(){Vj=E,CIt=CR((lz(),q(I(SIt,1),$Y,440,0,[yIt,bIt,xIt])))}function Hj(){Hj=E,uIt=CR((sN(),q(I(lIt,1),$Y,434,0,[oIt,cIt,sIt])))}function Uj(){Uj=E,hIt=CR((BR(),q(I(mIt,1),$Y,435,0,[dIt,pIt,fIt])))}function Wj(){Wj=E,DSt=CR((IF(),q(I(ESt,1),$Y,369,0,[Z0,X0,Y0])))}function uMe(){uMe=E,CMt=CR((BL(),q(I(SMt,1),$Y,386,0,[xMt,bMt,X3])))}function dMe(){dMe=E,tPt=CR((eR(),q(I(ePt,1),$Y,387,0,[ZNt,QNt,$Nt])))}function fMe(){fMe=E,mFt=CR((tB(),q(I(pFt,1),$Y,388,0,[dFt,fFt,uFt])))}function Gj(){Gj=E,KBt=CR((rR(),q(I(GBt,1),$Y,348,0,[WBt,$8,e5])))}function Kj(){Kj=E,EBt=CR((yP(),q(I(TBt,1),$Y,281,0,[K8,q8,J8])))}function qj(){qj=E,TVt=CR((zR(),q(I(wVt,1),$Y,283,0,[SVt,l7,CVt])))}function Jj(){Jj=E,pVt=CR((MP(),q(I(fVt,1),$Y,301,0,[$5,uVt,dVt])))}function Yj(){Yj=E,zSt=new Bue(`QUADRATIC`,0),BSt=new Bue(`SCANLINE`,1)}function Xj(e){return!e.g&&(e.g=new $s),!e.g.c&&(e.g.c=new kae(e)),e.g.c}function pMe(e){return!e.g&&(e.g=new $s),!e.g.b&&(e.g.b=new Qf(e)),e.g.b}function mMe(e){return!e.g&&(e.g=new $s),!e.g.d&&(e.g.d=new Oae(e)),e.g.d}function Zj(e){return!e.g&&(e.g=new $s),!e.g.a&&(e.g.a=new $f(e)),e.g.a}function Qj(e,t){var n=t,r=BD(ow(new vN(e,n)));return Ow(new vN(e,n)),r}function $j(e,t,n,r){return n&&(r=n.Oh(t,pB(n.Ah(),e.c.sk()),null,r)),r}function hMe(e,t,n,r){return n&&(r=n.Qh(t,pB(n.Ah(),e.c.sk()),null,r)),r}function eM(e,t,n,r){var i=G(q9,pX,30,t+1,15,1);return N8e(i,e,t,n,r),i}function G(e,t,n,r,i,a){var o=sGe(i,r);return i!=10&&q(I(e,a),t,n,i,o),o}function tM(e,t,n){var r,i=new YI(t,e);for(r=0;r<n;++r)vV(i);return i}function nM(e,t,n){var r,i;if(n!=null)for(r=0;r<t;++r)i=n[r],e.Oi(r,i)}function rM(e,t){var n=new fe;return n.c=!0,n.d=t.kd(),NJ(e,t.jd(),n)}function gMe(e,t){var n=e.q.getHours()+(t/3600|0);e.q.setSeconds(t),Wq(e,n)}function iM(e,t){return!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),MVe(e.o,t)}function aM(e,t,n){B(e.b,68),B(e.b,68),B(e.b,68),hP(e.a,new j_e(n,t,e))}function _Me(e,t,n,r){O8e(e,t,n,Kq(e,t,r,R(t,104)&&(B(t,20).Bb&OX)!=0))}function oM(e,t,n){if(e<0||t>n||t<e)throw P(new $m(HX+e+rat+t+qit+n))}function vMe(e,t,n){this.d=new Xp,this.c=new dp,this.a=e,this.e=t,this.c=n}function sM(e){e?(this.c=e,this.b=null):(this.c=null,this.b=new up)}function cM(e,t){d_.call(this,e,t),this.a=G(T_t,GY,443,2,0,1),this.b=!0}function lM(e){sRe.call(this,e,0),bS(this),this.d.b=this.d,this.d.a=this.d}function uM(e){this.e=e,this.b=this.e.a.entries(),this.a=G(v1,CY,1,0,5,1)}function yMe(){yMe=E,KAt=uT(ww(new RE,(zU(),m0),(sY(),vxt)),v0,U0)}function dM(){return QU(),q(I(xCt,1),$Y,286,0,[gCt,hCt,vCt,_Ct,bCt,yCt])}function fM(){return BH(),q(I(NCt,1),$Y,284,0,[ACt,kCt,MCt,OCt,jCt,DCt])}function bMe(){return YU(),q(I(BCt,1),$Y,285,0,[d2,ICt,zCt,RCt,LCt,FCt])}function xMe(){return gW(),q(I(a2,1),$Y,233,0,[t2,r2,e2,n2,i2,$0])}function SMe(){return NU(),q(I(IBt,1),$Y,328,0,[PBt,MBt,FBt,ABt,NBt,jBt])}function CMe(){return eU(),q(I(JRt,1),$Y,300,0,[qRt,o8,a8,KRt,r8,i8])}function wMe(){return bV(),q(I(MRt,1),$Y,259,0,[ORt,t8,n8,jRt,kRt,ARt])}function pM(){return mU(),q(I(eVt,1),$Y,103,0,[w5,C5,S5,y5,x5,b5])}function mM(){return NW(),q(I(nVt,1),$Y,282,0,[k5,D5,O5,E5,T5,A5])}function hM(e){var t;return!e.a&&e.b!=-1&&(t=e.c.Ah(),e.a=YN(t,e.b)),e.a}function gM(e,t){return e.Qi()&&e.Gc(t)?!1:(e.Fi(t),!0)}function _M(e,t){return XD(t,`Horizontal alignment cannot be null`),e.b=t,e}function TMe(e,t,n){cY();var r=JJ(e,t);return n&&r&&HCe(e)&&(r=null),r}function EMe(e,t,n){var r=e.b[n.c.p][n.p];r.b+=t.b,r.c+=t.c,r.a+=t.a,++r.a}function vM(e,t,n){var i;e.d[t.g]=n,i=e.g.c,i[t.g]=r.Math.max(i[t.g],n+1)}function yM(e,t){var n=e.a-t.a,i=e.b-t.b;return r.Math.sqrt(n*n+i*i)}function bM(e,t){var n,r;for(r=t.Jc();r.Ob();)n=B(r.Pb(),37),t6e(e,n,0,0)}function xM(e,t,n){var r,i;for(i=e.Jc();i.Ob();)r=B(i.Pb(),37),eq(r,t,n)}function SM(e){var t,n;for(n=tV(e.a,0);n.b!=n.d.c;)t=B(Lk(n),65),tQe(t)}function DMe(e,t){return vue(e.e,t)||ZB(e.e,t,new _Ue(t)),B(RN(e.e,t),114)}function CM(e,t,n,r){return NE(e),NE(t),NE(n),NE(r),new QSe(e,t,new me)}function wM(e,t,n,r){this.$j(),this.a=t,this.b=e,this.c=new PSe(this,t,n,r)}function TM(e,t,n,r,i,a){Fke.call(this,t,r,i,a),this.c=e,this.b=n}function EM(e,t,n,r,i,a){Fke.call(this,t,r,i,a),this.c=e,this.a=n}function DM(e,t){var n,r,i=e.r;return r=e.d,n=nJ(e,t,!0),n.b!=i||n.a!=r}function OM(e,t,n){var r,i=(r=jG(e.b,t),r);return i?gJ(CN(e,i),n):null}function OMe(e,t,n){var r=bO(e,n),i=null,a;r&&(i=wXe(r)),a=i,sUe(t,n,a)}function kMe(e,t,n){var r=bO(e,n),i=null,a;r&&(i=wXe(r)),a=i,sUe(t,n,a)}function AMe(e,t){var n=bE(e.k,t);return E0e(e,t),W3e(e,t),yG(e,t,n),null}function kM(e,t){var n;return n=e.Fh(t),n>=0?e.Ih(n,!0,!0):XW(e,t,!0)}function jMe(e,t){return _z(F(z(Y(e,(aY(),Y2)))),F(z(Y(t,Y2))))}function AM(e,t){Wy.call(this,t.xd(),t.wd()&-16449),NE(e),this.a=e,this.c=t}function jM(e,t,n,r,i){mpe(this),this.b=e,this.d=t,this.f=n,this.g=r,this.c=i}function MM(e){zb(this),cw(e>=0,`Initial capacity must not be negative`)}function NM(e){var t;return gE(e),R(e,206)?(t=B(e,206),t):new id(e)}function MMe(e){for(;!e.a;)if(!qge(e.c,new sre(e)))return!1;return!0}function NMe(e){var t;if(!e.a)throw P(new JE);return t=e.a,e.a=AO(e.a),t}function PMe(e){if(e.b<=0)throw P(new jp);return--e.b,e.a-=e.c.c,UR(e.a)}function PM(e,t){if(e.g==null||t>=e.i)throw P(new Zy(t,e.i));return e.g[t]}function FM(e,t,n){if(HL(e,n),n!=null&&!e.dk(n))throw P(new Tp);return n}function FMe(e,t,n){var r=qLe(e,t,n);return e.b=new QF(r.c.length),q2e(e,r)}function IMe(e){var t;if(e.ll())for(t=e.i-1;t>=0;--t)K(e,t);return vAe(e)}function LMe(e){IM(),B(e.mf((oY(),O8)),185).Ec((NW(),O5)),e.of(Uzt,null)}function IM(){IM=E,gRt=new ns,vRt=new rs,_Rt=SLe((oY(),Uzt),gRt,C8,vRt)}function LM(){LM=E,Qq(),eWt=wX,$Ut=TX,nWt=new Jd(wX),tWt=new Jd(TX)}function RM(){RM=E,qNt=new Sde(`LEAF_NUMBER`,0),JNt=new Sde(`NODE_SIZE`,1)}function zM(e){e.a=G(q9,pX,30,e.b+1,15,1),e.c=G(q9,pX,30,e.b,15,1),e.d=0}function BM(e,t){e.a.Le(t.d,e.b)>0&&(hx(e.c,new gbe(t.c,t.d,e.d)),e.b=t.d)}function VM(e,t,n,r){var i;r=(PD(),r||o_t),i=e.slice(t,n),lZe(i,e,t,n,-t,r)}function HM(e,t,n,r,i){return t<0?XW(e,n,r):B(n,69).uk().wk(e,e.ei(),t,r,i)}function UM(e,t){var n,r=t/e.c.Pd().gc()|0;return n=t%e.c.Pd().gc(),wj(e,r,n)}function WM(e){var t,n;if(!e.b)return null;for(n=e.b;t=n.a[0];)n=t;return n}function RMe(e){var t,n;if(!e.b)return null;for(n=e.b;t=n.a[1];)n=t;return n}function zMe(e){return R(e,183)?``+B(e,183).a:e==null?null:Jz(e)}function GM(e){return R(e,183)?``+B(e,183).a:e==null?null:Jz(e)}function BMe(e,t){if(t.a)throw P(new vm(cat));BT(e.a,t),t.a=e,!e.j&&(e.j=t)}function KM(){KM=E,e0=new T_(ZX,0),$1=new T_(XX,1),t0=new T_(QX,2)}function qM(){qM=E,E_t=new v_(`All`,0),D_t=new Lfe,O_t=new fpe,k_t=new Rfe}function VMe(){VMe=E,j_t=CR((qM(),q(I(A_t,1),$Y,310,0,[E_t,D_t,O_t,k_t])))}function HMe(){HMe=E,zvt=CR(($I(),q(I(Rvt,1),$Y,414,0,[o0,a0,Ivt,Lvt])))}function UMe(){UMe=E,pbt=CR((bL(),q(I(fbt,1),$Y,413,0,[b0,C0,x0,S0])))}function JM(){JM=E,wbt=CR((HB(),q(I(Cbt,1),$Y,384,0,[T0,xbt,bbt,Sbt])))}function YM(){YM=E,eSt=CR((yL(),q(I($xt,1),$Y,368,0,[Qxt,Xxt,Zxt,W0])))}function XM(){XM=E,hSt=CR((nL(),q(I(mSt,1),$Y,418,0,[G0,K0,q0,pSt])))}function WMe(){WMe=E,ujt=CR((yR(),q(I(ljt,1),$Y,409,0,[P3,F3,cjt,sjt])))}function GMe(){GMe=E,Xkt=CR((yV(),q(I(Ykt,1),$Y,205,0,[y3,Jkt,v3,_3])))}function ZM(){ZM=E,mAt=CR((MB(),q(I(pAt,1),$Y,270,0,[E3,uAt,dAt,fAt])))}function QM(){QM=E,KSt=CR((eB(),q(I(GSt,1),$Y,302,0,[s2,USt,o2,WSt])))}function KMe(){KMe=E,ONt=CR(($L(),q(I(DNt,1),$Y,354,0,[ENt,wNt,TNt,CNt])))}function $M(){$M=E,HPt=CR((RV(),q(I(VPt,1),$Y,355,0,[BPt,RPt,zPt,LPt])))}function eN(){eN=E,rFt=CR((MU(),q(I(nFt,1),$Y,406,0,[tFt,QPt,eFt,$Pt])))}function tN(){tN=E,iMt=CR((fV(),q(I(rMt,1),$Y,402,0,[nMt,q3,J3,Y3])))}function qMe(){qMe=E,RLt=CR((AH(),q(I(LLt,1),$Y,396,0,[NLt,PLt,FLt,ILt])))}function JMe(){JMe=E,wBt=CR((RR(),q(I(CBt,1),$Y,280,0,[G8,bBt,xBt,SBt])))}function nN(){nN=E,kBt=CR((rB(),q(I(OBt,1),$Y,225,0,[DBt,X8,Y8,Z8])))}function rN(){rN=E,YBt=CR((pH(),q(I(JBt,1),$Y,293,0,[i5,t5,n5,r5])))}function iN(){iN=E,AVt=CR((cA(),q(I(u7,1),$Y,290,0,[EVt,kVt,DVt,OVt])))}function aN(){aN=E,mVt=CR((jB(),q(I(i7,1),$Y,381,0,[n7,r7,t7,e7])))}function YMe(){YMe=E,IVt=CR((nB(),q(I(FVt,1),$Y,327,0,[PVt,jVt,NVt,MVt])))}function XMe(){XMe=E,UVt=CR((QL(),q(I(HVt,1),$Y,412,0,[zVt,BVt,RVt,VVt])))}function oN(){oN=E,wCt=new Hue(KZ,0),CCt=new Hue(`IMPROVE_STRAIGHTNESS`,1)}function sN(){sN=E,oIt=new Ode(eut,0),cIt=new Ode(mlt,1),sIt=new Ode(KZ,2)}function cN(e){var t;if(!TFe(e))throw P(new jp);return e.e=1,t=e.d,e.d=null,t}function lN(e){var t;return cb(e)&&(t=0-e,!isNaN(t))?t:RI(DL(e))}function uN(e,t,n){for(;n<e.c.length;++n)if(XE(t,e.c[n]))return n;return-1}function dN(e,t){var n=uN(e,t,0);return n==-1?!1:(ij(e,n),!0)}function ZMe(e,t){var n=B(sj(e.e,t),395);return n?(Obe(n),n.e):null}function QMe(e,t,n,r,i){return NE(e),NE(t),NE(n),NE(r),NE(i),new QSe(e,t,r)}function $Me(e){CS(!!e.c),k_e(e.f.g,e.d),e.c.Qb(),e.c=null,e.b=tLe(e),e.d=e.f.g}function fN(e){var t;for(t=e.p+1;t<e.c.a.c.length;++t)--B(Pw(e.c.a,t),9).p}function pN(e){var t=e.hj();t!=null&&e.d!=-1&&B(t,95).uh(e),e.i&&e.i.mj()}function mN(e){var t;return IE(e),t=G(Z9,AX,30,0,15,1),Jh(e.a,new ire(t)),t}function hN(e,t,n){var r;return IE(e),r=new ye,r.a=t,e.a.Nb(new Tue(r,n)),r.a}function gN(e,t){return qN(t)!=10&&q(hR(t),t.Qm,t.__elementTypeId$,qN(t),e),e}function _N(e){return B(Y(B(Pw(e.j,0),12),(aY(),q2)),12)}function vN(e,t){var n;this.f=e,this.b=t,n=B(bE(e.b,t),263),this.c=n?n.b:null}function eNe(){KC(),this.b=new dp,this.f=new dp,this.g=new dp,this.e=new dp}function yN(e){nx(this),this.g=e?eO(e,e.ge()):null,this.f=e,kD(this),this.he()}function bN(e,t,n,r,i,a,o){fF.call(this,t,r,i,a,o),this.c=e,this.b=n}function xN(e,t){if(t<0)throw P(new jm(xdt+t));return pAe(e,t+1),Pw(e.j,t)}function SN(e,t){return XE(t,Pw(e.f,0))||XE(t,Pw(e.f,1))||XE(t,Pw(e.f,2))}function tNe(e,t){return new Oye(t,MS(ix(t.e),t.f.a+e,t.f.b+e),(Rx(),!1))}function nNe(e,t){return GC(),hx(e,new ny(t,UR(t.e.c.length+t.g.c.length)))}function rNe(e,t){return GC(),hx(e,new ny(t,UR(t.e.c.length+t.g.c.length)))}function iNe(e,t){Hg();var n=zk(e),r=zk(t);return!!n&&!!r&&!LUe(n.k,r.k)}function CN(e,t){var n=B(t,687),r=n.ui();return!r&&n.xi(r=new rfe(e,t)),r}function wN(e,t){var n=B(t,689),r=n.Yk();return!r&&n.al(r=new HOe(e,t)),r}function TN(e){sxe();var t=e+128,n=Agt[t];return!n&&(n=Agt[t]=new Kd(e)),n}function EN(e){return e.b||(e.b=new Gxe(e,G7,e),!e.a&&(e.a=new XS(e,e))),e.b}function aNe(e){return k_e(e.d.a.e.g,e.b),SS(e.c!=e.d.a.d),e.a=e.c,e.c=e.c.a,e.a}function DN(e){var t,n=e.length;return t=G(K9,cX,30,n,15,1),iCe(e,0,n,t,0),t}function oNe(e,t){for(;t[0]<e.length&&sb(` \r
139
+ `).map((e,n)=>{let i=t+n,a=r.has(i);return(0,A.jsxs)(Sf,{gap:0,align:`stretch`,wrap:`nowrap`,style:{borderLeft:a?`2px solid var(--mantine-color-red-6)`:`2px solid transparent`,background:a?`rgba(248,113,113,0.08)`:`transparent`},children:[(0,A.jsx)(N,{ff:`monospace`,size:`xs`,c:`dimmed`,px:`sm`,py:6,style:{width:64,textAlign:`right`,borderRight:`1px solid rgba(255,255,255,0.06)`,userSelect:`none`},children:i}),(0,A.jsx)(N,{ff:`monospace`,size:`sm`,c:`white`,px:`sm`,py:6,style:{whiteSpace:`pre-wrap`,flex:1},children:e||` `})]},i)})})}function bB({step:e}){let t=e.match(/^(Given|When|Then|And)\b/)?.[1]??``,n=t?e.slice(t.length).trimStart():e;return(0,A.jsxs)(N,{ff:`monospace`,size:`sm`,c:`white`,pl:t===`And`?16:0,children:[t&&(0,A.jsx)(N,{component:`span`,inherit:!0,c:`var(--mantine-color-violet-4)`,fw:600,children:t}),t?` ${n}`:e]})}const xB=()=>(0,A.jsx)(N,{c:`dimmed`,size:`sm`,ta:`center`,children:`Not available`});var GVe=({type:e,isHoverable:t,onMouseEnter:n,onMouseLeave:r})=>(0,A.jsx)(eS,{type:`workflowInputType`,value:e,className:t?fx.clickableText:void 0,onMouseEnter:n,onMouseLeave:r}),KVe=e=>{if(e==null)return{type:`$static`,displayValue:(0,A.jsx)(N,{c:`dimmed`,size:`sm`,children:`null`})};if(typeof e==`object`&&e.$template){let t=e.$template,n=[];for(let e=0;e<t.parts.length;e++)if(t.parts[e]&&n.push((0,A.jsx)(N,{span:!0,size:`sm`,ff:`monospace`,children:t.parts[e]},`part-${e}`)),e<t.expressions.length){let r=t.expressions[e];if(typeof r==`object`&&r.$ref){let t=r.$ref===`trigger`?`$trigger`:`$ref`,i=r.path?`.${r.path}`:``;n.push((0,A.jsx)(eS,{type:`label`,color:wme[t]?.color||`gray`,children:r.$ref+i},`expr-${e}`))}else n.push((0,A.jsx)(eS,{type:`label`,color:wme.$expression?.color||`cyan`,children:String(r)},`expr-${e}`))}return{type:`$template`,displayValue:(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:n})}}if(typeof e==`object`&&e.$ref){let t=e.$ref===`trigger`||e.$ref===`$item`,n=e.$ref===`trigger`?`$trigger`:`$ref`,r=e.path?`.${e.path}`:``;return{type:n,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$ref+r}),isHoverable:!t,hoverRef:e.$ref}}return typeof e==`object`&&e.$state?{type:`$state`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$state})}:typeof e==`object`&&e.$expression?{type:`$expression`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.$expression})}:typeof e==`object`?{type:`$static`,displayValue:(0,A.jsx)(iA,{code:JSON.stringify(e,null,2),language:`json`})}:{type:`$static`,displayValue:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:String(e)})}};const qVe=({stepId:e})=>{let t=qk(e);return t?.flow||t?.rpcName,(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Options`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.options?(0,A.jsx)(iA,{code:JSON.stringify(t.options,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},JVe=({stepId:e})=>{let t=qk(e),{findNodeByOutputVar:n,setReferencedNode:r}=Gk(),i=t?.input,a=i&&Object.keys(i).length>0,o=e=>{r(e&&n(e)||null)};return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Input Parameters`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:a?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Parameter`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Value`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(i).map(([e,t])=>{let n=KVe(t);return(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(GVe,{type:n.type,isHoverable:n.isHoverable,onMouseEnter:n.isHoverable&&n.hoverRef?()=>o(n.hoverRef):void 0,onMouseLeave:n.isHoverable?()=>o(null):void 0})}),(0,A.jsx)(eg.Td,{children:n.displayValue})]},e)})})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var YVe=e=>e?e.type===`array`&&e.items?`${YVe(e.items)}[]`:e.$ref?e.$ref.replace(`#/definitions/`,``):e.type||`unknown`:`unknown`;const XVe=({stepId:e,showOutputs:t=!1})=>{let n=qk(e),r=n?.outputs,i=n?.outputVar,a=n?.rpcName,o=r&&typeof r==`object`&&Object.keys(r).length>0,{data:s,isLoading:c}=FAe(a);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output Schema`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:c?(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(mf,{size:`sm`})}):s?.properties?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Property`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(s.properties).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e}),s.required?.includes(e)&&(0,A.jsx)(eS,{type:`flag`,flag:`required`})]})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:YVe(t)})})]},e))})]})}):s?(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(ZAe,{schema:s})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output Variable`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:i?(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{ff:`monospace`,children:i}),c&&(0,A.jsx)(mf,{size:`sm`})]}):(0,A.jsx)(xB,{})})})]}),t&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Outputs`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:o?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Output`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Source`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(r).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsxs)(eg.Td,{children:[t?.from&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:t.from}),t.name&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.name}),t.expression&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.expression}),t.path&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`.`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.path})]})]}),!t?.from&&(0,A.jsx)(tp,{children:JSON.stringify(t,null,2)})]})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})]})},ZVe=({stepId:e})=>{let t=qk(e),n=t?.flow;return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:n===`branch`?`Branches`:n===`switch`?`Cases`:n===`parallel`?`Children`:n===`fanout`?`Fanout`:`Flow`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:n===`branch`&&t?.branches?(0,A.jsx)(Bh,{gap:`xs`,children:t.branches.map((e,t)=>(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,mb:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:t===0?`if`:`else if`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.condition?.expression||`true`})]}),e.entry&&(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:e.entry})]})]},t))}):n===`switch`&&t?.cases?(0,A.jsxs)(Bh,{gap:`xs`,children:[t.cases.map((e,t)=>(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,mb:`xs`,children:[(0,A.jsx)(eS,{type:`label`,children:`case`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.value})]}),e.entry&&(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:e.entry})]})]},t)),t.defaultEntry&&(0,A.jsxs)(j,{p:`sm`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsx)(Sf,{gap:`xs`,mb:`xs`,children:(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`default`})}),(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Entry:`,` `,(0,A.jsx)(N,{span:!0,ff:`monospace`,children:t.defaultEntry})]})]})]}):n===`parallel`&&t?.children?(0,A.jsx)(Bh,{gap:`xs`,children:t.children.map((e,t)=>(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e},t))}):n===`fanout`?(0,A.jsxs)(Bh,{gap:`xs`,children:[t?.sourceVar&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Source:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.sourceVar})]}),t?.itemVar&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Item:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.itemVar})]}),t?.mode&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Mode:`}),(0,A.jsx)(eS,{type:`label`,children:t.mode})]}),t?.childEntry&&(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Child Entry:`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.childEntry})]})]}):(0,A.jsx)(xB,{})})})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Next Step`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.next?(0,A.jsx)(N,{ff:`monospace`,children:t.next}):(0,A.jsx)(xB,{})})})]})]})};var SB=e=>e?new Date(e).toLocaleString():`—`,CB=(e,t)=>{if(!e||!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`};const wB=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);if(!t)return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(gA,{children:`Execution`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]});let n=t.succeededAt||t.failedAt,r=CB(t.runningAt||t.createdAt,n);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(gA,{children:`Execution`}),(0,A.jsx)(eS,{type:`status`,value:t.status,variant:`filled`})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Timing`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsx)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:(0,A.jsxs)(eg.Tbody,{children:[(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Created`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.createdAt)})})]}),t.runningAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Started`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.runningAt)})})]}),t.succeededAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Succeeded`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.succeededAt)})})]}),t.failedAt&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Failed`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:SB(t.failedAt)})})]}),r&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Duration`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:r})})]}),(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Attempts`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.attemptCount})})]})]})})})})]})]})},QVe=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Input Data`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.data?(0,A.jsx)(iA,{code:JSON.stringify(t.data,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},$Ve=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Output Data`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t?.result?(0,A.jsx)(iA,{code:JSON.stringify(t.result,null,2),language:`json`}):(0,A.jsx)(xB,{})})})]})},TB=({stepId:e})=>{let t=(Wk()?.stepStates)?.get(e);return t?.error?(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(gA,{children:`Error`}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Message`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`red`,children:typeof t.error.message==`string`?t.error.message:JSON.stringify(t.error.message,null,2)})})})]}),t.error.code&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Code`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(eS,{type:`label`,color:`red`,children:t.error.code})})})]}),t.error.stack&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Stack Trace`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(iA,{code:t.error.stack,language:`text`})})})]})]}):(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Error`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})},EB=({stepId:e})=>{let{data:t}=Hk(Wk()?.selectedRunId??null),n=D.useMemo(()=>!t||!Array.isArray(t)?[]:t.filter(t=>t.stepName===e),[t,e]);return n.length<=1?(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(gA,{children:`Retry History`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{c:`dimmed`,size:`sm`,ta:`center`,children:`No retries`})})})]}):(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(gA,{children:`Retry History`}),(0,A.jsxs)(eS,{type:`label`,children:[n.length,` attempts`]})]}),(0,A.jsx)(sg,{active:n.length-1,bulletSize:24,lineWidth:2,children:n.map((e,t)=>{let n=e.status===`succeeded`?(0,A.jsx)(rb,{size:14}):e.status===`failed`?(0,A.jsx)(zb,{size:14}):e.status===`running`?(0,A.jsx)(Eb,{size:14}):(0,A.jsx)(ab,{size:14});return(0,A.jsxs)(sg.Item,{bullet:n,color:Eme[e.status]?.color||`gray`,title:`Attempt ${e.attemptCount}`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`status`,value:e.status}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:SB(e.createdAt)})]}),e.error&&(0,A.jsx)(N,{size:`sm`,c:`red`,mt:4,children:typeof e.error.message==`string`?e.error.message:JSON.stringify(e.error.message,null,2)})]},t)})})]})};var DB={http:`/apis?tab=http`,channel:`/apis?tab=channels`,mcp:`/apis?tab=mcp`,cli:`/apis?tab=cli`,rpc:`/apis?tab=http`,scheduler:`/jobs?tab=schedulers`,queue:`/jobs?tab=queues`,trigger:`/jobs?tab=triggers`,triggerSource:`/jobs?tab=triggers`,agent:`/apis/agents`};const eHe=({workflowId:e})=>{let{workflow:t}=Gk();return(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(db,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e}),t?.graphHash&&(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:[`#`,t.graphHash]})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t?.summary||`No summary`})]})};var tHe=({wiredTo:e})=>{let t=Hy();return e.transports.length===0&&e.jobs.length===0?null:(0,A.jsxs)(Bh,{gap:`sm`,children:[e.transports.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wired To`}),(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:e.transports.map(e=>(0,A.jsx)(Lf,{component:t,to:DB[e.type]||`#`,underline:`never`,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(e.type),className:fx.clickableText,children:e.name})},e.id))})]}),e.jobs.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Jobs`}),(0,A.jsx)(Sf,{gap:4,wrap:`wrap`,children:e.jobs.map(e=>(0,A.jsx)(Lf,{component:t,to:DB[e.type]||`#`,underline:`never`,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(e.type),className:fx.clickableText,children:e.name})},e.id))})]})]})};const nHe=({workflowId:e})=>{let{workflow:t}=Gk(),n=t?.middleware||[],r=t?.permissions||[],i=t?.tags||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[r.length>0&&(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})}),t?.wiredTo&&(0,A.jsx)(tHe,{wiredTo:t.wiredTo}),t?.pikkuFuncId&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Handler Function`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.pikkuFuncId})]}),(0,A.jsx)(vA,{description:t?.description,middleware:n,permissions:r,tags:i})]})},OB=({workflowId:e})=>{let{workflow:t,setFocusedNode:n}=Gk(),r=t?.nodes,i=r&&Object.keys(r).length>0;return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Nodes`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:i?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,highlightOnHover:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(r).map(([e,t])=>(0,A.jsxs)(eg.Tr,{onMouseEnter:()=>n(e),onMouseLeave:()=>n(null),children:[(0,A.jsxs)(eg.Td,{children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:t.stepName||e}),t.stepName&&t.stepName!==e&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e})]}),(0,A.jsxs)(eg.Td,{children:[t.flow&&(0,A.jsx)(eS,{type:`label`,children:t.flow}),t.rpcName&&(0,A.jsx)(eS,{type:`label`,color:`green`,children:`RPC`})]})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var kB=({workflowId:e})=>{let{workflow:t,setFocusedNode:n}=Gk(),r=Wk(),{openWorkflowStep:i}=_x(),a=t?.nodes,o=r?.stepStates,s=a?Object.entries(a).filter(([e])=>o?.has(e)):[];return s.length===0?null:(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Nodes`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,highlightOnHover:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Status`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Runs`})]})}),(0,A.jsx)(eg.Tbody,{children:s.map(([e,t])=>{let r=o.get(e);return(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onMouseEnter:()=>n(e),onMouseLeave:()=>n(null),onClick:()=>i(e,t.flow||`rpc`),children:[(0,A.jsxs)(eg.Td,{children:[(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:t.stepName||e}),t.stepName&&t.stepName!==e&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e})]}),(0,A.jsxs)(eg.Td,{children:[t.flow&&(0,A.jsx)(eS,{type:`label`,children:t.flow}),t.rpcName&&(0,A.jsx)(eS,{type:`label`,color:`green`,children:t.rpcName})]}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(eS,{type:`status`,value:r.status})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:r.attemptCount})})]},e)})})]})})})]})};const rHe=({workflowId:e})=>{let{workflow:t}=Gk(),n=t?.context,r=n&&Object.keys(n).length>0;return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`State Variables`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:r?(0,A.jsx)($f.Section,{children:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Variable`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Type`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Default`})]})}),(0,A.jsx)(eg.Tbody,{children:Object.entries(n).map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{fw:500,ff:`monospace`,size:`sm`,children:e})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(eS,{type:`label`,children:t.type||`unknown`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`dimmed`,children:t.default===void 0?`—`:String(t.default)})})]},e))})]})}):(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]})};var iHe=e=>e?new Date(e).toLocaleString():`—`,aHe=(e,t)=>{if(!e||!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`},oHe=({input:e})=>{let{schema:t}=LAe();return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Input`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:t&&e&&typeof e==`object`?(0,A.jsx)(Vk,{schema:t,initialData:e,readOnly:!0}):(0,A.jsx)(iA,{code:JSON.stringify(e,null,2),language:`json`})})})]})};const sHe=({workflowId:e})=>{let t=Wk()?.runData;if(!t)return(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Run`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(xB,{})})})]});let n=t.status===`completed`||t.status===`failed`||t.status===`cancelled`?t.updatedAt:void 0,r=aHe(t.createdAt,n);return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(mA,{children:`Run`}),(0,A.jsx)(eS,{type:`status`,value:t.status,variant:`filled`})]}),(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Details`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{children:(0,A.jsx)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:(0,A.jsxs)(eg.Tbody,{children:[(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Run ID`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.id})})]}),(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Started`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:iHe(t.createdAt)})})]}),n&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Ended`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:iHe(n)})})]}),r&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Duration`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:r})})]}),t.wire&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Wire`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(eS,{type:`label`,size:`sm`,color:Dme(t.wire.type),children:t.wire.type}),t.wire.id&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.wire.id})]})})]}),t.graphHash&&(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Graph Hash`})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.graphHash})})]})]})})})})]}),(0,A.jsx)(kB,{workflowId:e}),t.input&&(0,A.jsx)(oHe,{input:t.input}),t.output&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Output`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(iA,{code:JSON.stringify(t.output,null,2),language:`json`})})})]}),t.error&&(0,A.jsxs)(Bh,{gap:6,children:[(0,A.jsx)(mA,{children:`Error`}),(0,A.jsx)($f,{withBorder:!0,radius:`md`,padding:0,children:(0,A.jsx)($f.Section,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`red`,children:typeof t.error.message==`string`?t.error.message:JSON.stringify(t.error.message??t.error,null,2)})})})]})]})};var cHe=u(s(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(`cronstrue`,[],r):typeof e==`object`?e.cronstrue=r():n.cronstrue=r()})(globalThis,()=>(()=>{var e={949(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.CronParser=void 0;var r=n(515);t.CronParser=function(){function e(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e,t=this.expression??``;if(t===`@reboot`)return e=[`@reboot`,``,``,``,``,``,``],e;if(t.startsWith(`@`)){var n=this.parseSpecial(this.expression);e=this.extractParts(n)}else e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.parseSpecial=function(e){var t={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`,"@reboot":`@reboot`}[e];if(!t)throw Error(`Unknown special expression.`);return t},e.prototype.extractParts=function(e){if(!this.expression)throw Error(`cron expression is empty`);for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(`,`)){var r=t[n].split(`,`).map(function(e){return e.trim()}).filter(function(e){return e!==``}).map(function(e){return isNaN(Number(e))?e:Number(e)}).filter(function(e){return e!==null&&e!==``});r.length===0&&r.push(`*`),r.sort(function(e,t){return e!==null&&t!==null?e-t:0}),t[n]=r.map(function(e){return e===null?``:e.toString()}).join(`,`)}if(t.length<5)throw Error(`Expression has only ${t.length} part${t.length==1?``:`s`}. At least 5 parts are required.`);if(t.length==5)t.unshift(``),t.push(``);else if(t.length==6)/\d{4}$/.test(t[5])||t[4]==`?`||t[2]==`?`?t.unshift(``):t.push(``);else if(t.length>7)throw Error(`Expression has ${t.length} parts; too many!`);return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace(`?`,`*`),e[5]=e[5].replace(`?`,`*`),e[2]=e[2].replace(`?`,`*`),e[0].indexOf(`0/`)==0&&(e[0]=e[0].replace(`0/`,`*/`)),e[1].indexOf(`0/`)==0&&(e[1]=e[1].replace(`0/`,`*/`)),e[2].indexOf(`0/`)==0&&(e[2]=e[2].replace(`0/`,`*/`)),e[3].indexOf(`1/`)==0&&(e[3]=e[3].replace(`1/`,`*/`)),e[4].indexOf(`1/`)==0&&(e[4]=e[4].replace(`1/`,`*/`)),e[6].indexOf(`1/`)==0&&(e[6]=e[6].replace(`1/`,`*/`)),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(e){var n=e.replace(/\D/,``),r=n;return t.dayOfWeekStartIndexZero?n==`7`&&(r=`0`):r=(parseInt(n)-1).toString(),e.replace(n,r)}),e[5]==`L`&&(e[5]=`6`),e[3]==`?`&&(e[3]=`*`),e[3].indexOf(`W`)>-1&&(e[3].indexOf(`,`)>-1||e[3].indexOf(`-`)>-1))throw Error(`The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.`);var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,`gi`),n[r].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(e){var n=e.replace(/\D/,``),r=n;return t.monthStartIndexZero&&(r=(parseInt(n)+1).toString()),e.replace(n,r)});var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in i)e[4]=e[4].replace(new RegExp(a,`gi`),i[a].toString());e[0]==`0`&&(e[0]=``),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+=`-${e[2]}`);for(var o=0;o<e.length;o++)if(e[o].indexOf(`,`)!=-1&&(e[o]=e[o].split(`,`).filter(function(e){return e!==``}).join(`,`)||`*`),e[o]==`*/1`&&(e[o]=`*`),e[o].indexOf(`/`)>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s=`12`;break;case 5:s=`6`;break;case 6:s=`9999`;break;default:s=null;break}if(s!==null){var c=e[o].split(`/`);e[o]=`${c[0]}-${s}/${c[1]}`}}},e.prototype.validate=function(e){var t=`0-9,\\-*/`;this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],`0-9,\\-*/LW`),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],`0-9,\\-*/L#`),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},e.prototype.validateAnyRanges=function(e){r.default.secondRange(e[0]),r.default.minuteRange(e[1]),r.default.hourRange(e[2]),r.default.dayOfMonthRange(e[3]),r.default.monthRange(e[4],this.monthStartIndexZero),r.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.validateOnlyExpectedCharactersFound=function(e,t){var n=e.match(RegExp(`[^${t}]+`,`gi`));if(n&&n.length)throw Error(`Expression contains invalid values: '${n.toString()}'`)},e}()},333(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.ExpressionDescriptor=void 0;var r=n(823),i=n(949);t.ExpressionDescriptor=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=[,,,,,],!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var r=Object.keys(e.locales)[0];console.warn(`Locale '${this.options.locale}' could not be found; falling back to '${r}'.`),this.options.locale=r}this.i18n=e.locales[this.options.locale],n.use24HourTimeFormat===void 0&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=n===void 0?{}:n,i=r.throwExceptionOnParseError,a=i===void 0?!0:i,o=r.verbose,s=o===void 0?!1:o,c=r.dayOfWeekStartIndexZero,l=c===void 0?!0:c,u=r.monthStartIndexZero,d=u===void 0?!1:u,f=r.use24HourTimeFormat,p=r.locale,m=p===void 0?null:p,h=r.logicalAndDayFields,g={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:l,monthStartIndexZero:d,use24HourTimeFormat:f,locale:m,logicalAndDayFields:h===void 0?!1:h};return g.tzOffset&&console.warn(`'tzOffset' option has been deprecated and is no longer supported.`),new e(t,g).getFullDescription()},e.initialize=function(t,n){n===void 0&&(n=`en`),e.specialCharacters=[`/`,`-`,`,`,`*`],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e,t=``;try{if(this.expressionParts=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero).parse(),this.expressionParts[0]===`@reboot`)return(e=this.i18n).atReboot?.call(e)||`Run once, at startup`;var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();t+=n+r+o+a+s,t=this.transformVerbosity(t,!!this.options.verbose),t=t.charAt(0).toLocaleUpperCase()+t.substr(1)}catch(e){if(!this.options.throwExceptionOnParseError)t=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw`${e}`}return t},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],a=``;if(!r.StringUtilities.containsAny(n,e.specialCharacters)&&!r.StringUtilities.containsAny(i,e.specialCharacters)&&!r.StringUtilities.containsAny(t,e.specialCharacters))a+=this.i18n.atSpace()+this.formatTime(i,n,t);else if(!t&&n.indexOf(`-`)>-1&&!(n.indexOf(`,`)>-1)&&!(n.indexOf(`/`)>-1)&&!r.StringUtilities.containsAny(i,e.specialCharacters)){var o=n.split(`-`);a+=r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(i,o[0],``),this.formatTime(i,o[1],``))}else if(!t&&i.indexOf(`,`)>-1&&i.indexOf(`-`)==-1&&i.indexOf(`/`)==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(`,`);a+=this.i18n.at();for(var c=0;c<s.length;c++)a+=` `,a+=this.formatTime(s[c],n,``),c<s.length-2&&(a+=`,`),c==s.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),d=this.getHoursDescription();if(a+=l,a&&u&&(a+=`, `),a+=u,u===d)return a;a&&d&&(a+=`, `),a+=d}return a},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(t),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return t==`0`?``:parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)})},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2];return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(t),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(r){var i;try{return r==`0`&&n.indexOf(`/`)==-1&&t==``?e.i18n.everyHour():r==`0`?(i=e.i18n).onTheHour?.call(i)||e.i18n.atX0MinutesPastTheHour(r):parseInt(r)<20?e.i18n.atX0MinutesPastTheHour(r):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(r)}catch{return e.i18n.atX0MinutesPastTheHour(r)}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=0,i=[];t.split(`/`)[0].split(`,`).forEach(function(e){var t=e.split(`-`);t.length===2&&i.push({value:t[1],index:n+1}),n+=t.length});var a=0;return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){var n=i.find(function(e){return e.value===t&&e.index===a})&&e.expressionParts[1]!==`0`;return a++,n?e.formatTime(t,`59`,``):e.formatTime(t,`0`,``)},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(t),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n=this.expressionParts[5]==`*`?``:this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(n,r){var i=n;n.indexOf(`#`)>-1?i=n.substring(0,n.indexOf(`#`)):n.indexOf(`L`)>-1&&(i=i.replace(`L`,``));var a=parseInt(i),o=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(r)[a]:t[a];if(n.indexOf(`#`)>-1){var s=null,c=n.substring(n.indexOf(`#`)+1),l=n.substring(0,n.indexOf(`#`));switch(c){case`1`:s=e.i18n.first(l);break;case`2`:s=e.i18n.second(l);break;case`3`:s=e.i18n.third(l);break;case`4`:s=e.i18n.fourth(l);break;case`5`:s=e.i18n.fifth(l);break}o=s+` `+o}return o},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)},function(t){var n=t.substring(0,t.indexOf(`-`));return e.expressionParts[3]==`*`?e.i18n.commaX0ThroughX1(n):e.i18n.commaAndX0ThroughX1(n)},function(t){var n=null;if(t.indexOf(`#`)>-1){var r=t.substring(t.indexOf(`#`)+1),i=t.substring(0,t.indexOf(`#`));n=e.i18n.commaOnThe(r,i).trim()+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf(`L`)>-1?e.i18n.commaOnTheLastX0OfTheMonth(t.replace(`L`,``)):e.expressionParts[3]==`*`||e.options.logicalAndDayFields?e.i18n.commaOnlyOnX0(t):e.i18n.commaAndOnX0();return n}),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],``,function(n,r){return r&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(r)[parseInt(n)-1]:t[parseInt(n)-1]},function(t){return parseInt(t)==1?``:r.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case`L`:t=this.i18n.commaOnTheLastDayOfTheMonth();break;case`WL`:case`LW`:t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var a=parseInt(i[0].replace(`W`,``)),o=a==1?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var c=s[1];t=r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(c),c);break}else if(n==`*`&&this.expressionParts[5]!=`*`)return``;else t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(t){return t==`L`?e.i18n.lastDay():e.i18n.dayX0?r.StringUtilities.format(e.i18n.dayX0(),t):t},function(t){return t==`1`?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)},function(t){return e.i18n.commaOnDayX0OfTheMonth(t)});break}}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],``,function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,a,o){var s=null,c=e.indexOf(`/`)>-1,l=e.indexOf(`-`)>-1,u=e.indexOf(`,`)>-1;if(!e)s=``;else if(e===`*`)s=t;else if(!c&&!l&&!u)s=r.StringUtilities.format(o(e),n(e));else if(u){for(var d=e.split(`,`),f=``,p=0;p<d.length;p++)if(p>0&&d.length>2&&(f+=`,`,p<d.length-1&&(f+=` `)),p>0&&d.length>1&&(p==d.length-1||d.length==2)&&(f+=`${this.i18n.spaceAnd()} `),d[p].indexOf(`/`)>-1||d[p].indexOf(`-`)>-1){var m=d[p].indexOf(`-`)>-1&&d[p].indexOf(`/`)==-1,h=this.getSegmentDescription(d[p],t,n,i,m?this.i18n.commaX0ThroughX1:a,o);m&&(h=h.replace(`, `,``)),f+=h}else if(!c)f+=n(d[p]);else{var g=this.getSegmentDescription(d[p],t,n,i,a,o);g&&g.startsWith(`, `)&&(g=g.substring(2)),f+=g}s=c?f:r.StringUtilities.format(o(e),f)}else if(c){var d=e.split(`/`);if(s=r.StringUtilities.format(i(d[1]),d[1]),d[0].indexOf(`-`)>-1){var _=this.generateRangeSegmentDescription(d[0],a,n);_.indexOf(`, `)!=0&&(s+=`, `),s+=_}else if(d[0].indexOf(`*`)==-1){var v=r.StringUtilities.format(o(d[0]),n(d[0]));v=v.replace(`, `,``),s+=r.StringUtilities.format(this.i18n.commaStartingX0(),v)}}else l&&(s=this.generateRangeSegmentDescription(e,a,n));return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var i=``,a=e.split(`-`),o=n(a[0],1),s=n(a[1],2),c=t(e);return i+=r.StringUtilities.format(c,o,s),i},e.prototype.formatTime=function(e,t,n){var r=0,i=0,a=parseInt(e)+r,o=parseInt(t)+i;o>=60?(o-=60,a+=1):o<0&&(o+=60,--a),a>=24?a-=24:a<0&&(a=24+a);var s=``,c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),s=c?`${this.getPeriod(a)} `:` ${this.getPeriod(a)}`,a>12&&(a-=12),a===0&&(a=12));var l=``;return n&&(l=`:${(`00`+n).substring(n.length)}`),`${c?s:``}${(`00`+a.toString()).substring(a.toString().length)}:${(`00`+o.toString()).substring(o.toString().length)}${l}${c?``:s}`},e.prototype.transformVerbosity=function(e,t){if(!t&&(e=e.replace(RegExp(`, ${this.i18n.everyMinute()}`,`g`),``),e=e.replace(RegExp(`, ${this.i18n.everyHour()}`,`g`),``),e=e.replace(new RegExp(this.i18n.commaEveryDay(),`g`),``),e=e.replace(/\, ?$/,``),this.i18n.conciseVerbosityReplacements))for(var n=0,r=Object.entries(this.i18n.conciseVerbosityReplacements());n<r.length;n++){var i=r[n],a=i[0],o=i[1];e=e.replace(new RegExp(a,`g`),o)}return e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||`PM`:this.i18n.am&&this.i18n.am()||`AM`},e.locales={},e}()},747(e,t,n){Object.defineProperty(t,`__esModule`,{value:!0}),t.enLocaleLoader=void 0;var r=n(486);t.enLocaleLoader=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}()},486(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.en=void 0,t.en=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return`An error occurred when generating the expression description. Check the cron expression syntax.`},e.prototype.everyMinute=function(){return`every minute`},e.prototype.everyHour=function(){return`every hour`},e.prototype.atSpace=function(){return`At `},e.prototype.everyMinuteBetweenX0AndX1=function(){return`Every minute between %s and %s`},e.prototype.at=function(){return`At`},e.prototype.spaceAnd=function(){return` and`},e.prototype.everySecond=function(){return`every second`},e.prototype.everyX0Seconds=function(){return`every %s seconds`},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return`seconds %s through %s past the minute`},e.prototype.atX0SecondsPastTheMinute=function(){return`at %s seconds past the minute`},e.prototype.everyX0Minutes=function(){return`every %s minutes`},e.prototype.minutesX0ThroughX1PastTheHour=function(){return`minutes %s through %s past the hour`},e.prototype.atX0MinutesPastTheHour=function(){return`at %s minutes past the hour`},e.prototype.everyX0Hours=function(){return`every %s hours`},e.prototype.betweenX0AndX1=function(){return`between %s and %s`},e.prototype.atX0=function(){return`at %s`},e.prototype.commaEveryDay=function(){return`, every day`},e.prototype.commaEveryX0DaysOfTheWeek=function(){return`, every %s days of the week`},e.prototype.commaX0ThroughX1=function(){return`, %s through %s`},e.prototype.commaAndX0ThroughX1=function(){return`, %s through %s`},e.prototype.first=function(){return`first`},e.prototype.second=function(){return`second`},e.prototype.third=function(){return`third`},e.prototype.fourth=function(){return`fourth`},e.prototype.fifth=function(){return`fifth`},e.prototype.commaOnThe=function(){return`, on the `},e.prototype.spaceX0OfTheMonth=function(){return` %s of the month`},e.prototype.lastDay=function(){return`the last day`},e.prototype.commaOnTheLastX0OfTheMonth=function(){return`, on the last %s of the month`},e.prototype.commaOnlyOnX0=function(){return`, only on %s`},e.prototype.commaAndOnX0=function(){return`, and on %s`},e.prototype.commaEveryX0Months=function(){return`, every %s months`},e.prototype.commaOnlyInX0=function(){return`, only in %s`},e.prototype.commaOnTheLastDayOfTheMonth=function(){return`, on the last day of the month`},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return`, on the last weekday of the month`},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return`, %s days before the last day of the month`},e.prototype.firstWeekday=function(){return`first weekday`},e.prototype.weekdayNearestDayX0=function(){return`weekday nearest day %s`},e.prototype.commaOnTheX0OfTheMonth=function(){return`, on the %s of the month`},e.prototype.commaEveryX0Days=function(){return`, every %s days in a month`},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return`, between day %s and %s of the month`},e.prototype.commaOnDayX0OfTheMonth=function(){return`, on day %s of the month`},e.prototype.commaEveryHour=function(){return`, every hour`},e.prototype.commaEveryX0Years=function(){return`, every %s years`},e.prototype.commaStartingX0=function(){return`, starting %s`},e.prototype.daysOfTheWeek=function(){return[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},e.prototype.monthsOfTheYear=function(){return[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},e.prototype.atReboot=function(){return`Run once, at startup`},e.prototype.onTheHour=function(){return`on the hour`},e}()},515(e,t){Object.defineProperty(t,`__esModule`,{value:!0});function n(e,t){if(!e)throw Error(t)}t.default=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`seconds part must be >= 0 and <= 59`)}},e.minuteRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=59,`minutes part must be >= 0 and <= 59`)}},e.hourRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=0&&i<=23,`hours part must be >= 0 and <= 23`)}},e.dayOfMonthRange=function(e){for(var t=e.split(`,`),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var i=parseInt(t[r],10);n(i>=1&&i<=31,`DOM part must be >= 1 and <= 31`)}},e.monthRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=1&&a<=12,t?`month part must be >= 0 and <= 11`:`month part must be >= 1 and <= 12`)}},e.dayOfWeekRange=function(e,t){for(var r=e.split(`,`),i=0;i<r.length;i++)if(!isNaN(parseInt(r[i],10))){var a=parseInt(r[i],10);n(a>=0&&a<=6,t?`DOW part must be >= 0 and <= 6`:`DOW part must be >= 1 and <= 7`)}},e}()},823(e,t){Object.defineProperty(t,`__esModule`,{value:!0}),t.StringUtilities=void 0,t.StringUtilities=function(){function e(){}return e.format=function(e){var t=[...arguments].slice(1);return e.replace(/%s/g,function(e){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}()}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.toString=void 0;var t=n(333),i=n(747);t.ExpressionDescriptor.initialize(new i.enLocaleLoader),e.default=t.ExpressionDescriptor,e.toString=t.ExpressionDescriptor.toString})(),r})())}))(),1);const lHe=({pikkuFuncId:e,label:t})=>{let{data:n}=Yk(e??``),{navigateInPanel:r}=_x();if(!e)return null;let i=n?.name||e;return(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:t||`Handler Function`}),(0,A.jsx)(Sf,{gap:6,children:(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,leftSection:(0,A.jsx)(gb,{size:10}),style:{cursor:`pointer`},onClick:()=>r(`function`,e,i,n),children:i})})]})},uHe=({wireId:e,metadata:t={}})=>{let n=t?.method?.toUpperCase()||`GET`,r=t?.route||e,i=t?.middleware||[],a=t?.permissions||[],o=t?.auth!==!1;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(pb,{size:20}),(0,A.jsx)(eS,{type:`httpMethod`,value:n,variant:`filled`}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:r})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[o&&(0,A.jsx)(eS,{type:`flag`,flag:`auth`}),a.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`}),t?.sse&&(0,A.jsx)(eS,{type:`flag`,flag:`sse`})]}),(t?.params&&t.params.length>0||t?.query&&t.query.length>0)&&(0,A.jsxs)(Sf,{gap:`xs`,children:[t?.params?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`param`,value:`:${e}`},`p-${e}`)),t?.query?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`query`,value:`?${e}`},`q-${e}`))]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:i,permissions:a,tags:t?.tags||[],errors:t?.errors||[],inputSchemaName:t?.inputSchemaName,outputSchemaName:t?.outputSchemaName})]})},dHe=({wireId:e,metadata:t={}})=>{let{navigateInPanel:n}=_x(),r=t?.middleware||[],i=t?.permissions||[],a=t?.channelMiddleware||[],o=t?.auth!==!1,s=t?.messageWirings;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(kb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.route&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.route}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`channel`}),o&&(0,A.jsx)(eS,{type:`flag`,flag:`auth`}),i.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(t?.params&&t.params.length>0||t?.query&&t.query.length>0)&&(0,A.jsxs)(Sf,{gap:`xs`,children:[t?.params?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`param`,value:`:${e}`},`p-${e}`)),t?.query?.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`query`,value:`?${e}`},`q-${e}`))]}),(0,A.jsxs)(vA,{description:t?.description,middleware:r,permissions:i,tags:t?.tags||[],errors:t?.errors||[],children:[t?.input&&(0,A.jsx)(_A,{label:`Input Schema`,schemaName:t.input}),(0,A.jsx)(lHe,{pikkuFuncId:t?.connect?.pikkuFuncId,label:`Connect Handler`}),(0,A.jsx)(lHe,{pikkuFuncId:t?.disconnect?.pikkuFuncId,label:`Disconnect Handler`}),(0,A.jsx)(lHe,{pikkuFuncId:t?.message?.pikkuFuncId,label:`Message Handler`}),a.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Channel Middleware`}),(0,A.jsx)(Sf,{gap:6,children:a.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),s&&Object.keys(s).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Message Wirings`}),(0,A.jsx)(Bh,{gap:`sm`,children:Object.entries(s).map(([e,t])=>(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:600,mb:4,children:e}),(0,A.jsx)(Sf,{gap:6,children:Object.entries(t).map(([e,t])=>(0,A.jsx)(eS,{type:`dynamic`,badge:`actions`,value:e,className:t?.pikkuFuncId?fx.clickableText:void 0,onClick:t?.pikkuFuncId?()=>n(`function`,t.pikkuFuncId,e,t):void 0},e))})]},e))})]})]})]})},fHe=({wireId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Fb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:e})]})}),(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`wiringType`,value:`rpc`})}),(0,A.jsx)(vA,{pikkuFuncId:t?.pikkuFuncId})]}),AB=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(ab,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`scheduler`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),t?.schedule&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Schedule`}),(0,A.jsx)(N,{size:`sm`,children:cHe.default.toString(t.schedule)}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,mt:2,children:t.schedule})]}),t?.timezone&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Timezone`}),(0,A.jsx)(N,{size:`sm`,children:t.timezone})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[]})]})},pHe=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[],i=t?.config;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(vb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`queue`}),t?.concurrency!==void 0&&(0,A.jsx)(eS,{type:`dynamic`,badge:`concurrency`,value:t.concurrency,variant:`outline`,color:`gray`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[],children:i&&Object.keys(i).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Config`}),(0,A.jsx)(Sf,{gap:6,children:Object.entries(i).map(([e,t])=>(0,A.jsxs)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,children:[e,`: `,String(t)]},e))})]})})]})};var jB=({options:e})=>{let t=Object.entries(e);return t.length===0?null:(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Option`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Description`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Default`})]})}),(0,A.jsx)(eg.Tbody,{children:t.map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,children:[`--`,e,t.short?`, -${t.short}`:``]})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,children:t.description||``})}),(0,A.jsx)(eg.Td,{children:t.required?(0,A.jsx)(eS,{type:`flag`,flag:`required`}):t.default===void 0?(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`-`}):(0,A.jsx)(tp,{children:String(t.default)})})]},e))})]})},MB=({commands:e,depth:t=0})=>{let{navigateInPanel:n}=_x();return(0,A.jsx)(Bh,{gap:`xs`,children:Object.entries(e).map(([e,r])=>(0,A.jsxs)(j,{ml:t*16,children:[(0,A.jsxs)(Sf,{gap:6,mb:4,children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:600,children:e}),r.isDefault&&(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`light`,color:`gray`,children:`default`}),r.pikkuFuncId&&(0,A.jsx)(eS,{type:`label`,size:`sm`,variant:`outline`,color:`gray`,className:fx.clickableText,onClick:()=>n(`function`,r.pikkuFuncId,r.pikkuFuncId,r),children:r.pikkuFuncId})]}),r.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mb:4,children:r.description}),r.positionals&&r.positionals.length>0&&(0,A.jsx)(Sf,{gap:6,mb:4,children:r.positionals.map(e=>(0,A.jsxs)(eS,{type:`label`,size:`sm`,variant:`outline`,color:e.required?`red`:`gray`,children:[e.variadic?`...${e.name}`:e.name,e.required?`*`:``]},e.name))}),r.options&&Object.keys(r.options).length>0&&(0,A.jsx)(jB,{options:r.options}),r.subcommands&&Object.keys(r.subcommands).length>0&&(0,A.jsx)(MB,{commands:r.subcommands,depth:t+1})]},e))})};const mHe=({wireId:e,metadata:t={}})=>{let n=t?.program||e,r=t?.commands,i=t?.options;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ib,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:n})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`cli`}),t?.defaultRenderName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`format`,value:t.defaultRenderName})]}),(0,A.jsxs)(vA,{description:t?.description,children:[i&&Object.keys(i).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Global Options`}),(0,A.jsx)(jB,{options:i})]}),r&&Object.keys(r).length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Commands`}),(0,A.jsx)(MB,{commands:r})]})]})]})},hHe=({wireId:e,metadata:t={}})=>{let n=t?.method||`unknown`,r=t?.middleware||[],i=t?.permissions||[],a=t?.arguments;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(lb,{size:20}),(0,A.jsx)(eS,{type:`mcpType`,value:n,variant:`filled`}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),t?.uri&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`URI`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.uri})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:r,permissions:i,tags:t?.tags||[],errors:t?.errors||[],inputSchemaName:t?.inputSchemaName,outputSchemaName:t?.outputSchemaName,children:a&&a.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Arguments`}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Name`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Description`}),(0,A.jsx)(eg.Th,{c:`dimmed`,fw:500,fz:`xs`,children:`Required`})]})}),(0,A.jsx)(eg.Tbody,{children:a.map(e=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:e.name})}),(0,A.jsx)(eg.Td,{children:(0,A.jsx)(N,{size:`sm`,children:e.description||``})}),(0,A.jsx)(eg.Td,{children:e.required&&(0,A.jsx)(eS,{type:`flag`,flag:`required`})})]},e.name))})]})]})})]})},gHe=({wireId:e,metadata:t={}})=>{let n=t?.middleware||[],r=t?.permissions||[];return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ub,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`trigger`}),r.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId,middleware:n,permissions:r,tags:t?.tags||[],errors:t?.errors||[]})]})},_He=({wireId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ub,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`triggerSource`}),t?.packageName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.packageName})]}),(0,A.jsx)(vA,{description:t?.description,pikkuFuncId:t?.pikkuFuncId})]});var vHe=({defId:e,def:t})=>{let{meta:n}=R(),r=n.middlewareGroupsMeta?.instances||{},i=n.middlewareGroupsMeta?.httpGroups||{},a=n.middlewareGroupsMeta?.tagGroups||{},o=Object.entries(r).filter(([,t])=>t.definitionId===e),s=new Set(o.map(([e])=>e)),c=[];for(let[e,t]of Object.entries(i))t.instanceIds?.some(e=>s.has(e))&&c.push({type:`http`,key:e,group:t});for(let[e,t]of Object.entries(a))t.instanceIds?.some(e=>s.has(e))&&c.push({type:`tag`,key:e,group:t});return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(hb,{size:20}),(0,A.jsx)(N,{size:`lg`,fw:600,children:t.name||t.exportedName||e})]}),t.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsxs)(Sf,{gap:4,children:[t.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`}),t.exportedName===null&&(0,A.jsx)(eS,{type:`flag`,flag:`local`}),t.exportedName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`exportedName`,value:t.exportedName}),t.package&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.package})]}),t.services?.services?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Services`}),(0,A.jsx)(Sf,{gap:4,children:t.services.services.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`service`,value:e},e))})]}),t.wires&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wires`}),t.wires.wires?.length>0?(0,A.jsxs)(Sf,{gap:4,children:[t.wires.wires.some(e=>[`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e))&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),t.wires.wires.filter(e=>![`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e)).map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e))]}):(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`None`})]}),o.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kp,{}),(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Instances (`,o.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`ID`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:o.map(([e,t])=>(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:e}),(0,A.jsx)(eg.Td,{children:t.isFactoryCall&&(0,A.jsx)(eS,{type:`flag`,flag:`factoryCall`})})]},e))})]})]})]}),c.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Used in Groups`}),(0,A.jsx)(Sf,{gap:4,children:c.map(e=>(0,A.jsx)(eS,{type:`label`,color:e.type===`http`?`blue`:`green`,leftSection:(0,A.jsx)(hb,{size:10}),children:e.type===`http`?`HTTP ${e.key}`:`Tag: ${e.key}`},`${e.type}::${e.key}`))})]})]})},yHe=({groupType:e,groupKey:t})=>{let{meta:n}=R(),{openMiddleware:r}=_x(),i=(e===`http`?n.middlewareGroupsMeta?.httpGroups||{}:n.middlewareGroupsMeta?.tagGroups||{})[t],a=n.middlewareGroupsMeta?.instances||{},o=n.middlewareGroupsMeta?.definitions||{},s=[],c=new Set;for(let e of i?.instanceIds||[]){let t=a[e];t?.definitionId&&!c.has(t.definitionId)&&(c.add(t.definitionId),s.push({defId:t.definitionId,def:o[t.definitionId],instanceId:e,instance:t}))}return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsx)(eS,{type:`label`,color:e===`http`?`blue`:`green`,children:e===`http`?`HTTP ${t}`:`Tag: ${t}`})}),i?.exportName&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Export`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:i.exportName})]}),s.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Middleware (`,s.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`Definition`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:s.map(({defId:e,def:t,instance:n})=>(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onClick:()=>r(e,{...t,_id:e}),children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:t?.name||t?.exportedName||e}),(0,A.jsx)(eg.Td,{children:(0,A.jsxs)(Sf,{gap:4,children:[n?.isFactoryCall&&(0,A.jsx)(eS,{type:`flag`,flag:`factoryCall`}),t?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})]})})]},e))})]})]})]})};const NB=({middlewareId:e,metadata:t={}})=>t._groupType?(0,A.jsx)(yHe,{groupType:t._groupType,groupKey:t._groupKey}):(0,A.jsx)(vHe,{defId:t._id||e,def:t});var PB=({defId:e,def:t})=>{let{meta:n}=R(),r=n.permissionsGroupsMeta?.httpGroups||{},i=n.permissionsGroupsMeta?.tagGroups||{},a=[];for(let[t,n]of Object.entries(r))n.instanceIds?.includes(e)&&a.push({type:`http`,key:t,group:n});for(let[t,n]of Object.entries(i))n.instanceIds?.includes(e)&&a.push({type:`tag`,key:t,group:n});return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Pb,{size:20}),(0,A.jsx)(N,{size:`lg`,fw:600,children:t.name||t.exportedName||e})]}),t.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsxs)(Sf,{gap:4,children:[t.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`}),t.exportedName===null&&(0,A.jsx)(eS,{type:`flag`,flag:`local`}),t.exportedName&&(0,A.jsx)(eS,{type:`dynamic`,badge:`exportedName`,value:t.exportedName}),t.package&&(0,A.jsx)(eS,{type:`dynamic`,badge:`package`,value:t.package})]}),t.services?.services?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Services`}),(0,A.jsx)(Sf,{gap:4,children:t.services.services.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`service`,value:e},e))})]}),t.wires&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Wires`}),t.wires.wires?.length>0?(0,A.jsxs)(Sf,{gap:4,children:[t.wires.wires.some(e=>[`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e))&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),t.wires.wires.filter(e=>![`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`].includes(e)).map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e))]}):(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`None`})]}),a.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kp,{}),(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Used in Groups`}),(0,A.jsx)(Sf,{gap:4,children:a.map(e=>(0,A.jsx)(eS,{type:`label`,color:e.type===`http`?`blue`:`green`,leftSection:(0,A.jsx)(hb,{size:10}),children:e.type===`http`?`HTTP ${e.key}`:`Tag: ${e.key}`},`${e.type}::${e.key}`))})]})]})]})},FB=({groupType:e,groupKey:t})=>{let{meta:n}=R(),{openPermission:r}=_x(),i=(e===`http`?n.permissionsGroupsMeta?.httpGroups||{}:n.permissionsGroupsMeta?.tagGroups||{})[t],a=n.permissionsGroupsMeta?.definitions||{},o=[],s=new Set;for(let e of i?.instanceIds||[])!s.has(e)&&a[e]&&(s.add(e),o.push({defId:e,def:a[e]}));return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(j,{children:(0,A.jsx)(eS,{type:`label`,color:e===`http`?`blue`:`green`,children:e===`http`?`HTTP ${t}`:`Tag: ${t}`})}),i?.exportName&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Export`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:i.exportName})]}),o.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Permissions (`,o.length,`)`]}),(0,A.jsxs)(eg,{verticalSpacing:4,horizontalSpacing:`xs`,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsxs)(eg.Tr,{children:[(0,A.jsx)(eg.Th,{children:`Definition`}),(0,A.jsx)(eg.Th,{children:`Type`})]})}),(0,A.jsx)(eg.Tbody,{children:o.map(({defId:e,def:t})=>(0,A.jsxs)(eg.Tr,{className:fx.clickableText,onClick:()=>r(e,{...t,_id:e}),children:[(0,A.jsx)(eg.Td,{ff:`monospace`,fz:`sm`,children:t?.name||t?.exportedName||e}),(0,A.jsx)(eg.Td,{children:t?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})})]},e))})]})]})]})};const bHe=({permissionId:e,metadata:t={}})=>t._groupType?(0,A.jsx)(FB,{groupType:t._groupType,groupKey:t._groupKey}):(0,A.jsx)(PB,{defId:t._id||e,def:t});function xHe(e,t=!0){let n=By();return Rr({queryKey:[`agent-threads`,e],queryFn:async()=>await n.invoke(`console:getAgentThreads`,{agentName:e,limit:50,offset:0}),enabled:!!e,refetchInterval:t?5e3:!1})}function SHe(e,t=!0){let n=By();return Rr({queryKey:[`agent-thread-messages`,e],queryFn:async()=>await n.invoke(`console:getAgentThreadMessages`,{threadId:e}),enabled:!!e,refetchInterval:t?5e3:!1})}function IB(){let e=By(),t=Dr();return zr({mutationFn:async t=>await e.invoke(`console:deleteAgentThread`,{threadId:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`agent-threads`]})}})}const CHe=(0,D.createContext)(void 0),wHe=()=>{let e=(0,D.useContext)(CHe);if(!e)throw Error(`useAgentPlayground must be used within AgentPlaygroundProvider`);return e};var THe=e=>({id:e.id,status:`completed`,createdAt:e.createdAt,label:e.title||e.id.slice(0,8)});const LB=({children:e,agentId:t})=>{let[n,r]=Gy(),[i,a]=(0,D.useState)(n.get(`threadId`)),[o,s]=(0,D.useState)(),[c,l]=(0,D.useState)(),{data:u,refetch:d}=xHe(t),{data:f}=SHe(i),p=(u||[]).map(THe),m=(0,D.useCallback)(e=>{a(e),r(t=>{let n=new URLSearchParams(t);return e?n.set(`threadId`,e):n.delete(`threadId`),n},{replace:!0})},[r]);(0,D.useEffect)(()=>{let e=n.get(`threadId`);e!==i&&a(e)},[n]);let h=(0,D.useCallback)(()=>{m(crypto.randomUUID())},[m]);return(0,A.jsx)(CHe.Provider,{value:{agentId:t,threadId:i,setThreadId:m,threads:p,createNewThread:h,refetchThreads:()=>{d()},dbMessages:f,model:o,setModel:s,temperature:c,setTemperature:l},children:e})};function RB(){let e=By();return Rr({queryKey:[`addon-functions`],queryFn:async()=>{let t=await e.invoke(`console:getInstalledAddons`),n=[];return await Promise.all(t.filter(e=>e.namespace!==`console`).map(async t=>{try{let r=(await e.invoke(`console:getAddonInstalledPackage`,{packageName:t.packageName}))?.functions||{};for(let e of Object.keys(r))n.push({namespace:t.namespace,funcId:`${t.namespace}:${e}`})}catch{}})),n}})}const EHe=({wireId:e,sourceFile:t,exportedName:n,metadata:r,onClose:i})=>{let{data:a,isLoading:o}=sA(t,n,!0),s=cA(),{meta:c}=R(),{data:l}=RB(),u=_B(),[d,f]=(0,D.useState)(``),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)(``),[_,v]=(0,D.useState)(``),[y,b]=(0,D.useState)(null),[x,S]=(0,D.useState)(``),[C,w]=(0,D.useState)(``),[T,E]=(0,D.useState)(null),[O,k]=(0,D.useState)([]),[ee,te]=(0,D.useState)([]),[ne,re]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(a){let e=a.config||{};f(e.description||``),m(e.role||``),g(e.personality||``),v(e.goal||``),b(e.model||null),S(typeof e.maxSteps==`number`?e.maxSteps:``),w(typeof e.temperature==`number`?e.temperature:``),E(e.toolChoice||null),k(r?.tools||[]),te(r?.tags||[])}},[a]);let ie=async()=>{let e=a?.config||{},o={};d!==(e.description||``)&&(o.description=d||null),p!==(e.role||``)&&(o.role=p||null),h!==(e.personality||``)&&(o.personality=h||null),_!==(e.goal||``)&&(o.goal=_||null),y!==(e.model||null)&&(o.model=y||void 0),x!==(typeof e.maxSteps==`number`?e.maxSteps:``)&&(o.maxSteps=typeof x==`number`?x:null),C!==(typeof e.temperature==`number`?e.temperature:``)&&(o.temperature=typeof C==`number`?C:null),T!==(e.toolChoice||null)&&(o.toolChoice=T||null);let c=r?.tools||[];JSON.stringify(O)!==JSON.stringify(c)&&(o.tools=O.length>0?O:null);let l=r?.tags||[];if(JSON.stringify(ee)!==JSON.stringify(l)&&(o.tags=ee.length>0?ee:null),Object.keys(o).length===0){i();return}try{await s.mutateAsync({sourceFile:t,exportedName:n,changes:o}),re(`Saved and rebuilt successfully`),setTimeout(()=>{re(null),i()},1500)}catch{}};if(o)return null;let ae=c.functions??[],oe={};for(let e of ae){if(e.functionType!==`user`)continue;let t=e.pikkuFuncId;oe.Local||=[],oe.Local.push(t)}for(let e of l??[])oe[e.namespace]||(oe[e.namespace]=[]),oe[e.namespace].push(e.funcId);let se=Object.entries(oe).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({group:e,items:t.sort()}));return(0,A.jsxs)(Bh,{gap:`md`,children:[ne&&(0,A.jsx)(If,{color:`green`,icon:(0,A.jsx)(rb,{size:16}),withCloseButton:!0,onClose:()=>re(null),children:ne}),s.error&&(0,A.jsx)(If,{color:`red`,icon:(0,A.jsx)(zb,{size:16}),children:s.error.message}),(0,A.jsx)(mA,{children:`Configuration`}),(0,A.jsx)(im,{label:`Description`,value:d,onChange:e=>f(e.currentTarget.value),autosize:!0,minRows:2,maxRows:4,size:`xs`}),(0,A.jsx)(ig,{label:`Model`,description:`Provider-qualified, e.g. openai/gpt-4o`,placeholder:`provider/model`,value:y??``,onChange:e=>b(e.currentTarget.value||null),size:`xs`}),(0,A.jsxs)(Sf,{grow:!0,gap:`xs`,wrap:`wrap`,children:[(0,A.jsx)(rh,{label:`Max Steps`,style:{minWidth:100},value:x,onChange:e=>S(typeof e==`number`?e:``),min:1,max:100,size:`xs`}),(0,A.jsx)(rh,{label:`Temperature`,style:{minWidth:100},value:C,onChange:e=>w(typeof e==`number`?e:``),min:0,max:2,step:.1,decimalScale:1,size:`xs`}),(0,A.jsx)(Th,{label:`Tool Choice`,style:{minWidth:120},data:[`auto`,`required`,`none`],value:T,onChange:E,clearable:!0,size:`xs`})]}),(0,A.jsx)(Sm,{label:`Tools`,data:se,value:O,onChange:k,searchable:!0,clearable:!0,size:`xs`,placeholder:`Search functions...`}),(0,A.jsx)(Sm,{label:`Tags`,data:u,value:ee,onChange:te,searchable:!0,clearable:!0,size:`xs`,placeholder:`Search tags...`}),(0,A.jsx)(mA,{children:`Role`}),(0,A.jsx)(im,{value:p,onChange:e=>m(e.currentTarget.value),placeholder:`Who the agent is -- role, expertise, domain context`,autosize:!0,minRows:2,maxRows:6,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsx)(mA,{children:`Personality`}),(0,A.jsx)(im,{value:h,onChange:e=>g(e.currentTarget.value),placeholder:`Defines how the agent behaves -- tone, style, constraints`,autosize:!0,minRows:3,maxRows:10,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsx)(mA,{children:`Goal`}),(0,A.jsx)(im,{value:_,onChange:e=>v(e.currentTarget.value),placeholder:`Defines what the agent is trying to accomplish`,autosize:!0,minRows:3,maxRows:10,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:i,disabled:s.isPending,leftSection:(0,A.jsx)(Hb,{size:14}),size:`xs`,children:`Cancel`}),(0,A.jsx)(Xf,{onClick:ie,loading:s.isPending,leftSection:(0,A.jsx)(jb,{size:14}),size:`xs`,children:`Save & Rebuild`})]})]})};var DHe=(0,D.createContext)(!0);function zB(){return(0,D.useContext)(DHe)}const OHe=({wireId:e,metadata:t={}})=>{let{navigateInPanel:n}=_x(),r=(0,D.useContext)(CHe),i=zB(),[a,o]=(0,D.useState)(!1),s=i&&!!t?.sourceFile&&!!t?.exportedName;if(a&&s)return(0,A.jsx)(EHe,{wireId:e,sourceFile:t.sourceFile,exportedName:t.exportedName,metadata:t,onClose:()=>o(!1)});let c=t?.middleware||[],l=t?.channelMiddleware||[],u=t?.aiMiddleware||[],d=t?.permissions||[],f=t?.tools||[],p=t?.agents||[],m=t?.memory;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Qy,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.name||e}),t?.model&&(0,A.jsx)(eS,{type:`dynamic`,badge:`model`,value:t.model})]}),s&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>o(!0),title:`Edit agent`,children:(0,A.jsx)(Tb,{size:14})})]}),t?.summary&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.summary})]}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`wiringType`,value:`agent`}),t?.maxSteps&&(0,A.jsx)(eS,{type:`dynamic`,badge:`maxSteps`,value:t.maxSteps,variant:`outline`,color:`gray`}),t?.toolChoice&&(0,A.jsx)(eS,{type:`dynamic`,badge:`toolChoice`,value:t.toolChoice,variant:`outline`,color:`gray`}),d.length>0&&(0,A.jsx)(eS,{type:`flag`,flag:`permissioned`})]}),r&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Playground Overrides`}),(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(ig,{size:`xs`,label:`Model${t?.model?` (default: ${t.model})`:``}`,placeholder:t?.model??`provider/model`,value:r.model??``,onChange:e=>r.setModel(e.currentTarget.value||void 0)}),(0,A.jsx)(rh,{size:`xs`,label:`Temperature${t?.temperature==null?``:` (default: ${t.temperature})`}`,placeholder:t?.temperature==null?`default`:String(t.temperature),value:r.temperature??``,onChange:e=>r.setTemperature(typeof e==`number`?e:void 0),min:0,max:2,step:.1,decimalScale:1})]})]}),(0,A.jsxs)(vA,{description:t?.description,middleware:c,permissions:d,tags:t?.tags,children:[t?.role&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Role`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.role})]}),t?.personality&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Personality`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.personality})]}),t?.goal&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Goal`}),(0,A.jsx)(N,{size:`md`,style:{whiteSpace:`pre-wrap`},children:t.goal})]}),f.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Tools (`,f.length,`)`]}),(0,A.jsx)(Sf,{gap:6,children:f.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`tool`,value:e,className:fx.clickableText,onClick:()=>n(`function`,e,e)},e))})]}),p.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsxs)(mA,{children:[`Sub-Agents (`,p.length,`)`]}),(0,A.jsx)(Sf,{gap:6,children:p.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`agent`,value:e,className:fx.clickableText,onClick:()=>n(`agent`,e,e)},e))})]}),l.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Channel Middleware`}),(0,A.jsx)(Sf,{gap:6,children:l.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),u.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`AI Middleware`}),(0,A.jsx)(Sf,{gap:6,children:u.map((e,t)=>(0,A.jsx)(fA,{item:e,kind:`middleware`},t))})]}),m&&(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Memory`}),(0,A.jsxs)(Sf,{gap:6,children:[m.storage&&(0,A.jsx)(eS,{type:`dynamic`,badge:`storage`,value:m.storage,variant:`outline`,color:`gray`}),m.lastMessages!==void 0&&(0,A.jsx)(eS,{type:`dynamic`,badge:`lastMessages`,value:m.lastMessages,variant:`outline`,color:`gray`})]})]}),(0,A.jsx)(_A,{label:`Input Schema`,schemaName:t?.inputSchema}),(0,A.jsx)(_A,{label:`Output Schema`,schemaName:t?.outputSchema}),(0,A.jsx)(_A,{label:`Working Memory Schema`,schemaName:t?.workingMemorySchema})]})]})};function kHe(e,t){let n=By();return Rr({queryKey:[`secret-value`,e],queryFn:async()=>await n.invoke(`pikkuConsoleGetSecret`,{secretId:e}),enabled:!!e&&t})}function AHe(){let e=By(),t=Dr();return zr({mutationFn:({secretId:t,value:n})=>e.invoke(`pikkuConsoleSetSecret`,{secretId:t,value:n}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`secret-value`,n.secretId]})}})}function jHe(e,t){let n=By();return Rr({queryKey:[`oauth-status`,e],queryFn:async()=>await n.invoke(`console:oauthStatus`,{credentialName:e}),enabled:!!e&&t})}function MHe(){let e=By();return zr({mutationFn:({credentialName:t,callbackUrl:n})=>e.invoke(`console:oauthConnect`,{credentialName:t,callbackUrl:n})})}function BB(){let e=By(),t=Dr();return zr({mutationFn:({credentialName:t})=>e.invoke(`console:oauthDisconnect`,{credentialName:t}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`oauth-status`,n.credentialName]})}})}function VB(){let e=By();return zr({mutationFn:({credentialName:t})=>e.invoke(`console:oauthTestToken`,{credentialName:t})})}var HB={type:`object`,properties:{clientId:{type:`string`,title:`Client ID`},clientSecret:{type:`string`,title:`Client Secret`}},required:[`clientId`]};const UB=({secretId:e,schemaName:t,isOAuth2:n})=>{let r=zB(),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(!1),[c,l]=(0,D.useState)(`form`),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(null),[m,h]=(0,D.useState)(null),{data:g,isLoading:_}=kHe(e,i),{data:v}=Zk(t),y=AHe(),b=v||(n?HB:void 0),x=!!b,S=g?.exists?g.value:null;if((0,D.useEffect)(()=>{g&&d(S==null?``:JSON.stringify(S,null,2))},[g,S]),!e)return null;let C=e=>{h(e),setTimeout(()=>h(null),3e3)},w=t=>{y.mutate({secretId:e,value:t},{onSuccess:()=>{C(`Secret saved successfully`),s(!1)}})},T=()=>{p(null);let t;try{t=JSON.parse(u)}catch{p(`Invalid JSON`);return}y.mutate({secretId:e,value:t},{onSuccess:()=>{C(`Secret saved successfully`),s(!1)}})};if(!i)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsx)(Xf,{variant:`light`,leftSection:(0,A.jsx)(Tfe,{size:16}),onClick:()=>a(!0),size:`sm`,children:`Retrieve secret value`})]});if(_)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsx)(mf,{size:`sm`})]});let E=x?c:`json`;return(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(mA,{children:`Secret Value`}),(0,A.jsxs)(Sf,{gap:`xs`,align:`center`,children:[!o&&r&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>s(!0),title:`Edit secret value`,children:(0,A.jsx)(Tb,{size:14})}),x&&(0,A.jsx)(wh,{value:E,onChange:l,data:[{label:`Form`,value:`form`},{label:`JSON`,value:`json`}],size:`sm`,style:{width:`auto`}})]})]}),m&&(0,A.jsx)(If,{icon:(0,A.jsx)(rb,{size:16}),color:`green`,variant:`light`,children:m}),y.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to save secret`}),!g?.exists&&!o&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No value set yet.`}),o?(0,A.jsx)(Bh,{gap:`sm`,children:E===`form`&&x?(0,A.jsx)(Vk,{schema:b,onSubmit:w,submitting:y.isPending,submitLabel:`Save`,initialData:S??void 0,children:(0,A.jsxs)(Sf,{mt:`sm`,gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>s(!1),children:`Cancel`}),(0,A.jsx)(Xf,{type:`submit`,leftSection:(0,A.jsx)(jb,{size:16}),loading:y.isPending,children:`Save`})]})}):(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(im,{value:u,onChange:e=>{d(e.currentTarget.value),p(null)},placeholder:`{"key": "value"}`,autosize:!0,minRows:4,maxRows:12,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),f&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:f}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>s(!1),children:`Cancel`}),(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(jb,{size:16}),loading:y.isPending,onClick:T,children:`Save`})]})]})}):(0,A.jsx)(Bh,{gap:`xs`,children:g?.exists&&(E===`form`&&x?(0,A.jsx)(j,{style:{pointerEvents:`none`,opacity:.8},children:(0,A.jsx)(Vk,{schema:b,onSubmit:()=>{},initialData:S??void 0,children:(0,A.jsx)(A.Fragment,{})})}):(0,A.jsx)(tp,{block:!0,style:{whiteSpace:`pre-wrap`,maxHeight:300,overflow:`auto`},children:JSON.stringify(S,null,2)}))})]})};function NHe(e,t){let n=By();return Rr({queryKey:[`variable-value`,e],queryFn:async()=>await n.invoke(`pikkuConsoleGetVariable`,{variableId:e}),enabled:!!e&&t})}function PHe(){let e=By(),t=Dr();return zr({mutationFn:({variableId:t,value:n})=>e.invoke(`pikkuConsoleSetVariable`,{variableId:t,value:n}),onSuccess:(e,n)=>{t.invalidateQueries({queryKey:[`variable-value`,n.variableId]})}})}const FHe=({variableId:e,schemaName:t})=>{let n=zB(),[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(`form`),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(null),{data:h,isLoading:g}=NHe(e,r),{data:_}=Zk(t),v=PHe(),y=!!_,b=h?.exists?h.value:null;if((0,D.useEffect)(()=>{h&&u(b==null?``:JSON.stringify(b,null,2))},[h,b]),!e)return null;let x=e=>{m(e),setTimeout(()=>m(null),3e3)},S=t=>{v.mutate({variableId:e,value:t},{onSuccess:()=>{x(`Variable saved successfully`),o(!1)}})},C=()=>{f(null);let t;try{t=JSON.parse(l)}catch{f(`Invalid JSON`);return}v.mutate({variableId:e,value:t},{onSuccess:()=>{x(`Variable saved successfully`),o(!1)}})};if(!r)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsx)(Xf,{variant:`light`,leftSection:(0,A.jsx)(Tfe,{size:16}),onClick:()=>i(!0),size:`sm`,children:`Retrieve variable value`})]});if(g)return(0,A.jsxs)(j,{children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsx)(mf,{size:`sm`})]});let w=y?s:`json`;return(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(mA,{children:`Variable Value`}),(0,A.jsxs)(Sf,{gap:`xs`,align:`center`,children:[!a&&n&&(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,onClick:()=>o(!0),title:`Edit variable value`,children:(0,A.jsx)(Tb,{size:14})}),y&&(0,A.jsx)(wh,{value:w,onChange:c,data:[{label:`Form`,value:`form`},{label:`JSON`,value:`json`}],size:`sm`,style:{width:`auto`}})]})]}),p&&(0,A.jsx)(If,{icon:(0,A.jsx)(rb,{size:16}),color:`green`,variant:`light`,children:p}),v.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to save variable`}),!h?.exists&&!a&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No value set yet.`}),a?(0,A.jsx)(Bh,{gap:`sm`,children:w===`form`&&y?(0,A.jsx)(Vk,{schema:_,onSubmit:S,submitting:v.isPending,submitLabel:`Save`,initialData:b??void 0,children:(0,A.jsxs)(Sf,{mt:`sm`,gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>o(!1),children:`Cancel`}),(0,A.jsx)(Xf,{type:`submit`,leftSection:(0,A.jsx)(jb,{size:16}),loading:v.isPending,children:`Save`})]})}):(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(im,{value:l,onChange:e=>{u(e.currentTarget.value),f(null)},placeholder:`{"key": "value"}`,autosize:!0,minRows:4,maxRows:12,styles:{input:{fontFamily:`monospace`,fontSize:`13px`}}}),d&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:d}),(0,A.jsxs)(Sf,{gap:`xs`,justify:`flex-end`,children:[(0,A.jsx)(Xf,{variant:`subtle`,onClick:()=>o(!1),children:`Cancel`}),(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(jb,{size:16}),loading:v.isPending,onClick:C,children:`Save`})]})]})}):(0,A.jsx)(Bh,{gap:`xs`,children:h?.exists&&(w===`form`&&y?(0,A.jsx)(j,{style:{pointerEvents:`none`,opacity:.8},children:(0,A.jsx)(Vk,{schema:_,onSubmit:()=>{},initialData:b??void 0,children:(0,A.jsx)(A.Fragment,{})})}):(0,A.jsx)(tp,{block:!0,style:{whiteSpace:`pre-wrap`,maxHeight:300,overflow:`auto`},children:JSON.stringify(b,null,2)}))})]})},IHe=({secretId:e,metadata:t={}})=>{let n=!!t?.oauth2;return(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(mb,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.displayName||e})]}),t?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsx)(Sf,{gap:`xs`,children:n?(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`OAuth2`}):(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Secret`})}),(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Secret ID`}),(0,A.jsx)(tp,{children:t?.secretId})]}),n&&(0,A.jsxs)(A.Fragment,{children:[t.oauth2.tokenSecretId&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Token Secret ID`}),(0,A.jsx)(tp,{children:t.oauth2.tokenSecretId})]}),t.oauth2.authorizationUrl&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Authorization URL`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.oauth2.authorizationUrl})]}),t.oauth2.tokenUrl&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Token URL`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,children:t.oauth2.tokenUrl})]}),t.oauth2.scopes?.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Scopes`}),(0,A.jsx)(Sf,{gap:6,children:t.oauth2.scopes.map(e=>(0,A.jsx)(eS,{type:`label`,color:`gray`,children:e},e))})]})]}),(0,A.jsx)(_A,{label:`Fields`,schemaName:t?.schema}),t?.installed!==!1&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(UB,{secretId:t?.secretId,schemaName:t?.schema,isOAuth2:n}),n&&(0,A.jsx)(LHe,{credentialName:t.name})]})]})};var LHe=({credentialName:e})=>{let t=Dr(),n=(0,D.useRef)(null),{data:r,isLoading:i}=jHe(e,!0),a=MHe(),o=BB(),s=VB(),c=(0,D.useCallback)(n=>{n.data?.type===`oauth-callback-success`&&(t.invalidateQueries({queryKey:[`oauth-status`,e]}),window.removeEventListener(`message`,c))},[e,t]),l=(0,D.useCallback)(()=>{let t=`${window.location.origin}/oauth/callback`;a.mutate({credentialName:e,callbackUrl:t},{onSuccess:e=>{window.addEventListener(`message`,c),n.current=window.open(e.authUrl,`oauth-popup`,`width=600,height=700,popup=yes`)}})},[e,a,c]),u=(0,D.useCallback)(()=>{o.mutate({credentialName:e})},[e,o]),d=(0,D.useCallback)(()=>{s.mutate({credentialName:e})},[e,s]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`OAuth2 Connection`}),(0,A.jsxs)(Bh,{gap:`sm`,children:[i?(0,A.jsx)(mf,{size:`sm`}):r?.connected?(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(eS,{type:`label`,color:`green`,children:`Connected`}),r.hasRefreshToken&&(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Has Refresh Token`})]}),r.expiresAt&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:r.isExpired?`Token expired at ${new Date(r.expiresAt).toLocaleString()}`:`Token expires at ${new Date(r.expiresAt).toLocaleString()}`})]}):(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`Not Connected`}),a.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to start OAuth flow`}),o.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to disconnect`}),s.isSuccess&&(0,A.jsx)(If,{icon:s.data?.valid?(0,A.jsx)(rb,{size:16}):(0,A.jsx)(zb,{size:16}),color:s.data?.valid?`green`:`red`,variant:`light`,children:s.data?.valid?`Token is valid`:`Token invalid: ${s.data?.error||`unknown error`}`}),s.isError&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`red`,variant:`light`,children:`Failed to test token`}),(0,A.jsx)(Sf,{gap:`xs`,children:r?.connected?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Xf,{variant:`default`,size:`sm`,leftSection:(0,A.jsx)(Hfe,{size:14}),loading:s.isPending,onClick:d,children:`Test Token`}),(0,A.jsx)(Xf,{variant:`light`,color:`red`,size:`sm`,leftSection:(0,A.jsx)(Gfe,{size:14}),loading:o.isPending,onClick:u,children:`Disconnect`})]}):(0,A.jsx)(Xf,{variant:`light`,color:`green`,size:`sm`,leftSection:(0,A.jsx)(_b,{size:14}),loading:a.isPending,onClick:l,children:`Connect`})})]})]})};const RHe=({variableId:e,metadata:t={}})=>(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsxs)(j,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Bfe,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,fw:600,children:t?.displayName||e})]}),t?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,mt:4,children:t.description})]}),(0,A.jsx)(Sf,{gap:`xs`,children:(0,A.jsx)(eS,{type:`label`,color:`teal`,children:`Variable`})}),(0,A.jsxs)(j,{children:[(0,A.jsx)(gA,{children:`Variable ID`}),(0,A.jsx)(tp,{children:t?.variableId})]}),(0,A.jsx)(_A,{label:`Fields`,schemaName:t?.schema}),t?.installed!==!1&&(0,A.jsx)(FHe,{variableId:t?.variableId,schemaName:t?.schema})]}),zHe=({userId:e,metadata:t})=>{let n=By(),r=Dr(),i=t?.credentialsMeta??[],a=t?.credentials??{},o=i.filter(e=>a[e.name]),s=i.filter(e=>!a[e.name]),c=zr({mutationFn:async t=>{await n.invoke(`console:credentialDelete`,{name:t,userId:e})},onSuccess:()=>{r.invalidateQueries({queryKey:[`credential-list-users`]})}}),l=zr({mutationFn:async t=>{let r=await n.invoke(`console:oauthConnect`,{credentialName:t,userId:e});window.open(r.authUrl,`oauth-connect`,`width=600,height=700`)||(window.location.href=r.authUrl)}});return(0,A.jsxs)(Bh,{gap:`md`,pt:`md`,children:[(0,A.jsxs)(Jf,{size:`sm`,variant:`light`,color:o.length>0?`teal`:`gray`,children:[o.length,` of `,i.length,` credentials connected`]}),o.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:`xs`,children:`Connected`}),(0,A.jsx)(Bh,{gap:`xs`,children:o.map(e=>(0,A.jsxs)(Sf,{justify:`space-between`,p:`xs`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`},children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[e.isOAuth2?(0,A.jsx)(gb,{size:14,color:`var(--mantine-color-dimmed)`}):(0,A.jsx)(mb,{size:14,color:`var(--mantine-color-dimmed)`}),(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:e.displayName}),(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:e.isOAuth2?`violet`:`blue`,children:e.isOAuth2?`OAuth2`:`API Key`})]})]}),(0,A.jsx)(Xf,{size:`compact-xs`,variant:`subtle`,color:`red`,leftSection:(0,A.jsx)(Rb,{size:12}),onClick:()=>c.mutate(e.name),loading:c.isPending,children:`Revoke`})]},e.name))})]}),s.length>0&&(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:`xs`,c:`dimmed`,children:`Not Connected`}),(0,A.jsx)(Bh,{gap:`xs`,children:s.map(e=>(0,A.jsxs)(Sf,{justify:`space-between`,p:`xs`,style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,opacity:.7},children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[e.isOAuth2?(0,A.jsx)(gb,{size:14,color:`var(--mantine-color-dimmed)`}):(0,A.jsx)(mb,{size:14,color:`var(--mantine-color-dimmed)`}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.displayName})]}),e.isOAuth2&&(0,A.jsx)(Xf,{size:`compact-xs`,variant:`light`,leftSection:(0,A.jsx)(gb,{size:12}),onClick:()=>l.mutate(e.name),loading:l.isPending,children:`Connect`})]},e.name))})]}),o.length===0&&!s.some(e=>e.isOAuth2)&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`This user hasn't connected any credentials yet.`}),(c.isError||l.isError)&&(0,A.jsx)(If,{color:`red`,variant:`light`,icon:(0,A.jsx)(zb,{size:14}),children:String(c.error?.message||l.error?.message||`An error occurred`)})]})};var BHe=({stepId:e,metadata:t})=>{let n=Wk(),r=qk(e),i=!!n?.selectedRunId,a=t?.stepType,o=a===`trigger`,s=[`branch`,`switch`,`parallel`,`fanout`,`filter`,`arrayPredicate`].includes(a)?(0,A.jsx)(ZVe,{stepId:e}):a===`return`?(0,A.jsx)(XVe,{stepId:e,showOutputs:!0}):(0,A.jsxs)(Bh,{gap:`xl`,children:[!o&&(0,A.jsx)(JVe,{stepId:e}),(0,A.jsx)(XVe,{stepId:e}),(0,A.jsx)(qVe,{stepId:e})]}),c=(0,A.jsxs)(Bh,{gap:`xl`,children:[(0,A.jsx)(wB,{stepId:e}),(0,A.jsx)(QVe,{stepId:e}),(0,A.jsx)($Ve,{stepId:e}),(0,A.jsx)(TB,{stepId:e}),(0,A.jsx)(EB,{stepId:e})]});return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,children:[(0,A.jsx)(db,{size:20}),(0,A.jsx)(N,{size:`lg`,ff:`monospace`,children:r?.stepName||r?.nodeId||e}),(0,A.jsx)(eS,{type:`label`,color:`gray`,children:a})]}),(0,A.jsxs)(rg,{defaultValue:i?`run`:`overview`,children:[(0,A.jsxs)(rg.List,{grow:!0,children:[(0,A.jsx)(rg.Tab,{value:`overview`,children:`Overview`}),(0,A.jsx)(rg.Tab,{value:`run`,disabled:!i,children:`Run`})]}),(0,A.jsx)(rg.Panel,{value:`overview`,pt:`md`,px:`md`,children:s}),(0,A.jsx)(rg.Panel,{value:`run`,pt:`md`,px:`md`,children:c})]},i?`with-run`:`no-run`)]})},VHe=({workflowId:e})=>{let t=Wk(),n=DAe(),{schema:r,isLoading:i}=LAe(),a=(0,D.useCallback)(r=>{n.mutate({workflowName:e,input:r},{onSuccess:e=>{e?.runId&&t?.setSelectedRunId(e.runId),t?.setIsCreatingRun(!1)}})},[e,n,t]);return(0,A.jsxs)(Bh,{gap:`md`,children:[i?(0,A.jsx)(mf,{size:`sm`}):r?(0,A.jsx)(Vk,{schema:r,onSubmit:a,submitting:n.isPending}):(0,A.jsx)(Sf,{justify:`flex-end`,children:(0,A.jsx)(Xf,{leftSection:(0,A.jsx)(Eb,{size:16}),onClick:()=>a({}),loading:n.isPending,children:`Run`})}),n.isError&&(0,A.jsx)(N,{size:`sm`,c:`red`,children:typeof n.error?.message==`string`?n.error.message:JSON.stringify(n.error?.message??n.error,null,2)||`Failed to start workflow`})]})},HHe=({workflowId:e})=>{let t=Wk(),n=!!t?.selectedRunId,r=!!t?.isCreatingRun,i=`${r?`creating`:``}${n?`with-run`:`no-run`}`;return(0,A.jsxs)(Bh,{gap:`md`,children:[(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(eHe,{workflowId:e})}),(0,A.jsxs)(rg,{defaultValue:`overview`,children:[(0,A.jsxs)(rg.List,{grow:!0,children:[(0,A.jsx)(rg.Tab,{value:`overview`,children:`Overview`}),(0,A.jsx)(rg.Tab,{value:`run`,children:n&&!r?`Run`:`New Run`})]}),(0,A.jsx)(rg.Panel,{value:`overview`,pt:`md`,px:`md`,children:(0,A.jsxs)(Bh,{gap:`xl`,children:[(0,A.jsx)(nHe,{workflowId:e}),(0,A.jsx)(OB,{workflowId:e}),(0,A.jsx)(rHe,{workflowId:e})]})}),(0,A.jsx)(rg.Panel,{value:`run`,pt:`md`,px:`md`,children:r?(0,A.jsx)(VHe,{workflowId:e}):n?(0,A.jsx)(sHe,{workflowId:e}):(0,A.jsx)(VHe,{workflowId:e})})]},i)]})};const UHe=e=>{switch(e.type){case`function`:return[{id:`configuration`,title:`Function`,content:(0,A.jsx)(HVe,{functionName:e.id,metadata:e.metadata})}];case`workflowStep`:return[{id:`step`,title:`Step`,content:(0,A.jsx)(BHe,{stepId:e.id,metadata:e.metadata})}];case`workflow`:return[{id:`workflow`,title:`Workflow`,content:(0,A.jsx)(HHe,{workflowId:e.id})}];case`http`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(uHe,{wireId:e.id,metadata:e.metadata})})}];case`channel`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(dHe,{wireId:e.id,metadata:e.metadata})})}];case`rpc`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(fHe,{wireId:e.id,metadata:e.metadata})})}];case`scheduler`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(AB,{wireId:e.id,metadata:e.metadata})})}];case`queue`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(pHe,{wireId:e.id,metadata:e.metadata})})}];case`cli`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(mHe,{wireId:e.id,metadata:e.metadata})})}];case`mcp`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(hHe,{wireId:e.id,metadata:e.metadata})})}];case`trigger`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(gHe,{wireId:e.id,metadata:e.metadata})})}];case`triggerSource`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(_He,{wireId:e.id,metadata:e.metadata})})}];case`middleware`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(NB,{middlewareId:e.id,metadata:e.metadata})})}];case`permission`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(bHe,{permissionId:e.id,metadata:e.metadata})})}];case`agent`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(OHe,{wireId:e.id,metadata:e.metadata})})}];case`secret`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(IHe,{secretId:e.id,metadata:e.metadata})})}];case`variable`:return[{id:`configuration`,title:`Configuration`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(RHe,{variableId:e.id,metadata:e.metadata})})}];case`credentialUser`:return[{id:`configuration`,title:`Credentials`,content:(0,A.jsx)(j,{px:`md`,children:(0,A.jsx)(zHe,{userId:e.id,metadata:e.metadata})})}];default:return[]}},WHe=({showTabs:e=!0,emptyMessage:t})=>{let{panels:n,activePanel:r,setActivePanel:i,closePanel:a,goBack:o,goBackTo:s}=_x(),c=Array.from(n.values()),l=r?n.get(r):null,u=(0,D.useMemo)(()=>l?UHe(l.data):[],[l]);return!e&&(c.length===0||u.length===0)?(0,A.jsx)(ep,{h:`100%`,p:`xl`,children:(0,A.jsx)(N,{c:`dimmed`,ta:`center`,children:t||`Select an item to view details`})}):c.length===0||u.length===0?null:(0,A.jsxs)(Bh,{gap:0,className:`${fx.flexColumn} ${fx.overflowHidden}`,children:[e&&(0,A.jsx)(j,{style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(Sf,{gap:0,wrap:`nowrap`,style:{overflowX:`auto`},children:c.map(e=>(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,px:`md`,py:`xs`,className:fx.noShrink,style:{cursor:`pointer`,borderLeft:`1px solid var(--mantine-color-default-border)`,borderRight:`1px solid var(--mantine-color-default-border)`,borderBottom:r===e.id?`2px solid var(--mantine-color-blue-6)`:`2px solid transparent`,backgroundColor:r===e.id?`var(--mantine-color-gray-1)`:`transparent`,transition:`all 0.2s`},onClick:()=>i(e.id),children:[(0,A.jsx)(N,{size:`sm`,fw:r===e.id?600:400,children:e.title}),(0,A.jsx)(bf,{size:`sm`,onClick:t=>{t.stopPropagation(),a(e.id)}})]},e.id))})}),l&&l.history.length>0&&(0,A.jsx)(j,{px:`md`,py:`xs`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,align:`center`,children:[(0,A.jsx)(Ud,{onClick:o,style:{display:`flex`,alignItems:`center`},children:(0,A.jsx)(bfe,{size:18,color:`var(--mantine-color-dimmed)`})}),l.history.map((e,t)=>(0,A.jsxs)(D.Fragment,{children:[(0,A.jsx)(Ud,{onClick:()=>s(t),children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,style:{whiteSpace:`nowrap`},children:e.title})}),(0,A.jsx)(nb,{size:14,color:`var(--mantine-color-dimmed)`})]},t)),(0,A.jsx)(N,{size:`sm`,fw:600,style:{whiteSpace:`nowrap`},children:l.title})]})}),(0,A.jsx)(j,{py:`md`,className:`${fx.flexGrow} ${fx.overflowAuto}`,children:(0,A.jsx)(Bh,{gap:`xl`,children:u.map(e=>(0,A.jsx)(j,{children:e.content},e.id))})})]})},WB=({children:e,header:t,minSize:n=267,emptyPanelMessage:r,showTabs:i=!1,hidePanel:a=!1})=>{let{panels:o}=_x(),s=!a&&o.size!==0;return(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[t,(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(0,A.jsxs)(Yx,{defaultSizes:[840,267],children:[(0,A.jsx)(Yx.Pane,{children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:e})}),s&&(0,A.jsx)(Yx.Pane,{minSize:n,maxSize:500,preferredSize:267,children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:(0,A.jsx)(WHe,{showTabs:i,emptyMessage:r})})})]},s?`with-panel`:`no-panel`)})]})},GHe=({icon:e,title:t,description:n,docsHref:r})=>(0,A.jsxs)(Bh,{align:`center`,justify:`center`,gap:`md`,className:fx.emptyState,py:`xl`,style:{minHeight:`60vh`},children:[(0,A.jsx)(e,{size:48,strokeWidth:1}),(0,A.jsx)(N,{size:`xl`,fw:600,children:t}),n&&(0,A.jsx)(N,{c:`dimmed`,ta:`center`,maw:500,children:n}),(0,A.jsx)(Xf,{component:`a`,href:r,target:`_blank`,rel:`noopener noreferrer`,variant:`default`,leftSection:(0,A.jsx)(ub,{size:16}),children:`Docs`})]}),GB=({icon:e,title:t,docsHref:n,data:r,columns:i,getKey:a,onRowClick:o,searchPlaceholder:s=`Search...`,searchFilter:c,emptyMessage:l=`No items found.`,emptyTitle:u,emptyDescription:d,loading:f=!1,description:p,headerRight:m})=>{let[h,g]=(0,D.useState)(``),_=(0,D.useMemo)(()=>{if(!h||!c)return r;let e=h.toLowerCase();return r.filter(t=>c(t,e))},[r,h,c]);return f?(0,A.jsx)(ep,{h:`100%`,children:(0,A.jsx)(mf,{})}):r.length===0?(0,A.jsx)(GHe,{icon:e,title:u||`No ${t} found`,description:d??`No ${t.toLowerCase()} exist yet.`,docsHref:n}):(0,A.jsxs)(Bh,{gap:0,className:fx.flexColumn,children:[p&&(0,A.jsx)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:p}),(0,A.jsxs)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,display:`flex`,gap:8,alignItems:`center`},children:[(0,A.jsx)(ig,{placeholder:s,leftSection:(0,A.jsx)(Mb,{size:16}),value:h,onChange:e=>g(e.target.value),className:fx.flexGrow}),m]}),_.length===0?(0,A.jsx)(j,{p:`xl`,children:(0,A.jsx)(N,{c:`dimmed`,ta:`center`,children:h?`No results found for "${h}"`:l})}):(0,A.jsx)(j,{style:{overflowX:`auto`},children:(0,A.jsxs)(eg,{highlightOnHover:!0,withRowBorders:!0,children:[(0,A.jsx)(eg.Thead,{children:(0,A.jsx)(eg.Tr,{children:i.map((e,t)=>(0,A.jsx)(eg.Th,{pl:t===0?`md`:void 0,pr:t===i.length-1?`md`:void 0,fw:600,fz:`xs`,style:e.width?{width:e.width}:void 0,children:e.header},e.key))})}),(0,A.jsx)(eg.Tbody,{children:_.map((e,t)=>(0,A.jsx)(eg.Tr,{className:fx.clickableText,style:{height:`3.75rem`},onClick:()=>o(e),children:i.map((n,r)=>(0,A.jsx)(eg.Td,{pl:r===0?`md`:void 0,pr:r===i.length-1?`md`:void 0,style:n.width?{width:n.width}:void 0,children:n.render(e,t)},n.key))},a(e,t)))})]})})]})};var KB={covered:`green`,partial:`yellow`,uncovered:`red`,unknown:`gray`};function KHe(e){return Array.isArray(e.tags)&&e.tags.includes(`pikku`)}var qHe=({functions:e,extraColumns:t=[],headerRight:n,testsByFunction:r})=>{let{openFunction:i}=_x(),{functionUsedBy:a}=R(),[o,s]=(0,D.useState)(!1),c=(0,D.useMemo)(()=>!!r||e.some(e=>!!e.tests),[e,r]);return(0,A.jsx)(GB,{title:`Functions`,icon:Fb,docsHref:`https://pikku.dev/docs/core-features/functions`,data:(0,D.useMemo)(()=>e.filter(e=>o||!KHe(e)),[e,o]),columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,width:320,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,ff:`monospace`,children:e.pikkuFuncName||e.pikkuFuncId}),(e.summary||e.description)&&(0,A.jsx)(N,{size:`xs`,c:`dimmed`,truncate:!0,children:e.summary||e.description})]})},{key:`version`,header:`VERSION`,width:80,render:e=>(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,children:e.version==null?`—`:`v${e.version}`})},{key:`type`,header:`TYPE`,width:140,render:e=>{let t=Zx[e.funcWrapper];return t?(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,tt:`none`,children:t.label}):null}},{key:`auth`,header:`AUTH`,width:60,render:e=>{let t=e.sessionless!==!0;return(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:t?`#86efac`:`var(--app-text-muted)`,children:t?`Auth`:`—`})}},{key:`wirings`,header:`WIRINGS`,width:80,render:e=>{let t=e.pikkuFuncName||e.pikkuFuncId,n=a.get(t),r=n?n.transports.length+n.jobs.length:0;return(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:r>0?`var(--app-service-color)`:`var(--app-text-muted)`,children:r>0?String(r):`—`})}},...c?[{key:`tests`,header:`TESTS`,width:180,render:e=>{let t=e.pikkuFuncName||e.pikkuFuncId,n=e.tests??r?.[t];if(!n)return(0,A.jsx)(Ud,{onClick:n=>{n.stopPropagation(),i(t,e)},children:(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,children:`unknown`})});let a=n.status,o=n.status===`covered`?`${n.coveredLines}/${n.totalLines}`:n.status===`unknown`?`unknown`:`${Math.round(n.ratio*100)}%`;return(0,A.jsx)(Ud,{onClick:r=>{r.stopPropagation(),i(t,{...e,tests:n})},style:{display:`block`,textAlign:`left`},children:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,children:[(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:KB[a],children:o}),(0,A.jsx)(N,{size:`xs`,c:`dimmed`,children:n.scenarios.length===0?`No tests`:`${n.scenarios.length} linked`})]})})}}]:[],...t.map(e=>({key:e.label,header:e.label.toUpperCase(),width:e.width,align:e.align,render:t=>e.render(t.pikkuFuncName||t.pikkuFuncId)}))],[a,t,c,i,r]),getKey:e=>e.pikkuFuncName||e.pikkuFuncId,onRowClick:e=>i(e.pikkuFuncName||e.pikkuFuncId,e),searchPlaceholder:`Search functions...`,searchFilter:(e,t)=>e.pikkuFuncId?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||!1,emptyMessage:`No functions found.`,headerRight:(0,A.jsxs)(Sf,{gap:`sm`,wrap:`nowrap`,children:[(0,A.jsx)(qh,{size:`sm`,label:`Show Pikku`,checked:o,onChange:e=>s(e.currentTarget.checked)}),n]})})};const JHe=({extraColumns:e,headerRight:t,testsByFunction:n})=>{let r=By(),{data:i,isLoading:a}=Rr({queryKey:[`functions-meta`],queryFn:()=>r.invoke(`console:getFunctionsMeta`)});return(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{emptyPanelMessage:`Select a function to view details`,hidePanel:a||!i||i.length===0,children:(0,A.jsx)(qHe,{functions:i??[],extraColumns:e,headerRight:t,testsByFunction:n})})})};var YHe=(0,D.createContext)(null);function XHe(){let e=(0,D.useContext)(YHe);if(!e)throw Error(`useConsoleNavigator must be used within a navigator provider`);return e}var ZHe={workflows:`/workflow`};const QHe=({children:e})=>{let[t]=Gy(),n=Uy();return(0,A.jsx)(YHe.Provider,{value:{workflowId:t.get(`id`),navigateTo:(e,t)=>{let r=ZHe[e];n(t?`${r}?id=${encodeURIComponent(t)}`:r)}},children:e})};var $He=[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(N,{fw:500,children:[e.name,e.source===`dynamic-workflow`&&(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`violet`,ml:8,children:`Dynamic`})]})},{key:`steps`,header:`STEPS`,align:`right`,render:e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`steps`,value:Object.keys(e.nodes||{}).length})}];const eUe=({workflows:e,aiWorkflows:t,extraColumns:n=[],headerRight:r,icon:i=db})=>{let[a,o]=(0,D.useState)(`all`),{navigateTo:s}=XHe(),c=(0,D.useMemo)(()=>{let n=e?Object.values(e):[];if(t){let e=new Set(n.map(e=>e.name));for(let r of t)e.has(r.workflowName)||n.push({name:r.workflowName,pikkuFuncId:r.workflowName,steps:[],source:`dynamic-workflow`,nodes:r.graph?.nodes})}return n.sort((e,t)=>(e.name||``).localeCompare(t.name||``))},[e,t]);return(0,A.jsx)(GB,{title:`Workflows`,icon:i,docsHref:`https://pikku.dev/docs/wiring/workflows`,data:(0,D.useMemo)(()=>a===`dsl`?c.filter(e=>e.dsl===!0):a===`graph`?c.filter(e=>e.dsl!==!0&&e.source!==`dynamic-workflow`):a===`dynamic-workflow`?c.filter(e=>e.source===`dynamic-workflow`):c,[c,a]),columns:[...$He,...n.map(e=>({key:e.label,header:e.label.toUpperCase(),width:e.width,render:t=>e.render(t.name)}))],getKey:e=>e.name,onRowClick:e=>s(`workflows`,e.name),searchPlaceholder:`Search workflows...`,searchFilter:(e,t)=>(e.name?.toLowerCase().includes(t)||e.pikkuFuncId?.toLowerCase().includes(t))??!1,emptyMessage:`No workflows found.`,headerRight:(0,A.jsxs)(Sf,{gap:4,children:[r,(0,A.jsx)(Ch,{label:`Workflows docs`,children:(0,A.jsx)(_f,{component:`a`,href:`https://pikku.dev/docs/wiring/workflows`,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})})};function qB(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=qB(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var tUe=s((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),nUe=s(((e,t)=>{t.exports=tUe()})),rUe=s((e=>{var t=g(),n=nUe();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),iUe=s(((e,t)=>{t.exports=rUe()})),aUe=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},oUe=e=>e?aUe(e):aUe,sUe=u(iUe(),1),{useDebugValue:cUe}=D.default,{useSyncExternalStoreWithSelector:JB}=sUe.default,lUe=e=>e;function uUe(e,t=lUe,n){let r=JB(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cUe(r),r}var YB=(e,t)=>{let n=oUe(e),r=(e,r=t)=>uUe(n,e,r);return Object.assign(r,n),r},dUe=(e,t)=>e?YB(e,t):YB;function XB(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 ZB={value:()=>{}};function fUe(){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 QB(n)}function QB(e){this._=e}function $B(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}})}QB.prototype=fUe.prototype={constructor:QB,on:function(e,t){var n=this._,r=$B(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=pUe(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]=mUe(n[i],e.name,t);else if(t==null)for(i in n)n[i]=mUe(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 QB(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 pUe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function mUe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ZB,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var eV=fUe,hUe={value:()=>{}};function gUe(){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 tV(n)}function tV(e){this._=e}function _Ue(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}})}tV.prototype=gUe.prototype={constructor:tV,on:function(e,t){var n=this._,r=_Ue(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=vUe(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]=yUe(n[i],e.name,t);else if(t==null)for(i in n)n[i]=yUe(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 tV(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 vUe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function yUe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=hUe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var bUe=gUe,xUe={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 SUe(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),xUe.hasOwnProperty(t)?{space:xUe[t],local:e}:e}function CUe(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 nV(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rV(e){var t=SUe(e);return(t.local?nV:CUe)(t)}function wUe(){}function iV(e){return e==null?wUe:function(){return this.querySelector(e)}}function TUe(e){typeof e!=`function`&&(e=iV(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 jV(r,this._parents)}function aV(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function EUe(){return[]}function oV(e){return e==null?EUe:function(){return this.querySelectorAll(e)}}function sV(e){return function(){return aV(e.apply(this,arguments))}}function DUe(e){e=typeof e==`function`?sV(e):oV(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 jV(r,i)}function OUe(e){return function(){return this.matches(e)}}function kUe(e){return function(t){return t.matches(e)}}var AUe=Array.prototype.find;function jUe(e){return function(){return AUe.call(this.children,e)}}function cV(){return this.firstElementChild}function lV(e){return this.select(e==null?cV:jUe(typeof e==`function`?e:kUe(e)))}var MUe=Array.prototype.filter;function NUe(){return Array.from(this.children)}function PUe(e){return function(){return MUe.call(this.children,e)}}function FUe(e){return this.selectAll(e==null?NUe:PUe(typeof e==`function`?e:kUe(e)))}function IUe(e){typeof e!=`function`&&(e=OUe(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 jV(r,this._parents)}function LUe(e){return Array(e.length)}function RUe(){return new jV(this._enter||this._groups.map(LUe),this._parents)}function uV(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}uV.prototype={constructor:uV,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 dV(e){return function(){return e}}function fV(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 uV(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function pV(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 uV(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function zUe(e){return e.__data__}function mV(e,t){if(!arguments.length)return Array.from(this,zUe);var n=t?pV:fV,r=this._parents,i=this._groups;typeof e!=`function`&&(e=dV(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=hV(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 jV(o,r),o._enter=s,o._exit=c,o}function hV(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function BUe(){return new jV(this._exit||this._groups.map(LUe),this._parents)}function VUe(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 HUe(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 jV(s,this._parents)}function UUe(){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 WUe(e){e||=GUe;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 jV(i,this._parents).order()}function GUe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function KUe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qUe(){return Array.from(this)}function gV(){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 JUe(){let e=0;for(let t of this)++e;return e}function _V(){return!this.node()}function YUe(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 XUe(e){return function(){this.removeAttribute(e)}}function ZUe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function QUe(e,t){return function(){this.setAttribute(e,t)}}function $Ue(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function eWe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function vV(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 tWe(e,t){var n=SUe(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?ZUe:XUe:typeof t==`function`?n.local?vV:eWe:n.local?$Ue:QUe)(n,t))}function nWe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rWe(e){return function(){this.style.removeProperty(e)}}function iWe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function yV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function bV(e,t,n){return arguments.length>1?this.each((t==null?rWe:typeof t==`function`?yV:iWe)(e,t,n??``)):xV(this.node(),e)}function xV(e,t){return e.style.getPropertyValue(t)||nWe(e).getComputedStyle(e,null).getPropertyValue(t)}function SV(e){return function(){delete this[e]}}function aWe(e,t){return function(){this[e]=t}}function oWe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sWe(e,t){return arguments.length>1?this.each((t==null?SV:typeof t==`function`?oWe:aWe)(e,t)):this.node()[e]}function CV(e){return e.trim().split(/^|\s+/)}function cWe(e){return e.classList||new wV(e)}function wV(e){this._node=e,this._names=CV(e.getAttribute(`class`)||``)}wV.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 lWe(e,t){for(var n=cWe(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function TV(e,t){for(var n=cWe(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function uWe(e){return function(){lWe(this,e)}}function dWe(e){return function(){TV(this,e)}}function fWe(e,t){return function(){(t.apply(this,arguments)?lWe:TV)(this,e)}}function pWe(e,t){var n=CV(e+``);if(arguments.length<2){for(var r=cWe(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?fWe:t?uWe:dWe)(n,t))}function mWe(){this.textContent=``}function hWe(e){return function(){this.textContent=e}}function EV(e){return function(){this.textContent=e.apply(this,arguments)??``}}function DV(e){return arguments.length?this.each(e==null?mWe:(typeof e==`function`?EV:hWe)(e)):this.node().textContent}function gWe(){this.innerHTML=``}function OV(e){return function(){this.innerHTML=e}}function kV(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function _We(e){return arguments.length?this.each(e==null?gWe:(typeof e==`function`?kV:OV)(e)):this.node().innerHTML}function vWe(){this.nextSibling&&this.parentNode.appendChild(this)}function yWe(){return this.each(vWe)}function bWe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function xWe(){return this.each(bWe)}function SWe(e){var t=typeof e==`function`?e:rV(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function CWe(){return null}function wWe(e,t){var n=typeof e==`function`?e:rV(e),r=t==null?CWe:typeof t==`function`?t:iV(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function TWe(){var e=this.parentNode;e&&e.removeChild(this)}function EWe(){return this.each(TWe)}function DWe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function OWe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kWe(e){return this.select(e?OWe:DWe)}function AV(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function AWe(e){return function(t){e.call(this,t,this.__data__)}}function jWe(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 MWe(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 NWe(e,t,n){return function(){var r=this.__on,i,a=AWe(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 PWe(e,t,n){var r=jWe(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?NWe:MWe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function FWe(e,t,n){var r=nWe(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 IWe(e,t){return function(){return FWe(this,e,t)}}function LWe(e,t){return function(){return FWe(this,e,t.apply(this,arguments))}}function RWe(e,t){return this.each((typeof t==`function`?LWe:IWe)(e,t))}function*zWe(){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 BWe=[null];function jV(e,t){this._groups=e,this._parents=t}function VWe(){return new jV([[document.documentElement]],BWe)}function HWe(){return this}jV.prototype=VWe.prototype={constructor:jV,select:TUe,selectAll:DUe,selectChild:lV,selectChildren:FUe,filter:IUe,data:mV,enter:RUe,exit:BUe,join:VUe,merge:HUe,selection:HWe,order:UUe,sort:WUe,call:KUe,nodes:qUe,node:gV,size:JUe,empty:_V,each:YUe,attr:tWe,style:bV,property:sWe,classed:pWe,text:DV,html:_We,raise:yWe,lower:xWe,append:SWe,insert:wWe,remove:EWe,clone:kWe,datum:AV,on:PWe,dispatch:RWe,[Symbol.iterator]:zWe};var MV=VWe;function NV(e){return typeof e==`string`?new jV([[document.querySelector(e)]],[document.documentElement]):new jV([[e]],BWe)}function UWe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function PV(e,t){if(e=UWe(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]}const WWe={passive:!1},FV={capture:!0,passive:!1};function GWe(e){e.stopImmediatePropagation()}function IV(e){e.preventDefault(),e.stopImmediatePropagation()}function KWe(e){var t=e.document.documentElement,n=NV(e).on(`dragstart.drag`,IV,FV);`onselectstart`in t?n.on(`selectstart.drag`,IV,FV):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function qWe(e,t){var n=e.document.documentElement,r=NV(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,IV,FV),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 LV=e=>()=>e;function JWe(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}})}JWe.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function YWe(e){return!e.ctrlKey&&!e.button}function XWe(){return this.parentNode}function ZWe(e,t){return t??{x:e.x,y:e.y}}function QWe(){return navigator.maxTouchPoints||`ontouchstart`in this}function RV(){var e=YWe,t=XWe,n=ZWe,r=QWe,i={},a=bUe(`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`,_,WWe).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&&(NV(n.view).on(`mousemove.drag`,m,FV).on(`mouseup.drag`,h,FV),KWe(n.view),GWe(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(IV(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){NV(e.view).on(`mousemove.drag mouseup.drag`,null),qWe(e.view,l),IV(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]))&&(GWe(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])&&(IV(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])&&(GWe(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=PV(l||r,t),p,m,h;if((h=n.call(e,new JWe(`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=PV(l||a,t),_=o;break}u.call(r,e,new JWe(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:LV(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:LV(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:LV(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:LV(!!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 zV(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $We(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function BV(){}var VV=.7,eGe=1/VV,HV=`\\s*([+-]?\\d+)\\s*`,UV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,WV=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,tGe=/^#([0-9a-f]{3,8})$/,nGe=RegExp(`^rgb\\(${HV},${HV},${HV}\\)$`),rGe=RegExp(`^rgb\\(${WV},${WV},${WV}\\)$`),iGe=RegExp(`^rgba\\(${HV},${HV},${HV},${UV}\\)$`),aGe=RegExp(`^rgba\\(${WV},${WV},${WV},${UV}\\)$`),oGe=RegExp(`^hsl\\(${UV},${WV},${WV}\\)$`),sGe=RegExp(`^hsla\\(${UV},${WV},${WV},${UV}\\)$`),GV={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};zV(BV,qV,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cGe,formatHex:cGe,formatHex8:lGe,formatHsl:KV,formatRgb:uGe,toString:uGe});function cGe(){return this.rgb().formatHex()}function lGe(){return this.rgb().formatHex8()}function KV(){return _Ge(this).formatHsl()}function uGe(){return this.rgb().formatRgb()}function qV(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=tGe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?dGe(t):n===3?new YV(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?JV(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?JV(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=nGe.exec(e))?new YV(t[1],t[2],t[3],1):(t=rGe.exec(e))?new YV(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=iGe.exec(e))?JV(t[1],t[2],t[3],t[4]):(t=aGe.exec(e))?JV(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oGe.exec(e))?$V(t[1],t[2]/100,t[3]/100,1):(t=sGe.exec(e))?$V(t[1],t[2]/100,t[3]/100,t[4]):GV.hasOwnProperty(e)?dGe(GV[e]):e===`transparent`?new YV(NaN,NaN,NaN,0):null}function dGe(e){return new YV(e>>16&255,e>>8&255,e&255,1)}function JV(e,t,n,r){return r<=0&&(e=t=n=NaN),new YV(e,t,n,r)}function fGe(e){return e instanceof BV||(e=qV(e)),e?(e=e.rgb(),new YV(e.r,e.g,e.b,e.opacity)):new YV}function pGe(e,t,n,r){return arguments.length===1?fGe(e):new YV(e,t,n,r??1)}function YV(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}zV(YV,pGe,$We(BV,{brighter(e){return e=e==null?eGe:eGe**+e,new YV(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?VV:VV**+e,new YV(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new YV(ZV(this.r),ZV(this.g),ZV(this.b),gGe(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:mGe,formatHex:mGe,formatHex8:hGe,formatRgb:XV,toString:XV}));function mGe(){return`#${QV(this.r)}${QV(this.g)}${QV(this.b)}`}function hGe(){return`#${QV(this.r)}${QV(this.g)}${QV(this.b)}${QV((isNaN(this.opacity)?1:this.opacity)*255)}`}function XV(){let e=gGe(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ZV(this.r)}, ${ZV(this.g)}, ${ZV(this.b)}${e===1?`)`:`, ${e})`}`}function gGe(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ZV(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function QV(e){return e=ZV(e),(e<16?`0`:``)+e.toString(16)}function $V(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new eH(e,t,n,r)}function _Ge(e){if(e instanceof eH)return new eH(e.h,e.s,e.l,e.opacity);if(e instanceof BV||(e=qV(e)),!e)return new eH;if(e instanceof eH)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 eH(o,s,c,e.opacity)}function vGe(e,t,n,r){return arguments.length===1?_Ge(e):new eH(e,t,n,r??1)}function eH(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}zV(eH,vGe,$We(BV,{brighter(e){return e=e==null?eGe:eGe**+e,new eH(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?VV:VV**+e,new eH(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 YV(xGe(e>=240?e-240:e+120,i,r),xGe(e,i,r),xGe(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new eH(yGe(this.h),bGe(this.s),bGe(this.l),gGe(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=gGe(this.opacity);return`${e===1?`hsl(`:`hsla(`}${yGe(this.h)}, ${bGe(this.s)*100}%, ${bGe(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function yGe(e){return e=(e||0)%360,e<0?e+360:e}function bGe(e){return Math.max(0,Math.min(1,e||0))}function xGe(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 SGe=e=>()=>e;function tH(e,t){return function(n){return e+n*t}}function nH(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function CGe(e){return(e=+e)==1?wGe:function(t,n){return n-t?nH(t,n,e):SGe(isNaN(t)?n:t)}}function wGe(e,t){var n=t-e;return n?tH(e,n):SGe(isNaN(e)?t:e)}var TGe=(function e(t){var n=CGe(t);function r(e,t){var r=n((e=pGe(e)).r,(t=pGe(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=wGe(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 rH(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var iH=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,aH=new RegExp(iH.source,`g`);function oH(e){return function(){return e}}function EGe(e){return function(t){return e(t)+``}}function DGe(e,t){var n=iH.lastIndex=aH.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=iH.exec(e))&&(i=aH.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:rH(r,i)})),n=aH.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?EGe(c[0].x):oH(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(``)})}var OGe=180/Math.PI,sH={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kGe(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)*OGe,skewX:Math.atan(c)*OGe,scaleX:o,scaleY:s}}var AGe;function cH(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?sH:kGe(t.a,t.b,t.c,t.d,t.e,t.f)}function lH(e){return e==null||(AGe||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),AGe.setAttribute(`transform`,e),!(e=AGe.transform.baseVal.consolidate()))?sH:(e=e.matrix,kGe(e.a,e.b,e.c,e.d,e.e,e.f))}function jGe(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:rH(e,i)},{i:c-2,x:rH(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:rH(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:rH(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:rH(e,n)},{i:s-2,x:rH(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 MGe=jGe(cH,`px, `,`px)`,`deg)`),NGe=jGe(lH,`, `,`)`,`)`),PGe=1e-12;function FGe(e){return((e=Math.exp(e))+1/e)/2}function IGe(e){return((e=Math.exp(e))-1/e)/2}function LGe(e){return((e=Math.exp(2*e))-1)/(e+1)}var RGe=(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<PGe)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=FGe(y),c=s/(n*g)*(i*LGe(t*r+y)-IGe(y));return[a+c*d,o+c*f,s*i/FGe(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),uH=0,dH=0,zGe=0,BGe=1e3,VGe,fH,pH=0,mH=0,hH=0,gH=typeof performance==`object`&&performance.now?performance:Date,_H=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function HGe(){return mH||=(_H(UGe),gH.now()+hH)}function UGe(){mH=0}function WGe(){this._call=this._time=this._next=null}WGe.prototype=GGe.prototype={constructor:WGe,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?HGe():+n)+(t==null?0:+t),!this._next&&fH!==this&&(fH?fH._next=this:VGe=this,fH=this),this._call=e,this._time=n,YGe()},stop:function(){this._call&&(this._call=null,this._time=1/0,YGe())}};function GGe(e,t,n){var r=new WGe;return r.restart(e,t,n),r}function vH(){HGe(),++uH;for(var e=VGe,t;e;)(t=mH-e._time)>=0&&e._call.call(void 0,t),e=e._next;--uH}function KGe(){mH=(pH=gH.now())+hH,uH=dH=0;try{vH()}finally{uH=0,JGe(),mH=0}}function qGe(){var e=gH.now(),t=e-pH;t>BGe&&(hH-=t,pH=e)}function JGe(){for(var e,t=VGe,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:VGe=n);fH=e,YGe(r)}function YGe(e){uH||(dH&&=clearTimeout(dH),e-mH>24?(e<1/0&&(dH=setTimeout(KGe,e-gH.now()-hH)),zGe&&=clearInterval(zGe)):(zGe||=(pH=gH.now(),setInterval(qGe,BGe)),uH=1,_H(KGe)))}function XGe(e,t,n){var r=new WGe;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var ZGe=eV(`start`,`end`,`cancel`,`interrupt`),QGe=[];function yH(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;$Ge(e,n,{name:t,index:r,group:i,on:ZGe,tween:QGe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function bH(e,t){var n=SH(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xH(e,t){var n=SH(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function SH(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function $Ge(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=GGe(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 XGe(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(XGe(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 CH(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 eKe(e){return this.each(function(){CH(this,e)})}function tKe(e,t){var n,r;return function(){var i=xH(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 nKe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xH(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 rKe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=SH(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?tKe:nKe)(n,e,t))}function wH(e,t,n){var r=e._id;return e.each(function(){var e=xH(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return SH(e,r).value[t]}}function iKe(e,t){var n;return(typeof t==`number`?rH:t instanceof qV?TGe:(n=qV(t))?(t=n,TGe):DGe)(e,t)}function aKe(e){return function(){this.removeAttribute(e)}}function oKe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sKe(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 cKe(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 TH(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 lKe(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 uKe(e,t){var n=SUe(e),r=n===`transform`?NGe:iKe;return this.attrTween(e,typeof t==`function`?(n.local?lKe:TH)(n,r,wH(this,`attr.`+e,t)):t==null?(n.local?oKe:aKe)(n):(n.local?cKe:sKe)(n,r,t))}function EH(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dKe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fKe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&dKe(e,i)),n}return i._value=t,i}function DH(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&EH(e,i)),n}return i._value=t,i}function pKe(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=SUe(e);return this.tween(n,(r.local?fKe:DH)(r,t))}function mKe(e,t){return function(){bH(this,e).delay=+t.apply(this,arguments)}}function hKe(e,t){return t=+t,function(){bH(this,e).delay=t}}function gKe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?mKe:hKe)(t,e)):SH(this.node(),t).delay}function _Ke(e,t){return function(){xH(this,e).duration=+t.apply(this,arguments)}}function vKe(e,t){return t=+t,function(){xH(this,e).duration=t}}function yKe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?_Ke:vKe)(t,e)):SH(this.node(),t).duration}function bKe(e,t){if(typeof t!=`function`)throw Error();return function(){xH(this,e).ease=t}}function xKe(e){var t=this._id;return arguments.length?this.each(bKe(t,e)):SH(this.node(),t).ease}function SKe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xH(this,e).ease=n}}function CKe(e){if(typeof e!=`function`)throw Error();return this.each(SKe(this._id,e))}function wKe(e){typeof e!=`function`&&(e=OUe(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 jH(r,this._parents,this._name,this._id)}function OH(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 jH(o,this._parents,this._name,this._id)}function TKe(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 EKe(e,t,n){var r,i,a=TKe(t)?bH:xH;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function kH(e,t){var n=this._id;return arguments.length<2?SH(this.node(),n).on.on(e):this.each(EKe(n,e,t))}function DKe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function OKe(){return this.on(`end.remove`,DKe(this._id))}function kKe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=iV(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,yH(l[f],t,n,f,l,SH(u,n)));return new jH(a,this._parents,t,n)}function AKe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=oV(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=SH(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&yH(p,t,n,h,f,m);a.push(f),o.push(u)}return new jH(a,o,t,n)}var jKe=MV.prototype.constructor;function MKe(){return new jKe(this._groups,this._parents)}function NKe(e,t){var n,r,i;return function(){var a=xV(this,e),o=(this.style.removeProperty(e),xV(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function PKe(e){return function(){this.style.removeProperty(e)}}function FKe(e,t,n){var r,i=n+``,a;return function(){var o=xV(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function IKe(e,t,n){var r,i,a;return function(){var o=xV(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),xV(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function LKe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xH(this,e),l=c.on,u=c.value[a]==null?s||=PKe(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function RKe(e,t,n){var r=(e+=``)==`transform`?MGe:iKe;return t==null?this.styleTween(e,NKe(e,r)).on(`end.style.`+e,PKe(e)):typeof t==`function`?this.styleTween(e,IKe(e,r,wH(this,`style.`+e,t))).each(LKe(this._id,e)):this.styleTween(e,FKe(e,r,t),n).on(`end.style.`+e,null)}function zKe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function BKe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&zKe(e,a,n)),r}return a._value=t,a}function VKe(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,BKe(e,t,n??``))}function HKe(e){return function(){this.textContent=e}}function UKe(e){return function(){this.textContent=e(this)??``}}function WKe(e){return this.tween(`text`,typeof e==`function`?UKe(wH(this,`text`,e)):HKe(e==null?``:e+``))}function GKe(e){return function(t){this.textContent=e.call(this,t)}}function KKe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&GKe(r)),t}return r._value=e,r}function qKe(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,KKe(e))}function AH(){for(var e=this._name,t=this._id,n=MH(),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=SH(c,t);yH(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new jH(r,this._parents,e,n)}function JKe(){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=xH(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 YKe=0;function jH(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function XKe(e){return MV().transition(e)}function MH(){return++YKe}var NH=MV.prototype;jH.prototype=XKe.prototype={constructor:jH,select:kKe,selectAll:AKe,selectChild:NH.selectChild,selectChildren:NH.selectChildren,filter:wKe,merge:OH,selection:MKe,transition:AH,call:NH.call,nodes:NH.nodes,node:NH.node,size:NH.size,empty:NH.empty,each:NH.each,on:kH,attr:uKe,attrTween:pKe,style:RKe,styleTween:VKe,text:WKe,textTween:qKe,remove:OKe,tween:rKe,delay:gKe,duration:yKe,ease:xKe,easeVarying:CKe,end:JKe,[Symbol.iterator]:NH[Symbol.iterator]};function ZKe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QKe={time:null,delay:0,duration:250,ease:ZKe};function $Ke(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function eqe(e){var t,n;e instanceof jH?(t=e._id,e=e._name):(t=MH(),(n=QKe).time=HGe(),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])&&yH(c,e,t,l,o,n||$Ke(c,t));return new jH(r,this._parents,e,t)}MV.prototype.interrupt=eKe,MV.prototype.transition=eqe;var PH=e=>()=>e;function tqe(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 FH(e,t,n){this.k=e,this.x=t,this.y=n}FH.prototype={constructor:FH,scale:function(e){return e===1?this:new FH(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new FH(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 IH=new FH(1,0,0);nqe.prototype=FH.prototype;function nqe(e){for(;!e.__zoom;)if(!(e=e.parentNode))return IH;return e.__zoom}function rqe(e){e.stopImmediatePropagation()}function LH(e){e.preventDefault(),e.stopImmediatePropagation()}function RH(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function iqe(){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 aqe(){return this.__zoom||IH}function oqe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function sqe(){return navigator.maxTouchPoints||`ontouchstart`in this}function cqe(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 lqe(){var e=RH,t=iqe,n=cqe,r=oqe,i=sqe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=RGe,l=eV(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,aqe).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`,aqe),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(IH.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 FH(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 FH(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 FH(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=NV(this.that).datum();l.call(e,this.that,new tqe(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=PV(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)],CH(this),s.start();LH(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=NV(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=PV(t,i),l=t.clientX,u=t.clientY;KWe(t.view),rqe(t),a.mouse=[c,this.__zoom.invert(c)],CH(this),a.start();function d(e){if(LH(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]=PV(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),qWe(e.view,a.moved),LH(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=PV(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);LH(r),s>0?NV(this).transition().duration(s).call(x,d,c,r):NV(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(rqe(t),s=0;s<i;++s)c=r[s],l=PV(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)),CH(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(LH(e),s=0;s<a;++s)c=i[s],l=PV(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(rqe(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=PV(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=NV(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:PH(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:PH(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:PH(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:PH([[+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 uqe=b(),zH=(0,D.createContext)(null),BH=zH.Provider,VH={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?`target`:`source`} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,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.`},dqe=VH.error001();function HH(e,t){let n=(0,D.useContext)(zH);if(n===null)throw Error(dqe);return uUe(n,e,t)}var UH=()=>{let e=(0,D.useContext)(zH);if(e===null)throw Error(dqe);return(0,D.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},WH=e=>e.userSelectionActive?`none`:`all`;function fqe({position:e,children:t,className:n,style:r,...i}){let a=HH(WH),o=`${e}`.split(`-`);return D.createElement(`div`,{className:qB([`react-flow__panel`,n,...o]),style:{...r,pointerEvents:a},...i},t)}function pqe({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:D.createElement(fqe,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro`},D.createElement(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`},`React Flow`))}var mqe=(0,D.memo)(({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=(0,D.useRef)(null),[f,p]=(0,D.useState)({x:0,y:0,width:0,height:0}),m=qB([`react-flow__edge-textwrapper`,l]);return(0,D.useEffect)(()=>{if(d.current){let e=d.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n===void 0||!n?null:D.createElement(`g`,{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?`visible`:`hidden`,...u},i&&D.createElement(`rect`,{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),D.createElement(`text`,{className:`react-flow__edge-text`,y:f.height/2,dy:`0.3em`,ref:d,style:r},n),c)}),hqe=e=>({width:e.offsetWidth,height:e.offsetHeight}),GH=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),gqe=(e={x:0,y:0},t)=>({x:GH(e.x,t[0][0],t[1][0]),y:GH(e.y,t[0][1],t[1][1])}),KH=(e,t,n)=>e<t?GH(Math.abs(e-t),1,50)/50:e>n?-GH(Math.abs(e-n),1,50)/50:0,_qe=(e,t)=>[KH(e.x,35,t.width-35)*20,KH(e.y,35,t.height-35)*20],vqe=e=>e.getRootNode?.()||window?.document,qH=(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)}),JH=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yqe=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),YH=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),bqe=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},XH=e=>ZH(e.width)&&ZH(e.height)&&ZH(e.x)&&ZH(e.y),ZH=e=>!isNaN(e)&&isFinite(e),QH=Symbol.for(`internals`),xqe=[`Enter`,` `,`Escape`],Sqe=(e,t)=>{},Cqe=e=>`nativeEvent`in e;function wqe(e){let t=(Cqe(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return[`INPUT`,`SELECT`,`TEXTAREA`].includes(t?.nodeName)||t?.hasAttribute(`contenteditable`)||!!t?.closest(`.nokey`)}var Tqe=e=>`clientX`in e,$H=(e,t)=>{let n=Tqe(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)}},eU=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0,tU=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p=20})=>D.createElement(D.Fragment,null,D.createElement(`path`,{id:e,style:u,d:t,fill:`none`,className:`react-flow__edge-path`,markerEnd:d,markerStart:f}),p&&D.createElement(`path`,{d:t,fill:`none`,strokeOpacity:0,strokeWidth:p,className:`react-flow__edge-interaction`}),i&&ZH(n)&&ZH(r)?D.createElement(mqe,{x:n,y:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l}):null);tU.displayName=`BaseEdge`;function nU(e,t,n){return n===void 0?n:r=>{let i=t().edges.find(t=>t.id===e);i&&n(r,{...i})}}function Eqe({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 Dqe({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)]}var rU;(function(e){e.Strict=`strict`,e.Loose=`loose`})(rU||={});var iU;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(iU||={});var aU;(function(e){e.Partial=`partial`,e.Full=`full`})(aU||={});var oU;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(oU||={});var sU;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(sU||={});var cU;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(cU||={});function Oqe({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===cU.Left||e===cU.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function kqe({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top}){let[o,s]=Oqe({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Oqe({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Dqe({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]}var Aqe=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=cU.Bottom,targetPosition:a=cU.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=kqe({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a});return D.createElement(tU,{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})});Aqe.displayName=`SimpleBezierEdge`;var jqe={[cU.Left]:{x:-1,y:0},[cU.Right]:{x:1,y:0},[cU.Top]:{x:0,y:-1},[cU.Bottom]:{x:0,y:1}},Mqe=({source:e,sourcePosition:t=cU.Bottom,target:n})=>t===cU.Left||t===cU.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},Nqe=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Pqe({source:e,sourcePosition:t=cU.Bottom,target:n,targetPosition:r=cU.Top,center:i,offset:a}){let o=jqe[t],s=jqe[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=Mqe({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p=[],m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=Eqe({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function Fqe(e,t,n,r){let i=Math.min(Nqe(e,t)/2,Nqe(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 lU({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20}){let[u,d,f,p,m]=Pqe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l});return[u.reduce((e,t,n)=>{let r=``;return r=n>0&&n<u.length-1?Fqe(u[n-1],t,u[n+1],o):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),d,f,p,m]}var uU=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,sourcePosition:d=cU.Bottom,targetPosition:f=cU.Top,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=lU({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:h?.borderRadius,offset:h?.offset});return D.createElement(tU,{path:_,labelX:v,labelY:y,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:p,markerStart:m,interactionWidth:g})});uU.displayName=`SmoothStepEdge`;var Iqe=(0,D.memo)(e=>D.createElement(uU,{...e,pathOptions:(0,D.useMemo)(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Iqe.displayName=`StepEdge`;function Lqe({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Eqe({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Rqe=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})=>{let[m,h,g]=Lqe({sourceX:e,sourceY:t,targetX:n,targetY:r});return D.createElement(tU,{path:m,labelX:h,labelY:g,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})});Rqe.displayName=`StraightEdge`;function zqe(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Bqe({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case cU.Left:return[t-zqe(t-r,a),n];case cU.Right:return[t+zqe(r-t,a),n];case cU.Top:return[t,n-zqe(n-i,a)];case cU.Bottom:return[t,n+zqe(i-n,a)]}}function Vqe({sourceX:e,sourceY:t,sourcePosition:n=cU.Bottom,targetX:r,targetY:i,targetPosition:a=cU.Top,curvature:o=.25}){let[s,c]=Bqe({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Bqe({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Dqe({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]}var dU=(0,D.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=cU.Bottom,targetPosition:a=cU.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=Vqe({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a,curvature:h?.curvature});return D.createElement(tU,{path:_,labelX:v,labelY:y,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:g})});dU.displayName=`BezierEdge`;var fU=(0,D.createContext)(null),Hqe=fU.Provider;fU.Consumer;var Uqe=()=>(0,D.useContext)(fU),Wqe=e=>`id`in e&&`source`in e&&`target`in e,Gqe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||``}-${n}${r||``}`,pU=(e,t)=>e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`,Kqe=(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)),qqe=(e,t)=>{if(!e.source||!e.target)return VH.error006(),t;let n;return n=Wqe(e)?{...e}:{...e,id:Gqe(e)},Kqe(n,t)?t:t.concat(n)},mU=({x:e,y:t},[n,r,i],a,[o,s])=>{let c={x:(e-n)/i,y:(t-r)/i};return a?{x:o*Math.round(c.x/o),y:s*Math.round(c.y/s)}:c},Jqe=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),hU=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};let n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},Yqe=(e,t=[0,0])=>e.length===0?{x:0,y:0,width:0,height:0}:yqe(e.reduce((e,n)=>{let{x:r,y:i}=hU(n,t).positionAbsolute;return qH(e,JH({x:r,y:i,width:n.width||0,height:n.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Xqe=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{let c={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(e=>{let{width:t,height:n,selectable:r=!0,hidden:i=!1}=e;if(o&&!r||i)return!1;let{positionAbsolute:u}=hU(e,s),d=bqe(c,{x:u.x,y:u.y,width:t||0,height:n||0}),f=t===void 0||n===void 0||t===null||n===null,p=a&&d>0,m=(t||0)*(n||0);(f||p||d>=m||e.dragging)&&l.push(e)}),l},Zqe=(e,t)=>{let n=e.map(e=>e.id);return t.filter(e=>n.includes(e.source)||n.includes(e.target))},Qqe=(e,t,n,r,i,a=.1)=>{let o=t/(e.width*(1+a)),s=n/(e.height*(1+a)),c=GH(Math.min(o,s),r,i),l=e.x+e.width/2,u=e.y+e.height/2;return{x:t/2-l*c,y:n/2-u*c,zoom:c}},gU=(e,t=0)=>e.transition().duration(t);function $qe(e,t,n,r){return(t[n]||[]).reduce((t,i)=>(`${e.id}-${i.id}-${n}`!==r&&t.push({id:i.id||null,type:n,nodeId:e.id,x:(e.positionAbsolute?.x??0)+i.x+i.width/2,y:(e.positionAbsolute?.y??0)+i.y+i.height/2}),t),[])}function _U(e,t,n,r,i,a){let{x:o,y:s}=$H(e),c=t.elementsFromPoint(o,s).find(e=>e.classList.contains(`react-flow__handle`));if(c){let e=c.getAttribute(`data-nodeid`);if(e){let t=iJe(void 0,c),r=c.getAttribute(`data-handleid`),o=a({nodeId:e,id:r,type:t});if(o){let a=i.find(n=>n.nodeId===e&&n.type===t&&n.id===r);return{handle:{id:r,type:t,nodeId:e,x:a?.x||n.x,y:a?.y||n.y},validHandleResult:o}}}}let l=[],u=1/0;if(i.forEach(e=>{let t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=r){let n=a(e);t<=u&&(t<u?l=[{handle:e,validHandleResult:n}]:t===u&&l.push({handle:e,validHandleResult:n}),u=t)}}),!l.length)return{handle:null,validHandleResult:tJe()};if(l.length===1)return l[0];let d=l.some(({validHandleResult:e})=>e.isValid),f=l.some(({handle:e})=>e.type===`target`);return l.find(({handle:e,validHandleResult:t})=>f?e.type===`target`:d?t.isValid:!0)||l[0]}var eJe={source:null,target:null,sourceHandle:null,targetHandle:null},tJe=()=>({handleDomNode:null,isValid:!1,connection:eJe,endHandle:null});function nJe(e,t,n,r,i,a,o){let s=i===`target`,c=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tJe(),handleDomNode:c};if(c){let e=iJe(void 0,c),i=c.getAttribute(`data-nodeid`),o=c.getAttribute(`data-handleid`),u=c.classList.contains(`connectable`),d=c.classList.contains(`connectableend`),f={source:s?i:n,sourceHandle:s?o:r,target:s?n:i,targetHandle:s?r:o};l.connection=f,u&&d&&(t===rU.Strict?s&&e===`source`||!s&&e===`target`:i!==n||o!==r)&&(l.endHandle={nodeId:i,handleId:o,type:e},l.isValid=a(f))}return l}function rJe({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((e,i)=>{if(i[QH]){let{handleBounds:a}=i[QH],o=[],s=[];a&&(o=$qe(i,a,`source`,`${t}-${n}-${r}`),s=$qe(i,a,`target`,`${t}-${n}-${r}`)),e.push(...o,...s)}return e},[])}function iJe(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function vU(e){e?.classList.remove(`valid`,`connecting`,`react-flow__handle-valid`,`react-flow__handle-connecting`)}function aJe(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function oJe({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:c,onReconnectEnd:l}){let u=vqe(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:p,connectionRadius:m,onConnectStart:h,panBy:g,getNodes:_,cancelConnection:v}=a(),y=0,b,{x,y:S}=$H(e),C=u?.elementFromPoint(x,S),w=iJe(c,C),T=f?.getBoundingClientRect();if(!T||!w)return;let E,D=$H(e,T),O=!1,k=null,ee=!1,te=null,ne=rJe({nodes:_(),nodeId:n,handleId:t,handleType:w}),re=()=>{if(!p)return;let[e,t]=_qe(D,T);g({x:e,y:t}),y=requestAnimationFrame(re)};o({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:w,connectionStartHandle:{nodeId:n,handleId:t,type:w},connectionEndHandle:null}),h?.(e,{nodeId:n,handleId:t,handleType:w});function ie(e){let{transform:r}=a();D=$H(e,T);let{handle:c,validHandleResult:l}=_U(e,u,mU(D,r,!1,[1,1]),m,ne,e=>nJe(e,d,n,t,i?`target`:`source`,s,u));if(b=c,O||=(re(),!0),te=l.handleDomNode,k=l.connection,ee=l.isValid,o({connectionPosition:b&&ee?Jqe({x:b.x,y:b.y},r):D,connectionStatus:aJe(!!b,ee),connectionEndHandle:l.endHandle}),!b&&!ee&&!te)return vU(E);k.source!==k.target&&te&&(vU(E),E=te,te.classList.add(`connecting`,`react-flow__handle-connecting`),te.classList.toggle(`valid`,ee),te.classList.toggle(`react-flow__handle-valid`,ee))}function ae(e){(b||te)&&k&&ee&&r?.(k),a().onConnectEnd?.(e),c&&l?.(e),vU(E),v(),cancelAnimationFrame(y),O=!1,ee=!1,k=null,te=null,u.removeEventListener(`mousemove`,ie),u.removeEventListener(`mouseup`,ae),u.removeEventListener(`touchmove`,ie),u.removeEventListener(`touchend`,ae)}u.addEventListener(`mousemove`,ie),u.addEventListener(`mouseup`,ae),u.addEventListener(`touchmove`,ie),u.addEventListener(`touchend`,ae)}var yU=()=>!0,sJe=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),cJe=(e,t,n)=>r=>{let{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=r;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===n||a?.nodeId===e&&a?.handleId===t&&a?.type===n,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===n}},lJe=(0,D.forwardRef)(({type:e=`source`,position:t=cU.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=UH(),_=Uqe(),{connectOnClick:v,noPanClassName:y}=HH(sJe,XB),{connecting:b,clickConnecting:x}=HH(cJe(_,m,e),XB);_||g.getState().onError?.(`010`,VH.error010());let S=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(qqe(i,e))}n?.(i),s?.(i)},C=e=>{if(!_)return;let t=Tqe(e);i&&(t&&e.button===0||!t)&&oJe({event:e,handleId:m,nodeId:_,onConnect:S,isTarget:h,getState:g.getState,setState:g.setState,isValidConnection:n||g.getState().isValidConnection||yU}),t?u?.(e):d?.(e)},w=t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:m}});return}let l=vqe(t.target),u=n||c||yU,{connection:d,isValid:f}=nJe({nodeId:_,id:m,type:e},s,o.nodeId,o.handleId||null,o.type,u,l);f&&S(d),a?.(t),g.setState({connectionClickStartHandle:null})};return D.createElement(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${m}-${e}`,className:qB([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,connecting:x,connectionindicator:r&&(i&&!b||a&&b)}]),onMouseDown:C,onTouchStart:C,onClick:v?w:void 0,ref:p,...f},c)});lJe.displayName=`Handle`;var bU=(0,D.memo)(lJe),uJe=({data:e,isConnectable:t,targetPosition:n=cU.Top,sourcePosition:r=cU.Bottom})=>D.createElement(D.Fragment,null,D.createElement(bU,{type:`target`,position:n,isConnectable:t}),e?.label,D.createElement(bU,{type:`source`,position:r,isConnectable:t}));uJe.displayName=`DefaultNode`;var dJe=(0,D.memo)(uJe),fJe=({data:e,isConnectable:t,sourcePosition:n=cU.Bottom})=>D.createElement(D.Fragment,null,e?.label,D.createElement(bU,{type:`source`,position:n,isConnectable:t}));fJe.displayName=`InputNode`;var pJe=(0,D.memo)(fJe),mJe=({data:e,isConnectable:t,targetPosition:n=cU.Top})=>D.createElement(D.Fragment,null,D.createElement(bU,{type:`target`,position:n,isConnectable:t}),e?.label);mJe.displayName=`OutputNode`;var hJe=(0,D.memo)(mJe),gJe=()=>null;gJe.displayName=`GroupNode`;var _Je=e=>({selectedNodes:e.getNodes().filter(e=>e.selected),selectedEdges:e.edges.filter(e=>e.selected).map(e=>({...e}))}),xU=e=>e.id;function SU(e,t){return XB(e.selectedNodes.map(xU),t.selectedNodes.map(xU))&&XB(e.selectedEdges.map(xU),t.selectedEdges.map(xU))}var vJe=(0,D.memo)(({onSelectionChange:e})=>{let t=UH(),{selectedNodes:n,selectedEdges:r}=HH(_Je,SU);return(0,D.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChange.forEach(e=>e(i))},[n,r,e]),null});vJe.displayName=`SelectionListener`;var yJe=e=>!!e.onSelectionChange;function bJe({onSelectionChange:e}){let t=HH(yJe);return e||t?D.createElement(vJe,{onSelectionChange:e}):null}var xJe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function CU(e,t){(0,D.useEffect)(()=>{e!==void 0&&t(e)},[e])}function wU(e,t,n){(0,D.useEffect)(()=>{t!==void 0&&n({[e]:t})},[t])}var SJe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:c,nodesDraggable:l,nodesConnectable:u,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:m,minZoom:h,maxZoom:g,nodeExtent:_,onNodesChange:v,onEdgesChange:y,elementsSelectable:b,connectionMode:x,snapGrid:S,snapToGrid:C,translateExtent:w,connectOnClick:T,defaultEdgeOptions:E,fitView:O,fitViewOptions:k,onNodesDelete:ee,onEdgesDelete:te,onNodeDrag:ne,onNodeDragStart:re,onNodeDragStop:ie,onSelectionDrag:ae,onSelectionDragStart:oe,onSelectionDragStop:se,noPanClassName:ce,nodeOrigin:le,rfId:ue,autoPanOnConnect:de,autoPanOnNodeDrag:fe,onError:pe,connectionRadius:me,isValidConnection:he,nodeDragThreshold:ge})=>{let{setNodes:_e,setEdges:ve,setDefaultNodesAndEdges:ye,setMinZoom:be,setMaxZoom:xe,setTranslateExtent:Se,setNodeExtent:Ce,reset:we}=HH(xJe,XB),Te=UH();return(0,D.useEffect)(()=>{let e=r?.map(e=>({...e,...E}));return ye(n,e),()=>{we()}},[]),wU(`defaultEdgeOptions`,E,Te.setState),wU(`connectionMode`,x,Te.setState),wU(`onConnect`,i,Te.setState),wU(`onConnectStart`,a,Te.setState),wU(`onConnectEnd`,o,Te.setState),wU(`onClickConnectStart`,s,Te.setState),wU(`onClickConnectEnd`,c,Te.setState),wU(`nodesDraggable`,l,Te.setState),wU(`nodesConnectable`,u,Te.setState),wU(`nodesFocusable`,d,Te.setState),wU(`edgesFocusable`,f,Te.setState),wU(`edgesUpdatable`,p,Te.setState),wU(`elementsSelectable`,b,Te.setState),wU(`elevateNodesOnSelect`,m,Te.setState),wU(`snapToGrid`,C,Te.setState),wU(`snapGrid`,S,Te.setState),wU(`onNodesChange`,v,Te.setState),wU(`onEdgesChange`,y,Te.setState),wU(`connectOnClick`,T,Te.setState),wU(`fitViewOnInit`,O,Te.setState),wU(`fitViewOnInitOptions`,k,Te.setState),wU(`onNodesDelete`,ee,Te.setState),wU(`onEdgesDelete`,te,Te.setState),wU(`onNodeDrag`,ne,Te.setState),wU(`onNodeDragStart`,re,Te.setState),wU(`onNodeDragStop`,ie,Te.setState),wU(`onSelectionDrag`,ae,Te.setState),wU(`onSelectionDragStart`,oe,Te.setState),wU(`onSelectionDragStop`,se,Te.setState),wU(`noPanClassName`,ce,Te.setState),wU(`nodeOrigin`,le,Te.setState),wU(`rfId`,ue,Te.setState),wU(`autoPanOnConnect`,de,Te.setState),wU(`autoPanOnNodeDrag`,fe,Te.setState),wU(`onError`,pe,Te.setState),wU(`connectionRadius`,me,Te.setState),wU(`isValidConnection`,he,Te.setState),wU(`nodeDragThreshold`,ge,Te.setState),CU(e,_e),CU(t,ve),CU(h,be),CU(g,xe),CU(w,Se),CU(_,Ce),null},CJe={display:`none`},wJe={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},TJe=`react-flow__node-desc`,TU=`react-flow__edge-desc`,EJe=`react-flow__aria-live`,EU=e=>e.ariaLiveMessage;function DJe({rfId:e}){let t=HH(EU);return D.createElement(`div`,{id:`${EJe}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:wJe},t)}function OJe({rfId:e,disableKeyboardA11y:t}){return D.createElement(D.Fragment,null,D.createElement(`div`,{id:`${TJe}-${e}`,style:CJe},`Press enter or space to select a node.`,!t&&`You can then use the arrow keys to move the node around.`,` Press delete to remove it and escape to cancel.`,` `),D.createElement(`div`,{id:`${TU}-${e}`,style:CJe},`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`),!t&&D.createElement(DJe,{rfId:e}))}var DU=(e=null,t={actInsideInputWithModifier:!0})=>{let[n,r]=(0,D.useState)(!1),i=(0,D.useRef)(!1),a=(0,D.useRef)(new Set([])),[o,s]=(0,D.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.split(`+`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,D.useEffect)(()=>{let n=typeof document<`u`?document:null,c=t?.target||n;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&wqe(e))return!1;let n=kU(e.code,s);a.current.add(e[n]),OU(o,a.current,!1)&&(e.preventDefault(),r(!0))},n=e=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&wqe(e))return!1;let n=kU(e.code,s);OU(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[n]),e.key===`Meta`&&a.current.clear(),i.current=!1},l=()=>{a.current.clear(),r(!1)};return c?.addEventListener(`keydown`,e),c?.addEventListener(`keyup`,n),window.addEventListener(`blur`,l),()=>{c?.removeEventListener(`keydown`,e),c?.removeEventListener(`keyup`,n),window.removeEventListener(`blur`,l)}}},[e,r]),n};function OU(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function kU(e,t){return t.includes(e)?`code`:`key`}function kJe(e,t,n,r){let i=e.parentNode||e.parentId;if(!i)return n;let a=t.get(i),o=hU(a,r);return kJe(a,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(a[QH]?.z??0)>(n.z??0)?a[QH]?.z??0:n.z??0},r)}function AJe(e,t,n){e.forEach(r=>{let i=r.parentNode||r.parentId;if(i&&!e.has(i))throw Error(`Parent node ${i} not found`);if(i||n?.[r.id]){let{x:i,y:a,z:o}=kJe(r,e,{...r.position,z:r[QH]?.z??0},t);r.positionAbsolute={x:i,y:a},r[QH].z=o,n?.[r.id]&&(r[QH].isParent=!0)}})}function jJe(e,t,n,r){let i=new Map,a={},o=r?1e3:0;return e.forEach(e=>{let n=(ZH(e.zIndex)?e.zIndex:0)+(e.selected?o:0),r=t.get(e.id),s={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);let l=r?.type&&r?.type!==e.type;Object.defineProperty(s,QH,{enumerable:!1,value:{handleBounds:l?void 0:r?.[QH]?.handleBounds,z:n}}),i.set(e.id,s)}),AJe(i,n,a),i}function MJe(e,t={}){let{getNodes:n,width:r,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:c,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:d}=e(),f=t.initial&&!l&&u;if(s&&c&&(f||!t.initial)){let e=n().filter(e=>{let n=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return t.nodes?.length?n&&t.nodes.some(t=>t.id===e.id):n}),l=e.every(e=>e.width&&e.height);if(e.length>0&&l){let{x:n,y:l,zoom:u}=Qqe(Yqe(e,d),r,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),f=IH.translate(n,l).scale(u);return typeof t.duration==`number`&&t.duration>0?s.transform(gU(c,t.duration),f):s.transform(c,f),!0}}return!1}function AU(e,t){return e.forEach(e=>{let n=t.get(e.id);n&&t.set(n.id,{...n,[QH]:n[QH],selected:e.selected})}),new Map(t)}function NJe(e,t){return t.map(t=>{let n=e.find(e=>e.id===t.id);return n&&(t.selected=n.selected),t})}function jU({changedNodes:e,changedEdges:t,get:n,set:r}){let{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:c,hasDefaultEdges:l}=n();e?.length&&(c&&r({nodeInternals:AU(e,i)}),o?.(e)),t?.length&&(l&&r({edges:NJe(t,a)}),s?.(t))}var MU=()=>{},NU={zoomIn:MU,zoomOut:MU,zoomTo:MU,getZoom:()=>1,setViewport:MU,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:MU,fitBounds:MU,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},PJe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),FJe=()=>{let e=UH(),{d3Zoom:t,d3Selection:n}=HH(PJe,XB);return(0,D.useMemo)(()=>n&&t?{zoomIn:e=>t.scaleBy(gU(n,e?.duration),1.2),zoomOut:e=>t.scaleBy(gU(n,e?.duration),1/1.2),zoomTo:(e,r)=>t.scaleTo(gU(n,r?.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(r,i)=>{let[a,o,s]=e.getState().transform,c=IH.translate(r.x??a,r.y??o).scale(r.zoom??s);t.transform(gU(n,i?.duration),c)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>MJe(e.getState,t),setCenter:(r,i,a)=>{let{width:o,height:s,maxZoom:c}=e.getState(),l=a?.zoom===void 0?c:a.zoom,u=o/2-r*l,d=s/2-i*l,f=IH.translate(u,d).scale(l);t.transform(gU(n,a?.duration),f)},fitBounds:(r,i)=>{let{width:a,height:o,minZoom:s,maxZoom:c}=e.getState(),{x:l,y:u,zoom:d}=Qqe(r,a,o,s,c,i?.padding??.1),f=IH.translate(l,u).scale(d);t.transform(gU(n,i?.duration),f)},project:t=>{let{transform:n,snapToGrid:r,snapGrid:i}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),mU(t,n,r,i)},screenToFlowPosition:t=>{let{transform:n,snapToGrid:r,snapGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:o,y:s}=a.getBoundingClientRect();return mU({x:t.x-o,y:t.y-s},n,r,i)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=Jqe(t,n);return{x:o.x+i,y:o.y+a}},viewportInitialized:!0}:NU,[t,n])};function PU(){let e=FJe(),t=UH(),n=(0,D.useCallback)(()=>t.getState().getNodes().map(e=>({...e})),[]),r=(0,D.useCallback)(e=>t.getState().nodeInternals.get(e),[]),i=(0,D.useCallback)(()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},[]),a=(0,D.useCallback)(e=>{let{edges:n=[]}=t.getState();return n.find(t=>t.id===e)},[]),o=(0,D.useCallback)(e=>{let{getNodes:n,setNodes:r,hasDefaultNodes:i,onNodesChange:a}=t.getState(),o=n(),s=typeof e==`function`?e(o):e;i?r(s):a&&a(s.length===0?o.map(e=>({type:`remove`,id:e.id})):s.map(e=>({item:e,type:`reset`})))},[]),s=(0,D.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a}=t.getState(),o=typeof e==`function`?e(n):e;i?r(o):a&&a(o.length===0?n.map(e=>({type:`remove`,id:e.id})):o.map(e=>({item:e,type:`reset`})))},[]),c=(0,D.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{getNodes:r,setNodes:i,hasDefaultNodes:a,onNodesChange:o}=t.getState();a?i([...r(),...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),l=(0,D.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{edges:r=[],setEdges:i,hasDefaultEdges:a,onEdgesChange:o}=t.getState();a?i([...r,...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),u=(0,D.useCallback)(()=>{let{getNodes: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}}},[]),d=(0,D.useCallback)(({nodes:e,edges:n})=>{let{nodeInternals:r,getNodes:i,edges:a,hasDefaultNodes:o,hasDefaultEdges:s,onNodesDelete:c,onEdgesDelete:l,onNodesChange:u,onEdgesChange:d}=t.getState(),f=(e||[]).map(e=>e.id),p=(n||[]).map(e=>e.id),m=i().reduce((e,t)=>{let n=t.parentNode||t.parentId,r=!f.includes(t.id)&&n&&e.find(e=>e.id===n);return(typeof t.deletable!=`boolean`||t.deletable)&&(f.includes(t.id)||r)&&e.push(t),e},[]),h=a.filter(e=>typeof e.deletable==`boolean`?e.deletable:!0),g=h.filter(e=>p.includes(e.id));if(m||g){let e=Zqe(m,h),n=[...g,...e],i=n.reduce((e,t)=>(e.includes(t.id)||e.push(t.id),e),[]);(s||o)&&(s&&t.setState({edges:a.filter(e=>!i.includes(e.id))}),o&&(m.forEach(e=>{r.delete(e.id)}),t.setState({nodeInternals:new Map(r)}))),i.length>0&&(l?.(n),d&&d(i.map(e=>({id:e,type:`remove`})))),m.length>0&&(c?.(m),u&&u(m.map(e=>({id:e.id,type:`remove`}))))}},[]),f=(0,D.useCallback)(e=>{let n=XH(e),r=n?null:t.getState().nodeInternals.get(e.id);return!n&&!r?[null,null,n]:[n?e:YH(r),r,n]},[]),p=(0,D.useCallback)((e,n=!0,r)=>{let[i,a,o]=f(e);return i?(r||t.getState().getNodes()).filter(e=>{if(!o&&(e.id===a.id||!e.positionAbsolute))return!1;let t=bqe(YH(e),i);return n&&t>0||t>=i.width*i.height}):[]},[]),m=(0,D.useCallback)((e,t,n=!0)=>{let[r]=f(e);if(!r)return!1;let i=bqe(r,t);return n&&i>0||i>=r.width*r.height},[]);return(0,D.useMemo)(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:c,addEdges:l,toObject:u,deleteElements:d,getIntersectingNodes:p,isNodeIntersecting:m}),[e,n,r,i,a,o,s,c,l,u,d,p,m])}var IJe={actInsideInputWithModifier:!1},LJe=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{let n=UH(),{deleteElements:r}=PU(),i=DU(e,IJe),a=DU(t);(0,D.useEffect)(()=>{if(i){let{edges:e,getNodes:t}=n.getState();r({nodes:t().filter(e=>e.selected),edges:e.filter(e=>e.selected)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,D.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])};function RJe(e){let t=UH();(0,D.useEffect)(()=>{let n,r=()=>{if(!e.current)return;let n=hqe(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,VH.error004()),t.setState({width:n.width||500,height:n.height||500})};return r(),window.addEventListener(`resize`,r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener(`resize`,r),n&&e.current&&n.unobserve(e.current)}},[])}var FU={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},zJe=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,BJe=e=>({x:e.x,y:e.y,zoom:e.k}),IU=(e,t)=>e.target.closest(`.${t}`),VJe=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),HJe=e=>{let t=e.ctrlKey&&eU()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},UJe=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),WJe=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:c=iU.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:d=!0,defaultViewport:f,translateExtent:p,minZoom:m,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:_=!0,children:v,noWheelClassName:y,noPanClassName:b})=>{let x=(0,D.useRef)(),S=UH(),C=(0,D.useRef)(!1),w=(0,D.useRef)(!1),T=(0,D.useRef)(null),E=(0,D.useRef)({x:0,y:0,zoom:0}),{d3Zoom:O,d3Selection:k,d3ZoomHandler:ee,userSelectionActive:te}=HH(UJe,XB),ne=DU(g),re=(0,D.useRef)(0),ie=(0,D.useRef)(!1),ae=(0,D.useRef)();return RJe(T),(0,D.useEffect)(()=>{if(T.current){let e=T.current.getBoundingClientRect(),t=lqe().scaleExtent([m,h]).translateExtent(p),n=NV(T.current).call(t),r=IH.translate(f.x,f.y).scale(GH(f.zoom,m,h)),i=[[0,0],[e.width,e.height]],a=t.constrain()(r,i,p);t.transform(n,a),t.wheelDelta(HJe),S.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on(`wheel.zoom`),transform:[a.x,a.y,a.k],domNode:T.current.closest(`.react-flow`)})}},[]),(0,D.useEffect)(()=>{k&&O&&(o&&!ne&&!te?k.on(`wheel.zoom`,r=>{if(IU(r,y))return!1;r.preventDefault(),r.stopImmediatePropagation();let i=k.property(`__zoom`).k||1;if(r.ctrlKey&&a){let e=PV(r),t=i*2**HJe(r);O.scaleTo(k,t,e,r);return}let o=r.deltaMode===1?20:1,l=c===iU.Vertical?0:r.deltaX*o,u=c===iU.Horizontal?0:r.deltaY*o;!eU()&&r.shiftKey&&c!==iU.Vertical&&(l=r.deltaY*o,u=0),O.translateBy(k,-(l/i)*s,-(u/i)*s,{internal:!0});let d=BJe(k.property(`__zoom`)),{onViewportChangeStart:f,onViewportChange:p,onViewportChangeEnd:m}=S.getState();clearTimeout(ae.current),ie.current||(ie.current=!0,t?.(r,d),f?.(d)),ie.current&&(e?.(r,d),p?.(d),ae.current=setTimeout(()=>{n?.(r,d),m?.(d),ie.current=!1},150))},{passive:!1}):ee!==void 0&&k.on(`wheel.zoom`,function(e,t){if(!_&&e.type===`wheel`&&!e.ctrlKey||IU(e,y))return null;e.preventDefault(),ee.call(this,e,t)},{passive:!1}))},[te,o,c,k,O,ee,ne,a,_,y,t,e,n]),(0,D.useEffect)(()=>{O&&O.on(`start`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;re.current=e.sourceEvent?.button;let{onViewportChangeStart:n}=S.getState(),r=BJe(e.transform);C.current=!0,E.current=r,e.sourceEvent?.type===`mousedown`&&S.setState({paneDragging:!0}),n?.(r),t?.(e.sourceEvent,r)})},[O,t]),(0,D.useEffect)(()=>{O&&(te&&!C.current?O.on(`zoom`,null):te||O.on(`zoom`,t=>{let{onViewportChange:n}=S.getState();if(S.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),w.current=!!(r&&VJe(d,re.current??0)),(e||n)&&!t.sourceEvent?.internal){let r=BJe(t.transform);n?.(r),e?.(t.sourceEvent,r)}}))},[te,O,e,d,r]),(0,D.useEffect)(()=>{O&&O.on(`end`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;let{onViewportChangeEnd:t}=S.getState();if(C.current=!1,S.setState({paneDragging:!1}),r&&VJe(d,re.current??0)&&!w.current&&r(e.sourceEvent),w.current=!1,(n||t)&&zJe(E.current,e.transform)){let r=BJe(e.transform);E.current=r,clearTimeout(x.current),x.current=setTimeout(()=>{t?.(r),n?.(e.sourceEvent,r)},o?150:0)}})},[O,o,d,n,r]),(0,D.useEffect)(()=>{O&&O.filter(e=>{let t=ne||i,n=a&&e.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&e.button===1&&e.type===`mousedown`&&(IU(e,`react-flow__node`)||IU(e,`react-flow__edge`)))return!0;if(!d&&!t&&!o&&!l&&!a||te||!l&&e.type===`dblclick`||IU(e,y)&&e.type===`wheel`||IU(e,b)&&(e.type!==`wheel`||o&&e.type===`wheel`&&!ne)||!a&&e.ctrlKey&&e.type===`wheel`||!t&&!o&&!n&&e.type===`wheel`||!d&&(e.type===`mousedown`||e.type===`touchstart`)||Array.isArray(d)&&!d.includes(e.button)&&e.type===`mousedown`)return!1;let r=Array.isArray(d)&&d.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||e.type===`wheel`)&&r})},[te,O,i,a,o,l,d,u,ne]),D.createElement(`div`,{className:`react-flow__renderer`,ref:T,style:FU},v)},GJe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function KJe(){let{userSelectionActive:e,userSelectionRect:t}=HH(GJe,XB);return e&&t?D.createElement(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function qJe(e,t){let n=t.parentNode||t.parentId,r=e.find(e=>e.id===n);if(r){let e=t.position.x+t.width-r.width,n=t.position.y+t.height-r.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,e>0&&(r.style.width+=e),n>0&&(r.style.height+=n),t.position.x<0){let e=Math.abs(t.position.x);r.position.x=r.position.x-e,r.style.width+=e,t.position.x=0}if(t.position.y<0){let e=Math.abs(t.position.y);r.position.y=r.position.y-e,r.style.height+=e,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function JJe(e,t){if(e.some(e=>e.type===`reset`))return e.filter(e=>e.type===`reset`).map(e=>e.item);let n=e.filter(e=>e.type===`add`).map(e=>e.item);return t.reduce((t,n)=>{let r=e.filter(e=>e.id===n.id);if(r.length===0)return t.push(n),t;let i={...n};for(let e of r)if(e)switch(e.type){case`select`:i.selected=e.selected;break;case`position`:e.position!==void 0&&(i.position=e.position),e.positionAbsolute!==void 0&&(i.positionAbsolute=e.positionAbsolute),e.dragging!==void 0&&(i.dragging=e.dragging),i.expandParent&&qJe(t,i);break;case`dimensions`:e.dimensions!==void 0&&(i.width=e.dimensions.width,i.height=e.dimensions.height),e.updateStyle!==void 0&&(i.style={...i.style||{},...e.dimensions}),typeof e.resizing==`boolean`&&(i.resizing=e.resizing),i.expandParent&&qJe(t,i);break;case`remove`:return t}return t.push(i),t},n)}function YJe(e,t){return JJe(e,t)}function XJe(e,t){return JJe(e,t)}var LU=(e,t)=>({id:e,type:`select`,selected:t});function RU(e,t){return e.reduce((e,n)=>{let r=t.includes(n.id);return!n.selected&&r?(n.selected=!0,e.push(LU(n.id,!0))):n.selected&&!r&&(n.selected=!1,e.push(LU(n.id,!1))),e},[])}var Y=(e,t)=>n=>{n.target===t.current&&e?.(n)},zU=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),ZJe=(0,D.memo)(({isSelecting:e,selectionMode:t=aU.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:c,onPaneMouseMove:l,onPaneMouseLeave:u,children:d})=>{let f=(0,D.useRef)(null),p=UH(),m=(0,D.useRef)(0),h=(0,D.useRef)(0),g=(0,D.useRef)(),{userSelectionActive:_,elementsSelectable:v,dragging:y}=HH(zU,XB),b=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,h.current=0},x=e=>{a?.(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},S=e=>{if(Array.isArray(n)&&n?.includes(2)){e.preventDefault();return}o?.(e)},C=s?e=>s(e):void 0,w=t=>{let{resetSelectedElements:n,domNode:i}=p.getState();if(g.current=i?.getBoundingClientRect(),!v||!e||t.button!==0||t.target!==f.current||!g.current)return;let{x:a,y:o}=$H(t,g.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:o,x:a,y:o}}),r?.(t)},T=n=>{let{userSelectionRect:r,nodeInternals:i,edges:a,transform:o,onNodesChange:s,onEdgesChange:c,nodeOrigin:l,getNodes:u}=p.getState();if(!e||!g.current||!r)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});let d=$H(n,g.current),f=r.startX??0,_=r.startY??0,v={...r,x:d.x<f?d.x:f,y:d.y<_?d.y:_,width:Math.abs(d.x-f),height:Math.abs(d.y-_)},y=u(),b=Xqe(i,v,o,t===aU.Partial,!0,l),x=Zqe(b,a).map(e=>e.id),S=b.map(e=>e.id);if(m.current!==S.length){m.current=S.length;let e=RU(y,S);e.length&&s?.(e)}if(h.current!==x.length){h.current=x.length;let e=RU(a,x);e.length&&c?.(e)}p.setState({userSelectionRect:v})},E=e=>{if(e.button!==0)return;let{userSelectionRect:t}=p.getState();!_&&t&&e.target===f.current&&x?.(e),p.setState({nodesSelectionActive:m.current>0}),b(),i?.(e)},O=e=>{_&&(p.setState({nodesSelectionActive:m.current>0}),i?.(e)),b()},k=v&&(e||_);return D.createElement(`div`,{className:qB([`react-flow__pane`,{dragging:y,selection:e}]),onClick:k?void 0:Y(x,f),onContextMenu:Y(S,f),onWheel:Y(C,f),onMouseEnter:k?void 0:c,onMouseDown:k?w:void 0,onMouseMove:k?T:l,onMouseUp:k?E:void 0,onMouseLeave:k?O:u,ref:f,style:FU},d,D.createElement(KJe,null))});ZJe.displayName=`Pane`;function QJe(e,t){let n=e.parentNode||e.parentId;if(!n)return!1;let r=t.get(n);return r?r.selected?!0:QJe(r,t):!1}function $Je(e,t,n){let r=e;do{if(r?.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function BU(e,t,n,r){return Array.from(e.values()).filter(n=>(n.selected||n.id===r)&&(!n.parentNode||n.parentId||!QJe(n,e))&&(n.draggable||t&&n.draggable===void 0)).map(e=>({id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-(e.positionAbsolute?.x??0),y:n.y-(e.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}))}function VU(e,t){return!t||t===`parent`?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function eYe(e,t,n,r,i=[0,0],a){let o=VU(e,e.extent||r),s=o,c=e.parentNode||e.parentId;if(e.extent===`parent`&&!e.expandParent)if(c&&e.width&&e.height){let t=n.get(c),{x:r,y:a}=hU(t,i).positionAbsolute;s=t&&ZH(r)&&ZH(a)&&ZH(t.width)&&ZH(t.height)?[[r+e.width*i[0],a+e.height*i[1]],[r+t.width-e.width+e.width*i[0],a+t.height-e.height+e.height*i[1]]]:s}else a?.(`005`,VH.error005()),s=o;else if(e.extent&&c&&e.extent!==`parent`){let{x:t,y:r}=hU(n.get(c),i).positionAbsolute;s=[[e.extent[0][0]+t,e.extent[0][1]+r],[e.extent[1][0]+t,e.extent[1][1]+r]]}let l={x:0,y:0};c&&(l=hU(n.get(c),i).positionAbsolute);let u=s&&s!==`parent`?gqe(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function tYe({nodeId:e,dragItems:t,nodeInternals:n}){let r=t.map(e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute}));return[e?r.find(t=>t.id===e):r[0],r]}var HU=(e,t,n,r)=>{let i=t.querySelectorAll(e);if(!i||!i.length)return null;let a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*r[0],y:o.height*r[1]};return a.map(e=>{let t=e.getBoundingClientRect();return{id:e.getAttribute(`data-handleid`),position:e.getAttribute(`data-handlepos`),x:(t.left-o.left-s.x)/n,y:(t.top-o.top-s.y)/n,...hqe(e)}})};function UU(e,t,n){return n===void 0?n:r=>{let i=t().nodeInternals.get(e);i&&n(r,{...i})}}function WU({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,VH.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function nYe(){let e=UH();return(0,D.useCallback)(({sourceEvent:t})=>{let{transform:n,snapGrid:r,snapToGrid:i}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,s={x:(a-n[0])/n[2],y:(o-n[1])/n[2]};return{xSnapped:i?r[0]*Math.round(s.x/r[0]):s.x,ySnapped:i?r[1]*Math.round(s.y/r[1]):s.y,...s}},[])}function GU(e){return(t,n,r)=>e?.(t,r)}function rYe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){let s=UH(),[c,l]=(0,D.useState)(!1),u=(0,D.useRef)([]),d=(0,D.useRef)({x:null,y:null}),f=(0,D.useRef)(0),p=(0,D.useRef)(null),m=(0,D.useRef)({x:0,y:0}),h=(0,D.useRef)(null),g=(0,D.useRef)(!1),_=(0,D.useRef)(!1),v=(0,D.useRef)(!1),y=nYe();return(0,D.useEffect)(()=>{if(e?.current){let c=NV(e.current),b=({x:e,y:t})=>{let{nodeInternals:n,onNodeDrag:r,onSelectionDrag:a,updateNodePositions:o,nodeExtent:c,snapGrid:f,snapToGrid:p,nodeOrigin:m,onError:g}=s.getState();d.current={x:e,y:t};let _=!1,v={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&c&&(v=JH(Yqe(u.current,m))),u.current=u.current.map(r=>{let i={x:e-r.distance.x,y:t-r.distance.y};p&&(i.x=f[0]*Math.round(i.x/f[0]),i.y=f[1]*Math.round(i.y/f[1]));let a=[[c[0][0],c[0][1]],[c[1][0],c[1][1]]];u.current.length>1&&c&&!r.extent&&(a[0][0]=r.positionAbsolute.x-v.x+c[0][0],a[1][0]=r.positionAbsolute.x+(r.width??0)-v.x2+c[1][0],a[0][1]=r.positionAbsolute.y-v.y+c[0][1],a[1][1]=r.positionAbsolute.y+(r.height??0)-v.y2+c[1][1]);let o=eYe(r,i,n,a,m,g);return _=_||r.position.x!==o.position.x||r.position.y!==o.position.y,r.position=o.position,r.positionAbsolute=o.positionAbsolute,r}),!_)return;o(u.current,!0,!0),l(!0);let y=i?r:GU(a);if(y&&h.current){let[e,t]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});y(h.current,e,t)}},x=()=>{if(!p.current)return;let[e,t]=_qe(m.current,p.current);if(e!==0||t!==0){let{transform:n,panBy:r}=s.getState();d.current.x=(d.current.x??0)-e/n[2],d.current.y=(d.current.y??0)-t/n[2],r({x:e,y:t})&&b(d.current)}f.current=requestAnimationFrame(x)},S=t=>{let{nodeInternals:n,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:l,onNodeDragStart:f,onSelectionDragStart:p}=s.getState();_.current=!0;let m=i?f:GU(p);(!o||!a)&&!r&&i&&(n.get(i)?.selected||l()),i&&a&&o&&WU({id:i,store:s,nodeRef:e});let h=y(t);if(d.current=h,u.current=BU(n,c,h,i),m&&u.current){let[e,r]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});m(t.sourceEvent,e,r)}};if(t)c.on(`.drag`,null);else{let t=RV().on(`start`,e=>{let{domNode:t,nodeDragThreshold:n}=s.getState();n===0&&S(e),v.current=!1,d.current=y(e),p.current=t?.getBoundingClientRect()||null,m.current=$H(e.sourceEvent,p.current)}).on(`drag`,e=>{let t=y(e),{autoPanOnNodeDrag:n,nodeDragThreshold:r}=s.getState();if(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1&&(v.current=!0),!v.current){if(!g.current&&_.current&&n&&(g.current=!0,x()),!_.current){let n=t.xSnapped-(d?.current?.x??0),i=t.ySnapped-(d?.current?.y??0);Math.sqrt(n*n+i*i)>r&&S(e)}(d.current.x!==t.xSnapped||d.current.y!==t.ySnapped)&&u.current&&_.current&&(h.current=e.sourceEvent,m.current=$H(e.sourceEvent,p.current),b(t))}}).on(`end`,e=>{if(!(!_.current||v.current)&&(l(!1),g.current=!1,_.current=!1,cancelAnimationFrame(f.current),u.current)){let{updateNodePositions:t,nodeInternals:n,onNodeDragStop:r,onSelectionDragStop:a}=s.getState(),o=i?r:GU(a);if(t(u.current,!1,!1),o){let[t,r]=tYe({nodeId:i,dragItems:u.current,nodeInternals:n});o(e.sourceEvent,t,r)}}}).filter(t=>{let i=t.target;return!t.button&&(!n||!$Je(i,`.${n}`,e))&&(!r||$Je(i,r,e))});return c.call(t),()=>{c.on(`.drag`,null)}}}},[e,t,n,r,a,s,i,o,y]),c}function iYe(){let e=UH();return(0,D.useCallback)(t=>{let{nodeInternals:n,nodeExtent:r,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:s,onError:c,nodesDraggable:l}=e.getState(),u=a().filter(e=>e.selected&&(e.draggable||l&&e.draggable===void 0)),d=o?s[0]:5,f=o?s[1]:5,p=t.isShiftPressed?4:1,m=t.x*d*p,h=t.y*f*p;i(u.map(e=>{if(e.positionAbsolute){let t={x:e.positionAbsolute.x+m,y:e.positionAbsolute.y+h};o&&(t.x=s[0]*Math.round(t.x/s[0]),t.y=s[1]*Math.round(t.y/s[1]));let{positionAbsolute:i,position:a}=eYe(e,t,n,r,void 0,c);e.position=a,e.positionAbsolute=i}return e}),!0,!1)},[])}var KU={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},qU=e=>{let t=({id:t,type:n,data:r,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:s,selected:c,onClick:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onContextMenu:p,onDoubleClick:m,style:h,className:g,isDraggable:_,isSelectable:v,isConnectable:y,isFocusable:b,selectNodesOnDrag:x,sourcePosition:S,targetPosition:C,hidden:w,resizeObserver:T,dragHandle:E,zIndex:O,isParent:k,noDragClassName:ee,noPanClassName:te,initialized:ne,disableKeyboardA11y:re,ariaLabel:ie,rfId:ae,hasHandleBounds:oe})=>{let se=UH(),ce=(0,D.useRef)(null),le=(0,D.useRef)(null),ue=(0,D.useRef)(S),de=(0,D.useRef)(C),fe=(0,D.useRef)(n),pe=v||_||l||u||d||f,me=iYe(),he=UU(t,se.getState,u),ge=UU(t,se.getState,d),_e=UU(t,se.getState,f),ve=UU(t,se.getState,p),ye=UU(t,se.getState,m),be=e=>{let{nodeDragThreshold:n}=se.getState();if(v&&(!x||!_||n>0)&&WU({id:t,store:se,nodeRef:ce}),l){let n=se.getState().nodeInternals.get(t);n&&l(e,{...n})}},xe=e=>{wqe(e)||re||(xqe.includes(e.key)&&v?WU({id:t,store:se,unselect:e.key===`Escape`,nodeRef:ce}):_&&c&&Object.prototype.hasOwnProperty.call(KU,e.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),me({x:KU[e.key].x,y:KU[e.key].y,isShiftPressed:e.shiftKey})))};(0,D.useEffect)(()=>()=>{le.current&&=(T?.unobserve(le.current),null)},[]),(0,D.useEffect)(()=>{if(ce.current&&!w){let e=ce.current;(!ne||!oe||le.current!==e)&&(le.current&&T?.unobserve(le.current),T?.observe(e),le.current=e)}},[w,ne,oe]),(0,D.useEffect)(()=>{let e=fe.current!==n,r=ue.current!==S,i=de.current!==C;ce.current&&(e||r||i)&&(e&&(fe.current=n),r&&(ue.current=S),i&&(de.current=C),se.getState().updateNodeDimensions([{id:t,nodeElement:ce.current,forceUpdate:!0}]))},[t,n,S,C]);let Se=rYe({nodeRef:ce,disabled:w||!_,noDragClassName:ee,handleSelector:E,nodeId:t,isSelectable:v,selectNodesOnDrag:x});return w?null:D.createElement(`div`,{className:qB([`react-flow__node`,`react-flow__node-${n}`,{[te]:_},g,{selected:c,selectable:v,parent:k,dragging:Se}]),ref:ce,style:{zIndex:O,transform:`translate(${o}px,${s}px)`,pointerEvents:pe?`all`:`none`,visibility:ne?`visible`:`hidden`,...h},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:he,onMouseMove:ge,onMouseLeave:_e,onContextMenu:ve,onClick:be,onDoubleClick:ye,onKeyDown:b?xe:void 0,tabIndex:b?0:void 0,role:b?`button`:void 0,"aria-describedby":re?void 0:`${TJe}-${ae}`,"aria-label":ie},D.createElement(Hqe,{value:t},D.createElement(e,{id:t,data:r,type:n,xPos:i,yPos:a,selected:c,isConnectable:y,sourcePosition:S,targetPosition:C,dragging:Se,dragHandle:E,zIndex:O})))};return t.displayName=`NodeWrapper`,(0,D.memo)(t)},aYe=e=>({...Yqe(e.getNodes().filter(e=>e.selected),e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive});function oYe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=UH(),{width:i,height:a,x:o,y:s,transformString:c,userSelectionActive:l}=HH(aYe,XB),u=iYe(),d=(0,D.useRef)(null);if((0,D.useEffect)(()=>{n||d.current?.focus({preventScroll:!0})},[n]),rYe({nodeRef:d}),l||!i||!a)return null;let f=e?t=>{e(t,r.getState().getNodes().filter(e=>e.selected))}:void 0;return D.createElement(`div`,{className:qB([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:c}},D.createElement(`div`,{ref:d,className:`react-flow__nodesselection-rect`,onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(KU,e.key)&&u({x:KU[e.key].x,y:KU[e.key].y,isShiftPressed:e.shiftKey})},style:{width:i,height:a,top:s,left:o}}))}var JU=(0,D.memo)(oYe),sYe=e=>e.nodesSelectionActive,cYe=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:c,onMoveStart:l,onMoveEnd:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:p,onSelectionStart:m,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:_,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:E,defaultViewport:O,translateExtent:k,minZoom:ee,maxZoom:te,preventScrolling:ne,onSelectionContextMenu:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:oe})=>{let se=HH(sYe),ce=DU(d),le=DU(_),ue=le||E,de=le||S,fe=ce||f&&ue!==!0;return LJe({deleteKeyCode:s,multiSelectionKeyCode:g}),D.createElement(WJe,{onMove:c,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:a,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:de,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:!ce&&ue,defaultViewport:O,translateExtent:k,minZoom:ee,maxZoom:te,zoomActivationKeyCode:v,preventScrolling:ne,noWheelClassName:ie,noPanClassName:ae},D.createElement(ZJe,{onSelectionStart:m,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ue,isSelecting:!!fe,selectionMode:p},e,se&&D.createElement(JU,{onSelectionContextMenu:re,noPanClassName:ae,disableKeyboardA11y:oe})))};cYe.displayName=`FlowRenderer`;var lYe=(0,D.memo)(cYe);function uYe(e){return HH((0,D.useCallback)(t=>e?Xqe(t.nodeInternals,{x:0,y:0,width:t.width,height:t.height},t.transform,!0):t.getNodes(),[e]))}function dYe(e){let t={input:qU(e.input||pJe),default:qU(e.default||dJe),output:qU(e.output||hJe),group:qU(e.group||gJe)},n=Object.keys(e).filter(e=>![`input`,`default`,`output`,`group`].includes(e)).reduce((t,n)=>(t[n]=qU(e[n]||dJe),t),{});return{...t,...n}}var fYe=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r||i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},pYe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),mYe=e=>{let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:a,onError:o}=HH(pYe,XB),s=uYe(e.onlyRenderVisibleElements),c=(0,D.useRef)(),l=(0,D.useMemo)(()=>{if(typeof ResizeObserver>`u`)return null;let e=new ResizeObserver(e=>{a(e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0})))});return c.current=e,e},[]);return(0,D.useEffect)(()=>()=>{c?.current?.disconnect()},[]),D.createElement(`div`,{className:`react-flow__nodes`,style:FU},s.map(a=>{let s=a.type||`default`;e.nodeTypes[s]||(o?.(`003`,VH.error003(s)),s=`default`);let c=e.nodeTypes[s]||e.nodeTypes.default,u=!!(a.draggable||t&&a.draggable===void 0),d=!!(a.selectable||i&&a.selectable===void 0),f=!!(a.connectable||n&&a.connectable===void 0),p=!!(a.focusable||r&&a.focusable===void 0),m=e.nodeExtent?gqe(a.positionAbsolute,e.nodeExtent):a.positionAbsolute,h=m?.x??0,g=m?.y??0,_=fYe({x:h,y:g,width:a.width??0,height:a.height??0,origin:e.nodeOrigin});return D.createElement(c,{key:a.id,id:a.id,className:a.className,style:a.style,type:s,data:a.data,sourcePosition:a.sourcePosition||cU.Bottom,targetPosition:a.targetPosition||cU.Top,hidden:a.hidden,xPos:h,yPos:g,xPosOrigin:_.x,yPosOrigin:_.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!a.selected,isDraggable:u,isSelectable:d,isConnectable:f,isFocusable:p,resizeObserver:l,dragHandle:a.dragHandle,zIndex:a[QH]?.z??0,isParent:!!a[QH]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!a.width&&!!a.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:a.ariaLabel,hasHandleBounds:!!a[QH]?.handleBounds})}))};mYe.displayName=`NodeRenderer`;var hYe=(0,D.memo)(mYe),YU=(e,t,n)=>n===cU.Left?e-t:n===cU.Right?e+t:e,gYe=(e,t,n)=>n===cU.Top?e-t:n===cU.Bottom?e+t:e,_Ye=`react-flow__edgeupdater`,vYe=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>D.createElement(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:qB([_Ye,`${_Ye}-${s}`]),cx:YU(t,r,e),cy:gYe(n,r,e),r,stroke:`transparent`,fill:`transparent`}),yYe=()=>!0,XU=e=>{let t=({id:t,className:n,type:r,data:i,onClick:a,onEdgeDoubleClick:o,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:h,source:g,target:_,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,elementsSelectable:w,hidden:T,sourceHandleId:E,targetHandleId:O,onContextMenu:k,onMouseEnter:ee,onMouseMove:te,onMouseLeave:ne,reconnectRadius:re,onReconnect:ie,onReconnectStart:ae,onReconnectEnd:oe,markerEnd:se,markerStart:ce,rfId:le,ariaLabel:ue,isFocusable:de,isReconnectable:fe,pathOptions:pe,interactionWidth:me,disableKeyboardA11y:he})=>{let ge=(0,D.useRef)(null),[_e,ve]=(0,D.useState)(!1),[ye,be]=(0,D.useState)(!1),xe=UH(),Se=(0,D.useMemo)(()=>`url('#${pU(ce,le)}')`,[ce,le]),Ce=(0,D.useMemo)(()=>`url('#${pU(se,le)}')`,[se,le]);if(T)return null;let we=e=>{let{edges:n,addSelectedEdges:r,unselectNodesAndEdges:i,multiSelectionActive:o}=xe.getState(),s=n.find(e=>e.id===t);s&&(w&&(xe.setState({nodesSelectionActive:!1}),s.selected&&o?(i({nodes:[],edges:[s]}),ge.current?.blur()):r([t])),a&&a(e,s))},Te=nU(t,xe.getState,o),Ee=nU(t,xe.getState,k),De=nU(t,xe.getState,ee),Oe=nU(t,xe.getState,te),ke=nU(t,xe.getState,ne),Ae=(e,n)=>{if(e.button!==0)return;let{edges:r,isValidConnection:i}=xe.getState(),a=n?_:g,o=(n?O:E)||null,s=n?`target`:`source`,c=i||yYe,l=n,u=r.find(e=>e.id===t);be(!0),ae?.(e,u,s),oJe({event:e,handleId:o,nodeId:a,onConnect:e=>ie?.(u,e),isTarget:l,getState:xe.getState,setState:xe.setState,isValidConnection:c,edgeUpdaterType:s,onReconnectEnd:e=>{be(!1),oe?.(e,u,s)}})},je=e=>Ae(e,!0),Me=e=>Ae(e,!1),Ne=()=>ve(!0),Pe=()=>ve(!1),Fe=!w&&!a;return D.createElement(`g`,{className:qB([`react-flow__edge`,`react-flow__edge-${r}`,n,{selected:s,animated:c,inactive:Fe,updating:_e}]),onClick:we,onDoubleClick:Te,onContextMenu:Ee,onMouseEnter:De,onMouseMove:Oe,onMouseLeave:ke,onKeyDown:de?e=>{if(!he&&xqe.includes(e.key)&&w){let{unselectNodesAndEdges:n,addSelectedEdges:r,edges:i}=xe.getState();e.key===`Escape`?(ge.current?.blur(),n({edges:[i.find(e=>e.id===t)]})):r([t])}}:void 0,tabIndex:de?0:void 0,role:de?`button`:`img`,"data-testid":`rf__edge-${t}`,"aria-label":ue===null?void 0:ue||`Edge from ${g} to ${_}`,"aria-describedby":de?`${TU}-${le}`:void 0,ref:ge},!ye&&D.createElement(e,{id:t,source:g,target:_,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,data:i,style:h,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,sourceHandleId:E,targetHandleId:O,markerStart:Se,markerEnd:Ce,pathOptions:pe,interactionWidth:me}),fe&&D.createElement(D.Fragment,null,(fe===`source`||fe===!0)&&D.createElement(vYe,{position:S,centerX:v,centerY:y,radius:re,onMouseDown:je,onMouseEnter:Ne,onMouseOut:Pe,type:`source`}),(fe===`target`||fe===!0)&&D.createElement(vYe,{position:C,centerX:b,centerY:x,radius:re,onMouseDown:Me,onMouseEnter:Ne,onMouseOut:Pe,type:`target`})))};return t.displayName=`EdgeWrapper`,(0,D.memo)(t)};function bYe(e){let t={default:XU(e.default||dU),straight:XU(e.bezier||Rqe),step:XU(e.step||Iqe),smoothstep:XU(e.step||uU),simplebezier:XU(e.simplebezier||Aqe)},n=Object.keys(e).filter(e=>![`default`,`bezier`].includes(e)).reduce((t,n)=>(t[n]=XU(e[n]||dU),t),{});return{...t,...n}}function xYe(e,t,n=null){let r=(n?.x||0)+t.x,i=(n?.y||0)+t.y,a=n?.width||t.width,o=n?.height||t.height;switch(e){case cU.Top:return{x:r+a/2,y:i};case cU.Right:return{x:r+a,y:i+o/2};case cU.Bottom:return{x:r+a/2,y:i+o};case cU.Left:return{x:r,y:i+o/2}}}function SYe(e,t){return e?e.length===1||!t?e[0]:t&&e.find(e=>e.id===t)||null:null}var CYe=(e,t,n,r,i,a)=>{let o=xYe(n,e,t),s=xYe(a,r,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function wYe({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,transform:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=JH({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:o/c[2],height:s/c[2]}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function TYe(e){let t=e?.[QH]?.handleBounds||null,n=t&&e?.width&&e?.height&&e?.positionAbsolute?.x!==void 0&&e?.positionAbsolute?.y!==void 0;return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!n]}var EYe=[{level:0,isMaxLevel:!0,edges:[]}];function ZU(e,t,n=!1){let r=-1,i=e.reduce((e,i)=>{let a=ZH(i.zIndex),o=a?i.zIndex:0;if(n){let e=t.get(i.target),n=t.get(i.source),r=i.selected||e?.selected||n?.selected,s=Math.max(n?.[QH]?.z||0,e?.[QH]?.z||0,1e3);o=(a?i.zIndex:0)+(r?s:0)}return e[o]?e[o].push(i):e[o]=[i],r=o>r?o:r,e},{}),a=Object.entries(i).map(([e,t])=>{let n=+e;return{edges:t,level:n,isMaxLevel:n===r}});return a.length===0?EYe:a}function DYe(e,t,n){return ZU(HH((0,D.useCallback)(n=>e?n.edges.filter(e=>{let r=t.get(e.source),i=t.get(e.target);return r?.width&&r?.height&&i?.width&&i?.height&&wYe({sourcePos:r.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:r.width,sourceHeight:r.height,targetWidth:i.width,targetHeight:i.height,width:n.width,height:n.height,transform:n.transform})}):n.edges,[e,t])),t,n)}var OYe=({color:e=`none`,strokeWidth:t=1})=>D.createElement(`polyline`,{style:{stroke:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,points:`-5,-4 0,0 -5,4`}),kYe=({color:e=`none`,strokeWidth:t=1})=>D.createElement(`polyline`,{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),AYe={[sU.Arrow]:OYe,[sU.ArrowClosed]:kYe};function QU(e){let t=UH();return(0,D.useMemo)(()=>Object.prototype.hasOwnProperty.call(AYe,e)?AYe[e]:(t.getState().onError?.(`009`,VH.error009(e)),null),[e])}var jYe=({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=QU(t);return c?D.createElement(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`},D.createElement(c,{color:n,strokeWidth:o})):null},MYe=({defaultColor:e,rfId:t})=>n=>{let r=[];return n.edges.reduce((n,i)=>([i.markerStart,i.markerEnd].forEach(i=>{if(i&&typeof i==`object`){let a=pU(i,t);r.includes(a)||(n.push({id:a,color:i.color||e,...i}),r.push(a))}}),n),[]).sort((e,t)=>e.id.localeCompare(t.id))},NYe=({defaultColor:e,rfId:t})=>{let n=HH((0,D.useCallback)(MYe({defaultColor:e,rfId:t}),[e,t]),(e,t)=>!(e.length!==t.length||e.some((e,n)=>e.id!==t[n].id)));return D.createElement(`defs`,null,n.map(e=>D.createElement(jYe,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient})))};NYe.displayName=`MarkerDefinitions`;var PYe=(0,D.memo)(NYe),FYe=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),IYe=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,children:g,disableKeyboardA11y:_})=>{let{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:b,width:x,height:S,connectionMode:C,nodeInternals:w,onError:T}=HH(FYe,XB),E=DYe(t,w,n);return x?D.createElement(D.Fragment,null,E.map(({level:t,edges:n,isMaxLevel:g})=>D.createElement(`svg`,{key:t,style:{zIndex:t},width:x,height:S,className:`react-flow__edges react-flow__container`},g&&D.createElement(PYe,{defaultColor:e,rfId:r}),D.createElement(`g`,null,n.map(e=>{let[t,n,g]=TYe(w.get(e.source)),[x,S,E]=TYe(w.get(e.target));if(!g||!E)return null;let O=e.type||`default`;i[O]||(T?.(`011`,VH.error011(O)),O=`default`);let k=i[O]||i.default,ee=C===rU.Strict?S.target:(S.target??[]).concat(S.source??[]),te=SYe(n.source,e.sourceHandle),ne=SYe(ee,e.targetHandle),re=te?.position||cU.Bottom,ie=ne?.position||cU.Top,ae=!!(e.focusable||v&&e.focusable===void 0),oe=e.reconnectable||e.updatable,se=f!==void 0&&(oe||y&&oe===void 0);if(!te||!ne)return T?.(`008`,VH.error008(te,e)),null;let{sourceX:ce,sourceY:le,targetX:ue,targetY:de}=CYe(t,te,re,x,ne,ie);return D.createElement(k,{key:e.id,id:e.id,className:qB([e.className,a]),type:O,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:ce,sourceY:le,targetX:ue,targetY:de,sourcePosition:re,targetPosition:ie,elementsSelectable:b,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,rfId:r,ariaLabel:e.ariaLabel,isFocusable:ae,isReconnectable:se,pathOptions:`pathOptions`in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:_})})))),g):null};IYe.displayName=`EdgeRenderer`;var LYe=(0,D.memo)(IYe),RYe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zYe({children:e}){let t=HH(RYe);return D.createElement(`div`,{className:`react-flow__viewport react-flow__container`,style:{transform:t}},e)}function BYe(e){let t=PU(),n=(0,D.useRef)(!1);(0,D.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var VYe={[cU.Left]:cU.Right,[cU.Right]:cU.Left,[cU.Top]:cU.Bottom,[cU.Bottom]:cU.Top},HYe=({nodeId:e,handleType:t,style:n,type:r=oU.Bezier,CustomComponent:i,connectionStatus:a})=>{let{fromNode:o,handleId:s,toX:c,toY:l,connectionMode:u}=HH((0,D.useCallback)(t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode}),[e]),XB),d=o?.[QH]?.handleBounds,f=d?.[t];if(u===rU.Loose&&(f||=d?.[t===`source`?`target`:`source`]),!o||!f)return null;let p=s?f.find(e=>e.id===s):f[0],m=p?p.x+p.width/2:(o.width??0)/2,h=p?p.y+p.height/2:o.height??0,g=(o.positionAbsolute?.x??0)+m,_=(o.positionAbsolute?.y??0)+h,v=p?.position,y=v?VYe[v]:null;if(!v||!y)return null;if(i)return D.createElement(i,{connectionLineType:r,connectionLineStyle:n,fromNode:o,fromHandle:p,fromX:g,fromY:_,toX:c,toY:l,fromPosition:v,toPosition:y,connectionStatus:a});let b=``,x={sourceX:g,sourceY:_,sourcePosition:v,targetX:c,targetY:l,targetPosition:y};return r===oU.Bezier?[b]=Vqe(x):r===oU.Step?[b]=lU({...x,borderRadius:0}):r===oU.SmoothStep?[b]=lU(x):r===oU.SimpleBezier?[b]=kqe(x):b=`M${g},${_} ${c},${l}`,D.createElement(`path`,{d:b,fill:`none`,className:`react-flow__connection-path`,style:n})};HYe.displayName=`ConnectionLine`;var $U=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function UYe({containerStyle:e,style:t,type:n,component:r}){let{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:c,connectionStatus:l}=HH($U,XB);return i&&a&&s&&o?D.createElement(`svg`,{style:e,width:s,height:c,className:`react-flow__edges react-flow__connectionline react-flow__container`},D.createElement(`g`,{className:qB([`react-flow__connection`,l])},D.createElement(HYe,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:r,connectionStatus:l}))):null}function WYe(e,t){return(0,D.useRef)(null),UH(),(0,D.useMemo)(()=>t(e),[e])}var GYe=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:c,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:h,onSelectionEnd:g,connectionLineType:_,connectionLineStyle:v,connectionLineComponent:y,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,deleteKeyCode:O,onlyRenderVisibleElements:k,elementsSelectable:ee,selectNodesOnDrag:te,defaultViewport:ne,translateExtent:re,minZoom:ie,maxZoom:ae,preventScrolling:oe,defaultMarkerColor:se,zoomOnScroll:ce,zoomOnPinch:le,panOnScroll:ue,panOnScrollSpeed:de,panOnScrollMode:fe,zoomOnDoubleClick:pe,panOnDrag:me,onPaneClick:he,onPaneMouseEnter:ge,onPaneMouseMove:_e,onPaneMouseLeave:ve,onPaneScroll:ye,onPaneContextMenu:be,onEdgeContextMenu:xe,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:Te,onReconnectStart:Ee,onReconnectEnd:De,reconnectRadius:Oe,noDragClassName:ke,noWheelClassName:Ae,noPanClassName:je,elevateEdgesOnSelect:Me,disableKeyboardA11y:Ne,nodeOrigin:Pe,nodeExtent:Fe,rfId:Ie})=>{let Le=WYe(e,dYe),Re=WYe(t,bYe);return BYe(a),D.createElement(lYe,{onPaneClick:he,onPaneMouseEnter:ge,onPaneMouseMove:_e,onPaneMouseLeave:ve,onPaneContextMenu:be,onPaneScroll:ye,deleteKeyCode:O,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:ce,zoomOnPinch:le,zoomOnDoubleClick:pe,panOnScroll:ue,panOnScrollSpeed:de,panOnScrollMode:fe,panOnDrag:me,defaultViewport:ne,translateExtent:re,minZoom:ie,maxZoom:ae,onSelectionContextMenu:m,preventScrolling:oe,noDragClassName:ke,noWheelClassName:Ae,noPanClassName:je,disableKeyboardA11y:Ne},D.createElement(zYe,null,D.createElement(LYe,{edgeTypes:Re,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:k,onEdgeContextMenu:xe,onEdgeMouseEnter:Se,onEdgeMouseMove:Ce,onEdgeMouseLeave:we,onReconnect:Te,onReconnectStart:Ee,onReconnectEnd:De,reconnectRadius:Oe,defaultMarkerColor:se,noPanClassName:je,elevateEdgesOnSelect:!!Me,disableKeyboardA11y:Ne,rfId:Ie},D.createElement(UYe,{style:v,type:_,component:y,containerStyle:b})),D.createElement(`div`,{className:`react-flow__edgelabel-renderer`}),D.createElement(hYe,{nodeTypes:Le,onNodeClick:o,onNodeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:te,onlyRenderVisibleElements:k,noPanClassName:je,noDragClassName:ke,disableKeyboardA11y:Ne,nodeOrigin:Pe,nodeExtent:Fe,rfId:Ie})))};GYe.displayName=`GraphView`;var KYe=(0,D.memo)(GYe),eW=[[-1/0,-1/0],[1/0,1/0]],tW={rfId:`1`,width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:eW,nodeExtent:eW,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:`source`,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:rU.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Sqe,isValidConnection:void 0},qYe=()=>dUe((e,t)=>({...tW,setNodes:n=>{let{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:jJe(n,r,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{let{defaultEdgeOptions:r={}}=t();e({edges:n.map(e=>({...r,...e}))})},setDefaultNodesAndEdges:(n,r)=>{let i=n!==void 0,a=r!==void 0;e({nodeInternals:i?jJe(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map,edges:a?r:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{let{onNodesChange:r,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:c,nodeOrigin:l}=t(),u=c?.querySelector(`.react-flow__viewport`);if(!u)return;let d=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(d.transform),p=n.reduce((e,t)=>{let n=i.get(t.id);if(n?.hidden)i.set(n.id,{...n,[QH]:{...n[QH],handleBounds:void 0}});else if(n){let r=hqe(t.nodeElement);r.width&&r.height&&(n.width!==r.width||n.height!==r.height||t.forceUpdate)&&(i.set(n.id,{...n,[QH]:{...n[QH],handleBounds:{source:HU(`.source`,t.nodeElement,f,l),target:HU(`.target`,t.nodeElement,f,l)}},...r}),e.push({id:n.id,type:`dimensions`,dimensions:r}))}return e},[]);AJe(i,l);let m=o||a&&!o&&MJe(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:m}),p?.length>0&&r?.(p)},updateNodePositions:(e,n=!0,r=!1)=>{let{triggerNodeChanges:i}=t();i(e.map(e=>{let t={id:e.id,type:`position`,dragging:r};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t}))},triggerNodeChanges:n=>{let{onNodesChange:r,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:c}=t();n?.length&&(a&&e({nodeInternals:jJe(YJe(n,s()),i,o,c)}),r?.(n))},addSelectedNodes:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>LU(e,!0)):(o=RU(a(),n),s=RU(i,[])),jU({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>LU(e,!0)):(o=RU(i,n),s=RU(a(),[])),jU({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{let{edges:i,getNodes:a}=t(),o=n||a(),s=r||i;jU({changedNodes:o.map(e=>(e.selected=!1,LU(e.id,!1))),changedEdges:s.map(e=>LU(e.id,!1)),get:t,set:e})},setMinZoom:n=>{let{d3Zoom:r,maxZoom:i}=t();r?.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{let{d3Zoom:r,minZoom:i}=t();r?.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{t().d3Zoom?.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{let{edges:n,getNodes:r}=t();jU({changedNodes:r().filter(e=>e.selected).map(e=>LU(e.id,!1)),changedEdges:n.filter(e=>e.selected).map(e=>LU(e.id,!1)),get:t,set:e})},setNodeExtent:n=>{let{nodeInternals:r}=t();r.forEach(e=>{e.positionAbsolute=gqe(e.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:e=>{let{transform:n,width:r,height:i,d3Zoom:a,d3Selection:o,translateExtent:s}=t();if(!a||!o||!e.x&&!e.y)return!1;let c=IH.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),l=[[0,0],[r,i]],u=a?.constrain()(c,l,s);return a.transform(o,u),n[0]!==u.x||n[1]!==u.y||n[2]!==u.k},cancelConnection:()=>e({connectionNodeId:tW.connectionNodeId,connectionHandleId:tW.connectionHandleId,connectionHandleType:tW.connectionHandleType,connectionStatus:tW.connectionStatus,connectionStartHandle:tW.connectionStartHandle,connectionEndHandle:tW.connectionEndHandle}),reset:()=>e({...tW})}),Object.is),nW=({children:e})=>{let t=(0,D.useRef)(null);return t.current||=qYe(),D.createElement(BH,{value:t.current},e)};nW.displayName=`ReactFlowProvider`;var JYe=({children:e})=>(0,D.useContext)(zH)?D.createElement(D.Fragment,null,e):D.createElement(nW,null,e);JYe.displayName=`ReactFlowWrapper`;var rW={input:pJe,default:dJe,output:hJe,group:gJe},YYe={default:dU,straight:Rqe,step:Iqe,smoothstep:uU,simplebezier:Aqe},XYe=[0,0],ZYe=[15,15],QYe={x:0,y:0,zoom:1},$Ye={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0},iW=(0,D.forwardRef)(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a=rW,edgeTypes:o=YYe,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:O,onSelectionChange:k,onSelectionDragStart:ee,onSelectionDrag:te,onSelectionDragStop:ne,onSelectionContextMenu:re,onSelectionStart:ie,onSelectionEnd:ae,connectionMode:oe=rU.Strict,connectionLineType:se=oU.Bezier,connectionLineStyle:ce,connectionLineComponent:le,connectionLineContainerStyle:ue,deleteKeyCode:de=`Backspace`,selectionKeyCode:fe=`Shift`,selectionOnDrag:pe=!1,selectionMode:me=aU.Full,panActivationKeyCode:he=`Space`,multiSelectionKeyCode:ge=eU()?`Meta`:`Control`,zoomActivationKeyCode:_e=eU()?`Meta`:`Control`,snapToGrid:ve=!1,snapGrid:ye=ZYe,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:xe=!0,nodesDraggable:Se,nodesConnectable:Ce,nodesFocusable:we,nodeOrigin:Te=XYe,edgesFocusable:Ee,edgesUpdatable:De,elementsSelectable:Oe,defaultViewport:ke=QYe,minZoom:Ae=.5,maxZoom:je=2,translateExtent:Me=eW,preventScrolling:Ne=!0,nodeExtent:Pe,defaultMarkerColor:Fe=`#b1b1b7`,zoomOnScroll:Ie=!0,zoomOnPinch:Le=!0,panOnScroll:Re=!1,panOnScrollSpeed:ze=.5,panOnScrollMode:Be=iU.Free,zoomOnDoubleClick:Ve=!0,panOnDrag:He=!0,onPaneClick:Ue,onPaneMouseEnter:We,onPaneMouseMove:Ge,onPaneMouseLeave:Ke,onPaneScroll:qe,onPaneContextMenu:Je,children:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,onEdgeUpdate:tt,onEdgeUpdateStart:nt,onEdgeUpdateEnd:rt,onReconnect:it,onReconnectStart:at,onReconnectEnd:ot,reconnectRadius:st=10,edgeUpdaterRadius:ct=10,onNodesChange:lt,onEdgesChange:ut,noDragClassName:dt=`nodrag`,noWheelClassName:ft=`nowheel`,noPanClassName:pt=`nopan`,fitView:mt=!1,fitViewOptions:ht,connectOnClick:gt=!0,attributionPosition:_t,proOptions:vt,defaultEdgeOptions:yt,elevateNodesOnSelect:bt=!0,elevateEdgesOnSelect:xt=!1,disableKeyboardA11y:St=!1,autoPanOnConnect:Ct=!0,autoPanOnNodeDrag:wt=!0,connectionRadius:Tt=20,isValidConnection:Et,onError:Dt,style:Ot,id:kt,nodeDragThreshold:At,...jt},Mt)=>{let Nt=kt||`1`;return D.createElement(`div`,{...jt,style:{...Ot,...$Ye},ref:Mt,className:qB([`react-flow`,i]),"data-testid":`rf__wrapper`,id:kt},D.createElement(JYe,null,D.createElement(KYe,{onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:se,connectionLineStyle:ce,connectionLineComponent:le,connectionLineContainerStyle:ue,selectionKeyCode:fe,selectionOnDrag:pe,selectionMode:me,deleteKeyCode:de,multiSelectionKeyCode:ge,panActivationKeyCode:he,zoomActivationKeyCode:_e,onlyRenderVisibleElements:be,selectNodesOnDrag:xe,defaultViewport:ke,translateExtent:Me,minZoom:Ae,maxZoom:je,preventScrolling:Ne,zoomOnScroll:Ie,zoomOnPinch:Le,zoomOnDoubleClick:Ve,panOnScroll:Re,panOnScrollSpeed:ze,panOnScrollMode:Be,panOnDrag:He,onPaneClick:Ue,onPaneMouseEnter:We,onPaneMouseMove:Ge,onPaneMouseLeave:Ke,onPaneScroll:qe,onPaneContextMenu:Je,onSelectionContextMenu:re,onSelectionStart:ie,onSelectionEnd:ae,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,onReconnect:it??tt,onReconnectStart:at??nt,onReconnectEnd:ot??rt,reconnectRadius:st??ct,defaultMarkerColor:Fe,noDragClassName:dt,noWheelClassName:ft,noPanClassName:pt,elevateEdgesOnSelect:xt,rfId:Nt,disableKeyboardA11y:St,nodeOrigin:Te,nodeExtent:Pe}),D.createElement(SJe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:Se,nodesConnectable:Ce,nodesFocusable:we,edgesFocusable:Ee,edgesUpdatable:De,elementsSelectable:Oe,elevateNodesOnSelect:bt,minZoom:Ae,maxZoom:je,nodeExtent:Pe,onNodesChange:lt,onEdgesChange:ut,snapToGrid:ve,snapGrid:ye,connectionMode:oe,translateExtent:Me,connectOnClick:gt,defaultEdgeOptions:yt,fitView:mt,fitViewOptions:ht,onNodesDelete:E,onEdgesDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:te,onSelectionDragStart:ee,onSelectionDragStop:ne,noPanClassName:pt,nodeOrigin:Te,rfId:Nt,autoPanOnConnect:Ct,autoPanOnNodeDrag:wt,onError:Dt,connectionRadius:Tt,isValidConnection:Et,nodeDragThreshold:At}),D.createElement(bJe,{onSelectionChange:k}),Ye,D.createElement(pqe,{proOptions:vt,position:_t}),D.createElement(OJe,{rfId:Nt,disableKeyboardA11y:St})))});iW.displayName=`ReactFlow`;var eXe=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function tXe({children:e}){let t=HH(eXe);return t?(0,uqe.createPortal)(e,t):null}function nXe(e){return t=>{let[n,r]=(0,D.useState)(t);return[n,r,(0,D.useCallback)(t=>r(n=>e(t,n)),[])]}}var rXe=nXe(YJe),iXe=nXe(XJe),aW;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(aW||={});function aXe({color:e,dimensions:t,lineWidth:n}){return D.createElement(`path`,{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function oXe({color:e,radius:t}){return D.createElement(`circle`,{cx:t,cy:t,r:t,fill:e})}var sXe={[aW.Dots]:`#91919a`,[aW.Lines]:`#eee`,[aW.Cross]:`#e2e2e2`},cXe={[aW.Dots]:1,[aW.Lines]:1,[aW.Cross]:6},lXe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function uXe({id:e,variant:t=aW.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=2,color:o,style:s,className:c}){let l=(0,D.useRef)(null),{transform:u,patternId:d}=HH(lXe,XB),f=o||sXe[t],p=r||cXe[t],m=t===aW.Dots,h=t===aW.Cross,g=Array.isArray(n)?n:[n,n],_=[g[0]*u[2]||1,g[1]*u[2]||1],v=p*u[2],y=h?[v,v]:_,b=m?[v/a,v/a]:[y[0]/a,y[1]/a];return D.createElement(`svg`,{className:qB([`react-flow__background`,c]),style:{...s,position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},ref:l,"data-testid":`rf__background`},D.createElement(`pattern`,{id:d+e,x:u[0]%_[0],y:u[1]%_[1],width:_[0],height:_[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${b[0]},-${b[1]})`},m?D.createElement(oXe,{color:f,radius:v/a}):D.createElement(aXe,{dimensions:y,color:f,lineWidth:i})),D.createElement(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${d+e})`}))}uXe.displayName=`Background`;var dXe=(0,D.memo)(uXe),fXe=(0,D.createContext)(void 0);const pXe=()=>{let e=(0,D.useContext)(fXe);if(!e)throw Error(`useCanvasDrawerContext must be used within CanvasDrawerProvider`);return e},oW=({children:e})=>{let[t,n]=(0,D.useState)(null),r=(0,D.useCallback)(e=>{n({id:`add-step`,data:{type:`addStep`,metadata:e}})},[]),i=(0,D.useCallback)(()=>{n(null)},[]);return(0,A.jsx)(fXe.Provider,{value:{canvasDrawer:t,openAddStep:r,closeCanvasDrawer:i},children:e})},sW=({icon:e,category:t,docsHref:n,categoryPath:r,currentItem:i,items:a,onItemSelect:o,subtitle:s,tabs:c,rightSection:l})=>{let u=Hy(),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``),h=(0,D.useMemo)(()=>{if(!a)return[];if(!p)return a;let e=p.toLowerCase();return a.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[a,p]),g=e=>{f(!1),m(``),o?.(e)};return(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,h:50,className:fx.noShrink,style:{zIndex:9999,borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-body)`},children:[r?(0,A.jsx)(u,{to:r,style:{textDecoration:`none`},children:(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:t})}):i?(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:t}):null,i&&!a&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:`/`}),(0,A.jsx)(N,{size:`md`,fw:500,children:i})]}),i&&a&&o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`md`,c:`dimmed`,children:`/`}),(0,A.jsxs)(df,{opened:d,onChange:f,width:300,position:`bottom-start`,shadow:`md`,zIndex:1e4,children:[(0,A.jsx)(df.Target,{children:(0,A.jsxs)(Ud,{onClick:()=>f(e=>!e),style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,A.jsx)(N,{size:`md`,fw:500,children:i}),(0,A.jsx)(tb,{size:14})]})}),(0,A.jsxs)(df.Dropdown,{p:0,children:[(0,A.jsx)(ig,{placeholder:`Search ${t.toLowerCase()}...`,leftSection:(0,A.jsx)(Mb,{size:14}),value:p,onChange:e=>m(e.currentTarget.value),styles:{input:{border:`none`,borderBottom:`1px solid var(--mantine-color-default-border)`,borderRadius:0}}}),(0,A.jsx)(Hd.Autosize,{mah:300,children:(0,A.jsxs)(Bh,{gap:0,children:[h.map(e=>(0,A.jsxs)(Ud,{onClick:()=>g(e.name),py:`xs`,px:`sm`,style:{display:`flex`,alignItems:`center`,gap:8,backgroundColor:e.name===i?`var(--mantine-color-green-light)`:void 0},children:[e.name===i&&(0,A.jsx)(eb,{size:14,color:`var(--mantine-color-green-6)`}),(0,A.jsxs)(`div`,{style:{marginLeft:e.name===i?0:22},children:[(0,A.jsx)(N,{size:`sm`,fw:e.name===i?500:400,children:e.name}),e.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description})]})]},e.name)),h.length===0&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ta:`center`,py:`md`,children:`No results`})]})})]})]})]}),s,c&&(0,A.jsx)(j,{ml:`md`,children:c}),(0,A.jsxs)(Sf,{ml:`auto`,gap:`sm`,children:[l,(0,A.jsx)(Ch,{label:`${t} docs`,children:(0,A.jsx)(_f,{component:`a`,href:n,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})]})};var mXe=({id:e,size:t=20})=>{let n=By(),{data:r}=Rr({queryKey:[`addon`,`icon`,e],queryFn:()=>n.invoke(`console:getAddonIcon`,{alias:e})});return r?(0,A.jsx)(`img`,{src:`data:image/svg+xml,${encodeURIComponent(r)}`,alt:``,width:t,height:t,style:{display:`block`}}):(0,A.jsx)(j,{style:{width:t,height:t}})},hXe=[{id:`startWorkflow`,name:`Start Workflow`,description:`Start another workflow`,icon:Eb},{id:`branch`,name:`If`,description:`Route items to different branches (true/false)`,icon:Wfe},{id:`switch`,name:`Switch`,description:`Route items depending on defined expression or rules`,icon:fb},{id:`fanout`,name:`Loop Over Items (Split in Batches)`,description:`Split data into batches and iterate over each batch`,icon:Ife},{id:`parallel`,name:`Parallel`,description:`Execute multiple branches concurrently`,icon:Bb},{id:`sleep`,name:`Wait`,description:`Wait before continuing with execution`,icon:ab},{id:`return`,name:`Return`,description:`Return a value from the workflow`,icon:cb},{id:`cancel`,name:`Stop and Error`,description:`Throw an error in the workflow`,icon:xfe}],gXe=[{id:`http`,name:`HTTP`,description:`REST API endpoints and webhooks`,icon:pb},{id:`channel`,name:`Channel`,description:`Real-time WebSocket communication`,icon:kb},{id:`cli`,name:`CLI`,description:`Command-line interface commands`,icon:Ib},{id:`mcp`,name:`MCP`,description:`AI assistant tools (Model Context Protocol)`,icon:Qy},{id:`scheduler`,name:`Scheduler`,description:`Time-based scheduled tasks`,icon:$y},{id:`queue`,name:`Queue`,description:`Background job processing`,icon:yb}],_Xe={http:[{id:`httpSetHeader`,name:`Set Header`,description:`Set an HTTP response header`},{id:`httpSetStatus`,name:`Set Status`,description:`Set HTTP response status code`},{id:`httpRedirect`,name:`Redirect`,description:`Redirect to another URL`},{id:`httpSetCookie`,name:`Set Cookie`,description:`Set a response cookie`}],channel:[{id:`channelSend`,name:`Send Message`,description:`Send a message to the channel`},{id:`channelBroadcast`,name:`Broadcast`,description:`Broadcast to all channel subscribers`},{id:`channelClose`,name:`Close Connection`,description:`Close the WebSocket connection`}],mcp:[{id:`mcpDisableTool`,name:`Disable Tool`,description:`Disable an MCP tool`},{id:`mcpEnableTool`,name:`Enable Tool`,description:`Enable an MCP tool`}],session:[{id:`sessionGet`,name:`Get Session`,description:`Get the current user session`},{id:`sessionSet`,name:`Set Session`,description:`Set/update the user session`},{id:`sessionClear`,name:`Clear Session`,description:`Clear the user session`}]},cW=({icon:e,title:t,description:n,onClick:r,showArrow:i=!0})=>{let[a,o]=(0,D.useState)(!1);return(0,A.jsx)(Ud,{onClick:r,p:`md`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:fx.drawerButton,style:{backgroundColor:a?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,children:[(0,A.jsx)(j,{className:fx.drawerIconBox,children:(0,A.jsx)(e,{size:20})}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:t}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:n})]})]}),i&&(0,A.jsx)(nb,{size:16,color:`var(--mantine-color-default-border)`})]})})},lW=({title:e,iconId:t,onClick:n})=>(0,A.jsx)(Ud,{onClick:n,p:`md`,className:fx.drawerButton,children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Yy,{size:16}),t&&(0,A.jsx)(mXe,{id:t,size:16}),(0,A.jsx)(N,{size:`sm`,fw:600,children:e})]})}),uW=({icon:e,name:t,description:n,onClick:r})=>{let[i,a]=(0,D.useState)(!1);return(0,A.jsx)(Ud,{onClick:r,p:`md`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:fx.drawerButton,style:{backgroundColor:i?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,children:[e&&(0,A.jsx)(j,{className:fx.drawerIconBox,children:(0,A.jsx)(e,{size:20})}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:t}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:n})]})]})})},vXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Flow`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:hXe.map(e=>(0,A.jsx)(uW,{icon:e.icon,name:e.name,description:e.description},e.id))})]}),yXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Triggers`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:gXe.map(e=>(0,A.jsx)(uW,{icon:e.icon,name:e.name,description:e.description},e.id))})]}),bXe=[{key:`http`,title:`HTTP`,icon:pb},{key:`channel`,title:`Channel`,icon:kb},{key:`mcp`,title:`MCP`,icon:Qy},{key:`session`,title:`Session`,icon:Kfe}],xXe=({onBack:e})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Wire`,onClick:e}),(0,A.jsx)(Bh,{gap:0,children:bXe.map(({key:e,title:t})=>(0,A.jsxs)(j,{children:[(0,A.jsx)(j,{px:`md`,py:`xs`,bg:`var(--mantine-color-default-hover)`,children:(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,tt:`uppercase`,children:t})}),_Xe[e].map(e=>(0,A.jsx)(uW,{name:e.name,description:e.description},e.id))]},e))})]}),SXe=({onBack:e})=>{let{isLoading:t,isError:n}=Xk();return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Transform`,onClick:e}),t&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load transforms`})}),!t&&!n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No transforms available`})})]})},CXe=({onBack:e})=>{let{data:t,isLoading:n,isError:r}=Jk(),{data:i}=Xk(),a=D.useMemo(()=>{if(!t)return[];let e=new Set;if(i)for(let t of i)for(let n of Object.keys(t.functions??{}))e.add(n);return Object.values(t).filter(t=>!e.has(t.name))},[t,i]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Functions`,onClick:e}),n&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),r&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load functions`})}),a.length===0&&!n&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No functions available`})}),a.length>0&&(0,A.jsx)(Bh,{gap:0,children:a.map(e=>(0,A.jsx)(uW,{icon:ob,name:e.name,description:e.summary||e.description||``},e.name))})]})},wXe=({addon:e,onSelect:t})=>{let[n,r]=(0,D.useState)(!1),i=Object.keys(e.functions??{}).length;return(0,A.jsx)(Ud,{onClick:t,p:`md`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),className:fx.drawerButton,style:{backgroundColor:n?`var(--mantine-color-gray-1)`:void 0},children:(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,justify:`space-between`,children:[(0,A.jsxs)(Sf,{gap:`md`,wrap:`nowrap`,className:fx.flexGrow,children:[(0,A.jsx)(mXe,{id:e.id,size:20}),(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{size:`sm`,fw:500,children:e.displayName}),(0,A.jsx)(eS,{type:`dynamic`,badge:`functions`,value:i})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description})]})]}),(0,A.jsx)(nb,{size:16,color:`var(--mantine-color-default-border)`})]})})},TXe=({onBack:e,onSelectAddon:t})=>{let{data:n,isLoading:r,isError:i}=Xk(),a=D.useMemo(()=>n?n.filter(e=>e.id!==`pikku`):[],[n]);return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:`Addons`,onClick:e}),r&&(0,A.jsx)(j,{p:`xl`,className:fx.centeredLoader,children:(0,A.jsx)(mf,{size:`sm`})}),i&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`red`,children:`Failed to load addons`})}),a.length===0&&!r&&!i&&(0,A.jsx)(j,{p:`md`,children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`No addons available`})}),a.length>0&&(0,A.jsx)(Bh,{gap:0,children:a.map(e=>(0,A.jsx)(wXe,{addon:e,onSelect:()=>t(e)},e.id))})]})},EXe=({addon:e,onBack:t})=>{let n=Object.entries(e.functions??{}),r=Object.keys(e.secrets??{});return(0,A.jsxs)(j,{children:[(0,A.jsx)(lW,{title:e.displayName,iconId:e.id,onClick:t}),(0,A.jsxs)(j,{p:`md`,className:fx.drawerButton,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e.description}),r.length>0&&(0,A.jsxs)(j,{mt:`sm`,children:[(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,mb:`xs`,children:`Secrets`}),(0,A.jsx)(Bh,{gap:`xs`,children:r.map(e=>(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)(jfe,{size:14,color:`var(--mantine-color-default-border)`}),(0,A.jsx)(N,{size:`sm`,children:e})]},e))})]})]}),(0,A.jsx)(Bh,{gap:0,children:n.map(([e,t])=>(0,A.jsx)(uW,{name:t?.displayName??e,description:t?.description??``},e))})]})},DXe=()=>{let[e,t]=(0,D.useState)(`main`);return e===`functions`?(0,A.jsx)(CXe,{onBack:()=>t(`main`)}):e===`flow`?(0,A.jsx)(vXe,{onBack:()=>t(`main`)}):e===`triggers`?(0,A.jsx)(yXe,{onBack:()=>t(`main`)}):e===`wire`?(0,A.jsx)(xXe,{onBack:()=>t(`main`)}):e===`transform`?(0,A.jsx)(SXe,{onBack:()=>t(`main`)}):e===`addons`?(0,A.jsx)(TXe,{onBack:()=>t(`main`),onSelectAddon:e=>t({type:`addonDetail`,addon:e})}):typeof e==`object`&&e.type===`addonDetail`?(0,A.jsx)(EXe,{addon:e.addon,onBack:()=>t(`addons`)}):(0,A.jsxs)(j,{children:[(0,A.jsx)(j,{p:`md`,className:fx.drawerButton,children:(0,A.jsx)(N,{size:`sm`,fw:600,children:`Add a node`})}),(0,A.jsxs)(Bh,{gap:0,children:[(0,A.jsx)(cW,{icon:ob,title:`Function`,description:`Call an internal function or RPC`,onClick:()=>t(`functions`)}),(0,A.jsx)(cW,{icon:fb,title:`Flow`,description:`Branch, merge or loop the flow, etc.`,onClick:()=>t(`flow`)}),(0,A.jsx)(cW,{icon:Yfe,title:`Transform`,description:`Edit, filter, and transform data`,onClick:()=>t(`transform`)}),(0,A.jsx)(cW,{icon:Db,title:`Addons`,description:`Third-party services and APIs`,onClick:()=>t(`addons`)}),(0,A.jsx)(cW,{icon:kb,title:`Triggers`,description:`HTTP, WebSocket, CLI, MCP, Queue, Scheduler`,onClick:()=>t(`triggers`)}),(0,A.jsx)(cW,{icon:yfe,title:`Wire`,description:`HTTP headers, session, channel, MCP tools`,onClick:()=>t(`wire`)})]})]})};const OXe=e=>{switch(e.type){case`addStep`:return(0,A.jsx)(DXe,{});default:return null}};var kXe={running:`blue`,completed:`green`,failed:`red`,cancelled:`gray`},dW=e=>new Date(e).toLocaleString(),fW=({run:e,selected:t,onSelect:n,onDelete:r})=>{let[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(!1);return i?(0,A.jsxs)(j,{py:`sm`,px:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-red-light)`},children:[(0,A.jsx)(N,{size:`sm`,fw:500,mb:6,children:`Delete this run? This can't be undone.`}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Xf,{size:`compact-xs`,color:`red`,leftSection:(0,A.jsx)(eb,{size:12}),onClick:()=>{r?.(e.id),a(!1)},children:`Yes`}),(0,A.jsx)(Xf,{size:`compact-xs`,variant:`default`,leftSection:(0,A.jsx)(Hb,{size:12}),onClick:()=>a(!1),children:`No`})]})]}):(0,A.jsx)(j,{py:`sm`,px:`sm`,style:{backgroundColor:t?`var(--mantine-color-blue-light)`:void 0,borderBottom:`1px solid var(--mantine-color-default-border)`,cursor:`pointer`},onClick:n,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:(0,A.jsxs)(Sf,{gap:`xs`,justify:`space-between`,wrap:`nowrap`,align:`center`,children:[(0,A.jsxs)(Bh,{gap:2,style:{minWidth:0,flex:1},children:[(0,A.jsxs)(Sf,{gap:`xs`,wrap:`nowrap`,style:{minWidth:0},children:[(0,A.jsx)(Jf,{size:`sm`,color:kXe[e.status]||`gray`,variant:`filled`,circle:!0,children:` `}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,truncate:!0,children:e.label||e.id.slice(0,8)}),e.wire&&(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`gray`,children:e.wire.type})]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,pl:18,children:dW(e.createdAt)})]}),r&&o&&(0,A.jsx)(_f,{variant:`subtle`,size:`md`,color:`gray`,onClick:e=>{e.stopPropagation(),a(!0)},title:`Delete run`,children:(0,A.jsx)(Hb,{size:16})})]})})};const pW=({runs:e,selectedId:t,onSelect:n,onClear:r,loading:i=!1,statusFilters:a=[`running`,`completed`,`failed`],title:o,emptyMessage:s=`No runs found`,onNewClick:c,newButtonLabel:l=`New`,onStatusFilterChange:u,onDelete:d})=>{let[f,p]=(0,D.useState)(`all`),m=(0,D.useMemo)(()=>f===`all`?e:e.filter(e=>e.status===f),[e,f]),h=e=>{p(e),u?.(e===`all`?void 0:e)},g=[{value:`all`,label:`All`},...a.map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1)}))];return(0,A.jsxs)(Bh,{gap:0,className:fx.flexColumn,children:[a.length>0&&(0,A.jsx)(j,{px:`sm`,py:`xs`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(wh,{size:`sm`,fullWidth:!0,value:f,onChange:h,data:g})}),(0,A.jsxs)(Hd,{className:fx.flexGrow,children:[c&&(0,A.jsx)(j,{py:`sm`,px:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,cursor:`pointer`},onClick:c,children:(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(Ob,{size:16,color:`var(--mantine-color-primary-6)`}),(0,A.jsx)(N,{size:`sm`,fw:500,c:`primary`,children:l})]})}),i?(0,A.jsx)(j,{p:`md`,ta:`center`,children:(0,A.jsx)(mf,{size:`sm`})}):m.length===0?(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ta:`center`,py:`md`,children:s}):(0,A.jsx)(Bh,{gap:0,children:m.map(e=>(0,A.jsx)(fW,{run:e,selected:e.id===t,onSelect:()=>n(e.id),onDelete:d},e.id))})]})]})};var AXe={succeeded:`var(--pikku-status-succeeded, var(--mantine-color-green-4))`,failed:`var(--pikku-status-failed, var(--mantine-color-red-4))`,running:`var(--pikku-status-running, var(--mantine-color-blue-4))`,scheduled:`var(--pikku-status-scheduled, var(--mantine-color-orange-4))`,pending:`var(--pikku-status-pending, var(--mantine-color-gray-4))`,suspended:`var(--pikku-status-suspended, var(--mantine-color-yellow-4))`,cancelled:`var(--pikku-status-cancelled, var(--mantine-color-gray-5))`,skipped:`var(--pikku-status-skipped, var(--mantine-color-gray-4))`},jXe=(e,t,n)=>{let r=n||t.colors.gray[5],i=t.radius.md;switch(e){case`left`:return{left:0,top:0,bottom:0,width:4,height:`auto`,backgroundColor:r,borderTopLeftRadius:i,borderBottomLeftRadius:i};case`top`:return{left:0,right:0,top:0,width:`auto`,height:4,backgroundColor:r,borderTopLeftRadius:i,borderTopRightRadius:i};case`right`:default:return{right:0,top:0,bottom:0,width:4,height:`auto`,backgroundColor:r,borderTopRightRadius:i,borderBottomRightRadius:i}}},mW=(e,t)=>e?e===`focused`?t.colors?.primary?.[5]??t.colors?.blue?.[5]??`#228be6`:t.colors?.referencedNode?.[5]??t.colors?.violet?.[5]??`#7950f2`:null;const hW=({icon:e,colorKey:t,hasInput:n=!1,outputHandles:r=[],size:i=80,label:a,labelDimmed:o=!0,subtitle:s,onClick:c,borderPosition:l=`right`,showBorder:u=!0,borderColor:d,highlightType:f=null,nodeId:p})=>{let m=ds(),h=mW(f,m),g=Wk(),_=D.useMemo(()=>{if(!g?.selectedRunId||!p)return null;let e=g.stepStates.get(p)?.status;return!e&&!n&&g.stepStates.size===0&&g.runData?.status===`failed`&&(e=`failed`),e?AXe[e]??null:null},[g?.selectedRunId,g?.stepStates,g?.runData?.status,p,n]),v=h||(_?`white`:m.colors.gray[5]||t);return(0,A.jsxs)(j,{style:{width:i,overflow:`visible`},children:[(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:i,h:i,pos:`relative`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:c?`pointer`:`default`,..._?{background:_}:{}},onClick:c,children:[n&&(0,A.jsx)(bU,{type:`target`,position:cU.Left,style:{cursor:`default`}}),(0,A.jsx)(j,{style:{verticalAlign:`middle`,color:v},children:(0,A.jsx)(e,{size:50})}),u&&(0,A.jsx)(j,{pos:`absolute`,style:jXe(l,m,d)}),r.length>0&&r.map((e,t)=>{let n=r.length,i=n===1?50:25+50/(n-1)*t,a=e.label&&n>1;return(0,A.jsxs)(D.Fragment,{children:[(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:e.id,style:{top:`${i}%`,cursor:`default`}}),a&&(0,A.jsx)(N,{size:`10px`,c:`dimmed`,pos:`absolute`,style:{right:-4,top:`${i}%`,transform:`translate(100%, -50%)`,whiteSpace:`nowrap`,backgroundColor:`var(--mantine-color-body)`,padding:`2px 5px`,borderRadius:2},children:e.label})]},e.id)})]}),(a||s)&&(0,A.jsxs)(j,{style:{position:`absolute`,top:i+12,left:`50%`,transform:`translateX(-50%)`,textAlign:`center`,width:i*2},children:[a&&(0,A.jsx)(N,{size:`sm`,fw:600,c:h||(o?`dimmed`:void 0),children:a}),s&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:s})]})]})};var MXe={http:`http`,queue:`queue`,cli:`cli`,"mcp-tool":`mcp`,"mcp-prompt":`mcp`,"mcp-resource":`mcp`,schedule:`scheduler`,trigger:`trigger`},NXe={http:Xfe,queue:yb,cli:Ib,"mcp-tool":Vb,"mcp-prompt":Dfe,"mcp-resource":Ofe,schedule:ab,trigger:Ub};const gW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=Wk(),a=ds(),o=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),s=D.useCallback(()=>{n(t,`trigger`)},[t,n]),c=NXe[e.triggerType]||Ub,l={http:`HTTP`,queue:`Queue`,cli:`CLI`,"mcp-tool":`MCP Tool`,"mcp-prompt":`MCP Prompt`,"mcp-resource":`MCP Resource`,schedule:`Schedule`,trigger:`Trigger`}[e.triggerType]||`Trigger`,u=D.useMemo(()=>{let t=i?.runData?.wire;if(!t)return;let n=MXe[e.triggerType];if(t.type===n)return e.wireId&&t.id?t.id===e.wireId?a.colors[e.colorKey]?.[5]:void 0:a.colors[e.colorKey]?.[5]},[i?.runData?.wire,e.triggerType,e.wireId,e.colorKey,a]);return(0,A.jsx)(hW,{icon:c,colorKey:e.colorKey,hasInput:!1,outputHandles:e.outputHandles,size:80,label:l,subtitle:e.label===l?void 0:e.label,onClick:s,borderPosition:`left`,borderColor:u,highlightType:o,nodeId:t})},PXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`http`,triggerType:`http`,label:`${n.method?.toUpperCase()||`GET`} ${n.route||``}`,wireId:`${n.method?.toLowerCase()||`get`}:${n.route||``}`,outputHandles:r,nodeType:`wiring`}}},FXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`queue`,triggerType:`queue`,label:n.name||`Queue`,wireId:n.name,outputHandles:r,nodeType:`wiring`}}},IXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`cli`,triggerType:`cli`,label:n.command||`CLI`,wireId:n.command,outputHandles:r,nodeType:`wiring`}}},LXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-tool`,label:n.name||`MCP Tool`,wireId:n.name?`tool:${n.name}`:void 0,outputHandles:r,nodeType:`wiring`}}},RXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-prompt`,label:n.name||`MCP Prompt`,wireId:n.name?`prompt:${n.name}`:void 0,outputHandles:r,nodeType:`wiring`}}},zXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`mcp`,triggerType:`mcp-resource`,label:n.uri||`MCP Resource`,wireId:n.uri?`resource:${n.uri}`:void 0,outputHandles:r,nodeType:`wiring`}}},BXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`schedule`,triggerType:`schedule`,label:n.cron||n.interval||`Schedule`,wireId:n.cron||n.interval,outputHandles:r,nodeType:`wiring`}}},VXe=(e,t,n)=>{let r=[];return n.startNode&&r.push({id:`start`,label:``}),{id:e,type:`wiringNode`,position:t,data:{colorKey:`trigger`,triggerType:`trigger`,label:n.name||`Trigger`,wireId:n.name,outputHandles:r,nodeType:`wiring`}}},HXe=({size:e=40})=>(0,A.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 48 48`,fill:`currentColor`,children:[(0,A.jsx)(`path`,{d:`M24,25.9a14.7,14.7,0,0,1,3.5-9.6,2,2,0,0,0-3-2.6A18.2,18.2,0,0,0,20,25.9a18.4,18.4,0,0,0,4.5,12.5A2.2,2.2,0,0,0,26,39a2.4,2.4,0,0,0,1.4-.5,2.2,2.2,0,0,0,.1-2.9A14.2,14.2,0,0,1,24,25.9Z`}),(0,A.jsx)(`path`,{d:`M41.5,13.7a2,2,0,0,0-3,2.6A14.7,14.7,0,0,1,42,25.9a14.2,14.2,0,0,1-3.5,9.7,2.2,2.2,0,0,0,.1,2.9A2.4,2.4,0,0,0,40,39a2.2,2.2,0,0,0,1.5-.6A18.4,18.4,0,0,0,46,25.9,18.2,18.2,0,0,0,41.5,13.7Z`}),(0,A.jsx)(`path`,{d:`M38.7,30.9,35.4,26l3.3-4.9a2,2,0,1,0-3.4-2.2L33,22.4l-2.3-3.5a2,2,0,1,0-3.4,2.2L30.6,26l-3.3,4.9a2.1,2.1,0,0,0,.6,2.8A2,2,0,0,0,29,34a2.1,2.1,0,0,0,1.7-.9L33,29.6l2.3,3.5A2.1,2.1,0,0,0,37,34a2,2,0,0,0,1.1-.3A2.1,2.1,0,0,0,38.7,30.9Z`}),(0,A.jsx)(`path`,{d:`M18,15H15.8l.5-3.5A3.9,3.9,0,0,1,20.2,8H22a2,2,0,0,0,0-4H20.2a8.1,8.1,0,0,0-7.9,6.9L11.7,15H9a2,2,0,0,0,0,4h2.2L8.7,36.5A3.9,3.9,0,0,1,4.8,40H4a2,2,0,0,0,0,4h.8a8.1,8.1,0,0,0,7.9-6.9L15.2,19H18a2,2,0,0,0,0-4Z`})]}),UXe=({data:e,id:t,inFlow:n=!0})=>{let{data:r}=Yk(e.title),{openFunction:i,openWorkflowStep:a}=_x(),o=Kk(),s=D.useMemo(()=>!o||!e.inWorkflow?null:o.focusedNodeId===t?`focused`:o.referencedNodeId===t?`referenced`:null,[o,e.inWorkflow,t]),c=D.useCallback(()=>{e.inWorkflow?a(t,`rpc`):i(e.title,r)},[e.title,e.inWorkflow,t,r,i,a]),l=!!e.stepName,u=e.stepName||e.description||e.title,d=l?e.title:void 0;return(0,A.jsx)(hW,{icon:HXe,colorKey:e.colorKey,hasInput:n,outputHandles:e.terminal?[]:[{id:`default`,label:``}],size:80,label:u,labelDimmed:!l,subtitle:d,onClick:c,showBorder:!1,highlightType:s,nodeId:t})},WXe=(e,t,n,r,i,a,o)=>({id:e,type:`functionNode`,position:n,data:{type:`Function`,title:t,stepName:r,colorKey:`function`,nodeType:`rpc`,inWorkflow:o!==void 0}}),_W=({data:e,hasInput:t=!1,hasOutput:n=!0,outputHandles:r,additionalBody:i,width:a=200,hideMetadataIndicators:o=!1,inFlow:s=!0})=>(ds(),(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:a,pos:`relative`,children:[s&&t&&(0,A.jsx)(bU,{type:`target`,position:cU.Left,style:{cursor:`default`}}),(0,A.jsx)(j,{p:`sm`,className:`nodrag`,style:{cursor:e.onClick?`pointer`:`default`},onClick:e.onClick,children:(0,A.jsxs)(Bh,{gap:4,children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,lineClamp:2,children:e.title}),e.description&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:500,children:e.description}),e.tags&&e.tags.length>0&&(0,A.jsx)(Sf,{gap:4,children:e.tags.map(t=>(0,A.jsx)(eS,{type:`dynamic`,badge:`tag`,value:t,size:`sm`,variant:`light`,color:e.colorKey},t))}),!o&&(e.auth!==void 0||e.permissionsCount&&e.permissionsCount>0||e.middlewareCount&&e.middlewareCount>0)&&(0,A.jsxs)(Sf,{gap:6,children:[e.auth!==void 0&&(e.auth?(0,A.jsx)(bb,{size:12,strokeWidth:2}):(0,A.jsx)(Mfe,{size:12,strokeWidth:2})),e.permissionsCount!==void 0&&e.permissionsCount>0&&(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(Pb,{size:12,strokeWidth:2}),(0,A.jsx)(N,{size:`sm`,fw:500,children:e.permissionsCount})]}),e.middlewareCount!==void 0&&e.middlewareCount>0&&(0,A.jsxs)(Sf,{gap:4,children:[(0,A.jsx)(hb,{size:12,strokeWidth:2}),(0,A.jsx)(N,{size:`sm`,fw:500,children:e.middlewareCount})]})]}),i]})}),s&&(r&&r.length>0?r.map((e,t)=>{let n=r.length;return(0,A.jsxs)(j,{pos:`absolute`,right:-12,style:{top:`${n===1?50:25+50/(n-1)*t}%`,transform:`translateY(-50%)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,fw:500,children:e.label||e.id}),(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:e.id,style:{position:`relative`,right:0,transform:`none`,cursor:`default`}})]},e.id)}):n&&(0,A.jsx)(bU,{type:`source`,position:cU.Right,style:{cursor:`default`}}))]})),GXe=({data:e})=>(0,A.jsx)(_W,{data:e,hasInput:!1,hasOutput:!0,width:250}),KXe=({data:e})=>(0,A.jsx)(_W,{data:e,hasInput:!0,hasOutput:!0,width:200}),qXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`sleep`)},[t,n]);return(0,A.jsx)(hW,{icon:wb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Sleep`,subtitle:e.description,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},JXe=(e,t,n)=>({id:e,type:`sleepNode`,position:t,data:{colorKey:`workflow`,title:n.duration,description:n.stepName,nodeType:`flow`}}),vW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`inline`)},[t,n]);return(0,A.jsx)(_W,{data:{...e,onClick:r},hasInput:!0,hasOutput:!0,width:200,additionalBody:e.inWorkflow?(0,A.jsxs)(kh,{cols:2,px:`1rem`,c:`dimmed`,mt:`xs`,style:{alignItems:`center`},children:[(0,A.jsxs)(j,{pos:`relative`,style:{justifySelf:`center`},children:[(0,A.jsx)(Rfe,{size:16,strokeWidth:2}),e.workflowRetries!==void 0&&e.workflowRetries>0&&(0,A.jsx)(eS,{type:`label`,size:`sm`,pos:`absolute`,top:-8,right:-8,circle:!0,style:{minWidth:12,height:12,padding:2,width:`fit-content`},children:e.workflowRetries})]}),(0,A.jsxs)(j,{pos:`relative`,style:{justifySelf:`center`},children:[(0,A.jsx)(Lb,{size:16,strokeWidth:2}),e.workflowRetryDelay!==void 0&&e.workflowRetryDelay>0&&(0,A.jsx)(eS,{type:`label`,size:`sm`,pos:`absolute`,top:-8,right:-8,circle:!0,style:{minWidth:12,height:12,padding:2,width:`fit-content`},children:e.workflowRetryDelay})]})]}):void 0})},YXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[{id:`true`,label:`if`}];if(e.branchCount&&e.branchCount>1)for(let n=1;n<e.branchCount;n++)t.push({id:`branch-${n}`,label:`elif ${n}`});return e.hasElse&&t.push({id:`false`,label:`else`}),t.push({id:`after`,label:`next`}),t},[e.hasElse,e.branchCount]),o=D.useCallback(()=>{n(t,`branch`)},[t,n]);return(0,A.jsx)(hW,{icon:Wfe,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Branch`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},XXe=(e,t,n)=>{let r=!!n.elseEntry,i=n.branches?.length||(n.thenEntry?1:0);return{id:e,type:`branchNode`,position:t,data:{colorKey:`workflow`,condition:n.condition||`condition`,hasElse:r,branchCount:i,stepName:n.stepName,nodeType:`flow`}}},yW=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=[{id:`each`,label:`each`},{id:`done`,label:`done`}],o=D.useCallback(()=>{n(t,`fanout`)},[t,n]);return(0,A.jsx)(hW,{icon:Ife,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Loop`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},bW=(e,t,n)=>({id:e,type:`fanoutNode`,position:t,data:{colorKey:`workflow`,childRpc:n.childRpc||n.eachRpc,stepName:n.stepName,nodeType:`flow`}}),ZXe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`return`)},[t,n]);return(0,A.jsx)(hW,{icon:Lfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[],size:80,label:`Return`,subtitle:e.stepName,onClick:a,highlightType:i,nodeId:t})},QXe=(e,t,n)=>({id:e,type:`returnNode`,position:t,data:{colorKey:`workflow`,stepName:n.stepName,nodeType:`flow`}}),$Xe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`cancel`)},[t,n]);return(0,A.jsx)(hW,{icon:xfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[],size:80,label:`Cancel`,subtitle:e.stepName,onClick:r,nodeId:t})},eZe=(e,t,n)=>({id:e,type:`cancelNode`,position:t,data:{colorKey:`workflow`,stepName:n.stepName,nodeType:`flow`}}),tZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[];return e.cases&&e.cases.length>0&&e.cases.forEach(e=>{t.push({id:`case-${e.value}`,label:e.value})}),t.push({id:`default`,label:`default`}),t.push({id:`after`,label:`after`}),t},[e.cases]),o=D.useCallback(()=>{n(t,`switch`)},[t,n]);return(0,A.jsx)(hW,{icon:fb,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Switch`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},xW=(e,t,n)=>({id:e,type:`switchNode`,position:t,data:{colorKey:`workflow`,expression:n.expression,cases:n.cases,stepName:n.stepName,nodeType:`flow`}}),nZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`arrayPredicate`)},[t,n]),o=e.mode===`some`?`Some`:e.mode===`every`?`Every`:`Check`;return(0,A.jsx)(hW,{icon:rb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:o,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},SW=(e,t,n)=>({id:e,type:`arrayPredicateNode`,position:t,data:{colorKey:`workflow`,mode:n.mode,sourceVar:n.sourceVar,itemVar:n.itemVar,outputVar:n.outputVar,stepName:n.stepName,nodeType:`flow`}}),rZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`filter`)},[t,n]);return(0,A.jsx)(hW,{icon:kfe,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Filter`,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},iZe=(e,t,n)=>({id:e,type:`filterNode`,position:t,data:{colorKey:`workflow`,sourceVar:n.sourceVar,itemVar:n.itemVar,outputVar:n.outputVar,stepName:n.stepName,nodeType:`flow`}}),aZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useMemo(()=>{let t=[],n=e.childrenCount||0;for(let e=0;e<n;e++)t.push({id:`child-${e}`,label:`${e+1}`});return t.push({id:`done`,label:`done`}),t},[e.childrenCount]),o=D.useCallback(()=>{n(t,`parallel`)},[t,n]);return(0,A.jsx)(hW,{icon:Bb,colorKey:e.colorKey,hasInput:!0,outputHandles:a,size:80,label:`Parallel`,subtitle:e.stepName,onClick:o,showBorder:!1,highlightType:i,nodeId:t})},oZe=(e,t,n)=>({id:e,type:`parallelNode`,position:t,data:{colorKey:`workflow`,childrenCount:n.children?.length||0,stepName:n.stepName,nodeType:`flow`}});var CW=({label:e,handleId:t,hasTarget:n})=>(0,A.jsxs)(j,{px:`xs`,pl:`md`,py:4,style:{position:`relative`,opacity:n?1:.4,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:e}),n&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(vfe,{size:12}),(0,A.jsx)(bU,{type:`source`,position:cU.Right,id:t,style:{background:`var(--mantine-color-teal-6)`,width:8,height:8,right:-4}})]})]});const sZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=ds(),i=D.useCallback(()=>{n(t,`trigger`)},[t,n]),a=e.onMessageRoute?Object.entries(e.onMessageRoute):[];return(0,A.jsxs)(Kd,{shadow:`md`,radius:`md`,w:180,style:{cursor:`pointer`,overflow:`hidden`,position:`relative`},onClick:i,children:[(0,A.jsx)(j,{pos:`absolute`,left:0,top:0,bottom:0,w:4,style:{backgroundColor:r.colors.gray[5],borderTopLeftRadius:r.radius.md,borderBottomLeftRadius:r.radius.md}}),(0,A.jsxs)(Bh,{gap:0,py:4,children:[(0,A.jsx)(CW,{label:`onConnect`,handleId:`onConnect`,hasTarget:!!e.onConnect}),(0,A.jsx)(CW,{label:`onMessage`,handleId:`onMessage`,hasTarget:!!e.onMessage}),a.map(([e,t])=>(0,A.jsx)(CW,{label:`→ ${e}`,handleId:`route-${e}`,hasTarget:!!t},e)),(0,A.jsx)(CW,{label:`onDisconnect`,handleId:`onDisconnect`,hasTarget:!!e.onDisconnect})]})]})},cZe=(e,t,n)=>({id:e,type:`channelWiringNode`,position:t,data:{colorKey:`teal`,channelName:n.name||`Channel`,onConnect:n.onConnect,onDisconnect:n.onDisconnect,onMessage:n.onMessage,onMessageRoute:n.onMessageRoute,nodeType:`wiring`}}),lZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=Kk(),i=D.useMemo(()=>r?r.focusedNodeId===t?`focused`:r.referencedNodeId===t?`referenced`:null:null,[r,t]),a=D.useCallback(()=>{n(t,`set`)},[t,n]);return(0,A.jsx)(hW,{icon:Tb,colorKey:e.colorKey,hasInput:!0,outputHandles:[{id:`default`,label:``}],size:80,label:`Set`,subtitle:e.stepName,onClick:a,showBorder:!1,highlightType:i,nodeId:t})},uZe=(e,t,n)=>({id:e,type:`setNode`,position:t,data:{colorKey:`workflow`,variable:n.variable,stepName:n.stepName,nodeType:`flow`}}),dZe=({data:e,id:t})=>{let{openWorkflowStep:n}=_x(),r=D.useCallback(()=>{n(t,`generic`)},[t,n]);return(0,A.jsx)(_W,{data:{...e,onClick:r},hasInput:!0,hasOutput:!0,width:200})},fZe=(e,t,n)=>({id:e,type:`genericNode`,position:t,data:{icon:Sfe,colorKey:`generic`,title:`Generic Node (Implementation Needed)`,description:n.stepName,nodeType:`internal`}});function wW(e,t,n,r,i){let a={id:e,source:t,target:n,...i&&{sourceHandle:i}};return r&&(a.label=r,a.labelStyle={fontSize:10,fill:`rgba(255,255,255,0.4)`,fontFamily:`monospace`},a.labelBgStyle={fill:`rgba(255,255,255,0.05)`,fillOpacity:1}),a}function TW(e){return e.rpcName?`rpc`:e.flow?e.flow:`unknown`}function pZe(e,t,n,r){let i=[],a=[],o=TW(e);switch(o){case`rpc`:{let a=WXe(t,e.rpcName,n,e.stepName,r,void 0,e);i.push(a);break}case`sleep`:{let r=JXe(t,n,e);i.push(r);break}case`inline`:{let a=WXe(t,`inline`,n,e.stepName,r,void 0,e);i.push(a);break}case`branch`:{let r=XXe(t,n,e);i.push(r);break}case`switch`:{let r=xW(t,n,e);i.push(r);break}case`fanout`:{let r=bW(t,n,e);i.push(r);break}case`arrayPredicate`:{let r=SW(t,n,e);i.push(r);break}case`filter`:{let r=iZe(t,n,e);i.push(r);break}case`parallel`:{let r=oZe(t,n,e);i.push(r);break}case`return`:{let r=QXe(t,n,e);i.push(r);break}case`cancel`:{let r=eZe(t,n,e);i.push(r);break}case`set`:{let r=uZe(t,n,e);i.push(r);break}default:{let r=fZe(t,n,e);i.push(r);break}}return{nodes:i,edges:a,stepType:o}}function EW(e,t){if(t===`next`){if(e===`fanout`||e===`parallel`)return`done`;if(e===`branch`||e===`switch`)return`after`}if(t===`then`)return`true`;if(t===`child`)return`each`;if(t.startsWith(`case-`))return t;if(t===`default`)return`default`;if(t.startsWith(`parallel-`))return`child-${t.replace(`parallel-`,``)}`}function mZe(e){let t=[],n=[],r=e.nodes,i=e.entryNodeIds,a=e.wires;if(!r||Object.keys(r).length===0)return{nodes:t,edges:n};let o=new Set,s=new Map,c=new Map,l=0,u=0;Object.values(r).forEach(e=>{if(e.flow===`parallel`&&e.children){let t=new Set(e.children);e.children.forEach(e=>{c.set(e,t)})}});function d(e,i=0){if(o.has(e))return;let a=r[e];if(!a)return;o.add(e);let u={x:325+i*250,y:l};s.set(e,u),l+=100;let f=TW(a),p=pZe(a,e,u);if(t.push(...p.nodes),n.push(...p.edges),f===`branch`&&(a.thenEntry&&(n.push(wW(`${e}-to-${a.thenEntry}`,e,a.thenEntry,void 0,EW(f,`then`))),d(a.thenEntry,i+1)),a.elseEntry&&(n.push(wW(`${e}-to-${a.elseEntry}`,e,a.elseEntry,void 0,`false`)),d(a.elseEntry,i+1)),a.branches&&Array.isArray(a.branches)&&a.branches.forEach((t,r)=>{t.entry&&(n.push(wW(`${e}-branch-${r}-to-${t.entry}`,e,t.entry,void 0,r===0?`true`:`branch-${r}`)),d(t.entry,i+1))})),f===`switch`&&(a.cases&&a.cases.forEach((t,r)=>{t.entry&&(n.push(wW(`${e}-case-${r}-to-${t.entry}`,e,t.entry,void 0,EW(f,`case-${t.value}`))),d(t.entry,i+1))}),a.defaultEntry&&(n.push(wW(`${e}-default-to-${a.defaultEntry}`,e,a.defaultEntry,void 0,EW(f,`default`))),d(a.defaultEntry,i+1))),f===`fanout`&&a.childEntry&&(n.push(wW(`${e}-to-${a.childEntry}`,e,a.childEntry,void 0,EW(f,`child`))),d(a.childEntry,i+1)),f===`parallel`&&a.children&&a.children.forEach((t,r)=>{n.push(wW(`${e}-parallel-${r}-to-${t}`,e,t,void 0,EW(f,`parallel-${r}`))),d(t,i+1)}),a.next){let t=Array.isArray(a.next)?a.next:[a.next],r=c.get(e);t.forEach(t=>{r&&r.has(t)||n.push(wW(`${e}-to-${t}`,e,t,void 0,EW(f,`next`))),d(t,i)})}}if(i&&i.length>0)i.forEach(e=>{d(e)});else{let e=Object.keys(r)[0];e&&d(e)}return a&&(a.http&&Array.isArray(a.http)&&a.http.forEach((e,r)=>{let i=`http-trigger-${r}`,a={x:50,y:u};u+=120;let o=PXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.channel&&Array.isArray(a.channel)&&a.channel.forEach((e,r)=>{let i=`channel-trigger-${r}`,a={x:50,y:u},o=e.onMessageRoute?Object.keys(e.onMessageRoute).length:0;u+=100+o*30;let s=cZe(i,a,e);t.push(s),e.onConnect&&n.push(wW(`${i}-onConnect-to-${e.onConnect}`,i,e.onConnect,void 0,`onConnect`)),e.onMessage&&n.push(wW(`${i}-onMessage-to-${e.onMessage}`,i,e.onMessage,void 0,`onMessage`)),e.onMessageRoute&&Object.entries(e.onMessageRoute).forEach(([e,t])=>{t&&n.push(wW(`${i}-route-${e}-to-${t}`,i,t,void 0,`route-${e}`))}),e.onDisconnect&&n.push(wW(`${i}-onDisconnect-to-${e.onDisconnect}`,i,e.onDisconnect,void 0,`onDisconnect`))}),a.queue&&Array.isArray(a.queue)&&a.queue.forEach((e,r)=>{let i=`queue-trigger-${r}`,a={x:50,y:u};u+=120;let o=FXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.cli&&Array.isArray(a.cli)&&a.cli.forEach((e,r)=>{let i=`cli-trigger-${r}`,a={x:50,y:u};u+=120;let o=IXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp&&(a.mcp.tool&&Array.isArray(a.mcp.tool)&&a.mcp.tool.forEach((e,r)=>{let i=`mcp-tool-trigger-${r}`,a={x:50,y:u};u+=120;let o=LXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp.prompt&&Array.isArray(a.mcp.prompt)&&a.mcp.prompt.forEach((e,r)=>{let i=`mcp-prompt-trigger-${r}`,a={x:50,y:u};u+=120;let o=RXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.mcp.resource&&Array.isArray(a.mcp.resource)&&a.mcp.resource.forEach((e,r)=>{let i=`mcp-resource-trigger-${r}`,a={x:50,y:u};u+=120;let o=zXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))})),a.schedule&&Array.isArray(a.schedule)&&a.schedule.forEach((e,r)=>{let i=`schedule-trigger-${r}`,a={x:50,y:u};u+=120;let o=BXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))}),a.trigger&&Array.isArray(a.trigger)&&a.trigger.forEach((e,r)=>{let i=`named-trigger-${r}`,a={x:50,y:u};u+=120;let o=VXe(i,a,e);t.push(o),e.startNode&&n.push(wW(`${i}-to-${e.startNode}`,i,e.startNode,void 0,`start`))})),{nodes:t,edges:n}}var hZe=new(u(s(((e,t)=>{(function(n){if(typeof e==`object`&&t!==void 0)t.exports=n();else if(typeof define==`function`&&define.amd)define([],n);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.ELK=n()}})(function(){return(function(){function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof f==`function`&&f;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=Error(`Cannot find module '`+o+`'`);throw l.code=`MODULE_NOT_FOUND`,l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a=typeof f==`function`&&f,o=0;o<r.length;o++)i(r[o]);return i}return e})()({1:[function(e,t,n){Object.defineProperty(n,`__esModule`,{value:!0}),n.default=void 0;function r(e){"@babel/helpers - typeof";return r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},r(e)}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function s(e){var t=c(e,`string`);return r(t)==`symbol`?t:t+``}function c(e,t){if(r(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||`default`);if(r(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}n.default=function(){function e(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=n.defaultLayoutOptions,a=r===void 0?{}:r,o=n.algorithms,s=o===void 0?[`layered`,`stress`,`mrtree`,`radial`,`force`,`disco`,`sporeOverlap`,`sporeCompaction`,`rectpacking`,`vertiflex`]:o,c=n.workerFactory,u=n.workerUrl;if(i(this,e),this.defaultLayoutOptions=a,this.initialized=!1,u===void 0&&c===void 0)throw Error(`Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.`);var d=c;u!==void 0&&c===void 0&&(d=function(e){return new Worker(e)});var f=d(u);if(typeof f.postMessage!=`function`)throw TypeError(`Created worker does not provide the required 'postMessage' function.`);this.worker=new l(f),this.worker.postMessage({cmd:`register`,algorithms:s}).then(function(e){return t.initialized=!0}).catch(console.err)}return o(e,[{key:`layout`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.layoutOptions,r=n===void 0?this.defaultLayoutOptions:n,i=t.logging,a=i===void 0?!1:i,o=t.measureExecutionTime,s=o===void 0?!1:o;return e?this.worker.postMessage({cmd:`layout`,graph:e,layoutOptions:r,options:{logging:a,measureExecutionTime:s}}):Promise.reject(Error(`Missing mandatory parameter 'graph'.`))}},{key:`knownLayoutAlgorithms`,value:function(){return this.worker.postMessage({cmd:`algorithms`})}},{key:`knownLayoutOptions`,value:function(){return this.worker.postMessage({cmd:`options`})}},{key:`knownLayoutCategories`,value:function(){return this.worker.postMessage({cmd:`categories`})}},{key:`terminateWorker`,value:function(){this.worker&&this.worker.terminate()}}])}();var l=function(){function e(t){var n=this;if(i(this,e),t===void 0)throw Error(`Missing mandatory parameter 'worker'.`);this.resolvers={},this.worker=t,this.worker.onmessage=function(e){setTimeout(function(){n.receive(n,e)},0)}}return o(e,[{key:`postMessage`,value:function(e){var t=this.id||0;this.id=t+1,e.id=t;var n=this;return new Promise(function(r,i){n.resolvers[t]=function(e,t){e?(n.convertGwtStyleError(e),i(e)):r(t)},n.worker.postMessage(e)})}},{key:`receive`,value:function(e,t){var n=t.data,r=e.resolvers[n.id];r&&(delete e.resolvers[n.id],n.error?r(n.error):r(null,n.data))}},{key:`terminate`,value:function(){this.worker&&this.worker.terminate()}},{key:`convertGwtStyleError`,value:function(e){if(e){var t=e.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(e.cause=t.cause.backingJsObject,this.convertGwtStyleError(e.cause)),delete e.__java$exception)}}}])}()},{}],2:[function(e,t,n){(function(e){(function(){var r;typeof window<`u`?r=window:e===void 0?typeof self<`u`&&(r=self):r=e;var i;function a(){}function o(){}function s(){}function c(){}function l(){}function u(){}function d(){}function f(){}function p(){}function m(){}function h(){}function g(){}function _(){}function v(){}function y(){}function b(){}function x(){}function S(){}function C(){}function w(){}function T(){}function E(){}function D(){}function O(){}function k(){}function ee(){}function te(){}function ne(){}function re(){}function ie(){}function ae(){}function oe(){}function se(){}function ce(){}function le(){}function ue(){}function de(){}function fe(){}function pe(){}function me(){}function he(){}function ge(){}function _e(){}function ve(){}function ye(){}function be(){}function xe(){}function Se(){}function Ce(){}function we(){}function Te(){}function Ee(){}function De(){}function Oe(){}function ke(){}function Ae(){}function je(){}function Me(){}function Ne(){}function Pe(){}function Fe(){}function Ie(){}function Le(){}function Re(){}function ze(){}function Be(){}function Ve(){}function He(){}function Ue(){}function We(){}function Ge(){}function Ke(){}function qe(){}function Je(){}function Ye(){}function Xe(){}function Ze(){}function Qe(){}function $e(){}function et(){}function tt(){}function nt(){}function rt(){}function it(){}function at(){}function ot(){}function st(){}function ct(){}function lt(){}function ut(){}function dt(){}function ft(){}function pt(){}function mt(){}function ht(){}function gt(){}function _t(){}function vt(){}function yt(){}function bt(){}function xt(){}function St(){}function Ct(){}function wt(){}function Tt(){}function Et(){}function Dt(){}function Ot(){}function kt(){}function At(){}function jt(){}function Mt(){}function Nt(){}function Pt(){}function eee(){}function tee(){}function Ft(){}function It(){}function Lt(){}function Rt(){}function nee(){}function zt(){}function Bt(){}function ree(){}function Vt(){}function Ht(){}function Ut(){}function Wt(){}function iee(){}function Gt(){}function Kt(){}function aee(){}function oee(){}function qt(){}function see(){}function Jt(){}function cee(){}function Yt(){}function Xt(){}function lee(){}function Zt(){}function Qt(){}function $t(){}function en(){}function tn(){}function nn(){}function uee(){}function rn(){}function dee(){}function an(){}function on(){}function sn(){}function cn(){}function ln(){}function un(){}function dn(){}function fn(){}function pn(){}function mn(){}function hn(){}function gn(){}function _n(){}function vn(){}function yn(){}function fee(){}function bn(){}function xn(){}function Sn(){}function Cn(){}function wn(){}function pee(){}function Tn(){}function mee(){}function hee(){}function En(){}function gee(){}function _ee(){}function vee(){}function yee(){}function Dn(){}function bee(){}function xee(){}function On(){}function kn(){}function An(){}function See(){}function Cee(){}function jn(){}function Mn(){}function wee(){}function Nn(){}function Tee(){}function Pn(){}function Fn(){}function Eee(){}function In(){}function Dee(){}function Ln(){}function Rn(){}function zn(){}function Bn(){}function Vn(){}function Hn(){}function Un(){}function Wn(){}function Gn(){}function Kn(){}function qn(){}function Jn(){}function Yn(){}function Xn(){}function Zn(){}function Oee(){}function kee(){}function Qn(){}function Aee(){}function $n(){}function er(){}function tr(){}function nr(){}function rr(){}function jee(){}function ir(){}function ar(){}function Mee(){}function or(){}function sr(){}function cr(){}function lr(){}function Nee(){}function ur(){}function dr(){}function fr(){}function Pee(){}function pr(){}function mr(){}function hr(){}function gr(){}function _r(){}function Fee(){}function Iee(){}function vr(){}function Lee(){}function yr(){}function br(){}function xr(){}function Sr(){}function Cr(){}function wr(){}function Tr(){}function A(){}function Er(){}function Dr(){}function Ree(){}function Or(){}function kr(){}function zee(){}function Ar(){}function jr(){}function Mr(){}function Nr(){}function Pr(){}function Fr(){}function Ir(){}function Bee(){}function Lr(){}function Vee(){}function Rr(){}function zr(){}function Br(){}function Vr(){}function Hr(){}function Ur(){}function Wr(){}function Gr(){}function Kr(){}function qr(){}function Jr(){}function Yr(){}function Xr(){}function Zr(){}function Qr(){}function $r(){}function ei(){}function ti(){}function ni(){}function ri(){}function ii(){}function ai(){}function oi(){}function si(){}function ci(){}function li(){}function ui(){}function di(){}function fi(){}function pi(){}function mi(){}function hi(){}function gi(){}function _i(){}function vi(){}function yi(){}function bi(){}function xi(){}function Si(){}function Ci(){}function wi(){}function Hee(){}function Ti(){}function Ei(){}function Di(){}function Oi(){}function ki(){}function Ai(){}function ji(){}function Mi(){}function Ni(){}function Uee(){}function Pi(){}function Wee(){}function Gee(){}function Fi(){}function Ii(){}function Li(){}function Ri(){}function zi(){}function Bi(){}function Vi(){}function Hi(){}function Kee(){}function qee(){}function Ui(){}function Wi(){}function Gi(){}function Ki(){}function qi(){}function Ji(){}function Yi(){}function Xi(){}function Zi(){}function Qi(){}function $i(){}function ea(){}function ta(){}function na(){}function ra(){}function ia(){}function aa(){}function oa(){}function sa(){}function ca(){}function la(){}function ua(){}function Jee(){}function da(){}function fa(){}function pa(){}function ma(){}function ha(){}function ga(){}function _a(){}function va(){}function ya(){}function ba(){}function xa(){}function Sa(){}function Ca(){}function wa(){}function Ta(){}function Ea(){}function Da(){}function Oa(){}function ka(){}function Aa(){}function ja(){}function Ma(){}function Na(){}function Pa(){}function Fa(){}function Yee(){}function Ia(){}function La(){}function Ra(){}function Xee(){}function za(){}function Zee(){}function Ba(){}function Va(){}function Ha(){}function Ua(){}function Wa(){}function Ga(){}function Ka(){}function qa(){}function Ja(){}function Ya(){}function Xa(){}function Za(){}function Qa(){}function $a(){}function Qee(){}function $ee(){}function eo(){}function to(){}function no(){}function ro(){}function io(){}function ao(){}function oo(){}function so(){}function ete(){}function co(){}function lo(){}function uo(){}function fo(){}function po(){}function mo(){}function tte(){}function ho(){}function go(){}function _o(){}function vo(){}function yo(){}function bo(){}function xo(){}function nte(){}function So(){}function Co(){}function wo(){}function To(){}function Eo(){}function Do(){}function Oo(){}function ko(){}function Ao(){}function rte(){}function jo(){}function ite(){}function Mo(){}function No(){}function Po(){}function Fo(){}function Io(){}function ate(){}function Lo(){}function Ro(){}function ote(){}function zo(){}function Bo(){}function Vo(){}function Ho(){}function ste(){}function Uo(){}function cte(){}function Wo(){}function Go(){}function Ko(){}function qo(){}function Jo(){}function lte(){}function Yo(){}function Xo(){}function Zo(){}function Qo(){}function $o(){}function es(){}function ts(){}function ute(){}function dte(){}function fte(){}function ns(){}function rs(){}function is(){}function pte(){}function as(){}function os(){}function ss(){}function cs(){}function ls(){}function us(){}function ds(){}function fs(){}function ps(){}function ms(){}function hs(){}function gs(){}function _s(){}function vs(){}function ys(){}function bs(){}function xs(){}function Ss(){}function Cs(){}function ws(){}function Ts(){}function Es(){}function Ds(){}function Os(){}function ks(){}function As(){}function js(){}function Ms(){}function Ns(){}function Ps(){}function Fs(){}function Is(){}function Ls(){}function mte(){}function Rs(){}function hte(){}function zs(){}function Bs(){}function gte(){}function Vs(){}function Hs(){}function Us(){}function Ws(){}function Gs(){}function Ks(){}function qs(){}function Js(){}function Ys(){}function _te(){}function Xs(){}function Zs(){}function Qs(){}function vte(){}function $s(){}function ec(){}function yte(){}function tc(){}function nc(){}function rc(){}function ic(){}function ac(){}function bte(){}function oc(){}function xte(){}function sc(){}function cc(){}function lc(){}function Ste(){}function uc(){}function dc(){}function fc(){}function pc(){}function mc(){}function hc(){}function gc(){}function _c(){}function vc(){}function yc(){}function bc(){}function xc(){}function Sc(){}function Cte(){}function Cc(){}function wc(){}function wte(){}function Tc(){}function j(){}function Tte(){}function Ec(){}function Dc(){}function Oc(){}function kc(){}function Ac(){}function jc(){}function Mc(){}function Nc(){}function Pc(){}function Fc(){}function Ic(){}function Lc(){}function Rc(){}function zc(){}function Bc(){}function Vc(){}function Hc(){}function Uc(){}function Wc(){}function Gc(){}function Kc(){}function qc(){}function Jc(){}function Yc(){}function Xc(){}function Zc(){}function Qc(){}function $c(){}function el(){}function tl(){}function nl(){}function rl(){}function il(){}function al(){}function ol(){}function sl(){}function cl(){}function ll(){}function ul(){}function dl(){}function fl(){}function pl(){}function ml(){}function hl(){}function gl(){}function _l(){}function vl(){}function Ete(){}function yl(){}function bl(){}function xl(){}function Sl(){}function Cl(){}function wl(){}function Tl(){}function El(){}function Dl(){}function Ol(){}function Dte(){}function Ote(){}function kl(){}function Al(){}function jl(){}function Ml(){}function kte(){}function Ate(){}function Nl(){}function Pl(){}function jte(){}function Fl(){}function Il(){}function Mte(){}function Nte(){}function Ll(){}function Rl(){}function zl(){}function Bl(){}function Vl(){}function Hl(){}function Ul(){}function Wl(){}function Gl(){}function Pte(){}function Kl(){}function Fte(){}function Ite(){}function Lte(){}function ql(){}function Rte(){}function Jl(){}function Yl(){}function Xl(){}function Zl(){}function Ql(){}function $l(){}function eu(){}function tu(){}function nu(){lm()}function ru(){LYe()}function zte(){Bg()}function iu(){xq()}function au(){FGe()}function ou(){vH()}function su(){qC()}function Bte(){Ig()}function Vte(){zg()}function Hte(){uI()}function Ute(){Xje()}function Wte(){zL()}function Gte(){JU()}function cu(){mF()}function lu(){hF()}function uu(){uFe()}function du(){Ug()}function fu(){krt()}function Kte(){nDe()}function pu(){yMe()}function mu(){cFe()}function hu(){$Ee()}function gu(){QEe()}function _u(){eDe()}function vu(){aDe()}function yu(){nY()}function qte(){dFe()}function bu(){tke()}function Jte(){gF()}function Yte(){sDe()}function Xte(){SP()}function Zte(){dIe()}function xu(){K3e()}function Qte(){rW()}function $te(){iDe()}function Su(){BGe()}function ene(){A6e()}function Cu(){d$e()}function wu(){Lq()}function Tu(){HK()}function Eu(){v8e()}function tne(){aBe()}function Du(){CP()}function Ou(){BU()}function nne(){W4e()}function ku(){EWe()}function rne(){QBe()}function Au(){_U()}function ju(){IM()}function ine(){VU()}function Mu(){oY()}function Nu(){iR()}function ane(){SB()}function Pu(){Qq()}function Fu(){lI()}function Iu(){b_e()}function Lu(){Cq()}function Ru(e){NE(e)}function zu(e){this.a=e}function Bu(e){this.a=e}function Vu(e){this.a=e}function one(e){this.a=e}function sne(e){this.a=e}function Hu(e){this.a=e}function Uu(e){this.a=e}function Wu(e){this.a=e}function Gu(e){this.a=e}function cne(e){this.a=e}function Ku(e){this.a=e}function qu(e){this.a=e}function Ju(e){this.a=e}function Yu(e){this.c=e}function Xu(e){this.a=e}function Zu(e){this.a=e}function Qu(e){this.a=e}function $u(e){this.a=e}function lne(e){this.a=e}function ed(e){this.a=e}function une(e){this.a=e}function dne(e){this.a=e}function td(e){this.a=e}function fne(e){this.a=e}function nd(e){this.a=e}function rd(e){this.a=e}function id(e){this.a=e}function pne(e){this.a=e}function ad(e){this.a=e}function mne(e){this.a=e}function hne(e){this.a=e}function gne(e){this.a=e}function od(e){this.a=e}function sd(e){this.a=e}function cd(e){this.a=e}function ld(e){this.a=e}function ud(e){this.a=e}function dd(e){this.a=e}function fd(e){this.a=e}function _ne(e){this.a=e}function pd(e){this.a=e}function md(e){this.a=e}function hd(e){this.a=e}function gd(e){this.b=e}function _d(){this.a=[]}function vd(e,t){e.a=t}function yd(e,t){e.a=t}function bd(e,t){e.b=t}function xd(e,t){e.c=t}function Sd(e,t){e.c=t}function Cd(e,t){e.d=t}function wd(e,t){e.d=t}function Td(e,t){e.k=t}function Ed(e,t){e.j=t}function Dd(e,t){e.c=t}function vne(e,t){e.c=t}function Od(e,t){e.a=t}function kd(e,t){e.a=t}function yne(e,t){e.f=t}function Ad(e,t){e.a=t}function jd(e,t){e.b=t}function Md(e,t){e.d=t}function Nd(e,t){e.i=t}function Pd(e,t){e.o=t}function bne(e,t){e.r=t}function Fd(e,t){e.a=t}function Id(e,t){e.b=t}function Ld(e,t){e.e=t}function xne(e,t){e.f=t}function Rd(e,t){e.g=t}function Sne(e,t){e.e=t}function Cne(e,t){e.f=t}function zd(e,t){e.f=t}function Bd(e,t){e.b=t}function wne(e,t){e.b=t}function Vd(e,t){e.a=t}function Tne(e,t){e.n=t}function Ene(e,t){e.a=t}function Dne(e,t){e.c=t}function One(e,t){e.c=t}function kne(e,t){e.c=t}function Ane(e,t){e.a=t}function jne(e,t){e.a=t}function Mne(e,t){e.d=t}function Nne(e,t){e.d=t}function Pne(e,t){e.e=t}function Fne(e,t){e.e=t}function Ine(e,t){e.g=t}function Lne(e,t){e.f=t}function Rne(e,t){e.j=t}function Hd(e,t){e.a=t}function zne(e,t){e.a=t}function Bne(e,t){e.b=t}function Vne(e){e.b=e.a}function Ud(e){e.c=e.d.d}function Hne(e){this.a=e}function Wd(e){this.a=e}function Gd(e){this.a=e}function Une(e){this.a=e}function Kd(e){this.a=e}function qd(e){this.a=e}function Jd(e){this.a=e}function Wne(e){this.a=e}function Gne(e){this.a=e}function Yd(e){this.a=e}function Xd(e){this.a=e}function Zd(e){this.a=e}function Qd(e){this.a=e}function Kne(e){this.a=e}function $d(e){this.a=e}function qne(e){this.a=e}function Jne(e){this.a=e}function ef(e){this.a=e}function tf(e){this.d=e}function nf(e){this.b=e}function rf(e){this.b=e}function af(e){this.b=e}function of(e){this.c=e}function M(e){this.c=e}function Yne(e){this.c=e}function Xne(e){this.a=e}function Zne(e){this.a=e}function sf(e){this.a=e}function Qne(e){this.a=e}function $ne(e){this.a=e}function ere(e){this.a=e}function cf(e){this.a=e}function lf(e){this.a=e}function tre(e){this.a=e}function nre(e){this.a=e}function uf(e){this.a=e}function rre(e){this.a=e}function ire(e){this.a=e}function are(e){this.a=e}function ore(e){this.a=e}function sre(e){this.a=e}function df(e){this.a=e}function ff(e){this.a=e}function cre(e){this.a=e}function lre(e){this.a=e}function pf(e){this.a=e}function ure(e){this.a=e}function dre(e){this.a=e}function fre(e){this.a=e}function mf(e){this.a=e}function hf(e){this.a=e}function pre(e){this.a=e}function mre(e){this.a=e}function gf(e){this.a=e}function hre(e){this.a=e}function gre(e){this.a=e}function _re(e){this.a=e}function _f(e){this.a=e}function vre(e){this.a=e}function yre(e){this.a=e}function vf(e){this.a=e}function yf(e){this.e=e}function bf(e){this.a=e}function bre(e){this.a=e}function xf(e){this.a=e}function xre(e){this.a=e}function Sre(e){this.a=e}function Sf(e){this.a=e}function Cre(e){this.a=e}function Cf(e){this.a=e}function wre(e){this.a=e}function Tre(e){this.a=e}function Ere(e){this.a=e}function wf(e){this.a=e}function Dre(e){this.a=e}function Ore(e){this.a=e}function kre(e){this.a=e}function Tf(e){this.a=e}function Are(e){this.a=e}function jre(e){this.a=e}function Mre(e){this.a=e}function Nre(e){this.a=e}function Pre(e){this.a=e}function Fre(e){this.a=e}function Ire(e){this.a=e}function Lre(e){this.a=e}function Rre(e){this.a=e}function Ef(e){this.a=e}function zre(e){this.a=e}function Bre(e){this.a=e}function Vre(e){this.a=e}function Hre(e){this.a=e}function Df(e){this.a=e}function Ure(e){this.a=e}function Of(e){this.a=e}function Wre(e){this.a=e}function kf(e){this.a=e}function Gre(e){this.a=e}function Kre(e){this.a=e}function Af(e){this.a=e}function qre(e){this.a=e}function Jre(e){this.a=e}function Yre(e){this.a=e}function Xre(e){this.a=e}function jf(e){this.a=e}function Zre(e){this.a=e}function Qre(e){this.a=e}function Mf(e){this.a=e}function $re(e){this.a=e}function eie(e){this.a=e}function Nf(e){this.a=e}function tie(e){this.a=e}function nie(e){this.a=e}function Pf(e){this.a=e}function rie(e){this.a=e}function iie(e){this.a=e}function aie(e){this.a=e}function oie(e){this.a=e}function sie(e){this.a=e}function Ff(e){this.a=e}function cie(e){this.c=e}function lie(e){this.b=e}function If(e){this.a=e}function uie(e){this.a=e}function die(e){this.a=e}function fie(e){this.a=e}function pie(e){this.a=e}function N(e){this.a=e}function mie(e){this.a=e}function hie(e){this.a=e}function Lf(e){this.a=e}function gie(e){this.a=e}function _ie(e){this.a=e}function vie(e){this.a=e}function Rf(e){this.a=e}function yie(e){this.a=e}function bie(e){this.a=e}function xie(e){this.a=e}function Sie(e){this.a=e}function zf(e){this.a=e}function Cie(e){this.a=e}function wie(e){this.a=e}function Tie(e){this.a=e}function Eie(e){this.a=e}function Die(e){this.a=e}function Oie(e){this.a=e}function kie(e){this.a=e}function Aie(e){this.a=e}function jie(e){this.a=e}function Bf(e){this.a=e}function Vf(e){this.a=e}function Mie(e){this.a=e}function Nie(e){this.a=e}function Pie(e){this.a=e}function Fie(e){this.a=e}function Iie(e){this.a=e}function Lie(e){this.a=e}function Rie(e){this.a=e}function zie(e){this.a=e}function Bie(e){this.a=e}function Vie(e){this.a=e}function Hie(e){this.a=e}function Uie(e){this.a=e}function Wie(e){this.a=e}function Hf(e){this.a=e}function Gie(e){this.a=e}function Kie(e){this.a=e}function Uf(e){this.a=e}function qie(e){this.a=e}function Jie(e){this.a=e}function Yie(e){this.a=e}function Xie(e){this.a=e}function Zie(e){this.a=e}function Qie(e){this.a=e}function $ie(e){this.a=e}function eae(e){this.a=e}function tae(e){this.a=e}function nae(e){this.a=e}function Wf(e){this.a=e}function rae(e){this.f=e}function Gf(e){this.a=e}function iae(e){this.a=e}function aae(e){this.a=e}function oae(e){this.a=e}function sae(e){this.a=e}function cae(e){this.a=e}function lae(e){this.a=e}function uae(e){this.a=e}function Kf(e){this.a=e}function qf(e){this.a=e}function dae(e){this.a=e}function fae(e){this.a=e}function pae(e){this.a=e}function mae(e){this.a=e}function hae(e){this.a=e}function gae(e){this.a=e}function _ae(e){this.a=e}function vae(e){this.a=e}function Jf(e){this.a=e}function Yf(e){this.a=e}function yae(e){this.a=e}function bae(e){this.a=e}function xae(e){this.a=e}function Sae(e){this.a=e}function Cae(e){this.a=e}function wae(e){this.a=e}function Tae(e){this.a=e}function Xf(e){this.a=e}function Eae(e){this.a=e}function Zf(e){this.b=e}function Dae(e){this.a=e}function Qf(e){this.a=e}function Oae(e){this.a=e}function $f(e){this.a=e}function kae(e){this.a=e}function ep(e){this.a=e}function Aae(e){this.a=e}function jae(e){this.a=e}function tp(e){this.a=e}function Mae(e){this.a=e}function Nae(e){this.b=e}function Pae(e){this.c=e}function np(e){this.e=e}function Fae(e){this.a=e}function rp(e){this.a=e}function ip(e){this.a=e}function ap(e){this.a=e}function op(e){this.d=e}function sp(e){this.a=e}function Iae(e){this.a=e}function Lae(e){this.a=e}function cp(e){this.e=e}function lp(){this.a=0}function up(){zb(this)}function dp(){wT(this)}function fp(){qCe(this)}function Rae(){}function pp(){this.c=sUt}function zae(e,t){e.b+=t}function Bae(e,t){t.Wb(e)}function Vae(e){return e.a}function mp(e){return e.a}function hp(e){return e.a}function Hae(e){return e.a}function Uae(e){return e.a}function P(e){return e.e}function Wae(){return null}function gp(){return null}function Gae(e){throw P(e)}function _p(e){this.a=gE(e)}function vp(){this.a=this}function yp(){pme.call(this)}function Kae(e){e.b.Mf(e.e)}function qae(e){e.b=new Nse}function bp(e,t){e.b=t-e.b}function xp(e,t){e.a=t-e.a}function Jae(e,t){t.gd(e.a)}function Yae(e,t){AW(t,e)}function Sp(e,t){e.push(t)}function Xae(e,t){e.sort(t)}function Zae(e,t,n){e.Wd(n,t)}function Cp(e,t){e.e=t,t.b=e}function Qae(){Pce(),Dnt()}function $ae(e){QD(),vgt.je(e)}function eoe(){pme.call(this)}function wp(){yp.call(this)}function Tp(){yp.call(this)}function toe(){yp.call(this)}function Ep(){yp.call(this)}function Dp(){yp.call(this)}function Op(){yp.call(this)}function kp(){yp.call(this)}function Ap(){yp.call(this)}function noe(){yp.call(this)}function jp(){yp.call(this)}function Mp(){yp.call(this)}function Np(){this.Bb|=256}function Pp(){this.b=new gfe}function Fp(){Fp=E,new dp}function Ip(){wp.call(this)}function Lp(e,t){e.length=t}function Rp(e,t){hx(e.a,t)}function roe(e,t){tXe(e.c,t)}function ioe(e,t){BT(e.b,t)}function aoe(e,t){DV(e.a,t)}function ooe(e,t){yz(e.a,t)}function zp(e,t){II(e.e,t)}function Bp(e){aG(e.c,e.b)}function soe(e,t){e.kc().Nb(t)}function coe(e){this.a=ABe(e)}function Vp(){this.a=new dp}function loe(){this.a=new dp}function Hp(){this.a=new up}function Up(){this.a=new up}function uoe(){this.a=new up}function Wp(){this.a=new Fe}function Gp(){this.a=new Jje}function doe(){this.a=new Ple}function foe(){this.a=new HEe}function poe(){this.a=new _ge}function Kp(){this.a=new tt}function moe(){this.a=new OOe}function hoe(){this.a=new up}function goe(){this.a=new up}function _oe(){this.a=new up}function qp(){this.a=new up}function voe(){this.d=new up}function yoe(){this.a=new Vp}function boe(){this.a=new dp}function xoe(){this.b=new dp}function Soe(){this.b=new up}function Jp(){this.e=new up}function Coe(){this.d=new up}function woe(){this.a=new Gte}function Toe(){PTe.call(this)}function Yp(){PTe.call(this)}function Eoe(){Yoe.call(this)}function Doe(){Yoe.call(this)}function Ooe(){Yoe.call(this)}function koe(){up.call(this)}function Aoe(){qp.call(this)}function Xp(){Hp.call(this)}function joe(){dC.call(this)}function Zp(){Rae.call(this)}function Qp(){Zp.call(this)}function $p(){Rae.call(this)}function Moe(){$p.call(this)}function em(){Sg.call(this)}function Noe(){am.call(this)}function tm(){Us.call(this)}function Poe(){Us.call(this)}function Foe(){sm.call(this)}function nm(){sm.call(this)}function Ioe(){dp.call(this)}function Loe(){dp.call(this)}function Roe(){dp.call(this)}function zoe(){iFe.call(this)}function Boe(){Vp.call(this)}function Voe(){Np.call(this)}function Hoe(){Lx.call(this)}function rm(){dp.call(this)}function Uoe(){Lx.call(this)}function Woe(){dp.call(this)}function Goe(){dp.call(this)}function Koe(){rc.call(this)}function qoe(){Koe.call(this)}function Joe(){rc.call(this)}function im(){$l.call(this)}function Yoe(){this.a=new Vp}function Xoe(){this.a=new dp}function am(){this.a=new dp}function om(){this.a=new Sg}function Zoe(){this.a=new up}function Qoe(){this.j=new up}function sm(){this.a=new ec}function cm(){this.a=new ko}function $oe(){this.a=new Gce}function lm(){lm=E,Xht=new o}function um(){um=E,$ht=new pm}function dm(){dm=E,egt=new fm}function fm(){td.call(this,``)}function pm(){td.call(this,``)}function mm(e){$Ne.call(this,e)}function ese(e){$Ne.call(this,e)}function tse(e){Hu.call(this,e)}function hm(e){Cle.call(this,e)}function nse(e){Cle.call(this,e)}function rse(e){hm.call(this,e)}function ise(e){hm.call(this,e)}function ase(e){hm.call(this,e)}function ose(e){KAe.call(this,e)}function gm(e){KAe.call(this,e)}function sse(e){jpe.call(this,e)}function cse(e){Ele.call(this,e)}function _m(e){fg.call(this,e)}function lse(e){fg.call(this,e)}function use(e){fg.call(this,e)}function vm(e){nSe.call(this,e)}function dse(e){vm.call(this,e)}function ym(){hd.call(this,{})}function fse(e){mx(),this.a=e}function bm(e){e.b=null,e.c=0}function pse(e,t){e.e=t,x2e(e,t)}function mse(e,t){e.a=t,nZe(e)}function xm(e,t,n){e.a[t.g]=n}function hse(e,t,n){JKe(n,e,t)}function gse(e,t){t_e(t.i,e.n)}function _se(e,t){xRe(e).Ad(t)}function vse(e,t){return e*e/t}function yse(e,t){return e.g-t.g}function Sm(e,t){e.a.ec().Kc(t)}function bse(e){return new md(e)}function xse(e){return new _E(e)}function Cm(){Cm=E,dgt=new a}function Sse(){Sse=E,_gt=new v}function wm(){wm=E,w1=new x}function Tm(){Tm=E,rgt=new kpe}function Cse(){Cse=E,Cgt=new C}function Em(e){uIe(),this.a=e}function Dm(e){y_e(),this.a=e}function Om(e){nT(),this.f=e}function km(e){nT(),this.f=e}function Am(e){vm.call(this,e)}function jm(e){vm.call(this,e)}function wse(e){vm.call(this,e)}function Tse(e){nSe.call(this,e)}function Mm(e){vm.call(this,e)}function Nm(e){vm.call(this,e)}function Pm(e){vm.call(this,e)}function Ese(e){vm.call(this,e)}function Fm(e){vm.call(this,e)}function Im(e){vm.call(this,e)}function Lm(e){NE(e),this.a=e}function Rm(e){KSe(e,e.length)}function Dse(e){return FL(e),e}function zm(e){return!!e&&e.b}function Ose(e){return!!e&&e.k}function kse(e){return!!e&&e.j}function Bm(e){return e.b==e.c}function Vm(e){return NE(e),e}function F(e){return NE(e),e}function Hm(e){return NE(e),e}function Ase(e){return NE(e),e}function jse(e){return NE(e),e}function Um(e){vm.call(this,e)}function Wm(e){vm.call(this,e)}function Gm(e){vm.call(this,e)}function Km(e){vm.call(this,e)}function qm(e){vm.call(this,e)}function Mse(e){cS.call(this,e,0)}function Nse(){aOe.call(this,12,3)}function Pse(){this.a=BS(gE(SY))}function Fse(){throw P(new kp)}function Ise(){throw P(new kp)}function Lse(){throw P(new kp)}function Rse(){throw P(new kp)}function zse(){throw P(new kp)}function Bse(){throw P(new kp)}function Jm(){Jm=E,QD()}function Ym(){qd.call(this,``)}function Xm(){qd.call(this,``)}function Zm(){qd.call(this,``)}function Qm(){qd.call(this,``)}function $m(e){jm.call(this,e)}function eh(e){jm.call(this,e)}function th(e){Nm.call(this,e)}function nh(e){rf.call(this,e)}function Vse(e){nh.call(this,e)}function Hse(e){Jx.call(this,e)}function Use(e,t,n){e.c.Cf(t,n)}function Wse(e,t,n){t.Ad(e.a[n])}function rh(e,t,n){t.Ne(e.a[n])}function Gse(e,t){return e.a-t.a}function Kse(e,t){return e.a-t.a}function qse(e,t){return e.a-t.a}function ih(e,t){return gN(e,t)}function I(e,t){return JEe(e,t)}function Jse(e,t){return t in e.a}function Yse(e){return e.a?e.b:0}function Xse(e){return e.a?e.b:0}function Zse(e,t){return e.f=t,e}function Qse(e,t){return e.b=t,e}function $se(e,t){return e.c=t,e}function ece(e,t){return e.g=t,e}function ah(e,t){return e.a=t,e}function tce(e,t){return e.f=t,e}function nce(e,t){return e.k=t,e}function rce(e,t){return e.e=t,e}function ice(e,t){return e.e=t,e}function ace(e,t){return e.a=t,e}function oce(e,t){return e.f=t,e}function sce(e,t){e.b=new wb(t)}function cce(e,t){e._d(t),t.$d(e)}function lce(e,t){KC(),t.n.a+=e}function uce(e,t){JU(),IO(t,e)}function dce(e){Lwe.call(this,e)}function fce(e){Lwe.call(this,e)}function pce(){upe.call(this,``)}function mce(){this.b=0,this.a=0}function hce(){hce=E,p_t=Eqe()}function oh(e,t){return e.b=t,e}function sh(e,t){return e.a=t,e}function ch(e,t){return e.c=t,e}function lh(e,t){return e.d=t,e}function uh(e,t){return e.e=t,e}function dh(e,t){return e.f=t,e}function fh(e,t){return e.a=t,e}function ph(e,t){return e.b=t,e}function mh(e,t){return e.c=t,e}function hh(e,t){return e.c=t,e}function gh(e,t){return e.b=t,e}function _h(e,t){return e.d=t,e}function vh(e,t){return e.e=t,e}function gce(e,t){return e.f=t,e}function yh(e,t){return e.g=t,e}function bh(e,t){return e.a=t,e}function xh(e,t){return e.i=t,e}function Sh(e,t){return e.j=t,e}function _ce(e,t){return e.g-t.g}function vce(e,t){return e.b-t.b}function Ch(e,t){return e.s-t.s}function yce(e,t){return e?0:t-1}function bce(e,t){return e?0:t-1}function xce(e,t){return e?t-1:0}function wh(e,t){return t.pg(e)}function Sce(e,t){return e.k=t,e}function Th(e,t){return e.j=t,e}function Eh(){this.a=0,this.b=0}function Dh(e){g_e.call(this,e)}function Oh(e){cP.call(this,e)}function Cce(e){Kwe.call(this,e)}function wce(e){Kwe.call(this,e)}function Tce(e,t){e.b=0,WP(e,t)}function Ece(e,t){e.c=t,e.b=!0}function kh(e,t,n){zxe(e.a,t,n)}function Dce(e,t){return e.c._b(t)}function Ah(e){return e.e&&e.e()}function jh(e){return e?e.d:null}function Oce(e,t){return Wze(e.b,t)}function kce(e){return e?e.g:null}function Ace(e){return e?e.i:null}function jce(e,t){return gue(e.a,t)}function Mce(e,t){for(;e.zd(t););}function Nce(){throw P(new kp)}function Mh(){Mh=E,KVt=DKe()}function Nh(){Nh=E,S7=oJe()}function Pce(){Pce=E,P7=eF()}function Ph(){Ph=E,KHt=OKe()}function Fce(){Fce=E,LUt=kKe()}function Ice(){Ice=E,C9=$Xe()}function Fh(e){return RS(e),e.o}function Ih(e,t){return e.a+=t,e}function Lce(e,t){return e.a+=t,e}function Lh(e,t){return e.a+=t,e}function Rh(e,t){return e.a+=t,e}function Rce(e){Dtt(),qnt(this,e)}function zh(e){this.a=new bg(e)}function Bh(e){this.a=new pSe(e)}function zce(){throw P(new kp)}function Bce(){throw P(new kp)}function Vce(){throw P(new kp)}function Vh(){throw P(new kp)}function Hh(){throw P(new kp)}function Hce(){this.b=new xK(rMt)}function Uce(){this.a=new xK(RNt)}function Uh(e){this.a=0,this.b=e}function Wce(){this.a=new xK(XPt)}function Wh(){this.b=new xK(SIt)}function Gce(){this.b=new xK(SIt)}function Kce(){this.a=new xK(LLt)}function qce(e,t){return b2e(e,t)}function Jce(e,t){return yJ(t,e)}function Gh(e,t){return e.d[t.p]}function Kh(e){return e.b!=e.d.c}function Yce(e){return e.l|e.m<<22}function qh(e){return IE(e),e.a}function Xce(e){e.c?p4e(e):m4e(e)}function Jh(e,t){for(;e.Pe(t););}function Yh(e,t,n){e.splice(t,n)}function Zce(){throw P(new kp)}function Xh(){throw P(new kp)}function Qce(){throw P(new kp)}function $ce(){throw P(new kp)}function Zh(){throw P(new kp)}function ele(){throw P(new kp)}function tle(){throw P(new kp)}function nle(){throw P(new kp)}function rle(){throw P(new kp)}function ile(){throw P(new kp)}function ale(){throw P(new jp)}function ole(){throw P(new jp)}function Qh(e){this.a=new sle(e)}function sle(e){CF(this,e,VYe())}function $h(e){return!e||VCe(e)}function eg(e){return N9[e]!=-1}function cle(){mgt!=0&&(mgt=0),ggt=-1}function lle(){Uht??=[]}function tg(e,t){Mx.call(this,e,t)}function ng(e,t){tg.call(this,e,t)}function ule(e,t){this.a=e,this.b=t}function dle(e,t){this.a=e,this.b=t}function fle(e,t){this.a=e,this.b=t}function ple(e,t){this.a=e,this.b=t}function mle(e,t){this.a=e,this.b=t}function rg(e,t){this.a=e,this.b=t}function ig(e,t){this.a=e,this.b=t}function ag(e,t){this.e=e,this.d=t}function hle(e,t){this.b=e,this.c=t}function og(e,t){this.b=e,this.a=t}function gle(e,t){this.b=e,this.a=t}function _le(e,t){this.b=e,this.a=t}function vle(e,t){this.b=e,this.a=t}function yle(e,t){this.a=e,this.b=t}function ble(e,t){this.a=e,this.b=t}function xle(e,t){this.a=e,this.b=t}function sg(e,t){this.a=e,this.f=t}function cg(e,t){this.g=e,this.i=t}function lg(e,t){this.f=e,this.g=t}function Sle(e,t){this.b=e,this.c=t}function Cle(e){Px(e.dc()),this.c=e}function wle(e,t){this.a=e,this.b=t}function Tle(e,t){this.a=e,this.b=t}function ug(e){this.a=B(gE(e),16)}function Ele(e){this.a=B(gE(e),16)}function Dle(e){this.a=B(gE(e),93)}function dg(e){this.b=B(gE(e),93)}function fg(e){this.b=B(gE(e),51)}function pg(){this.q=new r.Date}function mg(e,t){this.a=e,this.b=t}function Ole(e,t){return IT(e.b,t)}function hg(e,t){return e.b.Gc(t)}function gg(e,t){return e.b.Hc(t)}function kle(e,t){return e.b.Oc(t)}function _g(e,t){return e.b.Gc(t)}function Ale(e,t){return e.c.uc(t)}function jle(e,t){return ZR(e.c,t)}function vg(e,t){return e.a._b(t)}function Mle(e,t){return e>t&&t<ZY}function yg(e){return e.f.c+e.i.c}function Nle(e){return uE(),e?Sgt:xgt}function bg(e){sRe.call(this,e,0)}function Ple(){pSe.call(this,null)}function xg(e){this.c=e,jNe(this)}function Sg(){cpe(this),AD(this)}function Cg(){Cg=E,Hgt=new D}function wg(){wg=E,W1=new te}function Tg(){Tg=E,y_t=new _fe}function Eg(){Eg=E,b_t=new Jy}function Dg(){Dg=E,P_t=new he}function Og(){Og=E,J1=new be}function Fle(){sM.call(this,null)}function kg(e,t){IE(e),e.a.Nb(t)}function Ile(e,t){return e.a.Vc(t)}function Lle(e,t){return e.a.Wc(t)}function Rle(e,t){return e.a.Yc(t)}function zle(e,t){return e.a.Zc(t)}function Ag(e,t){return e.Fc(t),e}function Ble(e,t){dG(ID(e.a),t)}function Vle(e,t){dG(ID(e.a),t)}function jg(e,t){return e.a.e=t,e}function Mg(e,t){return e.a.a=t,e}function Ng(e,t){return e.a.d=t,e}function Hle(e,t){return e.a.d=t,e}function Ule(e,t){return e.a.f=t,e}function Wle(e,t){return e.a.g=t,e}function Gle(e,t){return e.a.j=t,e}function Pg(e,t){return e.a.g=t,e}function Fg(e,t){return e.a.f=t,e}function Kle(e){return e.b=!1,e}function qle(){qle=E,abt=new yt}function Jle(){Jle=E,lbt=new Pxe}function Yle(){Yle=E,J_t=new ke}function Xle(){Xle=E,ibt=new ct}function Ig(){Ig=E,Bbt=new cee}function Lg(){Lg=E,ybt=new pt}function Zle(){Zle=E,Tbt=new Dt}function Rg(){Rg=E,Dbt=new Ot}function zg(){zg=E,qxt=new hee}function Bg(){Bg=E,zbt=new Eh}function Vg(){Vg=E,kkt=new Fs}function Hg(){Hg=E,lSt=new Vee}function Ug(){Ug=E,Q0=new ci}function Wg(){Wg=E,wIt=new $le}function Gg(){Gg=E,DIt=new Zme}function Kg(){Kg=E,A6=new YCe}function qg(){qg=E,QLt=new Exe}function Jg(){Jg=E,tRt=new Txe}function Yg(){Yg=E,iRt=new ASe}function Qle(){lFe(),this.c=new Nse}function $le(){lg.call(this,Oot,0)}function eue(e,t,n,r){YUe(e,r,t,n)}function tue(e,t,n,r){cK(r,e,t,n)}function nue(e,t,n,r){Ctt(r,e,t,n)}function rue(e,t,n){LO(e.d,t.f,n)}function Xg(e,t){ZB(e.c.b,t.c,t)}function Zg(e,t){ZB(e.c.c,t.b,t)}function Qg(e,t){return e.a=t.g,e}function iue(e){return e.e.a+e.f.a}function aue(e){return e.e.b+e.f.b}function oue(e){return(e.c+e.a)/2}function sue(e){return e.b?e.b:e.a}function $g(e,t){return WGe(e.a,t)}function cue(){cue=E,GHt=new Goe}function e_(){e_=E,cUt=new Dpe}function t_(){t_=E,h9=new Ope}function n_(){n_=E,WVt=new Hs}function lue(){lue=E,iHt=new nc}function uue(){uue=E,HHt=new Loe}function r_(){r_=E,WHt=new Roe}function i_(){i_=E,q7=new rm}function a_(){a_=E,EHt=new dp}function o_(){o_=E,yUt=new up}function s_(){s_=E,G9=new tu}function c_(){c_=E,OUt=new ul}function l_(){l_=E,AUt=new dl}function due(e){aD(),FYe.call(this,e)}function u_(e){aD(),due.call(this,e)}function fue(e){Aw(),jpe.call(this,e)}function pue(e,t){UEe.call(this,e,t)}function d_(e,t){this.d=e,this.e=t}function mue(e,t){return NR(e,t)>0}function hue(e,t){return NR(e,t)<0}function f_(e,t){return Zw(e.a,t)}function gue(e,t){return e.a.a.cc(t)}function p_(e){return e.b<e.d.gc()}function m_(e,t){return e.a.get(t)}function _ue(e,t){return t.split(e)}function vue(e,t){return IT(e.e,t)}function h_(e){return B(e,45).jd()}function g_(e){return NE(e),!1}function yue(e){this.a=B(gE(e),231)}function __(e){ZO.call(this,e,21)}function v_(e,t){lg.call(this,e,t)}function bue(e,t){lg.call(this,e,t)}function xue(e,t){this.b=e,this.a=t}function Sue(e,t){this.a=e,this.b=t}function Cue(e,t){this.a=e,this.b=t}function y_(e,t){this.a=e,this.b=t}function wue(e,t){this.a=e,this.b=t}function Tue(e,t){this.b=e,this.a=t}function Eue(e,t){Yw(e,e.length,t)}function b_(e,t){aCe(e,e.length,t)}function x_(e,t,n){t.Ne(e.a.We(n))}function Due(e,t,n){t.Bd(e.a.Xe(n))}function Oue(e,t,n){t.Ad(e.a.Kb(n))}function S_(e,t,n){e.Mb(n)&&t.Ad(n)}function C_(e,t,n){e.splice(t,0,n)}function w_(e,t){lg.call(this,e,t)}function T_(e,t){lg.call(this,e,t)}function E_(e,t){lg.call(this,e,t)}function D_(e,t){lg.call(this,e,t)}function O_(e,t){lg.call(this,e,t)}function k_(e,t){lg.call(this,e,t)}function A_(e,t){lg.call(this,e,t)}function j_(e,t){this.a=e,this.b=t}function kue(e,t){this.b=e,this.a=t}function Aue(e,t){this.b=e,this.a=t}function jue(e,t){this.b=e,this.a=t}function M_(e,t){this.b=e,this.a=t}function N_(e,t){this.c=e,this.d=t}function Mue(e,t){this.e=e,this.d=t}function P_(e,t){this.a=e,this.b=t}function F_(e,t){lg.call(this,e,t)}function I_(e,t){lg.call(this,e,t)}function L_(e,t){lg.call(this,e,t)}function R_(e,t){lg.call(this,e,t)}function z_(e,t){lg.call(this,e,t)}function B_(e,t){lg.call(this,e,t)}function V_(e,t){this.a=e,this.b=t}function H_(e,t){this.a=e,this.b=t}function Nue(e,t){this.a=e,this.b=t}function U_(e,t){this.a=e,this.b=t}function W_(e,t){this.a=e,this.b=t}function Pue(e,t){this.a=e,this.b=t}function Fue(e,t){this.a=e,this.b=t}function Iue(e,t){this.a=e,this.b=t}function Lue(e,t){this.b=e,this.a=t}function Rue(e,t){this.b=e,this.a=t}function zue(e,t){this.b=t,this.c=e}function G_(e,t){lg.call(this,e,t)}function K_(e,t){lg.call(this,e,t)}function q_(e,t){lg.call(this,e,t)}function J_(e,t){lg.call(this,e,t)}function Bue(e,t){lg.call(this,e,t)}function Y_(e,t){lg.call(this,e,t)}function Vue(e,t){lg.call(this,e,t)}function X_(e,t){lg.call(this,e,t)}function Z_(e,t){lg.call(this,e,t)}function Q_(e,t){lg.call(this,e,t)}function $_(e,t){lg.call(this,e,t)}function Hue(e,t){lg.call(this,e,t)}function ev(e,t){lg.call(this,e,t)}function tv(e,t){lg.call(this,e,t)}function nv(e,t){lg.call(this,e,t)}function Uue(e,t){lg.call(this,e,t)}function Wue(e,t){lg.call(this,e,t)}function Gue(e,t){lg.call(this,e,t)}function Kue(e,t){lg.call(this,e,t)}function rv(e,t){lg.call(this,e,t)}function iv(e,t){lg.call(this,e,t)}function av(e,t){lg.call(this,e,t)}function ov(e,t){lg.call(this,e,t)}function sv(e,t){lg.call(this,e,t)}function cv(e,t){lg.call(this,e,t)}function lv(e,t){lg.call(this,e,t)}function uv(e,t){lg.call(this,e,t)}function que(e,t){lg.call(this,e,t)}function Jue(e,t){lg.call(this,e,t)}function Yue(e,t){lg.call(this,e,t)}function dv(e,t){lg.call(this,e,t)}function Xue(e,t){lg.call(this,e,t)}function Zue(e,t){lg.call(this,e,t)}function Que(e,t){lg.call(this,e,t)}function $ue(e,t){this.b=e,this.a=t}function ede(e,t){return Vx(e.e,t)}function tde(e,t){return Vx(e.c,t)}function nde(e,t){return Vx(t.b,e)}function rde(e,t){return GC(),t!=e}function fv(e){return SS(e.a),e.b}function ide(e){return e$e(e,e.c),e}function ade(){return hce(),new p_t}function ode(){JC(),this.a=new lC}function pv(e,t){this.a=e,this.b=t}function sde(e,t){this.a=e,this.b=t}function cde(e,t){this.a=e,this.b=t}function lde(e,t){this.b=e,this.a=t}function ude(e,t){this.a=e,this.b=t}function dde(e,t){lg.call(this,e,t)}function mv(e,t){lg.call(this,e,t)}function hv(e,t){lg.call(this,e,t)}function gv(e,t){lg.call(this,e,t)}function _v(e,t){lg.call(this,e,t)}function fde(e,t){lg.call(this,e,t)}function pde(e,t){this.a=e,this.b=t}function mde(e,t){this.a=e,this.b=t}function hde(e,t){this.a=e,this.b=t}function gde(e,t){this.b=e,this.d=t}function _de(e,t){this.b=e,this.a=t}function vv(e,t){lg.call(this,e,t)}function yv(e,t){lg.call(this,e,t)}function vde(e,t){lg.call(this,e,t)}function bv(e,t){lg.call(this,e,t)}function yde(e,t){lg.call(this,e,t)}function bde(e,t){this.b=e,this.a=t}function xv(e,t){this.b=e,this.a=t}function Sv(e,t){this.b=e,this.a=t}function Cv(e,t){this.b=e,this.a=t}function xde(e,t){lg.call(this,e,t)}function wv(e,t){lg.call(this,e,t)}function Sde(e,t){lg.call(this,e,t)}function Cde(e,t){lg.call(this,e,t)}function Tv(e,t){lg.call(this,e,t)}function wde(e,t){lg.call(this,e,t)}function Tde(e,t){lg.call(this,e,t)}function Ev(e,t){lg.call(this,e,t)}function Ede(e,t){lg.call(this,e,t)}function Dde(e,t){lg.call(this,e,t)}function Ode(e,t){lg.call(this,e,t)}function kde(e,t){lg.call(this,e,t)}function Dv(e,t){lg.call(this,e,t)}function Ov(e,t){lg.call(this,e,t)}function Ade(e,t){lg.call(this,e,t)}function kv(e,t){lg.call(this,e,t)}function jde(e,t){lg.call(this,e,t)}function Mde(e,t){lg.call(this,e,t)}function Av(e,t){lg.call(this,e,t)}function Nde(e,t){lg.call(this,e,t)}function jv(e,t){this.a=e,this.b=t}function Pde(e,t){this.a=e,this.b=t}function Fde(e,t){this.a=e,this.b=t}function Mv(e,t){lg.call(this,e,t)}function Nv(e,t){lg.call(this,e,t)}function Pv(e,t){this.a=e,this.b=t}function Fv(e,t){lg.call(this,e,t)}function Iv(e,t){lg.call(this,e,t)}function Lv(e,t){lg.call(this,e,t)}function Rv(e,t){lg.call(this,e,t)}function zv(e,t){lg.call(this,e,t)}function Bv(e,t){lg.call(this,e,t)}function Vv(e,t){lg.call(this,e,t)}function Hv(e,t){lg.call(this,e,t)}function Uv(e,t){lg.call(this,e,t)}function Wv(e,t){lg.call(this,e,t)}function Gv(e,t){lg.call(this,e,t)}function Kv(e,t){lg.call(this,e,t)}function qv(e,t){lg.call(this,e,t)}function Jv(e,t){lg.call(this,e,t)}function Yv(e,t){lg.call(this,e,t)}function Xv(e,t){lg.call(this,e,t)}function Zv(e,t){lg.call(this,e,t)}function Qv(e,t){lg.call(this,e,t)}function Ide(e,t){lg.call(this,e,t)}function $v(e,t){lg.call(this,e,t)}function Lde(e,t){this.a=e,this.b=t}function Rde(e,t){this.a=e,this.b=t}function zde(e,t){this.a=e,this.b=t}function Bde(e,t){this.a=e,this.b=t}function Vde(e,t){this.a=e,this.b=t}function ey(e,t){this.a=e,this.b=t}function ty(e,t){lg.call(this,e,t)}function ny(e,t){this.a=e,this.b=t}function ry(){EK(),this.a=new Vp}function iy(){oDe(),this.b=new Vp}function ay(){tDe(),Ixe.call(this)}function oy(){rDe(),NTe.call(this)}function sy(){rDe(),NTe.call(this)}function cy(e,t){rNe(e.a,B(t,12))}function ly(e,t,n){lqe(t,LXe(e,n))}function uy(e,t,n){lqe(t,LXe(e,n))}function dy(e,t){return Vx(e.g,t)}function Hde(e,t){return-e.b.$e(t)}function Ude(e,t){this.a=e,this.b=t}function Wde(e,t){this.a=e,this.b=t}function Gde(e,t){this.a=e,this.b=t}function Kde(e,t){this.a=e,this.b=t}function qde(e,t){this.a=e,this.b=t}function Jde(e,t){this.a=e,this.b=t}function Yde(e,t){this.a=e,this.b=t}function Xde(e,t){this.a=e,this.b=t}function Zde(e,t){this.a=e,this.b=t}function fy(e,t){this.a=e,this.b=t}function py(e,t){this.b=e,this.a=t}function my(e,t){this.b=e,this.a=t}function Qde(e,t){this.b=e,this.a=t}function $de(e,t){this.b=e,this.a=t}function hy(e,t){this.f=e,this.c=t}function gy(e,t){this.i=e,this.g=t}function _y(e,t){this.a=e,this.b=t}function efe(e,t){this.a=e,this.b=t}function vy(e,t){this.a=e,this.b=t}function yy(e,t){this.a=e,this.b=t}function by(e,t){this.d=e,this.e=t}function tfe(e,t){this.d=e,this.b=t}function nfe(e,t){this.a=e,this.b=t}function rfe(e,t){this.e=e,this.a=t}function xy(e,t){this.b=e,this.c=t}function Sy(e,t){lg.call(this,e,t)}function ife(e,t){e&&WE(M7,e,t)}function afe(e,t){e.i=null,TF(e,t)}function ofe(e,t){return MVe(e.a,t)}function Cy(e){return hB(e.c,e.b)}function wy(e){return e?e.kd():null}function L(e){return e??null}function Ty(e){return typeof e===hY}function Ey(e){return typeof e===Irt}function Dy(e){return typeof e===gY}function Oy(e,t){return NR(e,t)==0}function ky(e,t){return NR(e,t)>=0}function Ay(e,t){return NR(e,t)!=0}function jy(e,t){return e.Pd().Xb(t)}function My(e,t){return iIe(e.Jc(),t)}function sfe(e){return``+(NE(e),e)}function Ny(e,t){return e.a+=``+t,e}function Py(e,t){return e.a+=``+t,e}function Fy(e,t){return e.a+=``+t,e}function Iy(e,t){return e.a+=``+t,e}function Ly(e,t){return e.a+=``+t,e}function Ry(e,t){return e.a+=``+t,e}function zy(e){return Dw(e==null),e}function cfe(e){return YO(e,0),null}function By(e){return Xz(e),e.d.gc()}function lfe(e){r.clearTimeout(e)}function ufe(e,t){e.q.setTime(Tk(t))}function Vy(e,t){RNe(new jx(e),t)}function Hy(e,t){mSe.call(this,e,t)}function Uy(e,t){mSe.call(this,e,t)}function Wy(e,t){mSe.call(this,e,t)}function Gy(e,t){bA(e,t,e.c.b,e.c)}function Ky(e,t){bA(e,t,e.a,e.a.a)}function dfe(e,t){return e.j[t.p]==2}function ffe(e,t){return e.a=t.g+1,e}function qy(e){return e.a=0,e.b=0,e}function pfe(){pfe=E,Nvt=CR(QB())}function mfe(){mfe=E,Kxt=CR(I0e())}function hfe(){hfe=E,yMt=CR(gIe())}function gfe(){this.b=new bg(zI(12))}function _fe(){this.b=0,this.a=!1}function Jy(){this.b=0,this.a=!1}function Yy(e){this.a=e,nu.call(this)}function vfe(e){this.a=e,nu.call(this)}function Xy(e,t){qS.call(this,e,t)}function Zy(e,t){hC.call(this,e,t)}function Qy(e,t){gy.call(this,e,t)}function yfe(e,t){oS.call(this,e,t)}function $y(e,t){YI.call(this,e,t)}function eb(e,t){a_(),WE(EHt,e,t)}function tb(e,t){return tO(e.a,0,t)}function bfe(e,t){return L(e)===L(t)}function nb(e,t){return _z(e.a,t.a)}function rb(e,t){return Yb(e.a,t.a)}function xfe(e,t){return nCe(e.a,t.a)}function ib(e){return wO((NE(e),e))}function ab(e){return wO((NE(e),e))}function ob(e){return Xb(e.l,e.m,e.h)}function Sfe(e){return gE(e),new Yy(e)}function sb(e,t){return e.indexOf(t)}function cb(e){return typeof e===Irt}function lb(e){return e<10?`0`+e:``+e}function Cfe(e){return e==b0||e==C0}function ub(e){return e==b0||e==x0}function wfe(e,t){return Yb(e.g,t.g)}function Tfe(e){return uN(e.b.b,e,0)}function Efe(e){wT(this),gI(this,e)}function Dfe(e){this.a=ade(),this.b=e}function Ofe(e){this.a=ade(),this.b=e}function kfe(e,t){return hx(e.a,t),t}function db(e,t){VM(e,0,e.length,t)}function fb(e,t){return Yb(e.g,t.g)}function pb(e,t){return _z(t.f,e.f)}function Afe(e,t){return KC(),t.a+=e}function mb(e,t){return KC(),t.a+=e}function jfe(e,t){return KC(),t.c+=e}function hb(e,t){return AI(e.a,t),e}function gb(e,t){return hx(e.c,t),e}function _b(e){return AI(new RE,e)}function vb(e){return e==B8||e==V8}function yb(e){return e==U8||e==z8}function Mfe(e){return e==v3||e==_3}function bb(e){return e!=C5&&e!=w5}function xb(e){return e.sh()&&e.th()}function Nfe(e){return Swe(B(e,127))}function Sb(){yD.call(this,0,0,0,0)}function Pfe(){Bw.call(this,0,0,0,0)}function Cb(){Zne.call(this,new DA)}function Ffe(e){hy.call(this,e,!0)}function wb(e){this.a=e.a,this.b=e.b}function Tb(e,t){ZL(e,t),KP(e,e.D)}function Eb(e,t,n){HP(e,t),PP(e,n)}function Db(e,t,n){LP(e,t),NP(e,n)}function Ob(e,t,n){RP(e,t),zP(e,n)}function kb(e,t,n){FP(e,t),IP(e,n)}function Ab(e,t,n){BP(e,t),VP(e,n)}function Ife(e,t,n){Ahe.call(this,e,t,n)}function Lfe(){v_.call(this,`Head`,1)}function Rfe(){v_.call(this,`Tail`,3)}function jb(e){rq(),vI.call(this,e)}function Mb(e){return e==null?0:JF(e)}function Nb(e,t){return new YI(t,e)}function zfe(e,t){return new YI(t,e)}function Bfe(e,t){return pP(t,_O(e))}function Vfe(e,t){return pP(t,_O(e))}function Hfe(e,t){return e[e.length]=t}function Pb(e,t){return e[e.length]=t}function Ufe(e){return Wye(e.b.Jc(),e.a)}function Wfe(e,t){return dF(pE(e.f),t)}function Fb(e,t){return dF(pE(e.n),t)}function Ib(e,t){return dF(pE(e.p),t)}function Lb(e,t){qS.call(this,e.b,t)}function Rb(e){Bw.call(this,e,e,e,e)}function zb(e){e.c=G(v1,CY,1,0,5,1)}function Gfe(e,t,n){yE(e.c[t.g],t.g,n)}function Kfe(e,t,n){B(e.c,72).Ei(t,n)}function qfe(e,t,n){Ob(n,n.i+e,n.j+t)}function Jfe(e,t){gM($k(e.a),_De(t))}function Yfe(e,t){gM(EN(e.a),vDe(t))}function Xfe(e,t){G1||(e.b=t)}function Bb(e,t,n){return yE(e,t,n),n}function Vb(e){hP(e.Qf(),new mf(e))}function Hb(){Hb=E,Njt=new Qz(OBt)}function Ub(){Ub=E,Fp(),ygt=new dp}function Wb(){Wb=E,new Zfe,new up}function Zfe(){new dp,new dp,new dp}function Qfe(){throw P(new Im(Rht))}function $fe(){throw P(new Im(Rht))}function Gb(){throw P(new Im(zht))}function epe(){throw P(new Im(zht))}function Kb(e){cY(),cp.call(this,e)}function tpe(e){this.a=e,qye.call(this,e)}function qb(e){this.a=e,dg.call(this,e)}function npe(e){this.a=e,dg.call(this,e)}function rpe(e){return e==null?0:JF(e)}function Jb(e){return e.a<e.c.c.length}function ipe(e){return e.a<e.c.a.length}function ape(e,t){return NR(e,t)>0?e:t}function Yb(e,t){return e<t?-1:e>t?1:0}function ope(e,t){return e.a?e.b:t.Ue()}function Xb(e,t,n){return{l:e,m:t,h:n}}function spe(e,t){e.a!=null&&cy(t,e.a)}function Zb(e,t){gE(t),lD(e).Ic(new h)}function Qb(e,t){Jw(e.c,e.c.length,t)}function cpe(e){e.a=new ce,e.c=new ce}function $b(e){this.b=e,this.a=new up}function lpe(e){this.b=new $e,this.a=e}function upe(e){cC.call(this),this.a=e}function dpe(e){FTe.call(this),this.b=e}function fpe(){v_.call(this,`Range`,2)}function ppe(){FKe(),this.a=new xK(nbt)}function ex(){ex=E,r.Math.log(2)}function tx(){tx=E,_9=(lue(),iHt)}function nx(e){e.j=G(Vgt,LY,325,0,0,1)}function mpe(e){e.a=new dp,e.e=new dp}function rx(e){return new Pv(e.c,e.d)}function hpe(e){return new Pv(e.c,e.d)}function ix(e){return new Pv(e.a,e.b)}function gpe(e,t){return WE(e.a,t.a,t)}function ax(e,t,n){return WE(e.g,n,t)}function _pe(e,t,n){return WE(e.k,n,t)}function ox(e,t,n){return eHe(t,n,e.c)}function sx(e,t){return Eet(e.a,t,null)}function cx(e,t){return z(bE(e.i,t))}function vpe(e,t){return z(bE(e.j,t))}function ype(e,t){SJ(e),e.Fc(B(t,16))}function bpe(e,t,n){e.c._c(t,B(n,138))}function xpe(e,t,n){e.c.Si(t,B(n,138))}function Spe(e,t,n){return MJ(e,t,n),n}function Cpe(e,t){return zO(),t.n.b+=e}function lx(e,t){return u9e(e.c,e.b,t)}function ux(e,t){return vL(e.Jc(),t)!=-1}function R(e,t){return e!=null&&XUe(e,t)}function wpe(e,t){return new lme(e.Jc(),t)}function dx(e){return e.Ob()?e.Pb():null}function Tpe(e){return AB(e,0,e.length)}function fx(e){NO(e,null),PO(e,null)}function Epe(e){UO(e,null),fDe(e,null)}function Dpe(){oS.call(this,null,null)}function Ope(){sS.call(this,null,null)}function kpe(){lg.call(this,`INSTANCE`,0)}function px(){this.a=G(v1,CY,1,8,5,1)}function Ape(e){this.a=e,dp.call(this)}function jpe(e){this.a=(ND(),new nh(e))}function Mpe(e){this.b=(ND(),new of(e))}function mx(){mx=E,v_t=new fse(null)}function Npe(){Npe=E,Npe(),w_t=new de}function hx(e,t){return Sp(e.c,t),!0}function Ppe(e,t){e.c&&(Obe(t),vEe(t))}function Fpe(e,t){e.q.setHours(t),Wq(e,t)}function Ipe(e,t){return e.a.Ac(t)!=null}function gx(e,t){return e.a.Ac(t)!=null}function _x(e,t){return e.a[t.c.p][t.p]}function vx(e,t){return e.c[t.c.p][t.p]}function yx(e,t){return e.e[t.c.p][t.p]}function bx(e,t,n){return e.a[t.g][n.g]}function xx(e,t){return e.j[t.p]=z1e(t)}function Sx(e,t){return e.a*t.a+e.b*t.b}function Lpe(e,t){return e.a<h_e(t)?-1:1}function Rpe(e,t){return Vje(e.b,t.Og())}function zpe(e,t){return Vje(e.f,t.Og())}function Bpe(e,t){return F(z(t.a))<=e}function Vpe(e,t){return F(z(t.a))>=e}function Hpe(e,t,n){return n?t!=0:t!=e-1}function Upe(e,t,n){e.a=t^1502,e.b=n^Git}function Wpe(e,t,n){return e.a=t,e.b=n,e}function Cx(e,t){return e.a*=t,e.b*=t,e}function wx(e,t,n){return yE(e.g,t,n),n}function Tx(e,t,n,r){yE(e.a[t.g],n.g,r)}function Ex(e,t,n){fw.call(this,e,t,n)}function Dx(e,t,n){Ex.call(this,e,t,n)}function Ox(e,t,n){Ex.call(this,e,t,n)}function Gpe(e,t,n){Dx.call(this,e,t,n)}function Kpe(e,t,n){fw.call(this,e,t,n)}function kx(e,t,n){fw.call(this,e,t,n)}function qpe(e,t,n){Ype.call(this,e,t,n)}function Jpe(e,t,n){Kpe.call(this,e,t,n)}function Ype(e,t,n){pw.call(this,e,t,n)}function Xpe(e,t,n){pw.call(this,e,t,n)}function Ax(e){this.c=e,this.a=this.c.a}function jx(e){this.i=e,this.f=this.i.j}function Mx(e,t){this.a=e,dg.call(this,t)}function Zpe(e,t){this.a=e,Mse.call(this,t)}function Qpe(e,t){this.a=e,Mse.call(this,t)}function $pe(e,t){this.a=e,Mse.call(this,t)}function eme(e){this.a=e,Yu.call(this,e.d)}function tme(e){e.b.Qb(),--e.d.f.d,aT(e.d)}function Nx(e){e.a=B(VI(e.b.a,4),131)}function nme(e){e.a=B(VI(e.b.a,4),131)}function rme(e){XD(e,opt),rK(e,Vtt(e))}function ime(e){td.call(this,B(gE(e),34))}function ame(e){td.call(this,B(gE(e),34))}function Px(e){if(!e)throw P(new Ep)}function Fx(e){if(!e)throw P(new Dp)}function ome(e,t){return Uz(e,new Zm,t).a}function sme(e,t){return new RXe(e.a,e.b,t)}function Ix(e,t){return gE(t),new cme(e,t)}function cme(e,t){this.a=t,fg.call(this,e)}function lme(e,t){this.a=t,fg.call(this,e)}function ume(e,t){this.a=t,Mse.call(this,e)}function dme(e,t){this.a=t,KAe.call(this,e)}function fme(e,t){this.a=e,KAe.call(this,t)}function pme(){nx(this),kD(this),this.he()}function Lx(){this.Bb|=256,this.Bb|=512}function Rx(){Rx=E,E1=!1,D1=!0}function mme(){mme=E,c_(),kUt=new Lu}function hme(e){return Kh(e.a)?yDe(e):null}function gme(e){return e.l+e.m*vX+e.h*yX}function _me(e){return e==null?null:e.name}function zx(e){return e==null?wY:Jz(e)}function Bx(e,t){return e.lastIndexOf(t)}function vme(e,t,n){return e.indexOf(t,n)}function Vx(e,t){return!!t&&e.b[t.g]==t}function Hx(e){return e.a==null?null:e.a}function Ux(e){return SS(e.a!=null),e.a}function Wx(e,t,n){return PI(e,t,t,n),e}function yme(e,t){return hx(t.a,e.a),e.a}function Gx(e,t){return hx(t.b,e.a),e.a}function Kx(e,t){return++e.b,hx(e.a,t)}function bme(e,t){return++e.b,dN(e.a,t)}function qx(e,t){return hx(t.a,e.a),e.a}function Jx(e){rf.call(this,e),this.a=e}function xme(e){af.call(this,e),this.a=e}function Yx(e){nh.call(this,e),this.a=e}function Sme(e){doe.call(this),YF(this,e)}function Xx(e){qd.call(this,(NE(e),e))}function Zx(e){qd.call(this,(NE(e),e))}function Qx(e){Zne.call(this,new lM(e))}function Cme(e,t){WB.call(this,e,t,null)}function wme(e,t){return _z(e.n.a,t.n.a)}function Tme(e,t){return _z(e.c.d,t.c.d)}function Eme(e,t){return _z(e.c.c,t.c.c)}function $x(e,t){return B($A(e.b,t),16)}function Dme(e,t){return e.n.b=(NE(t),t)}function Ome(e,t){return e.n.b=(NE(t),t)}function kme(e,t){return _z(e.e.b,t.e.b)}function Ame(e,t){return _z(e.e.a,t.e.a)}function jme(e,t,n){return mAe(e,t,n,e.b)}function Mme(e,t,n){return mAe(e,t,n,e.c)}function eS(e){return KC(),!!e&&!e.dc()}function tS(){Hg(),this.b=new kf(this)}function Nme(e){this.a=e,nf.call(this,e)}function nS(e){this.c=e,iS.call(this,e)}function rS(e){this.c=e,jx.call(this,e)}function iS(e){this.d=e,jx.call(this,e)}function aS(e,t){nT(),this.f=t,this.d=e}function oS(e,t){e_(),this.a=e,this.b=t}function sS(e,t){t_(),this.b=e,this.c=t}function cS(e,t){Uje(t,e),this.c=e,this.b=t}function lS(e){var t=e.a;e.a=e.b,e.b=t}function uS(e){return Jb(e.a)||Jb(e.b)}function dS(e){return e.$H||=++W_t}function fS(e,t){return new i_e(e,e.gc(),t)}function Pme(e,t){return $xe(e.c).Kd().Xb(t)}function pS(e,t,n){e.dd(t).Rb(n)}function mS(e,t,n){B(xN(e,t),24).Ec(n)}function Fme(e,t,n){yz(e.a,n),DV(e.a,t)}function Ime(e,t,n,r){iSe.call(this,e,t,n,r)}function hS(e,t,n){return vme(e,AU(t),n)}function Lme(e){return Tm(),QP((ZEe(),agt),e)}function gS(e){return++W9,new Jk(3,e)}function _S(e){return lF(e,QY),new MM(e)}function vS(e){return SS(e.b!=0),e.a.a.c}function yS(e){return SS(e.b!=0),e.c.b.c}function Rme(e,t){return PI(e,t,t+1,``),e}function zme(e){if(!e)throw P(new Ap)}function bS(e){e.d=new kS(e),e.e=new dp}function xS(e){if(!e)throw P(new Ep)}function Bme(e){if(!e)throw P(new Tp)}function SS(e){if(!e)throw P(new jp)}function CS(e){if(!e)throw P(new Dp)}function wS(e){return e.b=B(eTe(e.a),45)}function TS(e,t){return!!e.q&&IT(e.q,t)}function Vme(e,t){return e>0?t*t/e:t*t*100}function Hme(e,t){return e>0?t/(e*e):t*100}function ES(e,t){return B(RN(e.a,t),34)}function Ume(e){return e.f==null?``+e.g:e.f}function Wme(e){return e.f==null?``+e.g:e.f}function Gme(e){return QD(),parseInt(e)||-1}function Kme(e){return CP(),e.e.a+e.f.a/2}function qme(e,t,n){return CP(),n.e.a-e*t}function DS(e,t,n){return Vg(),n.Lg(e,t)}function Jme(e,t,n){return CP(),n.e.b-e*t}function Yme(e){return CP(),e.e.b+e.f.b/2}function Xme(e,t){return JU(),qW(e,t.e,t)}function OS(e){R(e,162)&&B(e,162).mi()}function kS(e){Jye.call(this,e,null,null)}function Zme(){lg.call(this,`GROW_TREE`,0)}function Qme(e){this.c=e,this.a=1,this.b=1}function $me(e){Tg(),this.b=e,this.a=!0}function ehe(e){Eg(),this.b=e,this.a=!0}function the(e){$J(),qae(this),this.Df(e)}function nhe(e){Sg.call(this),aF(this,e)}function rhe(e){this.c=e,RP(e,0),zP(e,0)}function AS(e){return e.a=-e.a,e.b=-e.b,e}function jS(e,t){return e.a=t.a,e.b=t.b,e}function MS(e,t,n){return e.a+=t,e.b+=n,e}function ihe(e,t,n){return e.a-=t,e.b-=n,e}function ahe(e,t,n){IM(),e.nf(t)&&n.Ad(e)}function NS(e,t,n){sz($k(e.a),t,_De(n))}function ohe(e,t,n){return hx(t,mVe(e,n))}function she(e,t){return B(bE(e.e,t),19)}function che(e,t){return B(bE(e.e,t),19)}function lhe(e,t){return e.c.Ec(B(t,138))}function uhe(e,t){e_(),oS.call(this,e,t)}function dhe(e,t){t_(),sS.call(this,e,t)}function fhe(e,t){t_(),sS.call(this,e,t)}function phe(e,t){t_(),dhe.call(this,e,t)}function mhe(e,t){tx(),Gw.call(this,e,t)}function hhe(e,t){tx(),mhe.call(this,e,t)}function ghe(e,t){tx(),mhe.call(this,e,t)}function PS(e,t){tx(),ghe.call(this,e,t)}function FS(e,t){tx(),Gw.call(this,e,t)}function _he(e,t){tx(),Gw.call(this,e,t)}function vhe(e,t){tx(),FS.call(this,e,t)}function IS(e,t,n){wM.call(this,e,t,n,2)}function yhe(e,t,n){sz(EN(e.a),t,vDe(n))}function bhe(e,t){return IR(e.e,B(t,52))}function xhe(e,t,n){return t.xl(e.e,e.c,n)}function She(e,t,n){return t.yl(e.e,e.c,n)}function Che(e,t,n){return gJ(CN(e,t),n)}function whe(e,t){return(NE(e),e)+h_e(t)}function LS(e){return e==null?null:Jz(e)}function The(e){return e==null?null:Jz(e)}function Ehe(e){return e==null?null:ktt(e)}function Dhe(e){return e==null?null:tW(e)}function RS(e){e.o??l1e(e)}function zS(e){return Dw(e==null||Ty(e)),e}function z(e){return Dw(e==null||Ey(e)),e}function BS(e){return Dw(e==null||Dy(e)),e}function Ohe(){this.a=new mO,this.b=new mO}function khe(e,t){this.d=e,Ud(this),this.b=t}function VS(e,t){this.c=e,ag.call(this,e,t)}function HS(e,t){this.a=e,VS.call(this,e,t)}function Ahe(e,t,n){Oj.call(this,e,t,n,null)}function US(e,t,n){Oj.call(this,e,t,n,null)}function jhe(){iFe.call(this),this.Bb|=OX}function Mhe(e,t){sM.call(this,e),this.a=t}function Nhe(e,t){sM.call(this,e),this.a=t}function Phe(e,t){G1||hx(e.a,t)}function Fhe(e,t){return AWe(e,t),new gwe(e,t)}function Ihe(e,t,n){return e.Le(t,n)<=0?n:t}function Lhe(e,t,n){return e.Le(t,n)<=0?t:n}function Rhe(e){return NE(e),e?1231:1237}function zhe(e){return B(Pw(e.a,e.b),296)}function Bhe(e){return zO(),Mfe(B(e,205))}function Vhe(e,t){return B(RN(e.b,t),144)}function Hhe(e,t){return B(RN(e.c,t),236)}function WS(e){return new Pv(e.c,e.d+e.a)}function GS(e,t){return uI(),new k3e(t,e)}function KS(e,t){return Bg(),LI(t.d.i,e)}function Uhe(e,t){t.a?o$e(e,t):gx(e.a,t.b)}function Whe(e,t){return B(bE(e.b,t),280)}function qS(e,t){Zf.call(this,e),this.a=t}function Ghe(e,t,n){return n=_q(e,t,3,n),n}function Khe(e,t,n){return n=_q(e,t,6,n),n}function qhe(e,t,n){return n=_q(e,t,9,n),n}function JS(e,t){return XD(t,Tat),e.f=t,e}function Jhe(e,t){return(t&vY)%e.d.length}function Yhe(e,t,n){++e.j,e.oj(t,e.Xi(t,n))}function YS(e,t,n){++e.j,e.rj(),nM(e,t,n)}function Xhe(e,t,n){e.dd(t).Rb(n)}function Zhe(e,t){this.c=e,cP.call(this,t)}function Qhe(e,t){this.a=e,Nae.call(this,t)}function XS(e,t){this.a=e,Nae.call(this,t)}function ZS(e){this.q=new r.Date(Tk(e))}function $he(e){this.a=(lF(e,QY),new MM(e))}function ege(e){this.a=(lF(e,QY),new MM(e))}function tge(e){this.a=(ND(),new Xd(gE(e)))}function QS(){QS=E,Fvt=new qS(kat,0)}function $S(){$S=E,f6=new Zf(`root`)}function eC(){eC=E,F7=new Foe,new nm}function tC(){tC=E,Pvt=Bz((jB(),r7))}function nge(e){return tT(bT(e,32))^tT(e)}function rge(e){return String.fromCharCode(e)}function ige(e){return e==null?null:e.message}function age(e,t,n){return e.apply(t,n)}function oge(e,t,n){return oJ(e.c,e.b,t,n)}function sge(e,t,n){return HT(e,B(t,23),n)}function nC(e,t){return Rx(),e==t?0:e?1:-1}function cge(e,t){var n=t;return!!e.De(n)}function rC(e,t){var n=e.e;return e.e=t,n}function lge(e,t){e[Wit].call(e,t)}function uge(e,t){e[Wit].call(e,t)}function iC(e,t){e.a._c(e.b,t),++e.b,e.c=-1}function dge(e){wT(e.e),e.d.b=e.d,e.d.a=e.d}function aC(e){e.b?aC(e.b):e.f.c.yc(e.e,e.d)}function oC(e){return!e.a&&(e.a=new w),e.a}function fge(e,t,n){return e.a+=AB(t,0,n),e}function pge(e,t,n){Og(),vd(e,t.Te(e.a,n))}function mge(e,t,n,r){Bw.call(this,e,t,n,r)}function hge(e,t){Pae.call(this,e),this.a=t}function gge(e,t){Pae.call(this,e),this.a=t}function sC(){dC.call(this),this.a=new Eh}function cC(){this.n=new Eh,this.o=new Eh}function _ge(){this.b=new Eh,this.c=new up}function vge(){this.a=new up,this.b=new up}function yge(){this.a=new tt,this.b=new Pp}function lC(){this.b=new DA,this.a=new DA}function bge(){this.b=new Vp,this.a=new Vp}function xge(){this.b=new dp,this.a=new dp}function Sge(){this.a=new up,this.d=new up}function Cge(){this.a=new du,this.b=new di}function uC(){this.b=new Hce,this.a=new wa}function dC(){this.n=new $p,this.i=new Sb}function fC(e,t){return e.a+=t.a,e.b+=t.b,e}function pC(e,t){return e.a-=t.a,e.b-=t.b,e}function wge(e){return Lp(e.j.c,0),e.a=-1,e}function Tge(e,t,n){return n=_q(e,t,11,n),n}function Ege(e,t,n){n!=null&&xF(t,zV(e,n))}function Dge(e,t,n){n!=null&&SF(t,zV(e,n))}function mC(e,t,n,r){V.call(this,e,t,n,r)}function hC(e,t){jm.call(this,L$+e+j$+t)}function Oge(e,t,n,r){V.call(this,e,t,n,r)}function kge(e,t,n,r){Oge.call(this,e,t,n,r)}function Age(e,t,n,r){jT.call(this,e,t,n,r)}function jge(e,t,n,r){jT.call(this,e,t,n,r)}function Mge(e,t,n,r){jge.call(this,e,t,n,r)}function Nge(e,t,n,r){jT.call(this,e,t,n,r)}function gC(e,t,n,r){Nge.call(this,e,t,n,r)}function Pge(e,t,n,r){jge.call(this,e,t,n,r)}function Fge(e,t,n,r){Pge.call(this,e,t,n,r)}function Ige(e,t,n,r){PSe.call(this,e,t,n,r)}function Lge(e,t){return e.hk().ti().oi(e,t)}function Rge(e,t){return e.hk().ti().qi(e,t)}function zge(e,t){return e.n.a=(NE(t),t)+10}function Bge(e,t){return e.n.a=(NE(t),t)+10}function _C(e,t){return e.e=B(e.d.Kb(t),163)}function Vge(e,t){return t==e||IH($G(t),e)}function vC(e,t){return ih(Array(t),e)}function Hge(e,t){return NE(e),L(e)===L(t)}function yC(e,t){return NE(e),L(e)===L(t)}function Uge(e,t){return WE(e.a,t,``)==null}function Wge(e,t,n){return e.lastIndexOf(t,n)}function Gge(e,t){return e.b.zd(new Cue(e,t))}function Kge(e,t){return e.b.zd(new y_(e,t))}function qge(e,t){return e.b.zd(new wue(e,t))}function Jge(e){return e<100?null:new Oh(e)}function Yge(e,t){return J(t,(nY(),w4),e)}function Xge(e,t,n){return _z(e[t.a],e[n.a])}function Zge(e,t){return Yb(e.a.d.p,t.a.d.p)}function Qge(e,t){return Yb(t.a.d.p,e.a.d.p)}function $ge(e,t){return Bg(),!LI(t.d.i,e)}function e_e(e,t){G1||t&&(e.d=t)}function t_e(e,t){vb(e.f)?Z$e(e,t):yJe(e,t)}function bC(e,t){Yye.call(this,e,e.length,t)}function n_e(e){this.c=e,Wy.call(this,HY,0)}function r_e(e,t){this.c=e,GT.call(this,e,t)}function i_e(e,t,n){this.a=e,cS.call(this,t,n)}function a_e(e,t,n){this.c=t,this.b=n,this.a=e}function xC(e){GC(),this.d=e,this.a=new px}function SC(e,t){return t.ni(e.a)}function o_e(e,t){return _z(e.c-e.s,t.c-t.s)}function s_e(e,t){return _z(e.c.e.a,t.c.e.a)}function c_e(e,t){return _z(e.b.e.a,t.b.e.a)}function CC(e,t){return R(t,16)&&A4e(e.c,t)}function l_e(e,t,n){return B(e.c,72).Uk(t,n)}function wC(e,t,n){return B(e.c,72).Vk(t,n)}function u_e(e,t,n){return xhe(e,B(t,345),n)}function d_e(e,t,n){return She(e,B(t,345),n)}function f_e(e,t,n){return Rqe(e,B(t,345),n)}function p_e(e,t,n){return FJe(e,B(t,345),n)}function TC(e,t){return t==null?null:jR(e.b,t)}function EC(e){return e==y5||e==x5||e==b5}function m_e(e){return e.c?uN(e.c.a,e,0):-1}function h_e(e){return Ey(e)?(NE(e),e):e.se()}function DC(e){return!isNaN(e)&&!isFinite(e)}function g_e(e){cpe(this),AD(this),YF(this,e)}function OC(e){zb(this),wbe(this.c,0,e.Nc())}function __e(e){LE(e.a),rM(e.c,e.b),e.b=null}function v_e(){v_e=E,g_t=new le,__t=new ue}function y_e(){y_e=E,CHt=G(v1,CY,1,0,5,1)}function b_e(){b_e=E,nUt=G(v1,CY,1,0,5,1)}function x_e(){x_e=E,rUt=G(v1,CY,1,0,5,1)}function S_e(e){return qM(),QP((VMe(),j_t),e)}function C_e(e){return nR(),QP((Aj(),H_t),e)}function w_e(e){return vP(),QP((nMe(),nvt),e)}function T_e(e){return KM(),QP((rMe(),ovt),e)}function E_e(e){return kN(),QP((jj(),lvt),e)}function D_e(e){return lY(),QP((pfe(),Nvt),e)}function O_e(e,t){if(!e)throw P(new Nm(t))}function kC(e){if(!e)throw P(new Pm(zrt))}function k_e(e,t){if(e!=t)throw P(new Ap)}function AC(e,t,n){this.a=e,this.b=t,this.c=n}function A_e(e,t,n){this.a=e,this.b=t,this.c=n}function j_e(e,t,n){this.a=e,this.b=t,this.c=n}function M_e(e,t,n){this.b=e,this.c=t,this.a=n}function jC(e,t,n){this.d=e,this.b=n,this.a=t}function N_e(e,t,n){return Og(),e.a.Wd(t,n),t}function MC(e){var t=new He;return t.e=e,t}function NC(e){var t=new voe;return t.b=e,t}function PC(e,t,n){this.e=t,this.b=e,this.d=n}function FC(e,t,n){this.b=e,this.a=t,this.c=n}function IC(e){this.a=e,Cg(),BI(Date.now())}function P_e(e,t,n){this.a=e,this.b=t,this.c=n}function F_e(e){Bw.call(this,e.d,e.c,e.a,e.b)}function I_e(e){Bw.call(this,e.d,e.c,e.a,e.b)}function L_e(e){return UG(),QP((fIe(),Abt),e)}function R_e(e){return $I(),QP((HMe(),zvt),e)}function z_e(e){return bL(),QP((UMe(),pbt),e)}function B_e(e){return KN(),QP((ZAe(),nyt),e)}function V_e(e){return ON(),QP((Mj(),Qyt),e)}function H_e(e){return zU(),QP((DNe(),rbt),e)}function U_e(e){return HB(),QP((JM(),wbt),e)}function W_e(e){return PF(),QP((fA(),Ubt),e)}function LC(e){return sY(),QP((mfe(),Kxt),e)}function G_e(e){return yL(),QP((YM(),eSt),e)}function RC(e){return nL(),QP((XM(),hSt),e)}function K_e(e){return lU(),QP((eP(),xSt),e)}function q_e(e){return Yj(),QP((mA(),HSt),e)}function J_e(e){return gW(),QP((EPe(),RSt),e)}function Y_e(e){return IF(),QP((Wj(),DSt),e)}function X_e(e){return UK(),QP((pIe(),LSt),e)}function Z_e(e){return eB(),QP((QM(),KSt),e)}function Q_e(e){return nF(),QP((Pj(),ZSt),e)}function $_e(e){return WG(),QP((WIe(),sCt),e)}function zC(e){return bP(),QP((pA(),dCt),e)}function eve(e){return SL(),QP((Fj(),mCt),e)}function tve(e){return QU(),QP((TPe(),SCt),e)}function nve(e){return oN(),QP((hA(),ECt),e)}function rve(e){return BH(),QP((CPe(),PCt),e)}function ive(e){return YU(),QP((wPe(),VCt),e)}function ave(e){return RK(),QP((wLe(),KCt),e)}function ove(e){return tL(),QP((aMe(),XCt),e)}function sve(e){return xL(),QP((iMe(),$Ct),e)}function cve(e){return AN(),QP((Nj(),twt),e)}function lve(e){return kk(),QP((QAe(),awt),e)}function uve(e){return $z(),QP((nP(),Pwt),e)}function dve(e){return sA(),QP((gA(),Rwt),e)}function BC(e){return yV(),QP((GMe(),Xkt),e)}function VC(e){return bR(),QP((cMe(),qkt),e)}function fve(e){return dV(),QP((rP(),tAt),e)}function pve(e){return aq(),QP((CLe(),lAt),e)}function mve(e){return _K(),QP((GIe(),Hkt),e)}function hve(e){return MB(),QP((ZM(),mAt),e)}function gve(e){return jN(),QP((_A(),vAt),e)}function _ve(e){return rF(),QP((Ij(),bAt),e)}function vve(e){return eL(),QP((oMe(),TAt),e)}function yve(e){return tR(),QP((Lj(),kAt),e)}function bve(e){return xR(),QP((Rj(),NAt),e)}function xve(e){return tF(),QP((sMe(),RAt),e)}function Sve(e){return rL(),QP((zj(),VAt),e)}function HC(e){return yR(),QP((WMe(),ujt),e)}function Cve(e){return oA(),QP(($Ae(),vjt),e)}function wve(e){return oO(),QP((eje(),kjt),e)}function UC(e){return hO(),QP((tje(),jjt),e)}function Tve(e){return _j(),QP((nje(),Jjt),e)}function Eve(e,t){return(NE(e),e)+(NE(t),t)}function Dve(e){return aO(),QP((vA(),tMt),e)}function Ove(e){return fV(),QP((tN(),iMt),e)}function kve(e){return oq(),QP((hfe(),yMt),e)}function Ave(e){return BL(),QP((uMe(),CMt),e)}function jve(e){return $L(),QP((KMe(),ONt),e)}function Mve(e){return nk(),QP((rje(),MNt),e)}function Nve(e){return FF(),QP((ije(),zNt),e)}function Pve(e){return vU(),QP((tP(),KNt),e)}function Fve(e){return RM(),QP((aje(),XNt),e)}function Ive(e){return eR(),QP((dMe(),tPt),e)}function Lve(e){return RV(),QP(($M(),HPt),e)}function Rve(e){return OI(),QP((Bj(),qPt),e)}function WC(e){return CB(),QP((lMe(),ZPt),e)}function zve(e){return MU(),QP((eN(),rFt),e)}function Bve(e){return tB(),QP((fMe(),mFt),e)}function GC(){GC=E,pjt=(GJ(),Z5),mjt=j5}function KC(){KC=E,uSt=new Tr,dSt=new A}function qC(){qC=E,Wbt=new pn,Gbt=new mn}function JC(){JC=E,nSt=new See,tSt=new Cee}function Vve(e){return!e.e&&(e.e=new up),e.e}function Hve(e){return aK(),QP((GNe(),vIt),e)}function YC(e){return Wg(),QP((wke(),EIt),e)}function Uve(e){return lz(),QP((Vj(),CIt),e)}function Wve(e){return Gg(),QP((Tke(),kIt),e)}function XC(e){return gj(),QP((sje(),NIt),e)}function Gve(e){return eW(),QP((KNe(),BIt),e)}function Kve(e){return yA(),QP((oje(),aIt),e)}function qve(e){return sN(),QP((Hj(),uIt),e)}function ZC(e){return BR(),QP((Uj(),hIt),e)}function Jve(e){return Kg(),QP((Eke(),SLt),e)}function Yve(e){return iL(),QP((cje(),ELt),e)}function Xve(e){return aA(),QP((lje(),ALt),e)}function Zve(e){return AH(),QP((qMe(),RLt),e)}function Qve(e){return qg(),QP((Dke(),eRt),e)}function $ve(e){return Jg(),QP((Oke(),rRt),e)}function QC(e){return Yg(),QP((kke(),oRt),e)}function eye(e){return xP(),QP((uje(),uRt),e)}function $C(e){return eV(),QP(($N(),SRt),e)}function tye(e){return fW(),QP((mIe(),TRt),e)}function nye(e){return bV(),QP((OPe(),NRt),e)}function rye(e){return eU(),QP((AP(),YRt),e)}function iye(e){return cz(),QP((WN(),yBt),e)}function aye(e){return RR(),QP((JMe(),wBt),e)}function oye(e){return yP(),QP((Kj(),EBt),e)}function sye(e){return rB(),QP((nN(),kBt),e)}function cye(e){return NU(),QP((DPe(),LBt),e)}function lye(e){return rR(),QP((Gj(),KBt),e)}function ew(e){return pH(),QP((rN(),YBt),e)}function uye(e){return vG(),QP((UIe(),XBt),e)}function dye(e){return nV(),QP((WNe(),$Bt),e)}function fye(e){return mU(),QP((jP(),tVt),e)}function pye(e){return NW(),QP((kPe(),rVt),e)}function mye(e){return MP(),QP((Jj(),pVt),e)}function hye(e){return GJ(),QP((UN(),iVt),e)}function gye(e){return jB(),QP((aN(),mVt),e)}function _ye(e){return dq(),QP((HIe(),xVt),e)}function vye(e){return zR(),QP((qj(),TVt),e)}function yye(e){return cA(),QP((iN(),AVt),e)}function bye(e){return nB(),QP((YMe(),IVt),e)}function xye(e){return QL(),QP((XMe(),UVt),e)}function Sye(e,t){this.c=e,this.a=t,this.b=t-e}function tw(e,t,n){this.c=e,this.a=t,this.b=n}function Cye(e,t,n){this.a=e,this.c=t,this.b=n}function wye(e,t,n){this.a=e,this.c=t,this.b=n}function Tye(e,t,n){this.a=e,this.b=t,this.c=n}function Eye(e,t,n){this.a=e,this.b=t,this.c=n}function Dye(e,t,n){this.a=e,this.b=t,this.c=n}function Oye(e,t,n){this.a=e,this.b=t,this.c=n}function kye(e,t,n){this.a=e,this.b=t,this.c=n}function Aye(e,t,n){this.a=e,this.b=t,this.c=n}function jye(e,t,n){this.a=e,this.b=t,this.c=n}function Mye(e,t,n){this.b=e,this.a=t,this.c=n}function nw(e,t,n){this.e=e,this.a=t,this.c=n}function Nye(e,t,n){tx(),pO.call(this,e,t,n)}function Pye(e,t,n){tx(),LCe.call(this,e,t,n)}function Fye(e,t,n){tx(),LCe.call(this,e,t,n)}function Iye(e,t,n){tx(),LCe.call(this,e,t,n)}function Lye(e,t,n){tx(),Pye.call(this,e,t,n)}function Rye(e,t,n){tx(),Pye.call(this,e,t,n)}function zye(e,t,n){tx(),Rye.call(this,e,t,n)}function Bye(e,t,n){tx(),Fye.call(this,e,t,n)}function Vye(e,t,n){tx(),Iye.call(this,e,t,n)}function Hye(e){return mG(),QP((hIe(),gHt),e)}function rw(e,t){return gE(e),gE(t),new dle(e,t)}function iw(e,t){return gE(e),gE(t),new xbe(e,t)}function Uye(e,t){return gE(e),gE(t),new Sbe(e,t)}function Wye(e,t){return gE(e),gE(t),new vle(e,t)}function Gye(e,t){wle.call(this,e,Pz(new Lm(t)))}function Kye(e,t){this.c=e,this.b=t,this.a=!1}function qye(e){this.d=e,Ud(this),this.b=Zxe(e.d)}function Jye(e,t,n){this.c=e,d_.call(this,t,n)}function Yye(e,t,n){hSe.call(this,t,n),this.a=e}function Xye(){this.a=`;,;`,this.b=``,this.c=``}function Zye(e,t,n){this.b=e,Hy.call(this,t,n)}function Qye(e,t){t&&(e.b=t,e.a=(IE(t),t.a))}function $ye(e){return SS(e.b!=0),mP(e,e.a.a)}function ebe(e){return SS(e.b!=0),mP(e,e.c.b)}function tbe(e){return!e.c&&(e.c=new xc),e.c}function nbe(e){var t=new doe;return WF(t,e),t}function aw(e){var t=new Sg;return WF(t,e),t}function ow(e){var t=new up;return gNe(t,e),t}function rbe(e){var t=new Vp;return gNe(t,e),t}function B(e,t){return Dw(e==null||XUe(e,t)),e}function sw(e,t){return t&&AE(e,t.d)?t:null}function cw(e,t){if(!e)throw P(new Nm(t))}function ibe(e,t){if(!e)throw P(new wse(t))}function lw(e,t){if(!e)throw P(new Pm(t))}function abe(e,t){return Ug(),Yb(e.d.p,t.d.p)}function obe(e,t){return CP(),_z(e.e.b,t.e.b)}function sbe(e,t){return CP(),_z(e.e.a,t.e.a)}function cbe(e,t){return Yb(Lbe(e.d),Lbe(t.d))}function lbe(e,t){return t==(GJ(),Z5)?e.c:e.d}function ube(e){return new Pv(e.c+e.b,e.d+e.a)}function dbe(e){var t,n=e.d;t=e.a,e.d=t,e.a=n}function fbe(e){var t=e.b;e.b=e.c,e.c=t}function uw(e,t,n,r,i){e.b=t,e.c=n,e.d=r,e.a=i}function pbe(e,t,n,r,i){e.d=t,e.c=n,e.a=r,e.b=i}function mbe(e,t,n,r,i){e.c=t,e.d=n,e.b=r,e.a=i}function dw(e,t){return mPe(e),e.a*=t,e.b*=t,e}function hbe(e,t){return t<0?e.g=-1:e.g=t,e}function fw(e,t,n){by.call(this,e,t),this.c=n}function gbe(e,t,n){N_.call(this,e,t),this.b=n}function _be(e){x_e(),rc.call(this),this._h(e)}function pw(e,t,n){by.call(this,e,t),this.c=n}function vbe(e,t,n){this.a=e,Qy.call(this,t,n)}function ybe(e,t,n){this.a=e,Qy.call(this,t,n)}function bbe(e){this.b=e,this.a=fT(this.b.a).Md()}function xbe(e,t){this.b=e,this.a=t,nu.call(this)}function Sbe(e,t){this.a=e,this.b=t,nu.call(this)}function Cbe(e){cS.call(this,e.length,0),this.a=e}function wbe(e,t,n){IQe(n,0,e,t,n.length,!1)}function mw(e,t,n){ZN(e,t,new _E(n))}function Tbe(e,t){var n=e.c;return hFe(e,t),n}function Ebe(e,t){return(az(e)<<4|az(t))&uX}function Dbe(e){return e!=null&&!nVe(e,I7,L7)}function hw(e){return e==0||isNaN(e)?e:e<0?-1:1}function Obe(e){e.a.b=e.b,e.b.a=e.a,e.a=e.b=null}function gw(e,t){return bA(e,t,e.c.b,e.c),!0}function _w(e){return gN(e.slice(),e)}function vw(e){var t=e.n;return e.a.b+t.d+t.a}function kbe(e){var t=e.n;return e.e.b+t.d+t.a}function Abe(e){var t=e.n;return e.e.a+t.b+t.c}function yw(e){return cY(),++W9,new Ww(0,e)}function jbe(){jbe=E,jUt=(ND(),new Xd(Zmt))}function bw(){bw=E,new aWe((dm(),egt),(um(),$ht))}function Mbe(){mj(),PCe.call(this,(i_(),q7))}function Nbe(e,t){hSe.call(this,t,1040),this.a=e}function xw(e,t){return OH(e,new N_(t.a,t.b))}function Pbe(e){return!NA(e)&&e.c.i.c==e.d.i.c}function Fbe(e,t){return e.c<t.c?-1:e.c==t.c?0:1}function Ibe(e){return e.b.c.length-e.e.c.length}function Lbe(e){return e.e.c.length-e.g.c.length}function Rbe(e){return e.e.c.length+e.g.c.length}function zbe(e){return SP(),G(oMt,Ilt,41,e,0,1)}function Bbe(){Bbe=E,Ngt=G(N1,LY,15,256,0,1)}function Vbe(){this.b=F(z(iV((xq(),Cyt))))}function Hbe(e){return zO(),(GJ(),I5).Gc(e.j)}function Ube(e,t,n){return CP(),n.e.a+n.f.a+e*t}function Wbe(e,t,n){return CP(),n.e.b+n.f.b+e*t}function Gbe(e,t,n){return WE(e.b,B(n.b,17),t)}function Kbe(e,t,n){return WE(e.b,B(n.b,17),t)}function qbe(e,t){return hx(e,new Pv(t.a,t.b))}function Jbe(e,t){vF(e,t==null?null:(NE(t),t))}function Ybe(e,t){_Fe(e,t==null?null:(NE(t),t))}function Xbe(e,t){_Fe(e,t==null?null:(NE(t),t))}function Zbe(e,t,n,r){vHe.call(this,e,t,n,r,0,0)}function Sw(e,t){xy.call(this,e,t),this.a=this}function Qbe(e){x_e(),_be.call(this,e),this.a=-1}function $be(){Ide.call(this,`COUNT_CHILDREN`,0)}function exe(e){this.c=e,this.b=this.c.d.vc().Jc()}function txe(e){return e.e.Pd().gc()*e.c.Pd().gc()}function Cw(e,t,n){return new a_e(UCe(e).Ze(),n,t)}function ww(e,t,n){return e.a=-1,mS(e,t.g,n),e}function nxe(e,t,n){var r=e[t];return e[t]=n,r}function Tw(e,t){var n=bCe(e,t);return n.i=2,n}function Ew(e,t){var n;return++e.j,n=e.Aj(t),n}function rxe(e){return e.a?e.a:zwe(e)}function Dw(e){if(!e)throw P(new Mm(null))}function ixe(e){if(e.c.e!=e.a)throw P(new Ap)}function axe(e){if(e.e.c!=e.b)throw P(new Ap)}function Ow(e){for(gE(e);e.Ob();)e.Pb(),e.Qb()}function oxe(e){e.a.jd(),B(e.a.kd(),18).gc(),Ise()}function kw(){kw=E,sgt=new mOe((ND(),ND(),H1))}function Aw(){Aw=E,lgt=new fue((ND(),ND(),a_t))}function sxe(){sxe=E,Agt=G(k1,LY,224,256,0,1)}function cxe(){cxe=E,Mgt=G(A1,LY,183,128,0,1)}function lxe(){lxe=E,Fgt=G(P1,LY,192,256,0,1)}function uxe(){uxe=E,Bgt=G(F1,LY,193,256,0,1)}function dxe(){uw(this,!1,!1,!1,!1)}function jw(e){Zne.call(this,new DA),YF(this,e)}function Mw(e){this.a=new bg(e.gc()),YF(this,e)}function fxe(e){this.c=e,this.a=new xg(this.c.a)}function Nw(e,t){Og(),sM.call(this,e),this.a=t}function Pw(e,t){return YO(t,e.c.length),e.c[t]}function pxe(e,t){return YO(t,e.a.length),e.a[t]}function mxe(e,t){return e.a+=AB(t,0,t.length),e}function hxe(e,t){return e.a??J4e(e),e.a[t]}function gxe(e,t,n){return Yb(t.d[e.g],n.d[e.g])}function _xe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function vxe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function Fw(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function yxe(e,t,n){return Yb(e.d[t.p],e.d[n.p])}function Iw(e,t){return NE(e),TI(e,(NE(t),t))}function bxe(e,t){return NE(t),TI(t,(NE(e),e))}function xxe(e){return e.q?e.q:(ND(),ND(),U1)}function Sxe(e){return e.c-B(Pw(e.a,e.b),296).b}function Lw(e,t){return e?0:r.Math.max(0,t-1)}function Rw(e,t,n){return r.Math.min(n/e,1/t)}function zw(e,t,n,r,i,a){return hqe(e,t,n,r,i,0,a)}function Bw(e,t,n,r){pbe(this,e,t,n,r)}function Cxe(e,t){var n;for(n=0;n<t;++n)e[n]=-1}function wxe(e){var t=bqe(e);return t?wxe(t):e}function Vw(e){return e.c?e.c.f:e.e.b}function Hw(e){return e.c?e.c.g:e.e.a}function Uw(e){cP.call(this,e.gc()),aE(this,e)}function Txe(){lg.call(this,`SIMPLE_X_PLACING`,0)}function Exe(){lg.call(this,`SIMPLE_Y_PLACING`,0)}function Dxe(e){this.a=e,this.c=new dp,TLe(this)}function Oxe(e){this.b=new Sg,this.a=e,this.c=-1}function Ww(e,t){cY(),cp.call(this,e),this.a=t}function Gw(e,t){tx(),np.call(this,t),this.a=e}function Kw(e,t,n){this.a=e,Ex.call(this,t,n,2)}function qw(e,t,n){JO(t,e.c.length),C_(e.c,t,n)}function kxe(e,t){return!e&&(e=[]),e[e.length]=t,e}function Jw(e,t,n){HRe(0,t,e.length),VM(e,0,t,n)}function Yw(e,t,n){var r;for(r=0;r<t;++r)e[r]=n}function Xw(e,t){var n=Bz(e);return GLe(n,t),n}function Zw(e,t){return R(t,23)&&Vx(e,B(t,23))}function Axe(e,t){return R(t,23)&&cPe(e,B(t,23))}function Qw(e,t){return JRe(e,t,vje(e,e.b.Ae(t)))}function jxe(e,t){return e.a.get(t)!==void 0}function $w(e,t){return e==null?t==null:yC(e,t)}function Mxe(e,t){return e==null?t==null:BB(e,t)}function eT(e,t){return cY(),++W9,new $Se(e,t)}function tT(e){return cb(e)?e|0:Yce(e)}function nT(){nT=E,GVt=new Lb((oY(),E8),0)}function Nxe(){Nxe=E,ngt=new Cbe(G(v1,CY,1,0,5,1))}function Pxe(){this.b=new St,this.c=new LTe(this)}function rT(){this.d=new Ne,this.e=new ITe(this)}function Fxe(e,t){this.b=new Sg,this.a=e,this.c=t}function Ixe(){tDe(),this.g=new Sg,this.f=new Sg}function Lxe(e,t){iT(e,pC(new Pv(t.a,t.b),e.c))}function iT(e,t){fC(e.c,t),e.b.c+=t.a,e.b.d+=t.b}function aT(e){e.b?aT(e.b):e.d.dc()&&e.f.c.Ac(e.e)}function Rxe(e){return Array.isArray(e)&&e.Rm===T}function oT(e){return YG(e,26)*IX+YG(e,27)*LX}function zxe(e,t,n){return BT(e,new j_(t.a,n.a))}function sT(e,t,n){return-Yb(e.f[t.p],e.f[n.p])}function cT(e,t,n){var r;e&&(r=e.i,r.c=t,r.b=n)}function lT(e,t,n){var r;e&&(r=e.i,r.d=t,r.a=n)}function uT(e,t,n){return e.a=-1,mS(e,t.g+1,n),e}function Bxe(e,t,n){return n=_q(e,B(t,52),7,n),n}function Vxe(e,t,n){return n=_q(e,B(t,52),3,n),n}function Hxe(e,t,n){G$e(n,e,1),hx(t,new U_(n,e))}function Uxe(e,t,n){DH(n,e,1),hx(t,new Rue(n,e))}function Wxe(e,t,n){this.a=e,Dx.call(this,t,n,22)}function Gxe(e,t,n){this.a=e,Dx.call(this,t,n,14)}function Kxe(e,t,n,r){tx(),BOe.call(this,e,t,n,r)}function qxe(e,t,n,r){tx(),BOe.call(this,e,t,n,r)}function Jxe(e,t){(t.Bb&h$)!=0&&!e.a.o&&(e.a.o=t)}function Yxe(e){return e!=null&&RSe(e)&&e.Rm!==T}function Xxe(e){return!Array.isArray(e)&&e.Rm===T}function Zxe(e){return R(e,16)?B(e,16).cd():e.Jc()}function Qxe(e){return e.Oc(G(v1,CY,1,e.gc(),5,1))}function dT(e,t){return NHe(CN(e,t))?t.wi():null}function fT(e){return e.c?e.c:e.c=e.Qd()}function $xe(e){return e.d?e.d:e.d=e.Rd()}function pT(e){return e.i||=e.bc()}function eSe(e){return e.f||=e.Cc()}function tSe(e){return cY(),++W9,new fO(10,e,0)}function mT(e){s_(),this.a=0,this.b=e-1,this.c=1}function nSe(e){nx(this),this.g=e,kD(this),this.he()}function rSe(){zO(),this.k=new dp,this.d=new Vp}function iSe(e,t,n,r){this.a=e,Oj.call(this,e,t,n,r)}function hT(e){this.a=(Nxe(),ngt),this.d=B(gE(e),51)}function gT(e){if(e.e.j!=e.d)throw P(new Ap)}function _T(e){return cb(e)?``+e:T4e(e)}function vT(e,t){return RI(EYe(cb(e)?qI(e):e,t))}function yT(e,t){return RI(gG(cb(e)?qI(e):e,t))}function bT(e,t){return RI(cXe(cb(e)?qI(e):e,t))}function aSe(e,t){return nC((NE(e),e),(NE(t),t))}function oSe(e,t){return _z((NE(e),e),(NE(t),t))}function sSe(e,t){return gE(t),e.a.Hd(t)&&!e.b.Hd(t)}function cSe(e,t){return Xb(e.l&t.l,e.m&t.m,e.h&t.h)}function lSe(e,t){return Xb(e.l|t.l,e.m|t.m,e.h|t.h)}function uSe(e,t){return Xb(e.l^t.l,e.m^t.m,e.h^t.h)}function xT(e,t){return XR(e,(NE(t),new tre(t)))}function ST(e,t){return XR(e,(NE(t),new nre(t)))}function dSe(e,t,n){e.a.Mb(n)&&(e.b=!0,t.Ad(n))}function fSe(e){e.d||(e.d=e.b.Jc(),e.c=e.b.gc())}function CT(e,t){if(e<0||e>=t)throw P(new Ip)}function wT(e){e.f=new Dfe(e),e.i=new Ofe(e),++e.g}function TT(e){this.b=new MM(11),this.a=(PD(),e)}function pSe(e){this.b=null,this.a=(PD(),e||o_t)}function mSe(e,t){this.e=e,this.d=t&64?t|RY:t}function hSe(e,t){this.c=0,this.d=e,this.b=t|64|RY}function gSe(e){this.a=$Ue(e.a),this.b=new OC(e.b)}function ET(e,t,n,r){var i=e.i;i.i=t,i.a=n,i.b=r}function _Se(e){for(var t=e;t.f;)t=t.f;return t}function vSe(e){return e.e?bj(e.e):null}function ySe(e,t){return uI(),_z(t.a.o.a,e.a.o.a)}function bSe(e,t,n){return zK(),CI(e,t)&&CI(e,n)}function DT(e){return NW(),!e.Gc(D5)&&!e.Gc(k5)}function xSe(e,t,n){return Drt(e,B(t,12),B(n,12))}function SSe(e){return dI(),B(e,12).g.c.length!=0}function CSe(e){return dI(),B(e,12).e.c.length!=0}function OT(e){return new Pv(e.c+e.b/2,e.d+e.a/2)}function wSe(e,t){return t.Sh()?IR(e.b,B(t,52)):t}function TSe(e,t,n){t.of(n,F(z(bE(e.b,n)))*e.a)}function ESe(e,t){t.Tg(`General 'Rotator`,1),utt(e)}function kT(e,t,n,r,i){TM.call(this,e,t,n,r,i,-1)}function AT(e,t,n,r,i){EM.call(this,e,t,n,r,i,-1)}function V(e,t,n,r){Ex.call(this,e,t,n),this.b=r}function jT(e,t,n,r){fw.call(this,e,t,n),this.b=r}function DSe(e){hy.call(this,e,!1),this.a=!1}function OSe(){Ide.call(this,`LOOKAHEAD_LAYOUT`,1)}function kSe(){Ide.call(this,`LAYOUT_NEXT_LEVEL`,3)}function ASe(){lg.call(this,`ABSOLUTE_XPLACING`,0)}function jSe(e){this.b=e,iS.call(this,e),Nx(this)}function MSe(e){this.b=e,nS.call(this,e),nme(this)}function NSe(e,t){this.b=e,Yu.call(this,e.b),this.a=t}function MT(e,t,n){this.a=e,mC.call(this,t,n,5,6)}function PSe(e,t,n,r){this.b=e,Ex.call(this,t,n,r)}function NT(e,t,n){rq(),this.e=e,this.d=t,this.a=n}function PT(e,t){for(NE(t);e.Ob();)t.Ad(e.Pb())}function FT(e,t){return cY(),++W9,new TE(e,t,0)}function FSe(e,t){return cY(),++W9,new TE(6,e,t)}function ISe(e,t){return yC(e.substr(0,t.length),t)}function IT(e,t){return Dy(t)?VD(e,t):!!Qw(e.f,t)}function LSe(e){return Xb(~e.l&hX,~e.m&hX,~e.h&gX)}function RSe(e){return typeof e===mY||typeof e===_Y}function LT(e){return new hT(new ume(e.a.length,e.a))}function zSe(e){return new Nw(null,tCe(e,e.length))}function BSe(e){if(!e)throw P(new jp);return e.d}function RT(e){var t=jL(e);return SS(t!=null),t}function VSe(e){var t=dz(e);return SS(t!=null),t}function zT(e,t){var n=e.a.gc();return Uje(t,n),n-t}function BT(e,t){return e.a.yc(t,e)==null}function VT(e,t){return e.a.yc(t,(Rx(),E1))==null}function HSe(e,t){return e>0?r.Math.log(e/t):-100}function USe(e,t){return t?YF(e,t):!1}function HT(e,t,n){return OF(e.a,t),nxe(e.b,t.g,n)}function WSe(e,t,n){CT(n,e.a.c.length),TA(e.a,n,t)}function H(e,t,n,r){HRe(t,n,e.length),GSe(e,t,n,r)}function GSe(e,t,n,r){var i;for(i=t;i<n;++i)e[i]=r}function KSe(e,t){var n;for(n=0;n<t;++n)e[n]=!1}function qSe(e,t){if(e==null)throw P(new Fm(t))}function UT(e,t){ype(e,R(t,164)?t:B(t,2015).Pl())}function JSe(e,t,n){htt(e.a,e.b,e.d,e.c,B(t,171),n)}function WT(e,t,n){return VRe(e,t.g,n),OF(e.c,t),e}function YSe(e){return RJ(e,(cz(),B8)),e.d=!0,e}function XSe(e){return!e.j&&Rne(e,i6e(e.g,e.b)),e.j}function ZSe(e,t,n){var r=HN(e,t);return BAe(e,t,n),r}function QSe(e,t,n){this.c=e,this.a=t,ND(),this.b=n}function GT(e,t){this.d=e,jx.call(this,e),this.e=t}function $Se(e,t){cp.call(this,1),this.a=e,this.b=t}function KT(e){CS(e.b!=-1),ij(e.c,e.a=e.b),e.b=-1}function eCe(e){e.a=null,e.e=null,wT(e.b),e.d=0,++e.c}function qT(e){return e.e==0?e:new NT(-e.e,e.d,e.a)}function tCe(e,t){return ePe(t,e.length),new Nbe(e,t)}function nCe(e,t){return NR(e,t)<0?-1:NR(e,t)>0?1:0}function rCe(e,t){return _z(e.c.c+e.c.b,t.c.c+t.c.b)}function JT(e,t){bA(e.d,t,e.b.b,e.b),++e.a,e.c=null}function YT(e,t){return e.c?YT(e.c,t):hx(e.b,t),e}function XT(e,t){kg(dD(e.Mc(),new Ur),new Mf(t))}function ZT(e,t,n,r,i){TU(e,B($A(t.k,n),16),n,r,i)}function iCe(e,t,n,r,i){for(;t<n;)r[i++]=YE(e,t++)}function aCe(e,t,n){var r;for(r=0;r<t;++r)yE(e,r,n)}function QT(e){e.s=NaN,e.c=NaN,a$e(e,e.e),a$e(e,e.j)}function oCe(e){return r.Math.abs(e.d.e-e.e.e)-e.a}function $T(e,t){return _z(e.e.a+e.f.a,t.e.a+t.f.a)}function eE(e,t){return _z(e.e.b+e.f.b,t.e.b+t.f.b)}function tE(e,t){this.d=uBe(e),this.c=t,this.a=.5*t}function nE(e){this.d=(NE(e),e),this.a=0,this.c=HY}function rE(e){FTe.call(this),this.a=e,hx(e.a,this)}function iE(e){e?eJe(e,(Cg(),Hgt),``):mEe((Cg(),e))}function sCe(e,t){OE(e,new _E(t.f==null?``+t.g:t.f))}function cCe(e,t){OE(e,new _E(t.f==null?``+t.g:t.f))}function aE(e,t){return e.Qi()&&(t=DO(e,t)),e.Di(t)}function oE(e,t){return t=e.Wk(null,t),CU(e,null,t)}function lCe(e,t,n){return cY(),++W9,new iOe(e,t,n)}function sE(e,t,n){return B(e.c.fd(t,B(n,138)),45)}function uCe(){return Tm(),q(I(igt,1),$Y,541,0,[rgt])}function dCe(e){return e==wX?d1:e==TX?`-INF`:``+e}function fCe(e){return e==wX?d1:e==TX?`-INF`:``+e}function cE(e){return(e.i??Rq(e),e.i).length}function lE(){lE=E,Q7=_Qe(),(uY(),e9)&&bKe()}function uE(){uE=E,xgt=new pd(!1),Sgt=new pd(!0)}function dE(e){var t;return t=e.g,t||(e.g=new Hu(e))}function fE(e){var t;return t=e.k,t||(e.k=new Uu(e))}function pCe(e){var t;return t=e.k,t||(e.k=new Uu(e))}function mCe(e){var t;return t=e.i,t||(e.i=new cne(e))}function hCe(e){return e.j||=new cd(e)}function gCe(e){return e.f||=new eme(e)}function pE(e){return e.d||=new nd(e)}function _Ce(e){return R(e,613)?e:new EEe(e)}function vCe(e,t){return wk(t,e.c.b.c.gc()),new ule(e,t)}function yCe(e,t){var n=e.a.gc();return wk(t,n),n-1-t}function U(e,t,n){var r=bCe(e,t);return HPe(n,r),r}function bCe(e,t){var n=new PLe;return n.j=e,n.d=t,n}function mE(e,t){return e.a+=String.fromCharCode(t),e}function hE(e,t){return e.a+=String.fromCharCode(t),e}function gE(e){if(e==null)throw P(new Op);return e}function _E(e){if(e==null)throw P(new Op);this.a=e}function xCe(e){Fp(),this.b=new up,this.a=e,H9e(this,e)}function SCe(e){this.b=e,this.a=B(ME(this.b.a.e),229)}function CCe(e){this.d=e,this.c=e.a.d.a,this.b=e.a.e.g}function wCe(e){this.b=new up,this.a=new up,this.c=e}function vE(e){this.c=new Eh,this.a=new up,this.b=e}function TCe(){DA.call(this),this.a=!0,this.b=!0}function ECe(e,t){return XO(t,e.length+1),e.substr(t)}function yE(e,t,n){return Bme(n==null||d8e(e,n)),e[t]=n}function DCe(e,t,n){return l3e(e,FFe(e,t,n))}function OCe(e,t){console[e].call(console,t)}function bE(e,t){return Dy(t)?sO(e,t):wy(Qw(e.f,t))}function kCe(e,t){return B(fT(e.a).Kd().Xb(t),45).jd()}function xE(e,t){return B(Y(t,(nY(),K4)),15).a<e}function ACe(e,t){return uI(),B(ZE(e,t.d),16).Ec(t)}function jCe(e,t,n,r){return n==0||(n-r)/n<e.e||t>=e.g}function SE(e){return r.Math.sqrt(e.a*e.a+e.b*e.b)}function CE(e){return R(e,104)&&(B(e,20).Bb&h$)!=0}function wE(e){return!e.d&&(e.d=new Ex(G7,e,1)),e.d}function MCe(e){return!e.a&&(e.a=new Ex(d7,e,4)),e.a}function NCe(e){this.c=e,this.a=new Sg,this.b=new Sg}function PCe(e){this.a=(NE(Y$),Y$),this.b=e,new rm}function FCe(e,t,n){this.a=e,Fke.call(this,8,t,null,n)}function ICe(e,t,n){this.a=e,Pae.call(this,t),this.b=n}function TE(e,t,n){cp.call(this,e),this.a=t,this.b=n}function LCe(e,t,n){np.call(this,t),this.a=e,this.b=n}function EE(e,t,n){B(t.b,68),hP(t.a,new Eye(e,n,t))}function DE(e,t){for(NE(t);e.c<e.d;)e.Qe(t,e.c++)}function RCe(e,t){++e.j,yU(e,e.i,t),vQe(e,B(t,345))}function zCe(e,t){var n;++e.j,n=e.Cj(),e.pj(e.Xi(n,t))}function OE(e,t){var n=e.a.length;HN(e,n),BAe(e,n,t)}function kE(e,t){return CT(t,e.a.c.length),Pw(e.a,t)}function AE(e,t){return sH(e.c,e.f,t,e.b,e.a,e.e,e.d)}function jE(e,t){return L(e)===L(t)||e!=null&&ZR(e,t)}function BCe(e){return ME(e),R(e,475)?B(e,475):Jz(e)}function VCe(e){return e?e.dc():!e.Jc().Ob()}function HCe(e){return B9?VD(B9,e):!1}function UCe(e){return 0>=e?new Fle:yFe(e-1)}function ME(e){if(e==null)throw P(new Op);return e}function NE(e){if(e==null)throw P(new Op);return e}function PE(e){return!e.a&&e.c?e.c.b:e.a}function WCe(e){return e.c.i.c==e.d.i.c}function GCe(e,t){return Yb(t.j.c.length,e.j.c.length)}function KCe(e){kwe(e.a),e.b=G(v1,CY,1,e.b.length,5,1)}function FE(e){e.c?e.c.Ye():(e.d=!0,dK(e))}function IE(e){e.c?IE(e.c):(zz(e),e.d=!0)}function LE(e){CS(e.c!=-1),e.d.ed(e.c),e.b=e.c,e.c=-1}function qCe(e){e.b=!1,e.c=!1,e.d=!1,e.a=!1}function JCe(e){this.c=e,this.b=this.c.a,this.a=this.c.e}function RE(){Qoe.call(this),Lp(this.j.c,0),this.a=-1}function YCe(){lg.call(this,`DELAUNAY_TRIANGULATION`,0)}function XCe(e){for(;e.a.b!=0;)Vet(e,B(yEe(e.a),9))}function ZCe(e,t){gM((!e.a&&(e.a=new XS(e,e)),e.a),t)}function QCe(e,t){e.c<0||e.b.b<e.c?Gy(e.b,t):e.a.vf(t)}function zE(e,t){var n=e.Fh(t);n>=0?e.hi(n):HZe(e,t)}function $Ce(e,t){this.b=e,GT.call(this,e,t),Nx(this)}function ewe(e,t){this.b=e,r_e.call(this,e,t),nme(this)}function twe(){XJe.call(this,Q$,(Ph(),KHt)),u7e(this)}function nwe(e){return!e.b&&(e.b=new rp(new Woe)),e.b}function BE(e){if(e.p!=3)throw P(new Dp);return e.e}function rwe(e){if(e.p!=4)throw P(new Dp);return e.e}function iwe(e){if(e.p!=4)throw P(new Dp);return e.j}function awe(e){if(e.p!=3)throw P(new Dp);return e.j}function owe(e){if(e.p!=6)throw P(new Dp);return e.f}function swe(e){if(e.p!=6)throw P(new Dp);return e.k}function VE(e){return e.c==-2&&kne(e,BJe(e.g,e.b)),e.c}function HE(e,t){var n=bCe(``,e);return n.n=t,n.i=1,n}function UE(e,t){for(;t-- >0;)e=e<<1|(e<0?1:0);return e}function cwe(e,t){iT(B(t.b,68),e),hP(t.a,new gf(e))}function lwe(e,t){return bw(),new aWe(new ame(e),new ime(t))}function uwe(e,t,n){return CL(),n.Kg(e,B(t.jd(),149))}function dwe(e){return lF(e,eit),XN(jz(jz(5,e),e/10|0))}function fwe(e){return ND(),e?e.Me():(PD(),PD(),c_t)}function WE(e,t,n){return Dy(t)?LO(e,t,n):xW(e.f,t,n)}function pwe(e){return String.fromCharCode.apply(null,e)}function mwe(e){return!e.d&&(e.d=new rf(e.c.Bc())),e.d}function GE(e){return!e.a&&(e.a=new Vse(e.c.vc())),e.a}function hwe(e){return!e.b&&(e.b=new nh(e.c.ec())),e.b}function gwe(e,t){Mpe.call(this,bFe(gE(e),gE(t))),this.a=t}function _we(e,t,n,r){cg.call(this,e,t),this.d=n,this.a=r}function KE(e,t,n,r){cg.call(this,e,n),this.a=t,this.f=r}function qE(e){this.d=e,this.a=this.d.b,this.b=this.d.c}function vwe(){XJe.call(this,s1,(Fce(),LUt)),h9e(this)}function JE(){vm.call(this,`There is no more element.`)}function YE(e,t){return XO(t,e.length),e.charCodeAt(t)}function ywe(e,t){e.u.Gc((NW(),D5))&&sQe(e,t),tMe(e,t)}function XE(e,t){return L(e)===L(t)||e!=null&&ZR(e,t)}function ZE(e,t){return Zw(e.a,t)?e.b[B(t,23).g]:null}function bwe(e,t){var n=new vE(e);return Sp(t.c,n),n}function QE(e){return e.j.c.length=0,kwe(e.c),wge(e.a),e}function xwe(e){return!e.b&&(e.b=new gC(g7,e,4,7)),e.b}function $E(e){return!e.c&&(e.c=new gC(g7,e,5,8)),e.c}function eD(e){return!e.c&&(e.c=new V(E7,e,9,9)),e.c}function Swe(e){return!e.n&&(e.n=new V(w7,e,1,7)),e.n}function tD(e,t,n,r){return cIe(e,t,n,!1),rz(e,r),e}function nD(e,t){kz(e,F(JP(t,`x`)),F(JP(t,`y`)))}function Cwe(e,t){kz(e,F(JP(t,`x`)),F(JP(t,`y`)))}function wwe(){return qg(),q(I($Lt,1),$Y,557,0,[QLt])}function rD(){return Jg(),q(I(nRt,1),$Y,558,0,[tRt])}function iD(){return Yg(),q(I(aRt,1),$Y,559,0,[iRt])}function Twe(){return Gg(),q(I(OIt,1),$Y,550,0,[DIt])}function Ewe(){return Wg(),q(I(TIt,1),$Y,480,0,[wIt])}function Dwe(){return Kg(),q(I(xLt,1),$Y,531,0,[A6])}function aD(){aD=E,cgt=new u_(q(I(S1,1),GY,45,0,[]))}function oD(e,t){return new wTe(B(gE(e),50),B(gE(t),50))}function Owe(e){return e!=null&&hg(zHt,e.toLowerCase())}function sD(e){return e.e==c1&&Fne(e,BHe(e.g,e.b)),e.e}function cD(e){return e.f==c1&&Lne(e,rKe(e.g,e.b)),e.f}function lD(e){var t=e.b;return!t&&(e.b=t=new Wu(e)),t}function kwe(e){var t;for(t=e.Jc();t.Ob();)t.Pb(),t.Qb()}function uD(e,t,n){var r=B(e.d.Kb(n),163);r&&r.Nb(t)}function Awe(e,t){return _z(e.d.c+e.d.b/2,t.d.c+t.d.b/2)}function jwe(e,t){return _z(e.g.c+e.g.b/2,t.g.c+t.g.b/2)}function Mwe(e,t){return Lg(),_z((NE(e),e),(NE(t),t))}function dD(e,t){return zz(e),new Nw(e,new Kje(t,e.a))}function fD(e,t){return zz(e),new Nw(e,new AM(t,e.a))}function pD(e,t){return zz(e),new Mhe(e,new Wje(t,e.a))}function mD(e,t){return zz(e),new Nhe(e,new Gje(t,e.a))}function Nwe(e,t){this.b=e,this.c=t,this.a=new xg(this.b)}function hD(e,t,n,r){this.a=e,this.e=t,this.d=n,this.c=r}function gD(e,t,n){this.a=sit,this.d=e,this.b=t,this.c=n}function _D(e,t,n,r){this.a=e,this.c=t,this.b=n,this.d=r}function vD(e,t,n,r){this.c=e,this.b=t,this.a=n,this.d=r}function Pwe(e,t,n,r){this.c=e,this.b=t,this.d=n,this.a=r}function Fwe(e,t,n,r){this.a=e,this.d=t,this.c=n,this.b=r}function yD(e,t,n,r){this.c=e,this.d=t,this.b=n,this.a=r}function bD(e,t,n,r){lg.call(this,e,t),this.a=n,this.b=r}function Iwe(e,t,n,r){RL.call(this,e,n,r,!1),this.f=t}function xD(e,t){this.d=(NE(e),e),this.a=16449,this.c=t}function Lwe(e){this.a=new up,this.e=G(q9,LY,54,e,0,2)}function Rwe(e){e.Tg(`No crossing minimization`,1),e.Ug()}function SD(e){var t,n=(t=new pp,t);return OP(n,e),n}function CD(e){var t,n=(t=new pp,t);return qU(n,e),n}function wD(e,t,n){var r=qtt(e);return t.qi(n,r)}function zwe(e){return CFe(e)||null}function Bwe(e){return!e.b&&(e.b=new V(_7,e,12,3)),e.b}function TD(e){if(Xz(e.d),e.d.d!=e.c)throw P(new Ap)}function Vwe(e,t,n,r){this.a=e,this.c=t,this.d=n,this.b=r}function Hwe(e,t,n,r){this.a=e,this.b=t,this.d=n,this.c=r}function Uwe(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function ED(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function DD(e,t,n,r){this.e=e,this.a=t,this.c=n,this.d=r}function Wwe(e,t,n,r){tx(),qje.call(this,t,n,r),this.a=e}function Gwe(e,t,n,r){tx(),qje.call(this,t,n,r),this.a=e}function OD(e,t){this.a=e,khe.call(this,e,B(e.d,16).dd(t))}function Kwe(e){this.f=e,this.c=this.f.e,e.f>0&&WKe(this)}function kD(e){return e.n&&(e.e!==nit&&e.he(),e.j=null),e}function qwe(e){return Dw(e==null||RSe(e)&&e.Rm!==T),e}function Jwe(e,t,n){return hx(e.a,(AWe(t,n),new cg(t,n))),e}function Ywe(e,t,n){t7e(e.a,n),oLe(n),A$e(e.b,n),M7e(t,n)}function Xwe(e,t){return _z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function Zwe(e,t){return _z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function Qwe(e){KC();var t=B(e.g,9);t.n.a=e.d.c+t.d.b}function AD(e){e.a.a=e.c,e.c.b=e.a,e.a.b=e.c.a=null,e.b=0}function $we(e,t){return e.b=t.b,e.c=t.c,e.d=t.d,e.a=t.a,e}function eTe(e){return SS(e.b<e.d.gc()),e.d.Xb(e.c=e.b++)}function tTe(e){return e.length>0?nj(e):new up}function nTe(e,t){return B(Y(e,(aY(),R2)),16).Ec(t),t}function rTe(e,t){return qW(e,B(Y(t,(nY(),K4)),15),t)}function iTe(e){return GW(e)&&Vm(zS(Z(e,(nY(),P4))))}function jD(e){var t;return t=e.f,t||(e.f=new ag(e,e.c))}function aTe(e,t,n){return Hg(),WBe(B(bE(e.e,t),520),n)}function oTe(e,t,n){e.i=0,e.e=0,t!=n&&rRe(e,t,n)}function sTe(e,t,n){e.i=0,e.e=0,t!=n&&iRe(e,t,n)}function cTe(e,t,n,r){this.b=e,this.c=r,Wy.call(this,t,n)}function lTe(e,t){this.g=e,this.d=q(I(O0,1),QZ,9,0,[t])}function uTe(e,t){e.d&&!e.d.a&&(zae(e.d,t),uTe(e.d,t))}function dTe(e,t){e.e&&!e.e.a&&(zae(e.e,t),dTe(e.e,t))}function fTe(e,t){return KR(e.j,t.s,t.c)+KR(t.e,e.s,e.c)}function pTe(e){return B(e.jd(),149).Og()+`:`+Jz(e.kd())}function mTe(e,t){return-_z(Hw(e)*Vw(e),Hw(t)*Vw(t))}function hTe(e,t){return hR(e),hR(t),yse(B(e,23),B(t,23))}function MD(e,t,n){ZN(e,t,new md(h_e(n)))}function gTe(e){Jm(),r.setTimeout(function(){throw e},0)}function _Te(e){this.b=new up,uL(this.b,this.b),this.a=e}function vTe(e){this.b=new Fi,this.a=e,r.Math.random()}function yTe(e,t){new Sg,this.a=new em,this.b=e,this.c=t}function bTe(e,t,n,r){by.call(this,t,n),this.b=e,this.a=r}function xTe(e,t,n,r,i,a){EM.call(this,e,t,n,r,i,a?-2:-1)}function STe(){yYe(this,new Pu),this.wb=(lE(),Q7),Ph()}function CTe(){CTe=E,Y_t=new Ae,Z_t=new rT,X_t=new je}function ND(){ND=E,H1=new ee,U1=new ne,a_t=new k}function PD(){PD=E,o_t=new ie,s_t=new ie,c_t=new ae}function FD(e){return!e.q&&(e.q=new V(K7,e,11,10)),e.q}function ID(e){return!e.s&&(e.s=new V(B7,e,21,17)),e.s}function LD(e){return!e.a&&(e.a=new V(T7,e,10,11)),e.a}function RD(e,t){if(e==null)throw P(new Fm(t));return e}function wTe(e,t){rse.call(this,new pSe(e)),this.a=e,this.b=t}function TTe(e){this.b=e,this.c=e,e.e=null,e.c=null,this.a=1}function ETe(e){return e&&e.hashCode?e.hashCode():dS(e)}function DTe(e){return new Zpe(e,e.e.Pd().gc()*e.c.Pd().gc())}function zD(e){return new Qpe(e,e.e.Pd().gc()*e.c.Pd().gc())}function OTe(e){return R(e,18)?new Mw(B(e,18)):rbe(e.Jc())}function BD(e){return ND(),R(e,59)?new Hse(e):new Jx(e)}function kTe(e){return gE(e),BWe(new hT(Ix(e.a.Jc(),new f)))}function VD(e,t){return t==null?!!Qw(e.f,null):jxe(e.i,t)}function ATe(e,t){var n=Ipe(e.a,t);return n&&(t.d=null),n}function jTe(e,t,n){return e.f?e.f.cf(t,n):!1}function HD(e,t,n,r){yE(e.c[t.g],n.g,r),yE(e.c[n.g],t.g,r)}function UD(e,t,n,r){yE(e.c[t.g],t.g,n),yE(e.b[t.g],t.g,r)}function MTe(e,t,n){return F(z(n.a))<=e&&F(z(n.b))>=t}function NTe(){this.d=new Sg,this.b=new dp,this.c=new up}function PTe(){this.b=new Vp,this.d=new Sg,this.e=new Xp}function FTe(){this.c=new Eh,this.d=new Eh,this.e=new Eh}function WD(){this.a=new em,this.b=(lF(3,QY),new MM(3))}function ITe(e){this.c=e,this.b=new Bh(B(gE(new Me),50))}function LTe(e){this.c=e,this.b=new Bh(B(gE(new xt),50))}function RTe(e){this.b=e,this.a=new Bh(B(gE(new Qe),50))}function GD(e,t){this.e=e,this.a=v1,this.b=u3e(t),this.c=t}function KD(e){this.c=e.c,this.d=e.d,this.b=e.b,this.a=e.a}function zTe(e,t,n,r,i,a){this.a=e,fF.call(this,t,n,r,i,a)}function BTe(e,t,n,r,i,a){this.a=e,fF.call(this,t,n,r,i,a)}function qD(e,t,n,r,i,a,o){return new GAe(e.e,t,n,r,i,a,o)}function VTe(e,t,n){return n>=0&&yC(e.substr(n,t.length),t)}function HTe(e,t){return R(t,149)&&yC(e.b,B(t,149).Og())}function JD(e,t){return e.a?t.Dh().Jc():B(t.Dh(),72).Gi()}function YD(e,t){var n=e.b.Oc(t);return IAe(n,e.b.gc()),n}function XD(e,t){if(e==null)throw P(new Fm(t));return e}function ZD(e){return e.u||=(BA(e),new Qhe(e,e)),e.u}function QD(){QD=E;var e,t=!pHe();e=new b,vgt=t?new y:e}function $D(e){return B(VI(e,16),29)||e.fi()}function eO(e,t){var n=Fh(e.Pm);return t==null?n:n+`: `+t}function tO(e,t,n){return oM(t,n,e.length),e.substr(t,n-t)}function UTe(e,t){dC.call(this),hPe(this),this.a=e,this.c=t}function WTe(){Ide.call(this,`FIXED_INTEGER_RATIO_BOXES`,2)}function GTe(){return kk(),q(I(iwt,1),$Y,425,0,[nwt,rwt])}function KTe(){return sA(),q(I(Lwt,1),$Y,428,0,[Iwt,Fwt])}function qTe(){return jN(),q(I(_At,1),$Y,426,0,[hAt,gAt])}function JTe(){return Yj(),q(I(VSt,1),$Y,427,0,[zSt,BSt])}function YTe(){return bP(),q(I(uCt,1),$Y,424,0,[cCt,lCt])}function XTe(){return oN(),q(I(TCt,1),$Y,479,0,[wCt,CCt])}function ZTe(){return hO(),q(I(Ajt,1),$Y,512,0,[B3,V3])}function QTe(){return oO(),q(I(Ojt,1),$Y,513,0,[z3,R3])}function $Te(){return _j(),q(I(qjt,1),$Y,519,0,[W3,U3])}function eEe(){return oA(),q(I(_jt,1),$Y,522,0,[L3,I3])}function tEe(){return aO(),q(I(eMt,1),$Y,457,0,[G3,K3])}function nEe(){return nk(),q(I(jNt,1),$Y,430,0,[ANt,kNt])}function rEe(){return FF(),q(I(RNt,1),$Y,490,0,[LNt,p6])}function iEe(){return RM(),q(I(YNt,1),$Y,431,0,[qNt,JNt])}function aEe(){return gj(),q(I(MIt,1),$Y,433,0,[jIt,AIt])}function oEe(){return yA(),q(I(iIt,1),$Y,481,0,[nIt,rIt])}function sEe(){return iL(),q(I(TLt,1),$Y,432,0,[wLt,CLt])}function cEe(){return xP(),q(I(lRt,1),$Y,498,0,[cRt,sRt])}function lEe(){return aA(),q(I(kLt,1),$Y,389,0,[OLt,DLt])}function uEe(){return KN(),q(I(tyt,1),$Y,429,0,[$vt,eyt])}function dEe(){return PF(),q(I(Hbt,1),$Y,506,0,[L0,Vbt])}function nO(e,t,n,r){return n>=0?e.Rh(t,n,r):e.zh(null,n,r)}function rO(e){return e.b.b==0?e.a.uf():$ye(e.b)}function fEe(e){if(e.p!=5)throw P(new Dp);return tT(e.f)}function pEe(e){if(e.p!=5)throw P(new Dp);return tT(e.k)}function iO(e){return L(e.a)===L((lI(),aUt))&&l9e(e),e.a}function mEe(e){!e||eO(e,e.ge())}function hEe(e,t){Fd(this,new Pv(e.a,e.b)),Id(this,aw(t))}function aO(){aO=E,G3=new fde(ZX,0),K3=new fde(QX,1)}function oO(){oO=E,z3=new dde(QX,0),R3=new dde(ZX,1)}function gEe(e,t){e.c=t,e.c>0&&e.b>0&&(e.g=Rw(e.c,e.b,e.a))}function _Ee(e,t){e.b=t,e.c>0&&e.b>0&&(e.g=Rw(e.c,e.b,e.a))}function vEe(e){var t=e.c.d.b;e.b=t,e.a=e.c.d,t.a=e.c.d.b=e}function yEe(e){return e.b==0?null:(SS(e.b!=0),mP(e,e.a.a))}function sO(e,t){return t==null?wy(Qw(e.f,null)):m_(e.i,t)}function bEe(e,t,n,r,i){return new eXe(e,(qM(),O_t),t,n,r,i)}function cO(e,t){return zAe(t),UPe(e,G(q9,pX,30,t,15,1),t)}function lO(e,t){return RD(e,`set1`),RD(t,`set2`),new Tle(e,t)}function xEe(e,t){return pgt[e.charCodeAt(0)]??e}function SEe(e,t){var n=t,r=new fe;return NJ(e,n,r),r.d}function CEe(e,t,n,r){var i=new sC;t.a[n.g]=i,HT(e.b,r,i)}function wEe(e,t){return fC(AS(xPe(e.f,t)),e.f.d)}function uO(e){var t;tFe(e.a),Vb(e.a),t=new hf(e.a),oVe(t)}function TEe(e,t){B4e(e,!0),hP(e.e.Pf(),new M_e(e,!0,t))}function EEe(e){this.a=B(gE(e),279),this.b=(ND(),new Yx(e))}function DEe(e,t,n){this.i=new up,this.b=e,this.g=t,this.a=n}function dO(e,t,n){this.c=new up,this.e=e,this.f=t,this.b=n}function OEe(e,t,n){this.a=new up,this.e=e,this.f=t,this.c=n}function fO(e,t,n){cY(),cp.call(this,e),this.b=t,this.a=n}function pO(e,t,n){tx(),np.call(this,t),this.a=e,this.b=n}function kEe(e){dC.call(this),hPe(this),this.a=e,this.c=!0}function mO(){ise.call(this,new bg(zI(12))),Px(!0),this.a=2}function hO(){hO=E,B3=new mv(Aat,0),V3=new mv(`UP`,1)}function gO(e){return e.Db>>16==3?B(e.Cb,19):null}function _O(e){return e.Db>>16==9?B(e.Cb,19):null}function AEe(e){return e.Db>>16==6?B(e.Cb,74):null}function jEe(e){if(e.ye())return null;var t=e.n;return Hht[t]}function MEe(e){function t(){}return t.prototype=e||{},new t}function NEe(e){var t=new zh(zI(e.length));return GLe(t,e),t}function vO(e,t){var n=e.q.getHours();e.q.setDate(t),Wq(e,n)}function PEe(e,t,n){var r=e.Fh(t);r>=0?e.$h(r,n):W1e(e,t,n)}function yO(e,t,n){BO(),e&&WE(bHt,e,t),e&&WE(M7,e,n)}function FEe(e,t){return CP(),B(Y(t,(Lq(),d6)),15).a==e}function IEe(e,t){return JC(),Rx(),B(t.b,15).a<e}function LEe(e,t){return JC(),Rx(),B(t.a,15).a<e}function REe(e,t){return nLe(e,t)?(eFe(e),!0):!1}function bO(e,t){if(t==null)throw P(new Op);return yHe(e,t)}function zEe(e,t){return e.b+=t.b,e.c+=t.c,e.d+=t.d,e.a+=t.a,e}function xO(e,t){var n;for(gE(t),n=e.a;n;n=n.c)t.Wd(n.g,n.i)}function BEe(e,t){var n=e.Fh(t);return n>=0?e.Th(n):gQe(e,t)}function SO(e,t,n){e.b=new QF(qLe(e,t,n).c.length)}function VEe(e){this.a=e,this.b=G(djt,LY,2022,e.e.length,0,2)}function HEe(){this.a=new Cb,this.e=new Vp,this.g=0,this.i=0}function UEe(e,t){nx(this),this.f=t,this.g=e,kD(this),this.he()}function CO(e,t){return r.Math.abs(e)<r.Math.abs(t)?e:t}function wO(e){return Math.max(Math.min(e,vY),-2147483648)|0}function TO(e){return!e.a&&(e.a=new V(T7,e,10,11)),e.a.i>0}function EO(e){var t=e.d;return t=e._i(e.f),gM(e,t),t.Ob()}function DO(e,t){var n=new jw(t);return IU(n,e),new OC(n)}function WEe(e){if(e.p!=0)throw P(new Dp);return Ay(e.f,0)}function GEe(e){if(e.p!=0)throw P(new Dp);return Ay(e.k,0)}function KEe(e){return e.Db>>16==7?B(e.Cb,244):null}function OO(e){return e.Db>>16==6?B(e.Cb,244):null}function kO(e){return e.Db>>16==7?B(e.Cb,176):null}function AO(e){return e.Db>>16==11?B(e.Cb,19):null}function jO(e){return e.Db>>16==17?B(e.Cb,29):null}function qEe(e){return e.Db>>16==3?B(e.Cb,159):null}function MO(e){var t;return zz(e),t=new Vp,fD(e,new df(t))}function JEe(e,t){var n=e.a=e.a||[];return n[t]||(n[t]=e.te(t))}function YEe(e,t){var n=e.q.getHours();e.q.setMonth(t),Wq(e,n)}function NO(e,t){e.c&&dN(e.c.g,e),e.c=t,e.c&&hx(e.c.g,e)}function PO(e,t){e.d&&dN(e.d.e,e),e.d=t,e.d&&hx(e.d.e,e)}function FO(e,t){e.c&&dN(e.c.a,e),e.c=t,e.c&&hx(e.c.a,e)}function IO(e,t){e.i&&dN(e.i.j,e),e.i=t,e.i&&hx(e.i.j,e)}function LO(e,t,n){return t==null?xW(e.f,null,n):Oz(e.i,t,n)}function RO(e,t,n,r,i,a){return new bN(e.e,t,e.Jj(),n,r,i,a)}function XEe(e){return IRe(),Rx(),B(e.a,84).d.e!=0}function ZEe(){ZEe=E,agt=CR((Tm(),q(I(igt,1),$Y,541,0,[rgt])))}function QEe(){QEe=E,HAt=uT(new RE,(zU(),v0),(sY(),U0))}function $Ee(){$Ee=E,UAt=uT(new RE,(zU(),v0),(sY(),U0))}function eDe(){eDe=E,WAt=uT(new RE,(zU(),v0),(sY(),U0))}function tDe(){tDe=E,GAt=uT(new RE,(zU(),v0),(sY(),U0))}function nDe(){nDe=E,qAt=uT(new RE,(zU(),v0),(sY(),U0))}function rDe(){rDe=E,JAt=uT(new RE,(zU(),v0),(sY(),U0))}function iDe(){iDe=E,yjt=ww(new RE,(zU(),v0),(sY(),z0))}function zO(){zO=E,wjt=ww(new RE,(zU(),v0),(sY(),z0))}function aDe(){aDe=E,Djt=ww(new RE,(zU(),v0),(sY(),z0))}function oDe(){oDe=E,Mjt=ww(new RE,(zU(),v0),(sY(),z0))}function sDe(){sDe=E,NNt=uT(new RE,(fV(),J3),(oq(),cMt))}function BO(){BO=E,bHt=new dp,M7=new dp,ife(d_t,new Qs)}function cDe(e,t,n){this.a=t,this.c=e,this.b=(gE(n),new OC(n))}function lDe(e,t,n){this.a=t,this.c=e,this.b=(gE(n),new OC(n))}function uDe(e,t){this.a=e,this.c=ix(this.a),this.b=new KD(t)}function VO(e,t,n,r){this.c=e,this.d=r,UO(this,t),fDe(this,n)}function HO(e){this.c=new Sg,this.b=e.b,this.d=e.c,this.a=e.a}function dDe(e){this.a=r.Math.cos(e),this.b=r.Math.sin(e)}function UO(e,t){e.a&&dN(e.a.k,e),e.a=t,e.a&&hx(e.a.k,e)}function fDe(e,t){e.b&&dN(e.b.f,e),e.b=t,e.b&&hx(e.b.f,e)}function pDe(e,t){EE(e,e.b,e.c),B(e.b.b,68),t&&B(t.b,68).b}function WO(e,t){EBe(e,t),R(e.Cb,89)&&DW(BA(B(e.Cb,89)),2)}function mDe(e,t){R(e.Cb,89)&&DW(BA(B(e.Cb,89)),4),VF(e,t)}function GO(e,t){R(e.Cb,187)&&(B(e.Cb,187).tb=null),VF(e,t)}function hDe(e,t){var n=B(jR(jD(e.a),t),18);return n?n.gc():0}function gDe(e,t){t.c!=null&&OE(e,new _E(t.c))}function _De(e){var t,n=(Ph(),t=new pp,t);return OP(n,e),n}function vDe(e){var t,n=(Ph(),t=new pp,t);return OP(n,e),n}function yDe(e){for(var t;;)if(t=e.Pb(),!e.Ob())return t}function KO(e,t){return l_(),IN(t)?new Sw(t,e):new xy(t,e)}function bDe(e,t){return _z(B(e.c,65).c.e.b,B(t.c,65).c.e.b)}function xDe(e,t){return _z(B(e.c,65).c.e.a,B(t.c,65).c.e.a)}function SDe(e,t,n){return new eXe(e,(qM(),k_t),t,n,null,!1)}function CDe(e,t,n){return new eXe(e,(qM(),D_t),null,!1,t,n)}function qO(e){return rq(),NR(e,0)>=0?bB(e):qT(bB(lN(e)))}function wDe(){return nR(),q(I(q1,1),$Y,132,0,[B_t,K1,V_t])}function TDe(){return vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])}function EDe(){return KM(),q(I(avt,1),$Y,464,0,[e0,$1,t0])}function DDe(){return kN(),q(I(cvt,1),$Y,465,0,[i0,r0,n0])}function ODe(e,t){Upe(e,tT(ok(yT(t,24),zX)),tT(ok(t,zX)))}function JO(e,t){if(e<0||e>t)throw P(new jm(iat+e+aat+t))}function YO(e,t){if(e<0||e>=t)throw P(new jm(iat+e+aat+t))}function XO(e,t){if(e<0||e>=t)throw P(new $m(iat+e+aat+t))}function ZO(e,t){this.b=(NE(e),e),this.a=(t&EX)==0?t|64|RY:t}function QO(e,t,n){qze(t,n,e.gc()),this.c=e,this.a=t,this.b=n-t}function kDe(e,t,n){var r;qze(t,n,e.c.length),r=n-t,Yh(e.c,t,r)}function ADe(e,t,n){var r=new wb(n.d);fC(r,e),kz(t,r.a,r.b)}function jDe(e){var t;return zz(e),t=(PD(),PD(),s_t),sP(e,t)}function $O(e){return Hg(),R(e.g,9)?B(e.g,9):null}function ek(e){return PL(q(I(e8,1),LY,8,0,[e.i.n,e.n,e.a]))}function MDe(){return ON(),q(I(Zyt,1),$Y,385,0,[Yyt,Jyt,Xyt])}function NDe(){return xL(),q(I(QCt,1),$Y,330,0,[x2,ZCt,b2])}function PDe(){return AN(),q(I(ewt,1),$Y,316,0,[C2,w2,S2])}function FDe(){return tL(),q(I(YCt,1),$Y,303,0,[qCt,JCt,y2])}function IDe(){return nF(),q(I(XSt,1),$Y,351,0,[qSt,YSt,JSt])}function LDe(){return SL(),q(I(pCt,1),$Y,452,0,[fCt,l2,u2])}function RDe(){return rF(),q(I(yAt,1),$Y,455,0,[k3,D3,O3])}function zDe(){return eL(),q(I(wAt,1),$Y,382,0,[xAt,SAt,CAt])}function BDe(){return tR(),q(I(OAt,1),$Y,349,0,[DAt,EAt,A3])}function VDe(){return xR(),q(I(MAt,1),$Y,350,0,[AAt,jAt,j3])}function HDe(){return bR(),q(I(Kkt,1),$Y,353,0,[Ukt,Wkt,Gkt])}function UDe(){return tF(),q(I(LAt,1),$Y,352,0,[IAt,PAt,FAt])}function WDe(){return rL(),q(I(BAt,1),$Y,383,0,[zAt,N3,M3])}function GDe(){return BL(),q(I(SMt,1),$Y,386,0,[xMt,bMt,X3])}function KDe(){return eR(),q(I(ePt,1),$Y,387,0,[ZNt,QNt,$Nt])}function qDe(){return tB(),q(I(pFt,1),$Y,388,0,[dFt,fFt,uFt])}function JDe(){return IF(),q(I(ESt,1),$Y,369,0,[Z0,X0,Y0])}function YDe(){return BR(),q(I(mIt,1),$Y,435,0,[dIt,pIt,fIt])}function XDe(){return sN(),q(I(lIt,1),$Y,434,0,[oIt,cIt,sIt])}function ZDe(){return lz(),q(I(SIt,1),$Y,440,0,[yIt,bIt,xIt])}function QDe(){return CB(),q(I(XPt,1),$Y,441,0,[h6,JPt,YPt])}function $De(){return OI(),q(I(KPt,1),$Y,304,0,[WPt,GPt,UPt])}function eOe(){return MP(),q(I(fVt,1),$Y,301,0,[$5,uVt,dVt])}function tOe(){return yP(),q(I(TBt,1),$Y,281,0,[K8,q8,J8])}function nOe(){return zR(),q(I(wVt,1),$Y,283,0,[SVt,l7,CVt])}function rOe(){return rR(),q(I(GBt,1),$Y,348,0,[WBt,$8,e5])}function tk(e){cY(),cp.call(this,e),this.c=!1,this.a=!1}function iOe(e,t,n){cp.call(this,25),this.b=e,this.a=t,this.c=n}function aOe(e,t){nse.call(this,new bg(zI(e))),lF(t,Krt),this.a=t}function oOe(e,t){var n=(NE(e),e).g;return xS(!!n),NE(t),n(t)}function sOe(e,t){var n,r=zT(e,t);return n=e.a.dd(r),new Sle(e,n)}function cOe(e,t,n){var r=nJ(e,t,!1);return r.b<=t&&r.a<=n}function lOe(e,t,n){var r=new oa;r.b=t,r.a=n,++t.b,hx(e.d,r)}function nk(){nk=E,ANt=new yde(`DFS`,0),kNt=new yde(`BFS`,1)}function uOe(e){if(e.p!=2)throw P(new Dp);return tT(e.f)&uX}function dOe(e){if(e.p!=2)throw P(new Dp);return tT(e.k)&uX}function fOe(e){return e.Db>>16==6?B(fG(e),244):null}function W(e){return SS(e.a<e.c.c.length),e.b=e.a++,e.c.c[e.b]}function pOe(e){return e.a==(mj(),EUt)&&jne(e,M4e(e.g,e.b)),e.a}function rk(e){return e.d==(mj(),EUt)&&Nne(e,Q8e(e.g,e.b)),e.d}function mOe(e){kw(),this.a=(ND(),R(e,59)?new Hse(e):new Jx(e))}function ik(e){return gE(e),R(e,18)?new OC(B(e,18)):ow(e.Jc())}function ak(e,t){return Axe(e.a,t)?nxe(e.b,B(t,23).g,null):null}function ok(e,t){return RI(cSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function sk(e,t){return RI(lSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function ck(e,t){return RI(uSe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function lk(e){return jz(vT(BI(YG(e,32)),32),BI(YG(e,32)))}function hOe(e){var t=B(_w(e.b),10);return new AC(e.a,t,e.c)}function gOe(e,t){snt(e,t,F(z(e.a.mf((oY(),rBt)))))}function _Oe(e,t){return GN(),e.c==t.c?_z(t.d,e.d):_z(e.c,t.c)}function vOe(e,t){return GN(),e.c==t.c?_z(e.d,t.d):_z(e.c,t.c)}function yOe(e,t){return GN(),e.c==t.c?_z(e.d,t.d):_z(t.c,e.c)}function bOe(e,t){return GN(),e.c==t.c?_z(t.d,e.d):_z(t.c,e.c)}function uk(e,t){e.b|=t.b,e.c|=t.c,e.d|=t.d,e.a|=t.a}function xOe(e,t,n){var r=e.d[t.p];e.d[t.p]=e.d[n.p],e.d[n.p]=r}function SOe(e,t){var n=_N(t);return B(bE(e.c,n),15).a}function COe(e,t){var n=lGe(e),r=lGe(t);return n<r?-1:n>r?1:0}function wOe(e,t){var n=B(bE(e.g,t),60);hP(t.d,new Fue(e,n))}function dk(e,t){for(var n=e+``;n.length<t;)n=`0`+n;return n}function fk(e){return e.c==null||e.c.length==0?`n_`+e.g:`n_`+e.c}function pk(e){return e.b==null||e.b.length==0?`n_`+e.a:`n_`+e.b}function mk(e){return B(JB(e,G(O0,QZ,9,e.c.length,0,1)),201)}function hk(e,t){return e&&e.equals?e.equals(t):L(e)===L(t)}function TOe(e,t){return t==0?!!e.o&&e.o.f!=0:rV(e,t)}function EOe(e){return!!e.u&&$k(e.u.a).i!=0&&!(e.n&&yWe(e.n))}function DOe(e,t,n){var r;e.n&&t&&n&&(r=new zs,hx(e.e,r))}function gk(e,t){if(BT(e.a,t),t.d)throw P(new vm(cat));t.d=e}function _k(e,t){this.a=new up,this.d=new up,this.f=e,this.c=t}function OOe(){this.c=new ppe,this.a=new Yje,this.b=new xoe,Zle()}function kOe(){CL(),this.b=new dp,this.a=new dp,this.c=new up}function AOe(e,t,n){this.d=e,this.j=t,this.e=n,this.o=-1,this.p=3}function jOe(e,t,n){this.d=e,this.k=t,this.f=n,this.o=-1,this.p=5}function MOe(e,t,n,r,i,a){PPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function NOe(e,t,n,r,i,a){FPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function POe(e,t,n,r,i,a){qA.call(this,e,t,n,r,i),a&&(this.o=-2)}function FOe(e,t,n,r,i,a){RPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function IOe(e,t,n,r,i,a){Nje.call(this,e,t,n,r,i),a&&(this.o=-2)}function LOe(e,t,n,r,i,a){IPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function ROe(e,t,n,r,i,a){LPe.call(this,e,t,n,r,i),a&&(this.o=-2)}function zOe(e,t,n,r,i,a){Pje.call(this,e,t,n,r,i),a&&(this.o=-2)}function BOe(e,t,n,r){np.call(this,n),this.b=e,this.c=t,this.d=r}function VOe(e,t){this.f=e,this.a=(mj(),TUt),this.c=TUt,this.b=t}function HOe(e,t){this.g=e,this.d=(mj(),EUt),this.a=EUt,this.b=t}function UOe(e,t){!e.c&&(e.c=new MI(e,0)),hJ(e.c,(OJ(),D9),t)}function WOe(e,t){return f1e(e,t,R(t,104)&&(B(t,20).Bb&OX)!=0)}function GOe(e,t){return nCe(BI(e.q.getTime()),BI(t.q.getTime()))}function KOe(e){return Cw(e.e.Pd().gc()*e.c.Pd().gc(),16,new qu(e))}function qOe(e){return!!e.a&&EN(e.a.a).i!=0&&!(e.b&&bWe(e.b))}function vk(e){for(;e.d>0&&e.a[--e.d]==0;);e.a[e.d++]==0&&(e.e=0)}function JOe(e){return e.a?e.e.length==0?e.a.a:e.a.a+(``+e.e):e.c}function YOe(e){return SS(e.b.b!=e.d.a),e.c=e.b=e.b.b,--e.a,e.c.c}function XOe(e,t){var n=1-t;return e.a[n]=kF(e.a[n],n),kF(e,t)}function ZOe(e,t){var n,r=ok(e,jX);return n=vT(t,32),sk(n,r)}function QOe(e,t,n){var r=B(e.Zb().xc(t),18);return!!r&&r.Gc(n)}function $Oe(e,t,n){var r=B(e.Zb().xc(t),18);return!!r&&r.Kc(n)}function eke(e,t,n){MGe(new cDe((gE(e),new OC(e)),t,n))}function yk(e,t,n){NGe(new lDe((gE(e),new OC(e)),t,n))}function tke(){tke=E,tjt=lwe(UR(1),UR(4)),ejt=lwe(UR(1),UR(2))}function nke(e){ZF.call(this,e,(qM(),E_t),null,!1,null,!1)}function rke(e,t){NT.call(this,1,2,q(I(q9,1),pX,30,15,[e,t]))}function bk(e,t){this.a=e,tf.call(this,e),JO(t,e.gc()),this.b=t}function ike(e,t){var n;e.e=new cm,n=IK(t),Qb(n,e.c),u4e(e,n,0)}function ake(e,t,n){e.a=t,e.c=n,e.b.a.$b(),AD(e.d),Lp(e.e.a.c,0)}function xk(e,t,n,r){var i=new os;i.a=t,i.b=n,i.c=r,gw(e.a,i)}function Sk(e,t,n,r){var i=new os;i.a=t,i.b=n,i.c=r,gw(e.b,i)}function oke(e,t,n,r){return e.a+=``+tO(t==null?wY:Jz(t),n,r),e}function Ck(e,t,n,r,i,a){return cIe(e,t,n,a),Jze(e,r),Yze(e,i),e}function ske(){var e,t=(n=(e=new pp,e),n),n;return hx(yUt,t),t}function wk(e,t){if(e<0||e>=t)throw P(new jm(TZe(e,t)));return e}function cke(e,t,n){if(e<0||t<e||t>n)throw P(new jm(_Xe(e,t,n)))}function lke(e){if(!(`stack`in e))try{throw e}catch{}return e}function uke(e){return lD(e).dc()?!1:(Zb(e,new g),!0)}function Tk(e){var t;return cb(e)?(t=e,t==-0?0:t):bNe(e)}function dke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function fke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function pke(e,t){return R(t,45)?YWe(e.a,B(t,45)):!1}function mke(e,t){return SP(),B(Y(t,(Lq(),u6)),15).a>=e.gc()}function hke(e){return zO(),!NA(e)&&!(!NA(e)&&e.c.i.c==e.d.i.c)}function Ek(e){return B(JB(e,G(D0,ZZ,17,e.c.length,0,1)),324)}function Dk(e){return new MM((lF(e,eit),XN(jz(jz(5,e),e/10|0))))}function gke(e,t){return new Oye(t,ihe(ix(t.e),e,e),(Rx(),!0))}function _ke(e){return Cw(e.e.Pd().gc()*e.c.Pd().gc(),273,new Ku(e))}function vke(e){return B(JB(e,G(Rbt,oot,12,e.c.length,0,1)),2021)}function yke(e){this.a=G(v1,CY,1,BLe(r.Math.max(8,e))<<1,5,1)}function bke(e){var t;return IE(e),t=new oe,Jh(e.a,new are(t)),t}function Ok(e){var t;return IE(e),t=new se,Jh(e.a,new ore(t)),t}function xke(e,t){return e.a<=e.b?(t.Bd(e.a++),!0):!1}function Ske(e,t,n){e.d&&dN(e.d.e,e),e.d=t,e.d&&qw(e.d.e,n,e)}function Cke(e,t,n){this.d=new sie(this),this.e=e,this.i=t,this.f=n}function kk(){kk=E,nwt=new Kue(XX,0),rwt=new Kue(`TOP_LEFT`,1)}function wke(){wke=E,EIt=CR((Wg(),q(I(TIt,1),$Y,480,0,[wIt])))}function Tke(){Tke=E,kIt=CR((Gg(),q(I(OIt,1),$Y,550,0,[DIt])))}function Eke(){Eke=E,SLt=CR((Kg(),q(I(xLt,1),$Y,531,0,[A6])))}function Dke(){Dke=E,eRt=CR((qg(),q(I($Lt,1),$Y,557,0,[QLt])))}function Oke(){Oke=E,rRt=CR((Jg(),q(I(nRt,1),$Y,558,0,[tRt])))}function kke(){kke=E,oRt=CR((Yg(),q(I(aRt,1),$Y,559,0,[iRt])))}function Ake(e){aVe((!e.a&&(e.a=new V(T7,e,10,11)),e.a),new Mo)}function Ak(e,t){Ant(t,e),fbe(e.d),fbe(B(Y(e,(nY(),zOt)),216))}function jke(e,t){jnt(t,e),dbe(e.d),dbe(B(Y(e,(nY(),zOt)),216))}function jk(e,t){var n=bO(e,t),r=null;return n&&(r=n.ne()),r}function Mk(e,t){var n=bO(e,t),r=null;return n&&(r=n.qe()),r}function Nk(e,t){var n=HN(e,t),r=null;return n&&(r=n.qe()),r}function Pk(e,t){var n=bO(e,t),r=null;return n&&(r=wXe(n)),r}function Mke(e,t,n){var r=NB(n);return iq(e.n,r,t),iq(e.o,t,n),t}function Nke(e,t,n){var r=YHe();try{return age(e,t,n)}finally{AA(r)}}function Pke(e,t,n,r){return R(n,59)?new Ime(e,t,n,r):new iSe(e,t,n,r)}function Fke(e,t,n,r){this.d=e,this.n=t,this.g=n,this.o=r,this.p=-1}function Ike(e,t,n,r){this.e=null,this.c=e,this.d=t,this.a=n,this.b=r}function Lke(e){var t=e.Dh();this.a=R(t,72)?B(t,72).Gi():t.Jc()}function Rke(e){return new ZO(yPe(B(e.a.kd(),18).gc(),e.a.jd()),16)}function Fk(e){return R(e,18)?B(e,18).dc():!e.Jc().Ob()}function Ik(e){if(e.e.g!=e.b)throw P(new Ap);return!!e.c&&e.d>0}function Lk(e){return SS(e.b!=e.d.c),e.c=e.b,e.b=e.b.a,++e.a,e.c.c}function zke(e,t){NE(t),yE(e.a,e.c,t),e.c=e.c+1&e.a.length-1,xGe(e)}function Rk(e,t){NE(t),e.b=e.b-1&e.a.length-1,yE(e.a,e.b,t),xGe(e)}function Bke(e,t){var n=B(RN(e.b,t),66);return!n&&(n=new Sg),n}function Vke(e,t){var n=t.a;NO(n,t.c.d),PO(n,t.d.d),wI(n.a,e.n)}function Hke(e,t){return B(Ux(xT(B($A(e.k,t),16).Mc(),Q0)),114)}function Uke(e,t){return B(Ux(ST(B($A(e.k,t),16).Mc(),Q0)),114)}function Wke(){return bL(),q(I(fbt,1),$Y,413,0,[b0,C0,x0,S0])}function Gke(){return $I(),q(I(Rvt,1),$Y,414,0,[o0,a0,Ivt,Lvt])}function Kke(){return qM(),q(I(A_t,1),$Y,310,0,[E_t,D_t,O_t,k_t])}function qke(){return HB(),q(I(Cbt,1),$Y,384,0,[T0,xbt,bbt,Sbt])}function Jke(){return yL(),q(I($xt,1),$Y,368,0,[Qxt,Xxt,Zxt,W0])}function Yke(){return nL(),q(I(mSt,1),$Y,418,0,[G0,K0,q0,pSt])}function Xke(){return yR(),q(I(ljt,1),$Y,409,0,[P3,F3,cjt,sjt])}function Zke(){return yV(),q(I(Ykt,1),$Y,205,0,[y3,Jkt,v3,_3])}function Qke(){return MB(),q(I(pAt,1),$Y,270,0,[E3,uAt,dAt,fAt])}function $ke(){return eB(),q(I(GSt,1),$Y,302,0,[s2,USt,o2,WSt])}function eAe(){return $L(),q(I(DNt,1),$Y,354,0,[ENt,wNt,TNt,CNt])}function tAe(){return RV(),q(I(VPt,1),$Y,355,0,[BPt,RPt,zPt,LPt])}function nAe(){return MU(),q(I(nFt,1),$Y,406,0,[tFt,QPt,eFt,$Pt])}function rAe(){return fV(),q(I(rMt,1),$Y,402,0,[nMt,q3,J3,Y3])}function iAe(){return AH(),q(I(LLt,1),$Y,396,0,[NLt,PLt,FLt,ILt])}function aAe(){return RR(),q(I(CBt,1),$Y,280,0,[G8,bBt,xBt,SBt])}function oAe(){return rB(),q(I(OBt,1),$Y,225,0,[DBt,X8,Y8,Z8])}function sAe(){return pH(),q(I(JBt,1),$Y,293,0,[i5,t5,n5,r5])}function cAe(){return jB(),q(I(i7,1),$Y,381,0,[n7,r7,t7,e7])}function lAe(){return cA(),q(I(u7,1),$Y,290,0,[EVt,kVt,DVt,OVt])}function uAe(){return nB(),q(I(FVt,1),$Y,327,0,[PVt,jVt,NVt,MVt])}function dAe(){return QL(),q(I(HVt,1),$Y,412,0,[zVt,BVt,RVt,VVt])}function fAe(e){var t;return e.j==(GJ(),Y5)&&(t=lG(e),Vx(t,j5))}function pAe(e,t){var n;for(n=e.j.c.length;n<t;n++)hx(e.j,e.Mg())}function mAe(e,t,n,r){var i=r[t.g][n.g];return F(z(Y(e.a,i)))}function hAe(e,t,n){var r=NB(n);return iq(e.f,r,t),WE(e.g,t,n),t}function gAe(e,t,n){var r=NB(n);return iq(e.p,r,t),WE(e.q,t,n),t}function _Ae(e){var t=(Mh(),n=new Ws,n),n;return e&&rK(t,e),t}function vAe(e){var t=e.$i(e.i);return e.i>0&&Fq(e.g,0,t,0,e.i),t}function zk(e){return Hg(),R(e.g,157)?B(e.g,157):null}function yAe(e){return BO(),IT(bHt,e)?B(bE(bHt,e),343).Pg():null}function Bk(e,t,n){return t<0?gQe(e,n):B(n,69).uk().zk(e,e.ei(),t)}function bAe(e,t){return Sx(new Pv(t.e.a+t.f.a/2,t.e.b+t.f.b/2),e)}function xAe(e,t){return L(t)===L(e)?`(this Map)`:t==null?wY:Jz(t)}function SAe(e,t){a_();var n=B(bE(EHt,e),58);return!n||n.dk(t)}function Vk(e){if(e.p!=1)throw P(new Dp);return tT(e.f)<<24>>24}function CAe(e){if(e.p!=1)throw P(new Dp);return tT(e.k)<<24>>24}function wAe(e){if(e.p!=7)throw P(new Dp);return tT(e.k)<<16>>16}function TAe(e){if(e.p!=7)throw P(new Dp);return tT(e.f)<<16>>16}function Hk(e,t){return t.e==0||e.e==0?R1:(BK(),gK(e,t))}function EAe(e,t,n){if(n){var r=n.me();e.a[t]=r(n)}else delete e.a[t]}function DAe(e,t){var n=new Qm;return e.Ed(n),n.a+=`..`,t.Fd(n),n.a}function Uk(e){for(var t=0;e.Ob();)e.Pb(),t=jz(t,1);return XN(t)}function OAe(e,t,n){var r=B(bE(e.g,n),60);hx(e.a.c,new ny(t,r))}function kAe(e,t,n,r,i){hx(t,wW(i,O1e(i,n,r))),dYe(e,i,t)}function Wk(e,t,n){e.i=0,e.e=0,t!=n&&(iRe(e,t,n),rRe(e,t,n))}function AAe(e){e.a=null,e.e=null,Lp(e.b.c,0),Lp(e.f.c,0),e.c=null}function jAe(e,t){return B(t==null?wy(Qw(e.f,null)):m_(e.i,t),291)}function MAe(e,t,n){return oSe(z(wy(Qw(e.f,t))),z(wy(Qw(e.f,n))))}function Gk(e,t,n){return Bq(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function Kk(e,t,n){return Kq(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function qk(e,t,n){return b1e(e,t,n,R(t,104)&&(B(t,20).Bb&OX)!=0)}function NAe(e,t){return e==(UG(),P0)&&t==P0?4:e==P0||t==P0?8:32}function PAe(e,t){FTe.call(this),this.a=e,this.b=t,hx(this.a.b,this)}function Jk(e,t){cY(),cp.call(this,e),this.a=t,this.c=-1,this.b=-1}function Yk(e,t,n,r,i){this.i=e,this.a=t,this.e=n,this.j=r,this.f=i}function Xk(e,t){rq(),NT.call(this,e,1,q(I(q9,1),pX,30,15,[t]))}function Zk(e,t){l_();var n=B(e,69).tk();return RYe(n,t),n.vl(t)}function FAe(e,t){for(var n=t;n;)MS(e,n.i,n.j),n=AO(n);return e}function IAe(e,t){var n;for(n=0;n<t;++n)yE(e,n,new qne(B(e[n],45)))}function LAe(e,t){var n=e.q.getHours();e.q.setFullYear(t+fX),Wq(e,n)}function RAe(e,t){zL();var n=e.j.g-t.j.g;return n==0?0:n}function Qk(e){return SS(e.a<e.c.a.length),e.b=e.a,jNe(e),e.c.b[e.b]}function $k(e){return e.n||(BA(e),e.n=new Wxe(e,G7,e),ZD(e)),e.n}function zAe(e){if(e<0)throw P(new Ese(`Negative array size: `+e))}function BAe(e,t,n){n=n?n.me()(n):void 0,e.a[t]=n}function VAe(e,t){var n;return n=t==null?wy(Qw(e.f,t)):sO(e,t),zy(n)}function HAe(e,t){var n;return n=t==null?wy(Qw(e.f,t)):sO(e,t),zy(n)}function UAe(e){return e.c&&e.d?pk(e.c)+`->`+pk(e.d):`e_`+dS(e)}function eA(e){R(e,209)&&!Vm(zS(e.mf((oY(),Ozt))))&&G8e(B(e,19))}function WAe(e){e.b!=e.c&&(e.a=G(v1,CY,1,8,5,1),e.b=0,e.c=0)}function tA(e,t,n){this.e=e,this.a=v1,this.b=u3e(t),this.c=t,this.d=n}function nA(e,t,n,r){AOe.call(this,1,n,r),this.c=e,this.b=t}function rA(e,t,n,r){jOe.call(this,1,n,r),this.c=e,this.b=t}function GAe(e,t,n,r,i,a,o){fF.call(this,t,r,i,a,o),this.c=e,this.a=n}function KAe(e){this.e=e,this.c=this.e.a,this.b=this.e.g,this.d=this.e.i}function iA(e){this.c=e,this.a=B(EH(e),160),this.b=this.a.hk().ti()}function qAe(e,t){return Cg(),gM(ID(e.a),t)}function JAe(e,t){return Cg(),gM(ID(e.a),t)}function aA(){aA=E,OLt=new Mde(`STRAIGHT`,0),DLt=new Mde(`BEND`,1)}function oA(){oA=E,L3=new gv(`UPPER`,0),I3=new gv(`LOWER`,1)}function sA(){sA=E,Iwt=new iv(KZ,0),Fwt=new iv(`ALTERNATING`,1)}function cA(){cA=E,EVt=new $be,kVt=new OSe,DVt=new WTe,OVt=new kSe}function lA(e){var t;return e?new jw(e):(t=new Cb,WF(t,e),t)}function YAe(e,t){var n;for(n=e.d-1;n>=0&&e.a[n]===t[n];n--);return n<0}function XAe(e,t){var n;return zAe(t),n=e.slice(0,t),n.length=t,gN(n,e)}function uA(e,t){var n;return t.b.Kb(hN(e,t.c.Ve(),(n=new cre(t),n)))}function dA(e){pJe(),Upe(this,tT(ok(yT(e,24),zX)),tT(ok(e,zX)))}function ZAe(){ZAe=E,nyt=CR((KN(),q(I(tyt,1),$Y,429,0,[$vt,eyt])))}function fA(){fA=E,Ubt=CR((PF(),q(I(Hbt,1),$Y,506,0,[L0,Vbt])))}function pA(){pA=E,dCt=CR((bP(),q(I(uCt,1),$Y,424,0,[cCt,lCt])))}function mA(){mA=E,HSt=CR((Yj(),q(I(VSt,1),$Y,427,0,[zSt,BSt])))}function hA(){hA=E,ECt=CR((oN(),q(I(TCt,1),$Y,479,0,[wCt,CCt])))}function QAe(){QAe=E,awt=CR((kk(),q(I(iwt,1),$Y,425,0,[nwt,rwt])))}function gA(){gA=E,Rwt=CR((sA(),q(I(Lwt,1),$Y,428,0,[Iwt,Fwt])))}function _A(){_A=E,vAt=CR((jN(),q(I(_At,1),$Y,426,0,[hAt,gAt])))}function $Ae(){$Ae=E,vjt=CR((oA(),q(I(_jt,1),$Y,522,0,[L3,I3])))}function eje(){eje=E,kjt=CR((oO(),q(I(Ojt,1),$Y,513,0,[z3,R3])))}function tje(){tje=E,jjt=CR((hO(),q(I(Ajt,1),$Y,512,0,[B3,V3])))}function nje(){nje=E,Jjt=CR((_j(),q(I(qjt,1),$Y,519,0,[W3,U3])))}function vA(){vA=E,tMt=CR((aO(),q(I(eMt,1),$Y,457,0,[G3,K3])))}function rje(){rje=E,MNt=CR((nk(),q(I(jNt,1),$Y,430,0,[ANt,kNt])))}function ije(){ije=E,zNt=CR((FF(),q(I(RNt,1),$Y,490,0,[LNt,p6])))}function aje(){aje=E,XNt=CR((RM(),q(I(YNt,1),$Y,431,0,[qNt,JNt])))}function yA(){yA=E,nIt=new Dde(Dot,0),rIt=new Dde(`TARGET_WIDTH`,1)}function oje(){oje=E,aIt=CR((yA(),q(I(iIt,1),$Y,481,0,[nIt,rIt])))}function sje(){sje=E,NIt=CR((gj(),q(I(MIt,1),$Y,433,0,[jIt,AIt])))}function cje(){cje=E,ELt=CR((iL(),q(I(TLt,1),$Y,432,0,[wLt,CLt])))}function lje(){lje=E,ALt=CR((aA(),q(I(kLt,1),$Y,389,0,[OLt,DLt])))}function uje(){uje=E,uRt=CR((xP(),q(I(lRt,1),$Y,498,0,[cRt,sRt])))}function dje(){return cz(),q(I(W8,1),$Y,87,0,[H8,V8,B8,z8,U8])}function fje(){return GJ(),q(I(Q5,1),qZ,64,0,[X5,M5,j5,Y5,Z5])}function pje(e){return(e.k==(UG(),P0)||e.k==A0)&&TS(e,(aY(),k2))}function mje(e,t,n){return B(t==null?xW(e.f,null,n):Oz(e.i,t,n),291)}function hje(e,t,n){e.a.c.length=0,m9e(e,t,n),e.a.c.length==0||M6e(e,t)}function bA(e,t,n,r){var i=new ce;i.c=t,i.b=n,i.a=r,r.b=n.a=i,++e.b}function xA(e,t){for(var n=t,r=0;n>0;)r+=e.a[n],n-=n&-n;return r}function SA(e,t){for(var n=t;n;)MS(e,-n.i,-n.j),n=AO(n);return e}function gje(e,t){var n,r=!1;do n=ALe(e,t),r|=n;while(n);return r}function CA(e,t){var n,r;for(NE(t),r=e.Jc();r.Ob();)n=r.Pb(),t.Ad(n)}function _je(e,t){var n=t.jd(),r=e.De(n);return!!r&&XE(r.e,t.kd())}function wA(e,t){var n=t.jd();return new cg(n,e.e.pc(n,B(t.kd(),18)))}function vje(e,t){return e.a.get(t)??G(v1,CY,1,0,5,1)}function TA(e,t,n){var r=(YO(t,e.c.length),e.c[t]);return e.c[t]=n,r}function yje(e,t){this.c=0,this.b=t,Uy.call(this,e,17493),this.a=this.c}function EA(e){this.d=e,this.b=this.d.a.entries(),this.a=this.b.next()}function DA(){dp.call(this),bS(this),this.d.b=this.d,this.d.a=this.d}function bje(e){MA(),!G1&&(this.c=e,this.e=!0,this.a=new up)}function xje(e){mrt(),qae(this),this.a=new Sg,bRe(this,e),gw(this.a,e)}function OA(){zb(this),this.b=new Pv(wX,wX),this.a=new Pv(TX,TX)}function kA(e){pue.call(this,e==null?wY:Jz(e),R(e,81)?B(e,81):null)}function AA(e){e&&LNe((Sse(),_gt)),--mgt,e&&ggt!=-1&&(lfe(ggt),ggt=-1)}function jA(e){e.i=0,b_(e.b,null),b_(e.c,null),e.a=null,e.e=null,++e.g}function MA(){MA=E,G1=!0,I_t=!1,L_t=!1,z_t=!1,R_t=!1}function NA(e){return!e.c||!e.d?!1:!!e.c.i&&e.c.i==e.d.i}function PA(e,t){return R(t,144)?yC(e.c,B(t,144).c):!1}function FA(e,t){return B(RN(e.d,t),21)||B(RN(e.e,t),21)}function IA(e,t){return(zz(e),qh(new Nw(e,new AM(t,e.a)))).zd(J1)}function Sje(){return zU(),q(I(nbt,1),$Y,364,0,[m0,h0,g0,_0,v0])}function Cje(){return vU(),q(I(GNt,1),$Y,365,0,[UNt,BNt,WNt,VNt,HNt])}function wje(){return lU(),q(I(bSt,1),$Y,372,0,[J0,vSt,ySt,_St,gSt])}function LA(){return aK(),q(I(_It,1),$Y,370,0,[E6,T6,O6,D6,k6])}function Tje(){return eW(),q(I(zIt,1),$Y,331,0,[PIt,FIt,RIt,IIt,LIt])}function RA(){return dV(),q(I(eAt,1),$Y,329,0,[$kt,Zkt,Qkt,b3,x3])}function Eje(){return $z(),q(I(Nwt,1),$Y,166,0,[p4,l4,u4,d4,f4])}function Dje(){return eV(),q(I(G6,1),$Y,161,0,[U6,H6,B6,W6,V6])}function zA(){return nV(),q(I(v5,1),$Y,260,0,[g5,_5,ZBt,h5,QBt])}function Oje(e){return Jm(),function(){return Nke(e,this,arguments)}}function BA(e){return e.t||(e.t=new ep(e),sz(new Dm(e),0,e.t)),e.t}function kje(e){var t;return e.c||(t=e.r,R(t,89)&&(e.c=B(t,29))),e.c}function Aje(e){return e.e=3,e.d=e.Yb(),e.e==2?!1:(e.e=0,!0)}function jje(e){return Xb(e&hX,e>>22&hX,e<0?gX:0)}function VA(e){var t=e.length;return yC(DX.substr(DX.length-t,t),e)}function HA(e){if(hG(e))return e.c=e.a,e.a.Pb();throw P(new jp)}function UA(e,t){return t==0||e.e==0?e:t>0?nHe(e,t):jK(e,-t)}function WA(e,t){return t==0||e.e==0?e:t>0?jK(e,t):nHe(e,-t)}function GA(e){this.b=e,jx.call(this,e),this.a=B(VI(this.b.a,4),131)}function Mje(e){this.b=e,rS.call(this,e),this.a=B(VI(this.b.a,4),131)}function KA(e,t,n,r,i){cj.call(this,t,r,i),this.c=e,this.b=n}function qA(e,t,n,r,i){AOe.call(this,t,r,i),this.c=e,this.a=n}function Nje(e,t,n,r,i){jOe.call(this,t,r,i),this.c=e,this.a=n}function Pje(e,t,n,r,i){cj.call(this,t,r,i),this.c=e,this.a=n}function JA(e,t,n){return _z(Sx($B(e),ix(t.b)),Sx($B(e),ix(n.b)))}function Fje(e,t,n){return _z(Sx($B(e),ix(t.e)),Sx($B(e),ix(n.e)))}function Ije(e,t){return r.Math.min(yM(t.a,e.d.d.c),yM(t.b,e.d.d.c))}function YA(e,t,n){var r;return r=e.Fh(t),r>=0?e.Ih(r,n,!0):XW(e,t,n)}function Lje(e,t){var n=B(MR(e.c,t),18),r;n&&(r=n.gc(),n.$b(),e.d-=r)}function Rje(e){var t=e.c.i,n=e.d.i;return t.k==(UG(),A0)&&n.k==A0}function XA(e){var t,n;++e.j,t=e.g,n=e.i,e.g=null,e.i=0,e.Mi(n,t),e.Li()}function ZA(e,t){e.Zi(e.i+1),wx(e,e.i,e.Xi(e.i,t)),e.Ki(e.i++,t),e.Li()}function zje(e,t,n){var r=new Ape(e.a);gI(r,e.a.a),xW(r.f,t,n),e.a.a=r}function QA(e,t,n,r){var i;for(i=0;i<ivt;i++)cT(e.a[i][t.g],n,r[t.g])}function Bje(e,t,n,r){var i;for(i=0;i<rvt;i++)lT(e.a[t.g][i],n,r[t.g])}function $A(e,t){var n=B(e.c.xc(t),18);return!n&&(n=e.ic(t)),e.pc(t,n)}function ej(e){var t=(gE(e),e?new OC(e):ow(e.Jc()));return yW(t),Pz(t)}function tj(e){var t=new WD;return JI(t,e),J(t,(nY(),F4),null),t}function nj(e){var t,n;return gE(e),t=dwe(e.length),n=new MM(t),GLe(n,e),n}function rj(e,t,n,r){var i=G(q9,pX,30,t,15,1);return dJe(i,e,t,n,r),i}function ij(e,t){var n=(YO(t,e.c.length),e.c[t]);return Yh(e.c,t,1),n}function Vje(e,t){var n=(NE(e),e),r=(NE(t),t);return n==r?0:n<r?-1:1}function Hje(e){var t=e.e+e.f;return isNaN(t)&&DC(e.d)?e.d:t}function aj(e,t){return e.a?Ry(e.a,e.b):e.a=new Zx(e.d),Iy(e.a,t),e}function Uje(e,t){if(e<0||e>t)throw P(new jm(cZe(e,t,`index`)));return e}function oj(e,t){var n=e.q.getHours()+(t/60|0);e.q.setMinutes(t),Wq(e,n)}function sj(e,t){return Dy(t)?t==null?pG(e.f,null):MIe(e.i,t):pG(e.f,t)}function Wje(e,t){Hy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function Gje(e,t){Uy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function Kje(e,t){Wy.call(this,t.xd(),t.wd()&-6),NE(e),this.a=e,this.b=t}function qje(e,t,n){np.call(this,n),this.b=e,this.c=t,this.d=(ZVe(),_Ut)}function cj(e,t,n){this.d=e,this.k=t?1:0,this.f=n?1:0,this.o=-1,this.p=0}function lj(e,t,n){this.a=e,this.c=t,this.d=n,hx(t.e,this),hx(n.b,this)}function uj(e){this.c=e,this.a=new M(this.c.a),this.b=new M(this.c.b)}function dj(){this.e=new up,this.c=new up,this.d=new up,this.b=new up}function Jje(){this.g=new uoe,this.b=new uoe,this.a=new up,this.k=new up}function Yje(){this.a=new qp,this.b=new Aoe,this.d=new Tt,this.e=new wt}function fj(e,t,n){this.a=e,this.b=t,this.c=n,hx(e.t,this),hx(t.i,this)}function pj(){this.b=new Sg,this.a=new Sg,this.b=new Sg,this.a=new Sg}function mj(){mj=E;var e,t;TUt=(Ph(),t=new Np,t),EUt=(e=new zoe,e)}function hj(){hj=E,$6=new Zf(`org.eclipse.elk.labels.labelManager`)}function Xje(){Xje=E,Yxt=new qS(`separateLayerConnections`,(yL(),Qxt))}function gj(){gj=E,jIt=new Ade(`FIXED`,0),AIt=new Ade(`CENTER_NODE`,1)}function _j(){_j=E,W3=new _v(`REGULAR`,0),U3=new _v(`CRITICAL`,1)}function Zje(e,t){var n=B9e(e,t);return e.b=new QF(n.c.length),K7e(e,n)}function vj(e,t,n){var r;return++e.e,--e.f,r=B(e.d[t].ed(n),138),r.kd()}function Qje(e){var t=e.jd();return rw(B(e.kd(),18).Lc(),new sne(t))}function yj(e){var t=e.b;return t.b==0?null:B(hV(t,0),65).b}function bj(e){if(e.a){if(e.e)return bj(e.e)}else return e;return null}function xj(e,t){return e.p<t.p?1:e.p>t.p?-1:0}function Sj(e,t){return NE(t),e.c<e.d?(e.Qe(t,e.c++),!0):!1}function Cj(e,t){return IT(e.a,t)?(sj(e.a,t),!0):!1}function wj(e,t,n){return wk(t,e.e.Pd().gc()),wk(n,e.c.Pd().gc()),e.a[t][n]}function Tj(e){var t;return e.a||(t=e.r,R(t,160)&&(e.a=B(t,160))),e.a}function $je(e){var t;for(IE(e),t=0;e.a.zd(new xe);)t=jz(t,1);return t}function eMe(e){var t;return zz(e),t=new Zye(e,e.a.e,e.a.d|4),new Mhe(e,t)}function tMe(e,t){var n;e.C&&(n=B(ZE(e.b,t),129).n,n.d=e.C.d,n.a=e.C.a)}function Ej(e){var t,n,r,i=e.d;t=e.a,n=e.b,r=e.c,e.d=n,e.a=r,e.b=i,e.c=t}function Dj(e,t,n){var r=0,i;for(i=0;i<t.length;i++)r+=e.sg(t[i],r,n)}function Oj(e,t,n,r){this.f=e,this.e=t,this.d=n,this.b=r,this.c=r?r.d:null}function kj(e,t){t.Tg(`Label management`,1),zy(Y(e,(hj(),$6))),t.Ug()}function Aj(){Aj=E,H_t=CR((nR(),q(I(q1,1),$Y,132,0,[B_t,K1,V_t])))}function nMe(){nMe=E,nvt=CR((vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])))}function rMe(){rMe=E,ovt=CR((KM(),q(I(avt,1),$Y,464,0,[e0,$1,t0])))}function jj(){jj=E,lvt=CR((kN(),q(I(cvt,1),$Y,465,0,[i0,r0,n0])))}function Mj(){Mj=E,Qyt=CR((ON(),q(I(Zyt,1),$Y,385,0,[Yyt,Jyt,Xyt])))}function iMe(){iMe=E,$Ct=CR((xL(),q(I(QCt,1),$Y,330,0,[x2,ZCt,b2])))}function Nj(){Nj=E,twt=CR((AN(),q(I(ewt,1),$Y,316,0,[C2,w2,S2])))}function aMe(){aMe=E,XCt=CR((tL(),q(I(YCt,1),$Y,303,0,[qCt,JCt,y2])))}function Pj(){Pj=E,ZSt=CR((nF(),q(I(XSt,1),$Y,351,0,[qSt,YSt,JSt])))}function Fj(){Fj=E,mCt=CR((SL(),q(I(pCt,1),$Y,452,0,[fCt,l2,u2])))}function Ij(){Ij=E,bAt=CR((rF(),q(I(yAt,1),$Y,455,0,[k3,D3,O3])))}function oMe(){oMe=E,TAt=CR((eL(),q(I(wAt,1),$Y,382,0,[xAt,SAt,CAt])))}function Lj(){Lj=E,kAt=CR((tR(),q(I(OAt,1),$Y,349,0,[DAt,EAt,A3])))}function Rj(){Rj=E,NAt=CR((xR(),q(I(MAt,1),$Y,350,0,[AAt,jAt,j3])))}function sMe(){sMe=E,RAt=CR((tF(),q(I(LAt,1),$Y,352,0,[IAt,PAt,FAt])))}function zj(){zj=E,VAt=CR((rL(),q(I(BAt,1),$Y,383,0,[zAt,N3,M3])))}function cMe(){cMe=E,qkt=CR((bR(),q(I(Kkt,1),$Y,353,0,[Ukt,Wkt,Gkt])))}function Bj(){Bj=E,qPt=CR((OI(),q(I(KPt,1),$Y,304,0,[WPt,GPt,UPt])))}function lMe(){lMe=E,ZPt=CR((CB(),q(I(XPt,1),$Y,441,0,[h6,JPt,YPt])))}function Vj(){Vj=E,CIt=CR((lz(),q(I(SIt,1),$Y,440,0,[yIt,bIt,xIt])))}function Hj(){Hj=E,uIt=CR((sN(),q(I(lIt,1),$Y,434,0,[oIt,cIt,sIt])))}function Uj(){Uj=E,hIt=CR((BR(),q(I(mIt,1),$Y,435,0,[dIt,pIt,fIt])))}function Wj(){Wj=E,DSt=CR((IF(),q(I(ESt,1),$Y,369,0,[Z0,X0,Y0])))}function uMe(){uMe=E,CMt=CR((BL(),q(I(SMt,1),$Y,386,0,[xMt,bMt,X3])))}function dMe(){dMe=E,tPt=CR((eR(),q(I(ePt,1),$Y,387,0,[ZNt,QNt,$Nt])))}function fMe(){fMe=E,mFt=CR((tB(),q(I(pFt,1),$Y,388,0,[dFt,fFt,uFt])))}function Gj(){Gj=E,KBt=CR((rR(),q(I(GBt,1),$Y,348,0,[WBt,$8,e5])))}function Kj(){Kj=E,EBt=CR((yP(),q(I(TBt,1),$Y,281,0,[K8,q8,J8])))}function qj(){qj=E,TVt=CR((zR(),q(I(wVt,1),$Y,283,0,[SVt,l7,CVt])))}function Jj(){Jj=E,pVt=CR((MP(),q(I(fVt,1),$Y,301,0,[$5,uVt,dVt])))}function Yj(){Yj=E,zSt=new Bue(`QUADRATIC`,0),BSt=new Bue(`SCANLINE`,1)}function Xj(e){return!e.g&&(e.g=new $s),!e.g.c&&(e.g.c=new kae(e)),e.g.c}function pMe(e){return!e.g&&(e.g=new $s),!e.g.b&&(e.g.b=new Qf(e)),e.g.b}function mMe(e){return!e.g&&(e.g=new $s),!e.g.d&&(e.g.d=new Oae(e)),e.g.d}function Zj(e){return!e.g&&(e.g=new $s),!e.g.a&&(e.g.a=new $f(e)),e.g.a}function Qj(e,t){var n=t,r=BD(ow(new vN(e,n)));return Ow(new vN(e,n)),r}function $j(e,t,n,r){return n&&(r=n.Oh(t,pB(n.Ah(),e.c.sk()),null,r)),r}function hMe(e,t,n,r){return n&&(r=n.Qh(t,pB(n.Ah(),e.c.sk()),null,r)),r}function eM(e,t,n,r){var i=G(q9,pX,30,t+1,15,1);return N8e(i,e,t,n,r),i}function G(e,t,n,r,i,a){var o=sGe(i,r);return i!=10&&q(I(e,a),t,n,i,o),o}function tM(e,t,n){var r,i=new YI(t,e);for(r=0;r<n;++r)vV(i);return i}function nM(e,t,n){var r,i;if(n!=null)for(r=0;r<t;++r)i=n[r],e.Oi(r,i)}function rM(e,t){var n=new fe;return n.c=!0,n.d=t.kd(),NJ(e,t.jd(),n)}function gMe(e,t){var n=e.q.getHours()+(t/3600|0);e.q.setSeconds(t),Wq(e,n)}function iM(e,t){return!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),MVe(e.o,t)}function aM(e,t,n){B(e.b,68),B(e.b,68),B(e.b,68),hP(e.a,new j_e(n,t,e))}function _Me(e,t,n,r){O8e(e,t,n,Kq(e,t,r,R(t,104)&&(B(t,20).Bb&OX)!=0))}function oM(e,t,n){if(e<0||t>n||t<e)throw P(new $m(HX+e+rat+t+qit+n))}function vMe(e,t,n){this.d=new Xp,this.c=new dp,this.a=e,this.e=t,this.c=n}function sM(e){e?(this.c=e,this.b=null):(this.c=null,this.b=new up)}function cM(e,t){d_.call(this,e,t),this.a=G(T_t,GY,443,2,0,1),this.b=!0}function lM(e){sRe.call(this,e,0),bS(this),this.d.b=this.d,this.d.a=this.d}function uM(e){this.e=e,this.b=this.e.a.entries(),this.a=G(v1,CY,1,0,5,1)}function yMe(){yMe=E,KAt=uT(ww(new RE,(zU(),m0),(sY(),vxt)),v0,U0)}function dM(){return QU(),q(I(xCt,1),$Y,286,0,[gCt,hCt,vCt,_Ct,bCt,yCt])}function fM(){return BH(),q(I(NCt,1),$Y,284,0,[ACt,kCt,MCt,OCt,jCt,DCt])}function bMe(){return YU(),q(I(BCt,1),$Y,285,0,[d2,ICt,zCt,RCt,LCt,FCt])}function xMe(){return gW(),q(I(a2,1),$Y,233,0,[t2,r2,e2,n2,i2,$0])}function SMe(){return NU(),q(I(IBt,1),$Y,328,0,[PBt,MBt,FBt,ABt,NBt,jBt])}function CMe(){return eU(),q(I(JRt,1),$Y,300,0,[qRt,o8,a8,KRt,r8,i8])}function wMe(){return bV(),q(I(MRt,1),$Y,259,0,[ORt,t8,n8,jRt,kRt,ARt])}function pM(){return mU(),q(I(eVt,1),$Y,103,0,[w5,C5,S5,y5,x5,b5])}function mM(){return NW(),q(I(nVt,1),$Y,282,0,[k5,D5,O5,E5,T5,A5])}function hM(e){var t;return!e.a&&e.b!=-1&&(t=e.c.Ah(),e.a=YN(t,e.b)),e.a}function gM(e,t){return e.Qi()&&e.Gc(t)?!1:(e.Fi(t),!0)}function _M(e,t){return XD(t,`Horizontal alignment cannot be null`),e.b=t,e}function TMe(e,t,n){cY();var r=JJ(e,t);return n&&r&&HCe(e)&&(r=null),r}function EMe(e,t,n){var r=e.b[n.c.p][n.p];r.b+=t.b,r.c+=t.c,r.a+=t.a,++r.a}function vM(e,t,n){var i;e.d[t.g]=n,i=e.g.c,i[t.g]=r.Math.max(i[t.g],n+1)}function yM(e,t){var n=e.a-t.a,i=e.b-t.b;return r.Math.sqrt(n*n+i*i)}function bM(e,t){var n,r;for(r=t.Jc();r.Ob();)n=B(r.Pb(),37),t6e(e,n,0,0)}function xM(e,t,n){var r,i;for(i=e.Jc();i.Ob();)r=B(i.Pb(),37),eq(r,t,n)}function SM(e){var t,n;for(n=tV(e.a,0);n.b!=n.d.c;)t=B(Lk(n),65),tQe(t)}function DMe(e,t){return vue(e.e,t)||ZB(e.e,t,new _Ue(t)),B(RN(e.e,t),114)}function CM(e,t,n,r){return NE(e),NE(t),NE(n),NE(r),new QSe(e,t,new me)}function wM(e,t,n,r){this.$j(),this.a=t,this.b=e,this.c=new PSe(this,t,n,r)}function TM(e,t,n,r,i,a){Fke.call(this,t,r,i,a),this.c=e,this.b=n}function EM(e,t,n,r,i,a){Fke.call(this,t,r,i,a),this.c=e,this.a=n}function DM(e,t){var n,r,i=e.r;return r=e.d,n=nJ(e,t,!0),n.b!=i||n.a!=r}function OM(e,t,n){var r,i=(r=jG(e.b,t),r);return i?gJ(CN(e,i),n):null}function OMe(e,t,n){var r=bO(e,n),i=null,a;r&&(i=wXe(r)),a=i,sUe(t,n,a)}function kMe(e,t,n){var r=bO(e,n),i=null,a;r&&(i=wXe(r)),a=i,sUe(t,n,a)}function AMe(e,t){var n=bE(e.k,t);return E0e(e,t),W3e(e,t),yG(e,t,n),null}function kM(e,t){var n;return n=e.Fh(t),n>=0?e.Ih(n,!0,!0):XW(e,t,!0)}function jMe(e,t){return _z(F(z(Y(e,(aY(),Y2)))),F(z(Y(t,Y2))))}function AM(e,t){Wy.call(this,t.xd(),t.wd()&-16449),NE(e),this.a=e,this.c=t}function jM(e,t,n,r,i){mpe(this),this.b=e,this.d=t,this.f=n,this.g=r,this.c=i}function MM(e){zb(this),cw(e>=0,`Initial capacity must not be negative`)}function NM(e){var t;return gE(e),R(e,206)?(t=B(e,206),t):new id(e)}function MMe(e){for(;!e.a;)if(!qge(e.c,new sre(e)))return!1;return!0}function NMe(e){var t;if(!e.a)throw P(new JE);return t=e.a,e.a=AO(e.a),t}function PMe(e){if(e.b<=0)throw P(new jp);return--e.b,e.a-=e.c.c,UR(e.a)}function PM(e,t){if(e.g==null||t>=e.i)throw P(new Zy(t,e.i));return e.g[t]}function FM(e,t,n){if(HL(e,n),n!=null&&!e.dk(n))throw P(new Tp);return n}function FMe(e,t,n){var r=qLe(e,t,n);return e.b=new QF(r.c.length),q2e(e,r)}function IMe(e){var t;if(e.ll())for(t=e.i-1;t>=0;--t)K(e,t);return vAe(e)}function LMe(e){IM(),B(e.mf((oY(),O8)),185).Ec((NW(),O5)),e.of(Uzt,null)}function IM(){IM=E,gRt=new ns,vRt=new rs,_Rt=SLe((oY(),Uzt),gRt,C8,vRt)}function LM(){LM=E,Qq(),eWt=wX,$Ut=TX,nWt=new Jd(wX),tWt=new Jd(TX)}function RM(){RM=E,qNt=new Sde(`LEAF_NUMBER`,0),JNt=new Sde(`NODE_SIZE`,1)}function zM(e){e.a=G(q9,pX,30,e.b+1,15,1),e.c=G(q9,pX,30,e.b,15,1),e.d=0}function BM(e,t){e.a.Le(t.d,e.b)>0&&(hx(e.c,new gbe(t.c,t.d,e.d)),e.b=t.d)}function VM(e,t,n,r){var i;r=(PD(),r||o_t),i=e.slice(t,n),lZe(i,e,t,n,-t,r)}function HM(e,t,n,r,i){return t<0?XW(e,n,r):B(n,69).uk().wk(e,e.ei(),t,r,i)}function UM(e,t){var n,r=t/e.c.Pd().gc()|0;return n=t%e.c.Pd().gc(),wj(e,r,n)}function WM(e){var t,n;if(!e.b)return null;for(n=e.b;t=n.a[0];)n=t;return n}function RMe(e){var t,n;if(!e.b)return null;for(n=e.b;t=n.a[1];)n=t;return n}function zMe(e){return R(e,183)?``+B(e,183).a:e==null?null:Jz(e)}function GM(e){return R(e,183)?``+B(e,183).a:e==null?null:Jz(e)}function BMe(e,t){if(t.a)throw P(new vm(cat));BT(e.a,t),t.a=e,!e.j&&(e.j=t)}function KM(){KM=E,e0=new T_(ZX,0),$1=new T_(XX,1),t0=new T_(QX,2)}function qM(){qM=E,E_t=new v_(`All`,0),D_t=new Lfe,O_t=new fpe,k_t=new Rfe}function VMe(){VMe=E,j_t=CR((qM(),q(I(A_t,1),$Y,310,0,[E_t,D_t,O_t,k_t])))}function HMe(){HMe=E,zvt=CR(($I(),q(I(Rvt,1),$Y,414,0,[o0,a0,Ivt,Lvt])))}function UMe(){UMe=E,pbt=CR((bL(),q(I(fbt,1),$Y,413,0,[b0,C0,x0,S0])))}function JM(){JM=E,wbt=CR((HB(),q(I(Cbt,1),$Y,384,0,[T0,xbt,bbt,Sbt])))}function YM(){YM=E,eSt=CR((yL(),q(I($xt,1),$Y,368,0,[Qxt,Xxt,Zxt,W0])))}function XM(){XM=E,hSt=CR((nL(),q(I(mSt,1),$Y,418,0,[G0,K0,q0,pSt])))}function WMe(){WMe=E,ujt=CR((yR(),q(I(ljt,1),$Y,409,0,[P3,F3,cjt,sjt])))}function GMe(){GMe=E,Xkt=CR((yV(),q(I(Ykt,1),$Y,205,0,[y3,Jkt,v3,_3])))}function ZM(){ZM=E,mAt=CR((MB(),q(I(pAt,1),$Y,270,0,[E3,uAt,dAt,fAt])))}function QM(){QM=E,KSt=CR((eB(),q(I(GSt,1),$Y,302,0,[s2,USt,o2,WSt])))}function KMe(){KMe=E,ONt=CR(($L(),q(I(DNt,1),$Y,354,0,[ENt,wNt,TNt,CNt])))}function $M(){$M=E,HPt=CR((RV(),q(I(VPt,1),$Y,355,0,[BPt,RPt,zPt,LPt])))}function eN(){eN=E,rFt=CR((MU(),q(I(nFt,1),$Y,406,0,[tFt,QPt,eFt,$Pt])))}function tN(){tN=E,iMt=CR((fV(),q(I(rMt,1),$Y,402,0,[nMt,q3,J3,Y3])))}function qMe(){qMe=E,RLt=CR((AH(),q(I(LLt,1),$Y,396,0,[NLt,PLt,FLt,ILt])))}function JMe(){JMe=E,wBt=CR((RR(),q(I(CBt,1),$Y,280,0,[G8,bBt,xBt,SBt])))}function nN(){nN=E,kBt=CR((rB(),q(I(OBt,1),$Y,225,0,[DBt,X8,Y8,Z8])))}function rN(){rN=E,YBt=CR((pH(),q(I(JBt,1),$Y,293,0,[i5,t5,n5,r5])))}function iN(){iN=E,AVt=CR((cA(),q(I(u7,1),$Y,290,0,[EVt,kVt,DVt,OVt])))}function aN(){aN=E,mVt=CR((jB(),q(I(i7,1),$Y,381,0,[n7,r7,t7,e7])))}function YMe(){YMe=E,IVt=CR((nB(),q(I(FVt,1),$Y,327,0,[PVt,jVt,NVt,MVt])))}function XMe(){XMe=E,UVt=CR((QL(),q(I(HVt,1),$Y,412,0,[zVt,BVt,RVt,VVt])))}function oN(){oN=E,wCt=new Hue(KZ,0),CCt=new Hue(`IMPROVE_STRAIGHTNESS`,1)}function sN(){sN=E,oIt=new Ode(eut,0),cIt=new Ode(mlt,1),sIt=new Ode(KZ,2)}function cN(e){var t;if(!TFe(e))throw P(new jp);return e.e=1,t=e.d,e.d=null,t}function lN(e){var t;return cb(e)&&(t=0-e,!isNaN(t))?t:RI(DL(e))}function uN(e,t,n){for(;n<e.c.length;++n)if(XE(t,e.c[n]))return n;return-1}function dN(e,t){var n=uN(e,t,0);return n==-1?!1:(ij(e,n),!0)}function ZMe(e,t){var n=B(sj(e.e,t),395);return n?(Obe(n),n.e):null}function QMe(e,t,n,r,i){return NE(e),NE(t),NE(n),NE(r),NE(i),new QSe(e,t,r)}function $Me(e){CS(!!e.c),k_e(e.f.g,e.d),e.c.Qb(),e.c=null,e.b=tLe(e),e.d=e.f.g}function fN(e){var t;for(t=e.p+1;t<e.c.a.c.length;++t)--B(Pw(e.c.a,t),9).p}function pN(e){var t=e.hj();t!=null&&e.d!=-1&&B(t,95).uh(e),e.i&&e.i.mj()}function mN(e){var t;return IE(e),t=G(Z9,AX,30,0,15,1),Jh(e.a,new ire(t)),t}function hN(e,t,n){var r;return IE(e),r=new ye,r.a=t,e.a.Nb(new Tue(r,n)),r.a}function gN(e,t){return qN(t)!=10&&q(hR(t),t.Qm,t.__elementTypeId$,qN(t),e),e}function _N(e){return B(Y(B(Pw(e.j,0),12),(aY(),q2)),12)}function vN(e,t){var n;this.f=e,this.b=t,n=B(bE(e.b,t),263),this.c=n?n.b:null}function eNe(){KC(),this.b=new dp,this.f=new dp,this.g=new dp,this.e=new dp}function yN(e){nx(this),this.g=e?eO(e,e.ge()):null,this.f=e,kD(this),this.he()}function bN(e,t,n,r,i,a,o){fF.call(this,t,r,i,a,o),this.c=e,this.b=n}function xN(e,t){if(t<0)throw P(new jm(xdt+t));return pAe(e,t+1),Pw(e.j,t)}function SN(e,t){return XE(t,Pw(e.f,0))||XE(t,Pw(e.f,1))||XE(t,Pw(e.f,2))}function tNe(e,t){return new Oye(t,MS(ix(t.e),t.f.a+e,t.f.b+e),(Rx(),!1))}function nNe(e,t){return GC(),hx(e,new ny(t,UR(t.e.c.length+t.g.c.length)))}function rNe(e,t){return GC(),hx(e,new ny(t,UR(t.e.c.length+t.g.c.length)))}function iNe(e,t){Hg();var n=zk(e),r=zk(t);return!!n&&!!r&&!LUe(n.k,r.k)}function CN(e,t){var n=B(t,687),r=n.ui();return!r&&n.xi(r=new rfe(e,t)),r}function wN(e,t){var n=B(t,689),r=n.Yk();return!r&&n.al(r=new HOe(e,t)),r}function TN(e){sxe();var t=e+128,n=Agt[t];return!n&&(n=Agt[t]=new Kd(e)),n}function EN(e){return e.b||(e.b=new Gxe(e,G7,e),!e.a&&(e.a=new XS(e,e))),e.b}function aNe(e){return k_e(e.d.a.e.g,e.b),SS(e.c!=e.d.a.d),e.a=e.c,e.c=e.c.a,e.a}function DN(e){var t,n=e.length;return t=G(K9,cX,30,n,15,1),iCe(e,0,n,t,0),t}function oNe(e,t){for(;t[0]<e.length&&sb(` \r
140
140
  `,AU(YE(e,t[0])))>=0;)++t[0]}function sNe(e,t){Vvt=new et,Bvt=t,s0=e,B(s0.b,68),aM(s0,Vvt,null),R7e(s0)}function ON(){ON=E,Yyt=new k_(`XY`,0),Jyt=new k_(`X`,1),Xyt=new k_(`Y`,2)}function kN(){kN=E,i0=new E_(`TOP`,0),r0=new E_(XX,1),n0=new E_(Eat,2)}function AN(){AN=E,C2=new Gue(KZ,0),w2=new Gue(`TOP`,1),S2=new Gue(Eat,2)}function jN(){jN=E,hAt=new que(`INPUT_ORDER`,0),gAt=new que(`PORT_DEGREE`,1)}function MN(){MN=E,Tgt=Xb(hX,hX,524287),Egt=Xb(0,0,_X),Dgt=jje(1),jje(2),Ogt=jje(0)}function cNe(e){var t=kP(VI(e,32));return t??=(LB(e),kP(VI(e,32))),t}function NN(e){var t;return e.Lh()||(t=cE(e.Ah())-e.gi(),e.Xh().Kk(t)),e.wh()}function lNe(e){(this.q?this.q:(ND(),ND(),U1)).zc(e.q?e.q:(ND(),ND(),U1))}function uNe(e,t){RP(e,t==null||DC((NE(t),t))||isNaN((NE(t),t))?0:(NE(t),t))}function dNe(e,t){zP(e,t==null||DC((NE(t),t))||isNaN((NE(t),t))?0:(NE(t),t))}function fNe(e,t){LP(e,t==null||DC((NE(t),t))||isNaN((NE(t),t))?0:(NE(t),t))}function pNe(e,t){NP(e,t==null||DC((NE(t),t))||isNaN((NE(t),t))?0:(NE(t),t))}function mNe(e,t){EC(B(B(e.f,19).mf((oY(),D8)),103))&&aVe(eD(B(e.f,19)),t)}function PN(e,t){var n=pB(e.d,t);return n>=0?_V(e,n,!0,!0):XW(e,t,!0)}function FN(e,t){var n=e.bd(t);return n>=0?(e.ed(n),!0):!1}function hNe(e,t,n){var r=e.g[t];return wx(e,t,e.Xi(t,n)),e.Pi(t,n,r),e.Li(),r}function IN(e){var t;return e.d!=e.r&&(t=EH(e),e.e=!!t&&t.jk()==_mt,e.d=t),e.e}function gNe(e,t){var n;for(gE(e),gE(t),n=!1;t.Ob();)n|=e.Ec(t.Pb());return n}function LN(e,t){var n,r;return zz(e),r=new Kje(t,e.a),n=new n_e(r),new Nw(e,n)}function RN(e,t){var n=B(bE(e.e,t),395);return n?(Ppe(e,n),n.e):null}function _Ne(e,t){var n,r,i=t.c.i;n=B(bE(e.f,i),60),r=n.d.c-n.e.c,rI(t.a,r,0)}function zN(e,t,n){var r=10,i;for(i=0;i<n-1;i++)t<r&&(e.a+=`0`),r*=10;e.a+=t}function vNe(e,t){var n;for(++e.d,++e.c[t],n=t+1;n<e.a.length;)++e.a[n],n+=n&-n}function BN(e){var t=e.b.c.length==0?null:Pw(e.b,0);return t!=null&&AF(e,0),t}function yNe(e){switch(e.g){case 0:return vY;case 1:return aX;default:return 0}}function bNe(e){return xKe(e,(MN(),Ogt))<0?-gme(DL(e)):e.l+e.m*vX+e.h*yX}function VN(e){var t=e/60|0,n=e%60;return n==0?``+t:``+t+`:`+(``+n)}function HN(e,t){var n=e.a[t],r=(wL(),wgt)[typeof n];return r?r(n):VR(typeof n)}function xNe(e,t){return R(t,104)&&(B(t,20).Bb&OX)!=0?new $y(t,e):new YI(t,e)}function SNe(e,t){return R(t,104)&&(B(t,20).Bb&OX)!=0?new $y(t,e):new YI(t,e)}function CNe(e,t,n){return Sx(new Pv(n.e.a+n.f.a/2,n.e.b+n.f.b/2),e)==(NE(t),t)}function wNe(e){if(!e.c)throw P(new jp);return e.e=e.a=e.c,e.c=e.c.c,++e.d,e.a.f}function TNe(e){if(!e.e)throw P(new jp);return e.c=e.a=e.e,e.e=e.e.e,--e.d,e.a.f}function ENe(e,t,n,r){if(!e)throw P(new Nm(QK(t,q(I(v1,1),CY,1,5,[n,r]))))}function UN(){UN=E,iVt=CR((GJ(),q(I(Q5,1),qZ,64,0,[X5,M5,j5,Y5,Z5])))}function WN(){WN=E,yBt=CR((cz(),q(I(W8,1),$Y,87,0,[H8,V8,B8,z8,U8])))}function DNe(){DNe=E,rbt=CR((zU(),q(I(nbt,1),$Y,364,0,[m0,h0,g0,_0,v0])))}function GN(){GN=E,gbt=new mt,_bt=new ft,mbt=new ht,hbt=new gt,vbt=new vt}function KN(){KN=E,$vt=new O_(`EADES`,0),eyt=new O_(`FRUCHTERMAN_REINGOLD`,1)}function ONe(e){this.g=e,this.f=new up,this.a=r.Math.min(this.g.c.c,this.g.d.c)}function kNe(e,t,n,r){cY(),cp.call(this,26),this.c=e,this.a=t,this.d=n,this.b=r}function ANe(e,t){var n,r=t.c;for(n=r+1;n<=t.f;n++)e.a[n]>e.a[r]&&(r=n);return r}function jNe(e){var t;for(++e.a,t=e.c.a.length;e.a<t;++e.a)if(e.c.b[e.a])return}function MNe(e,t){var n=oB(e.e.c,t.e.c);return n==0?_z(e.e.d,t.e.d):n}function NNe(e){var t=B(Y(e,(aY(),E2)),318);return t?t.a==e:!1}function PNe(e){var t=B(Y(e,(aY(),E2)),318);return t?t.i==e:!1}function FNe(e,t){return t==(v_e(),v_e(),__t)?e.toLocaleLowerCase():e.toLowerCase()}function qN(e){return e.__elementTypeCategory$==null?10:e.__elementTypeCategory$}function INe(e){var t,n;if(e.a){n=null;do t=e.a,e.a=null,n=cW(t,n);while(e.a);e.a=n}}function LNe(e){var t,n;if(e.b){n=null;do t=e.b,e.b=null,n=cW(t,n);while(e.b);e.b=n}}function RNe(e,t){for(var n=0;e.e!=e.i.gc();)JSe(t,aV(e),UR(n)),n!=vY&&++n}function JN(e,t){var n=B(bE(e.a,t),151);return n||(n=new rt,WE(e.a,t,n)),n}function zNe(e,t,n){return wO(hw(e.a.e[B(t.a,9).p]-e.a.e[B(n.a,9).p]))}function YN(e,t){var n=(e.i??Rq(e),e.i);return t>=0&&t<n.length?n[t]:null}function BNe(e){return(e.i&2?`interface `:e.i&1?``:`class `)+(RS(e),e.o)}function XN(e){return NR(e,vY)>0?vY:NR(e,aX)<0?aX:tT(e)}function ZN(e,t,n){var r;if(t==null)throw P(new Op);return r=bO(e,t),EAe(e,t,n),r}function VNe(e,t){return NE(t),fSe(e),e.d.Ob()?(t.Ad(e.d.Pb()),!0):!1}function QN(e){this.b=new up,this.a=new up,this.c=new up,this.d=new up,this.e=e}function HNe(e,t,n){dC.call(this),hPe(this),this.a=e,this.c=n,this.b=t.d,this.f=t.e}function UNe(){return UG(),q(I(kbt,1),$Y,252,0,[P0,M0,A0,F0,j0,k0,I0,N0])}function WNe(){WNe=E,$Bt=CR((nV(),q(I(v5,1),$Y,260,0,[g5,_5,ZBt,h5,QBt])))}function $N(){$N=E,SRt=CR((eV(),q(I(G6,1),$Y,161,0,[U6,H6,B6,W6,V6])))}function eP(){eP=E,xSt=CR((lU(),q(I(bSt,1),$Y,372,0,[J0,vSt,ySt,_St,gSt])))}function tP(){tP=E,KNt=CR((vU(),q(I(GNt,1),$Y,365,0,[UNt,BNt,WNt,VNt,HNt])))}function nP(){nP=E,Pwt=CR(($z(),q(I(Nwt,1),$Y,166,0,[p4,l4,u4,d4,f4])))}function rP(){rP=E,tAt=CR((dV(),q(I(eAt,1),$Y,329,0,[$kt,Zkt,Qkt,b3,x3])))}function GNe(){GNe=E,vIt=CR((aK(),q(I(_It,1),$Y,370,0,[E6,T6,O6,D6,k6])))}function KNe(){KNe=E,BIt=CR((eW(),q(I(zIt,1),$Y,331,0,[PIt,FIt,RIt,IIt,LIt])))}function iP(){return UK(),q(I(ISt,1),$Y,277,0,[kSt,MSt,OSt,FSt,jSt,ASt,PSt,NSt])}function aP(){return fW(),q(I(wRt,1),$Y,287,0,[CRt,K6,X6,Q6,q6,J6,Y6,Z6])}function qNe(){return mG(),q(I(j7,1),$Y,235,0,[hHt,pHt,A7,k7,mHt,dHt,uHt,fHt])}function JNe(e,t){return SP(),-Yb(B(Y(e,(Lq(),u6)),15).a,B(Y(t,u6),15).a)}function YNe(e,t,n,r){var i;e.j=-1,KQe(e,TXe(e,t,n),(l_(),i=B(t,69).tk(),i.vl(r)))}function XNe(e,t,n){var r,i;for(i=new M(n);i.a<i.c.c.length;)r=W(i),Hqe(e,t,r)}function oP(e){var t,n=(t=new Hoe,t);gM((!e.q&&(e.q=new V(K7,e,11,10)),e.q),n)}function ZNe(e,t){var n=t>0?t-1:t;return Sce(Th(jPe(hbe(new om,n),e.n),e.j),e.k)}function sP(e,t){var n;return zz(e),n=new cTe(e,e.a.xd(),e.a.wd()|4,t),new Nw(e,n)}function QNe(e,t){var n=B(jR(e.d,t),18),r;return n?(r=t,e.e.pc(r,n)):null}function $Ne(e){this.d=e,this.c=e.c.vc().Jc(),this.b=null,this.a=null,this.e=(Tm(),rgt)}function cP(e){if(e<0)throw P(new Nm(`Illegal Capacity: `+e));this.g=this.$i(e)}function ePe(e,t){if(0>e||e>t)throw P(new eh(`fromIndex: 0, toIndex: `+e+qit+t))}function tPe(e,t){return!!aI(e,t,tT(Mz(JY,UE(tT(Mz(t==null?0:JF(t),YY)),15))))}function nPe(e,t){EC(B(Y(B(e.e,9),(nY(),Y4)),103))&&(ND(),Qb(B(e.e,9).j,t))}function rPe(e){var t=F(z(Y(e,(nY(),j4))));return t<0&&(t=0,J(e,j4,t)),t}function lP(e,t){var n,r;for(r=e.Jc();r.Ob();)n=B(r.Pb(),70),J(n,(aY(),z2),t)}function iPe(e,t,n){var i=r.Math.max(0,e.b/2-.5);DH(n,i,1),hx(t,new H_(n,i))}function aPe(e,t,n,r,i,a){var o=tj(r);NO(o,i),PO(o,a),qW(e.a,r,new FC(o,t,n.f))}function oPe(e,t){mV(e,(KK(),cFt),t.f),mV(e,aFt,t.e),mV(e,sFt,t.d),mV(e,iFt,t.c)}function uP(e){var t;CS(!!e.c),t=e.c.a,mP(e.d,e.c),e.b==e.c?e.b=t:--e.a,e.c=null}function sPe(e){return e.a>=-.01&&e.a<=tZ&&(e.a=0),e.b>=-.01&&e.b<=tZ&&(e.b=0),e}function dP(e){zK();var t,n=Plt;for(t=0;t<e.length;t++)e[t]>n&&(n=e[t]);return n}function fP(e,t){var n=vK(e.Ah(),t);if(!n)throw P(new Nm(p$+t+Eft));return n}function pP(e,t){for(var n=e;AO(n);)if(n=AO(n),n==t)return!0;return!1}function cPe(e,t){return t&&e.b[t.g]==t?(yE(e.b,t.g,null),--e.c,!0):!1}function mP(e,t){var n=t.c;return t.a.b=t.b,t.b.a=t.a,t.a=t.b=null,t.c=null,--e.b,n}function hP(e,t){var n,r,i,a;for(NE(t),r=e.c,i=0,a=r.length;i<a;++i)n=r[i],t.Ad(n)}function lPe(e,t){var n,r=t.a.jd(),i;for(n=B(t.a.kd(),18).gc(),i=0;i<n;i++)e.Ad(r)}function uPe(e){for(var t=e.a.d.j,n=e.c.d.j;t!=n;)OF(e.b,t),t=mz(t);OF(e.b,t)}function dPe(e){var t;for(t=0;t<e.c.length;t++)(YO(t,e.c.length),B(e.c[t],12)).p=t}function fPe(e,t,n){var r,i=t[n],a;for(r=0;r<i.length;r++)a=i[r],e.e[a.c.p][a.p]=r}function gP(e,t){var n,r,i,a;for(r=e.d,i=0,a=r.length;i<a;++i)n=r[i],_x(e.g,n).a=t}function pPe(e,t,n){var r=t,i;do i=F(e.p[r.p])+n,e.p[r.p]=i,r=e.a[r.p];while(r!=t)}function mPe(e){var t=r.Math.sqrt(e.a*e.a+e.b*e.b);return t>0&&(e.a/=t,e.b/=t),e}function _P(e){this.b=(gE(e),new OC(e)),this.a=new up,this.d=new up,this.e=new Eh}function hPe(e){e.b=(KM(),$1),e.f=(kN(),r0),e.d=(lF(2,QY),new MM(2)),e.e=new Eh}function gPe(){gPe=E,ivt=(vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])).length,rvt=ivt}function vP(){vP=E,Y1=new w_(`BEGIN`,0),X1=new w_(XX,1),Z1=new w_(`END`,2)}function yP(){yP=E,K8=new zv(XX,0),q8=new zv(`HEAD`,1),J8=new zv(`TAIL`,2)}function bP(){bP=E,cCt=new Z_(`READING_DIRECTION`,0),lCt=new Z_(`ROTATION`,1)}function xP(){xP=E,cRt=new Nde(`DIRECT_ROUTING`,0),sRt=new Nde(`BEND_ROUTING`,1)}function SP(){SP=E,PNt=IB(IB(IB(Qg(new RE,(fV(),q3)),(oq(),_Mt)),uMt),mMt)}function CP(){CP=E,INt=IB(IB(IB(Qg(new RE,(fV(),Y3)),(oq(),fMt)),sMt),dMt)}function wP(e,t){return Ace(iI(e,t,tT(Mz(JY,UE(tT(Mz(t==null?0:JF(t),YY)),15)))))}function TP(e,t){return ex(),$P(iX),r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)}function _Pe(e,t){return ex(),$P(iX),r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)}function EP(e){var t;return e.w?e.w:(t=fOe(e),t&&!t.Sh()&&(e.w=t),t)}function vPe(e){var t;return e==null?null:(t=B(e,198),MJe(t,t.length))}function K(e,t){if(e.g==null||t>=e.i)throw P(new Zy(t,e.i));return e.Ui(t,e.g[t])}function yPe(e,t){ND();var n,r=new up;for(n=0;n<e;++n)Sp(r.c,t);return new Hse(r)}function DP(e){return zz(e),lw(!0,`n may not be negative`),new Nw(e,new oFe(e.a))}function bPe(e,t){return JU(),Yb(e.b.c.length-e.e.c.length,t.b.c.length-t.e.c.length)}function OP(e,t){var n,r=e.a;n=Xze(e,t,null),r!=t&&!e.e&&(n=FJ(e,t,n)),n&&n.mj()}function xPe(e,t){return pC(ix(B(bE(e.g,t),8)),rx(B(bE(e.f,t),463).b))}function SPe(e,t,n){var r=function(){return e.apply(r,arguments)};return t.apply(r,n),r}function kP(e){var t;return Dw(e==null||Array.isArray(e)&&(t=qN(e),!(t>=14&&t<=16))),e}function CPe(){CPe=E,PCt=CR((BH(),q(I(NCt,1),$Y,284,0,[ACt,kCt,MCt,OCt,jCt,DCt])))}function wPe(){wPe=E,VCt=CR((YU(),q(I(BCt,1),$Y,285,0,[d2,ICt,zCt,RCt,LCt,FCt])))}function TPe(){TPe=E,SCt=CR((QU(),q(I(xCt,1),$Y,286,0,[gCt,hCt,vCt,_Ct,bCt,yCt])))}function EPe(){EPe=E,RSt=CR((gW(),q(I(a2,1),$Y,233,0,[t2,r2,e2,n2,i2,$0])))}function DPe(){DPe=E,LBt=CR((NU(),q(I(IBt,1),$Y,328,0,[PBt,MBt,FBt,ABt,NBt,jBt])))}function AP(){AP=E,YRt=CR((eU(),q(I(JRt,1),$Y,300,0,[qRt,o8,a8,KRt,r8,i8])))}function OPe(){OPe=E,NRt=CR((bV(),q(I(MRt,1),$Y,259,0,[ORt,t8,n8,jRt,kRt,ARt])))}function jP(){jP=E,tVt=CR((mU(),q(I(eVt,1),$Y,103,0,[w5,C5,S5,y5,x5,b5])))}function kPe(){kPe=E,rVt=CR((NW(),q(I(nVt,1),$Y,282,0,[k5,D5,O5,E5,T5,A5])))}function APe(){return vG(),q(I(m5,1),$Y,96,0,[o5,a5,c5,p5,f5,d5,l5,u5,s5])}function MP(){MP=E,$5=new Yv(cft,0),uVt=new Yv(`PARENT`,1),dVt=new Yv(`ROOT`,2)}function jPe(e,t){return e.n=t,e.n?(e.f=new up,e.e=new up):(e.f=null,e.e=null),e}function NP(e,t){var n=e.f;e.f=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,3,n,e.f))}function PP(e,t){var n=e.b;e.b=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,1,n,e.b))}function FP(e,t){var n=e.b;e.b=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,3,n,e.b))}function IP(e,t){var n=e.c;e.c=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,4,n,e.c))}function LP(e,t){var n=e.g;e.g=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,4,n,e.g))}function RP(e,t){var n=e.i;e.i=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,5,n,e.i))}function zP(e,t){var n=e.j;e.j=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,6,n,e.j))}function BP(e,t){var n=e.j;e.j=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,1,n,e.j))}function VP(e,t){var n=e.k;e.k=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,2,n,e.k))}function HP(e,t){var n=e.a;e.a=t,e.Db&4&&!(e.Db&1)&&II(e,new nA(e,0,n,e.a))}function UP(e,t){var n=e.s;e.s=t,e.Db&4&&!(e.Db&1)&&II(e,new rA(e,4,n,e.s))}function WP(e,t){var n=e.t;e.t=t,e.Db&4&&!(e.Db&1)&&II(e,new rA(e,5,n,e.t))}function GP(e,t){var n=e.d;e.d=t,e.Db&4&&!(e.Db&1)&&II(e,new rA(e,2,n,e.d))}function KP(e,t){var n=e.F;e.F=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,5,n,t))}function qP(e,t){var n=B(bE((a_(),EHt),e),58);return n?n.ek(t):G(v1,CY,1,t,5,1)}function JP(e,t){var n=t in e.a,r;return n&&(r=bO(e,t).pe(),r)?r.a:null}function MPe(e,t){var n=(r=(Mh(),i=new Js,i),t&&hK(r,t),r),r,i;return gFe(n,e),n}function NPe(e,t,n){var r=NB(n);return WE(e.c,r,t),WE(e.d,t,n),WE(e.e,t,gO(t)),t}function YP(e,t,n,r,i,a){var o=bCe(e,t);return HPe(n,o),o.i=i?8:0,o.f=r,o.e=i,o.g=a,o}function PPe(e,t,n,r,i){this.d=t,this.k=r,this.f=i,this.o=-1,this.p=1,this.c=e,this.a=n}function FPe(e,t,n,r,i){this.d=t,this.k=r,this.f=i,this.o=-1,this.p=2,this.c=e,this.a=n}function IPe(e,t,n,r,i){this.d=t,this.k=r,this.f=i,this.o=-1,this.p=6,this.c=e,this.a=n}function LPe(e,t,n,r,i){this.d=t,this.k=r,this.f=i,this.o=-1,this.p=7,this.c=e,this.a=n}function RPe(e,t,n,r,i){this.d=t,this.j=r,this.e=i,this.o=-1,this.p=4,this.c=e,this.a=n}function zPe(e,t){var n,r,i,a;for(r=t,i=0,a=r.length;i<a;++i)n=r[i],BMe(e.a,n);return e}function XP(e){var t,n,r,i;for(n=e,r=0,i=n.length;r<i;++r)t=n[r],gE(t);return new vfe(e)}function BPe(e){var t=pC(ix(e.d.d),e.c.d);return kH(t,e.c.e.a,e.c.e.b),fC(t,e.c.d)}function ZP(e){var t=pC(ix(e.c.d),e.d.d);return kH(t,e.d.e.a,e.d.e.b),fC(t,e.d.d)}function VPe(e){var t=/function(?:\s+([\w$]+))?\s*\(/.exec(e);return t&&t[1]||ait}function HPe(e,t){if(e){t.n=e;var n=jEe(t);if(!n){Hht[e]=[t];return}n.Pm=t}}function UPe(e,t,n){var i,a=e.length;return i=r.Math.min(n,a),IQe(e,0,t,0,i,!0),t}function WPe(e,t,n){if(HL(e,n),!e.il()&&n!=null&&!e.dk(n))throw P(new Tp);return n}function QP(e,t){var n;return NE(t),n=e[`:`+t],cw(!!n,`Enum constant undefined: `+t),n}function GPe(e,t){var n=e.c,r=t.e[e.p];return r>0?B(Pw(n.a,r-1),9):null}function $P(e){if(!(e>=0))throw P(new Nm(`tolerance (`+e+`) must be >= 0`));return e}function eF(){return bRt||(bRt=new c3e,WL(bRt,q(I(l0,1),CY,139,0,[new Mu]))),bRt}function tF(){tF=E,IAt=new Zue(`NO`,0),PAt=new Zue(Dot,1),FAt=new Zue(`LOOK_BACK`,2)}function nF(){nF=E,qSt=new Vue(`ARD`,0),YSt=new Vue(`MSD`,1),JSt=new Vue(`MANUAL`,2)}function rF(){rF=E,k3=new Jue(eZ,0),D3=new Jue(`INPUT`,1),O3=new Jue(`OUTPUT`,2)}function KPe(){return WG(),q(I(oCt,1),$Y,268,0,[tCt,$St,rCt,iCt,nCt,aCt,c2,eCt,QSt])}function qPe(){return _K(),q(I(Vkt,1),$Y,269,0,[zkt,Ikt,Lkt,Nkt,Fkt,Bkt,Rkt,Mkt,Pkt])}function JPe(){return dq(),q(I(bVt,1),$Y,267,0,[o7,s7,hVt,c7,_Vt,yVt,vVt,gVt,a7])}function iF(e,t,n){return DR(e,t),VF(e,n),UP(e,0),WP(e,1),nz(e,!0),tz(e,!0),e}function YPe(e,t){var n;return R(t,45)?e.c.Kc(t):(n=MVe(e,t),FB(e,t),n)}function aF(e,t){var n,r,i,a;for(r=t,i=0,a=r.length;i<a;++i)n=r[i],bA(e,n,e.c.b,e.c)}function XPe(){lle();for(var e=Uht,t=0;t<arguments.length;t++)e.push(arguments[t])}function ZPe(e){var t,n,r,i;for(n=e.a,r=0,i=n.length;r<i;++r)t=n[r],aCe(t,t.length,null)}function oF(e){var t,n;for(n=e.c.Bc().Jc();n.Ob();)t=B(n.Pb(),18),t.$b();e.c.$b(),e.d=0}function sF(e,t){var n=e.gc();if(t<0||t>n)throw P(new hC(t,n));return new r_e(e,t)}function QPe(e,t){var n,r;for(n=0,r=e.gc();n<r;++n)if(XE(t,e.Xb(n)))return n;return-1}function cF(e){var t,n;if(e==0)return 32;for(n=0,t=1;(t&e)==0;t<<=1)++n;return n}function lF(e,t){if(e<0)throw P(new Nm(t+` cannot be negative but was: `+e));return e}function $Pe(e,t){t.Tg(`Hierarchical port constraint processing`,1),MUe(e),irt(e),t.Ug()}function uF(e,t){e.b=r.Math.max(e.b,t.d),e.e+=t.r+(e.a.c.length==0?0:e.c),hx(e.a,t)}function eFe(e){CS(e.c>=0),DHe(e.d,e.c)<0&&(e.a=e.a-1&e.d.a.length-1,e.b=e.d.c),e.c=-1}function tFe(e){var t,n;for(n=new M(hGe(e));n.a<n.c.c.length;)t=B(W(n),692),t.Zf()}function nFe(e,t){var n,r,i=t.c.i;n=B(bE(e.f,i),60),r=n.d.c-n.e.c,hP(t.b,new Zre(r))}function dF(e,t){return kce(aI(e.a,t,tT(Mz(JY,UE(tT(Mz(t==null?0:JF(t),YY)),15)))))}function rFe(e,t,n,r){this.$j(),this.a=t,this.b=e,this.c=null,this.c=new Ige(this,t,n,r)}function fF(e,t,n,r,i){this.d=e,this.n=t,this.g=n,this.o=r,this.p=-1,i||(this.o=-2-r-1)}function iFe(){Lx.call(this),this.n=-1,this.g=null,this.i=null,this.j=null,this.Bb|=tX}function pF(e){Xle(),this.g=new dp,this.f=new dp,this.b=new dp,this.c=new mO,this.i=e}function aFe(){this.f=new Eh,this.d=new Moe,this.c=new Eh,this.a=new up,this.b=new up}function oFe(e){Wy.call(this,e.yd(64)?ape(0,Nz(e.xd(),1)):HY,e.wd()),this.b=1,this.a=e}function sFe(e,t){return SP(),B(Y(t,(Lq(),u6)),15).a<e.gc()&&B(Y(t,u6),15).a>=0}function cFe(){cFe=E,YAt=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function lFe(){lFe=E,XAt=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function mF(){mF=E,ZAt=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function hF(){hF=E,QAt=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function uFe(){uFe=E,$At=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function dFe(){dFe=E,njt=ww(ww(ww(new RE,(zU(),m0),(sY(),R0)),h0,H0),g0,V0)}function gF(){gF=E,ajt=uT(ww(ww(new RE,(zU(),g0),(sY(),Dxt)),_0,bxt),v0,Ext)}function fFe(){fFe=E,Pgt=q(I(q9,1),pX,30,15,[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15])}function _F(e,t){var n=e.b;e.b=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,0,n,e.b))}function pFe(e,t){var n=e.c;e.c=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,1,n,e.c))}function mFe(e,t){var n=e.c;e.c=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,4,n,e.c))}function hFe(e,t){var n=e.c;e.c=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,1,n,e.c))}function vF(e,t){var n=e.d;e.d=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,1,n,e.d))}function yF(e,t){var n=e.k;e.k=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,2,n,e.k))}function bF(e,t){var n=e.D;e.D=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,2,n,e.D))}function xF(e,t){var n=e.f;e.f=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,8,n,e.f))}function SF(e,t){var n=e.i;e.i=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,7,n,e.i))}function gFe(e,t){var n=e.a;e.a=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,8,n,e.a))}function _Fe(e,t){var n=e.b;e.b=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,0,n,e.b))}function CF(e,t,n){var r;e.b=t,e.a=n,r=(e.a&512)==512?new im:new $l,e.c=B2e(r,e.b,e.a)}function vFe(e,t){return NK(e.e,t)?(l_(),IN(t)?new Sw(t,e):new xy(t,e)):new nfe(t,e)}function yFe(e){var t,n;return 0>e?new Fle:(t=e+1,n=new yje(t,e),new Nhe(null,n))}function bFe(e,t){ND();var n=new bg(1);return Dy(e)?LO(n,e,t):xW(n.f,e,t),new of(n)}function xFe(e,t){var n=new et;B(t.b,68),B(t.b,68),B(t.b,68),hP(t.a,new Dye(e,n,t))}function SFe(e,t){var n;return R(t,8)?(n=B(t,8),e.a==n.a&&e.b==n.b):!1}function CFe(e){var t=Y(e,(aY(),q2));return R(t,176)?bVe(B(t,176)):null}function wFe(e){var t;return e=r.Math.max(e,2),t=BLe(e),e>t?(t<<=1,t>0?t:ZY):t}function TFe(e){switch(Fx(e.e!=3),e.e){case 2:return!1;case 0:return!0}return Aje(e)}function EFe(e){var t;return e.b==null?(t_(),t_(),h9):(t=e.sl()?e.rl():e.ql(),t)}function DFe(e,t){var n,r;for(r=t.vc().Jc();r.Ob();)n=B(r.Pb(),45),MH(e,n.jd(),n.kd())}function wF(e,t){var n=e.d;e.d=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,11,n,e.d))}function TF(e,t){var n=e.j;e.j=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,13,n,e.j))}function EF(e,t){var n=e.b;e.b=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,21,n,e.b))}function OFe(e,t){e.r>0&&e.c<e.r&&(e.c+=t,e.i&&e.i.d>0&&e.g!=0&&OFe(e.i,t/e.r*e.i.d))}function DF(e){var t;return k_e(e.f.g,e.d),SS(e.b),e.c=e.a,t=B(e.a.Pb(),45),e.b=tLe(e),t}function kFe(e,t){var n=t==null?-1:uN(e.b,t,0);return n<0?!1:(AF(e,n),!0)}function OF(e,t){var n;return NE(t),n=t.g,e.b[n]?!1:(yE(e.b,n,t),++e.c,!0)}function kF(e,t){var n=1-t,r=e.a[n];return e.a[n]=r.a[t],r.a[t]=e,e.b=!0,r.b=!1,r}function AF(e,t){var n=ij(e.b,e.b.c.length-1);t<e.b.c.length&&(TA(e.b,t,n),AZe(e,t))}function jF(e,t){(MA(),G1?null:t.c).length==0&&Phe(t,new ge),LO(e.a,G1?null:t.c,t)}function AFe(e,t,n){var r,i,a=e.a.length-1;for(i=e.b,r=0;r<n;i=i+1&a,++r)yE(t,r,e.a[i])}function MF(e,t){typeof window===mY&&typeof window.$gwt===mY&&(window.$gwt[e]=t)}function jFe(e,t){kg(fD(new Nw(null,new ZO(new Wd(e.b),1)),new Lde(e,t)),new zde(e,t))}function NF(){NF=E,p0=new Zf(Wat),kyt=new Zf(Gat),f0=new Zf(Kat),d0=new Zf(qat)}function PF(){PF=E,L0=new z_(`TO_INTERNAL_LTR`,0),Vbt=new z_(`TO_INPUT_DIRECTION`,1)}function FF(){FF=E,LNt=new xde(`P1_NODE_PLACEMENT`,0),p6=new xde(`P2_EDGE_ROUTING`,1)}function IF(){IF=E,Z0=new q_(`START`,0),X0=new q_(`MIDDLE`,1),Y0=new q_(`END`,2)}function MFe(e,t,n){Cke.call(this,e,t,n),this.a=new dp,this.b=new dp,this.d=new pie(this)}function NFe(e){rT.call(this),this.b=F(z(Y(e,(nY(),i3)))),this.a=B(Y(e,A4),225)}function LF(e,t){var n=B(Y(e,(nY(),$4)),8),r=B(Y(t,$4),8);return _z(n.b,r.b)}function PFe(e,t){var n,r=new up;n=t;do Sp(r.c,n),n=B(bE(e.k,n),17);while(n);return r}function FFe(e,t,n){var r=new up;return g2e(e,t,r,n,!0,!0),e.b=new QF(r.c.length),r}function IFe(e,t){var n=B(bE(e.c,t),459);return n||(n=new Coe,n.c=t,WE(e.c,n.c,n)),n}function RF(e,t){var n=e.a,r=0;for(var i in n)n.hasOwnProperty(i)&&(t[r++]=i);return t}function zF(e){var t,n;for(n=new jx(e);n.e!=n.i.gc();)t=B(aV(n),19),RP(t,0),zP(t,0)}function LFe(e){var t,n;for(n=e.c.a.ec().Jc();n.Ob();)t=B(n.Pb(),221),kd(t,new gSe(t.f))}function RFe(e){var t,n;for(n=e.c.a.ec().Jc();n.Ob();)t=B(n.Pb(),221),yne(t,new sYe(t.e))}function BF(e,t){var n=e.Nc(),r;for(VM(n,0,n.length,t),r=0;r<n.length;r++)e.fd(r,n[r])}function VF(e,t){var n=e.zb;e.zb=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,1,n,e.zb))}function HF(e,t){var n=(r=new zoe,r),r;n.n=t,gM((!e.s&&(e.s=new V(B7,e,21,17)),e.s),n)}function UF(e,t){var n,r=(n=new jhe,n);r.n=t,gM((!e.s&&(e.s=new V(B7,e,21,17)),e.s),r)}function WF(e,t){var n;return R(t,18)?(n=B(t,18),e.Fc(n)):gNe(e,B(gE(t),22).Jc())}function GF(e,t){var n=e.xb;e.xb=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,3,n,e.xb))}function KF(e,t){var n=e.yb;e.yb=t,e.Db&4&&!(e.Db&1)&&II(e,new kT(e,1,2,n,e.yb))}function qF(e,t){t.Tg(got,1),kg(LN(new Nw(null,new ZO(e.b,16)),new Bt),new ree),t.Ug()}function JF(e){return Dy(e)?UL(e):Ey(e)?ib(e):Ty(e)?Rhe(e):Xxe(e)?e.Hb():Rxe(e)?dS(e):ETe(e)}function YF(e,t){var n,r,i;for(NE(t),n=!1,i=t.Jc();i.Ob();)r=i.Pb(),n|=e.Ec(r);return n}function zFe(e){var t=0,n,r;for(r=e.Jc();r.Ob();)n=r.Pb(),t+=n==null?0:JF(n),t=~~t;return t}function BFe(e){var t;return e==0?`UTC`:(e<0?(e=-e,t=`UTC+`):t=`UTC-`,t+VN(e))}function VFe(e){return e.a<54?e.f<0?-1:e.f>0?1:0:(!e.c&&(e.c=qO(BI(e.f))),e.c).e}function HFe(e,t){t?e.B??(e.B=e.D,e.D=null):e.B!=null&&(e.D=e.B,e.B=null)}function XF(e,t,n,r,i,a,o,s,c,l,u,d,f){return sZe(e,t,n,r,i,a,o,s,c,l,u,d,f),Ez(e,!1),e}function ZF(e,t,n,r,i,a){var o;this.c=e,o=new up,qWe(e,o,t,e.b,n,r,i,a),this.a=new bk(o,0)}function UFe(){this.c=new Uh(0),this.b=new Uh(klt),this.d=new Uh(Dlt),this.a=new Uh(Olt)}function WFe(e){this.e=e,this.d=new zh(zI(pT(this.e).gc())),this.c=this.e.a,this.b=this.e.c}function QF(e){this.b=e,this.a=G(q9,pX,30,e+1,15,1),this.c=G(q9,pX,30,e,15,1),this.d=0}function GFe(){return aq(),q(I(cAt,1),$Y,246,0,[oAt,w3,T3,rAt,iAt,nAt,aAt,sAt,S3,C3])}function $F(){return RK(),q(I(GCt,1),$Y,262,0,[HCt,m2,h2,UCt,g2,_2,v2,f2,p2,WCt])}function eI(e,t){return F(z(Ux(XR(dD(new Nw(null,new ZO(e.c.b,16)),new Pf(e)),t))))}function tI(e,t){return F(z(Ux(XR(dD(new Nw(null,new ZO(e.c.b,16)),new nie(e)),t))))}function KFe(e,t){return ex(),$P(tZ),r.Math.abs(0-t)<=tZ||t==0?0:e/t}function qFe(e,t){return bL(),e==b0&&t==C0||e==C0&&t==b0||e==S0&&t==x0||e==x0&&t==S0}function nI(e,t){return bL(),e==b0&&t==x0||e==b0&&t==S0||e==C0&&t==S0||e==C0&&t==x0}function JFe(e,t,n){var r=0,i,a;for(i=0;i<n;i++)a=t[i],e[i]=a<<1|r,r=a>>>31;r!=0&&(e[n]=r)}function rI(e,t,n){var r,i;for(i=tV(e,0);i.b!=i.d.c;)r=B(Lk(i),8),r.a+=t,r.b+=n;return e}function iI(e,t,n){var r;for(r=e.b[n&e.f];r;r=r.b)if(n==r.a&&jE(t,r.g))return r;return null}function aI(e,t,n){var r;for(r=e.c[n&e.f];r;r=r.d)if(n==r.f&&jE(t,r.i))return r;return null}function oI(e,t){var n=B(Z(e,(rW(),DPt)),15),r=B(Z(t,DPt),15);return Yb(n.a,r.a)}function sI(e,t){var n;t.Tg(`General Compactor`,1),n=DVe(B(Z(e,(rW(),bPt)),387)),n.Bg(e)}function YFe(e,t,n){n.Tg(`DFS Treeifying phase`,1),$Ve(e,t),Z0e(e,t),e.a=null,e.b=null,n.Ug()}function cI(e,t,n,r){var i=new ym;MD(i,`x`,rU(e,t,r.a)),MD(i,`y`,iU(e,t,r.b)),OE(n,i)}function XFe(e,t,n,r){var i=new ym;MD(i,`x`,rU(e,t,r.a)),MD(i,`y`,iU(e,t,r.b)),OE(n,i)}function lI(){lI=E,m9=new Boe,aUt=q(I(B7,1),K$,182,0,[]),iUt=q(I(K7,1),bmt,62,0,[])}function uI(){uI=E,Jxt=new qS(`edgelabelcenterednessanalysis.includelabel`,(Rx(),E1))}function dI(){dI=E,Fbt=new jt,Nbt=new Mt,Pbt=new Nt,Mbt=new Pt,Ibt=new eee,Lbt=new tee}function ZFe(e,t){t.Tg(got,1),oVe(Kle(new hf((Rg(),new hD(e,!1,!1,new kt))))),t.Ug()}function fI(e){var t=bke(e);return Oy(t.a,0)?(Tg(),Tg(),y_t):(Tg(),new $me(t.b))}function pI(e){var t=bke(e);return Oy(t.a,0)?(Tg(),Tg(),y_t):(Tg(),new $me(t.c))}function QFe(e){var t=Ok(e);return Oy(t.a,0)?(Eg(),Eg(),b_t):(Eg(),new ehe(t.b))}function mI(e){return e.b.c.i.k==(UG(),A0)?B(Y(e.b.c.i,(aY(),q2)),12):e.b.c}function $Fe(e){return e.b.d.i.k==(UG(),A0)?B(Y(e.b.d.i,(aY(),q2)),12):e.b.d}function hI(e){switch(e.g){case 2:return GJ(),Z5;case 4:return GJ(),j5;default:return e}}function eIe(e){switch(e.g){case 1:return GJ(),Y5;case 3:return GJ(),M5;default:return e}}function tIe(e,t){var n=DJe(e);return VW(new Pv(n.c,n.d),new Pv(n.b,n.a),e.Kf(),t,e.$f())}function nIe(e){var t,n,r=0;for(n=new M(e.b);n.a<n.c.c.length;)t=B(W(n),26),t.p=r,++r}function gI(e,t){var n,r;for(NE(t),r=t.vc().Jc();r.Ob();)n=B(r.Pb(),45),e.yc(n.jd(),n.kd())}function rIe(e,t,n){var r;for(r=n.Jc();r.Ob();)if(!Gk(e,t,r.Pb()))return!1;return!0}function iIe(e,t){var n;for(gE(t);e.Ob();)if(n=e.Pb(),!aL(B(n,9)))return!1;return!0}function _I(e,t,n,r,i){var a;return n&&(a=pB(t.Ah(),e.c),i=n.Oh(t,-1-(a==-1?r:a),null,i)),i}function aIe(e,t,n,r,i){var a;return n&&(a=pB(t.Ah(),e.c),i=n.Qh(t,-1-(a==-1?r:a),null,i)),i}function oIe(e){var t;if(e.b==-2){if(e.e==0)t=-1;else for(t=0;e.a[t]==0;t++);e.b=t}return e.b}function vI(e){if(NE(e),e.length==0)throw P(new th(`Zero length BigInteger`));u6e(this,e)}function yI(e){this.i=e.gc(),this.i>0&&(this.g=this.$i(this.i+(this.i/8|0)+1),e.Oc(this.g))}function bI(e,t,n){this.g=e,this.d=t,this.e=n,this.a=new up,FZe(this),ND(),Qb(this.a,null)}function xI(e,t,n,r,i,a,o){lg.call(this,e,t),this.d=n,this.e=r,this.c=i,this.b=a,this.a=nj(o)}function SI(e,t){t.q=e,e.d=r.Math.max(e.d,t.r),e.b+=t.d+(e.a.c.length==0?0:e.c),hx(e.a,t)}function CI(e,t){var n,r,i=e.c,a;return n=e.c+e.b,a=e.d,r=e.d+e.a,t.a>i&&t.a<n&&t.b>a&&t.b<r}function wI(e,t){var n,r;for(r=tV(e,0);r.b!=r.d.c;)n=B(Lk(r),8),n.a+=t.a,n.b+=t.b;return e}function sIe(e,t){return t<e.b.gc()?B(e.b.Xb(t),9):t==e.b.gc()?e.a:B(Pw(e.e,t-e.b.gc()-1),9)}function TI(e,t){return Rx(),Dy(e)?Vje(e,BS(t)):Ey(e)?oSe(e,z(t)):Ty(e)?aSe(e,zS(t)):e.Dd(t)}function EI(e,t){var n;R(t,93)?(B(e.c,78).Ek(),n=B(t,93),DFe(e,n)):B(e.c,78).Wb(t)}function cIe(e,t,n,r){R(e.Cb,187)&&(B(e.Cb,187).tb=null),VF(e,n),t&&mQe(e,t),r&&e.el(!0)}function DI(e,t){var n,r;for(NE(t),r=e.vc().Jc();r.Ob();)n=B(r.Pb(),45),t.Wd(n.jd(),n.kd())}function lIe(e){var t,n,r;return e.j==(GJ(),M5)&&(t=lG(e),n=Vx(t,j5),r=Vx(t,Z5),r||r&&n)}function uIe(){uIe=E,ojt=IB(ffe(ww(ww(new RE,(zU(),g0),(sY(),Dxt)),_0,bxt),v0),Ext)}function dIe(){dIe=E,fjt=IB(ffe(ww(ww(new RE,(zU(),g0),(sY(),Dxt)),_0,bxt),v0),Ext)}function fIe(){fIe=E,Abt=CR((UG(),q(I(kbt,1),$Y,252,0,[P0,M0,A0,F0,j0,k0,I0,N0])))}function pIe(){pIe=E,LSt=CR((UK(),q(I(ISt,1),$Y,277,0,[kSt,MSt,OSt,FSt,jSt,ASt,PSt,NSt])))}function mIe(){mIe=E,TRt=CR((fW(),q(I(wRt,1),$Y,287,0,[CRt,K6,X6,Q6,q6,J6,Y6,Z6])))}function hIe(){hIe=E,gHt=CR((mG(),q(I(j7,1),$Y,235,0,[hHt,pHt,A7,k7,mHt,dHt,uHt,fHt])))}function gIe(){return oq(),q(I(vMt,1),$Y,265,0,[_Mt,uMt,mMt,hMt,pMt,lMt,gMt,sMt,fMt,dMt,cMt])}function OI(){OI=E,WPt=new wde(KZ,0),GPt=new wde(`POLAR_COORDINATE`,1),UPt=new wde(`ID`,2)}function kI(){kI=E,c0=new qS(`debugSVG`,(Rx(),!1)),Hvt=new qS(`overlapsExisted`,!0)}function _Ie(){var e;return F_t||(F_t=new loe,e=new bje(``),Xfe(e,(Dg(),P_t)),jF(F_t,e)),F_t}function vIe(e){return tC(),e.A.Gc((jB(),e7))&&!e.B.Gc((dq(),s7))?IVe(e):null}function yIe(e,t){var n=w3e(eF(),e);return n?(mV(t,(oY(),M8),n),!0):!1}function AI(e,t){var n;for(n=0;n<t.j.c.length;n++)B(xN(e,n),24).Fc(B(xN(t,n),18));return e}function bIe(e,t){var n,r;for(r=new M(t.b);r.a<r.c.c.length;)n=B(W(r),26),e.a[n.p]=aYe(n)}function jI(e){this.f=e,this.e=new EA(this.f.i),this.a=this.e,this.b=tLe(this),this.d=this.f.g}function MI(e,t){pw.call(this,lUt,e,t),this.b=this,this.a=TK(e.Ah(),YN(this.e.Ah(),this.c))}function xIe(){this.a=B(iV((xq(),oyt)),15).a,this.c=F(z(iV(Syt))),this.b=F(z(iV(vyt)))}function NI(e,t){e.a=jz(e.a,1),e.c=r.Math.min(e.c,t),e.b=r.Math.max(e.b,t),e.d=jz(e.d,t)}function PI(e,t,n,r){var i=e.a.length;n>i?n=i:XO(t,n+1),e.a=tO(e.a,0,t)+(``+r)+ECe(e.a,n)}function FI(e,t,n){var r,i=B(TC(e.d,t),15);return r=B(TC(e.b,n),15),!i||!r?null:wj(e,i.a,r.a)}function SIe(e,t,n){return _z(Sx($B(e),new Pv(t.e.a,t.e.b)),Sx($B(e),new Pv(n.e.a,n.e.b)))}function CIe(e,t,n){return e==(yR(),cjt)?new Wi:YG(t,1)==0?new fce(n.length):new dce(n.length)}function II(e,t){var n=e.qh(),r,i;if(n!=null&&e.th())for(r=0,i=n.length;r<i;++r)n[r].bj(t)}function LI(e,t){for(var n=e,r=PE(n).e;r;){if(n=r,n==t)return!0;r=PE(n).e}return!1}function RI(e){var t=e.h;return t==0?e.l+e.m*vX:t==gX?e.l+e.m*vX-yX:e}function wIe(e,t,n){var r=e.a.f[t.p],i=e.a.f[n.p];return r<i?-1:r==i?0:1}function zI(e){return e<3?(lF(e,$rt),e+1):e<ZY?wO(r.Math.ceil(e/.75)):vY}function BI(e){return xX<e&&e<yX?e<0?r.Math.ceil(e):r.Math.floor(e):RI(D0e(e))}function TIe(e){switch(e.a.g){case 1:return new ry;case 3:return new vGe;default:return new ene}}function VI(e,t){var n;return(e.Db&t)==0?null:(n=iGe(e,t),n==-1?e.Eb:kP(e.Eb)[n])}function EIe(e){var t;if(e.a==e.b.a)throw P(new jp);return t=e.a,e.c=t,e.a=B(ME(e.a.e),229),t}function DIe(e){var t;e.d==null?(++e.e,e.f=0,xze(null)):(++e.e,t=e.d,e.d=null,e.f=0,xze(t))}function OIe(e,t){var n,r;for(r=new M(t);r.a<r.c.c.length;)n=B(W(r),70),hx(e.d,n),oYe(e,n)}function kIe(e,t){var n,r;for(r=new jx(e);r.e!=r.i.gc();)n=B(aV(r),19),Ob(n,n.i+t.b,n.j+t.d)}function HI(e,t){var n=(r=new Fu,r),r;return n.G=t,!e.rb&&(e.rb=new MT(e,H7,e)),gM(e.rb,n),n}function UI(e,t){var n=(r=new Np,r),r;return n.G=t,!e.rb&&(e.rb=new MT(e,H7,e)),gM(e.rb,n),n}function WI(e){var t,n,r=0;for(n=new xg(e.a);n.a<n.c.a.length;)t=Qk(n),e.b.Gc(t)&&++r;return r}function AIe(e){var t=1,n,r;for(r=e.Jc();r.Ob();)n=r.Pb(),t=31*t+(n==null?0:JF(n)),t=~~t;return t}function GI(e){var t;return e<128?(cxe(),t=Mgt[e],!t&&(t=Mgt[e]=new Une(e)),t):new Une(e)}function KI(e){var t;if(e.g>1||e.Ob())return++e.a,e.g=0,t=e.i,e.Ob(),t;throw P(new jp)}function jIe(e){Hb();var t;return f_(Njt,e)||(t=new ca,t.a=e,sge(Njt,e,t)),B(ZE(Njt,e),642)}function qI(e){var t,n,r,i=e;return r=0,i<0&&(i+=yX,r=gX),n=wO(i/vX),t=wO(i-n*vX),Xb(t,n,r)}function MIe(e,t){var n=e.a.get(t);return n===void 0?++e.d:(uge(e.a,t),--e.c,++e.b.g),n}function JI(e,t){var n;return t?(n=t.lf(),n.dc()||(e.q?gI(e.q,n):e.q=new Efe(n)),e):e}function NIe(e,t){var n=t.p-e.p,r,i;return n==0?(r=e.f.a*e.f.b,i=t.f.a*t.f.b,_z(r,i)):n}function PIe(e,t){switch(t){case 1:return!!e.n&&e.n.i!=0;case 2:return e.k!=null}return TOe(e,t)}function FIe(e){return e.b.c.length!=0&&B(Pw(e.b,0),70).a?B(Pw(e.b,0),70).a:zwe(e)}function IIe(e,t){var n;try{t.be()}catch(t){if(t=lL(t),R(t,81))n=t,Sp(e.c,n);else throw P(t)}}function LIe(e,t){var n;t.Tg(`Edge and layer constraint edge reversal`,1),n=Q4e(e),itt(n),t.Ug()}function RIe(e,t){var n=e.j,r=t.j;return n==r?e.p==t.p?0:n==(GJ(),M5)?e.p-t.p:t.p-e.p:n.g-r.g}function YI(e,t){this.b=e,this.e=t,this.d=t.j,this.f=(l_(),B(e,69).vk()),this.k=TK(t.e.Ah(),e)}function XI(e,t,n){this.b=(NE(e),e),this.d=(NE(t),t),this.e=(NE(n),n),this.c=this.d+(``+this.e)}function zIe(e,t,n,r,i){RL.call(this,e,n,r,i),this.f=G(O0,QZ,9,t.a.c.length,0,1),JB(t.a,this.f)}function ZI(e,t,n,r,i){yE(e.c[t.g],n.g,r),yE(e.c[n.g],t.g,r),yE(e.b[t.g],n.g,i),yE(e.b[n.g],t.g,i)}function BIe(e,t){e.c&&(B3e(e,t,!0),kg(new Nw(null,new ZO(t,16)),new Ff(e))),B3e(e,t,!1)}function QI(e){this.n=new up,this.e=new Sg,this.j=new Sg,this.k=new up,this.f=new up,this.p=e}function VIe(e){e.r=new Vp,e.w=new Vp,e.t=new up,e.i=new up,e.d=new Vp,e.a=new Sb,e.c=new dp}function $I(){$I=E,o0=new D_(`UP`,0),a0=new D_(Aat,1),Ivt=new D_(ZX,2),Lvt=new D_(QX,3)}function eL(){eL=E,xAt=new Yue(`EQUALLY`,0),SAt=new Yue(`NORTH`,1),CAt=new Yue(`NORTH_SOUTH`,2)}function tL(){tL=E,qCt=new Uue(`ONE_SIDED`,0),JCt=new Uue(`TWO_SIDED`,1),y2=new Uue(`OFF`,2)}function HIe(){HIe=E,xVt=CR((dq(),q(I(bVt,1),$Y,267,0,[o7,s7,hVt,c7,_Vt,yVt,vVt,gVt,a7])))}function UIe(){UIe=E,XBt=CR((vG(),q(I(m5,1),$Y,96,0,[o5,a5,c5,p5,f5,d5,l5,u5,s5])))}function WIe(){WIe=E,sCt=CR((WG(),q(I(oCt,1),$Y,268,0,[tCt,$St,rCt,iCt,nCt,aCt,c2,eCt,QSt])))}function GIe(){GIe=E,Hkt=CR((_K(),q(I(Vkt,1),$Y,269,0,[zkt,Ikt,Lkt,Nkt,Fkt,Bkt,Rkt,Mkt,Pkt])))}function nL(){nL=E,G0=new G_(XX,0),K0=new G_(ZX,1),q0=new G_(QX,2),pSt=new G_(`TOP`,3)}function rL(){rL=E,zAt=new Que(`OFF`,0),N3=new Que(`SINGLE_EDGE`,1),M3=new Que(`MULTI_EDGE`,2)}function iL(){iL=E,wLt=new jde(`MINIMUM_SPANNING_TREE`,0),CLt=new jde(`MAXIMUM_SPANNING_TREE`,1)}function KIe(e,t,n){var r,i=B(Y(e,(nY(),F4)),79);i&&(r=new em,aR(r,0,i),wI(r,n),YF(t,r))}function aL(e){var t=B(Y(e,(aY(),M2)),64);return e.k==(UG(),A0)&&(t==(GJ(),Z5)||t==j5)}function qIe(e){var t;if(e){if(t=e,t.dc())throw P(new jp);return t.Xb(t.gc()-1)}return yDe(e.Jc())}function JIe(e,t,n,r){return n==1?(!e.n&&(e.n=new V(w7,e,1,7)),gV(e.n,t,r)):vYe(e,t,n,r)}function oL(e,t){var n,r=(n=new Sc,n);return VF(r,t),gM((!e.A&&(e.A=new Ox(X7,e,7)),e.A),r),r}function YIe(e,t,n){var r,i,a=null;return i=jk(t,Bft),r=new Ude(e,n),a=(XKe(r.a,r.b,i),i),a}function sL(e,t,n){var r,i,a,o=PE(e);r=o.d,i=o.c,a=e.n,t&&(a.a=a.a-r.b-i.a),n&&(a.b=a.b-r.d-i.b)}function XIe(e,t){var n=e.l+t.l,r=e.m+t.m+(n>>22),i=e.h+t.h+(r>>22);return Xb(n&hX,r&hX,i&gX)}function ZIe(e,t){var n=e.l-t.l,r=e.m-t.m+(n>>22),i=e.h-t.h+(r>>22);return Xb(n&hX,r&hX,i&gX)}function cL(e,t){var n,r;for(NE(t),r=t.Jc();r.Ob();)if(n=r.Pb(),!e.Gc(n))return!1;return!0}function QIe(e){var t;return(!e.a||!(e.Bb&1)&&e.a.Sh())&&(t=EH(e),R(t,160)&&(e.a=B(t,160))),e.a}function lL(e){var t;return R(e,81)?e:(t=e&&e.__java$exception,t||(t=new _R(e),$ae(t)),t)}function $Ie(e){if(R(e,196))return B(e,127);if(e)return null;throw P(new Fm(apt))}function eLe(e){switch(e.g){case 0:return new Vo;case 1:return new Ho;case 2:default:return null}}function tLe(e){return e.a.Ob()?!0:e.a==e.e?(e.a=new uM(e.f.f),e.a.Ob()):!1}function nLe(e,t){if(t==null)return!1;for(;e.a!=e.b;)if(ZR(t,AR(e)))return!0;return!1}function rLe(e,t){return!e||!t||e==t?!1:gHe(e.d.c,t.d.c+t.d.b)&&gHe(t.d.c,e.d.c+e.d.b)}function iLe(){return MA(),G1?new bje(null):ZQe(_Ie(),`com.google.common.base.Strings`)}function uL(e,t){var n=t.Nc();return n.length==0?!1:(wbe(e.c,e.c.length,n),!0)}function aLe(e,t){var n=e.c,r=t.e[e.p];return r<n.a.c.length-1?B(Pw(n.a,r+1),9):null}function oLe(e){var t,n;for($q(e),n=new M(e.d);n.a<n.c.c.length;)t=B(W(n),108),t.i&&nXe(t)}function sLe(e,t){var n,r;for(r=new M(e.b);r.a<r.c.c.length;)n=B(W(r),70),J(n,(aY(),z2),t)}function dL(e,t,n){var r,i;for(i=new M(e.b);i.a<i.c.c.length;)r=B(W(i),19),Ob(r,r.i+t,r.j+n)}function fL(e){var t=new Sg,n,r;for(r=tV(e.d,0);r.b!=r.d.c;)n=B(Lk(r),65),gw(t,n.c);return t}function cLe(e){var t=1,n,r,i;for(n=0,i=e.gc();n<i;++n)r=e.Ti(n),t=31*t+(r==null?0:JF(r));return t}function lLe(e){var t,n=(t=new Sc,t);return VF(n,`T`),gM((!e.d&&(e.d=new Ox(X7,e,11)),e.d),n),n}function uLe(e,t){var n=_S(t.a.gc());return kg(sP(new Nw(null,new ZO(t,1)),e.i),new Pde(e,n)),n}function pL(e,t,n,r){var i;return wk(t,e.e.Pd().gc()),wk(n,e.c.Pd().gc()),i=e.a[t][n],yE(e.a[t],n,r),i}function dLe(e,t,n,r){B(n.b,68),B(n.b,68),B(r.b,68),B(r.b,68),B(r.b,68),hP(r.a,new Eye(e,t,r))}function fLe(e,t){e.d==(cz(),B8)||e.d==U8?B(t.a,60).c.Ec(B(t.b,60)):B(t.b,60).c.Ec(B(t.a,60))}function pLe(e,t){this.c=e,this.d=t,this.b=this.d/this.c.c.Pd().gc()|0,this.a=this.d%this.c.c.Pd().gc()}function mLe(e,t,n,i,a){return zK(),r.Math.min(vet(e,t,n,i,a),vet(n,i,e,t,AS(new Pv(a.a,a.b))))}function hLe(e,t){if(!e)throw P(new Nm(QK(`value already present: %s`,q(I(v1,1),CY,1,5,[t]))))}function gLe(e,t,n){var r;wT(e.a),hP(n.i,new qie(e)),r=new $b(B(bE(e.a,t.b),68)),IHe(e,r,t),n.f=r}function mL(e){var t;Hq(e,!0),t=lX,TS(e,(nY(),e3))&&(t+=B(Y(e,e3),15).a),J(e,e3,UR(t))}function _Le(e){var t,n,r,i=new up;for(r=e.Jc();r.Ob();)n=B(r.Pb(),19),t=IK(n),uL(i,t);return i}function hL(e){var t,n=(Mh(),t=new Gs,t);return e&&gM((!e.a&&(e.a=new V(v7,e,6,6)),e.a),n),n}function gL(e,t){var n,r=0;if(e<64&&e<=t)for(t=t<64?t:63,n=e;n<=t;n++)r=sk(r,vT(1,n));return r}function _L(e){switch(e.g){case 1:return n5;case 2:return t5;case 3:return r5;default:return i5}}function vLe(e){switch(B(Y(e,(nY(),I4)),166).g){case 2:case 4:return!0;default:return!1}}function yLe(e,t){switch(t){case 0:!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),e.o.c.$b();return}CXe(e,t)}function vL(e,t){var n,r;for(RD(t,`predicate`),r=0;e.Ob();r++)if(n=e.Pb(),t.Lb(n))return r;return-1}function bLe(e){ND();var t,n,r=0;for(n=e.Jc();n.Ob();)t=n.Pb(),r+=t==null?0:JF(t),r|=0;return r}function xLe(e){var t=new S;return t.a=e,t.b=VLe(e),t.c=G(I1,LY,2,2,6,1),t.c[0]=BFe(e),t.c[1]=BFe(e),t}function q(e,t,n,r,i){return i.Pm=e,i.Qm=t,i.Rm=T,i.__elementTypeId$=n,i.__elementTypeCategory$=r,i}function SLe(e,t,n,r){return new u_(q(I(S1,1),GY,45,0,[(AWe(e,t),new cg(e,t)),(AWe(n,r),new cg(n,r))]))}function yL(){yL=E,Qxt=new B_(KZ,0),Xxt=new B_(Sot,1),Zxt=new B_(Cot,2),W0=new B_(`BOTH`,3)}function bL(){bL=E,b0=new I_(`Q1`,0),C0=new I_(`Q4`,1),x0=new I_(`Q2`,2),S0=new I_(`Q3`,3)}function xL(){xL=E,x2=new Wue(`ONLY_WITHIN_GROUP`,0),ZCt=new Wue(tot,1),b2=new Wue(`ENFORCED`,2)}function SL(){SL=E,fCt=new Q_(KZ,0),l2=new Q_(`INCOMING_ONLY`,1),u2=new Q_(`OUTGOING_ONLY`,2)}function CL(){CL=E,new Zf(`org.eclipse.elk.addLayoutConfig`),pRt=new Wo,fRt=new Jo,mRt=new lte}function wL(){wL=E,wgt={boolean:Nle,number:bse,string:xse,object:gZe,function:gZe,undefined:gp}}function CLe(){CLe=E,lAt=CR((aq(),q(I(cAt,1),$Y,246,0,[oAt,w3,T3,rAt,iAt,nAt,aAt,sAt,S3,C3])))}function wLe(){wLe=E,KCt=CR((RK(),q(I(GCt,1),$Y,262,0,[HCt,m2,h2,UCt,g2,_2,v2,f2,p2,WCt])))}function TLe(e){var t,n,r,i;for(n=e.a,r=0,i=n.length;r<i;++r)t=n[r],$Le(e,t,(GJ(),Y5)),$Le(e,t,M5)}function ELe(e){var t,n=e.n,r=e.o;return t=e.d,new yD(n.a-t.b,n.b-t.d,r.a+(t.b+t.c),r.b+(t.d+t.a))}function DLe(e,t){return!e||!t||e==t?!1:oB(e.b.c,t.b.c+t.b.b)<0&&oB(t.b.c,e.b.c+e.b.b)<0}function TL(e,t,n){return e>=128?!1:Ay(e<64?ok(vT(1,e),n):ok(vT(1,e-64),t),0)}function EL(e,t,n){var r=e.gc();if(t>r)throw P(new hC(t,r));return e.Qi()&&(n=DO(e,n)),e.Ci(t,n)}function OLe(e,t){return kq(B(B(bE(e.g,t.a),49).a,68),B(B(bE(e.g,t.b),49).a,68))}function DL(e){var t=~e.l+1&hX,n=~e.m+(t==0?1:0)&hX;return Xb(t,n,~e.h+(t==0&&n==0?1:0)&gX)}function kLe(e){zK();var t,n=G(e8,LY,8,2,0,1),r=0;for(t=0;t<2;t++)r+=.5,n[t]=PV(r,e);return n}function ALe(e,t){var n=!1,r=e.a[t].length,i,a;for(a=0;a<r-1;a++)i=a+1,n|=iHe(e,t,a,i);return n}function jLe(e){var t,n=new dj;return JI(n,e),J(n,(NF(),p0),e),t=new dp,d5e(e,n,t),Jet(e,n,t),n}function J(e,t,n){return n==null?(!e.q&&(e.q=new dp),sj(e.q,t)):(!e.q&&(e.q=new dp),WE(e.q,t,n)),e}function OL(e,t,n){return n==null?(!e.q&&(e.q=new dp),sj(e.q,t)):(!e.q&&(e.q=new dp),WE(e.q,t,n)),e}function MLe(e,t){return Sx($B(B(Y(t,(Lq(),l6)),87)),new Pv(e.c.e.a-e.b.e.a,e.c.e.b-e.b.e.b))<=0}function kL(e,t){this.b=e,Qy.call(this,(B(K(ID((lE(),Q7).o),10),20),t.i),t.g),this.a=(lI(),aUt)}function NLe(e,t,n){this.q=new r.Date,this.q.setFullYear(e+fX,t,n),this.q.setHours(0,0,0,0),Wq(this,0)}function PLe(){++Jht,this.o=null,this.k=null,this.j=null,this.d=null,this.b=null,this.n=null,this.a=null}function FLe(e,t){for(;e.g==null&&!e.c?EO(e):e.g==null||e.i!=0&&B(e.g[e.i-1],51).Ob();)t.Bi(HG(e))}function AL(e,t,n){switch(n.g){case 2:e.b=t;break;case 1:e.c=t;break;case 4:e.d=t;break;case 3:e.a=t}}function ILe(e,t){switch(t){case 7:return!!e.e&&e.e.i!=0;case 8:return!!e.d&&e.d.i!=0}return wVe(e,t)}function LLe(e){var t=e.t-e.k[e.o.p]*e.d+e.j[e.o.p]>e.f,n=e.u+e.e[e.o.p]*e.d>e.f*e.s*e.d;return t||n}function jL(e){var t=e.a[e.b];return t==null?null:(yE(e.a,e.b,null),e.b=e.b+1&e.a.length-1,t)}function RLe(e,t,n){var r=new cM(t,n),i=new fe;return e.b=P2e(e,e.b,r,i),i.b||++e.c,e.b.b=!1,i.d}function zLe(e){var t,n=JW(e.h);return n==32?(t=JW(e.m),t==32?JW(e.l)+32:t+20-10):n-12}function BLe(e){var t;if(e<0)return aX;if(e==0)return 0;for(t=ZY;(t&e)==0;t>>=1);return t}function VLe(e){var t;return e==0?`Etc/GMT`:(e<0?(e=-e,t=`Etc/GMT-`):t=`Etc/GMT+`,t+VN(e))}function HLe(e){var t;return(!e.c||!(e.Bb&1)&&e.c.Db&64)&&(t=EH(e),R(t,89)&&(e.c=B(t,29))),e.c}function ML(e){var t,n;for(n=new M(e.a.b);n.a<n.c.c.length;)t=B(W(n),84),t.g.c=-t.g.c-t.g.b;fK(e)}function NL(e){var t,n;for(n=new M(e.a.b);n.a<n.c.c.length;)t=B(W(n),60),t.d.c=-t.d.c-t.d.b;A0e(e)}function ULe(e){var t=B(e.e&&e.e(),10),n;return new AC(t,(n=t.slice(),B(gN(n,t),10)),t.length)}function WLe(e){var t=~e.l+1&hX,n=~e.m+(t==0?1:0)&hX,r=~e.h+(t==0&&n==0?1:0)&gX;e.l=t,e.m=n,e.h=r}function PL(e){var t=new Eh,n,r,i,a;for(r=e,i=0,a=r.length;i<a;++i)n=r[i],t.a+=n.a,t.b+=n.b;return t}function GLe(e,t){ND();var n,r,i,a,o=!1;for(r=t,i=0,a=r.length;i<a;++i)n=r[i],o|=e.Ec(n);return o}function KLe(e,t,n){var r,i,a=null;return i=jk(t,`labels`),r=new Yde(e,n),a=(U$e(r.a,r.b,i),i),a}function qLe(e,t,n){var r=new up;return g2e(e,t,r,(GJ(),j5),!0,!1),g2e(e,n,r,Z5,!1,!1),r}function JLe(e,t,n,r){var i=d1e(e,t,n,r);return!i&&(i=rBe(e,n,r),i&&!DJ(e,t,i))?null:i}function YLe(e,t,n,r){var i=xG(e,t,n,r);return!i&&(i=oz(e,n,r),i&&!DJ(e,t,i))?null:i}function XLe(e,t){var n;for(n=0;n<e.a.a.length;n++)if(!B(pxe(e.a,n),181).Lb(t))return!1;return!0}function ZLe(e,t,n){if(gE(t),n.Ob())for(Ny(t,BCe(n.Pb()));n.Ob();)Ny(t,e.a),Ny(t,BCe(n.Pb()));return t}function QLe(e){ND();var t,n,r=1;for(n=e.Jc();n.Ob();)t=n.Pb(),r=31*r+(t==null?0:JF(t)),r|=0;return r}function $Le(e,t,n){var r,i,a,o=$R(t,n);for(a=0,i=o.Jc();i.Ob();)r=B(i.Pb(),12),WE(e.c,r,UR(a++))}function FL(e){var t,n;for(n=new M(e.a.b);n.a<n.c.c.length;)t=B(W(n),84),t.f.$b();mse(e.b,e),B0e(e)}function IL(e){var t;return IE(e),t=new ye,e.a.zd(t)?(mx(),new fse(NE(t.a))):(mx(),mx(),v_t)}function eRe(e){var t;return e.b<=0?!1:(t=sb(`MLydhHmsSDkK`,AU(YE(e.c,0))),t>1||t>=0&&e.b<3)}function tRe(e,t,n){return!qh(fD(new Nw(null,new ZO(e.c,16)),new uf(new Rde(t,n)))).zd((Og(),J1))}function nRe(e,t,n){this.g=e,this.e=new Eh,this.f=new Eh,this.d=new Sg,this.b=new Sg,this.a=t,this.c=n}function LL(e,t,n,r){this.b=new up,this.n=new up,this.i=r,this.j=n,this.s=e,this.t=t,this.r=0,this.d=0}function RL(e,t,n,r){this.b=new dp,this.g=new dp,this.d=(bR(),Gkt),this.c=e,this.e=t,this.d=n,this.a=r}function rRe(e,t,n){e.g=MXe(e,t,(GJ(),j5),e.b),e.d=MXe(e,n,j5,e.b),!(e.g.c==0||e.d.c==0)&&uYe(e)}function iRe(e,t,n){e.g=MXe(e,t,(GJ(),Z5),e.j),e.d=MXe(e,n,Z5,e.j),!(e.g.c==0||e.d.c==0)&&uYe(e)}function aRe(e,t,n,r,i){var a=gG(e,t);return n&&WLe(a),i&&(e=XWe(e,t),T1=r?DL(e):Xb(e.l,e.m,e.h)),a}function oRe(e,t,n,r,i){var a,o=e.length;if(a=n.length,t<0||r<0||i<0||t+i>o||r+i>a)throw P(new wp)}function sRe(e,t){cw(e>=0,`Negative initial capacity`),cw(t>=0,`Non-positive load factor`),wT(this)}function zL(){zL=E,sSt=new zn,cSt=new Bn,oSt=new Vn,aSt=new Hn,iSt=new Un,rSt=(NE(iSt),new re)}function BL(){BL=E,xMt=new vde(KZ,0),bMt=new vde(`MIDDLE_TO_MIDDLE`,1),X3=new vde(`AVOID_OVERLAP`,2)}function cRe(e,t,n){switch(t){case 0:!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),EI(e.o,n);return}TW(e,t,n)}function lRe(e,t){switch(t.g){case 0:R(e.b,638)||(e.b=new xIe);break;case 1:R(e.b,639)||(e.b=new Vbe)}}function uRe(e){switch(e.g){case 0:return new Zo;default:throw P(new Nm(Kut+(e.f==null?``+e.g:e.f)))}}function dRe(e){switch(e.g){case 0:return new Yo;default:throw P(new Nm(Kut+(e.f==null?``+e.g:e.f)))}}function VL(e){switch(e.g){case 0:return new $o;default:throw P(new Nm(hlt+(e.f==null?``+e.g:e.f)))}}function fRe(e){switch(e.g){case 0:return new es;default:throw P(new Nm(hlt+(e.f==null?``+e.g:e.f)))}}function pRe(e){switch(e.g){case 0:return new Go;default:throw P(new Nm(hlt+(e.f==null?``+e.g:e.f)))}}function HL(e,t){if(!e.Ji()&&t==null)throw P(new Nm(`The 'no null' constraint is violated`));return t}function mRe(e){var t=new em,n,r;for(r=tV(e,0);r.b!=r.d.c;)n=B(Lk(r),8),pS(t,0,new wb(n));return t}function UL(e){var t=0,n;for(n=0;n<e.length;n++)t=(t<<5)-t+(XO(n,e.length),e.charCodeAt(n))|0;return t}function hRe(e){var t=B(Y(e,(aY(),J2)),9),n;t&&(n=t.c,dN(n.a,t),n.a.c.length==0&&dN(PE(t).b,n))}function gRe(e,t){var n=B(Z(e,(HK(),x6)),15).a,r=B(Z(t,x6),15).a;return n==r||n<r?-1:n>r?1:0}function _Re(e,t){for(var n,r,i=e.b;i;){if(n=e.a.Le(t,i.d),n==0)return i;r=n<0?0:1,i=i.a[r]}return null}function WL(e,t){var n,r,i,a,o;for(r=t,i=0,a=r.length;i<a;++i)n=r[i],o=new NCe(e),n.tf(o),A5e(o);wT(e.f)}function vRe(e,t,n){var r,i;this.g=e,this.c=t,this.a=this,this.d=this,i=wFe(n),r=G(ogt,XY,229,i,0,1),this.b=r}function yRe(){cY();var e;return lWt||(e=gS(JJ(`M`,!0)),e=eT(JJ(`M`,!1),e),lWt=e,lWt)}function GL(e){switch(e.g){case 1:return Dlt;default:case 2:return 0;case 3:return Olt;case 4:return klt}}function bRe(e,t){return lK(e,t)?(qW(e.b,B(Y(t,(aY(),j2)),24),t),gw(e.a,t),!0):!1}function xRe(e){return hx(e.c,(CL(),pRt)),_Pe(e.a,F(z(iV((_B(),Akt)))))?new Is:new eae(e)}function SRe(e){for(;!e.d||!e.d.Ob();)if(e.b&&!Bm(e.b))e.d=B(RT(e.b),51);else return null;return e.d}function CRe(e,t){return TS(e,(aY(),K2))&&TS(t,K2)?B(Y(e,K2),15).a-B(Y(t,K2),15).a:0}function wRe(e,t){return TS(e,(aY(),K2))&&TS(t,K2)?B(Y(t,K2),15).a-B(Y(e,K2),15).a:0}function TRe(e,t){var n;return t===e?!0:R(t,231)?(n=B(t,231),ZR(e.Zb(),n.Zb())):!1}function ERe(e){switch(e.i){case 2:return!0;case 1:return!1;case-1:++e.c;default:return e.Yl()}}function DRe(e){return G1?G(N_t,$it,574,0,0,1):B(JB(e.a,G(N_t,$it,574,e.a.c.length,0,1)),848)}function ORe(e,t){var n;t*2+1>=e.b.c.length||(ORe(e,2*t+1),n=2*t+2,n<e.b.c.length&&ORe(e,n),AZe(e,t))}function KL(e,t){var n,r;for(r=tV(e,0);r.b!=r.d.c;)n=B(Lk(r),221),n.e.length>0&&(t.Ad(n),n.i&&vUe(n))}function kRe(e,t,n){var r;for(r=n-1;r>=0&&e[r]===t[r];r--);return r<0?0:hue(ok(e[r],jX),ok(t[r],jX))?-1:1}function ARe(e,t){var n;return!e||e==t||!TS(t,(aY(),L2))?!1:(n=B(Y(t,(aY(),L2)),9),n!=e)}function qL(e,t,n){var r,i=(r=new Hoe,r);return iF(i,t,n),gM((!e.q&&(e.q=new V(K7,e,11,10)),e.q),i),i}function JL(e,t){var n,r=B(VI(e.a,4),131);return n=G(xHt,Qpt,420,t,0,1),r!=null&&Fq(r,0,n,0,r.length),n}function YL(e){var t,n,r,i=_ue(oHt,e);for(n=i.length,r=G(I1,LY,2,n,6,1),t=0;t<n;++t)r[t]=i[t];return r}function jRe(e,t){var n=new WK((e.f&256)!=0,e.i,e.a,e.d,(e.f&16)!=0,e.j,e.g,t);return e.e??(n.c=e),n}function MRe(e,t){var n,r;for(r=e.Zb().Bc().Jc();r.Ob();)if(n=B(r.Pb(),18),n.Gc(t))return!0;return!1}function XL(e,t,n){var r,i,a,o;for(NE(n),o=!1,a=e.dd(t),i=n.Jc();i.Ob();)r=i.Pb(),a.Rb(r),o=!0;return o}function NRe(e,t){var n;return e===t?!0:R(t,93)?(n=B(t,93),iW(fT(e),n.vc())):!1}function PRe(e,t,n){var r,i;for(i=n.Jc();i.Ob();)if(r=B(i.Pb(),45),e.ze(t,r.kd()))return!0;return!1}function FRe(e,t,n){return e.d[t.p][n.p]||(QUe(e,t,n),e.d[t.p][n.p]=!0,e.d[n.p][t.p]=!0),e.a[t.p][n.p]}function ZL(e,t){e.D==null&&e.B!=null&&(e.D=e.B,e.B=null),bF(e,t==null?null:(NE(t),t)),e.C&&e.fl(null)}function QL(){QL=E,zVt=new ty(`ELK`,0),BVt=new ty(`JSON`,1),RVt=new ty(`DOT`,2),VVt=new ty(`SVG`,3)}function $L(){$L=E,ENt=new bv(tot,0),wNt=new bv(Rlt,1),TNt=new bv(`FAN`,2),CNt=new bv(`CONSTRAINT`,3)}function eR(){eR=E,ZNt=new Cde(KZ,0),QNt=new Cde(`RADIAL_COMPACTION`,1),$Nt=new Cde(`WEDGE_COMPACTION`,2)}function tR(){tR=E,DAt=new dv(`STACKED`,0),EAt=new dv(`REVERSE_STACKED`,1),A3=new dv(`SEQUENCED`,2)}function nR(){nR=E,B_t=new bue(`CONCURRENT`,0),K1=new bue(`IDENTITY_FINISH`,1),V_t=new bue(`UNORDERED`,2)}function rR(){rR=E,WBt=new Hv(cft,0),$8=new Hv(`INCLUDE_CHILDREN`,1),e5=new Hv(`SEPARATE_CHILDREN`,2)}function iR(){iR=E,UBt=new Rb(15),HBt=new Lb((oY(),T8),UBt),Q8=A8,RBt=QRt,zBt=b8,VBt=S8,BBt=x8}function IRe(){IRe=E,sbt=NEe(q(I(W8,1),$Y,87,0,[(cz(),B8),V8])),cbt=NEe(q(I(W8,1),$Y,87,0,[U8,z8]))}function LRe(e){var t=0,n,r=G(e8,LY,8,e.b,0,1);for(n=tV(e,0);n.b!=n.d.c;)r[t++]=B(Lk(n),8);return r}function aR(e,t,n){var r=new Sg,i,a;for(a=tV(n,0);a.b!=a.d.c;)i=B(Lk(a),8),gw(r,new wb(i));XL(e,t,r)}function RRe(e,t){var n=iV((_B(),Akt))!=null&&t.Rg()!=null?F(z(t.Rg()))/F(z(iV(Akt))):1;WE(e.b,t,n)}function zRe(e,t){var n=B(e.d.Ac(t),18),r;return n?(r=e.e.hc(),r.Fc(n),e.e.d-=n.gc(),n.$b(),r):null}function BRe(e,t){var n,r=e.c[t];if(r!=0)for(e.c[t]=0,e.d-=r,n=t+1;n<e.a.length;)e.a[n]-=r,n+=n&-n}function oR(e){var t=e.a.c.length;if(t>0)return CT(t-1,e.a.c.length),ij(e.a,t-1);throw P(new noe)}function VRe(e,t,n){if(t<0)throw P(new jm(xdt+t));t<e.j.c.length?TA(e.j,t,n):(pAe(e,t),hx(e.j,n))}function HRe(e,t,n){if(e>t)throw P(new Nm(HX+e+nat+t));if(e<0||t>n)throw P(new eh(HX+e+rat+t+qit+n))}function URe(e){if(!e.a||!(e.a.i&8))throw P(new Pm(`Enumeration class expected for layout option `+e.f))}function sR(e){UEe.call(this,`The given string does not match the expected format for individual spacings.`,e)}function cR(e){switch(e.i){case-2:return!0;case-1:return!1;case 1:--e.c;default:return e.Zl()}}function lR(e){switch(e.c){case 0:return Aw(),lgt;case 1:return new _p(zZe(new xg(e)));default:return new sse(e)}}function WRe(e){switch(e.gc()){case 0:return Aw(),lgt;case 1:return new _p(e.Jc().Pb());default:return new fue(e)}}function GRe(e){var t=(!e.a&&(e.a=new V(W7,e,9,5)),e.a);return t.i==0?null:sue(B(K(t,0),691))}function uR(e,t){var n=jz(e,t);return hue(ck(e,t),0)|ky(ck(e,n),0)?n:jz(HY,ck(bT(n,63),1))}function dR(e,t,n){var r,i;return JO(t,e.c.length),r=n.Nc(),i=r.length,i==0?!1:(wbe(e.c,t,r),!0)}function fR(e,t){for(var n=e.a.length-1,r;t!=e.b;)r=t-1&n,yE(e.a,t,e.a[r]),t=r;yE(e.a,e.b,null),e.b=e.b+1&n}function KRe(e,t){var n=e.a.length-1,r;for(e.c=e.c-1&n;t!=e.c;)r=t+1&n,yE(e.a,t,e.a[r]),t=r;yE(e.a,e.c,null)}function pR(e){var t;++e.j,e.i==0?e.g=null:e.i<e.g.length&&(t=e.g,e.g=e.$i(e.i),Fq(t,0,e.g,0,e.i))}function mR(e){return(e.c!=e.b.b||e.i!=e.g.b)&&(Lp(e.a.c,0),uL(e.a,e.b),uL(e.a,e.g),e.c=e.b.b,e.i=e.g.b),e.a}function hR(e){return Dy(e)?I1:Ey(e)?j1:Ty(e)?O1:Xxe(e)||Rxe(e)?e.Pm:e.Pm||Array.isArray(e)&&I(fgt,1)||fgt}function gR(e){return e?e.i&1?e==J9?O1:e==q9?N1:e==Q9?M1:e==Z9?j1:e==Y9?P1:e==$9?F1:e==X9?k1:A1:e:null}function _R(e){Cm(),nx(this),kD(this),this.e=e,x2e(this,e),this.g=e==null?wY:Jz(e),this.a=``,this.b=e,this.a=``}function vR(){ase.call(this,new lM(zI(16))),lF(2,Krt),this.b=2,this.a=new _we(null,null,0,null),Cp(this.a,this.a)}function yR(){yR=E,P3=new hv(`BARYCENTER`,0),F3=new hv(_ot,1),cjt=new hv(vot,2),sjt=new hv(`MEDIAN`,3)}function bR(){bR=E,Ukt=new ov(`DUMMY_NODE_OVER`,0),Wkt=new ov(`DUMMY_NODE_UNDER`,1),Gkt=new ov(`EQUAL`,2)}function xR(){xR=E,AAt=new Xue(`CONSERVATIVE`,0),jAt=new Xue(`CONSERVATIVE_SOFT`,1),j3=new Xue(`SLOPPY`,2)}function qRe(e){var t,n,r=0;for(n=new hT(Ix(e.a.Jc(),new f));hG(n);)t=B(HA(n),17),t.c.i==t.d.i||++r;return r}function SR(e){var t,n,r,i,a=1;for(n=e,r=0,i=n.length;r<i;++r)t=n[r],a=31*a+(t==null?0:JF(t)),a|=0;return a}function CR(e){var t={},n,r,i,a;for(r=e,i=0,a=r.length;i<a;++i)n=r[i],t[`:`+(n.f==null?``+n.g:n.f)]=n;return t}function JRe(e,t,n){var r,i,a,o;for(i=n,a=0,o=i.length;a<o;++a)if(r=i[a],e.b.ze(t,r.jd()))return r;return null}function YRe(e){var t,n;if(e==null)return null;for(t=0,n=e.length;t<n;t++)if(!Dbe(e[t]))return e[t];return null}function wR(e,t){return!e||t&&!e.j||R(e,129)&&B(e,129).a.b==0?0:e.ff()}function TR(e,t){return!e||t&&!e.k||R(e,129)&&B(e,129).a.a==0?0:e.gf()}function XRe(e,t){var n;for(n=0;n<t.length;n++)if(e==(XO(n,t.length),t.charCodeAt(n)))return!0;return!1}function ZRe(e,t){return t<e.length&&(XO(t,e.length),e.charCodeAt(t)!=63)&&(XO(t,e.length),e.charCodeAt(t)!=35)}function ER(e,t){var n,r,i=t-e.f;for(r=new M(e.d);r.a<r.c.c.length;)n=B(W(r),320),QVe(n,n.e,n.f+i);e.f=t}function QRe(e){var t,n;for(n=new M(e.r);n.a<n.c.c.length;)if(t=B(W(n),9),e.n[t.p]<=0)return t;return null}function $Re(e){var t=new ONe(e);return yk(e.a,vbt,new Lm(q(I(y0,1),CY,378,0,[t]))),t.d&&hx(t.f,t.d),t.f}function eze(e){var t;for(gE(e),O_e(!0,`numberToAdvance must be nonnegative`),t=0;t<0&&hG(e);t++)HA(e);return t}function tze(e,t){var n,r=!1,i;return n=t.q.d,t.d<e.b&&(i=T0e(t.q,e.b),t.q.d>i&&($H(t.q,i),r=n!=t.q.d)),r}function nze(e,t){var n,i,a,o,s,c,l=t.i,u=t.j;return i=e.f,a=i.i,o=i.j,s=l-a,c=u-o,n=r.Math.sqrt(s*s+c*c),n}function rze(e,t){var n=e,r,i=0;do{if(n==t)return i;if(r=n.e,!r)throw P(new Ep);n=PE(r),++i}while(!0)}function DR(e,t){var n,r=e.Wk(t,null),i=null;t&&(i=(Ph(),n=new pp,n),OP(i,e.r)),r=OU(e,i,r),r&&r.mj()}function ize(e,t){var n,r=YG(e.d,1)!=0;for(n=!0;n;)n=!1,n=t.c.kg(t.e,r),n|=yK(e,t,r,!1),r=!r;RFe(e)}function aze(e,t){var n,r=UB(e);return r||(!sHt&&(sHt=new uc),n=(m7e(),bG(t)),r=new op(n),gM(r.Cl(),e)),r}function OR(e,t){var n=B(e.c.Ac(t),18),r;return n?(r=e.hc(),r.Fc(n),e.d-=n.gc(),n.$b(),e.mc(r)):e.jc()}function oze(e){var t;if(!(e.c.c<0?e.a>=e.c.b:e.a<=e.c.b))throw P(new jp);return t=e.a,e.a+=e.c.c,++e.b,UR(t)}function kR(e){var t,n;if(e==null)return!1;for(t=0,n=e.length;t<n;t++)if(!Dbe(e[t]))return!1;return!0}function sze(e,t){var n;for(n=0;n<t.length;n++)if(e==(XO(n,t.length),t.charCodeAt(n)))return!0;return!1}function cze(e){var t;if(e.c!=0)return e.c;for(t=0;t<e.a.length;t++)e.c=e.c*33+(e.a[t]&-1);return e.c*=e.e,e.c}function AR(e){var t;return SS(e.a!=e.b),t=e.d.a[e.a],zme(e.b==e.d.c&&t!=null),e.c=e.a,e.a=e.a+1&e.d.a.length-1,t}function lze(e,t,n,r){var i,a;e.a=t,a=r?0:1,e.f=(i=new lXe(e.c,e.a,n,a),new GK(n,e.a,i,e.e,e.b,e.c==(yR(),F3)))}function uze(e,t,n){var r,i;for(i=t.a.a.ec().Jc();i.Ob();)if(r=B(i.Pb(),60),jTe(e,r,n))return!0;return!1}function jR(e,t){gE(e);try{return e.xc(t)}catch(e){if(e=lL(e),R(e,214)||R(e,174))return null;throw P(e)}}function MR(e,t){gE(e);try{return e.Ac(t)}catch(e){if(e=lL(e),R(e,214)||R(e,174))return null;throw P(e)}}function dze(e,t,n){return r.Math.abs(t-e)<Elt||r.Math.abs(n-e)<Elt?!0:t-e>Elt?e-n>Elt:n-e>Elt}function NR(e,t){var n;return cb(e)&&cb(t)&&(n=e-t,!isNaN(n))?n:xKe(cb(e)?qI(e):e,cb(t)?qI(t):t)}function PR(e,t,n){var r=new zQe(e,t);qW(e.r,t.$f(),r),n&&!DT(e.u)&&(r.c=new kEe(e.d),hP(t.Pf(),new pre(r)))}function FR(e){var t=new upe(e.a);return JI(t,e),J(t,(aY(),q2),e),t.o.a=e.g,t.o.b=e.f,t.n.a=e.i,t.n.b=e.j,t}function fze(e){var t=_b(ajt);return B(Y(e,(aY(),P2)),24).Gc((RK(),g2))&&ww(t,(zU(),g0),(sY(),Fxt)),t}function pze(e){var t,n,r,i=new Vp;for(r=new M(e);r.a<r.c.c.length;)n=B(W(r),19),t=t4e(n),YF(i,t);return i}function mze(e,t){var n,r,i=1;for(n=e,r=t>=0?t:-t;r>0;)r%2==0?(n*=n,r=r/2|0):(i*=n,--r);return t<0?1/i:i}function hze(e,t){var n,r,i=1;for(n=e,r=t>=0?t:-t;r>0;)r%2==0?(n*=n,r=r/2|0):(i*=n,--r);return t<0?1/i:i}function IR(e,t){var n,r,i,a=(i=e?UB(e):null,EW((r=t,i&&i.El(),r)));return a==t&&(n=UB(e),n&&n.El()),a}function gze(e,t,n){var r,i=e.a;return e.a=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,1,i,t),n?n.lj(r):n=r),n}function _ze(e,t,n){var r,i=e.b;return e.b=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,3,i,t),n?n.lj(r):n=r),n}function vze(e,t,n){var r,i=e.f;return e.f=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,0,i,t),n?n.lj(r):n=r),n}function yze(e,t,n,r){var i,a;for(a=e.Jc();a.Ob();)i=B(a.Pb(),70),i.n.a=t.a+(r.a-i.o.a)/2,i.n.b=t.b,t.b+=i.o.b+n}function bze(e,t,n,r,i,a,o,s){for(var c=n;a<o;)c>=r||t<n&&s.Le(e[t],e[c])<=0?yE(i,a++,e[t++]):yE(i,a++,e[c++])}function xze(e){var t,n,r,i;if(e!=null){for(n=0;n<e.length;++n)if(t=e[n],t)for(B(t.g,375),i=t.i,r=0;r<i;++r);}}function Sze(e,t,n,r,i){t==0||r==0||(t==1?i[r]=oWe(i,n,r,e[0]):r==1?i[t]=oWe(i,e,t,n[0]):r$e(e,n,i,t,r))}function Cze(e){return(GJ(),U5).Gc(e.j)?F(z(Y(e,(aY(),r4)))):PL(q(I(e8,1),LY,8,0,[e.i.n,e.n,e.a])).b}function wze(e,t){var n=new kV(e);return Td(n,(UG(),M0)),J(n,(aY(),q2),t),J(n,(nY(),Y4),(mU(),b5)),n}function Tze(e,t,n){var r,i;for(i=e.Jc();i.Ob();){if(r=B(i.Pb(),9),r==t)return-1;if(r==n)return 1}return 0}function Eze(e,t,n){var r=n/e.gc(),i=0,a,o;for(o=e.Jc();o.Ob();)a=B(o.Pb(),189),ER(a,a.f+r*i),UKe(a,t,r),++i}function Dze(e){var t,n,r;for(r=new M(e.b);r.a<r.c.c.length;)n=B(W(r),221),t=n.c.ig()?n.f:n.a,t&&w7e(t,n.j)}function LR(e){var t,n,i=0;for(n=new M(e.a);n.a<n.c.c.length;)t=B(W(n),175),i=r.Math.max(i,t.g);return i}function Oze(){this.a=new ste,this.f=new Hie(this),this.b=new Uie(this),this.i=new Wie(this),this.e=new Hf(this)}function RR(){RR=E,G8=new Rv(cft,0),bBt=new Rv(`CONTAINER`,1),xBt=new Rv(`PARENT`,2),SBt=new Rv(`ROOT`,3)}function zR(){zR=E,SVt=new Qv(`PARALLEL_NODE`,0),l7=new Qv(`HIERARCHICAL_NODE`,1),CVt=new Qv(`ROOT_NODE`,2)}function BR(){BR=E,dIt=new kde(`EQUAL_BETWEEN_STRUCTURES`,0),pIt=new kde(`TO_ASPECT_RATIO`,1),fIt=new kde(KZ,2)}function VR(e){throw wL(),P(new dse(`Unexpected typeof result '`+e+`'; please report this bug to the GWT team`))}function kze(e){switch(e.g){case 0:return new ote;case 1:return new Bo;case 2:return new zo;default:return null}}function HR(e,t){switch(t){case 1:!e.n&&(e.n=new V(w7,e,1,7)),SJ(e.n);return;case 2:yF(e,null);return}yLe(e,t)}function Aze(e,t){var n;e.a.c.length>0&&(n=B(Pw(e.a,e.a.c.length-1),572),bRe(n,t))||hx(e.a,new xje(t))}function jze(e,t){var n;e.c.length!=0&&(n=B(JB(e,G(O0,QZ,9,e.c.length,0,1)),201),db(n,new ln),YW(n,t))}function Mze(e,t){var n;e.c.length!=0&&(n=B(JB(e,G(O0,QZ,9,e.c.length,0,1)),201),db(n,new un),YW(n,t))}function UR(e){var t,n;return e>-129&&e<128?(Bbe(),t=e+128,n=Ngt[t],!n&&(n=Ngt[t]=new Wne(e)),n):new Wne(e)}function WR(e){var t,n;return e>-129&&e<128?(uxe(),t=e+128,n=Bgt[t],!n&&(n=Bgt[t]=new Hne(e)),n):new Hne(e)}function Nze(e){var t=new Zm;return t.a+=`VerticalSegment `,Ly(t,e.e),t.a+=` `,Ry(t,ome(new Pse,new M(e.k))),t.a}function Pze(e){KC();var t=e.d.c-e.e.c,n=B(e.g,157);hP(n.b,new Kre(t)),hP(n.c,new Af(t)),CA(n.i,new qre(t))}function Fze(e){var t=B(RN(e.c.c,``),236);return t||(t=new HO(mh(ph(new as,``),`Other`)),ZB(e.c.c,``,t)),t}function GR(e){var t;return e.Db&64?DG(e):(t=new Xx(DG(e)),t.a+=` (name: `,Fy(t,e.zb),t.a+=`)`,t.a)}function Ize(e,t,n){var r,i=e.sb;return e.sb=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,4,i,t),n?n.lj(r):n=r),n}function Lze(e,t){var n=0,r,i;for(i=Az(e,t).Jc();i.Ob();)r=B(i.Pb(),12),n+=Y(r,(aY(),J2))==null?0:1;return n}function KR(e,t,n){var r=0,i,a;for(a=tV(e,0);a.b!=a.d.c&&(i=F(z(Lk(a))),!(i>n));)i>=t&&++r;return r}function Rze(e,t,n){var r=new bN(e.e,3,13,null,(i=t.c,i||(uY(),o9)),SV(e,t),!1),i;return n?n.lj(r):n=r,n}function zze(e,t,n){var r=new bN(e.e,4,13,(i=t.c,i||(uY(),o9)),null,SV(e,t),!1),i;return n?n.lj(r):n=r,n}function Bze(e,t,n){var r,i=e.r;return e.r=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,8,i,e.r),n?n.lj(r):n=r),n}function qR(e,t){var n=B(t,688),r=n.cl();return!r&&n.dl(r=R(t,89)?new tfe(e,B(t,29)):new VOe(e,B(t,160))),r}function JR(e,t,n){var r;e.Zi(e.i+1),r=e.Xi(t,n),t!=e.i&&Fq(e.g,t,e.g,t+1,e.i-t),yE(e.g,t,r),++e.i,e.Ki(t,n),e.Li()}function Vze(e,t){var n;e.c=t,e.a=vVe(t),e.a<54&&(e.f=(n=t.d>1?ZOe(t.a[0],t.a[1]):ZOe(t.a[0],0),Tk(t.e>0?n:lN(n))))}function YR(e,t){var n;return t.a&&(n=t.a.a.length,e.a?Ry(e.a,e.b):e.a=new Zx(e.d),oke(e.a,t.a,t.d.length,n)),e}function Hze(e,t){var n,r,i,a;if(t.cj(e.a),a=B(VI(e.a,8),2014),a!=null)for(n=a,r=0,i=n.length;r<i;++r)null.Sm()}function XR(e,t){var n=new ye;return e.a.zd(n)?(mx(),new fse(NE(hN(e,n.a,t)))):(IE(e),mx(),mx(),v_t)}function Uze(e){var t;return NR(e,0)<0&&(e=RI(LSe(cb(e)?qI(e):e))),t=tT(bT(e,32)),64-(t==0?JW(tT(e))+32:JW(t))}function ZR(e,t){return Dy(e)?yC(e,t):Ey(e)?Hge(e,t):Ty(e)?(NE(e),L(e)===L(t)):Xxe(e)?e.Fb(t):Rxe(e)?bfe(e,t):hk(e,t)}function Wze(e,t){gE(e);try{return e._b(t)}catch(e){if(e=lL(e),R(e,214)||R(e,174))return!1;throw P(e)}}function Gze(e,t){gE(e);try{return e.Gc(t)}catch(e){if(e=lL(e),R(e,214)||R(e,174))return!1;throw P(e)}}function QR(e,t){gE(e);try{return e.Kc(t)}catch(e){if(e=lL(e),R(e,214)||R(e,174))return!1;throw P(e)}}function Kze(e,t,n,r){switch(t){case 1:return!e.n&&(e.n=new V(w7,e,1,7)),e.n;case 2:return e.k}return iH(e,t,n,r)}function $R(e,t){switch(t.g){case 2:case 1:return Az(e,t);case 3:case 4:return cB(Az(e,t))}return ND(),ND(),H1}function ez(e,t,n){if(t<0)HZe(e,n);else{if(!n.pk())throw P(new Nm(p$+n.ve()+m$));B(n,69).uk().Ck(e,e.ei(),t)}}function qze(e,t,n){if(e<0||t>n)throw P(new jm(HX+e+rat+t+`, size: `+n));if(e>t)throw P(new Nm(HX+e+nat+t))}function tz(e,t){var n=(e.Bb&256)!=0;t?e.Bb|=256:e.Bb&=-257,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,2,n,t))}function Jze(e,t){var n=(e.Bb&256)!=0;t?e.Bb|=256:e.Bb&=-257,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,8,n,t))}function Yze(e,t){var n=(e.Bb&512)!=0;t?e.Bb|=512:e.Bb&=-513,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,9,n,t))}function nz(e,t){var n=(e.Bb&512)!=0;t?e.Bb|=512:e.Bb&=-513,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,3,n,t))}function rz(e,t){var n=(e.Bb&256)!=0;t?e.Bb|=256:e.Bb&=-257,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,8,n,t))}function Xze(e,t,n){var r,i=e.a;return e.a=t,e.Db&4&&!(e.Db&1)&&(r=new kT(e,1,5,i,e.a),n?Lqe(n,r):n=r),n}function Zze(e){var t;return e.Db&64?DG(e):(t=new Xx(DG(e)),t.a+=` (source: `,Fy(t,e.d),t.a+=`)`,t.a)}function iz(e,t){var n;return e.b==-1&&e.a&&(n=e.a.nk(),e.b=n?e.c.Eh(e.a.Jj(),n):pB(e.c.Ah(),e.a)),e.c.vh(e.b,t)}function Qze(e,t){var n,r;for(r=new jx(e);r.e!=r.i.gc();)if(n=B(aV(r),29),L(t)===L(n))return!0;return!1}function $ze(e){lY();var t,n,r,i;for(n=QB(),r=0,i=n.length;r<i;++r)if(t=n[r],uN(t.a,e,0)!=-1)return t;return jvt}function az(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e>=48&&e<=57?e-48:0}function eBe(e){return e-=e>>1&1431655765,e=(e>>2&858993459)+(e&858993459),e=(e>>4)+e&252645135,e+=e>>8,e+=e>>16,e&63}function tBe(e){var t=e.k,n;return t==(UG(),A0)?(n=B(Y(e,(aY(),M2)),64),n==(GJ(),M5)||n==Y5):!1}function nBe(e,t){var n,r;for(r=new jx(e);r.e!=r.i.gc();)if(n=B(aV(r),146),L(t)===L(n))return!0;return!1}function rBe(e,t,n){var r,i,a=(i=jG(e.b,t),i);return a&&(r=B(gJ(CN(e,a),``),29),r)?d1e(e,r,t,n):null}function oz(e,t,n){var r,i,a=(i=jG(e.b,t),i);return a&&(r=B(gJ(CN(e,a),``),29),r)?xG(e,r,t,n):null}function sz(e,t,n){var r=e.gc();if(t>r)throw P(new hC(t,r));if(e.Qi()&&e.Gc(n))throw P(new Nm(A$));e.Ei(t,n)}function iBe(e,t){t.Tg(`Sort end labels`,1),kg(fD(LN(new Nw(null,new ZO(e.b,16)),new Yt),new Xt),new lee),t.Ug()}function cz(){cz=E,H8=new Lv(eZ,0),V8=new Lv(QX,1),B8=new Lv(ZX,2),z8=new Lv(Aat,3),U8=new Lv(`UP`,4)}function lz(){lz=E,yIt=new Ov(`P1_STRUCTURE`,0),bIt=new Ov(`P2_PROCESSING_ORDER`,1),xIt=new Ov(`P3_EXECUTION`,2)}function aBe(){aBe=E,FNt=IB(IB(Qg(IB(IB(Qg(ww(new RE,(fV(),q3),(oq(),_Mt)),J3),pMt),hMt),Y3),lMt),gMt)}function oBe(e){var t=new up,n,r;for(r=new M(e.b);r.a<r.c.c.length;)n=B(W(r),598),uL(t,B(n.Af(),18));return t}function uz(e){var t,n,r=0;for(n=e.length,t=0;t<n;t++)e[t]==32||e[t]==13||e[t]==10||e[t]==9||(e[r++]=e[t]);return r}function dz(e){var t=e.a[e.c-1&e.a.length-1];return t==null?null:(e.c=e.c-1&e.a.length-1,yE(e.a,e.c,null),t)}function sBe(e){var t,n;for(n=e.p.a.ec().Jc();n.Ob();)if(t=B(n.Pb(),220),t.f&&e.b[t.c]<-1e-10)return t;return null}function cBe(e,t){switch(e.b.g){case 0:case 1:return t;case 2:case 3:return new yD(t.d,0,t.a,t.b);default:return null}}function lBe(e){switch(e.g){case 2:return V8;case 1:return B8;case 4:return z8;case 3:return U8;default:return H8}}function fz(e){switch(e.g){case 1:return Z5;case 2:return M5;case 3:return j5;case 4:return Y5;default:return X5}}function pz(e){switch(e.g){case 1:return Y5;case 2:return Z5;case 3:return M5;case 4:return j5;default:return X5}}function mz(e){switch(e.g){case 1:return j5;case 2:return Y5;case 3:return Z5;case 4:return M5;default:return X5}}function uBe(e){switch(e){case 0:return new Ooe;case 1:return new Eoe;case 2:return new Doe;default:throw P(new Ep)}}function dBe(e){switch(B(Y(e,(aY(),I2)),316).g){case 1:J(e,I2,(AN(),S2));break;case 2:J(e,I2,(AN(),w2))}}function hz(e,t){this.e=t,this.a=Uze(e),this.a<54?this.f=Tk(e):this.c=(rq(),NR(e,0)>=0?bB(e):qT(bB(lN(e))))}function fBe(e,t,n,r,i,a){this.e=new up,this.f=(rF(),k3),hx(this.e,e),this.d=t,this.a=n,this.b=r,this.f=i,this.c=a}function pBe(e){var t;if(!e.a)throw P(new Pm(`Cannot offset an unassigned cut.`));t=e.c-e.b,e.b+=t,uTe(e,t),dTe(e,t)}function mBe(e){var t=bke(e);return Oy(t.a,0)?(Tg(),Tg(),y_t):(Tg(),new $me(mue(t.a,0)?Hje(t)/Tk(t.a):0))}function gz(e,t){var n=vK(e,t);if(R(n,336))return B(n,38);throw P(new Nm(p$+t+`' is not a valid attribute`))}function _z(e,t){return e<t?-1:e>t?1:e==t?e==0?_z(1/e,1/t):0:isNaN(e)?isNaN(t)?0:1:-1}function vz(e,t,n){var r,i;return e.Nj()?(i=e.Oj(),r=KW(e,t,n),e.Hj(e.Gj(7,UR(n),r,t,i)),r):KW(e,t,n)}function yz(e,t){var n,r,i;e.d==null?(++e.e,--e.f):(i=t.jd(),n=t.yi(),r=(n&vY)%e.d.length,vj(e,r,AG(e,r,n,i)))}function bz(e,t){var n=(e.Bb&tX)!=0;t?e.Bb|=tX:e.Bb&=-1025,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,10,n,t))}function xz(e,t){var n=(e.Bb&EX)!=0;t?e.Bb|=EX:e.Bb&=-4097,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,12,n,t))}function Sz(e,t){var n=(e.Bb&z$)!=0;t?e.Bb|=z$:e.Bb&=-8193,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,15,n,t))}function Cz(e,t){var n=(e.Bb&FY)!=0;t?e.Bb|=FY:e.Bb&=-2049,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,11,n,t))}function hBe(e,t){var n=_z(e.b.c,t.b.c);return n!=0||(n=_z(e.a.a,t.a.a),n!=0)?n:_z(e.a.b,t.a.b)}function wz(e){var t,n=B(Y(e,(nY(),D4)),87);return n==(cz(),H8)?(t=F(z(Y(e,BDt))),t>=1?V8:z8):n}function gBe(e){var t,n;for(n=p1e(EP(e)).Jc();n.Ob();)if(t=BS(n.Pb()),vq(e,t))return VAe((uue(),HHt),t);return null}function _Be(e,t,n){var r,i;for(i=e.a.ec().Jc();i.Ob();)if(r=B(i.Pb(),9),cL(n,B(Pw(t,r.p),18)))return r;return null}function vBe(e,t,n){var r,i=R(t,104)&&(B(t,20).Bb&OX)!=0?new $y(t,e):new YI(t,e);for(r=0;r<n;++r)vV(i);return i}function yBe(e,t){var n,r,i,a,o=TK(e.e.Ah(),t);for(a=0,n=B(e.g,123),i=0;i<e.i;++i)r=n[i],o.$l(r.Jk())&&++a;return a}function bBe(e,t,n){var r=B(t.mf(e.a),34),i=B(n.mf(e.a),34);return r!=null&&i!=null?TI(r,i):r==null?i==null?0:1:-1}function xBe(e,t,n){var r,i;if(e.c)WJe(e.c,t,n);else for(i=new M(e.b);i.a<i.c.c.length;)r=B(W(i),168),xBe(r,t,n)}function SBe(e,t){var n,r;for(r=new M(t);r.a<r.c.c.length;)n=B(W(r),49),dN(e.b.b,n.b),ATe(B(n.a,197),B(n.b,84))}function CBe(e,t){var n,r,i;for(NE(t),n=!1,r=new M(e);r.a<r.c.c.length;)i=W(r),t.Gc(i)&&(KT(r),n=!0);return n}function wBe(e){var t,n=hE(new Zm,91);for(t=!0;e.Ob();)t||(n.a+=SY),t=!1,Ly(n,e.Pb());return(n.a+=`]`,n).a}function Tz(e){var t=G(K9,cX,30,2,15,1);return e-=OX,t[0]=(e>>10)+kX&uX,t[1]=(e&1023)+56320&uX,AB(t,0,t.length)}function TBe(e,t){var n=(e.Bb&OX)!=0;t?e.Bb|=OX:e.Bb&=-65537,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,20,n,t))}function EBe(e,t){var n=(e.Bb&h$)!=0;t?e.Bb|=h$:e.Bb&=-32769,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,18,n,t))}function Ez(e,t){var n=(e.Bb&h$)!=0;t?e.Bb|=h$:e.Bb&=-32769,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,18,n,t))}function Dz(e,t){var n=(e.Bb&RY)!=0;t?e.Bb|=RY:e.Bb&=-16385,e.Db&4&&!(e.Db&1)&&II(e,new KA(e,1,16,n,t))}function DBe(e,t,n){var r=0;return t&&(yb(e.a)?r+=t.f.a/2:r+=t.f.b/2),n&&(yb(e.a)?r+=n.f.a/2:r+=n.f.b/2),r}function Oz(e,t,n){var r=e.a.get(t);return e.a.set(t,n===void 0?null:n),r===void 0?(++e.c,++e.b.g):++e.d,r}function kz(e,t,n){var r=(Mh(),i=new Ks,i),i;return HP(r,t),PP(r,n),e&&gM((!e.a&&(e.a=new Ex(p7,e,5)),e.a),r),r}function OBe(e,t,n){var r=n;!r&&(r=hbe(new om,0)),r.Tg(eot,2),tWe(e.b,t,r.dh(1)),r9e(e,t,r.dh(1)),ent(t,r.dh(1)),r.Ug()}function Az(e,t){var n;return e.i||VZe(e),n=B(ZE(e.g,t),49),n?new QO(e.j,B(n.a,15).a,B(n.b,15).a):(ND(),ND(),H1)}function jz(e,t){var n;return cb(e)&&cb(t)&&(n=e+t,xX<n&&n<yX)?n:RI(XIe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function Mz(e,t){var n;return cb(e)&&cb(t)&&(n=e*t,xX<n&&n<yX)?n:RI(V7e(cb(e)?qI(e):e,cb(t)?qI(t):t))}function Nz(e,t){var n;return cb(e)&&cb(t)&&(n=e-t,xX<n&&n<yX)?n:RI(ZIe(cb(e)?qI(e):e,cb(t)?qI(t):t))}function Pz(e){var t;switch(e.gc()){case 0:return kw(),sgt;case 1:return new tge(gE(e.Xb(0)));default:return t=e,new mOe(t)}}function kBe(e){switch(B(Y(e,(nY(),A4)),225).g){case 1:return new si;case 3:return new fi;default:return new oi}}function ABe(e){var t=ZU(e);return t>34028234663852886e22?wX:t<-34028234663852886e22?TX:t}function Fz(e){var t=new up,n,r;for(r=new M(e.j);r.a<r.c.c.length;)n=B(W(r),12),hx(t,n.b);return gE(t),new Yy(t)}function Iz(e){var t=new up,n,r;for(r=new M(e.j);r.a<r.c.c.length;)n=B(W(r),12),hx(t,n.e);return gE(t),new Yy(t)}function Lz(e){var t=new up,n,r;for(r=new M(e.j);r.a<r.c.c.length;)n=B(W(r),12),hx(t,n.g);return gE(t),new Yy(t)}function Rz(e){var t;return e.Db&64?DG(e):(t=new Xx(DG(e)),t.a+=` (identifier: `,Fy(t,e.k),t.a+=`)`,t.a)}function zz(e){if(e.c)zz(e.c);else if(e.d)throw P(new Pm(`Stream already terminated, can't be modified or used`))}function jBe(e,t,n){switch(t.g){case 1:e.b-=n.b/2;break;case 3:e.b+=n.b/2;break;case 4:e.a-=n.a/2;break;case 2:e.a+=n.a/2}}function MBe(e,t){return yC(t.b&&t.c?fk(t.b)+`->`+fk(t.c):`e_`+JF(t),e.b&&e.c?fk(e.b)+`->`+fk(e.c):`e_`+JF(e))}function NBe(e,t){return yC(t.b&&t.c?fk(t.b)+`->`+fk(t.c):`e_`+JF(t),e.b&&e.c?fk(e.b)+`->`+fk(e.c):`e_`+JF(e))}function PBe(e){return IRe(),Rx(),!!(GBe(B(e.a,84).j,B(e.b,87))||B(e.a,84).d.e!=0&&GBe(B(e.a,84).j,B(e.b,87)))}function FBe(){pJe();var e,t,n=C_t+++Date.now();e=wO(r.Math.floor(n*RX))&zX,t=wO(n-e*Kit),this.a=e^1502,this.b=t^Git}function IBe(e,t,n,r,i){mpe(this),this.b=e,this.d=G(O0,QZ,9,t.a.c.length,0,1),this.f=n,JB(t.a,this.d),this.g=r,this.c=i}function LBe(e,t){e.n.c.length==0&&hx(e.n,new dO(e.s,e.t,e.i)),hx(e.b,t),UWe(B(Pw(e.n,e.n.c.length-1),211),t),J8e(e,t)}function RBe(e,t,n){var r;n.Tg(`Straight Line Edge Routing`,1),n.bh(t,Zlt),r=B(Z(t,($S(),f6)),19),H5e(e,r),n.bh(t,Qlt)}function Bz(e){var t,n=(t=B(Ah((r=e.Pm,i=r.f,i==C1?r:i)),10),new AC(t,B(vC(t,t.length),10),0)),r,i;return OF(n,e),n}function Vz(e){var t,n;for(n=O$e(EP(jO(e))).Jc();n.Ob();)if(t=BS(n.Pb()),vq(e,t))return HAe((r_(),WHt),t);return null}function Hz(e,t){var n,r,i=0;for(r=B(t.Kb(e),22).Jc();r.Ob();)n=B(r.Pb(),17),Vm(zS(Y(n,(aY(),Q2))))||++i;return i}function zBe(e){var t=new ege(e.Pd().gc()),n,r,i=0;for(r=NM(e.Pd().Jc());r.Ob();)n=r.Pb(),Jwe(t,n,UR(i++));return qYe(t.a)}function BBe(e){var t,n,r;for(n=0,r=e.length;n<r;n++)if(e[n]==null)throw P(new Fm(`at index `+n));return t=e,new Lm(t)}function Uz(e,t,n){var r;try{ZLe(e,t,n)}catch(e){throw e=lL(e),R(e,602)?(r=e,P(new kA(r))):P(e)}return t}function VBe(e,t){for(var n=tV(e,0),r;n.b!=n.d.c;){if(r=Hm(z(Lk(n))),r==t)return;if(r>t){YOe(n);break}}JT(n,t)}function Wz(e,t){var n,i=F(z(TB($O(t),(nY(),i3))));n=r.Math.max(0,i/2-.5),DH(t,n,1),hx(e,new Lue(t,n))}function Gz(e,t){var n=t.f,r,i,a,o;if(ZB(e.c.d,n,t),t.g!=null)for(i=t.g,a=0,o=i.length;a<o;++a)r=i[a],ZB(e.c.e,r,t)}function HBe(e,t,n,r){var i,a,o;for(i=t+1;i<n;++i)for(a=i;a>t&&r.Le(e[a-1],e[a])>0;--a)o=e[a],yE(e,a,e[a-1]),yE(e,a-1,o)}function Kz(e,t,n,r){if(t<0)W1e(e,n,r);else{if(!n.pk())throw P(new Nm(p$+n.ve()+m$));B(n,69).uk().Ak(e,e.ei(),t,r)}}function qz(e,t){var n=vK(e.Ah(),t);if(R(n,104))return B(n,20);throw P(new Nm(p$+t+`' is not a valid reference`))}function Jz(e){var t;return Array.isArray(e)&&e.Rm===T?Fh(hR(e))+`@`+(t=JF(e)>>>0,t.toString(16)):e.toString()}function UBe(e,t){return e.h==_X&&e.m==0&&e.l==0?(t&&(T1=Xb(0,0,0)),ob((MN(),Dgt))):(t&&(T1=Xb(e.l,e.m,e.h)),Xb(0,0,0))}function WBe(e,t){switch(t.g){case 2:return e.b;case 1:return e.c;case 4:return e.d;case 3:return e.a;default:return!1}}function GBe(e,t){switch(t.g){case 2:return e.b;case 1:return e.c;case 4:return e.d;case 3:return e.a;default:return!1}}function KBe(e,t,n,r){switch(t){case 3:return e.f;case 4:return e.g;case 5:return e.i;case 6:return e.j}return Kze(e,t,n,r)}function Yz(e,t){if(t==e.d)return e.e;if(t==e.e)return e.d;throw P(new Nm(`Node `+t+` not part of edge `+e))}function qBe(e){return e.e==null?e:(!e.c&&(e.c=new WK((e.f&256)!=0,e.i,e.a,e.d,(e.f&16)!=0,e.j,e.g,null)),e.c)}function JBe(e){return e.k==(UG(),P0)?IA(new Nw(null,new nE(new hT(Ix(Lz(e).a.Jc(),new f)))),new Rr):!1}function Xz(e){var t;if(e.b){if(Xz(e.b),e.b.d!=e.c)throw P(new Ap)}else e.d.dc()&&(t=B(e.f.c.xc(e.e),18),t&&(e.d=t))}function YBe(e){tC();var t=e.o.b,n,r,i;for(r=B(B($A(e.r,(GJ(),Y5)),24),85).Jc();r.Ob();)n=B(r.Pb(),116),i=n.e,i.b+=t}function Zz(e,t){var n,r=m3e(e,t),i=r[r.length-1]/2;for(n=0;n<r.length;n++)if(r[n]>=i)return t.c+n;return t.c+t.b.gc()}function XBe(e,t,n,r,i){for(var a,o=i,s;t.b!=t.c;)a=B(RT(t),9),s=B(Az(a,r).Xb(0),12),e.d[s.p]=o++,Sp(n.c,s);return o}function Qz(e){var t;this.a=(t=B(e.e&&e.e(),10),new AC(t,B(vC(t,t.length),10),0)),this.b=G(v1,CY,1,this.a.a.length,5,1)}function ZBe(e){_B(),this.c=nj(q(I(hRt,1),CY,837,0,[kkt])),this.b=new dp,this.a=e,WE(this.b,Akt,1),hP(jkt,new $ie(this))}function $z(){$z=E,p4=new rv(KZ,0),l4=new rv(`FIRST`,1),u4=new rv(Sot,2),d4=new rv(`LAST`,3),f4=new rv(Cot,4)}function eB(){eB=E,s2=new Y_(`LAYER_SWEEP`,0),USt=new Y_(`MEDIAN_LAYER_SWEEP`,1),o2=new Y_(Eot,2),WSt=new Y_(KZ,3)}function tB(){tB=E,dFt=new Ede(`ASPECT_RATIO_DRIVEN`,0),fFt=new Ede(`MAX_SCALE_DRIVEN`,1),uFt=new Ede(`AREA_DRIVEN`,2)}function nB(){nB=E,PVt=new $v(mlt,0),jVt=new $v(`GROUP_DEC`,1),NVt=new $v(`GROUP_MIXED`,2),MVt=new $v(`GROUP_INC`,3)}function rB(){rB=E,DBt=new Bv(eZ,0),X8=new Bv(`POLYLINE`,1),Y8=new Bv(`ORTHOGONAL`,2),Z8=new Bv(`SPLINES`,3)}function QBe(){QBe=E,ULt=new Zf(ldt),HLt=(aA(),OLt),VLt=new Xy(udt,HLt),BLt=new Xy(ddt,50),zLt=new Xy(fdt,(Rx(),!0))}function $Be(e){var t,n,r,i,a=xJe(e);return n=$h(e.c),r=!n,r&&(i=new _d,ZN(a,`knownLayouters`,i),t=new wae(i),CA(e.c,t)),a}function eVe(e,t){var n,r=0,i,a,o,s;for(n=0,a=t,o=0,s=a.length;o<s;++o)i=a[o],i>0&&(r+=i,++n);return n>1&&(r+=e.d*(n-1)),r}function tVe(e){var t,n,r=new Ym;for(r.a+=`[`,t=0,n=e.gc();t<n;)Fy(r,zx(e.Ti(t))),++t<n&&(r.a+=SY);return r.a+=`]`,r.a}function nVe(e,t,n){var r,i;for(r=0,i=e.length;r<i;r++)if(TL((XO(r,e.length),e.charCodeAt(r)),t,n))return!0;return!1}function rVe(e){var t;return e==null?!0:(t=e.length,t>0&&(XO(t-1,e.length),e.charCodeAt(t-1)==58)&&!nVe(e,I7,L7))}function iB(e,t){var n;return L(e)===L(t)?!0:R(t,92)?(n=B(t,92),e.e==n.e&&e.d==n.d&&YAe(e,n.a)):!1}function aB(e){switch(GJ(),e.g){case 4:return M5;case 1:return j5;case 3:return Y5;case 2:return Z5;default:return X5}}function iVe(e){var t,n;if(e.b)return e.b;for(n=G1?null:e.d;n;){if(t=G1?null:n.b,t)return t;n=G1?null:n.d}return Dg(),P_t}function oB(e,t){return ex(),$P(iX),r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)?0:e<t?-1:e>t?1:nC(isNaN(e),isNaN(t))}function aVe(e,t){eC();var n,r=IMe(e),i=t,a;for(VM(r,0,r.length,i),n=0;n<r.length;n++)a=nKe(e,r[n],n),n!=a&&vz(e,n,a)}function oVe(e){var t,n,r=F(z(e.a.mf((oY(),rBt))));for(n=new M(e.a.Qf());n.a<n.c.c.length;)t=B(W(n),692),snt(e,t,r)}function sVe(e){var t,n,r,i;for(t=(e.j??=(QD(),i=vgt.ke(e),LH(i)),e.j),n=0,r=t.length;n<r;++n);}function cVe(e,t){var n,r;for(r=new M(t);r.a<r.c.c.length;)n=B(W(r),49),hx(e.b.b,B(n.b,84)),gk(B(n.a,197),B(n.b,84))}function lVe(e,t,n){var r,i=e.a.b;for(r=i.c.length;r<n;r++)qw(i,0,new vE(e.a));FO(t,B(Pw(i,i.c.length-n),26)),e.b[t.p]=n}function uVe(e,t,n){var r;n.Tg(_dt,1),(!t.a&&(t.a=new V(T7,t,10,11)),t.a).i!=0&&(r=B(Z(t,(mK(),R6)),19),A3e(e,r)),n.Ug()}function dVe(e,t,n,r,i){zO(),CK(jg(Ng(Mg(Pg(new Wp,0),i.d.e-e),t),i.d)),CK(jg(Ng(Mg(Pg(new Wp,0),n-i.a.e),i.a),r))}function fVe(e,t){var n,r,i,a;t&&(i=JP(t,`x`),n=new vae(e),BP(n.a,(NE(i),i)),a=JP(t,`y`),r=new Jf(e),VP(r.a,(NE(a),a)))}function pVe(e,t){var n,r,i,a;t&&(i=JP(t,`x`),n=new yae(e),FP(n.a,(NE(i),i)),a=JP(t,`y`),r=new bae(e),IP(r.a,(NE(a),a)))}function mVe(e,t){var n;return e.d?IT(e.b,t)?B(bE(e.b,t),43):(n=t.bg(),WE(e.b,t,n),n):t.bg()}function hVe(e,t,n){var r,i;if(++e.j,n.dc())return!1;for(i=n.Jc();i.Ob();)r=i.Pb(),e.oj(t,e.Xi(t,r)),++t;return!0}function gVe(e,t){var n,r,i=new MM(t.gc()),a;for(r=t.Jc();r.Ob();)n=r.Pb(),a=S6e(e,B(n,57)),a&&Sp(i.c,a);return i}function sB(e,t,n){var r,i;for(i=e.Jc();i.Ob();)if(r=i.Pb(),L(t)===L(r)||t!=null&&ZR(t,r))return n&&i.Qb(),!0;return!1}function _Ve(e,t,n,r){var i,a=n-t;if(a<3)for(;a<3;)e*=10,++a;else{for(i=1;a>3;)i*=10,--a;e=(e+(i>>1))/i|0}return r.i=e,!0}function vVe(e){var t,n,r;return e.e==0?0:(t=e.d<<5,n=e.a[e.d-1],e.e<0&&(r=oIe(e),r==e.d-1&&(--n,n|=0)),t-=JW(n),t)}function yVe(e){var t,n,r;return e<t_t.length?t_t[e]:(n=e>>5,t=e&31,r=G(q9,pX,30,n+1,15,1),r[n]=1<<t,new NT(1,n+1,r))}function bVe(e){var t,n=e.ih(),r;return n?(t=e.Bh(),R(t,176)&&(r=bVe(B(t,176)),r!=null)?r+`.`+n:n):null}function xVe(e){var t;return!e.c&&(e.c=new qe),Qb(e.d,new Ye),o4e(e),t=Y2e(e),kg(new Nw(null,new ZO(e.d,16)),new mre(e)),t}function SVe(e,t){t.Tg(`End label post-processing`,1),kg(fD(LN(new Nw(null,new ZO(e.b,16)),new Gt),new Kt),new aee),t.Ug()}function cB(e){var t,n;return R(e,312)?(n=ej(B(e,312)),t=n,t):R(e,437)?B(e,437).a:R(e,59)?new cse(e):new Ele(e)}function CVe(e){var t=e.e;function n(e){return!e||e.length==0?``:` `+e.join(`
141
141
  `)}return t&&(t.stack||n(e[oit]))}function wVe(e,t){switch(t){case 3:return e.f!=0;case 4:return e.g!=0;case 5:return e.i!=0;case 6:return e.j!=0}return PIe(e,t)}function TVe(e,t){switch(t){case 3:NP(e,0);return;case 4:LP(e,0);return;case 5:RP(e,0);return;case 6:zP(e,0);return}HR(e,t)}function EVe(e){switch(e.g){case 0:return new Eo;case 1:return new Do;default:throw P(new Nm(iut+(e.f==null?``+e.g:e.f)))}}function lB(e){switch(e.g){case 0:return new To;case 1:return new Oo;default:throw P(new Nm(yot+(e.f==null?``+e.g:e.f)))}}function DVe(e){switch(e.g){case 1:return new yo;case 2:return new Ohe;default:throw P(new Nm(iut+(e.f==null?``+e.g:e.f)))}}function OVe(e){switch(e.g){case 0:return new am;case 1:return new Noe;default:throw P(new Nm(Kut+(e.f==null?``+e.g:e.f)))}}function uB(e,t){switch(t.g){case 1:return iw(e.j,(dI(),Nbt));case 2:return iw(e.j,(dI(),Fbt));default:return ND(),ND(),H1}}function kVe(e,t){var n,r;if(t){for(n=0;n<e.i;++n)if(r=B(e.g[n],374),r.kj(t))return!1;return gM(e,t)}else return!1}function AVe(e){var t=new _d,n,r,i;for(i=new af(e.b.Jc());i.b.Ob();)r=B(i.b.Pb(),697),n=aW(r),ZSe(t,t.a.length,n);return t.a}function dB(e){var t;return e.Db&64?GR(e):(t=new Xx(GR(e)),t.a+=` (instanceClassName: `,Fy(t,e.D),t.a+=`)`,t.a)}function fB(e,t){var n;return e.i>0&&(t.length<e.i&&(n=qP(hR(t).c,e.i),t=n),Fq(e.g,0,t,0,e.i)),t.length>e.i&&yE(t,e.i,null),t}function jVe(e,t,n){var r=F(e.p[t.i.p])+F(e.d[t.i.p])+t.n.b+t.a.b;return F(e.p[n.i.p])+F(e.d[n.i.p])+n.n.b+n.a.b-r}function pB(e,t){var n=(e.i??Rq(e),e.i),r=t.Jj(),i;if(r!=-1){for(i=n.length;r<i;++r)if(n[r]==t)return r}return-1}function MVe(e,t){var n,r,i;return e.f>0?(e.Zj(),r=t==null?0:JF(t),i=(r&vY)%e.d.length,n=AG(e,i,r,t),n!=-1):!1}function mB(e){var t,n,r,i=0;for(n=0,r=e.length;n<r;n++)t=(XO(n,e.length),e.charCodeAt(n)),t<64&&(i=sk(i,vT(1,t)));return i}function NVe(e){var t,n=B(e.g,686),r,i,a;for(r=e.i-1;r>=0;--r)for(t=n[r],i=0;i<r;++i)if(a=n[i],Tq(e,t,a)){lH(e,r);break}}function hB(e,t){var n,r,i,a=TK(e.e.Ah(),t);for(n=B(e.g,123),i=0;i<e.i;++i)if(r=n[i],a.$l(r.Jk()))return!1;return!0}function PVe(e,t){var n,r=new lf(e.a.$c(t,!0));if(r.a.gc()<=1)throw P(new Op);return n=r.a.ec().Jc(),n.Pb(),B(n.Pb(),41)}function FVe(e,t,n){var r=ok(n,jX),i;for(i=0;NR(r,0)!=0&&i<t;i++)r=jz(r,ok(e[i],jX)),e[i]=tT(r),r=yT(r,32);return tT(r)}function gB(e,t){Ub();var n=oC((wm(),wm(),w1)),r=null;return t==n&&(r=B(sO(ygt,e),622)),r||(r=new xCe(e),t==n&&LO(ygt,e,r)),r}function IVe(e){tC();var t=new wb(B(e.e.mf((oY(),S8)),8));return e.B.Gc((dq(),o7))&&(t.a<=0&&(t.a=20),t.b<=0&&(t.b=20)),t}function LVe(e){IM(),B(e.mf((oY(),C8)),185).Gc((dq(),vVt))&&(B(e.mf(O8),185).Ec((NW(),A5)),B(e.mf(C8),185).Kc(vVt))}function RVe(e){var t=e.d==(gW(),e2),n=Fqe(e);t&&!n||!t&&n?J(e.a,(nY(),m4),(bV(),n8)):J(e.a,(nY(),m4),(bV(),t8))}function zVe(e){var t,n,r=rZe(e),i;for(Qb(r,Bbt),i=e.d,i.c.length=0,n=new M(r);n.a<n.c.c.length;)t=B(W(n),458),uL(i,t.b)}function _B(){_B=E,Vg(),Akt=(nY(),f3),jkt=nj(q(I(xRt,1),flt,149,0,[r3,i3,o3,s3,l3,ukt,u3,d3,dkt,h3,a3,c3,p3]))}function BVe(e,t){var n=B(uA(e,CM(new we,new Ce,new Ee,q(I(q1,1),$Y,132,0,[(nR(),K1)]))),16);return n.Oc(zbe(n.gc()))}function vB(e,t){var n,r,i;return e.f>0&&(e.Zj(),r=t==null?0:JF(t),i=(r&vY)%e.d.length,n=wQe(e,i,r,t),n)?n.kd():null}function VVe(e,t){var n,r,i;return R(t,45)?(n=B(t,45),r=n.jd(),i=jR(e.Pc(),r),jE(i,n.kd())&&(i!=null||e.Pc()._b(r))):!1}function yB(e,t,n){var r,i,a;return e.Nj()?(r=e.i,a=e.Oj(),JR(e,r,t),i=e.Gj(3,null,t,r,a),n?n.lj(i):n=i):JR(e,e.i,t),n}function HVe(e,t,n){var r=new bN(e.e,4,10,(i=t.c,R(i,89)?B(i,29):(uY(),s9)),null,SV(e,t),!1),i;return n?n.lj(r):n=r,n}function UVe(e,t,n){var r=new bN(e.e,3,10,null,(i=t.c,R(i,89)?B(i,29):(uY(),s9)),SV(e,t),!1),i;return n?n.lj(r):n=r,n}function WVe(e){return yV(),(e.q?e.q:(ND(),ND(),U1))._b((nY(),V4))?B(Y(e,V4),205):B(Y(PE(e),H4),205)}function bB(e){rq();var t,n=tT(e);return t=tT(bT(e,32)),t==0?n>10||n<0?new Xk(1,n):$gt[n]:new rke(n,t)}function xB(e){if(e.b==null){for(;e.a.Ob();)if(e.b=e.a.Pb(),!B(e.b,52).Gh())return!0;return e.b=null,!1}else return!0}function GVe(e,t,n){gPe(),joe.call(this),this.a=zw(tvt,[LY,wat],[599,219],0,[ivt,rvt],2),this.c=new Sb,this.g=e,this.f=t,this.d=n}function KVe(e){this.e=G(q9,pX,30,e.length,15,1),this.c=G(J9,JX,30,e.length,16,1),this.b=G(J9,JX,30,e.length,16,1),this.f=0}function qVe(e){var t,n;for(e.j=G(Z9,AX,30,e.p.c.length,15,1),n=new M(e.p);n.a<n.c.c.length;)t=B(W(n),9),e.j[t.p]=t.o.b/e.i}function JVe(e,t){var n,i;e.a=jz(e.a,1),e.c=r.Math.min(e.c,t),e.b=r.Math.max(e.b,t),e.d+=t,n=t-e.f,i=e.e+n,e.f=i-e.e-n,e.e=i}function YVe(e,t){t.Tg(`Min Size Postprocessing`,1),mV(e,(KK(),b6),r.Math.max(F(z(Z(e,b6))),F(z(Z(e,y6))))),t.Ug()}function XVe(e,t){e.Vj();try{e.d._c(e.e++,t),e.f=e.d.j,e.g=-1}catch(e){throw e=lL(e),R(e,99)?P(new Ap):P(e)}}function ZVe(){ZVe=E,_Ut=new fc,uUt=new pc,dUt=new mc,fUt=new hc,pUt=new gc,mUt=new _c,hUt=new vc,gUt=new yc,vUt=new bc}function SB(){SB=E,sVt=new Rb(15),oVt=new Lb((oY(),T8),sVt),lVt=new Lb(P8,15),cVt=new Lb(qzt,UR(0)),aVt=new Lb(c8,hZ)}function CB(){CB=E,h6=new Tde(`P1_WIDTH_APPROXIMATION`,0),JPt=new Tde(`P2_PACKING`,1),YPt=new Tde(`P3_WHITESPACE_ELIMINATION`,2)}function wB(e,t){var n,r=t.length;for(n=0;n<r;n+=2)FK(e,(XO(n,t.length),t.charCodeAt(n)),(XO(n+1,t.length),t.charCodeAt(n+1)))}function QVe(e,t,n){var r,i,a=t-e.e,o=n-e.f;for(i=new M(e.a);i.a<i.c.c.length;)r=B(W(i),175),wV(r,r.s+a,r.t+o);e.e=t,e.f=n}function $Ve(e,t){var n,r,i,a=t.b.b;for(e.a=new Sg,e.b=G(q9,pX,30,a,15,1),n=0,i=tV(t.b,0);i.b!=i.d.c;)r=B(Lk(i),41),r.g=n++}function TB(e,t){var n,r=null;return TS(e,(nY(),lkt))&&(n=B(Y(e,lkt),105),n.nf(t)&&(r=n.mf(t))),r??=Y(PE(e),t),r}function EB(e,t){var n;ttt(t),n=B(Y(e,(nY(),dOt)),286),n&&J(e,dOt,AGe(n)),lS(e.c),lS(e.f),Ej(e.d),Ej(B(Y(e,zOt),216))}function DB(e,t){var n;return cb(e)&&cb(t)&&(n=e%t,xX<n&&n<yX)?n:RI((s9e(cb(e)?qI(e):e,cb(t)?qI(t):t,!0),T1))}function eHe(e,t,n){var i,a,o,s=e.k,c=t.k;return i=n[s.g][c.g],a=z(TB(e,i)),o=z(TB(t,i)),r.Math.max((NE(a),a),(NE(o),o))}function tHe(e,t,n){var r=B(sO(R9,t),122),i=B(sO(z9,t),122);n?(LO(R9,e,r),LO(z9,e,i)):(LO(z9,e,r),LO(R9,e,i))}function nHe(e,t){var n=t>>5,r,i,a;return t&=31,i=e.d+n+(t==0?0:1),r=G(q9,pX,30,i,15,1),CJe(r,e.a,n,t),a=new NT(e.e,i,r),vk(a),a}function OB(e,t,n){for(var r,i=null,a=e.b;a;){if(r=e.a.Le(t,a.d),n&&r==0)return a;r>=0?a=a.a[1]:(i=a,a=a.a[0])}return i}function kB(e,t,n){for(var r,i=null,a=e.b;a;){if(r=e.a.Le(t,a.d),n&&r==0)return a;r<=0?a=a.a[0]:(i=a,a=a.a[1])}return i}function rHe(e,t,n){var r,i=B(bE(e.b,n),172),a,o;for(r=0,o=new M(t.j);o.a<o.c.c.length;)a=B(W(o),114),i[a.d.p]&&++r;return r}function iHe(e,t,n,r){var i=!1,a,o;return iet(e.f,n,r)&&($He(e.f,e.a[t][n],e.a[t][r]),a=e.a[t],o=a[r],a[r]=a[n],a[n]=o,i=!0),i}function aHe(e,t){var n,r,i;for(r=new hT(Ix(Lz(e).a.Jc(),new f));hG(r);)if(n=B(HA(r),17),i=n.d.i,i.c==t)return!1;return!0}function oHe(e){var t=e.a;do t=B(HA(new hT(Ix(Lz(t).a.Jc(),new f))),17).d.i,t.k==(UG(),M0)&&hx(e.e,t);while(t.k==(UG(),M0))}function sHe(e){var t;e.c!=0&&(t=B(Pw(e.a,e.b),296),t.b==1?(++e.b,e.b<e.a.c.length&&Vne(B(Pw(e.a,e.b),296))):--t.b,--e.c)}function cHe(e){var t,n,r,i,a;if(e==null)return null;for(a=new up,n=YL(e),r=0,i=n.length;r<i;++r)t=n[r],hx(a,fJ(t,!0));return a}function lHe(e){var t,n,r,i,a;if(e==null)return null;for(a=new up,n=YL(e),r=0,i=n.length;r<i;++r)t=n[r],hx(a,fJ(t,!0));return a}function uHe(e){var t,n,r,i,a;if(e==null)return null;for(a=new up,n=YL(e),r=0,i=n.length;r<i;++r)t=n[r],hx(a,fJ(t,!0));return a}function dHe(e){var t=B(VI(e.a,4),131),n;return t==null?CHt:(n=G(xHt,Qpt,420,t.length,0,1),Fq(t,0,n,0,t.length),n)}function fHe(e,t){for(var n=0;!t[n]||t[n]==``;)n++;for(var r=t[n++];n<t.length;n++)!t[n]||t[n]==``||(r+=e+t[n]);return r}function AB(e,t,n){var i,a,o=t+n,s;for(oM(t,o,e.length),s=``,a=t;a<o;)i=r.Math.min(a+1e4,o),s+=pwe(e.slice(a,i)),a=i;return s}function pHe(){return Error.stackTraceLimit>0?(r.Error.stackTraceLimit=Error.stackTraceLimit=64,!0):`stack`in Error()}function jB(){jB=E,n7=new Xv(`PORTS`,0),r7=new Xv(`PORT_LABELS`,1),t7=new Xv(`NODE_LABELS`,2),e7=new Xv(`MINIMUM_SIZE`,3)}function MB(){MB=E,E3=new uv(KZ,0),uAt=new uv(`NODES_AND_EDGES`,1),dAt=new uv(`PREFER_EDGES`,2),fAt=new uv(`PREFER_NODES`,3)}function mHe(e,t){return ex(),ex(),$P(iX),(r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)?0:e<t?-1:e>t?1:nC(isNaN(e),isNaN(t)))>0}function hHe(e,t){return ex(),ex(),$P(iX),(r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)?0:e<t?-1:e>t?1:nC(isNaN(e),isNaN(t)))<0}function gHe(e,t){return ex(),ex(),$P(iX),(r.Math.abs(e-t)<=iX||e==t||isNaN(e)&&isNaN(t)?0:e<t?-1:e>t?1:nC(isNaN(e),isNaN(t)))<=0}function _He(e){switch(e.g){case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:return!0;default:return!1}}function vHe(e,t,n,r,i,a){this.a=e,this.c=t,this.b=n,this.f=r,this.d=i,this.e=a,this.c>0&&this.b>0&&(this.g=Rw(this.c,this.b,this.a))}function yHe(e,t){var n=e.a,r;t=String(t),n.hasOwnProperty(t)&&(r=n[t]);var i=(wL(),wgt)[typeof r];return i?i(r):VR(typeof r)}function NB(e){var t,n,r=null;if(t=T$ in e.a,n=!t,n)throw P(new Gm(`Every element must have an id.`));return r=PW(bO(e,T$)),r}function PB(e){var t,n=gXe(e);for(t=null;e.c==2;)tY(e),t||(t=(cY(),cY(),++W9,new Kb(2)),xJ(t,n),n=t),n.Hm(gXe(e));return n}function FB(e,t){var n,r,i;return e.Zj(),r=t==null?0:JF(t),i=(r&vY)%e.d.length,n=wQe(e,i,r,t),n?(YPe(e,n),n.kd()):null}function bHe(e,t){return e.e>t.e?1:e.e<t.e?-1:e.d>t.d?e.e:e.d<t.d?-t.e:e.e*kRe(e.a,t.a,e.d)}function xHe(e){return e>=48&&e<48+r.Math.min(10,10)?e-48:e>=97&&e<97?e-97+10:e>=65&&e<65?e-65+10:-1}function SHe(e,t){if(t.c==e)return t.d;if(t.d==e)return t.c;throw P(new Nm(`Input edge is not connected to the input port.`))}function IB(e,t){if(e.a<0)throw P(new Pm(`Did not call before(...) or after(...) before calling add(...).`));return mS(e,e.a,t),e}function CHe(e,t){var n,r,i;if(e.c)NP(e.c,t);else for(n=t-Vw(e),i=new M(e.a);i.a<i.c.c.length;)r=B(W(i),168),CHe(r,Vw(r)+n)}function wHe(e,t){var n,r,i;if(e.c)LP(e.c,t);else for(n=t-Hw(e),i=new M(e.d);i.a<i.c.c.length;)r=B(W(i),168),wHe(r,Hw(r)+n)}function THe(e){return BO(),R(e,167)?B(bE(M7,d_t),297).Qg(e):IT(M7,hR(e))?B(bE(M7,hR(e)),297).Qg(e):null}function LB(e){var t,n;return e.Db&32||(n=(t=B(VI(e,16),29),cE(t||e.fi())-cE(e.fi())),n!=0&&RB(e,32,G(v1,CY,1,n,5,1))),e}function RB(e,t,n){var r;(e.Db&t)==0?n!=null&&h2e(e,t,n):n==null?n$e(e,t):(r=iGe(e,t),r==-1?e.Eb=n:yE(kP(e.Eb),r,n))}function EHe(e,t,n,r){var i,a;t.c.length!=0&&(i=K1e(n,r),a=WZe(t),kg(sP(new Nw(null,new ZO(a,1)),new ha),new Fwe(e,n,i,r)))}function DHe(e,t){var n,r=e.a.length-1,i,a;return n=t-e.b&r,a=e.c-t&r,i=e.c-e.b&r,zme(n<i),n>=a?(KRe(e,t),-1):(fR(e,t),1)}function zB(e,t){for(var n=(XO(t,e.length),e.charCodeAt(t)),r=t+1;r<e.length&&(XO(r,e.length),e.charCodeAt(r)==n);)++r;return r-t}function OHe(e){var t,n=e.Nc();switch(n.length){case 0:return kw(),sgt;case 1:return t=n[0],new tge(gE(t));default:return new mOe(BBe(n))}}function kHe(e){switch(typeof e){case gY:return UL(e);case Irt:return ib(e);case hY:return Rhe(e);default:return e==null?0:dS(e)}}function AHe(e){if(BB(r$,e))return Rx(),D1;if(BB(wdt,e))return Rx(),E1;throw P(new Nm(`Expecting true or false`))}function jHe(e,t){return e.e<t.e?-1:e.e>t.e?1:e.f<t.f?-1:e.f>t.f?1:JF(e)-JF(t)}function MHe(e,t){var n;return L(t)===L(e)?!0:!R(t,24)||(n=B(t,24),n.gc()!=e.gc())?!1:e.Hc(n)}function BB(e,t){return NE(e),t==null?!1:yC(e,t)?!0:e.length==t.length&&yC(e.toLowerCase(),t.toLowerCase())}function VB(e){var t,n;return NR(e,-129)>0&&NR(e,128)<0?(lxe(),t=tT(e)+128,n=Fgt[t],!n&&(n=Fgt[t]=new Gne(e)),n):new Gne(e)}function HB(){HB=E,T0=new R_(KZ,0),xbt=new R_(`INSIDE_PORT_SIDE_GROUPS`,1),bbt=new R_(`GROUP_MODEL_ORDER`,2),Sbt=new R_(tot,3)}function UB(e){var t,n,r=e.Gh();if(!r)for(t=0,n=e.Mh();n;n=n.Mh()){if(++t>Iit)return n.Nh();if(r=n.Gh(),r||n==e)break}return r}function NHe(e){var t;return e.b||Ece(e,(t=SC(e.e,e.a),!t||!yC(wdt,vB((!t.b&&(t.b=new IS((uY(),f9),g9,t)),t.b),`qualified`)))),e.c}function PHe(e){var t,n;for(n=new M(e.a.b);n.a<n.c.c.length;)if(t=B(W(n),70),Vm(zS(Y(t,(nY(),O4)))))return!0;return!1}function FHe(e,t){oDe();var n,r;for(r=new hT(Ix(Fz(e).a.Jc(),new f));hG(r);)if(n=B(HA(r),17),n.d.i==t||n.c.i==t)return n;return null}function IHe(e,t,n){var r,i,a;for(a=new M(n.a);a.a<a.c.c.length;)i=B(W(a),227),r=new $b(B(bE(e.a,i.b),68)),hx(t.a,r),IHe(e,r,i)}function LHe(e,t,n){var r=t.c.p,i,a=t.p;e.b[r][a]=new lTe(e,t),n&&(e.a[r][a]=new cie(t),i=B(Y(t,(aY(),L2)),9),i&&qW(e.d,i,t))}function RHe(e,t,n){var r;e.a=n,e.a.Tg(ydt,1),(!t.a&&(t.a=new V(T7,t,10,11)),t.a).i!=0&&(r=B(Z(t,(mK(),R6)),19),s1e(e,r)),e.a.Ug()}function zHe(e,t){var n=t.ni(e.a),r;return n&&(r=BS(vB((!n.b&&(n.b=new IS((uY(),f9),g9,n)),n.b),k$)),r!=null)?r:t.ve()}function BHe(e,t){var n=t.ni(e.a),r;return n&&(r=BS(vB((!n.b&&(n.b=new IS((uY(),f9),g9,n)),n.b),k$)),r!=null)?r:t.ve()}function VHe(e,t){(!t&&console.groupCollapsed!=null?console.groupCollapsed:console.group==null?console.log:console.group).call(console,e)}function HHe(e,t,n,r){B(n.b,68),B(n.b,68),B(r.b,68),B(r.b,68).c.b,aM(r,t,e)}function UHe(e,t,n){t.b=r.Math.max(t.b,-n.a),t.c=r.Math.max(t.c,n.a-e.a),t.d=r.Math.max(t.d,-n.b),t.a=r.Math.max(t.a,n.b-e.b)}function WHe(e,t,n){var r=B(K(EN(e.a),t),88),i,a=(i=r.c,i||(uY(),o9));return(a.Sh()?IR(e.b,B(a,52)):a)==n?wq(r):OP(r,n),a}function WB(e,t,n){this.c=e,this.f=new up,this.e=new Eh,this.j=new dxe,this.n=new dxe,this.b=t,this.g=new yD(t.c,t.d,t.b,t.a),this.a=n}function GHe(e){var t,n,r,i;for(this.a=new Cb,this.d=new Vp,this.e=0,n=e,r=0,i=n.length;r<i;++r)t=n[r],!this.f&&(this.f=t),gk(this,t)}function GB(e){rq(),e.length==0?(this.e=0,this.d=1,this.a=q(I(q9,1),pX,30,15,[0])):(this.e=1,this.d=e.length,this.a=e,vk(this))}function KB(e,t,n){joe.call(this),this.a=G(tvt,wat,219,(vP(),q(I(Q1,1),$Y,240,0,[Y1,X1,Z1])).length,0,1),this.b=e,this.d=t,this.c=n}function KHe(e){var t,n,r,i,a,o=B(Y(e,(aY(),q2)),12);for(J(o,r4,e.i.n.b),t=Ek(e.e),r=t,i=0,a=r.length;i<a;++i)n=r[i],PO(n,o)}function qHe(e){var t,n=B(Y(e,(aY(),q2)),12),r,i,a,o;for(J(n,r4,e.i.n.b),t=Ek(e.g),i=t,a=0,o=i.length;a<o;++a)r=i[a],NO(r,n)}function JHe(e,t){var n,r,i,a;for(r=0,i=t.gc();r<i;++r)n=t.Rl(r),R(n,104)&&(B(n,20).Bb&h$)!=0&&(a=t.Sl(r),a!=null&&S6e(e,B(a,57)))}function YHe(){var e;return mgt!=0&&(e=Date.now(),e-hgt>2e3&&(hgt=e,ggt=r.setTimeout(cle,10))),mgt++==0?(INe((Sse(),_gt)),!0):!1}function XHe(e,t,n){var r;(I_t?(iVe(e),!0):L_t||z_t?(Dg(),!0):R_t&&(Dg(),!1))&&(r=new IC(t),r.b=n,xYe(e,r))}function ZHe(e,t){var n=!e.A.Gc((jB(),r7))||e.q==(mU(),b5);e.u.Gc((NW(),D5))?n?Wtt(e,t):btt(e,t):e.u.Gc(k5)&&(n?$et(e,t):fnt(e,t))}function QHe(e){var t;L(Z(e,(oY(),m8)))===L((rR(),WBt))&&(AO(e)?(t=B(Z(AO(e),m8),348),mV(e,m8,t)):mV(e,m8,e5))}function $He(e,t,n){var r,i;UJe(e.e,t,n,(GJ(),Z5)),UJe(e.i,t,n,j5),e.a&&(i=B(Y(t,(aY(),q2)),12),r=B(Y(n,q2),12),xOe(e.g,i,r))}function eUe(e,t,n){return new yD(r.Math.min(e.a,t.a)-n/2,r.Math.min(e.b,t.b)-n/2,r.Math.abs(e.a-t.a)+n,r.Math.abs(e.b-t.b)+n)}function qB(e,t){var n=Yb(e.a.c.p,t.a.c.p),r;return n==0?(r=Yb(e.a.d.i.p,t.a.d.i.p),r==0?Yb(t.a.d.p,e.a.d.p):r):n}function tUe(e,t,n){var r,i,a=t.j,o=n.j;return a==o?(r=e.f[t.p],i=e.f[n.p],r==0&&i==0?0:r==0?-1:i==0?1:_z(r,i)):a.g-o.g}function nUe(e){var t;this.d=new up,this.j=new Eh,this.g=new Eh,t=e.g.b,this.f=B(Y(PE(t),(nY(),D4)),87),this.e=F(z(sV(t,l3)))}function rUe(e){this.d=new up,this.e=new DA,this.c=G(q9,pX,30,(GJ(),q(I(Q5,1),qZ,64,0,[X5,M5,j5,Y5,Z5])).length,15,1),this.b=e}function iUe(e,t,n){var r=n[e.g][t];switch(e.g){case 1:case 3:return new Pv(0,r);case 2:case 4:return new Pv(r,0);default:return null}}function aUe(e,t){var n=wP(e.o,t);if(n==null)throw P(new Gm(`Node did not exist in input.`));return E0e(e,t),W3e(e,t),yG(e,t,n),null}function oUe(e,t,n){var r,i=B(rO(t.f),207);try{i.kf(e,n),QCe(t.f,i)}catch(e){throw e=lL(e),R(e,102)?(r=e,P(r)):P(e)}}function sUe(e,t,n){var r=null,i,a,o,s=V9e(eF(),t),c;return a=null,s&&(i=null,c=E9e(s,n),o=null,c!=null&&(o=e.of(s,c)),i=o,a=i),r=a,r}function cUe(e,t,n,r){var i=e.length;if(t>=i)return i;for(t=t>0?t:0;t<i&&!TL((XO(t,e.length),e.charCodeAt(t)),n,r);t++);return t}function JB(e,t){var n,r=e.c.length;for(t.length<r&&(t=ih(Array(r),t)),n=0;n<r;++n)yE(t,n,e.c[n]);return t.length>r&&yE(t,r,null),t}function lUe(e,t){var n,r=e.a.length;for(t.length<r&&(t=ih(Array(r),t)),n=0;n<r;++n)yE(t,n,e.a[n]);return t.length>r&&yE(t,r,null),t}function uUe(e){var t;if(e==null)return null;if(t=v1e(fJ(e,!0)),t==null)throw P(new qm(`Invalid hexBinary value: '`+e+`'`));return t}function YB(e,t,n){var r;t.a.length>0&&(hx(e.b,new Kye(t.a,n)),r=t.a.length,0<r?t.a=tO(t.a,0,0):0>r&&(t.a+=Tpe(G(K9,cX,30,-r,15,1))))}function dUe(e,t,n){var r,i,a;if(!n[t.d])for(n[t.d]=!0,i=new M(mR(t));i.a<i.c.c.length;)r=B(W(i),220),a=Yz(r,t),dUe(e,a,n)}function XB(e,t){var n=0,i,a,o;for(a=new M(t.a);a.a<a.c.c.length;)i=B(W(a),9),o=i.o.a+i.d.c+i.d.b+e.j,n=r.Math.max(n,o);return n}function ZB(e,t,n){var r,i=B(bE(e.e,t),395),a;return i?(a=rC(i,n),Ppe(e,i),a):(r=new Jye(e,t,n),WE(e.e,t,r),vEe(r),null)}function fUe(e,t){var n=bE(e.q,t);if(n==null)throw P(new Gm(`Port did not exist in input.`));return E0e(e,t),W3e(e,t),yG(e,t,n),null}function QB(){return lY(),q(I(Mvt,1),$Y,169,0,[kvt,Ovt,Avt,bvt,yvt,xvt,wvt,Cvt,Svt,Dvt,Evt,Tvt,_vt,gvt,vvt,mvt,pvt,hvt,dvt,uvt,fvt,jvt])}function $B(e){switch(e.g){case 4:return new Pv(0,-1);case 1:return new Pv(1,0);case 2:return new Pv(-1,0);default:return new Pv(0,1)}}function pUe(e){switch(e.g){case 1:return cz(),U8;case 4:return cz(),B8;case 2:return cz(),V8;case 3:return cz(),z8}return cz(),H8}function mUe(e){switch(e.fj(null)){case 10:return 0;case 15:return 1;case 14:return 2;case 11:return 3;case 21:return 4}return-1}function eV(){eV=E,U6=new Mv(`PARENTS`,0),H6=new Mv(`NODES`,1),B6=new Mv(`EDGES`,2),W6=new Mv(`PORTS`,3),V6=new Mv(`LABELS`,4)}function hUe(e,t,n,r){var i=new bN(e.e,1,13,(o=t.c,o||(uY(),o9)),(a=n.c,a||(uY(),o9)),SV(e,t),!1),a,o;return r?r.lj(i):r=i,r}function gUe(e,t,n){var r=n.q.getFullYear()-fX+fX;switch(r<0&&(r=-r),t){case 1:e.a+=r;break;case 2:zN(e,r%100,2);break;default:zN(e,r,t)}}function tV(e,t){var n,r;if(JO(t,e.b),t>=e.b>>1)for(r=e.c,n=e.b;n>t;--n)r=r.b;else for(r=e.a.a,n=0;n<t;++n)r=r.a;return new jC(e,t,r)}function _Ue(e){this.b=new up,this.e=new up,this.d=e,this.a=!qh(fD(new Nw(null,new nE(new uj(e.b))),new uf(new zr))).zd((Og(),J1))}function vUe(e){var t;e.g&&(e.c.ig()?e.f:e.a)&&(t=e.c.ig()?e.f:e.a,w2e(t.a,e.o,!0),w2e(t.a,e.o,!1),J(e.o,(nY(),Y4),(mU(),y5)))}function yUe(e,t){var n,r,i=t.d.i;r=i.k,!(r==(UG(),P0)||r==k0)&&(n=new hT(Ix(Lz(i).a.Jc(),new f)),hG(n)&&WE(e.k,t,B(HA(n),17)))}function bUe(e,t){return CP(),_z((e.a.b==0?new Pv(e.c.e.a,e.c.e.b):B(vS(e.a),8)).b,(t.a.b==0?new Pv(t.c.e.a,t.c.e.b):B(vS(t.a),8)).b)}function xUe(e,t){return CP(),_z((e.a.b==0?new Pv(e.c.e.a,e.c.e.b):B(vS(e.a),8)).a,(t.a.b==0?new Pv(t.c.e.a,t.c.e.b):B(vS(t.a),8)).a)}function SUe(e,t){return CP(),_z((e.a.b==0?new Pv(e.b.e.a,e.b.e.b):B(yS(e.a),8)).a,(t.a.b==0?new Pv(t.b.e.a,t.b.e.b):B(yS(t.a),8)).a)}function CUe(e,t){return CP(),_z((e.a.b==0?new Pv(e.b.e.a,e.b.e.b):B(yS(e.a),8)).b,(t.a.b==0?new Pv(t.b.e.a,t.b.e.b):B(yS(t.a),8)).b)}function nV(){nV=E,g5=new Gv(`DISTRIBUTED`,0),_5=new Gv(`JUSTIFIED`,1),ZBt=new Gv(`BEGIN`,2),h5=new Gv(XX,3),QBt=new Gv(`END`,4)}function rV(e,t){var n,r=YN(e.Ah(),t),i;return n=t-e.gi(),n<0?(i=e.Fh(r),i>=0?e.Th(i):gQe(e,r)):n<0?gQe(e,r):B(r,69).uk().zk(e,e.ei(),n)}function wUe(e){var t,n,r=(!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),e.o);for(n=r.c.Jc();n.e!=n.i.gc();)t=B(n.Wj(),45),t.kd();return Xj(r)}function iV(e){var t;if(R(e.a,4)){if(t=THe(e.a),t==null)throw P(new Pm(Tdt+e.b+`'. `+Sdt+(RS(N7),N7.k)+Cdt));return t}else return e.a}function TUe(e){var t;if(e==null)return null;if(t=rnt(fJ(e,!0)),t==null)throw P(new qm(`Invalid base64Binary value: '`+e+`'`));return t}function aV(e){var t;try{return t=e.i.Xb(e.e),e.Vj(),e.g=e.e++,t}catch(t){throw t=lL(t),R(t,99)?(e.Vj(),P(new jp)):P(t)}}function EUe(e){var t;try{return t=e.c.Ti(e.e),e.Vj(),e.g=e.e++,t}catch(t){throw t=lL(t),R(t,99)?(e.Vj(),P(new jp)):P(t)}}function oV(e){var t,n,r,i=0;for(n=0,r=e.length;n<r;n++)t=(XO(n,e.length),e.charCodeAt(n)),t>=64&&t<128&&(i=sk(i,vT(1,t-64)));return i}function sV(e,t){var n,r=null;return TS(e,(oY(),N8))&&(n=B(Y(e,N8),105),n.nf(t)&&(r=n.mf(t))),r==null&&PE(e)&&(r=Y(PE(e),t)),r}function DUe(e,t){var n=B(Y(e,(nY(),F4)),79);return ux(t,Tbt)?n?AD(n):(n=new em,J(e,F4,n)):n&&J(e,F4,null),n}function OUe(e,t){var n,r,i=new MM(t.gc());for(r=t.Jc();r.Ob();)n=B(r.Pb(),295),n.c==n.f?lW(e,n,n.c):pXe(e,n)||Sp(i.c,n);return i}function kUe(e,t){var n=e.o,r,i;for(i=B(B($A(e.r,t),24),85).Jc();i.Ob();)r=B(i.Pb(),116),r.e.a=SGe(r,n.a),r.e.b=n.b*F(z(r.b.mf(Fvt)))}function AUe(e,t){var n,r,i=e.k,a;return n=F(z(Y(e,(aY(),Y2)))),a=t.k,r=F(z(Y(t,Y2))),a==(UG(),A0)?i==A0?n==r?0:n<r?-1:1:1:-1}function jUe(e,t){var n=B(B(bE(e.g,t.a),49).a,68),r=B(B(bE(e.g,t.b),49).a,68);return yM(t.a,t.b)-yM(t.a,rx(n.b))-yM(t.b,rx(r.b))}function cV(e,t){var n,r;if(++e.j,t!=null&&(n=(r=e.a.Cb,R(r,101)?B(r,101).qh():null),EQe(t,n))){RB(e.a,4,n);return}RB(e.a,4,B(t,131))}function lV(e){switch(Lg(),this.c=new up,this.d=e,e.g){case 0:case 2:this.a=fwe(ybt),this.b=wX;break;case 3:case 1:this.a=ybt,this.b=TX}}function MUe(e){var t;EC(B(Y(e,(nY(),Y4)),103))&&(t=e.b,AQe((YO(0,t.c.length),B(t.c[0],26))),AQe(B(Pw(t,t.c.length-1),26)))}function NUe(e,t){t.Tg(`Self-Loop post-processing`,1),kg(fD(fD(LN(new Nw(null,new ZO(e.b,16)),new Oee),new kee),new Qn),new Aee),t.Ug()}function PUe(e,t,n){var r,i;if(e.c)RP(e.c,e.c.i+t),zP(e.c,e.c.j+n);else for(i=new M(e.b);i.a<i.c.c.length;)r=B(W(i),168),PUe(r,t,n)}function FUe(e){var t,n,r=e.c.a;for(e.p=(gE(r),new OC(r)),n=new M(r);n.a<n.c.c.length;)t=B(W(n),9),t.p=oZe(t).a;ND(),Qb(e.p,new Ii)}function IUe(e,t){var n,r;if(e.j.length!=t.j.length)return!1;for(n=0,r=e.j.length;n<r;n++)if(!yC(e.j[n],t.j[n]))return!1;return!0}function LUe(e,t){ND();var n=e,r,i,a=t;for(R(e,24)&&!R(t,24)&&(n=t,a=e),i=n.Jc();i.Ob();)if(r=i.Pb(),a.Gc(r))return!1;return!0}function RUe(e,t,n,r){return t.a<r.a||t.a==r.a&&(t.b<r.b||t.b==r.b&&e.b>n.b)}function uV(e){var t=new Zm;return t.a+=`n`,e.k!=(UG(),P0)&&Ry(Ry((t.a+=`(`,t),Wme(e.k).toLowerCase()),`)`),Ry((t.a+=`_`,t),tH(e)),t.a}function dV(){dV=E,$kt=new cv(mlt,0),Zkt=new cv(Eot,1),Qkt=new cv(`LINEAR_SEGMENTS`,2),b3=new cv(`BRANDES_KOEPF`,3),x3=new cv(plt,4)}function fV(){fV=E,nMt=new vv(`P1_TREEIFICATION`,0),q3=new vv(`P2_NODE_ORDERING`,1),J3=new vv(`P3_NODE_PLACEMENT`,2),Y3=new vv(jlt,3)}function pV(e,t,n,r){var i;return n>=0?e.Ph(t,n,r):(e.Mh()&&(r=(i=e.Ch(),i>=0?e.xh(r):e.Mh().Qh(e,-1-i,null,r))),e.zh(t,n,r))}function zUe(e,t){switch(t){case 7:!e.e&&(e.e=new gC(_7,e,7,4)),SJ(e.e);return;case 8:!e.d&&(e.d=new gC(_7,e,8,5)),SJ(e.d);return}TVe(e,t)}function mV(e,t,n){return n==null?(!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),FB(e.o,t)):(!e.o&&(e.o=new wM((ZJ(),C7),O7,e,0)),MH(e.o,t,n)),e}function hV(e,t){var n=e.dd(t);try{return n.Pb()}catch(e){throw e=lL(e),R(e,113)?P(new jm(`Can't get element `+t)):P(e)}}function BUe(e,t){var n=B(ZE(e.b,t),129).n;switch(t.g){case 1:e.t>=0&&(n.d=e.t);break;case 3:e.t>=0&&(n.a=e.t)}e.C&&(n.b=e.C.b,n.c=e.C.c)}function VUe(e){var t=e.a;do t=B(HA(new hT(Ix(Iz(t).a.Jc(),new f))),17).c.i,t.k==(UG(),M0)&&e.b.Ec(t);while(t.k==(UG(),M0));e.b=cB(e.b)}function HUe(e,t){var n,i,a=e;for(i=new hT(Ix(Iz(t).a.Jc(),new f));hG(i);)n=B(HA(i),17),n.c.i.c&&(a=r.Math.max(a,n.c.i.c.p));return a}function UUe(e,t){var n,r,i=0;for(r=B(B($A(e.r,t),24),85).Jc();r.Ob();)n=B(r.Pb(),116),i+=n.d.d+n.b.Kf().b+n.d.a,r.Ob()&&(i+=e.w);return i}function WUe(e,t){var n,r,i=0;for(r=B(B($A(e.r,t),24),85).Jc();r.Ob();)n=B(r.Pb(),116),i+=n.d.b+n.b.Kf().a+n.d.c,r.Ob()&&(i+=e.w);return i}function GUe(e){var t,n,r=0,i=IK(e);if(i.c.length==0)return 1;for(n=new M(i);n.a<n.c.c.length;)t=B(W(n),19),r+=GUe(t);return r}function KUe(e){var t,n;for(this.b=new up,this.c=e,this.a=!1,n=new M(e.a);n.a<n.c.c.length;)t=B(W(n),9),this.a|=t.k==(UG(),P0)}function qUe(e,t,n){var r=e.bd(t),i,a,o;return r!=-1&&(e.Nj()?(a=e.Oj(),o=Ew(e,r),i=e.Gj(4,o,null,r,a),n?n.lj(i):n=i):Ew(e,r)),n}function gV(e,t,n){var r=e.bd(t),i,a,o;return r!=-1&&(e.Nj()?(a=e.Oj(),o=lH(e,r),i=e.Gj(4,o,null,r,a),n?n.lj(i):n=i):lH(e,r)),n}function JUe(e,t,n,r){var i,a,o;n.Uh(t)&&(l_(),IN(t)?(i=B(n.Jh(t),164),JHe(e,i)):(a=(o=t,o?B(r,52).di(o):null),a&&Bae(n.Jh(t),a)))}function _V(e,t,n,r){var i,a=YN(e.Ah(),t),o;return i=t-e.gi(),i<0?(o=e.Fh(a),o>=0?e.Ih(o,n,!0):XW(e,a,n)):B(a,69).uk().wk(e,e.ei(),i,n,r)}function YUe(e,t,n,r){var i=$ze(t.nf((oY(),y8))?B(t.mf(y8),24):e.j);i!=(lY(),jvt)&&(n&&!_He(i)||tXe(y1e(e,i,r),t))}function XUe(e,t){return Dy(e)?!!qht[t]:e.Qm?!!e.Qm[t]:Ey(e)?!!Kht[t]:Ty(e)?!!Ght[t]:!1}function ZUe(e){switch(e.g){case 1:return $I(),o0;case 3:return $I(),a0;case 2:return $I(),Lvt;case 4:return $I(),Ivt;default:return null}}function QUe(e,t,n){if(e.e)switch(e.b){case 1:oTe(e.c,t,n);break;case 0:sTe(e.c,t,n)}else Wk(e.c,t,n);e.a[t.p][n.p]=e.c.i,e.a[n.p][t.p]=e.c.e}function $Ue(e){var t,n;if(e==null)return null;for(n=G(O0,LY,201,e.length,0,2),t=0;t<n.length;t++)n[t]=B(XAe(e[t],e[t].length),201);return n}function eWe(e){var t=B(Y(e,(Lq(),lNt)),100);J(e,(UJ(),Q3),new Pv(0,0)),b6e(new pj,e,t.b-F(z(Y(e,AMt))),t.d-F(z(Y(e,MMt))))}function vV(e){var t;if(ERe(e))return gT(e),e.sl()&&(t=UW(e.e,e.b,e.c,e.a,e.j),e.j=t),e.g=e.a,++e.a,++e.c,e.i=0,e.j;throw P(new jp)}function tWe(e,t,n){n.Tg(`Compound graph preprocessor`,1),e.a=new mO,BJ(e,t,null),C7e(e,t),f0e(e),J(t,(aY(),dwt),e.a),e.a=null,wT(e.b),n.Ug()}function nWe(e,t,n){var r,i,a;for(i=new hT(Ix((t?Iz(e):Lz(e)).a.Jc(),new f));hG(i);)r=B(HA(i),17),a=t?r.c.i:r.d.i,a.k==(UG(),j0)&&FO(a,n)}function rWe(e,t){var n,r,i;for(t.Tg(`Untreeify`,1),n=B(Y(e,(UJ(),IMt)),16),i=n.Jc();i.Ob();)r=B(i.Pb(),65),gw(r.b.d,r),gw(r.c.b,r);t.Ug()}function iWe(e,t,n){var r=t.i.j.c.length,i,a;return TS(t,(aY(),K2))&&TS(n,K2)?(i=SK(t,n,e.b,r),a=SK(n,t,e.b,r),i<a?-1:i>a?1:0):0}function yV(){yV=E,y3=new sv(KZ,0),Jkt=new sv(`PORT_POSITION`,1),v3=new sv(`NODE_SIZE_WHERE_SPACE_PERMITS`,2),_3=new sv(`NODE_SIZE`,3)}function bV(){bV=E,ORt=new Fv(`AUTOMATIC`,0),t8=new Fv(ZX,1),n8=new Fv(QX,2),jRt=new Fv(`TOP`,3),kRt=new Fv(Eat,4),ARt=new Fv(XX,5)}function xV(e,t,n){var r,i=e.gc();if(t>=i)throw P(new hC(t,i));if(e.Qi()&&(r=e.bd(n),r>=0&&r!=t))throw P(new Nm(A$));return e.Vi(t,n)}function SV(e,t){var n,r,i=hH(e,t);if(i>=0)return i;if(e.ml()){for(r=0;r<e.i;++r)if(n=e.nl(B(e.g[r],57)),L(n)===L(t))return r}return-1}function aWe(e,t){if(this.a=B(gE(e),257),this.b=B(gE(t),257),e.Cd(t)>0||e==(um(),$ht)||t==(dm(),egt))throw P(new Nm(`Invalid range: `+DAe(e,t)))}function oWe(e,t,n,r){BK();var i=0,a;for(a=0;a<n;a++)i=jz(Mz(ok(t[a],jX),ok(r,jX)),ok(tT(i),jX)),e[a]=tT(i),i=bT(i,32);return tT(i)}function sWe(e,t,n){var i,a=0;for(i=0;i<rvt;i++)a=r.Math.max(a,wR(e.a[t.g][i],n));return t==(vP(),X1)&&e.b&&(a=r.Math.max(a,e.b.b)),a}function CV(e,t){var n,r;if(xS(t>0),(t&-t)==t)return wO(t*YG(e,31)*4656612873077393e-25);do n=YG(e,31),r=n%t;while(n-r+(t-1)<0);return wO(r)}function cWe(e,t){var n=qx(new Gp,e),r,i;for(i=new M(t);i.a<i.c.c.length;)r=B(W(i),126),CK(jg(Ng(Pg(Mg(new Wp,0),0),n),r));return n}function wV(e,t,n){var r,i;for(dL(e,t-e.s,n-e.t),i=new M(e.n);i.a<i.c.c.length;)r=B(W(i),211),Sne(r,r.e+t-e.s),Cne(r,r.f+n-e.t);e.s=t,e.t=n}function lWe(e,t,n){switch(n.g){case 1:e.a=t.a/2,e.b=0;break;case 2:e.a=t.a,e.b=t.b/2;break;case 3:e.a=t.a/2,e.b=t.b;break;case 4:e.a=0,e.b=t.b/2}}function TV(e,t,n,r){var i,a;for(i=t;i<e.c.length;i++)if(a=(YO(i,e.c.length),B(e.c[i],12)),n.Mb(a))Sp(r.c,a);else return i;return e.c.length}function uWe(e){var t,n,r;for(r=B($A(e.a,(lU(),vSt)),16).Jc();r.Ob();)n=B(r.Pb(),108),t=dH(n),ZT(e,n,t[0],(IF(),Y0),0),ZT(e,n,t[1],Z0,1)}function dWe(e){var t,n,r;for(r=B($A(e.a,(lU(),ySt)),16).Jc();r.Ob();)n=B(r.Pb(),108),t=dH(n),ZT(e,n,t[0],(IF(),Y0),0),ZT(e,n,t[1],Z0,1)}function fWe(e){switch(e.g){case 0:return null;case 1:return new UFe;case 2:return new cm;default:throw P(new Nm(iut+(e.f==null?``+e.g:e.f)))}}function pWe(e){var t=F(z(Z(e,(oY(),I8))))*r.Math.sqrt((!e.a&&(e.a=new V(T7,e,10,11)),e.a).i);return new Pv(t,t/F(z(Z(e,F8))))}function mWe(e){var t;return e.f&&e.f.Sh()&&(t=B(e.f,52),e.f=B(IR(e,t),83),e.f!=t&&e.Db&4&&!(e.Db&1)&&II(e,new kT(e,9,8,t,e.f))),e.f}function hWe(e){var t;return e.i&&e.i.Sh()&&(t=B(e.i,52),e.i=B(IR(e,t),83),e.i!=t&&e.Db&4&&!(e.Db&1)&&II(e,new kT(e,9,7,t,e.i))),e.i}function EV(e){var t;return e.b&&e.b.Db&64&&(t=e.b,e.b=B(IR(e,t),20),e.b!=t&&e.Db&4&&!(e.Db&1)&&II(e,new kT(e,9,21,t,e.b))),e.b}function DV(e,t){var n,r,i;e.d==null?(++e.e,++e.f):(r=t.yi(),S0e(e,e.f+1),i=(r&vY)%e.d.length,n=e.d[i],!n&&(n=e.d[i]=e.bk()),n.Ec(t),++e.f)}function gWe(e,t,n){var r;return t.rk()?!1:t.Gk()==-2?t.ok()==e.e.Ah()&&n==null:(r=t.gk(),r==null?n==null:ZR(r,n))}function OV(){var e;lF(16,$rt),e=wFe(16),this.b=G(tgt,XY,309,e,0,1),this.c=G(tgt,XY,309,e,0,1),this.a=null,this.e=null,this.i=0,this.f=e-1,this.g=0}function kV(e){cC.call(this),this.k=(UG(),P0),this.j=(lF(6,QY),new MM(6)),this.b=(lF(2,QY),new MM(2)),this.d=new Qp,this.f=new Moe,this.a=e}function _We(e){var t,n=0,r,i,a;for(i=new M(e.a);i.a<i.c.c.length;)r=B(W(i),126),r.d=n++;return t=KJe(e),a=null,t.c.length>1&&(a=cWe(e,t)),a}function vWe(e){var t=0,n,r;for(r=new M(e.c.a);r.a<r.c.c.length;)n=B(W(r),9),t+=Uk(new hT(Ix(Lz(n).a.Jc(),new f)));return t/e.c.a.c.length}function yWe(e){var t,n;for(n=new jx(e);n.e!=n.i.gc();)if(t=B(aV(n),88),t.e||(!t.d&&(t.d=new Ex(G7,t,1)),t.d).i!=0)return!0;return!1}function bWe(e){var t,n;for(n=new jx(e);n.e!=n.i.gc();)if(t=B(aV(n),88),t.e||(!t.d&&(t.d=new Ex(G7,t,1)),t.d).i!=0)return!0;return!1}function xWe(e,t,n,r){var i=B($A(r?e.a:e.b,t),24),a,o;for(o=i.Jc();o.Ob();)if(a=B(o.Pb(),19),VK(e,n,a))return!0;return!1}function SWe(e,t){for(var n,r;e.Ob();)if(!t.Ob()||(n=e.Pb(),r=t.Pb(),!(L(n)===L(r)||n!=null&&ZR(n,r))))return!1;return!t.Ob()}function CWe(e){var t,n;e.c.length<=1||(t=n4e(e,(GJ(),Y5)),xXe(e,B(t.a,15).a,B(t.b,15).a),n=n4e(e,Z5),xXe(e,B(n.a,15).a,B(n.b,15).a))}function wWe(e,t,n){var r,i=e.a.b;for(r=i.c.length;r<n;r++)qw(i,i.c.length,new vE(e.a));FO(t,(YO(n-1,i.c.length),B(i.c[n-1],26))),e.b[t.p]=n}function TWe(e,t){var n,r,i;for(e.b[t.g]=1,r=tV(t.d,0);r.b!=r.d.c;)n=B(Lk(r),65),i=n.c,e.b[i.g]==1?gw(e.a,n):e.b[i.g]==2?e.b[i.g]=1:TWe(e,i)}function EWe(){EWe=E,bLt=(W4e(),mLt),vLt=new Rb(8),new Lb((oY(),T8),vLt),new Lb(P8,8),yLt=fLt,gLt=nLt,_Lt=rLt,hLt=new Lb(f8,(Rx(),!1))}function DWe(e,t,n){var r;n.Tg(`Shrinking tree compaction`,1),Vm(zS(Y(t,(kI(),c0))))?(xFe(e,t.f),sNe(t.f,(r=t.c,r))):sNe(t.f,t.c),n.Ug()}function OWe(e,t,n,r){switch(t){case 7:return!e.e&&(e.e=new gC(_7,e,7,4)),e.e;case 8:return!e.d&&(e.d=new gC(_7,e,8,5)),e.d}return KBe(e,t,n,r)}function kWe(e){var t;return e.a&&e.a.Sh()&&(t=B(e.a,52),e.a=B(IR(e,t),146),e.a!=t&&e.Db&4&&!(e.Db&1)&&II(e,new kT(e,9,5,t,e.a))),e.a}function AV(e){return e<48||e>102?-1:e<=57?e-48:e<65?-1:e<=70?e-65+10:e<97?-1:e-97+10}function AWe(e,t){if(e==null)throw P(new Fm(`null key in entry: null=`+t));if(t==null)throw P(new Fm(`null value in entry: `+e+`=null`))}function jWe(e,t){var n=q(I(Z9,1),AX,30,15,[wR(e.a[0],t),wR(e.a[1],t),wR(e.a[2],t)]);return e.d&&(n[0]=r.Math.max(n[0],n[2]),n[2]=n[0]),n}function MWe(e,t){var n=q(I(Z9,1),AX,30,15,[TR(e.a[0],t),TR(e.a[1],t),TR(e.a[2],t)]);return e.d&&(n[0]=r.Math.max(n[0],n[2]),n[2]=n[0]),n}function NWe(e,t,n){EC(B(Y(t,(nY(),Y4)),103))||(hje(e,t,nW(t,n)),hje(e,t,nW(t,(GJ(),Y5))),hje(e,t,nW(t,M5)),ND(),Qb(t.j,new oie(e)))}function PWe(e){var t,n;for(e.c||p9e(e),n=new em,t=new M(e.a),W(t);t.a<t.c.c.length;)gw(n,B(W(t),415).a);return SS(n.b!=0),mP(n,n.c.b),n}function FWe(e,t,n){var r,i,a,o,s=e.r+t;for(e.r+=t,e.d+=n,r=n/e.n.c.length,i=0,o=new M(e.n);o.a<o.c.c.length;)a=B(W(o),211),o1e(a,s,r,i),++i}function IWe(e){var t,n,r;for(e.b.a.$b(),e.a=G(q_t,CY,60,e.c.c.a.b.c.length,0,1),t=0,r=new M(e.c.c.a.b);r.a<r.c.c.length;)n=B(W(r),60),n.f=t++}function LWe(e){var t,n,r;for(e.b.a.$b(),e.a=G(obt,CY,84,e.c.a.a.b.c.length,0,1),t=0,r=new M(e.c.a.a.b);r.a<r.c.c.length;)n=B(W(r),84),n.i=t++}function RWe(e){var t,n,r,i,a;for(r=new M(e.b);r.a<r.c.c.length;)for(n=B(W(r),26),t=0,a=new M(n.a);a.a<a.c.c.length;)i=B(W(a),9),i.p=t++}function zWe(e,t,n){var r,i,a,o=0;for(r=n/e.a.c.length,a=new M(e.a);a.a<a.c.c.length;)i=B(W(a),175),wV(i,i.s,i.t+o*r),FWe(i,e.d-i.r+t,r),++o}function BWe(e){var t=eze(e);if(!hG(e))throw P(new jm(`position (0) must be less than the number of elements that remained (`+t+`)`));return HA(e)}function jV(e,t){var n;return e.a||=(n=G(Z9,AX,30,0,15,1),Jh(e.b.a,new rre(n)),Xae(n,SPe(O.prototype.Ke,O,[])),new bC(n,e.d)),Sj(e.a,t)}function VWe(e){switch(e.g){case 1:return GJ(),Z5;case 4:return GJ(),M5;case 3:return GJ(),j5;case 2:return GJ(),Y5;default:return GJ(),X5}}function HWe(e,t,n){t.k==(UG(),P0)&&n.k==M0&&(e.d=Lze(t,(GJ(),Y5)),e.b=Lze(t,M5)),n.k==P0&&t.k==M0&&(e.d=Lze(n,(GJ(),M5)),e.b=Lze(n,Y5))}function MV(e,t){var n,r;for(r=Az(e,t).Jc();r.Ob();)if(n=B(r.Pb(),12),Y(n,(aY(),J2))!=null||uS(new uj(n.b)))return!0;return!1}function NV(e,t,n){n.Tg(`Linear segments node placement`,1),e.b=B(Y(t,(aY(),t4)),317),art(e,t),J5e(e,t),O7e(e,t),Cnt(e),e.a=null,e.b=null,n.Ug()}function UWe(e,t){return RP(t,e.e+e.d+(e.c.c.length==0?0:e.b)),zP(t,e.f),e.a=r.Math.max(e.a,t.f),e.d+=t.g+(e.c.c.length==0?0:e.b),hx(e.c,t),!0}function PV(e,t){var n,r,i=t.length-1,a,o=0,s=0;for(r=0;r<=i;r++)a=t[r],n=MYe(i,r)*mze(1-e,i-r)*mze(e,r),o+=a.a*n,s+=a.b*n;return new Pv(o,s)}function WWe(e,t){var n=t.gc(),r,i,a,o;for(e.Zi(e.i+n),a=t.Jc(),o=e.i,e.i+=n,r=o;r<e.i;++r)i=a.Pb(),wx(e,r,e.Xi(r,i)),e.Ki(r,i),e.Li();return n!=0}function FV(e,t,n){var r,i,a;return e.Nj()?(r=e.Cj(),a=e.Oj(),++e.j,e.oj(r,e.Xi(r,t)),i=e.Gj(3,null,t,r,a),n?n.lj(i):n=i):Yhe(e,e.Cj(),t),n}function GWe(e,t,n){var r=B(K($k(e.a),t),88),i,a=(i=r.c,R(i,89)?B(i,29):(uY(),s9));return(a.Db&64?IR(e.b,a):a)==n?wq(r):OP(r,n),a}function IV(e){var t;return e==null?null:new jb((t=fJ(e,!0),t.length>0&&(XO(0,t.length),t.charCodeAt(0)==43)?(XO(1,t.length+1),t.substr(1)):t))}function KWe(e){var t;return e==null?null:new jb((t=fJ(e,!0),t.length>0&&(XO(0,t.length),t.charCodeAt(0)==43)?(XO(1,t.length+1),t.substr(1)):t))}function qWe(e,t,n,r,i,a,o,s){var c,l;r&&(c=r.a[0],c&&qWe(e,t,n,c,i,a,o,s),sH(e,n,r.d,i,a,o,s)&&t.Ec(r),l=r.a[1],l&&qWe(e,t,n,l,i,a,o,s))}function LV(e,t){var n,r,i,a=e.gc();for(t.length<a&&(t=ih(Array(a),t)),i=t,r=e.Jc(),n=0;n<a;++n)yE(i,n,r.Pb());return t.length>a&&yE(t,a,null),t}function JWe(e,t){var n,r=e.gc();if(t==null){for(n=0;n<r;n++)if(e.Xb(n)==null)return n}else for(n=0;n<r;n++)if(ZR(t,e.Xb(n)))return n;return-1}function YWe(e,t){var n=t.jd(),r,i=t.kd();return r=e.xc(n),!(!(L(i)===L(r)||i!=null&&ZR(i,r))||r==null&&!e._b(n))}function XWe(e,t){var n,r,i;return t<=22?(n=e.l&(1<<t)-1,r=i=0):t<=44?(n=e.l,r=e.m&(1<<t-22)-1,i=0):(n=e.l,r=e.m,i=e.h&(1<<t-44)-1),Xb(n,r,i)}function ZWe(e,t){switch(t.g){case 1:return e.f.n.d+e.t;case 3:return e.f.n.a+e.t;case 2:return e.f.n.c+e.s;case 4:return e.f.n.b+e.s;default:return 0}}function QWe(e,t){var n,r=t.c;switch(n=t.a,e.b.g){case 0:n.d=e.e-r.a-r.d;break;case 1:n.d+=e.e;break;case 2:n.c=e.e-r.a-r.d;break;case 3:n.c=e.e+r.d}}function RV(){RV=E,BPt=new Tv(KZ,0),RPt=new Tv(kot,1),zPt=new Tv(`EDGE_LENGTH_BY_POSITION`,2),LPt=new Tv(`CROSSING_MINIMIZATION_BY_POSITION`,3)}function zV(e,t){var n=B(wP(e.n,t),19),r;if(n)return n;if(r=B(wP(e.p,t),127),r)return r;throw P(new Gm(`Referenced shape does not exist: `+t))}function $We(e,t){if(e.g==-1)throw P(new Dp);e.Vj();try{e.d.fd(e.g,t),e.f=e.d.j}catch(e){throw e=lL(e),R(e,99)?P(new Ap):P(e)}}function BV(e,t){var n,r;if(R(t,257)){r=B(t,257);try{return n=e.Cd(r),n==0}catch(e){if(e=lL(e),R(e,214))return!1;throw P(e)}}return!1}function VV(e,t){if(e.c==t)return e.d;if(e.d==t)return e.c;throw P(new Nm(`Node 'one' must be either source or target of edge 'edge'.`))}function eGe(e,t){if(e.c.i==t)return e.d.i;if(e.d.i==t)return e.c.i;throw P(new Nm(`Node `+t+` is neither source nor target of edge `+e))}function HV(e,t,n){n.Tg(`Self-Loop ordering`,1),kg(dD(fD(fD(LN(new Nw(null,new ZO(t.b,16)),new Kn),new qn),new Jn),new Yn),new Bre(e)),n.Ug()}function UV(e,t,n,r,i,a){var o=LKe(t,n,a),s=n==(GJ(),M5)||n==Z5?-1:1,c,l=e[n.g],u;for(u=0;u<l.length;u++)c=l[u],c>0&&(c+=i),l[u]=o,o+=s*(c+r)}function WV(e){var t;for(t=0;t<e.a.c.length;t++)if(TS(B(Pw(e.a,t),9),(nY(),NOt))&&Vm(zS(Y(B(Pw(e.a,t),9),NOt))))return!0;return!1}function tGe(e){var t,n,r=e.f;for(e.n=G(Z9,AX,30,r,15,1),e.d=G(Z9,AX,30,r,15,1),t=0;t<r;t++)n=B(Pw(e.c.b,t),26),e.n[t]=XB(e,n),e.d[t]=n0e(e,n)}function nGe(e,t,n,r){var i;this.c=e,this.d=t,i=new Sg,bA(i,n,i.c.b,i.c),this.a=i,this.b=B(Y(r,(Lq(),l6)),87),this.e=F(z(Y(r,hNt))),yrt(this)}function rGe(e,t,n){var r,i=e.a?_z(n.j,t.j):_z(t.j,n.j);return i==0?(r=Yb(B(Z(t,(mK(),F6)),15).a,B(Z(n,F6),15).a),r):i}function iGe(e,t){var n,r,i=0;for(r=2;r<t;r<<=1)(e.Db&r)!=0&&++i;if(i==0){for(n=t<<=1;n<=128;n<<=1)if((e.Db&n)!=0)return 0;return-1}else return i}function aGe(e,t){var n,r,i,a,o=TK(e.e.Ah(),t);for(a=null,n=B(e.g,123),i=0;i<e.i;++i)r=n[i],o.$l(r.Jk())&&(!a&&(a=new Xs),gM(a,r));a&&ynt(e,a)}function oGe(e){var t,n,r;if(!e)return null;if(e.dc())return``;for(r=new Ym,n=e.Jc();n.Ob();)t=n.Pb(),Fy(r,BS(t)),r.a+=` `;return tb(r,r.a.length-1)}function sGe(e,t){var n=Array(t),r;switch(e){case 14:case 15:r=0;break;case 16:r=!1;break;default:return n}for(var i=0;i<t;++i)n[i]=r;return n}function GV(e){var t,n,r;for(n=new M(e.a.b);n.a<n.c.c.length;)t=B(W(n),60),t.c.$b();r=vb(e.d)?e.a.c:e.a.d,hP(r,new fre(e)),e.c.bf(e),O2e(e)}function cGe(e){var t,n,r,i;for(n=new M(e.e.c);n.a<n.c.c.length;){for(t=B(W(n),292),i=new M(t.b);i.a<i.c.c.length;)r=B(W(i),448),N5e(r);VQe(t)}}function lGe(e){var t,n,i=vY;for(n=new M(e.a);n.a<n.c.c.length;)t=B(W(n),9),TS(t,(aY(),K2))&&(i=r.Math.min(i,B(Y(t,K2),15).a));return i}function KV(e){var t,n,i=0,a,o=0;for(a=0,n=new M(e.a);n.a<n.c.c.length;)t=B(W(n),175),o=r.Math.max(o,t.r),i+=t.d+(a>0?e.c:0),++a;e.b=i,e.d=o}function uGe(e,t){var n=q(I(Z9,1),AX,30,15,[sWe(e,(vP(),Y1),t),sWe(e,X1,t),sWe(e,Z1,t)]);return e.f&&(n[0]=r.Math.max(n[0],n[2]),n[2]=n[0]),n}function qV(e){var t;TS(e,(nY(),z4))&&(t=B(Y(e,z4),24),t.Gc((vG(),o5))?(t.Kc(o5),t.Ec(c5)):t.Gc(c5)&&(t.Kc(c5),t.Ec(o5)))}function dGe(e){var t;TS(e,(nY(),z4))&&(t=B(Y(e,z4),24),t.Gc((vG(),p5))?(t.Kc(p5),t.Ec(d5)):t.Gc(d5)&&(t.Kc(d5),t.Ec(p5)))}function JV(e,t,n,r){var i,a,o,s;return e.a??AYe(e,t),o=t.b.j.c.length,a=n.d.p,s=r.d.p,i=s-1,i<0&&(i=o-1),a<=i?e.a[i]-e.a[a]:e.a[o-1]-e.a[a]+e.a[i]}function fGe(e){var t;for(t=0;t<e.a.c.length;t++)if(TS(B(Pw(e.a,t),9),(nY(),POt))&&!Vm(zS(Y(B(Pw(e.a,t),9),POt))))return!1;return!0}function pGe(e,t,n){var r,i,a=e.c,o,s=n?t:e;for(r=n?e:t,i=s.p+1;i<r.p;++i)if(o=B(Pw(a.a,i),9),!(o.k==(UG(),k0)||mKe(o)))return!1;return!0}function YV(e){var t,n;if(!e.b)for(e.b=Dk(B(e.f,19).jh().i),n=new jx(B(e.f,19).jh());n.e!=n.i.gc();)t=B(aV(n),158),hx(e.b,new km(t));return e.b}function mGe(e){var t,n;if(!e.e)for(e.e=Dk(eD(B(e.f,19)).i),n=new jx(eD(B(e.f,19)));n.e!=n.i.gc();)t=B(aV(n),127),hx(e.e,new rae(t));return e.e}function hGe(e){var t,n;if(!e.a)for(e.a=Dk(LD(B(e.f,19)).i),n=new jx(LD(B(e.f,19)));n.e!=n.i.gc();)t=B(aV(n),19),hx(e.a,new aS(e,t));return e.a}function XV(e){var t;if(!e.C&&(e.D!=null||e.B!=null))if(t=Het(e),t)e.fl(t);else try{e.fl(null)}catch(e){if(e=lL(e),!R(e,63))throw P(e)}return e.C}function gGe(e){switch(e.q.g){case 5:QKe(e,(GJ(),M5)),QKe(e,Y5);break;case 4:k9e(e,(GJ(),M5)),k9e(e,Y5);break;default:BXe(e,(GJ(),M5)),BXe(e,Y5)}}function ZV(e){switch(e.q.g){case 5:$Ke(e,(GJ(),j5)),$Ke(e,Z5);break;case 4:A9e(e,(GJ(),j5)),A9e(e,Z5);break;default:VXe(e,(GJ(),j5)),VXe(e,Z5)}}function QV(e,t){var n,i,a=new Eh;for(i=e.Jc();i.Ob();)n=B(i.Pb(),37),eq(n,a.a,0),a.a+=n.f.a+t,a.b=r.Math.max(a.b,n.f.b);return a.b>0&&(a.b+=t),a}function $V(e,t){var n,i,a=new Eh;for(i=e.Jc();i.Ob();)n=B(i.Pb(),37),eq(n,0,a.b),a.b+=n.f.b+t,a.a=r.Math.max(a.a,n.f.a);return a.a>0&&(a.a+=t),a}function _Ge(e,t){var n,r;if(t.length==0)return 0;for(n=DCe(e.a,t[0],(GJ(),Z5)),n+=DCe(e.a,t[t.length-1],j5),r=0;r<t.length;r++)n+=cYe(e,r,t);return n}function vGe(){DK(),this.c=new up,this.i=new up,this.e=new Cb,this.f=new Cb,this.g=new Cb,this.j=new up,this.a=new up,this.b=new dp,this.k=new dp}function eH(e,t){var n,r;return e.Db>>16==6?e.Cb.Qh(e,5,x7,t):(r=EV(B(YN((n=B(VI(e,16),29),n||e.fi()),e.Db>>16),20)),e.Cb.Qh(e,r.n,r.f,t))}function yGe(e){QD();var t=e.e;if(t&&t.stack){var n=t.stack,r=t+`
142
142
  `;return n.substring(0,r.length)==r&&(n=n.substring(r.length)),n.split(`
@@ -162,7 +162,7 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
162
162
  ... Falling back to non-web worker version.`);if(!r.workerFactory){var o=e(`./elk-worker.min.js`).Worker;r.workerFactory=function(e){return new o(e)}}return l(this,n,[r])}return m(n,t),a(n)}(e(`./elk-api.js`).default);Object.defineProperty(t.exports,`__esModule`,{value:!0}),t.exports=g,g.default=g},{"./elk-api.js":1,"./elk-worker.min.js":2,"web-worker":4}],4:[function(e,t,n){t.exports=typeof Worker<`u`?Worker:void 0},{}]},{},[3])(3)})}))(),1)).default,gZe={"elk.algorithm":`layered`,"elk.direction":`RIGHT`,"elk.spacing.nodeNode":`80`,"elk.layered.spacing.nodeNodeBetweenLayers":`120`,"elk.layered.spacing.edgeNodeBetweenLayers":`40`,"elk.spacing.edgeNode":`40`,"elk.spacing.edgeEdge":`20`,"elk.layered.nodePlacement.strategy":`NETWORK_SIMPLEX`,"elk.layered.crossingMinimization.strategy":`LAYER_SWEEP`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.mergeEdges":`false`,"elk.edgeRouting":`ORTHOGONAL`};function _Ze(e,t){let[n,r]=(0,D.useState)({nodes:[],edges:[]}),[i,a]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{(async()=>{if(e.length===0||i)return;a(!0);let n={id:`root`,layoutOptions:gZe,children:e.map(e=>{let t=e.data?.nodeType,n=e.width||200,r=e.height||100;if(t===`flow`)n=80;else if(t===`channelEntry`)n=220,r=55+((e.data?.handlers?.length||0)+(e.data?.categories?.length||0))*30;else if(t===`channelRouter`)n=200,r=40+(e.data?.actions?.length||0)*28;else if(t===`wiring`)if(e.type===`channelWiringNode`){n=180;let t=3;e.data?.onMessageRoute&&(t+=Object.keys(e.data.onMessageRoute).length),r=40+t*28}else n=80;else (t===`rpc`||e.type===`functionNode`)&&(n=80);let i={id:e.id,width:n,height:r};return e.data?.order!==void 0&&(i.properties={"org.eclipse.elk.priority":e.data.order}),i}),edges:t.map(e=>({id:e.id,sources:[e.source],targets:[e.target]}))};try{let i=await hZe.layout(n),a=75-Math.min(...i.children?.map(e=>e.y||0)||[0]),o=e.map(e=>{let t=i.children?.find(t=>t.id===e.id);return t?{...e,position:{x:t.x??e.position.x,y:(t.y??0)+a}}:e}),s=new Map;if(i.edges)for(let e of i.edges){let t=e.sections;if(t&&t.length>0){let n=[];for(let e of t)if(e.bendPoints)for(let t of e.bendPoints)n.push({x:t.x,y:(t.y??0)+a});n.length>0&&s.set(e.id,n)}}r({nodes:o,edges:t.map(e=>{let t=s.get(e.id);return t?{...e,type:`elk`,data:{...e.data,bendPoints:t}}:{...e,type:`elk`}})})}catch{r({nodes:e,edges:t})}finally{a(!1)}})()},[(0,D.useMemo)(()=>e.map(e=>e.id).join(`,`),[e]),(0,D.useMemo)(()=>t.map(e=>e.id).join(`,`),[t])]),n.nodes.length>0?n:{nodes:e,edges:t}}var vZe=({side:e,onExpand:t})=>(0,A.jsx)(j,{style:{width:36,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRight:e===`left`?`1px solid var(--mantine-color-default-border)`:void 0,borderLeft:e===`right`?`1px solid var(--mantine-color-default-border)`:void 0,background:`var(--mantine-color-body)`,flexShrink:0},children:(0,A.jsx)(Ch,{label:`Expand`,position:e===`left`?`right`:`left`,children:(0,A.jsx)(_f,{variant:`subtle`,size:`sm`,color:`gray`,onClick:t,children:(0,A.jsx)(e===`left`?Cb:Ffe,{size:16})})})});const yZe=({children:e,header:t,runsPanel:n,runsPanelVisible:r=!0,emptyPanelMessage:i,showTabs:a=!1,hidePanel:o=!1,initialLeftCollapsed:s=!1,initialRightCollapsed:c=!1})=>{let{panels:l}=_x(),u=!a,[d,f]=(0,D.useState)(s),[p,m]=(0,D.useState)(c),h=(0,D.useRef)(r);(0,D.useEffect)(()=>{!h.current&&r&&f(!1),h.current=r},[r]);let g=!!n&&r,_=g&&!d,v=!o&&(u||l.size!==0),y=v&&!p,b=(0,D.useCallback)((e,t)=>{g&&e===0&&f(!t),v&&e===(g?2:1)&&m(!t)},[g,v]);return(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100%`},children:[t,(0,A.jsxs)(j,{className:fx.flexRow,style:{flex:1,minHeight:0},children:[g&&d&&(0,A.jsx)(vZe,{side:`left`,onExpand:()=>f(!1)}),(0,A.jsx)(j,{className:`${fx.flexGrow} ${fx.flexColumn}`,children:(0,A.jsxs)(Yx,{defaultSizes:g&&v?[220,640,400]:g?[220,840]:v?[840,400]:void 0,onVisibleChange:b,children:[g&&(0,A.jsx)(Yx.Pane,{visible:_,snap:!0,minSize:180,preferredSize:220,maxSize:300,children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,style:{borderRight:`1px solid var(--mantine-color-default-border)`},children:n})}),(0,A.jsx)(Yx.Pane,{children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:e})}),v&&(0,A.jsx)(Yx.Pane,{visible:y,snap:!0,minSize:200,preferredSize:400,children:(0,A.jsx)(j,{className:`${fx.flexColumn} ${fx.overflowAuto}`,children:(0,A.jsx)(WHe,{showTabs:a,emptyMessage:i})})})]},`${g}-${v}`)}),v&&p&&(0,A.jsx)(vZe,{side:`right`,onExpand:()=>m(!1)})]})]})},bZe=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,data:a,label:o,labelStyle:s,labelBgStyle:c,style:l,markerEnd:u})=>{let d=a?.bendPoints||[],f=[{x:t,y:n},...d,{x:r,y:i}],p=f.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `),m=Math.floor(f.length/2),h=f[m]?.x??(t+r)/2,g=f[m]?.y??(n+i)/2;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(tU,{id:e,path:p,style:l,markerEnd:u}),o&&(0,A.jsx)(tXe,{children:(0,A.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${h}px, ${g}px)`,pointerEvents:`all`,fontSize:10,fontFamily:`monospace`,color:`#666`,backgroundColor:`rgba(255, 255, 255, 0.8)`,padding:`1px 4px`,borderRadius:3,...s},children:o})})]})};var xZe={http:`http`,queue:`queue`,scheduler:`schedule`,trigger:`trigger`,cli:`cli`},SZe={http:e=>`${e.method?.toLowerCase()||`get`}:${e.route||``}`,queue:e=>e.name,schedule:e=>e.cron||e.interval,trigger:e=>e.name,cli:e=>e.command};function CZe(e,t){let n=xZe[t.type];if(!n)return{};if(n===`mcp`||t.type===`mcp`){if(!e.mcp||!t.id)return{mcp:e.mcp};let[n,...r]=t.id.split(`:`),i=r.join(`:`),a={};return e.mcp[n]&&(a[n]=e.mcp[n].filter(e=>(e.name||e.uri)===i)),{mcp:a}}let r=e[n];if(!r)return{};if(!t.id)return{[n]:r};let i=SZe[n];return i?{[n]:r.filter(e=>i(e)===t.id)}:{[n]:r}}var DW={functionNode:UXe,wiringNode:gW,channelNode:GXe,decisionNode:KXe,sleepNode:qXe,inlineNode:vW,genericNode:dZe,branchNode:YXe,fanoutNode:yW,returnNode:ZXe,cancelNode:$Xe,switchNode:tZe,arrayPredicateNode:nZe,filterNode:rZe,parallelNode:aZe,channelWiringNode:sZe,setNode:lZe},wZe={elk:bZe},TZe=({workflow:e,onPaneClick:t})=>{let{fitView:n}=PU(),{nodes:r,edges:i}=(0,D.useMemo)(()=>mZe(e),[e]),a=_Ze(r,i),[o,s]=rXe([]),[c,l]=iXe([]);return(0,D.useEffect)(()=>{a.nodes.length>0&&(s(a.nodes),l(a.edges),setTimeout(()=>{n({padding:.2})},50))},[a,s,l,n]),(0,A.jsxs)(j,{style:{width:`100%`,height:`100%`},children:[(0,A.jsx)(`style`,{children:`
163
163
  .react-flow__handle { opacity: 0; pointer-events: none; }
164
164
  @keyframes pulse-border { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
165
- `}),(0,A.jsx)(iW,{nodes:o,edges:c,nodeTypes:DW,edgeTypes:wZe,defaultEdgeOptions:{style:{stroke:`#c0c0c0`,strokeWidth:1.5,strokeDasharray:`6 4`},animated:!0,markerEnd:{type:sU.ArrowClosed,color:`#c0c0c0`,width:16,height:16}},zoomOnScroll:!0,preventScrolling:!1,nodesConnectable:!1,nodesDraggable:!0,proOptions:{hideAttribution:!0},noDragClassName:`nodrag`,onPaneClick:t,children:(0,A.jsx)(dXe,{color:`#e0e0e0`,variant:aW.Dots,size:1})})]})},EZe=e=>(0,A.jsx)(nW,{children:(0,A.jsx)(TZe,{...e})}),DZe=({workflowName:e})=>{let{selectedRunId:t,setSelectedRunId:n,setIsCreatingRun:r}=kAe(),{setActivePanel:i}=_x(),a=zB(),o=By(),{data:s,isLoading:c,refetch:l}=CAe(e),u=(0,D.useMemo)(()=>!s||!Array.isArray(s)?[]:s,[s]),d=(0,D.useCallback)(async e=>{await o.invoke(`console:deleteWorkflowRun`,{runId:e}),t===e&&n(null),l()},[o,t,n,l]),f=(0,D.useCallback)(()=>{n(null),r(!0),i(`workflow-${e}`)},[n,r,i,e]);return(0,A.jsx)(pW,{title:`Runs`,runs:u,selectedId:t,onSelect:n,onClear:()=>n(null),loading:c,emptyMessage:`No runs found`,statusFilters:[],onNewClick:a?f:void 0,newButtonLabel:a?`New workflow run`:void 0,onDelete:a?d:void 0})},OZe=({workflow:e,items:t,onItemSelect:n,immersiveDetail:r=!1})=>{let{canvasDrawer:i,closeCanvasDrawer:a}=pXe(),{panels:o,activePanel:s,openWorkflow:c,setActivePanel:l}=_x(),{setFocusedNode:u}=Gk(),d=e.name||e.wireId||`Workflow`,f=`workflow-${d}`,p=(0,D.useCallback)(()=>{l(f)},[l,f]);(0,D.useEffect)(()=>{c(d,e)},[]),(0,D.useEffect)(()=>{if(!s){u(null);return}let e=o.get(s);e?.data.type===`workflowStep`?u(e.data.id):u(null)},[s,o,u]);let m=(0,D.useMemo)(()=>i?OXe(i.data):null,[i]),h=(e.source||`graph`)===`complex`,g=Wk(),_=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(sW,{icon:db,category:`Workflows`,docsHref:`https://pikku.dev/docs/wiring/workflows`,categoryPath:`/workflow`,currentItem:d,items:t,onItemSelect:n,subtitle:e.source?(0,A.jsx)(eS,{type:`dynamic`,badge:`source`,value:e.source}):void 0}),h&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`yellow`,radius:0,py:`xs`,styles:{root:{borderBottom:`1px solid var(--mantine-color-default-border)`}},children:(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(N,{size:`sm`,children:`This is a complex workflow. The visual representation may not be accurate.`}),(0,A.jsx)(N,{size:`sm`,c:`yellow.7`,style:{cursor:`pointer`,textDecoration:`underline`},children:`Learn more`})]})}),g?.isVersionMismatch&&(0,A.jsx)(If,{icon:(0,A.jsx)(Afe,{size:16}),color:`orange`,radius:0,py:`xs`,styles:{root:{borderBottom:`1px solid var(--mantine-color-default-border)`}},children:(0,A.jsx)(N,{size:`sm`,children:`Viewing historical version — workflow definition has changed since this run`})})]}),v=g?.isVersionMismatch&&g?.historicalWorkflow?{...e,...g.historicalWorkflow}:e,y=(0,D.useMemo)(()=>{let e=g?.runData?.wire;return!e||!v.wires?v:{...v,wires:CZe(v.wires,e)}},[v,g?.runData?.wire]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(yZe,{header:_,showTabs:r,emptyPanelMessage:`Select a node to view its details`,runsPanel:g?(0,A.jsx)(DZe,{workflowName:d}):void 0,initialLeftCollapsed:r,initialRightCollapsed:r,children:(0,A.jsx)(j,{style:{height:`100%`,position:`relative`},children:(0,A.jsx)(EZe,{workflow:y,onPaneClick:p})})}),i&&(0,A.jsx)(j,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,zIndex:98},onClick:a}),(0,A.jsx)(Hp,{opened:i!==null,onClose:a,position:`right`,size:`md`,withOverlay:!1,withinPortal:!1,closeOnClickOutside:!1,withCloseButton:!1,styles:{inner:{top:`50px`,zIndex:99},content:{height:`100%`},header:{display:`none`},body:{padding:0}},children:m})]})};const kZe=e=>(0,A.jsx)(NAe,{workflow:e.workflow,children:(0,A.jsx)(oW,{children:(0,A.jsx)(OZe,{...e})})}),AZe=({immersiveDetail:e=!1})=>{let{workflowId:t,navigateTo:n}=XHe(),r=By(),{data:i,isLoading:a}=Rr({queryKey:[`workflow-meta-by-id`,t],queryFn:()=>r.invoke(`console:getWorkflowMetaById`,{workflowId:t}),enabled:!!t}),{meta:o}=R(),s=(0,D.useMemo)(()=>o.workflows?Object.entries(o.workflows).map(([e,t])=>({name:e,description:t.steps?`${t.steps.length} steps`:void 0})):[],[o.workflows]);return a?(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}):i?(0,A.jsx)(vx,{children:(0,A.jsx)(jAe,{workflowName:t,currentGraphHash:i.graphHash,workflowNodes:i.nodes,children:(0,A.jsx)(j,{h:`100vh`,className:fx.flexColumn,children:(0,A.jsx)(j,{className:`${fx.flexGrow} ${fx.overflowAuto}`,children:(0,A.jsx)(kZe,{workflow:i,items:s,onItemSelect:e=>n(`workflows`,e),immersiveDetail:e})})})})}):(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsxs)(N,{c:`dimmed`,children:[`Workflow "`,t,`" not found.`]})})};var jZe=({extraColumns:e,headerRight:t,immersiveDetail:n=!1})=>{let{workflowId:r}=XHe(),{meta:i,loading:a}=R(),{data:o}=Uk();if(r)return(0,A.jsx)(AZe,{immersiveDetail:n});if(a)return(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})});let s=i.workflows||{};return Object.keys(s).length>0||o&&o.length>0?(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{hidePanel:!0,children:(0,A.jsx)(eUe,{workflows:s,aiWorkflows:o,extraColumns:e,headerRight:t})})}):(0,A.jsx)(eUe,{workflows:s,aiWorkflows:o,extraColumns:e,headerRight:t})};const MZe=({extraColumns:e,headerRight:t,immersiveDetail:n=!1})=>{let r=(0,D.useContext)(YHe),i=(0,A.jsx)(D.Suspense,{fallback:(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}),children:(0,A.jsx)(jZe,{extraColumns:e,headerRight:t,immersiveDetail:n})});return r?i:(0,A.jsx)(QHe,{children:i})},OW=({icon:e,category:t,docsHref:n,tabs:r,activeTab:i,onTabChange:a,rightSection:o})=>(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,h:50,className:fx.noShrink,style:{zIndex:9999,borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-body)`},children:[(0,A.jsx)(rg,{value:i,onChange:e=>e&&a(e),style:{alignSelf:`stretch`},styles:{root:{display:`flex`,alignItems:`stretch`},list:{borderBottom:`none`,background:`transparent`,padding:0,gap:0}},children:(0,A.jsx)(rg.List,{children:r.map(e=>(0,A.jsx)(rg.Tab,{value:e.value,children:e.label},e.value))})}),(0,A.jsxs)(Sf,{ml:`auto`,gap:`sm`,children:[o,(0,A.jsx)(Ch,{label:`${t} docs`,children:(0,A.jsx)(_f,{component:`a`,href:n,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})]}),kW=({code:e,label:t,language:n=`typescript`})=>(0,A.jsxs)(j,{children:[t&&(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,tt:`uppercase`,mb:4,children:t}),(0,A.jsx)(iA,{code:e,language:n,copyLabel:`Copy`,copiedLabel:`Copied`})]});var AW=(e,t)=>{let n=[];return e.enum?n.push(e.enum.map(e=>JSON.stringify(e)).join(` | `)):e.type===`string`?n.push(e.format?`string (${e.format})`:`string`):e.type===`number`||e.type===`integer`?n.push(`number`):e.type===`boolean`?n.push(`boolean`):e.type===`array`?n.push(`[]`):e.type===`object`?n.push(`{}`):n.push(`unknown`),t||n.push(`undefined`),n.join(` | `)},NZe=(e,t)=>{if(!e?.properties)return null;let n=new Set(e.required||[]),r=Object.entries(e.properties).filter(([,e])=>typeof e==`object`).map(([e,r])=>`${t} ${e}: /* ${AW(r,n.has(e))} */ undefined,`);return r.length===0?null:`{\n${r.join(`
165
+ `}),(0,A.jsx)(iW,{nodes:o,edges:c,nodeTypes:DW,edgeTypes:wZe,defaultEdgeOptions:{style:{stroke:`#c0c0c0`,strokeWidth:1.5,strokeDasharray:`6 4`},animated:!0,markerEnd:{type:sU.ArrowClosed,color:`#c0c0c0`,width:16,height:16}},zoomOnScroll:!0,preventScrolling:!1,nodesConnectable:!1,nodesDraggable:!0,proOptions:{hideAttribution:!0},noDragClassName:`nodrag`,onPaneClick:t,children:(0,A.jsx)(dXe,{color:`#e0e0e0`,variant:aW.Dots,size:1})})]})},EZe=e=>(0,A.jsx)(nW,{children:(0,A.jsx)(TZe,{...e})}),DZe=({workflowName:e})=>{let{selectedRunId:t,setSelectedRunId:n,setIsCreatingRun:r}=kAe(),{setActivePanel:i}=_x(),a=zB(),o=By(),{data:s,isLoading:c,refetch:l}=CAe(e),u=(0,D.useMemo)(()=>!s||!Array.isArray(s)?[]:s,[s]),d=(0,D.useCallback)(async e=>{await o.invoke(`console:deleteWorkflowRun`,{runId:e}),t===e&&n(null),l()},[o,t,n,l]),f=(0,D.useCallback)(()=>{n(null),r(!0),i(`workflow-${e}`)},[n,r,i,e]);return(0,A.jsx)(pW,{title:`Runs`,runs:u,selectedId:t,onSelect:n,onClear:()=>n(null),loading:c,emptyMessage:`No runs found`,statusFilters:[],onNewClick:a?f:void 0,newButtonLabel:a?`New workflow run`:void 0,onDelete:a?d:void 0})},OZe=({workflow:e,items:t,onItemSelect:n,immersiveDetail:r=!1})=>{let{canvasDrawer:i,closeCanvasDrawer:a}=pXe(),{panels:o,activePanel:s,openWorkflow:c,setActivePanel:l}=_x(),{setFocusedNode:u}=Gk(),d=e.name||e.wireId||`Workflow`,f=`workflow-${d}`,p=(0,D.useCallback)(()=>{l(f)},[l,f]);(0,D.useEffect)(()=>{c(d,e)},[]),(0,D.useEffect)(()=>{if(!s){u(null);return}let e=o.get(s);e?.data.type===`workflowStep`?u(e.data.id):u(null)},[s,o,u]);let m=(0,D.useMemo)(()=>i?OXe(i.data):null,[i]),h=(e.source||`graph`)===`complex`,g=Wk(),_=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(sW,{icon:db,category:`Workflows`,docsHref:`https://pikku.dev/docs/wiring/workflows`,categoryPath:`/workflow`,currentItem:d,items:t,onItemSelect:n,subtitle:e.source?(0,A.jsx)(eS,{type:`dynamic`,badge:`source`,value:e.source}):void 0}),h&&(0,A.jsx)(If,{icon:(0,A.jsx)(zb,{size:16}),color:`yellow`,radius:0,py:`xs`,styles:{root:{borderBottom:`1px solid var(--mantine-color-default-border)`}},children:(0,A.jsxs)(Sf,{justify:`space-between`,align:`center`,children:[(0,A.jsx)(N,{size:`sm`,children:`This is a complex workflow. The visual representation may not be accurate.`}),(0,A.jsx)(N,{size:`sm`,c:`yellow.7`,style:{cursor:`pointer`,textDecoration:`underline`},children:`Learn more`})]})}),g?.isVersionMismatch&&(0,A.jsx)(If,{icon:(0,A.jsx)(Afe,{size:16}),color:`orange`,radius:0,py:`xs`,styles:{root:{borderBottom:`1px solid var(--mantine-color-default-border)`}},children:(0,A.jsx)(N,{size:`sm`,children:`Viewing historical version — workflow definition has changed since this run`})})]}),v=g?.isVersionMismatch&&g?.historicalWorkflow?{...e,...g.historicalWorkflow}:e,y=(0,D.useMemo)(()=>{let e=g?.runData?.wire;return!e||!v.wires?v:{...v,wires:CZe(v.wires,e)}},[v,g?.runData?.wire]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(yZe,{header:_,showTabs:r,emptyPanelMessage:`Select a node to view its details`,runsPanel:g?(0,A.jsx)(DZe,{workflowName:d}):void 0,initialLeftCollapsed:r,initialRightCollapsed:r,children:(0,A.jsx)(j,{style:{height:`100%`,position:`relative`},children:(0,A.jsx)(EZe,{workflow:y,onPaneClick:p})})}),i&&(0,A.jsx)(j,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,zIndex:98},onClick:a}),(0,A.jsx)(Hp,{opened:i!==null,onClose:a,position:`right`,size:`md`,withOverlay:!1,withinPortal:!1,closeOnClickOutside:!1,withCloseButton:!1,styles:{inner:{top:`50px`,zIndex:99},content:{height:`100%`},header:{display:`none`},body:{padding:0}},children:m})]})};const kZe=e=>(0,A.jsx)(NAe,{workflow:e.workflow,children:(0,A.jsx)(oW,{children:(0,A.jsx)(OZe,{...e})})}),AZe=({immersiveDetail:e=!1})=>{let{workflowId:t,navigateTo:n}=XHe(),r=By(),{data:i,isLoading:a}=Rr({queryKey:[`workflow-meta-by-id`,t],queryFn:()=>r.invoke(`console:getWorkflowMetaById`,{workflowId:t}),enabled:!!t}),{meta:o}=R(),s=(0,D.useMemo)(()=>o.workflows?Object.entries(o.workflows).map(([e,t])=>({name:e,description:t.steps?`${t.steps.length} steps`:void 0})):[],[o.workflows]);return a?(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}):i?(0,A.jsx)(vx,{children:(0,A.jsx)(jAe,{workflowName:t,currentGraphHash:i.graphHash,workflowNodes:i.nodes,children:(0,A.jsx)(j,{h:`100vh`,className:fx.flexColumn,children:(0,A.jsx)(j,{className:`${fx.flexGrow} ${fx.overflowAuto}`,children:(0,A.jsx)(kZe,{workflow:i,items:s,onItemSelect:e=>n(`workflows`,e),immersiveDetail:e})})})})}):(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsxs)(N,{c:`dimmed`,children:[`Workflow "`,t,`" not found.`]})})};var jZe=({extraColumns:e,headerRight:t,immersiveDetail:n=!1,icon:r})=>{let{workflowId:i}=XHe(),{meta:a,loading:o}=R(),{data:s}=Uk();if(i)return(0,A.jsx)(AZe,{immersiveDetail:n});if(o)return(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})});let c=a.workflows||{};return Object.keys(c).length>0||s&&s.length>0?(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{hidePanel:!0,children:(0,A.jsx)(eUe,{workflows:c,aiWorkflows:s,extraColumns:e,headerRight:t})})}):(0,A.jsx)(eUe,{workflows:c,aiWorkflows:s,extraColumns:e,headerRight:t,icon:r})};const MZe=({extraColumns:e,headerRight:t,immersiveDetail:n=!1,icon:r})=>{let i=(0,D.useContext)(YHe),a=(0,A.jsx)(D.Suspense,{fallback:(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}),children:(0,A.jsx)(jZe,{extraColumns:e,headerRight:t,immersiveDetail:n,icon:r})});return i?a:(0,A.jsx)(QHe,{children:a})},OW=({icon:e,category:t,docsHref:n,tabs:r,activeTab:i,onTabChange:a,rightSection:o})=>(0,A.jsxs)(Sf,{gap:`xs`,px:`md`,h:50,className:fx.noShrink,style:{zIndex:9999,borderBottom:`1px solid var(--mantine-color-default-border)`,backgroundColor:`var(--mantine-color-body)`},children:[(0,A.jsx)(rg,{value:i,onChange:e=>e&&a(e),style:{alignSelf:`stretch`},styles:{root:{display:`flex`,alignItems:`stretch`},list:{borderBottom:`none`,background:`transparent`,padding:0,gap:0}},children:(0,A.jsx)(rg.List,{children:r.map(e=>(0,A.jsx)(rg.Tab,{value:e.value,children:e.label},e.value))})}),(0,A.jsxs)(Sf,{ml:`auto`,gap:`sm`,children:[o,(0,A.jsx)(Ch,{label:`${t} docs`,children:(0,A.jsx)(_f,{component:`a`,href:n,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})]})]}),kW=({code:e,label:t,language:n=`typescript`})=>(0,A.jsxs)(j,{children:[t&&(0,A.jsx)(N,{size:`sm`,fw:600,c:`dimmed`,tt:`uppercase`,mb:4,children:t}),(0,A.jsx)(iA,{code:e,language:n,copyLabel:`Copy`,copiedLabel:`Copied`})]});var AW=(e,t)=>{let n=[];return e.enum?n.push(e.enum.map(e=>JSON.stringify(e)).join(` | `)):e.type===`string`?n.push(e.format?`string (${e.format})`:`string`):e.type===`number`||e.type===`integer`?n.push(`number`):e.type===`boolean`?n.push(`boolean`):e.type===`array`?n.push(`[]`):e.type===`object`?n.push(`{}`):n.push(`unknown`),t||n.push(`undefined`),n.join(` | `)},NZe=(e,t)=>{if(!e?.properties)return null;let n=new Set(e.required||[]),r=Object.entries(e.properties).filter(([,e])=>typeof e==`object`).map(([e,r])=>`${t} ${e}: /* ${AW(r,n.has(e))} */ undefined,`);return r.length===0?null:`{\n${r.join(`
166
166
  `)}\n${t}}`};const PZe=(e,t)=>{let n=(e?.method||`GET`).toUpperCase(),r=[`curl -X ${n} 'http://localhost:3000${(e?.route||`/`).replace(/:(\w+)/g,`{$1}`)}'`];if(e?.auth!==!1&&r.push(` -H 'Authorization: Bearer {token}'`),r.push(` -H 'Content-Type: application/json'`),[`POST`,`PUT`,`PATCH`].includes(n)){let e=NZe(t,` `);r.push(` -d '${e||`{ }`}'`)}return r.join(` \\
167
167
  `)},FZe=(e,t)=>{let n=(e?.method||`GET`).toUpperCase(),r=[`const response = await fetch('http://localhost:3000${(e?.route||`/`).replace(/:(\w+)/g,`{$1}`)}', {`,` method: '${n}',`,` headers: {`];if(e?.auth!==!1&&r.push(` 'Authorization': 'Bearer {token}',`),r.push(` 'Content-Type': 'application/json',`),r.push(` },`),[`POST`,`PUT`,`PATCH`].includes(n)){let e=NZe(t,` `);r.push(` body: JSON.stringify(${e||`{ }`}),`)}return r.push(`})`),r.push(`const data = await response.json()`),r.join(`
168
168
  `)},IZe=(e,t)=>{let n=(e?.method||`GET`).toLowerCase(),r=e?.route||`/`,i=[`post`,`put`,`patch`].includes(n),a=i?NZe(t,``):null;return[`import { pikkuFetch } from '.pikku/pikku-fetch.gen'`,``,`const result = await pikkuFetch.${n}('${r}'${a?`, ${a}`:i?`, { }`:``})`].join(`
@@ -181,7 +181,7 @@ Tool usage rules:
181
181
  - Never stuff unrelated information into the wrong field.
182
182
  - Keep responses concise.`),n?.agents?.length&&(i+=`
183
183
 
184
- When calling a sub-agent, provide a short session name that describes the task. Use the same session name to continue a previous conversation with that agent. Use a new session name for a new independent task. When a request involves multiple actions for the same domain, combine them into a single sub-agent call rather than making separate calls.`),i}function r$e(e,t,n){let r=[];return{channelId:`${e.channelId}:${t}:${n}`,openingData:e.openingData,get state(){return e.state},get approvals(){return r},close:()=>{},sendBinary:t=>e.sendBinary(t),send:i=>{if(i.type!==`done`){if(i.type===`approval-request`){r.push({toolCallId:i.toolCallId,toolName:i.toolName,args:i.args,runId:i.runId});return}i.type===`step-start`||i.type===`text-delta`||i.type===`reasoning-delta`||i.type===`tool-call`||i.type===`tool-result`||i.type===`usage`||i.type===`error`||i.type===`workflow-created`?e.send({...i,agent:t,session:n}):e.send(i)}},setState:t=>e.setState(t),getState:()=>e.getState(),clearState:()=>e.clearState()}}async function lG(e,t,n,r,i,a,o,s){let c=LW(),l=[],u=[],d=a?.options?.requiresToolApproval??`explicit`,f=IW(i,`agent`,`agentsMeta`)[r];if(!f)return{tools:l,missingRpcs:u};let p=e.sessionService?await e.sessionService.get():null,m=f.tools,h=f.agents;if(m?.length)for(let t of m){let n,r=null,i,a=t.includes(`:`)?pG(t):null,o;if(a)r=a.package,o=a.function,n=IW(r,`function`,`meta`)[o],i=IW(r,`misc`,`schemas`);else{if(o=IW(null,`rpc`,`meta`)[t],!o){u.push(t);continue}n=IW(null,`function`,`meta`)[o],i=IW(null,`misc`,`schemas`)}if(!n){u.push(t);continue}if(n.permissions?.length&&(!p||!await XW(n.permissions,p,c,r)))continue;let s=n?.inputSchemaName,f=s?i.get(s):void 0;(!f||typeof f==`object`&&f.type===`object`&&!f.properties)&&(f={type:`object`,properties:{}});let m=d===`all`||d===`explicit`&&n?.approvalRequired,h;if(m&&o){let e=IW(r,`function`,`functions`).get(o);if(e?.approvalDescription){let t=e.approvalDescription,n=r;h=async e=>{let r=c;if(n){let e=IW(n,`package`,`singletonServices`);e&&(r=e)}return t(r,e)}}}l.push({name:t.replaceAll(`@`,`_`).replaceAll(`:`,`__`),description:n?.description||n?.title||t,inputSchema:f,needsApproval:m||void 0,approvalDescriptionFn:h,execute:async n=>new l$e(c,e.sessionService?{...kQe(e.sessionService)}:{},{sessionService:e.sessionService}).rpc(t,n)})}if(h?.length){let r=IW(null,`agent`,`agentsMeta`);for(let i of h){let o=r[i];if(!o){c.logger.warn(`Sub-agent '${i}' not found in agent registry`);continue}o.permissions?.length&&(!p||!await XW(o.permissions,p,c))||l.push({name:i,description:o.description,inputSchema:{type:`object`,properties:{message:{type:`string`},session:{type:`string`,description:`Short session label for thread continuity`}},required:[`message`,`session`]},execute:async r=>{let{message:o,session:c}=r,l=`${i}::${c}`,u=t.get(l);if(u||(u=rG(),t.set(l,u)),a){let l=s!==`supervise`;l&&a.delegateState&&(a.delegateState.delegated=!0);let{channel:d}=a;d.send({type:`agent-call`,agentName:i,session:c,input:o});let f=r$e(d,i,c),p=l?f:{...f,send:e=>{e.type===`text-delta`||e.type===`reasoning-delta`||f.send(e)}},m=await QQe(i,{message:o,threadId:u,resourceId:n},p,e,t,a.options);return f.approvals.length>0?{__approvalRequired:!0,toolName:i,args:r,agentRunId:f.approvals[0].runId,subApprovals:f.approvals}:(d.send({type:`agent-result`,agentName:i,session:c,result:m}),m)}let d=await dG(i,{message:o,threadId:u,resourceId:n},e,t);return d.status===`suspended`&&d.pendingApprovals?.length?{__approvalRequired:!0,toolName:i,args:r,agentRunId:d.runId,subApprovals:d.pendingApprovals.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args,runId:e.runId}))}:d.object??d.text}})}}if(o?.some(e=>e.beforeToolCall||e.afterToolCall))for(let e of l){let t=e.execute;e.execute=async n=>{let r=rG(),i=n??{};for(let t of o)if(t.beforeToolCall){let n=await t.beforeToolCall(c,{toolName:e.name,toolCallId:r,args:i});n&&`args`in n&&(i=n.args)}let a=Date.now(),s,l;try{s=await t(i)}catch(e){if(l=e,e?.payload?.error===`missing_credential`)throw e;s=e instanceof Error?e.message:String(e)}let u=Date.now()-a;for(let t=o.length-1;t>=0;t--){let n=o[t];if(n.afterToolCall){let t=await n.afterToolCall(c,{toolName:e.name,toolCallId:r,args:i,result:s,durationMs:u});t&&`result`in t&&(s=t.result)}}if(l)throw l;return s}}return{tools:l,missingRpcs:u}}async function i$e(e,t,n,r,i){let a=LW(),{agent:o,packageName:s,resolvedName:c}=n$e(e),l=a.aiAgentRunner;if(!l)throw new VW;if(n.getCredential&&l.withApiKey){let e=await n.getCredential(`AI_API_KEY`);e?.apiKey?.trim()&&(l=l.withApiKey(e.apiKey))}let{storage:u}=PQe(o,a),d=o.memory,f=t.threadId,p=IW(s,`agent`,`agentsMeta`)[c],m=p?.outputSchema,h=m?IW(s,`misc`,`schemas`).get(m):void 0,g=p?.workingMemorySchema??null,_=g?IW(s,`misc`,`schemas`).get(g):void 0;if(u)try{await u.getThread(f)}catch{await u.createThread(t.resourceId,{threadId:f})}let v=[];u&&(v=await u.getMessages(f,{lastN:d?.lastMessages??20}));let y=await RQe(d,u,t,_),b=t.attachments?.length?[{type:`text`,text:t.message},...t.attachments.map(e=>({type:e.type,data:e.data,url:e.url,mediaType:e.mediaType,...e.filename?{filename:e.filename}:{}}))]:t.message,x={id:rG(),role:`user`,content:b,createdAt:new Date},S=eG([...y,...v,x]),C=o.aiMiddleware??[],{tools:w,missingRpcs:T}=await lG(n,r,t.resourceId,c,s,i,C,o.agentMode),E=await cG(c,s),D=iG(c,o);t.model&&(D.model=iG(c,{...o,model:t.model}).model),t.temperature!==void 0&&(D.temperature=t.temperature);let O=D.maxSteps??10,k={model:D.model,temperature:D.temperature,instructions:E,messages:S,tools:w,maxSteps:1,toolChoice:o.toolChoice??`auto`,outputSchema:h};return{agent:o,packageName:s,resolvedName:c,agentRunner:l,storage:u,memoryConfig:d,threadId:f,userMessage:x,runnerParams:k,maxSteps:O,missingRpcs:T,workingMemoryJsonSchema:_,workingMemorySchemaName:g}}function a$e(e){if(e===null)return;if(Array.isArray(e))return e.map(a$e);if(typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))r!==null&&(t[n]=a$e(r));return t}function uG(e){if(!e||typeof e!=`object`)return{text:null,uiSpec:null};let t=e;return{text:typeof t.text==`string`?t.text:null,uiSpec:t.ui??null}}async function dG(e,t,n,r){let{agent:i,agentRunner:a,storage:o,memoryConfig:s,threadId:c,userMessage:l,runnerParams:u,maxSteps:d,missingRpcs:f,workingMemorySchemaName:p}=await i$e(e,t,n,r??new Map);u.agentId=e;let m=LW(),{aiRunState:h}=m;if(!h)throw Error(`AIRunStateService not available in singletonServices`);if(f.length>0)return{runId:await h.createRun({agentName:e,threadId:c,resourceId:t.resourceId,status:`suspended`,suspendReason:`rpc-missing`,missingRpcs:f,usage:{inputTokens:0,outputTokens:0,model:i.model},createdAt:new Date,updatedAt:new Date}),text:``,threadId:c,steps:[],usage:{inputTokens:0,outputTokens:0}};let g=[...nG(s,o,{threadId:c,workingMemorySchemaName:p,logger:m.logger,schemaService:m.schema}),...i.aiMiddleware??[]],_=u.messages,v=u.instructions;for(let e of g)if(e.modifyInput){let t=await e.modifyInput(m,{messages:_,instructions:v});_=t.messages,v=t.instructions}u.messages=_,u.instructions=v;let y=await h.createRun({agentName:e,threadId:c,resourceId:t.resourceId,status:`running`,usage:{inputTokens:0,outputTokens:0,model:i.model},createdAt:new Date,updatedAt:new Date});try{let e=[],n={inputTokens:0,outputTokens:0},r=null;for(let f=0;f<d;f++){if(i.prepareStep){let e=!1;if(await i.prepareStep({stepNumber:f,messages:u.messages,tools:u.tools,toolChoice:u.toolChoice,model:u.model,stop:()=>{e=!0}}),e)break}let d=await a.run(u);r=d,n.inputTokens+=d.usage.inputTokens,n.outputTokens+=d.usage.outputTokens;for(let e of g)e.afterStep&&await e.afterStep(m,{stepNumber:f,text:d.text,toolCalls:d.toolCalls,toolResults:d.toolResults,usage:d.usage,finishReason:d.finishReason});if(e.push({usage:d.usage,toolCalls:d.toolCalls.map(e=>{let t=d.toolResults.find(t=>t.toolCallId===e.toolCallId);return{name:e.toolName,args:e.args,result:typeof t?.result==`string`?t.result:JSON.stringify(t?.result??``)}})}),d.toolCalls.length===0)break;let p=JQe(d,u.tools,y);if(p.length>0){for(let e of p){let t=u.tools.find(t=>t.name===e.toolName);if(t?.approvalDescriptionFn&&!e.reason)try{e.reason=await t.approvalDescriptionFn(e.args)}catch{}}let a=p.map(e=>e.agentRunId?{type:`agent-call`,toolCallId:e.toolCallId,agentName:e.toolName,agentRunId:e.agentRunId,displayToolName:e.displayToolName??e.toolName,displayArgs:e.displayArgs??e.args}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args}),f=e.slice(0,-1);return await $W(o,c,t.resourceId,s,l,{text:``,steps:f}),o&&await o.saveMessages(c,[{id:rG(),role:`assistant`,toolCalls:d.toolCalls.map(e=>({id:e.toolCallId,name:e.toolName,args:e.args})),createdAt:new Date}]),await h.updateRun(y,{status:`suspended`,suspendReason:`approval`,pendingApprovals:a,usage:{...n,model:i.model}}),{runId:y,text:r?.text??``,threadId:c,steps:e,usage:n,status:`suspended`,pendingApprovals:p.map(e=>({toolCallId:e.toolCallId,toolName:e.displayToolName??e.toolName,args:e.displayArgs??e.args,reason:e.reason,runId:y}))}}oG(u,d)}let f=r?.object,p=uG(f),_=p.text??r?.text??``,v={text:_,steps:e},b=_,x=u.messages;for(let e=g.length-1;e>=0;e--){let t=g[e];if(t.modifyOutput){let e=await t.modifyOutput(m,{text:b,messages:x,usage:n});b=e.text,x=e.messages}}return await $W(o,c,t.resourceId,s,l,{...v,text:b,uiSpec:p.uiSpec}),await h.updateRun(y,{status:`completed`,usage:{...n,model:i.model}}),{runId:y,text:b,object:f,threadId:c,steps:e,usage:n}}catch(e){for(let t of g)if(t.onError)try{await t.onError(m,{error:e instanceof Error?e:Error(String(e)),stepNumber:-1,messages:u.messages})}catch{}throw await h.updateRun(y,{status:`failed`,errorMessage:e instanceof Error?e.message:String(e)}),e}}async function o$e(e,t,n,r){let i=LW(),{aiRunState:a}=i;if(!a)throw Error(`AIRunStateService not available in singletonServices`);let o=await a.getRun(e);if(!o)throw Error(`No run found for runId ${e}`);if(r&&o.agentName!==r)throw Error(`Run ${e} belongs to agent '${o.agentName}', not '${r}'`);if(o.status!==`suspended`)throw Error(`Run ${e} is not suspended (status: ${o.status})`);let{agent:s,packageName:c,resolvedName:l}=n$e(o.agentName),{storage:u}=PQe(s,i),d=s.memory,f=i.aiAgentRunner;if(!f)throw new VW;let p=new Set(t.filter(e=>e.approved).map(e=>e.toolCallId)),m=new Set(t.filter(e=>!e.approved).map(e=>e.toolCallId)),h=[...o.pendingApprovals??[]];for(let{toolCallId:e,approved:n}of t)await a.resolveApproval(e,n?`approved`:`denied`);let{tools:g}=await lG(n,new Map,o.resourceId,l,c,void 0,s.aiMiddleware??[]),_=[];for(let e of h){if(e.type!==`tool-call`)continue;let t=e.toolCallId,n;if(m.has(t))n=`The user explicitly declined this action. Inform them that it was declined and do not retry.`;else if(p.has(t)){let t=g.find(t=>t.name===e.toolName);if(!t)throw Error(`Tool "${e.toolName}" not found in agent definition`);let r=a$e(typeof e.args==`string`?JSON.parse(e.args):e.args)??{};try{let e=await t.execute(r);n=typeof e==`string`?e:JSON.stringify(e)}catch(e){n=e?.payload?.error===`missing_credential`?JSON.stringify(e.payload):`Error: ${e instanceof Error?e.message:String(e)}`}}else continue;_.push({toolCallId:t,toolName:e.toolName,args:typeof e.args==`string`?JSON.parse(e.args):e.args,result:n})}return u&&_.length>0&&await u.saveMessages(o.threadId,[{id:rG(),role:`tool`,toolResults:_.map(e=>({id:e.toolCallId,name:e.toolName,result:e.result})),createdAt:new Date}]),await a.updateRun(e,{status:`running`}),s$e(o,s,c,l,u,d,f,n,a)}async function s$e(e,t,n,r,i,a,o,s,c){let l=LW(),u=IW(n,`agent`,`agentsMeta`)[r],d=u?.workingMemorySchema??null,f=i?await i.getMessages(e.threadId,{lastN:a?.lastMessages??20}):[],p=d?IW(n,`misc`,`schemas`).get(d):void 0,m=eG([...await RQe(a,i,{message:``,threadId:e.threadId,resourceId:e.resourceId},p),...f]),h=await cG(r,n),g=[...nG(a,i,{threadId:e.threadId,workingMemorySchemaName:d,logger:l.logger,schemaService:l.schema}),...t.aiMiddleware??[]],_=m,v=h;for(let e of g)if(e.modifyInput){let t=await e.modifyInput(l,{messages:_,instructions:v});_=t.messages,v=t.instructions}let{tools:y}=await lG(s,new Map,e.resourceId,r,n,void 0,g),b=iG(r,t),x=b.maxSteps??10,S={model:b.model,temperature:b.temperature,instructions:v,messages:_,tools:y,maxSteps:1,toolChoice:t.toolChoice??`auto`,outputSchema:u?.outputSchema?IW(n,`misc`,`schemas`).get(u.outputSchema):void 0,agentId:e.agentName};try{let n=[],r={inputTokens:0,outputTokens:0},s=null;for(let u=0;u<x;u++){let d=await o.run(S);s=d,r.inputTokens+=d.usage.inputTokens,r.outputTokens+=d.usage.outputTokens;for(let e of g)e.afterStep&&await e.afterStep(l,{stepNumber:u,text:d.text,toolCalls:d.toolCalls,toolResults:d.toolResults,usage:d.usage,finishReason:d.finishReason});if(n.push({usage:d.usage,toolCalls:d.toolCalls.map(e=>{let t=d.toolResults.find(t=>t.toolCallId===e.toolCallId);return{name:e.toolName,args:e.args,result:typeof t?.result==`string`?t.result:JSON.stringify(t?.result??``)}})}),d.toolCalls.length===0)break;let f=JQe(d,S.tools,e.runId);if(f.length>0){for(let e of f){let t=S.tools.find(t=>t.name===e.toolName);if(t?.approvalDescriptionFn&&!e.reason)try{e.reason=await t.approvalDescriptionFn(e.args)}catch{}}let o=f.map(e=>e.agentRunId?{type:`agent-call`,toolCallId:e.toolCallId,agentName:e.toolName,agentRunId:e.agentRunId,displayToolName:e.displayToolName??e.toolName,displayArgs:e.displayArgs??e.args}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args}),l=n.slice(0,-1);l.length>0&&await $W(i,e.threadId,e.resourceId,a,null,{text:``,steps:l}),i&&await i.saveMessages(e.threadId,[{id:rG(),role:`assistant`,toolCalls:d.toolCalls.map(e=>({id:e.toolCallId,name:e.toolName,args:e.args})),createdAt:new Date}]),await c.updateRun(e.runId,{status:`suspended`,suspendReason:`approval`,pendingApprovals:o,usage:{...r,model:t.model}});let u=s?.text??``;return{runId:e.runId,text:u,threadId:e.threadId,steps:n,usage:r,status:`suspended`,pendingApprovals:f.map(t=>({toolCallId:t.toolCallId,toolName:t.displayToolName??t.toolName,args:t.displayArgs??t.args,reason:t.reason,runId:e.runId}))}}oG(S,d)}let u=s?.text??``,d=s?.object,f={text:u,steps:n},p=u,m=S.messages;for(let e=g.length-1;e>=0;e--){let t=g[e];if(t.modifyOutput){let e=await t.modifyOutput(l,{text:p,messages:m,usage:r});p=e.text,m=e.messages}}return await $W(i,e.threadId,e.resourceId,a,null,{...f,text:p}),await c.updateRun(e.runId,{status:`completed`,usage:{...r,model:t.model}}),{runId:e.runId,text:p,object:d,threadId:e.threadId,steps:n,usage:r}}catch(t){for(let e of g)if(e.onError)try{await e.onError(l,{error:t instanceof Error?t:Error(String(t)),stepNumber:-1,messages:S.messages})}catch{}throw await c.updateRun(e.runId,{status:`failed`,errorMessage:t instanceof Error?t.message:String(t)}),t}}var fG=class extends RW{rpcName;constructor(e){super(`RPC function not found: ${e}`),this.rpcName=e}};zW(fG,{status:404,mcpCode:-32601,message:`RPC function not found.`});const pG=e=>{let t=e.indexOf(`:`);if(t===-1)return null;let n=e.substring(0,t),r=e.substring(t+1),i=IW(null,`addons`,`packages`).get(n);return i?{package:i.package,function:r,addonConfig:i}:null};var c$e=(e,t=null)=>{if(t){let n=IW(t,`function`,`meta`)?.[e];if(n)return{pikkuFuncId:n.pikkuFuncId||e,packageName:t}}let n=IW(null,`rpc`,`meta`),r=n[e];if(!r){let{baseName:t,version:i}=DQe(e);i!==null&&(r=n[t])}if(!r){let t=IW(null,`function`,`meta`)?.[e];if(t)return{pikkuFuncId:t.pikkuFuncId||e,packageName:null}}if(!r)throw new fG(e);return{pikkuFuncId:r,packageName:null}},l$e=class{services;wire;options;packageName;constructor(e,t,n,r=null){this.services=e,this.wire=t,this.options=n,this.packageName=r}async rpcExposed(e,t){let n;if(e.includes(`:`)){let t=pG(e);t&&(n=IW(t.package,`function`,`meta`)[t.function])}else{let t=c$e(e,this.packageName);n=IW(t.packageName,`function`,`meta`)[t.pikkuFuncId]}if(!n||!n.expose)throw new fG(e);return await this.rpc(e,t)}async rpc(e,t){let n=this.wire.rpc?.depth||0,r={...this.wire,rpc:this.wire.rpc?{...this.wire.rpc,depth:n+1,global:!1}:void 0};if(e.includes(`:`))try{return await this.invokeAddonFunction(e,t,r)}catch(e){if(!(e instanceof fG))throw e}try{let n=c$e(e,this.packageName);return await m$e(`rpc`,e,n.pikkuFuncId,{auth:this.options.requiresAuth,singletonServices:this.services,data:()=>t,wire:r,packageName:n.packageName})}catch(n){if(n instanceof fG&&this.services.deploymentService){let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}throw n}}async invokeAddonFunction(e,t,n){let r=pG(e);if(!r)throw new fG(e);let i=IW(r.package,`function`,`meta`)[r.function];if(!i)throw new fG(e);let a=i.pikkuFuncId||r.function,o=r.addonConfig?.auth??this.options.requiresAuth,s=[...r.addonConfig?.tags??[],...i.tags??[]];return m$e(`rpc`,e,a,{auth:o,singletonServices:this.services,data:()=>t,wire:n,packageName:r.package,tags:s})}async rpcWithWire(e,t,n){let r=this.wire.rpc?.depth||0,i={...this.wire,...n,rpc:this.wire.rpc?{...this.wire.rpc,depth:r+1,global:!1}:void 0};if(e.includes(`:`))return this.invokeAddonFunction(e,t,i);try{let n=c$e(e,this.packageName);return await m$e(`rpc`,e,n.pikkuFuncId,{auth:this.options.requiresAuth,singletonServices:this.services,data:()=>t,wire:i,packageName:n.packageName})}catch(n){if(n instanceof fG&&this.services.deploymentService){let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}throw n}}async startWorkflow(e,t,n){if(!this.services.workflowService)throw Error(`WorkflowService service not available`);let r=this.wire.workflowStep?.runId??this.wire.graph?.runId,i=n?.wire??{type:this.wire.wireType??`unknown`,id:this.wire.wireId,...r?{parentRunId:r}:{},...this.wire.pikkuUserId?{pikkuUserId:this.wire.pikkuUserId}:{}};return this.services.workflowService.startWorkflow(e,t,i,this,n)}get agent(){return{run:async(e,t)=>{let n=await dG(e,t,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)});return{runId:n.runId,result:n.object??n.text,usage:n.usage,...n.status===`suspended`&&{status:`suspended`,pendingApprovals:n.pendingApprovals}}},stream:async(e,t,n)=>{let r=this.wire.channel;if(!r)throw Error(`No channel available for streaming`);await QQe(e,t,r,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)},void 0,n)},resume:async(e,t,n)=>{let r=this.wire.channel;if(!r)throw Error(`No channel available for streaming`);await $Qe({runId:e,...t},r,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)},n)},approve:async(e,t,n)=>{let r=await o$e(e,t,{sessionService:this.options.sessionService},n);return{runId:r.runId,result:r.object??r.text,usage:r.usage,...r.status===`suspended`&&{status:`suspended`,pendingApprovals:r.pendingApprovals}}}}}async remote(e,t){if(!this.services.deploymentService)throw Error(`No DeploymentService configured for remote RPC: ${e}. Set up a DeploymentService to enable remote function calls.`);let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}};const u$e=new class{getContextRPCService(e,t,n,r=0,i=null){let a=new l$e(e,t,typeof n==`object`&&n?n:{requiresAuth:n},i);return{depth:r,global:!1,invoke:a.rpc.bind(a),remote:a.remote.bind(a),exposed:a.rpcExposed.bind(a),startWorkflow:a.startWorkflow.bind(a),get agent(){return a.agent},rpcWithWire:a.rpcWithWire.bind(a)}}};async function d$e(e,t,n){let r=AQe(e);r&&(e.pikkuUserId=r,n instanceof OQe&&n.setPikkuUserId(r));let{sessionStore:i}=t;if(!(!i||!r)&&!e.session){let t=await i.get(r);t&&(e.session=t,n?.setInitial(t))}}var f$e=e=>{let t=IW(null,`addons`,`packages`);if(!t)return null;for(let[n,r]of t.entries())if(r?.package===e)return n;return null},mG=(e,t)=>new Proxy(e,{get(e,n,r){if(n===`startWorkflow`||n===`runToCompletion`){let i=Reflect.get(e,n,r);return function(e,...n){if(typeof e==`string`&&!e.includes(`:`)){let n=f$e(t);n&&(e=`${n}:${e}`)}return i.call(this,e,...n)}}return Reflect.get(e,n,r)}}),p$e=async(e,t)=>{let n=IW(e,`package`,`singletonServices`);if(n)return n;let r=IW(e,`package`,`factories`);if(!r||!r.createSingletonServices)return t;let i=t.config;r.createConfig&&(i=await r.createConfig(t.variables));let a=await r.createSingletonServices(i,t);return a.workflowService&&typeof a.workflowService==`object`&&(a.workflowService=mG(a.workflowService,e)),IW(e,`package`,`singletonServices`,a),a};const m$e=async(e,t,n,{singletonServices:r,createWireServices:i,data:a,auth:o,inheritedMiddleware:s,wireMiddleware:c,inheritedChannelMiddleware:l,wireChannelMiddleware:u,inheritedPermissions:d,wirePermissions:f,coerceDataFromSchema:p,tags:m=[],wire:h,sessionService:g,credentialWireService:_,packageName:v=null})=>{h.wireType??=e,h.wireId??=t;let y=IW(v,`function`,`functions`),b=y.get(n),x=IW(v,`function`,`meta`),S=x[n];if(!b||!S){let{baseName:e,version:t}=DQe(n);t!==null&&(b||=y.get(e),S||=x[e],b&&S&&r.logger.warn(`Version '${n}' not registered, resolved to '${e}'`))}if(!b)throw Error(`Function not found: ${n}`);if(!S)throw Error(`Function meta not found: ${n}`);let C=S.pikkuFuncId??n,w=v?await p$e(v,r):r,T=i;if(v){let e=IW(v,`package`,`factories`);e?.createWireServices&&(T=e.createWireServices)}let E=qW(e,t,{wireInheritedChannelMiddleware:l,wireChannelMiddleware:u,packageName:v}),D=E.length>0&&h.channel?JW(h,w,E):h;if(!D.getCredentials){let e=_??new jQe(w.credentialService,D);Object.assign(D,MQe(e))}let O=NQe(b.audit),k=D,ee=k.functionId,te=k.audit,ne=Object.getOwnPropertyDescriptor(k,`rpc`);k.functionId=C,k.audit=O;let re;re=m&&m.length>0?[...d||[],...m.map(e=>({type:`tag`,tag:e}))]:d||[];let ie=async()=>{await d$e(k,w,g),g&&(k.session=g.freezeInitial(),k.setSession=e=>g.set(e),k.clearSession=()=>g.clear(),k.getSession=()=>g.get(),k.hasSessionChanged=()=>g.sessionChanged);let r=k.session;if(S.sessionless){if((o===!0||b.auth===!0)&&!r)throw new BW(`Authentication required`)}else if(S.sessionless===!1){if((o===!1||b.auth===!1)&&w.logger.warn(`Function '${n}' requires a session but auth was explicitly disabled — use pikkuSessionlessFunc instead.`),!r)throw new BW(`Authentication required`)}else if((o===!0||b.auth===!0)&&!r)throw new BW(`Authentication required`);if(r?.readonly&&!S.readonly)throw new cQe;let i=await a(),s=S.inputSchemaName;s&&(p&&TQe(s,i,v),await ZW(w.logger,w.schema,s,i,v)),(re.length>0||f||S.permissions||b.permissions)&&await CQe(e,t,{wireInheritedPermissions:re,wirePermissions:f,funcInheritedPermissions:S.permissions,funcPermissions:b.permissions,services:w,wire:k,data:i,packageName:v});let c;try{c=await T?.(w,k);let e=c&&Object.keys(c).length>0?{...w,...c}:w,t=v;return Object.defineProperty(k,`rpc`,{get(){let n=u$e.getContextRPCService(e,k,{sessionService:g},0,t);return Object.defineProperty(k,`rpc`,{value:n,writable:!0,configurable:!0}),n},configurable:!0,enumerable:!0}),await b.func(e,i,k)}finally{c&&Object.keys(c).length>0&&await dQe(w.logger,c)}},ae=yQe(e,t,{wireInheritedMiddleware:s,wireMiddleware:c,funcInheritedMiddleware:S.middleware,funcMiddleware:b.middleware,packageName:v});if(ae.length>0)try{return await gQe(w,k,ae,ie)}finally{ne&&Object.defineProperty(k,`rpc`,ne),ee===void 0?delete k.functionId:k.functionId=ee,te===void 0?delete k.audit:k.audit=te}try{return await ie()}finally{ne&&Object.defineProperty(k,`rpc`,ne),ee===void 0?delete k.functionId:k.functionId=ee,te===void 0?delete k.audit:k.audit=te}};function h$e(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function g$e(e,t){if(t.length===0)return null;let n=e.commands[t[0]];if(!n)return null;for(let e=1;e<t.length;e++){if(!n.subcommands||!n.subcommands[t[e]])return null;n=n.subcommands[t[e]]}return n}function _$e(e,t){let n={...e.options};if(t.length===0)return n;let r=e.commands[t[0]];if(r){n={...n,...r.options};for(let e=1;e<t.length;e++)r.subcommands&&r.subcommands[t[e]]&&(r=r.subcommands[t[e]],n={...n,...r.options})}return n}function X(e,t,n=[]){let r=[],i=t.programs[e];if(!i)return`Program not found: ${e}`;if(n.length===0){r.push(`Usage: ${e} <command> [options]`),r.push(``),r.push(`Commands:`);for(let[e,t]of Object.entries(i.commands)){let n=t.description||``,i=t.isDefault?` (default)`:``;r.push(` ${e.padEnd(20)} ${n}${i}`)}Object.keys(i.options).length>0&&(r.push(``),r.push(`Options:`),hG(i.options,r))}else{let t=g$e(i,n);if(!t)return`Unknown command: ${n.join(` `)}`;let a=`${e} ${n.join(` `)}`;if(t.parameters&&(a+=` `+t.parameters),r.push(`Usage: ${a} [options]`),t.description&&(r.push(``),r.push(t.description)),t.positionals.length>0){r.push(``),r.push(`Arguments:`);for(let e of t.positionals){let t=e.required?`<required>`:`[optional]`,n=e.variadic?`...`:``;r.push(` ${e.name}${n} ${t}`)}}if(t.subcommands&&Object.keys(t.subcommands).length>0){r.push(``),r.push(`Subcommands:`);for(let[e,n]of Object.entries(t.subcommands)){let t=n.description||``;r.push(` ${e.padEnd(20)} ${t}`)}}let o=_$e(i,n);Object.keys(o).length>0&&(r.push(``),r.push(`Options:`),hG(o,r))}return r.join(`
184
+ When calling a sub-agent, provide a short session name that describes the task. Use the same session name to continue a previous conversation with that agent. Use a new session name for a new independent task. When a request involves multiple actions for the same domain, combine them into a single sub-agent call rather than making separate calls.`),i}function r$e(e,t,n){let r=[];return{channelId:`${e.channelId}:${t}:${n}`,openingData:e.openingData,get state(){return e.state},get approvals(){return r},close:()=>{},sendBinary:t=>e.sendBinary(t),send:i=>{if(i.type!==`done`){if(i.type===`approval-request`){r.push({toolCallId:i.toolCallId,toolName:i.toolName,args:i.args,runId:i.runId});return}i.type===`step-start`||i.type===`text-delta`||i.type===`reasoning-delta`||i.type===`tool-call`||i.type===`tool-result`||i.type===`usage`||i.type===`error`||i.type===`workflow-created`?e.send({...i,agent:t,session:n}):e.send(i)}},setState:t=>e.setState(t),getState:()=>e.getState(),clearState:()=>e.clearState()}}async function lG(e,t,n,r,i,a,o,s){let c=LW(),l=[],u=[],d=a?.options?.requiresToolApproval??`explicit`,f=IW(i,`agent`,`agentsMeta`)[r];if(!f)return{tools:l,missingRpcs:u};let p=e.sessionService?await e.sessionService.get():null,m=f.tools,h=f.agents;if(m?.length)for(let t of m){let n,r=null,i,a=t.includes(`:`)?pG(t):null,o;if(a)r=a.package,o=a.function,n=IW(r,`function`,`meta`)[o],i=IW(r,`misc`,`schemas`);else{if(o=IW(null,`rpc`,`meta`)[t],!o){u.push(t);continue}n=IW(null,`function`,`meta`)[o],i=IW(null,`misc`,`schemas`)}if(!n){u.push(t);continue}if(n.permissions?.length&&(!p||!await XW(n.permissions,p,c,r)))continue;let s=n?.inputSchemaName,f=s?i.get(s):void 0;(!f||typeof f==`object`&&f.type===`object`&&!f.properties)&&(f={type:`object`,properties:{}});let m=d===`all`||d===`explicit`&&n?.approvalRequired,h;if(m&&o){let e=IW(r,`function`,`functions`).get(o);if(e?.approvalDescription){let t=e.approvalDescription,n=r;h=async e=>{let r=c;if(n){let e=IW(n,`package`,`singletonServices`);e&&(r=e)}return t(r,e)}}}l.push({name:t.replaceAll(`@`,`_`).replaceAll(`:`,`__`),description:n?.description||n?.title||t,inputSchema:f,needsApproval:m||void 0,approvalDescriptionFn:h,execute:async n=>new l$e(c,e.sessionService?{...kQe(e.sessionService)}:{},{sessionService:e.sessionService}).rpc(t,n)})}if(h?.length){let r=IW(null,`agent`,`agentsMeta`);for(let i of h){let o=r[i];if(!o){c.logger.warn(`Sub-agent '${i}' not found in agent registry`);continue}o.permissions?.length&&(!p||!await XW(o.permissions,p,c))||l.push({name:i,description:o.description,inputSchema:{type:`object`,properties:{message:{type:`string`},session:{type:`string`,description:`Short session label for thread continuity`}},required:[`message`,`session`]},execute:async r=>{let{message:o,session:c}=r,l=`${i}::${c}`,u=t.get(l);if(u||(u=rG(),t.set(l,u)),a){let l=s!==`supervise`;l&&a.delegateState&&(a.delegateState.delegated=!0);let{channel:d}=a;d.send({type:`agent-call`,agentName:i,session:c,input:o});let f=r$e(d,i,c),p=l?f:{...f,send:e=>{e.type===`text-delta`||e.type===`reasoning-delta`||f.send(e)}},m=await QQe(i,{message:o,threadId:u,resourceId:n},p,e,t,a.options);return f.approvals.length>0?{__approvalRequired:!0,toolName:i,args:r,agentRunId:f.approvals[0].runId,subApprovals:f.approvals}:(d.send({type:`agent-result`,agentName:i,session:c,result:m}),m)}let d=await dG(i,{message:o,threadId:u,resourceId:n},e,t);return d.status===`suspended`&&d.pendingApprovals?.length?{__approvalRequired:!0,toolName:i,args:r,agentRunId:d.runId,subApprovals:d.pendingApprovals.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args,runId:e.runId}))}:d.object??d.text}})}}if(o?.some(e=>e.beforeToolCall||e.afterToolCall))for(let e of l){let t=e.execute;e.execute=async n=>{let r=rG(),i=n??{};for(let t of o)if(t.beforeToolCall){let n=await t.beforeToolCall(c,{toolName:e.name,toolCallId:r,args:i});n&&`args`in n&&(i=n.args)}let a=Date.now(),s,l;try{s=await t(i)}catch(e){if(l=e,e?.payload?.error===`missing_credential`)throw e;s=e instanceof Error?e.message:String(e)}let u=Date.now()-a;for(let t=o.length-1;t>=0;t--){let n=o[t];if(n.afterToolCall){let t=await n.afterToolCall(c,{toolName:e.name,toolCallId:r,args:i,result:s,durationMs:u});t&&`result`in t&&(s=t.result)}}if(l)throw l;return s}}return{tools:l,missingRpcs:u}}async function i$e(e,t,n,r,i){let a=LW(),{agent:o,packageName:s,resolvedName:c}=n$e(e),l=a.aiAgentRunner;if(!l)throw new VW;if(n.getCredential&&l.withApiKey){let e=await n.getCredential(`AI_API_KEY`);e?.apiKey?.trim()&&(l=l.withApiKey(e.apiKey))}let{storage:u}=PQe(o,a),d=o.memory,f=t.threadId,p=IW(s,`agent`,`agentsMeta`)[c],m=p?.outputSchema,h=m?IW(s,`misc`,`schemas`).get(m):void 0,g=p?.workingMemorySchema??null,_=g?IW(s,`misc`,`schemas`).get(g):void 0;if(u)try{await u.getThread(f)}catch{await u.createThread(t.resourceId,{threadId:f})}let v=[];u&&(v=await u.getMessages(f,{lastN:d?.lastMessages??20}));let y=await RQe(d,u,t,_),b=t.attachments?.length?[{type:`text`,text:t.message},...t.attachments.map(e=>({type:e.type,data:e.data,url:e.url,mediaType:e.mediaType,...e.filename?{filename:e.filename}:{}}))]:t.message,x={id:rG(),role:`user`,content:b,createdAt:new Date},S=eG([...y,...v,x]),C=o.aiMiddleware??[],{tools:w,missingRpcs:T}=await lG(n,r,t.resourceId,c,s,i,C,o.agentMode),E=await cG(c,s);t.context&&(E=`${E}\n\nCurrent context (use these identifiers directly in tool calls — do not ask the user for them):\n${t.context}`);let D=iG(c,o);t.model&&(D.model=iG(c,{...o,model:t.model}).model),t.temperature!==void 0&&(D.temperature=t.temperature);let O=D.maxSteps??10,k={model:D.model,temperature:D.temperature,instructions:E,messages:S,tools:w,maxSteps:1,toolChoice:o.toolChoice??`auto`,outputSchema:h};return{agent:o,packageName:s,resolvedName:c,agentRunner:l,storage:u,memoryConfig:d,threadId:f,userMessage:x,runnerParams:k,maxSteps:O,missingRpcs:T,workingMemoryJsonSchema:_,workingMemorySchemaName:g}}function a$e(e){if(e===null)return;if(Array.isArray(e))return e.map(a$e);if(typeof e!=`object`)return e;let t={};for(let[n,r]of Object.entries(e))r!==null&&(t[n]=a$e(r));return t}function uG(e){if(!e||typeof e!=`object`)return{text:null,uiSpec:null};let t=e;return{text:typeof t.text==`string`?t.text:null,uiSpec:t.ui??null}}async function dG(e,t,n,r){let{agent:i,agentRunner:a,storage:o,memoryConfig:s,threadId:c,userMessage:l,runnerParams:u,maxSteps:d,missingRpcs:f,workingMemorySchemaName:p}=await i$e(e,t,n,r??new Map);u.agentId=e;let m=LW(),{aiRunState:h}=m;if(!h)throw Error(`AIRunStateService not available in singletonServices`);if(f.length>0)return{runId:await h.createRun({agentName:e,threadId:c,resourceId:t.resourceId,status:`suspended`,suspendReason:`rpc-missing`,missingRpcs:f,usage:{inputTokens:0,outputTokens:0,model:i.model},createdAt:new Date,updatedAt:new Date}),text:``,threadId:c,steps:[],usage:{inputTokens:0,outputTokens:0}};let g=[...nG(s,o,{threadId:c,workingMemorySchemaName:p,logger:m.logger,schemaService:m.schema}),...i.aiMiddleware??[]],_=u.messages,v=u.instructions;for(let e of g)if(e.modifyInput){let t=await e.modifyInput(m,{messages:_,instructions:v});_=t.messages,v=t.instructions}u.messages=_,u.instructions=v;let y=await h.createRun({agentName:e,threadId:c,resourceId:t.resourceId,status:`running`,usage:{inputTokens:0,outputTokens:0,model:i.model},createdAt:new Date,updatedAt:new Date});try{let e=[],n={inputTokens:0,outputTokens:0},r=null;for(let f=0;f<d;f++){if(i.prepareStep){let e=!1;if(await i.prepareStep({stepNumber:f,messages:u.messages,tools:u.tools,toolChoice:u.toolChoice,model:u.model,stop:()=>{e=!0}}),e)break}let d=await a.run(u);r=d,n.inputTokens+=d.usage.inputTokens,n.outputTokens+=d.usage.outputTokens;for(let e of g)e.afterStep&&await e.afterStep(m,{stepNumber:f,text:d.text,toolCalls:d.toolCalls,toolResults:d.toolResults,usage:d.usage,finishReason:d.finishReason});if(e.push({usage:d.usage,toolCalls:d.toolCalls.map(e=>{let t=d.toolResults.find(t=>t.toolCallId===e.toolCallId);return{name:e.toolName,args:e.args,result:typeof t?.result==`string`?t.result:JSON.stringify(t?.result??``)}})}),d.toolCalls.length===0)break;let p=JQe(d,u.tools,y);if(p.length>0){for(let e of p){let t=u.tools.find(t=>t.name===e.toolName);if(t?.approvalDescriptionFn&&!e.reason)try{e.reason=await t.approvalDescriptionFn(e.args)}catch{}}let a=p.map(e=>e.agentRunId?{type:`agent-call`,toolCallId:e.toolCallId,agentName:e.toolName,agentRunId:e.agentRunId,displayToolName:e.displayToolName??e.toolName,displayArgs:e.displayArgs??e.args}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args}),f=e.slice(0,-1);return await $W(o,c,t.resourceId,s,l,{text:``,steps:f}),o&&await o.saveMessages(c,[{id:rG(),role:`assistant`,toolCalls:d.toolCalls.map(e=>({id:e.toolCallId,name:e.toolName,args:e.args})),createdAt:new Date}]),await h.updateRun(y,{status:`suspended`,suspendReason:`approval`,pendingApprovals:a,usage:{...n,model:i.model}}),{runId:y,text:r?.text??``,threadId:c,steps:e,usage:n,status:`suspended`,pendingApprovals:p.map(e=>({toolCallId:e.toolCallId,toolName:e.displayToolName??e.toolName,args:e.displayArgs??e.args,reason:e.reason,runId:y}))}}oG(u,d)}let f=r?.object,p=uG(f),_=p.text??r?.text??``,v={text:_,steps:e},b=_,x=u.messages;for(let e=g.length-1;e>=0;e--){let t=g[e];if(t.modifyOutput){let e=await t.modifyOutput(m,{text:b,messages:x,usage:n});b=e.text,x=e.messages}}return await $W(o,c,t.resourceId,s,l,{...v,text:b,uiSpec:p.uiSpec}),await h.updateRun(y,{status:`completed`,usage:{...n,model:i.model}}),{runId:y,text:b,object:f,threadId:c,steps:e,usage:n}}catch(e){for(let t of g)if(t.onError)try{await t.onError(m,{error:e instanceof Error?e:Error(String(e)),stepNumber:-1,messages:u.messages})}catch{}throw await h.updateRun(y,{status:`failed`,errorMessage:e instanceof Error?e.message:String(e)}),e}}async function o$e(e,t,n,r){let i=LW(),{aiRunState:a}=i;if(!a)throw Error(`AIRunStateService not available in singletonServices`);let o=await a.getRun(e);if(!o)throw Error(`No run found for runId ${e}`);if(r&&o.agentName!==r)throw Error(`Run ${e} belongs to agent '${o.agentName}', not '${r}'`);if(o.status!==`suspended`)throw Error(`Run ${e} is not suspended (status: ${o.status})`);let{agent:s,packageName:c,resolvedName:l}=n$e(o.agentName),{storage:u}=PQe(s,i),d=s.memory,f=i.aiAgentRunner;if(!f)throw new VW;let p=new Set(t.filter(e=>e.approved).map(e=>e.toolCallId)),m=new Set(t.filter(e=>!e.approved).map(e=>e.toolCallId)),h=[...o.pendingApprovals??[]];for(let{toolCallId:e,approved:n}of t)await a.resolveApproval(e,n?`approved`:`denied`);let{tools:g}=await lG(n,new Map,o.resourceId,l,c,void 0,s.aiMiddleware??[]),_=[];for(let e of h){if(e.type!==`tool-call`)continue;let t=e.toolCallId,n;if(m.has(t))n=`The user explicitly declined this action. Inform them that it was declined and do not retry.`;else if(p.has(t)){let t=g.find(t=>t.name===e.toolName);if(!t)throw Error(`Tool "${e.toolName}" not found in agent definition`);let r=a$e(typeof e.args==`string`?JSON.parse(e.args):e.args)??{};try{let e=await t.execute(r);n=typeof e==`string`?e:JSON.stringify(e)}catch(e){n=e?.payload?.error===`missing_credential`?JSON.stringify(e.payload):`Error: ${e instanceof Error?e.message:String(e)}`}}else continue;_.push({toolCallId:t,toolName:e.toolName,args:typeof e.args==`string`?JSON.parse(e.args):e.args,result:n})}return u&&_.length>0&&await u.saveMessages(o.threadId,[{id:rG(),role:`tool`,toolResults:_.map(e=>({id:e.toolCallId,name:e.toolName,result:e.result})),createdAt:new Date}]),await a.updateRun(e,{status:`running`}),s$e(o,s,c,l,u,d,f,n,a)}async function s$e(e,t,n,r,i,a,o,s,c){let l=LW(),u=IW(n,`agent`,`agentsMeta`)[r],d=u?.workingMemorySchema??null,f=i?await i.getMessages(e.threadId,{lastN:a?.lastMessages??20}):[],p=d?IW(n,`misc`,`schemas`).get(d):void 0,m=eG([...await RQe(a,i,{message:``,threadId:e.threadId,resourceId:e.resourceId},p),...f]),h=await cG(r,n),g=[...nG(a,i,{threadId:e.threadId,workingMemorySchemaName:d,logger:l.logger,schemaService:l.schema}),...t.aiMiddleware??[]],_=m,v=h;for(let e of g)if(e.modifyInput){let t=await e.modifyInput(l,{messages:_,instructions:v});_=t.messages,v=t.instructions}let{tools:y}=await lG(s,new Map,e.resourceId,r,n,void 0,g),b=iG(r,t),x=b.maxSteps??10,S={model:b.model,temperature:b.temperature,instructions:v,messages:_,tools:y,maxSteps:1,toolChoice:t.toolChoice??`auto`,outputSchema:u?.outputSchema?IW(n,`misc`,`schemas`).get(u.outputSchema):void 0,agentId:e.agentName};try{let n=[],r={inputTokens:0,outputTokens:0},s=null;for(let u=0;u<x;u++){let d=await o.run(S);s=d,r.inputTokens+=d.usage.inputTokens,r.outputTokens+=d.usage.outputTokens;for(let e of g)e.afterStep&&await e.afterStep(l,{stepNumber:u,text:d.text,toolCalls:d.toolCalls,toolResults:d.toolResults,usage:d.usage,finishReason:d.finishReason});if(n.push({usage:d.usage,toolCalls:d.toolCalls.map(e=>{let t=d.toolResults.find(t=>t.toolCallId===e.toolCallId);return{name:e.toolName,args:e.args,result:typeof t?.result==`string`?t.result:JSON.stringify(t?.result??``)}})}),d.toolCalls.length===0)break;let f=JQe(d,S.tools,e.runId);if(f.length>0){for(let e of f){let t=S.tools.find(t=>t.name===e.toolName);if(t?.approvalDescriptionFn&&!e.reason)try{e.reason=await t.approvalDescriptionFn(e.args)}catch{}}let o=f.map(e=>e.agentRunId?{type:`agent-call`,toolCallId:e.toolCallId,agentName:e.toolName,agentRunId:e.agentRunId,displayToolName:e.displayToolName??e.toolName,displayArgs:e.displayArgs??e.args}:{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args}),l=n.slice(0,-1);l.length>0&&await $W(i,e.threadId,e.resourceId,a,null,{text:``,steps:l}),i&&await i.saveMessages(e.threadId,[{id:rG(),role:`assistant`,toolCalls:d.toolCalls.map(e=>({id:e.toolCallId,name:e.toolName,args:e.args})),createdAt:new Date}]),await c.updateRun(e.runId,{status:`suspended`,suspendReason:`approval`,pendingApprovals:o,usage:{...r,model:t.model}});let u=s?.text??``;return{runId:e.runId,text:u,threadId:e.threadId,steps:n,usage:r,status:`suspended`,pendingApprovals:f.map(t=>({toolCallId:t.toolCallId,toolName:t.displayToolName??t.toolName,args:t.displayArgs??t.args,reason:t.reason,runId:e.runId}))}}oG(S,d)}let u=s?.text??``,d=s?.object,f={text:u,steps:n},p=u,m=S.messages;for(let e=g.length-1;e>=0;e--){let t=g[e];if(t.modifyOutput){let e=await t.modifyOutput(l,{text:p,messages:m,usage:r});p=e.text,m=e.messages}}return await $W(i,e.threadId,e.resourceId,a,null,{...f,text:p}),await c.updateRun(e.runId,{status:`completed`,usage:{...r,model:t.model}}),{runId:e.runId,text:p,object:d,threadId:e.threadId,steps:n,usage:r}}catch(t){for(let e of g)if(e.onError)try{await e.onError(l,{error:t instanceof Error?t:Error(String(t)),stepNumber:-1,messages:S.messages})}catch{}throw await c.updateRun(e.runId,{status:`failed`,errorMessage:t instanceof Error?t.message:String(t)}),t}}var fG=class extends RW{rpcName;constructor(e){super(`RPC function not found: ${e}`),this.rpcName=e}};zW(fG,{status:404,mcpCode:-32601,message:`RPC function not found.`});const pG=e=>{let t=e.indexOf(`:`);if(t===-1)return null;let n=e.substring(0,t),r=e.substring(t+1),i=IW(null,`addons`,`packages`).get(n);return i?{package:i.package,function:r,addonConfig:i}:null};var c$e=(e,t=null)=>{if(t){let n=IW(t,`function`,`meta`)?.[e];if(n)return{pikkuFuncId:n.pikkuFuncId||e,packageName:t}}let n=IW(null,`rpc`,`meta`),r=n[e];if(!r){let{baseName:t,version:i}=DQe(e);i!==null&&(r=n[t])}if(!r){let t=IW(null,`function`,`meta`)?.[e];if(t)return{pikkuFuncId:t.pikkuFuncId||e,packageName:null}}if(!r)throw new fG(e);return{pikkuFuncId:r,packageName:null}},l$e=class{services;wire;options;packageName;constructor(e,t,n,r=null){this.services=e,this.wire=t,this.options=n,this.packageName=r}async rpcExposed(e,t){let n;if(e.includes(`:`)){let t=pG(e);t&&(n=IW(t.package,`function`,`meta`)[t.function])}else{let t=c$e(e,this.packageName);n=IW(t.packageName,`function`,`meta`)[t.pikkuFuncId]}if(!n||!n.expose)throw new fG(e);return await this.rpc(e,t)}async rpc(e,t){let n=this.wire.rpc?.depth||0,r={...this.wire,rpc:this.wire.rpc?{...this.wire.rpc,depth:n+1,global:!1}:void 0};if(e.includes(`:`))try{return await this.invokeAddonFunction(e,t,r)}catch(e){if(!(e instanceof fG))throw e}try{let n=c$e(e,this.packageName);return await m$e(`rpc`,e,n.pikkuFuncId,{auth:this.options.requiresAuth,singletonServices:this.services,data:()=>t,wire:r,packageName:n.packageName})}catch(n){if(n instanceof fG&&this.services.deploymentService){let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}throw n}}async invokeAddonFunction(e,t,n){let r=pG(e);if(!r)throw new fG(e);let i=IW(r.package,`function`,`meta`)[r.function];if(!i)throw new fG(e);let a=i.pikkuFuncId||r.function,o=r.addonConfig?.auth??this.options.requiresAuth,s=[...r.addonConfig?.tags??[],...i.tags??[]];return m$e(`rpc`,e,a,{auth:o,singletonServices:this.services,data:()=>t,wire:n,packageName:r.package,tags:s})}async rpcWithWire(e,t,n){let r=this.wire.rpc?.depth||0,i={...this.wire,...n,rpc:this.wire.rpc?{...this.wire.rpc,depth:r+1,global:!1}:void 0};if(e.includes(`:`))return this.invokeAddonFunction(e,t,i);try{let n=c$e(e,this.packageName);return await m$e(`rpc`,e,n.pikkuFuncId,{auth:this.options.requiresAuth,singletonServices:this.services,data:()=>t,wire:i,packageName:n.packageName})}catch(n){if(n instanceof fG&&this.services.deploymentService){let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}throw n}}async startWorkflow(e,t,n){if(!this.services.workflowService)throw Error(`WorkflowService service not available`);let r=this.wire.workflowStep?.runId??this.wire.graph?.runId,i=n?.wire??{type:this.wire.wireType??`unknown`,id:this.wire.wireId,...r?{parentRunId:r}:{},...this.wire.pikkuUserId?{pikkuUserId:this.wire.pikkuUserId}:{}};return this.services.workflowService.startWorkflow(e,t,i,this,n)}get agent(){return{run:async(e,t)=>{let n=await dG(e,t,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)});return{runId:n.runId,result:n.object??n.text,usage:n.usage,...n.status===`suspended`&&{status:`suspended`,pendingApprovals:n.pendingApprovals}}},stream:async(e,t,n)=>{let r=this.wire.channel;if(!r)throw Error(`No channel available for streaming`);await QQe(e,t,r,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)},void 0,n)},resume:async(e,t,n)=>{let r=this.wire.channel;if(!r)throw Error(`No channel available for streaming`);await $Qe({runId:e,...t},r,{sessionService:this.options.sessionService,getCredential:this.wire.getCredential?.bind(this.wire)},n)},approve:async(e,t,n)=>{let r=await o$e(e,t,{sessionService:this.options.sessionService},n);return{runId:r.runId,result:r.object??r.text,usage:r.usage,...r.status===`suspended`&&{status:`suspended`,pendingApprovals:r.pendingApprovals}}}}}async remote(e,t){if(!this.services.deploymentService)throw Error(`No DeploymentService configured for remote RPC: ${e}. Set up a DeploymentService to enable remote function calls.`);let n=this.wire.getSession&&typeof this.wire.getSession==`function`?await this.wire.getSession():this.wire.session;return this.services.deploymentService.invoke(e,t,n,this.wire.traceId)}};const u$e=new class{getContextRPCService(e,t,n,r=0,i=null){let a=new l$e(e,t,typeof n==`object`&&n?n:{requiresAuth:n},i);return{depth:r,global:!1,invoke:a.rpc.bind(a),remote:a.remote.bind(a),exposed:a.rpcExposed.bind(a),startWorkflow:a.startWorkflow.bind(a),get agent(){return a.agent},rpcWithWire:a.rpcWithWire.bind(a)}}};async function d$e(e,t,n){let r=AQe(e);r&&(e.pikkuUserId=r,n instanceof OQe&&n.setPikkuUserId(r));let{sessionStore:i}=t;if(!(!i||!r)&&!e.session){let t=await i.get(r);t&&(e.session=t,n?.setInitial(t))}}var f$e=e=>{let t=IW(null,`addons`,`packages`);if(!t)return null;for(let[n,r]of t.entries())if(r?.package===e)return n;return null},mG=(e,t)=>new Proxy(e,{get(e,n,r){if(n===`startWorkflow`||n===`runToCompletion`){let i=Reflect.get(e,n,r);return function(e,...n){if(typeof e==`string`&&!e.includes(`:`)){let n=f$e(t);n&&(e=`${n}:${e}`)}return i.call(this,e,...n)}}return Reflect.get(e,n,r)}}),p$e=async(e,t)=>{let n=IW(e,`package`,`singletonServices`);if(n)return n;let r=IW(e,`package`,`factories`);if(!r||!r.createSingletonServices)return t;let i=t.config;r.createConfig&&(i=await r.createConfig(t.variables));let a=await r.createSingletonServices(i,t);return a.workflowService&&typeof a.workflowService==`object`&&(a.workflowService=mG(a.workflowService,e)),IW(e,`package`,`singletonServices`,a),a};const m$e=async(e,t,n,{singletonServices:r,createWireServices:i,data:a,auth:o,inheritedMiddleware:s,wireMiddleware:c,inheritedChannelMiddleware:l,wireChannelMiddleware:u,inheritedPermissions:d,wirePermissions:f,coerceDataFromSchema:p,tags:m=[],wire:h,sessionService:g,credentialWireService:_,packageName:v=null})=>{h.wireType??=e,h.wireId??=t;let y=IW(v,`function`,`functions`),b=y.get(n),x=IW(v,`function`,`meta`),S=x[n];if(!b||!S){let{baseName:e,version:t}=DQe(n);t!==null&&(b||=y.get(e),S||=x[e],b&&S&&r.logger.warn(`Version '${n}' not registered, resolved to '${e}'`))}if(!b)throw Error(`Function not found: ${n}`);if(!S)throw Error(`Function meta not found: ${n}`);let C=S.pikkuFuncId??n,w=v?await p$e(v,r):r,T=i;if(v){let e=IW(v,`package`,`factories`);e?.createWireServices&&(T=e.createWireServices)}let E=qW(e,t,{wireInheritedChannelMiddleware:l,wireChannelMiddleware:u,packageName:v}),D=E.length>0&&h.channel?JW(h,w,E):h;if(!D.getCredentials){let e=_??new jQe(w.credentialService,D);Object.assign(D,MQe(e))}let O=NQe(b.audit),k=D,ee=k.functionId,te=k.audit,ne=Object.getOwnPropertyDescriptor(k,`rpc`);k.functionId=C,k.audit=O;let re;re=m&&m.length>0?[...d||[],...m.map(e=>({type:`tag`,tag:e}))]:d||[];let ie=async()=>{await d$e(k,w,g),g&&(k.session=g.freezeInitial(),k.setSession=e=>g.set(e),k.clearSession=()=>g.clear(),k.getSession=()=>g.get(),k.hasSessionChanged=()=>g.sessionChanged);let r=k.session;if(S.sessionless){if((o===!0||b.auth===!0)&&!r)throw new BW(`Authentication required`)}else if(S.sessionless===!1){if((o===!1||b.auth===!1)&&w.logger.warn(`Function '${n}' requires a session but auth was explicitly disabled — use pikkuSessionlessFunc instead.`),!r)throw new BW(`Authentication required`)}else if((o===!0||b.auth===!0)&&!r)throw new BW(`Authentication required`);if(r?.readonly&&!S.readonly)throw new cQe;let i=await a(),s=S.inputSchemaName;s&&(p&&TQe(s,i,v),await ZW(w.logger,w.schema,s,i,v)),(re.length>0||f||S.permissions||b.permissions)&&await CQe(e,t,{wireInheritedPermissions:re,wirePermissions:f,funcInheritedPermissions:S.permissions,funcPermissions:b.permissions,services:w,wire:k,data:i,packageName:v});let c;try{c=await T?.(w,k);let e=c&&Object.keys(c).length>0?{...w,...c}:w,t=v;return Object.defineProperty(k,`rpc`,{get(){let n=u$e.getContextRPCService(e,k,{sessionService:g},0,t);return Object.defineProperty(k,`rpc`,{value:n,writable:!0,configurable:!0}),n},configurable:!0,enumerable:!0}),await b.func(e,i,k)}finally{c&&Object.keys(c).length>0&&await dQe(w.logger,c)}},ae=yQe(e,t,{wireInheritedMiddleware:s,wireMiddleware:c,funcInheritedMiddleware:S.middleware,funcMiddleware:b.middleware,packageName:v});if(ae.length>0)try{return await gQe(w,k,ae,ie)}finally{ne&&Object.defineProperty(k,`rpc`,ne),ee===void 0?delete k.functionId:k.functionId=ee,te===void 0?delete k.audit:k.audit=te}try{return await ie()}finally{ne&&Object.defineProperty(k,`rpc`,ne),ee===void 0?delete k.functionId:k.functionId=ee,te===void 0?delete k.audit:k.audit=te}};function h$e(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function g$e(e,t){if(t.length===0)return null;let n=e.commands[t[0]];if(!n)return null;for(let e=1;e<t.length;e++){if(!n.subcommands||!n.subcommands[t[e]])return null;n=n.subcommands[t[e]]}return n}function _$e(e,t){let n={...e.options};if(t.length===0)return n;let r=e.commands[t[0]];if(r){n={...n,...r.options};for(let e=1;e<t.length;e++)r.subcommands&&r.subcommands[t[e]]&&(r=r.subcommands[t[e]],n={...n,...r.options})}return n}function X(e,t,n=[]){let r=[],i=t.programs[e];if(!i)return`Program not found: ${e}`;if(n.length===0){r.push(`Usage: ${e} <command> [options]`),r.push(``),r.push(`Commands:`);for(let[e,t]of Object.entries(i.commands)){let n=t.description||``,i=t.isDefault?` (default)`:``;r.push(` ${e.padEnd(20)} ${n}${i}`)}Object.keys(i.options).length>0&&(r.push(``),r.push(`Options:`),hG(i.options,r))}else{let t=g$e(i,n);if(!t)return`Unknown command: ${n.join(` `)}`;let a=`${e} ${n.join(` `)}`;if(t.parameters&&(a+=` `+t.parameters),r.push(`Usage: ${a} [options]`),t.description&&(r.push(``),r.push(t.description)),t.positionals.length>0){r.push(``),r.push(`Arguments:`);for(let e of t.positionals){let t=e.required?`<required>`:`[optional]`,n=e.variadic?`...`:``;r.push(` ${e.name}${n} ${t}`)}}if(t.subcommands&&Object.keys(t.subcommands).length>0){r.push(``),r.push(`Subcommands:`);for(let[e,n]of Object.entries(t.subcommands)){let t=n.description||``;r.push(` ${e.padEnd(20)} ${t}`)}}let o=_$e(i,n);Object.keys(o).length>0&&(r.push(``),r.push(`Options:`),hG(o,r))}return r.join(`
185
185
  `)}function hG(e,t){for(let[n,r]of Object.entries(e)){let e=` `;r.short?e+=`-${r.short}, `:e+=` `,e+=`--${h$e(n)}`,r.default!==void 0&&typeof r.default!=`boolean`&&(e+=` <value>`),e=e.padEnd(30),e+=r.description||``,r.default!==void 0&&(e+=` (default: ${JSON.stringify(r.default)})`),r.choices&&(e+=` [choices: ${r.choices.join(`, `)}]`),t.push(e)}}var v$e=e=>{let t=e.split(`
186
186
  `),n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e],a=i.trim();if(a===`Commands:`||a===`Subcommands:`||a===`Options:`||i.startsWith(`Usage:`)){r=a===`Commands:`||a===`Subcommands:`,n.push({text:i+`
187
187
  `,type:`heading`});continue}if(r&&a===``&&(r=!1),r&&i.startsWith(` `)){let e=i.match(/^(\s{2})(\S+)(\s.*)?$/);if(e){let[,t,r,i]=e;n.push({text:t}),n.push({text:r,type:`command`}),n.push({text:(i||``)+`
@@ -190,7 +190,7 @@ When calling a sub-agent, provide a short session name that describes the task.
190
190
  `:``)})}return n};const y$e=({programId:e,cliMeta:t,commandPath:n})=>(0,A.jsx)(j,{component:`pre`,style:{fontFamily:`var(--mantine-font-family-monospace)`,fontSize:`var(--mantine-font-size-sm)`,lineHeight:1.6,margin:0,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:(0,D.useMemo)(()=>v$e(X(e,t,n)),[e,t,n]).map((e,t)=>e.type===`heading`?(0,A.jsx)(`span`,{style:{color:`var(--mantine-color-yellow-5)`,fontWeight:600},children:e.text},t):e.type===`command`?(0,A.jsx)(`span`,{style:{color:`var(--mantine-color-blue-5)`},children:e.text},t):e.type===`flag`?(0,A.jsx)(`span`,{style:{color:`var(--mantine-color-green-5)`},children:e.text},t):(0,A.jsx)(`span`,{children:e.text},t))});var b$e=({programs:e,cliRenderers:t})=>{let[n,r]=(0,D.useState)(``),[i,a]=(0,D.useState)(e[0]?.wireId||``),[o,s]=(0,D.useState)([]),[c,l]=(0,D.useState)(()=>new Set(e.length>0?[e[0].wireId]:[])),u=(0,D.useMemo)(()=>e.find(e=>e.wireId===i),[e,i]),d=(0,D.useMemo)(()=>u?{programs:{[i]:{program:u.program||i,commands:u.commands,options:u.options,defaultRenderName:u.defaultRenderName}},renderers:t}:{programs:{},renderers:{}},[u,i,t]),f=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=e=>{a(e),s([]),c.has(e)||l(t=>new Set(t).add(e))},m=(e,t)=>{i!==e&&(a(e),c.has(e)||l(t=>new Set(t).add(e))),s([t])},h=o.length>0?`$ ${i} ${o.join(` `)} --help`:`$ ${i} --help`,g=e.length;return(0,A.jsxs)(j,{className:fx.flexRow,children:[(0,A.jsxs)(j,{className:fx.listPaneFixed,style:{width:280,minWidth:220},children:[(0,A.jsx)(jW,{value:n,onChange:r,placeholder:`Search commands...`,label:`CLI`,count:g}),(0,A.jsx)(Hd,{style:{flex:1},children:e.map(e=>{let t=e.wireId===i,r=c.has(e.wireId),a=Object.entries(e.commands||{}),s=n.toLowerCase(),l=s?a.filter(([e,t])=>e.includes(s)||t.description?.toLowerCase().includes(s)):a;return s&&l.length===0&&!e.wireId.includes(s)?null:(0,A.jsxs)(D.Fragment,{children:[(0,A.jsxs)(Ud,{onClick:()=>t?f(e.wireId):p(e.wireId),style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 12px`,fontSize:11,color:t?`var(--app-meta-value)`:`var(--app-text)`,borderLeft:t?`2px solid rgba(6,182,212,0.4)`:`2px solid transparent`,width:`100%`,opacity:t?1:.6,cursor:`pointer`},children:[r?(0,A.jsx)(tb,{size:9,color:`var(--app-section-label)`}):(0,A.jsx)(nb,{size:9,color:`var(--app-section-label)`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,style:{flex:1},children:e.wireId}),(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:`cyan`,ff:`monospace`,children:`cli`})]}),r&&l.map(([n,r])=>{let i=t&&o.length===1&&o[0]===n;return(0,A.jsxs)(Ud,{onClick:()=>m(e.wireId,n),className:fx.listItem,"data-active":i,style:{display:`flex`,alignItems:`center`,gap:7,padding:`5px 12px 5px 24px`},children:[(0,A.jsx)(j,{className:fx.typeDot,style:{background:`rgba(124,58,237,0.4)`}}),(0,A.jsxs)(j,{style:{flex:1,minWidth:0},children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,fw:i?600:400,c:i?`var(--app-meta-value)`:`var(--app-text)`,truncate:!0,children:n}),r.description&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:i?`var(--app-meta-label)`:`var(--app-text-muted)`,truncate:!0,style:{fontSize:9},children:r.description})]})]},n)})]},e.wireId)})})]}),(0,A.jsxs)(j,{className:`${fx.detailPane} ${fx.flexColumn}`,style:{overflow:`hidden`},children:[(0,A.jsxs)(j,{className:fx.gridHeader,style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,style:{flex:1},children:[(0,A.jsx)(N,{component:`span`,c:`violet`,ff:`monospace`,children:`$`}),` `,(0,A.jsx)(N,{component:`span`,c:`var(--app-text)`,ff:`monospace`,children:h.slice(2)})]}),(0,A.jsx)(toe,{value:typeof document<`u`&&document.getElementById(`cli-terminal`)?.innerText||``,children:({copied:e,copy:t})=>(0,A.jsx)(Ch,{label:e?`Copied`:`Copy`,children:(0,A.jsx)(_f,{variant:`subtle`,color:e?`teal`:`gray`,size:`sm`,onClick:t,children:e?(0,A.jsx)(eb,{size:12}):(0,A.jsx)(sb,{size:12})})})})]}),(0,A.jsx)(j,{id:`cli-terminal`,className:fx.overflowAuto,style:{flex:1,padding:`20px 24px`,lineHeight:1.9,fontSize:11,fontFamily:`var(--mantine-font-family-monospace)`},children:u?(0,A.jsx)(y$e,{programId:i,cliMeta:d,commandPath:o}):(0,A.jsx)(N,{c:`dimmed`,ff:`monospace`,size:`sm`,children:`No CLI programs found.`})})]})]})};const x$e=()=>{let{meta:e}=R(),t=e.cliMeta||[];return t.length===0?(0,A.jsx)(ep,{h:`100%`,children:(0,A.jsx)(N,{c:`dimmed`,children:`No CLI programs found.`})}):(0,A.jsx)(vx,{children:(0,A.jsx)(b$e,{programs:t,cliRenderers:e.cliRenderers||{}})})},S$e=()=>(0,A.jsx)(D.Suspense,{fallback:(0,A.jsx)(ep,{h:`100%`,children:(0,A.jsx)(mf,{})}),children:(0,A.jsx)(x$e,{})});var C$e=[{value:`http`,label:`HTTP`},{value:`channels`,label:`Channels`},{value:`mcp`,label:`MCP`},{value:`cli`,label:`CLI`}],w$e=()=>{let[e,t]=Gy(),n=e.get(`tab`)||`http`;return(0,A.jsx)(vx,{children:(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[(0,A.jsx)(OW,{icon:pb,category:`APIs`,docsHref:`https://pikku.dev/docs/wiring/http`,tabs:C$e,activeTab:n,onTabChange:e=>{t({tab:e})}}),(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(()=>{switch(n){case`channels`:return(0,A.jsx)(XZe,{});case`mcp`:return(0,A.jsx)(nQe,{});case`cli`:return(0,A.jsx)(S$e,{});default:return(0,A.jsx)(MW,{})}})()})]})})};const T$e=()=>(0,A.jsx)(D.Suspense,{fallback:(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}),children:(0,A.jsx)(w$e,{})}),gG=({columns:e,gridTemplateColumns:t})=>(0,A.jsx)(j,{className:fx.gridHeader,style:{display:`grid`,gridTemplateColumns:t},children:e.map(e=>(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-section-label)`,tt:`uppercase`,className:fx.gridHeaderLabel,ta:e.align,children:e.label},e.label))}),E$e=({title:e,subtitle:t,badge:n,children:r})=>(0,A.jsxs)(j,{className:fx.detailHeader,children:[(0,A.jsxs)(j,{className:fx.flexGrow,children:[(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-meta-value)`,mb:t?4:0,children:e}),t&&(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,children:t})]}),n&&(0,A.jsx)(Jf,{size:`sm`,variant:`light`,color:n.color,children:n.label}),r]});var D$e=`1fr 160px 120px`,O$e=({schedule:e})=>(0,A.jsx)(Sf,{gap:3,wrap:`nowrap`,children:e.split(` `).map((e,t)=>(0,A.jsx)(Jf,{size:`sm`,ff:`monospace`,tt:`none`,style:{background:`rgba(245,158,11,0.08)`,border:`0.5px solid rgba(245,158,11,0.18)`,color:`#fbbf24`,padding:`1px 5px`},children:e},t))}),k$e=e=>{let[t,n,r,i,a]=e.split(` `),o=[];return a!==`*`&&r===`*`?o.push(`Every ${[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`][parseInt(a)]||a}`):r===`*`?o.push(`Every day`):o.push(`Day ${r} of every month`),o.push(`at ${n}:${t?.padStart(2,`0`)}`),o.join(` `)},A$e=(e,t)=>{if(!e||e===`*`)return t;let n=parseInt(e);return isNaN(n)?t:n},j$e=(e,t)=>{let[n,r,i,,a]=e.split(` `),o=[],s=new Date,c=new Date(s);c.setSeconds(0),c.setMilliseconds(0),c.setMinutes(A$e(n,s.getMinutes())),c.setHours(A$e(r,s.getHours())),c<=s&&c.setDate(c.getDate()+1);let l=0;for(;o.length<t&&l<500;){l++;let e=!0;a&&a!==`*`&&!a.split(`,`).map(Number).includes(c.getDay())&&(e=!1),i&&i!==`*`&&c.getDate()!==parseInt(i)&&(e=!1),e&&o.push(new Date(c)),c.setDate(c.getDate()+1)}return o},M$e=e=>{let t=Math.floor((Date.now()-e)/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`},N$e=e=>e===null?``:e<1?`${Math.round(e*1e3)}ms`:e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`,P$e=e=>`${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][e.getDay()]} ${String(e.getDate()).padStart(2,`0`)} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][e.getMonth()]}`,F$e=e=>`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`,I$e=({item:e,history:t})=>{let{navigateInPanel:n}=_x(),r=e?.pikkuFuncId,{data:i}=Yk(r??``),a=i?.name||r,o=e?.schedule||``,s=(0,D.useMemo)(()=>j$e(o,5),[o]),c=t[e?.wireId||e?.name];return(0,A.jsxs)(j,{className:fx.flexColumn,style:{overflow:`auto`},children:[(0,A.jsx)(E$e,{title:e.wireId||e.name,badge:{label:`Scheduler`,color:`yellow`}}),(0,A.jsxs)(j,{p:`md`,className:fx.flexGrow,children:[(0,A.jsx)(mA,{children:`Schedule`}),(0,A.jsx)(j,{style:{background:`#111827`,border:`1px solid rgba(245,158,11,0.15)`,borderRadius:6,padding:`8px 10px`,fontSize:11,color:`#fbbf24`,fontFamily:`var(--mantine-font-family-monospace)`,marginBottom:4},children:k$e(o)}),(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,children:[`cron: `,o]}),(0,A.jsx)(mA,{children:`Handler`}),r&&(0,A.jsx)(pA,{label:`function`,labelWidth:80,children:(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-meta-value)`,className:fx.clickableText,onClick:()=>n(`function`,r,a||r,i),children:a})}),(0,A.jsx)(pA,{label:`timezone`,labelWidth:80,children:(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text)`,children:`UTC`})}),e.tags&&e.tags.length>0&&(0,A.jsx)(pA,{label:`tags`,labelWidth:80,children:(0,A.jsx)(Sf,{gap:4,children:e.tags.map((e,t)=>(0,A.jsx)(hA,{children:e},t))})}),c?.history&&c.history.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mA,{children:`Recent Runs`}),(0,A.jsx)(j,{style:{display:`flex`,flexDirection:`column`,gap:3,marginBottom:12},children:c.history.map((e,t)=>(0,A.jsxs)(j,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,padding:`6px 8px`,borderRadius:5,background:`var(--app-surface)`,border:`1px solid ${e.status===`failed`?`rgba(239,68,68,0.2)`:`var(--app-row-border)`}`,gap:8},children:[(0,A.jsxs)(j,{style:{minWidth:0},children:[(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:e.status===`failed`?`var(--mantine-color-red-5)`:`var(--mantine-color-green-5)`,children:e.status}),e.error&&(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:`var(--app-text-muted)`,style:{wordBreak:`break-word`},children:e.error})]}),(0,A.jsxs)(j,{style:{textAlign:`right`,flexShrink:0},children:[(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:`var(--app-text)`,children:M$e(e.timestamp)}),e.durationSeconds!==null&&(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:`var(--app-text-muted)`,children:N$e(e.durationSeconds)})]})]},t))})]}),s.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mA,{children:`Next Runs`}),(0,A.jsx)(j,{style:{display:`flex`,flexDirection:`column`,gap:3},children:s.map((e,t)=>(0,A.jsxs)(j,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 8px`,borderRadius:5,background:t===0?`rgba(6,182,212,0.04)`:`var(--app-surface)`,border:t===0?`1px solid rgba(6,182,212,0.22)`:`1px solid var(--app-row-border)`},children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-meta-label)`,children:P$e(e)}),(0,A.jsxs)(Sf,{gap:6,children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text)`,children:F$e(e)}),t===0&&(0,A.jsx)(Jf,{size:`sm`,ff:`monospace`,tt:`none`,style:{background:`rgba(6,182,212,0.08)`,color:`#06b6d4`,padding:`1px 5px`},children:`next`})]})]},t))})]})]})]})};const L$e=()=>{let{meta:e}=R(),t=By(),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(``),{data:o={}}=Rr({queryKey:[`console:getSchedulerHistory`],queryFn:()=>t.invoke(`console:getSchedulerHistory`).then(e=>e??{}),refetchInterval:15e3}),s=(0,D.useMemo)(()=>e.schedulerMeta?Object.entries(e.schedulerMeta).map(([e,t])=>({name:e,...t})):[],[e.schedulerMeta]),c=(0,D.useMemo)(()=>{if(!i)return s;let e=i.toLowerCase();return s.filter(t=>t.name?.toLowerCase().includes(e)||t.pikkuFuncId?.toLowerCase().includes(e)||t.schedule?.toLowerCase().includes(e))},[s,i]),l=(0,D.useMemo)(()=>n&&s.find(e=>e.name===n)||null,[s,n]);return(0,A.jsx)(ZZe,{list:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(jW,{value:i,onChange:a,placeholder:`Search scheduled tasks...`}),(0,A.jsx)(gG,{columns:[{label:`Name`},{label:`Schedule`},{label:`Last Run`}],gridTemplateColumns:D$e}),(0,A.jsx)(Hd,{className:fx.flexGrow,children:c.map(e=>{let t=n===e.name,i=e.wireId||e.name,a=o[i]?.lastRun??null;return(0,A.jsxs)(QZe,{active:t,onClick:()=>r(e.name),gridTemplateColumns:D$e,children:[(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:t?`var(--app-meta-value)`:`var(--app-text)`,children:i}),(0,A.jsxs)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,style:{fontSize:9},children:[e.pikkuFuncId,`()`]})]}),e.schedule&&(0,A.jsx)(O$e,{schedule:e.schedule}),(0,A.jsx)(j,{children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:a.status===`failed`?`var(--mantine-color-red-5)`:`var(--mantine-color-green-5)`,children:a.status}),(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:`var(--app-text-muted)`,children:M$e(a.timestamp)})]}):(0,A.jsx)(N,{size:`xs`,ff:`monospace`,c:`var(--app-meta-label)`,children:`—`})})]},e.name)})})]}),detail:l?(0,A.jsx)(I$e,{item:l,history:o}):null,hasSelection:!!l,emptyMessage:`Select a scheduled task`})},_G=({value:e,fallback:t=`—`,isBoolean:n})=>{let r=e!=null&&e!==``?String(e):t,i=r===t;return n&&!i?(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:e?`#86efac`:`var(--app-text-muted)`,children:String(e)}):(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:i?`var(--app-text-muted)`:`var(--app-text)`,children:r})};var R$e=`1fr 70px 70px 70px`,z$e=({item:e})=>{let{navigateInPanel:t}=_x(),n=e?.pikkuFuncId,{data:r}=Yk(n??``),i=r?.name||n,a=e?.workerConfig||{};return(0,A.jsxs)(j,{className:fx.flexColumn,style:{overflow:`auto`},children:[(0,A.jsx)(E$e,{title:e.wireId||e.name,badge:{label:`Queue`,color:`cyan`}}),(0,A.jsxs)(j,{p:`md`,className:fx.flexGrow,children:[(0,A.jsx)(mA,{children:`Handler`}),n&&(0,A.jsx)(pA,{label:`function`,labelWidth:130,children:(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-meta-value)`,className:fx.clickableText,onClick:()=>t(`function`,n,i||n,r),children:i})}),(0,A.jsx)(pA,{label:`name`,labelWidth:130,children:(0,A.jsx)(_G,{value:e.wireId||e.name})}),(0,A.jsx)(pA,{label:`autorun`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.autorun??!0,isBoolean:!0})}),(0,A.jsx)(mA,{children:`Processing`}),(0,A.jsx)(pA,{label:`batchSize`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.batchSize})}),(0,A.jsx)(pA,{label:`prefetch`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.prefetch})}),(0,A.jsx)(pA,{label:`pollInterval`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.pollInterval})}),(0,A.jsx)(mA,{children:`Timeouts`}),(0,A.jsx)(pA,{label:`visibilityTimeout`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.visibilityTimeout?`${a.visibilityTimeout}s`:null})}),(0,A.jsx)(pA,{label:`lockDuration`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.lockDuration?`${a.lockDuration}ms`:null})}),(0,A.jsx)(pA,{label:`drainDelay`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.drainDelay?`${a.drainDelay}s`:null})}),(0,A.jsx)(pA,{label:`maxStalledCount`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.maxStalledCount})}),(0,A.jsx)(mA,{children:`Retention`}),(0,A.jsx)(pA,{label:`removeOnComplete`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.removeOnComplete})}),(0,A.jsx)(pA,{label:`removeOnFail`,labelWidth:130,children:(0,A.jsx)(_G,{value:a.removeOnFail})})]})]})};const B$e=()=>{let{meta:e}=R(),t=By(),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(``),{data:o}=Rr({queryKey:[`console:getQueueDepths`],queryFn:()=>t.invoke(`console:getQueueDepths`).then(e=>e??{}),refetchInterval:5e3}),s=(0,D.useMemo)(()=>e.queueMeta?Object.entries(e.queueMeta).map(([e,t])=>({name:e,...t})):[],[e.queueMeta]),c=(0,D.useMemo)(()=>{if(!i)return s;let e=i.toLowerCase();return s.filter(t=>t.name?.toLowerCase().includes(e)||t.wireId?.toLowerCase().includes(e)||t.pikkuFuncId?.toLowerCase().includes(e))},[s,i]),l=(0,D.useMemo)(()=>n&&s.find(e=>e.name===n)||null,[s,n]);return(0,A.jsx)(ZZe,{list:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(jW,{value:i,onChange:a,placeholder:`Search queue workers...`}),(0,A.jsx)(gG,{columns:[{label:`Name`},{label:`Queued`},{label:`Active`},{label:`Failed`}],gridTemplateColumns:R$e}),(0,A.jsx)(Hd,{className:fx.flexGrow,children:c.map(e=>{let t=n===e.name,i=e.wireId||e.name,a=o?.[i];return(0,A.jsxs)(QZe,{active:t,onClick:()=>r(e.name),gridTemplateColumns:R$e,children:[(0,A.jsxs)(j,{children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:t?`var(--app-meta-value)`:`var(--app-text)`,truncate:!0,children:i}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:`var(--app-text-muted)`,truncate:!0,style:{fontSize:9},children:e.pikkuFuncId})]}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:a?.queued?`var(--app-meta-value)`:`var(--app-meta-label)`,children:a?.queued??`—`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:a?.active?`var(--mantine-color-green-5)`:`var(--app-meta-label)`,children:a?.active??`—`}),(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:a?.failed?`var(--mantine-color-red-5)`:`var(--app-meta-label)`,children:a?.failed??`—`})]},e.name)})})]}),detail:l?(0,A.jsx)(z$e,{item:l}):null,hasSelection:!!l,emptyMessage:`Select a queue worker`})};var V$e=`1fr 1fr 1fr`,H$e=({item:e})=>{let{navigateInPanel:t}=_x(),n=e.source?.pikkuFuncId,r=e.trigger?.pikkuFuncId,{data:i}=Yk(n??``),{data:a}=Yk(r??``),o=i?.name||n,s=a?.name||r;return(0,A.jsxs)(j,{className:fx.flexColumn,style:{overflow:`auto`},children:[(0,A.jsx)(E$e,{title:e.name,badge:{label:`Trigger`,color:`violet`}}),(0,A.jsxs)(j,{p:`md`,className:fx.flexGrow,children:[e.source&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mA,{children:`Source`}),(0,A.jsx)(pA,{label:`function`,labelWidth:70,children:(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-meta-value)`,className:fx.clickableText,onClick:()=>t(`function`,n,o||n,i),children:o})})]}),e.trigger&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(mA,{children:`Target`}),(0,A.jsx)(pA,{label:`function`,labelWidth:70,children:(0,A.jsx)(N,{size:`sm`,fw:600,ff:`monospace`,c:`var(--app-meta-value)`,className:fx.clickableText,onClick:()=>t(`function`,r,s||r,a),children:s})})]})]})]})};const U$e=()=>{let{meta:e}=R(),[t,n]=(0,D.useState)(null),[r,i]=(0,D.useState)(``),a=(0,D.useMemo)(()=>{let t=new Set;return e.triggerSourceMeta&&Object.keys(e.triggerSourceMeta).forEach(e=>t.add(e)),e.triggerMeta&&Object.keys(e.triggerMeta).forEach(e=>t.add(e)),Array.from(t).sort().map(t=>({name:t,source:e.triggerSourceMeta?.[t]||null,trigger:e.triggerMeta?.[t]||null}))},[e.triggerMeta,e.triggerSourceMeta]),o=(0,D.useMemo)(()=>{if(!r)return a;let e=r.toLowerCase();return a.filter(t=>t.name.toLowerCase().includes(e)||t.source?.pikkuFuncId?.toLowerCase().includes(e)||t.trigger?.pikkuFuncId?.toLowerCase().includes(e))},[a,r]),s=(0,D.useMemo)(()=>t&&a.find(e=>e.name===t)||null,[a,t]);return(0,A.jsx)(ZZe,{list:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(jW,{value:r,onChange:i,placeholder:`Search triggers...`}),(0,A.jsx)(gG,{columns:[{label:`Name`},{label:`Source`},{label:`Target`}],gridTemplateColumns:V$e}),(0,A.jsx)(Hd,{className:fx.flexGrow,children:o.map(e=>{let r=t===e.name;return(0,A.jsxs)(QZe,{active:r,onClick:()=>n(e.name),gridTemplateColumns:V$e,children:[(0,A.jsx)(N,{size:`sm`,ff:`monospace`,c:r?`var(--app-meta-value)`:`var(--app-text)`,children:e.name}),(0,A.jsx)(Jf,{size:`sm`,ff:`monospace`,tt:`none`,style:{background:`rgba(124,58,237,0.08)`,border:`0.5px solid rgba(124,58,237,0.18)`,color:`#a78bfa`,maxWidth:150,overflow:`hidden`,textOverflow:`ellipsis`},children:e.source?.pikkuFuncId||`Missing`}),(0,A.jsx)(Jf,{size:`sm`,ff:`monospace`,tt:`none`,style:{background:`rgba(6,182,212,0.07)`,border:`0.5px solid rgba(6,182,212,0.15)`,color:`#06b6d4`,maxWidth:150,overflow:`hidden`,textOverflow:`ellipsis`},children:e.trigger?.pikkuFuncId||`Missing`})]},e.name)})})]}),detail:s?(0,A.jsx)(H$e,{item:s}):null,hasSelection:!!s,emptyMessage:`Select a trigger`})};var W$e=[{value:`schedulers`,label:`Schedulers`},{value:`queues`,label:`Queues`},{value:`triggers`,label:`Triggers`}];const G$e=()=>{let[e,t]=Gy(),n=e.get(`tab`)||`schedulers`;return(0,A.jsx)(vx,{children:(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[(0,A.jsx)(OW,{icon:ab,category:`Jobs`,docsHref:`https://pikku.dev/docs/wiring/scheduled-tasks`,tabs:W$e,activeTab:n,onTabChange:e=>{t({tab:e})}}),(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(()=>{switch(n){case`queues`:return(0,A.jsx)(B$e,{});case`triggers`:return(0,A.jsx)(U$e,{});default:return(0,A.jsx)(L$e,{})}})()})]})})};var K$e=[{key:`name`,header:`NAME`,render:e=>(0,A.jsx)(N,{fw:500,children:e.name})},{key:`functions`,header:`FUNCTIONS`,align:`right`,render:e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`functions`,value:e.funcCount})}];const q$e=()=>{let{meta:e,loading:t}=R();return(0,A.jsx)(GB,{title:`Services`,icon:Nb,docsHref:`https://pikku.dev/docs/core-features/services`,data:(0,D.useMemo)(()=>{let t=new Map;return e.functions?.forEach(e=>{if(e.services?.services)for(let n of e.services.services){let r=t.get(n)||{funcCount:0,functions:[]};r.funcCount++,r.functions.push(e.pikkuFuncId),t.set(n,r)}}),Array.from(t.entries()).map(([e,t])=>({name:e,...t})).sort((e,t)=>t.funcCount-e.funcCount)},[e.functions]),columns:K$e,getKey:e=>e.name,onRowClick:()=>{},searchPlaceholder:`Search services...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.functions.some(e=>e.toLowerCase().includes(t)),emptyMessage:`No services found.`,loading:t})},J$e=()=>{let{meta:e,loading:t}=R(),{openMiddleware:n}=_x();return(0,A.jsx)(GB,{title:`Middleware`,icon:hb,docsHref:`https://pikku.dev/docs/core-features/middleware`,data:(0,D.useMemo)(()=>{if(!e.middlewareGroupsMeta)return[];let t=e.middlewareGroupsMeta.definitions||{},n=[];for(let[e,r]of Object.entries(t))r.exportedName!==null&&n.push({id:`middleware::def::${e}`,name:r.name||r.exportedName||e,data:{...r,_id:e}});return n},[e.middlewareGroupsMeta]),columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,children:e.name}),e.data?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,lineClamp:1,children:e.data.description})]})},{key:`type`,header:`TYPE`,align:`right`,render:e=>{let t=e.data?.wires?.wires??[],n=new Set([`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`]),r=t.some(e=>n.has(e)),i=t.filter(e=>!n.has(e));return(0,A.jsxs)(Sf,{gap:4,wrap:`nowrap`,children:[r&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),i.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e)),e.data?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})]})}}],[]),getKey:e=>e.id,onRowClick:e=>n(e.id,e.data),searchPlaceholder:`Search middleware...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.data?.description?.toLowerCase().includes(t),emptyMessage:`No middleware found.`,loading:t})},Z=()=>{let{meta:e,loading:t}=R(),{openPermission:n}=_x();return(0,A.jsx)(GB,{title:`Permissions`,icon:Pb,docsHref:`https://pikku.dev/docs/core-features/permission-guards`,data:(0,D.useMemo)(()=>{if(!e.permissionsGroupsMeta)return[];let t=e.permissionsGroupsMeta.definitions||{},n=[];for(let[e,r]of Object.entries(t))r.exportedName!==null&&n.push({id:`permission::def::${e}`,name:r.name||r.exportedName||e,data:{...r,_id:e}});return n},[e.permissionsGroupsMeta]),columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,children:e.name}),e.data?.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,lineClamp:1,children:e.data.description})]})},{key:`type`,header:`TYPE`,align:`right`,render:e=>{let t=e.data?.wires?.wires??[],n=new Set([`session`,`setSession`,`clearSession`,`getSession`,`hasSessionChanged`]),r=t.some(e=>n.has(e)),i=t.filter(e=>!n.has(e));return(0,A.jsxs)(Sf,{gap:4,wrap:`nowrap`,children:[r&&(0,A.jsx)(eS,{type:`flag`,flag:`session`}),i.map(e=>(0,A.jsx)(eS,{type:`dynamic`,badge:`wire`,value:e},e)),e.data?.factory&&(0,A.jsx)(eS,{type:`flag`,flag:`factory`})]})}}],[]),getKey:e=>e.id,onRowClick:e=>n(e.id,e.data),searchPlaceholder:`Search permissions...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.data?.description?.toLowerCase().includes(t),emptyMessage:`No permissions found.`,loading:t})};var vG=[{value:`services`,label:`Services`},{value:`middleware`,label:`Middleware`},{value:`permissions`,label:`Permissions`}];const Y$e=()=>{let[e,t]=Gy(),n=e.get(`tab`)||`services`;return(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{header:(0,A.jsx)(OW,{icon:Nb,category:`Runtime`,docsHref:`https://pikku.dev/docs/core-features/services`,tabs:vG,activeTab:n,onTabChange:e=>{t({tab:e})}}),showTabs:!1,emptyPanelMessage:`Select an item to view its details`,children:(()=>{switch(n){case`middleware`:return(0,A.jsx)(J$e,{});case`permissions`:return(0,A.jsx)(Z,{});default:return(0,A.jsx)(q$e,{})}})()})})};var X$e=`https://pikku.dev/docs`;function Z$e(e){return{type:`object`,properties:Object.fromEntries(e.map(e=>[e,{type:`string`,title:e}]))}}var Q$e=({templateNames:e,templates:t,onSelect:n})=>{let[r,i]=(0,D.useState)(``),a=(0,D.useMemo)(()=>{if(!r)return e;let n=r.toLowerCase();return e.filter(e=>{let r=t[e];return e.toLowerCase().includes(n)||r.variables.some(e=>e.toLowerCase().includes(n))})},[r,e,t]);return(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[(0,A.jsx)(sW,{icon:xb,category:`Emails`,docsHref:X$e}),(0,A.jsx)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Browse generated email templates, inspect locale coverage, and open a template to render desktop and mobile previews.`})}),(0,A.jsx)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(ig,{placeholder:`Search email templates...`,leftSection:(0,A.jsx)(Mb,{size:16}),value:r,onChange:e=>i(e.currentTarget.value)})}),(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(0,A.jsx)(j,{className:fx.overflowAuto,p:`md`,h:`100%`,children:a.length===0?(0,A.jsx)(RZe,{message:`No email templates match the current search.`}):(0,A.jsx)(kh,{cols:{base:1,md:2,xl:3},spacing:`md`,children:a.map(e=>{let r=t[e],i=Object.keys(r.locales).length;return(0,A.jsx)(Ud,{onClick:()=>n(e),style:{border:`1px solid var(--mantine-color-default-border)`,borderRadius:8,padding:16,background:`var(--mantine-color-body)`,textAlign:`start`},children:(0,A.jsxs)(Bh,{gap:`sm`,children:[(0,A.jsxs)(Sf,{justify:`space-between`,align:`flex-start`,wrap:`nowrap`,children:[(0,A.jsxs)(Bh,{gap:4,style:{minWidth:0},children:[(0,A.jsx)(N,{ff:`monospace`,fw:600,truncate:!0,children:e}),(0,A.jsxs)(N,{size:`sm`,c:`dimmed`,children:[r.variables.length,` variable`,r.variables.length===1?``:`s`]})]}),(0,A.jsxs)(Jf,{variant:`light`,children:[i,` locales`]})]}),(0,A.jsxs)(Sf,{gap:6,children:[Object.keys(r.locales).slice(0,3).map(e=>(0,A.jsx)(Jf,{variant:`outline`,color:`gray`,children:e},e)),i>3?(0,A.jsxs)(Jf,{variant:`outline`,color:`gray`,children:[`+`,i-3]}):null]})]})},e)})})})})]})};const $$e=()=>{let{meta:e,loading:t}=R(),[n,r]=Gy(),[i,a]=(0,D.useState)({}),[o,s]=(0,D.useState)(`desktop`),c=e.emailsMeta.templates||{},l=(0,D.useMemo)(()=>Object.keys(c).sort((e,t)=>e.localeCompare(t)),[c]),u=n.get(`template`),d=u?c[u]:null,f=(0,D.useMemo)(()=>l.map(e=>({name:e,description:`${c[e].variables.length} variable${c[e].variables.length===1?``:`s`}`})),[l,c]),p=(0,D.useMemo)(()=>Object.keys(d?.locales??{}).sort((e,t)=>e.localeCompare(t)).map(e=>({label:e,value:e})),[d]),m=n.get(`locale`),h=d?p.find(e=>e.value===m)?.value||p[0]?.value||`en`:null;(0,D.useEffect)(()=>{!u||!h||n.get(`locale`)!==h&&r({template:u,locale:h},{replace:!0})},[n,h,u,r]);let g=IAe(u,h??void 0,i,!!u&&!!h),_=(0,D.useMemo)(()=>Z$e(d?.variables??[]),[d]);return t?(0,A.jsx)(ep,{h:`100vh`,children:(0,A.jsx)(mf,{})}):l.length===0?(0,A.jsx)(ep,{h:`100vh`,px:`xl`,children:(0,A.jsx)(RZe,{message:"No email templates found. Add an `emailTemplatesDir` and run `pikku emails generate`."})}):!u||!d||!h?(0,A.jsx)(Q$e,{templateNames:l,templates:c,onSelect:e=>{a({}),r({template:e,locale:Object.keys(c[e].locales).sort((e,t)=>e.localeCompare(t))[0]??`en`})}}):(0,A.jsxs)(j,{className:fx.flexColumn,style:{height:`100vh`},children:[(0,A.jsx)(sW,{icon:xb,category:`Emails`,docsHref:X$e,categoryPath:`/emails`,currentItem:u,items:f,onItemSelect:e=>{a({}),r({template:e,locale:Object.keys(c[e].locales).sort((e,t)=>e.localeCompare(t))[0]??`en`})},rightSection:(0,A.jsxs)(Sf,{gap:`sm`,wrap:`nowrap`,children:[(0,A.jsx)(Th,{data:p,value:h,onChange:e=>{e&&(a({}),r({template:u,locale:e}))},allowDeselect:!1,size:`xs`,w:96}),(0,A.jsx)(wh,{value:o,onChange:e=>s(e),size:`xs`,data:[{label:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,children:[(0,A.jsx)(Nfe,{size:14}),(0,A.jsx)(`span`,{children:`Desktop`})]}),value:`desktop`},{label:(0,A.jsxs)(Sf,{gap:6,wrap:`nowrap`,children:[(0,A.jsx)(Ufe,{size:14}),(0,A.jsx)(`span`,{children:`Mobile`})]}),value:`mobile`}]})]})}),(0,A.jsx)(j,{px:`md`,py:`sm`,style:{borderBottom:`1px solid var(--mantine-color-default-border)`},children:(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Render a template with sample variables and inspect its desktop or mobile presentation before sending.`})}),(0,A.jsx)(j,{className:fx.flexGrow,style:{minHeight:0},children:(0,A.jsxs)(Yx,{defaultSizes:[760,340],children:[(0,A.jsx)(Yx.Pane,{minSize:480,children:(0,A.jsxs)(j,{className:fx.flexColumn,h:`100%`,children:[(0,A.jsx)(j,{className:fx.detailHeader,children:(0,A.jsxs)(Bh,{gap:4,style:{minWidth:0},children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(xb,{size:16}),(0,A.jsx)(N,{fw:600,ff:`monospace`,children:u}),(0,A.jsx)(Jf,{variant:`light`,children:h}),g.data?.hash?(0,A.jsx)(Jf,{variant:`outline`,color:`gray`,children:g.data.hash.slice(0,10)}):null]}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,truncate:!0,children:g.data?.subject||`No subject rendered yet`})]})}),(0,A.jsx)(j,{className:fx.overflowAuto,p:`md`,children:(0,A.jsxs)(Bh,{gap:`md`,children:[g.isLoading?(0,A.jsx)(ep,{py:`xl`,children:(0,A.jsx)(mf,{})}):null,g.error?(0,A.jsx)(If,{color:`red`,icon:(0,A.jsx)(zb,{size:16}),children:g.error instanceof Error?g.error.message:`Failed to render email preview`}):null,g.data?.missing?.length?(0,A.jsxs)(If,{color:`yellow`,icon:(0,A.jsx)(zb,{size:16}),children:[`Missing source files: `,g.data.missing.join(`, `)]}):null,(0,A.jsx)(ep,{py:`sm`,children:o===`desktop`?(0,A.jsx)(j,{style:{width:`100%`,maxWidth:960,height:720,border:`1px solid var(--mantine-color-default-border)`,borderRadius:8,overflow:`hidden`,background:`#fff`},children:(0,A.jsx)(`iframe`,{title:`Desktop email preview`,srcDoc:g.data?.html??``,style:{width:`100%`,height:`100%`,border:0,background:`#fff`}})}):(0,A.jsx)(j,{style:{width:390,maxWidth:`100%`,height:720,border:`1px solid var(--mantine-color-default-border)`,borderRadius:24,overflow:`hidden`,background:`#fff`},children:(0,A.jsx)(`iframe`,{title:`Mobile email preview`,srcDoc:g.data?.html??``,style:{width:`100%`,height:`100%`,border:0,background:`#fff`}})})}),g.data?.text?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(kp,{}),(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(N,{fw:600,children:`Text fallback`}),(0,A.jsx)(tp,{block:!0,children:g.data.text})]})]}):null]})})]})}),(0,A.jsx)(Yx.Pane,{minSize:280,preferredSize:340,maxSize:420,children:(0,A.jsxs)(j,{className:fx.flexColumn,h:`100%`,style:{borderLeft:`1px solid var(--mantine-color-default-border)`},children:[(0,A.jsx)(j,{className:fx.detailHeader,children:(0,A.jsxs)(Bh,{gap:2,children:[(0,A.jsx)(N,{fw:600,children:`Render`}),(0,A.jsx)(N,{size:`sm`,c:`dimmed`,children:`Supply variables and render the selected template.`})]})}),(0,A.jsx)(j,{className:fx.overflowAuto,p:`md`,children:(0,A.jsxs)(Bh,{gap:`lg`,children:[(0,A.jsx)(Vk,{schema:_,submitLabel:`Render preview`,onSubmit:e=>a(e??{})},`${u}:${h}`),(0,A.jsx)(kp,{}),(0,A.jsxs)(Bh,{gap:`xs`,children:[(0,A.jsx)(N,{fw:600,children:`Template details`}),(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsxs)(Jf,{variant:`light`,children:[d.variables.length,` variables`]}),(0,A.jsxs)(Jf,{variant:`light`,children:[Object.keys(d.locales).length,` locales`]})]}),g.data?.hash?(0,A.jsx)(tp,{block:!0,children:g.data.hash}):null]})]})})]})})]})})]})},e1e=({secrets:e,loading:t,installed:n=!0})=>{let{openSecret:r}=_x();return(0,A.jsx)(GB,{title:`Secrets`,icon:mb,docsHref:`https://pikku.dev/docs/core-features/secrets`,data:e,columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(Sf,{gap:`xs`,children:[(0,A.jsx)(N,{fw:500,truncate:!0,children:e.displayName}),e.isOAuth2&&(0,A.jsx)(eS,{type:`label`,color:`gray`,children:`OAuth2`})]}),e.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,truncate:!0,children:e.description})]})},{key:`secretId`,header:`SECRET ID`,render:e=>(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,children:e.secretId})}],[]),getKey:e=>e.name,onRowClick:e=>r(e.name,{...e.rawData??e,installed:n}),searchPlaceholder:`Search secrets...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.displayName.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.secretId.toLowerCase().includes(t)||!1,emptyMessage:`No secrets found.`,loading:t,headerRight:(0,A.jsx)(Ch,{label:`Secrets docs`,children:(0,A.jsx)(_f,{component:`a`,href:`https://pikku.dev/docs/core-features/secrets`,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})})};var t1e=()=>{let{meta:e,loading:t}=R();return(0,A.jsx)(WB,{children:(0,A.jsx)(e1e,{secrets:(0,D.useMemo)(()=>e.secretsMeta?Object.entries(e.secretsMeta).map(([e,t])=>({name:e,displayName:t.displayName,description:t.description,secretId:t.secretId,isOAuth2:!!t.oauth2,rawData:t})):[],[e.secretsMeta]),loading:t})})};const n1e=()=>(0,A.jsx)(vx,{children:(0,A.jsx)(t1e,{})}),r1e=({variables:e,loading:t,installed:n=!0})=>{let{openVariable:r}=_x();return(0,A.jsx)(GB,{title:`Environment Variables`,icon:zfe,docsHref:`https://pikku.dev/docs/core-features/variables`,data:e,columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,children:e.displayName}),e.description&&(0,A.jsx)(N,{size:`sm`,c:`dimmed`,truncate:!0,children:e.description})]})},{key:`variableId`,header:`VARIABLE ID`,render:e=>(0,A.jsx)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,children:e.variableId})}],[]),getKey:e=>e.name,onRowClick:e=>r(e.name,{...e.rawData??e,installed:n}),searchPlaceholder:`Search variables...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.displayName.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.variableId.toLowerCase().includes(t)||!1,emptyMessage:`No variables found.`,loading:t,headerRight:(0,A.jsx)(Ch,{label:`Environment Variables docs`,children:(0,A.jsx)(_f,{component:`a`,href:`https://pikku.dev/docs/core-features/variables`,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,size:`sm`,children:(0,A.jsx)(ub,{size:14})})})})};var i1e=()=>{let{meta:e,loading:t}=R();return(0,A.jsx)(WB,{children:(0,A.jsx)(r1e,{variables:(0,D.useMemo)(()=>e.variablesMeta?Object.entries(e.variablesMeta).map(([e,t])=>({name:e,displayName:t.displayName,description:t.description,variableId:t.variableId,rawData:t})):[],[e.variablesMeta]),loading:t})})};const a1e=()=>(0,A.jsx)(vx,{children:(0,A.jsx)(i1e,{})});var o1e=({extraColumns:e,headerRight:t})=>{let n=Uy(),{meta:r,loading:i}=R();return(0,A.jsx)(GB,{title:`Agents`,icon:Qy,docsHref:`https://pikku.dev/docs/wiring/ai-agents`,data:(0,D.useMemo)(()=>r.agentsMeta?Object.entries(r.agentsMeta).map(([e,t])=>({name:e,model:t.model,toolCount:(t.tools||[]).length,agentCount:(t.agents||[]).length,data:t})):[],[r.agentsMeta]),columns:(0,D.useMemo)(()=>[{key:`name`,header:`NAME`,render:e=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(N,{fw:500,truncate:!0,children:e.name}),e.data?.summary&&(0,A.jsx)(N,{size:`xs`,c:`dimmed`,truncate:!0,children:e.data.summary})]})},{key:`model`,header:`MODEL`,render:e=>e.model?(0,A.jsx)(eS,{type:`dynamic`,badge:`model`,value:e.model}):null},{key:`tools`,header:`TOOLS`,render:e=>e.toolCount>0?(0,A.jsx)(eS,{type:`dynamic`,badge:`tools`,value:e.toolCount}):null},{key:`agents`,header:`AGENTS`,render:e=>e.agentCount>0?(0,A.jsx)(eS,{type:`dynamic`,badge:`agents`,value:e.agentCount}):null},...(e??[]).map((e,t)=>({key:`extra-${t}`,header:e.label.toUpperCase(),width:e.width,render:t=>e.render(t.name)}))],[e]),getKey:e=>e.name,onRowClick:e=>n(`/agents/playground?id=${encodeURIComponent(e.name)}`),searchPlaceholder:`Search agents...`,searchFilter:(e,t)=>e.name.toLowerCase().includes(t)||e.model?.toLowerCase().includes(t)||e.data?.summary?.toLowerCase().includes(t)||!1,emptyMessage:`No agents found.`,loading:i,headerRight:t??null})},s1e=({agentId:e})=>{let{meta:t}=R(),{openAgent:n}=_x();return(0,D.useEffect)(()=>{let r=t.agentsMeta?.[e];r&&n(e,r)},[e,t.agentsMeta,n]),(0,A.jsx)(`div`,{})};const c1e=({extraColumns:e,headerRight:t})=>{let[n]=Gy(),r=n.get(`id`),{meta:i,loading:a}=R(),o=!a&&i.agentsMeta&&Object.keys(i.agentsMeta).length>0;return!r&&!o?(0,A.jsx)(o1e,{extraColumns:e,headerRight:t}):(0,A.jsx)(vx,{children:(0,A.jsx)(WB,{hidePanel:!r,children:r?(0,A.jsx)(s1e,{agentId:r}):(0,A.jsx)(o1e,{extraColumns:e,headerRight:t})})})};function l1e(e){let t=[];for(let n of e.effectTasks)try{n()}catch(e){t.push(e)}if(t.length>0){if(t.length===1)throw t[0];for(let e of t)console.error(e);throw AggregateError(t,`Errors during commit`)}}function u1e(e){let t=[];for(let n of e.cells)if(n?.type===`effect`&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(e){t.push(e)}finally{n.cleanup=void 0}if(t.length>0){if(t.length===1)throw t[0];for(let e of t)console.error(e);throw AggregateError(t,`Errors during cleanup`)}}const yG=typeof process<`u`&&!1;var bG=null;function d1e(e,t){e.currentIndex=0;let n=bG;bG=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{bG=n}}function xG(){if(!bG)throw Error(`No resource fiber available`);return bG}function f1e(e){return yG?bG?.devStrictMode?bG.isFirstRender?`child`:`root`:e?`root`:null:null}function p1e(e,t){let n=e[m1e];if(!n)throw Error(`ResourceElement.type is not a valid Resource`);return n(t)}const m1e=Symbol(`fnSymbol`);function SG(e,t,n=void 0,r=f1e(!1)){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function CG(e){if(!e.isMounted)throw Error(`Tried to unmount a fiber that is already unmounted`);e.isMounted=!1,u1e(e)}function wG(e,t){let n={effectTasks:[],props:t,output:void 0};return d1e(e,()=>{e.renderContext=n;try{n.output=p1e(e.type,t)}finally{e.renderContext=void 0}}),n}function TG(e,t){e.isMounted=!0,yG&&e.isNeverMounted&&e.devStrictMode===`root`&&(e.isNeverMounted=!1,l1e(t),u1e(e)),e.isNeverMounted=!1,l1e(t)}const EG=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),DG=e=>{for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},OG=(e,t)=>{let n=e.version>t;if(e.version=t,n){for(let t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.workInProgress=t.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error(`Version is less than committed version`);for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(e=>e()),DG(e)}}},h1e=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))};var g1e=()=>{if(!yG)return null;let e=(0,D.useRef)(0),t=e.current===0;return(0,D.useState)(()=>e.current++),e.current===2?t?`child`:`root`:null};function _1e(e){let t=(0,D.useMemo)(()=>EG(e=>r(e)),[]),[n,r]=(0,D.useReducer)((e,n)=>(OG(t,e),e+(n()?1:0)),0);OG(t,n);let i=g1e(),a=(0,D.useMemo)(()=>(e.key,SG(e.type,t,void 0,i)),[e.type,e.key,t,i]),o=wG(a,e.props);return(0,D.useLayoutEffect)(()=>()=>CG(a),[a]),(0,D.useLayoutEffect)(()=>{DG(t),TG(a,o)}),o.output}function kG(e){let t=e=>({type:t,props:e});return t[m1e]=e,t}function AG(e,t){return{...t,key:e}}const jG=(e,t)=>{let n=xG(),r=n.currentIndex++;if(!n.isFirstRender&&r>=n.cells.length)throw Error(`Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.`);let i=n.cells[r];if(i||(i=t(),n.cells[r]=i),i.type!==e)throw Error(`Hook order changed between renders`);return i},v1e=e=>{xG().renderContext.effectTasks.push(e)};var y1e=(e,t)=>{if(e.renderContext)throw Error(`Resource updated during render`);if(e.isNeverMounted)throw Error(`Resource updated before mount`);e.root.dispatchUpdate(()=>{let n=t();return n?(n(),e.root.changelog.push(n),!0):!1})};function b1e(e,t,n,r){let i=jG(`reducer`,()=>{let t=xG(),a=r?r(n):n;return yG&&t.devStrictMode&&r&&r(n),{type:`reducer`,queue:new Set,dirty:!1,workInProgress:a,current:a,reducer:e,dispatch:n=>{let r={action:n,hasEagerState:!1,eagerState:void 0};y1e(t,()=>t.root.dirtyCells.length===0&&!r.hasEagerState&&(r.eagerState=e(i.workInProgress,n),r.hasEagerState=!0,Object.is(i.current,r.eagerState))?null:()=>{h1e(t,i),i.queue.add(r)})}}}),a=xG(),o=e===i.reducer;i.reducer=e;for(let t of i.queue)(!t.hasEagerState||!o)&&(t.eagerState=e(i.workInProgress,t.action),t.hasEagerState=!0),yG&&a.devStrictMode&&e(i.workInProgress,t.action),i.workInProgress=t.eagerState;if(i.queue.clear(),t){let e=t(i.workInProgress);Object.is(e,i.workInProgress)||(h1e(a,i),i.workInProgress=e)}return[i.workInProgress,i.dispatch]}function x1e(e,t,n){return b1e(e,void 0,t,n)}function S1e(e,t,n,r){return b1e(e,t,n,r)}var C1e=(e,t)=>typeof t==`function`?t(e):t,w1e=e=>typeof e==`function`?e():e;function MG(e){return x1e(C1e,e,w1e)}const T1e=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0};var E1e=()=>({type:`effect`,cleanup:void 0,deps:null});function NG(e,t){let n=jG(`effect`,E1e);if(!(t&&n.deps&&T1e(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw Error(`tapEffect called with and without dependencies across re-renders`);v1e(()=>{let r=[];try{n.cleanup?.()}catch(e){r.push(e)}finally{n.cleanup=void 0}try{let t=e();if(t!==void 0&&typeof t!=`function`)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);n.cleanup=t}catch(e){r.push(e)}if(n.deps=t,r.length>0){if(r.length===1)throw r[0];for(let e of r)console.error(e);throw AggregateError(r,`Errors during commit`)}})}}function PG(e){let[t]=MG(()=>({current:e}));return t}function FG(e,t){let[n]=MG(e);return n}var D1e=()=>{throw Error(`Memo reducer should not be called`)};const IG=(e,t)=>{let n=xG(),[r]=S1e(D1e,r=>{if(r&&T1e(r.deps,t))return r;let i=e();return yG&&n.devStrictMode&&e(),{value:i,deps:t}},null);return r.value},LG=(e,t)=>IG(()=>e,t);function O1e(e){let t=PG(e);if(NG(()=>{t.current=e}),yG){let e=xG();return LG(((...n)=>{if(e.renderContext)throw Error(`tapEffectEvent cannot be called during render`);return t.current(...n)}),[e])}return t.current}function RG(e,t){let n=xG(),r=PG(0),i=IG(()=>(e.key,SG(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),a=t?IG(()=>wG(i,e.props),[i,...t,r.current]):wG(i,e.props);return NG(()=>()=>CG(i),[i]),NG(()=>{TG(i,a)},[i,a]),a.output}function zG(e,t){let n=PG(0),r=n.current,i=FG(xG,[]),a=FG(()=>()=>{n.current++,i.markDirty?.()},[]),o=FG(()=>new Map,[]),s=t?LG(e,t):e,c=IG(()=>{let e=s(),t=new Set,n=[],r=0;for(let s=0;s<e.length;s++){let c=e[s],l=c.key;if(l===void 0)throw Error(`tapResources did not provide a key for array at index ${s}`);if(t.has(l))throw Error(`Duplicate key ${l} in tapResources`);t.add(l);let u=o.get(l);if(u)if(u.fiber.type!==c.type){let e=SG(c.type,i.root,a),t=wG(e,c.props);u.next=[e,t],n.push(t.output)}else u.next=wG(u.fiber,c.props),n.push(u.next.output);else{let e=SG(c.type,i.root,a),t=wG(e,c.props);u={fiber:e,next:t},r++,o.set(l,u),n.push(t.output)}}if(o.size>n.length-r)for(let e of o.keys())t.has(e)||(o.get(e).next=`delete`);return n},[s,r]);return NG(()=>()=>{for(let e of o.keys()){let t=o.get(e).fiber;CG(t)}},[]),NG(()=>{for(let[e,t]of o.entries())t.next===`delete`?(t.fiber.isMounted&&CG(t.fiber),o.delete(e)):Array.isArray(t.next)?(CG(t.fiber),t.fiber=t.next[0],TG(t.fiber,t.next[1])):TG(t.fiber,t.next)},[c]),c}var k1e=50,BG={schedulers:new Set([]),isScheduled:!1},A1e=class{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,BG.schedulers.add(this),j1e()}runTask(){this._isDirty=!1,this._task()}},j1e=()=>{BG.isScheduled||(BG.isScheduled=!0,M1e())},VG=()=>{try{let e=[],t=0;for(let n of BG.schedulers)if(BG.schedulers.delete(n),n.isDirty){if(t++,t>k1e)throw Error(`Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.`);try{n.runTask()}catch(t){e.push(t)}}if(e.length>0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e,`Errors occurred during flushSync`)}}finally{BG.schedulers.clear(),BG.isScheduled=!1}},M1e=(()=>{if(typeof MessageChannel<`u`){let e=new MessageChannel;return e.port1.onmessage=VG,()=>e.port2.postMessage(null)}return()=>setTimeout(VG,0)})();const HG=e=>{let t=BG;BG={schedulers:new Set([]),isScheduled:!0};try{let t=e();return VG(),t}finally{BG=t}},N1e=e=>{let t=FG(()=>new A1e(()=>l(null)),[]),n=FG(()=>[],[]),r=IG(()=>(e.key,SG(e.type,EG(e=>{!t.isDirty&&!e()||(n.push(e),t.markDirty())}))),[e.type,e.key]);OG(r.root,r.root.committedVersion);let i=wG(r,e.props),a=PG(!1),o=PG(e.props),s=PG(i.output),c=FG(()=>new Set,[]),l=O1e(e=>{if(e===null&&(OG(r.root,2),OG(r.root,1),n.forEach(e=>{yG&&r.devStrictMode&&e(),e()}),yG&&r.devStrictMode&&wG(r,o.current),e=wG(r,o.current)),t.isDirty)throw Error(`Scheduler is dirty, this should never happen`);DG(r.root),n.length=0,a.current&&TG(r,e),!(t.isDirty||s.current===e.output)&&(s.current=e.output,c.forEach(e=>e()))});return NG(()=>(a.current=!0,()=>{a.current=!1,CG(r)}),[r]),NG(()=>{o.current=i.props,DG(r.root),TG(r,i),!(t.isDirty||s.current===i.output)&&(s.current=i.output,c.forEach(e=>e()))}),IG(()=>({getValue:()=>s.current,subscribe:e=>(c.add(e),()=>c.delete(e))}),[])};var UG=Symbol(`tap.Context`);const P1e=e=>({[UG]:e}),WG=(e,t,n)=>{let r=e[UG];e[UG]=t;try{return n()}finally{e[UG]=r}},F1e=e=>e[UG],GG=Symbol(`assistant-ui.store.clientIndex`),I1e=e=>e[GG];var KG=P1e([]);const qG=()=>F1e(KG),L1e=(e,t)=>{let n=qG();return WG(KG,IG(()=>[...n,e],[n,e]),t)};var R1e=new Set([`$$typeof`,`nodeType`,`then`]);const JG=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!=`symbol`){if(e===`toJSON`)return()=>t;if(!R1e.has(e))return!1}};var z1e=class{getOwnPropertyDescriptor(e,t){let n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}};const YG=e=>{let t=kG(e);return e=>{let n=t(e);return e.key===void 0?n:AG(e.key,n)}};var XG=Symbol(`assistant-ui.store.getValue`);const B1e=e=>{let t=e[XG];if(!t)throw Error(`Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.`);return t.getState?.()};var V1e=new Map;function H1e(e){let t=V1e.get(e);return t||(t=function(...t){if(!this||typeof this!=`object`)throw Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);let n=this[XG];if(!n)throw Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let r=n[e];if(!r)throw Error(`Method "${String(e)}" is not implemented.`);if(typeof r!=`function`)throw Error(`"${String(e)}" is not a function.`);return r(...t)},V1e.set(e,t)),t}var U1e=class extends z1e{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,n){if(t===XG)return this.outputRef.current;if(t===GG)return this.index;let r=JG(t,`ClientProxy`);if(r!==!1)return r;let i=this.outputRef.current[t];if(typeof i==`function`){this.cachedReceiver!==n&&(this.boundFns=new Map,this.cachedReceiver=n);let e=this.boundFns.get(t);return e||(e=H1e(t).bind(n),this.boundFns.set(t,e)),e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===XG||t===GG?!0:t in this.outputRef.current}};const W1e=YG(e=>{let t=PG(null),n=qG().length,r=IG(()=>new Proxy({},new U1e(t,n)),[n]),i=L1e(r,()=>RG(e));return t.current||=i,NG(()=>{t.current=i}),{methods:r,state:i.getState?.(),key:e.key}}),G1e=e=>RG(W1e(e)),ZG=Symbol(`assistant-ui.store.proxiedAssistantState`);var QG=e=>e===`on`||e===`subscribe`||typeof e==`symbol`;const K1e=e=>{class t extends z1e{get(t,n){let r=JG(n,`AssistantState`);if(r!==!1)return r;let i=n;if(!QG(i))return B1e(e[i]())}ownKeys(){return Object.keys(e).filter(e=>!QG(e))}has(t,n){return!QG(n)&&n in e}}return new Proxy({},new t)},q1e=e=>e[ZG];var $G=()=>()=>{},J1e=e=>{let t=(()=>{throw Error(e)});return t.source=null,t.query=null,t},Y1e=class extends z1e{get(e,t){if(t===`subscribe`||t===`on`)return $G;if(t===ZG)return X1e;let n=JG(t,`DefaultAssistantClient`);return n===!1?J1e(`You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.`):n}ownKeys(){return[`subscribe`,`on`,ZG]}has(e,t){return t===`subscribe`||t===`on`||t===ZG}};const eK=new Proxy({},new Y1e);var X1e=K1e(eK);const Z1e=()=>new Proxy({},{get(e,t){let n=JG(t,`AssistantClient`);return n===!1?J1e(`The current scope does not have a "${String(t)}" property.`):n}});var Q1e=(0,D.createContext)(eK);const $1e=()=>(0,D.useContext)(Q1e),tK=({value:e,children:t})=>(0,A.jsx)(Q1e.Provider,{value:e,children:t}),nK=kG(e=>null);var e0e=Symbol(`assistant-ui.transform-scopes`);function t0e(e,t){let n=e;if(n[e0e])throw Error(`transformScopes is already attached to this resource`);n[e0e]=t}function n0e(e){return e[e0e]}function r0e(e,t){let n={...e},r=new Set,i=!0;for(;i;){i=!1;for(let e of Object.values(n)){if(e.type===nK||r.has(e.type))continue;r.add(e.type);let a=n0e(e.type);if(a){n=a(n,t),i=!0;break}}}let a={},o={};for(let[e,t]of Object.entries(n))t.type===nK?o[e]=t:a[e]=t;return{rootClients:a,derivedClients:o}}var i0e=e=>IG(()=>e,[...Object.entries(e).flat()]);const rK=(e,t)=>{let{rootClients:n,derivedClients:r}=r0e(e,t);return{rootClients:i0e(n),derivedClients:i0e(r)}},a0e=e=>typeof e==`string`?{scope:e.split(`.`)[0],event:e}:{scope:e.scope,event:e.event},iK=kG(()=>FG(()=>{let e=new Map,t=new Set,n=new Set;return{on(n,r){let i=r;if(n===`*`)return t.add(i),()=>t.delete(i);let a=e.get(n);return a||(a=new Set,e.set(n,a)),a.add(i),()=>{a.delete(i),a.size===0&&e.delete(n)}},emit(n,r,i){let a=e.get(n);!a&&t.size===0||queueMicrotask(()=>{let e=[];if(a)for(let t of a)try{t(r,i)}catch(t){e.push(t)}if(t.size>0){let a={event:n,payload:r};for(let n of t)try{n(a,i)}catch(t){e.push(t)}}if(e.length>0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e,`Errors occurred during event emission`)}})},subscribe(e){return n.add(e),()=>n.delete(e)},notifySubscribers(){for(let e of n)try{e()}catch(e){console.error(`NotificationManager: subscriber callback error`,e)}}}},[]));var o0e=P1e(null);const s0e=(e,t)=>WG(o0e,e,t);var c0e=()=>{let e=F1e(o0e);if(!e)throw Error(`AssistantTapContext is not available`);return e};const l0e=()=>c0e().clientRef,u0e=()=>{let{emit:e}=c0e(),t=qG();return O1e((n,r)=>{e(n,r,t)})};var d0e=e=>IG(()=>e,e),aK=kG(({element:e,emit:t,clientRef:n})=>{let{methods:r,state:i}=s0e({clientRef:n,emit:t},()=>G1e(e));return IG(()=>({state:i,methods:r}),[r,i])}),f0e=kG(({element:e,notifications:t,clientRef:n,name:r})=>{let i=N1e(aK({element:e,emit:t.emit,clientRef:n}));return NG(()=>i.subscribe(t.notifySubscribers),[i,t]),IG(()=>{let e=()=>i.getValue().methods;return Object.defineProperties(e,{source:{value:`root`,writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),e},[i,r])}),p0e=kG(()=>IG(()=>({clients:[],subscribe:void 0,on:void 0}),[])),oK=kG(({clients:e,clientRef:t})=>{let n=RG(iK());NG(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);let r=d0e(zG(()=>Object.keys(e).map(r=>AG(r,f0e({element:e[r],notifications:n,clientRef:t,name:r}))),[e,n,t]));return IG(()=>({clients:r,subscribe:n.subscribe,on:function(e,r){if(!this)throw Error(`const { on } = useAui() is not supported. Use aui.on() instead.`);let{scope:i,event:a}=a0e(e);if(i!==`*`&&this[i].source===null)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);let o=n.on(a,(e,t)=>{if(i===`*`){r(e);return}let n=this[i]();n===t[I1e(n)]&&r(e)});if(i!==`*`&&t.parent[i].source===null)return o;let s=t.parent.on(e,r);return()=>{o(),s()}}}),[r,n,t])}),m0e=(e,t,n)=>{if(`source`in e&&`query`in e)return e;if(n.dep===e)return n.meta;let r=e.getMeta(t.current);return n.meta=r,n.dep=e,r},h0e=kG(({element:e,clientRef:t,name:n})=>{let r=O1e(()=>e.props);return IG(()=>{let e=()=>r().get(t.current),i={};return Object.defineProperties(e,{source:{get:()=>m0e(r(),t,i).source},query:{get:()=>m0e(r(),t,i).query},name:{value:n,configurable:!0}}),e},[t,n])}),g0e=kG(({clients:e,clientRef:t})=>d0e(zG(()=>Object.keys(e).map(n=>AG(n,h0e({element:e[n],clientRef:t,name:n}))),[e,t])));const _0e=kG(({parent:e,clients:t})=>{let{rootClients:n,derivedClients:r}=rK(t,e),i=PG({parent:e,current:null}).current;NG(()=>{i.current=s});let a=RG(Object.keys(n).length>0?oK({clients:n,clientRef:i}):p0e()),o=RG(g0e({clients:r,clientRef:i})),s=IG(()=>{let t=e===eK?Z1e():e,n=Object.create(t);Object.assign(n,{subscribe:a.subscribe??e.subscribe,on:a.on??e.on,[ZG]:K1e(n)});for(let e of a.clients)n[e.name]=e;for(let e of o)n[e.name]=e;return n},[e,a,o]);return i.current===null&&(i.current=s),s});function sK(e,{parent:t}={parent:$1e()}){if(e)return _1e(_0e({parent:t??eK,clients:e}));if(t===null)throw Error(`received null parent, this usage is not allowed`);return t}const cK=e=>{let t=sK(),n=q1e(t),r=(0,D.useSyncExternalStore)(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw Error(`You tried to return the entire AssistantState. This is not supported due to technical limitations.`);return(0,D.useDebugValue)(r),r};var v0e=D.createContext(!0);function y0e(){throw Error(`A function wrapped in useEffectEvent can't be called during rendering.`)}var b0e=`use`in D.default?()=>{try{return D.use(v0e)}catch{return!1}}:()=>!1;function x0e(e){let t=D.useRef(y0e);return D.useInsertionEffect(()=>{t.current=e},[e]),(...e)=>{b0e()&&y0e();let n=t.current;return n(...e)}}const S0e=(e,t)=>{let n=sK(),r=x0e(t),{scope:i,event:a}=a0e(e);(0,D.useEffect)(()=>n.on({scope:i,event:a},r),[n,i,a,r])};var C0e=YG(e=>{if(e.key===void 0)throw Error(`tapClientResource: Element has no key`);return RG(W1e(e))});function lK(e,t){let n=zG(()=>e().map(e=>C0e(e)),t),r=IG(()=>Object.keys(n),[n]),i=IG(()=>n.reduce((e,t,n)=>(e[t.key]=n,e),{}),[n]);return{state:IG(()=>n.map(e=>e.state),[n]),get:e=>{if(`index`in e){if(e.index<0||e.index>=r.length)throw Error(`tapClientLookup: Index ${e.index} out of bounds (length: ${r.length})`);return n[e.index].methods}let t=i[e.key];if(t===void 0)throw Error(`tapClientLookup: Key "${e.key}" not found`);return n[t].methods}}}var w0e=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))},o=t=e(r,i,a);return a},T0e=(e=>e?w0e(e):w0e),uK=e=>e;function E0e(e,t=uK){let n=D.useSyncExternalStore(e.subscribe,D.useCallback(()=>t(e.getState()),[e,t]),D.useCallback(()=>t(e.getInitialState()),[e,t]));return D.useDebugValue(n),n}var D0e=e=>{let t=T0e(e),n=e=>E0e(t,e);return Object.assign(n,t),n},dK=(e=>e?D0e(e):D0e),O0e=kG(e=>({getState:()=>e}));const k0e=kG(e=>{let[t]=MG(()=>({suggestions:(e??[]).map(e=>typeof e==`string`?{title:e,label:``,prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),n=lK(()=>t.suggestions.map((e,t)=>AG(t,O0e(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>n.get({index:e})}});var A0e=Object.freeze({type:`complete`});const fK=kG(({parts:e,getMessagePart:t})=>{let[n,r]=MG(!0),i=IG(()=>e[e.length-1]?.status??A0e,[e]),a=IG(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>a,setCollapsed:r,part:t}});let j0e=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r};const pK=j0e(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7);var M0e=`__optimistic__`;const mK=()=>`${M0e}${pK()}`,hK=e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
191
191
 
192
192
  `),N0e=e=>Array.from(e).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`\n\n${t.system}`:e.system=t.system),t.tools)for(let[n,r]of Object.entries(t.tools)){let t=e.tools?.[n];if(t&&t!==r)throw Error(`You tried to define a tool with the name ${n}, but it already exists.`);e.tools||={},e.tools[n]=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{});var gK=class{_providers=new Set;getModelContext(){return N0e(this._providers)}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}},_K=1;const P0e=kG(()=>{let[e]=MG(()=>({version:_K+1})),t=IG(()=>new gK,[]);return{getState:()=>e,getModelContext:()=>t.getModelContext(),subscribe:e=>t.subscribe(e),register:e=>t.registerModelContextProvider(e)}}),vK=kG(({toolkit:e})=>{let[t,n]=MG(()=>({tools:{}})),r=l0e(),i=LG((e,t)=>(n(n=>({...n,tools:{...n.tools,[e]:[...n.tools[e]??[],t]}})),()=>{n(n=>({...n,tools:{...n.tools,[e]:n.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return NG(()=>{if(!e)return;let t=[];for(let[n,r]of Object.entries(e))r.render&&t.push(i(n,r.render));let n=Object.entries(e).reduce((e,[t,n])=>{let{render:r,...i}=n;return e[t]=i,e},{});return t.push(r.current.modelContext().register({getModelContext:()=>({tools:n})})),()=>{t.forEach(e=>e())}},[e,i,r]),{getState:()=>t,setToolUI:i}});t0e(vK,(e,t)=>({...e,...e.modelContext||t.modelContext.source!==null?{}:{modelContext:P0e()}}));const F0e=kG(()=>{let[e,t]=MG(()=>({renderers:{}}));return{getState:()=>e,setDataUI:LG((e,n)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],n]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==n)??[]}}))}),[])}}),yK=e=>{let[,t]=MG(e.getState);return NG(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},bK=kG(({runtime:e})=>{let t=yK(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),I0e=kG(({runtime:e})=>{let t=yK(e);return{getState:()=>t,addToolResult:t=>e.addToolResult(t),resumeToolCall:t=>e.resumeToolCall(t),__internal_getRuntime:()=>e}});var L0e=kG(({runtime:e,index:t})=>RG(bK({runtime:IG(()=>e.getAttachmentByIndex(t),[e,t])})));const xK=kG(({threadIdRef:e,messageIdRef:t,runtime:n})=>{let r=yK(n),i=u0e();NG(()=>{let r=[];for(let a of[`send`,`attachmentAdd`]){let o=n.unstable_on(a,()=>{i(`composer.${a}`,{threadId:e.current,...t&&{messageId:t.current}})});r.push(o)}return()=>{for(let e of r)e()}},[n,i,e,t]);let a=lK(()=>r.attachments.map((e,t)=>AG(e.id,L0e({runtime:n,index:t}))),[r.attachments,n]),o=IG(()=>({text:r.text,role:r.role,attachments:a.state,runConfig:r.runConfig,isEditing:r.isEditing,canCancel:r.canCancel,attachmentAccept:r.attachmentAccept,isEmpty:r.isEmpty,type:r.type??`thread`,dictation:r.dictation,quote:r.quote}),[r,a.state]);return{getState:()=>o,setText:n.setText,setRole:n.setRole,setRunConfig:n.setRunConfig,addAttachment:n.addAttachment,reset:n.reset,clearAttachments:n.clearAttachments,send:n.send,cancel:n.cancel,beginEdit:n.beginEdit??(()=>{throw Error(`beginEdit is not supported in this runtime`)}),startDictation:n.startDictation,stopDictation:n.stopDictation,setQuote:n.setQuote,attachment:e=>`id`in e?a.get({key:e.id}):a.get(e),__internal_getRuntime:()=>n}});var R0e=kG(({runtime:e,index:t})=>RG(bK({runtime:IG(()=>e.getAttachmentByIndex(t),[e,t])}))),z0e=kG(({runtime:e,index:t})=>RG(I0e({runtime:IG(()=>e.getMessagePartByIndex(t),[e,t])})));const B0e=kG(({runtime:e,threadIdRef:t})=>{let n=yK(e),[r,i]=MG(!1),[a,o]=MG(!1),s=IG(()=>({get current(){return e.getState().id}}),[e]),c=G1e(xK({runtime:e.composer,threadIdRef:t,messageIdRef:s})),l=lK(()=>n.content.map((t,n)=>AG(`toolCallId`in t&&t.toolCallId!=null?`toolCallId-${t.toolCallId}`:`index-${n}`,z0e({runtime:e,index:n}))),[n.content,e]),u=lK(()=>(n.attachments??[]).map((t,n)=>AG(t.id,R0e({runtime:e,index:n}))),[n.attachments,e]),d=IG(()=>({...n,parts:l.state,composer:c.state,isCopied:r,isHovering:a}),[n,l.state,c.state,r,a]);return{getState:()=>d,composer:()=>c.methods,reload:t=>e.reload(t),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:t=>e.submitFeedback(t),switchToBranch:t=>e.switchToBranch(t),getCopyText:()=>e.unstable_getCopyText(),part:e=>`index`in e?l.get({index:e.index}):l.get({key:`toolCallId-${e.toolCallId}`}),attachment:e=>`id`in e?u.get({key:e.id}):u.get(e),setIsCopied:i,setIsHovering:o,__internal_getRuntime:()=>e}});var V0e=kG(({runtime:e,id:t,threadIdRef:n})=>RG(B0e({runtime:IG(()=>e.getMessageById(t),[e,t]),threadIdRef:n})));const H0e=kG(({runtime:e})=>{let t=yK(e),n=u0e();NG(()=>{let t=[];for(let r of[`runStart`,`runEnd`,`initialize`,`modelContextUpdate`]){let i=e.unstable_on(r,()=>{let t=e.getState()?.threadId||`unknown`;n(`thread.${r}`,{threadId:t})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]);let r=IG(()=>({get current(){return e.getState().threadId}}),[e]),i=G1e(xK({runtime:e.composer,threadIdRef:r})),a=lK(()=>t.messages.map(t=>AG(t.id,V0e({runtime:e,id:t.id,threadIdRef:r}))),[t.messages,e,r]),o=IG(()=>({isEmpty:a.state.length===0&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,composer:i.state,messages:a.state}),[t,a,i.state]);return{getState:()=>o,composer:()=>i.methods,append:e.append,startRun:e.startRun,unstable_resumeRun:e.unstable_resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,startVoice:async()=>{throw Error(`startVoice is not supported in this runtime`)},stopVoice:async()=>{throw Error(`stopVoice is not supported in this runtime`)},message:e=>`id`in e?a.get({key:e.id}):a.get(e),__internal_getRuntime:()=>e}}),U0e=kG(({runtime:e})=>{let t=yK(e),n=u0e();return NG(()=>{let t=[];for(let r of[`switchedTo`,`switchedAway`]){let i=e.unstable_on(r,()=>{n(`threadListItem.${r}`,{threadId:e.getState().id})});t.push(i)}return()=>{for(let e of t)e()}},[e,n]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}});var W0e=kG(({runtime:e,id:t})=>RG(U0e({runtime:IG(()=>e.getItemById(t),[e,t])})));const SK=kG(({runtime:e,__internal_assistantRuntime:t})=>{let n=yK(e),r=G1e(H0e({runtime:e.main})),i=lK(()=>Object.keys(n.threadItems).map(t=>AG(t,W0e({runtime:e,id:t}))),[n.threadItems,e]),a=IG(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:i.state,main:r.state}),[n,i.state,r.state]);return{getState:()=>a,thread:()=>r.methods,item:e=>{if(e===`main`)return i.get({key:a.mainThreadId});if(`id`in e)return i.get({key:e.id});let{index:t,archived:n=!1}=e,r=n?a.archivedThreadIds[t]:a.threadIds[t];return i.get({key:r})},switchToThread:async t=>{await e.switchToThread(t)},switchToNewThread:async()=>{await e.switchToNewThread()},__internal_getAssistantRuntime:()=>t}}),G0e=kG(e=>{let t=l0e();return NG(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),RG(SK({runtime:e.threads,__internal_assistantRuntime:e}))}),CK=(e,t)=>{let n={...e,thread:e.thread??nK({source:`threads`,query:{type:`main`},get:e=>e.threads().thread(`main`)}),threadListItem:e.threadListItem??nK({source:`threads`,query:{type:`main`},get:e=>e.threads().item(`main`)}),composer:e.composer??nK({source:`thread`,query:{},get:e=>e.threads().thread(`main`).composer()})};return!n.modelContext&&t.modelContext.source===null&&(n.modelContext=P0e()),!n.suggestions&&t.suggestions.source===null&&(n.suggestions=k0e()),n},K0e=({runtime:e,children:t})=>(0,A.jsx)(tK,{value:sK({threadListItem:U0e({runtime:e})}),children:t}),q0e=({index:e,children:t})=>(0,A.jsx)(tK,{value:sK({message:nK({source:`thread`,query:{type:`index`,index:e},get:t=>t.thread().message({index:e})}),composer:nK({source:`message`,query:{},get:t=>t.thread().message({index:e}).composer()})}),children:t}),J0e=({index:e,children:t})=>(0,A.jsx)(tK,{value:sK({part:nK({source:`message`,query:{type:`index`,index:e},get:t=>t.message().part({index:e})})}),children:t});var Y0e=kG(({text:e,isRunning:t})=>{let n=IG(()=>({type:`text`,text:e,status:t?{type:`running`}:{type:`complete`}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw Error(`Not supported`)},resumeToolCall:()=>{throw Error(`Not supported`)}}});const X0e=({text:e,isRunning:t=!1,children:n})=>(0,A.jsx)(tK,{value:sK({part:Y0e({text:e,isRunning:t})}),children:n}),Z0e=({startIndex:e,endIndex:t,children:n})=>{let r=cK(e=>e.message.parts).slice(e,t+1),i=sK();return(0,A.jsx)(tK,{value:sK({chainOfThought:fK({parts:r,getMessagePart:({index:t})=>{if(t<0||t>=r.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${r.length-1})`);return i.message().part({index:e+t})}})}),children:n})},Q0e=kG(e=>RG(G0e(e)));t0e(Q0e,(e,t)=>{let n=CK(e,t);return!n.tools&&t.tools.source===null&&(n.tools=vK({})),!n.dataRenderers&&t.dataRenderers.source===null&&(n.dataRenderers=F0e()),n});const $0e=e=>e._core?.RenderComponent,e2e=(0,D.memo)(({runtime:e,aui:t=null,children:n})=>{let r=sK({threads:Q0e(e)},{parent:t}),i=$0e(e);return(0,A.jsxs)(tK,{value:r,children:[i&&(0,A.jsx)(i,{}),n]})});var t2e=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,n2e=()=>null,wK=(e,t,n)=>{switch(t){case`user`:return n?e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message:e.UserMessage??e.Message;case`assistant`:return n?e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message:e.AssistantMessage??e.Message;case`system`:return n?e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message:e.SystemMessage??e.Message??n2e;default:let r=t;throw Error(`Unknown message role: ${r}`)}},TK=({components:e})=>(0,A.jsx)(wK(e,cK(e=>e.message.role),cK(e=>e.message.composer.isEditing)),{});const r2e=(0,D.memo)(({index:e,components:t})=>(0,A.jsx)(q0e,{index:e,children:(0,A.jsx)(TK,{components:t})}),(e,t)=>e.index===t.index&&t2e(e.components,t.components));r2e.displayName=`ThreadPrimitive.MessageByIndex`;const i2e=({components:e})=>{let t=cK(e=>e.thread.messages.length);return(0,D.useMemo)(()=>t===0?null:Array.from({length:t},(t,n)=>(0,A.jsx)(r2e,{index:n,components:e},n)),[t,e])};i2e.displayName=`ThreadPrimitive.Messages`;const a2e=(0,D.memo)(i2e,(e,t)=>t2e(e.components,t.components));var o2e=e=>Symbol.iterator in e,s2e=e=>`entries`in e,c2e=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},l2e=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function u2e(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:o2e(e)&&o2e(t)?s2e(e)&&s2e(t)?c2e(e,t):l2e(e,t):c2e({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function d2e(e){let t=D.useRef(void 0);return n=>{let r=e(n);return u2e(t.current,r)?t.current:t.current=r}}var EK=e=>{let t=-1;return{startGroup:e=>{t===-1&&(t=e)},endGroup:(n,r)=>{t!==-1&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{t!==-1&&r.push({type:e,startIndex:t,endIndex:n})}}},DK=(e,t)=>{let n=[];if(t){let t=EK(`chainOfThoughtGroup`);for(let r=0;r<e.length;r++){let i=e[r];i===`tool-call`||i===`reasoning`?t.startGroup(r):(t.endGroup(r-1,n),n.push({type:`single`,index:r}))}t.finalize(e.length-1,n)}else{let t=EK(`toolGroup`),r=EK(`reasoningGroup`);for(let i=0;i<e.length;i++){let a=e[i];a===`tool-call`?(r.endGroup(i-1,n),t.startGroup(i)):a===`reasoning`?(t.endGroup(i-1,n),r.startGroup(i)):(t.endGroup(i-1,n),r.endGroup(i-1,n),n.push({type:`single`,index:i}))}t.finalize(e.length-1,n),r.finalize(e.length-1,n)}return n},f2e=e=>{let t=cK(d2e(e=>e.message.parts.map(e=>e.type)));return(0,D.useMemo)(()=>t.length===0?[]:DK(t,e),[t,e])},p2e=({Fallback:e,...t})=>{let n=cK(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,A.jsx)(n,{...t}):null},m2e=({Fallback:e,...t})=>{let n=cK(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,A.jsx)(n,{...t}):null};const OK={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},h2e=({components:{Text:e=OK.Text,Reasoning:t=OK.Reasoning,Image:n=OK.Image,Source:r=OK.Source,File:i=OK.File,Unstable_Audio:a=OK.Unstable_Audio,tools:o={},data:s}={}})=>{let c=sK(),l=cK(e=>e.part),u=l.type;if(u===`tool-call`){let e=c.part().addToolResult,t=c.part().resumeToolCall;if(`Override`in o)return(0,A.jsx)(o.Override,{...l,addResult:e,resume:t});let n=o.by_name?.[l.toolName]??o.Fallback;return(0,A.jsx)(p2e,{...l,Fallback:n,addResult:e,resume:t})}if(l.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(u){case`text`:return(0,A.jsx)(e,{...l});case`reasoning`:return(0,A.jsx)(t,{...l});case`source`:return(0,A.jsx)(r,{...l});case`image`:return(0,A.jsx)(n,{...l});case`file`:return(0,A.jsx)(i,{...l});case`audio`:return(0,A.jsx)(a,{...l});case`data`:{let e=s?.by_name?.[l.name]??s?.Fallback;return(0,A.jsx)(m2e,{...l,Fallback:e})}default:return console.warn(`Unknown message part type: ${u}`),null}},kK=(0,D.memo)(({index:e,components:t})=>(0,A.jsx)(J0e,{index:e,children:(0,A.jsx)(h2e,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);kK.displayName=`MessagePrimitive.PartByIndex`;var g2e=({status:e,component:t})=>(0,A.jsx)(X0e,{text:``,isRunning:e.type===`running`,children:(0,A.jsx)(t,{type:`text`,text:``,status:e})}),_2e=Object.freeze({type:`complete`}),v2e=(0,D.memo)(({components:e})=>{let t=cK(e=>e.message.status??_2e);return e?.Empty?(0,A.jsx)(e.Empty,{status:t}):(0,A.jsx)(g2e,{status:t,component:e?.Text??OK.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),y2e=(0,D.memo)(({components:e,enabled:t})=>cK(e=>{if(!t||e.message.parts.length===0)return!1;let n=e.message.parts[e.message.parts.length-1];return n?.type!==`text`&&n?.type!==`reasoning`})?(0,A.jsx)(v2e,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text);const b2e=({components:e,unstable_showEmptyOnNonTextEnd:t=!0})=>{let n=cK(e=>e.message.parts.length),r=f2e(!!e?.ChainOfThought);return(0,A.jsxs)(A.Fragment,{children:[(0,D.useMemo)(()=>n===0?(0,A.jsx)(v2e,{components:e}):r.map(t=>{if(t.type===`single`)return(0,A.jsx)(kK,{index:t.index,components:e},t.index);if(t.type===`chainOfThoughtGroup`){let n=e?.ChainOfThought;return n?(0,A.jsx)(Z0e,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,A.jsx)(n,{})},`chainOfThought-${t.startIndex}`):null}else if(t.type===`toolGroup`)return(0,A.jsx)(e?.ToolGroup??OK.ToolGroup,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,r)=>(0,A.jsx)(kK,{index:t.startIndex+r,components:e},r))},`tool-${t.startIndex}`);else return(0,A.jsx)(e?.ReasoningGroup??OK.ReasoningGroup,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,r)=>(0,A.jsx)(kK,{index:t.startIndex+r,components:e},r))},`reasoning-${t.startIndex}`)}),[r,e,n]),(0,A.jsx)(y2e,{components:e,enabled:t})]})};b2e.displayName=`MessagePrimitive.Parts`;const AK=Symbol(`skip-update`);function x2e(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0)return!1;for(let n of Object.keys(e)){let r=e[n],i=t[n];if(!Object.is(r,i))return!1}return!0}var jK=class{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e)}}},S2e=class{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else this._connection?.(),this._connection=void 0}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}},MK=class extends S2e{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;let t=e.getState();if(t===AK)throw Error(`Entry not available in the store`);this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return e===AK||x2e(e,this._previousState)?!1:(this._previousState=e,!0)}_connect(){return this.binding.subscribe(()=>{this._syncState()&&this.notifySubscribers()})}},NK=class extends S2e{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==AK&&(this._previousState=e),this._previousStateDirty=!1}if(this._previousState===void 0)throw Error(`Entry not available in the store`);return this._previousState};_connect(){return this.binding.subscribe(()=>{this._previousStateDirty=!0,this.notifySubscribers()})}},C2e=class extends S2e{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=this.outerSubscribe(()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())});return()=>{r?.(),n?.()}}},w2e=class extends S2e{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=this.outerSubscribe(()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))});return()=>{r?.(),n?.()}}},T2e=class{_contextProvider=new gK;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}},PK=Symbol(`autoStatus`),E2e=Object.freeze(Object.assign({type:`running`},{[PK]:!0})),D2e=Object.freeze(Object.assign({type:`complete`,reason:`unknown`},{[PK]:!0})),O2e=Object.freeze(Object.assign({type:`requires-action`,reason:`tool-calls`},{[PK]:!0})),k2e=Object.freeze(Object.assign({type:`requires-action`,reason:`interrupt`},{[PK]:!0}));const A2e=(e,t,n,r,i)=>e&&i?Object.assign({type:`incomplete`,reason:`error`,error:i},{[PK]:!0}):e&&t?E2e:n?k2e:r?O2e:D2e;var j2e=s(((e,t)=>{var n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o}));function M2e(e){let t=[`ROOT`],n=-1,r=null,i=[],a;function o(){a!==void 0&&(i.push(JSON.parse(`"${a}"`)),a=void 0)}function s(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`),o();break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),o();break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),o();break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`),o();break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`),o();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop(),a=i.pop();break}}function l(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),a=(Number(a)+1).toString();break;case`]`:n=r,t.pop(),a=i.pop();break}}for(let o=0;o<e.length;o++){let u=e[o];switch(t[t.length-1]){case`ROOT`:s(u,o,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`),a=``;break;case`}`:n=o,t.pop(),a=i.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`),a=``;break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`),a+=u;break;default:a+=u;break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:s(u,o,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:c(u,o);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=o,a=i.pop();break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=o}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=o,t.pop(),a=i.pop();break;default:n=o,a=`0`,s(u,o,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),a=(Number(a)+1).toString();break;case`]`:n=o,t.pop(),a=i.pop();break;default:n=o;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:s(u,o,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),t[t.length-1]===`INSIDE_STRING`?n=o:t[t.length-1]===`INSIDE_OBJECT_KEY`&&(a+=u);break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=o;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&c(u,o);break;case`}`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&c(u,o);break;case`]`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o);break;default:t.pop(),a=i.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,o+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?c(u,o):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o)):n=o;break}}}let u=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:u+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:u+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:u+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?u+=`true`.slice(t.length):`false`.startsWith(t)?u+=`false`.slice(t.length):`null`.startsWith(t)&&(u+=`null`.slice(t.length))}}return[u,i]}var N2e=u(j2e(),1),P2e=Symbol(`aui.parse-partial-json-object.meta`);const F2e=e=>{if(e.length===0)return{[P2e]:{state:`partial`,partialPath:[]}};try{let t=N2e.default.parse(e);if(typeof t!=`object`||!t)throw Error(`argsText is expected to be an object`);return t[P2e]={state:`complete`,partialPath:[]},t}catch{try{let[t,n]=M2e(e),r=N2e.default.parse(t);if(typeof r!=`object`||!r)throw Error(`argsText is expected to be an object`);return r[P2e]={state:`partial`,partialPath:n},r}catch{return}}},I2e={toResponse(e,t){return new Response(I2e.toByteStream(e,t),{headers:t.headers??{}})},fromResponse(e,t){return I2e.fromByteStream(e.body,t)},toByteStream(e,t){return e.pipeThrough(t)},fromByteStream(e,t){return e.pipeThrough(t)}},L2e=function(){let e,t,n=new Promise((n,r)=>{e=n,t=r});if(!e||!t)throw Error(`Failed to create promise`);return{promise:n,resolve:e,reject:t}},FK=()=>{let e=[],t=!1,n,r,i=i=>{i.promise||=i.reader.read().then(({done:a,value:o})=>{i.promise=void 0,a?(e.splice(e.indexOf(i),1),t&&e.length===0&&n.close()):n.enqueue(o),r?.resolve(),r=void 0}).catch(t=>{console.error(t),e.forEach(e=>{e.reader.cancel()}),e.length=0,n.error(t),r?.reject(t),r=void 0})};return{readable:new ReadableStream({start(e){n=e},pull(){return r=L2e(),e.forEach(e=>{i(e)}),r.promise},cancel(){e.forEach(e=>{e.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(n){if(t)throw Error(`Cannot add streams after the run callback has settled.`);let r={reader:n.getReader()};e.push(r),i(r)},enqueue(e){this.addStream(new ReadableStream({start(t){t.enqueue(e),t.close()}}))}}};var R2e=class{_controller;_isClosed=!1;constructor(e){this._controller=e}append(e){return this._controller.enqueue({type:`text-delta`,path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:`part-finish`,path:[]}),this._controller.close())}};const z2e=e=>new ReadableStream({start(t){return e.start?.(new R2e(t))},pull(t){return e.pull?.(new R2e(t))},cancel(t){return e.cancel?.(t)}}),IK=()=>{let e;return[z2e({start(t){e=t}}),e]};var B2e=class{_controller;_isClosed=!1;_mergeTask;constructor(e){this._controller=e;let t=z2e({start:e=>{this._argsTextController=e}}),n=!1;this._mergeTask=t.pipeTo(new WritableStream({write:e=>{switch(e.type){case`text-delta`:n=!0,this._controller.enqueue(e);break;case`part-finish`:n||this._controller.enqueue({type:`text-delta`,textDelta:`{}`,path:[]}),this._controller.enqueue({type:`tool-call-args-text-finish`,path:[]});break;default:throw Error(`Unexpected chunk type: ${e.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:`result`,path:[],...e.artifact===void 0?{}:{artifact:e.artifact},result:e.result,isError:e.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:`part-finish`,path:[]}),this._controller.close())}};const V2e=e=>new ReadableStream({start(t){return e.start?.(new B2e(t))},pull(t){return e.pull?.(new B2e(t))},cancel(t){return e.cancel?.(t)}}),H2e=()=>{let e;return[V2e({start(t){e=t}}),e]};var U2e=class{value=-1;up(){return++this.value}},W2e=class extends TransformStream{constructor(e){super({transform(t,n){n.enqueue({...t,path:[e,...t.path]})}})}},G2e=class extends TransformStream{constructor(e){let t=new U2e,n=new Map;super({transform(r,i){r.type===`part-start`&&r.path.length===0&&n.set(t.up(),e.up());let[a,...o]=r.path;if(a===void 0){i.enqueue(r);return}let s=n.get(a);if(s===void 0)throw Error(`Path not found`);i.enqueue({...r,path:[s,...o]})}})}},K2e=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,`readable`,{value:t,writable:!1})}};const q2e=j0e(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7);var J2e=class e{_state;_parentId;constructor(e){this._state=e||{merger:FK(),contentCounter:new U2e}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:`part-start`,part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new W2e(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new G2e(this._state.contentCounter)))}appendText(e){this._state.append?.kind!==`text`&&(this._state.append={kind:`text`,controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){this._state.append?.kind!==`reasoning`&&(this._state.append={kind:`reasoning`,controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=IK();return this._addPart({type:`text`},e),t}addReasoningPart(){let[e,t]=IK();return this._addPart({type:`reasoning`},e),t}addToolCallPart(e){let t=typeof e==`string`?{toolName:e}:e,n=t.toolName,r=t.toolCallId??q2e(),[i,a]=H2e();return this._addPart({type:`tool-call`,toolName:n,toolCallId:r,...this._parentId&&{parentId:this._parentId}},i),t.argsText!==void 0&&(a.argsText.append(t.argsText),a.argsText.close()),t.args!==void 0&&(a.argsText.append(JSON.stringify(t.args)),a.argsText.close()),t.response!==void 0&&a.setResponse(t.response),a}appendSource(e){this._addPart({...e,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(e){e.enqueue({type:`part-finish`,path:[]}),e.close()}}))}appendFile(e){this._addPart(e,new ReadableStream({start(e){e.enqueue({type:`part-finish`,path:[]}),e.close()}}))}enqueue(e){this._state.merger.enqueue(e),e.type===`part-start`&&e.path.length===0&&this._state.contentCounter.up()}withParentId(t){let n=new e(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function LK(e){let t=new J2e;return(async()=>{try{await e(t)}catch(e){throw t.__internal_isClosed||t.enqueue({type:`error`,path:[],error:String(e)}),e}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function Y2e(){let{resolve:e,promise:t}=L2e(),n;return[LK(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}var X2e=class extends TransformStream{constructor(e,t,n){let[r,i]=Y2e(),a;super({start(t){return a=r.pipeTo(new WritableStream({write(e){t.enqueue(e)},abort(e){t.error(e)},close(){t.terminate()}})).catch(e=>{t.error(e)}),e.start?.(i)},transform(t){return e.transform?.(t,i)},async flush(){await e.flush?.(i),i.close(),await a}},t,n)}},RK=(e,t)=>{if(e.startsWith(`data-`))return{type:`data`,name:e.substring(5),data:t}};const Z2e=(e,t,n)=>{let{role:r,id:i,createdAt:a,attachments:o,status:s,metadata:c}=e,l={id:i??t,createdAt:a??new Date},u=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content,d=({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn(`Invalid image data format detected`),null);if(r!==`user`&&o?.length)throw Error(`attachments are only supported for user messages`);if(r!==`assistant`&&s)throw Error(`status is only supported for assistant messages`);if(r!==`assistant`&&c?.steps)throw Error(`metadata.steps is only supported for assistant messages`);switch(r){case`assistant`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:case`reasoning`:return e.text.trim().length===0?null:e;case`file`:case`source`:return e;case`image`:return d(e);case`data`:return e;case`tool-call`:{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${pK()}`,...t!==void 0&&{parentId:t},...n!==void 0&&{messages:n}};return e.args?{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)}:{...i,args:F2e(e.argsText??``)??{},argsText:e.argsText??``}}default:{let n=RK(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:s??n,metadata:{unstable_state:c?.unstable_state??null,unstable_annotations:c?.unstable_annotations??[],unstable_data:c?.unstable_data??[],custom:c?.custom??{},steps:c?.steps??[],...c?.timing&&{timing:c.timing},...c?.submittedFeedback&&{submittedFeedback:c.submittedFeedback}}};case`user`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:case`image`:case`audio`:case`file`:case`data`:return e;default:{let n=RK(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>RK(e.type,e.data)??e)})),metadata:{custom:c?.custom??{}}};case`system`:if(u.length!==1||u[0].type!==`text`)throw Error(`System messages must have exactly one text message part.`);return{...l,role:r,content:u,metadata:{custom:c?.custom??{}}};default:{let e=r;throw Error(`Unknown message role: ${e}`)}}},Q2e={fromArray:e=>{let t=e.map(e=>Z2e(e,pK(),A2e(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}}};var $2e=e=>e.next?$2e(e.next):`current`in e?e:null,e4e=class{func;_value=null;constructor(e){this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},t4e=class{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){e.level=t;for(let n of e.children){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if(!(n===`relink`&&r===i)){if(n!==`link`&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(t===void 0)throw Error(`MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.`);r.next=t}if(n!==`cut`){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error(`MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.`);i.children=[...i.children,t.current.id],($2e(t)===this.head||i.next===null)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new e4e(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(e===void 0||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.`);let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(r===void 0)throw Error(`MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.`);if(n){n.current=t,this.performOp(r,n,`relink`),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,`link`),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.`);return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let n;do n=mK();while(this.messages.has(n));return this.addOrUpdateMessage(e,Z2e(t,n,{type:`running`})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error(`MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.`);let r=t===void 0?n.prev:t===null?null:this.messages.get(t);if(r===void 0)throw Error(`MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.`);for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.`);this.performOp(r,t,`relink`)}this.performOp(null,n,`cut`),this.messages.delete(e),this.head===n&&(this.head=$2e(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.`);let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.`);let n=t.prev??this.root;n.next=t,this.head=$2e(t),this._messages.dirty()}resetHead(e){if(e===null){this.clear();return}let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.`);if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}},zK=e=>e.status.type===`complete`,BK=class extends jK{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??`*`}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text=``;get text(){return this._text}_role=`user`;get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText=``;let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text=``,this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>!zK(e));await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(this._attachments.length===0&&this._text===``&&this._role===`user`&&Object.keys(this._runConfig).length===0&&this._quote===void 0)return;this._role=`user`,this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let e=this.getAttachmentAdapter(),t=this.attachments.length>0?Promise.all(this.attachments.map(async t=>{if(zK(t))return t;if(!e)throw Error(`Attachments are not supported`);return await e.send(t)})):[],n=this.text,r=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let i={createdAt:new Date,role:this.role,content:n?[{type:`text`,text:n}]:[],attachments:await t,runConfig:this.runConfig,metadata:{custom:{...r?{quote:r}:{}}}};this.handleSend(i),this._notifyEventSubscribers(`send`)}cancel(){this.handleCancel()}async addAttachment(e){if(!(e instanceof File)){let t={id:e.id??pK(),type:e.type??`document`,name:e.name,contentType:e.contentType,content:e.content,status:{type:`complete`}};this._attachments=[...this._attachments,t],this._notifyEventSubscribers(`attachmentAdd`),this._notifySubscribers();return}let t=this.getAttachmentAdapter();if(!t)throw Error(`Attachments are not supported`);let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);t===-1?this._attachments=[...this._attachments,e]:this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)],this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers(`attachmentAdd`),this._notifySubscribers()}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(t===-1)throw Error(`Attachment not found`);let n=this._attachments[t];if(!zK(n)){let e=this.getAttachmentAdapter();if(!e)throw Error(`Attachments are not supported`);await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText=``;_currentInterimText=``;_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error(`Dictation adapter not configured`);if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText=``;let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=e.isFinal!==!1,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(` `)&&e.transcript?` `:``;if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText=``,this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&={...this._dictation,transcript:e.transcript},this._notifySubscribers()});this._dictationUnsubscribes.push(i);let a=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:`running`},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(a);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let s=setInterval(()=>{this._isActiveSession(r,n)&&n.status.type===`ended`&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(s))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if(!(e?.sessionId!==void 0&&e.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText=``,this._currentInterimText=``,this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}},n4e=class extends BK{runtime;_canCancel=!1;get canCancel(){return this._canCancel}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}},r4e=class extends BK{runtime;endEditCallback;get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextParts;_previousText;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=hK(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>e.type!==`text`),this.setRunConfig({...e.composer.runConfig})}async handleSend(e){hK(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},i4e=class{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new t4e;get messages(){return this.repository.getMessages()}get state(){let e;for(let t of this.messages)t.role===`assistant`&&(e=t);return e?.metadata.unstable_state??null}composer=new n4e(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error(`Edit already in progress`);this._editComposers.set(e,new r4e(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{return}}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error(`Feedback adapter not configured`);let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role===`assistant`){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error(`Speech adapter not configured`);let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(hK(n)),i=r.subscribe(()=>{r.status.type===`ended`?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error(`No message is being spoken`);this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers(`initialize`))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(Q2e.fromArray(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if(e===`modelContextUpdate`)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}},VK=class{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),a=i.isMain,o=i.id;n===a&&r===o||(n=a,r=o,!(e===`switchedTo`&&!a)&&(e===`switchedAway`&&a||t()))})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}};const a4e=Symbol(`innerMessage`);var o4e=class{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}},s4e=class extends o4e{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error(`Composer is not available`);return e.removeAttachment(this.getState().id)}},c4e=class extends s4e{get source(){return`thread-composer`}},l4e=class extends s4e{get source(){return`edit-composer`}},u4e=class extends o4e{get source(){return`message`}constructor(e){super(e)}remove(){throw Error(`Message attachments cannot be removed`)}},d4e=Object.freeze([]),f4e=Object.freeze({}),p4e=e=>Object.freeze({type:`thread`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??d4e,text:e?.text??``,role:e?.role??`user`,runConfig:e?.runConfig??f4e,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,value:e?.text??``}),m4e=e=>Object.freeze({type:`edit`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,isEmpty:e?.isEmpty??!0,text:e?.text??``,role:e?.role??`user`,attachments:e?.attachments??d4e,runConfig:e?.runConfig??f4e,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,value:e?.text??``}),h4e=class{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.send()}cancel(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new w2e({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},g4e=class extends h4e{get path(){return this._core.path}get type(){return`thread`}_getState;constructor(e){let t=new NK({path:e.path,getState:()=>p4e(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new c4e(new MK({path:{...this.path,attachmentSource:`thread-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`thread-composer`}:AK},subscribe:e=>this._core.subscribe(e)}),this._core)}},_4e=class extends h4e{_beginEdit;get path(){return this._core.path}get type(){return`edit`}_getState;constructor(e,t){let n=new NK({path:e.path,getState:()=>m4e(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new l4e(new MK({path:{...this.path,attachmentSource:`edit-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`edit-composer`}:AK},subscribe:e=>this._core.subscribe(e)}),this._core)}},v4e=class e{_state;constructor(e=null){this._state=e}get state(){return this._state}append(t){this._state=t.reduce((t,n)=>e.apply(t,n),this._state)}static apply(t,n){let r=n.type;switch(r){case`set`:return e.updatePath(t,n.path,()=>n.value);case`append-text`:return e.updatePath(t,n.path,e=>{if(typeof e!=`string`)throw Error(`Expected string at path [${n.path.join(`, `)}]`);return e+n.value});default:{let e=r;throw Error(`Invalid operation type: ${e}`)}}}static updatePath(e,t,n){if(t.length===0)return n(e);if(e??={},typeof e!=`object`)throw Error(`Invalid path: [${t.join(`, `)}]`);let[r,...i]=t;if(Array.isArray(e)){let a=Number(r);if(Number.isNaN(a))throw Error(`Expected array index at [${t.join(`, `)}]`);if(a>e.length||a<0)throw Error(`Insert array index out of bounds`);let o=[...e];return o[a]=this.updatePath(o[a],i,n),o}let a={...e};return a[r]=this.updatePath(a[r],i,n),a}},y4e=class{_streamStartTime;_firstTokenTime;_totalChunks=0;_toolCallIds=new Set;constructor(){this._streamStartTime=Date.now()}recordChunk(){this._totalChunks++}recordFirstToken(){this._firstTokenTime===void 0&&(this._firstTokenTime=Date.now())}recordToolCallStart(e){this._toolCallIds.add(e)}getTiming(e,t){let n=Date.now()-this._streamStartTime,r=e&&e>0?e:t?Math.ceil(t.length/4):void 0,i=r&&n>0?r/n*1e3:void 0;return{streamStartTime:this._streamStartTime,...this._firstTokenTime===void 0?void 0:{firstTokenTime:this._firstTokenTime-this._streamStartTime},totalStreamTime:n,...r===void 0?void 0:{tokenCount:r},...i===void 0?void 0:{tokensPerSecond:i},totalChunks:this._totalChunks,toolCallCount:this._toolCallIds.size}}};const b4e=({unstable_state:e=null}={})=>({role:`assistant`,status:{type:`running`},parts:[],get content(){return this.parts},metadata:{unstable_state:e,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}});var x4e=(e,t,n)=>{if(e.parts.length===0)throw Error(`No parts available to update.`);if(t.path.length!==1)throw Error(`Nested paths are not supported yet.`);let r=t.path[0],i=n(e.parts[r]);return{...e,parts:[...e.parts.slice(0,r),i,...e.parts.slice(r+1)],get content(){return this.parts}}},S4e=(e,t)=>{let n=t.part;if(n.type===`text`||n.type===`reasoning`){let t={type:n.type,text:``,status:{type:`running`},...n.parentId&&{parentId:n.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else if(n.type===`tool-call`){let t={type:`tool-call`,state:`partial-call`,status:{type:`running`,isArgsComplete:!1},toolCallId:n.toolCallId,toolName:n.toolName,argsText:``,args:{},...n.parentId&&{parentId:n.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else if(n.type===`source`){let t={type:`source`,sourceType:n.sourceType,id:n.id,url:n.url,...n.title?{title:n.title}:void 0,...n.parentId&&{parentId:n.parentId}};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else if(n.type===`file`){let t={type:`file`,mimeType:n.mimeType,data:n.data};return{...e,parts:[...e.parts,t],get content(){return this.parts}}}else throw Error(`Unsupported part type: ${n.type}`)},C4e=(e,t)=>x4e(e,t,e=>{if(e.type!==`tool-call`)throw Error(`Last is not a tool call`);return e.state===`partial-call`?{...e,state:`call`}:e}),w4e=(e,t)=>x4e(e,t,e=>({...e,status:{type:`complete`,reason:`unknown`}})),T4e=(e,t)=>x4e(e,t,e=>{if(e.type===`text`||e.type===`reasoning`)return{...e,text:e.text+t.textDelta};if(e.type===`tool-call`){let n=e.argsText+t.textDelta,r=F2e(n)??e.args;return{...e,argsText:n,args:r}}else throw Error(`text-delta received but part is neither text nor tool-call`)}),E4e=(e,t)=>x4e(e,t,e=>{if(e.type===`tool-call`)return{...e,state:`result`,...t.artifact===void 0?{}:{artifact:t.artifact},result:t.result,isError:t.isError??!1,status:{type:`complete`,reason:`stop`}};throw Error(`Result chunk received but part is not a tool-call`)}),D4e=(e,t)=>{if(e.status?.type===`incomplete`&&e.status?.reason===`error`)return e;let n=O4e(t);return{...e,status:n}},O4e=e=>e.finishReason===`tool-calls`?{type:`requires-action`,reason:`tool-calls`}:e.finishReason===`stop`||e.finishReason===`unknown`?{type:`complete`,reason:e.finishReason}:{type:`incomplete`,reason:e.finishReason},k4e=(e,t)=>({...e,metadata:{...e.metadata,unstable_annotations:[...e.metadata.unstable_annotations,...t.annotations]}}),HK=(e,t)=>({...e,metadata:{...e.metadata,unstable_data:[...e.metadata.unstable_data,...t.data]}}),A4e=(e,t)=>({...e,metadata:{...e.metadata,steps:[...e.metadata.steps,{state:`started`,messageId:t.messageId}]}}),j4e=(e,t)=>{let n=e.metadata.steps.slice(),r=n.length-1;return n.length>0&&n[r]?.state===`started`?n[r]={...n[r],state:`finished`,finishReason:t.finishReason,usage:t.usage,isContinued:t.isContinued}:n.push({state:`finished`,messageId:q2e(),finishReason:t.finishReason,usage:t.usage,isContinued:t.isContinued}),{...e,metadata:{...e.metadata,steps:n}}},M4e=(e,t)=>({...e,status:{type:`incomplete`,reason:`error`,error:t.error}}),UK=(e,t)=>{let n=new v4e(e.metadata.unstable_state);return n.append(t.operations),{...e,metadata:{...e.metadata,unstable_state:n.state}}},N4e=(e,t)=>{let n=0;for(let e of t.metadata.steps)e.state===`finished`&&e.usage&&(n+=e.usage.outputTokens);let r=``;for(let e of t.parts)(e.type===`text`||e.type===`reasoning`)&&(r+=e.text);return e.getTiming(n>0?n:void 0,r||void 0)},P4e=e=>{let t=!1;return()=>{t||(t=!0,queueMicrotask(()=>{t=!1,e()}))}},F4e=class extends TransformStream{constructor({initialMessage:e,throttle:t,onError:n}={}){let r=e??b4e(),i=new y4e,a,o=t?P4e(()=>{a?.enqueue(r)}):()=>{a?.enqueue(r)};super({start(e){a=e},transform(e){i.recordChunk();let t=e.type;switch(t){case`part-start`:r=S4e(r,e),e.part.type===`tool-call`&&i.recordToolCallStart(e.part.toolCallId);break;case`tool-call-args-text-finish`:r=C4e(r,e);break;case`part-finish`:r=w4e(r,e);break;case`text-delta`:r=T4e(r,e),i.recordFirstToken();break;case`result`:r=E4e(r,e);break;case`message-finish`:r=D4e(r,e);break;case`annotations`:r=k4e(r,e);break;case`data`:r=HK(r,e);break;case`step-start`:r=A4e(r,e);break;case`step-finish`:r=j4e(r,e);break;case`error`:r=M4e(r,e),n?.(e.error);break;case`update-state`:r=UK(r,e);break;default:{let e=t;throw Error(`Unsupported chunk type: ${e}`)}}r.status.type!==`running`&&(r={...r,metadata:{...r.metadata,timing:N4e(i,r)}}),o()},flush(e){if(r.status?.type===`running`){let t=r.parts?.some(e=>e.type===`tool-call`&&(e.state===`call`||e.state===`partial-call`)&&e.result===void 0)??!1;r=D4e(r,{type:`message-finish`,path:[],finishReason:t?`tool-calls`:`unknown`,usage:{inputTokens:0,outputTokens:0}}),r={...r,metadata:{...r.metadata,timing:N4e(i,r)}},e.enqueue(r)}}})}},I4e=class extends K2e{constructor(){super(e=>{let t=new X2e({transform(e,t){t.appendText(e)}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},L4e=class e{readable;constructor(e){this.readable=e,this.readable=e}static fromAssistantStream(t){return new e(t.pipeThrough(new F4e))}async unstable_result(){let e;for await(let t of this)e=t;return e||{role:`assistant`,status:{type:`complete`,reason:`unknown`},parts:[],content:[],metadata:{unstable_state:null,unstable_data:[],unstable_annotations:[],steps:[],custom:{}}}}[Symbol.asyncIterator](){let e=this.readable.getReader();return{async next(){let{done:t,value:n}=await e.read();return t?{done:!0,value:void 0}:{done:!1,value:n}}}}tee(){let[t,n]=this.readable.tee();return[new e(t),new e(n)]}},WK=Symbol.for(`aui.tool-response`),R4e=class e{get[WK](){return!0}artifact;result;isError;constructor(e){e.artifact!==void 0&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1}static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&WK in e}static toResponse(t){return t instanceof e?t:new e({result:t===void 0?`<no result>`:t})}},z4e=class{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to add tool result to non-tool message part`);if(!this.messageApi)throw Error(`Message API is not available. This is likely a bug in assistant-ui.`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=this.messageApi.getState();if(!n)throw Error(`Message is not available`);let r=t.toolName,i=t.toolCallId,a=R4e.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:a.result,artifact:a.artifact,isError:a.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to resume tool call on non-tool message part`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}},GK=Object.freeze({type:`complete`});const B4e=(e,t,n)=>{if(e.role!==`assistant`)return GK;if(n.type===`tool-call`)return n.result?GK:e.status;let r=t===Math.max(0,e.content.length-1);return e.status.type===`requires-action`?GK:r?e.status:GK};var V4e=(e,t)=>{let n=e.content[t];if(!n)return AK;let r=B4e(e,t,n);return Object.freeze({...n,[a4e]:n[a4e],status:r})},H4e=class{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new _4e(new C2e({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:`edit`},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,r=t??n,{runConfig:i=r.runConfig}=e,a=this._core.getState();if(a.role!==`assistant`)throw Error(`Can only reload assistant messages`);this._threadBinding.getState().startRun({parentId:a.parentId,sourceId:a.id,runConfig:i})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState();if(this._threadBinding.getState().speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error(`Message is not being spoken`)}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error(`May not specify both branchId and position`);if(!t&&!e)throw Error(`Must specify either branchId or position`);let r=this._threadBinding.getState().getBranches(n.id),i=t;if(e===`previous`?i=r[n.branchNumber-2]:e===`next`&&(i=r[n.branchNumber]),!i)throw Error(`Branch not found`);this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return hK(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error(`Message part index must be >= 0`);return new z4e(new MK({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:`index`,index:e}},getState:()=>V4e(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new z4e(new MK({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:`toolCallId`,toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>t.type===`tool-call`&&t.toolCallId===e);return n===-1?AK:V4e(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new u4e(new MK({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:`message`,attachmentSelector:{type:`index`,index:e}},getState:()=>{let t=this.getState().attachments?.[e];return t?{...t,source:`message`}:AK},subscribe:e=>this._core.subscribe(e)}))}},U4e=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),W4e=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),G4e=(e,t)=>typeof t==`string`?{createdAt:new Date,parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:`user`,content:[{type:`text`,text:t}],attachments:[],metadata:{custom:{}}}:{createdAt:t.createdAt??new Date,parentId:t.parentId??e.at(-1)?.id??null,sourceId:t.sourceId??null,role:t.role??`user`,content:t.content,attachments:t.attachments??[],metadata:t.metadata??{custom:{}},runConfig:t.runConfig??{},startRun:t.startRun};const K4e=(e,t)=>{let n=e.messages.at(-1);return Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isLoading:e.isLoading,isRunning:n?.role===`assistant`?n.status.type===`running`:!1,messages:e.messages,state:e.state,suggestions:e.suggestions,extras:e.extras,speech:e.speech})};var q4e=class{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){let n=new MK({path:e.path,getState:()=>K4e(e.getState(),t.getState()),subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new g4e(new C2e({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:`thread`},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.unstable_resumeRun=this.unstable_resumeRun.bind(this),this.unstable_loadExternalState=this.unstable_loadExternalState.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){this._threadBinding.getState().append(G4e(this._threadBinding.getState().messages,e))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){let t=e===null||typeof e==`string`?{parentId:e}:e;return this._threadBinding.getState().startRun(W4e(t))}unstable_resumeRun(e){return this._threadBinding.getState().resumeRun(U4e(e))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}unstable_loadExternalState(e){this._threadBinding.getState().unstable_loadExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error(`Message index must be >= 0`);return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:`index`,index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:`messageId`,messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new H4e(new MK({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:a}=this._threadBinding.getState();if(!e||n===void 0||r===void 0)return AK;let o=this._threadBinding.getState().getBranches(e.id),s=e.metadata.submittedFeedback;return{...e,[a4e]:e[a4e],index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:a?.messageId===e.id?a:void 0,submittedFeedback:s}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new w2e({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},J4e=e=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,threadItems:e.threadItems}),KK=(e,t)=>{if(t===void 0)return AK;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.id===e.mainThreadId}:AK},Y4e=class{_core;_runtimeFactory;_getState;constructor(e,t=q4e){this._core=e,this._runtimeFactory=t;let n=new NK({path:{},getState:()=>J4e(e),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new VK(new MK({path:{ref:`threadItems[main]`,threadSelector:{type:`main`}},getState:()=>KK(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new C2e({path:{ref:`threads.main`,threadSelector:{type:`main`}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new C2e({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new VK(new MK({path:{ref:`threadItems[${e}]`,threadSelector:{type:`index`,index:e}},getState:()=>KK(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new VK(new MK({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:`archiveIndex`,index:e}},getState:()=>KK(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new VK(new MK({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>KK(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}},X4e=class{_core;threads;get threadList(){return this.threads}_thread;constructor(e){this._core=e,this.threads=new Y4e(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(Q2e.fromArray(e??[]))}};const Z4e=(e,t)=>t===void 0?e.status?.type===`requires-action`&&e.status.reason===`tool-calls`&&e.content.every(e=>e.type!==`tool-call`||!!e.result):e.status?.type===`requires-action`&&e.status.reason===`tool-calls`&&e.content.every(e=>e.type!==`tool-call`||!!e.result||!t.includes(e.toolName));var Q4e=class extends Error{name=`AbortError`;detach;constructor(e,t){super(t),this.detach=e}},$4e=class extends i4e{capabilities={switchToBranch:!0,switchBranchDuringRun:!0,edit:!0,reload:!0,cancel:!0,unstable_copy:!0,speech:!1,dictation:!1,attachments:!1,feedback:!1};abortController=null;isDisabled=!1;_isLoading=!1;get isLoading(){return this._isLoading}_suggestions=[];_suggestionsController=null;get suggestions(){return this._suggestions}get adapters(){return this._options.adapters}constructor(e,t){super(e),this.__internal_setOptions(t)}_options;_lastRunConfig={};_getThreadId;__internal_setGetThreadId(e){this._getThreadId=e}_getInitializePromise;__internal_setGetInitializePromise(e){this._getInitializePromise=e}get extras(){}__internal_setOptions(e){if(this._options===e)return;this._options=e;let t=!1,n=e.adapters?.speech!==void 0;this.capabilities.speech!==n&&(this.capabilities.speech=n,t=!0);let r=e.adapters?.dictation!==void 0;this.capabilities.dictation!==r&&(this.capabilities.dictation=r,t=!0);let i=e.adapters?.attachments!==void 0;this.capabilities.attachments!==i&&(this.capabilities.attachments=i,t=!0);let a=e.adapters?.feedback!==void 0;this.capabilities.feedback!==a&&(this.capabilities.feedback=a,t=!0),t&&this._notifySubscribers()}_loadPromise;__internal_load(){if(this._loadPromise)return this._loadPromise;let e=this.adapters.history?.load()??Promise.resolve(null);return this._isLoading=!0,this._notifySubscribers(),this._loadPromise=e.then(e=>{if(!e)return;this.repository.import(e),e.messages.length>0&&this.ensureInitialized(),this._notifySubscribers();let t=this.adapters.history?.resume?.bind(this.adapters.history);e.unstable_resume&&t&&this.startRun({parentId:this.repository.headId,sourceId:this.repository.headId,runConfig:this._lastRunConfig},t).catch(()=>{})}).finally(()=>{this._isLoading=!1,this._notifySubscribers()}),this._loadPromise}async append(e){this.ensureInitialized();let t=this._getInitializePromise?.();t&&await t;let n=Z2e(e,pK(),{type:`complete`,reason:`unknown`});this.repository.addOrUpdateMessage(e.parentId,n),this._options.adapters.history?.append({parentId:e.parentId,message:n,...e.runConfig!==void 0&&{runConfig:e.runConfig}}),e.startRun??e.role===`user`?await this.startRun({parentId:n.id,sourceId:e.sourceId,runConfig:e.runConfig??{}}):(this.repository.resetHead(n.id),this._notifySubscribers())}resumeRun({stream:e,...t}){if(!e)throw Error(`You must pass a stream parameter to resume runs.`);return this.startRun(t,e)}exportExternalState(){throw Error(`Runtime does not support exporting external states.`)}importExternalState(){throw Error(`Runtime does not support importing external states.`)}unstable_loadExternalState(){throw Error(`Runtime does not support importing external states.`)}async startRun({parentId:e,runConfig:t},n){this.ensureInitialized();let r={id:pK(),role:`assistant`,status:{type:`running`},content:[],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},createdAt:new Date};this._notifyEventSubscribers(`runStart`);try{this._suggestions=[],this._suggestionsController?.abort(),this._suggestionsController=null,this._notifySubscribers();do r=await this.performRoundtrip(e,r,t,n),n=void 0;while(Z4e(r,this._options.unstable_humanToolNames))}finally{this._notifyEventSubscribers(`runEnd`)}this._suggestionsController=new AbortController;let i=this._suggestionsController.signal;if(this.adapters.suggestion&&r.status?.type!==`requires-action`){let e=this.adapters.suggestion?.generate({messages:this.messages});if(Symbol.asyncIterator in e)for await(let t of e){if(i.aborted)break;this._suggestions=t,this._notifySubscribers()}else{let t=await e;if(i.aborted)return;this._suggestions=t,this._notifySubscribers()}}}async performRoundtrip(e,t,n,r){let i=e?this.repository.getMessages(e):[];this.abortController?.abort(),this.abortController=new AbortController;let a=t.content,o=t.metadata?.unstable_annotations,s=t.metadata?.unstable_data,c=t.metadata?.steps,l=t.metadata?.custom,u=n=>{let r=n.metadata?.steps,i=r?[...c??[],...r]:void 0,u=n.metadata?.unstable_annotations,d=n.metadata?.unstable_data,f=u?[...o??[],...u]:void 0,p=d?[...s??[],...d]:void 0;t={...t,...n.content?{content:[...a,...n.content??[]]}:void 0,status:n.status??t.status,...n.metadata?{metadata:{...t.metadata,...n.metadata.unstable_state?{unstable_state:n.metadata.unstable_state}:void 0,...f?{unstable_annotations:f}:void 0,...p?{unstable_data:p}:void 0,...i?{steps:i}:void 0,...n.metadata?.timing?{timing:n.metadata.timing}:void 0,...n.metadata?.custom?{custom:{...l??{},...n.metadata.custom}}:void 0}}:void 0},this.repository.addOrUpdateMessage(e,t),this._notifySubscribers()},d=this._options.maxSteps??2;if((t.metadata?.steps?.length??0)>=d)return u({status:{type:`incomplete`,reason:`tool-calls`}}),t;u({status:{type:`running`}}),this.repository.resetHead(t.id),this._notifySubscribers();try{this._lastRunConfig=n??{};let a=this.getModelContext();r??=this.adapters.chatModel.run.bind(this.adapters.chatModel);let o=this.abortController.signal,s=this._getThreadId?.(),c=r({messages:i,runConfig:this._lastRunConfig,abortSignal:o,context:a,config:a,unstable_assistantMessageId:t.id,unstable_threadId:s,unstable_parentId:e,unstable_getMessage(){return t}});if(Symbol.asyncIterator in c)for await(let e of c){if(o.aborted){u({status:{type:`incomplete`,reason:`cancelled`}});break}u(e)}else u(await c);t.status.type===`running`&&u({status:{type:`complete`,reason:`unknown`}})}catch(e){if(e instanceof Q4e)u({status:{type:`incomplete`,reason:`cancelled`}});else if(e instanceof Error&&e.name===`AbortError`)u({status:{type:`incomplete`,reason:`cancelled`}});else throw u({status:{type:`incomplete`,reason:`error`,error:e instanceof Error?e.message:`[${typeof e}] ${new String(e).toString()}`}}),e}finally{this.abortController=null,(t.status.type===`complete`||t.status.type===`incomplete`)&&await this._options.adapters.history?.append({parentId:e,message:t,runConfig:this._lastRunConfig})}return t}detach(){let e=new Q4e(!0);this.abortController?.abort(e),this.abortController=null}cancelRun(){let e=new Q4e(!1);this.abortController?.abort(e),this.abortController=null}addToolResult({messageId:e,toolCallId:t,result:n,isError:r,artifact:i}){let a=this.repository.getMessage(e),{parentId:o}=a,{message:s}=a;if(s.role!==`assistant`)throw Error(`Tried to add tool result to non-assistant message`);let c=!1,l=!1,u=s.content.map(e=>e.type!==`tool-call`||e.toolCallId!==t?e:(l=!0,e.result||(c=!0),{...e,result:n,artifact:i,isError:r}));if(!l)throw Error(`Tried to add tool result to non-existing tool call`);s={...s,content:u},this.repository.addOrUpdateMessage(o,s),c&&Z4e(s,this._options.unstable_humanToolNames)&&this.performRoundtrip(o,s,this._lastRunConfig).catch(()=>{})}resumeToolCall(e){throw Error(`Local runtime does not support resuming tool calls.`)}},e3e=Object.freeze([]),t3e=`__DEFAULT_ID__`,n3e=Object.freeze({[t3e]:{id:t3e,remoteId:void 0,externalId:void 0,status:`regular`,title:void 0}}),r3e=class extends jK{_mainThread;constructor(e){super(),this._mainThread=e()}get isLoading(){return!1}getMainThreadRuntimeCore(){return this._mainThread}get newThreadId(){}get threadIds(){return e3e}get archivedThreadIds(){return e3e}get mainThreadId(){return t3e}get threadItems(){return n3e}getThreadRuntimeCore(){throw Error(`Method not implemented.`)}getLoadThreadsPromise(){return Promise.resolve()}getItemById(e){if(e===this.mainThreadId)return{status:`regular`,id:this.mainThreadId,remoteId:this.mainThreadId,externalId:void 0,title:void 0,isMain:!0};throw Error(`Method not implemented`)}async switchToThread(){throw Error(`Method not implemented.`)}switchToNewThread(){throw Error(`Method not implemented.`)}rename(){throw Error(`Method not implemented.`)}archive(){throw Error(`Method not implemented.`)}detach(){throw Error(`Method not implemented.`)}unarchive(){throw Error(`Method not implemented.`)}delete(){throw Error(`Method not implemented.`)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error(`Method not implemented.`)}},i3e=class extends T2e{threads;Provider=void 0;_options;constructor(e,t){super(),this._options=e,this.threads=new r3e(()=>new $4e(this._contextProvider,this._options)),t&&this.threads.getMainThreadRuntimeCore().import(Q2e.fromArray(t))}},qK=(e,t,n)=>n.reduce((e,n)=>n?.(e,t)??e,e),a3e=class extends jK{_pendingTransforms=[];_baseValue;_cachedValue;constructor(e){super(),this._baseValue=e,this._cachedValue=e}_updateState(){this._cachedValue=this._pendingTransforms.reduce((e,t)=>qK(e,t.task,[t.loading,t.optimistic]),this._baseValue),this._notifySubscribers()}get baseValue(){return this._baseValue}get value(){return this._cachedValue}update(e){this._baseValue=e,this._updateState()}async optimisticUpdate(e){let t=e.execute(),n={...e,task:t};try{this._pendingTransforms.push(n),this._updateState();let r=await t;return this._baseValue=qK(this._baseValue,r,[e.optimistic,e.then]),r}finally{let e=this._pendingTransforms.indexOf(n);e>-1&&this._pendingTransforms.splice(e,1),this._updateState()}}},JK=Error("This is the empty thread, a placeholder for the main thread. You cannot perform any actions on this thread instance. This error is probably because you tried to call a thread method in your render function. Call the method inside a `useEffect` hook instead.");const o3e={getMessageById(){},getBranches(){return[]},switchToBranch(){throw JK},append(){throw JK},startRun(){throw JK},resumeRun(){throw JK},cancelRun(){throw JK},addToolResult(){throw JK},resumeToolCall(){throw JK},speak(){throw JK},stopSpeaking(){throw JK},submitFeedback(){throw JK},getModelContext(){return{}},exportExternalState(){throw JK},importExternalState(){throw JK},unstable_loadExternalState(){throw JK},composer:{attachments:[],attachmentAccept:`*`,async addAttachment(e){throw JK},async removeAttachment(){throw JK},isEditing:!0,canCancel:!1,isEmpty:!0,text:``,setText(){throw JK},role:`user`,setRole(){throw JK},runConfig:{},setRunConfig(){throw JK},async reset(){},async clearAttachments(){},send(){throw JK},cancel(){},dictation:void 0,startDictation(){throw JK},stopDictation(){},quote:void 0,setQuote(){throw JK},subscribe(){return()=>{}},unstable_on(){return()=>{}}},getEditComposer(){},beginEdit(){throw JK},speech:void 0,capabilities:{switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,attachments:!1,feedback:!1},isDisabled:!1,isLoading:!1,messages:[],state:null,suggestions:[],extras:void 0,subscribe(){return()=>{}},import(){throw JK},export(){return{messages:[]}},reset(){throw JK},unstable_on(){return()=>{}}};function YK(e){return e}const XK=(e,t)=>{let n=e.threadIdMap[t];if(n!==void 0)return e.threadData[n]},s3e=(e,t,n)=>{let r=XK(e,t);if(!r)return e;let{id:i,remoteId:a,status:o}=r;if(o===n)return e;let s={...e};switch(o){case`new`:s.newThreadId=void 0;break;case`regular`:s.threadIds=s.threadIds.filter(e=>e!==i);break;case`archived`:s.archivedThreadIds=s.archivedThreadIds.filter(e=>e!==i);break;default:{let e=o;throw Error(`Unsupported state: ${e}`)}}switch(n){case`regular`:s.threadIds=[i,...s.threadIds];break;case`archived`:s.archivedThreadIds=[i,...s.archivedThreadIds];break;case`deleted`:s.threadData=Object.fromEntries(Object.entries(s.threadData).filter(([e])=>e!==i)),s.threadIdMap=Object.fromEntries(Object.entries(s.threadIdMap).filter(([e])=>e!==i&&e!==a));break;default:{let e=n;throw Error(`Unsupported state: ${e}`)}}return n!==`deleted`&&(s.threadData={...s.threadData,[i]:{...r,status:n}}),s};var ZK=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}};const c3e=(e={})=>{let t=new Set,n=ZK(e=>{a.setState({height:{...a.getState().height,viewport:e}})}),r=ZK(e=>{a.setState({height:{...a.getState().height,inset:e}})}),i=ZK(e=>{a.setState({height:{...a.getState().height,userMessage:e}})}),a=dK(()=>({isAtBottom:!0,scrollToBottom:({behavior:e=`auto`}={})=>{for(let n of t)n({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??`bottom`,height:{viewport:0,inset:0,userMessage:0},registerViewport:n.register,registerContentInset:r.register,registerUserMessageHeight:i.register}));return a};function QK(e,t){function n(n){let r=(0,D.useContext)(e);if(!n?.optional&&!r)throw Error(`This component must be used within ${t}.`);return r}return n}function l3e(e,t){function n(n){let r=e(n);return r?r[t]:null}function r(e){let t=!1,r;typeof e==`function`?r=e:e&&typeof e==`object`&&(t=!!e.optional,r=e.selector);let i=n({optional:t});return i?r?i(r):i():null}return{[t]:r,[`${t}Store`]:n}}const u3e=(0,D.createContext)(null),{useThreadViewport:d3e,useThreadViewportStore:f3e}=l3e(QK(u3e,`ThreadPrimitive.Viewport`),`useThreadViewport`),$K=e=>e;var p3e=e=>{let t=f3e({optional:!0}),[n]=(0,D.useState)(()=>c3e(e));return(0,D.useEffect)(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),(0,D.useEffect)(()=>{if(t)return n.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&$K(t).setState({isAtBottom:e.isAtBottom})})},[n,t]),(0,D.useEffect)(()=>{let t={turnAnchor:e.turnAnchor??`bottom`};n.getState().turnAnchor!==t.turnAnchor&&$K(n).setState(t)},[n,e.turnAnchor]),n};const m3e=({children:e,options:t={}})=>{let n=p3e(t),[r]=(0,D.useState)(()=>({useThreadViewport:n}));return(0,A.jsx)(u3e.Provider,{value:r,children:e})};var h3e=()=>((0,D.useEffect)(()=>{},[sK()]),null);const g3e=(0,D.memo)(({children:e,aui:t,runtime:n})=>(0,A.jsxs)(e2e,{runtime:n,aui:t??null,children:[(0,A.jsx)(h3e,{}),(0,A.jsx)(m3e,{children:e})]}));var _3e=class extends jK{useRuntimeHook;instances=new Map;useAliveThreadsKeysChanged=dK(()=>({}));parent;constructor(e,t){super(),this.parent=t,this.useRuntimeHook=dK(()=>({useRuntime:e}))}startThreadRuntime(e){return this.instances.has(e)||(this.instances.set(e,{}),this.useAliveThreadsKeysChanged.setState({},!0)),new Promise((t,n)=>{let r=()=>{let r=this.instances.get(e);if(!r)i(),n(Error(`Thread was deleted before runtime was started`));else if(r.runtime)i(),t(r.runtime);else return},i=this.subscribe(r);r()})}getThreadRuntimeCore(e){let t=this.instances.get(e);if(t)return t.runtime}stopThreadRuntime(e){this.instances.delete(e),this.useAliveThreadsKeysChanged.setState({},!0)}setRuntimeHook(e){this.useRuntimeHook.getState().useRuntime!==e&&this.useRuntimeHook.setState({useRuntime:e},!0)}_InnerActiveThreadProvider=({threadId:e})=>{let{useRuntime:t}=this.useRuntimeHook(),n=t(),r=n.thread.__internal_threadBinding,i=(0,D.useCallback)(()=>{let t=this.instances.get(e);if(!t)throw Error(`Thread not found. This is a bug in assistant-ui.`);t.runtime=r.getState(),this._notifySubscribers()},[e,r]),a=(0,D.useRef)(!1);a.current||i(),(0,D.useEffect)(()=>(a.current=!0,i(),r.outerSubscribe(i)),[r,i]);let o=sK(),s=(0,D.useRef)(void 0);return(0,D.useEffect)(()=>{let e=r.getState(),t=e.__internal_setGetInitializePromise;typeof t==`function`&&t.call(e,()=>s.current)},[r]),(0,D.useEffect)(()=>n.threads.main.unstable_on(`initialize`,()=>{if(o.threadListItem().getState().status===`new`){s.current=o.threadListItem().initialize();let e=n.thread.unstable_on(`runEnd`,()=>{e(),o.threadListItem().generateTitle()})}}),[n,o]),null};_OuterActiveThreadProvider=(0,D.memo)(({threadId:e,provider:t})=>(0,A.jsx)(K0e,{runtime:(0,D.useMemo)(()=>new Y4e(this.parent).getItemById(e),[e]),children:(0,A.jsx)(t,{children:(0,A.jsx)(this._InnerActiveThreadProvider,{threadId:e})})}));__internal_RenderThreadRuntimes=({provider:e})=>(this.useAliveThreadsKeysChanged(),Array.from(this.instances.keys()).map(t=>(0,A.jsx)(this._OuterActiveThreadProvider,{threadId:t,provider:e},t)))},v3e=(0,D.createContext)(null);const y3e=({adapters:e,children:t})=>{let n=(0,D.useContext)(v3e);return(0,A.jsx)(v3e.Provider,{value:{...n,...e},children:t})},b3e=()=>(0,D.useContext)(v3e);var x3e=class extends jK{contextProvider;_options;_hookManager;_loadThreadsPromise;_mainThreadId;_state=new a3e({isLoading:!1,newThreadId:void 0,threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}});get threadItems(){return this._state.value.threadData}getLoadThreadsPromise(){return this._loadThreadsPromise||=this._state.optimisticUpdate({execute:()=>this._options.adapter.list(),loading:e=>({...e,isLoading:!0}),then:(e,t)=>{let n=[],r=[],i={},a={};for(let e of t.threads){switch(e.status){case`regular`:n.push(e.remoteId);break;case`archived`:r.push(e.remoteId);break;default:{let t=e.status;throw Error(`Unsupported state: ${t}`)}}let t=YK(e.remoteId);i[e.remoteId]=t,a[t]={id:e.remoteId,remoteId:e.remoteId,externalId:e.externalId,status:e.status,title:e.title,initializeTask:Promise.resolve({remoteId:e.remoteId,externalId:e.externalId})}}return{...e,threadIds:n,archivedThreadIds:r,threadIdMap:{...e.threadIdMap,...i},threadData:{...e.threadData,...a}}}}).then(()=>{}),this._loadThreadsPromise}constructor(e,t){super(),this.contextProvider=t,this._state.subscribe(()=>this._notifySubscribers()),this._hookManager=new _3e(e.runtimeHook,this),this.useProvider=dK(()=>({Provider:e.adapter.unstable_Provider??D.Fragment})),this.__internal_setOptions(e),this.switchToNewThread()}useProvider;__internal_setOptions(e){if(this._options===e)return;this._options=e;let t=e.adapter.unstable_Provider??D.Fragment;t!==this.useProvider.getState().Provider&&this.useProvider.setState({Provider:t},!0),this._hookManager.setRuntimeHook(e.runtimeHook)}__internal_load(){this.getLoadThreadsPromise()}get isLoading(){return this._state.value.isLoading}get threadIds(){return this._state.value.threadIds}get archivedThreadIds(){return this._state.value.archivedThreadIds}get newThreadId(){return this._state.value.newThreadId}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){return this._hookManager.getThreadRuntimeCore(this._mainThreadId)||o3e}getThreadRuntimeCore(e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);let n=this._hookManager.getThreadRuntimeCore(t.id);if(!n)throw Error(`Thread not found`);return n}getItemById(e){return XK(this._state.value,e)}async switchToThread(e){let t=this.getItemById(e);if(!t){let n=await this._options.adapter.fetch(e),r=this._state.value,i=YK(n.remoteId),a={...r.threadData,[i]:{id:i,initializeTask:Promise.resolve({remoteId:n.remoteId,externalId:n.externalId}),remoteId:n.remoteId,externalId:n.externalId,status:n.status,title:n.title}},o={...r.threadIdMap,[n.remoteId]:i},s=n.status===`regular`?[...r.threadIds,n.remoteId]:r.threadIds,c=n.status===`archived`?[...r.archivedThreadIds,n.remoteId]:r.archivedThreadIds;this._state.update({...r,threadIds:s,archivedThreadIds:c,threadIdMap:o,threadData:a}),t=this.getItemById(e)}if(!t)throw Error(`Thread not found`);if(this._mainThreadId===t.id)return;let n=this._hookManager.startThreadRuntime(t.id);this.mainThreadId===void 0?n.then(()=>this._notifySubscribers()):await n,t.status===`archived`&&await this.unarchive(t.id),this._mainThreadId=t.id,this._notifySubscribers()}async switchToNewThread(){for(;this._state.baseValue.newThreadId!==void 0&&this._state.value.newThreadId===void 0;)await this._state.waitForUpdate();let e=this._state.value,t=this._state.value.newThreadId;if(t===void 0){do t=`__LOCALID_${pK()}`;while(e.threadIdMap[t]);let n=YK(t);this._state.update({...e,newThreadId:t,threadIdMap:{...e.threadIdMap,[t]:n},threadData:{...e.threadData,[n]:{status:`new`,id:t,remoteId:void 0,externalId:void 0,title:void 0}}})}return this.switchToThread(t)}initialize=async e=>{if(this._state.value.newThreadId!==e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status===`new`)throw Error(`Unexpected new state`);return t.initializeTask}return this._state.optimisticUpdate({execute:()=>this._options.adapter.initialize(e),optimistic:t=>s3e(t,e,`regular`),loading:(t,n)=>{let r=YK(e);return{...t,threadData:{...t.threadData,[r]:{...t.threadData[r],initializeTask:n}}}},then:(t,{remoteId:n,externalId:r})=>{let i=XK(t,e);if(!i)return t;let a=YK(e);return{...t,threadIdMap:{...t.threadIdMap,[n]:a},threadData:{...t.threadData,[a]:{...i,initializeTask:Promise.resolve({remoteId:n,externalId:r}),remoteId:n,externalId:r}}}}})};generateTitle=async e=>{let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status===`new`)throw Error(`Thread is not yet initialized`);let{remoteId:n}=await t.initializeTask,r=this._hookManager.getThreadRuntimeCore(t.id);if(!r)return;let i=r.messages,a=await this._options.adapter.generateTitle(n,i),o=L4e.fromAssistantStream(a);for await(let e of o){let n=e.parts.filter(e=>e.type===`text`)[0]?.text,r=this._state.baseValue,i=XK(r,t.id);i&&this._state.update({...r,threadData:{...r.threadData,[i.id]:{...i,title:n}}})}};rename(e,t){let n=this.getItemById(e);if(!n)throw Error(`Thread not found`);if(n.status===`new`)throw Error(`Thread is not yet initialized`);return this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await n.initializeTask;return this._options.adapter.rename(e,t)},optimistic:n=>{let r=XK(n,e);return r?{...n,threadData:{...n.threadData,[r.id]:{...r,title:t}}}:n}})}async _ensureThreadIsNotMain(e){if(e===this.newThreadId)throw Error(`Cannot ensure new thread is not main`);e===this._mainThreadId&&await this.switchToNewThread()}async archive(e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status!==`regular`)throw Error(`Thread is not yet initialized or already archived`);return await this._ensureThreadIsNotMain(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return this._options.adapter.archive(e)},optimistic:e=>s3e(e,t.id,`archived`)})}unarchive(e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status!==`archived`)throw Error(`Thread is not archived`);return this._state.optimisticUpdate({execute:async()=>{try{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.unarchive(e)}catch(e){throw await this._ensureThreadIsNotMain(t.id),e}},optimistic:e=>s3e(e,t.id,`regular`)})}async delete(e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status!==`regular`&&t.status!==`archived`)throw Error(`Thread is not yet initialized`);return await this._ensureThreadIsNotMain(t.id),this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.delete(e)},optimistic:e=>s3e(e,t.id,`deleted`)})}async detach(e){let t=this.getItemById(e);if(!t)throw Error(`Thread not found`);if(t.status!==`regular`&&t.status!==`archived`)throw Error(`Thread is not yet initialized`);await this._ensureThreadIsNotMain(t.id),this._hookManager.stopThreadRuntime(t.id)}useBoundIds=dK(()=>[]);__internal_RenderComponent=()=>{let e=(0,D.useId)();(0,D.useEffect)(()=>(this.useBoundIds.setState(t=>[...t,e],!0),()=>{this.useBoundIds.setState(t=>t.filter(t=>t!==e),!0)}),[e]);let t=this.useBoundIds(),{Provider:n}=this.useProvider(),r={modelContext:this.contextProvider};return(t.length===0||t[0]===e)&&(0,A.jsx)(y3e,{adapters:r,children:(0,A.jsx)(this._hookManager.__internal_RenderThreadRuntimes,{provider:n})})}},S3e=class extends T2e{threads;constructor(e){super(),this.threads=new x3e(e,this._contextProvider)}get RenderComponent(){return this.threads.__internal_RenderComponent}},C3e=e=>{let[t]=(0,D.useState)(()=>new S3e(e));return(0,D.useEffect)(()=>{t.threads.__internal_setOptions(e),t.threads.__internal_load()},[t,e]),(0,D.useMemo)(()=>new X4e(t),[t])};const w3e=e=>{let t=(0,D.useRef)(e.runtimeHook);t.current=e.runtimeHook;let n=(0,D.useCallback)(()=>t.current(),[]),r=(0,D.useMemo)(()=>({adapter:e.adapter,allowNesting:e.allowNesting,runtimeHook:n}),[e.adapter,e.allowNesting,n]);if(sK().threadListItem.source!==null){if(!r.allowNesting)throw Error(`useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. Set allowNesting: true to allow nesting (the inner runtime will become a no-op).`);return n()}return C3e(r)};var eq=e=>{try{let t=e.split(`.`)[1];if(!t)throw Error(`Invalid JWT format`);let n=t.replace(/-/g,`+`).replace(/_/g,`/`);for(;n.length%4!=0;)n+=`=`;let r=atob(n),i=JSON.parse(r).exp;if(!i||typeof i!=`number`)throw Error(`JWT does not contain a valid "exp" field`);return i*1e3}catch(e){throw Error(`Unable to determine the token expiry: ${e}`)}},T3e=class{strategy=`jwt`;cachedToken=null;tokenExpiry=null;#e;constructor(e){this.#e=e}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>30*1e3)return{Authorization:`Bearer ${this.cachedToken}`};let t=await this.#e();return t?(this.cachedToken=t,this.tokenExpiry=eq(t),{Authorization:`Bearer ${t}`}):!1}readAuthHeaders(e){let t=e.get(`Authorization`);if(!t)return;let[n,r]=t.split(` `);if(n!==`Bearer`||!r)throw Error(`Invalid auth header received`);this.cachedToken=r,this.tokenExpiry=eq(r)}},E3e=class{strategy=`api-key`;#e;#t;#n;constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}async getAuthHeaders(){return{Authorization:`Bearer ${this.#e}`,"Aui-User-Id":this.#t,"Aui-Workspace-Id":this.#n}}readAuthHeaders(){}},D3e=`aui:refresh_token`,O3e=class{strategy=`anon`;baseUrl;jwtStrategy;constructor(e){this.baseUrl=e,this.jwtStrategy=new T3e(async()=>{let e=Date.now(),t=localStorage.getItem(D3e),n=t?JSON.parse(t):void 0;if(n)if(new Date(n.expires_at).getTime()-e>30*1e3){let e=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({refresh_token:n.token})});if(e.ok){let{access_token:t,refresh_token:n}=await e.json();return n&&localStorage.setItem(D3e,JSON.stringify(n)),t}}else localStorage.removeItem(D3e);let r=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:`POST`});if(!r.ok)return null;let{access_token:i,refresh_token:a}=await r.json();return!i||!a?null:(localStorage.setItem(D3e,JSON.stringify(a)),i)})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}},k3e=class extends Error{constructor(e){super(e),this.name=`APIError`}},tq=class{_auth;_baseUrl;constructor(e){if(`authToken`in e)this._baseUrl=e.baseUrl,this._auth=new T3e(e.authToken);else if(`apiKey`in e)this._baseUrl=`https://backend.assistant-api.com`,this._auth=new E3e(e.apiKey,e.userId,e.workspaceId);else if(`anonymous`in e)this._baseUrl=e.baseUrl,this._auth=new O3e(e.baseUrl);else throw Error(`Invalid configuration: Must provide authToken, apiKey, or anonymous configuration`)}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let n=await this._auth.getAuthHeaders();if(!n)throw Error(`Authorization failed`);let r={...n,...t.headers,"Content-Type":`application/json`},i=new URLSearchParams;if(t.query)for(let[e,n]of Object.entries(t.query))n!==!1&&(n===!0?i.set(e,`true`):i.set(e,n.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=i.toString();let o=await fetch(a,{method:t.method??`GET`,headers:r,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(o.headers),!o.ok){let e=await o.text();try{throw new k3e(JSON.parse(e).message)}catch(t){throw t instanceof k3e?t:Error(`Request failed with status ${o.status}, ${e}`)}}return o}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}},nq=class{cloud;constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest(`/auth/tokens`,{method:`POST`})}},rq=class{cloud;constructor(e){this.cloud=e}__internal_getAssistantOptions(e){return{api:`${this.cloud._baseUrl}/v1/runs/stream`,headers:async()=>{let e=await this.cloud._auth.getAuthHeaders();if(!e)throw Error(`Authorization failed`);return{...e,Accept:`text/plain`}},body:{assistant_id:e,response_format:`vercel-ai-data-stream/v1`,thread_id:`unstable_todo`}}}async stream(e){let t=await this.cloud.makeRawRequest(`/runs/stream`,{method:`POST`,headers:{Accept:`text/plain`},body:e});return I2e.fromResponse(t,new I4e)}async report(e){return this.cloud.makeRequest(`/runs`,{method:`POST`,body:e})}},A3e=class{cloud;constructor(e){this.cloud=e}async list(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{query:t})}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:`POST`,body:t})}async update(e,t,n){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`,{method:`PUT`,body:n})}},j3e=class{cloud;messages;constructor(e){this.cloud=e,this.messages=new A3e(e)}async list(e){return this.cloud.makeRequest(`/threads`,{query:e})}async get(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`)}async create(e){return this.cloud.makeRequest(`/threads`,{method:`POST`,body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:`PUT`,body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:`DELETE`})}},M3e=class{cloud;constructor(e){this.cloud=e}async pdfToImages(e){return this.cloud.makeRequest(`/files/pdf-to-images`,{method:`POST`,body:e})}async generatePresignedUploadUrl(e){return this.cloud.makeRequest(`/files/attachments/generate-presigned-upload-url`,{method:`POST`,body:e})}},N3e=class{threads;auth;runs;files;telemetry;constructor(e){let t=new tq(e);this.threads=new j3e(t),this.auth={tokens:new nq(t)},this.runs=new rq(t),this.files=new M3e(t);let n=e.telemetry;this.telemetry=n===!1?{enabled:!1}:n===!0||n===void 0?{enabled:!0}:{enabled:n.enabled!==!1,...n}}},P3e=class{cloud;idMapping={};constructor(e){this.cloud=e}async append(e,t,n,r,i){let a=n?await this.idMapping[n]??n:null,o=this.cloud.threads.messages.create(e,{parent_id:a,format:r,content:i}).then(({message_id:e})=>(this.idMapping[t]=e,e)).catch(e=>{throw this.idMapping[t]===o&&delete this.idMapping[t],e});return this.idMapping[t]=o,o.then(()=>{})}async update(e,t,n,r){let i=await this.getRemoteId(t);i&&await this.cloud.threads.messages.update(e,i,{content:r})}isPersisted(e){return e in this.idMapping}async getRemoteId(e){let t=this.idMapping[e];if(t)return t}async load(e,t){let{messages:n}=await this.cloud.threads.messages.list(e,t?{format:t}:void 0);for(let e of n)this.idMapping[e.id]=e.id;return n}reset(){this.idMapping={}}};const F3e=(e,t)=>({append:async(n,r)=>{let i=t.getId(r.message),a=t.encode(r);return e.append(n,i,r.parentId,t.format,a)},update:e.update?async(n,r,i)=>{let a=t.encode(r);return e.update(n,i,t.format,a)}:void 0,load:async n=>({messages:(await e.load(n,t.format)).filter(e=>e.format===t.format).map(e=>t.decode({id:e.id,parent_id:e.parent_id,format:e.format,content:e.content})).reverse()}),isPersisted:t=>e.isPersisted(t)});var I3e=class{list(){return Promise.resolve({threads:[]})}rename(){return Promise.resolve()}archive(){return Promise.resolve()}unarchive(){return Promise.resolve()}delete(){return Promise.resolve()}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){return Promise.resolve(new ReadableStream)}fetch(e){return Promise.reject(Error(`Thread not found`))}};function L3e(e,t=0){return t>100?!1:e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(e=>L3e(e,t+1)):typeof e==`object`?Object.entries(e).every(([e,n])=>typeof e==`string`&&L3e(n,t+1)):!1}function R3e(e){let t=e.status?.type===`running`?{type:`incomplete`,reason:`cancelled`}:e.status;return{role:e.role,content:e.content.map(e=>{let t=e.type;switch(t){case`text`:return{type:`text`,text:e.text};case`reasoning`:return{type:`reasoning`,text:e.text};case`source`:return{type:`source`,sourceType:e.sourceType,id:e.id,url:e.url,...e.title?{title:e.title}:void 0};case`tool-call`:return L3e(e.result)||console.warn(`tool-call result is not JSON! ${JSON.stringify(e)}`),{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,...JSON.stringify(e.args)===e.argsText?{args:e.args}:{argsText:e.argsText},...e.result?{result:e.result}:void 0,...e.isError?{isError:!0}:void 0};case`image`:return{type:`image`,image:e.image};case`file`:return{type:`file`,data:e.data,mimeType:e.mimeType,...e.filename?{filename:e.filename}:void 0};default:{let e=t;throw Error(`Message part type not supported by aui/v0: ${e}`)}}}),metadata:e.metadata,...t?{status:t}:void 0}}function z3e(e){let t=e.content,n=Z2e({id:e.id,createdAt:e.created_at,...t},e.id,{type:`complete`,reason:`unknown`});return{parentId:e.parent_id,message:n}}var B3e=new WeakMap,V3e=class{cloudRef;aui;constructor(e,t){this.cloudRef=e,this.aui=t}get _persistence(){let e=this.aui.threadListItem();return B3e.has(e)||B3e.set(e,new P3e(this.cloudRef.current)),B3e.get(e)}withFormat(e){let t=this,n=F3e(this._persistence,e);return{async append(e){let{remoteId:r}=await t.aui.threadListItem().initialize();await n.append(r,e)},async update(e,r){let i=t.aui.threadListItem().getState().remoteId;i&&await n.update?.(i,e,r)},reportTelemetry(n,r){let i=n.map(t=>e.encode(t));t._reportRunTelemetry(e.format,i,r)},async load(){let e=t.aui.threadListItem().getState().remoteId;return e?n.load(e):{messages:[]}}}}async append({parentId:e,message:t}){let{remoteId:n}=await this.aui.threadListItem().initialize(),r=R3e(t);await this._persistence.append(n,t.id,e,`aui/v0`,r),this.cloudRef.current.telemetry.enabled&&this._maybeReportRun(n,`aui/v0`,r)}async load(){let e=this.aui.threadListItem().getState().remoteId;return e?{messages:(await this._persistence.load(e,`aui/v0`)).filter(e=>e.format===`aui/v0`).map(z3e).reverse()}:{messages:[]}}_reportRunTelemetry(e,t,n){if(!this.cloudRef.current.telemetry.enabled)return;let r=this.aui.threadListItem().getState().remoteId;if(!r)return;let i=J3e(e,t);i&&this._sendReport(r,i,n?.durationMs,n?.stepTimestamps)}_maybeReportRun(e,t,n){let r=q3e(t,n);r&&this._sendReport(e,r)}_sendReport(e,t,n,r){let i=K3e(t.steps,r),a={thread_id:e,status:t.status,...t.totalSteps==null?void 0:{total_steps:t.totalSteps},...t.toolCalls?{tool_calls:t.toolCalls}:void 0,...i?{steps:i}:void 0,...t.inputTokens==null?void 0:{input_tokens:t.inputTokens},...t.outputTokens==null?void 0:{output_tokens:t.outputTokens},...t.reasoningTokens==null?void 0:{reasoning_tokens:t.reasoningTokens},...t.cachedInputTokens==null?void 0:{cached_input_tokens:t.cachedInputTokens},...n==null?void 0:{duration_ms:n},...t.outputText==null?void 0:{output_text:t.outputText},...t.metadata?{metadata:t.metadata}:void 0,...t.modelId?{model_id:t.modelId}:void 0},{beforeReport:o}=this.cloudRef.current.telemetry,s=o?o(a):a;s&&this.cloudRef.current.runs.report(s).catch(()=>{})}},H3e=5e4;function iq(e){return e.length<=H3e?e:e.slice(0,H3e)}function U3e(e){if(e!=null)try{return iq(JSON.stringify(e))}catch{return}}var aq=/^[A-Za-z0-9+/]{100,}={0,2}$/;function W3e(e){if(e!=null){try{let t=typeof e==`string`?JSON.parse(e):e;if(Array.isArray(t)){let e=t.map(e=>{if(e&&typeof e==`object`&&e.type&&(e.type===`image`||e.type===`audio`)&&typeof e.data==`string`&&aq.test(e.data.slice(0,200))){let t=(e.data.length*3/4/1024).toFixed(1);return{...e,data:`[${e.type}: ${t}KB]`}}return e});return iq(JSON.stringify(e))}}catch{}return U3e(e)}}function G3e(e,t,n,r,i,a){let o={tool_name:e,tool_call_id:t},s=i??U3e(n);s!==void 0&&(o.tool_args=s);let c=a===`mcp`?W3e(r):U3e(r);return c!==void 0&&(o.tool_result=c),a&&(o.tool_source=a),o}function K3e(e,t){if(!t)return e;if(!e)return t.map(e=>({...e}));let n=Math.min(e.length,t.length);return e.map((e,r)=>({...e,...r<n?t[r]:void 0}))}function q3e(e,t){switch(e){case`aui/v0`:return oq(t);case`ai-sdk/v6`:return r6e(t);default:return null}}function J3e(e,t){if(e===`ai-sdk/v6`)return i6e(t);for(let n=t.length-1;n>=0;n--){let r=q3e(e,t[n]);if(r)return r}return null}var Y3e={error:`error`,incomplete:`incomplete`};function oq(e){let t=e;if(t.role!==`assistant`)return null;let n=t.content?.filter(e=>e.type===`tool-call`&&e.toolName&&e.toolCallId).map(e=>G3e(e.toolName,e.toolCallId,e.args,e.result,e.argsText)),r=t.content?.filter(e=>e.type===`text`&&e.text),i=r&&r.length>0?iq(r.map(e=>e.text).join(``)):void 0,a=t.metadata?.steps,o,s,c,l;if(a&&a.length>0){let e=0,t=0,n=0,r=0,i=!1,u=!1,d=!1,f=!1;for(let o of a)o.usage?.inputTokens!=null&&(e+=o.usage.inputTokens,i=!0),o.usage?.outputTokens!=null&&(t+=o.usage.outputTokens,u=!0),o.usage?.reasoningTokens!=null&&(n+=o.usage.reasoningTokens,d=!0),o.usage?.cachedInputTokens!=null&&(r+=o.usage.cachedInputTokens,f=!0);o=i?e:void 0,s=u?t:void 0,c=d?n:void 0,l=f?r:void 0}let u=t.status?.type,d=u&&Y3e[u]||`completed`,f=t.metadata?.custom,p=t.metadata?.modelId??(typeof t.metadata?.custom?.modelId==`string`?t.metadata.custom.modelId:void 0),m=a&&a.length>1?a.map(e=>({...e.usage?.inputTokens==null?void 0:{input_tokens:e.usage.inputTokens},...e.usage?.outputTokens==null?void 0:{output_tokens:e.usage.outputTokens},...e.usage?.reasoningTokens==null?void 0:{reasoning_tokens:e.usage.reasoningTokens},...e.usage?.cachedInputTokens==null?void 0:{cached_input_tokens:e.usage.cachedInputTokens}})):void 0;return{status:d,...n&&n.length>0?{toolCalls:n}:void 0,...a?.length?{totalSteps:a.length}:void 0,...o==null?void 0:{inputTokens:o},...s==null?void 0:{outputTokens:s},...c==null?void 0:{reasoningTokens:c},...l==null?void 0:{cachedInputTokens:l},...i==null?void 0:{outputText:i},...f?{metadata:f}:void 0,...m?{steps:m}:void 0,...p?{modelId:p}:void 0}}function X3e(e){return e.toolCallId?e.type===`tool-call`||e.type===`dynamic-tool`?!!e.toolName:e.type.startsWith(`tool-`)||e.type.startsWith(`dynamic-tool-`):!1}function Z3e(e){return e.type===`dynamic-tool`||e.type.startsWith(`dynamic-tool-`)}function Q3e(e){let t=Z3e(e)?`mcp`:void 0;return G3e(e.toolName??e.type.slice(5),e.toolCallId,e.args??e.input,e.result??e.output,void 0,t)}function $3e(e){let t=[],n=[],r=[],i=null;for(let a of e)if(a.type===`step-start`)i!==null&&r.push({tool_calls:i}),i=[];else if(a.type===`text`&&a.text)t.push(a.text);else if(X3e(a)){let e=Q3e(a);n.push(e),i!==null&&i.push(e)}return i!==null&&r.push({tool_calls:i}),{textParts:t,toolCalls:n,stepsData:r}}function sq(e){if(!e)return;if(typeof e.modelId==`string`)return e.modelId;let t=e.custom;if(typeof t?.modelId==`string`)return t.modelId}function e6e(e,t,n,r,i,a){let o=e.length>0,s=o?iq(e.join(``)):void 0,c=sq(r),l=i&&i.length>1?i.map(e=>({...e.tool_calls.length>0?{tool_calls:e.tool_calls}:void 0})):void 0;return{status:o?`completed`:`incomplete`,...t.length>0?{toolCalls:t}:void 0,...n>0?{totalSteps:n}:void 0,...a?.inputTokens==null?void 0:{inputTokens:a.inputTokens},...a?.outputTokens==null?void 0:{outputTokens:a.outputTokens},...a?.reasoningTokens==null?void 0:{reasoningTokens:a.reasoningTokens},...a?.cachedInputTokens==null?void 0:{cachedInputTokens:a.cachedInputTokens},...s==null?void 0:{outputText:s},...r?{metadata:r}:void 0,...l?{steps:l}:void 0,...c?{modelId:c}:void 0}}function t6e(e){let t=e.inputTokens??e.promptTokens,n=e.outputTokens??e.completionTokens;if(!(t==null&&n==null&&e.reasoningTokens==null&&e.cachedInputTokens==null))return{...t==null?void 0:{inputTokens:t},...n==null?void 0:{outputTokens:n},...e.reasoningTokens==null?void 0:{reasoningTokens:e.reasoningTokens},...e.cachedInputTokens==null?void 0:{cachedInputTokens:e.cachedInputTokens}}}function n6e(e){let t=e?.usage;if(t){let e=t6e(t);if(e)return e}let n=e?.steps;if(n&&n.length>0){let e=0,t=0,r=0,i=0,a=!1,o=!1,s=!1,c=!1,l=!1;for(let u of n){if(!u.usage)continue;let n=t6e(u.usage);n&&(n.inputTokens!=null&&(e+=n.inputTokens,a=!0),n.outputTokens!=null&&(t+=n.outputTokens,o=!0),n.reasoningTokens!=null&&(r+=n.reasoningTokens,s=!0),n.cachedInputTokens!=null&&(i+=n.cachedInputTokens,c=!0),l=!0)}if(l)return{...a?{inputTokens:e}:void 0,...o?{outputTokens:t}:void 0,...s?{reasoningTokens:r}:void 0,...c?{cachedInputTokens:i}:void 0}}}function r6e(e){let t=e;if(t.role!==`assistant`)return null;let{textParts:n,toolCalls:r,stepsData:i}=$3e(t.parts??[]);return e6e(n,r,i.length,t.metadata,i,n6e(t.metadata))}function i6e(e){let t=[],n=[],r=[],i=!1,a,o=0,s=0,c=0,l=0,u=!1,d=!1,f=!1,p=!1;for(let m of e){let e=m;if(e.role!==`assistant`)continue;i=!0;let{textParts:h,toolCalls:g,stepsData:_}=$3e(e.parts??[]);t.push(...h),n.push(...g),r.push(..._),e.metadata&&(a=e.metadata);let v=n6e(e.metadata);v&&(v.inputTokens!=null&&(o+=v.inputTokens,u=!0),v.outputTokens!=null&&(s+=v.outputTokens,d=!0),v.reasoningTokens!=null&&(c+=v.reasoningTokens,f=!0),v.cachedInputTokens!=null&&(l+=v.cachedInputTokens,p=!0))}return i?e6e(t,n,r.length,a,r,{...u?{inputTokens:o}:void 0,...d?{outputTokens:s}:void 0,...f?{reasoningTokens:c}:void 0,...p?{cachedInputTokens:l}:void 0}):null}function cq(e){let t=sK(),[n]=(0,D.useState)(()=>new V3e(e,t));return n}var lq=e=>e.startsWith(`image/`)?`image`:e.startsWith(`text/`)?`document`:`file`,a6e=class{cloud;accept=`*`;constructor(e){this.cloud=e}uploadedUrls=new Map;async*add({file:e}){let t=crypto.randomUUID(),n={id:t,type:lq(e.type),name:e.name,contentType:e.type,file:e,status:{type:`running`,reason:`uploading`,progress:0}};yield n;try{let{signedUrl:r,publicUrl:i}=await this.cloud.files.generatePresignedUploadUrl({filename:e.name});await fetch(r,{method:`PUT`,body:e,headers:{"Content-Type":e.type},mode:`cors`}),this.uploadedUrls.set(t,i),n={...n,status:{type:`requires-action`,reason:`composer-send`}},yield n}catch{n={...n,status:{type:`incomplete`,reason:`error`}},yield n}}async remove(e){this.uploadedUrls.delete(e.id)}async send(e){let t=this.uploadedUrls.get(e.id);if(!t)throw Error(`Attachment not uploaded`);this.uploadedUrls.delete(e.id);let n;return n=e.type===`image`?[{type:`image`,image:t,filename:e.name}]:[{type:`file`,data:t,mimeType:e.contentType??``,filename:e.name}],{...e,status:{type:`complete`},content:n}}},o6e=typeof process<`u`&&{}?.NEXT_PUBLIC_ASSISTANT_BASE_URL,s6e=o6e?new N3e({baseUrl:o6e,anonymous:!0}):void 0;const c6e=e=>{let t=(0,D.useRef)(e);(0,D.useEffect)(()=>{t.current=e},[e]);let n=(0,D.useCallback)(function({children:e}){let n=cq({get current(){return t.current.cloud??s6e}}),r=t.current.cloud??s6e,i=(0,D.useMemo)(()=>new a6e(r),[r]);return(0,A.jsx)(y3e,{adapters:(0,D.useMemo)(()=>({history:n,attachments:i}),[n,i]),children:e})},[]),r=e.cloud??s6e;if(!r){let e=t,n=new I3e;return n.initialize=async t=>({remoteId:t,externalId:(await e.current.create?.())?.externalId}),n}return{list:async()=>{let{threads:e}=await r.threads.list();return{threads:e.map(e=>({status:e.is_archived?`archived`:`regular`,remoteId:e.id,title:e.title,externalId:e.external_id??void 0}))}},initialize:async()=>{let t=await(e.create?.()??Promise.resolve()),n=t?t.externalId:void 0,{thread_id:i}=await r.threads.create({last_message_at:new Date,external_id:n});return{externalId:n,remoteId:i}},rename:async(e,t)=>r.threads.update(e,{title:t}),archive:async e=>r.threads.update(e,{is_archived:!0}),unarchive:async e=>r.threads.update(e,{is_archived:!1}),delete:async t=>(await e.delete?.(t),r.threads.delete(t)),generateTitle:async(e,t)=>{let n=t.map(e=>({...e,content:e.content.filter(e=>e.type===`text`||e.type===`tool-call`)}));return r.runs.stream({thread_id:e,assistant_id:`system/thread_title`,messages:n})},fetch:async e=>{let t=await r.threads.get(e);return{status:t.is_archived?`archived`:`regular`,remoteId:t.id,title:t.title,externalId:t.external_id??void 0}},unstable_Provider:n}};function l6e(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}var u6e=(0,D.createContext)(null);function d6e(e){let t=(0,D.useContext)(u6e);if(!e?.optional&&!t)throw Error(`This component must be used within a SmoothContextProvider.`);return t}const{useSmoothStatus:f6e,useSmoothStatusStore:p6e}=l3e(d6e,`useSmoothStatus`);var m6e=class{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText=``;constructor(e,t){this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n),i=0;for(;t>=r&&i<n;)i++,t-=r;i===n?this.animationFrameId=null:this.animationFrameId=requestAnimationFrame(this.animate),i!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}},h6e=Object.freeze({type:`running`});const g6e=(e,t=!1)=>{let{text:n}=e,r=cK(e=>e.message.id),i=(0,D.useRef)(r),[a,o]=(0,D.useState)(e.status.type===`running`?``:n),s=p6e({optional:!0}),c=l6e(t=>{if(o(t),s){let n=a!==t||e.status.type===`running`?h6e:e.status;$K(s).setState(n,!0)}});(0,D.useEffect)(()=>{if(s){let r=t&&(a!==n||e.status.type===`running`)?h6e:e.status;$K(s).setState(r,!0)}},[s,t,n,a,e.status]);let[l]=(0,D.useState)(new m6e(a,c));return(0,D.useEffect)(()=>{if(!t){l.stop();return}if(i.current!==r||!n.startsWith(l.targetText)){i.current=r,e.status.type===`running`?(c(``),l.currentText=``,l.targetText=n,l.start()):(c(n),l.currentText=n,l.targetText=n,l.stop());return}l.targetText=n,l.start()},[c,l,r,t,n,e.status.type]),(0,D.useEffect)(()=>()=>{l.stop()},[l]),(0,D.useMemo)(()=>t?{type:`text`,text:a,status:n===a?e.status:h6e}:e,[t,a,e,n])};var _6e=(e,{initialMessages:t,...n})=>{let{modelContext:r,...i}=b3e()??{},a={...n,adapters:{...i,...n.adapters,chatModel:e}},[o]=(0,D.useState)(()=>new i3e(a,t)),s=(0,D.useRef)(void 0);return s.current=cK(e=>e.threadListItem.remoteId),(0,D.useEffect)(()=>{o.threads.getMainThreadRuntimeCore().__internal_setGetThreadId(()=>s.current)},[o]),(0,D.useEffect)(()=>()=>{o.threads.getMainThreadRuntimeCore().detach()},[o]),(0,D.useEffect)(()=>{o.threads.getMainThreadRuntimeCore().__internal_setOptions(a),o.threads.getMainThreadRuntimeCore().__internal_load()}),(0,D.useEffect)(()=>{if(r)return o.registerModelContextProvider(r)},[r,o]),(0,D.useMemo)(()=>new X4e(o),[o])};const v6e=(e,{cloud:t,...n}={})=>w3e({runtimeHook:function(){return _6e(e,n)},adapter:c6e({cloud:t}),allowNesting:!0});function y6e(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function b6e(...e){return t=>{let n=!1,r=e.map(e=>{let r=y6e(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():y6e(e[t],null)}}}}function uq(...e){return D.useCallback(b6e(...e),e)}var x6e=Symbol.for(`react.lazy`),dq=D.use;function S6e(e){return typeof e==`object`&&!!e&&`then`in e}function C6e(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===x6e&&`_payload`in e&&S6e(e._payload)}function w6e(e){let t=T6e(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e;C6e(r)&&typeof dq==`function`&&(r=dq(r._payload));let a=D.Children.toArray(r),o=a.find(D6e);if(o){let e=o.props.children,r=a.map(t=>t===o?D.Children.count(e)>1?D.Children.only(null):D.isValidElement(e)?e.props.children:null:t);return(0,A.jsx)(t,{...i,ref:n,children:D.isValidElement(e)?D.cloneElement(e,void 0,r):null})}return(0,A.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function T6e(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(C6e(n)&&typeof dq==`function`&&(n=dq(n._payload)),D.isValidElement(n)){let e=k6e(n),i=O6e(r,n.props);return n.type!==D.Fragment&&(i.ref=t?b6e(t,e):e),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E6e=Symbol(`radix.slottable`);function D6e(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===E6e}function O6e(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function k6e(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}b();var fq=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=w6e(`Primitive.${t}`),r=D.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,A.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});typeof window<`u`&&window.document&&window.document.createElement;function pq(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}const A6e=(e,t,n=[])=>{let r=(0,D.forwardRef)((e,r)=>{let i={},a={};Object.keys(e).forEach(t=>{n.includes(t)?i[t]=e[t]:a[t]=e[t]});let o=t(i)??void 0;return(0,A.jsx)(fq.button,{type:`button`,...a,ref:r,disabled:a.disabled||!o,onClick:pq(a.onClick,o)})});return r.displayName=e,r};function j6e(e,t=globalThis?.document){let n=l6e(e);D.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}function M6e(e){let t=N6e(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(hq);if(o){let e=o.props.children,r=a.map(t=>t===o?D.Children.count(e)>1?D.Children.only(null):D.isValidElement(e)?e.props.children:null:t);return(0,A.jsx)(t,{...i,ref:n,children:D.isValidElement(e)?D.cloneElement(e,void 0,r):null})}return(0,A.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var mq=M6e(`Slot`);function N6e(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=gq(n),i=F6e(r,n.props);return n.type!==D.Fragment&&(i.ref=t?b6e(t,e):e),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var P6e=Symbol(`radix.slottable`);function hq(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===P6e}function F6e(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function gq(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const I6e=e=>{let t=(0,D.useRef)(void 0);return(0,D.useCallback)(n=>{t.current&&t.current(),n&&(t.current=e(n))},[e])},L6e=(e,t)=>I6e((0,D.useCallback)(n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},a=new ResizeObserver(i);return a.observe(n),i(),()=>{a.disconnect(),r.unregister()}},[e,t])),R6e=()=>cK(e=>{if(e.part.type!==`text`&&e.part.type!==`reasoning`)throw Error(`MessagePartText can only be used inside text or reasoning message parts.`);return e.part}),z6e=(0,D.forwardRef)(({smooth:e=!0,component:t=`span`,...n},r)=>{let{text:i,status:a}=g6e(R6e(),e);return(0,A.jsx)(t,{"data-status":a.type,...n,ref:r,children:i})});z6e.displayName=`MessagePartPrimitive.Text`;const B6e=()=>cK(e=>{if(e.part.type!==`image`)throw Error(`MessagePartImage can only be used inside image message parts.`);return e.part}),V6e=(0,D.forwardRef)((e,t)=>{let{image:n}=B6e();return(0,A.jsx)(fq.img,{src:n,...e,ref:t})});V6e.displayName=`MessagePartPrimitive.Image`;const H6e=({children:e})=>cK(e=>e.part.status.type===`running`)?e:null;H6e.displayName=`MessagePartPrimitive.InProgress`;var U6e={...OK,Text:()=>(0,A.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,A.jsx)(z6e,{}),(0,A.jsx)(H6e,{children:(0,A.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Image:()=>(0,A.jsx)(V6e,{})};const W6e=({components:e,...t})=>(0,A.jsx)(b2e,{components:e?{Text:e.Text??U6e.Text,Image:e.Image??U6e.Image,Reasoning:e.Reasoning??OK.Reasoning,Source:e.Source??OK.Source,File:e.File??OK.File,Unstable_Audio:e.Unstable_Audio??OK.Unstable_Audio,...`ChainOfThought`in e?{ChainOfThought:e.ChainOfThought}:{tools:e.tools,data:e.data,ToolGroup:e.ToolGroup??OK.ToolGroup,ReasoningGroup:e.ReasoningGroup??OK.ReasoningGroup},Empty:e.Empty}:U6e,...t});W6e.displayName=`MessagePrimitive.Parts`;var G6e=e=>cK(t=>{let{role:n,attachments:r,parts:i,branchCount:a,isLast:o,speech:s,isCopied:c,isHovering:l}=t.message;return!(e.hasBranches===!0&&a<2||e.user&&n!==`user`||e.assistant&&n!==`assistant`||e.system&&n!==`system`||e.lastOrHover===!0&&!l&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!c||e.copied===!1&&c||e.speaking===!0&&s==null||e.speaking===!1&&s!=null||e.hasAttachments===!0&&(n!==`user`||!r?.length)||e.hasAttachments===!1&&n===`user`&&r?.length||e.hasContent===!0&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)});const K6e=({children:e,...t})=>G6e(t)?e:null;K6e.displayName=`MessagePrimitive.If`;const _q=()=>{let e=sK(),t=cK(e=>e.thread.isRunning||!e.composer.isEditing||e.composer.isEmpty),n=(0,D.useCallback)(()=>{e.composer().send()},[e]);return t?null:n},q6e=A6e(`ComposerPrimitive.Send`,_q),J6e=(0,D.forwardRef)(({onSubmit:e,...t},n)=>{let r=_q(),i=e=>{e.preventDefault(),r&&r()};return(0,A.jsx)(fq.form,{...t,ref:n,onSubmit:pq(e,i)})});J6e.displayName=`ComposerPrimitive.Root`;const Y6e=e=>{let t=l6e(e),n=d3e(e=>e.onScrollToBottom);(0,D.useEffect)(()=>n(t),[n,t])},X6e=(0,D.forwardRef)(({autoFocus:e=!1,asChild:t,disabled:n,onChange:r,onKeyDown:i,onPaste:a,submitOnEnter:o,submitMode:s,cancelOnEscape:c=!0,unstable_focusOnRunStart:l=!0,unstable_focusOnScrollToBottom:u=!0,unstable_focusOnThreadSwitched:d=!0,addAttachmentOnPaste:f=!0,...p},m)=>{let h=sK(),g=s??(o===!1?`none`:`enter`),_=cK(e=>e.composer.isEditing?e.composer.text:``),v=t?mq:qoe,y=cK(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,b=(0,D.useRef)(null),x=uq(m,b);j6e(e=>{if(!c||!b.current?.contains(e.target))return;let t=h.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let S=e=>{if(!y&&!e.nativeEvent.isComposing&&e.key===`Enter`&&!e.shiftKey){if(h.thread().getState().isRunning)return;let t=!1;g===`ctrlEnter`?t=e.ctrlKey||e.metaKey:g===`enter`&&(t=!0),t&&(e.preventDefault(),b.current?.closest(`form`)?.requestSubmit())}},C=async e=>{if(!f)return;let t=h.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>h.composer().addAttachment(e)))}catch(e){console.error(`Error adding attachment:`,e)}},w=e&&!y,T=(0,D.useCallback)(()=>{let e=b.current;!e||!w||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[w]);return(0,D.useEffect)(()=>T(),[T]),Y6e(()=>{h.composer().getState().type===`thread`&&u&&T()}),(0,D.useEffect)(()=>{if(!(h.composer().getState().type!==`thread`||!l))return h.on(`thread.runStart`,T)},[l,T,h]),(0,D.useEffect)(()=>{if(!(h.composer().getState().type!==`thread`||!d))return h.on(`threadListItem.switchedTo`,T)},[d,T,h]),(0,A.jsx)(v,{name:`input`,value:_,...p,ref:x,disabled:y,onChange:pq(r,e=>{h.composer().getState().isEditing&&HG(()=>{h.composer().setText(e.target.value)})}),onKeyDown:pq(i,S),onPaste:pq(a,C)})});X6e.displayName=`ComposerPrimitive.Input`;const Z6e=(0,D.forwardRef)((e,t)=>(0,A.jsx)(fq.div,{...e,ref:t}));Z6e.displayName=`ThreadPrimitive.Root`;const Q6e=({children:e})=>cK(e=>e.thread.isEmpty)?e:null;Q6e.displayName=`ThreadPrimitive.Empty`;var $6e=e=>cK(t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled));const vq=({children:e,...t})=>$6e(t)?e:null;vq.displayName=`ThreadPrimitive.If`;const e8e=e=>{let t=l6e(e);return I6e((0,D.useCallback)(e=>{let n=new ResizeObserver(()=>{t()}),r=new MutationObserver(e=>{e.some(e=>e.type!==`attributes`||e.attributeName!==`style`)&&t()});return n.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{n.disconnect(),r.disconnect()}},[t]))},t8e=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{let i=(0,D.useRef)(null),a=f3e();e===void 0&&(e=a.getState().turnAnchor!==`top`);let o=(0,D.useRef)(0),s=(0,D.useRef)(null),c=(0,D.useCallback)(e=>{let t=i.current;t&&(s.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),l=()=>{let e=i.current;if(!e)return;let t=a.getState().isAtBottom,n=Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<1||e.scrollHeight<=e.clientHeight;!n&&o.current<e.scrollTop||(n&&(s.current=null),(n||s.current===null)&&n!==t&&$K(a).setState({isAtBottom:n})),o.current=e.scrollTop},u=e8e(()=>{let t=s.current;t?c(t):e&&a.getState().isAtBottom&&c(`instant`),l()}),d=I6e(e=>(e.addEventListener(`scroll`,l),()=>{e.removeEventListener(`scroll`,l)}));return Y6e(({behavior:e})=>{c(e)}),S0e(`thread.runStart`,()=>{t&&(s.current=`auto`,requestAnimationFrame(()=>{c(`auto`)}))}),S0e(`thread.initialize`,()=>{n&&(s.current=`instant`,requestAnimationFrame(()=>{c(`instant`)}))}),S0e(`threadListItem.switchedTo`,()=>{r&&(s.current=`instant`,requestAnimationFrame(()=>{c(`instant`)}))}),uq(u,d,i)};var n8e=()=>L6e(d3e(e=>e.registerViewport),(0,D.useCallback)(e=>e.clientHeight,[])),r8e=(0,D.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:i,...a},o)=>{let s=uq(o,t8e({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),n8e());return(0,A.jsx)(fq.div,{...a,ref:s,children:i})});r8e.displayName=`ThreadPrimitive.ViewportScrollable`;const yq=(0,D.forwardRef)(({turnAnchor:e,...t},n)=>(0,A.jsx)(m3e,{options:{turnAnchor:e},children:(0,A.jsx)(r8e,{...t,ref:n})}));yq.displayName=`ThreadPrimitive.Viewport`;const i8e=(0,D.createContext)({pendingApprovals:[],handleApproval:()=>{}}),a8e=()=>(0,D.useContext)(i8e);async function*o8e(e){let t=new TextDecoder,n=``;for(;;){let{done:r,value:i}=await e.read();if(r)break;n+=t.decode(i,{stream:!0});let a=n.split(`
193
- `);n=a.pop();for(let e of a)if(e.startsWith(`data: `)){let t=e.slice(6);if(t)try{yield JSON.parse(t)}catch{}}}}async function s8e(e,t,n,r,i,a){let o=[];for await(let s of o8e(e)){switch(s.type){case`text-delta`:t.value+=s.text;break;case`tool-call`:{let e=s.args;if(typeof s.args==`string`)try{e=JSON.parse(s.args)}catch{e={}}n.push({type:`tool-call`,toolCallId:s.toolCallId,toolName:s.toolName,args:e});break}case`tool-result`:{let e=typeof s.result==`object`?s.result:null;if(e&&`__approvalRequired`in e)break;let t=n.find(e=>e.toolCallId===s.toolCallId);t&&(t.result=typeof s.result==`string`?s.result:JSON.stringify(s.result),s.isError&&(t.isError=!0));break}case`generative-ui`:{let e={type:`generative-ui`,spec:s.spec},t=r.findIndex(e=>e.type===`generative-ui`);t===-1?r.push(e):r[t]=e;break}case`data`:{let e={type:`data`,name:s.name,data:s.data},t=r.findIndex(e=>e.type===`data`&&e.name===s.name);t===-1?r.push(e):r[t]=e;break}case`approval-request`:o.push({toolCallId:s.toolCallId,toolName:s.toolName,args:s.args,reason:s.reason,runId:s.runId,type:`approval-request`});break;case`credential-request`:o.push({toolCallId:s.toolCallId,toolName:s.toolName,args:s.args,runId:s.runId,type:`credential-request`,credentialName:s.credentialName,credentialType:s.credentialType,connectUrl:s.connectUrl});break;case`error`:t.value+=`\n\nError: ${s.message||s.errorText||`Unknown error`}`;break;case`done`:a?.();continue}i()}return o}function c8e(e){if(e==null)return!1;try{let t=typeof e==`string`?JSON.parse(e):e;return t&&typeof t==`object`&&t.approved===!1}catch{return!1}}function l8e(e){if(typeof e==`object`&&e&&e.error===`missing_credential`)return e;if(typeof e==`string`)try{let t=JSON.parse(e);if(t?.error===`missing_credential`)return t}catch{}return null}function u8e(e,t){if(e.type===`running`)return{type:`running`};if(e.type===`requires-action`)return{type:`requires-action`};if(c8e(t))return{type:`denied`};let n=l8e(t);return n?{type:`missing-credential`,payload:n}:typeof t==`string`&&t.startsWith(`Error:`)?{type:`error`}:{type:`completed`}}function bq(e,t,n){let r=[];return e.value&&r.push({type:`text`,text:e.value}),r.push(...t),r.push(...n),r}function xq(e){let t=[];if(typeof e==`string`)return e&&t.push({type:`text`,text:e}),t;if(!e||typeof e!=`object`)return t;let n=e;return typeof n.text==`string`&&n.text&&t.push({type:`text`,text:n.text}),n.ui!=null&&t.push({type:`generative-ui`,spec:n.ui}),t}function d8e(e,t,n,r,i){return{async*run({messages:a,abortSignal:o}){let s=e.current,c=t.current;if(c.length>0){let e=n.current;if(n.current=[],e.length===0)return;t.current=[],r.current([]);let a={value:``},l=[],u=[],d=[];for(let t=0;t<e.length;t++){let n=e[t],r=c.find(e=>e.toolCallId===n.toolCallId)?.runId??c[0]?.runId,f=await fetch(`${s.api}/${s.agentName}/resume`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({runId:r,toolCallId:n.toolCallId,approved:n.approved}),signal:o,credentials:s.credentials});if(!f.ok||!f.body){let e=f.body?await f.text().catch(()=>``):``;throw Error(`Resume failed: ${f.status}${e?` - ${e}`:``}`)}let p={value:``},m=[],h=[],g=await s8e(f.body.getReader(),p,m,h,()=>{},t===e.length-1?i.current??void 0:void 0);a=p,l=m,u=h,g.length>0&&(d=g)}let f=bq(a,u,l);if(d.length>0){t.current=d,r.current(d);for(let e of d){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=l.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?l.push(t):l[n]=t}yield{content:bq(a,u,l),status:{type:`requires-action`,reason:`tool-calls`}}}else f.length>0&&(yield{content:f});return}let l=[...a].reverse().find(e=>e.role===`user`);if(!l)return;let u=``;if(l.content)for(let e of l.content)`text`in e&&e.type===`text`&&(u+=e.text);let d;try{d=await fetch(`${s.api}/${s.agentName}/stream`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({agentName:s.agentName,message:u,threadId:s.threadId,resourceId:s.resourceId,model:s.model,temperature:s.temperature}),signal:o,credentials:s.credentials})}catch(e){let t=e?.message||`Unknown error`,n=`Failed to connect to the agent.`;if(t.includes(`Failed to fetch`)||t.includes(`NetworkError`)||t.includes(`CORS`))n=`Unable to reach the agent server. The deployment may be down or the URL may be incorrect.`;else if(t.includes(`abort`))return;yield{content:[{type:`text`,text:`⚠️ ${n}`}]};return}if(!d.ok||!d.body){let e=`Request failed (${d.status}).`;d.status===401||d.status===403?e=`Authentication error.`:d.status===404?e=`Agent not found — the agent may not be configured for this project.`:d.status===502||d.status===503?e=`The agent server is currently unavailable. Try again in a moment.`:d.status===429&&(e=`Rate limited — too many requests. Please wait a moment.`),yield{content:[{type:`text`,text:`⚠️ ${e}`}]};return}let f={value:``},p=[],m=[],h=null,g=await s8e(d.body.getReader(),f,p,m,()=>{let e=bq(f,m,p);e.length>0&&(h=e)},i.current??void 0);if(g.length===0){h&&(yield{content:h});return}t.current=g,r.current(g);for(let e of g){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=p.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?p.push(t):p[n]=t}let _=new Set(g.map(e=>e.toolCallId)),v=new Set(g.map(e=>e.toolName));for(let e=p.length-1;e>=0;e--)v.has(p[e].toolName)&&!_.has(p[e].toolCallId)&&p.splice(e,1);yield{content:bq(f,m,p),status:{type:`requires-action`,reason:`tool-calls`}}}}}const f8e=e=>{let t=[],n=null;for(let r of e){if(r.role===`user`){n&&=(t.push(n),null),t.push({role:`user`,content:r.content||``,id:r.id,createdAt:new Date(r.createdAt)});continue}if(r.role===`tool`&&n&&Array.isArray(r.toolResults)){let e=Array.isArray(n.content)?[...n.content]:n.content?[{type:`text`,text:n.content}]:[];for(let t of r.toolResults){let n=e.findIndex(e=>e.type===`tool-call`&&e.toolCallId===t.id);n!==-1&&(e[n]={...e[n],result:typeof t.result==`string`?t.result:JSON.stringify(t.result)})}n={role:n.role,id:n.id,createdAt:n.createdAt,status:n.status,content:e};continue}if(r.role===`tool`)continue;let e=[];if(r.content&&(Array.isArray(r.content)?e.push(...r.content):e.push({type:`text`,text:r.content})),Array.isArray(r.toolCalls))for(let t of r.toolCalls)e.push({type:`tool-call`,toolCallId:t.id,toolName:t.name,args:t.args||{}});if(n){let t=n.content,r=Array.isArray(t)?[...t]:t?[{type:`text`,text:t}]:[];n={role:n.role,id:n.id,createdAt:n.createdAt,status:n.status,content:[...r,...e]}}else n={role:`assistant`,content:e.length>0?e:``,id:r.id,createdAt:new Date(r.createdAt),status:{type:`complete`,reason:`stop`}}}return n&&t.push(n),t};function p8e(e){let[t,n]=(0,D.useState)([]),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)(e.onFinish);i.current=e.onFinish;let a=(0,D.useRef)([]),o=(0,D.useRef)([]),s=(0,D.useRef)(n);s.current=n;let c=v6e((0,D.useMemo)(()=>d8e(r,a,o,s,i),[]),{initialMessages:(0,D.useMemo)(()=>e.initialMessages?f8e(e.initialMessages):void 0,[e.initialMessages])}),l=(0,D.useCallback)((e,t)=>{o.current.push({toolCallId:e,approved:t})},[]);return{runtime:c,pendingApprovals:t,isAwaitingApproval:t.length>0,handleApproval:l}}function m8e(e,t,n,r,i){return{async*run({messages:a,abortSignal:o}){let s=e.current,c=t.current;if(c.length>0){let e=n.current;if(n.current=[],e.length===0)return;t.current=[],r.current([]);let a={value:``},l=[],u=[],d=[];for(let t=0;t<e.length;t++){let n=e[t],r=c.find(e=>e.toolCallId===n.toolCallId)?.runId??c[0]?.runId,f=await fetch(`${s.api}/${s.agentName}/resume`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({runId:r,toolCallId:n.toolCallId,approved:n.approved}),signal:o,credentials:s.credentials});if(!f.ok||!f.body){let e=f.body?await f.text().catch(()=>``):``;throw Error(`Resume failed: ${f.status}${e?` - ${e}`:``}`)}let p={value:``},m=[],h=[],g=await s8e(f.body.getReader(),p,m,h,()=>{},t===e.length-1?i.current??void 0:void 0);a=p,l=m,u=h,g.length>0&&(d=g)}let f=bq(a,u,l);if(d.length>0){t.current=d,r.current(d);for(let e of d){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=l.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?l.push(t):l[n]=t}yield{content:bq(a,u,l),status:{type:`requires-action`,reason:`tool-calls`}}}else f.length>0&&(yield{content:f});return}let l=[...a].reverse().find(e=>e.role===`user`);if(!l)return;let u=``;if(l.content)for(let e of l.content)`text`in e&&e.type===`text`&&(u+=e.text);let d=await fetch(`${s.api}/${s.agentName}`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({agentName:s.agentName,message:u,threadId:s.threadId,resourceId:s.resourceId,model:s.model,temperature:s.temperature}),signal:o,credentials:s.credentials});if(!d.ok)throw Error(`Agent run failed: ${d.status}`);let f=await d.json();if(f.status===`suspended`&&f.pendingApprovals?.length>0){let e=f.pendingApprovals;t.current=e,r.current(e);let n=e.map(e=>({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}})),i=[];i.push(...xq(f.result)),i.push(...n),yield{content:i,status:{type:`requires-action`,reason:`tool-calls`}};return}i.current?.();let p=xq(f.result);p.length>0&&(yield{content:p})}}}function h8e(e){let[t,n]=(0,D.useState)([]),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)(e.onFinish);i.current=e.onFinish;let a=(0,D.useRef)([]),o=(0,D.useRef)([]),s=(0,D.useRef)(n);s.current=n;let c=v6e((0,D.useMemo)(()=>m8e(r,a,o,s,i),[]),{initialMessages:(0,D.useMemo)(()=>e.initialMessages?f8e(e.initialMessages):void 0,[e.initialMessages])}),l=(0,D.useCallback)((e,t)=>{o.current.push({toolCallId:e,approved:t})},[]);return{runtime:c,pendingApprovals:t,isAwaitingApproval:t.length>0,handleApproval:l}}function g8e(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _8e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v8e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y8e={};function b8e(e,t){return((t||y8e).jsx?v8e:_8e).test(e)}var x8e=/[ \t\n\f\r]/g;function S8e(e){return typeof e==`object`?e.type===`text`?C8e(e.value):!1:C8e(e)}function C8e(e){return e.replace(x8e,``)===``}var Sq=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Sq.prototype.normal={},Sq.prototype.property={},Sq.prototype.space=void 0;function w8e(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Sq(n,r,t)}function T8e(e){return e.toLowerCase()}var Cq=class{constructor(e,t){this.attribute=t,this.property=e}};Cq.prototype.attribute=``,Cq.prototype.booleanish=!1,Cq.prototype.boolean=!1,Cq.prototype.commaOrSpaceSeparated=!1,Cq.prototype.commaSeparated=!1,Cq.prototype.defined=!1,Cq.prototype.mustUseProperty=!1,Cq.prototype.number=!1,Cq.prototype.overloadedBoolean=!1,Cq.prototype.property=``,Cq.prototype.spaceSeparated=!1,Cq.prototype.space=void 0;var E8e=c({boolean:()=>wq,booleanish:()=>Tq,commaOrSpaceSeparated:()=>kq,commaSeparated:()=>Oq,number:()=>Eq,overloadedBoolean:()=>O8e,spaceSeparated:()=>Dq},1),D8e=0;const wq=Aq(),Tq=Aq(),O8e=Aq(),Eq=Aq(),Dq=Aq(),Oq=Aq(),kq=Aq();function Aq(){return 2**++D8e}var jq=Object.keys(E8e),Mq=class extends Cq{constructor(e,t,n,r){let i=-1;if(super(e,t),k8e(this,`space`,r),typeof n==`number`)for(;++i<jq.length;){let e=jq[i];k8e(this,jq[i],(n&E8e[e])===E8e[e])}}};Mq.prototype.defined=!0;function k8e(e,t,n){n&&(e[t]=n)}function Nq(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Mq(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[T8e(r)]=r,n[T8e(a.attribute)]=r}return new Sq(t,n,e.space)}const A8e=Nq({properties:{ariaActiveDescendant:null,ariaAtomic:Tq,ariaAutoComplete:null,ariaBusy:Tq,ariaChecked:Tq,ariaColCount:Eq,ariaColIndex:Eq,ariaColSpan:Eq,ariaControls:Dq,ariaCurrent:null,ariaDescribedBy:Dq,ariaDetails:null,ariaDisabled:Tq,ariaDropEffect:Dq,ariaErrorMessage:null,ariaExpanded:Tq,ariaFlowTo:Dq,ariaGrabbed:Tq,ariaHasPopup:null,ariaHidden:Tq,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dq,ariaLevel:Eq,ariaLive:null,ariaModal:Tq,ariaMultiLine:Tq,ariaMultiSelectable:Tq,ariaOrientation:null,ariaOwns:Dq,ariaPlaceholder:null,ariaPosInSet:Eq,ariaPressed:Tq,ariaReadOnly:Tq,ariaRelevant:null,ariaRequired:Tq,ariaRoleDescription:Dq,ariaRowCount:Eq,ariaRowIndex:Eq,ariaRowSpan:Eq,ariaSelected:Tq,ariaSetSize:Eq,ariaSort:null,ariaValueMax:Eq,ariaValueMin:Eq,ariaValueNow:Eq,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function j8e(e,t){return t in e?e[t]:t}function M8e(e,t){return j8e(e,t.toLowerCase())}const N8e=Nq({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Oq,acceptCharset:Dq,accessKey:Dq,action:null,allow:null,allowFullScreen:wq,allowPaymentRequest:wq,allowUserMedia:wq,alt:null,as:null,async:wq,autoCapitalize:null,autoComplete:Dq,autoFocus:wq,autoPlay:wq,blocking:Dq,capture:null,charSet:null,checked:wq,cite:null,className:Dq,cols:Eq,colSpan:null,content:null,contentEditable:Tq,controls:wq,controlsList:Dq,coords:Eq|Oq,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wq,defer:wq,dir:null,dirName:null,disabled:wq,download:O8e,draggable:Tq,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wq,formTarget:null,headers:Dq,height:Eq,hidden:O8e,high:Eq,href:null,hrefLang:null,htmlFor:Dq,httpEquiv:Dq,id:null,imageSizes:null,imageSrcSet:null,inert:wq,inputMode:null,integrity:null,is:null,isMap:wq,itemId:null,itemProp:Dq,itemRef:Dq,itemScope:wq,itemType:Dq,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wq,low:Eq,manifest:null,max:null,maxLength:Eq,media:null,method:null,min:null,minLength:Eq,multiple:wq,muted:wq,name:null,nonce:null,noModule:wq,noValidate:wq,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:wq,optimum:Eq,pattern:null,ping:Dq,placeholder:null,playsInline:wq,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wq,referrerPolicy:null,rel:Dq,required:wq,reversed:wq,rows:Eq,rowSpan:Eq,sandbox:Dq,scope:null,scoped:wq,seamless:wq,selected:wq,shadowRootClonable:wq,shadowRootDelegatesFocus:wq,shadowRootMode:null,shape:null,size:Eq,sizes:null,slot:null,span:Eq,spellCheck:Tq,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Eq,step:null,style:null,tabIndex:Eq,target:null,title:null,translate:null,type:null,typeMustMatch:wq,useMap:null,value:Tq,width:Eq,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dq,axis:null,background:null,bgColor:null,border:Eq,borderColor:null,bottomMargin:Eq,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wq,declare:wq,event:null,face:null,frame:null,frameBorder:null,hSpace:Eq,leftMargin:Eq,link:null,longDesc:null,lowSrc:null,marginHeight:Eq,marginWidth:Eq,noResize:wq,noHref:wq,noShade:wq,noWrap:wq,object:null,profile:null,prompt:null,rev:null,rightMargin:Eq,rules:null,scheme:null,scrolling:Tq,standby:null,summary:null,text:null,topMargin:Eq,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Eq,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wq,disableRemotePlayback:wq,prefix:null,property:null,results:Eq,security:null,unselectable:null},space:`html`,transform:M8e}),P8e=Nq({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:kq,accentHeight:Eq,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Eq,amplitude:Eq,arabicForm:null,ascent:Eq,attributeName:null,attributeType:null,azimuth:Eq,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Eq,by:null,calcMode:null,capHeight:Eq,className:Dq,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Eq,diffuseConstant:Eq,direction:null,display:null,dur:null,divisor:Eq,dominantBaseline:null,download:wq,dx:null,dy:null,edgeMode:null,editable:null,elevation:Eq,enableBackground:null,end:null,event:null,exponent:Eq,externalResourcesRequired:null,fill:null,fillOpacity:Eq,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oq,g2:Oq,glyphName:Oq,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Eq,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Eq,horizOriginX:Eq,horizOriginY:Eq,id:null,ideographic:Eq,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Eq,k:Eq,k1:Eq,k2:Eq,k3:Eq,k4:Eq,kernelMatrix:kq,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Eq,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Eq,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Eq,overlineThickness:Eq,paintOrder:null,panose1:null,path:null,pathLength:Eq,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dq,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Eq,pointsAtY:Eq,pointsAtZ:Eq,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kq,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kq,rev:kq,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kq,requiredFeatures:kq,requiredFonts:kq,requiredFormats:kq,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Eq,specularExponent:Eq,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Eq,strikethroughThickness:Eq,string:null,stroke:null,strokeDashArray:kq,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Eq,strokeOpacity:Eq,strokeWidth:null,style:null,surfaceScale:Eq,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kq,tabIndex:Eq,tableValues:null,target:null,targetX:Eq,targetY:Eq,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kq,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Eq,underlineThickness:Eq,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Eq,values:null,vAlphabetic:Eq,vMathematical:Eq,vectorEffect:null,vHanging:Eq,vIdeographic:Eq,version:null,vertAdvY:Eq,vertOriginX:Eq,vertOriginY:Eq,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Eq,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:j8e}),Pq=Nq({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),F8e=Nq({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:M8e}),I8e=Nq({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),L8e={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`};var R8e=/[A-Z]/g,z8e=/-[a-z]/g,Fq=/^data[-\w.:]+$/i;function B8e(e,t){let n=T8e(t),r=t,i=Cq;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Fq.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(z8e,H8e);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!z8e.test(e)){let n=e.replace(R8e,V8e);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Mq}return new i(r,t)}function V8e(e){return`-`+e.toLowerCase()}function H8e(e){return e.charAt(1).toUpperCase()}const Iq=w8e([A8e,N8e,Pq,F8e,I8e],`html`),Lq=w8e([A8e,P8e,Pq,F8e,I8e],`svg`);function U8e(e){return e.join(` `).trim()}var W8e=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
193
+ `);n=a.pop();for(let e of a)if(e.startsWith(`data: `)){let t=e.slice(6);if(t)try{yield JSON.parse(t)}catch{}}}}async function s8e(e,t,n,r,i,a){let o=[];for await(let s of o8e(e)){switch(s.type){case`text-delta`:t.value+=s.text;break;case`tool-call`:{let e=s.args;if(typeof s.args==`string`)try{e=JSON.parse(s.args)}catch{e={}}n.push({type:`tool-call`,toolCallId:s.toolCallId,toolName:s.toolName,args:e});break}case`tool-result`:{let e=typeof s.result==`object`?s.result:null;if(e&&`__approvalRequired`in e)break;let t=n.find(e=>e.toolCallId===s.toolCallId);t&&(t.result=typeof s.result==`string`?s.result:JSON.stringify(s.result),s.isError&&(t.isError=!0));break}case`generative-ui`:{let e={type:`generative-ui`,spec:s.spec},t=r.findIndex(e=>e.type===`generative-ui`);t===-1?r.push(e):r[t]=e;break}case`data`:{let e={type:`data`,name:s.name,data:s.data},t=r.findIndex(e=>e.type===`data`&&e.name===s.name);t===-1?r.push(e):r[t]=e;break}case`approval-request`:o.push({toolCallId:s.toolCallId,toolName:s.toolName,args:s.args,reason:s.reason,runId:s.runId,type:`approval-request`});break;case`credential-request`:o.push({toolCallId:s.toolCallId,toolName:s.toolName,args:s.args,runId:s.runId,type:`credential-request`,credentialName:s.credentialName,credentialType:s.credentialType,connectUrl:s.connectUrl});break;case`error`:t.value+=`\n\nError: ${s.message||s.errorText||`Unknown error`}`;break;case`done`:a?.();continue}i()}return o}function c8e(e){if(e==null)return!1;try{let t=typeof e==`string`?JSON.parse(e):e;return t&&typeof t==`object`&&t.approved===!1}catch{return!1}}function l8e(e){if(typeof e==`object`&&e&&e.error===`missing_credential`)return e;if(typeof e==`string`)try{let t=JSON.parse(e);if(t?.error===`missing_credential`)return t}catch{}return null}function u8e(e,t){if(e.type===`running`)return{type:`running`};if(e.type===`requires-action`)return{type:`requires-action`};if(c8e(t))return{type:`denied`};let n=l8e(t);return n?{type:`missing-credential`,payload:n}:typeof t==`string`&&t.startsWith(`Error:`)?{type:`error`}:{type:`completed`}}function bq(e,t,n){let r=[];return e.value&&r.push({type:`text`,text:e.value}),r.push(...t),r.push(...n),r}function xq(e){let t=[];if(typeof e==`string`)return e&&t.push({type:`text`,text:e}),t;if(!e||typeof e!=`object`)return t;let n=e;return typeof n.text==`string`&&n.text&&t.push({type:`text`,text:n.text}),n.ui!=null&&t.push({type:`generative-ui`,spec:n.ui}),t}function d8e(e,t,n,r,i){return{async*run({messages:a,abortSignal:o}){let s=e.current,c=t.current;if(c.length>0){let e=n.current;if(n.current=[],e.length===0)return;t.current=[],r.current([]);let a={value:``},l=[],u=[],d=[];for(let t=0;t<e.length;t++){let n=e[t],r=c.find(e=>e.toolCallId===n.toolCallId)?.runId??c[0]?.runId,f=await fetch(`${s.api}/${s.agentName}/resume`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({runId:r,toolCallId:n.toolCallId,approved:n.approved}),signal:o,credentials:s.credentials});if(!f.ok||!f.body){let e=f.body?await f.text().catch(()=>``):``;throw Error(`Resume failed: ${f.status}${e?` - ${e}`:``}`)}let p={value:``},m=[],h=[],g=await s8e(f.body.getReader(),p,m,h,()=>{},t===e.length-1?i.current??void 0:void 0);a=p,l=m,u=h,g.length>0&&(d=g)}let f=bq(a,u,l);if(d.length>0){t.current=d,r.current(d);for(let e of d){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=l.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?l.push(t):l[n]=t}yield{content:bq(a,u,l),status:{type:`requires-action`,reason:`tool-calls`}}}else f.length>0&&(yield{content:f});return}let l=[...a].reverse().find(e=>e.role===`user`);if(!l)return;let u=``;if(l.content)for(let e of l.content)`text`in e&&e.type===`text`&&(u+=e.text);let d;try{d=await fetch(`${s.api}/${s.agentName}/stream`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({agentName:s.agentName,message:u,threadId:s.threadId,resourceId:s.resourceId,model:s.model,temperature:s.temperature,...s.context?{context:s.context}:{}}),signal:o,credentials:s.credentials})}catch(e){let t=e?.message||`Unknown error`,n=`Failed to connect to the agent.`;if(t.includes(`Failed to fetch`)||t.includes(`NetworkError`)||t.includes(`CORS`))n=`Unable to reach the agent server. The deployment may be down or the URL may be incorrect.`;else if(t.includes(`abort`))return;yield{content:[{type:`text`,text:`⚠️ ${n}`}]};return}if(!d.ok||!d.body){let e=`Request failed (${d.status}).`;d.status===401||d.status===403?e=`Authentication error.`:d.status===404?e=`Agent not found — the agent may not be configured for this project.`:d.status===502||d.status===503?e=`The agent server is currently unavailable. Try again in a moment.`:d.status===429&&(e=`Rate limited — too many requests. Please wait a moment.`),yield{content:[{type:`text`,text:`⚠️ ${e}`}]};return}let f={value:``},p=[],m=[],h=null,g=await s8e(d.body.getReader(),f,p,m,()=>{let e=bq(f,m,p);e.length>0&&(h=e)},i.current??void 0);if(g.length===0){h&&(yield{content:h});return}t.current=g,r.current(g);for(let e of g){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=p.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?p.push(t):p[n]=t}let _=new Set(g.map(e=>e.toolCallId)),v=new Set(g.map(e=>e.toolName));for(let e=p.length-1;e>=0;e--)v.has(p[e].toolName)&&!_.has(p[e].toolCallId)&&p.splice(e,1);yield{content:bq(f,m,p),status:{type:`requires-action`,reason:`tool-calls`}}}}}const f8e=e=>{let t=[],n=null;for(let r of e){if(r.role===`user`){n&&=(t.push(n),null),t.push({role:`user`,content:r.content||``,id:r.id,createdAt:new Date(r.createdAt)});continue}if(r.role===`tool`&&n&&Array.isArray(r.toolResults)){let e=Array.isArray(n.content)?[...n.content]:n.content?[{type:`text`,text:n.content}]:[];for(let t of r.toolResults){let n=e.findIndex(e=>e.type===`tool-call`&&e.toolCallId===t.id);n!==-1&&(e[n]={...e[n],result:typeof t.result==`string`?t.result:JSON.stringify(t.result)})}n={role:n.role,id:n.id,createdAt:n.createdAt,status:n.status,content:e};continue}if(r.role===`tool`)continue;let e=[];if(r.content&&(Array.isArray(r.content)?e.push(...r.content):e.push({type:`text`,text:r.content})),Array.isArray(r.toolCalls))for(let t of r.toolCalls)e.push({type:`tool-call`,toolCallId:t.id,toolName:t.name,args:t.args||{}});if(n){let t=n.content,r=Array.isArray(t)?[...t]:t?[{type:`text`,text:t}]:[];n={role:n.role,id:n.id,createdAt:n.createdAt,status:n.status,content:[...r,...e]}}else n={role:`assistant`,content:e.length>0?e:``,id:r.id,createdAt:new Date(r.createdAt),status:{type:`complete`,reason:`stop`}}}return n&&t.push(n),t};function p8e(e){let[t,n]=(0,D.useState)([]),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)(e.onFinish);i.current=e.onFinish;let a=(0,D.useRef)([]),o=(0,D.useRef)([]),s=(0,D.useRef)(n);s.current=n;let c=v6e((0,D.useMemo)(()=>d8e(r,a,o,s,i),[]),{initialMessages:(0,D.useMemo)(()=>e.initialMessages?f8e(e.initialMessages):void 0,[e.initialMessages])}),l=(0,D.useCallback)((e,t)=>{o.current.push({toolCallId:e,approved:t})},[]);return{runtime:c,pendingApprovals:t,isAwaitingApproval:t.length>0,handleApproval:l}}function m8e(e,t,n,r,i){return{async*run({messages:a,abortSignal:o}){let s=e.current,c=t.current;if(c.length>0){let e=n.current;if(n.current=[],e.length===0)return;t.current=[],r.current([]);let a={value:``},l=[],u=[],d=[];for(let t=0;t<e.length;t++){let n=e[t],r=c.find(e=>e.toolCallId===n.toolCallId)?.runId??c[0]?.runId,f=await fetch(`${s.api}/${s.agentName}/resume`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({runId:r,toolCallId:n.toolCallId,approved:n.approved}),signal:o,credentials:s.credentials});if(!f.ok||!f.body){let e=f.body?await f.text().catch(()=>``):``;throw Error(`Resume failed: ${f.status}${e?` - ${e}`:``}`)}let p={value:``},m=[],h=[],g=await s8e(f.body.getReader(),p,m,h,()=>{},t===e.length-1?i.current??void 0:void 0);a=p,l=m,u=h,g.length>0&&(d=g)}let f=bq(a,u,l);if(d.length>0){t.current=d,r.current(d);for(let e of d){let t={type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}},n=l.findIndex(t=>t.toolCallId===e.toolCallId&&!t.result);n===-1?l.push(t):l[n]=t}yield{content:bq(a,u,l),status:{type:`requires-action`,reason:`tool-calls`}}}else f.length>0&&(yield{content:f});return}let l=[...a].reverse().find(e=>e.role===`user`);if(!l)return;let u=``;if(l.content)for(let e of l.content)`text`in e&&e.type===`text`&&(u+=e.text);let d=await fetch(`${s.api}/${s.agentName}`,{method:`POST`,headers:{"Content-Type":`application/json`,...s.headers},body:JSON.stringify({agentName:s.agentName,message:u,threadId:s.threadId,resourceId:s.resourceId,model:s.model,temperature:s.temperature,...s.context?{context:s.context}:{}}),signal:o,credentials:s.credentials});if(!d.ok)throw Error(`Agent run failed: ${d.status}`);let f=await d.json();if(f.status===`suspended`&&f.pendingApprovals?.length>0){let e=f.pendingApprovals;t.current=e,r.current(e);let n=e.map(e=>({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,args:{...typeof e.args==`object`&&e.args!==null?e.args:{},...e.reason?{__approvalReason:e.reason}:{}}})),i=[];i.push(...xq(f.result)),i.push(...n),yield{content:i,status:{type:`requires-action`,reason:`tool-calls`}};return}i.current?.();let p=xq(f.result);p.length>0&&(yield{content:p})}}}function h8e(e){let[t,n]=(0,D.useState)([]),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)(e.onFinish);i.current=e.onFinish;let a=(0,D.useRef)([]),o=(0,D.useRef)([]),s=(0,D.useRef)(n);s.current=n;let c=v6e((0,D.useMemo)(()=>m8e(r,a,o,s,i),[]),{initialMessages:(0,D.useMemo)(()=>e.initialMessages?f8e(e.initialMessages):void 0,[e.initialMessages])}),l=(0,D.useCallback)((e,t)=>{o.current.push({toolCallId:e,approved:t})},[]);return{runtime:c,pendingApprovals:t,isAwaitingApproval:t.length>0,handleApproval:l}}function g8e(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _8e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v8e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y8e={};function b8e(e,t){return((t||y8e).jsx?v8e:_8e).test(e)}var x8e=/[ \t\n\f\r]/g;function S8e(e){return typeof e==`object`?e.type===`text`?C8e(e.value):!1:C8e(e)}function C8e(e){return e.replace(x8e,``)===``}var Sq=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Sq.prototype.normal={},Sq.prototype.property={},Sq.prototype.space=void 0;function w8e(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Sq(n,r,t)}function T8e(e){return e.toLowerCase()}var Cq=class{constructor(e,t){this.attribute=t,this.property=e}};Cq.prototype.attribute=``,Cq.prototype.booleanish=!1,Cq.prototype.boolean=!1,Cq.prototype.commaOrSpaceSeparated=!1,Cq.prototype.commaSeparated=!1,Cq.prototype.defined=!1,Cq.prototype.mustUseProperty=!1,Cq.prototype.number=!1,Cq.prototype.overloadedBoolean=!1,Cq.prototype.property=``,Cq.prototype.spaceSeparated=!1,Cq.prototype.space=void 0;var E8e=c({boolean:()=>wq,booleanish:()=>Tq,commaOrSpaceSeparated:()=>kq,commaSeparated:()=>Oq,number:()=>Eq,overloadedBoolean:()=>O8e,spaceSeparated:()=>Dq},1),D8e=0;const wq=Aq(),Tq=Aq(),O8e=Aq(),Eq=Aq(),Dq=Aq(),Oq=Aq(),kq=Aq();function Aq(){return 2**++D8e}var jq=Object.keys(E8e),Mq=class extends Cq{constructor(e,t,n,r){let i=-1;if(super(e,t),k8e(this,`space`,r),typeof n==`number`)for(;++i<jq.length;){let e=jq[i];k8e(this,jq[i],(n&E8e[e])===E8e[e])}}};Mq.prototype.defined=!0;function k8e(e,t,n){n&&(e[t]=n)}function Nq(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Mq(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[T8e(r)]=r,n[T8e(a.attribute)]=r}return new Sq(t,n,e.space)}const A8e=Nq({properties:{ariaActiveDescendant:null,ariaAtomic:Tq,ariaAutoComplete:null,ariaBusy:Tq,ariaChecked:Tq,ariaColCount:Eq,ariaColIndex:Eq,ariaColSpan:Eq,ariaControls:Dq,ariaCurrent:null,ariaDescribedBy:Dq,ariaDetails:null,ariaDisabled:Tq,ariaDropEffect:Dq,ariaErrorMessage:null,ariaExpanded:Tq,ariaFlowTo:Dq,ariaGrabbed:Tq,ariaHasPopup:null,ariaHidden:Tq,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dq,ariaLevel:Eq,ariaLive:null,ariaModal:Tq,ariaMultiLine:Tq,ariaMultiSelectable:Tq,ariaOrientation:null,ariaOwns:Dq,ariaPlaceholder:null,ariaPosInSet:Eq,ariaPressed:Tq,ariaReadOnly:Tq,ariaRelevant:null,ariaRequired:Tq,ariaRoleDescription:Dq,ariaRowCount:Eq,ariaRowIndex:Eq,ariaRowSpan:Eq,ariaSelected:Tq,ariaSetSize:Eq,ariaSort:null,ariaValueMax:Eq,ariaValueMin:Eq,ariaValueNow:Eq,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function j8e(e,t){return t in e?e[t]:t}function M8e(e,t){return j8e(e,t.toLowerCase())}const N8e=Nq({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Oq,acceptCharset:Dq,accessKey:Dq,action:null,allow:null,allowFullScreen:wq,allowPaymentRequest:wq,allowUserMedia:wq,alt:null,as:null,async:wq,autoCapitalize:null,autoComplete:Dq,autoFocus:wq,autoPlay:wq,blocking:Dq,capture:null,charSet:null,checked:wq,cite:null,className:Dq,cols:Eq,colSpan:null,content:null,contentEditable:Tq,controls:wq,controlsList:Dq,coords:Eq|Oq,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wq,defer:wq,dir:null,dirName:null,disabled:wq,download:O8e,draggable:Tq,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wq,formTarget:null,headers:Dq,height:Eq,hidden:O8e,high:Eq,href:null,hrefLang:null,htmlFor:Dq,httpEquiv:Dq,id:null,imageSizes:null,imageSrcSet:null,inert:wq,inputMode:null,integrity:null,is:null,isMap:wq,itemId:null,itemProp:Dq,itemRef:Dq,itemScope:wq,itemType:Dq,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wq,low:Eq,manifest:null,max:null,maxLength:Eq,media:null,method:null,min:null,minLength:Eq,multiple:wq,muted:wq,name:null,nonce:null,noModule:wq,noValidate:wq,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:wq,optimum:Eq,pattern:null,ping:Dq,placeholder:null,playsInline:wq,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wq,referrerPolicy:null,rel:Dq,required:wq,reversed:wq,rows:Eq,rowSpan:Eq,sandbox:Dq,scope:null,scoped:wq,seamless:wq,selected:wq,shadowRootClonable:wq,shadowRootDelegatesFocus:wq,shadowRootMode:null,shape:null,size:Eq,sizes:null,slot:null,span:Eq,spellCheck:Tq,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Eq,step:null,style:null,tabIndex:Eq,target:null,title:null,translate:null,type:null,typeMustMatch:wq,useMap:null,value:Tq,width:Eq,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dq,axis:null,background:null,bgColor:null,border:Eq,borderColor:null,bottomMargin:Eq,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wq,declare:wq,event:null,face:null,frame:null,frameBorder:null,hSpace:Eq,leftMargin:Eq,link:null,longDesc:null,lowSrc:null,marginHeight:Eq,marginWidth:Eq,noResize:wq,noHref:wq,noShade:wq,noWrap:wq,object:null,profile:null,prompt:null,rev:null,rightMargin:Eq,rules:null,scheme:null,scrolling:Tq,standby:null,summary:null,text:null,topMargin:Eq,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Eq,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wq,disableRemotePlayback:wq,prefix:null,property:null,results:Eq,security:null,unselectable:null},space:`html`,transform:M8e}),P8e=Nq({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:kq,accentHeight:Eq,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Eq,amplitude:Eq,arabicForm:null,ascent:Eq,attributeName:null,attributeType:null,azimuth:Eq,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Eq,by:null,calcMode:null,capHeight:Eq,className:Dq,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Eq,diffuseConstant:Eq,direction:null,display:null,dur:null,divisor:Eq,dominantBaseline:null,download:wq,dx:null,dy:null,edgeMode:null,editable:null,elevation:Eq,enableBackground:null,end:null,event:null,exponent:Eq,externalResourcesRequired:null,fill:null,fillOpacity:Eq,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oq,g2:Oq,glyphName:Oq,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Eq,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Eq,horizOriginX:Eq,horizOriginY:Eq,id:null,ideographic:Eq,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Eq,k:Eq,k1:Eq,k2:Eq,k3:Eq,k4:Eq,kernelMatrix:kq,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Eq,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Eq,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Eq,overlineThickness:Eq,paintOrder:null,panose1:null,path:null,pathLength:Eq,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dq,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Eq,pointsAtY:Eq,pointsAtZ:Eq,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kq,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kq,rev:kq,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kq,requiredFeatures:kq,requiredFonts:kq,requiredFormats:kq,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Eq,specularExponent:Eq,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Eq,strikethroughThickness:Eq,string:null,stroke:null,strokeDashArray:kq,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Eq,strokeOpacity:Eq,strokeWidth:null,style:null,surfaceScale:Eq,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kq,tabIndex:Eq,tableValues:null,target:null,targetX:Eq,targetY:Eq,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kq,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Eq,underlineThickness:Eq,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Eq,values:null,vAlphabetic:Eq,vMathematical:Eq,vectorEffect:null,vHanging:Eq,vIdeographic:Eq,version:null,vertAdvY:Eq,vertOriginX:Eq,vertOriginY:Eq,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Eq,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:j8e}),Pq=Nq({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),F8e=Nq({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:M8e}),I8e=Nq({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),L8e={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`};var R8e=/[A-Z]/g,z8e=/-[a-z]/g,Fq=/^data[-\w.:]+$/i;function B8e(e,t){let n=T8e(t),r=t,i=Cq;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Fq.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(z8e,H8e);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!z8e.test(e)){let n=e.replace(R8e,V8e);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Mq}return new i(r,t)}function V8e(e){return`-`+e.toLowerCase()}function H8e(e){return e.charAt(1).toUpperCase()}const Iq=w8e([A8e,N8e,Pq,F8e,I8e],`html`),Lq=w8e([A8e,P8e,Pq,F8e,I8e],`svg`);function U8e(e){return e.join(` `).trim()}var W8e=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
194
194
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),G8e=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(W8e());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),K8e=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),q8e=s(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(G8e()),r=K8e();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i}));const J8e=Rq(`end`),Y8e=Rq(`start`);function Rq(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function X8e(e){let t=Y8e(e),n=J8e(e);if(t&&n)return{start:t,end:n}}function zq(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Bq(e.position):`start`in e||`end`in e?Bq(e):`line`in e||`column`in e?Z8e(e):``}function Z8e(e){return Q8e(e&&e.line)+`:`+Q8e(e&&e.column)}function Bq(e){return Z8e(e&&e.start)+`-`+Z8e(e&&e.end)}function Q8e(e){return e&&typeof e==`number`?e:1}var Vq=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=zq(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Vq.prototype.file=``,Vq.prototype.name=``,Vq.prototype.reason=``,Vq.prototype.message=``,Vq.prototype.stack=``,Vq.prototype.column=void 0,Vq.prototype.line=void 0,Vq.prototype.ancestors=void 0,Vq.prototype.cause=void 0,Vq.prototype.fatal=void 0,Vq.prototype.place=void 0,Vq.prototype.ruleId=void 0,Vq.prototype.source=void 0;var $8e=u(q8e(),1),e5e={}.hasOwnProperty,t5e=new Map,n5e=/[A-Z]/g,r5e=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),i5e=new Set([`td`,`th`]),a5e=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function o5e(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=h5e(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=m5e(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Lq:Iq,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Hq(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Hq(e,t,n){if(t.type===`element`)return s5e(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return c5e(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return u5e(e,t,n);if(t.type===`mdxjsEsm`)return l5e(e,t);if(t.type===`root`)return d5e(e,t,n);if(t.type===`text`)return f5e(e,t)}function s5e(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Lq,e.schema=i),e.ancestors.push(t);let a=b5e(e,t.tagName,!1),o=g5e(e,t),s=Wq(e,t);return r5e.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!S8e(e):!0})),p5e(e,o,a,t),Uq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function c5e(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Gq(e,t.position)}function l5e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Gq(e,t.position)}function u5e(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Lq,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:b5e(e,t.name,!0),o=_5e(e,t),s=Wq(e,t);return p5e(e,o,a,t),Uq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function d5e(e,t,n){let r={};return Uq(r,Wq(e,t)),e.create(t,e.Fragment,r,n)}function f5e(e,t){return t.value}function p5e(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Uq(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function m5e(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function h5e(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Y8e(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function g5e(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&e5e.call(t.properties,i)){let a=v5e(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&i5e.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function _5e(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Gq(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Gq(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Wq(e,t){let n=[],r=-1,i=e.passKeys?new Map:t5e;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Hq(e,a,o);s!==void 0&&n.push(s)}return n}function v5e(e,t,n){let r=B8e(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?g8e(n):U8e(n)),r.property===`style`){let t=typeof n==`object`?n:y5e(e,String(n));return e.stylePropertyNameCase===`css`&&(t=x5e(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?L8e[r.property]||r.property:r.attribute,n]}}function y5e(e,t){try{return(0,$8e.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Vq("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=a5e+`#cannot-parse-style-attribute`,r}}function b5e(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=b8e(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=b8e(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return e5e.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Gq(e)}function Gq(e,t){let n=new Vq("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=a5e+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function x5e(e){let t={},n;for(n in e)e5e.call(e,n)&&(t[Kq(n)]=e[n]);return t}function Kq(e){let t=e.replace(n5e,S5e);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function S5e(e){return`-`+e.toLowerCase()}const C5e={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]};var w5e={};function T5e(e,t){let n=t||w5e;return E5e(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function E5e(e,t,n){if(qq(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return D5e(e.children,t,n)}return Array.isArray(e)?D5e(e,t,n):``}function D5e(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=E5e(e[i],t,n);return r.join(``)}function qq(e){return!!(e&&typeof e==`object`)}var O5e=document.createElement(`i`);function Jq(e){let t=`&`+e+`;`;O5e.innerHTML=t;let n=O5e.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Yq(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Xq(e,t){return e.length>0?(Yq(e,e.length,0,t),e):t}var k5e={}.hasOwnProperty;function A5e(e){let t={},n=-1;for(;++n<e.length;)j5e(t,e[n]);return t}function j5e(e,t){let n;for(n in t){let r=(k5e.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){k5e.call(r,a)||(r[a]=[]);let e=i[a];M5e(r[a],Array.isArray(e)?e:e?[e]:[])}}}function M5e(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Yq(e,0,0,r)}function N5e(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Zq(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}const Qq=oJ(/[A-Za-z]/),$q=oJ(/[\dA-Za-z]/),P5e=oJ(/[#-'*+\--9=?A-Z^-~]/);function eJ(e){return e!==null&&(e<32||e===127)}const F5e=oJ(/\d/),I5e=oJ(/[\dA-Fa-f]/),L5e=oJ(/[!-/:-@[-`{-~]/);function tJ(e){return e!==null&&e<-2}function nJ(e){return e!==null&&(e<0||e===32)}function rJ(e){return e===-2||e===-1||e===32}const iJ=oJ(/\p{P}|\p{S}/u),aJ=oJ(/\s/);function oJ(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function sJ(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&$q(e.charCodeAt(n+1))&&$q(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function cJ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return rJ(r)?(e.enter(n),s(r)):t(r)}function s(r){return rJ(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}const lJ={tokenize:R5e};function R5e(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),cJ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return tJ(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}const uJ={tokenize:z5e};var dJ={tokenize:B5e};function z5e(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Yq(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(dJ,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(dJ,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return tJ(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Yq(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function B5e(e,t,n){return cJ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function fJ(e){if(e===null||nJ(e)||aJ(e))return 1;if(iJ(e))return 2}function V5e(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const H5e={name:`attention`,resolveAll:pJ,tokenize:U5e};function pJ(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};W5e(d,-c),W5e(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Xq(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Xq(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Xq(l,V5e(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Xq(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Xq(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Yq(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function U5e(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=fJ(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=fJ(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function W5e(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const G5e={name:`autolink`,tokenize:K5e};function K5e(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Qq(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||$q(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||$q(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||eJ(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):P5e(t)?(e.consume(t),l):n(t)}function u(e){return $q(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||$q(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}const mJ={partial:!0,tokenize:q5e};function q5e(e,t,n){return r;function r(t){return rJ(t)?cJ(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||tJ(e)?t(e):n(e)}}const J5e={continuation:{tokenize:X5e},exit:Z5e,name:`blockQuote`,tokenize:Y5e};function Y5e(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return rJ(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function X5e(e,t,n){let r=this;return i;function i(t){return rJ(t)?cJ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(J5e,t,n)(r)}}function Z5e(e){e.exit(`blockQuote`)}const Q5e={name:`characterEscape`,tokenize:$5e};function $5e(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return L5e(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const e7e={name:`characterReference`,tokenize:t7e};function t7e(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=$q,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=I5e,u):(e.enter(`characterReferenceValue`),a=7,o=F5e,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===$q&&!Jq(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var n7e={partial:!0,tokenize:i7e};const r7e={concrete:!0,name:`codeFenced`,tokenize:hJ};function hJ(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),rJ(t)?cJ(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||tJ(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(n7e,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||tJ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):rJ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),cJ(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||tJ(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||tJ(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&rJ(t)?cJ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||tJ(t)?e.check(n7e,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||tJ(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),rJ(t)?cJ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),rJ(t)?cJ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||tJ(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function i7e(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const a7e={name:`codeIndented`,tokenize:s7e};var o7e={partial:!0,tokenize:c7e};function s7e(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),cJ(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):tJ(t)?e.attempt(o7e,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||tJ(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function c7e(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):tJ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):cJ(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):tJ(e)?i(e):n(e)}}const l7e={name:`codeText`,previous:d7e,resolve:u7e,tokenize:f7e};function u7e(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function d7e(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function f7e(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):tJ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||tJ(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var p7e=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&gJ(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),gJ(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),gJ(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);gJ(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);gJ(this.left,t.reverse())}}};function gJ(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function _J(e){let t={},n=-1,r,i,a,o,s,c,l,u=new p7e(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,m7e(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Yq(e,0,1/0,u.slice(0)),!l}function m7e(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const h7e={resolve:g7e,tokenize:_7e};var vJ={partial:!0,tokenize:v7e};function g7e(e){return _J(e),e}function _7e(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):tJ(t)?e.check(vJ,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function v7e(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),cJ(e,a,`linePrefix`)}function a(i){if(i===null||tJ(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function y7e(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||eJ(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||tJ(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||nJ(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||eJ(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function b7e(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):tJ(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||tJ(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!rJ(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function x7e(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):tJ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),cJ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||tJ(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function yJ(e,t){let n;return r;function r(i){return tJ(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):rJ(i)?cJ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}const S7e={name:`definition`,tokenize:C7e};var bJ={partial:!0,tokenize:w7e};function C7e(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return b7e.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Zq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return nJ(t)?yJ(e,l)(t):l(t)}function l(t){return y7e(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(bJ,d,d)(t)}function d(t){return rJ(t)?cJ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||tJ(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function w7e(e,t,n){return r;function r(t){return nJ(t)?yJ(e,i)(t):n(t)}function i(t){return x7e(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return rJ(t)?cJ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||tJ(e)?t(e):n(e)}}const T7e={name:`hardBreakEscape`,tokenize:E7e};function E7e(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return tJ(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const D7e={name:`headingAtx`,resolve:O7e,tokenize:k7e};function O7e(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Yq(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function k7e(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||nJ(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||tJ(n)?(e.exit(`atxHeading`),t(n)):rJ(n)?cJ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||nJ(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}const xJ=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),A7e=[`pre`,`script`,`style`,`textarea`],j7e={concrete:!0,name:`htmlFlow`,resolveTo:P7e,tokenize:F7e};var M7e={partial:!0,tokenize:L7e},N7e={partial:!0,tokenize:I7e};function P7e(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function F7e(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:oe):Qq(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Qq(a)?(e.consume(a),i=4,r.interrupt?t:oe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:oe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Qq(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||nJ(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&A7e.includes(l)?(i=1,r.interrupt?t(s):O(s)):xJ.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||$q(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return rJ(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Qq(t)?(e.consume(t),b):rJ(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||$q(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):rJ(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):rJ(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||tJ(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||nJ(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||rJ(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||tJ(t)?O(t):rJ(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),re):t===62&&i===4?(e.consume(t),se):t===63&&i===3?(e.consume(t),oe):t===93&&i===5?(e.consume(t),ae):tJ(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(M7e,ce,k)(t)):t===null||tJ(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(N7e,ee,ce)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||tJ(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),oe):O(t)}function re(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return A7e.includes(n)?(e.consume(t),se):O(t)}return Qq(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),oe):O(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):O(t)}function se(t){return t===null||tJ(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function I7e(e,t,n){let r=this;return i;function i(t){return tJ(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function L7e(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(mJ,t,n)}}const R7e={name:`htmlText`,tokenize:z7e};function z7e(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Qq(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Qq(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):tJ(t)?(o=d,re(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):tJ(t)?(o=h,re(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):tJ(t)?(o=v,re(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):tJ(t)?(o=y,re(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return Qq(t)?(e.consume(t),S):n(t)}function S(t){return t===45||$q(t)?(e.consume(t),S):C(t)}function C(t){return tJ(t)?(o=C,re(t)):rJ(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||$q(t)?(e.consume(t),w):t===47||t===62||nJ(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||Qq(t)?(e.consume(t),E):tJ(t)?(o=T,re(t)):rJ(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||$q(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):tJ(t)?(o=D,re(t)):rJ(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):tJ(t)?(o=O,re(t)):rJ(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):tJ(t)?(o=k,re(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||nJ(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||nJ(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function re(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return rJ(t)?cJ(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}const SJ={name:`labelEnd`,resolveAll:U7e,resolveTo:W7e,tokenize:G7e};var B7e={tokenize:K7e},V7e={tokenize:q7e},H7e={tokenize:J7e};function U7e(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Yq(e,0,e.length,n),e}function W7e(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Xq(s,e.slice(a+1,a+r+3)),s=Xq(s,[[`enter`,u,t]]),s=Xq(s,V5e(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Xq(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Xq(s,e.slice(o+1)),s=Xq(s,[[`exit`,c,t]]),Yq(e,a,e.length,s),e}function G7e(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Zq(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(B7e,u,o?u:d)(t):t===91?e.attempt(V7e,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(H7e,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function K7e(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return nJ(t)?yJ(e,a)(t):a(t)}function a(t){return t===41?u(t):y7e(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return nJ(t)?yJ(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?x7e(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return nJ(t)?yJ(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function q7e(e,t,n){let r=this;return i;function i(t){return b7e.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Zq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function J7e(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const Y7e={name:`labelStartImage`,resolveAll:SJ.resolveAll,tokenize:X7e};function X7e(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const Z7e={name:`labelStartLink`,resolveAll:SJ.resolveAll,tokenize:Q7e};function Q7e(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const $7e={name:`lineEnding`,tokenize:CJ};function CJ(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),cJ(e,t,`linePrefix`)}}const e9e={name:`thematicBreak`,tokenize:t9e};function t9e(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||tJ(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),rJ(t)?cJ(e,s,`whitespace`)(t):s(t))}}const wJ={continuation:{tokenize:a9e},exit:o9e,name:`list`,tokenize:i9e};var n9e={partial:!0,tokenize:s9e},r9e={partial:!0,tokenize:TJ};function i9e(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:F5e(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(e9e,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return F5e(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(mJ,r.interrupt?n:u,e.attempt(n9e,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return rJ(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function a9e(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mJ,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,cJ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!rJ(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(r9e,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,cJ(e,e.attempt(wJ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function TJ(e,t,n){let r=this;return cJ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function o9e(e){e.exit(this.containerState.type)}function s9e(e,t,n){let r=this;return cJ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!rJ(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const EJ={name:`setextUnderline`,resolveTo:c9e,tokenize:l9e};function c9e(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function l9e(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),rJ(t)?cJ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||tJ(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const DJ={tokenize:u9e};function u9e(e){let t=this,n=e.attempt(mJ,r,e.attempt(this.parser.constructs.flowInitial,i,cJ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(h7e,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}const d9e={resolveAll:m9e()},f9e=OJ(`string`),p9e=OJ(`text`);function OJ(e){return{resolveAll:m9e(e===`text`?h9e:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function m9e(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function h9e(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var g9e=c({attentionMarkers:()=>w9e,contentInitial:()=>v9e,disable:()=>T9e,document:()=>_9e,flow:()=>b9e,flowInitial:()=>y9e,insideSpan:()=>C9e,string:()=>x9e,text:()=>S9e},1);const _9e={42:wJ,43:wJ,45:wJ,48:wJ,49:wJ,50:wJ,51:wJ,52:wJ,53:wJ,54:wJ,55:wJ,56:wJ,57:wJ,62:J5e},v9e={91:S7e},y9e={[-2]:a7e,[-1]:a7e,32:a7e},b9e={35:D7e,42:e9e,45:[EJ,e9e],60:j7e,61:EJ,95:e9e,96:r7e,126:r7e},x9e={38:e7e,92:Q5e},S9e={[-5]:$7e,[-4]:$7e,[-3]:$7e,33:Y7e,38:e7e,42:H5e,60:[G5e,R7e],91:Z7e,92:[T7e,Q5e],93:SJ,95:H5e,96:l7e},C9e={null:[H5e,d9e]},w9e={null:[42,95]},T9e={null:[]};function E9e(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Xq(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=V5e(a,l.events,l),l.events):[]}function f(e,t){return kJ(p(e),t)}function p(e){return D9e(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){tJ(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Yq(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function D9e(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function kJ(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
195
195
  `;break;case-3:o=`\r
196
196
  `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function O9e(e){let t={constructs:A5e([g9e,...(e||{}).extensions||[]]),content:n(lJ),defined:[],document:n(uJ),flow:n(DJ),lazy:{},string:n(f9e),text:n(p9e)};return t;function n(e){return n;function n(n){return E9e(t,e,n)}}}function k9e(e){for(;!_J(e););return e}var A9e=/[\0\t\n\r]/g;function j9e(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(A9e.lastIndex=u,c=A9e.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var M9e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function N9e(e){return e.replace(M9e,P9e)}function P9e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return N5e(n.slice(t?2:1),t?16:10)}return Jq(n)||e}var F9e={}.hasOwnProperty;function I9e(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),L9e(n)(k9e(O9e(n).document().write(j9e()(e,t,!0))))}function L9e(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Te),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(xe),blockQuote:a(ge),characterEscape:T,characterReference:T,codeFenced:a(_e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(_e,o),codeText:a(ve,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ye),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(be),hardBreakEscape:a(Se),hardBreakTrailing:a(Se),htmlFlow:a(Ce,o),htmlFlowData:T,htmlText:a(Ce,o),htmlTextData:T,image:a(we),label:o,link:a(Te),listItem:a(De),listItemValue:f,listOrdered:a(Ee,d),listUnordered:a(Ee),paragraph:a(Oe),reference:le,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(xe),strong:a(ke),thematicBreak:a(je)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:he,autolinkProtocol:me,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:fe,characterReference:pe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(ee),htmlTextData:E,image:c(re),label:ae,labelText:ie,lineEnding:D,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ue,resourceDestinationString:oe,resourceTitleString:se,resource:ce,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};R9e(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];F9e.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||B9e).call(a,void 0,e[0])}for(r.position={start:AJ(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:AJ(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:AJ(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||B9e).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+zq({start:e.start,end:e.end})+`): it’s not open`);n.position.end=AJ(e.end)}function u(){return T5e(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Zq(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ae(),n.position={start:AJ(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=AJ(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=AJ(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ie(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=N9e(t),n.identifier=Zq(t).toLowerCase()}function ae(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ce(){this.data.inReference=void 0}function le(){this.data.referenceType=`collapsed`}function ue(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Zq(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function de(e){this.data.characterReferenceType=e.type}function fe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=N5e(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Jq(t);let i=this.stack[this.stack.length-1];i.value+=r}function pe(e){let t=this.stack.pop();t.position.end=AJ(e.end)}function me(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ge(){return{type:`blockquote`,children:[]}}function _e(){return{type:`code`,lang:null,meta:null,value:``}}function ve(){return{type:`inlineCode`,value:``}}function ye(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function be(){return{type:`emphasis`,children:[]}}function xe(){return{type:`heading`,depth:0,children:[]}}function Se(){return{type:`break`}}function Ce(){return{type:`html`,value:``}}function we(){return{type:`image`,title:null,url:``,alt:null}}function Te(){return{type:`link`,title:null,url:``,children:[]}}function Ee(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function De(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Oe(){return{type:`paragraph`,children:[]}}function ke(){return{type:`strong`,children:[]}}function Ae(){return{type:`text`,value:``}}function je(){return{type:`thematicBreak`}}}function AJ(e){return{line:e.line,column:e.column,offset:e.offset}}function R9e(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?R9e(e,r):z9e(e,r)}}function z9e(e,t){let n;for(n in t)if(F9e.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function B9e(e,t){throw e?Error("Cannot close `"+e.type+"` ("+zq({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zq({start:t.start,end:t.end})+`) is open`):Error("Cannot close document, a token (`"+t.type+"`, "+zq({start:t.start,end:t.end})+`) is still open`)}function V9e(e){let t=this;t.parser=n;function n(n){return I9e(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function H9e(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function U9e(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`