pmx-canvas 0.4.7 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/.github/extensions/pmx-canvas/extension.mjs +154 -5
  2. package/.github/extensions/pmx-canvas/steering-delivery.mjs +79 -0
  3. package/CHANGELOG.md +156 -0
  4. package/Readme.md +72 -23
  5. package/dist/canvas/global.css +3069 -796
  6. package/dist/canvas/index.js +104 -104
  7. package/dist/json-render/index.css +1 -1
  8. package/dist/types/cli/agent.d.ts +1 -0
  9. package/dist/types/cli/commands/pump.d.ts +9 -0
  10. package/dist/types/client/App.d.ts +1 -1
  11. package/dist/types/client/canvas/AgentPresenceLayer.d.ts +11 -0
  12. package/dist/types/client/canvas/BarHint.d.ts +22 -0
  13. package/dist/types/client/canvas/CanvasNode.d.ts +5 -0
  14. package/dist/types/client/canvas/CanvasViewport.d.ts +4 -4
  15. package/dist/types/client/canvas/CommandBar.d.ts +10 -0
  16. package/dist/types/client/canvas/ConnectionBanner.d.ts +13 -0
  17. package/dist/types/client/canvas/ContextMenu.d.ts +6 -0
  18. package/dist/types/client/canvas/EdgeLayer.d.ts +2 -1
  19. package/dist/types/client/canvas/EmptyState.d.ts +11 -0
  20. package/dist/types/client/canvas/ExternalWriters.d.ts +5 -0
  21. package/dist/types/client/canvas/HumanPresenceLayer.d.ts +8 -0
  22. package/dist/types/client/canvas/Minimap.d.ts +12 -1
  23. package/dist/types/client/canvas/ScopeFenceLayer.d.ts +8 -0
  24. package/dist/types/client/canvas/SelectionBar.d.ts +6 -0
  25. package/dist/types/client/canvas/SessionPanel.d.ts +1 -0
  26. package/dist/types/client/canvas/SessionReceipt.d.ts +17 -0
  27. package/dist/types/client/canvas/TextPrompt.d.ts +25 -0
  28. package/dist/types/client/canvas/ToolRail.d.ts +21 -0
  29. package/dist/types/client/canvas/TopBar.d.ts +7 -0
  30. package/dist/types/client/canvas/canvas-area.d.ts +25 -0
  31. package/dist/types/client/canvas/create-in-view.d.ts +18 -0
  32. package/dist/types/client/canvas/import-files.d.ts +8 -0
  33. package/dist/types/client/canvas/kind-colors.d.ts +3 -0
  34. package/dist/types/client/canvas/use-focus-trap.d.ts +14 -0
  35. package/dist/types/client/canvas/use-now.d.ts +6 -0
  36. package/dist/types/client/icons.d.ts +11 -4
  37. package/dist/types/client/nodes/ExtAppFrame.d.ts +32 -0
  38. package/dist/types/client/nodes/GroupNode.d.ts +6 -1
  39. package/dist/types/client/nodes/MarkdownNode.d.ts +2 -0
  40. package/dist/types/client/nodes/inline-editor-commands.d.ts +3 -4
  41. package/dist/types/client/state/canvas-store.d.ts +49 -5
  42. package/dist/types/client/state/human-store.d.ts +26 -0
  43. package/dist/types/client/state/iframe-mode.d.ts +1 -0
  44. package/dist/types/client/state/intent-bridge.d.ts +37 -5
  45. package/dist/types/client/state/node-factory.d.ts +0 -1
  46. package/dist/types/client/state/presence-store.d.ts +78 -0
  47. package/dist/types/client/state/session-store.d.ts +176 -0
  48. package/dist/types/client/types.d.ts +2 -1
  49. package/dist/types/client/utils/platform.d.ts +2 -0
  50. package/dist/types/server/agent-presence.d.ts +192 -0
  51. package/dist/types/server/ax-gate-ttl.d.ts +6 -0
  52. package/dist/types/server/ax-interaction.d.ts +4 -10
  53. package/dist/types/server/ax-state-manager.d.ts +21 -2
  54. package/dist/types/server/ax-state.d.ts +49 -3
  55. package/dist/types/server/ax-wait.d.ts +13 -0
  56. package/dist/types/server/canvas-db.d.ts +23 -1
  57. package/dist/types/server/canvas-operations.d.ts +1 -0
  58. package/dist/types/server/canvas-state.d.ts +27 -13
  59. package/dist/types/server/canvas-validation.d.ts +0 -14
  60. package/dist/types/server/html-surface.d.ts +1 -1
  61. package/dist/types/server/human-presence.d.ts +40 -0
  62. package/dist/types/server/index.d.ts +29 -3
  63. package/dist/types/server/intent-registry.d.ts +7 -0
  64. package/dist/types/server/mutation-history.d.ts +15 -2
  65. package/dist/types/server/operations/invoker.d.ts +13 -2
  66. package/dist/types/server/operations/ops/ax-presence.d.ts +2 -0
  67. package/dist/types/server/operations/ops/human-presence.d.ts +3 -0
  68. package/dist/types/server/operations/registry.d.ts +11 -0
  69. package/dist/types/server/operations/types.d.ts +1 -1
  70. package/dist/types/server/scope-fence.d.ts +62 -0
  71. package/dist/types/server/server.d.ts +0 -12
  72. package/dist/types/shared/agent-presence.d.ts +130 -0
  73. package/dist/types/shared/approval-gates.d.ts +19 -0
  74. package/dist/types/shared/auto-arrange.d.ts +0 -1
  75. package/dist/types/shared/ax-kinds.d.ts +11 -0
  76. package/dist/types/shared/human-presence.d.ts +31 -0
  77. package/dist/types/shared/iframe-probe.d.ts +8 -0
  78. package/dist/types/shared/scope-fence.d.ts +21 -0
  79. package/docs/RELEASE.md +54 -0
  80. package/docs/ax-host-adapter-contract.md +30 -14
  81. package/docs/cli.md +37 -1
  82. package/docs/environment.md +3 -0
  83. package/docs/http-api.md +222 -5
  84. package/docs/mcp.md +6 -5
  85. package/docs/node-types.md +3 -1
  86. package/docs/plans/plan-009-tech-debt-backlog.md +13 -0
  87. package/docs/screenshot.png +0 -0
  88. package/docs/screenshots/multi-agent-live.png +0 -0
  89. package/docs/screenshots/workbench-live-dark.png +0 -0
  90. package/docs/screenshots/workbench-live-light.png +0 -0
  91. package/docs/sdk.md +1 -1
  92. package/package.json +1 -1
  93. package/skills/pmx-canvas/SKILL.md +109 -18
  94. package/skills/pmx-canvas/references/codex-app-adapter.md +28 -0
  95. package/skills/pmx-canvas/references/full-reference.md +55 -16
  96. package/skills/pmx-canvas/references/github-copilot-app-adapter.md +41 -24
  97. package/skills/pmx-canvas-orchestration/SKILL.md +56 -2
  98. package/skills/pmx-canvas-testing/SKILL.md +57 -0
  99. package/src/cli/agent.ts +1 -0
  100. package/src/cli/commands/copilot.ts +15 -8
  101. package/src/cli/commands/nodes.ts +1 -19
  102. package/src/cli/commands/pump.ts +252 -0
  103. package/src/cli/index.ts +1 -5
  104. package/src/cli/shared.ts +1 -1
  105. package/src/client/App.tsx +209 -585
  106. package/src/client/canvas/AgentPresenceLayer.tsx +74 -0
  107. package/src/client/canvas/AttentionHistory.tsx +0 -10
  108. package/src/client/canvas/BarHint.tsx +49 -0
  109. package/src/client/canvas/CanvasNode.tsx +488 -136
  110. package/src/client/canvas/CanvasViewport.tsx +190 -94
  111. package/src/client/canvas/CommandBar.tsx +140 -0
  112. package/src/client/canvas/CommandPalette.tsx +133 -58
  113. package/src/client/canvas/ConnectionBanner.tsx +65 -0
  114. package/src/client/canvas/ContextMenu.tsx +88 -27
  115. package/src/client/canvas/ContextPinBar.tsx +2 -2
  116. package/src/client/canvas/EdgeLayer.tsx +121 -38
  117. package/src/client/canvas/EmptyState.tsx +93 -0
  118. package/src/client/canvas/ExpandedNodeOverlay.tsx +64 -118
  119. package/src/client/canvas/ExternalWriters.tsx +308 -0
  120. package/src/client/canvas/FocusFieldLayer.tsx +12 -1
  121. package/src/client/canvas/HumanPresenceLayer.tsx +45 -0
  122. package/src/client/canvas/IntentLayer.tsx +1 -1
  123. package/src/client/canvas/Minimap.tsx +117 -190
  124. package/src/client/canvas/ScopeFenceLayer.tsx +38 -0
  125. package/src/client/canvas/SelectionBar.tsx +175 -23
  126. package/src/client/canvas/SessionPanel.tsx +481 -0
  127. package/src/client/canvas/SessionReceipt.tsx +141 -0
  128. package/src/client/canvas/ShortcutOverlay.tsx +21 -6
  129. package/src/client/canvas/SnapshotPanel.tsx +166 -80
  130. package/src/client/canvas/TextPrompt.tsx +128 -0
  131. package/src/client/canvas/ToolRail.tsx +447 -0
  132. package/src/client/canvas/TopBar.tsx +308 -0
  133. package/src/client/canvas/auto-fit.ts +1 -5
  134. package/src/client/canvas/canvas-area.ts +41 -0
  135. package/src/client/canvas/create-in-view.ts +48 -0
  136. package/src/client/canvas/import-files.ts +64 -0
  137. package/src/client/canvas/kind-colors.ts +22 -0
  138. package/src/client/canvas/snap-guides.ts +1 -1
  139. package/src/client/canvas/use-focus-trap.ts +54 -0
  140. package/src/client/canvas/use-now.ts +17 -0
  141. package/src/client/canvas/use-pan-zoom.ts +13 -2
  142. package/src/client/icons.tsx +57 -18
  143. package/src/client/nodes/ExtAppFrame.tsx +79 -2
  144. package/src/client/nodes/GroupNode.tsx +9 -28
  145. package/src/client/nodes/InlineFormatBar.tsx +4 -3
  146. package/src/client/nodes/InlineMarkdownEditor.tsx +27 -0
  147. package/src/client/nodes/MarkdownNode.tsx +59 -24
  148. package/src/client/nodes/MdFormatBar.tsx +2 -4
  149. package/src/client/nodes/inline-editor-commands.ts +17 -6
  150. package/src/client/nodes/use-surface-frame.ts +3 -1
  151. package/src/client/state/attention-bridge.ts +3 -0
  152. package/src/client/state/canvas-store.ts +273 -84
  153. package/src/client/state/human-store.ts +175 -0
  154. package/src/client/state/iframe-mode.ts +33 -9
  155. package/src/client/state/intent-bridge.ts +75 -13
  156. package/src/client/state/node-factory.ts +2 -8
  157. package/src/client/state/presence-store.ts +168 -0
  158. package/src/client/state/session-store.ts +419 -0
  159. package/src/client/state/sse-bridge.ts +93 -30
  160. package/src/client/theme/global.css +3069 -796
  161. package/src/client/types.ts +3 -1
  162. package/src/client/utils/platform.ts +6 -1
  163. package/src/mcp/canvas-access.ts +2 -2
  164. package/src/server/agent-presence.ts +755 -0
  165. package/src/server/ax-context.ts +45 -0
  166. package/src/server/ax-gate-ttl.ts +61 -0
  167. package/src/server/ax-interaction.ts +29 -1
  168. package/src/server/ax-state-manager.ts +78 -6
  169. package/src/server/ax-state.ts +82 -15
  170. package/src/server/ax-wait.ts +33 -0
  171. package/src/server/canvas-db.ts +237 -61
  172. package/src/server/canvas-operations.ts +17 -8
  173. package/src/server/canvas-state.ts +131 -58
  174. package/src/server/canvas-validation.ts +3 -53
  175. package/src/server/demo-state.json +2 -70
  176. package/src/server/html-surface.ts +11 -2
  177. package/src/server/human-presence.ts +160 -0
  178. package/src/server/index.ts +107 -4
  179. package/src/server/intent-registry.ts +13 -0
  180. package/src/server/mutation-history.ts +47 -2
  181. package/src/server/operations/composites.ts +6 -3
  182. package/src/server/operations/http.ts +10 -1
  183. package/src/server/operations/index.ts +4 -0
  184. package/src/server/operations/invoker.ts +33 -6
  185. package/src/server/operations/ops/ax-presence.ts +62 -0
  186. package/src/server/operations/ops/ax-read.ts +8 -0
  187. package/src/server/operations/ops/ax-state.ts +106 -1
  188. package/src/server/operations/ops/ax-timeline.ts +54 -5
  189. package/src/server/operations/ops/ax-work.ts +46 -0
  190. package/src/server/operations/ops/batch.ts +3 -1
  191. package/src/server/operations/ops/edges.ts +88 -2
  192. package/src/server/operations/ops/groups.ts +4 -3
  193. package/src/server/operations/ops/human-presence.ts +35 -0
  194. package/src/server/operations/ops/json-render.ts +11 -1
  195. package/src/server/operations/ops/nodes.ts +65 -16
  196. package/src/server/operations/ops/query.ts +1 -0
  197. package/src/server/operations/ops/snapshots.ts +16 -0
  198. package/src/server/operations/registry.ts +196 -1
  199. package/src/server/operations/types.ts +1 -1
  200. package/src/server/scope-fence.ts +207 -0
  201. package/src/server/server.ts +177 -79
  202. package/src/server/trace-manager.ts +0 -2
  203. package/src/server/web-artifacts.ts +0 -1
  204. package/src/shared/agent-presence.ts +162 -0
  205. package/src/shared/approval-gates.ts +35 -0
  206. package/src/shared/auto-arrange.ts +121 -13
  207. package/src/shared/ax-kinds.ts +23 -0
  208. package/src/shared/human-presence.ts +30 -0
  209. package/src/shared/iframe-probe.ts +8 -0
  210. package/src/shared/scope-fence.ts +31 -0
  211. package/dist/types/client/canvas/DockedNode.d.ts +0 -4
  212. package/src/client/canvas/DockedNode.tsx +0 -165
@@ -1,160 +1,160 @@
1
- var fk=Object.create;var{getPrototypeOf:rk,defineProperty:c2,getOwnPropertyNames:Ek}=Object;var mk=Object.prototype.hasOwnProperty;function ck($){return this[$]}var ik,xk,hk=($,v,g)=>{var _=$!=null&&typeof $==="object";if(_){var U=v?ik??=new WeakMap:xk??=new WeakMap,z=U.get($);if(z)return z}g=$!=null?fk(rk($)):{};let J=v||!$||!$.__esModule?c2(g,"default",{value:$,enumerable:!0}):g;for(let G of Ek($))if(!mk.call(J,G))c2(J,G,{get:ck.bind($,G),enumerable:!0});if(_)U.set($,J);return J};var lk=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var pk=($)=>$;function ok($,v){this[$]=pk.bind(null,v)}var $4=($,v)=>{for(var g in v)c2($,g,{get:v[g],enumerable:!0,configurable:!0,set:ok.bind(v,g)})};var ab=lk((db)=>{Object.defineProperty(db,"__esModule",{value:!0});var Vb=/highlight-(?:text|source)-([a-z0-9]+)/;function rb($){$.addRule("highlightedCodeBlock",{filter:function(v){var g=v.firstChild;return v.nodeName==="DIV"&&Vb.test(v.className)&&g&&g.nodeName==="PRE"},replacement:function(v,g,_){var U=g.className||"",z=(U.match(Vb)||[null,""])[1];return`
1
+ var LL=Object.create;var{getPrototypeOf:FL,defineProperty:K8,getOwnPropertyNames:PL}=Object;var kL=Object.prototype.hasOwnProperty;function bL($){return this[$]}var ML,AL,IL=($,U,v)=>{var J=$!=null&&typeof $==="object";if(J){var _=U?ML??=new WeakMap:AL??=new WeakMap,z=_.get($);if(z)return z}v=$!=null?LL(FL($)):{};let K=U||!$||!$.__esModule?K8(v,"default",{value:$,enumerable:!0}):v;for(let W of PL($))if(!kL.call(K,W))K8(K,W,{get:bL.bind($,W),enumerable:!0});if(J)_.set($,K);return K};var wL=($,U)=>()=>(U||$((U={exports:{}}).exports,U),U.exports);var gL=($)=>$;function NL($,U){this[$]=gL.bind(null,U)}var A4=($,U)=>{for(var v in U)K8($,v,{get:U[v],enumerable:!0,configurable:!0,set:NL.bind(U,v)})};var EZ=wL((fZ)=>{Object.defineProperty(fZ,"__esModule",{value:!0});var MZ=/highlight-(?:text|source)-([a-z0-9]+)/;function IZ($){$.addRule("highlightedCodeBlock",{filter:function(U){var v=U.firstChild;return U.nodeName==="DIV"&&MZ.test(U.className)&&v&&v.nodeName==="PRE"},replacement:function(U,v,J){var _=v.className||"",z=(_.match(MZ)||[null,""])[1];return`
2
2
 
3
- `+_.fence+z+`
4
- `+g.firstChild.textContent+`
5
- `+_.fence+`
3
+ `+J.fence+z+`
4
+ `+v.firstChild.textContent+`
5
+ `+J.fence+`
6
6
 
7
- `}})}function Eb($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var MP=Array.prototype.indexOf,SP=Array.prototype.every,N4={},NP={left:":---",right:"---:",center:":---:"},Sz=null,mb=null,fb=new WeakMap;function yP($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function cb($){return $?NP[$]:"---"}function ib($,v){var g={left:0,right:0,center:0,"":0},_="";for(var U=0;U<$.rows.length;++U){var z=$.rows[U];if(v<z.childNodes.length){var J=yP(z.childNodes[v]);if(++g[J],g[J]>g[_])_=J}}return _}N4.tableCell={filter:["th","td"],replacement:function($,v){if(yz(pb(v)))return $;return xb($,v)}};N4.tableRow={filter:"tr",replacement:function($,v){let g=pb(v);if(yz(g))return $;var _="";if(RP(v)){let J=ob(g);for(var U=0;U<J;U++){let G=U<v.childNodes.length?v.childNodes[U]:null;var z=cb(ib(g,U));_+=xb(z,G,U)}}return`
8
- `+$+(_?`
9
- `+_:"")}};N4.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(lb(v,mb)){let G=v.outerHTML,b=jP(v);if(b===null||!b.classList.contains("joplin-table-wrapper"))return`
7
+ `}})}function wZ($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(U){return"~~"+U+"~~"}})}var vP=Array.prototype.indexOf,JP=Array.prototype.every,U1={},zP={left:":---",right:"---:",center:":---:"},d8=null,gZ=null,AZ=new WeakMap;function KP($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function NZ($){return $?zP[$]:"---"}function SZ($,U){var v={left:0,right:0,center:0,"":0},J="";for(var _=0;_<$.rows.length;++_){var z=$.rows[_];if(U<z.childNodes.length){var K=KP(z.childNodes[U]);if(++v[K],v[K]>v[J])J=K}}return J}U1.tableCell={filter:["th","td"],replacement:function($,U){if(t8(CZ(U)))return $;return RZ($,U)}};U1.tableRow={filter:"tr",replacement:function($,U){let v=CZ(U);if(t8(v))return $;var J="";if(GP(U)){let K=DZ(v);for(var _=0;_<K;_++){let W=_<U.childNodes.length?U.childNodes[_]:null;var z=NZ(SZ(v,_));J+=RZ(z,W,_)}}return`
8
+ `+$+(J?`
9
+ `+J:"")}};U1.table={filter:function($,U){return $.nodeName==="TABLE"},replacement:function($,U){if(yZ(U,gZ)){let W=U.outerHTML,O=YP(U);if(O===null||!O.classList.contains("joplin-table-wrapper"))return`
10
10
 
11
- <div class="joplin-table-wrapper">${G}</div>
11
+ <div class="joplin-table-wrapper">${W}</div>
12
12
 
13
- `;else return G}else{if(yz(v))return $;$=$.replace(/\n+/g,`
14
- `);var g=$.trim().split(`
15
- `);if(g.length>=2)g=g[1];var _=/\| :?---/.test(g),U=ob(v),z="";if(U&&!_){z="|"+" |".repeat(U)+`
16
- |`;for(var J=0;J<U;++J)z+=" "+cb(ib(v,J))+" |"}let G=v.caption?v.caption.textContent||"":"",b=G?`${G}
13
+ `;else return W}else{if(t8(U))return $;$=$.replace(/\n+/g,`
14
+ `);var v=$.trim().split(`
15
+ `);if(v.length>=2)v=v[1];var J=/\| :?---/.test(v),_=DZ(U),z="";if(_&&!J){z="|"+" |".repeat(_)+`
16
+ |`;for(var K=0;K<_;++K)z+=" "+NZ(SZ(U,K))+" |"}let W=U.caption?U.caption.textContent||"":"",O=W?`${W}
17
17
 
18
- `:"",O=`${z}${$}`.trimStart();return`
18
+ `:"",Y=`${z}${$}`.trimStart();return`
19
19
 
20
- ${b}${O}
20
+ ${O}${Y}
21
21
 
22
- `}}};N4.tableCaption={filter:["caption"],replacement:()=>""};N4.tableColgroup={filter:["colgroup","col"],replacement:()=>""};N4.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function RP($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||DP(v))&&SP.call($.childNodes,function(g){return g.nodeName==="TH"})}function DP($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function xb($,v=null,g=null){if(g===null)g=MP.call(v.parentNode.childNodes,v);var _=" ";if(g===0)_="| ";let U=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");U=U.replace(/\|+/g,"\\|");while(U.length<3)U+=" ";if(v)U=uP(U,v," ");return _+U+" |"}function hb($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let g=$.childNodes[v];if(g.nodeName==="TABLE")return!0;if(hb(g))return!0}return!1}var Nz=($,v)=>{if(!$.childNodes)return!1;for(let g=0;g<$.childNodes.length;g++){let _=$.childNodes[g];if(v==="code"&&Sz&&Sz(_))return!0;if(v.includes(_.nodeName))return!0;if(Nz(_,v))return!0}return!1},lb=($,v)=>{let g=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)g.push("TABLE");return Nz($,"code")||Nz($,g)};function yz($){let v=fb.get($);if(v!==void 0)return v;let g=TP($);return fb.set($,g),g}function TP($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(hb($))return!0;return!1}function jP($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function pb($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function uP($,v,g){let _=v.getAttribute("colspan")||1;for(let U=1;U<_;U++)$+=" | "+g.repeat(3);return $}function ob($){let v=0;for(let g=0;g<$.rows.length;g++){let U=$.rows[g].childNodes.length;if(U>v)v=U}return v}function nb($){Sz=$.isCodeBlock,mb=$.options,$.keep(function(g){if(g.nodeName==="TABLE"&&lb(g,$.options))return!0;return!1});for(var v in N4)$.addRule(v,N4[v])}function tb($){$.addRule("taskListItems",{filter:function(v){let g=v.parentNode,_=g.parentNode;return v.type==="checkbox"&&(g.nodeName==="LI"||g.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,g){return(g.checked?"[x]":"[ ]")+" "}})}function CP($){$.use([rb,Eb,nb,tb])}db.gfm=CP;db.highlightedCodeBlock=rb;db.strikethrough=Eb;db.tables=nb;db.taskListItems=tb});if(typeof crypto<"u"&&typeof crypto.randomUUID!=="function")crypto.randomUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let v=Math.random()*16|0;return($==="x"?v:v&3|8).toString(16)});var Ag,H$,eK,l2,X4,tK,$7,v7,U7,p2,i2,x2,nk,Ig={},Qg=[],tk=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Mg=Array.isArray;function v4($,v){for(var g in v)$[g]=v[g];return $}function o2($){$&&$.parentNode&&$.parentNode.removeChild($)}function dk($,v,g){var _,U,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?U=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?Ag.call(arguments,2):g),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return Zg($,J,_,U,null)}function Zg($,v,g,_,U){var z={type:$,props:v,key:g,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:U==null?++eK:U,__i:-1,__u:0};return U==null&&H$.vnode!=null&&H$.vnode(z),z}function t$($){return $.children}function Fv($,v){this.props=$,this.context=v}function Zv($,v){if(v==null)return $.__?Zv($.__,$.__i+1):null;for(var g;v<$.__k.length;v++)if((g=$.__k[v])!=null&&g.__e!=null)return g.__e;return typeof $.type=="function"?Zv($):null}function ak($){if($.__P&&$.__d){var v=$.__v,g=v.__e,_=[],U=[],z=v4({},v);z.__v=v.__v+1,H$.vnode&&H$.vnode(z),n2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[g]:null,_,g==null?Zv(v):g,!!(32&v.__u),U),z.__v=v.__v,z.__.__k[z.__i]=z,J7(_,z,U),v.__e=v.__=null,z.__e!=g&&g7(z)}}function g7($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(v){if(v!=null&&v.__e!=null)return $.__e=$.__c.base=v.__e}),g7($)}function dK($){(!$.__d&&($.__d=!0)&&X4.push($)&&!wg.__r++||tK!=H$.debounceRendering)&&((tK=H$.debounceRendering)||$7)(wg)}function wg(){try{for(var $,v=1;X4.length;)X4.length>v&&X4.sort(v7),$=X4.shift(),v=X4.length,ak($)}finally{X4.length=wg.__r=0}}function _7($,v,g,_,U,z,J,G,b,O,W){var B,k,Y,F,X,H,q,L=_&&_.__k||Qg,I=v.length;for(b=sk(g,v,L,b,I),B=0;B<I;B++)(Y=g.__k[B])!=null&&(k=Y.__i!=-1&&L[Y.__i]||Ig,Y.__i=B,H=n2($,Y,k,U,z,J,G,b,O,W),F=Y.__e,Y.ref&&k.ref!=Y.ref&&(k.ref&&t2(k.ref,null,Y),W.push(Y.ref,Y.__c||F,Y)),X==null&&F!=null&&(X=F),(q=!!(4&Y.__u))||k.__k===Y.__k?b=z7(Y,b,$,q):typeof Y.type=="function"&&H!==void 0?b=H:F&&(b=F.nextSibling),Y.__u&=-7);return g.__e=X,b}function sk($,v,g,_,U){var z,J,G,b,O,W=g.length,B=W,k=0;for($.__k=Array(U),z=0;z<U;z++)(J=v[z])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=$.__k[z]=Zg(null,J,null,null,null):Mg(J)?J=$.__k[z]=Zg(t$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=Zg(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):$.__k[z]=J,b=z+k,J.__=$,J.__b=$.__b+1,G=null,(O=J.__i=ek(J,g,b,B))!=-1&&(B--,(G=g[O])&&(G.__u|=2)),G==null||G.__v==null?(O==-1&&(U>W?k--:U<W&&k++),typeof J.type!="function"&&(J.__u|=4)):O!=b&&(O==b-1?k--:O==b+1?k++:(O>b?k--:k++,J.__u|=4))):$.__k[z]=null;if(B)for(z=0;z<W;z++)(G=g[z])!=null&&(2&G.__u)==0&&(G.__e==_&&(_=Zv(G)),K7(G,G));return _}function z7($,v,g,_){var U,z;if(typeof $.type=="function"){for(U=$.__k,z=0;U&&z<U.length;z++)U[z]&&(U[z].__=$,v=z7(U[z],v,g,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=Zv($)),g.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function ek($,v,g,_){var U,z,J,G=$.key,b=$.type,O=v[g],W=O!=null&&(2&O.__u)==0;if(O===null&&G==null||W&&G==O.key&&b==O.type)return g;if(_>(W?1:0)){for(U=g-1,z=g+1;U>=0||z<v.length;)if((O=v[J=U>=0?U--:z++])!=null&&(2&O.__u)==0&&G==O.key&&b==O.type)return J}return-1}function aK($,v,g){v[0]=="-"?$.setProperty(v,g==null?"":g):$[v]=g==null?"":typeof g!="number"||tk.test(v)?g:g+"px"}function Fg($,v,g,_,U){var z,J;$:if(v=="style")if(typeof g=="string")$.style.cssText=g;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)g&&v in g||aK($.style,v,"");if(g)for(v in g)_&&g[v]==_[v]||aK($.style,v,g[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(U7,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=g,g?_?g.u=_.u:(g.u=p2,$.addEventListener(v,z?x2:i2,z)):$.removeEventListener(v,z?x2:i2,z);else{if(U=="http://www.w3.org/2000/svg")v=v.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(v!="width"&&v!="height"&&v!="href"&&v!="list"&&v!="form"&&v!="tabIndex"&&v!="download"&&v!="rowSpan"&&v!="colSpan"&&v!="role"&&v!="popover"&&v in $)try{$[v]=g==null?"":g;break $}catch(G){}typeof g=="function"||(g==null||g===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&g==1?"":g))}}function sK($){return function(v){if(this.l){var g=this.l[v.type+$];if(v.t==null)v.t=p2++;else if(v.t<g.u)return;return g(H$.event?H$.event(v):v)}}}function n2($,v,g,_,U,z,J,G,b,O){var W,B,k,Y,F,X,H,q,L,I,N,T,x,S,l,t=v.type;if(v.constructor!==void 0)return null;128&g.__u&&(b=!!(32&g.__u),z=[G=v.__e=g.__e]),(W=H$.__b)&&W(v);$:if(typeof t=="function")try{if(q=v.props,L=t.prototype&&t.prototype.render,I=(W=t.contextType)&&_[W.__c],N=W?I?I.props.value:W.__:_,g.__c?H=(B=v.__c=g.__c).__=B.__E:(L?v.__c=B=new t(q,N):(v.__c=B=new Fv(q,N),B.constructor=t,B.render=vq),I&&I.sub(B),B.state||(B.state={}),B.__n=_,k=B.__d=!0,B.__h=[],B._sb=[]),L&&B.__s==null&&(B.__s=B.state),L&&t.getDerivedStateFromProps!=null&&(B.__s==B.state&&(B.__s=v4({},B.__s)),v4(B.__s,t.getDerivedStateFromProps(q,B.__s))),Y=B.props,F=B.state,B.__v=v,k)L&&t.getDerivedStateFromProps==null&&B.componentWillMount!=null&&B.componentWillMount(),L&&B.componentDidMount!=null&&B.__h.push(B.componentDidMount);else{if(L&&t.getDerivedStateFromProps==null&&q!==Y&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(q,N),v.__v==g.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(q,B.__s,N)===!1){v.__v!=g.__v&&(B.props=q,B.state=B.__s,B.__d=!1),v.__e=g.__e,v.__k=g.__k,v.__k.some(function(M){M&&(M.__=v)}),Qg.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(q,B.__s,N),L&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(Y,F,X)})}if(B.context=N,B.props=q,B.__P=$,B.__e=!1,T=H$.__r,x=0,L)B.state=B.__s,B.__d=!1,T&&T(v),W=B.render(B.props,B.state,B.context),Qg.push.apply(B.__h,B._sb),B._sb=[];else do B.__d=!1,T&&T(v),W=B.render(B.props,B.state,B.context),B.state=B.__s;while(B.__d&&++x<25);B.state=B.__s,B.getChildContext!=null&&(_=v4(v4({},_),B.getChildContext())),L&&!k&&B.getSnapshotBeforeUpdate!=null&&(X=B.getSnapshotBeforeUpdate(Y,F)),S=W!=null&&W.type===t$&&W.key==null?G7(W.props.children):W,G=_7($,Mg(S)?S:[S],v,g,_,U,z,J,G,b,O),B.base=v.__e,v.__u&=-161,B.__h.length&&J.push(B),H&&(B.__E=B.__=null)}catch(M){if(v.__v=null,b||z!=null)if(M.then){for(v.__u|=b?160:128;G&&G.nodeType==8&&G.nextSibling;)G=G.nextSibling;z[z.indexOf(G)]=null,v.__e=G}else{for(l=z.length;l--;)o2(z[l]);h2(v)}else v.__e=g.__e,v.__k=g.__k,M.then||h2(v);H$.__e(M,v,g)}else z==null&&v.__v==g.__v?(v.__k=g.__k,v.__e=g.__e):G=v.__e=$q(g.__e,v,g,_,U,z,J,b,O);return(W=H$.diffed)&&W(v),128&v.__u?void 0:G}function h2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(h2))}function J7($,v,g){for(var _=0;_<g.length;_++)t2(g[_],g[++_],g[++_]);H$.__c&&H$.__c(v,$),$.some(function(U){try{$=U.__h,U.__h=[],$.some(function(z){z.call(U)})}catch(z){H$.__e(z,U.__v)}})}function G7($){return typeof $!="object"||$==null||$.__b>0?$:Mg($)?$.map(G7):v4({},$)}function $q($,v,g,_,U,z,J,G,b){var O,W,B,k,Y,F,X,H=g.props||Ig,q=v.props,L=v.type;if(L=="svg"?U="http://www.w3.org/2000/svg":L=="math"?U="http://www.w3.org/1998/Math/MathML":U||(U="http://www.w3.org/1999/xhtml"),z!=null){for(O=0;O<z.length;O++)if((Y=z[O])&&"setAttribute"in Y==!!L&&(L?Y.localName==L:Y.nodeType==3)){$=Y,z[O]=null;break}}if($==null){if(L==null)return document.createTextNode(q);$=document.createElementNS(U,L,q.is&&q),G&&(H$.__m&&H$.__m(v,z),G=!1),z=null}if(L==null)H===q||G&&$.data==q||($.data=q);else{if(z=z&&Ag.call($.childNodes),!G&&z!=null)for(H={},O=0;O<$.attributes.length;O++)H[(Y=$.attributes[O]).name]=Y.value;for(O in H)Y=H[O],O=="dangerouslySetInnerHTML"?B=Y:O=="children"||(O in q)||O=="value"&&("defaultValue"in q)||O=="checked"&&("defaultChecked"in q)||Fg($,O,null,Y,U);for(O in q)Y=q[O],O=="children"?k=Y:O=="dangerouslySetInnerHTML"?W=Y:O=="value"?F=Y:O=="checked"?X=Y:G&&typeof Y!="function"||H[O]===Y||Fg($,O,Y,H[O],U);if(W)G||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),_7(v.type=="template"?$.content:$,Mg(k)?k:[k],v,g,_,L=="foreignObject"?"http://www.w3.org/1999/xhtml":U,z,J,z?z[0]:g.__k&&Zv(g,0),G,b),z!=null)for(O=z.length;O--;)o2(z[O]);G||(O="value",L=="progress"&&F==null?$.removeAttribute("value"):F!=null&&(F!==$[O]||L=="progress"&&!F||L=="option"&&F!=H[O])&&Fg($,O,F,H[O],U),O="checked",X!=null&&X!=$[O]&&Fg($,O,X,H[O],U))}return $}function t2($,v,g){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(U){H$.__e(U,g)}}function K7($,v,g){var _,U;if(H$.unmount&&H$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||t2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){H$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(U=0;U<_.length;U++)_[U]&&K7(_[U],v,g||typeof $.type!="function");g||o2($.__e),$.__c=$.__=$.__e=void 0}function vq($,v,g){return this.constructor($,g)}function b7($,v,g){var _,U,z,J;v==document&&(v=document.documentElement),H$.__&&H$.__($,v),U=(_=typeof g=="function")?null:g&&g.__k||v.__k,z=[],J=[],n2(v,$=(!_&&g||v).__k=dk(t$,null,[$]),U||Ig,Ig,v.namespaceURI,!_&&g?[g]:U?null:v.firstChild?Ag.call(v.childNodes):null,z,!_&&g?g:U?U.__e:v.firstChild,_,J),J7(z,$,J)}Ag=Qg.slice,H$={__e:function($,v,g,_){for(var U,z,J;v=v.__;)if((U=v.__c)&&!U.__)try{if((z=U.constructor)&&z.getDerivedStateFromError!=null&&(U.setState(z.getDerivedStateFromError($)),J=U.__d),U.componentDidCatch!=null&&(U.componentDidCatch($,_||{}),J=U.__d),J)return U.__E=U}catch(G){$=G}throw $}},eK=0,l2=function($){return $!=null&&$.constructor===void 0},Fv.prototype.setState=function($,v){var g;g=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v4({},this.state),typeof $=="function"&&($=$(v4({},g),this.props)),$&&v4(g,$),$!=null&&this.__v&&(v&&this._sb.push(v),dK(this))},Fv.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),dK(this))},Fv.prototype.render=t$,X4=[],$7=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,v7=function($,v){return $.__v.__b-v.__v.__b},wg.__r=0,U7=/(PointerCapture)$|Capture$/i,p2=0,i2=sK(!1),x2=sK(!0),nk=0;var Iv,i$,d2,O7,hU=0,H7=[],l$=H$,W7=l$.__b,B7=l$.__r,Y7=l$.diffed,k7=l$.__c,q7=l$.unmount,P7=l$.__;function Ng($,v){l$.__h&&l$.__h(i$,$,hU||v),hU=0;var g=i$.__H||(i$.__H={__:[],__h:[]});return $>=g.__.length&&g.__.push({}),g.__[$]}function i($){return hU=1,Uq(L7,$)}function Uq($,v,g){var _=Ng(Iv++,2);if(_.t=$,!_.__c&&(_.__=[g?g(v):L7(void 0,v),function(G){var b=_.__N?_.__N[0]:_.__[0],O=_.t(b,G);b!==O&&(_.__N=[O,_.__[1]],_.__c.setState({}))}],_.__c=i$,!i$.__f)){var U=function(G,b,O){if(!_.__c.__H)return!0;var W=_.__c.__H.__.filter(function(k){return k.__c});if(W.every(function(k){return!k.__N}))return!z||z.call(this,G,b,O);var B=_.__c.props!==G;return W.some(function(k){if(k.__N){var Y=k.__[0];k.__=k.__N,k.__N=void 0,Y!==k.__[0]&&(B=!0)}}),z&&z.call(this,G,b,O)||B};i$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:J}=i$;i$.componentWillUpdate=function(G,b,O){if(this.__e){var W=z;z=void 0,U(G,b,O),z=W}J&&J.call(this,G,b,O)},i$.shouldComponentUpdate=U}return _.__N||_.__}function r($,v){var g=Ng(Iv++,3);!l$.__s&&s2(g.__H,v)&&(g.__=$,g.u=v,i$.__H.__h.push(g))}function yg($,v){var g=Ng(Iv++,4);!l$.__s&&s2(g.__H,v)&&(g.__=$,g.u=v,i$.__h.push(g))}function D($){return hU=5,D$(function(){return{current:$}},[])}function D$($,v){var g=Ng(Iv++,7);return s2(g.__H,v)&&(g.__=$(),g.__H=v,g.__h=$),g.__}function y($,v){return hU=8,D$(function(){return $},v)}function gq(){for(var $;$=H7.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(Sg),v.__h.some(a2),v.__h=[]}catch(g){v.__h=[],l$.__e(g,$.__v)}}}l$.__b=function($){i$=null,W7&&W7($)},l$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),P7&&P7($,v)},l$.__r=function($){B7&&B7($),Iv=0;var v=(i$=$.__c).__H;v&&(d2===i$?(v.__h=[],i$.__h=[],v.__.some(function(g){g.__N&&(g.__=g.__N),g.u=g.__N=void 0})):(v.__h.some(Sg),v.__h.some(a2),v.__h=[],Iv=0)),d2=i$},l$.diffed=function($){Y7&&Y7($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(H7.push(v)!==1&&O7===l$.requestAnimationFrame||((O7=l$.requestAnimationFrame)||_q)(gq)),v.__H.__.some(function(g){g.u&&(g.__H=g.u),g.u=void 0})),d2=i$=null},l$.__c=function($,v){v.some(function(g){try{g.__h.some(Sg),g.__h=g.__h.filter(function(_){return!_.__||a2(_)})}catch(_){v.some(function(U){U.__h&&(U.__h=[])}),v=[],l$.__e(_,g.__v)}}),k7&&k7($,v)},l$.unmount=function($){q7&&q7($);var v,g=$.__c;g&&g.__H&&(g.__H.__.some(function(_){try{Sg(_)}catch(U){v=U}}),g.__H=void 0,v&&l$.__e(v,g.__v))};var X7=typeof requestAnimationFrame=="function";function _q($){var v,g=function(){clearTimeout(_),X7&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(g,35);X7&&(v=requestAnimationFrame(g))}function Sg($){var v=i$,g=$.__c;typeof g=="function"&&($.__c=void 0,g()),i$=v}function a2($){var v=i$;$.__c=$.__(),i$=v}function s2($,v){return!$||$.length!==v.length||v.some(function(g,_){return g!==$[_]})}function L7($,v){return typeof v=="function"?v($):v}var zq=Symbol.for("preact-signals");function jg(){if(!(U4>1)){var $,v=!1;(function(){var U=Dg;Dg=void 0;while(U!==void 0){if(U.S.v===U.v)U.S.i=U.i;U=U.o}})();while(lU!==void 0){var g=lU;lU=void 0,Rg++;while(g!==void 0){var _=g.u;if(g.u=void 0,g.f&=-3,!(8&g.f)&&I7(g))try{g.c()}catch(U){if(!v)$=U,v=!0}g=_}}if(Rg=0,U4--,v)throw $}else U4--}function g4($){if(U4>0)return $();e2=++Jq,U4++;try{return $()}finally{jg()}}var w$=void 0;function $z($){var v=w$;w$=void 0;try{return $()}finally{w$=v}}var F7,lU=void 0,U4=0,Rg=0,Jq=0,e2=0,Dg=void 0,Tg=0;function Z7($){if(w$!==void 0){var v=$.n;if(v===void 0||v.t!==w$){if(v={i:0,S:$,p:w$.s,n:void 0,t:w$,e:void 0,x:void 0,r:v},w$.s!==void 0)w$.s.n=v;if(w$.s=v,$.n=v,32&w$.f)$.S(v);return v}else if(v.i===-1){if(v.i=0,v.n!==void 0){if(v.n.p=v.p,v.p!==void 0)v.p.n=v.n;v.p=w$.s,v.n=void 0,w$.s.n=v,w$.s=v}return v}}}function d$($,v){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}d$.prototype.brand=zq;d$.prototype.h=function(){return!0};d$.prototype.S=function($){var v=this,g=this.t;if(g!==$&&$.e===void 0)if($.x=g,this.t=$,g!==void 0)g.e=$;else $z(function(){var _;(_=v.W)==null||_.call(v)})};d$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:g,x:_}=$;if(g!==void 0)g.x=_,$.e=void 0;if(_!==void 0)_.e=g,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)$z(function(){var U;(U=v.Z)==null||U.call(v)})}}};d$.prototype.subscribe=function($){var v=this;return H4(function(){var g=v.value,_=w$;w$=void 0;try{$(g)}finally{w$=_}},{name:"sub"})};d$.prototype.valueOf=function(){return this.value};d$.prototype.toString=function(){return this.value+""};d$.prototype.toJSON=function(){return this.value};d$.prototype.peek=function(){var $=w$;w$=void 0;try{return this.value}finally{w$=$}};Object.defineProperty(d$.prototype,"value",{get:function(){var $=Z7(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(Rg>100)throw Error("Cycle detected");(function(g){if(U4!==0&&Rg===0){if(g.l!==e2)g.l=e2,Dg={S:g,v:g.v,i:g.i,o:Dg}}})(this),this.v=$,this.i++,Tg++,U4++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{jg()}}}});function B$($,v){return new d$($,v)}function I7($){for(var v=$.s;v!==void 0;v=v.n)if(v.S.i!==v.i||!v.S.h()||v.S.i!==v.i)return!0;return!1}function Q7($){for(var v=$.s;v!==void 0;v=v.n){var g=v.S.n;if(g!==void 0)v.r=g;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function w7($){var v=$.s,g=void 0;while(v!==void 0){var _=v.p;if(v.i===-1){if(v.S.U(v),_!==void 0)_.n=v.n;if(v.n!==void 0)v.n.p=_}else g=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=g}function $v($,v){d$.call(this,void 0),this.x=$,this.s=void 0,this.g=Tg-1,this.f=4,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}$v.prototype=new d$;$v.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===Tg)return!0;if(this.g=Tg,this.f|=1,this.i>0&&!I7(this))return this.f&=-2,!0;var $=w$;try{Q7(this),w$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(g){this.v=g,this.f|=16,this.i++}return w$=$,w7(this),this.f&=-2,!0};$v.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var v=this.s;v!==void 0;v=v.n)v.S.S(v)}d$.prototype.S.call(this,$)};$v.prototype.U=function($){if(this.t!==void 0){if(d$.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var v=this.s;v!==void 0;v=v.n)v.S.U(v)}}};$v.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty($v.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=Z7(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function vv($,v){return new $v($,v)}function A7($){var v=$.m;if($.m=void 0,typeof v=="function"){U4++;var g=w$;w$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,vz($),_}finally{w$=g,jg()}}}function vz($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,A7($)}function Gq($){if(w$!==this)throw Error("Out-of-order effect");if(w7(this),w$=$,this.f&=-2,8&this.f)vz(this);jg()}function Qv($,v){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=v==null?void 0:v.name,F7)F7.push(this)}Qv.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var v=this.x();if(typeof v=="function")this.m=v}finally{$()}};Qv.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,A7(this),Q7(this),U4++;var $=w$;return w$=this,Gq.bind(this,$)};Qv.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=lU,lU=this};Qv.prototype.d=function(){if(this.f|=8,!(1&this.f))vz(this)};Qv.prototype.dispose=function(){this.d()};function H4($,v){var g=new Qv($,v);try{g.c()}catch(U){throw g.d(),U}var _=g.d.bind(g);return _[Symbol.dispose]=_,_}var Uz,gz,ug,Kq=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,M7=[],S7=[];H4(function(){Uz=this.N})();function wv($,v){H$[$]=v.bind(null,H$[$]||function(){})}function Cg($){if(ug){var v=ug;ug=void 0,v()}ug=$&&$.S()}function N7($){var v=this,g=$.data,_=Oq(g);_.value=g;var U=D$(function(){var G=v,b=v.__v;while(b=b.__)if(b.__c){b.__c.__$f|=4;break}var O=vv(function(){var Y=_.value.value;return Y===0?0:Y===!0?"":Y||""}),W=vv(function(){return!Array.isArray(O.value)&&!l2(O.value)}),B=H4(function(){if(this.N=y7,W.value){var Y=O.value;if(G.__v&&G.__v.__e&&G.__v.__e.nodeType===3)G.__v.__e.data=Y}}),k=v.__$u.d;return v.__$u.d=function(){B(),k.call(this)},[W,O]},[]),z=U[0],J=U[1];return z.value?J.peek():J.value}N7.displayName="ReactiveTextNode";Object.defineProperties(d$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:N7},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});wv("__b",function($,v){if(typeof v.type=="string"){var g,_=v.props;for(var U in _)if(U!=="children"){var z=_[U];if(z instanceof d$){if(!g)v.__np=g={};g[U]=z,_[U]=z.peek()}}}$(v)});wv("__r",function($,v){if($(v),v.type!==t$){Cg();var g,_=v.__c;if(_){if(_.__$f&=-2,(g=_.__$u)===void 0)_.__$u=g=function(U,z){var J;return H4(function(){J=this},{name:z}),J.c=U,J}(function(){var U;if(Kq)(U=g.y)==null||U.call(g);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}gz=_,Cg(g)}});wv("__e",function($,v,g,_){Cg(),gz=void 0,$(v,g,_)});wv("diffed",function($,v){Cg(),gz=void 0;var g;if(typeof v.type=="string"&&(g=v.__e)){var{__np:_,props:U}=v;if(_){var z=g.U;if(z)for(var J in z){var G=z[J];if(G!==void 0&&!(J in _))G.d(),z[J]=void 0}else z={},g.U=z;for(var b in _){var O=z[b],W=_[b];if(O===void 0)O=bq(g,b,W),z[b]=O;else O.o(W,U)}for(var B in _)U[B]=_[B]}}$(v)});function bq($,v,g,_){var U=v in $&&$.ownerSVGElement===void 0,z=B$(g),J=g.peek();return{o:function(G,b){z.value=G,J=G.peek()},d:H4(function(){this.N=y7;var G=z.value.value;if(J!==G)if(J=void 0,U)$[v]=G;else if(G!=null&&(G!==!1||v[4]==="-"))$.setAttribute(v,G);else $.removeAttribute(v);else J=void 0})}}wv("unmount",function($,v){if(typeof v.type=="string"){var g=v.__e;if(g){var _=g.U;if(_){g.U=void 0;for(var U in _){var z=_[U];if(z)z.d()}}}v.__np=void 0}else{var J=v.__c;if(J){var G=J.__$u;if(G)J.__$u=void 0,G.d()}}$(v)});wv("__h",function($,v,g,_){if(_<3||_===9)v.__$f|=2;$(v,g,_)});Fv.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var g=this.__$u,_=g&&g.s!==void 0;for(var U in v)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(_||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(_||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var J in $)if(J!=="__source"&&$[J]!==this.props[J])return!0;for(var G in this.props)if(!(G in $))return!0;return!1};function Oq($,v){return D$(function(){return B$($,v)},[])}var Wq=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(g),cancelAnimationFrame(_),$()},g=setTimeout(v,35),_=requestAnimationFrame(v)},Bq=function($){queueMicrotask(function(){queueMicrotask($)})};function Yq(){g4(function(){var $;while($=M7.shift())Uz.call($)})}function kq(){if(M7.push(this)===1)(H$.requestAnimationFrame||Wq)(Yq)}function qq(){g4(function(){var $;while($=S7.shift())Uz.call($)})}function y7(){if(S7.push(this)===1)(H$.requestAnimationFrame||Bq)(qq)}function R7($,v){var g=D($);g.current=$,r(function(){return H4(function(){return this.N=kq,g.current()},v)},[])}var Vg=B$(null),pU=B$([]),Mv=B$(new Set),Sv=B$(new Set),fg=B$([]),rg=B$(new Set),L4=B$(!1),Av=B$(0);function D7(){Vg.value=null,pU.value=[],Mv.value=new Set,Sv.value=new Set,fg.value=[],rg.value=new Set,L4.value=!1,Av.value=0}function Eg(){L4.value=!0,Av.value=0}function mg(){L4.value=!1}function T7($,v,g){Mv.value=new Set($),Sv.value=new Set(v),fg.value=g}function cg($){Vg.value=$}function j7($,v=6){if(pU.value=[$,...pU.value].slice(0,v),!L4.value)Av.value=Math.min(99,Av.value+1)}function ig($){rg.value=new Set($)}var v6={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",diff:"DIFF",mermaid:"MERMAID",image:"IMG",html:"HTML",group:"GROUP"},xg=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","diff","mermaid","image","html"]);function u7($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function C7($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:U}=Number;for(let z of $)v=Math.min(v,z.position.x),g=Math.min(g,z.position.y),_=Math.max(_,z.position.x+z.size.width),U=Math.max(U,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(g))return null;return{x:v-40,y:g-40-32,width:_-v+80,height:U-g+80+32}}function Pq($){let v=$.filter((b)=>!b.pinned&&b.dockPosition===null),g=new Map(v.map((b)=>[b.id,b])),_=new Map,U=[],z=new Map;for(let b of v){if(b.type==="group")continue;let O=typeof b.data.parentGroup==="string"?b.data.parentGroup:"",W=O?g.get(O):void 0;if(!W||W.type!=="group")continue;if(!z.has(O))z.set(O,[]);z.get(O).push(b)}let J=v.filter((b)=>b.type==="group").sort((b,O)=>b.position.y-O.position.y||b.position.x-O.position.x);for(let b of J){let O=z.get(b.id)??[];if(O.length===0){let Y=`unit:${b.id}`;U.push({id:Y,memberIds:[b.id],origin:{...b.position},size:{...b.size},sortKey:{x:b.position.x,y:b.position.y}}),_.set(b.id,Y);continue}let W=O.map((Y)=>({position:Y.position,size:Y.size})),B=C7(W);if(!B)continue;let k=`group:${b.id}`;U.push({id:k,memberIds:O.map((Y)=>Y.id),origin:{x:B.x,y:B.y},size:{width:B.width,height:B.height},sortKey:{x:B.x,y:B.y},groupId:b.id}),_.set(b.id,k);for(let Y of O)_.set(Y.id,k)}let G=v.filter((b)=>!_.has(b.id)).sort((b,O)=>b.position.y-O.position.y||b.position.x-O.position.x);for(let b of G){let O=`unit:${b.id}`;U.push({id:O,memberIds:[b.id],origin:{...b.position},size:{...b.size},sortKey:{x:b.position.x,y:b.position.y}}),_.set(b.id,O)}return{units:U,nodesById:g,nodeToUnit:_}}function Xq($,v,g){let _=new Map,U=new Map,z=new Map,J=new Map;for(let G of $)_.set(G.id,new Set),U.set(G.id,new Set),z.set(G.id,0),J.set(G.id,0);for(let G of g){let b=v.get(G.from),O=v.get(G.to);if(!b||!O||b===O)continue;if(!_.get(b).has(O))_.get(b).add(O),J.set(b,(J.get(b)??0)+1),z.set(O,(z.get(O)??0)+1);U.get(b).add(O),U.get(O).add(b)}return{outgoing:_,undirected:U,indegree:z,outdegree:J}}function Hq($,v){let g=new Map($.map((z)=>[z.id,z])),_=new Set,U=[];for(let z of $){if(_.has(z.id))continue;let J=[z.id],G=[];_.add(z.id);while(J.length>0){let O=J.pop();G.push(O);for(let W of v.get(O)??[]){if(_.has(W))continue;_.add(W),J.push(W)}}let b=G.map((O)=>g.get(O)).filter((O)=>O!==void 0).sort((O,W)=>O.sortKey.y-W.sortKey.y||O.sortKey.x-W.sortKey.x);U.push(b)}return U.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function Lq($){let v=new Map,g=0,_=0,U=0,z=0,J=Math.max(900,Math.ceil(Math.sqrt($.reduce((G,b)=>G+b.size.width*b.size.height,0))));for(let G of $){if(g>0&&g+G.size.width>J)g=0,_+=U+72,U=0;v.set(G.id,{x:g,y:_}),g+=G.size.width+96,U=Math.max(U,G.size.height),z=Math.max(z,g-96)}return{positions:v,size:{width:Math.max(0,z),height:_+U},sortKey:$[0].sortKey}}function Fq($,v,g,_,U){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((L)=>L.id)),J=$.filter((L)=>(_.get(L.id)??0)===0&&(U.get(L.id)??0)>0).sort((L,I)=>L.sortKey.x-I.sortKey.x||L.sortKey.y-I.sortKey.y),G=J.length>0?J:[$.slice().sort((L,I)=>L.sortKey.x-I.sortKey.x||L.sortKey.y-I.sortKey.y)[0]],b=new Map,O=G.map((L)=>L.id);for(let L of G)b.set(L.id,0);while(O.length>0){let L=O.shift(),I=b.get(L)??0;for(let N of g.get(L)??[]){if(!z.has(N)||b.has(N))continue;b.set(N,I+1),O.push(N)}}let W=0;for(let L of $){if(b.has(L.id))continue;b.set(L.id,W),W+=1}let B=new Map;for(let L of $){let I=b.get(L.id)??0;if(!B.has(I))B.set(I,[]);B.get(I).push(L)}let k=Array.from(B.keys()).sort((L,I)=>L-I);for(let L of k)B.get(L).sort((I,N)=>I.sortKey.y-N.sortKey.y||I.sortKey.x-N.sortKey.x);let Y=new Map,F=new Map,X=0;for(let L of k){let I=B.get(L),N=I.reduce((x,S,l)=>x+S.size.height+(l>0?72:0),0),T=Math.max(...I.map((x)=>x.size.width));Y.set(L,N),F.set(L,T),X=Math.max(X,N)}let H=new Map,q=0;for(let L of k){let I=B.get(L),N=Y.get(L)??0,T=F.get(L)??0,x=Math.max(0,(X-N)/2);for(let S of I)H.set(S.id,{x:q,y:x}),x+=S.size.height+72;q+=T+96}return{positions:H,size:{width:Math.max(0,q-96),height:X},sortKey:$[0].sortKey}}function Zq($){let v=new Map,g=40,_=80,U=0;for(let z of $){if(g>40&&g+z.size.width>3200)g=40,_+=U+180,U=0;for(let[J,G]of z.positions.entries())v.set(J,{x:g+G.x,y:_+G.y});g+=z.size.width+220,U=Math.max(U,z.size.height)}return v}function _z($,v,g){let{units:_,nodesById:U,nodeToUnit:z}=Pq($),J=new Map,G=new Map;if(_.length===0)return{nodePositions:J,groupBounds:G};let{outgoing:b,undirected:O,indegree:W,outdegree:B}=Xq(_,z,v),k=Hq(_,O).map((F)=>g==="graph"?Fq(F,b,O,W,B):Lq(F)),Y=Zq(k);for(let F of _){let X=Y.get(F.id);if(!X)continue;let H=X.x-F.origin.x,q=X.y-F.origin.y;if(F.groupId){let N=[];for(let x of F.memberIds){let S=U.get(x);if(!S)continue;let l={x:S.position.x+H,y:S.position.y+q};J.set(x,l),N.push({position:l,size:S.size})}let T=C7(N);if(T)G.set(F.groupId,T);continue}let L=F.memberIds[0],I=U.get(L);if(!I)continue;J.set(L,{x:I.position.x+H,y:I.position.y+q})}return{nodePositions:J,groupBounds:G}}function zz($,v){console.error(`[intent-bridge] ${$} failed`,v)}function Jz($){return{...$,headers:{...$?.headers,"X-PMX-Workbench":"1"}}}async function x$($,v,g,_){try{return await(await fetch(v,Jz(_))).json()}catch(U){return zz($,U),g}}async function Iq($,v,g){try{return{ok:(await fetch(v,Jz(g))).ok}}catch(_){return zz($,_),{ok:!1}}}async function Gz($,v,g){try{await fetch(v,Jz(g))}catch(_){zz($,_)}}async function V7($,v={}){return x$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function Kz($){let g=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await x$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await Gz("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:g,source:"browser"})}),!0}async function _4($){return(await x$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function oU($){return x$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function f7($,v){return x$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function hg($){return Iq("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function lg($){return x$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function r7(){return[]}async function nU($,v,g,_,U){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return x$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...g?{parentNodeId:g}:{},..._&&_.length>0?{contextNodeIds:_}:{},...U?{threadNodeId:U}:{}})})}async function E7($,v){return nU(v,void 0,void 0,void 0,$)}async function m7($,v={}){await Gz("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function Nv($,v,g,_){return x$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:g,label:_})})}async function l6($){return x$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function k6($,v){return x$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function pg($,v){return x$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v?{url:v}:{})})}async function og($){return x$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function c7(){return x$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function i7($,v){return x$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function ng($){return x$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function x7($,v={}){return x$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...h7(),...v.recordHistory===!1?{recordHistory:!1}:{}})})}function h7(){if(typeof window>"u")return{};let{innerWidth:$,innerHeight:v}=window;if(!$||!v)return{};return{clientWidth:$,clientHeight:v}}async function tg(){let $=h7();if(!("clientWidth"in $))return;await Gz("reportClientViewportSize","/api/canvas/viewport",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,recordHistory:!1})})}async function dg($){return x$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function l7($){return x$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function p7(){return x$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function o7($){return x$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function n7($){return x$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function t7($){return x$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function tU($,v){console.error(`[canvas-store] ${$} failed`,v)}var X$=B$({x:0,y:0,scale:1}),u=B$(new Map),h$=B$(new Map),Rv=B$(new Map),V$=B$(null),o6=B$("connecting"),dU=B$(0),Uv=B$(""),sg=B$(!1),c$=B$("dark"),Z4=B$(!1),I4=B$(null),m$=B$(null),p6=B$(null),M6=null,yv,d7=100,Qq=2500,eg=B$(null),T6=B$(null),Q4=B$(null),p$=B$(new Set),f$=B$(new Set);function e7($,v){if(!$)return new Set;let g=new Set;for(let _ of v.values()){if(_.from===$)g.add(_.to);if(_.to===$)g.add(_.from)}return g}var $b=vv(()=>e7(V$.value,h$.value));function a7($,v){let g=new Set;for(let _ of $)if(v.has(_))g.add(_);return g}function s7($,v){if($.size!==v.size)return!1;for(let g of $)if(!v.has(g))return!1;return!0}function vb($){let v=new Set(p$.value);if(v.has($))v.delete($);else v.add($);p$.value=v}function Ub($){p$.value=new Set($)}function E6(){if(p$.value.size===0)return;p$.value=new Set}function Dv($){let v=new Set(f$.value);if(v.has($))v.delete($);else v.add($);f$.value=v,a$(),$_(v)}function gb($){let v=new Set(f$.value);for(let g of $)v.add(g);f$.value=v,a$(),$_(v)}function _b(){if(f$.value.size===0)return;f$.value=new Set,a$(),$_(new Set)}function zb($){f$.value=new Set($)}function Jb(){let $=f$.value;if($.size===0)return[];return Array.from($).map((v)=>u.value.get(v)).filter((v)=>v!==void 0)}function $_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{tU("syncContextPinsToServer",v)})}var ag=1;function z4($){g4(()=>{let v=new Map(u.value);if($.zIndex>=ag)ag=$.zIndex+1;v.set($.id,$),u.value=v,V$.value=$.id})}function q6($,v){Oz($,v)}function Oz($,v,g={}){let _=u.value.get($);if(!_)return;let U=new Map(u.value);if(_.type==="group"&&v.position&&g.skipGroupChildTranslation!==!0){let J=v.position.x-_.position.x,G=v.position.y-_.position.y;if(J!==0||G!==0){let b=Array.isArray(_.data.children)?_.data.children.filter((O)=>typeof O==="string"):[];for(let O of b){let W=U.get(O);if(!W||W.type==="group")continue;U.set(O,{...W,position:{x:W.position.x+J,y:W.position.y+G}})}}}U.set($,{..._,...v}),u.value=U;let z=U.get($)?.data.appCheckpoint?.updatedAt;if(p6.value===$&&z!==void 0&&z!==yv)bz($)}function g$($,v){let g=u.value.get($);if(!g)return;q6($,{data:{...g.data,...v}})}function Tv($){wq($);let v=new Map(u.value);if(v.delete($),u.value=v,V$.value===$)V$.value=null;if(m$.value===$)m$.value=null;if(p$.value.has($)){let g=new Set(p$.value);g.delete($),p$.value=g}if(f$.value.has($)){let g=new Set(f$.value);g.delete($),f$.value=g,$_(g)}}function v_($){let v=new Map(h$.value);v.set($.id,$),h$.value=v}function Gb($){let v=new Map(h$.value);v.delete($),h$.value=v}function wq($){let v=!1,g=new Map(h$.value);for(let[_,U]of g)if(U.from===$||U.to===$)g.delete(_),v=!0;if(v)h$.value=g}function Aq($){let v=new Map(Rv.value);if(!v.delete($))return;Rv.value=v}async function Wz($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return tU("createAnnotationFromClient",v),{ok:!1}}}async function Kb($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)Aq($);return{ok:v.ok}}catch(v){return tU("removeAnnotationFromClient",v),{ok:!1}}}function jv($,v){if(!u.value.get($))return;q6($,{size:v})}function w4($){if(!u.value.get($))return;q6($,{zIndex:ag++}),V$.value=$}function A4($){let v=u.value.get($);if(!v)return;q6($,{collapsed:!v.collapsed})}function bb(){for(let $ of u.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)q6($.id,{collapsed:!0})}var U_=vv(()=>{for(let $ of u.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function Bz($,v){if(!u.value.get($))return;q6($,{dockPosition:v}),a$()}function uv($){let v=u.value.get($);if(!v)return;let g=X$.value,_=(window.innerWidth/2-g.x)/g.scale,U=(window.innerHeight/2-g.y)/g.scale;q6($,{dockPosition:null,position:{x:_-v.size.width/2,y:U-v.size.height/2}}),a$()}function Ob($){X$.value={...X$.value,...$}}function Wb($){X$.value=$}function Bb($){Yb($)}function Yb($,v={}){X$.value=$,a$(v),x7($,v)}function kb($,v={}){let g=new Map,_=1;for(let B of $.nodes)if(g.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let U=$.edges.filter((B)=>g.has(B.from)&&g.has(B.to)),z=new Map;for(let B of U)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let G=V$.value!==null&&g.has(V$.value)?V$.value:null,b=m$.value!==null&&g.has(m$.value)?m$.value:null,O=a7(p$.value,g),W=a7(f$.value,g);g4(()=>{if(v.applyViewport===!0&&$.viewport)X$.value=$.viewport;if(ag=_,u.value=g,h$.value=z,Rv.value=J,V$.value=G,m$.value=b,!s7(p$.value,O))p$.value=O;if(!s7(f$.value,W))f$.value=W})}var F4=null;function Mq($){return 1-(1-$)**3}function aU($,v=150){let g=X$.value,_=Math.min(4,Math.max(0.1,g.scale*$));if(_===g.scale)return;let U=_/g.scale,z=window.innerWidth/2,J=window.innerHeight/2;gv({x:z-U*(z-g.x),y:J-U*(J-g.y),scale:_},v)}function gv($,v=300,g={}){if(F4!==null)cancelAnimationFrame(F4);let _={...X$.value},U=performance.now();function z(J){let G=J-U,b=Math.min(1,G/v),O=Mq(b);if(X$.value={x:_.x+($.x-_.x)*O,y:_.y+($.y-_.y)*O,scale:_.scale+($.scale-_.scale)*O},b<1)F4=requestAnimationFrame(z);else F4=null,Yb($,g)}F4=requestAnimationFrame(z)}function Cv(){if(F4!==null)cancelAnimationFrame(F4),F4=null}var qb="pmx-canvas-layout";function a$($={}){try{let v=Array.from(u.value.values()),g=v.map((U)=>({id:U.id,position:U.position,size:U.size,collapsed:U.collapsed,dockPosition:U.dockPosition})),_={viewport:X$.value,nodes:v.map((U)=>({id:U.id,type:U.type,position:U.position,size:U.size,collapsed:U.collapsed,pinned:U.pinned,dockPosition:U.dockPosition})),edges:Array.from(h$.value.values()).map((U)=>({id:U.id,from:U.from,to:U.to,type:U.type,label:U.label,style:U.style,animated:U.animated})),contextPinnedNodeIds:Array.from(f$.value)};localStorage.setItem(qb,JSON.stringify(_)),m7(g,$)}catch(v){tU("persistLayout",v)}}function Yz(){try{let $=localStorage.getItem(qb);if(!$)return null;let v=JSON.parse($),g=Array.isArray(v.nodes)?v.nodes:[];if(g.length===0)return null;let _=new Map;for(let U of g){if(typeof U.id!=="string"||U.id.length===0)continue;_.set(U.id,{...U.position?{position:U.position}:{},...U.size?{size:U.size}:{},...U.collapsed!==void 0?{collapsed:U.collapsed}:{},...U.pinned!==void 0?{pinned:U.pinned}:{},...U.dockPosition!==void 0?{dockPosition:U.dockPosition}:{}})}return _.size>0?_:null}catch($){return tU("restoreLayout",$),null}}function g_($,v){let g=Array.from(u.value.values());if(g.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let Y of g)_=Math.min(_,Y.position.x),U=Math.min(U,Y.position.y),z=Math.max(z,Y.position.x+Y.size.width),J=Math.max(J,Y.position.y+Y.size.height);let G=60,b=z-_+G*2,O=J-U+G*2,W=Math.min(1,Math.min($/b,v/O)),B=(_+z)/2,k=(U+J)/2;gv({x:$/2-B*W,y:v/2-k*W,scale:W})}function F6($,v={}){let g=u.value.get($);if(!g)return;let _=X$.value,U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2;gv({x:window.innerWidth/2-U*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),w4($)}function Pb($=1){let v=Array.from(u.value.keys());if(v.length===0)return;let _=((V$.value?v.indexOf(V$.value):-1)+$+v.length)%v.length,U=v[_];w4(U),F6(U)}function Xb($){let v=V$.value;if(!v)return;let g=u.value.get(v);if(!g)return;let _=e7(v,h$.value);if(_.size===0)return;let U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2,J=null,G=-1/0;for(let b of _){let O=u.value.get(b);if(!O)continue;let W=O.position.x+O.size.width/2,B=O.position.y+O.size.height/2,k=W-U,Y=B-z,F=Math.sqrt(k*k+Y*Y);if(F<1)continue;let X;switch($){case"up":X=-Y;break;case"down":X=Y;break;case"left":X=-k;break;case"right":X=k;break}if(X<=0)continue;let H=X/F-F*0.001;if(H>G)G=H,J=b}if(J)F6(J)}function J4($){if(!u.value.get($))return;if(M6!==null)clearTimeout(M6),M6=null;p6.value=null,yv=void 0,w4($),m$.value=$}function bz($){if(M6!==null)clearTimeout(M6),M6=null;if(m$.value===$)m$.value=null;if(p6.value===$)p6.value=null;yv=void 0}function _v(){let $=m$.value,v=$?u.value.get($):void 0;if($&&v&&u7(v)){let g=$,_=Date.now();if(p6.value=g,yv=v.data.appCheckpoint?.updatedAt,M6!==null)clearTimeout(M6);let U=()=>{let J=u.value.get(g)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==yv){bz(g);return}if(Date.now()-_>=Qq){bz(g);return}M6=setTimeout(U,d7)};M6=setTimeout(U,d7);return}if(M6!==null)clearTimeout(M6),M6=null;p6.value=null,yv=void 0,m$.value=null}function sU(){let $=_z(Array.from(u.value.values()),Array.from(h$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g4(()=>{for(let[v,g]of $.nodePositions.entries())q6(v,{position:g});for(let[v,g]of $.groupBounds.entries())Oz(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),a$()}function eU(){let $=_z(Array.from(u.value.values()),Array.from(h$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g4(()=>{for(let[v,g]of $.nodePositions.entries())q6(v,{position:g});for(let[v,g]of $.groupBounds.entries())Oz(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),a$()}var Sq=0;function K($,v,g,_,U,z){v||(v={});var J,G,b=v;if("ref"in b)for(G in b={},v)G=="ref"?J=v[G]:b[G]=v[G];var O={type:$,props:b,key:g,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sq,__i:-1,__u:0,__source:U,__self:z};if(typeof $=="function"&&(J=$.defaultProps))for(G in J)b[G]===void 0&&(b[G]=J[G]);return H$.vnode&&H$.vnode(O),O}function Nq($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function yq(){bb(),Eg()}function Hb(){let $=pU.value;if($.length===0)return null;let v=L4.value,g=Av.value;if(!v&&U_.value)return null;if(!v)return K("button",{type:"button",class:"attention-history-tab",onClick:yq,"aria-label":g>0?`Recent updates — ${g} new`:"Recent updates",title:g>0?`${g} new updates since last viewed`:"Recent updates",children:[K("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),g>0&&K("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:g>9?"9+":g},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return K("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[K("div",{class:"attention-history-header",children:[K("div",{class:"attention-history-header-text",children:[K("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),K("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"attention-history-close",onClick:mg,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"attention-history-list",children:$.map((_)=>K("article",{class:`attention-history-entry attention-tone-${_.tone}`,children:[K("div",{class:"attention-history-meta",children:[K("span",{class:"attention-history-kind",children:_.title},void 0,!1,void 0,this),K("time",{class:"attention-history-time",dateTime:new Date(_.createdAt).toISOString(),children:Nq(_.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("p",{class:"attention-history-detail",children:_.detail},void 0,!1,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Lb(){let $=Vg.value;if(!$)return null;return K("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:Eg,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[K("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),K("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Rq=700,Dq=1600;function Tq($){return $.replace(/\r\n?/g,`
22
+ `}}};U1.tableCaption={filter:["caption"],replacement:()=>""};U1.tableColgroup={filter:["colgroup","col"],replacement:()=>""};U1.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function GP($){var U=$.parentNode;return U.nodeName==="THEAD"||U.firstChild===$&&(U.nodeName==="TABLE"||WP(U))&&JP.call($.childNodes,function(v){return v.nodeName==="TH"})}function WP($){var U=$.previousSibling;return $.nodeName==="TBODY"&&(!U||U.nodeName==="THEAD"&&/^\s*$/i.test(U.textContent))}function RZ($,U=null,v=null){if(v===null)v=vP.call(U.parentNode.childNodes,U);var J=" ";if(v===0)J="| ";let _=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");_=_.replace(/\|+/g,"\\|");while(_.length<3)_+=" ";if(U)_=ZP(_,U," ");return J+_+" |"}function TZ($){if(!$.childNodes)return!1;for(let U=0;U<$.childNodes.length;U++){let v=$.childNodes[U];if(v.nodeName==="TABLE")return!0;if(TZ(v))return!0}return!1}var n8=($,U)=>{if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let J=$.childNodes[v];if(U==="code"&&d8&&d8(J))return!0;if(U.includes(J.nodeName))return!0;if(n8(J,U))return!0}return!1},yZ=($,U)=>{let v=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(U.preserveNestedTables)v.push("TABLE");return n8($,"code")||n8($,v)};function t8($){let U=AZ.get($);if(U!==void 0)return U;let v=OP($);return AZ.set($,v),v}function OP($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(TZ($))return!0;return!1}function YP($){let U=$.parentNode;while(U.nodeName!=="DIV")if(U=U.parentNode,!U)return null;return U}function CZ($){let U=$.parentNode;while(U.nodeName!=="TABLE")if(U=U.parentNode,!U)return null;return U}function ZP($,U,v){let J=U.getAttribute("colspan")||1;for(let _=1;_<J;_++)$+=" | "+v.repeat(3);return $}function DZ($){let U=0;for(let v=0;v<$.rows.length;v++){let _=$.rows[v].childNodes.length;if(_>U)U=_}return U}function jZ($){d8=$.isCodeBlock,gZ=$.options,$.keep(function(v){if(v.nodeName==="TABLE"&&yZ(v,$.options))return!0;return!1});for(var U in U1)$.addRule(U,U1[U])}function VZ($){$.addRule("taskListItems",{filter:function(U){let v=U.parentNode,J=v.parentNode;return U.type==="checkbox"&&(v.nodeName==="LI"||v.nodeName==="LABEL"&&J&&J.nodeName==="LI")},replacement:function(U,v){return(v.checked?"[x]":"[ ]")+" "}})}function qP($){$.use([IZ,wZ,jZ,VZ])}fZ.gfm=qP;fZ.highlightedCodeBlock=IZ;fZ.strikethrough=wZ;fZ.tables=jZ;fZ.taskListItems=VZ});if(typeof crypto<"u"&&typeof crypto.randomUUID!=="function")crypto.randomUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let U=Math.random()*16|0;return($==="x"?U:U&3|8).toString(16)});var b2,k$,TO,Y8,o4,gO,yO,CO,DO,Z8,G8,W8,SL,F2={},P2=[],RL=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,M2=Array.isArray;function I4($,U){for(var v in U)$[v]=U[v];return $}function q8($){$&&$.parentNode&&$.parentNode.removeChild($)}function TL($,U,v){var J,_,z,K={};for(z in U)z=="key"?J=U[z]:z=="ref"?_=U[z]:K[z]=U[z];if(arguments.length>2&&(K.children=arguments.length>3?b2.call(arguments,2):v),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)K[z]===void 0&&(K[z]=$.defaultProps[z]);return L2($,K,J,_,null)}function L2($,U,v,J,_){var z={type:$,props:U,key:v,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:_==null?++TO:_,__i:-1,__u:0};return _==null&&k$.vnode!=null&&k$.vnode(z),z}function M$($){return $.children}function zU($,U){this.props=$,this.context=U}function KU($,U){if(U==null)return $.__?KU($.__,$.__i+1):null;for(var v;U<$.__k.length;U++)if((v=$.__k[U])!=null&&v.__e!=null)return v.__e;return typeof $.type=="function"?KU($):null}function yL($){if($.__P&&$.__d){var U=$.__v,v=U.__e,J=[],_=[],z=I4({},U);z.__v=U.__v+1,k$.vnode&&k$.vnode(z),B8($.__P,z,U,$.__n,$.__P.namespaceURI,32&U.__u?[v]:null,J,v==null?KU(U):v,!!(32&U.__u),_),z.__v=U.__v,z.__.__k[z.__i]=z,EO(J,z,_),U.__e=U.__=null,z.__e!=v&&jO(z)}}function jO($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(U){if(U!=null&&U.__e!=null)return $.__e=$.__c.base=U.__e}),jO($)}function NO($){(!$.__d&&($.__d=!0)&&o4.push($)&&!k2.__r++||gO!=k$.debounceRendering)&&((gO=k$.debounceRendering)||yO)(k2)}function k2(){try{for(var $,U=1;o4.length;)o4.length>U&&o4.sort(CO),$=o4.shift(),U=o4.length,yL($)}finally{o4.length=k2.__r=0}}function VO($,U,v,J,_,z,K,W,O,Y,Z){var q,X,B,L,P,k,H,F=J&&J.__k||P2,b=U.length;for(O=CL(v,U,F,O,b),q=0;q<b;q++)(B=v.__k[q])!=null&&(X=B.__i!=-1&&F[B.__i]||F2,B.__i=q,k=B8($,B,X,_,z,K,W,O,Y,Z),L=B.__e,B.ref&&X.ref!=B.ref&&(X.ref&&X8(X.ref,null,B),Z.push(B.ref,B.__c||L,B)),P==null&&L!=null&&(P=L),(H=!!(4&B.__u))||X.__k===B.__k?O=fO(B,O,$,H):typeof B.type=="function"&&k!==void 0?O=k:L&&(O=L.nextSibling),B.__u&=-7);return v.__e=P,O}function CL($,U,v,J,_){var z,K,W,O,Y,Z=v.length,q=Z,X=0;for($.__k=Array(_),z=0;z<_;z++)(K=U[z])!=null&&typeof K!="boolean"&&typeof K!="function"?(typeof K=="string"||typeof K=="number"||typeof K=="bigint"||K.constructor==String?K=$.__k[z]=L2(null,K,null,null,null):M2(K)?K=$.__k[z]=L2(M$,{children:K},null,null,null):K.constructor===void 0&&K.__b>0?K=$.__k[z]=L2(K.type,K.props,K.key,K.ref?K.ref:null,K.__v):$.__k[z]=K,O=z+X,K.__=$,K.__b=$.__b+1,W=null,(Y=K.__i=DL(K,v,O,q))!=-1&&(q--,(W=v[Y])&&(W.__u|=2)),W==null||W.__v==null?(Y==-1&&(_>Z?X--:_<Z&&X++),typeof K.type!="function"&&(K.__u|=4)):Y!=O&&(Y==O-1?X--:Y==O+1?X++:(Y>O?X--:X++,K.__u|=4))):$.__k[z]=null;if(q)for(z=0;z<Z;z++)(W=v[z])!=null&&(2&W.__u)==0&&(W.__e==J&&(J=KU(W)),mO(W,W));return J}function fO($,U,v,J){var _,z;if(typeof $.type=="function"){for(_=$.__k,z=0;_&&z<_.length;z++)_[z]&&(_[z].__=$,U=fO(_[z],U,v,J));return U}$.__e!=U&&(J&&(U&&$.type&&!U.parentNode&&(U=KU($)),v.insertBefore($.__e,U||null)),U=$.__e);do U=U&&U.nextSibling;while(U!=null&&U.nodeType==8);return U}function DL($,U,v,J){var _,z,K,W=$.key,O=$.type,Y=U[v],Z=Y!=null&&(2&Y.__u)==0;if(Y===null&&W==null||Z&&W==Y.key&&O==Y.type)return v;if(J>(Z?1:0)){for(_=v-1,z=v+1;_>=0||z<U.length;)if((Y=U[K=_>=0?_--:z++])!=null&&(2&Y.__u)==0&&W==Y.key&&O==Y.type)return K}return-1}function SO($,U,v){U[0]=="-"?$.setProperty(U,v==null?"":v):$[U]=v==null?"":typeof v!="number"||RL.test(U)?v:v+"px"}function Q2($,U,v,J,_){var z,K;$:if(U=="style")if(typeof v=="string")$.style.cssText=v;else{if(typeof J=="string"&&($.style.cssText=J=""),J)for(U in J)v&&U in v||SO($.style,U,"");if(v)for(U in v)J&&v[U]==J[U]||SO($.style,U,v[U])}else if(U[0]=="o"&&U[1]=="n")z=U!=(U=U.replace(DO,"$1")),K=U.toLowerCase(),U=K in $||U=="onFocusOut"||U=="onFocusIn"?K.slice(2):U.slice(2),$.l||($.l={}),$.l[U+z]=v,v?J?v.u=J.u:(v.u=Z8,$.addEventListener(U,z?W8:G8,z)):$.removeEventListener(U,z?W8:G8,z);else{if(_=="http://www.w3.org/2000/svg")U=U.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(U!="width"&&U!="height"&&U!="href"&&U!="list"&&U!="form"&&U!="tabIndex"&&U!="download"&&U!="rowSpan"&&U!="colSpan"&&U!="role"&&U!="popover"&&U in $)try{$[U]=v==null?"":v;break $}catch(W){}typeof v=="function"||(v==null||v===!1&&U[4]!="-"?$.removeAttribute(U):$.setAttribute(U,U=="popover"&&v==1?"":v))}}function RO($){return function(U){if(this.l){var v=this.l[U.type+$];if(U.t==null)U.t=Z8++;else if(U.t<v.u)return;return v(k$.event?k$.event(U):U)}}}function B8($,U,v,J,_,z,K,W,O,Y){var Z,q,X,B,L,P,k,H,F,b,V,E,A,I,N,R=U.type;if(U.constructor!==void 0)return null;128&v.__u&&(O=!!(32&v.__u),z=[W=U.__e=v.__e]),(Z=k$.__b)&&Z(U);$:if(typeof R=="function")try{if(H=U.props,F=R.prototype&&R.prototype.render,b=(Z=R.contextType)&&J[Z.__c],V=Z?b?b.props.value:Z.__:J,v.__c?k=(q=U.__c=v.__c).__=q.__E:(F?U.__c=q=new R(H,V):(U.__c=q=new zU(H,V),q.constructor=R,q.render=VL),b&&b.sub(q),q.state||(q.state={}),q.__n=J,X=q.__d=!0,q.__h=[],q._sb=[]),F&&q.__s==null&&(q.__s=q.state),F&&R.getDerivedStateFromProps!=null&&(q.__s==q.state&&(q.__s=I4({},q.__s)),I4(q.__s,R.getDerivedStateFromProps(H,q.__s))),B=q.props,L=q.state,q.__v=U,X)F&&R.getDerivedStateFromProps==null&&q.componentWillMount!=null&&q.componentWillMount(),F&&q.componentDidMount!=null&&q.__h.push(q.componentDidMount);else{if(F&&R.getDerivedStateFromProps==null&&H!==B&&q.componentWillReceiveProps!=null&&q.componentWillReceiveProps(H,V),U.__v==v.__v||!q.__e&&q.shouldComponentUpdate!=null&&q.shouldComponentUpdate(H,q.__s,V)===!1){U.__v!=v.__v&&(q.props=H,q.state=q.__s,q.__d=!1),U.__e=v.__e,U.__k=v.__k,U.__k.some(function(p){p&&(p.__=U)}),P2.push.apply(q.__h,q._sb),q._sb=[],q.__h.length&&K.push(q);break $}q.componentWillUpdate!=null&&q.componentWillUpdate(H,q.__s,V),F&&q.componentDidUpdate!=null&&q.__h.push(function(){q.componentDidUpdate(B,L,P)})}if(q.context=V,q.props=H,q.__P=$,q.__e=!1,E=k$.__r,A=0,F)q.state=q.__s,q.__d=!1,E&&E(U),Z=q.render(q.props,q.state,q.context),P2.push.apply(q.__h,q._sb),q._sb=[];else do q.__d=!1,E&&E(U),Z=q.render(q.props,q.state,q.context),q.state=q.__s;while(q.__d&&++A<25);q.state=q.__s,q.getChildContext!=null&&(J=I4(I4({},J),q.getChildContext())),F&&!X&&q.getSnapshotBeforeUpdate!=null&&(P=q.getSnapshotBeforeUpdate(B,L)),I=Z!=null&&Z.type===M$&&Z.key==null?uO(Z.props.children):Z,W=VO($,M2(I)?I:[I],U,v,J,_,z,K,W,O,Y),q.base=U.__e,U.__u&=-161,q.__h.length&&K.push(q),k&&(q.__E=q.__=null)}catch(p){if(U.__v=null,O||z!=null)if(p.then){for(U.__u|=O?160:128;W&&W.nodeType==8&&W.nextSibling;)W=W.nextSibling;z[z.indexOf(W)]=null,U.__e=W}else{for(N=z.length;N--;)q8(z[N]);O8(U)}else U.__e=v.__e,U.__k=v.__k,p.then||O8(U);k$.__e(p,U,v)}else z==null&&U.__v==v.__v?(U.__k=v.__k,U.__e=v.__e):W=U.__e=jL(v.__e,U,v,J,_,z,K,O,Y);return(Z=k$.diffed)&&Z(U),128&U.__u?void 0:W}function O8($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(O8))}function EO($,U,v){for(var J=0;J<v.length;J++)X8(v[J],v[++J],v[++J]);k$.__c&&k$.__c(U,$),$.some(function(_){try{$=_.__h,_.__h=[],$.some(function(z){z.call(_)})}catch(z){k$.__e(z,_.__v)}})}function uO($){return typeof $!="object"||$==null||$.__b>0?$:M2($)?$.map(uO):I4({},$)}function jL($,U,v,J,_,z,K,W,O){var Y,Z,q,X,B,L,P,k=v.props||F2,H=U.props,F=U.type;if(F=="svg"?_="http://www.w3.org/2000/svg":F=="math"?_="http://www.w3.org/1998/Math/MathML":_||(_="http://www.w3.org/1999/xhtml"),z!=null){for(Y=0;Y<z.length;Y++)if((B=z[Y])&&"setAttribute"in B==!!F&&(F?B.localName==F:B.nodeType==3)){$=B,z[Y]=null;break}}if($==null){if(F==null)return document.createTextNode(H);$=document.createElementNS(_,F,H.is&&H),W&&(k$.__m&&k$.__m(U,z),W=!1),z=null}if(F==null)k===H||W&&$.data==H||($.data=H);else{if(z=z&&b2.call($.childNodes),!W&&z!=null)for(k={},Y=0;Y<$.attributes.length;Y++)k[(B=$.attributes[Y]).name]=B.value;for(Y in k)B=k[Y],Y=="dangerouslySetInnerHTML"?q=B:Y=="children"||(Y in H)||Y=="value"&&("defaultValue"in H)||Y=="checked"&&("defaultChecked"in H)||Q2($,Y,null,B,_);for(Y in H)B=H[Y],Y=="children"?X=B:Y=="dangerouslySetInnerHTML"?Z=B:Y=="value"?L=B:Y=="checked"?P=B:W&&typeof B!="function"||k[Y]===B||Q2($,Y,B,k[Y],_);if(Z)W||q&&(Z.__html==q.__html||Z.__html==$.innerHTML)||($.innerHTML=Z.__html),U.__k=[];else if(q&&($.innerHTML=""),VO(U.type=="template"?$.content:$,M2(X)?X:[X],U,v,J,F=="foreignObject"?"http://www.w3.org/1999/xhtml":_,z,K,z?z[0]:v.__k&&KU(v,0),W,O),z!=null)for(Y=z.length;Y--;)q8(z[Y]);W||(Y="value",F=="progress"&&L==null?$.removeAttribute("value"):L!=null&&(L!==$[Y]||F=="progress"&&!L||F=="option"&&L!=k[Y])&&Q2($,Y,L,k[Y],_),Y="checked",P!=null&&P!=$[Y]&&Q2($,Y,P,k[Y],_))}return $}function X8($,U,v){try{if(typeof $=="function"){var J=typeof $.__u=="function";J&&$.__u(),J&&U==null||($.__u=$(U))}else $.current=U}catch(_){k$.__e(_,v)}}function mO($,U,v){var J,_;if(k$.unmount&&k$.unmount($),(J=$.ref)&&(J.current&&J.current!=$.__e||X8(J,null,U)),(J=$.__c)!=null){if(J.componentWillUnmount)try{J.componentWillUnmount()}catch(z){k$.__e(z,U)}J.base=J.__P=null}if(J=$.__k)for(_=0;_<J.length;_++)J[_]&&mO(J[_],U,v||typeof $.type!="function");v||q8($.__e),$.__c=$.__=$.__e=void 0}function VL($,U,v){return this.constructor($,v)}function xO($,U,v){var J,_,z,K;U==document&&(U=document.documentElement),k$.__&&k$.__($,U),_=(J=typeof v=="function")?null:v&&v.__k||U.__k,z=[],K=[],B8(U,$=(!J&&v||U).__k=TL(M$,null,[$]),_||F2,F2,U.namespaceURI,!J&&v?[v]:_?null:U.firstChild?b2.call(U.childNodes):null,z,!J&&v?v:_?_.__e:U.firstChild,J,K),EO(z,$,K)}b2=P2.slice,k$={__e:function($,U,v,J){for(var _,z,K;U=U.__;)if((_=U.__c)&&!_.__)try{if((z=_.constructor)&&z.getDerivedStateFromError!=null&&(_.setState(z.getDerivedStateFromError($)),K=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch($,J||{}),K=_.__d),K)return _.__E=_}catch(W){$=W}throw $}},TO=0,Y8=function($){return $!=null&&$.constructor===void 0},zU.prototype.setState=function($,U){var v;v=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=I4({},this.state),typeof $=="function"&&($=$(I4({},v),this.props)),$&&I4(v,$),$!=null&&this.__v&&(U&&this._sb.push(U),NO(this))},zU.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),NO(this))},zU.prototype.render=M$,o4=[],yO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,CO=function($,U){return $.__v.__b-U.__v.__b},k2.__r=0,DO=/(PointerCapture)$|Capture$/i,Z8=0,G8=RO(!1),W8=RO(!0),SL=0;var GU,a$,H8,hO,f0=0,nO=[],e$=k$,cO=e$.__b,lO=e$.__r,rO=e$.diffed,iO=e$.__c,pO=e$.unmount,oO=e$.__;function I2($,U){e$.__h&&e$.__h(a$,$,f0||U),f0=0;var v=a$.__H||(a$.__H={__:[],__h:[]});return $>=v.__.length&&v.__.push({}),v.__[$]}function f($){return f0=1,fL(tO,$)}function fL($,U,v){var J=I2(GU++,2);if(J.t=$,!J.__c&&(J.__=[v?v(U):tO(void 0,U),function(W){var O=J.__N?J.__N[0]:J.__[0],Y=J.t(O,W);O!==Y&&(J.__N=[Y,J.__[1]],J.__c.setState({}))}],J.__c=a$,!a$.__f)){var _=function(W,O,Y){if(!J.__c.__H)return!0;var Z=J.__c.__H.__.filter(function(X){return X.__c});if(Z.every(function(X){return!X.__N}))return!z||z.call(this,W,O,Y);var q=J.__c.props!==W;return Z.some(function(X){if(X.__N){var B=X.__[0];X.__=X.__N,X.__N=void 0,B!==X.__[0]&&(q=!0)}}),z&&z.call(this,W,O,Y)||q};a$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:K}=a$;a$.componentWillUpdate=function(W,O,Y){if(this.__e){var Z=z;z=void 0,_(W,O,Y),z=Z}K&&K.call(this,W,O,Y)},a$.shouldComponentUpdate=_}return J.__N||J.__}function u($,U){var v=I2(GU++,3);!e$.__s&&L8(v.__H,U)&&(v.__=$,v.u=U,a$.__H.__h.push(v))}function w2($,U){var v=I2(GU++,4);!e$.__s&&L8(v.__H,U)&&(v.__=$,v.u=U,a$.__h.push(v))}function C($){return f0=5,u$(function(){return{current:$}},[])}function u$($,U){var v=I2(GU++,7);return L8(v.__H,U)&&(v.__=$(),v.__H=U,v.__h=$),v.__}function j($,U){return f0=8,u$(function(){return $},U)}function EL(){for(var $;$=nO.shift();){var U=$.__H;if($.__P&&U)try{U.__h.some(A2),U.__h.some(Q8),U.__h=[]}catch(v){U.__h=[],e$.__e(v,$.__v)}}}e$.__b=function($){a$=null,cO&&cO($)},e$.__=function($,U){$&&U.__k&&U.__k.__m&&($.__m=U.__k.__m),oO&&oO($,U)},e$.__r=function($){lO&&lO($),GU=0;var U=(a$=$.__c).__H;U&&(H8===a$?(U.__h=[],a$.__h=[],U.__.some(function(v){v.__N&&(v.__=v.__N),v.u=v.__N=void 0})):(U.__h.some(A2),U.__h.some(Q8),U.__h=[],GU=0)),H8=a$},e$.diffed=function($){rO&&rO($);var U=$.__c;U&&U.__H&&(U.__H.__h.length&&(nO.push(U)!==1&&hO===e$.requestAnimationFrame||((hO=e$.requestAnimationFrame)||uL)(EL)),U.__H.__.some(function(v){v.u&&(v.__H=v.u),v.u=void 0})),H8=a$=null},e$.__c=function($,U){U.some(function(v){try{v.__h.some(A2),v.__h=v.__h.filter(function(J){return!J.__||Q8(J)})}catch(J){U.some(function(_){_.__h&&(_.__h=[])}),U=[],e$.__e(J,v.__v)}}),iO&&iO($,U)},e$.unmount=function($){pO&&pO($);var U,v=$.__c;v&&v.__H&&(v.__H.__.some(function(J){try{A2(J)}catch(_){U=_}}),v.__H=void 0,U&&e$.__e(U,v.__v))};var dO=typeof requestAnimationFrame=="function";function uL($){var U,v=function(){clearTimeout(J),dO&&cancelAnimationFrame(U),setTimeout($)},J=setTimeout(v,35);dO&&(U=requestAnimationFrame(v))}function A2($){var U=a$,v=$.__c;typeof v=="function"&&($.__c=void 0,v()),a$=U}function Q8($){var U=a$;$.__c=$.__(),a$=U}function L8($,U){return!$||$.length!==U.length||U.some(function(v,J){return v!==$[J]})}function tO($,U){return typeof U=="function"?U($):U}var mL=Symbol.for("preact-signals");function R2(){if(!(w4>1)){var $,U=!1;(function(){var _=N2;N2=void 0;while(_!==void 0){if(_.S.v===_.v)_.S.i=_.i;_=_.o}})();while(E0!==void 0){var v=E0;E0=void 0,g2++;while(v!==void 0){var J=v.u;if(v.u=void 0,v.f&=-3,!(8&v.f)&&eO(v))try{v.c()}catch(_){if(!U)$=_,U=!0}v=J}}if(g2=0,w4--,U)throw $}else w4--}function o6($){if(w4>0)return $();F8=++xL,w4++;try{return $()}finally{R2()}}var S$=void 0;function P8($){var U=S$;S$=void 0;try{return $()}finally{S$=U}}var aO,E0=void 0,w4=0,g2=0,xL=0,F8=0,N2=void 0,S2=0;function sO($){if(S$!==void 0){var U=$.n;if(U===void 0||U.t!==S$){if(U={i:0,S:$,p:S$.s,n:void 0,t:S$,e:void 0,x:void 0,r:U},S$.s!==void 0)S$.s.n=U;if(S$.s=U,$.n=U,32&S$.f)$.S(U);return U}else if(U.i===-1){if(U.i=0,U.n!==void 0){if(U.n.p=U.p,U.p!==void 0)U.p.n=U.n;U.p=S$.s,U.n=void 0,S$.s.n=U,S$.s=U}return U}}}function z6($,U){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=U==null?void 0:U.watched,this.Z=U==null?void 0:U.unwatched,this.name=U==null?void 0:U.name}z6.prototype.brand=mL;z6.prototype.h=function(){return!0};z6.prototype.S=function($){var U=this,v=this.t;if(v!==$&&$.e===void 0)if($.x=v,this.t=$,v!==void 0)v.e=$;else P8(function(){var J;(J=U.W)==null||J.call(U)})};z6.prototype.U=function($){var U=this;if(this.t!==void 0){var{e:v,x:J}=$;if(v!==void 0)v.x=J,$.e=void 0;if(J!==void 0)J.e=v,$.x=void 0;if($===this.t){if(this.t=J,J===void 0)P8(function(){var _;(_=U.Z)==null||_.call(U)})}}};z6.prototype.subscribe=function($){var U=this;return Z4(function(){var v=U.value,J=S$;S$=void 0;try{$(v)}finally{S$=J}},{name:"sub"})};z6.prototype.valueOf=function(){return this.value};z6.prototype.toString=function(){return this.value+""};z6.prototype.toJSON=function(){return this.value};z6.prototype.peek=function(){var $=S$;S$=void 0;try{return this.value}finally{S$=$}};Object.defineProperty(z6.prototype,"value",{get:function(){var $=sO(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(g2>100)throw Error("Cycle detected");(function(v){if(w4!==0&&g2===0){if(v.l!==F8)v.l=F8,N2={S:v,v:v.v,i:v.i,o:N2}}})(this),this.v=$,this.i++,S2++,w4++;try{for(var U=this.t;U!==void 0;U=U.x)U.t.N()}finally{R2()}}}});function s($,U){return new z6($,U)}function eO($){for(var U=$.s;U!==void 0;U=U.n)if(U.S.i!==U.i||!U.S.h()||U.S.i!==U.i)return!0;return!1}function $Y($){for(var U=$.s;U!==void 0;U=U.n){var v=U.S.n;if(v!==void 0)U.r=v;if(U.S.n=U,U.i=-1,U.n===void 0){$.s=U;break}}}function UY($){var U=$.s,v=void 0;while(U!==void 0){var J=U.p;if(U.i===-1){if(U.S.U(U),J!==void 0)J.n=U.n;if(U.n!==void 0)U.n.p=J}else v=U;if(U.S.n=U.r,U.r!==void 0)U.r=void 0;U=J}$.s=v}function y1($,U){z6.call(this,void 0),this.x=$,this.s=void 0,this.g=S2-1,this.f=4,this.W=U==null?void 0:U.watched,this.Z=U==null?void 0:U.unwatched,this.name=U==null?void 0:U.name}y1.prototype=new z6;y1.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===S2)return!0;if(this.g=S2,this.f|=1,this.i>0&&!eO(this))return this.f&=-2,!0;var $=S$;try{$Y(this),S$=this;var U=this.x();if(16&this.f||this.v!==U||this.i===0)this.v=U,this.f&=-17,this.i++}catch(v){this.v=v,this.f|=16,this.i++}return S$=$,UY(this),this.f&=-2,!0};y1.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var U=this.s;U!==void 0;U=U.n)U.S.S(U)}z6.prototype.S.call(this,$)};y1.prototype.U=function($){if(this.t!==void 0){if(z6.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var U=this.s;U!==void 0;U=U.n)U.S.U(U)}}};y1.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty(y1.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=sO(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function r$($,U){return new y1($,U)}function _Y($){var U=$.m;if($.m=void 0,typeof U=="function"){w4++;var v=S$;S$=void 0;try{U()}catch(J){throw $.f&=-2,$.f|=8,k8($),J}finally{S$=v,R2()}}}function k8($){for(var U=$.s;U!==void 0;U=U.n)U.S.U(U);$.x=void 0,$.s=void 0,_Y($)}function hL($){if(S$!==this)throw Error("Out-of-order effect");if(UY(this),S$=$,this.f&=-2,8&this.f)k8(this);R2()}function WU($,U){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=U==null?void 0:U.name,aO)aO.push(this)}WU.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var U=this.x();if(typeof U=="function")this.m=U}finally{$()}};WU.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,_Y(this),$Y(this),w4++;var $=S$;return S$=this,hL.bind(this,$)};WU.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=E0,E0=this};WU.prototype.d=function(){if(this.f|=8,!(1&this.f))k8(this)};WU.prototype.dispose=function(){this.d()};function Z4($,U){var v=new WU($,U);try{v.c()}catch(_){throw v.d(),_}var J=v.d.bind(v);return J[Symbol.dispose]=J,J}var vY,b8,T2,cL=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var JY=[];Z4(function(){vY=this.N})();function OU($,U){k$[$]=U.bind(null,k$[$]||function(){})}function y2($){if(T2){var U=T2;T2=void 0,U()}T2=$&&$.S()}function zY($){var U=this,v=$.data,J=rL(v);J.value=v;var _=u$(function(){var W=U,O=U.__v;while(O=O.__)if(O.__c){O.__c.__$f|=4;break}var Y=r$(function(){var B=J.value.value;return B===0?0:B===!0?"":B||""}),Z=r$(function(){return!Array.isArray(Y.value)&&!Y8(Y.value)}),q=Z4(function(){if(this.N=KY,Z.value){var B=Y.value;if(W.__v&&W.__v.__e&&W.__v.__e.nodeType===3)W.__v.__e.data=B}}),X=U.__$u.d;return U.__$u.d=function(){q(),X.call(this)},[Z,Y]},[]),z=_[0],K=_[1];return z.value?K.peek():K.value}zY.displayName="ReactiveTextNode";Object.defineProperties(z6.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:zY},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});OU("__b",function($,U){if(typeof U.type=="string"){var v,J=U.props;for(var _ in J)if(_!=="children"){var z=J[_];if(z instanceof z6){if(!v)U.__np=v={};v[_]=z,J[_]=z.peek()}}}$(U)});OU("__r",function($,U){if($(U),U.type!==M$){y2();var v,J=U.__c;if(J){if(J.__$f&=-2,(v=J.__$u)===void 0)J.__$u=v=function(_,z){var K;return Z4(function(){K=this},{name:z}),K.c=_,K}(function(){var _;if(cL)(_=v.y)==null||_.call(v);J.__$f|=1,J.setState({})},typeof U.type=="function"?U.type.displayName||U.type.name:"")}b8=J,y2(v)}});OU("__e",function($,U,v,J){y2(),b8=void 0,$(U,v,J)});OU("diffed",function($,U){y2(),b8=void 0;var v;if(typeof U.type=="string"&&(v=U.__e)){var{__np:J,props:_}=U;if(J){var z=v.U;if(z)for(var K in z){var W=z[K];if(W!==void 0&&!(K in J))W.d(),z[K]=void 0}else z={},v.U=z;for(var O in J){var Y=z[O],Z=J[O];if(Y===void 0)Y=lL(v,O,Z),z[O]=Y;else Y.o(Z,_)}for(var q in J)_[q]=J[q]}}$(U)});function lL($,U,v,J){var _=U in $&&$.ownerSVGElement===void 0,z=s(v),K=v.peek();return{o:function(W,O){z.value=W,K=W.peek()},d:Z4(function(){this.N=KY;var W=z.value.value;if(K!==W)if(K=void 0,_)$[U]=W;else if(W!=null&&(W!==!1||U[4]==="-"))$.setAttribute(U,W);else $.removeAttribute(U);else K=void 0})}}OU("unmount",function($,U){if(typeof U.type=="string"){var v=U.__e;if(v){var J=v.U;if(J){v.U=void 0;for(var _ in J){var z=J[_];if(z)z.d()}}}U.__np=void 0}else{var K=U.__c;if(K){var W=K.__$u;if(W)K.__$u=void 0,W.d()}}$(U)});OU("__h",function($,U,v,J){if(J<3||J===9)U.__$f|=2;$(U,v,J)});zU.prototype.shouldComponentUpdate=function($,U){if(this.__R)return!0;var v=this.__$u,J=v&&v.s!==void 0;for(var _ in U)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(J||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(J||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var K in $)if(K!=="__source"&&$[K]!==this.props[K])return!0;for(var W in this.props)if(!(W in $))return!0;return!1};function rL($,U){return u$(function(){return s($,U)},[])}var iL=function($){queueMicrotask(function(){queueMicrotask($)})};function pL(){o6(function(){var $;while($=JY.shift())vY.call($)})}function KY(){if(JY.push(this)===1)(k$.requestAnimationFrame||iL)(pL)}var C2=s(null),u0=s([]),ZU=s(new Set),qU=s(new Set),D2=s([]),j2=s(new Set),q4=s(!1),YU=s(0);function GY(){C2.value=null,u0.value=[],ZU.value=new Set,qU.value=new Set,D2.value=[],j2.value=new Set,q4.value=!1,YU.value=0}function V2(){q4.value=!0,YU.value=0}function WY(){q4.value=!1}function OY($,U,v){ZU.value=new Set($),qU.value=new Set(U),D2.value=v}function f2($){C2.value=$}function YY($,U=6){if(u0.value=[$,...u0.value].slice(0,U),!q4.value)YU.value=Math.min(99,YU.value+1)}function E2($){j2.value=new Set($)}var oL=0;function G($,U,v,J,_,z){U||(U={});var K,W,O=U;if("ref"in O)for(W in O={},U)W=="ref"?K=U[W]:O[W]=U[W];var Y={type:$,props:O,key:v,ref:K,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--oL,__i:-1,__u:0,__source:_,__self:z};if(typeof $=="function"&&(K=$.defaultProps))for(W in K)O[W]===void 0&&(O[W]=K[W]);return k$.vnode&&k$.vnode(Y),Y}function dL($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function nL(){V2()}function ZY(){let $=u0.value;if($.length===0)return null;let U=q4.value,v=YU.value;if(!U)return G("button",{type:"button",class:"attention-history-tab",onClick:nL,"aria-label":v>0?`Recent updates — ${v} new`:"Recent updates",title:v>0?`${v} new updates since last viewed`:"Recent updates",children:[G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),v>0&&G("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:v>9?"9+":v},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[G("div",{class:"attention-history-header",children:[G("div",{class:"attention-history-header-text",children:[G("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),G("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"attention-history-close",onClick:WY,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"attention-history-list",children:$.map((J)=>G("article",{class:`attention-history-entry attention-tone-${J.tone}`,children:[G("div",{class:"attention-history-meta",children:[G("span",{class:"attention-history-kind",children:J.title},void 0,!1,void 0,this),G("time",{class:"attention-history-time",dateTime:new Date(J.createdAt).toISOString(),children:dL(J.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{class:"attention-history-detail",children:J.detail},void 0,!1,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qY(){let $=C2.value;if(!$)return null;return G("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:V2,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[G("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var M8=null;function BY($){M8=$}function $4(){if(M8?.isConnected){let $=M8.getBoundingClientRect();if($.width>0&&$.height>0)return{left:$.left,top:$.top,width:$.width,height:$.height}}return{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}function C1(){let $=$4();return{x:$.left+$.width/2,y:$.top+$.height/2}}var x0=s(null),XY=0;function g4($,U,v={}){return new Promise((J)=>{x0.value?.resolve(null),XY+=1,x0.value={seq:XY,title:$,placeholder:U,initial:v.initial??"",allowEmpty:v.allowEmpty??!1,confirm:v.confirm??"Add",resolve:J}})}function m0($){let U=x0.value;x0.value=null,U?.resolve($)}function HY(){let $=x0.value,U=C(null);if(u(()=>{if(!$)return;let J=(_)=>{if(_.key!=="Escape")return;_.preventDefault(),_.stopPropagation(),m0(null)};return window.addEventListener("keydown",J,{capture:!0}),()=>window.removeEventListener("keydown",J,{capture:!0})},[$]),!$)return null;let v=()=>{let J=U.current?.value.trim()??"";m0(J?J:$.allowEmpty?"":null)};return G("div",{class:"text-prompt-backdrop",onPointerDown:()=>m0(null),children:G("div",{class:"text-prompt",role:"dialog","aria-label":$.title,"data-testid":"text-prompt",onPointerDown:(J)=>J.stopPropagation(),children:[G("div",{class:"text-prompt-title",children:$.title},void 0,!1,void 0,this),G("input",{ref:(J)=>{if(U.current=J,!J)return;if(J.focus(),$.initial)J.select()},class:"text-prompt-input",type:"text",defaultValue:$.initial,placeholder:$.placeholder,onKeyDown:(J)=>{if(J.key==="Enter")J.preventDefault(),J.stopPropagation(),v();else if(J.key==="Escape")J.preventDefault(),J.stopPropagation(),m0(null)}},$.seq,!1,void 0,this),G("div",{class:"text-prompt-actions",children:[G("button",{type:"button",class:"text-prompt-cancel",onClick:()=>m0(null),children:"Cancel"},void 0,!1,void 0,this),G("button",{type:"button",class:"text-prompt-confirm",onClick:v,children:$.confirm},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function A8($,U){console.error(`[intent-bridge] ${$} failed`,U)}var u2=(()=>{try{let $=new URLSearchParams(window.location.search).get("agent")?.trim();return $?$.slice(0,64):null}catch{return null}})();function I8($){let U={...$?.headers};if(u2)U["x-pmx-source"]=u2;else U["X-PMX-Workbench"]="1";return{...$,headers:U}}async function b$($,U,v,J){try{return await(await fetch(U,I8(J))).json()}catch(_){return A8($,_),v}}async function u6($,U,v){try{return{ok:(await fetch(U,I8(v))).ok}}catch(J){return A8($,J),{ok:!1}}}async function U4($,U,v){try{await fetch(U,I8(v))}catch(J){A8($,J)}}async function QY($,U={}){return b$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:U})})}async function D1($){let v=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await b$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await U4("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:v,source:"browser"})}),!0}async function N4($){return(await b$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function h0($){return b$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function LY($,U){return b$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:U})})}async function m2($){return u6("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function x2($){return b$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function FY(){return[]}async function c0($,U,v,J,_){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return b$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...U?{position:U}:{},...v?{parentNodeId:v}:{},...J&&J.length>0?{contextNodeIds:J}:{},..._?{threadNodeId:_}:{}})})}async function PY($,U){return c0(U,void 0,void 0,void 0,$)}async function kY($,U={}){await U4("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...U.recordHistory===!1?{recordHistory:!1}:{}})})}async function j1($,U,v,J){return b$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:U,type:v,label:J})})}async function d6($){return b$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function b6($,U){return b$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)})}async function h2($,U){return b$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U?{url:U}:{})})}async function d4($){return b$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function w8(){return b$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function bY(){return b$("fetchAgentPresence","/api/canvas/ax/presence",null)}async function MY($,U){return b$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:U})})}async function c2($){return b$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function AY($,U={}){return b$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...IY(),...U.recordHistory===!1?{recordHistory:!1}:{}})})}function IY(){if(typeof window>"u")return{};let $=$4(),U=Math.round($.width),v=Math.round($.height);if(!U||!v)return{};return{clientWidth:U,clientHeight:v}}async function l0(){let $=IY();if(!("clientWidth"in $))return;await U4("reportClientViewportSize","/api/canvas/viewport",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,recordHistory:!1})})}async function BU($){return b$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function g8($,U,v){return b$("addToGroupFromClient","/api/canvas/group/add",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$,childIds:U,...v?{childLayout:v}:{}})})}async function l2($,U){return b6($,{children:U})}async function XU($){return b$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function wY(){return b$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function gY($){return b$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function NY($){return b$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function SY($){return b$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}async function r2($,U){return b$("updateEdgeFromClient",`/api/canvas/edge/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)})}async function i2($){return b$("removeEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({edge_id:$})})}var O6={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",diff:"DIFF",mermaid:"MERMAID",image:"IMG",html:"HTML",group:"GROUP"},r0=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","diff","mermaid","image","html"]);function RY($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}var tL=700,aL=1600;function sL($){return $.replace(/\r\n?/g,`
23
23
  `).replace(/[ \t\f\v]+/g," ").replace(/\n\s+/g,`
24
24
  `).replace(/\s+\n/g,`
25
25
  `).replace(/\n{3,}/g,`
26
26
 
27
- `).trim()}function Z6($,v){if(v<=0)return"";let g=Tq($);if(g.length<=v)return g;if(v<=1)return g.slice(0,v);return`${g.slice(0,Math.max(0,v-1)).trimEnd()}…`}function __($,v){if(typeof $==="string")return Z6($,v);if($===null||$===void 0)return"";try{return Z6(JSON.stringify($),v)}catch{return""}}function jq($,v){let g=[],_=typeof $.url==="string"?$.url:"",U=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",J=typeof $.status==="string"?$.status:"",G=typeof $.statusCode==="number"?$.statusCode:null,b=typeof $.error==="string"?$.error:"",O=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(_)g.push(`URL: ${_}`);if(U)g.push(`Title: ${U}`);if(z)g.push(`Description: ${z}`);if(J||G!==null)g.push(`Fetch: ${J||"unknown"}${G!==null?` (${G})`:""}`);if(b)g.push(`Error: ${b}`);let W=g.join(`
28
- `),B=Math.max(0,v-W.length-(W?2:0)),k=B>0?Z6(O,B):"";if(W&&k)return`${W}
29
-
30
- ${k}`;if(W)return Z6(W,v);return Z6(O,v)}function uq($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let g=Object.keys($).sort();return g.length>0?`Input keys: ${g.join(", ")}`:""}function Cq($,v){let g=[],_=typeof $.title==="string"?$.title:"",U=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",J=typeof $.serverName==="string"?$.serverName:"",G=typeof $.toolName==="string"?$.toolName:"",b=typeof $.resourceUri==="string"?$.resourceUri:"",O=typeof $.path==="string"?$.path:"",W=typeof $.url==="string"?$.url:"",B=typeof $.sessionStatus==="string"?$.sessionStatus:"",k=uq($.toolInput);if(_)g.push(`App: ${_}`);if(U||z)g.push(`Mode: ${[U,z].filter(Boolean).join(" / ")}`);if(J||G)g.push(`Source: ${[J,G].filter(Boolean).join(" / ")}`);if(b)g.push(`Resource: ${b}`);if(O)g.push(`Path: ${O}`);if(W)g.push(`URL: ${W}`);if(B)g.push(`Session: ${B}`);if(k)g.push(k);if(g.length===0)return"MCP App node";return Z6(g.join(`
31
- `),v)}function Vq($,v){let g=[],_=typeof $.content==="string"?$.content:"",U=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",J=typeof $.url==="string"?$.url:"",G=typeof $.projectPath==="string"?$.projectPath:"",b=typeof $.artifactBytes==="number"?$.artifactBytes:null,O=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,W=Array.isArray($.sourceFiles)?$.sourceFiles.filter((k)=>typeof k==="string"):[],B=Array.isArray($.deps)?$.deps.filter((k)=>typeof k==="string"):[];if(_)g.push(_);if(!_&&U)g.push(`Web artifact: ${U}`);if(W.length>0&&!_.includes("Source files:")){let k=O!==null?Math.max(0,O-W.length):0;g.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(b!==null&&!_.includes("Artifact bytes:"))g.push(`Artifact bytes: ${b}`);if(B.length>0&&!_.includes("Dependencies:"))g.push(`Dependencies: ${B.join(", ")}`);if(z)g.push(`Path: ${z}`);if(G)g.push(`Project: ${G}`);if(J)g.push(`URL: ${J}`);return g.length>0?Z6(g.join(`
32
- `),v):"Web artifact node"}function fq($,v){let g=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",U=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)g.push(`HTML primitive: ${_}`);if(U)g.push(U);if(z!==void 0)g.push(`Data: ${__(z,v)}`);return Z6(g.join(`
33
- `),v)}function Fb($,v={}){let g=v.defaultTextLength??Rq,_=v.webpageTextLength??Dq;switch($.type){case"markdown":{let U=$.data.rendered||$.data.content||"";return Z6(U,g)}case"mcp-app":{if($.data.viewerType==="web-artifact")return Vq($.data,g);let U=$.data.chartConfig;if(U){let z=U.title||"Untitled chart",J=U.type||"unknown",G=Array.isArray(U.labels)?U.labels.join(", "):"";return Z6(`Chart: ${z} (${J}). Labels: ${G}`,g)}return Cq($.data,g)}case"webpage":return jq($.data,_);case"json-render":case"graph":{let U=$.data.graphConfig;if(U)return Z6(`Graph: ${JSON.stringify(U)}`,g);return __($.data.spec??{},g)}case"html":{if(typeof $.data.agentSummary==="string")return Z6($.data.agentSummary,g);if(typeof $.data.htmlPrimitive==="string")return fq($.data,g);return __({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},g)}case"prompt":case"response":{let U=$.data.text||$.data.content||"";return Z6(U,g)}case"file":{let U=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=U?`Path: ${U}
34
-
35
- `:"",G=Math.max(0,g-J.length);return`${J}${Z6(z,G)}`.trim()}default:return __($.data,g)}}function rq($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((g-U)**2+(_-z)**2)}function Eq($,v){let g=$.position.x+$.size.width,_=$.position.y+$.size.height,U=v.position.x+v.size.width,z=v.position.y+v.size.height,J=Math.max(0,Math.max($.position.x,v.position.x)-Math.min(g,U)),G=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+G**2)}function mq($){let v=[...$],g=100;return v.sort((_,U)=>{let z=Math.floor(_.position.y/100),J=Math.floor(U.position.y/100);if(z!==J)return z-J;return _.position.x-U.position.x}),v}function cq($){let v=$.find((U)=>U.data.title&&typeof U.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let g={};for(let U of $)g[U.type]=(g[U.type]??0)+1;let _=Object.entries(g).map(([U,z])=>z===1?U:`${z} ${U}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function iq($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function xq($,v){let g=v.filter((U)=>iq($.bounds,{x:U.position.x,y:U.position.y,width:U.size.width,height:U.size.height})),_=g.map((U)=>typeof U.data.title==="string"&&U.data.title.length>0?U.data.title:U.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:g.map((U)=>U.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function hq($,v=200){if($.length===0)return[];let g=new Map,_=(b)=>{while(g.get(b)!==b){let O=g.get(b);g.set(b,g.get(O)),b=O}return b},U=(b,O)=>{let W=_(b),B=_(O);if(W!==B)g.set(W,B)};for(let b of $)g.set(b.id,b.id);for(let b=0;b<$.length;b++)for(let O=b+1;O<$.length;O++)if(Eq($[b],$[O])<=v)U($[b].id,$[O].id);let z=new Map;for(let b of $){let O=_(b.id);if(!z.has(O))z.set(O,[]);z.get(O).push(b)}let J=[],G=0;for(let[,b]of z){if(b.length<2)continue;let O=b.map((q)=>q.position.x),W=b.map((q)=>q.position.y),B=b.map((q)=>q.position.x+q.size.width),k=b.map((q)=>q.position.y+q.size.height),Y=Math.min(...O),F=Math.min(...W),X=Math.max(...B),H=Math.max(...k);J.push({id:`cluster-${G++}`,nodeIds:b.map((q)=>q.id),label:cq(b),centroid:{x:Math.round((Y+X)/2),y:Math.round((F+H)/2)},bounds:{x:Y,y:F,width:X-Y,height:H-F}})}return J.sort((b,O)=>{let W=Math.floor(b.centroid.y/200),B=Math.floor(O.centroid.y/200);if(W!==B)return W-B;return b.centroid.x-O.centroid.x}),J}function lq($,v,g=5,_=600){let U=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return U.map((J)=>{let G=z.map((b)=>({node:b,distance:rq(J,b)})).filter((b)=>b.distance<=_).sort((b,O)=>b.distance-O.distance).slice(0,g);return{pinnedNodeId:J.id,pinnedNodeTitle:J.data.title??null,neighbors:G.map((b)=>({id:b.node.id,type:b.node.type,title:b.node.data.title??null,distance:Math.round(b.distance)}))}})}function $1($,v,g,_=[]){let U=hq($),z=new Map;for(let O of U)for(let W of O.nodeIds)z.set(W,O.id);let G=mq($).map((O,W)=>({id:O.id,type:O.type,title:O.data.title??null,content:Fb(O,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(O.id)??null,readingOrder:W})),b=lq($,g);return{totalNodes:$.length,clusters:U,nodesInReadingOrder:G,pinnedNeighborhoods:b,annotations:_.map((O)=>xq(O,$))}}function Vv($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function z_($,v){return{id:$?.id??v,title:Vv($),nodeType:$?.type??"markdown"}}function Zb($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:Vv(v.get($.from)),toTitle:Vv(v.get($.to))}}function J_($){return new Map($.map((v)=>[v.id,v]))}function Ib($){return new Map($.map((v)=>[v.id,v]))}function m6($){return Array.from($).sort((v,g)=>v.localeCompare(g))}function kz($,v){if($.length!==v.length)return!1;for(let g=0;g<$.length;g++)if($[g]!==v[g])return!1;return!0}function qz($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((g)=>typeof g==="string").sort((g,_)=>g.localeCompare(_))}function Qb($){let v=new Map;for(let g of $.clusters){let _=[...g.nodeIds].sort((U,z)=>U.localeCompare(z));for(let U of _)v.set(U,_.filter((z)=>z!==U))}return v}function wb($){let v=new Map;for(let g of $.pinnedNeighborhoods)v.set(g.pinnedNodeId,g.neighbors.map((_)=>_.id).sort((_,U)=>_.localeCompare(U)));return v}function pq($,v){let g=m6(Array.from(v).filter((U)=>!$.has(U))),_=m6(Array.from($).filter((U)=>!v.has(U)));return{added:g,removed:_}}function Ab($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function oq($,v,g){if(!$||!g)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:g};let _=J_($.nodes),U=m6(v).filter((b)=>_.has(b)),z=new Set(U),J=new Set,G=[];for(let b of g.pinnedNeighborhoods){if(!z.has(b.pinnedNodeId))continue;let O=m6([b.pinnedNodeId,...b.neighbors.map((W)=>W.id)]).filter((W,B,k)=>k.indexOf(W)===B&&_.has(W));for(let W of O)if(!z.has(W))J.add(W);G.push({id:`region-${b.pinnedNodeId}`,primaryNodeId:b.pinnedNodeId,nodeIds:O})}if(G.length===0&&U.length>0)for(let b of U)G.push({id:`region-${b}`,primaryNodeId:b,nodeIds:[b]});return{layout:$,pinnedNodeIds:U,primaryFocusNodeIds:U,secondaryFocusNodeIds:m6(J),regions:G,spatial:g}}class G_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return oq(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let v=$&&typeof $==="object"?$:{},g=Array.isArray(v.nodeIds)?v.nodeIds.filter((O)=>typeof O==="string"):[],_=Ab($),U=new Set(g),{added:z,removed:J}=pq(this.currentPins,U);if(this.currentPins=U,!this.currentLayout)return[];let G=J_(this.currentLayout.nodes),b={added:z.map((O)=>z_(G.get(O),O)),removed:J.map((O)=>z_(G.get(O),O))};if(this.previousSpatial=$1(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),b.added.length===0&&b.removed.length===0)return[];return[{type:"context-pin",..._,...b}]}handleLayoutUpdate($){let v=$&&typeof $==="object"?$:{},g=v.layout&&typeof v.layout==="object"?v.layout:null;if(!g)return[];let _=Ab($);if(!this.currentLayout)return this.currentLayout=g,this.previousSpatial=$1(g.nodes,g.edges,this.currentPins,g.annotations??[]),[];let U=this.currentLayout,z=this.previousSpatial??$1(U.nodes,U.edges,this.currentPins,U.annotations??[]),J=$1(g.nodes,g.edges,this.currentPins,g.annotations??[]),G=[],b=J_(U.nodes),O=J_(g.nodes),W=Ib(U.edges),B=Ib(g.edges),k=m6(Array.from(B.keys()).filter((q)=>!W.has(q))).map((q)=>B.get(q)).filter((q)=>q!==void 0);if(k.length>0)G.push({type:"connect",..._,edges:k.map((q)=>Zb(q,O))});let Y=m6(Array.from(b.keys()).filter((q)=>!O.has(q))),F=m6(Array.from(W.keys()).filter((q)=>!B.has(q)));if(Y.length>0||F.length>0)G.push({type:"remove",..._,nodes:Y.map((q)=>z_(b.get(q),q)),edges:F.map((q)=>W.get(q)).filter((q)=>q!==void 0).map((q)=>Zb(q,b))});let X=this.buildGroupEvent(b,O,_);if(X)G.push(X);let H=this.buildMoveEndEvent(U,g,b,O,z,J,_);if(H)G.push(H);return this.currentLayout=g,this.previousSpatial=J,G}buildGroupEvent($,v,g){let _=m6(Array.from($.values()).filter((G)=>G.type==="group").map((G)=>G.id)),U=m6(Array.from(v.values()).filter((G)=>G.type==="group").map((G)=>G.id)),z=U.filter((G)=>!_.includes(G)).map((G)=>{let b=v.get(G),O=qz(b);return{id:G,title:Vv(b),childCount:O.length}}),J=[];for(let G of U.filter((b)=>_.includes(b))){let b=qz($.get(G)),O=qz(v.get(G));if(kz(b,O))continue;J.push({id:G,title:Vv(v.get(G)),addedChildIds:O.filter((W)=>!b.includes(W)),removedChildIds:b.filter((W)=>!O.includes(W)),childCount:O.length})}if(z.length===0&&J.length===0)return null;return{type:"group",...g,created:z,updated:J}}buildMoveEndEvent($,v,g,_,U,z,J){let G=m6(Array.from(_.keys()).filter((H)=>{let q=g.get(H),L=_.get(H);if(!q||!L)return!1;return q.position.x!==L.position.x||q.position.y!==L.position.y}));if(G.length===0)return null;let b=Qb(U),O=Qb(z),W=wb(U),B=wb(z),k=new Map,Y=(H,q)=>{let L=k.get(H)??new Set;L.add(q),k.set(H,L)};for(let H of G){let q=b.get(H)??[],L=O.get(H)??[];if(!kz(q,L))if(q.length===0&&L.length>0)Y(H,"joined cluster");else if(q.length>0&&L.length===0)Y(H,"left cluster");else Y(H,"cluster changed")}let F=new Set([...W.keys(),...B.keys()]);for(let H of F){let q=W.get(H)??[],L=B.get(H)??[];if(kz(q,L))continue;let I=Vv(_.get(H)??g.get(H))??H,N=L.filter((x)=>!q.includes(x)),T=q.filter((x)=>!L.includes(x));for(let x of N)if(G.includes(x))Y(x,`entered pinned neighborhood of "${I}"`);for(let x of T)if(G.includes(x))Y(x,`left pinned neighborhood of "${I}"`);if(G.includes(H))Y(H,"pinned neighborhood changed")}let X=G.filter((H)=>(k.get(H)?.size??0)>0).map((H)=>{let q=_.get(H);return{...z_(q,H),reasons:Array.from(k.get(H)??[]).sort((L,I)=>L.localeCompare(I))}});if(X.length===0)return null;return{type:"move-end",...J,nodes:X}}}var Lz=new G_,Fz=[],v1=null,fv=null,Pz="",Xz=0;function Sb($,v){return globalThis.setTimeout($,v)}function Hz($){if($===null)return;globalThis.clearTimeout($)}function nq($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function M4($,v){return $&&$.trim().length>0?$.trim():v}function G4($,v=3){if($.length===0)return"";if($.length<=v)return $.join(", ");return`${$.slice(0,v).join(", ")} +${$.length-v}`}function tq($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function c6($,v,g,_,U=Date.now()){return{id:`${$}-${U}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:g,nodeIds:tq(_),createdAt:U}}function Mb($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let v=/^entered pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved into focus around ${v[1]}`;let g=/^left pinned neighborhood of "(.+)"$/.exec($);if(g)return`moved out of focus around ${g[1]}`;return $}function dq($){let v=$.added.map((U)=>M4(U.title,U.id)),g=$.removed.map((U)=>M4(U.title,U.id));if(v.length===0&&g.length===0)return null;let _="";if(v.length>0&&g.length===0)_=`Now in focus: ${G4(v)}`;else if(g.length>0&&v.length===0)_=`Removed from focus: ${G4(g)}`;else{let U=[];if(v.length>0)U.push(`${G4(v)} added`);if(g.length>0)U.push(`${G4(g)} removed`);_=U.join(" · ")}return c6("context","Context updated",_,[...$.added.map((U)=>U.id),...$.removed.map((U)=>U.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function aq($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return c6("relationship","Relationship added",`${M4(v.fromTitle,v.fromId)} linked to ${M4(v.toTitle,v.toId)}`,[v.fromId,v.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return c6("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((v)=>[v.fromId,v.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function sq($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>M4(_.title,_.id)),g=[];if(v.length>0)g.push(G4(v));if($.edges.length>0)g.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return c6("remove","Items removed",g.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function eq($){if($.created.length>0){let v=$.created.map((g)=>M4(g.title,g.id));return c6("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${v[0]} now frames ${$.created[0].childCount} items`:G4(v),$.created.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((g)=>M4(g.title,g.id));return c6("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${v[0]} now holds ${$.updated[0].childCount} items`:G4(v),$.updated.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function $P($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),g=$.nodes.map((z)=>M4(z.title,z.id)),_=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(v.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return c6("neighborhood","Neighborhood changed",`${g[0]} ${Mb($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return c6("neighborhood","Neighborhood changed",G4(g),$.nodes.map((z)=>z.id),_)}let U=v.filter((z)=>z.includes("cluster"));if(U.length>0){let z=U.every((J)=>J==="joined cluster");if($.nodes.length===1)return c6("cluster",z?"Cluster formed":"Cluster changed",`${g[0]} ${Mb($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return c6("cluster",z?"Cluster formed":"Cluster changed",G4(g),$.nodes.map((J)=>J.id),_)}return null}function vP($){switch($.type){case"context-pin":return dq($);case"connect":return aq($);case"remove":return sq($);case"group":return eq($);case"move-end":return $P($)}}function UP(){let $=Lz.getAttentionSnapshot();T7($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function Nb(){if(v1!==null)return;let $=Fz.shift()??null;if(!$){cg(null);return}cg($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));v1=Sb(()=>{v1=null,cg(null),Nb()},v)}function yb($){Fz.push($),Nb()}function rv($,v,g="",_=[]){yb(c6($,v,g,_))}function gP($){if(Hz(fv),fv=null,ig([]),$.length===0)return;nq(()=>{ig($),fv=Sb(()=>{fv=null,ig([])},900)})}function _P($){let v=`${$.tone}:${$.title}:${$.detail}`,g=$.createdAt;if(v===Pz&&g-Xz<1200)return!0;return Pz=v,Xz=g,!1}function Zz(){Hz(v1),Hz(fv),v1=null,fv=null,Fz=[],Pz="",Xz=0,Lz=new G_,D7()}function Iz($){let v=Lz.handleMessage($).map((g)=>vP(g)).filter((g)=>g!==null);UP();for(let g of v){if(_P(g))continue;j7(g),yb(g),gP(g.nodeIds)}}async function S4($,v,g,_){let U=await ng({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...g?{payload:g}:{}});if(U.ok)rv("context",_,"",[$.id]);else rv("remove","AX action failed",U.error??U.code??"Unknown error",[$.id])}var zv={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function zP($){let v=$.title||$.label||$.key||"Context",g=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",U=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",J=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:v,summary:g,pathDisplay:_,category:U,sourceKind:z,status:J,required:$.required===!0}}function i6($){return typeof $==="string"?$.trim():""}function JP($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function GP($){let v=i6($.title),g=i6($.content),_=JP(i6($.rendered)),U=g||_,z=i6($.path);if(!v&&!U&&!z)return null;return{title:v||"Context",summary:U,path:z}}function KP($){let v=i6($.data.title)||$.id,g=i6($.data.content)||i6($.data.excerpt)||i6($.data.description)||i6($.data.pageTitle)||"",_=i6($.data.path)||i6($.data.url);return{id:$.id,title:v,summary:g,kind:v6[$.type]??$.type,path:_}}function Rb($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function bP($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function Jv({node:$,expanded:v=!1,pinnedNodes:g=[]}){let _=$.data.cards??[],U=$.data.auxTabs??[],z=g.map(KP),J=z.length>0,G=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,b=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,O=typeof $.data.utilization==="number"?$.data.utilization:null,W=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,B=O!==null?Math.max(0,Math.min(100,Math.round(O*100))):null,k=bP(O??0),Y=!J&&_.length===0&&U.length===0?GP($.data):null,F=async(X)=>{let H=typeof X.path==="string"?X.path.trim():"";if(!H)return;await hg(H)};return K("div",{style:{display:"flex",flexDirection:"column",gap:v?"10px":"6px",fontSize:v?"14px":"12px",maxWidth:v?"760px":void 0,margin:v?"0 auto":void 0,width:v?"100%":void 0,padding:v?"8px 0":void 0},children:[K("div",{style:{display:"flex",justifyContent:"flex-end"},children:K("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:zv,onClick:(X)=>{X.stopPropagation(),S4($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b!==null&&b>0&&K("div",{style:{marginBottom:"8px"},children:[K("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),K("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:K("div",{style:{height:"100%",width:`${Math.min(100,(O??0)*100)}%`,background:k,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[B,"% — ",Rb(G)," / ",Rb(b)," tokens",W!==null&&K(t$,{children:[" · ",W," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&K("div",{children:[K("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((X)=>K("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[K("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:X.title},void 0,!1,void 0,this),X.summary&&K("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:X.summary},void 0,!1,void 0,this),K("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:K("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:X.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),X.path&&K("div",{style:{marginTop:"6px"},children:[K("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:X.path},void 0,!1,void 0,this),X.path.startsWith("/")&&K("button",{type:"button",onClick:()=>void hg(X.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},X.id,!0,void 0,this))]},void 0,!0,void 0,this),!J&&_.length>0&&K("div",{children:[K("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",_.length,")"]},void 0,!0,void 0,this),_.map((X)=>{let H=zP(X);return K("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[K("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:H.title},void 0,!1,void 0,this),K("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:H.summary},void 0,!1,void 0,this),H.pathDisplay&&K("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:H.pathDisplay},void 0,!1,void 0,this),K("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[K("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:H.status},void 0,!1,void 0,this),H.category&&K("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.category},void 0,!1,void 0,this),K("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.sourceKind},void 0,!1,void 0,this),H.required&&K("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X.path&&K("div",{style:{marginTop:"6px"},children:K("button",{type:"button",onClick:()=>void F(X),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},X.key??H.pathDisplay??H.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&U.length>0&&K("div",{children:[K("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:_.length>0?"8px":0},children:["References (",U.length,")"]},void 0,!0,void 0,this),U.map((X)=>K("a",{href:X.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[X.url,X.reason&&K("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",X.reason,")"]},void 0,!0,void 0,this)]},X.id,!0,void 0,this))]},void 0,!0,void 0,this),Y&&K("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[K("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:Y.title},void 0,!1,void 0,this),Y.summary&&K("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:Y.summary},void 0,!1,void 0,this),Y.path&&K("div",{style:{marginTop:"6px"},children:[K("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:Y.path},void 0,!1,void 0,this),K("button",{type:"button",onClick:()=>void hg(Y.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!J&&!Y&&_.length===0&&U.length===0&&K("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Db($){return $.replace(/^[ab]\//,"")}function OP($,v){if(v&&v!=="/dev/null")return Db(v);if($&&$!=="/dev/null")return Db($);return null}function WP($){if(!$.trim())return[];let v=$.split(`
36
- `);if(v.length>0&&v[v.length-1]==="")v.pop();let g=[],_=null,U=!1,z=(J)=>{let G={path:J,lines:[]};return U=!1,g.push(G),G};for(let J=0;J<v.length;J++){let G=v[J]??"",b=G.match(/^diff --git a\/(.+?) b\/(.+)$/);if(b){_=z(b[2]??null);continue}let O=v[J+1]??"";if(G.startsWith("--- ")&&O.startsWith("+++ ")){let B=OP(G.slice(4).trim(),O.slice(4).trim());if(_&&!U){if(!_.path)_.path=B}else _=z(B);J++;continue}if(!_)_=z(null);let W=_;if(G.startsWith("@@"))U=!0,W.lines.push({kind:"hunk",text:G});else if(G.startsWith("+"))W.lines.push({kind:"add",text:G});else if(G.startsWith("-"))W.lines.push({kind:"remove",text:G});else W.lines.push({kind:"context",text:G})}return g}function K_({node:$}){let v=typeof $.data.content==="string"?$.data.content:"",g=D$(()=>WP(v),[v]);if(g.length===0)return K("div",{class:"diff-node diff-node-empty",children:"Empty diff"},void 0,!1,void 0,this);return K("div",{class:"diff-node",children:g.map((_,U)=>K("div",{class:"diff-file",children:[_.path&&K("div",{class:"diff-file-header",children:_.path},void 0,!1,void 0,this),K("pre",{class:"diff-lines",children:_.lines.map((z,J)=>K("div",{class:z.kind==="hunk"?"diff-hunk":`diff-line-${z.kind}`,children:z.text||" "},J,!1,void 0,this))},void 0,!1,void 0,this)]},`${_.path??"anonymous"}-${U}`,!0,void 0,this))},void 0,!1,void 0,this)}var BP="/api/canvas/iframe-probe",YP=3000,I6=B$(null);function kP(){let $=new URLSearchParams(window.location.search).get("iframe-mode");return $==="srcdoc"||$==="src"?$:null}function qP($=YP){return new Promise((v)=>{let g=document.createElement("iframe");g.setAttribute("data-pmx-iframe-probe",""),g.style.cssText="position:fixed;width:1px;height:1px;left:-9999px;border:none",g.setAttribute("sandbox","allow-scripts");let _=(z)=>{window.clearTimeout(U),g.remove(),v(z)},U=window.setTimeout(()=>_(!1),$);g.addEventListener("load",()=>_(!0)),g.addEventListener("error",()=>_(!1)),g.src=BP,(document.body??document.documentElement).appendChild(g)})}var b_=null;function PP(){try{return window.self!==window.top}catch{return!0}}function XP(){return window.__PMX_AMP_ORB===!0}function Tb($={}){if(I6.value)return Promise.resolve(I6.value);if(b_)return b_;let v=kP();if(v)return I6.value=v,Promise.resolve(v);if(!($.embedded??PP()))return I6.value="src",Promise.resolve("src");if($.ampOrb??XP())return I6.value="srcdoc",Promise.resolve("srcdoc");return b_=qP().then((g)=>{let _=g?"src":"srcdoc";return I6.value=_,_}),b_}function HP($){let v=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[v]??(v.toUpperCase()||"Text")}var Qz=500;function LP($){let v=$.toLowerCase();if(v.endsWith(".csv"))return",";if(v.endsWith(".tsv"))return"\t";return null}function FP($,v){let g=[],_=[],U="",z=!1,J=!1;for(let b=0;b<$.length;b++){let O=$[b];if(J=!0,z){if(O==='"')if($[b+1]==='"')U+='"',b++;else z=!1;else if(O==="\r"&&$[b+1]===`
37
- `)U+=`
38
- `,b++;else U+=O;continue}if(O==='"'&&U==="")z=!0;else if(O===v)_.push(U),U="";else if(O===`
39
- `||O==="\r"){if(O==="\r"&&$[b+1]===`
40
- `)b++;_.push(U),U="",g.push(_),_=[],J=!1}else U+=O}if(J)_.push(U),g.push(_);let G=g.shift()??[];return{header:G,rows:g.map((b)=>Array.from({length:G.length},(O,W)=>b[W]??""))}}function wz($){if(!Number.isFinite($)||$<0)return"";if($<1024)return`${Math.round($)} B`;let v=["KB","MB","GB","TB"],g=$/1024,_=0;while(g>=1024&&_<v.length-1)g/=1024,_++;return`${g<10?g.toFixed(1):Math.round(g)} ${v[_]}`}function O_({node:$,expanded:v=!1}){let g=$.data.path||$.data.content||"",_=$.data.title||g.split("/").pop()||"File",U=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,G=$.data.byteSize,b=$.data.binary===!0,O=$.data.truncated===!0,B=$.data.mimeType==="application/pdf"||g.toLowerCase().endsWith(".pdf"),k=b||B,[Y,F]=i(U??""),[X,H]=i(!U&&!!g&&!k),[q,L]=i(null),[I,N]=i(0);r(()=>{if(!g)return;if(k){H(!1);return}if(U!==void 0){F(U),H(!1);return}let a=!1;return H(!0),L(null),oU(g).then(({content:J$})=>{if(a)return;if(!J$&&J$!==""){L("File not found"),H(!1);return}F(J$),H(!1);let P$=J$.split(`
41
- `).length;g$($.id,{fileContent:J$,lineCount:P$}),k6($.id,{data:{fileContent:J$,lineCount:P$}})}).catch(()=>{if(!a)L("Failed to load file"),H(!1)}),()=>{a=!0}},[g,U,k]),r(()=>{if(U!==void 0&&U!==Y)F(U)},[U]);let T=y(()=>{if(!g)return;if(k){N((a)=>a+1);return}H(!0),L(null),g$($.id,{fileContent:void 0}),k6($.id,{data:{fileContent:void 0}}),oU(g).then(({content:a})=>{F(a),H(!1);let J$=a.split(`
42
- `).length,P$=new Date().toISOString();g$($.id,{fileContent:a,lineCount:J$,updatedAt:P$}),k6($.id,{data:{fileContent:a,lineCount:J$,updatedAt:P$}})}).catch(()=>{L("Failed to reload"),H(!1)})},[g,$.id,k]),x=HP(g),S=Y.split(`
43
- `),l=`${String(S.length).length+1}ch`,t=LP(g),M=D$(()=>{if(!t||k||!Y)return null;let a=FP(Y,t);return a.header.length>=2?a:null},[Y,t,k]),R=`/api/canvas/file-bytes?nodeId=${encodeURIComponent($.id)}${I?`&v=${I}`:""}`,n=I6.value==="srcdoc",p=k||M!==null,c=O?K("div",{class:"file-node-notice",children:["Showing the first ",wz(Y.length)," of ",wz(G??Y.length)]},void 0,!0,void 0,this):null;if(!g)return K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return K("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:v?"13px":"11px"},children:[K("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[K("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:x},void 0,!1,void 0,this),K("span",{style:{color:"var(--c-text-soft)",fontSize:v?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:g,children:g},void 0,!1,void 0,this),J!==void 0&&K("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[J," lines"]},void 0,!0,void 0,this),z&&K("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),K("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(a)=>{a.stopPropagation(),S4($,"ax.evidence.add",{kind:"file",title:g.split("/").pop()||g,ref:g},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),K("button",{type:"button",onClick:T,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{style:{flex:1,minHeight:0,overflow:p?"hidden":"auto",padding:p?0:"8px 0",background:v?"var(--c-panel-soft)":void 0,borderRadius:v?"0 0 8px 8px":void 0},children:[B&&(n?K("div",{class:"file-node-placeholder",children:[K("div",{children:"PDF preview is unavailable in this embedded host."},void 0,!1,void 0,this),K("a",{class:"file-node-link",href:R,target:"_blank",rel:"noreferrer",children:"Open PDF"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):K("iframe",{src:R,title:_,sandbox:"",style:{width:"100%",height:"100%",border:"none",display:"block"}},void 0,!1,void 0,this)),!B&&b&&K("div",{class:"file-node-placeholder",children:[K("div",{class:"file-node-placeholder-name",children:_},void 0,!1,void 0,this),K("div",{children:"Binary file"},void 0,!1,void 0,this),G!==void 0&&K("div",{children:wz(G)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!k&&K(t$,{children:[X&&K("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),q&&K("div",{style:{color:"var(--c-danger)",padding:"12px"},children:q},void 0,!1,void 0,this),!X&&!q&&(M?K("div",{class:"file-table-shell",children:[c,M.rows.length>Qz&&K("div",{class:"file-node-notice",children:["Showing ",Qz," of ",M.rows.length," rows"]},void 0,!0,void 0,this),K("div",{class:"file-table-wrap",children:K("table",{class:"file-table",children:[K("thead",{children:K("tr",{children:M.header.map((a,J$)=>K("th",{children:a},J$,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("tbody",{children:M.rows.slice(0,Qz).map((a,J$)=>K("tr",{children:a.map((P$,A)=>K("td",{children:P$},A,!1,void 0,this))},J$,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):K(t$,{children:[c,K("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:S.map((a,J$)=>K("div",{style:{display:"flex",minHeight:"1.55em"},children:[K("span",{style:{width:l,minWidth:l,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:J$+1},void 0,!1,void 0,this),K("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:a||`
44
- `},void 0,!1,void 0,this)]},J$,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var ZP=new Set(["title","__type","content","strictSize","arrangeLocked"]);function Ev({node:$}){let v=$.data,_=(typeof v.content==="string"?v.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),U=Object.entries(v).filter(([z])=>!ZP.has(z));if(_.length===0&&U.length===0)return K("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return K("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[_.length>0&&K("div",{style:{display:"flex",flexDirection:"column"},children:_.map((z,J)=>K("div",{style:{padding:"3px 0",borderBottom:J<_.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},J,!1,void 0,this))},void 0,!1,void 0,this),U.map(([z,J])=>K("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[K("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(G)=>G.toUpperCase())},void 0,!1,void 0,this),K("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof J==="object"?JSON.stringify(J):String(J??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var Az=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),S6=Az?"⌘":"Ctrl";function W_($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.slice(g,_),J=U.slice(Math.max(0,g-v.length),g),G=U.slice(_,_+v.length);if(J===v&&G===v){let b=U.slice(0,g-v.length)+z+U.slice(_+v.length);n6($,b,g-v.length,_-v.length);return}if(z){let b=U.slice(0,g)+v+z+v+U.slice(_);n6($,b,g+v.length,_+v.length)}else{let b=U.slice(0,g)+v+v+U.slice(_);n6($,b,g+v.length,g+v.length)}}function U1($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
45
- `,g-1)+1,J=U.indexOf(`
46
- `,_),G=J===-1?U.length:J,b=U.slice(z,G);if(b.startsWith(v)){let W=U.slice(0,z)+b.slice(v.length)+U.slice(G);n6($,W,Math.max(z,g-v.length),Math.max(z,_-v.length));return}let O=U.slice(0,z)+v+U.slice(z);n6($,O,g+v.length,_+v.length)}function IP($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g);if(U){let z=_.slice(0,v)+`[${U}](url)`+_.slice(g),J=v+U.length+3;n6($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(g);n6($,z,v+1,v+5)}}function QP($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g),z="```";if(U){let J=_.slice(0,v)+`\`\`\`
47
- ${U}
48
- \`\`\``+_.slice(g);n6($,J,v+3+1,v+3+1+U.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(g);n6($,J,v+3+1,v+3+1)}}function jb($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
49
- `,g-1)+1,J=U.indexOf(`
50
- `,_),G=J===-1?U.length:J,b=U.slice(z,G).split(`
51
- `),O=g,W=_,B=b.map((Y,F)=>{if(v){if(Y.startsWith(" ")){if(F===0)O=Math.max(z,O-2);return W-=2,Y.slice(2)}else if(Y.startsWith("\t")){if(F===0)O=Math.max(z,O-1);return W-=1,Y.slice(1)}return Y}else{if(F===0)O+=2;return W+=2," "+Y}}),k=U.slice(0,z)+B.join(`
52
- `)+U.slice(G);n6($,k,O,W)}function n6($,v,g,_){let U=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(U)U.call($,v);else $.value=v;$.selectionStart=g,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var B_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>W_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>W_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>W_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>W_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:IP},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>U1($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>U1($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>U1($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>U1($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>U1($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:QP}];function ub($,v){if(!($.metaKey||$.ctrlKey))return!1;let g=B_.find((_)=>_.shortcut===$.key);if(!g)return!1;return $.preventDefault(),g.action(v),!0}function Cb($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),g=getComputedStyle($),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let W of _)v.style[W]=g[W];v.style.position="absolute",v.style.visibility="hidden",v.style.overflow="hidden",v.style.height="auto",v.style.top="0",v.style.left="0";let U=$.value,z=document.createTextNode(U.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=U.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(U.slice($.selectionEnd))),document.body.appendChild(v);let G=J.getBoundingClientRect(),b=v.getBoundingClientRect(),O=$.getBoundingClientRect();return document.body.removeChild(v),{top:O.top+(G.top-b.top)-$.scrollTop,left:O.left+(G.left-b.left)-$.scrollLeft,width:G.width}}var wP=B_.filter(($)=>$.shortcut),AP=B_.filter(($)=>!$.shortcut);function Mz({textareaRef:$}){let[v,g]=i(!1),[_,U]=i({top:0,left:0}),z=D(null),J=D(null),G=y(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){g(!1);return}let B=Cb(W);if(!B){g(!1);return}let k=380,Y=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));U({top:B.top-40,left:Y}),g(!0)},[$]);r(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(G,50)},k=()=>{J.current=setTimeout(()=>g(!1),200)},Y=(F)=>{if(F.shiftKey||F.key.startsWith("Arrow"))B()};return W.addEventListener("select",B),W.addEventListener("mouseup",B),W.addEventListener("keyup",Y),W.addEventListener("blur",k),()=>{if(W.removeEventListener("select",B),W.removeEventListener("mouseup",B),W.removeEventListener("keyup",Y),W.removeEventListener("blur",k),J.current)clearTimeout(J.current)}},[$,G]);let b=y((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let O=Az?"⌘":"Ctrl";return K("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[wP.map((W)=>K("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:`${W.label} (${O}+${W.shortcut.toUpperCase()})`,onClick:()=>b(W),children:W.icon},W.key,!1,void 0,this)),K("div",{class:"md-format-divider"},void 0,!1,void 0,this),AP.map((W)=>K("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:W.label,onClick:()=>b(W),children:W.icon},W.key,!1,void 0,this))]},void 0,!0,void 0,this)}var YO=hk(ab(),1);function cP($){for(var v=1;v<arguments.length;v++){var g=arguments[v];for(var _ in g)if(Object.prototype.hasOwnProperty.call(g,_))$[_]=g[_]}return $}function jz($,v){return Array(v+1).join($)}function $O($){return $.replace(/^\n*/,"")}function vO($){var v=$.length;while(v>0&&$[v-1]===`
53
- `)v--;return $.substring(0,v)}function UO($){return vO($O($))}var iP=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function uz($){return Cz($,iP)}var gO=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function _O($){return Cz($,gO)}function xP($){return JO($,gO)}var zO=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function hP($){return Cz($,zO)}function lP($){return JO($,zO)}function Cz($,v){return v.indexOf($.nodeName)>=0}function JO($,v){return $.getElementsByTagName&&v.some(function(g){return $.getElementsByTagName(g).length})}var pP=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function GO($){return pP.reduce(function(v,g){return v.replace(g[0],g[1])},$)}var O6={};O6.paragraph={filter:"p",replacement:function($){return`
27
+ `).trim()}function D6($,U){if(U<=0)return"";let v=sL($);if(v.length<=U)return v;if(U<=1)return v.slice(0,U);return`${v.slice(0,Math.max(0,U-1)).trimEnd()}…`}function p2($,U){if(typeof $==="string")return D6($,U);if($===null||$===void 0)return"";try{return D6(JSON.stringify($),U)}catch{return""}}function eL($,U){let v=[],J=typeof $.url==="string"?$.url:"",_=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",K=typeof $.status==="string"?$.status:"",W=typeof $.statusCode==="number"?$.statusCode:null,O=typeof $.error==="string"?$.error:"",Y=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(J)v.push(`URL: ${J}`);if(_)v.push(`Title: ${_}`);if(z)v.push(`Description: ${z}`);if(K||W!==null)v.push(`Fetch: ${K||"unknown"}${W!==null?` (${W})`:""}`);if(O)v.push(`Error: ${O}`);let Z=v.join(`
28
+ `),q=Math.max(0,U-Z.length-(Z?2:0)),X=q>0?D6(Y,q):"";if(Z&&X)return`${Z}
29
+
30
+ ${X}`;if(Z)return D6(Z,U);return D6(Y,U)}function $F($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let U=$.elements;if(Array.isArray(U))return`Diagram elements: ${U.length}`;let v=Object.keys($).sort();return v.length>0?`Input keys: ${v.join(", ")}`:""}function UF($,U){let v=[],J=typeof $.title==="string"?$.title:"",_=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",K=typeof $.serverName==="string"?$.serverName:"",W=typeof $.toolName==="string"?$.toolName:"",O=typeof $.resourceUri==="string"?$.resourceUri:"",Y=typeof $.path==="string"?$.path:"",Z=typeof $.url==="string"?$.url:"",q=typeof $.sessionStatus==="string"?$.sessionStatus:"",X=$F($.toolInput);if(J)v.push(`App: ${J}`);if(_||z)v.push(`Mode: ${[_,z].filter(Boolean).join(" / ")}`);if(K||W)v.push(`Source: ${[K,W].filter(Boolean).join(" / ")}`);if(O)v.push(`Resource: ${O}`);if(Y)v.push(`Path: ${Y}`);if(Z)v.push(`URL: ${Z}`);if(q)v.push(`Session: ${q}`);if(X)v.push(X);if(v.length===0)return"MCP App node";return D6(v.join(`
31
+ `),U)}function _F($,U){let v=[],J=typeof $.content==="string"?$.content:"",_=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",K=typeof $.url==="string"?$.url:"",W=typeof $.projectPath==="string"?$.projectPath:"",O=typeof $.artifactBytes==="number"?$.artifactBytes:null,Y=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,Z=Array.isArray($.sourceFiles)?$.sourceFiles.filter((X)=>typeof X==="string"):[],q=Array.isArray($.deps)?$.deps.filter((X)=>typeof X==="string"):[];if(J)v.push(J);if(!J&&_)v.push(`Web artifact: ${_}`);if(Z.length>0&&!J.includes("Source files:")){let X=Y!==null?Math.max(0,Y-Z.length):0;v.push(`Source files: ${Z.join(", ")}${X>0?`, +${X} more`:""}`)}if(O!==null&&!J.includes("Artifact bytes:"))v.push(`Artifact bytes: ${O}`);if(q.length>0&&!J.includes("Dependencies:"))v.push(`Dependencies: ${q.join(", ")}`);if(z)v.push(`Path: ${z}`);if(W)v.push(`Project: ${W}`);if(K)v.push(`URL: ${K}`);return v.length>0?D6(v.join(`
32
+ `),U):"Web artifact node"}function vF($,U){let v=[],J=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",_=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(J)v.push(`HTML primitive: ${J}`);if(_)v.push(_);if(z!==void 0)v.push(`Data: ${p2(z,U)}`);return D6(v.join(`
33
+ `),U)}function TY($,U={}){let v=U.defaultTextLength??tL,J=U.webpageTextLength??aL;switch($.type){case"markdown":{let _=$.data.rendered||$.data.content||"";return D6(_,v)}case"mcp-app":{if($.data.viewerType==="web-artifact")return _F($.data,v);let _=$.data.chartConfig;if(_){let z=_.title||"Untitled chart",K=_.type||"unknown",W=Array.isArray(_.labels)?_.labels.join(", "):"";return D6(`Chart: ${z} (${K}). Labels: ${W}`,v)}return UF($.data,v)}case"webpage":return eL($.data,J);case"json-render":case"graph":{let _=$.data.graphConfig;if(_)return D6(`Graph: ${JSON.stringify(_)}`,v);return p2($.data.spec??{},v)}case"html":{if(typeof $.data.agentSummary==="string")return D6($.data.agentSummary,v);if(typeof $.data.htmlPrimitive==="string")return vF($.data,v);return p2({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},v)}case"prompt":case"response":{let _=$.data.text||$.data.content||"";return D6(_,v)}case"file":{let _=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",K=_?`Path: ${_}
34
+
35
+ `:"",W=Math.max(0,v-K.length);return`${K}${D6(z,W)}`.trim()}default:return p2($.data,v)}}function JF($,U){let v=$.position.x+$.size.width/2,J=$.position.y+$.size.height/2,_=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2;return Math.sqrt((v-_)**2+(J-z)**2)}function zF($,U){let v=$.position.x+$.size.width,J=$.position.y+$.size.height,_=U.position.x+U.size.width,z=U.position.y+U.size.height,K=Math.max(0,Math.max($.position.x,U.position.x)-Math.min(v,_)),W=Math.max(0,Math.max($.position.y,U.position.y)-Math.min(J,z));return Math.sqrt(K**2+W**2)}function KF($){let U=[...$],v=100;return U.sort((J,_)=>{let z=Math.floor(J.position.y/100),K=Math.floor(_.position.y/100);if(z!==K)return z-K;return J.position.x-_.position.x}),U}function GF($){let U=$.find((_)=>_.data.title&&typeof _.data.title==="string");if(U&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let v={};for(let _ of $)v[_.type]=(v[_.type]??0)+1;let J=Object.entries(v).map(([_,z])=>z===1?_:`${z} ${_}`);if(U)return`${U.data.title} + ${J.join(", ")}`;return J.join(", ")}function WF($,U){return $.x<=U.x+U.width&&$.x+$.width>=U.x&&$.y<=U.y+U.height&&$.y+$.height>=U.y}function OF($,U){let v=U.filter((_)=>WF($.bounds,{x:_.position.x,y:_.position.y,width:_.size.width,height:_.size.height})),J=v.map((_)=>typeof _.data.title==="string"&&_.data.title.length>0?_.data.title:_.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:v.map((_)=>_.id),targetNodeTitles:J,target:J.length>0?J.join(", "):"empty canvas region"}}function YF($,U=200){if($.length===0)return[];let v=new Map,J=(O)=>{while(v.get(O)!==O){let Y=v.get(O);v.set(O,v.get(Y)),O=Y}return O},_=(O,Y)=>{let Z=J(O),q=J(Y);if(Z!==q)v.set(Z,q)};for(let O of $)v.set(O.id,O.id);for(let O=0;O<$.length;O++)for(let Y=O+1;Y<$.length;Y++)if(zF($[O],$[Y])<=U)_($[O].id,$[Y].id);let z=new Map;for(let O of $){let Y=J(O.id);if(!z.has(Y))z.set(Y,[]);z.get(Y).push(O)}let K=[],W=0;for(let[,O]of z){if(O.length<2)continue;let Y=O.map((H)=>H.position.x),Z=O.map((H)=>H.position.y),q=O.map((H)=>H.position.x+H.size.width),X=O.map((H)=>H.position.y+H.size.height),B=Math.min(...Y),L=Math.min(...Z),P=Math.max(...q),k=Math.max(...X);K.push({id:`cluster-${W++}`,nodeIds:O.map((H)=>H.id),label:GF(O),centroid:{x:Math.round((B+P)/2),y:Math.round((L+k)/2)},bounds:{x:B,y:L,width:P-B,height:k-L}})}return K.sort((O,Y)=>{let Z=Math.floor(O.centroid.y/200),q=Math.floor(Y.centroid.y/200);if(Z!==q)return Z-q;return O.centroid.x-Y.centroid.x}),K}function ZF($,U,v=5,J=600){let _=$.filter((K)=>U.has(K.id)),z=$.filter((K)=>!U.has(K.id));return _.map((K)=>{let W=z.map((O)=>({node:O,distance:JF(K,O)})).filter((O)=>O.distance<=J).sort((O,Y)=>O.distance-Y.distance).slice(0,v);return{pinnedNodeId:K.id,pinnedNodeTitle:K.data.title??null,neighbors:W.map((O)=>({id:O.node.id,type:O.node.type,title:O.node.data.title??null,distance:Math.round(O.distance)}))}})}function i0($,U,v,J=[]){let _=YF($),z=new Map;for(let Y of _)for(let Z of Y.nodeIds)z.set(Z,Y.id);let W=KF($).map((Y,Z)=>({id:Y.id,type:Y.type,title:Y.data.title??null,content:TY(Y,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(Y.id)??null,readingOrder:Z})),O=ZF($,v);return{totalNodes:$.length,clusters:_,nodesInReadingOrder:W,pinnedNeighborhoods:O,annotations:J.map((Y)=>OF(Y,$))}}function HU($){if(!$)return null;let U=$.data.title;return typeof U==="string"&&U.trim().length>0?U.trim():null}function o2($,U){return{id:$?.id??U,title:HU($),nodeType:$?.type??"markdown"}}function yY($,U){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:HU(U.get($.from)),toTitle:HU(U.get($.to))}}function d2($){return new Map($.map((U)=>[U.id,U]))}function CY($){return new Map($.map((U)=>[U.id,U]))}function _4($){return Array.from($).sort((U,v)=>U.localeCompare(v))}function N8($,U){if($.length!==U.length)return!1;for(let v=0;v<$.length;v++)if($[v]!==U[v])return!1;return!0}function S8($){if(!$||$.type!=="group")return[];let U=$.data.children;if(!Array.isArray(U))return[];return U.filter((v)=>typeof v==="string").sort((v,J)=>v.localeCompare(J))}function DY($){let U=new Map;for(let v of $.clusters){let J=[...v.nodeIds].sort((_,z)=>_.localeCompare(z));for(let _ of J)U.set(_,J.filter((z)=>z!==_))}return U}function jY($){let U=new Map;for(let v of $.pinnedNeighborhoods)U.set(v.pinnedNodeId,v.neighbors.map((J)=>J.id).sort((J,_)=>J.localeCompare(_)));return U}function qF($,U){let v=_4(Array.from(U).filter((_)=>!$.has(_))),J=_4(Array.from($).filter((_)=>!U.has(_)));return{added:v,removed:J}}function VY($){let U=$&&typeof $==="object"?$:{};return{timestamp:typeof U.timestamp==="string"?U.timestamp:void 0,sessionId:typeof U.sessionId==="string"?U.sessionId:void 0}}function BF($,U,v){if(!$||!v)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:v};let J=d2($.nodes),_=_4(U).filter((O)=>J.has(O)),z=new Set(_),K=new Set,W=[];for(let O of v.pinnedNeighborhoods){if(!z.has(O.pinnedNodeId))continue;let Y=_4([O.pinnedNodeId,...O.neighbors.map((Z)=>Z.id)]).filter((Z,q,X)=>X.indexOf(Z)===q&&J.has(Z));for(let Z of Y)if(!z.has(Z))K.add(Z);W.push({id:`region-${O.pinnedNodeId}`,primaryNodeId:O.pinnedNodeId,nodeIds:Y})}if(W.length===0&&_.length>0)for(let O of _)W.push({id:`region-${O}`,primaryNodeId:O,nodeIds:[O]});return{layout:$,pinnedNodeIds:_,primaryFocusNodeIds:_,secondaryFocusNodeIds:_4(K),regions:W,spatial:v}}class n2{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return BF(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let U=$&&typeof $==="object"?$:{},v=Array.isArray(U.nodeIds)?U.nodeIds.filter((Y)=>typeof Y==="string"):[],J=VY($),_=new Set(v),{added:z,removed:K}=qF(this.currentPins,_);if(this.currentPins=_,!this.currentLayout)return[];let W=d2(this.currentLayout.nodes),O={added:z.map((Y)=>o2(W.get(Y),Y)),removed:K.map((Y)=>o2(W.get(Y),Y))};if(this.previousSpatial=i0(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),O.added.length===0&&O.removed.length===0)return[];return[{type:"context-pin",...J,...O}]}handleLayoutUpdate($){let U=$&&typeof $==="object"?$:{},v=U.layout&&typeof U.layout==="object"?U.layout:null;if(!v)return[];let J=VY($);if(!this.currentLayout)return this.currentLayout=v,this.previousSpatial=i0(v.nodes,v.edges,this.currentPins,v.annotations??[]),[];let _=this.currentLayout,z=this.previousSpatial??i0(_.nodes,_.edges,this.currentPins,_.annotations??[]),K=i0(v.nodes,v.edges,this.currentPins,v.annotations??[]),W=[],O=d2(_.nodes),Y=d2(v.nodes),Z=CY(_.edges),q=CY(v.edges),X=_4(Array.from(q.keys()).filter((H)=>!Z.has(H))).map((H)=>q.get(H)).filter((H)=>H!==void 0);if(X.length>0)W.push({type:"connect",...J,edges:X.map((H)=>yY(H,Y))});let B=_4(Array.from(O.keys()).filter((H)=>!Y.has(H))),L=_4(Array.from(Z.keys()).filter((H)=>!q.has(H)));if(B.length>0||L.length>0)W.push({type:"remove",...J,nodes:B.map((H)=>o2(O.get(H),H)),edges:L.map((H)=>Z.get(H)).filter((H)=>H!==void 0).map((H)=>yY(H,O))});let P=this.buildGroupEvent(O,Y,J);if(P)W.push(P);let k=this.buildMoveEndEvent(_,v,O,Y,z,K,J);if(k)W.push(k);return this.currentLayout=v,this.previousSpatial=K,W}buildGroupEvent($,U,v){let J=_4(Array.from($.values()).filter((W)=>W.type==="group").map((W)=>W.id)),_=_4(Array.from(U.values()).filter((W)=>W.type==="group").map((W)=>W.id)),z=_.filter((W)=>!J.includes(W)).map((W)=>{let O=U.get(W),Y=S8(O);return{id:W,title:HU(O),childCount:Y.length}}),K=[];for(let W of _.filter((O)=>J.includes(O))){let O=S8($.get(W)),Y=S8(U.get(W));if(N8(O,Y))continue;K.push({id:W,title:HU(U.get(W)),addedChildIds:Y.filter((Z)=>!O.includes(Z)),removedChildIds:O.filter((Z)=>!Y.includes(Z)),childCount:Y.length})}if(z.length===0&&K.length===0)return null;return{type:"group",...v,created:z,updated:K}}buildMoveEndEvent($,U,v,J,_,z,K){let W=_4(Array.from(J.keys()).filter((k)=>{let H=v.get(k),F=J.get(k);if(!H||!F)return!1;return H.position.x!==F.position.x||H.position.y!==F.position.y}));if(W.length===0)return null;let O=DY(_),Y=DY(z),Z=jY(_),q=jY(z),X=new Map,B=(k,H)=>{let F=X.get(k)??new Set;F.add(H),X.set(k,F)};for(let k of W){let H=O.get(k)??[],F=Y.get(k)??[];if(!N8(H,F))if(H.length===0&&F.length>0)B(k,"joined cluster");else if(H.length>0&&F.length===0)B(k,"left cluster");else B(k,"cluster changed")}let L=new Set([...Z.keys(),...q.keys()]);for(let k of L){let H=Z.get(k)??[],F=q.get(k)??[];if(N8(H,F))continue;let b=HU(J.get(k)??v.get(k))??k,V=F.filter((A)=>!H.includes(A)),E=H.filter((A)=>!F.includes(A));for(let A of V)if(W.includes(A))B(A,`entered pinned neighborhood of "${b}"`);for(let A of E)if(W.includes(A))B(A,`left pinned neighborhood of "${b}"`);if(W.includes(k))B(k,"pinned neighborhood changed")}let P=W.filter((k)=>(X.get(k)?.size??0)>0).map((k)=>{let H=J.get(k);return{...o2(H,k),reasons:Array.from(X.get(k)??[]).sort((F,b)=>F.localeCompare(b))}});if(P.length===0)return null;return{type:"move-end",...K,nodes:P}}}var C8=new n2,QU=[],p0=null,LU=null,R8="",T8=0;function EY($,U){return globalThis.setTimeout($,U)}function y8($){if($===null)return;globalThis.clearTimeout($)}function XF($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function n4($,U){return $&&$.trim().length>0?$.trim():U}function S4($,U=3){if($.length===0)return"";if($.length<=U)return $.join(", ");return`${$.slice(0,U).join(", ")} +${$.length-U}`}function HF($){return Array.from(new Set(Array.from($).filter((U)=>U.length>0)))}function v4($,U,v,J,_=Date.now()){return{id:`${$}-${_}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:U,detail:v,nodeIds:HF(J),createdAt:_}}function fY($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let U=/^entered pinned neighborhood of "(.+)"$/.exec($);if(U)return`moved into focus around ${U[1]}`;let v=/^left pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved out of focus around ${v[1]}`;return $}function QF($){let U=$.added.map((_)=>n4(_.title,_.id)),v=$.removed.map((_)=>n4(_.title,_.id));if(U.length===0&&v.length===0)return null;let J="";if(U.length>0&&v.length===0)J=`Now in focus: ${S4(U)}`;else if(v.length>0&&U.length===0)J=`Removed from focus: ${S4(v)}`;else{let _=[];if(U.length>0)_.push(`${S4(U)} added`);if(v.length>0)_.push(`${S4(v)} removed`);J=_.join(" · ")}return v4("context","Context updated",J,[...$.added.map((_)=>_.id),...$.removed.map((_)=>_.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function LF($){if($.edges.length===0)return null;if($.edges.length===1){let U=$.edges[0];return v4("relationship","Relationship added",`${n4(U.fromTitle,U.fromId)} linked to ${n4(U.toTitle,U.toId)}`,[U.fromId,U.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return v4("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((U)=>[U.fromId,U.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function FF($){if($.nodes.length===0&&$.edges.length===0)return null;let U=$.nodes.map((J)=>n4(J.title,J.id)),v=[];if(U.length>0)v.push(S4(U));if($.edges.length>0)v.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return v4("remove","Items removed",v.join(" · "),[...$.nodes.map((J)=>J.id),...$.edges.flatMap((J)=>[J.fromId,J.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function PF($){if($.created.length>0){let U=$.created.map((v)=>n4(v.title,v.id));return v4("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${U[0]} now frames ${$.created[0].childCount} items`:S4(U),$.created.map((v)=>v.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let U=$.updated.map((v)=>n4(v.title,v.id));return v4("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${U[0]} now holds ${$.updated[0].childCount} items`:S4(U),$.updated.map((v)=>v.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function kF($){if($.nodes.length===0)return null;let U=$.nodes.flatMap((z)=>z.reasons),v=$.nodes.map((z)=>n4(z.title,z.id)),J=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(U.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return v4("neighborhood","Neighborhood changed",`${v[0]} ${fY($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),J);return v4("neighborhood","Neighborhood changed",S4(v),$.nodes.map((z)=>z.id),J)}let _=U.filter((z)=>z.includes("cluster"));if(_.length>0){let z=_.every((K)=>K==="joined cluster");if($.nodes.length===1)return v4("cluster",z?"Cluster formed":"Cluster changed",`${v[0]} ${fY($.nodes[0].reasons[0])}`,$.nodes.map((K)=>K.id),J);return v4("cluster",z?"Cluster formed":"Cluster changed",S4(v),$.nodes.map((K)=>K.id),J)}return null}function bF($){switch($.type){case"context-pin":return QF($);case"connect":return LF($);case"remove":return FF($);case"group":return PF($);case"move-end":return kF($)}}function MF(){let $=C8.getAttentionSnapshot();OY($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function uY(){if(p0!==null)return;let $=QU.shift()??null;if(!$){f2(null);return}f2($);let U=Math.max(1800,Math.min(2800,1600+$.detail.length*18));p0=EY(()=>{p0=null,f2(null),uY()},U)}function mY($){if(QU.push($),QU.length>3)QU.splice(0,QU.length-3);uY()}function FU($,U,v="",J=[]){mY(v4($,U,v,J))}function AF($){if(y8(LU),LU=null,E2([]),$.length===0)return;XF(()=>{E2($),LU=EY(()=>{LU=null,E2([])},900)})}function IF($){let U=`${$.tone}:${$.title}:${$.detail}`,v=$.createdAt;if(U===R8&&v-T8<1200)return!0;return R8=U,T8=v,!1}function D8(){y8(p0),y8(LU),p0=null,LU=null,QU=[],R8="",T8=0,C8=new n2,GY()}function j8($){let U=C8.handleMessage($).map((v)=>bF(v)).filter((v)=>v!==null);MF();for(let v of U){if(IF(v))continue;YY(v),mY(v),AF(v.nodeIds)}}async function t4($,U,v,J){let _=await c2({type:U,sourceNodeId:$.id,sourceSurface:"native-node",...v?{payload:v}:{}});if(_.ok)FU("context",J,"",[$.id]);else FU("remove","AX action failed",_.error??_.code??"Unknown error",[$.id])}var V1={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function wF($){let U=$.title||$.label||$.key||"Context",v=$.summary?.trim()||"Available in startup context.",J=$.pathDisplay||$.path||"",_=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",K=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:U,summary:v,pathDisplay:J,category:_,sourceKind:z,status:K,required:$.required===!0}}function J4($){return typeof $==="string"?$.trim():""}function gF($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function NF($){let U=J4($.title),v=J4($.content),J=gF(J4($.rendered)),_=v||J,z=J4($.path);if(!U&&!_&&!z)return null;return{title:U||"Context",summary:_,path:z}}function SF($){let U=J4($.data.title)||$.id,v=J4($.data.content)||J4($.data.excerpt)||J4($.data.description)||J4($.data.pageTitle)||"",J=J4($.data.path)||J4($.data.url);return{id:$.id,title:U,summary:v,kind:O6[$.type]??$.type,path:J}}function xY($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function RF($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function t2({node:$,expanded:U=!1,pinnedNodes:v=[]}){let J=$.data.cards??[],_=$.data.auxTabs??[],z=v.map(SF),K=z.length>0,W=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,O=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,Y=typeof $.data.utilization==="number"?$.data.utilization:null,Z=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,q=Y!==null?Math.max(0,Math.min(100,Math.round(Y*100))):null,X=RF(Y??0),B=!K&&J.length===0&&_.length===0?NF($.data):null,L=async(P)=>{let k=typeof P.path==="string"?P.path.trim():"";if(!k)return;await m2(k)};return G("div",{style:{display:"flex",flexDirection:"column",gap:U?"10px":"6px",fontSize:U?"14px":"12px",maxWidth:U?"760px":void 0,margin:U?"0 auto":void 0,width:U?"100%":void 0,padding:U?"8px 0":void 0},children:[G("div",{style:{display:"flex",justifyContent:"flex-end"},children:G("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:V1,onClick:(P)=>{P.stopPropagation(),t4($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O!==null&&O>0&&G("div",{style:{marginBottom:"8px"},children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),G("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:G("div",{style:{height:"100%",width:`${Math.min(100,(Y??0)*100)}%`,background:X,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[q,"% — ",xY(W)," / ",xY(O)," tokens",Z!==null&&G(M$,{children:[" · ",Z," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((P)=>G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:P.title},void 0,!1,void 0,this),P.summary&&G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:P.summary},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:P.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),P.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:P.path},void 0,!1,void 0,this),P.path.startsWith("/")&&G("button",{type:"button",onClick:()=>void m2(P.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.id,!0,void 0,this))]},void 0,!0,void 0,this),!K&&J.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",J.length,")"]},void 0,!0,void 0,this),J.map((P)=>{let k=wF(P);return G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:k.title},void 0,!1,void 0,this),G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:k.summary},void 0,!1,void 0,this),k.pathDisplay&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:k.pathDisplay},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:k.status},void 0,!1,void 0,this),k.category&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:k.category},void 0,!1,void 0,this),G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:k.sourceKind},void 0,!1,void 0,this),k.required&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.path&&G("div",{style:{marginTop:"6px"},children:G("button",{type:"button",onClick:()=>void L(P),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},P.key??k.pathDisplay??k.title,!0,void 0,this)})]},void 0,!0,void 0,this),!K&&_.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:J.length>0?"8px":0},children:["References (",_.length,")"]},void 0,!0,void 0,this),_.map((P)=>G("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[P.url,P.reason&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",P.reason,")"]},void 0,!0,void 0,this)]},P.id,!0,void 0,this))]},void 0,!0,void 0,this),B&&G("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:B.title},void 0,!1,void 0,this),B.summary&&G("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:B.summary},void 0,!1,void 0,this),B.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:B.path},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>void m2(B.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!K&&!B&&J.length===0&&_.length===0&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hY($){return $.replace(/^[ab]\//,"")}function TF($,U){if(U&&U!=="/dev/null")return hY(U);if($&&$!=="/dev/null")return hY($);return null}function yF($){if(!$.trim())return[];let U=$.split(`
36
+ `);if(U.length>0&&U[U.length-1]==="")U.pop();let v=[],J=null,_=!1,z=(K)=>{let W={path:K,lines:[]};return _=!1,v.push(W),W};for(let K=0;K<U.length;K++){let W=U[K]??"",O=W.match(/^diff --git a\/(.+?) b\/(.+)$/);if(O){J=z(O[2]??null);continue}let Y=U[K+1]??"";if(W.startsWith("--- ")&&Y.startsWith("+++ ")){let q=TF(W.slice(4).trim(),Y.slice(4).trim());if(J&&!_){if(!J.path)J.path=q}else J=z(q);K++;continue}if(!J)J=z(null);let Z=J;if(W.startsWith("@@"))_=!0,Z.lines.push({kind:"hunk",text:W});else if(W.startsWith("+"))Z.lines.push({kind:"add",text:W});else if(W.startsWith("-"))Z.lines.push({kind:"remove",text:W});else Z.lines.push({kind:"context",text:W})}return v}function a2({node:$}){let U=typeof $.data.content==="string"?$.data.content:"",v=u$(()=>yF(U),[U]);if(v.length===0)return G("div",{class:"diff-node diff-node-empty",children:"Empty diff"},void 0,!1,void 0,this);return G("div",{class:"diff-node",children:v.map((J,_)=>G("div",{class:"diff-file",children:[J.path&&G("div",{class:"diff-file-header",children:J.path},void 0,!1,void 0,this),G("pre",{class:"diff-lines",children:J.lines.map((z,K)=>G("div",{class:z.kind==="hunk"?"diff-hunk":`diff-line-${z.kind}`,children:z.text||" "},K,!1,void 0,this))},void 0,!1,void 0,this)]},`${J.path??"anonymous"}-${_}`,!0,void 0,this))},void 0,!1,void 0,this)}function cY($){if($.length===0)return null;let{POSITIVE_INFINITY:U,POSITIVE_INFINITY:v,NEGATIVE_INFINITY:J,NEGATIVE_INFINITY:_}=Number;for(let z of $)U=Math.min(U,z.position.x),v=Math.min(v,z.position.y),J=Math.max(J,z.position.x+z.size.width),_=Math.max(_,z.position.y+z.size.height);if(!Number.isFinite(U)||!Number.isFinite(v))return null;return{x:U-40,y:v-40-32,width:J-U+80,height:_-v+80+32}}function CF($){let U=$.filter((O)=>!O.pinned),v=new Map(U.map((O)=>[O.id,O])),J=new Map,_=[],z=new Map;for(let O of U){if(O.type==="group")continue;let Y=typeof O.data.parentGroup==="string"?O.data.parentGroup:"",Z=Y?v.get(Y):void 0;if(!Z||Z.type!=="group")continue;if(!z.has(Y))z.set(Y,[]);z.get(Y).push(O)}let K=U.filter((O)=>O.type==="group").sort((O,Y)=>O.position.y-Y.position.y||O.position.x-Y.position.x);for(let O of K){let Y=z.get(O.id)??[];if(Y.length===0){let B=`unit:${O.id}`;_.push({id:B,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),J.set(O.id,B);continue}let Z=Y.map((B)=>({position:B.position,size:B.size})),q=cY(Z);if(!q)continue;let X=`group:${O.id}`;_.push({id:X,memberIds:Y.map((B)=>B.id),origin:{x:q.x,y:q.y},size:{width:q.width,height:q.height},sortKey:{x:q.x,y:q.y},groupId:O.id}),J.set(O.id,X);for(let B of Y)J.set(B.id,X)}let W=U.filter((O)=>!J.has(O.id)).sort((O,Y)=>O.position.y-Y.position.y||O.position.x-Y.position.x);for(let O of W){let Y=`unit:${O.id}`;_.push({id:Y,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),J.set(O.id,Y)}return{units:_,nodesById:v,nodeToUnit:J}}function DF($,U,v){let J=new Map,_=new Map,z=new Map,K=new Map;for(let W of $)J.set(W.id,new Set),_.set(W.id,new Set),z.set(W.id,0),K.set(W.id,0);for(let W of v){let O=U.get(W.from),Y=U.get(W.to);if(!O||!Y||O===Y)continue;if(!J.get(O).has(Y))J.get(O).add(Y),K.set(O,(K.get(O)??0)+1),z.set(Y,(z.get(Y)??0)+1);_.get(O).add(Y),_.get(Y).add(O)}return{outgoing:J,undirected:_,indegree:z,outdegree:K}}function jF($,U){let v=new Map($.map((z)=>[z.id,z])),J=new Set,_=[];for(let z of $){if(J.has(z.id))continue;let K=[z.id],W=[];J.add(z.id);while(K.length>0){let Y=K.pop();W.push(Y);for(let Z of U.get(Y)??[]){if(J.has(Z))continue;J.add(Z),K.push(Z)}}let O=W.map((Y)=>v.get(Y)).filter((Y)=>Y!==void 0).sort((Y,Z)=>Y.sortKey.y-Z.sortKey.y||Y.sortKey.x-Z.sortKey.x);_.push(O)}return _.sort((z,K)=>z[0].sortKey.y-K[0].sortKey.y||z[0].sortKey.x-K[0].sortKey.x)}function VF($){let U=new Map,v=0,J=0,_=0,z=0,K=Math.max(900,Math.ceil(Math.sqrt($.reduce((W,O)=>W+O.size.width*O.size.height,0))));for(let W of $){if(v>0&&v+W.size.width>K)v=0,J+=_+72,_=0;U.set(W.id,{x:v,y:J}),v+=W.size.width+96,_=Math.max(_,W.size.height),z=Math.max(z,v-96)}return{positions:U,size:{width:Math.max(0,z),height:J+_},sortKey:$[0].sortKey}}function fF($,U,v,J,_){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((F)=>F.id)),K=$.filter((F)=>(J.get(F.id)??0)===0&&(_.get(F.id)??0)>0).sort((F,b)=>F.sortKey.x-b.sortKey.x||F.sortKey.y-b.sortKey.y),W=K.length>0?K:[$.slice().sort((F,b)=>F.sortKey.x-b.sortKey.x||F.sortKey.y-b.sortKey.y)[0]],O=new Map,Y=W.map((F)=>F.id);for(let F of W)O.set(F.id,0);while(Y.length>0){let F=Y.shift(),b=O.get(F)??0;for(let V of v.get(F)??[]){if(!z.has(V)||O.has(V))continue;O.set(V,b+1),Y.push(V)}}let Z=0;for(let F of $){if(O.has(F.id))continue;O.set(F.id,Z),Z+=1}let q=new Map;for(let F of $){let b=O.get(F.id)??0;if(!q.has(b))q.set(b,[]);q.get(b).push(F)}let X=Array.from(q.keys()).sort((F,b)=>F-b);for(let F of X)q.get(F).sort((b,V)=>b.sortKey.y-V.sortKey.y||b.sortKey.x-V.sortKey.x);let B=new Map,L=new Map,P=0;for(let F of X){let b=q.get(F),V=b.reduce((A,I,N)=>A+I.size.height+(N>0?72:0),0),E=Math.max(...b.map((A)=>A.size.width));B.set(F,V),L.set(F,E),P=Math.max(P,V)}let k=new Map,H=0;for(let F of X){let b=q.get(F),V=B.get(F)??0,E=L.get(F)??0,A=Math.max(0,(P-V)/2);for(let I of b)k.set(I.id,{x:H,y:A}),A+=I.size.height+72;H+=E+96}return{positions:k,size:{width:Math.max(0,H-96),height:P},sortKey:$[0].sortKey}}function EF($,U){let v=new Map($.map((O)=>[O.id,O.id])),J=(O)=>{let Y=O;while(v.get(Y)!==Y)Y=v.get(Y);let Z=O;while(v.get(Z)!==Z){let q=v.get(Z);v.set(Z,Y),Z=q}return Y},_=(O,Y)=>{let Z=J(O),q=J(Y);if(Z!==q)v.set(Z,q)},z=160;for(let O=0;O<$.length;O++)for(let Y=O+1;Y<$.length;Y++){let Z=$[O],q=$[Y];if(Z.origin.x-160<q.origin.x+q.size.width+160&&Z.origin.x+Z.size.width+160>q.origin.x-160&&Z.origin.y-160<q.origin.y+q.size.height+160&&Z.origin.y+Z.size.height+160>q.origin.y-160)_(Z.id,q.id)}for(let[O,Y]of U)for(let Z of Y)if(v.has(O)&&v.has(Z))_(O,Z);let K=new Map;for(let O of $){let Y=J(O.id);if(!K.has(Y))K.set(Y,[]);K.get(Y).push(O)}let W=Array.from(K.values());for(let O of W)O.sort((Y,Z)=>Y.sortKey.y-Z.sortKey.y||Y.sortKey.x-Z.sortKey.x);return W.sort((O,Y)=>O[0].sortKey.y-Y[0].sortKey.y||O[0].sortKey.x-Y[0].sortKey.x)}function uF($,U){let v=new Map,J=U.x,_=U.y,z=0;for(let K of $){if(J>U.x&&J-U.x+K.size.width>3200)J=U.x,_+=z+180,z=0;for(let[W,O]of K.positions.entries())v.set(W,{x:J+O.x,y:_+O.y});J+=K.size.width+220,z=Math.max(z,K.size.height)}return v}function V8($,U,v){let{units:J,nodesById:_,nodeToUnit:z}=CF($),K=new Map,W=new Map;if(J.length===0)return{nodePositions:K,groupBounds:W};let{outgoing:O,undirected:Y,indegree:Z,outdegree:q}=DF(J,z,U),X=EF(J,Y),B=new Map,L=[];for(let P of X){let k=jF(P,Y).map((A)=>v==="graph"?fF(A,O,Y,Z,q):VF(A)),H={x:Math.min(...P.map((A)=>A.origin.x)),y:Math.min(...P.map((A)=>A.origin.y))},F=uF(k,H),b=new Map(P.map((A)=>[A.id,A.size])),V=(A)=>{let{POSITIVE_INFINITY:I,POSITIVE_INFINITY:N,NEGATIVE_INFINITY:R,NEGATIVE_INFINITY:p}=Number;for(let[l,T]of A){let r=b.get(l);if(!r)continue;I=Math.min(I,T.x),N=Math.min(N,T.y),R=Math.max(R,T.x+r.width),p=Math.max(p,T.y+r.height)}return{x:I,y:N,width:R-I,height:p-N}},E=F;for(let A=0;A<=L.length;A++){let I=V(E),N=L.filter((l)=>I.x<l.x+l.width+220&&I.x+I.width+220>l.x&&I.y<l.y+l.height+180&&I.y+I.height+180>l.y);if(N.length===0)break;let R=Math.max(...N.map((l)=>l.y+l.height))+180-I.y;if(R<=0)break;let p=new Map;for(let[l,T]of E)p.set(l,{x:T.x,y:T.y+R});E=p}for(let[A,I]of E)B.set(A,I);L.push(V(E))}for(let P of J){let k=B.get(P.id);if(!k)continue;let H=k.x-P.origin.x,F=k.y-P.origin.y;if(P.groupId){let E=[];for(let I of P.memberIds){let N=_.get(I);if(!N)continue;let R={x:N.position.x+H,y:N.position.y+F};K.set(I,R),E.push({position:R,size:N.size})}let A=cY(E);if(A)W.set(P.groupId,A);continue}let b=P.memberIds[0],V=_.get(b);if(!V)continue;K.set(b,{x:V.position.x+H,y:V.position.y+F})}return{nodePositions:K,groupBounds:W}}function oY($,U){console.error(`[canvas-store] ${$} failed`,U)}var G$=s({x:0,y:0,scale:1}),D=s(new Map),c$=s(new Map),kU=s(new Map),C$=s(null),T4=s(null),x6=s("connecting"),f1=s(0),E1=s(0),u1=s(0),y4=s(""),bU=s(!1),$6=s("dark"),z4=s(!1),K4=s(null),n$=s(null),B4=s(null),m6=null,PU,lY=100,mF=2500,s2=s(null),o$=s(null),s4=s(null),A$=s(new Set),j$=s(new Set),R6=s("select"),d0=s(!1);function MU(){return R6.value==="pan"||d0.value}function dY($,U){if(!$)return new Set;let v=new Set;for(let J of U.values()){if(J.from===$)v.add(J.to);if(J.to===$)v.add(J.from)}return v}var nY=r$(()=>dY(C$.value,c$.value));function rY($,U){let v=new Set;for(let J of $)if(U.has(J))v.add(J);return v}function iY($,U){if($.size!==U.size)return!1;for(let v of $)if(!U.has(v))return!1;return!0}function u8($){let U=new Set(A$.value);if(U.has($))U.delete($);else U.add($);A$.value=U}function tY($){A$.value=new Set($)}function M6(){if(T4.value=null,A$.value.size===0)return;A$.value=new Set}var R4=s(null),m8=!1;function aY(){m8=!0,R4.value=null}function sY(){m8=!1,R4.value=null}function f8($){return{x:$.position.x,y:$.position.y,w:$.size.width,h:$.size.height}}function xF($,U,v){let J=f8($);return U>=J.x&&U<=J.x+J.w&&v>=J.y&&v<=J.y+J.h}function pY($,U){let v=f8($),J=f8(U);return v.x+v.w<J.x||v.x>J.x+J.w||v.y+v.h<J.y||v.y>J.y+J.h}function eY($){let U=D.value.get($);if(!U||U.type==="group")return;let v=typeof U.data.parentGroup==="string"?U.data.parentGroup:null,J=v?D.value.get(v):void 0,_=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2,K=null;for(let W of D.value.values()){if(W.type!=="group"||W.id===v||W.collapsed)continue;if(xF(W,_,z))K=W}if(!m8){let W=K?{nodeId:$,groupId:K.id,mode:"add"}:J&&pY(U,J)?{nodeId:$,groupId:J.id,mode:"remove"}:null,O=R4.value;if((O?.groupId??null)!==(W?.groupId??null)||O?.mode!==W?.mode)R4.value=W}if(J&&J.data.frameMode!=="manual"&&!pY(U,J)){let O=Math.min(J.position.x,U.position.x-22),Y=Math.min(J.position.y,U.position.y-22-32),Z=Math.max(J.position.x+J.size.width,U.position.x+U.size.width+22),q=Math.max(J.position.y+J.size.height,U.position.y+U.size.height+22);if(O!==J.position.x||Y!==J.position.y||Z!==J.position.x+J.size.width||q!==J.position.y+J.size.height)_v(J.id,{position:{x:O,y:Y},size:{width:Z-O,height:q-Y}},{skipGroupChildTranslation:!0})}}var x8=r$(()=>{let $=new Map;for(let U of D.value.values()){if(U.type!=="group"||!U.collapsed)continue;let v=Array.isArray(U.data.children)?U.data.children:[];for(let J of v)if(typeof J==="string")$.set(J,U.id)}return $});function e2($){let U=x8.value.get($);return D.value.get(U??$)}function $Z(){let $=new Set;for(let U of A$.value){let v=D.value.get(U);if(!v)continue;if(v.type==="group")$.add(v.id);else if(typeof v.data.parentGroup==="string")$.add(v.data.parentGroup)}return[...$]}function h8($){let U=c8();if(U.length<2)return;let v=Math.min(...U.map((O)=>$==="left"?O.position.x:O.position.y)),J=24,_=new Map;for(let O of U)_.set(O.id,$==="left"?{x:v,y:O.position.y}:{x:O.position.x,y:v});let z=(O,Y)=>O.x<Y.x+Y.w&&Y.x<O.x+O.w&&O.y<Y.y+Y.h&&Y.y<O.y+O.h,K=U.map((O)=>{let Y=_.get(O.id);return{node:O,x:Y.x,y:Y.y,w:O.size.width,h:O.size.height}});if(K.some((O,Y)=>K.some((Z,q)=>q>Y&&z(O,Z)))){let O=[...U].sort((Z,q)=>$==="left"?Z.position.y-q.position.y:Z.position.x-q.position.x),Y=$==="left"?Math.min(...U.map((Z)=>Z.position.y)):Math.min(...U.map((Z)=>Z.position.x));for(let Z of O)_.set(Z.id,$==="left"?{x:v,y:Y}:{x:Y,y:v}),Y+=($==="left"?Z.size.height:Z.size.width)+J}o6(()=>{for(let O of U)Y6(O.id,{position:_.get(O.id)})}),v6()}function UZ(){let $=c8().sort((W,O)=>W.position.x-O.position.x);if($.length<3)return;let U=$[0],J=$[$.length-1].position.x-(U.position.x+U.size.width),_=$.slice(1,-1),z=_.reduce((W,O)=>W+O.size.width,0),K=(J-z)/(_.length+1);o6(()=>{if(K<8){let O=U.position.x+U.size.width+24;for(let Y of $.slice(1))Y6(Y.id,{position:{x:O,y:Y.position.y}}),O+=Y.size.width+24;return}let W=U.position.x+U.size.width+K;for(let O of _)Y6(O.id,{position:{x:W,y:O.position.y}}),W+=O.size.width+K}),v6()}function _Z($=24){let U=c8().sort((W,O)=>W.position.y-O.position.y||W.position.x-O.position.x);if(U.length<2)return;let v=Math.min(...U.map((W)=>W.position.x)),J=Math.min(...U.map((W)=>W.position.y)),_=Math.ceil(Math.sqrt(U.length)),z=Math.max(...U.map((W)=>W.size.width)),K=Math.max(...U.map((W)=>W.size.height));o6(()=>{U.forEach((W,O)=>{Y6(W.id,{position:{x:v+O%_*(z+$),y:J+Math.floor(O/_)*(K+$)}})})}),v6()}function c8(){let $=A$.value;if($.size===0)return[];return Array.from($).map((U)=>D.value.get(U)).filter((U)=>U!==void 0)}function e4($){let U=new Set(j$.value);if(U.has($))U.delete($);else U.add($);j$.value=U,v6(),Uv(U)}function $v($){let U=new Set(j$.value);for(let v of $)U.add(v);j$.value=U,v6(),Uv(U)}function vZ(){if(j$.value.size===0)return;j$.value=new Set,v6(),Uv(new Set)}function JZ($){j$.value=new Set($)}function Uv($){U4("syncContextPinsToServer","/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})})}var o0=1;function C4($){o6(()=>{let U=new Map(D.value);if($.zIndex>=o0)o0=$.zIndex+1;U.set($.id,$),D.value=U,C$.value=$.id})}function Y6($,U){_v($,U)}function _v($,U,v={}){let J=D.value.get($);if(!J)return;let _=new Map(D.value);if(J.type==="group"&&U.position&&v.skipGroupChildTranslation!==!0){let K=U.position.x-J.position.x,W=U.position.y-J.position.y;if(K!==0||W!==0){let O=Array.isArray(J.data.children)?J.data.children.filter((Y)=>typeof Y==="string"):[];for(let Y of O){let Z=_.get(Y);if(!Z||Z.type==="group")continue;_.set(Y,{...Z,position:{x:Z.position.x+K,y:Z.position.y+W}})}}}_.set($,{...J,...U}),D.value=_;let z=_.get($)?.data.appCheckpoint?.updatedAt;if(B4.value===$&&z!==void 0&&z!==PU)E8($)}function W$($,U){let v=D.value.get($);if(!v)return;Y6($,{data:{...v.data,...U}})}function h6($){hF($);let U=new Map(D.value);if(U.delete($),D.value=U,C$.value===$)C$.value=null;if(n$.value===$)n$.value=null;if(A$.value.has($)){let v=new Set(A$.value);v.delete($),A$.value=v}if(j$.value.has($)){let v=new Set(j$.value);v.delete($),j$.value=v,Uv(v)}}function vv($){let U=new Map(c$.value);U.set($.id,$),c$.value=U}function zZ($){let U=new Map(c$.value);U.delete($),c$.value=U}function hF($){let U=!1,v=new Map(c$.value);for(let[J,_]of v)if(_.from===$||_.to===$)v.delete(J),U=!0;if(U)c$.value=v}function cF($){let U=new Map(kU.value);if(!U.delete($))return;kU.value=U}async function l8($){return u6("createAnnotationFromClient","/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function KZ($){let U=await u6("removeAnnotationFromClient",`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(U.ok)cF($);return U}function AU($,U){if(!D.value.get($))return;Y6($,{size:U})}function D4($){let U=D.value.get($);if(!U)return;o6(()=>{if(Y6($,{zIndex:o0++}),U.type==="group"&&Array.isArray(U.data.children)){for(let v of U.data.children)if(typeof v==="string"&&D.value.has(v))Y6(v,{zIndex:o0++})}}),C$.value=$}function IU($){let U=D.value.get($);if(!U)return;Y6($,{collapsed:!U.collapsed}),v6()}function GZ($){G$.value={...G$.value,...$}}function WZ($){G$.value=$}function OZ($){YZ($)}function YZ($,U={}){G$.value=$,v6(U),AY($,U)}function ZZ($,U={}){let v=new Map,J=1;for(let q of $.nodes)if(v.set(q.id,q),q.zIndex>=J)J=q.zIndex+1;let _=$.edges.filter((q)=>v.has(q.from)&&v.has(q.to)),z=new Map;for(let q of _)z.set(q.id,q);let K=new Map;for(let q of $.annotations??[])K.set(q.id,q);let W=C$.value!==null&&v.has(C$.value)?C$.value:null,O=n$.value!==null&&v.has(n$.value)?n$.value:null,Y=rY(A$.value,v),Z=rY(j$.value,v);o6(()=>{if(U.applyViewport===!0&&$.viewport)G$.value=$.viewport;if(o0=J,D.value=v,c$.value=z,kU.value=K,C$.value=W,n$.value=O,!iY(A$.value,Y))A$.value=Y;if(!iY(j$.value,Z))j$.value=Z})}var a4=null;function lF($){return 1-(1-$)**3}function wU($,U=150){let v=G$.value,J=Math.min(4,Math.max(0.1,v.scale*$));if(J===v.scale)return;let _=J/v.scale,{x:z,y:K}=C1();$1({x:z-_*(z-v.x),y:K-_*(K-v.y),scale:J},U)}function $1($,U=300,v={}){if(a4!==null)cancelAnimationFrame(a4);let J={...G$.value},_=performance.now();function z(K){let W=K-_,O=Math.min(1,W/U),Y=lF(O);if(G$.value={x:J.x+($.x-J.x)*Y,y:J.y+($.y-J.y)*Y,scale:J.scale+($.scale-J.scale)*Y},O<1)a4=requestAnimationFrame(z);else a4=null,YZ($,v)}a4=requestAnimationFrame(z)}function gU(){if(a4!==null)cancelAnimationFrame(a4),a4=null}var qZ="pmx-canvas-layout";function v6($={}){try{let U=Array.from(D.value.values()),v=U.map((_)=>({id:_.id,position:_.position,size:_.size,collapsed:_.collapsed})),J={viewport:G$.value,nodes:U.map((_)=>({id:_.id,type:_.type,position:_.position,size:_.size,collapsed:_.collapsed,pinned:_.pinned})),edges:Array.from(c$.value.values()).map((_)=>({id:_.id,from:_.from,to:_.to,type:_.type,label:_.label,style:_.style,animated:_.animated})),contextPinnedNodeIds:Array.from(j$.value)};localStorage.setItem(qZ,JSON.stringify(J)),kY(v,$)}catch(U){oY("persistLayout",U)}}function r8(){try{let $=localStorage.getItem(qZ);if(!$)return null;let U=JSON.parse($),v=Array.isArray(U.nodes)?U.nodes:[];if(v.length===0)return null;let J=new Map;for(let _ of v){if(typeof _.id!=="string"||_.id.length===0)continue;J.set(_.id,{..._.position?{position:_.position}:{},..._.size?{size:_.size}:{},..._.collapsed!==void 0?{collapsed:_.collapsed}:{},..._.pinned!==void 0?{pinned:_.pinned}:{}})}return J.size>0?J:null}catch($){return oY("restoreLayout",$),null}}function NU($,U){let v=Array.from(D.value.values());if(v.length===0)return;let{POSITIVE_INFINITY:J,POSITIVE_INFINITY:_,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:K}=Number;for(let B of v)J=Math.min(J,B.position.x),_=Math.min(_,B.position.y),z=Math.max(z,B.position.x+B.size.width),K=Math.max(K,B.position.y+B.size.height);let W=60,O=z-J+W*2,Y=K-_+W*2,Z=Math.min(1,Math.min($/O,U/Y)),q=(J+z)/2,X=(_+K)/2;$1({x:$/2-q*Z,y:U/2-X*Z,scale:Z})}function K6($,U={}){let v=D.value.get($);if(!v)return;let J=G$.value,_=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,K=C1();$1({x:K.x-_*J.scale,y:K.y-z*J.scale,scale:J.scale},300,U),D4($)}function BZ($=1){let U=Array.from(D.value.keys());if(U.length===0)return;let J=((C$.value?U.indexOf(C$.value):-1)+$+U.length)%U.length,_=U[J];D4(_),K6(_)}function XZ($){let U=C$.value;if(!U)return;let v=D.value.get(U);if(!v)return;let J=dY(U,c$.value);if(J.size===0)return;let _=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,K=null,W=-1/0;for(let O of J){let Y=D.value.get(O);if(!Y)continue;let Z=Y.position.x+Y.size.width/2,q=Y.position.y+Y.size.height/2,X=Z-_,B=q-z,L=Math.sqrt(X*X+B*B);if(L<1)continue;let P;switch($){case"up":P=-B;break;case"down":P=B;break;case"left":P=-X;break;case"right":P=X;break}if(P<=0)continue;let k=P/L-L*0.001;if(k>W)W=k,K=O}if(K)K6(K)}function X4($){if(!D.value.get($))return;if(m6!==null)clearTimeout(m6),m6=null;B4.value=null,PU=void 0,D4($),n$.value=$}function E8($){if(m6!==null)clearTimeout(m6),m6=null;if(n$.value===$)n$.value=null;if(B4.value===$)B4.value=null;PU=void 0}function m1(){let $=n$.value,U=$?D.value.get($):void 0;if($&&U&&RY(U)){let v=$,J=Date.now();if(B4.value=v,PU=U.data.appCheckpoint?.updatedAt,m6!==null)clearTimeout(m6);let _=()=>{let K=D.value.get(v)?.data.appCheckpoint?.updatedAt;if(K!==void 0&&K!==PU){E8(v);return}if(Date.now()-J>=mF){E8(v);return}m6=setTimeout(_,lY)};m6=setTimeout(_,lY);return}if(m6!==null)clearTimeout(m6),m6=null;B4.value=null,PU=void 0,n$.value=null}function Jv(){let $=V8(Array.from(D.value.values()),Array.from(c$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;o6(()=>{for(let[U,v]of $.nodePositions.entries())Y6(U,{position:v});for(let[U,v]of $.groupBounds.entries())_v(U,{position:{x:v.x,y:v.y},size:{width:v.width,height:v.height}},{skipGroupChildTranslation:!0})}),v6()}function zv(){let $=V8(Array.from(D.value.values()),Array.from(c$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;o6(()=>{for(let[U,v]of $.nodePositions.entries())Y6(U,{position:v});for(let[U,v]of $.groupBounds.entries())_v(U,{position:{x:v.x,y:v.y},size:{width:v.width,height:v.height}},{skipGroupChildTranslation:!0})}),v6()}var HZ="pmx-canvas-iframe-probe";var rF="/api/canvas/iframe-probe",iF=3000,A6=s(null);function pF(){let $=new URLSearchParams(window.location.search).get("iframe-mode");return $==="srcdoc"||$==="src"?$:null}function QZ($=iF){return new Promise((U)=>{let v=document.createElement("iframe");v.setAttribute("data-pmx-iframe-probe",""),v.style.cssText="position:fixed;width:1px;height:1px;left:-9999px;border:none",v.setAttribute("sandbox","allow-scripts");let J=(K)=>{window.clearTimeout(z),window.removeEventListener("message",_),v.remove(),U(K)},_=(K)=>{if(K.source!==v.contentWindow)return;if(K.data?.source!==HZ)return;J(!0)},z=window.setTimeout(()=>J(!1),$);window.addEventListener("message",_),v.addEventListener("error",()=>J(!1)),v.src=rF,(document.body??document.documentElement).appendChild(v)})}var Kv=null;function oF(){try{return window.self!==window.top}catch{return!0}}function dF(){return window.__PMX_AMP_ORB===!0}function LZ($={}){if(A6.value)return Promise.resolve(A6.value);if(Kv)return Kv;let U=pF();if(U)return A6.value=U,Promise.resolve(U);if(!($.embedded??oF()))return A6.value="src",QZ($.probeTimeoutMs).then((v)=>{if(!v&&A6.value==="src")A6.value="srcdoc"}),Promise.resolve("src");if($.ampOrb??dF())return A6.value="srcdoc",Promise.resolve("srcdoc");return Kv=QZ($.probeTimeoutMs).then((v)=>{let J=v?"src":"srcdoc";return A6.value=J,J}),Kv}function nF($){let U=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[U]??(U.toUpperCase()||"Text")}var i8=500;function tF($){let U=$.toLowerCase();if(U.endsWith(".csv"))return",";if(U.endsWith(".tsv"))return"\t";return null}function aF($,U){let v=[],J=[],_="",z=!1,K=!1;for(let O=0;O<$.length;O++){let Y=$[O];if(K=!0,z){if(Y==='"')if($[O+1]==='"')_+='"',O++;else z=!1;else if(Y==="\r"&&$[O+1]===`
37
+ `)_+=`
38
+ `,O++;else _+=Y;continue}if(Y==='"'&&_==="")z=!0;else if(Y===U)J.push(_),_="";else if(Y===`
39
+ `||Y==="\r"){if(Y==="\r"&&$[O+1]===`
40
+ `)O++;J.push(_),_="",v.push(J),J=[],K=!1}else _+=Y}if(K)J.push(_),v.push(J);let W=v.shift()??[];return{header:W,rows:v.map((O)=>Array.from({length:W.length},(Y,Z)=>O[Z]??""))}}function p8($){if(!Number.isFinite($)||$<0)return"";if($<1024)return`${Math.round($)} B`;let U=["KB","MB","GB","TB"],v=$/1024,J=0;while(v>=1024&&J<U.length-1)v/=1024,J++;return`${v<10?v.toFixed(1):Math.round(v)} ${U[J]}`}function Gv({node:$,expanded:U=!1}){let v=$.data.path||$.data.content||"",J=$.data.title||v.split("/").pop()||"File",_=$.data.fileContent,z=$.data.updatedAt,K=$.data.lineCount,W=$.data.byteSize,O=$.data.binary===!0,Y=$.data.truncated===!0,q=$.data.mimeType==="application/pdf"||v.toLowerCase().endsWith(".pdf"),X=O||q,[B,L]=f(_??""),[P,k]=f(!_&&!!v&&!X),[H,F]=f(null),[b,V]=f(0);u(()=>{if(!v)return;if(X){k(!1);return}if(_!==void 0){L(_),k(!1);return}let i=!1;return k(!0),F(null),h0(v).then(({content:o})=>{if(i)return;if(!o&&o!==""){F("File not found"),k(!1);return}L(o),k(!1);let z$=o.split(`
41
+ `).length;W$($.id,{fileContent:o,lineCount:z$}),b6($.id,{data:{fileContent:o,lineCount:z$}})}).catch(()=>{if(!i)F("Failed to load file"),k(!1)}),()=>{i=!0}},[v,_,X]),u(()=>{if(_!==void 0&&_!==B)L(_)},[_]);let E=j(()=>{if(!v)return;if(X){V((i)=>i+1);return}k(!0),F(null),W$($.id,{fileContent:void 0}),b6($.id,{data:{fileContent:void 0}}),h0(v).then(({content:i})=>{L(i),k(!1);let o=i.split(`
42
+ `).length,z$=new Date().toISOString();W$($.id,{fileContent:i,lineCount:o,updatedAt:z$}),b6($.id,{data:{fileContent:i,lineCount:o,updatedAt:z$}})}).catch(()=>{F("Failed to reload"),k(!1)})},[v,$.id,X]),A=nF(v),I=B.split(`
43
+ `),N=`${String(I.length).length+1}ch`,R=tF(v),p=u$(()=>{if(!R||X||!B)return null;let i=aF(B,R);return i.header.length>=2?i:null},[B,R,X]),l=`/api/canvas/file-bytes?nodeId=${encodeURIComponent($.id)}${b?`&v=${b}`:""}`,T=A6.value==="srcdoc",r=X||p!==null,t=Y?G("div",{class:"file-node-notice",children:["Showing the first ",p8(B.length)," of ",p8(W??B.length)]},void 0,!0,void 0,this):null;if(!v)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:U?"13px":"11px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:A},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text-soft)",fontSize:U?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:v,children:v},void 0,!1,void 0,this),K!==void 0&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[K," lines"]},void 0,!0,void 0,this),z&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),G("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(i)=>{i.stopPropagation(),t4($,"ax.evidence.add",{kind:"file",title:v.split("/").pop()||v,ref:v},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),G("button",{type:"button",onClick:E,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,minHeight:0,overflow:r?"hidden":"auto",padding:r?0:"8px 0",background:U?"var(--c-panel-soft)":void 0,borderRadius:U?"0 0 8px 8px":void 0},children:[q&&(T?G("div",{class:"file-node-placeholder",children:[G("div",{children:"PDF preview is unavailable in this embedded host."},void 0,!1,void 0,this),G("a",{class:"file-node-link",href:l,target:"_blank",rel:"noreferrer",children:"Open PDF"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("iframe",{src:l,title:J,sandbox:"",style:{width:"100%",height:"100%",border:"none",display:"block"}},void 0,!1,void 0,this)),!q&&O&&G("div",{class:"file-node-placeholder",children:[G("div",{class:"file-node-placeholder-name",children:J},void 0,!1,void 0,this),G("div",{children:"Binary file"},void 0,!1,void 0,this),W!==void 0&&G("div",{children:p8(W)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!X&&G(M$,{children:[P&&G("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),H&&G("div",{style:{color:"var(--c-danger)",padding:"12px"},children:H},void 0,!1,void 0,this),!P&&!H&&(p?G("div",{class:"file-table-shell",children:[t,p.rows.length>i8&&G("div",{class:"file-node-notice",children:["Showing ",i8," of ",p.rows.length," rows"]},void 0,!0,void 0,this),G("div",{class:"file-table-wrap",children:G("table",{class:"file-table",children:[G("thead",{children:G("tr",{children:p.header.map((i,o)=>G("th",{children:i},o,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("tbody",{children:p.rows.slice(0,i8).map((i,o)=>G("tr",{children:i.map((z$,B$)=>G("td",{children:z$},B$,!1,void 0,this))},o,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(M$,{children:[t,G("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:I.map((i,o)=>G("div",{style:{display:"flex",minHeight:"1.55em"},children:[G("span",{style:{width:N,minWidth:N,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:o+1},void 0,!1,void 0,this),G("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:i||`
44
+ `},void 0,!1,void 0,this)]},o,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var sF=new Set(["title","__type","content","strictSize","arrangeLocked"]);function Wv({node:$}){let U=$.data,J=(typeof U.content==="string"?U.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),_=Object.entries(U).filter(([z])=>!sF.has(z));if(J.length===0&&_.length===0)return G("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[J.length>0&&G("div",{style:{display:"flex",flexDirection:"column"},children:J.map((z,K)=>G("div",{style:{padding:"3px 0",borderBottom:K<J.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},K,!1,void 0,this))},void 0,!1,void 0,this),_.map(([z,K])=>G("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[G("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(W)=>W.toUpperCase())},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof K==="object"?JSON.stringify(K):String(K??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var n0=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),FZ=n0?"⌘":"Ctrl";function d$($){return n0?`${FZ}${$}`:`${FZ}+${$}`}function Ov($,U){let{selectionStart:v,selectionEnd:J,value:_}=$,z=_.slice(v,J),K=_.slice(Math.max(0,v-U.length),v),W=_.slice(J,J+U.length);if(K===U&&W===U){let O=_.slice(0,v-U.length)+z+_.slice(J+U.length);H4($,O,v-U.length,J-U.length);return}if(z){let O=_.slice(0,v)+U+z+U+_.slice(J);H4($,O,v+U.length,J+U.length)}else{let O=_.slice(0,v)+U+U+_.slice(J);H4($,O,v+U.length,v+U.length)}}function t0($,U){let{selectionStart:v,selectionEnd:J,value:_}=$,z=_.lastIndexOf(`
45
+ `,v-1)+1,K=_.indexOf(`
46
+ `,J),W=K===-1?_.length:K,O=_.slice(z,W);if(O.startsWith(U)){let Z=_.slice(0,z)+O.slice(U.length)+_.slice(W);H4($,Z,Math.max(z,v-U.length),Math.max(z,J-U.length));return}let Y=_.slice(0,z)+U+_.slice(z);H4($,Y,v+U.length,J+U.length)}function eF($){let{selectionStart:U,selectionEnd:v,value:J}=$,_=J.slice(U,v);if(_){let z=J.slice(0,U)+`[${_}](url)`+J.slice(v),K=U+_.length+3;H4($,z,K,K+3)}else{let z=J.slice(0,U)+"[text](url)"+J.slice(v);H4($,z,U+1,U+5)}}function $P($){let{selectionStart:U,selectionEnd:v,value:J}=$,_=J.slice(U,v),z="```";if(_){let K=J.slice(0,U)+`\`\`\`
47
+ ${_}
48
+ \`\`\``+J.slice(v);H4($,K,U+3+1,U+3+1+_.length)}else{let K=J.slice(0,U)+"```\n\n```"+J.slice(v);H4($,K,U+3+1,U+3+1)}}function PZ($,U){let{selectionStart:v,selectionEnd:J,value:_}=$,z=_.lastIndexOf(`
49
+ `,v-1)+1,K=_.indexOf(`
50
+ `,J),W=K===-1?_.length:K,O=_.slice(z,W).split(`
51
+ `),Y=v,Z=J,q=O.map((B,L)=>{if(U){if(B.startsWith(" ")){if(L===0)Y=Math.max(z,Y-2);return Z-=2,B.slice(2)}else if(B.startsWith("\t")){if(L===0)Y=Math.max(z,Y-1);return Z-=1,B.slice(1)}return B}else{if(L===0)Y+=2;return Z+=2," "+B}}),X=_.slice(0,z)+q.join(`
52
+ `)+_.slice(W);H4($,X,Y,Z)}function H4($,U,v,J){let _=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(_)_.call($,U);else $.value=U;$.selectionStart=v,$.selectionEnd=J,$.dispatchEvent(new Event("input",{bubbles:!0}))}var Yv=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>Ov($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>Ov($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>Ov($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>Ov($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:eF},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>t0($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>t0($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>t0($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>t0($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>t0($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:$P}];function kZ($,U){if(!($.metaKey||$.ctrlKey))return!1;let v=Yv.find((J)=>J.shortcut===$.key);if(!v)return!1;return $.preventDefault(),v.action(U),!0}function bZ($){if($.selectionStart===$.selectionEnd)return null;let U=document.createElement("div"),v=getComputedStyle($),J=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let Z of J)U.style[Z]=v[Z];U.style.position="absolute",U.style.visibility="hidden",U.style.overflow="hidden",U.style.height="auto",U.style.top="0",U.style.left="0";let _=$.value,z=document.createTextNode(_.slice(0,$.selectionStart)),K=document.createElement("span");K.textContent=_.slice($.selectionStart,$.selectionEnd)||".",U.appendChild(z),U.appendChild(K),U.appendChild(document.createTextNode(_.slice($.selectionEnd))),document.body.appendChild(U);let W=K.getBoundingClientRect(),O=U.getBoundingClientRect(),Y=$.getBoundingClientRect();return document.body.removeChild(U),{top:Y.top+(W.top-O.top)-$.scrollTop,left:Y.left+(W.left-O.left)-$.scrollLeft,width:W.width}}var UP=Yv.filter(($)=>$.shortcut),_P=Yv.filter(($)=>!$.shortcut);function o8({textareaRef:$}){let[U,v]=f(!1),[J,_]=f({top:0,left:0}),z=C(null),K=C(null),W=j(()=>{let Y=$.current;if(!Y||Y.selectionStart===Y.selectionEnd){v(!1);return}let Z=bZ(Y);if(!Z){v(!1);return}let q=380,X=Math.max(8,Math.min(Z.left+Z.width/2-q/2,window.innerWidth-q-8));_({top:Z.top-40,left:X}),v(!0)},[$]);u(()=>{let Y=$.current;if(!Y)return;let Z=()=>{if(K.current)clearTimeout(K.current);K.current=setTimeout(W,50)},q=()=>{K.current=setTimeout(()=>v(!1),200)},X=(B)=>{if(B.shiftKey||B.key.startsWith("Arrow"))Z()};return Y.addEventListener("select",Z),Y.addEventListener("mouseup",Z),Y.addEventListener("keyup",X),Y.addEventListener("blur",q),()=>{if(Y.removeEventListener("select",Z),Y.removeEventListener("mouseup",Z),Y.removeEventListener("keyup",X),Y.removeEventListener("blur",q),K.current)clearTimeout(K.current)}},[$,W]);let O=j((Y)=>{let Z=$.current;if(Z)Y.action(Z),Z.focus()},[$]);if(!U)return null;return G("div",{ref:z,class:"md-format-bar",style:{top:`${J.top}px`,left:`${J.left}px`},onMouseDown:(Y)=>Y.preventDefault(),children:[UP.map((Y)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${Y.key}`,title:`${Y.label} (${d$(Y.shortcut.toUpperCase())})`,onClick:()=>O(Y),children:Y.icon},Y.key,!1,void 0,this)),G("div",{class:"md-format-divider"},void 0,!1,void 0,this),_P.map((Y)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${Y.key}`,title:Y.label,onClick:()=>O(Y),children:Y.icon},Y.key,!1,void 0,this))]},void 0,!0,void 0,this)}var eZ=IL(EZ(),1);function FP($){for(var U=1;U<arguments.length;U++){var v=arguments[U];for(var J in v)if(Object.prototype.hasOwnProperty.call(v,J))$[J]=v[J]}return $}function $5($,U){return Array(U+1).join($)}function xZ($){return $.replace(/^\n*/,"")}function hZ($){var U=$.length;while(U>0&&$[U-1]===`
53
+ `)U--;return $.substring(0,U)}function cZ($){return hZ(xZ($))}var PP=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function U5($){return _5($,PP)}var lZ=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function rZ($){return _5($,lZ)}function kP($){return pZ($,lZ)}var iZ=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function bP($){return _5($,iZ)}function MP($){return pZ($,iZ)}function _5($,U){return U.indexOf($.nodeName)>=0}function pZ($,U){return $.getElementsByTagName&&U.some(function(v){return $.getElementsByTagName(v).length})}var AP=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function oZ($){return AP.reduce(function(U,v){return U.replace(v[0],v[1])},$)}var I6={};I6.paragraph={filter:"p",replacement:function($){return`
54
54
 
55
55
  `+$+`
56
56
 
57
- `}};O6.lineBreak={filter:"br",replacement:function($,v,g){return g.br+`
58
- `}};O6.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,g){var _=Number(v.nodeName.charAt(1));if(g.headingStyle==="setext"&&_<3){var U=jz(_===1?"=":"-",$.length);return`
57
+ `}};I6.lineBreak={filter:"br",replacement:function($,U,v){return v.br+`
58
+ `}};I6.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,U,v){var J=Number(U.nodeName.charAt(1));if(v.headingStyle==="setext"&&J<3){var _=$5(J===1?"=":"-",$.length);return`
59
59
 
60
60
  `+$+`
61
- `+U+`
61
+ `+_+`
62
62
 
63
63
  `}else return`
64
64
 
65
- `+jz("#",_)+" "+$+`
65
+ `+$5("#",J)+" "+$+`
66
66
 
67
- `}};O6.blockquote={filter:"blockquote",replacement:function($){return $=UO($).replace(/^/gm,"> "),`
67
+ `}};I6.blockquote={filter:"blockquote",replacement:function($){return $=cZ($).replace(/^/gm,"> "),`
68
68
 
69
69
  `+$+`
70
70
 
71
- `}};O6.list={filter:["ul","ol"],replacement:function($,v){var g=v.parentNode;if(g.nodeName==="LI"&&g.lastElementChild===v)return`
71
+ `}};I6.list={filter:["ul","ol"],replacement:function($,U){var v=U.parentNode;if(v.nodeName==="LI"&&v.lastElementChild===U)return`
72
72
  `+$;else return`
73
73
 
74
74
  `+$+`
75
75
 
76
- `}};O6.listItem={filter:"li",replacement:function($,v,g){var _=g.bulletListMarker+" ",U=v.parentNode;if(U.nodeName==="OL"){var z=U.getAttribute("start"),J=Array.prototype.indexOf.call(U.children,v);_=(z?Number(z)+J:J+1)+". "}var G=/\n$/.test($);return $=UO($)+(G?`
76
+ `}};I6.listItem={filter:"li",replacement:function($,U,v){var J=v.bulletListMarker+" ",_=U.parentNode;if(_.nodeName==="OL"){var z=_.getAttribute("start"),K=Array.prototype.indexOf.call(_.children,U);J=(z?Number(z)+K:K+1)+". "}var W=/\n$/.test($);return $=cZ($)+(W?`
77
77
  `:""),$=$.replace(/\n/gm,`
78
- `+" ".repeat(_.length)),_+$+(v.nextSibling?`
79
- `:"")}};O6.indentedCodeBlock={filter:function($,v){return v.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){return`
78
+ `+" ".repeat(J.length)),J+$+(U.nextSibling?`
79
+ `:"")}};I6.indentedCodeBlock={filter:function($,U){return U.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,U,v){return`
80
80
 
81
- `+v.firstChild.textContent.replace(/\n/g,`
81
+ `+U.firstChild.textContent.replace(/\n/g,`
82
82
  `)+`
83
83
 
84
- `}};O6.fencedCodeBlock={filter:function($,v){return v.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){var _=v.firstChild.getAttribute("class")||"",U=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=g.fence.charAt(0),G=3,b=new RegExp("^"+J+"{3,}","gm"),O;while(O=b.exec(z))if(O[0].length>=G)G=O[0].length+1;var W=jz(J,G);return`
84
+ `}};I6.fencedCodeBlock={filter:function($,U){return U.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,U,v){var J=U.firstChild.getAttribute("class")||"",_=(J.match(/language-(\S+)/)||[null,""])[1],z=U.firstChild.textContent,K=v.fence.charAt(0),W=3,O=new RegExp("^"+K+"{3,}","gm"),Y;while(Y=O.exec(z))if(Y[0].length>=W)W=Y[0].length+1;var Z=$5(K,W);return`
85
85
 
86
- `+W+U+`
86
+ `+Z+_+`
87
87
  `+z.replace(/\n$/,"")+`
88
- `+W+`
88
+ `+Z+`
89
89
 
90
- `}};O6.horizontalRule={filter:"hr",replacement:function($,v,g){return`
90
+ `}};I6.horizontalRule={filter:"hr",replacement:function($,U,v){return`
91
91
 
92
- `+g.hr+`
92
+ `+v.hr+`
93
93
 
94
- `}};O6.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var g=Vz(v.getAttribute("href")),_=fz(Y_(v.getAttribute("title"))),U=_?' "'+_+'"':"";return"["+$+"]("+g+U+")"}};O6.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,g){var _=Vz(v.getAttribute("href")),U=Y_(v.getAttribute("title"));if(U)U=' "'+fz(U)+'"';var z,J;switch(g.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+U;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+U;break;default:var G=this.references.length+1;z="["+$+"]["+G+"]",J="["+G+"]: "+_+U}return this.references.push(J),z},references:[],append:function($){var v="";if(this.references.length)v=`
94
+ `}};I6.inlineLink={filter:function($,U){return U.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,U){var v=v5(U.getAttribute("href")),J=J5(Zv(U.getAttribute("title"))),_=J?' "'+J+'"':"";return"["+$+"]("+v+_+")"}};I6.referenceLink={filter:function($,U){return U.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,U,v){var J=v5(U.getAttribute("href")),_=Zv(U.getAttribute("title"));if(_)_=' "'+J5(_)+'"';var z,K;switch(v.linkReferenceStyle){case"collapsed":z="["+$+"][]",K="["+$+"]: "+J+_;break;case"shortcut":z="["+$+"]",K="["+$+"]: "+J+_;break;default:var W=this.references.length+1;z="["+$+"]["+W+"]",K="["+W+"]: "+J+_}return this.references.push(K),z},references:[],append:function($){var U="";if(this.references.length)U=`
95
95
 
96
96
  `+this.references.join(`
97
97
  `)+`
98
98
 
99
- `,this.references=[];return v}};O6.emphasis={filter:["em","i"],replacement:function($,v,g){if(!$.trim())return"";return g.emDelimiter+$+g.emDelimiter}};O6.strong={filter:["strong","b"],replacement:function($,v,g){if(!$.trim())return"";return g.strongDelimiter+$+g.strongDelimiter}};O6.code={filter:function($){var v=$.previousSibling||$.nextSibling,g=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!g},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",g="`",_=$.match(/`+/gm)||[];while(_.indexOf(g)!==-1)g=g+"`";return g+v+$+v+g}};O6.image={filter:"img",replacement:function($,v){var g=GO(Y_(v.getAttribute("alt"))),_=Vz(v.getAttribute("src")||""),U=Y_(v.getAttribute("title")),z=U?' "'+fz(U)+'"':"";return _?"!["+g+"]("+_+z+")":""}};function Y_($){return $?$.replace(/(\n+\s*)+/g,`
100
- `):""}function Vz($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function fz($){return $.replace(/"/g,"\\\"")}function KO($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var v in $.rules)this.array.push($.rules[v])}KO.prototype={add:function($,v){this.array.unshift(v)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var v;if(v=Rz(this.array,$,this.options))return v;if(v=Rz(this._keep,$,this.options))return v;if(v=Rz(this._remove,$,this.options))return v;return this.defaultRule},forEach:function($){for(var v=0;v<this.array.length;v++)$(this.array[v],v)}};function Rz($,v,g){for(var _=0;_<$.length;_++){var U=$[_];if(oP(U,v,g))return U}return}function oP($,v,g){var _=$.filter;if(typeof _==="string"){if(_===v.nodeName.toLowerCase())return!0}else if(Array.isArray(_)){if(_.indexOf(v.nodeName.toLowerCase())>-1)return!0}else if(typeof _==="function"){if(_.call($,v,g))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function nP($){var{element:v,isBlock:g,isVoid:_}=$,U=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||U(v))return;var z=null,J=!1,G=null,b=sb(G,v,U);while(b!==v){if(b.nodeType===3||b.nodeType===4){var O=b.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!J&&O[0]===" ")O=O.substr(1);if(!O){b=Dz(b);continue}b.data=O,z=b}else if(b.nodeType===1){if(g(b)||b.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(b)||U(b))z=null,J=!0;else if(z)J=!1}else{b=Dz(b);continue}var W=sb(G,b,U);G=b,b=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)Dz(z)}}function Dz($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function sb($,v,g){if($&&$.parentNode===v||g(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var rz=typeof window<"u"?window:{};function tP(){var $=rz.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(g){}return v}function dP(){var $=function(){};if(aP())$.prototype.parseFromString=function(v){var g=new window.ActiveXObject("htmlfile");return g.designMode="on",g.open(),g.write(v),g.close(),g};else $.prototype.parseFromString=function(v){var g=document.implementation.createHTMLDocument("");return g.open(),g.write(v),g.close(),g};return $}function aP(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(rz.ActiveXObject)$=!0}return $}var sP=tP()?rz.DOMParser:dP();function eP($,v){var g;if(typeof $==="string"){var _=$X().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");g=_.getElementById("turndown-root")}else g=$.cloneNode(!0);return nP({element:g,isBlock:uz,isVoid:_O,isPre:v.preformattedCode?vX:null}),g}var Tz;function $X(){return Tz=Tz||new sP,Tz}function vX($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function UX($,v){return $.isBlock=uz($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=gX($),$.flankingWhitespace=_X($,v),$}function gX($){return!_O($)&&!hP($)&&/^\s*$/i.test($.textContent)&&!xP($)&&!lP($)}function _X($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var g=zX($.textContent);if(g.leadingAscii&&eb("left",$,v))g.leading=g.leadingNonAscii;if(g.trailingAscii&&eb("right",$,v))g.trailing=g.trailingNonAscii;return{leading:g.leading,trailing:g.trailing}}function zX($){var v=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:v[1],leadingAscii:v[2],leadingNonAscii:v[3],trailing:v[4],trailingNonAscii:v[5],trailingAscii:v[6]}}function eb($,v,g){var _,U,z;if($==="left")_=v.previousSibling,U=/ $/;else _=v.nextSibling,U=/^ /;if(_){if(_.nodeType===3)z=U.test(_.nodeValue);else if(g.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!uz(_))z=U.test(_.textContent)}return z}var JX=Array.prototype.reduce;function g1($){if(!(this instanceof g1))return new g1($);var v={rules:O6,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(g,_){return _.isBlock?`
99
+ `,this.references=[];return U}};I6.emphasis={filter:["em","i"],replacement:function($,U,v){if(!$.trim())return"";return v.emDelimiter+$+v.emDelimiter}};I6.strong={filter:["strong","b"],replacement:function($,U,v){if(!$.trim())return"";return v.strongDelimiter+$+v.strongDelimiter}};I6.code={filter:function($){var U=$.previousSibling||$.nextSibling,v=$.parentNode.nodeName==="PRE"&&!U;return $.nodeName==="CODE"&&!v},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var U=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",v="`",J=$.match(/`+/gm)||[];while(J.indexOf(v)!==-1)v=v+"`";return v+U+$+U+v}};I6.image={filter:"img",replacement:function($,U){var v=oZ(Zv(U.getAttribute("alt"))),J=v5(U.getAttribute("src")||""),_=Zv(U.getAttribute("title")),z=_?' "'+J5(_)+'"':"";return J?"!["+v+"]("+J+z+")":""}};function Zv($){return $?$.replace(/(\n+\s*)+/g,`
100
+ `):""}function v5($){var U=$.replace(/([<>()])/g,"\\$1");return U.indexOf(" ")>=0?"<"+U+">":U}function J5($){return $.replace(/"/g,"\\\"")}function dZ($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var U in $.rules)this.array.push($.rules[U])}dZ.prototype={add:function($,U){this.array.unshift(U)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var U;if(U=a8(this.array,$,this.options))return U;if(U=a8(this._keep,$,this.options))return U;if(U=a8(this._remove,$,this.options))return U;return this.defaultRule},forEach:function($){for(var U=0;U<this.array.length;U++)$(this.array[U],U)}};function a8($,U,v){for(var J=0;J<$.length;J++){var _=$[J];if(IP(_,U,v))return _}return}function IP($,U,v){var J=$.filter;if(typeof J==="string"){if(J===U.nodeName.toLowerCase())return!0}else if(Array.isArray(J)){if(J.indexOf(U.nodeName.toLowerCase())>-1)return!0}else if(typeof J==="function"){if(J.call($,U,v))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function wP($){var{element:U,isBlock:v,isVoid:J}=$,_=$.isPre||function(q){return q.nodeName==="PRE"};if(!U.firstChild||_(U))return;var z=null,K=!1,W=null,O=uZ(W,U,_);while(O!==U){if(O.nodeType===3||O.nodeType===4){var Y=O.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!K&&Y[0]===" ")Y=Y.substr(1);if(!Y){O=s8(O);continue}O.data=Y,z=O}else if(O.nodeType===1){if(v(O)||O.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,K=!1}else if(J(O)||_(O))z=null,K=!0;else if(z)K=!1}else{O=s8(O);continue}var Z=uZ(W,O,_);W=O,O=Z}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)s8(z)}}function s8($){var U=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),U}function uZ($,U,v){if($&&$.parentNode===U||v(U))return U.nextSibling||U.parentNode;return U.firstChild||U.nextSibling||U.parentNode}var z5=typeof window<"u"?window:{};function gP(){var $=z5.DOMParser,U=!1;try{if(new $().parseFromString("","text/html"))U=!0}catch(v){}return U}function NP(){var $=function(){};if(SP())$.prototype.parseFromString=function(U){var v=new window.ActiveXObject("htmlfile");return v.designMode="on",v.open(),v.write(U),v.close(),v};else $.prototype.parseFromString=function(U){var v=document.implementation.createHTMLDocument("");return v.open(),v.write(U),v.close(),v};return $}function SP(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(U){if(z5.ActiveXObject)$=!0}return $}var RP=gP()?z5.DOMParser:NP();function TP($,U){var v;if(typeof $==="string"){var J=yP().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");v=J.getElementById("turndown-root")}else v=$.cloneNode(!0);return wP({element:v,isBlock:U5,isVoid:rZ,isPre:U.preformattedCode?CP:null}),v}var e8;function yP(){return e8=e8||new RP,e8}function CP($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function DP($,U){return $.isBlock=U5($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=jP($),$.flankingWhitespace=VP($,U),$}function jP($){return!rZ($)&&!bP($)&&/^\s*$/i.test($.textContent)&&!kP($)&&!MP($)}function VP($,U){if($.isBlock||U.preformattedCode&&$.isCode)return{leading:"",trailing:""};var v=fP($.textContent);if(v.leadingAscii&&mZ("left",$,U))v.leading=v.leadingNonAscii;if(v.trailingAscii&&mZ("right",$,U))v.trailing=v.trailingNonAscii;return{leading:v.leading,trailing:v.trailing}}function fP($){var U=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:U[1],leadingAscii:U[2],leadingNonAscii:U[3],trailing:U[4],trailingNonAscii:U[5],trailingAscii:U[6]}}function mZ($,U,v){var J,_,z;if($==="left")J=U.previousSibling,_=/ $/;else J=U.nextSibling,_=/^ /;if(J){if(J.nodeType===3)z=_.test(J.nodeValue);else if(v.preformattedCode&&J.nodeName==="CODE")z=!1;else if(J.nodeType===1&&!U5(J))z=_.test(J.textContent)}return z}var EP=Array.prototype.reduce;function a0($){if(!(this instanceof a0))return new a0($);var U={rules:I6,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(v,J){return J.isBlock?`
101
101
 
102
- `:""},keepReplacement:function(g,_){return _.isBlock?`
102
+ `:""},keepReplacement:function(v,J){return J.isBlock?`
103
103
 
104
- `+_.outerHTML+`
104
+ `+J.outerHTML+`
105
105
 
106
- `:_.outerHTML},defaultReplacement:function(g,_){return _.isBlock?`
106
+ `:J.outerHTML},defaultReplacement:function(v,J){return J.isBlock?`
107
107
 
108
- `+g+`
108
+ `+v+`
109
109
 
110
- `:g}};this.options=cP({},v,$),this.rules=new KO(this.options)}g1.prototype={turndown:function($){if(!bX($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=bO.call(this,new eP($,this.options));return GX.call(this,v)},use:function($){if(Array.isArray($))for(var v=0;v<$.length;v++)this.use($[v]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,v){return this.rules.add($,v),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return GO($)}};function bO($){var v=this;return JX.call($.childNodes,function(g,_){_=new UX(_,v.options);var U="";if(_.nodeType===3)U=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)U=KX.call(v,_);return OO(g,U)},"")}function GX($){var v=this;return this.rules.forEach(function(g){if(typeof g.append==="function")$=OO($,g.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function KX($){var v=this.rules.forNode($),g=bO.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)g=g.trim();return _.leading+v.replacement(g,$,this.options)+_.trailing}function OO($,v){var g=vO($),_=$O(v),U=Math.max($.length-g.length,v.length-_.length),z=`
110
+ `:v}};this.options=FP({},U,$),this.rules=new dZ(this.options)}a0.prototype={turndown:function($){if(!xP($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var U=nZ.call(this,new TP($,this.options));return uP.call(this,U)},use:function($){if(Array.isArray($))for(var U=0;U<$.length;U++)this.use($[U]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,U){return this.rules.add($,U),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return oZ($)}};function nZ($){var U=this;return EP.call($.childNodes,function(v,J){J=new DP(J,U.options);var _="";if(J.nodeType===3)_=J.isCode?J.nodeValue:U.escape(J.nodeValue);else if(J.nodeType===1)_=mP.call(U,J);return tZ(v,_)},"")}function uP($){var U=this;return this.rules.forEach(function(v){if(typeof v.append==="function")$=tZ($,v.append(U.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function mP($){var U=this.rules.forNode($),v=nZ.call(this,$),J=$.flankingWhitespace;if(J.leading||J.trailing)v=v.trim();return J.leading+U.replacement(v,$,this.options)+J.trailing}function tZ($,U){var v=hZ($),J=xZ(U),_=Math.max($.length-v.length,U.length-J.length),z=`
111
111
 
112
- `.substring(0,U);return g+z+_}function bX($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function k_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function WO(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let g=v.toString(),_=document.createElement("code");_.textContent=g,v.deleteContents(),v.insertNode(_);let U=document.createRange();U.setStartAfter(_),U.setEndAfter(_),$.removeAllRanges(),$.addRange(U)}var q_=8,OX=[{kind:"exec",command:"bold",icon:"B",title:"Bold (⌘B)"},{kind:"exec",command:"italic",icon:"I",title:"Italic (⌘I)"},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:"Link (⌘K)",dividerBefore:!0}];function WX($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":WO();return;case"link":k_();return}}function BO({hostRef:$,onChange:v}){let[g,_]=i(!1),[U,z]=i({top:0,left:0}),[J,G]=i(0),b=D(null),O=D(null),W=y(()=>{let Y=$.current;if(!Y){_(!1);return}let F=window.getSelection();if(!F||F.rangeCount===0||F.isCollapsed){_(!1);return}let X=F.getRangeAt(0);if(!Y.contains(X.commonAncestorContainer)){_(!1);return}let H=X.getBoundingClientRect();if(H.width===0&&H.height===0){_(!1);return}let q=J||420,L=Math.max(q_,Math.min(H.left+H.width/2-q/2,window.innerWidth-q-q_)),I=Math.max(q_,H.top-q_-36);z({top:I,left:L}),_(!0)},[$,J]),B=y(()=>{if(O.current!==null)return;O.current=requestAnimationFrame(()=>{O.current=null,W()})},[W]);r(()=>{return document.addEventListener("selectionchange",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{if(document.removeEventListener("selectionchange",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),O.current!==null)cancelAnimationFrame(O.current)}},[B]),yg(()=>{if(!g)return;let Y=b.current;if(!Y)return;let F=Y.getBoundingClientRect().width;if(F&&Math.abs(F-J)>1)G(F)},[g,J]);let k=y((Y)=>{WX(Y),v(),W()},[v,W]);if(!g)return null;return K("div",{ref:b,class:"md-inline-format-bar",style:{top:`${U.top}px`,left:`${U.left}px`},onMouseDown:(Y)=>Y.preventDefault(),children:OX.flatMap((Y,F)=>{let X=K("button",{type:"button",class:"md-inline-format-btn",title:Y.title,onClick:()=>k(Y),children:Y.icon},`btn-${F}`,!1,void 0,this);return Y.dividerBefore?[K("span",{class:"md-inline-format-divider"},`div-${F}`,!1,void 0,this),X]:[X]})},void 0,!1,void 0,this)}var Ez=null;function BX(){if(Ez)return Ez;let $=new g1({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(YO.gfm),Ez=$,$}function kO({initialHtml:$,className:v,onChange:g,onSave:_}){let U=D(null),z=D($);r(()=>{let B=U.current;if(!B)return;B.innerHTML=z.current},[]);let J=y(()=>{let B=U.current;if(!B)return"";return BX().turndown(B.innerHTML)},[]),G=y(()=>{g(J())},[g,J]),b=y(()=>{_?.(J())},[_,J]),O=y((B)=>{if(!(B.metaKey||B.ctrlKey))return;if(B.key==="s"){B.preventDefault(),b();return}if(B.key==="b"){B.preventDefault(),document.execCommand("bold"),G();return}if(B.key==="i"){B.preventDefault(),document.execCommand("italic"),G();return}if(B.key==="k")B.preventDefault(),k_(),G()},[G,b]),W=y((B)=>{let k=B.clipboardData?.getData("text/plain");if(k==null)return;B.preventDefault(),document.execCommand("insertText",!1,k),G()},[G]);return K(t$,{children:[K("div",{ref:U,class:v,contentEditable:!0,spellcheck:!1,onInput:G,onKeyDown:O,onPaste:W,onBlur:b},void 0,!1,void 0,this),K(BO,{hostRef:U,onChange:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mz({html:$,className:v,style:g}){let _=D(null);return r(()=>{let U=_.current;if(!U)return;if(U.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,U.append(z.content.cloneNode(!0))},[$]),K("div",{ref:_,class:v,style:g},void 0,!1,void 0,this)}function P_({node:$,expanded:v=!1}){let g=$.data.path,[_,U]=i(""),[z,J]=i(""),[G,b]=i(!1),[O,W]=i(!1),[B,k]=i(!1),[Y,F]=i(!1),X=D(null),H=D(null),q=D(""),L=D(null),I=$.data.reviewActive;r(()=>{let R=!1;return(async()=>{let n;if(g){let c=await oU(g);if(R)return;n=c.content}else if($.data.content)n=$.data.content;else{b(!0);return}U(n);let p=await _4(n);if(R)return;J(p),b(!0),g$($.id,{content:n,rendered:p})})(),()=>{R=!0}},[g,$.id,$.data.content]);let N=y(async(R)=>{let n=R.target.value;U(n),F(!0);let p=await _4(n);J(p)},[]),T=y(async(R)=>{if(!g){let p=await _4(R);J(p),F(!1),g$($.id,{content:R,rendered:p}),await k6($.id,{content:R,data:{rendered:p}});return}k(!0);let n=await f7(g,R);if(k(!1),n.ok){let p=await _4(R);J(p),F(!1),g$($.id,{content:R,rendered:p,savedAt:n.updatedAt}),await k6($.id,{content:R,data:{rendered:p,savedAt:n.updatedAt}})}},[g,$.id]),x=y(async()=>{if(!Y)return;await T(_)},[Y,_,T]),S=y((R)=>{if((R.metaKey||R.ctrlKey)&&R.key==="s"){R.preventDefault(),x();return}let n=X.current;if(n&&ub(R,n))return;if(n&&R.key==="Tab")R.preventDefault(),jb(n,R.shiftKey)},[x]);L.current=T;let l=y((R)=>{if(U(R),F(!0),q.current=R,H.current!==null)window.clearTimeout(H.current);H.current=window.setTimeout(()=>{H.current=null,T(R)},800)},[T]),t=y((R)=>{if(U(R),q.current=R,H.current!==null)window.clearTimeout(H.current),H.current=null;T(R)},[T]);r(()=>{return()=>{if(H.current===null)return;window.clearTimeout(H.current),H.current=null;let R=L.current;if(R)R(q.current)}},[$.id]);let M=I?K("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(O&&v)return K("div",{class:"md-editor-expanded",onKeyDown:S,children:[K("div",{class:"md-editor-toolbar",children:[K("button",{type:"button",class:"md-toolbar-btn",onClick:()=>W(!1),children:"← Back to document"},void 0,!1,void 0,this),K("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[g&&K("span",{class:"md-toolbar-path",children:g.split("/").pop()},void 0,!1,void 0,this),K("button",{type:"button",class:`md-toolbar-btn${Y?" md-toolbar-btn-primary":""}`,onClick:x,disabled:!Y||B,children:B?"Saving…":Y?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"md-editor-split",children:[K("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[K("textarea",{ref:X,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),K(Mz,{textareaRef:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(mz,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(O)return K("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:S,children:[K("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[K("textarea",{ref:X,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),K(Mz,{textareaRef:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(mz,{html:z,className:"md-preview"},void 0,!1,void 0,this),K("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[K("button",{type:"button",onClick:()=>W(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),K("button",{type:"button",onClick:x,disabled:!Y||B,style:{padding:"4px 10px",fontSize:"11px",background:Y?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${Y?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:Y?"var(--c-text)":"var(--c-dim)",cursor:Y?"pointer":"default"},children:B?"Saving…":Y?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(v)return K("div",{style:{height:"100%",position:"relative"},children:[M,K("div",{class:"md-reader",children:G?K(kO,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:l,onSave:t},$.id,!1,void 0,this):K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("button",{type:"button",class:"md-edit-fab",onClick:()=>W(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return K("div",{style:{height:"100%",position:"relative"},children:[M,K(mz,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"}},void 0,!1,void 0,this),!G&&K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),G&&!z&&K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),K("button",{type:"button",onClick:()=>J4($.id),style:{position:"absolute",top:"4px",right:"4px",padding:"3px 8px",fontSize:"10px",background:"var(--c-panel-overlay)",border:"1px solid var(--c-line)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",opacity:0.7},onMouseEnter:(R)=>{R.target.style.opacity="1"},onMouseLeave:(R)=>{R.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var X_="pmx-canvas-ax",H_="pmx-canvas-ax-ack",j6="pmx-canvas-html-node",L_="pmx-canvas-ext-app-alive",cz="pmx-canvas-ext-app-paint-probe";function qO($,v){switch($){case"html":return typeof v.html==="string"&&v.html.length>0||typeof v.content==="string"&&v.content.length>0;case"mermaid":return typeof v.content==="string"&&v.content.trim().length>0;case"json-render":case"graph":return!0;case"mcp-app":return v.viewerType==="web-artifact"&&typeof v.path==="string"&&v.path.length>0||typeof v.url==="string"&&v.url.length>0;case"webpage":return typeof v.url==="string"&&v.url.length>0;default:return!1}}var iz="allow-scripts allow-popups allow-popups-to-escape-sandbox";function mv($){let v=5381;for(let g=0;g<$.length;g+=1)v=(v<<5)+v+$.charCodeAt(g)|0;return(v>>>0).toString(36)}function _1($,v={}){let g=new URLSearchParams;if(g.set("theme",v.theme??c$.value),v.themeToken)g.set("themeToken",v.themeToken);if(v.present)g.set("present","1");if(v.presentToken)g.set("presentToken",v.presentToken);if(v.v)g.set("v",v.v);if(v.axToken)g.set("axToken",v.axToken);if(v.frameToken)g.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${g.toString()}`}function F_($){return qO($.type,$.data)}async function Z_($){let v=_1($.id);if(!(await i7($.id,v)).opened)window.open(v,"_blank","noopener")}var YX={markdown:{width:360,height:180},context:{width:360,height:180},file:{width:360,height:200},diff:{width:420,height:240},mermaid:{width:360,height:240},status:{width:280,height:120},ledger:{width:320,height:200},image:{width:240,height:180},html:{width:420,height:280},webpage:{width:420,height:280},"json-render":{width:420,height:280},graph:{width:420,height:280},"mcp-app":{width:480,height:320}};function PO($){return YX[$]}var cv=37,kX=600,qX=1400,PX=24;function XX($){return $.type==="html"||$.type==="mermaid"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function HX($){if($.type==="html")return $.data.presentation!==!0;if($.type==="mermaid")return!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function XO($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function xz($){return!XO($)&&!XX($)}function HO($,v){if(!xz($)||v<=0)return null;let g=Math.min(v+cv,kX),_=PO($.type);return _?Math.max(g,_.height):g}function hz($){return HX($)&&!XO($)}function LO($,v){if(!hz($)||v<=0)return null;let g=Math.min(v+cv+PX,qX);return g>$.size.height+8?g:null}function iv($,v,g){let _=D($);_.current=$;let U=D(null);r(()=>{if(!g)return;function z(J){if(J.source!==v.current?.contentWindow)return;let G=J.data;if(!G||G.source!=="pmx-canvas-frame"||G.type!=="content-height"||G.token!==g)return;let b=_.current,O=typeof G.height==="number"?G.height:0,W=LO(b,O);if(W===null)return;if(jv(b.id,{width:b.size.width,height:W}),U.current!==null)window.clearTimeout(U.current);U.current=window.setTimeout(()=>{a$({recordHistory:!1}),U.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),U.current!==null)window.clearTimeout(U.current),U.current=null}},[$.id,g])}function LX($){try{return new URL($,window.location.origin).origin===window.location.origin}catch{return!1}}function xv($){let v=I6.value,[g,_]=i(null),U=Boolean($)&&LX($),z=v==="srcdoc"&&U;if(r(()=>{if(!z)return;let J=!1;return fetch($,{credentials:"same-origin"}).then((G)=>G.ok?G.text():Promise.reject(Error(`HTTP ${G.status}`))).then((G)=>{if(!J)_({url:$,html:G})}).catch((G)=>{if(console.error("[surface-frame] srcdoc fetch failed, falling back to src:",$,G),!J)_({url:$,html:""})}),()=>{J=!0}},[z,$]),!$)return{};if(!z)return v===null&&U?{}:{src:$};if(g)return g.html?{srcdoc:g.html}:{src:g.url};return{}}function I_({node:$,expanded:v=!1}){let g=D(null),_=c$.value,U=D$(()=>`theme-${crypto.randomUUID()}`,[]),z=D$(()=>`frame-${crypto.randomUUID()}`,[]),J=typeof $.data.content==="string"?$.data.content:"",G=D$(()=>mv(J),[J]),b=D$(()=>J?_1($.id,{theme:_,themeToken:U,v:G,frameToken:z}):"",[J,U,G,$.id,z]),O=xv(b);iv($,g,v?"":z);let W=()=>{g.current?.contentWindow?.postMessage({source:j6,type:"theme-update",token:U,theme:_},"*")};if(r(W,[_,U]),!J)return K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No diagram source set"},void 0,!1,void 0,this);return K("iframe",{ref:g,class:"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"Mermaid diagram",sandbox:"allow-scripts",...O,onLoad:W,style:{width:"100%",height:"100%",minHeight:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:"6px",display:"block"}},void 0,!1,void 0,this)}var lz=["dark","light","high-contrast","midnight","sepia","arctic","ember","forest","volt"];function z1($){return typeof $==="string"&&lz.includes($)}function pz($,v="dark"){return z1($)?$:v}var hv={dark:{label:"Dark",scheme:"dark",swatchBg:"#081524",swatchAccent:"#4BBCFF"},light:{label:"Light",scheme:"light",swatchBg:"#F4EFE6",swatchAccent:"#1A7ABF"},"high-contrast":{label:"High contrast",scheme:"dark",swatchBg:"#000000",swatchAccent:"#00ffff"},midnight:{label:"Midnight",scheme:"dark",swatchBg:"#0A0D1C",swatchAccent:"#8B96FF"},sepia:{label:"Sepia",scheme:"light",swatchBg:"#F2E7D5",swatchAccent:"#B4632C"},arctic:{label:"Arctic",scheme:"dark",swatchBg:"#20242E",swatchAccent:"#7FC8DE"},ember:{label:"Ember",scheme:"dark",swatchBg:"#0B0B0C",swatchAccent:"#F34E1C"},forest:{label:"Forest",scheme:"dark",swatchBg:"#0C1712",swatchAccent:"#5CCF8F"},volt:{label:"Volt",scheme:"dark",swatchBg:"#0B0D0B",swatchAccent:"#DFDFC1"}};function lv($){return hv[pz($)].scheme}var P={};$4(P,{xor:()=>sW,xid:()=>QW,void:()=>nW,uuidv7:()=>qW,uuidv6:()=>kW,uuidv4:()=>YW,uuid:()=>BW,util:()=>V,url:()=>PW,uppercase:()=>_U,unknown:()=>R$,union:()=>S$,undefined:()=>pW,ulid:()=>IW,uint64:()=>hW,uint32:()=>cW,tuple:()=>gG,trim:()=>OU,treeifyError:()=>_J,transform:()=>o0,toUpperCase:()=>BU,toLowerCase:()=>WU,toJSONSchema:()=>Z0,templateLiteral:()=>bB,symbol:()=>lW,superRefine:()=>yG,success:()=>JB,stringbool:()=>PB,stringFormat:()=>uW,string:()=>w,strictObject:()=>aW,startsWith:()=>JU,slugify:()=>YU,size:()=>Wv,setErrorMap:()=>iL,set:()=>UB,safeParseAsync:()=>C5,safeParse:()=>u5,safeEncodeAsync:()=>i5,safeEncode:()=>m5,safeDecodeAsync:()=>x5,safeDecode:()=>c5,registry:()=>p_,regexes:()=>C6,regex:()=>UU,refine:()=>NG,record:()=>j$,readonly:()=>IG,property:()=>X0,promise:()=>OB,prettifyError:()=>zJ,preprocess:()=>x1,prefault:()=>qG,positive:()=>Y0,pipe:()=>C1,partialRecord:()=>eW,parseAsync:()=>j5,parse:()=>T5,overwrite:()=>x6,optional:()=>C$,object:()=>o,number:()=>Z$,nullish:()=>zB,nullable:()=>u1,null:()=>IU,normalize:()=>bU,nonpositive:()=>q0,nonoptional:()=>PG,nonnegative:()=>P0,never:()=>p0,negative:()=>k0,nativeEnum:()=>gB,nanoid:()=>LW,nan:()=>GB,multipleOf:()=>j4,minSize:()=>s6,minLength:()=>b4,mime:()=>KU,meta:()=>kB,maxSize:()=>u4,maxLength:()=>Bv,map:()=>vB,mac:()=>MW,lte:()=>y6,lt:()=>d6,lowercase:()=>gU,looseRecord:()=>$B,looseObject:()=>g6,locales:()=>y1,literal:()=>d,length:()=>Yv,lazy:()=>AG,ksuid:()=>wW,keyof:()=>dW,jwt:()=>jW,json:()=>XB,iso:()=>r4,ipv6:()=>SW,ipv4:()=>AW,intersection:()=>QU,int64:()=>xW,int32:()=>mW,int:()=>S0,instanceof:()=>qB,includes:()=>zU,httpUrl:()=>XW,hostname:()=>CW,hex:()=>VW,hash:()=>fW,guid:()=>WW,gte:()=>X6,gt:()=>a6,globalRegistry:()=>U6,getErrorMap:()=>xL,function:()=>WB,fromJSONSchema:()=>LB,formatError:()=>q1,float64:()=>EW,float32:()=>rW,flattenError:()=>k1,file:()=>_B,exactOptional:()=>OG,enum:()=>_6,endsWith:()=>GU,encodeAsync:()=>r5,encode:()=>V5,emoji:()=>HW,email:()=>OW,e164:()=>TW,discriminatedUnion:()=>m1,describe:()=>YB,decodeAsync:()=>E5,decode:()=>f5,date:()=>tW,custom:()=>s0,cuid2:()=>ZW,cuid:()=>FW,core:()=>O4,config:()=>o$,coerce:()=>DG,codec:()=>KB,clone:()=>P6,cidrv6:()=>yW,cidrv4:()=>NW,check:()=>BB,catch:()=>LG,boolean:()=>n$,bigint:()=>iW,base64url:()=>DW,base64:()=>RW,array:()=>q$,any:()=>oW,_function:()=>WB,_default:()=>YG,_ZodString:()=>N0,ZodXor:()=>e5,ZodXID:()=>C0,ZodVoid:()=>a5,ZodUnknown:()=>t5,ZodUnion:()=>E1,ZodUndefined:()=>p5,ZodUUID:()=>e6,ZodURL:()=>V1,ZodULID:()=>u0,ZodType:()=>b$,ZodTuple:()=>UG,ZodTransform:()=>KG,ZodTemplateLiteral:()=>QG,ZodSymbol:()=>l5,ZodSuccess:()=>XG,ZodStringFormat:()=>y$,ZodString:()=>XU,ZodSet:()=>zG,ZodRecord:()=>c1,ZodRealError:()=>A6,ZodReadonly:()=>ZG,ZodPromise:()=>MG,ZodPrefault:()=>kG,ZodPipe:()=>d0,ZodOptional:()=>n0,ZodObject:()=>r1,ZodNumberFormat:()=>kv,ZodNumber:()=>LU,ZodNullable:()=>WG,ZodNull:()=>o5,ZodNonOptional:()=>t0,ZodNever:()=>d5,ZodNanoID:()=>D0,ZodNaN:()=>FG,ZodMap:()=>_G,ZodMAC:()=>h5,ZodLiteral:()=>JG,ZodLazy:()=>wG,ZodKSUID:()=>V0,ZodJWT:()=>h0,ZodIssueCode:()=>cL,ZodIntersection:()=>vG,ZodISOTime:()=>A0,ZodISODuration:()=>M0,ZodISODateTime:()=>Q0,ZodISODate:()=>w0,ZodIPv6:()=>r0,ZodIPv4:()=>f0,ZodGUID:()=>j1,ZodFunction:()=>SG,ZodFirstPartyTypeKind:()=>RG,ZodFile:()=>GG,ZodExactOptional:()=>bG,ZodError:()=>EL,ZodEnum:()=>PU,ZodEmoji:()=>R0,ZodEmail:()=>y0,ZodE164:()=>x0,ZodDiscriminatedUnion:()=>$G,ZodDefault:()=>BG,ZodDate:()=>f1,ZodCustomStringFormat:()=>HU,ZodCustom:()=>i1,ZodCodec:()=>a0,ZodCatch:()=>HG,ZodCUID2:()=>j0,ZodCUID:()=>T0,ZodCIDRv6:()=>m0,ZodCIDRv4:()=>E0,ZodBoolean:()=>FU,ZodBigIntFormat:()=>l0,ZodBigInt:()=>ZU,ZodBase64URL:()=>i0,ZodBase64:()=>c0,ZodArray:()=>s5,ZodAny:()=>n5,TimePrecision:()=>G3,NEVER:()=>oz,$output:()=>v3,$input:()=>U3,$brand:()=>nz});var O4={};$4(O4,{version:()=>sJ,util:()=>V,treeifyError:()=>_J,toJSONSchema:()=>Z0,toDotPath:()=>AO,safeParseAsync:()=>H1,safeParse:()=>sv,safeEncodeAsync:()=>TO,safeEncode:()=>RO,safeDecodeAsync:()=>jO,safeDecode:()=>DO,registry:()=>p_,regexes:()=>C6,process:()=>A$,prettifyError:()=>zJ,parseAsync:()=>X1,parse:()=>P1,meta:()=>c3,locales:()=>y1,isValidJWT:()=>sO,isValidBase64URL:()=>aO,isValidBase64:()=>F8,initializeContext:()=>C4,globalRegistry:()=>U6,globalConfig:()=>J1,formatError:()=>q1,flattenError:()=>k1,finalize:()=>f4,extractDefs:()=>V4,encodeAsync:()=>NO,encode:()=>MO,describe:()=>m3,decodeAsync:()=>yO,decode:()=>SO,createToJSONSchemaMethod:()=>x3,createStandardJSONSchemaMethod:()=>qU,config:()=>o$,clone:()=>P6,_xor:()=>qL,_xid:()=>g0,_void:()=>D3,_uuidv7:()=>a_,_uuidv6:()=>d_,_uuidv4:()=>t_,_uuid:()=>n_,_url:()=>D1,_uppercase:()=>_U,_unknown:()=>y3,_union:()=>kL,_undefined:()=>M3,_ulid:()=>U0,_uint64:()=>w3,_uint32:()=>H3,_tuple:()=>HL,_trim:()=>OU,_transform:()=>AL,_toUpperCase:()=>BU,_toLowerCase:()=>WU,_templateLiteral:()=>uL,_symbol:()=>A3,_superRefine:()=>E3,_success:()=>RL,_stringbool:()=>i3,_stringFormat:()=>kU,_string:()=>_3,_startsWith:()=>JU,_slugify:()=>YU,_size:()=>Wv,_set:()=>ZL,_safeParseAsync:()=>ev,_safeParse:()=>av,_safeEncodeAsync:()=>D_,_safeEncode:()=>y_,_safeDecodeAsync:()=>T_,_safeDecode:()=>R_,_regex:()=>UU,_refine:()=>r3,_record:()=>LL,_readonly:()=>jL,_property:()=>X0,_promise:()=>VL,_positive:()=>Y0,_pipe:()=>TL,_parseAsync:()=>dv,_parse:()=>tv,_overwrite:()=>x6,_optional:()=>ML,_number:()=>B3,_nullable:()=>SL,_null:()=>S3,_normalize:()=>bU,_nonpositive:()=>q0,_nonoptional:()=>yL,_nonnegative:()=>P0,_never:()=>R3,_negative:()=>k0,_nativeEnum:()=>QL,_nanoid:()=>e_,_nan:()=>u3,_multipleOf:()=>j4,_minSize:()=>s6,_minLength:()=>b4,_min:()=>X6,_mime:()=>KU,_maxSize:()=>u4,_maxLength:()=>Bv,_max:()=>y6,_map:()=>FL,_mac:()=>J3,_lte:()=>y6,_lt:()=>d6,_lowercase:()=>gU,_literal:()=>wL,_length:()=>Yv,_lazy:()=>CL,_ksuid:()=>_0,_jwt:()=>B0,_isoTime:()=>O3,_isoDuration:()=>W3,_isoDateTime:()=>K3,_isoDate:()=>b3,_ipv6:()=>J0,_ipv4:()=>z0,_intersection:()=>XL,_int64:()=>Q3,_int32:()=>X3,_int:()=>k3,_includes:()=>zU,_guid:()=>R1,_gte:()=>X6,_gt:()=>a6,_float64:()=>P3,_float32:()=>q3,_file:()=>V3,_enum:()=>IL,_endsWith:()=>GU,_encodeAsync:()=>S_,_encode:()=>A_,_emoji:()=>s_,_email:()=>o_,_e164:()=>W0,_discriminatedUnion:()=>PL,_default:()=>NL,_decodeAsync:()=>N_,_decode:()=>M_,_date:()=>T3,_custom:()=>f3,_cuid2:()=>v0,_cuid:()=>$0,_coercedString:()=>z3,_coercedNumber:()=>Y3,_coercedDate:()=>j3,_coercedBoolean:()=>F3,_coercedBigint:()=>I3,_cidrv6:()=>K0,_cidrv4:()=>G0,_check:()=>GW,_catch:()=>DL,_boolean:()=>L3,_bigint:()=>Z3,_base64url:()=>O0,_base64:()=>b0,_array:()=>C3,_any:()=>N3,TimePrecision:()=>G3,NEVER:()=>oz,JSONSchemaGenerator:()=>S5,JSONSchema:()=>KW,Doc:()=>V_,$output:()=>v3,$input:()=>U3,$constructor:()=>Z,$brand:()=>nz,$ZodXor:()=>r8,$ZodXID:()=>b8,$ZodVoid:()=>u8,$ZodUnknown:()=>T8,$ZodUnion:()=>Q1,$ZodUndefined:()=>y8,$ZodUUID:()=>v8,$ZodURL:()=>g8,$ZodULID:()=>K8,$ZodType:()=>z$,$ZodTuple:()=>h_,$ZodTransform:()=>o8,$ZodTemplateLiteral:()=>_9,$ZodSymbol:()=>N8,$ZodSuccess:()=>e8,$ZodStringFormat:()=>N$,$ZodString:()=>Ov,$ZodSet:()=>x8,$ZodRegistry:()=>g3,$ZodRecord:()=>c8,$ZodRealError:()=>w6,$ZodReadonly:()=>g9,$ZodPromise:()=>J9,$ZodPrefault:()=>a8,$ZodPipe:()=>U9,$ZodOptional:()=>l_,$ZodObjectJIT:()=>f8,$ZodObject:()=>vW,$ZodNumberFormat:()=>M8,$ZodNumber:()=>i_,$ZodNullable:()=>t8,$ZodNull:()=>R8,$ZodNonOptional:()=>s8,$ZodNever:()=>j8,$ZodNanoID:()=>z8,$ZodNaN:()=>v9,$ZodMap:()=>i8,$ZodMAC:()=>X8,$ZodLiteral:()=>l8,$ZodLazy:()=>G9,$ZodKSUID:()=>O8,$ZodJWT:()=>w8,$ZodIntersection:()=>m8,$ZodISOTime:()=>Y8,$ZodISODuration:()=>k8,$ZodISODateTime:()=>W8,$ZodISODate:()=>B8,$ZodIPv6:()=>P8,$ZodIPv4:()=>q8,$ZodGUID:()=>$8,$ZodFunction:()=>z9,$ZodFile:()=>p8,$ZodExactOptional:()=>n8,$ZodError:()=>Y1,$ZodEnum:()=>h8,$ZodEncodeError:()=>Gv,$ZodEmoji:()=>_8,$ZodEmail:()=>U8,$ZodE164:()=>Q8,$ZodDiscriminatedUnion:()=>E8,$ZodDefault:()=>d8,$ZodDate:()=>C8,$ZodCustomStringFormat:()=>A8,$ZodCustom:()=>K9,$ZodCodec:()=>w1,$ZodCheckUpperCase:()=>lJ,$ZodCheckStringFormat:()=>$U,$ZodCheckStartsWith:()=>oJ,$ZodCheckSizeEquals:()=>EJ,$ZodCheckRegex:()=>xJ,$ZodCheckProperty:()=>tJ,$ZodCheckOverwrite:()=>aJ,$ZodCheckNumberFormat:()=>CJ,$ZodCheckMultipleOf:()=>uJ,$ZodCheckMinSize:()=>rJ,$ZodCheckMinLength:()=>cJ,$ZodCheckMimeType:()=>dJ,$ZodCheckMaxSize:()=>fJ,$ZodCheckMaxLength:()=>mJ,$ZodCheckLowerCase:()=>hJ,$ZodCheckLessThan:()=>u_,$ZodCheckLengthEquals:()=>iJ,$ZodCheckIncludes:()=>pJ,$ZodCheckGreaterThan:()=>C_,$ZodCheckEndsWith:()=>nJ,$ZodCheckBigIntFormat:()=>VJ,$ZodCheck:()=>T$,$ZodCatch:()=>$9,$ZodCUID2:()=>G8,$ZodCUID:()=>J8,$ZodCIDRv6:()=>L8,$ZodCIDRv4:()=>H8,$ZodBoolean:()=>I1,$ZodBigIntFormat:()=>S8,$ZodBigInt:()=>x_,$ZodBase64URL:()=>I8,$ZodBase64:()=>Z8,$ZodAsyncError:()=>t6,$ZodArray:()=>V8,$ZodAny:()=>D8});var oz=Object.freeze({status:"aborted"});function Z($,v,g){function _(G,b){if(!G._zod)Object.defineProperty(G,"_zod",{value:{def:b,constr:J,traits:new Set},enumerable:!1});if(G._zod.traits.has($))return;G._zod.traits.add($),v(G,b);let O=J.prototype,W=Object.keys(O);for(let B=0;B<W.length;B++){let k=W[B];if(!(k in G))G[k]=O[k].bind(G)}}let U=g?.Parent??Object;class z extends U{}Object.defineProperty(z,"name",{value:$});function J(G){var b;let O=g?.Parent?new z:this;_(O,G),(b=O._zod).deferred??(b.deferred=[]);for(let W of O._zod.deferred)W();return O}return Object.defineProperty(J,"init",{value:_}),Object.defineProperty(J,Symbol.hasInstance,{value:(G)=>{if(g?.Parent&&G instanceof g.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var nz=Symbol("zod_brand");class t6 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Gv extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var J1={};function o$($){if($)Object.assign(J1,$);return J1}var V={};$4(V,{unwrapMessage:()=>G1,uint8ArrayToHex:()=>hX,uint8ArrayToBase64url:()=>iX,uint8ArrayToBase64:()=>IO,stringifyPrimitive:()=>j,slugify:()=>az,shallowClone:()=>ez,safeExtend:()=>VX,required:()=>EX,randomString:()=>yX,propertyKeyTypes:()=>O1,promiseAllObject:()=>NX,primitiveTypes:()=>$J,prefixIssues:()=>N6,pick:()=>jX,partial:()=>rX,parsedType:()=>C,optionalKeys:()=>vJ,omit:()=>uX,objectClone:()=>AX,numKeys:()=>RX,nullish:()=>y4,normalizeParams:()=>f,mergeDefs:()=>K4,merge:()=>fX,jsonStringifyReplacer:()=>pv,joinValues:()=>Q,issue:()=>nv,isPlainObject:()=>D4,isObject:()=>Kv,hexToUint8Array:()=>xX,getSizableOrigin:()=>W1,getParsedType:()=>DX,getLengthableOrigin:()=>B1,getEnumValues:()=>K1,getElementAtPath:()=>SX,floatSafeRemainder:()=>dz,finalizeIssue:()=>Q6,extend:()=>CX,escapeRegex:()=>u6,esc:()=>Q_,defineLazy:()=>Y$,createTransparentProxy:()=>TX,cloneDef:()=>MX,clone:()=>P6,cleanRegex:()=>b1,cleanEnum:()=>mX,captureStackTrace:()=>w_,cached:()=>ov,base64urlToUint8Array:()=>cX,base64ToUint8Array:()=>ZO,assignProp:()=>R4,assertNotEqual:()=>ZX,assertNever:()=>QX,assertIs:()=>IX,assertEqual:()=>FX,assert:()=>wX,allowsEval:()=>sz,aborted:()=>T4,NUMBER_FORMAT_RANGES:()=>UJ,Class:()=>QO,BIGINT_FORMAT_RANGES:()=>gJ});function FX($){return $}function ZX($){return $}function IX($){}function QX($){throw Error("Unexpected value in exhaustive check")}function wX($){}function K1($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,U])=>v.indexOf(+_)===-1).map(([_,U])=>U)}function Q($,v="|"){return $.map((g)=>j(g)).join(v)}function pv($,v){if(typeof v==="bigint")return v.toString();return v}function ov($){return{get value(){{let g=$();return Object.defineProperty(this,"value",{value:g}),g}throw Error("cached value already set")}}}function y4($){return $===null||$===void 0}function b1($){let v=$.startsWith("^")?1:0,g=$.endsWith("$")?$.length-1:$.length;return $.slice(v,g)}function dz($,v){let g=($.toString().split(".")[1]||"").length,_=v.toString(),U=(_.split(".")[1]||"").length;if(U===0&&/\d?e-\d?/.test(_)){let b=_.match(/\d?e-(\d?)/);if(b?.[1])U=Number.parseInt(b[1])}let z=g>U?g:U,J=Number.parseInt($.toFixed(z).replace(".","")),G=Number.parseInt(v.toFixed(z).replace(".",""));return J%G/10**z}var FO=Symbol("evaluating");function Y$($,v,g){let _=void 0;Object.defineProperty($,v,{get(){if(_===FO)return;if(_===void 0)_=FO,_=g();return _},set(U){Object.defineProperty($,v,{value:U})},configurable:!0})}function AX($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function R4($,v,g){Object.defineProperty($,v,{value:g,writable:!0,enumerable:!0,configurable:!0})}function K4(...$){let v={};for(let g of $){let _=Object.getOwnPropertyDescriptors(g);Object.assign(v,_)}return Object.defineProperties({},v)}function MX($){return K4($._zod.def)}function SX($,v){if(!v)return $;return v.reduce((g,_)=>g?.[_],$)}function NX($){let v=Object.keys($),g=v.map((_)=>$[_]);return Promise.all(g).then((_)=>{let U={};for(let z=0;z<v.length;z++)U[v[z]]=_[z];return U})}function yX($=10){let g="";for(let _=0;_<$;_++)g+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return g}function Q_($){return JSON.stringify($)}function az($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var w_="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function Kv($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var sz=ov(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function D4($){if(Kv($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let g=v.prototype;if(Kv(g)===!1)return!1;if(Object.prototype.hasOwnProperty.call(g,"isPrototypeOf")===!1)return!1;return!0}function ez($){if(D4($))return{...$};if(Array.isArray($))return[...$];return $}function RX($){let v=0;for(let g in $)if(Object.prototype.hasOwnProperty.call($,g))v++;return v}var DX=($)=>{let v=typeof $;switch(v){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${v}`)}},O1=new Set(["string","number","symbol"]),$J=new Set(["string","number","bigint","boolean","symbol","undefined"]);function u6($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P6($,v,g){let _=new $._zod.constr(v??$._zod.def);if(!v||g?.parent)_._zod.parent=$;return _}function f($){let v=$;if(!v)return{};if(typeof v==="string")return{error:()=>v};if(v?.message!==void 0){if(v?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");v.error=v.message}if(delete v.message,typeof v.error==="string")return{...v,error:()=>v.error};return v}function TX($){let v;return new Proxy({},{get(g,_,U){return v??(v=$()),Reflect.get(v,_,U)},set(g,_,U,z){return v??(v=$()),Reflect.set(v,_,U,z)},has(g,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(g,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(g){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(g,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(g,_,U){return v??(v=$()),Reflect.defineProperty(v,_,U)}})}function j($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function vJ($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var UJ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},gJ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function jX($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=K4($._zod.def,{get shape(){let J={};for(let G in v){if(!(G in g.shape))throw Error(`Unrecognized key: "${G}"`);if(!v[G])continue;J[G]=g.shape[G]}return R4(this,"shape",J),J},checks:[]});return P6($,z)}function uX($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=K4($._zod.def,{get shape(){let J={...$._zod.def.shape};for(let G in v){if(!(G in g.shape))throw Error(`Unrecognized key: "${G}"`);if(!v[G])continue;delete J[G]}return R4(this,"shape",J),J},checks:[]});return P6($,z)}function CX($,v){if(!D4(v))throw Error("Invalid input to extend: expected a plain object");let g=$._zod.def.checks;if(g&&g.length>0){let z=$._zod.def.shape;for(let J in v)if(Object.getOwnPropertyDescriptor(z,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let U=K4($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return R4(this,"shape",z),z}});return P6($,U)}function VX($,v){if(!D4(v))throw Error("Invalid input to safeExtend: expected a plain object");let g=K4($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return R4(this,"shape",_),_}});return P6($,g)}function fX($,v){let g=K4($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return R4(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return P6($,g)}function rX($,v,g){let U=v._zod.def.checks;if(U&&U.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=K4(v._zod.def,{get shape(){let G=v._zod.def.shape,b={...G};if(g)for(let O in g){if(!(O in G))throw Error(`Unrecognized key: "${O}"`);if(!g[O])continue;b[O]=$?new $({type:"optional",innerType:G[O]}):G[O]}else for(let O in G)b[O]=$?new $({type:"optional",innerType:G[O]}):G[O];return R4(this,"shape",b),b},checks:[]});return P6(v,J)}function EX($,v,g){let _=K4(v._zod.def,{get shape(){let U=v._zod.def.shape,z={...U};if(g)for(let J in g){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!g[J])continue;z[J]=new $({type:"nonoptional",innerType:U[J]})}else for(let J in U)z[J]=new $({type:"nonoptional",innerType:U[J]});return R4(this,"shape",z),z}});return P6(v,_)}function T4($,v=0){if($.aborted===!0)return!0;for(let g=v;g<$.issues.length;g++)if($.issues[g]?.continue!==!0)return!0;return!1}function N6($,v){return v.map((g)=>{var _;return(_=g).path??(_.path=[]),g.path.unshift($),g})}function G1($){return typeof $==="string"?$:$?.message}function Q6($,v,g){let _={...$,path:$.path??[]};if(!$.message){let U=G1($.inst?._zod.def?.error?.($))??G1(v?.error?.($))??G1(g.customError?.($))??G1(g.localeError?.($))??"Invalid input";_.message=U}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function W1($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function B1($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function C($){let v=typeof $;switch(v){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let g=$;if(g&&Object.getPrototypeOf(g)!==Object.prototype&&"constructor"in g&&g.constructor)return g.constructor.name}}return v}function nv(...$){let[v,g,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:g,inst:_};return{...v}}function mX($){return Object.entries($).filter(([v,g])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function ZO($){let v=atob($),g=new Uint8Array(v.length);for(let _=0;_<v.length;_++)g[_]=v.charCodeAt(_);return g}function IO($){let v="";for(let g=0;g<$.length;g++)v+=String.fromCharCode($[g]);return btoa(v)}function cX($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),g="=".repeat((4-v.length%4)%4);return ZO(v+g)}function iX($){return IO($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function xX($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let g=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)g[_/2]=Number.parseInt(v.slice(_,_+2),16);return g}function hX($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class QO{constructor(...$){}}var wO=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,pv,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},Y1=Z("$ZodError",wO),w6=Z("$ZodError",wO,{Parent:Error});function k1($,v=(g)=>g.message){let g={},_=[];for(let U of $.issues)if(U.path.length>0)g[U.path[0]]=g[U.path[0]]||[],g[U.path[0]].push(v(U));else _.push(v(U));return{formErrors:_,fieldErrors:g}}function q1($,v=(g)=>g.message){let g={_errors:[]},_=(U)=>{for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>_({issues:J}));else if(z.code==="invalid_key")_({issues:z.issues});else if(z.code==="invalid_element")_({issues:z.issues});else if(z.path.length===0)g._errors.push(v(z));else{let J=g,G=0;while(G<z.path.length){let b=z.path[G];if(G!==z.path.length-1)J[b]=J[b]||{_errors:[]};else J[b]=J[b]||{_errors:[]},J[b]._errors.push(v(z));J=J[b],G++}}};return _($),g}function _J($,v=(g)=>g.message){let g={errors:[]},_=(U,z=[])=>{var J,G;for(let b of U.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((O)=>_({issues:O},b.path));else if(b.code==="invalid_key")_({issues:b.issues},b.path);else if(b.code==="invalid_element")_({issues:b.issues},b.path);else{let O=[...z,...b.path];if(O.length===0){g.errors.push(v(b));continue}let W=g,B=0;while(B<O.length){let k=O[B],Y=B===O.length-1;if(typeof k==="string")W.properties??(W.properties={}),(J=W.properties)[k]??(J[k]={errors:[]}),W=W.properties[k];else W.items??(W.items=[]),(G=W.items)[k]??(G[k]={errors:[]}),W=W.items[k];if(Y)W.errors.push(v(b));B++}}};return _($),g}function AO($){let v=[],g=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of g)if(typeof _==="number")v.push(`[${_}]`);else if(typeof _==="symbol")v.push(`[${JSON.stringify(String(_))}]`);else if(/[^\w$]/.test(_))v.push(`[${JSON.stringify(_)}]`);else{if(v.length)v.push(".");v.push(_)}return v.join("")}function zJ($){let v=[],g=[...$.issues].sort((_,U)=>(_.path??[]).length-(U.path??[]).length);for(let _ of g)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${AO(_.path)}`);return v.join(`
113
- `)}var tv=($)=>(v,g,_,U)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)throw new t6;if(J.issues.length){let G=new(U?.Err??$)(J.issues.map((b)=>Q6(b,z,o$())));throw w_(G,U?.callee),G}return J.value},P1=tv(w6),dv=($)=>async(v,g,_,U)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let G=new(U?.Err??$)(J.issues.map((b)=>Q6(b,z,o$())));throw w_(G,U?.callee),G}return J.value},X1=dv(w6),av=($)=>(v,g,_)=>{let U=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)throw new t6;return z.issues.length?{success:!1,error:new($??Y1)(z.issues.map((J)=>Q6(J,U,o$())))}:{success:!0,data:z.value}},sv=av(w6),ev=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Q6(J,U,o$())))}:{success:!0,data:z.value}},H1=ev(w6),A_=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return tv($)(v,g,U)},MO=A_(w6),M_=($)=>(v,g,_)=>{return tv($)(v,g,_)},SO=M_(w6),S_=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return dv($)(v,g,U)},NO=S_(w6),N_=($)=>async(v,g,_)=>{return dv($)(v,g,_)},yO=N_(w6),y_=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return av($)(v,g,U)},RO=y_(w6),R_=($)=>(v,g,_)=>{return av($)(v,g,_)},DO=R_(w6),D_=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return ev($)(v,g,U)},TO=D_(w6),T_=($)=>async(v,g,_)=>{return ev($)(v,g,_)},jO=T_(w6);var C6={};$4(C6,{xid:()=>bJ,uuid7:()=>tX,uuid6:()=>nX,uuid4:()=>oX,uuid:()=>bv,uppercase:()=>jJ,unicodeEmail:()=>uO,undefined:()=>DJ,ulid:()=>KJ,time:()=>wJ,string:()=>MJ,sha512_hex:()=>PH,sha512_base64url:()=>HH,sha512_base64:()=>XH,sha384_hex:()=>YH,sha384_base64url:()=>qH,sha384_base64:()=>kH,sha256_hex:()=>OH,sha256_base64url:()=>BH,sha256_base64:()=>WH,sha1_hex:()=>GH,sha1_base64url:()=>bH,sha1_base64:()=>KH,rfc5322Email:()=>aX,number:()=>L1,null:()=>RJ,nanoid:()=>WJ,md5_hex:()=>_H,md5_base64url:()=>JH,md5_base64:()=>zH,mac:()=>HJ,lowercase:()=>TJ,ksuid:()=>OJ,ipv6:()=>XJ,ipv4:()=>PJ,integer:()=>NJ,idnEmail:()=>sX,html5Email:()=>dX,hostname:()=>vH,hex:()=>gH,guid:()=>YJ,extendedDuration:()=>pX,emoji:()=>qJ,email:()=>kJ,e164:()=>IJ,duration:()=>BJ,domain:()=>UH,datetime:()=>AJ,date:()=>QJ,cuid2:()=>GJ,cuid:()=>JJ,cidrv6:()=>FJ,cidrv4:()=>LJ,browserEmail:()=>eX,boolean:()=>yJ,bigint:()=>SJ,base64url:()=>j_,base64:()=>ZJ});var JJ=/^[cC][^\s-]{8,}$/,GJ=/^[0-9a-z]+$/,KJ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bJ=/^[0-9a-vA-V]{20}$/,OJ=/^[A-Za-z0-9]{27}$/,WJ=/^[a-zA-Z0-9_-]{21}$/,BJ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,YJ=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bv=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},oX=bv(4),nX=bv(6),tX=bv(7),kJ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,dX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,aX=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,uO=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,sX=uO,eX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$H="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function qJ(){return new RegExp($H,"u")}var PJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,XJ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,HJ=($)=>{let v=u6($??":");return new RegExp(`^(?:[0-9A-F]{2}${v}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${v}){5}[0-9a-f]{2}$`)},LJ=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,FJ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ZJ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,j_=/^[A-Za-z0-9_-]*$/,vH=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,UH=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,IJ=/^\+[1-9]\d{6,14}$/,CO="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",QJ=new RegExp(`^${CO}$`);function VO($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function wJ($){return new RegExp(`^${VO($)}$`)}function AJ($){let v=VO({precision:$.precision}),g=["Z"];if($.local)g.push("");if($.offset)g.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${g.join("|")})`;return new RegExp(`^${CO}T(?:${_})$`)}var MJ=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},SJ=/^-?\d+n?$/,NJ=/^-?\d+$/,L1=/^-?\d+(?:\.\d+)?$/,yJ=/^(?:true|false)$/i,RJ=/^null$/i;var DJ=/^undefined$/i;var TJ=/^[^A-Z]*$/,jJ=/^[^a-z]*$/,gH=/^[0-9a-fA-F]*$/;function F1($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function Z1($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var _H=/^[0-9a-fA-F]{32}$/,zH=F1(22,"=="),JH=Z1(22),GH=/^[0-9a-fA-F]{40}$/,KH=F1(27,"="),bH=Z1(27),OH=/^[0-9a-fA-F]{64}$/,WH=F1(43,"="),BH=Z1(43),YH=/^[0-9a-fA-F]{96}$/,kH=F1(64,""),qH=Z1(64),PH=/^[0-9a-fA-F]{128}$/,XH=F1(86,"=="),HH=Z1(86);var T$=Z("$ZodCheck",($,v)=>{var g;$._zod??($._zod={}),$._zod.def=v,(g=$._zod).onattach??(g.onattach=[])}),rO={number:"number",bigint:"bigint",object:"date"},u_=Z("$ZodCheckLessThan",($,v)=>{T$.init($,v);let g=rO[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)U.maximum=v.value;else U.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:g,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),C_=Z("$ZodCheckGreaterThan",($,v)=>{T$.init($,v);let g=rO[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)U.minimum=v.value;else U.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:g,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),uJ=Z("$ZodCheckMultipleOf",($,v)=>{T$.init($,v),$._zod.onattach.push((g)=>{var _;(_=g._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(g)=>{if(typeof g.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof g.value==="bigint"?g.value%v.value===BigInt(0):dz(g.value,v.value)===0)return;g.issues.push({origin:typeof g.value,code:"not_multiple_of",divisor:v.value,input:g.value,inst:$,continue:!v.abort})}}),CJ=Z("$ZodCheckNumberFormat",($,v)=>{T$.init($,v),v.format=v.format||"float64";let g=v.format?.includes("int"),_=g?"int":"number",[U,z]=UJ[v.format];$._zod.onattach.push((J)=>{let G=J._zod.bag;if(G.format=v.format,G.minimum=U,G.maximum=z,g)G.pattern=NJ}),$._zod.check=(J)=>{let G=J.value;if(g){if(!Number.isInteger(G)){J.issues.push({expected:_,format:v.format,code:"invalid_type",continue:!1,input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)J.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});else J.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});return}}if(G<U)J.issues.push({origin:"number",input:G,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(G>z)J.issues.push({origin:"number",input:G,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!v.abort})}}),VJ=Z("$ZodCheckBigIntFormat",($,v)=>{T$.init($,v);let[g,_]=gJ[v.format];$._zod.onattach.push((U)=>{let z=U._zod.bag;z.format=v.format,z.minimum=g,z.maximum=_}),$._zod.check=(U)=>{let z=U.value;if(z<g)U.issues.push({origin:"bigint",input:z,code:"too_small",minimum:g,inclusive:!0,inst:$,continue:!v.abort});if(z>_)U.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),fJ=Z("$ZodCheckMaxSize",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.size<=v.maximum)return;_.issues.push({origin:W1(U),code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),rJ=Z("$ZodCheckMinSize",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.size>=v.minimum)return;_.issues.push({origin:W1(U),code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),EJ=Z("$ZodCheckSizeEquals",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.size,U.maximum=v.size,U.size=v.size}),$._zod.check=(_)=>{let U=_.value,z=U.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:W1(U),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),mJ=Z("$ZodCheckMaxLength",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.length<=v.maximum)return;let J=B1(U);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),cJ=Z("$ZodCheckMinLength",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.length>=v.minimum)return;let J=B1(U);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),iJ=Z("$ZodCheckLengthEquals",($,v)=>{var g;T$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y4(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.length,U.maximum=v.length,U.length=v.length}),$._zod.check=(_)=>{let U=_.value,z=U.length;if(z===v.length)return;let J=B1(U),G=z>v.length;_.issues.push({origin:J,...G?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),$U=Z("$ZodCheckStringFormat",($,v)=>{var g,_;if(T$.init($,v),$._zod.onattach.push((U)=>{let z=U._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(g=$._zod).check??(g.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:v.format,input:U.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),xJ=Z("$ZodCheckRegex",($,v)=>{$U.init($,v),$._zod.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:"regex",input:g.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),hJ=Z("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=TJ),$U.init($,v)}),lJ=Z("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=jJ),$U.init($,v)}),pJ=Z("$ZodCheckIncludes",($,v)=>{T$.init($,v);let g=u6(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${g}`:g);v.pattern=_,$._zod.onattach.push((U)=>{let z=U._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(U)=>{if(U.value.includes(v.includes,v.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:U.value,inst:$,continue:!v.abort})}}),oJ=Z("$ZodCheckStartsWith",($,v)=>{T$.init($,v);let g=new RegExp(`^${u6(v.prefix)}.*`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.startsWith(v.prefix))return;_.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:v.prefix,input:_.value,inst:$,continue:!v.abort})}}),nJ=Z("$ZodCheckEndsWith",($,v)=>{T$.init($,v);let g=new RegExp(`.*${u6(v.suffix)}$`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.endsWith(v.suffix))return;_.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:v.suffix,input:_.value,inst:$,continue:!v.abort})}});function fO($,v,g){if($.issues.length)v.issues.push(...N6(g,$.issues))}var tJ=Z("$ZodCheckProperty",($,v)=>{T$.init($,v),$._zod.check=(g)=>{let _=v.schema._zod.run({value:g.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((U)=>fO(U,g,v.property));fO(_,g,v.property);return}}),dJ=Z("$ZodCheckMimeType",($,v)=>{T$.init($,v);let g=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(g.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),aJ=Z("$ZodCheckOverwrite",($,v)=>{T$.init($,v),$._zod.check=(g)=>{g.value=v.tx(g.value)}});class V_{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let g=$.split(`
114
- `).filter((z)=>z),_=Math.min(...g.map((z)=>z.length-z.trimStart().length)),U=g.map((z)=>z.slice(_)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of U)this.content.push(z)}compile(){let $=Function,v=this?.args,_=[...(this?.content??[""]).map((U)=>` ${U}`)];return new $(...v,_.join(`
115
- `))}}var sJ={major:4,minor:3,patch:6};var z$=Z("$ZodType",($,v)=>{var g;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=sJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let U of _)for(let z of U._zod.onattach)z($);if(_.length===0)(g=$._zod).deferred??(g.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,G,b)=>{let O=T4(J),W;for(let B of G){if(B._zod.def.when){if(!B._zod.def.when(J))continue}else if(O)continue;let k=J.issues.length,Y=B._zod.check(J);if(Y instanceof Promise&&b?.async===!1)throw new t6;if(W||Y instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Y,J.issues.length===k)return;if(!O)O=T4(J,k)});else{if(J.issues.length===k)continue;if(!O)O=T4(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,G,b)=>{if(T4(J))return J.aborted=!0,J;let O=U(G,_,b);if(O instanceof Promise){if(b.async===!1)throw new t6;return O.then((W)=>$._zod.parse(W,b))}return $._zod.parse(O,b)};$._zod.run=(J,G)=>{if(G.skipChecks)return $._zod.parse(J,G);if(G.direction==="backward"){let O=$._zod.parse({value:J.value,issues:[]},{...G,skipChecks:!0});if(O instanceof Promise)return O.then((W)=>{return z(W,J,G)});return z(O,J,G)}let b=$._zod.parse(J,G);if(b instanceof Promise){if(G.async===!1)throw new t6;return b.then((O)=>U(O,_,G))}return U(b,_,G)}}Y$($,"~standard",()=>({validate:(U)=>{try{let z=sv($,U);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return H1($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),Ov=Z("$ZodString",($,v)=>{z$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??MJ($._zod.bag),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=String(g.value)}catch(U){}if(typeof g.value==="string")return g;return g.issues.push({expected:"string",code:"invalid_type",input:g.value,inst:$}),g}}),N$=Z("$ZodStringFormat",($,v)=>{$U.init($,v),Ov.init($,v)}),$8=Z("$ZodGUID",($,v)=>{v.pattern??(v.pattern=YJ),N$.init($,v)}),v8=Z("$ZodUUID",($,v)=>{if(v.version){let _={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(_===void 0)throw Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=bv(_))}else v.pattern??(v.pattern=bv());N$.init($,v)}),U8=Z("$ZodEmail",($,v)=>{v.pattern??(v.pattern=kJ),N$.init($,v)}),g8=Z("$ZodURL",($,v)=>{N$.init($,v),$._zod.check=(g)=>{try{let _=g.value.trim(),U=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(U.hostname))g.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:g.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))g.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:g.value,inst:$,continue:!v.abort})}if(v.normalize)g.value=U.href;else g.value=_;return}catch(_){g.issues.push({code:"invalid_format",format:"url",input:g.value,inst:$,continue:!v.abort})}}}),_8=Z("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=qJ()),N$.init($,v)}),z8=Z("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=WJ),N$.init($,v)}),J8=Z("$ZodCUID",($,v)=>{v.pattern??(v.pattern=JJ),N$.init($,v)}),G8=Z("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=GJ),N$.init($,v)}),K8=Z("$ZodULID",($,v)=>{v.pattern??(v.pattern=KJ),N$.init($,v)}),b8=Z("$ZodXID",($,v)=>{v.pattern??(v.pattern=bJ),N$.init($,v)}),O8=Z("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=OJ),N$.init($,v)}),W8=Z("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=AJ(v)),N$.init($,v)}),B8=Z("$ZodISODate",($,v)=>{v.pattern??(v.pattern=QJ),N$.init($,v)}),Y8=Z("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=wJ(v)),N$.init($,v)}),k8=Z("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=BJ),N$.init($,v)}),q8=Z("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=PJ),N$.init($,v),$._zod.bag.format="ipv4"}),P8=Z("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=XJ),N$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(g)=>{try{new URL(`http://[${g.value}]`)}catch{g.issues.push({code:"invalid_format",format:"ipv6",input:g.value,inst:$,continue:!v.abort})}}}),X8=Z("$ZodMAC",($,v)=>{v.pattern??(v.pattern=HJ(v.delimiter)),N$.init($,v),$._zod.bag.format="mac"}),H8=Z("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=LJ),N$.init($,v)}),L8=Z("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=FJ),N$.init($,v),$._zod.check=(g)=>{let _=g.value.split("/");try{if(_.length!==2)throw Error();let[U,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{g.issues.push({code:"invalid_format",format:"cidrv6",input:g.value,inst:$,continue:!v.abort})}}});function F8($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var Z8=Z("$ZodBase64",($,v)=>{v.pattern??(v.pattern=ZJ),N$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(g)=>{if(F8(g.value))return;g.issues.push({code:"invalid_format",format:"base64",input:g.value,inst:$,continue:!v.abort})}});function aO($){if(!j_.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),g=v.padEnd(Math.ceil(v.length/4)*4,"=");return F8(g)}var I8=Z("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=j_),N$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(g)=>{if(aO(g.value))return;g.issues.push({code:"invalid_format",format:"base64url",input:g.value,inst:$,continue:!v.abort})}}),Q8=Z("$ZodE164",($,v)=>{v.pattern??(v.pattern=IJ),N$.init($,v)});function sO($,v=null){try{let g=$.split(".");if(g.length!==3)return!1;let[_]=g;if(!_)return!1;let U=JSON.parse(atob(_));if("typ"in U&&U?.typ!=="JWT")return!1;if(!U.alg)return!1;if(v&&(!("alg"in U)||U.alg!==v))return!1;return!0}catch{return!1}}var w8=Z("$ZodJWT",($,v)=>{N$.init($,v),$._zod.check=(g)=>{if(sO(g.value,v.alg))return;g.issues.push({code:"invalid_format",format:"jwt",input:g.value,inst:$,continue:!v.abort})}}),A8=Z("$ZodCustomStringFormat",($,v)=>{N$.init($,v),$._zod.check=(g)=>{if(v.fn(g.value))return;g.issues.push({code:"invalid_format",format:v.format,input:g.value,inst:$,continue:!v.abort})}}),i_=Z("$ZodNumber",($,v)=>{z$.init($,v),$._zod.pattern=$._zod.bag.pattern??L1,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Number(g.value)}catch(J){}let U=g.value;if(typeof U==="number"&&!Number.isNaN(U)&&Number.isFinite(U))return g;let z=typeof U==="number"?Number.isNaN(U)?"NaN":!Number.isFinite(U)?"Infinity":void 0:void 0;return g.issues.push({expected:"number",code:"invalid_type",input:U,inst:$,...z?{received:z}:{}}),g}}),M8=Z("$ZodNumberFormat",($,v)=>{CJ.init($,v),i_.init($,v)}),I1=Z("$ZodBoolean",($,v)=>{z$.init($,v),$._zod.pattern=yJ,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Boolean(g.value)}catch(z){}let U=g.value;if(typeof U==="boolean")return g;return g.issues.push({expected:"boolean",code:"invalid_type",input:U,inst:$}),g}}),x_=Z("$ZodBigInt",($,v)=>{z$.init($,v),$._zod.pattern=SJ,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=BigInt(g.value)}catch(U){}if(typeof g.value==="bigint")return g;return g.issues.push({expected:"bigint",code:"invalid_type",input:g.value,inst:$}),g}}),S8=Z("$ZodBigIntFormat",($,v)=>{VJ.init($,v),x_.init($,v)}),N8=Z("$ZodSymbol",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U==="symbol")return g;return g.issues.push({expected:"symbol",code:"invalid_type",input:U,inst:$}),g}}),y8=Z("$ZodUndefined",($,v)=>{z$.init($,v),$._zod.pattern=DJ,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"undefined",code:"invalid_type",input:U,inst:$}),g}}),R8=Z("$ZodNull",($,v)=>{z$.init($,v),$._zod.pattern=RJ,$._zod.values=new Set([null]),$._zod.parse=(g,_)=>{let U=g.value;if(U===null)return g;return g.issues.push({expected:"null",code:"invalid_type",input:U,inst:$}),g}}),D8=Z("$ZodAny",($,v)=>{z$.init($,v),$._zod.parse=(g)=>g}),T8=Z("$ZodUnknown",($,v)=>{z$.init($,v),$._zod.parse=(g)=>g}),j8=Z("$ZodNever",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{return g.issues.push({expected:"never",code:"invalid_type",input:g.value,inst:$}),g}}),u8=Z("$ZodVoid",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"void",code:"invalid_type",input:U,inst:$}),g}}),C8=Z("$ZodDate",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=new Date(g.value)}catch(G){}let U=g.value,z=U instanceof Date;if(z&&!Number.isNaN(U.getTime()))return g;return g.issues.push({expected:"date",code:"invalid_type",input:U,...z?{received:"Invalid Date"}:{},inst:$}),g}});function mO($,v,g){if($.issues.length)v.issues.push(...N6(g,$.issues));v.value[g]=$.value}var V8=Z("$ZodArray",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!Array.isArray(U))return g.issues.push({expected:"array",code:"invalid_type",input:U,inst:$}),g;g.value=Array(U.length);let z=[];for(let J=0;J<U.length;J++){let G=U[J],b=v.element._zod.run({value:G,issues:[]},_);if(b instanceof Promise)z.push(b.then((O)=>mO(O,g,J)));else mO(b,g,J)}if(z.length)return Promise.all(z).then(()=>g);return g}});function c_($,v,g,_,U){if($.issues.length){if(U&&!(g in _))return;v.issues.push(...N6(g,$.issues))}if($.value===void 0){if(g in _)v.value[g]=void 0}else v.value[g]=$.value}function eO($){let v=Object.keys($.shape);for(let _ of v)if(!$.shape?.[_]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${_}": expected a Zod schema`);let g=vJ($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(g)}}function $W($,v,g,_,U,z){let J=[],G=U.keySet,b=U.catchall._zod,O=b.def.type,W=b.optout==="optional";for(let B in v){if(G.has(B))continue;if(O==="never"){J.push(B);continue}let k=b.run({value:v[B],issues:[]},_);if(k instanceof Promise)$.push(k.then((Y)=>c_(Y,g,B,v,W)));else c_(k,g,B,v,W)}if(J.length)g.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return g;return Promise.all($).then(()=>{return g})}var vW=Z("$ZodObject",($,v)=>{if(z$.init($,v),!Object.getOwnPropertyDescriptor(v,"shape")?.get){let G=v.shape;Object.defineProperty(v,"shape",{get:()=>{let b={...G};return Object.defineProperty(v,"shape",{value:b}),b}})}let _=ov(()=>eO(v));Y$($._zod,"propValues",()=>{let G=v.shape,b={};for(let O in G){let W=G[O]._zod;if(W.values){b[O]??(b[O]=new Set);for(let B of W.values)b[O].add(B)}}return b});let U=Kv,z=v.catchall,J;$._zod.parse=(G,b)=>{J??(J=_.value);let O=G.value;if(!U(O))return G.issues.push({expected:"object",code:"invalid_type",input:O,inst:$}),G;G.value={};let W=[],B=J.shape;for(let k of J.keys){let Y=B[k],F=Y._zod.optout==="optional",X=Y._zod.run({value:O[k],issues:[]},b);if(X instanceof Promise)W.push(X.then((H)=>c_(H,G,k,O,F)));else c_(X,G,k,O,F)}if(!z)return W.length?Promise.all(W).then(()=>G):G;return $W(W,O,G,b,_.value,$)}}),f8=Z("$ZodObjectJIT",($,v)=>{vW.init($,v);let g=$._zod.parse,_=ov(()=>eO(v)),U=(k)=>{let Y=new V_(["shape","payload","ctx"]),F=_.value,X=(I)=>{let N=Q_(I);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};Y.write("const input = payload.value;");let H=Object.create(null),q=0;for(let I of F.keys)H[I]=`key_${q++}`;Y.write("const newResult = {};");for(let I of F.keys){let N=H[I],T=Q_(I),S=k[I]?._zod?.optout==="optional";if(Y.write(`const ${N} = ${X(I)};`),S)Y.write(`
116
- if (${N}.issues.length) {
117
- if (${T} in input) {
118
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
112
+ `.substring(0,_);return v+z+J}function xP($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function qv(){let $=window.getSelection(),U=$&&$.rangeCount>0?$.getRangeAt(0).cloneRange():null;g4("Link URL","https://example.com").then((v)=>{if(!v)return;let J=v.trim().toLowerCase();if(J.startsWith("javascript:")||J.startsWith("data:"))return;if(U){let _=window.getSelection();_?.removeAllRanges(),_?.addRange(U)}document.execCommand("createLink",!1,v)})}function aZ(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let U=$.getRangeAt(0);if(U.collapsed)return;let v=U.toString(),J=document.createElement("code");J.textContent=v,U.deleteContents(),U.insertNode(J);let _=document.createRange();_.setStartAfter(J),_.setEndAfter(J),$.removeAllRanges(),$.addRange(_)}var Bv=8,hP=[{kind:"exec",command:"bold",icon:"B",title:`Bold (${d$("B")})`},{kind:"exec",command:"italic",icon:"I",title:`Italic (${d$("I")})`},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:`Link (${d$("K")})`,dividerBefore:!0}];function cP($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":aZ();return;case"link":qv();return}}function sZ({hostRef:$,onChange:U}){let[v,J]=f(!1),[_,z]=f({top:0,left:0}),[K,W]=f(0),O=C(null),Y=C(null),Z=j(()=>{let B=$.current;if(!B){J(!1);return}let L=window.getSelection();if(!L||L.rangeCount===0||L.isCollapsed){J(!1);return}let P=L.getRangeAt(0);if(!B.contains(P.commonAncestorContainer)){J(!1);return}let k=P.getBoundingClientRect();if(k.width===0&&k.height===0){J(!1);return}let H=K||420,F=Math.max(Bv,Math.min(k.left+k.width/2-H/2,window.innerWidth-H-Bv)),b=Math.max(Bv,k.top-Bv-36);z({top:b,left:F}),J(!0)},[$,K]),q=j(()=>{if(Y.current!==null)return;Y.current=requestAnimationFrame(()=>{Y.current=null,Z()})},[Z]);u(()=>{return document.addEventListener("selectionchange",q),window.addEventListener("scroll",q,!0),window.addEventListener("resize",q),()=>{if(document.removeEventListener("selectionchange",q),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q),Y.current!==null)cancelAnimationFrame(Y.current)}},[q]),w2(()=>{if(!v)return;let B=O.current;if(!B)return;let L=B.getBoundingClientRect().width;if(L&&Math.abs(L-K)>1)W(L)},[v,K]);let X=j((B)=>{cP(B),U(),Z()},[U,Z]);if(!v)return null;return G("div",{ref:O,class:"md-inline-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(B)=>B.preventDefault(),children:hP.flatMap((B,L)=>{let P=G("button",{type:"button",class:"md-inline-format-btn",title:B.title,onClick:()=>X(B),children:B.icon},`btn-${L}`,!1,void 0,this);return B.dividerBefore?[G("span",{class:"md-inline-format-divider"},`div-${L}`,!1,void 0,this),P]:[P]})},void 0,!1,void 0,this)}var K5=null;function lP(){if(K5)return K5;let $=new a0({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(eZ.gfm),K5=$,$}function $q({initialHtml:$,className:U,onChange:v,onSave:J}){let _=C(null),z=C($);u(()=>{let X=_.current;if(!X)return;X.innerHTML=z.current;for(let B of X.querySelectorAll('input[type="checkbox"][disabled]'))B.removeAttribute("disabled")},[]);let K=j(()=>{let X=_.current;if(!X)return"";return lP().turndown(X.innerHTML)},[]),W=j(()=>{v(K())},[v,K]),O=j(()=>{let X=_.current;if(!X||!X.isConnected||X.innerHTML==="")return;J?.(K())},[J,K]),Y=j((X)=>{if(!(X.metaKey||X.ctrlKey))return;if(X.key==="s"){X.preventDefault(),O();return}if(X.key==="b"){X.preventDefault(),document.execCommand("bold"),W();return}if(X.key==="i"){X.preventDefault(),document.execCommand("italic"),W();return}if(X.key==="k")X.preventDefault(),qv(),W()},[W,O]),Z=j((X)=>{let B=X.target;if(B instanceof HTMLInputElement&&B.type==="checkbox")B.toggleAttribute("checked",B.checked),W()},[W]),q=j((X)=>{let B=X.clipboardData?.getData("text/plain");if(B==null)return;X.preventDefault(),document.execCommand("insertText",!1,B),W()},[W]);return G(M$,{children:[G("div",{ref:_,class:U,contentEditable:!0,spellcheck:!1,onInput:W,onKeyDown:Y,onPaste:q,onClick:Z,onBlur:O},void 0,!1,void 0,this),G(sZ,{hostRef:_,onChange:W},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function G5({html:$,className:U,style:v,onTaskToggle:J}){let _=C(null),z=C(J);return z.current=J,u(()=>{let W=_.current;if(!W)return;if(W.replaceChildren(),!$)return;let O=document.createElement("template");if(O.innerHTML=$,W.append(O.content.cloneNode(!0)),z.current)for(let Y of W.querySelectorAll('input[type="checkbox"][disabled]'))Y.removeAttribute("disabled")},[$]),G("div",{ref:_,class:U,style:v,onClick:J?(W)=>{let O=z.current,Y=_.current;if(!Y||!O)return;let Z=W.target,q=null;if(Z instanceof HTMLInputElement&&Z.type==="checkbox")q=Z;else{let L=Z.closest("li")?.querySelector(':scope > input[type="checkbox"]');if(L&&W.clientX<=L.getBoundingClientRect().right+6)q=L}if(!q)return;W.stopPropagation();let X=[...Y.querySelectorAll('input[type="checkbox"]')].indexOf(q);if(X>=0)O(X)}:void 0},void 0,!1,void 0,this)}function rP($,U){let v=-1;return $.replace(/^(\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])(\])/gm,(J,_,z,K)=>{if(v+=1,v!==U)return J;return`${_}${z===" "?"x":" "}${K}`})}function Xv({node:$,expanded:U=!1}){let v=$.data.path,[J,_]=f(""),[z,K]=f(""),[W,O]=f(!1),[Y,Z]=f(!1),[q,X]=f(!1),[B,L]=f(!1),P=C(null),k=C(null),H=C(""),F=C(null),b=$.data.reviewActive;u(()=>{let l=!1;return(async()=>{let T;if(v){let t=await h0(v);if(l)return;T=t.content}else if($.data.content)T=$.data.content;else{O(!0);return}_(T);let r=await N4(T);if(l)return;K(r),O(!0),W$($.id,{content:T,rendered:r})})(),()=>{l=!0}},[v,$.id,$.data.content]);let V=j(async(l)=>{let T=l.target.value;_(T),L(!0);let r=await N4(T);K(r)},[]),E=j(async(l)=>{if(!v){let r=await N4(l);K(r),L(!1),W$($.id,{content:l,rendered:r}),await b6($.id,{content:l,data:{rendered:r}});return}X(!0);let T=await LY(v,l);if(X(!1),T.ok){let r=await N4(l);K(r),L(!1),W$($.id,{content:l,rendered:r,savedAt:T.updatedAt}),await b6($.id,{content:l,data:{rendered:r,savedAt:T.updatedAt}})}},[v,$.id]),A=j(async()=>{if(!B)return;await E(J)},[B,J,E]),I=j((l)=>{if((l.metaKey||l.ctrlKey)&&l.key==="s"){l.preventDefault(),A();return}let T=P.current;if(T&&kZ(l,T))return;if(T&&l.key==="Tab")l.preventDefault(),PZ(T,l.shiftKey)},[A]);F.current=E;let N=j((l)=>{if(_(l),L(!0),H.current=l,k.current!==null)window.clearTimeout(k.current);k.current=window.setTimeout(()=>{k.current=null,E(l)},800)},[E]),R=j((l)=>{if(_(l),H.current=l,k.current!==null)window.clearTimeout(k.current),k.current=null;E(l)},[E]);u(()=>{return()=>{if(k.current===null)return;window.clearTimeout(k.current),k.current=null;let l=F.current;if(l)l(H.current)}},[$.id]);let p=b?G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(Y&&U)return G("div",{class:"md-editor-expanded",onKeyDown:I,children:[G("div",{class:"md-editor-toolbar",children:[G("button",{type:"button",class:"md-toolbar-btn",onClick:()=>Z(!1),children:"← Back to document"},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[v&&G("span",{class:"md-toolbar-path",children:v.split("/").pop()},void 0,!1,void 0,this),G("button",{type:"button",class:`md-toolbar-btn${B?" md-toolbar-btn-primary":""}`,onClick:A,disabled:!B||q,children:q?"Saving…":B?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"md-editor-split",children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:P,value:J,onInput:V,spellcheck:!1},void 0,!1,void 0,this),G(o8,{textareaRef:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(G5,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(Y)return G("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:I,children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:P,value:J,onInput:V,spellcheck:!1},void 0,!1,void 0,this),G(o8,{textareaRef:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(G5,{html:z,className:"md-preview"},void 0,!1,void 0,this),G("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[G("button",{type:"button",onClick:()=>Z(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),G("button",{type:"button",onClick:A,disabled:!B||q,style:{padding:"4px 10px",fontSize:"11px",background:B?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${B?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:B?"var(--c-text)":"var(--c-dim)",cursor:B?"pointer":"default"},children:q?"Saving…":B?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(U)return G("div",{style:{height:"100%",position:"relative"},children:[p,G("div",{class:"md-reader",children:W?G($q,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:N,onSave:R},$.id,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"md-edit-fab",onClick:()=>Z(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",position:"relative"},children:[p,G(G5,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"},onTaskToggle:(l)=>{let T=rP(J,l);if(T!==J)R(T)}},void 0,!1,void 0,this),!W&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),W&&!z&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),G("button",{type:"button",class:"md-edit-btn",onClick:()=>X4($.id),children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Hv="pmx-canvas-ax",Qv="pmx-canvas-ax-ack",n6="pmx-canvas-html-node",Lv="pmx-canvas-ext-app-alive",W5="pmx-canvas-ext-app-paint-probe";function Uq($,U){switch($){case"html":return typeof U.html==="string"&&U.html.length>0||typeof U.content==="string"&&U.content.length>0;case"mermaid":return typeof U.content==="string"&&U.content.trim().length>0;case"json-render":case"graph":return!0;case"mcp-app":return U.viewerType==="web-artifact"&&typeof U.path==="string"&&U.path.length>0||typeof U.url==="string"&&U.url.length>0;case"webpage":return typeof U.url==="string"&&U.url.length>0;default:return!1}}var O5="allow-scripts allow-popups allow-popups-to-escape-sandbox";function SU($){let U=5381;for(let v=0;v<$.length;v+=1)U=(U<<5)+U+$.charCodeAt(v)|0;return(U>>>0).toString(36)}function s0($,U={}){let v=new URLSearchParams;if(v.set("theme",U.theme??$6.value),U.themeToken)v.set("themeToken",U.themeToken);if(U.present)v.set("present","1");if(U.presentToken)v.set("presentToken",U.presentToken);if(U.v)v.set("v",U.v);if(U.axToken)v.set("axToken",U.axToken);if(U.frameToken)v.set("frameToken",U.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${v.toString()}`}function Fv($){return Uq($.type,$.data)}async function Pv($){let U=s0($.id);if(!(await MY($.id,U)).opened)window.open(U,"_blank","noopener")}var iP={markdown:{width:360,height:180},context:{width:360,height:180},file:{width:360,height:200},diff:{width:420,height:240},mermaid:{width:360,height:240},status:{width:280,height:120},ledger:{width:320,height:200},image:{width:240,height:180},html:{width:420,height:280},webpage:{width:420,height:280},"json-render":{width:420,height:280},graph:{width:420,height:280},"mcp-app":{width:480,height:320}};function _q($){return iP[$]}var RU=37,pP=600,oP=1400,dP=24;function nP($){return $.type==="html"||$.type==="mermaid"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function tP($){if($.type==="html")return $.data.presentation!==!0;if($.type==="mermaid")return!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function vq($){return $.collapsed===!0||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function Y5($){return!vq($)&&!nP($)}function Jq($,U){if(!Y5($)||U<=0)return null;let v=Math.min(U+RU,pP),J=_q($.type);return J?Math.max(v,J.height):v}function Z5($){return tP($)&&!vq($)}function zq($,U){if(!Z5($)||U<=0)return null;let v=Math.min(U+RU+dP,oP);return v>$.size.height+8?v:null}function TU($,U,v){let J=C($);J.current=$;let _=C(null);u(()=>{if(!v)return;function z(K){if(K.source!==U.current?.contentWindow)return;let W=K.data;if(!W||W.source!=="pmx-canvas-frame"||W.type!=="content-height"||W.token!==v)return;let O=J.current,Y=typeof W.height==="number"?W.height:0,Z=zq(O,Y);if(Z===null)return;if(AU(O.id,{width:O.size.width,height:Z}),_.current!==null)window.clearTimeout(_.current);_.current=window.setTimeout(()=>{v6({recordHistory:!1}),_.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),_.current!==null)window.clearTimeout(_.current),_.current=null}},[$.id,v])}function aP($){try{return new URL($,window.location.origin).origin===window.location.origin}catch{return!1}}function yU($){let U=A6.value,[v,J]=f(null),_=Boolean($)&&aP($),z=U==="srcdoc"&&_;if(u(()=>{if(!z)return;let K=!1;return fetch(`${$}${$.includes("?")?"&":"?"}inline-assets=1`,{credentials:"same-origin"}).then((W)=>W.ok?W.text():Promise.reject(Error(`HTTP ${W.status}`))).then((W)=>{if(!K)J({url:$,html:W})}).catch((W)=>{if(console.error("[surface-frame] srcdoc fetch failed, falling back to src:",$,W),!K)J({url:$,html:""})}),()=>{K=!0}},[z,$]),!$)return{};if(!z)return U===null&&_?{}:{src:$};if(v)return v.html?{srcdoc:v.html}:{src:v.url};return{}}function kv({node:$,expanded:U=!1}){let v=C(null),J=$6.value,_=u$(()=>`theme-${crypto.randomUUID()}`,[]),z=u$(()=>`frame-${crypto.randomUUID()}`,[]),K=typeof $.data.content==="string"?$.data.content:"",W=u$(()=>SU(K),[K]),O=u$(()=>K?s0($.id,{theme:J,themeToken:_,v:W,frameToken:z}):"",[K,_,W,$.id,z]),Y=yU(O);TU($,v,U?"":z);let Z=()=>{v.current?.contentWindow?.postMessage({source:n6,type:"theme-update",token:_,theme:J},"*")};if(u(Z,[J,_]),!K)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No diagram source set"},void 0,!1,void 0,this);return G("iframe",{ref:v,class:"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"Mermaid diagram",sandbox:"allow-scripts",...Y,onLoad:Z,style:{width:"100%",height:"100%",minHeight:U?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:"6px",display:"block"}},void 0,!1,void 0,this)}var q5=["dark","light","high-contrast","midnight","sepia","arctic","ember","forest","volt"];function e0($){return typeof $==="string"&&q5.includes($)}function B5($,U="dark"){return e0($)?$:U}var CU={dark:{label:"Dark",scheme:"dark",swatchBg:"#081524",swatchAccent:"#4BBCFF"},light:{label:"Light",scheme:"light",swatchBg:"#F4EFE6",swatchAccent:"#1A7ABF"},"high-contrast":{label:"High contrast",scheme:"dark",swatchBg:"#000000",swatchAccent:"#00ffff"},midnight:{label:"Midnight",scheme:"dark",swatchBg:"#0A0D1C",swatchAccent:"#8B96FF"},sepia:{label:"Sepia",scheme:"light",swatchBg:"#F2E7D5",swatchAccent:"#B4632C"},arctic:{label:"Arctic",scheme:"dark",swatchBg:"#20242E",swatchAccent:"#7FC8DE"},ember:{label:"Ember",scheme:"dark",swatchBg:"#0B0B0C",swatchAccent:"#F34E1C"},forest:{label:"Forest",scheme:"dark",swatchBg:"#0C1712",swatchAccent:"#5CCF8F"},volt:{label:"Volt",scheme:"dark",swatchBg:"#0B0D0B",swatchAccent:"#DFDFC1"}};function DU($){return CU[B5($)].scheme}var Q={};A4(Q,{xor:()=>uB,xid:()=>OB,void:()=>jB,uuidv7:()=>UB,uuidv6:()=>$B,uuidv4:()=>eq,uuid:()=>sq,util:()=>h,url:()=>_B,uppercase:()=>pU,unknown:()=>E$,union:()=>D$,undefined:()=>CB,ulid:()=>WB,uint64:()=>TB,uint32:()=>NB,tuple:()=>IG,trim:()=>sU,treeifyError:()=>w5,transform:()=>iJ,toUpperCase:()=>$0,toLowerCase:()=>eU,toJSONSchema:()=>PJ,templateLiteral:()=>nB,symbol:()=>yB,superRefine:()=>tG,success:()=>pB,stringbool:()=>_X,stringFormat:()=>kB,string:()=>g,strictObject:()=>EB,startsWith:()=>dU,slugify:()=>U0,size:()=>r1,setErrorMap:()=>kM,set:()=>cB,safeParseAsync:()=>_G,safeParse:()=>UG,safeEncodeAsync:()=>OG,safeEncode:()=>GG,safeDecodeAsync:()=>YG,safeDecode:()=>WG,registry:()=>rv,regexes:()=>a6,regex:()=>rU,refine:()=>nG,record:()=>x$,readonly:()=>lG,property:()=>HJ,promise:()=>tB,prettifyError:()=>g5,preprocess:()=>E_,prefault:()=>fG,positive:()=>ZJ,pipe:()=>R_,partialRecord:()=>mB,parseAsync:()=>$G,parse:()=>eK,overwrite:()=>G4,optional:()=>l$,object:()=>a,number:()=>I$,nullish:()=>iB,nullable:()=>S_,null:()=>Y0,normalize:()=>aU,nonpositive:()=>BJ,nonoptional:()=>EG,nonnegative:()=>XJ,never:()=>rJ,negative:()=>qJ,nativeEnum:()=>lB,nanoid:()=>zB,nan:()=>oB,multipleOf:()=>K1,minSize:()=>P4,minLength:()=>V4,mime:()=>tU,meta:()=>$X,maxSize:()=>G1,maxLength:()=>i1,map:()=>hB,mac:()=>qB,lte:()=>l6,lt:()=>L4,lowercase:()=>iU,looseRecord:()=>xB,looseObject:()=>q6,locales:()=>A_,literal:()=>$$,length:()=>p1,lazy:()=>pG,ksuid:()=>YB,keyof:()=>fB,jwt:()=>PB,json:()=>vX,iso:()=>Z1,ipv6:()=>BB,ipv4:()=>ZB,intersection:()=>Z0,int64:()=>RB,int32:()=>gB,int:()=>wJ,instanceof:()=>UX,includes:()=>oU,httpUrl:()=>vB,hostname:()=>bB,hex:()=>MB,hash:()=>AB,guid:()=>aq,gte:()=>y6,gt:()=>F4,globalRegistry:()=>Z6,getErrorMap:()=>bM,function:()=>aB,fromJSONSchema:()=>zX,formatError:()=>O_,float64:()=>wB,float32:()=>IB,flattenError:()=>W_,file:()=>rB,exactOptional:()=>yG,enum:()=>B6,endsWith:()=>nU,encodeAsync:()=>zG,encode:()=>vG,emoji:()=>JB,email:()=>tq,e164:()=>FB,discriminatedUnion:()=>j_,describe:()=>eB,decodeAsync:()=>KG,decode:()=>JG,date:()=>VB,custom:()=>tJ,cuid2:()=>GB,cuid:()=>KB,core:()=>f4,config:()=>U6,coerce:()=>sG,codec:()=>dB,clone:()=>T6,cidrv6:()=>HB,cidrv4:()=>XB,check:()=>sB,catch:()=>xG,boolean:()=>_6,bigint:()=>SB,base64url:()=>LB,base64:()=>QB,array:()=>Q$,any:()=>DB,_function:()=>aB,_default:()=>jG,_ZodString:()=>gJ,ZodXor:()=>kG,ZodXID:()=>DJ,ZodVoid:()=>FG,ZodUnknown:()=>QG,ZodUnion:()=>D_,ZodUndefined:()=>BG,ZodUUID:()=>k4,ZodURL:()=>T_,ZodULID:()=>CJ,ZodType:()=>q$,ZodTuple:()=>AG,ZodTransform:()=>RG,ZodTemplateLiteral:()=>rG,ZodSymbol:()=>qG,ZodSuccess:()=>uG,ZodStringFormat:()=>f$,ZodString:()=>z0,ZodSet:()=>gG,ZodRecord:()=>V_,ZodRealError:()=>f6,ZodReadonly:()=>cG,ZodPromise:()=>oG,ZodPrefault:()=>VG,ZodPipe:()=>dJ,ZodOptional:()=>pJ,ZodObject:()=>C_,ZodNumberFormat:()=>o1,ZodNumber:()=>G0,ZodNullable:()=>CG,ZodNull:()=>XG,ZodNonOptional:()=>oJ,ZodNever:()=>LG,ZodNanoID:()=>RJ,ZodNaN:()=>hG,ZodMap:()=>wG,ZodMAC:()=>ZG,ZodLiteral:()=>NG,ZodLazy:()=>iG,ZodKSUID:()=>jJ,ZodJWT:()=>cJ,ZodIssueCode:()=>PM,ZodIntersection:()=>MG,ZodISOTime:()=>AJ,ZodISODuration:()=>IJ,ZodISODateTime:()=>bJ,ZodISODate:()=>MJ,ZodIPv6:()=>fJ,ZodIPv4:()=>VJ,ZodGUID:()=>N_,ZodFunction:()=>dG,ZodFirstPartyTypeKind:()=>aG,ZodFile:()=>SG,ZodExactOptional:()=>TG,ZodError:()=>LM,ZodEnum:()=>J0,ZodEmoji:()=>SJ,ZodEmail:()=>NJ,ZodE164:()=>hJ,ZodDiscriminatedUnion:()=>bG,ZodDefault:()=>DG,ZodDate:()=>y_,ZodCustomStringFormat:()=>K0,ZodCustom:()=>f_,ZodCodec:()=>nJ,ZodCatch:()=>mG,ZodCUID2:()=>yJ,ZodCUID:()=>TJ,ZodCIDRv6:()=>uJ,ZodCIDRv4:()=>EJ,ZodBoolean:()=>W0,ZodBigIntFormat:()=>lJ,ZodBigInt:()=>O0,ZodBase64URL:()=>xJ,ZodBase64:()=>mJ,ZodArray:()=>PG,ZodAny:()=>HG,TimePrecision:()=>S7,NEVER:()=>X5,$output:()=>M7,$input:()=>A7,$brand:()=>H5});var f4={};A4(f4,{version:()=>P3,util:()=>h,treeifyError:()=>w5,toJSONSchema:()=>PJ,toDotPath:()=>Zq,safeParseAsync:()=>q_,safeParse:()=>xU,safeEncodeAsync:()=>Fq,safeEncode:()=>Qq,safeDecodeAsync:()=>Pq,safeDecode:()=>Lq,registry:()=>rv,regexes:()=>a6,process:()=>R$,prettifyError:()=>g5,parseAsync:()=>Z_,parse:()=>Y_,meta:()=>WK,locales:()=>A_,isValidJWT:()=>uq,isValidBase64URL:()=>Eq,isValidBase64:()=>h3,initializeContext:()=>W1,globalRegistry:()=>Z6,globalConfig:()=>$_,formatError:()=>O_,flattenError:()=>W_,finalize:()=>Y1,extractDefs:()=>O1,encodeAsync:()=>Xq,encode:()=>qq,describe:()=>GK,decodeAsync:()=>Hq,decode:()=>Bq,createToJSONSchemaMethod:()=>YK,createStandardJSONSchemaMethod:()=>v0,config:()=>U6,clone:()=>T6,_xor:()=>ob,_xid:()=>UJ,_void:()=>s7,_uuidv7:()=>nv,_uuidv6:()=>dv,_uuidv4:()=>ov,_uuid:()=>pv,_url:()=>w_,_uppercase:()=>pU,_unknown:()=>t7,_union:()=>pb,_undefined:()=>o7,_ulid:()=>$J,_uint64:()=>i7,_uint32:()=>m7,_tuple:()=>tb,_trim:()=>sU,_transform:()=>vM,_toUpperCase:()=>$0,_toLowerCase:()=>eU,_templateLiteral:()=>qM,_symbol:()=>p7,_superRefine:()=>KK,_success:()=>WM,_stringbool:()=>OK,_stringFormat:()=>_0,_string:()=>w7,_startsWith:()=>dU,_slugify:()=>U0,_size:()=>r1,_set:()=>eb,_safeParseAsync:()=>hU,_safeParse:()=>mU,_safeEncodeAsync:()=>Rv,_safeEncode:()=>Nv,_safeDecodeAsync:()=>Tv,_safeDecode:()=>Sv,_regex:()=>rU,_refine:()=>zK,_record:()=>ab,_readonly:()=>ZM,_property:()=>HJ,_promise:()=>XM,_positive:()=>ZJ,_pipe:()=>YM,_parseAsync:()=>uU,_parse:()=>EU,_overwrite:()=>G4,_optional:()=>JM,_number:()=>D7,_nullable:()=>zM,_null:()=>d7,_normalize:()=>aU,_nonpositive:()=>BJ,_nonoptional:()=>GM,_nonnegative:()=>XJ,_never:()=>a7,_negative:()=>qJ,_nativeEnum:()=>UM,_nanoid:()=>av,_nan:()=>UK,_multipleOf:()=>K1,_minSize:()=>P4,_minLength:()=>V4,_min:()=>y6,_mime:()=>tU,_maxSize:()=>G1,_maxLength:()=>i1,_max:()=>l6,_map:()=>sb,_mac:()=>N7,_lte:()=>l6,_lt:()=>L4,_lowercase:()=>iU,_literal:()=>_M,_length:()=>p1,_lazy:()=>BM,_ksuid:()=>_J,_jwt:()=>YJ,_isoTime:()=>y7,_isoDuration:()=>C7,_isoDateTime:()=>R7,_isoDate:()=>T7,_ipv6:()=>JJ,_ipv4:()=>vJ,_intersection:()=>nb,_int64:()=>r7,_int32:()=>u7,_int:()=>V7,_includes:()=>oU,_guid:()=>I_,_gte:()=>y6,_gt:()=>F4,_float64:()=>E7,_float32:()=>f7,_file:()=>vK,_enum:()=>$M,_endsWith:()=>nU,_encodeAsync:()=>wv,_encode:()=>Av,_emoji:()=>tv,_email:()=>iv,_e164:()=>OJ,_discriminatedUnion:()=>db,_default:()=>KM,_decodeAsync:()=>gv,_decode:()=>Iv,_date:()=>e7,_custom:()=>JK,_cuid2:()=>ev,_cuid:()=>sv,_coercedString:()=>g7,_coercedNumber:()=>j7,_coercedDate:()=>$K,_coercedBoolean:()=>h7,_coercedBigint:()=>l7,_cidrv6:()=>KJ,_cidrv4:()=>zJ,_check:()=>oq,_catch:()=>OM,_boolean:()=>x7,_bigint:()=>c7,_base64url:()=>WJ,_base64:()=>GJ,_array:()=>_K,_any:()=>n7,TimePrecision:()=>S7,NEVER:()=>X5,JSONSchemaGenerator:()=>dK,JSONSchema:()=>dq,Doc:()=>jv,$output:()=>M7,$input:()=>A7,$constructor:()=>M,$brand:()=>H5,$ZodXor:()=>zz,$ZodXID:()=>T3,$ZodVoid:()=>Uz,$ZodUnknown:()=>e3,$ZodUnion:()=>L_,$ZodUndefined:()=>t3,$ZodUUID:()=>M3,$ZodURL:()=>I3,$ZodULID:()=>R3,$ZodType:()=>Y$,$ZodTuple:()=>cv,$ZodTransform:()=>Xz,$ZodTemplateLiteral:()=>wz,$ZodSymbol:()=>n3,$ZodSuccess:()=>kz,$ZodStringFormat:()=>V$,$ZodString:()=>l1,$ZodSet:()=>Yz,$ZodRegistry:()=>I7,$ZodRecord:()=>Wz,$ZodRealError:()=>V6,$ZodReadonly:()=>Iz,$ZodPromise:()=>Nz,$ZodPrefault:()=>Fz,$ZodPipe:()=>Az,$ZodOptional:()=>lv,$ZodObjectJIT:()=>Jz,$ZodObject:()=>hq,$ZodNumberFormat:()=>o3,$ZodNumber:()=>xv,$ZodNullable:()=>Qz,$ZodNull:()=>a3,$ZodNonOptional:()=>Pz,$ZodNever:()=>$z,$ZodNanoID:()=>g3,$ZodNaN:()=>Mz,$ZodMap:()=>Oz,$ZodMAC:()=>u3,$ZodLiteral:()=>qz,$ZodLazy:()=>Sz,$ZodKSUID:()=>y3,$ZodJWT:()=>i3,$ZodIntersection:()=>Gz,$ZodISOTime:()=>j3,$ZodISODuration:()=>V3,$ZodISODateTime:()=>C3,$ZodISODate:()=>D3,$ZodIPv6:()=>E3,$ZodIPv4:()=>f3,$ZodGUID:()=>b3,$ZodFunction:()=>gz,$ZodFile:()=>Bz,$ZodExactOptional:()=>Hz,$ZodError:()=>G_,$ZodEnum:()=>Zz,$ZodEncodeError:()=>x1,$ZodEmoji:()=>w3,$ZodEmail:()=>A3,$ZodE164:()=>r3,$ZodDiscriminatedUnion:()=>Kz,$ZodDefault:()=>Lz,$ZodDate:()=>_z,$ZodCustomStringFormat:()=>p3,$ZodCustom:()=>Rz,$ZodCodec:()=>F_,$ZodCheckUpperCase:()=>q3,$ZodCheckStringFormat:()=>cU,$ZodCheckStartsWith:()=>X3,$ZodCheckSizeEquals:()=>K3,$ZodCheckRegex:()=>Y3,$ZodCheckProperty:()=>Q3,$ZodCheckOverwrite:()=>F3,$ZodCheckNumberFormat:()=>_3,$ZodCheckMultipleOf:()=>U3,$ZodCheckMinSize:()=>z3,$ZodCheckMinLength:()=>W3,$ZodCheckMimeType:()=>L3,$ZodCheckMaxSize:()=>J3,$ZodCheckMaxLength:()=>G3,$ZodCheckLowerCase:()=>Z3,$ZodCheckLessThan:()=>Cv,$ZodCheckLengthEquals:()=>O3,$ZodCheckIncludes:()=>B3,$ZodCheckGreaterThan:()=>Dv,$ZodCheckEndsWith:()=>H3,$ZodCheckBigIntFormat:()=>v3,$ZodCheck:()=>m$,$ZodCatch:()=>bz,$ZodCUID2:()=>S3,$ZodCUID:()=>N3,$ZodCIDRv6:()=>x3,$ZodCIDRv4:()=>m3,$ZodBoolean:()=>Q_,$ZodBigIntFormat:()=>d3,$ZodBigInt:()=>hv,$ZodBase64URL:()=>l3,$ZodBase64:()=>c3,$ZodAsyncError:()=>Q4,$ZodArray:()=>vz,$ZodAny:()=>s3});var X5=Object.freeze({status:"aborted"});function M($,U,v){function J(W,O){if(!W._zod)Object.defineProperty(W,"_zod",{value:{def:O,constr:K,traits:new Set},enumerable:!1});if(W._zod.traits.has($))return;W._zod.traits.add($),U(W,O);let Y=K.prototype,Z=Object.keys(Y);for(let q=0;q<Z.length;q++){let X=Z[q];if(!(X in W))W[X]=Y[X].bind(W)}}let _=v?.Parent??Object;class z extends _{}Object.defineProperty(z,"name",{value:$});function K(W){var O;let Y=v?.Parent?new z:this;J(Y,W),(O=Y._zod).deferred??(O.deferred=[]);for(let Z of Y._zod.deferred)Z();return Y}return Object.defineProperty(K,"init",{value:J}),Object.defineProperty(K,Symbol.hasInstance,{value:(W)=>{if(v?.Parent&&W instanceof v.Parent)return!0;return W?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}var H5=Symbol("zod_brand");class Q4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class x1 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var $_={};function U6($){if($)Object.assign($_,$);return $_}var h={};A4(h,{unwrapMessage:()=>U_,uint8ArrayToHex:()=>Mk,uint8ArrayToBase64url:()=>kk,uint8ArrayToBase64:()=>Wq,stringifyPrimitive:()=>m,slugify:()=>F5,shallowClone:()=>k5,safeExtend:()=>Xk,required:()=>Lk,randomString:()=>Gk,propertyKeyTypes:()=>J_,promiseAllObject:()=>Kk,primitiveTypes:()=>b5,prefixIssues:()=>c6,pick:()=>Zk,partial:()=>Qk,parsedType:()=>x,optionalKeys:()=>M5,omit:()=>qk,objectClone:()=>vk,numKeys:()=>Wk,nullish:()=>_1,normalizeParams:()=>c,mergeDefs:()=>j4,merge:()=>Hk,jsonStringifyReplacer:()=>jU,joinValues:()=>w,issue:()=>fU,isPlainObject:()=>J1,isObject:()=>h1,hexToUint8Array:()=>bk,getSizableOrigin:()=>z_,getParsedType:()=>Ok,getLengthableOrigin:()=>K_,getEnumValues:()=>__,getElementAtPath:()=>zk,floatSafeRemainder:()=>L5,finalizeIssue:()=>j6,extend:()=>Bk,escapeRegex:()=>t6,esc:()=>bv,defineLazy:()=>X$,createTransparentProxy:()=>Yk,cloneDef:()=>Jk,clone:()=>T6,cleanRegex:()=>v_,cleanEnum:()=>Fk,captureStackTrace:()=>Mv,cached:()=>VU,base64urlToUint8Array:()=>Pk,base64ToUint8Array:()=>Gq,assignProp:()=>v1,assertNotEqual:()=>eP,assertNever:()=>Uk,assertIs:()=>$k,assertEqual:()=>sP,assert:()=>_k,allowsEval:()=>P5,aborted:()=>z1,NUMBER_FORMAT_RANGES:()=>A5,Class:()=>Oq,BIGINT_FORMAT_RANGES:()=>I5});function sP($){return $}function eP($){return $}function $k($){}function Uk($){throw Error("Unexpected value in exhaustive check")}function _k($){}function __($){let U=Object.values($).filter((J)=>typeof J==="number");return Object.entries($).filter(([J,_])=>U.indexOf(+J)===-1).map(([J,_])=>_)}function w($,U="|"){return $.map((v)=>m(v)).join(U)}function jU($,U){if(typeof U==="bigint")return U.toString();return U}function VU($){return{get value(){{let v=$();return Object.defineProperty(this,"value",{value:v}),v}throw Error("cached value already set")}}}function _1($){return $===null||$===void 0}function v_($){let U=$.startsWith("^")?1:0,v=$.endsWith("$")?$.length-1:$.length;return $.slice(U,v)}function L5($,U){let v=($.toString().split(".")[1]||"").length,J=U.toString(),_=(J.split(".")[1]||"").length;if(_===0&&/\d?e-\d?/.test(J)){let O=J.match(/\d?e-(\d?)/);if(O?.[1])_=Number.parseInt(O[1])}let z=v>_?v:_,K=Number.parseInt($.toFixed(z).replace(".","")),W=Number.parseInt(U.toFixed(z).replace(".",""));return K%W/10**z}var Kq=Symbol("evaluating");function X$($,U,v){let J=void 0;Object.defineProperty($,U,{get(){if(J===Kq)return;if(J===void 0)J=Kq,J=v();return J},set(_){Object.defineProperty($,U,{value:_})},configurable:!0})}function vk($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function v1($,U,v){Object.defineProperty($,U,{value:v,writable:!0,enumerable:!0,configurable:!0})}function j4(...$){let U={};for(let v of $){let J=Object.getOwnPropertyDescriptors(v);Object.assign(U,J)}return Object.defineProperties({},U)}function Jk($){return j4($._zod.def)}function zk($,U){if(!U)return $;return U.reduce((v,J)=>v?.[J],$)}function Kk($){let U=Object.keys($),v=U.map((J)=>$[J]);return Promise.all(v).then((J)=>{let _={};for(let z=0;z<U.length;z++)_[U[z]]=J[z];return _})}function Gk($=10){let v="";for(let J=0;J<$;J++)v+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return v}function bv($){return JSON.stringify($)}function F5($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mv="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function h1($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var P5=VU(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function J1($){if(h1($)===!1)return!1;let U=$.constructor;if(U===void 0)return!0;if(typeof U!=="function")return!0;let v=U.prototype;if(h1(v)===!1)return!1;if(Object.prototype.hasOwnProperty.call(v,"isPrototypeOf")===!1)return!1;return!0}function k5($){if(J1($))return{...$};if(Array.isArray($))return[...$];return $}function Wk($){let U=0;for(let v in $)if(Object.prototype.hasOwnProperty.call($,v))U++;return U}var Ok=($)=>{let U=typeof $;switch(U){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${U}`)}},J_=new Set(["string","number","symbol"]),b5=new Set(["string","number","bigint","boolean","symbol","undefined"]);function t6($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T6($,U,v){let J=new $._zod.constr(U??$._zod.def);if(!U||v?.parent)J._zod.parent=$;return J}function c($){let U=$;if(!U)return{};if(typeof U==="string")return{error:()=>U};if(U?.message!==void 0){if(U?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");U.error=U.message}if(delete U.message,typeof U.error==="string")return{...U,error:()=>U.error};return U}function Yk($){let U;return new Proxy({},{get(v,J,_){return U??(U=$()),Reflect.get(U,J,_)},set(v,J,_,z){return U??(U=$()),Reflect.set(U,J,_,z)},has(v,J){return U??(U=$()),Reflect.has(U,J)},deleteProperty(v,J){return U??(U=$()),Reflect.deleteProperty(U,J)},ownKeys(v){return U??(U=$()),Reflect.ownKeys(U)},getOwnPropertyDescriptor(v,J){return U??(U=$()),Reflect.getOwnPropertyDescriptor(U,J)},defineProperty(v,J,_){return U??(U=$()),Reflect.defineProperty(U,J,_)}})}function m($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function M5($){return Object.keys($).filter((U)=>{return $[U]._zod.optin==="optional"&&$[U]._zod.optout==="optional"})}var A5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},I5={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zk($,U){let v=$._zod.def,J=v.checks;if(J&&J.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=j4($._zod.def,{get shape(){let K={};for(let W in U){if(!(W in v.shape))throw Error(`Unrecognized key: "${W}"`);if(!U[W])continue;K[W]=v.shape[W]}return v1(this,"shape",K),K},checks:[]});return T6($,z)}function qk($,U){let v=$._zod.def,J=v.checks;if(J&&J.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=j4($._zod.def,{get shape(){let K={...$._zod.def.shape};for(let W in U){if(!(W in v.shape))throw Error(`Unrecognized key: "${W}"`);if(!U[W])continue;delete K[W]}return v1(this,"shape",K),K},checks:[]});return T6($,z)}function Bk($,U){if(!J1(U))throw Error("Invalid input to extend: expected a plain object");let v=$._zod.def.checks;if(v&&v.length>0){let z=$._zod.def.shape;for(let K in U)if(Object.getOwnPropertyDescriptor(z,K)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let _=j4($._zod.def,{get shape(){let z={...$._zod.def.shape,...U};return v1(this,"shape",z),z}});return T6($,_)}function Xk($,U){if(!J1(U))throw Error("Invalid input to safeExtend: expected a plain object");let v=j4($._zod.def,{get shape(){let J={...$._zod.def.shape,...U};return v1(this,"shape",J),J}});return T6($,v)}function Hk($,U){let v=j4($._zod.def,{get shape(){let J={...$._zod.def.shape,...U._zod.def.shape};return v1(this,"shape",J),J},get catchall(){return U._zod.def.catchall},checks:[]});return T6($,v)}function Qk($,U,v){let _=U._zod.def.checks;if(_&&_.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let K=j4(U._zod.def,{get shape(){let W=U._zod.def.shape,O={...W};if(v)for(let Y in v){if(!(Y in W))throw Error(`Unrecognized key: "${Y}"`);if(!v[Y])continue;O[Y]=$?new $({type:"optional",innerType:W[Y]}):W[Y]}else for(let Y in W)O[Y]=$?new $({type:"optional",innerType:W[Y]}):W[Y];return v1(this,"shape",O),O},checks:[]});return T6(U,K)}function Lk($,U,v){let J=j4(U._zod.def,{get shape(){let _=U._zod.def.shape,z={..._};if(v)for(let K in v){if(!(K in z))throw Error(`Unrecognized key: "${K}"`);if(!v[K])continue;z[K]=new $({type:"nonoptional",innerType:_[K]})}else for(let K in _)z[K]=new $({type:"nonoptional",innerType:_[K]});return v1(this,"shape",z),z}});return T6(U,J)}function z1($,U=0){if($.aborted===!0)return!0;for(let v=U;v<$.issues.length;v++)if($.issues[v]?.continue!==!0)return!0;return!1}function c6($,U){return U.map((v)=>{var J;return(J=v).path??(J.path=[]),v.path.unshift($),v})}function U_($){return typeof $==="string"?$:$?.message}function j6($,U,v){let J={...$,path:$.path??[]};if(!$.message){let _=U_($.inst?._zod.def?.error?.($))??U_(U?.error?.($))??U_(v.customError?.($))??U_(v.localeError?.($))??"Invalid input";J.message=_}if(delete J.inst,delete J.continue,!U?.reportInput)delete J.input;return J}function z_($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function K_($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function x($){let U=typeof $;switch(U){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let v=$;if(v&&Object.getPrototypeOf(v)!==Object.prototype&&"constructor"in v&&v.constructor)return v.constructor.name}}return U}function fU(...$){let[U,v,J]=$;if(typeof U==="string")return{message:U,code:"custom",input:v,inst:J};return{...U}}function Fk($){return Object.entries($).filter(([U,v])=>{return Number.isNaN(Number.parseInt(U,10))}).map((U)=>U[1])}function Gq($){let U=atob($),v=new Uint8Array(U.length);for(let J=0;J<U.length;J++)v[J]=U.charCodeAt(J);return v}function Wq($){let U="";for(let v=0;v<$.length;v++)U+=String.fromCharCode($[v]);return btoa(U)}function Pk($){let U=$.replace(/-/g,"+").replace(/_/g,"/"),v="=".repeat((4-U.length%4)%4);return Gq(U+v)}function kk($){return Wq($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bk($){let U=$.replace(/^0x/,"");if(U.length%2!==0)throw Error("Invalid hex string length");let v=new Uint8Array(U.length/2);for(let J=0;J<U.length;J+=2)v[J/2]=Number.parseInt(U.slice(J,J+2),16);return v}function Mk($){return Array.from($).map((U)=>U.toString(16).padStart(2,"0")).join("")}class Oq{constructor(...$){}}var Yq=($,U)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:U,enumerable:!1}),$.message=JSON.stringify(U,jU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},G_=M("$ZodError",Yq),V6=M("$ZodError",Yq,{Parent:Error});function W_($,U=(v)=>v.message){let v={},J=[];for(let _ of $.issues)if(_.path.length>0)v[_.path[0]]=v[_.path[0]]||[],v[_.path[0]].push(U(_));else J.push(U(_));return{formErrors:J,fieldErrors:v}}function O_($,U=(v)=>v.message){let v={_errors:[]},J=(_)=>{for(let z of _.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((K)=>J({issues:K}));else if(z.code==="invalid_key")J({issues:z.issues});else if(z.code==="invalid_element")J({issues:z.issues});else if(z.path.length===0)v._errors.push(U(z));else{let K=v,W=0;while(W<z.path.length){let O=z.path[W];if(W!==z.path.length-1)K[O]=K[O]||{_errors:[]};else K[O]=K[O]||{_errors:[]},K[O]._errors.push(U(z));K=K[O],W++}}};return J($),v}function w5($,U=(v)=>v.message){let v={errors:[]},J=(_,z=[])=>{var K,W;for(let O of _.issues)if(O.code==="invalid_union"&&O.errors.length)O.errors.map((Y)=>J({issues:Y},O.path));else if(O.code==="invalid_key")J({issues:O.issues},O.path);else if(O.code==="invalid_element")J({issues:O.issues},O.path);else{let Y=[...z,...O.path];if(Y.length===0){v.errors.push(U(O));continue}let Z=v,q=0;while(q<Y.length){let X=Y[q],B=q===Y.length-1;if(typeof X==="string")Z.properties??(Z.properties={}),(K=Z.properties)[X]??(K[X]={errors:[]}),Z=Z.properties[X];else Z.items??(Z.items=[]),(W=Z.items)[X]??(W[X]={errors:[]}),Z=Z.items[X];if(B)Z.errors.push(U(O));q++}}};return J($),v}function Zq($){let U=[],v=$.map((J)=>typeof J==="object"?J.key:J);for(let J of v)if(typeof J==="number")U.push(`[${J}]`);else if(typeof J==="symbol")U.push(`[${JSON.stringify(String(J))}]`);else if(/[^\w$]/.test(J))U.push(`[${JSON.stringify(J)}]`);else{if(U.length)U.push(".");U.push(J)}return U.join("")}function g5($){let U=[],v=[...$.issues].sort((J,_)=>(J.path??[]).length-(_.path??[]).length);for(let J of v)if(U.push(`✖ ${J.message}`),J.path?.length)U.push(` → at ${Zq(J.path)}`);return U.join(`
113
+ `)}var EU=($)=>(U,v,J,_)=>{let z=J?Object.assign(J,{async:!1}):{async:!1},K=U._zod.run({value:v,issues:[]},z);if(K instanceof Promise)throw new Q4;if(K.issues.length){let W=new(_?.Err??$)(K.issues.map((O)=>j6(O,z,U6())));throw Mv(W,_?.callee),W}return K.value},Y_=EU(V6),uU=($)=>async(U,v,J,_)=>{let z=J?Object.assign(J,{async:!0}):{async:!0},K=U._zod.run({value:v,issues:[]},z);if(K instanceof Promise)K=await K;if(K.issues.length){let W=new(_?.Err??$)(K.issues.map((O)=>j6(O,z,U6())));throw Mv(W,_?.callee),W}return K.value},Z_=uU(V6),mU=($)=>(U,v,J)=>{let _=J?{...J,async:!1}:{async:!1},z=U._zod.run({value:v,issues:[]},_);if(z instanceof Promise)throw new Q4;return z.issues.length?{success:!1,error:new($??G_)(z.issues.map((K)=>j6(K,_,U6())))}:{success:!0,data:z.value}},xU=mU(V6),hU=($)=>async(U,v,J)=>{let _=J?Object.assign(J,{async:!0}):{async:!0},z=U._zod.run({value:v,issues:[]},_);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((K)=>j6(K,_,U6())))}:{success:!0,data:z.value}},q_=hU(V6),Av=($)=>(U,v,J)=>{let _=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return EU($)(U,v,_)},qq=Av(V6),Iv=($)=>(U,v,J)=>{return EU($)(U,v,J)},Bq=Iv(V6),wv=($)=>async(U,v,J)=>{let _=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return uU($)(U,v,_)},Xq=wv(V6),gv=($)=>async(U,v,J)=>{return uU($)(U,v,J)},Hq=gv(V6),Nv=($)=>(U,v,J)=>{let _=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return mU($)(U,v,_)},Qq=Nv(V6),Sv=($)=>(U,v,J)=>{return mU($)(U,v,J)},Lq=Sv(V6),Rv=($)=>async(U,v,J)=>{let _=J?Object.assign(J,{direction:"backward"}):{direction:"backward"};return hU($)(U,v,_)},Fq=Rv(V6),Tv=($)=>async(U,v,J)=>{return hU($)(U,v,J)},Pq=Tv(V6);var a6={};A4(a6,{xid:()=>T5,uuid7:()=>Nk,uuid6:()=>gk,uuid4:()=>wk,uuid:()=>c1,uppercase:()=>$3,unicodeEmail:()=>kq,undefined:()=>s5,ulid:()=>R5,time:()=>i5,string:()=>o5,sha512_hex:()=>dk,sha512_base64url:()=>tk,sha512_base64:()=>nk,sha384_hex:()=>ik,sha384_base64url:()=>ok,sha384_base64:()=>pk,sha256_hex:()=>ck,sha256_base64url:()=>rk,sha256_base64:()=>lk,sha1_hex:()=>mk,sha1_base64url:()=>hk,sha1_base64:()=>xk,rfc5322Email:()=>Rk,number:()=>B_,null:()=>a5,nanoid:()=>C5,md5_hex:()=>fk,md5_base64url:()=>uk,md5_base64:()=>Ek,mac:()=>m5,lowercase:()=>e5,ksuid:()=>y5,ipv6:()=>u5,ipv4:()=>E5,integer:()=>n5,idnEmail:()=>Tk,html5Email:()=>Sk,hostname:()=>Dk,hex:()=>Vk,guid:()=>j5,extendedDuration:()=>Ik,emoji:()=>f5,email:()=>V5,e164:()=>l5,duration:()=>D5,domain:()=>jk,datetime:()=>p5,date:()=>r5,cuid2:()=>S5,cuid:()=>N5,cidrv6:()=>h5,cidrv4:()=>x5,browserEmail:()=>yk,boolean:()=>t5,bigint:()=>d5,base64url:()=>yv,base64:()=>c5});var N5=/^[cC][^\s-]{8,}$/,S5=/^[0-9a-z]+$/,R5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,T5=/^[0-9a-vA-V]{20}$/,y5=/^[A-Za-z0-9]{27}$/,C5=/^[a-zA-Z0-9_-]{21}$/,D5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ik=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,j5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,c1=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},wk=c1(4),gk=c1(6),Nk=c1(7),V5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Sk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Rk=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,kq=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Tk=kq,yk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ck="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function f5(){return new RegExp(Ck,"u")}var E5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,m5=($)=>{let U=t6($??":");return new RegExp(`^(?:[0-9A-F]{2}${U}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${U}){5}[0-9a-f]{2}$`)},x5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,h5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,c5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yv=/^[A-Za-z0-9_-]*$/,Dk=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,jk=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,l5=/^\+[1-9]\d{6,14}$/,bq="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",r5=new RegExp(`^${bq}$`);function Mq($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function i5($){return new RegExp(`^${Mq($)}$`)}function p5($){let U=Mq({precision:$.precision}),v=["Z"];if($.local)v.push("");if($.offset)v.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let J=`${U}(?:${v.join("|")})`;return new RegExp(`^${bq}T(?:${J})$`)}var o5=($)=>{let U=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${U}$`)},d5=/^-?\d+n?$/,n5=/^-?\d+$/,B_=/^-?\d+(?:\.\d+)?$/,t5=/^(?:true|false)$/i,a5=/^null$/i;var s5=/^undefined$/i;var e5=/^[^A-Z]*$/,$3=/^[^a-z]*$/,Vk=/^[0-9a-fA-F]*$/;function X_($,U){return new RegExp(`^[A-Za-z0-9+/]{${$}}${U}$`)}function H_($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var fk=/^[0-9a-fA-F]{32}$/,Ek=X_(22,"=="),uk=H_(22),mk=/^[0-9a-fA-F]{40}$/,xk=X_(27,"="),hk=H_(27),ck=/^[0-9a-fA-F]{64}$/,lk=X_(43,"="),rk=H_(43),ik=/^[0-9a-fA-F]{96}$/,pk=X_(64,""),ok=H_(64),dk=/^[0-9a-fA-F]{128}$/,nk=X_(86,"=="),tk=H_(86);var m$=M("$ZodCheck",($,U)=>{var v;$._zod??($._zod={}),$._zod.def=U,(v=$._zod).onattach??(v.onattach=[])}),Iq={number:"number",bigint:"bigint",object:"date"},Cv=M("$ZodCheckLessThan",($,U)=>{m$.init($,U);let v=Iq[typeof U.value];$._zod.onattach.push((J)=>{let _=J._zod.bag,z=(U.inclusive?_.maximum:_.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(U.value<z)if(U.inclusive)_.maximum=U.value;else _.exclusiveMaximum=U.value}),$._zod.check=(J)=>{if(U.inclusive?J.value<=U.value:J.value<U.value)return;J.issues.push({origin:v,code:"too_big",maximum:typeof U.value==="object"?U.value.getTime():U.value,input:J.value,inclusive:U.inclusive,inst:$,continue:!U.abort})}}),Dv=M("$ZodCheckGreaterThan",($,U)=>{m$.init($,U);let v=Iq[typeof U.value];$._zod.onattach.push((J)=>{let _=J._zod.bag,z=(U.inclusive?_.minimum:_.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(U.value>z)if(U.inclusive)_.minimum=U.value;else _.exclusiveMinimum=U.value}),$._zod.check=(J)=>{if(U.inclusive?J.value>=U.value:J.value>U.value)return;J.issues.push({origin:v,code:"too_small",minimum:typeof U.value==="object"?U.value.getTime():U.value,input:J.value,inclusive:U.inclusive,inst:$,continue:!U.abort})}}),U3=M("$ZodCheckMultipleOf",($,U)=>{m$.init($,U),$._zod.onattach.push((v)=>{var J;(J=v._zod.bag).multipleOf??(J.multipleOf=U.value)}),$._zod.check=(v)=>{if(typeof v.value!==typeof U.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof v.value==="bigint"?v.value%U.value===BigInt(0):L5(v.value,U.value)===0)return;v.issues.push({origin:typeof v.value,code:"not_multiple_of",divisor:U.value,input:v.value,inst:$,continue:!U.abort})}}),_3=M("$ZodCheckNumberFormat",($,U)=>{m$.init($,U),U.format=U.format||"float64";let v=U.format?.includes("int"),J=v?"int":"number",[_,z]=A5[U.format];$._zod.onattach.push((K)=>{let W=K._zod.bag;if(W.format=U.format,W.minimum=_,W.maximum=z,v)W.pattern=n5}),$._zod.check=(K)=>{let W=K.value;if(v){if(!Number.isInteger(W)){K.issues.push({expected:J,format:U.format,code:"invalid_type",continue:!1,input:W,inst:$});return}if(!Number.isSafeInteger(W)){if(W>0)K.issues.push({input:W,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:J,inclusive:!0,continue:!U.abort});else K.issues.push({input:W,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:J,inclusive:!0,continue:!U.abort});return}}if(W<_)K.issues.push({origin:"number",input:W,code:"too_small",minimum:_,inclusive:!0,inst:$,continue:!U.abort});if(W>z)K.issues.push({origin:"number",input:W,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!U.abort})}}),v3=M("$ZodCheckBigIntFormat",($,U)=>{m$.init($,U);let[v,J]=I5[U.format];$._zod.onattach.push((_)=>{let z=_._zod.bag;z.format=U.format,z.minimum=v,z.maximum=J}),$._zod.check=(_)=>{let z=_.value;if(z<v)_.issues.push({origin:"bigint",input:z,code:"too_small",minimum:v,inclusive:!0,inst:$,continue:!U.abort});if(z>J)_.issues.push({origin:"bigint",input:z,code:"too_big",maximum:J,inclusive:!0,inst:$,continue:!U.abort})}}),J3=M("$ZodCheckMaxSize",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.size!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag.maximum??Number.POSITIVE_INFINITY;if(U.maximum<_)J._zod.bag.maximum=U.maximum}),$._zod.check=(J)=>{let _=J.value;if(_.size<=U.maximum)return;J.issues.push({origin:z_(_),code:"too_big",maximum:U.maximum,inclusive:!0,input:_,inst:$,continue:!U.abort})}}),z3=M("$ZodCheckMinSize",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.size!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(U.minimum>_)J._zod.bag.minimum=U.minimum}),$._zod.check=(J)=>{let _=J.value;if(_.size>=U.minimum)return;J.issues.push({origin:z_(_),code:"too_small",minimum:U.minimum,inclusive:!0,input:_,inst:$,continue:!U.abort})}}),K3=M("$ZodCheckSizeEquals",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.size!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag;_.minimum=U.size,_.maximum=U.size,_.size=U.size}),$._zod.check=(J)=>{let _=J.value,z=_.size;if(z===U.size)return;let K=z>U.size;J.issues.push({origin:z_(_),...K?{code:"too_big",maximum:U.size}:{code:"too_small",minimum:U.size},inclusive:!0,exact:!0,input:J.value,inst:$,continue:!U.abort})}}),G3=M("$ZodCheckMaxLength",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.length!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag.maximum??Number.POSITIVE_INFINITY;if(U.maximum<_)J._zod.bag.maximum=U.maximum}),$._zod.check=(J)=>{let _=J.value;if(_.length<=U.maximum)return;let K=K_(_);J.issues.push({origin:K,code:"too_big",maximum:U.maximum,inclusive:!0,input:_,inst:$,continue:!U.abort})}}),W3=M("$ZodCheckMinLength",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.length!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(U.minimum>_)J._zod.bag.minimum=U.minimum}),$._zod.check=(J)=>{let _=J.value;if(_.length>=U.minimum)return;let K=K_(_);J.issues.push({origin:K,code:"too_small",minimum:U.minimum,inclusive:!0,input:_,inst:$,continue:!U.abort})}}),O3=M("$ZodCheckLengthEquals",($,U)=>{var v;m$.init($,U),(v=$._zod.def).when??(v.when=(J)=>{let _=J.value;return!_1(_)&&_.length!==void 0}),$._zod.onattach.push((J)=>{let _=J._zod.bag;_.minimum=U.length,_.maximum=U.length,_.length=U.length}),$._zod.check=(J)=>{let _=J.value,z=_.length;if(z===U.length)return;let K=K_(_),W=z>U.length;J.issues.push({origin:K,...W?{code:"too_big",maximum:U.length}:{code:"too_small",minimum:U.length},inclusive:!0,exact:!0,input:J.value,inst:$,continue:!U.abort})}}),cU=M("$ZodCheckStringFormat",($,U)=>{var v,J;if(m$.init($,U),$._zod.onattach.push((_)=>{let z=_._zod.bag;if(z.format=U.format,U.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(U.pattern)}),U.pattern)(v=$._zod).check??(v.check=(_)=>{if(U.pattern.lastIndex=0,U.pattern.test(_.value))return;_.issues.push({origin:"string",code:"invalid_format",format:U.format,input:_.value,...U.pattern?{pattern:U.pattern.toString()}:{},inst:$,continue:!U.abort})});else(J=$._zod).check??(J.check=()=>{})}),Y3=M("$ZodCheckRegex",($,U)=>{cU.init($,U),$._zod.check=(v)=>{if(U.pattern.lastIndex=0,U.pattern.test(v.value))return;v.issues.push({origin:"string",code:"invalid_format",format:"regex",input:v.value,pattern:U.pattern.toString(),inst:$,continue:!U.abort})}}),Z3=M("$ZodCheckLowerCase",($,U)=>{U.pattern??(U.pattern=e5),cU.init($,U)}),q3=M("$ZodCheckUpperCase",($,U)=>{U.pattern??(U.pattern=$3),cU.init($,U)}),B3=M("$ZodCheckIncludes",($,U)=>{m$.init($,U);let v=t6(U.includes),J=new RegExp(typeof U.position==="number"?`^.{${U.position}}${v}`:v);U.pattern=J,$._zod.onattach.push((_)=>{let z=_._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(J)}),$._zod.check=(_)=>{if(_.value.includes(U.includes,U.position))return;_.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:U.includes,input:_.value,inst:$,continue:!U.abort})}}),X3=M("$ZodCheckStartsWith",($,U)=>{m$.init($,U);let v=new RegExp(`^${t6(U.prefix)}.*`);U.pattern??(U.pattern=v),$._zod.onattach.push((J)=>{let _=J._zod.bag;_.patterns??(_.patterns=new Set),_.patterns.add(v)}),$._zod.check=(J)=>{if(J.value.startsWith(U.prefix))return;J.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:U.prefix,input:J.value,inst:$,continue:!U.abort})}}),H3=M("$ZodCheckEndsWith",($,U)=>{m$.init($,U);let v=new RegExp(`.*${t6(U.suffix)}$`);U.pattern??(U.pattern=v),$._zod.onattach.push((J)=>{let _=J._zod.bag;_.patterns??(_.patterns=new Set),_.patterns.add(v)}),$._zod.check=(J)=>{if(J.value.endsWith(U.suffix))return;J.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:U.suffix,input:J.value,inst:$,continue:!U.abort})}});function Aq($,U,v){if($.issues.length)U.issues.push(...c6(v,$.issues))}var Q3=M("$ZodCheckProperty",($,U)=>{m$.init($,U),$._zod.check=(v)=>{let J=U.schema._zod.run({value:v.value[U.property],issues:[]},{});if(J instanceof Promise)return J.then((_)=>Aq(_,v,U.property));Aq(J,v,U.property);return}}),L3=M("$ZodCheckMimeType",($,U)=>{m$.init($,U);let v=new Set(U.mime);$._zod.onattach.push((J)=>{J._zod.bag.mime=U.mime}),$._zod.check=(J)=>{if(v.has(J.value.type))return;J.issues.push({code:"invalid_value",values:U.mime,input:J.value.type,inst:$,continue:!U.abort})}}),F3=M("$ZodCheckOverwrite",($,U)=>{m$.init($,U),$._zod.check=(v)=>{v.value=U.tx(v.value)}});class jv{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let v=$.split(`
114
+ `).filter((z)=>z),J=Math.min(...v.map((z)=>z.length-z.trimStart().length)),_=v.map((z)=>z.slice(J)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of _)this.content.push(z)}compile(){let $=Function,U=this?.args,J=[...(this?.content??[""]).map((_)=>` ${_}`)];return new $(...U,J.join(`
115
+ `))}}var P3={major:4,minor:3,patch:6};var Y$=M("$ZodType",($,U)=>{var v;$??($={}),$._zod.def=U,$._zod.bag=$._zod.bag||{},$._zod.version=P3;let J=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))J.unshift($);for(let _ of J)for(let z of _._zod.onattach)z($);if(J.length===0)(v=$._zod).deferred??(v.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let _=(K,W,O)=>{let Y=z1(K),Z;for(let q of W){if(q._zod.def.when){if(!q._zod.def.when(K))continue}else if(Y)continue;let X=K.issues.length,B=q._zod.check(K);if(B instanceof Promise&&O?.async===!1)throw new Q4;if(Z||B instanceof Promise)Z=(Z??Promise.resolve()).then(async()=>{if(await B,K.issues.length===X)return;if(!Y)Y=z1(K,X)});else{if(K.issues.length===X)continue;if(!Y)Y=z1(K,X)}}if(Z)return Z.then(()=>{return K});return K},z=(K,W,O)=>{if(z1(K))return K.aborted=!0,K;let Y=_(W,J,O);if(Y instanceof Promise){if(O.async===!1)throw new Q4;return Y.then((Z)=>$._zod.parse(Z,O))}return $._zod.parse(Y,O)};$._zod.run=(K,W)=>{if(W.skipChecks)return $._zod.parse(K,W);if(W.direction==="backward"){let Y=$._zod.parse({value:K.value,issues:[]},{...W,skipChecks:!0});if(Y instanceof Promise)return Y.then((Z)=>{return z(Z,K,W)});return z(Y,K,W)}let O=$._zod.parse(K,W);if(O instanceof Promise){if(W.async===!1)throw new Q4;return O.then((Y)=>_(Y,J,W))}return _(O,J,W)}}X$($,"~standard",()=>({validate:(_)=>{try{let z=xU($,_);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return q_($,_).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),l1=M("$ZodString",($,U)=>{Y$.init($,U),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??o5($._zod.bag),$._zod.parse=(v,J)=>{if(U.coerce)try{v.value=String(v.value)}catch(_){}if(typeof v.value==="string")return v;return v.issues.push({expected:"string",code:"invalid_type",input:v.value,inst:$}),v}}),V$=M("$ZodStringFormat",($,U)=>{cU.init($,U),l1.init($,U)}),b3=M("$ZodGUID",($,U)=>{U.pattern??(U.pattern=j5),V$.init($,U)}),M3=M("$ZodUUID",($,U)=>{if(U.version){let J={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[U.version];if(J===void 0)throw Error(`Invalid UUID version: "${U.version}"`);U.pattern??(U.pattern=c1(J))}else U.pattern??(U.pattern=c1());V$.init($,U)}),A3=M("$ZodEmail",($,U)=>{U.pattern??(U.pattern=V5),V$.init($,U)}),I3=M("$ZodURL",($,U)=>{V$.init($,U),$._zod.check=(v)=>{try{let J=v.value.trim(),_=new URL(J);if(U.hostname){if(U.hostname.lastIndex=0,!U.hostname.test(_.hostname))v.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:U.hostname.source,input:v.value,inst:$,continue:!U.abort})}if(U.protocol){if(U.protocol.lastIndex=0,!U.protocol.test(_.protocol.endsWith(":")?_.protocol.slice(0,-1):_.protocol))v.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:U.protocol.source,input:v.value,inst:$,continue:!U.abort})}if(U.normalize)v.value=_.href;else v.value=J;return}catch(J){v.issues.push({code:"invalid_format",format:"url",input:v.value,inst:$,continue:!U.abort})}}}),w3=M("$ZodEmoji",($,U)=>{U.pattern??(U.pattern=f5()),V$.init($,U)}),g3=M("$ZodNanoID",($,U)=>{U.pattern??(U.pattern=C5),V$.init($,U)}),N3=M("$ZodCUID",($,U)=>{U.pattern??(U.pattern=N5),V$.init($,U)}),S3=M("$ZodCUID2",($,U)=>{U.pattern??(U.pattern=S5),V$.init($,U)}),R3=M("$ZodULID",($,U)=>{U.pattern??(U.pattern=R5),V$.init($,U)}),T3=M("$ZodXID",($,U)=>{U.pattern??(U.pattern=T5),V$.init($,U)}),y3=M("$ZodKSUID",($,U)=>{U.pattern??(U.pattern=y5),V$.init($,U)}),C3=M("$ZodISODateTime",($,U)=>{U.pattern??(U.pattern=p5(U)),V$.init($,U)}),D3=M("$ZodISODate",($,U)=>{U.pattern??(U.pattern=r5),V$.init($,U)}),j3=M("$ZodISOTime",($,U)=>{U.pattern??(U.pattern=i5(U)),V$.init($,U)}),V3=M("$ZodISODuration",($,U)=>{U.pattern??(U.pattern=D5),V$.init($,U)}),f3=M("$ZodIPv4",($,U)=>{U.pattern??(U.pattern=E5),V$.init($,U),$._zod.bag.format="ipv4"}),E3=M("$ZodIPv6",($,U)=>{U.pattern??(U.pattern=u5),V$.init($,U),$._zod.bag.format="ipv6",$._zod.check=(v)=>{try{new URL(`http://[${v.value}]`)}catch{v.issues.push({code:"invalid_format",format:"ipv6",input:v.value,inst:$,continue:!U.abort})}}}),u3=M("$ZodMAC",($,U)=>{U.pattern??(U.pattern=m5(U.delimiter)),V$.init($,U),$._zod.bag.format="mac"}),m3=M("$ZodCIDRv4",($,U)=>{U.pattern??(U.pattern=x5),V$.init($,U)}),x3=M("$ZodCIDRv6",($,U)=>{U.pattern??(U.pattern=h5),V$.init($,U),$._zod.check=(v)=>{let J=v.value.split("/");try{if(J.length!==2)throw Error();let[_,z]=J;if(!z)throw Error();let K=Number(z);if(`${K}`!==z)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${_}]`)}catch{v.issues.push({code:"invalid_format",format:"cidrv6",input:v.value,inst:$,continue:!U.abort})}}});function h3($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var c3=M("$ZodBase64",($,U)=>{U.pattern??(U.pattern=c5),V$.init($,U),$._zod.bag.contentEncoding="base64",$._zod.check=(v)=>{if(h3(v.value))return;v.issues.push({code:"invalid_format",format:"base64",input:v.value,inst:$,continue:!U.abort})}});function Eq($){if(!yv.test($))return!1;let U=$.replace(/[-_]/g,(J)=>J==="-"?"+":"/"),v=U.padEnd(Math.ceil(U.length/4)*4,"=");return h3(v)}var l3=M("$ZodBase64URL",($,U)=>{U.pattern??(U.pattern=yv),V$.init($,U),$._zod.bag.contentEncoding="base64url",$._zod.check=(v)=>{if(Eq(v.value))return;v.issues.push({code:"invalid_format",format:"base64url",input:v.value,inst:$,continue:!U.abort})}}),r3=M("$ZodE164",($,U)=>{U.pattern??(U.pattern=l5),V$.init($,U)});function uq($,U=null){try{let v=$.split(".");if(v.length!==3)return!1;let[J]=v;if(!J)return!1;let _=JSON.parse(atob(J));if("typ"in _&&_?.typ!=="JWT")return!1;if(!_.alg)return!1;if(U&&(!("alg"in _)||_.alg!==U))return!1;return!0}catch{return!1}}var i3=M("$ZodJWT",($,U)=>{V$.init($,U),$._zod.check=(v)=>{if(uq(v.value,U.alg))return;v.issues.push({code:"invalid_format",format:"jwt",input:v.value,inst:$,continue:!U.abort})}}),p3=M("$ZodCustomStringFormat",($,U)=>{V$.init($,U),$._zod.check=(v)=>{if(U.fn(v.value))return;v.issues.push({code:"invalid_format",format:U.format,input:v.value,inst:$,continue:!U.abort})}}),xv=M("$ZodNumber",($,U)=>{Y$.init($,U),$._zod.pattern=$._zod.bag.pattern??B_,$._zod.parse=(v,J)=>{if(U.coerce)try{v.value=Number(v.value)}catch(K){}let _=v.value;if(typeof _==="number"&&!Number.isNaN(_)&&Number.isFinite(_))return v;let z=typeof _==="number"?Number.isNaN(_)?"NaN":!Number.isFinite(_)?"Infinity":void 0:void 0;return v.issues.push({expected:"number",code:"invalid_type",input:_,inst:$,...z?{received:z}:{}}),v}}),o3=M("$ZodNumberFormat",($,U)=>{_3.init($,U),xv.init($,U)}),Q_=M("$ZodBoolean",($,U)=>{Y$.init($,U),$._zod.pattern=t5,$._zod.parse=(v,J)=>{if(U.coerce)try{v.value=Boolean(v.value)}catch(z){}let _=v.value;if(typeof _==="boolean")return v;return v.issues.push({expected:"boolean",code:"invalid_type",input:_,inst:$}),v}}),hv=M("$ZodBigInt",($,U)=>{Y$.init($,U),$._zod.pattern=d5,$._zod.parse=(v,J)=>{if(U.coerce)try{v.value=BigInt(v.value)}catch(_){}if(typeof v.value==="bigint")return v;return v.issues.push({expected:"bigint",code:"invalid_type",input:v.value,inst:$}),v}}),d3=M("$ZodBigIntFormat",($,U)=>{v3.init($,U),hv.init($,U)}),n3=M("$ZodSymbol",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(typeof _==="symbol")return v;return v.issues.push({expected:"symbol",code:"invalid_type",input:_,inst:$}),v}}),t3=M("$ZodUndefined",($,U)=>{Y$.init($,U),$._zod.pattern=s5,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(v,J)=>{let _=v.value;if(typeof _>"u")return v;return v.issues.push({expected:"undefined",code:"invalid_type",input:_,inst:$}),v}}),a3=M("$ZodNull",($,U)=>{Y$.init($,U),$._zod.pattern=a5,$._zod.values=new Set([null]),$._zod.parse=(v,J)=>{let _=v.value;if(_===null)return v;return v.issues.push({expected:"null",code:"invalid_type",input:_,inst:$}),v}}),s3=M("$ZodAny",($,U)=>{Y$.init($,U),$._zod.parse=(v)=>v}),e3=M("$ZodUnknown",($,U)=>{Y$.init($,U),$._zod.parse=(v)=>v}),$z=M("$ZodNever",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{return v.issues.push({expected:"never",code:"invalid_type",input:v.value,inst:$}),v}}),Uz=M("$ZodVoid",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(typeof _>"u")return v;return v.issues.push({expected:"void",code:"invalid_type",input:_,inst:$}),v}}),_z=M("$ZodDate",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{if(U.coerce)try{v.value=new Date(v.value)}catch(W){}let _=v.value,z=_ instanceof Date;if(z&&!Number.isNaN(_.getTime()))return v;return v.issues.push({expected:"date",code:"invalid_type",input:_,...z?{received:"Invalid Date"}:{},inst:$}),v}});function gq($,U,v){if($.issues.length)U.issues.push(...c6(v,$.issues));U.value[v]=$.value}var vz=M("$ZodArray",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(!Array.isArray(_))return v.issues.push({expected:"array",code:"invalid_type",input:_,inst:$}),v;v.value=Array(_.length);let z=[];for(let K=0;K<_.length;K++){let W=_[K],O=U.element._zod.run({value:W,issues:[]},J);if(O instanceof Promise)z.push(O.then((Y)=>gq(Y,v,K)));else gq(O,v,K)}if(z.length)return Promise.all(z).then(()=>v);return v}});function mv($,U,v,J,_){if($.issues.length){if(_&&!(v in J))return;U.issues.push(...c6(v,$.issues))}if($.value===void 0){if(v in J)U.value[v]=void 0}else U.value[v]=$.value}function mq($){let U=Object.keys($.shape);for(let J of U)if(!$.shape?.[J]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${J}": expected a Zod schema`);let v=M5($.shape);return{...$,keys:U,keySet:new Set(U),numKeys:U.length,optionalKeys:new Set(v)}}function xq($,U,v,J,_,z){let K=[],W=_.keySet,O=_.catchall._zod,Y=O.def.type,Z=O.optout==="optional";for(let q in U){if(W.has(q))continue;if(Y==="never"){K.push(q);continue}let X=O.run({value:U[q],issues:[]},J);if(X instanceof Promise)$.push(X.then((B)=>mv(B,v,q,U,Z)));else mv(X,v,q,U,Z)}if(K.length)v.issues.push({code:"unrecognized_keys",keys:K,input:U,inst:z});if(!$.length)return v;return Promise.all($).then(()=>{return v})}var hq=M("$ZodObject",($,U)=>{if(Y$.init($,U),!Object.getOwnPropertyDescriptor(U,"shape")?.get){let W=U.shape;Object.defineProperty(U,"shape",{get:()=>{let O={...W};return Object.defineProperty(U,"shape",{value:O}),O}})}let J=VU(()=>mq(U));X$($._zod,"propValues",()=>{let W=U.shape,O={};for(let Y in W){let Z=W[Y]._zod;if(Z.values){O[Y]??(O[Y]=new Set);for(let q of Z.values)O[Y].add(q)}}return O});let _=h1,z=U.catchall,K;$._zod.parse=(W,O)=>{K??(K=J.value);let Y=W.value;if(!_(Y))return W.issues.push({expected:"object",code:"invalid_type",input:Y,inst:$}),W;W.value={};let Z=[],q=K.shape;for(let X of K.keys){let B=q[X],L=B._zod.optout==="optional",P=B._zod.run({value:Y[X],issues:[]},O);if(P instanceof Promise)Z.push(P.then((k)=>mv(k,W,X,Y,L)));else mv(P,W,X,Y,L)}if(!z)return Z.length?Promise.all(Z).then(()=>W):W;return xq(Z,Y,W,O,J.value,$)}}),Jz=M("$ZodObjectJIT",($,U)=>{hq.init($,U);let v=$._zod.parse,J=VU(()=>mq(U)),_=(X)=>{let B=new jv(["shape","payload","ctx"]),L=J.value,P=(b)=>{let V=bv(b);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};B.write("const input = payload.value;");let k=Object.create(null),H=0;for(let b of L.keys)k[b]=`key_${H++}`;B.write("const newResult = {};");for(let b of L.keys){let V=k[b],E=bv(b),I=X[b]?._zod?.optout==="optional";if(B.write(`const ${V} = ${P(b)};`),I)B.write(`
116
+ if (${V}.issues.length) {
117
+ if (${E} in input) {
118
+ payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
119
119
  ...iss,
120
- path: iss.path ? [${T}, ...iss.path] : [${T}]
120
+ path: iss.path ? [${E}, ...iss.path] : [${E}]
121
121
  })));
122
122
  }
123
123
  }
124
124
 
125
- if (${N}.value === undefined) {
126
- if (${T} in input) {
127
- newResult[${T}] = undefined;
125
+ if (${V}.value === undefined) {
126
+ if (${E} in input) {
127
+ newResult[${E}] = undefined;
128
128
  }
129
129
  } else {
130
- newResult[${T}] = ${N}.value;
130
+ newResult[${E}] = ${V}.value;
131
131
  }
132
132
 
133
- `);else Y.write(`
134
- if (${N}.issues.length) {
135
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
133
+ `);else B.write(`
134
+ if (${V}.issues.length) {
135
+ payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
136
136
  ...iss,
137
- path: iss.path ? [${T}, ...iss.path] : [${T}]
137
+ path: iss.path ? [${E}, ...iss.path] : [${E}]
138
138
  })));
139
139
  }
140
140
 
141
- if (${N}.value === undefined) {
142
- if (${T} in input) {
143
- newResult[${T}] = undefined;
141
+ if (${V}.value === undefined) {
142
+ if (${E} in input) {
143
+ newResult[${E}] = undefined;
144
144
  }
145
145
  } else {
146
- newResult[${T}] = ${N}.value;
146
+ newResult[${E}] = ${V}.value;
147
147
  }
148
148
 
149
- `)}Y.write("payload.value = newResult;"),Y.write("return payload;");let L=Y.compile();return(I,N)=>L(k,I,N)},z,J=Kv,G=!J1.jitless,O=G&&sz.value,W=v.catchall,B;$._zod.parse=(k,Y)=>{B??(B=_.value);let F=k.value;if(!J(F))return k.issues.push({expected:"object",code:"invalid_type",input:F,inst:$}),k;if(G&&O&&Y?.async===!1&&Y.jitless!==!0){if(!z)z=U(v.shape);if(k=z(k,Y),!W)return k;return $W([],F,k,Y,B,$)}return g(k,Y)}});function cO($,v,g,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let U=$.filter((z)=>!T4(z));if(U.length===1)return v.value=U[0].value,U[0];return v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Q6(J,_,o$())))}),v}var Q1=Z("$ZodUnion",($,v)=>{z$.init($,v),Y$($._zod,"optin",()=>v.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),Y$($._zod,"optout",()=>v.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),Y$($._zod,"values",()=>{if(v.options.every((U)=>U._zod.values))return new Set(v.options.flatMap((U)=>Array.from(U._zod.values)));return}),Y$($._zod,"pattern",()=>{if(v.options.every((U)=>U._zod.pattern)){let U=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${U.map((z)=>b1(z.source)).join("|")})$`)}return});let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,G=[];for(let b of v.options){let O=b._zod.run({value:U.value,issues:[]},z);if(O instanceof Promise)G.push(O),J=!0;else{if(O.issues.length===0)return O;G.push(O)}}if(!J)return cO(G,U,$,z);return Promise.all(G).then((b)=>{return cO(b,U,$,z)})}});function iO($,v,g,_){let U=$.filter((z)=>z.issues.length===0);if(U.length===1)return v.value=U[0].value,v;if(U.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Q6(J,_,o$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:[],inclusive:!1});return v}var r8=Z("$ZodXor",($,v)=>{Q1.init($,v),v.inclusive=!1;let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,G=[];for(let b of v.options){let O=b._zod.run({value:U.value,issues:[]},z);if(O instanceof Promise)G.push(O),J=!0;else G.push(O)}if(!J)return iO(G,U,$,z);return Promise.all(G).then((b)=>{return iO(b,U,$,z)})}}),E8=Z("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,Q1.init($,v);let g=$._zod.parse;Y$($._zod,"propValues",()=>{let U={};for(let z of v.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(z)}"`);for(let[G,b]of Object.entries(J)){if(!U[G])U[G]=new Set;for(let O of b)U[G].add(O)}}return U});let _=ov(()=>{let U=v.options,z=new Map;for(let J of U){let G=J._zod.propValues?.[v.discriminator];if(!G||G.size===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(J)}"`);for(let b of G){if(z.has(b))throw Error(`Duplicate discriminator value "${String(b)}"`);z.set(b,J)}}return z});$._zod.parse=(U,z)=>{let J=U.value;if(!Kv(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let G=_.value.get(J?.[v.discriminator]);if(G)return G._zod.run(U,z);if(v.unionFallback)return g(U,z);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),U}}),m8=Z("$ZodIntersection",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value,z=v.left._zod.run({value:U,issues:[]},_),J=v.right._zod.run({value:U,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([b,O])=>{return xO(g,b,O)});return xO(g,z,J)}});function eJ($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(D4($)&&D4(v)){let g=Object.keys(v),_=Object.keys($).filter((z)=>g.indexOf(z)!==-1),U={...$,...v};for(let z of _){let J=eJ($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};U[z]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let g=[];for(let _=0;_<$.length;_++){let U=$[_],z=v[_],J=eJ(U,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};g.push(J.data)}return{valid:!0,data:g}}return{valid:!1,mergeErrorPath:[]}}function xO($,v,g){let _=new Map,U;for(let G of v.issues)if(G.code==="unrecognized_keys"){U??(U=G);for(let b of G.keys){if(!_.has(b))_.set(b,{});_.get(b).l=!0}}else $.issues.push(G);for(let G of g.issues)if(G.code==="unrecognized_keys")for(let b of G.keys){if(!_.has(b))_.set(b,{});_.get(b).r=!0}else $.issues.push(G);let z=[..._].filter(([,G])=>G.l&&G.r).map(([G])=>G);if(z.length&&U)$.issues.push({...U,keys:z});if(T4($))return $;let J=eJ(v.value,g.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var h_=Z("$ZodTuple",($,v)=>{z$.init($,v);let g=v.items;$._zod.parse=(_,U)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],G=[...g].reverse().findIndex((W)=>W._zod.optin!=="optional"),b=G===-1?0:g.length-G;if(!v.rest){let W=z.length>g.length,B=z.length<b-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:g.length,inclusive:!0}:{code:"too_small",minimum:g.length},input:z,inst:$,origin:"array"}),_}let O=-1;for(let W of g){if(O++,O>=z.length){if(O>=b)continue}let B=W._zod.run({value:z[O],issues:[]},U);if(B instanceof Promise)J.push(B.then((k)=>f_(k,_,O)));else f_(B,_,O)}if(v.rest){let W=z.slice(g.length);for(let B of W){O++;let k=v.rest._zod.run({value:B,issues:[]},U);if(k instanceof Promise)J.push(k.then((Y)=>f_(Y,_,O)));else f_(k,_,O)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function f_($,v,g){if($.issues.length)v.issues.push(...N6(g,$.issues));v.value[g]=$.value}var c8=Z("$ZodRecord",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!D4(U))return g.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),g;let z=[],J=v.keyType._zod.values;if(J){g.value={};let G=new Set;for(let O of J)if(typeof O==="string"||typeof O==="number"||typeof O==="symbol"){G.add(typeof O==="number"?O.toString():O);let W=v.valueType._zod.run({value:U[O],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...N6(O,B.issues));g.value[O]=B.value}));else{if(W.issues.length)g.issues.push(...N6(O,W.issues));g.value[O]=W.value}}let b;for(let O in U)if(!G.has(O))b=b??[],b.push(O);if(b&&b.length>0)g.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:b})}else{g.value={};for(let G of Reflect.ownKeys(U)){if(G==="__proto__")continue;let b=v.keyType._zod.run({value:G,issues:[]},_);if(b instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof G==="string"&&L1.test(G)&&b.issues.length){let B=v.keyType._zod.run({value:Number(G),issues:[]},_);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)b=B}if(b.issues.length){if(v.mode==="loose")g.value[G]=U[G];else g.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map((B)=>Q6(B,_,o$())),input:G,path:[G],inst:$});continue}let W=v.valueType._zod.run({value:U[G],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...N6(G,B.issues));g.value[b.value]=B.value}));else{if(W.issues.length)g.issues.push(...N6(G,W.issues));g.value[b.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>g);return g}}),i8=Z("$ZodMap",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Map))return g.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),g;let z=[];g.value=new Map;for(let[J,G]of U){let b=v.keyType._zod.run({value:J,issues:[]},_),O=v.valueType._zod.run({value:G,issues:[]},_);if(b instanceof Promise||O instanceof Promise)z.push(Promise.all([b,O]).then(([W,B])=>{hO(W,B,g,J,U,$,_)}));else hO(b,O,g,J,U,$,_)}if(z.length)return Promise.all(z).then(()=>g);return g}});function hO($,v,g,_,U,z,J){if($.issues.length)if(O1.has(typeof _))g.issues.push(...N6(_,$.issues));else g.issues.push({code:"invalid_key",origin:"map",input:U,inst:z,issues:$.issues.map((G)=>Q6(G,J,o$()))});if(v.issues.length)if(O1.has(typeof _))g.issues.push(...N6(_,v.issues));else g.issues.push({origin:"map",code:"invalid_element",input:U,inst:z,key:_,issues:v.issues.map((G)=>Q6(G,J,o$()))});g.value.set($.value,v.value)}var x8=Z("$ZodSet",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Set))return g.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),g;let z=[];g.value=new Set;for(let J of U){let G=v.valueType._zod.run({value:J,issues:[]},_);if(G instanceof Promise)z.push(G.then((b)=>lO(b,g)));else lO(G,g)}if(z.length)return Promise.all(z).then(()=>g);return g}});function lO($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var h8=Z("$ZodEnum",($,v)=>{z$.init($,v);let g=K1(v.entries),_=new Set(g);$._zod.values=_,$._zod.pattern=new RegExp(`^(${g.filter((U)=>O1.has(typeof U)).map((U)=>typeof U==="string"?u6(U):U.toString()).join("|")})$`),$._zod.parse=(U,z)=>{let J=U.value;if(_.has(J))return U;return U.issues.push({code:"invalid_value",values:g,input:J,inst:$}),U}}),l8=Z("$ZodLiteral",($,v)=>{if(z$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let g=new Set(v.values);$._zod.values=g,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?u6(_):_?u6(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,U)=>{let z=_.value;if(g.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),p8=Z("$ZodFile",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(U instanceof File)return g;return g.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),g}}),o8=Z("$ZodTransform",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new Gv($.constructor.name);let U=v.transform(g.value,g);if(_.async)return(U instanceof Promise?U:Promise.resolve(U)).then((J)=>{return g.value=J,g});if(U instanceof Promise)throw new t6;return g.value=U,g}});function pO($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var l_=Z("$ZodOptional",($,v)=>{z$.init($,v),$._zod.optin="optional",$._zod.optout="optional",Y$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,void 0]):void 0}),Y$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${b1(g.source)})?$`):void 0}),$._zod.parse=(g,_)=>{if(v.innerType._zod.optin==="optional"){let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>pO(z,g.value));return pO(U,g.value)}if(g.value===void 0)return g;return v.innerType._zod.run(g,_)}}),n8=Z("$ZodExactOptional",($,v)=>{l_.init($,v),Y$($._zod,"values",()=>v.innerType._zod.values),Y$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(g,_)=>{return v.innerType._zod.run(g,_)}}),t8=Z("$ZodNullable",($,v)=>{z$.init($,v),Y$($._zod,"optin",()=>v.innerType._zod.optin),Y$($._zod,"optout",()=>v.innerType._zod.optout),Y$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${b1(g.source)}|null)$`):void 0}),Y$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(g,_)=>{if(g.value===null)return g;return v.innerType._zod.run(g,_)}}),d8=Z("$ZodDefault",($,v)=>{z$.init($,v),$._zod.optin="optional",Y$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)return g.value=v.defaultValue,g;let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>oO(z,v));return oO(U,v)}});function oO($,v){if($.value===void 0)$.value=v.defaultValue;return $}var a8=Z("$ZodPrefault",($,v)=>{z$.init($,v),$._zod.optin="optional",Y$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)g.value=v.defaultValue;return v.innerType._zod.run(g,_)}}),s8=Z("$ZodNonOptional",($,v)=>{z$.init($,v),Y$($._zod,"values",()=>{let g=v.innerType._zod.values;return g?new Set([...g].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(g,_)=>{let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>nO(z,$));return nO(U,$)}});function nO($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var e8=Z("$ZodSuccess",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new Gv("ZodSuccess");let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{return g.value=z.issues.length===0,g});return g.value=U.issues.length===0,g}}),$9=Z("$ZodCatch",($,v)=>{z$.init($,v),Y$($._zod,"optin",()=>v.innerType._zod.optin),Y$($._zod,"optout",()=>v.innerType._zod.optout),Y$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{if(g.value=z.value,z.issues.length)g.value=v.catchValue({...g,error:{issues:z.issues.map((J)=>Q6(J,_,o$()))},input:g.value}),g.issues=[];return g});if(g.value=U.value,U.issues.length)g.value=v.catchValue({...g,error:{issues:U.issues.map((z)=>Q6(z,_,o$()))},input:g.value}),g.issues=[];return g}}),v9=Z("$ZodNaN",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{if(typeof g.value!=="number"||!Number.isNaN(g.value))return g.issues.push({input:g.value,inst:$,expected:"nan",code:"invalid_type"}),g;return g}}),U9=Z("$ZodPipe",($,v)=>{z$.init($,v),Y$($._zod,"values",()=>v.in._zod.values),Y$($._zod,"optin",()=>v.in._zod.optin),Y$($._zod,"optout",()=>v.out._zod.optout),Y$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>r_(J,v.in,_));return r_(z,v.in,_)}let U=v.in._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>r_(z,v.out,_));return r_(U,v.out,_)}});function r_($,v,g){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},g)}var w1=Z("$ZodCodec",($,v)=>{z$.init($,v),Y$($._zod,"values",()=>v.in._zod.values),Y$($._zod,"optin",()=>v.in._zod.optin),Y$($._zod,"optout",()=>v.out._zod.optout),Y$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>E_(J,v,_));return E_(z,v,_)}else{let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>E_(J,v,_));return E_(z,v,_)}}});function E_($,v,g){if($.issues.length)return $.aborted=!0,$;if((g.direction||"forward")==="forward"){let U=v.transform($.value,$);if(U instanceof Promise)return U.then((z)=>m_($,z,v.out,g));return m_($,U,v.out,g)}else{let U=v.reverseTransform($.value,$);if(U instanceof Promise)return U.then((z)=>m_($,z,v.in,g));return m_($,U,v.in,g)}}function m_($,v,g,_){if($.issues.length)return $.aborted=!0,$;return g._zod.run({value:v,issues:$.issues},_)}var g9=Z("$ZodReadonly",($,v)=>{z$.init($,v),Y$($._zod,"propValues",()=>v.innerType._zod.propValues),Y$($._zod,"values",()=>v.innerType._zod.values),Y$($._zod,"optin",()=>v.innerType?._zod?.optin),Y$($._zod,"optout",()=>v.innerType?._zod?.optout),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then(tO);return tO(U)}});function tO($){return $.value=Object.freeze($.value),$}var _9=Z("$ZodTemplateLiteral",($,v)=>{z$.init($,v);let g=[];for(let _ of v.parts)if(typeof _==="object"&&_!==null){if(!_._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[..._._zod.traits].shift()}`);let U=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!U)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=U.startsWith("^")?1:0,J=U.endsWith("$")?U.length-1:U.length;g.push(U.slice(z,J))}else if(_===null||$J.has(typeof _))g.push(u6(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${g.join("")}$`),$._zod.parse=(_,U)=>{if(typeof _.value!=="string")return _.issues.push({input:_.value,inst:$,expected:"string",code:"invalid_type"}),_;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(_.value))return _.issues.push({input:_.value,inst:$,code:"invalid_format",format:v.format??"template_literal",pattern:$._zod.pattern.source}),_;return _}}),z9=Z("$ZodFunction",($,v)=>{return z$.init($,v),$._def=v,$._zod.def=v,$.implement=(g)=>{if(typeof g!=="function")throw Error("implement() must be called with a function");return function(..._){let U=$._def.input?P1($._def.input,_):_,z=Reflect.apply(g,this,U);if($._def.output)return P1($._def.output,z);return z}},$.implementAsync=(g)=>{if(typeof g!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let U=$._def.input?await X1($._def.input,_):_,z=await Reflect.apply(g,this,U);if($._def.output)return await X1($._def.output,z);return z}},$._zod.parse=(g,_)=>{if(typeof g.value!=="function")return g.issues.push({code:"invalid_type",expected:"function",input:g.value,inst:$}),g;if($._def.output&&$._def.output._zod.def.type==="promise")g.value=$.implementAsync(g.value);else g.value=$.implement(g.value);return g},$.input=(...g)=>{let _=$.constructor;if(Array.isArray(g[0]))return new _({type:"function",input:new h_({type:"tuple",items:g[0],rest:g[1]}),output:$._def.output});return new _({type:"function",input:g[0],output:$._def.output})},$.output=(g)=>{return new $.constructor({type:"function",input:$._def.input,output:g})},$}),J9=Z("$ZodPromise",($,v)=>{z$.init($,v),$._zod.parse=(g,_)=>{return Promise.resolve(g.value).then((U)=>v.innerType._zod.run({value:U,issues:[]},_))}}),G9=Z("$ZodLazy",($,v)=>{z$.init($,v),Y$($._zod,"innerType",()=>v.getter()),Y$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),Y$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),Y$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),Y$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(g,_)=>{return $._zod.innerType._zod.run(g,_)}}),K9=Z("$ZodCustom",($,v)=>{T$.init($,v),z$.init($,v),$._zod.parse=(g,_)=>{return g},$._zod.check=(g)=>{let _=g.value,U=v.fn(_);if(U instanceof Promise)return U.then((z)=>dO(z,g,_,$));dO(U,g,_,$);return}});function dO($,v,g,_){if(!$){let U={code:"custom",input:g,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)U.params=_._zod.def.params;v.issues.push(nv(U))}}var y1={};$4(y1,{zhTW:()=>e9,zhCN:()=>s9,yo:()=>$3,vi:()=>a9,uz:()=>d9,ur:()=>t9,uk:()=>N1,ua:()=>n9,tr:()=>o9,th:()=>p9,ta:()=>l9,sv:()=>h9,sl:()=>x9,ru:()=>i9,pt:()=>c9,ps:()=>E9,pl:()=>m9,ota:()=>r9,no:()=>f9,nl:()=>V9,ms:()=>C9,mk:()=>u9,lt:()=>j9,ko:()=>T9,km:()=>M1,kh:()=>D9,ka:()=>R9,ja:()=>y9,it:()=>N9,is:()=>S9,id:()=>M9,hy:()=>A9,hu:()=>w9,he:()=>Q9,frCA:()=>I9,fr:()=>Z9,fi:()=>F9,fa:()=>L9,es:()=>H9,eo:()=>X9,en:()=>A1,de:()=>P9,da:()=>q9,cs:()=>k9,ca:()=>Y9,bg:()=>B9,be:()=>W9,az:()=>O9,ar:()=>b9});var FH=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(U){return $[U]??null}let g={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${U.expected}، ولكن تم إدخال ${G}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${G}`}case"invalid_value":if(U.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${j(U.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${U.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${g[z.format]??U.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${U.divisor}`;case"unrecognized_keys":return`معرف${U.keys.length>1?"ات":""} غريب${U.keys.length>1?"ة":""}: ${Q(U.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${U.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${U.origin}`;default:return"مدخل غير مقبول"}}};function b9(){return{localeError:FH()}}var ZH=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Yanlış dəyər: gözlənilən instanceof ${U.expected}, daxil olan ${G}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${G}`}case"invalid_value":if(U.values.length===1)return`Yanlış dəyər: gözlənilən ${j(U.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${g[z.format]??U.format}`}case"not_multiple_of":return`Yanlış ədəd: ${U.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${U.keys.length>1?"lar":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${U.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function O9(){return{localeError:ZH()}}function UW($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var IH=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function v(U){return $[U]??null}let g={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},_={nan:"NaN",number:"лік",array:"масіў"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Няправільны ўвод: чакаўся instanceof ${U.expected}, атрымана ${G}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${G}`}case"invalid_value":if(U.values.length===1)return`Няправільны ўвод: чакалася ${j(U.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),b=UW(G,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна ${J.verb} ${z}${U.maximum.toString()} ${b}`}return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна быць ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),b=UW(G,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${U.origin} павінна ${J.verb} ${z}${U.minimum.toString()} ${b}`}return`Занадта малы: чакалася, што ${U.origin} павінна быць ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${g[z.format]??U.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${U.keys.length>1?"ключы":"ключ"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${U.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${U.origin}`;default:return"Няправільны ўвод"}}};function W9(){return{localeError:IH()}}var QH=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(U){return $[U]??null}let g={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Невалиден вход: очакван instanceof ${U.expected}, получен ${G}`;return`Невалиден вход: очакван ${z}, получен ${G}`}case"invalid_value":if(U.values.length===1)return`Невалиден вход: очакван ${j(U.values[0])}`;return`Невалидна опция: очаквано едно от ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Твърде голямо: очаква се ${U.origin??"стойност"} да съдържа ${z}${U.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${U.origin??"стойност"} да бъде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Твърде малко: очаква се ${U.origin} да съдържа ${z}${U.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${U.origin} да бъде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let J="Невалиден";if(z.format==="emoji")J="Невалидно";if(z.format==="datetime")J="Невалидно";if(z.format==="date")J="Невалидна";if(z.format==="time")J="Невалидно";if(z.format==="duration")J="Невалидна";return`${J} ${g[z.format]??U.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${U.divisor}`;case"unrecognized_keys":return`Неразпознат${U.keys.length>1?"и":""} ключ${U.keys.length>1?"ове":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${U.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${U.origin}`;default:return"Невалиден вход"}}};function B9(){return{localeError:QH()}}var wH=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipus invàlid: s'esperava instanceof ${U.expected}, s'ha rebut ${G}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${G}`}case"invalid_value":if(U.values.length===1)return`Valor invàlid: s'esperava ${j(U.values[0])}`;return`Opció invàlida: s'esperava una de ${Q(U.values," o ")}`;case"too_big":{let z=U.inclusive?"com a màxim":"menys de",J=v(U.origin);if(J)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingués ${z} ${U.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"com a mínim":"més de",J=v(U.origin);if(J)return`Massa petit: s'esperava que ${U.origin} contingués ${z} ${U.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${g[z.format]??U.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${U.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${U.origin}`;default:return"Entrada invàlida"}}};function Y9(){return{localeError:wH()}}var AH=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function v(U){return $[U]??null}let g={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},_={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neplatný vstup: očekáváno instanceof ${U.expected}, obdrženo ${G}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${G}`}case"invalid_value":if(U.values.length===1)return`Neplatný vstup: očekáváno ${j(U.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí mít ${z}${U.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí být ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí mít ${z}${U.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí být ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${g[z.format]??U.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${U.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${Q(U.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${U.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${U.origin}`;default:return"Neplatný vstup"}}};function k9(){return{localeError:AH()}}var MH=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldigt input: forventede instanceof ${U.expected}, fik ${G}`;return`Ugyldigt input: forventede ${z}, fik ${G}`}case"invalid_value":if(U.values.length===1)return`Ugyldig værdi: forventede ${j(U.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`For stor: forventede ${G??"value"} ${J.verb} ${z} ${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${G??"value"} havde ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`For lille: forventede ${G} ${J.verb} ${z} ${U.minimum.toString()} ${J.unit}`;return`For lille: forventede ${G} havde ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${U.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${U.origin}`;default:return"Ugyldigt input"}}};function q9(){return{localeError:MH()}}var SH=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function v(U){return $[U]??null}let g={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},_={nan:"NaN",number:"Zahl",array:"Array"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ungültige Eingabe: erwartet instanceof ${U.expected}, erhalten ${G}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${G}`}case"invalid_value":if(U.values.length===1)return`Ungültige Eingabe: erwartet ${j(U.values[0])}`;return`Ungültige Option: erwartet eine von ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ist`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ist`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${U.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${U.origin}`;default:return"Ungültige Eingabe"}}};function P9(){return{localeError:SH()}}var NH=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;return`Invalid input: expected ${z}, received ${G}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${j(U.values[0])}`;return`Invalid option: expected one of ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Too big: expected ${U.origin??"value"} to have ${z}${U.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Too small: expected ${U.origin} to have ${z}${U.minimum.toString()} ${J.unit}`;return`Too small: expected ${U.origin} to be ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function A1(){return{localeError:NH()}}var yH=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(U){return $[U]??null}let g={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},_={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nevalida enigo: atendiĝis instanceof ${U.expected}, riceviĝis ${G}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${G}`}case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendiĝis ${j(U.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Tro malgranda: atendiĝis ke ${U.origin} havu ${z}${U.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${U.origin} estu ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${g[z.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} ŝlosilo${U.keys.length>1?"j":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function X9(){return{localeError:yH()}}var RH=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrada inválida: se esperaba instanceof ${U.expected}, recibido ${G}`;return`Entrada inválida: se esperaba ${z}, recibido ${G}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: se esperaba ${j(U.values[0])}`;return`Opción inválida: se esperaba una de ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`Demasiado grande: se esperaba que ${G??"valor"} tuviera ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${G??"valor"} fuera ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`Demasiado pequeño: se esperaba que ${G} tuviera ${z}${U.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${G} fuera ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${g[z.format]??U.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[U.origin]??U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[U.origin]??U.origin}`;default:return"Entrada inválida"}}};function H9(){return{localeError:RH()}}var DH=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(U){return $[U]??null}let g={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},_={nan:"NaN",number:"عدد",array:"آرایه"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ورودی نامعتبر: می‌بایست instanceof ${U.expected} می‌بود، ${G} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${G} دریافت شد`}case"invalid_value":if(U.values.length===1)return`ورودی نامعتبر: می‌بایست ${j(U.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${Q(U.values,"|")} می‌بود`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} باشد`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} باشد`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${g[z.format]??U.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${U.divisor} باشد`;case"unrecognized_keys":return`کلید${U.keys.length>1?"های":""} ناشناس: ${Q(U.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${U.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${U.origin}`;default:return"ورودی نامعتبر"}}};function L9(){return{localeError:DH()}}var TH=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function v(U){return $[U]??null}let g={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Virheellinen tyyppi: odotettiin instanceof ${U.expected}, oli ${G}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${G}`}case"invalid_value":if(U.values.length===1)return`Virheellinen syöte: täytyy olla ${j(U.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${U.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${U.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${g[z.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Q(U.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function F9(){return{localeError:TH()}}var jH=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN",number:"nombre",array:"tableau"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : instanceof ${U.expected} attendu, ${G} reçu`;return`Entrée invalide : ${z} attendu, ${G} reçu`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : ${j(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${Q(U.values,"|")} attendue`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Trop grand : ${U.origin??"valeur"} doit ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${U.origin??"valeur"} doit être ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Trop petit : ${U.origin} doit ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : ${U.origin} doit être ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${Q(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function Z9(){return{localeError:jH()}}var uH=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : attendu instanceof ${U.expected}, reçu ${G}`;return`Entrée invalide : attendu ${z}, reçu ${G}`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : attendu ${j(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"≤":"<",J=v(U.origin);if(J)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${z}${U.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"≥":">",J=v(U.origin);if(J)return`Trop petit : attendu que ${U.origin} ait ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${U.origin} soit ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${Q(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function I9(){return{localeError:uH()}}var CH=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},v={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},g=(O)=>O?$[O]:void 0,_=(O)=>{let W=g(O);if(W)return W.label;return O??$.unknown.label},U=(O)=>`ה${_(O)}`,z=(O)=>{return(g(O)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},J=(O)=>{if(!O)return null;return v[O]??null},G={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},b={nan:"NaN"};return(O)=>{switch(O.code){case"invalid_type":{let W=O.expected,B=b[W??""]??_(W),k=C(O.input),Y=b[k]??$[k]?.label??k;if(/^[A-Z]/.test(O.expected))return`קלט לא תקין: צריך להיות instanceof ${O.expected}, התקבל ${Y}`;return`קלט לא תקין: צריך להיות ${B}, התקבל ${Y}`}case"invalid_value":{if(O.values.length===1)return`ערך לא תקין: הערך חייב להיות ${j(O.values[0])}`;let W=O.values.map((Y)=>j(Y));if(O.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let B=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${B}`}case"too_big":{let W=J(O.origin),B=U(O.origin??"value");if(O.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${O.maximum.toString()} ${W?.unit??""} ${O.inclusive?"או פחות":"לכל היותר"}`.trim();if(O.origin==="number"){let F=O.inclusive?`קטן או שווה ל-${O.maximum}`:`קטן מ-${O.maximum}`;return`גדול מדי: ${B} צריך להיות ${F}`}if(O.origin==="array"||O.origin==="set"){let F=O.origin==="set"?"צריכה":"צריך",X=O.inclusive?`${O.maximum} ${W?.unit??""} או פחות`:`פחות מ-${O.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${F} להכיל ${X}`.trim()}let k=O.inclusive?"<=":"<",Y=z(O.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${B} ${Y} ${k}${O.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${B} ${Y} ${k}${O.maximum.toString()}`}case"too_small":{let W=J(O.origin),B=U(O.origin??"value");if(O.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${O.minimum.toString()} ${W?.unit??""} ${O.inclusive?"או יותר":"לפחות"}`.trim();if(O.origin==="number"){let F=O.inclusive?`גדול או שווה ל-${O.minimum}`:`גדול מ-${O.minimum}`;return`קטן מדי: ${B} צריך להיות ${F}`}if(O.origin==="array"||O.origin==="set"){let F=O.origin==="set"?"צריכה":"צריך";if(O.minimum===1&&O.inclusive){let H=O.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${F} להכיל ${H}`}let X=O.inclusive?`${O.minimum} ${W?.unit??""} או יותר`:`יותר מ-${O.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${F} להכיל ${X}`.trim()}let k=O.inclusive?">=":">",Y=z(O.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${B} ${Y} ${k}${O.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${B} ${Y} ${k}${O.minimum.toString()}`}case"invalid_format":{let W=O;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let B=G[W.format],k=B?.label??W.format,F=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${F}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${O.divisor}`;case"unrecognized_keys":return`מפתח${O.keys.length>1?"ות":""} לא מזוה${O.keys.length>1?"ים":"ה"}: ${Q(O.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${U(O.origin??"array")}`;default:return"קלט לא תקין"}}};function Q9(){return{localeError:CH()}}var VH=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(U){return $[U]??null}let g={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},_={nan:"NaN",number:"szám",array:"tömb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Érvénytelen bemenet: a várt érték instanceof ${U.expected}, a kapott érték ${G}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${G}`}case"invalid_value":if(U.values.length===1)return`Érvénytelen bemenet: a várt érték ${j(U.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Túl nagy: ${U.origin??"érték"} mérete túl nagy ${z}${U.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${U.origin??"érték"} túl nagy: ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Túl kicsi: a bemeneti érték ${U.origin} mérete túl kicsi ${z}${U.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${U.origin} túl kicsi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${g[z.format]??U.format}`}case"not_multiple_of":return`Érvénytelen szám: ${U.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${U.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${U.origin}`;default:return"Érvénytelen bemenet"}}};function w9(){return{localeError:VH()}}function gW($,v,g){return Math.abs($)===1?v:g}function vU($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],g=$[$.length-1];return $+(v.includes(g)?"ն":"ը")}var fH=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(U){return $[U]??null}let g={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},_={nan:"NaN",number:"թիվ",array:"զանգված"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${U.expected}, ստացվել է ${G}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${G}`}case"invalid_value":if(U.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${j(U.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),b=gW(G,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${vU(U.origin??"արժեք")} կունենա ${z}${U.maximum.toString()} ${b}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${vU(U.origin??"արժեք")} լինի ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),b=gW(G,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${vU(U.origin)} կունենա ${z}${U.minimum.toString()} ${b}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${vU(U.origin)} լինի ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${g[z.format]??U.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${U.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${U.keys.length>1?"ներ":""}. ${Q(U.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${vU(U.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${vU(U.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function A9(){return{localeError:fH()}}var rH=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak valid: diharapkan instanceof ${U.expected}, diterima ${G}`;return`Input tidak valid: diharapkan ${z}, diterima ${G}`}case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${j(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${g[z.format]??U.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${U.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${U.origin}`;default:return"Input tidak valid"}}};function M9(){return{localeError:rH()}}var EH=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function v(U){return $[U]??null}let g={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},_={nan:"NaN",number:"númer",array:"fylki"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Rangt gildi: Þú slóst inn ${G} þar sem á að vera instanceof ${U.expected}`;return`Rangt gildi: Þú slóst inn ${G} þar sem á að vera ${z}`}case"invalid_value":if(U.values.length===1)return`Rangt gildi: gert ráð fyrir ${j(U.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} hafi ${z}${U.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} sé ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Of lítið: gert er ráð fyrir að ${U.origin} hafi ${z}${U.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${U.origin} sé ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${g[z.format]??U.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${U.divisor}`;case"unrecognized_keys":return`Óþekkt ${U.keys.length>1?"ir lyklar":"ur lykill"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${U.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${U.origin}`;default:return"Rangt gildi"}}};function S9(){return{localeError:EH()}}var mH=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(U){return $[U]??null}let g={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"numero",array:"vettore"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input non valido: atteso instanceof ${U.expected}, ricevuto ${G}`;return`Input non valido: atteso ${z}, ricevuto ${G}`}case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${j(U.values[0])}`;return`Opzione non valida: atteso uno tra ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Troppo grande: ${U.origin??"valore"} deve avere ${z}${U.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Troppo piccolo: ${U.origin} deve avere ${z}${U.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${U.divisor}`;case"unrecognized_keys":return`Chiav${U.keys.length>1?"i":"e"} non riconosciut${U.keys.length>1?"e":"a"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${U.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${U.origin}`;default:return"Input non valido"}}};function N9(){return{localeError:mH()}}var cH=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(U){return $[U]??null}let g={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},_={nan:"NaN",number:"数値",array:"配列"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無効な入力: instanceof ${U.expected}が期待されましたが、${G}が入力されました`;return`無効な入力: ${z}が期待されましたが、${G}が入力されました`}case"invalid_value":if(U.values.length===1)return`無効な入力: ${j(U.values[0])}が期待されました`;return`無効な選択: ${Q(U.values,"、")}のいずれかである必要があります`;case"too_big":{let z=U.inclusive?"以下である":"より小さい",J=v(U.origin);if(J)return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${z}必要があります`}case"too_small":{let z=U.inclusive?"以上である":"より大きい",J=v(U.origin);if(J)return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${g[z.format]??U.format}`}case"not_multiple_of":return`無効な数値: ${U.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${U.keys.length>1?"群":""}: ${Q(U.keys,"、")}`;case"invalid_key":return`${U.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${U.origin}内の無効な値`;default:return"無効な入力"}}};function y9(){return{localeError:cH()}}var iH=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(U){return $[U]??null}let g={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},_={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${U.expected}, მიღებული ${G}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${G}`}case"invalid_value":if(U.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${j(U.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${Q(U.values,"|")}-დან`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} იყოს ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} იყოს ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${g[z.format]??U.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${U.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${U.keys.length>1?"ები":"ი"}: ${Q(U.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${U.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${U.origin}-ში`;default:return"არასწორი შეყვანა"}}};function R9(){return{localeError:iH()}}var xH=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(U){return $[U]??null}let g={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},_={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${U.expected} ប៉ុន្តែទទួលបាន ${G}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${G}`}case"invalid_value":if(U.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${j(U.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${g[z.format]??U.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${U.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${Q(U.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function M1(){return{localeError:xH()}}function D9(){return M1()}var hH=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`잘못된 입력: 예상 타입은 instanceof ${U.expected}, 받은 타입은 ${G}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${G}입니다`}case"invalid_value":if(U.values.length===1)return`잘못된 입력: 값은 ${j(U.values[0])} 이어야 합니다`;return`잘못된 옵션: ${Q(U.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=U.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",G=v(U.origin),b=G?.unit??"요소";if(G)return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()}${b} ${z}${J}`;return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()} ${z}${J}`}case"too_small":{let z=U.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",G=v(U.origin),b=G?.unit??"요소";if(G)return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()}${b} ${z}${J}`;return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${g[z.format]??U.format}`}case"not_multiple_of":return`잘못된 숫자: ${U.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${Q(U.keys,", ")}`;case"invalid_key":return`잘못된 키: ${U.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${U.origin}`;default:return"잘못된 입력"}}};function T9(){return{localeError:hH()}}var S1=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function _W($){let v=Math.abs($),g=v%10,_=v%100;if(_>=11&&_<=19||g===0)return"many";if(g===1)return"one";return"few"}var lH=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function v(U,z,J,G){let b=$[U]??null;if(b===null)return b;return{unit:b.unit[z],verb:b.verb[G][J?"inclusive":"notInclusive"]}}let g={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},_={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Gautas tipas ${G}, o tikėtasi - instanceof ${U.expected}`;return`Gautas tipas ${G}, o tikėtasi - ${z}`}case"invalid_value":if(U.values.length===1)return`Privalo būti ${j(U.values[0])}`;return`Privalo būti vienas iš ${Q(U.values,"|")} pasirinkimų`;case"too_big":{let z=_[U.origin]??U.origin,J=v(U.origin,_W(Number(U.maximum)),U.inclusive??!1,"smaller");if(J?.verb)return`${S1(z??U.origin??"reikšmė")} ${J.verb} ${U.maximum.toString()} ${J.unit??"elementų"}`;let G=U.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${S1(z??U.origin??"reikšmė")} turi būti ${G} ${U.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[U.origin]??U.origin,J=v(U.origin,_W(Number(U.minimum)),U.inclusive??!1,"bigger");if(J?.verb)return`${S1(z??U.origin??"reikšmė")} ${J.verb} ${U.minimum.toString()} ${J.unit??"elementų"}`;let G=U.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${S1(z??U.origin??"reikšmė")} turi būti ${G} ${U.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${g[z.format]??U.format}`}case"not_multiple_of":return`Skaičius privalo būti ${U.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${U.keys.length>1?"i":"as"} rakt${U.keys.length>1?"ai":"as"}: ${Q(U.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[U.origin]??U.origin;return`${S1(z??U.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function j9(){return{localeError:lH()}}var pH=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(U){return $[U]??null}let g={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},_={nan:"NaN",number:"број",array:"низа"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Грешен внес: се очекува instanceof ${U.expected}, примено ${G}`;return`Грешен внес: се очекува ${z}, примено ${G}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${j(U.values[0])}`;return`Грешана опција: се очекува една ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Премногу голем: се очекува ${U.origin??"вредноста"} да има ${z}${U.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${U.origin??"вредноста"} да биде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Премногу мал: се очекува ${U.origin} да има ${z}${U.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${U.origin} да биде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${U.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${U.origin}`;default:return"Грешен внес"}}};function u9(){return{localeError:pH()}}var oH=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"nombor"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak sah: dijangka instanceof ${U.expected}, diterima ${G}`;return`Input tidak sah: dijangka ${z}, diterima ${G}`}case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${j(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: dijangka ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${g[z.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Q(U.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${U.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${U.origin}`;default:return"Input tidak sah"}}};function C9(){return{localeError:oH()}}var nH=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(U){return $[U]??null}let g={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},_={nan:"NaN",number:"getal"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ongeldige invoer: verwacht instanceof ${U.expected}, ontving ${G}`;return`Ongeldige invoer: verwacht ${z}, ontving ${G}`}case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${j(U.values[0])}`;return`Ongeldige optie: verwacht één van ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=U.origin==="date"?"laat":U.origin==="string"?"lang":"groot";if(J)return`Te ${G}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${G}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} is`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=U.origin==="date"?"vroeg":U.origin==="string"?"kort":"klein";if(J)return`Te ${G}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${G}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} is`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${U.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${U.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${U.origin}`;default:return"Ongeldige invoer"}}};function V9(){return{localeError:nH()}}var tH=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"tall",array:"liste"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldig input: forventet instanceof ${U.expected}, fikk ${G}`;return`Ugyldig input: forventet ${z}, fikk ${G}`}case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${j(U.values[0])}`;return`Ugyldig valg: forventet en av ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function f9(){return{localeError:tH()}}var dH=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},_={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Fâsit giren: umulan instanceof ${U.expected}, alınan ${G}`;return`Fâsit giren: umulan ${z}, alınan ${G}`}case"invalid_value":if(U.values.length===1)return`Fâsit giren: umulan ${j(U.values[0])}`;return`Fâsit tercih: mûteberler ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} olmalıydı.`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${g[z.format]??U.format}`}case"not_multiple_of":return`Fâsit sayı: ${U.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${U.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function r9(){return{localeError:dH()}}var aH=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(U){return $[U]??null}let g={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},_={nan:"NaN",number:"عدد",array:"ارې"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ناسم ورودي: باید instanceof ${U.expected} وای, مګر ${G} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${G} ترلاسه شو`}case"invalid_value":if(U.values.length===1)return`ناسم ورودي: باید ${j(U.values[0])} وای`;return`ناسم انتخاب: باید یو له ${Q(U.values,"|")} څخه وای`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} وي`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} وي`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${g[z.format]??U.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${U.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${U.keys.length>1?"کلیډونه":"کلیډ"}: ${Q(U.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${U.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${U.origin} کې`;default:return"ناسمه ورودي"}}};function E9(){return{localeError:aH()}}var sH=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function v(U){return $[U]??null}let g={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},_={nan:"NaN",number:"liczba",array:"tablica"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${U.expected}, otrzymano ${G}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${G}`}case"invalid_value":if(U.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${j(U.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Za duża wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Za mała wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${g[z.format]??U.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${U.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${U.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function m9(){return{localeError:sH()}}var eH=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(U){return $[U]??null}let g={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",number:"número",null:"nulo"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipo inválido: esperado instanceof ${U.expected}, recebido ${G}`;return`Tipo inválido: esperado ${z}, recebido ${G}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: esperado ${j(U.values[0])}`;return`Opção inválida: esperada uma das ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Muito pequeno: esperado que ${U.origin} tivesse ${z}${U.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${g[z.format]??U.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Chave inválida em ${U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${U.origin}`;default:return"Campo inválido"}}};function c9(){return{localeError:eH()}}function zW($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var $L=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function v(U){return $[U]??null}let g={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},_={nan:"NaN",number:"число",array:"массив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неверный ввод: ожидалось instanceof ${U.expected}, получено ${G}`;return`Неверный ввод: ожидалось ${z}, получено ${G}`}case"invalid_value":if(U.values.length===1)return`Неверный ввод: ожидалось ${j(U.values[0])}`;return`Неверный вариант: ожидалось одно из ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),b=zW(G,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет иметь ${z}${U.maximum.toString()} ${b}`}return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),b=zW(G,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${U.origin} будет иметь ${z}${U.minimum.toString()} ${b}`}return`Слишком маленькое значение: ожидалось, что ${U.origin} будет ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${g[z.format]??U.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспознанн${U.keys.length>1?"ые":"ый"} ключ${U.keys.length>1?"и":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${U.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${U.origin}`;default:return"Неверные входные данные"}}};function i9(){return{localeError:$L()}}var vL=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(U){return $[U]??null}let g={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},_={nan:"NaN",number:"število",array:"tabela"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neveljaven vnos: pričakovano instanceof ${U.expected}, prejeto ${G}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${G}`}case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pričakovano ${j(U.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} imelo ${z}${U.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Premajhno: pričakovano, da bo ${U.origin} imelo ${z}${U.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${g[z.format]??U.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i ključi":" ključ"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function x9(){return{localeError:vL()}}var UL=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function v(U){return $[U]??null}let g={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},_={nan:"NaN",number:"antal",array:"lista"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ogiltig inmatning: förväntat instanceof ${U.expected}, fick ${G}`;return`Ogiltig inmatning: förväntat ${z}, fick ${G}`}case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: förväntat ${j(U.values[0])}`;return`Ogiltigt val: förväntade en av ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`För stor(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${g[z.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${Q(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${U.origin??"värdet"}`;default:return"Ogiltig input"}}};function h9(){return{localeError:UL()}}var gL=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(U){return $[U]??null}let g={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${U.expected}, பெறப்பட்டது ${G}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${G}`}case"invalid_value":if(U.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${j(U.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${Q(U.values,"|")} இல் ஒன்று`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${g[z.format]??U.format}`}case"not_multiple_of":return`தவறான எண்: ${U.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${U.keys.length>1?"கள்":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${U.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function l9(){return{localeError:gL()}}var _L=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(U){return $[U]??null}let g={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},_={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${U.expected} แต่ได้รับ ${G}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${G}`}case"invalid_value":if(U.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${j(U.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(U.origin);if(J)return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"อย่างน้อย":"มากกว่า",J=v(U.origin);if(J)return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${g[z.format]??U.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${U.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${Q(U.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${U.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${U.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function p9(){return{localeError:_L()}}var zL=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(U){return $[U]??null}let g={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Geçersiz değer: beklenen instanceof ${U.expected}, alınan ${G}`;return`Geçersiz değer: beklenen ${z}, alınan ${G}`}case"invalid_value":if(U.values.length===1)return`Geçersiz değer: beklenen ${j(U.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${g[z.format]??U.format}`}case"not_multiple_of":return`Geçersiz sayı: ${U.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${U.keys.length>1?"lar":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${U.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function o9(){return{localeError:zL()}}var JL=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(U){return $[U]??null}let g={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неправильні вхідні дані: очікується instanceof ${U.expected}, отримано ${G}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${G}`}case"invalid_value":if(U.values.length===1)return`Неправильні вхідні дані: очікується ${j(U.values[0])}`;return`Неправильна опція: очікується одне з ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Занадто велике: очікується, що ${U.origin??"значення"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${U.origin??"значення"} буде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Занадто мале: очікується, що ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${U.origin} буде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${g[z.format]??U.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${U.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${U.keys.length>1?"і":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${U.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${U.origin}`;default:return"Неправильні вхідні дані"}}};function N1(){return{localeError:JL()}}function n9(){return N1()}var GL=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(U){return $[U]??null}let g={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},_={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`غلط ان پٹ: instanceof ${U.expected} متوقع تھا، ${G} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${G} موصول ہوا`}case"invalid_value":if(U.values.length===1)return`غلط ان پٹ: ${j(U.values[0])} متوقع تھا`;return`غلط آپشن: ${Q(U.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`بہت بڑا: ${U.origin??"ویلیو"} کے ${z}${U.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${U.origin??"ویلیو"} کا ${z}${U.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`بہت چھوٹا: ${U.origin} کے ${z}${U.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${U.origin} کا ${z}${U.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${g[z.format]??U.format}`}case"not_multiple_of":return`غلط نمبر: ${U.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${U.keys.length>1?"ز":""}: ${Q(U.keys,"، ")}`;case"invalid_key":return`${U.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${U.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function t9(){return{localeError:GL()}}var KL=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function v(U){return $[U]??null}let g={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},_={nan:"NaN",number:"raqam",array:"massiv"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${U.expected}, qabul qilingan ${G}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${G}`}case"invalid_value":if(U.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${j(U.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${g[z.format]??U.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${U.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${U.keys.length>1?"lar":""}: ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${U.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function d9(){return{localeError:KL()}}var bL=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function v(U){return $[U]??null}let g={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},_={nan:"NaN",number:"số",array:"mảng"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${U.expected}, nhận được ${G}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${G}`}case"invalid_value":if(U.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${j(U.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Quá nhỏ: mong đợi ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${g[z.format]??U.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${U.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${Q(U.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${U.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${U.origin}`;default:return"Đầu vào không hợp lệ"}}};function a9(){return{localeError:bL()}}var OL=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(U){return $[U]??null}let g={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},_={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`无效输入:期望 instanceof ${U.expected},实际接收 ${G}`;return`无效输入:期望 ${z},实际接收 ${G}`}case"invalid_value":if(U.values.length===1)return`无效输入:期望 ${j(U.values[0])}`;return`无效选项:期望以下之一 ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${g[z.format]??U.format}`}case"not_multiple_of":return`无效数字:必须是 ${U.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${Q(U.keys,", ")}`;case"invalid_key":return`${U.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${U.origin} 中包含无效值(value)`;default:return"无效输入"}}};function s9(){return{localeError:OL()}}var WL=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(U){return $[U]??null}let g={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無效的輸入值:預期為 instanceof ${U.expected},但收到 ${G}`;return`無效的輸入值:預期為 ${z},但收到 ${G}`}case"invalid_value":if(U.values.length===1)return`無效的輸入值:預期為 ${j(U.values[0])}`;return`無效的選項:預期為以下其中之一 ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${g[z.format]??U.format}`}case"not_multiple_of":return`無效的數字:必須為 ${U.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${U.keys.length>1?"們":""}:${Q(U.keys,"、")}`;case"invalid_key":return`${U.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${U.origin} 中有無效的值`;default:return"無效的輸入值"}}};function e9(){return{localeError:WL()}}var BL=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(U){return $[U]??null}let g={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},_={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=C(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${U.expected}, àmọ̀ a rí ${G}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${G}`}case"invalid_value":if(U.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${j(U.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${Q(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${U.origin??"iye"} ${J.verb} ${z}${U.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${U.maximum}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${U.origin} ${J.verb} ${z}${U.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${U.minimum}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${g[z.format]??U.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${U.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${Q(U.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${U.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${U.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function $3(){return{localeError:BL()}}var JW,v3=Symbol("ZodOutput"),U3=Symbol("ZodInput");class g3{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let g=v[0];if(this._map.set($,g),g&&typeof g==="object"&&"id"in g)this._idmap.set(g.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let v=this._map.get($);if(v&&typeof v==="object"&&"id"in v)this._idmap.delete(v.id);return this._map.delete($),this}get($){let v=$._zod.parent;if(v){let g={...this.get(v)??{}};delete g.id;let _={...g,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function p_(){return new g3}(JW=globalThis).__zod_globalRegistry??(JW.__zod_globalRegistry=p_());var U6=globalThis.__zod_globalRegistry;function _3($,v){return new $({type:"string",...f(v)})}function z3($,v){return new $({type:"string",coerce:!0,...f(v)})}function o_($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...f(v)})}function R1($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...f(v)})}function n_($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...f(v)})}function t_($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(v)})}function d_($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(v)})}function a_($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(v)})}function D1($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...f(v)})}function s_($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...f(v)})}function e_($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(v)})}function $0($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...f(v)})}function v0($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(v)})}function U0($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...f(v)})}function g0($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...f(v)})}function _0($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(v)})}function z0($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(v)})}function J0($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(v)})}function J3($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...f(v)})}function G0($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(v)})}function K0($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(v)})}function b0($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...f(v)})}function O0($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...f(v)})}function W0($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...f(v)})}function B0($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...f(v)})}var G3={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function K3($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(v)})}function b3($,v){return new $({type:"string",format:"date",check:"string_format",...f(v)})}function O3($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...f(v)})}function W3($,v){return new $({type:"string",format:"duration",check:"string_format",...f(v)})}function B3($,v){return new $({type:"number",checks:[],...f(v)})}function Y3($,v){return new $({type:"number",coerce:!0,checks:[],...f(v)})}function k3($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...f(v)})}function q3($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...f(v)})}function P3($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...f(v)})}function X3($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...f(v)})}function H3($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...f(v)})}function L3($,v){return new $({type:"boolean",...f(v)})}function F3($,v){return new $({type:"boolean",coerce:!0,...f(v)})}function Z3($,v){return new $({type:"bigint",...f(v)})}function I3($,v){return new $({type:"bigint",coerce:!0,...f(v)})}function Q3($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f(v)})}function w3($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f(v)})}function A3($,v){return new $({type:"symbol",...f(v)})}function M3($,v){return new $({type:"undefined",...f(v)})}function S3($,v){return new $({type:"null",...f(v)})}function N3($){return new $({type:"any"})}function y3($){return new $({type:"unknown"})}function R3($,v){return new $({type:"never",...f(v)})}function D3($,v){return new $({type:"void",...f(v)})}function T3($,v){return new $({type:"date",...f(v)})}function j3($,v){return new $({type:"date",coerce:!0,...f(v)})}function u3($,v){return new $({type:"nan",...f(v)})}function d6($,v){return new u_({check:"less_than",...f(v),value:$,inclusive:!1})}function y6($,v){return new u_({check:"less_than",...f(v),value:$,inclusive:!0})}function a6($,v){return new C_({check:"greater_than",...f(v),value:$,inclusive:!1})}function X6($,v){return new C_({check:"greater_than",...f(v),value:$,inclusive:!0})}function Y0($){return a6(0,$)}function k0($){return d6(0,$)}function q0($){return y6(0,$)}function P0($){return X6(0,$)}function j4($,v){return new uJ({check:"multiple_of",...f(v),value:$})}function u4($,v){return new fJ({check:"max_size",...f(v),maximum:$})}function s6($,v){return new rJ({check:"min_size",...f(v),minimum:$})}function Wv($,v){return new EJ({check:"size_equals",...f(v),size:$})}function Bv($,v){return new mJ({check:"max_length",...f(v),maximum:$})}function b4($,v){return new cJ({check:"min_length",...f(v),minimum:$})}function Yv($,v){return new iJ({check:"length_equals",...f(v),length:$})}function UU($,v){return new xJ({check:"string_format",format:"regex",...f(v),pattern:$})}function gU($){return new hJ({check:"string_format",format:"lowercase",...f($)})}function _U($){return new lJ({check:"string_format",format:"uppercase",...f($)})}function zU($,v){return new pJ({check:"string_format",format:"includes",...f(v),includes:$})}function JU($,v){return new oJ({check:"string_format",format:"starts_with",...f(v),prefix:$})}function GU($,v){return new nJ({check:"string_format",format:"ends_with",...f(v),suffix:$})}function X0($,v,g){return new tJ({check:"property",property:$,schema:v,...f(g)})}function KU($,v){return new dJ({check:"mime_type",mime:$,...f(v)})}function x6($){return new aJ({check:"overwrite",tx:$})}function bU($){return x6((v)=>v.normalize($))}function OU(){return x6(($)=>$.trim())}function WU(){return x6(($)=>$.toLowerCase())}function BU(){return x6(($)=>$.toUpperCase())}function YU(){return x6(($)=>az($))}function C3($,v,g){return new $({type:"array",element:v,...f(g)})}function kL($,v,g){return new $({type:"union",options:v,...f(g)})}function qL($,v,g){return new $({type:"union",options:v,inclusive:!1,...f(g)})}function PL($,v,g,_){return new $({type:"union",options:g,discriminator:v,...f(_)})}function XL($,v,g){return new $({type:"intersection",left:v,right:g})}function HL($,v,g,_){let U=g instanceof z$;return new $({type:"tuple",items:v,rest:U?g:null,...f(U?_:g)})}function LL($,v,g,_){return new $({type:"record",keyType:v,valueType:g,...f(_)})}function FL($,v,g,_){return new $({type:"map",keyType:v,valueType:g,...f(_)})}function ZL($,v,g){return new $({type:"set",valueType:v,...f(g)})}function IL($,v,g){let _=Array.isArray(v)?Object.fromEntries(v.map((U)=>[U,U])):v;return new $({type:"enum",entries:_,...f(g)})}function QL($,v,g){return new $({type:"enum",entries:v,...f(g)})}function wL($,v,g){return new $({type:"literal",values:Array.isArray(v)?v:[v],...f(g)})}function V3($,v){return new $({type:"file",...f(v)})}function AL($,v){return new $({type:"transform",transform:v})}function ML($,v){return new $({type:"optional",innerType:v})}function SL($,v){return new $({type:"nullable",innerType:v})}function NL($,v,g){return new $({type:"default",innerType:v,get defaultValue(){return typeof g==="function"?g():ez(g)}})}function yL($,v,g){return new $({type:"nonoptional",innerType:v,...f(g)})}function RL($,v){return new $({type:"success",innerType:v})}function DL($,v,g){return new $({type:"catch",innerType:v,catchValue:typeof g==="function"?g:()=>g})}function TL($,v,g){return new $({type:"pipe",in:v,out:g})}function jL($,v){return new $({type:"readonly",innerType:v})}function uL($,v,g){return new $({type:"template_literal",parts:v,...f(g)})}function CL($,v){return new $({type:"lazy",getter:v})}function VL($,v){return new $({type:"promise",innerType:v})}function f3($,v,g){let _=f(g);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function r3($,v,g){return new $({type:"custom",check:"custom",fn:v,...f(g)})}function E3($){let v=GW((g)=>{return g.addIssue=(_)=>{if(typeof _==="string")g.issues.push(nv(_,g.value,v._zod.def));else{let U=_;if(U.fatal)U.continue=!1;U.code??(U.code="custom"),U.input??(U.input=g.value),U.inst??(U.inst=v),U.continue??(U.continue=!v._zod.def.abort),g.issues.push(nv(U))}},$(g.value,g)});return v}function GW($,v){let g=new T$({check:"custom",...f(v)});return g._zod.check=$,g}function m3($){let v=new T$({check:"describe"});return v._zod.onattach=[(g)=>{let _=U6.get(g)??{};U6.add(g,{..._,description:$})}],v._zod.check=()=>{},v}function c3($){let v=new T$({check:"meta"});return v._zod.onattach=[(g)=>{let _=U6.get(g)??{};U6.add(g,{..._,...$})}],v._zod.check=()=>{},v}function i3($,v){let g=f(v),_=g.truthy??["true","1","yes","on","y","enabled"],U=g.falsy??["false","0","no","off","n","disabled"];if(g.case!=="sensitive")_=_.map((Y)=>typeof Y==="string"?Y.toLowerCase():Y),U=U.map((Y)=>typeof Y==="string"?Y.toLowerCase():Y);let z=new Set(_),J=new Set(U),G=$.Codec??w1,b=$.Boolean??I1,W=new($.String??Ov)({type:"string",error:g.error}),B=new b({type:"boolean",error:g.error}),k=new G({type:"pipe",in:W,out:B,transform:(Y,F)=>{let X=Y;if(g.case!=="sensitive")X=X.toLowerCase();if(z.has(X))return!0;else if(J.has(X))return!1;else return F.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:F.value,inst:k,continue:!1}),{}},reverseTransform:(Y,F)=>{if(Y===!0)return _[0]||"true";else return U[0]||"false"},error:g.error});return k}function kU($,v,g,_={}){let U=f(_),z={...f(_),check:"string_format",type:"string",format:v,fn:typeof g==="function"?g:(G)=>g.test(G),...U};if(g instanceof RegExp)z.pattern=g;return new $(z)}function C4($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??U6,target:v,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function A$($,v,g={path:[],schemaPath:[]}){var _;let U=$._zod.def,z=v.seen.get($);if(z){if(z.count++,g.schemaPath.includes($))z.cycle=g.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:g.path};v.seen.set($,J);let G=$._zod.toJSONSchema?.();if(G)J.schema=G;else{let W={...g,schemaPath:[...g.schemaPath,$],path:g.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,Y=v.processors[U.type];if(!Y)throw Error(`[toJSONSchema]: Non-representable type encountered: ${U.type}`);Y($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;A$(B,v,W),v.seen.get(B).isParent=!0}}let b=v.metadataRegistry.get($);if(b)Object.assign(J.schema,b);if(v.io==="input"&&H6($))delete J.schema.examples,delete J.schema.default;if(v.io==="input"&&J.schema._prefault)(_=J.schema).default??(_.default=J.schema._prefault);return delete J.schema._prefault,v.seen.get($).schema}function V4($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=new Map;for(let J of $.seen.entries()){let G=$.metadataRegistry.get(J[0])?.id;if(G){let b=_.get(G);if(b&&b!==J[0])throw Error(`Duplicate schema id "${G}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);_.set(G,J[0])}}let U=(J)=>{let G=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((F)=>F);if(B)return{ref:k(B)};let Y=J[1].defId??J[1].schema.id??`schema${$.counter++}`;return J[1].defId=Y,{defId:Y,ref:`${k("__shared")}#/${G}/${Y}`}}if(J[1]===g)return{ref:"#"};let O=`${"#"}/${G}/`,W=J[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:O+W}},z=(J)=>{if(J[1].schema.$ref)return;let G=J[1],{ref:b,defId:O}=U(J);if(G.def={...G.schema},O)G.defId=O;let W=G.schema;for(let B in W)delete W[B];W.$ref=b};if($.cycles==="throw")for(let J of $.seen.entries()){let G=J[1];if(G.cycle)throw Error(`Cycle detected: #/${G.cycle?.join("/")}/<root>
149
+ `)}B.write("payload.value = newResult;"),B.write("return payload;");let F=B.compile();return(b,V)=>F(X,b,V)},z,K=h1,W=!$_.jitless,Y=W&&P5.value,Z=U.catchall,q;$._zod.parse=(X,B)=>{q??(q=J.value);let L=X.value;if(!K(L))return X.issues.push({expected:"object",code:"invalid_type",input:L,inst:$}),X;if(W&&Y&&B?.async===!1&&B.jitless!==!0){if(!z)z=_(U.shape);if(X=z(X,B),!Z)return X;return xq([],L,X,B,q,$)}return v(X,B)}});function Nq($,U,v,J){for(let z of $)if(z.issues.length===0)return U.value=z.value,U;let _=$.filter((z)=>!z1(z));if(_.length===1)return U.value=_[0].value,_[0];return U.issues.push({code:"invalid_union",input:U.value,inst:v,errors:$.map((z)=>z.issues.map((K)=>j6(K,J,U6())))}),U}var L_=M("$ZodUnion",($,U)=>{Y$.init($,U),X$($._zod,"optin",()=>U.options.some((_)=>_._zod.optin==="optional")?"optional":void 0),X$($._zod,"optout",()=>U.options.some((_)=>_._zod.optout==="optional")?"optional":void 0),X$($._zod,"values",()=>{if(U.options.every((_)=>_._zod.values))return new Set(U.options.flatMap((_)=>Array.from(_._zod.values)));return}),X$($._zod,"pattern",()=>{if(U.options.every((_)=>_._zod.pattern)){let _=U.options.map((z)=>z._zod.pattern);return new RegExp(`^(${_.map((z)=>v_(z.source)).join("|")})$`)}return});let v=U.options.length===1,J=U.options[0]._zod.run;$._zod.parse=(_,z)=>{if(v)return J(_,z);let K=!1,W=[];for(let O of U.options){let Y=O._zod.run({value:_.value,issues:[]},z);if(Y instanceof Promise)W.push(Y),K=!0;else{if(Y.issues.length===0)return Y;W.push(Y)}}if(!K)return Nq(W,_,$,z);return Promise.all(W).then((O)=>{return Nq(O,_,$,z)})}});function Sq($,U,v,J){let _=$.filter((z)=>z.issues.length===0);if(_.length===1)return U.value=_[0].value,U;if(_.length===0)U.issues.push({code:"invalid_union",input:U.value,inst:v,errors:$.map((z)=>z.issues.map((K)=>j6(K,J,U6())))});else U.issues.push({code:"invalid_union",input:U.value,inst:v,errors:[],inclusive:!1});return U}var zz=M("$ZodXor",($,U)=>{L_.init($,U),U.inclusive=!1;let v=U.options.length===1,J=U.options[0]._zod.run;$._zod.parse=(_,z)=>{if(v)return J(_,z);let K=!1,W=[];for(let O of U.options){let Y=O._zod.run({value:_.value,issues:[]},z);if(Y instanceof Promise)W.push(Y),K=!0;else W.push(Y)}if(!K)return Sq(W,_,$,z);return Promise.all(W).then((O)=>{return Sq(O,_,$,z)})}}),Kz=M("$ZodDiscriminatedUnion",($,U)=>{U.inclusive=!1,L_.init($,U);let v=$._zod.parse;X$($._zod,"propValues",()=>{let _={};for(let z of U.options){let K=z._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${U.options.indexOf(z)}"`);for(let[W,O]of Object.entries(K)){if(!_[W])_[W]=new Set;for(let Y of O)_[W].add(Y)}}return _});let J=VU(()=>{let _=U.options,z=new Map;for(let K of _){let W=K._zod.propValues?.[U.discriminator];if(!W||W.size===0)throw Error(`Invalid discriminated union option at index "${U.options.indexOf(K)}"`);for(let O of W){if(z.has(O))throw Error(`Duplicate discriminator value "${String(O)}"`);z.set(O,K)}}return z});$._zod.parse=(_,z)=>{let K=_.value;if(!h1(K))return _.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),_;let W=J.value.get(K?.[U.discriminator]);if(W)return W._zod.run(_,z);if(U.unionFallback)return v(_,z);return _.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:U.discriminator,input:K,path:[U.discriminator],inst:$}),_}}),Gz=M("$ZodIntersection",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value,z=U.left._zod.run({value:_,issues:[]},J),K=U.right._zod.run({value:_,issues:[]},J);if(z instanceof Promise||K instanceof Promise)return Promise.all([z,K]).then(([O,Y])=>{return Rq(v,O,Y)});return Rq(v,z,K)}});function k3($,U){if($===U)return{valid:!0,data:$};if($ instanceof Date&&U instanceof Date&&+$===+U)return{valid:!0,data:$};if(J1($)&&J1(U)){let v=Object.keys(U),J=Object.keys($).filter((z)=>v.indexOf(z)!==-1),_={...$,...U};for(let z of J){let K=k3($[z],U[z]);if(!K.valid)return{valid:!1,mergeErrorPath:[z,...K.mergeErrorPath]};_[z]=K.data}return{valid:!0,data:_}}if(Array.isArray($)&&Array.isArray(U)){if($.length!==U.length)return{valid:!1,mergeErrorPath:[]};let v=[];for(let J=0;J<$.length;J++){let _=$[J],z=U[J],K=k3(_,z);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};v.push(K.data)}return{valid:!0,data:v}}return{valid:!1,mergeErrorPath:[]}}function Rq($,U,v){let J=new Map,_;for(let W of U.issues)if(W.code==="unrecognized_keys"){_??(_=W);for(let O of W.keys){if(!J.has(O))J.set(O,{});J.get(O).l=!0}}else $.issues.push(W);for(let W of v.issues)if(W.code==="unrecognized_keys")for(let O of W.keys){if(!J.has(O))J.set(O,{});J.get(O).r=!0}else $.issues.push(W);let z=[...J].filter(([,W])=>W.l&&W.r).map(([W])=>W);if(z.length&&_)$.issues.push({..._,keys:z});if(z1($))return $;let K=k3(U.value,v.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var cv=M("$ZodTuple",($,U)=>{Y$.init($,U);let v=U.items;$._zod.parse=(J,_)=>{let z=J.value;if(!Array.isArray(z))return J.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),J;J.value=[];let K=[],W=[...v].reverse().findIndex((Z)=>Z._zod.optin!=="optional"),O=W===-1?0:v.length-W;if(!U.rest){let Z=z.length>v.length,q=z.length<O-1;if(Z||q)return J.issues.push({...Z?{code:"too_big",maximum:v.length,inclusive:!0}:{code:"too_small",minimum:v.length},input:z,inst:$,origin:"array"}),J}let Y=-1;for(let Z of v){if(Y++,Y>=z.length){if(Y>=O)continue}let q=Z._zod.run({value:z[Y],issues:[]},_);if(q instanceof Promise)K.push(q.then((X)=>Vv(X,J,Y)));else Vv(q,J,Y)}if(U.rest){let Z=z.slice(v.length);for(let q of Z){Y++;let X=U.rest._zod.run({value:q,issues:[]},_);if(X instanceof Promise)K.push(X.then((B)=>Vv(B,J,Y)));else Vv(X,J,Y)}}if(K.length)return Promise.all(K).then(()=>J);return J}});function Vv($,U,v){if($.issues.length)U.issues.push(...c6(v,$.issues));U.value[v]=$.value}var Wz=M("$ZodRecord",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(!J1(_))return v.issues.push({expected:"record",code:"invalid_type",input:_,inst:$}),v;let z=[],K=U.keyType._zod.values;if(K){v.value={};let W=new Set;for(let Y of K)if(typeof Y==="string"||typeof Y==="number"||typeof Y==="symbol"){W.add(typeof Y==="number"?Y.toString():Y);let Z=U.valueType._zod.run({value:_[Y],issues:[]},J);if(Z instanceof Promise)z.push(Z.then((q)=>{if(q.issues.length)v.issues.push(...c6(Y,q.issues));v.value[Y]=q.value}));else{if(Z.issues.length)v.issues.push(...c6(Y,Z.issues));v.value[Y]=Z.value}}let O;for(let Y in _)if(!W.has(Y))O=O??[],O.push(Y);if(O&&O.length>0)v.issues.push({code:"unrecognized_keys",input:_,inst:$,keys:O})}else{v.value={};for(let W of Reflect.ownKeys(_)){if(W==="__proto__")continue;let O=U.keyType._zod.run({value:W,issues:[]},J);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof W==="string"&&B_.test(W)&&O.issues.length){let q=U.keyType._zod.run({value:Number(W),issues:[]},J);if(q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(q.issues.length===0)O=q}if(O.issues.length){if(U.mode==="loose")v.value[W]=_[W];else v.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((q)=>j6(q,J,U6())),input:W,path:[W],inst:$});continue}let Z=U.valueType._zod.run({value:_[W],issues:[]},J);if(Z instanceof Promise)z.push(Z.then((q)=>{if(q.issues.length)v.issues.push(...c6(W,q.issues));v.value[O.value]=q.value}));else{if(Z.issues.length)v.issues.push(...c6(W,Z.issues));v.value[O.value]=Z.value}}}if(z.length)return Promise.all(z).then(()=>v);return v}}),Oz=M("$ZodMap",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(!(_ instanceof Map))return v.issues.push({expected:"map",code:"invalid_type",input:_,inst:$}),v;let z=[];v.value=new Map;for(let[K,W]of _){let O=U.keyType._zod.run({value:K,issues:[]},J),Y=U.valueType._zod.run({value:W,issues:[]},J);if(O instanceof Promise||Y instanceof Promise)z.push(Promise.all([O,Y]).then(([Z,q])=>{Tq(Z,q,v,K,_,$,J)}));else Tq(O,Y,v,K,_,$,J)}if(z.length)return Promise.all(z).then(()=>v);return v}});function Tq($,U,v,J,_,z,K){if($.issues.length)if(J_.has(typeof J))v.issues.push(...c6(J,$.issues));else v.issues.push({code:"invalid_key",origin:"map",input:_,inst:z,issues:$.issues.map((W)=>j6(W,K,U6()))});if(U.issues.length)if(J_.has(typeof J))v.issues.push(...c6(J,U.issues));else v.issues.push({origin:"map",code:"invalid_element",input:_,inst:z,key:J,issues:U.issues.map((W)=>j6(W,K,U6()))});v.value.set($.value,U.value)}var Yz=M("$ZodSet",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(!(_ instanceof Set))return v.issues.push({input:_,inst:$,expected:"set",code:"invalid_type"}),v;let z=[];v.value=new Set;for(let K of _){let W=U.valueType._zod.run({value:K,issues:[]},J);if(W instanceof Promise)z.push(W.then((O)=>yq(O,v)));else yq(W,v)}if(z.length)return Promise.all(z).then(()=>v);return v}});function yq($,U){if($.issues.length)U.issues.push(...$.issues);U.value.add($.value)}var Zz=M("$ZodEnum",($,U)=>{Y$.init($,U);let v=__(U.entries),J=new Set(v);$._zod.values=J,$._zod.pattern=new RegExp(`^(${v.filter((_)=>J_.has(typeof _)).map((_)=>typeof _==="string"?t6(_):_.toString()).join("|")})$`),$._zod.parse=(_,z)=>{let K=_.value;if(J.has(K))return _;return _.issues.push({code:"invalid_value",values:v,input:K,inst:$}),_}}),qz=M("$ZodLiteral",($,U)=>{if(Y$.init($,U),U.values.length===0)throw Error("Cannot create literal schema with no valid values");let v=new Set(U.values);$._zod.values=v,$._zod.pattern=new RegExp(`^(${U.values.map((J)=>typeof J==="string"?t6(J):J?t6(J.toString()):String(J)).join("|")})$`),$._zod.parse=(J,_)=>{let z=J.value;if(v.has(z))return J;return J.issues.push({code:"invalid_value",values:U.values,input:z,inst:$}),J}}),Bz=M("$ZodFile",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{let _=v.value;if(_ instanceof File)return v;return v.issues.push({expected:"file",code:"invalid_type",input:_,inst:$}),v}}),Xz=M("$ZodTransform",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{if(J.direction==="backward")throw new x1($.constructor.name);let _=U.transform(v.value,v);if(J.async)return(_ instanceof Promise?_:Promise.resolve(_)).then((K)=>{return v.value=K,v});if(_ instanceof Promise)throw new Q4;return v.value=_,v}});function Cq($,U){if($.issues.length&&U===void 0)return{issues:[],value:void 0};return $}var lv=M("$ZodOptional",($,U)=>{Y$.init($,U),$._zod.optin="optional",$._zod.optout="optional",X$($._zod,"values",()=>{return U.innerType._zod.values?new Set([...U.innerType._zod.values,void 0]):void 0}),X$($._zod,"pattern",()=>{let v=U.innerType._zod.pattern;return v?new RegExp(`^(${v_(v.source)})?$`):void 0}),$._zod.parse=(v,J)=>{if(U.innerType._zod.optin==="optional"){let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>Cq(z,v.value));return Cq(_,v.value)}if(v.value===void 0)return v;return U.innerType._zod.run(v,J)}}),Hz=M("$ZodExactOptional",($,U)=>{lv.init($,U),X$($._zod,"values",()=>U.innerType._zod.values),X$($._zod,"pattern",()=>U.innerType._zod.pattern),$._zod.parse=(v,J)=>{return U.innerType._zod.run(v,J)}}),Qz=M("$ZodNullable",($,U)=>{Y$.init($,U),X$($._zod,"optin",()=>U.innerType._zod.optin),X$($._zod,"optout",()=>U.innerType._zod.optout),X$($._zod,"pattern",()=>{let v=U.innerType._zod.pattern;return v?new RegExp(`^(${v_(v.source)}|null)$`):void 0}),X$($._zod,"values",()=>{return U.innerType._zod.values?new Set([...U.innerType._zod.values,null]):void 0}),$._zod.parse=(v,J)=>{if(v.value===null)return v;return U.innerType._zod.run(v,J)}}),Lz=M("$ZodDefault",($,U)=>{Y$.init($,U),$._zod.optin="optional",X$($._zod,"values",()=>U.innerType._zod.values),$._zod.parse=(v,J)=>{if(J.direction==="backward")return U.innerType._zod.run(v,J);if(v.value===void 0)return v.value=U.defaultValue,v;let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>Dq(z,U));return Dq(_,U)}});function Dq($,U){if($.value===void 0)$.value=U.defaultValue;return $}var Fz=M("$ZodPrefault",($,U)=>{Y$.init($,U),$._zod.optin="optional",X$($._zod,"values",()=>U.innerType._zod.values),$._zod.parse=(v,J)=>{if(J.direction==="backward")return U.innerType._zod.run(v,J);if(v.value===void 0)v.value=U.defaultValue;return U.innerType._zod.run(v,J)}}),Pz=M("$ZodNonOptional",($,U)=>{Y$.init($,U),X$($._zod,"values",()=>{let v=U.innerType._zod.values;return v?new Set([...v].filter((J)=>J!==void 0)):void 0}),$._zod.parse=(v,J)=>{let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>jq(z,$));return jq(_,$)}});function jq($,U){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:U});return $}var kz=M("$ZodSuccess",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{if(J.direction==="backward")throw new x1("ZodSuccess");let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>{return v.value=z.issues.length===0,v});return v.value=_.issues.length===0,v}}),bz=M("$ZodCatch",($,U)=>{Y$.init($,U),X$($._zod,"optin",()=>U.innerType._zod.optin),X$($._zod,"optout",()=>U.innerType._zod.optout),X$($._zod,"values",()=>U.innerType._zod.values),$._zod.parse=(v,J)=>{if(J.direction==="backward")return U.innerType._zod.run(v,J);let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>{if(v.value=z.value,z.issues.length)v.value=U.catchValue({...v,error:{issues:z.issues.map((K)=>j6(K,J,U6()))},input:v.value}),v.issues=[];return v});if(v.value=_.value,_.issues.length)v.value=U.catchValue({...v,error:{issues:_.issues.map((z)=>j6(z,J,U6()))},input:v.value}),v.issues=[];return v}}),Mz=M("$ZodNaN",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{if(typeof v.value!=="number"||!Number.isNaN(v.value))return v.issues.push({input:v.value,inst:$,expected:"nan",code:"invalid_type"}),v;return v}}),Az=M("$ZodPipe",($,U)=>{Y$.init($,U),X$($._zod,"values",()=>U.in._zod.values),X$($._zod,"optin",()=>U.in._zod.optin),X$($._zod,"optout",()=>U.out._zod.optout),X$($._zod,"propValues",()=>U.in._zod.propValues),$._zod.parse=(v,J)=>{if(J.direction==="backward"){let z=U.out._zod.run(v,J);if(z instanceof Promise)return z.then((K)=>fv(K,U.in,J));return fv(z,U.in,J)}let _=U.in._zod.run(v,J);if(_ instanceof Promise)return _.then((z)=>fv(z,U.out,J));return fv(_,U.out,J)}});function fv($,U,v){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:$.value,issues:$.issues},v)}var F_=M("$ZodCodec",($,U)=>{Y$.init($,U),X$($._zod,"values",()=>U.in._zod.values),X$($._zod,"optin",()=>U.in._zod.optin),X$($._zod,"optout",()=>U.out._zod.optout),X$($._zod,"propValues",()=>U.in._zod.propValues),$._zod.parse=(v,J)=>{if((J.direction||"forward")==="forward"){let z=U.in._zod.run(v,J);if(z instanceof Promise)return z.then((K)=>Ev(K,U,J));return Ev(z,U,J)}else{let z=U.out._zod.run(v,J);if(z instanceof Promise)return z.then((K)=>Ev(K,U,J));return Ev(z,U,J)}}});function Ev($,U,v){if($.issues.length)return $.aborted=!0,$;if((v.direction||"forward")==="forward"){let _=U.transform($.value,$);if(_ instanceof Promise)return _.then((z)=>uv($,z,U.out,v));return uv($,_,U.out,v)}else{let _=U.reverseTransform($.value,$);if(_ instanceof Promise)return _.then((z)=>uv($,z,U.in,v));return uv($,_,U.in,v)}}function uv($,U,v,J){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:U,issues:$.issues},J)}var Iz=M("$ZodReadonly",($,U)=>{Y$.init($,U),X$($._zod,"propValues",()=>U.innerType._zod.propValues),X$($._zod,"values",()=>U.innerType._zod.values),X$($._zod,"optin",()=>U.innerType?._zod?.optin),X$($._zod,"optout",()=>U.innerType?._zod?.optout),$._zod.parse=(v,J)=>{if(J.direction==="backward")return U.innerType._zod.run(v,J);let _=U.innerType._zod.run(v,J);if(_ instanceof Promise)return _.then(Vq);return Vq(_)}});function Vq($){return $.value=Object.freeze($.value),$}var wz=M("$ZodTemplateLiteral",($,U)=>{Y$.init($,U);let v=[];for(let J of U.parts)if(typeof J==="object"&&J!==null){if(!J._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...J._zod.traits].shift()}`);let _=J._zod.pattern instanceof RegExp?J._zod.pattern.source:J._zod.pattern;if(!_)throw Error(`Invalid template literal part: ${J._zod.traits}`);let z=_.startsWith("^")?1:0,K=_.endsWith("$")?_.length-1:_.length;v.push(_.slice(z,K))}else if(J===null||b5.has(typeof J))v.push(t6(`${J}`));else throw Error(`Invalid template literal part: ${J}`);$._zod.pattern=new RegExp(`^${v.join("")}$`),$._zod.parse=(J,_)=>{if(typeof J.value!=="string")return J.issues.push({input:J.value,inst:$,expected:"string",code:"invalid_type"}),J;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(J.value))return J.issues.push({input:J.value,inst:$,code:"invalid_format",format:U.format??"template_literal",pattern:$._zod.pattern.source}),J;return J}}),gz=M("$ZodFunction",($,U)=>{return Y$.init($,U),$._def=U,$._zod.def=U,$.implement=(v)=>{if(typeof v!=="function")throw Error("implement() must be called with a function");return function(...J){let _=$._def.input?Y_($._def.input,J):J,z=Reflect.apply(v,this,_);if($._def.output)return Y_($._def.output,z);return z}},$.implementAsync=(v)=>{if(typeof v!=="function")throw Error("implementAsync() must be called with a function");return async function(...J){let _=$._def.input?await Z_($._def.input,J):J,z=await Reflect.apply(v,this,_);if($._def.output)return await Z_($._def.output,z);return z}},$._zod.parse=(v,J)=>{if(typeof v.value!=="function")return v.issues.push({code:"invalid_type",expected:"function",input:v.value,inst:$}),v;if($._def.output&&$._def.output._zod.def.type==="promise")v.value=$.implementAsync(v.value);else v.value=$.implement(v.value);return v},$.input=(...v)=>{let J=$.constructor;if(Array.isArray(v[0]))return new J({type:"function",input:new cv({type:"tuple",items:v[0],rest:v[1]}),output:$._def.output});return new J({type:"function",input:v[0],output:$._def.output})},$.output=(v)=>{return new $.constructor({type:"function",input:$._def.input,output:v})},$}),Nz=M("$ZodPromise",($,U)=>{Y$.init($,U),$._zod.parse=(v,J)=>{return Promise.resolve(v.value).then((_)=>U.innerType._zod.run({value:_,issues:[]},J))}}),Sz=M("$ZodLazy",($,U)=>{Y$.init($,U),X$($._zod,"innerType",()=>U.getter()),X$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),X$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),X$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),X$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(v,J)=>{return $._zod.innerType._zod.run(v,J)}}),Rz=M("$ZodCustom",($,U)=>{m$.init($,U),Y$.init($,U),$._zod.parse=(v,J)=>{return v},$._zod.check=(v)=>{let J=v.value,_=U.fn(J);if(_ instanceof Promise)return _.then((z)=>fq(z,v,J,$));fq(_,v,J,$);return}});function fq($,U,v,J){if(!$){let _={code:"custom",input:v,inst:J,path:[...J._zod.def.path??[]],continue:!J._zod.def.abort};if(J._zod.def.params)_.params=J._zod.def.params;U.issues.push(fU(_))}}var A_={};A4(A_,{zhTW:()=>k7,zhCN:()=>P7,yo:()=>b7,vi:()=>F7,uz:()=>L7,ur:()=>Q7,uk:()=>M_,ua:()=>H7,tr:()=>X7,th:()=>B7,ta:()=>q7,sv:()=>Z7,sl:()=>Y7,ru:()=>O7,pt:()=>W7,ps:()=>K7,pl:()=>G7,ota:()=>z7,no:()=>J7,nl:()=>v7,ms:()=>_7,mk:()=>U7,lt:()=>$7,ko:()=>ez,km:()=>k_,kh:()=>sz,ka:()=>az,ja:()=>tz,it:()=>nz,is:()=>dz,id:()=>oz,hy:()=>pz,hu:()=>iz,he:()=>rz,frCA:()=>lz,fr:()=>cz,fi:()=>hz,fa:()=>xz,es:()=>mz,eo:()=>uz,en:()=>P_,de:()=>Ez,da:()=>fz,cs:()=>Vz,ca:()=>jz,bg:()=>Dz,be:()=>Cz,az:()=>yz,ar:()=>Tz});var sk=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function U(_){return $[_]??null}let v={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${_.expected}، ولكن تم إدخال ${W}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${W}`}case"invalid_value":if(_.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${m(_.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return` أكبر من اللازم: يفترض أن تكون ${_.origin??"القيمة"} ${z} ${_.maximum.toString()} ${K.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${_.origin??"القيمة"} ${z} ${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`أصغر من اللازم: يفترض لـ ${_.origin} أن يكون ${z} ${_.minimum.toString()} ${K.unit}`;return`أصغر من اللازم: يفترض لـ ${_.origin} أن يكون ${z} ${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${_.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${v[z.format]??_.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${_.divisor}`;case"unrecognized_keys":return`معرف${_.keys.length>1?"ات":""} غريب${_.keys.length>1?"ة":""}: ${w(_.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${_.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${_.origin}`;default:return"مدخل غير مقبول"}}};function Tz(){return{localeError:sk()}}var ek=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function U(_){return $[_]??null}let v={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Yanlış dəyər: gözlənilən instanceof ${_.expected}, daxil olan ${W}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${W}`}case"invalid_value":if(_.values.length===1)return`Yanlış dəyər: gözlənilən ${m(_.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Çox böyük: gözlənilən ${_.origin??"dəyər"} ${z}${_.maximum.toString()} ${K.unit??"element"}`;return`Çox böyük: gözlənilən ${_.origin??"dəyər"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Çox kiçik: gözlənilən ${_.origin} ${z}${_.minimum.toString()} ${K.unit}`;return`Çox kiçik: gözlənilən ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${v[z.format]??_.format}`}case"not_multiple_of":return`Yanlış ədəd: ${_.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${_.keys.length>1?"lar":""}: ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${_.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function yz(){return{localeError:ek()}}function cq($,U,v,J){let _=Math.abs($),z=_%10,K=_%100;if(K>=11&&K<=19)return J;if(z===1)return U;if(z>=2&&z<=4)return v;return J}var $b=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function U(_){return $[_]??null}let v={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},J={nan:"NaN",number:"лік",array:"масіў"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Няправільны ўвод: чакаўся instanceof ${_.expected}, атрымана ${W}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${W}`}case"invalid_value":if(_.values.length===1)return`Няправільны ўвод: чакалася ${m(_.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K){let W=Number(_.maximum),O=cq(W,K.unit.one,K.unit.few,K.unit.many);return`Занадта вялікі: чакалася, што ${_.origin??"значэнне"} павінна ${K.verb} ${z}${_.maximum.toString()} ${O}`}return`Занадта вялікі: чакалася, што ${_.origin??"значэнне"} павінна быць ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K){let W=Number(_.minimum),O=cq(W,K.unit.one,K.unit.few,K.unit.many);return`Занадта малы: чакалася, што ${_.origin} павінна ${K.verb} ${z}${_.minimum.toString()} ${O}`}return`Занадта малы: чакалася, што ${_.origin} павінна быць ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${v[z.format]??_.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${_.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${_.keys.length>1?"ключы":"ключ"}: ${w(_.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${_.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${_.origin}`;default:return"Няправільны ўвод"}}};function Cz(){return{localeError:$b()}}var Ub=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function U(_){return $[_]??null}let v={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},J={nan:"NaN",number:"число",array:"масив"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Невалиден вход: очакван instanceof ${_.expected}, получен ${W}`;return`Невалиден вход: очакван ${z}, получен ${W}`}case"invalid_value":if(_.values.length===1)return`Невалиден вход: очакван ${m(_.values[0])}`;return`Невалидна опция: очаквано едно от ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Твърде голямо: очаква се ${_.origin??"стойност"} да съдържа ${z}${_.maximum.toString()} ${K.unit??"елемента"}`;return`Твърде голямо: очаква се ${_.origin??"стойност"} да бъде ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Твърде малко: очаква се ${_.origin} да съдържа ${z}${_.minimum.toString()} ${K.unit}`;return`Твърде малко: очаква се ${_.origin} да бъде ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let K="Невалиден";if(z.format==="emoji")K="Невалидно";if(z.format==="datetime")K="Невалидно";if(z.format==="date")K="Невалидна";if(z.format==="time")K="Невалидно";if(z.format==="duration")K="Невалидна";return`${K} ${v[z.format]??_.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${_.divisor}`;case"unrecognized_keys":return`Неразпознат${_.keys.length>1?"и":""} ключ${_.keys.length>1?"ове":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${_.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${_.origin}`;default:return"Невалиден вход"}}};function Dz(){return{localeError:Ub()}}var _b=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function U(_){return $[_]??null}let v={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Tipus invàlid: s'esperava instanceof ${_.expected}, s'ha rebut ${W}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${W}`}case"invalid_value":if(_.values.length===1)return`Valor invàlid: s'esperava ${m(_.values[0])}`;return`Opció invàlida: s'esperava una de ${w(_.values," o ")}`;case"too_big":{let z=_.inclusive?"com a màxim":"menys de",K=U(_.origin);if(K)return`Massa gran: s'esperava que ${_.origin??"el valor"} contingués ${z} ${_.maximum.toString()} ${K.unit??"elements"}`;return`Massa gran: s'esperava que ${_.origin??"el valor"} fos ${z} ${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?"com a mínim":"més de",K=U(_.origin);if(K)return`Massa petit: s'esperava que ${_.origin} contingués ${z} ${_.minimum.toString()} ${K.unit}`;return`Massa petit: s'esperava que ${_.origin} fos ${z} ${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${v[z.format]??_.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${_.divisor}`;case"unrecognized_keys":return`Clau${_.keys.length>1?"s":""} no reconeguda${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${_.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${_.origin}`;default:return"Entrada invàlida"}}};function jz(){return{localeError:_b()}}var vb=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function U(_){return $[_]??null}let v={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},J={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Neplatný vstup: očekáváno instanceof ${_.expected}, obdrženo ${W}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${W}`}case"invalid_value":if(_.values.length===1)return`Neplatný vstup: očekáváno ${m(_.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Hodnota je příliš velká: ${_.origin??"hodnota"} musí mít ${z}${_.maximum.toString()} ${K.unit??"prvků"}`;return`Hodnota je příliš velká: ${_.origin??"hodnota"} musí být ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Hodnota je příliš malá: ${_.origin??"hodnota"} musí mít ${z}${_.minimum.toString()} ${K.unit??"prvků"}`;return`Hodnota je příliš malá: ${_.origin??"hodnota"} musí být ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${v[z.format]??_.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${_.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${w(_.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${_.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${_.origin}`;default:return"Neplatný vstup"}}};function Vz(){return{localeError:vb()}}var Jb=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function U(_){return $[_]??null}let v={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},J={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ugyldigt input: forventede instanceof ${_.expected}, fik ${W}`;return`Ugyldigt input: forventede ${z}, fik ${W}`}case"invalid_value":if(_.values.length===1)return`Ugyldig værdi: forventede ${m(_.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin),W=J[_.origin]??_.origin;if(K)return`For stor: forventede ${W??"value"} ${K.verb} ${z} ${_.maximum.toString()} ${K.unit??"elementer"}`;return`For stor: forventede ${W??"value"} havde ${z} ${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin),W=J[_.origin]??_.origin;if(K)return`For lille: forventede ${W} ${K.verb} ${z} ${_.minimum.toString()} ${K.unit}`;return`For lille: forventede ${W} havde ${z} ${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${v[z.format]??_.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${_.divisor}`;case"unrecognized_keys":return`${_.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${w(_.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${_.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${_.origin}`;default:return"Ugyldigt input"}}};function fz(){return{localeError:Jb()}}var zb=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function U(_){return $[_]??null}let v={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},J={nan:"NaN",number:"Zahl",array:"Array"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ungültige Eingabe: erwartet instanceof ${_.expected}, erhalten ${W}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${W}`}case"invalid_value":if(_.values.length===1)return`Ungültige Eingabe: erwartet ${m(_.values[0])}`;return`Ungültige Option: erwartet eine von ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Zu groß: erwartet, dass ${_.origin??"Wert"} ${z}${_.maximum.toString()} ${K.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${_.origin??"Wert"} ${z}${_.maximum.toString()} ist`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Zu klein: erwartet, dass ${_.origin} ${z}${_.minimum.toString()} ${K.unit} hat`;return`Zu klein: erwartet, dass ${_.origin} ${z}${_.minimum.toString()} ist`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${v[z.format]??_.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${_.divisor} sein`;case"unrecognized_keys":return`${_.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${w(_.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${_.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${_.origin}`;default:return"Ungültige Eingabe"}}};function Ez(){return{localeError:zb()}}var Kb=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function U(_){return $[_]??null}let v={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;return`Invalid input: expected ${z}, received ${W}`}case"invalid_value":if(_.values.length===1)return`Invalid input: expected ${m(_.values[0])}`;return`Invalid option: expected one of ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Too big: expected ${_.origin??"value"} to have ${z}${_.maximum.toString()} ${K.unit??"elements"}`;return`Too big: expected ${_.origin??"value"} to be ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Too small: expected ${_.origin} to have ${z}${_.minimum.toString()} ${K.unit}`;return`Too small: expected ${_.origin} to be ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${v[z.format]??_.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${_.divisor}`;case"unrecognized_keys":return`Unrecognized key${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Invalid key in ${_.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${_.origin}`;default:return"Invalid input"}}};function P_(){return{localeError:Kb()}}var Gb=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function U(_){return $[_]??null}let v={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},J={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Nevalida enigo: atendiĝis instanceof ${_.expected}, riceviĝis ${W}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${W}`}case"invalid_value":if(_.values.length===1)return`Nevalida enigo: atendiĝis ${m(_.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Tro granda: atendiĝis ke ${_.origin??"valoro"} havu ${z}${_.maximum.toString()} ${K.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${_.origin??"valoro"} havu ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Tro malgranda: atendiĝis ke ${_.origin} havu ${z}${_.minimum.toString()} ${K.unit}`;return`Tro malgranda: atendiĝis ke ${_.origin} estu ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${v[z.format]??_.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${_.divisor}`;case"unrecognized_keys":return`Nekonata${_.keys.length>1?"j":""} ŝlosilo${_.keys.length>1?"j":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${_.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${_.origin}`;default:return"Nevalida enigo"}}};function uz(){return{localeError:Gb()}}var Wb=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function U(_){return $[_]??null}let v={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},J={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Entrada inválida: se esperaba instanceof ${_.expected}, recibido ${W}`;return`Entrada inválida: se esperaba ${z}, recibido ${W}`}case"invalid_value":if(_.values.length===1)return`Entrada inválida: se esperaba ${m(_.values[0])}`;return`Opción inválida: se esperaba una de ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin),W=J[_.origin]??_.origin;if(K)return`Demasiado grande: se esperaba que ${W??"valor"} tuviera ${z}${_.maximum.toString()} ${K.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${W??"valor"} fuera ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin),W=J[_.origin]??_.origin;if(K)return`Demasiado pequeño: se esperaba que ${W} tuviera ${z}${_.minimum.toString()} ${K.unit}`;return`Demasiado pequeño: se esperaba que ${W} fuera ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${v[z.format]??_.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${_.divisor}`;case"unrecognized_keys":return`Llave${_.keys.length>1?"s":""} desconocida${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Llave inválida en ${J[_.origin]??_.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${J[_.origin]??_.origin}`;default:return"Entrada inválida"}}};function mz(){return{localeError:Wb()}}var Ob=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function U(_){return $[_]??null}let v={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},J={nan:"NaN",number:"عدد",array:"آرایه"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`ورودی نامعتبر: می‌بایست instanceof ${_.expected} می‌بود، ${W} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${W} دریافت شد`}case"invalid_value":if(_.values.length===1)return`ورودی نامعتبر: می‌بایست ${m(_.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${w(_.values,"|")} می‌بود`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`خیلی بزرگ: ${_.origin??"مقدار"} باید ${z}${_.maximum.toString()} ${K.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${_.origin??"مقدار"} باید ${z}${_.maximum.toString()} باشد`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`خیلی کوچک: ${_.origin} باید ${z}${_.minimum.toString()} ${K.unit} باشد`;return`خیلی کوچک: ${_.origin} باید ${z}${_.minimum.toString()} باشد`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${v[z.format]??_.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${_.divisor} باشد`;case"unrecognized_keys":return`کلید${_.keys.length>1?"های":""} ناشناس: ${w(_.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${_.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${_.origin}`;default:return"ورودی نامعتبر"}}};function xz(){return{localeError:Ob()}}var Yb=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function U(_){return $[_]??null}let v={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Virheellinen tyyppi: odotettiin instanceof ${_.expected}, oli ${W}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${W}`}case"invalid_value":if(_.values.length===1)return`Virheellinen syöte: täytyy olla ${m(_.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Liian suuri: ${K.subject} täytyy olla ${z}${_.maximum.toString()} ${K.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Liian pieni: ${K.subject} täytyy olla ${z}${_.minimum.toString()} ${K.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${v[z.format]??_.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${_.divisor} monikerta`;case"unrecognized_keys":return`${_.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(_.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function hz(){return{localeError:Yb()}}var Zb=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function U(_){return $[_]??null}let v={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},J={nan:"NaN",number:"nombre",array:"tableau"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Entrée invalide : instanceof ${_.expected} attendu, ${W} reçu`;return`Entrée invalide : ${z} attendu, ${W} reçu`}case"invalid_value":if(_.values.length===1)return`Entrée invalide : ${m(_.values[0])} attendu`;return`Option invalide : une valeur parmi ${w(_.values,"|")} attendue`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Trop grand : ${_.origin??"valeur"} doit ${K.verb} ${z}${_.maximum.toString()} ${K.unit??"élément(s)"}`;return`Trop grand : ${_.origin??"valeur"} doit être ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Trop petit : ${_.origin} doit ${K.verb} ${z}${_.minimum.toString()} ${K.unit}`;return`Trop petit : ${_.origin} doit être ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${v[z.format]??_.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${_.divisor}`;case"unrecognized_keys":return`Clé${_.keys.length>1?"s":""} non reconnue${_.keys.length>1?"s":""} : ${w(_.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${_.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${_.origin}`;default:return"Entrée invalide"}}};function cz(){return{localeError:Zb()}}var qb=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function U(_){return $[_]??null}let v={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Entrée invalide : attendu instanceof ${_.expected}, reçu ${W}`;return`Entrée invalide : attendu ${z}, reçu ${W}`}case"invalid_value":if(_.values.length===1)return`Entrée invalide : attendu ${m(_.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"≤":"<",K=U(_.origin);if(K)return`Trop grand : attendu que ${_.origin??"la valeur"} ait ${z}${_.maximum.toString()} ${K.unit}`;return`Trop grand : attendu que ${_.origin??"la valeur"} soit ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?"≥":">",K=U(_.origin);if(K)return`Trop petit : attendu que ${_.origin} ait ${z}${_.minimum.toString()} ${K.unit}`;return`Trop petit : attendu que ${_.origin} soit ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${v[z.format]??_.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${_.divisor}`;case"unrecognized_keys":return`Clé${_.keys.length>1?"s":""} non reconnue${_.keys.length>1?"s":""} : ${w(_.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${_.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${_.origin}`;default:return"Entrée invalide"}}};function lz(){return{localeError:qb()}}var Bb=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},U={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},v=(Y)=>Y?$[Y]:void 0,J=(Y)=>{let Z=v(Y);if(Z)return Z.label;return Y??$.unknown.label},_=(Y)=>`ה${J(Y)}`,z=(Y)=>{return(v(Y)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},K=(Y)=>{if(!Y)return null;return U[Y]??null},W={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},O={nan:"NaN"};return(Y)=>{switch(Y.code){case"invalid_type":{let Z=Y.expected,q=O[Z??""]??J(Z),X=x(Y.input),B=O[X]??$[X]?.label??X;if(/^[A-Z]/.test(Y.expected))return`קלט לא תקין: צריך להיות instanceof ${Y.expected}, התקבל ${B}`;return`קלט לא תקין: צריך להיות ${q}, התקבל ${B}`}case"invalid_value":{if(Y.values.length===1)return`ערך לא תקין: הערך חייב להיות ${m(Y.values[0])}`;let Z=Y.values.map((B)=>m(B));if(Y.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${Z[0]} או ${Z[1]}`;let q=Z[Z.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${Z.slice(0,-1).join(", ")} או ${q}`}case"too_big":{let Z=K(Y.origin),q=_(Y.origin??"value");if(Y.origin==="string")return`${Z?.longLabel??"ארוך"} מדי: ${q} צריכה להכיל ${Y.maximum.toString()} ${Z?.unit??""} ${Y.inclusive?"או פחות":"לכל היותר"}`.trim();if(Y.origin==="number"){let L=Y.inclusive?`קטן או שווה ל-${Y.maximum}`:`קטן מ-${Y.maximum}`;return`גדול מדי: ${q} צריך להיות ${L}`}if(Y.origin==="array"||Y.origin==="set"){let L=Y.origin==="set"?"צריכה":"צריך",P=Y.inclusive?`${Y.maximum} ${Z?.unit??""} או פחות`:`פחות מ-${Y.maximum} ${Z?.unit??""}`;return`גדול מדי: ${q} ${L} להכיל ${P}`.trim()}let X=Y.inclusive?"<=":"<",B=z(Y.origin??"value");if(Z?.unit)return`${Z.longLabel} מדי: ${q} ${B} ${X}${Y.maximum.toString()} ${Z.unit}`;return`${Z?.longLabel??"גדול"} מדי: ${q} ${B} ${X}${Y.maximum.toString()}`}case"too_small":{let Z=K(Y.origin),q=_(Y.origin??"value");if(Y.origin==="string")return`${Z?.shortLabel??"קצר"} מדי: ${q} צריכה להכיל ${Y.minimum.toString()} ${Z?.unit??""} ${Y.inclusive?"או יותר":"לפחות"}`.trim();if(Y.origin==="number"){let L=Y.inclusive?`גדול או שווה ל-${Y.minimum}`:`גדול מ-${Y.minimum}`;return`קטן מדי: ${q} צריך להיות ${L}`}if(Y.origin==="array"||Y.origin==="set"){let L=Y.origin==="set"?"צריכה":"צריך";if(Y.minimum===1&&Y.inclusive){let k=Y.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${q} ${L} להכיל ${k}`}let P=Y.inclusive?`${Y.minimum} ${Z?.unit??""} או יותר`:`יותר מ-${Y.minimum} ${Z?.unit??""}`;return`קטן מדי: ${q} ${L} להכיל ${P}`.trim()}let X=Y.inclusive?">=":">",B=z(Y.origin??"value");if(Z?.unit)return`${Z.shortLabel} מדי: ${q} ${B} ${X}${Y.minimum.toString()} ${Z.unit}`;return`${Z?.shortLabel??"קטן"} מדי: ${q} ${B} ${X}${Y.minimum.toString()}`}case"invalid_format":{let Z=Y;if(Z.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${Z.prefix}"`;if(Z.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${Z.suffix}"`;if(Z.format==="includes")return`המחרוזת חייבת לכלול "${Z.includes}"`;if(Z.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${Z.pattern}`;let q=W[Z.format],X=q?.label??Z.format,L=(q?.gender??"m")==="f"?"תקינה":"תקין";return`${X} לא ${L}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${Y.divisor}`;case"unrecognized_keys":return`מפתח${Y.keys.length>1?"ות":""} לא מזוה${Y.keys.length>1?"ים":"ה"}: ${w(Y.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${_(Y.origin??"array")}`;default:return"קלט לא תקין"}}};function rz(){return{localeError:Bb()}}var Xb=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function U(_){return $[_]??null}let v={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},J={nan:"NaN",number:"szám",array:"tömb"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Érvénytelen bemenet: a várt érték instanceof ${_.expected}, a kapott érték ${W}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${W}`}case"invalid_value":if(_.values.length===1)return`Érvénytelen bemenet: a várt érték ${m(_.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Túl nagy: ${_.origin??"érték"} mérete túl nagy ${z}${_.maximum.toString()} ${K.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${_.origin??"érték"} túl nagy: ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Túl kicsi: a bemeneti érték ${_.origin} mérete túl kicsi ${z}${_.minimum.toString()} ${K.unit}`;return`Túl kicsi: a bemeneti érték ${_.origin} túl kicsi ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${v[z.format]??_.format}`}case"not_multiple_of":return`Érvénytelen szám: ${_.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${_.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${_.origin}`;default:return"Érvénytelen bemenet"}}};function iz(){return{localeError:Xb()}}function lq($,U,v){return Math.abs($)===1?U:v}function lU($){if(!$)return"";let U=["ա","ե","ը","ի","ո","ու","օ"],v=$[$.length-1];return $+(U.includes(v)?"ն":"ը")}var Hb=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function U(_){return $[_]??null}let v={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},J={nan:"NaN",number:"թիվ",array:"զանգված"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${_.expected}, ստացվել է ${W}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${W}`}case"invalid_value":if(_.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${m(_.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K){let W=Number(_.maximum),O=lq(W,K.unit.one,K.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${lU(_.origin??"արժեք")} կունենա ${z}${_.maximum.toString()} ${O}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${lU(_.origin??"արժեք")} լինի ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K){let W=Number(_.minimum),O=lq(W,K.unit.one,K.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${lU(_.origin)} կունենա ${z}${_.minimum.toString()} ${O}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${lU(_.origin)} լինի ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${v[z.format]??_.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${_.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${_.keys.length>1?"ներ":""}. ${w(_.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${lU(_.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${lU(_.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function pz(){return{localeError:Hb()}}var Qb=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function U(_){return $[_]??null}let v={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Input tidak valid: diharapkan instanceof ${_.expected}, diterima ${W}`;return`Input tidak valid: diharapkan ${z}, diterima ${W}`}case"invalid_value":if(_.values.length===1)return`Input tidak valid: diharapkan ${m(_.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Terlalu besar: diharapkan ${_.origin??"value"} memiliki ${z}${_.maximum.toString()} ${K.unit??"elemen"}`;return`Terlalu besar: diharapkan ${_.origin??"value"} menjadi ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Terlalu kecil: diharapkan ${_.origin} memiliki ${z}${_.minimum.toString()} ${K.unit}`;return`Terlalu kecil: diharapkan ${_.origin} menjadi ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${v[z.format]??_.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${_.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${_.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${_.origin}`;default:return"Input tidak valid"}}};function oz(){return{localeError:Qb()}}var Lb=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function U(_){return $[_]??null}let v={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},J={nan:"NaN",number:"númer",array:"fylki"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Rangt gildi: Þú slóst inn ${W} þar sem á að vera instanceof ${_.expected}`;return`Rangt gildi: Þú slóst inn ${W} þar sem á að vera ${z}`}case"invalid_value":if(_.values.length===1)return`Rangt gildi: gert ráð fyrir ${m(_.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Of stórt: gert er ráð fyrir að ${_.origin??"gildi"} hafi ${z}${_.maximum.toString()} ${K.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${_.origin??"gildi"} sé ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Of lítið: gert er ráð fyrir að ${_.origin} hafi ${z}${_.minimum.toString()} ${K.unit}`;return`Of lítið: gert er ráð fyrir að ${_.origin} sé ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${v[z.format]??_.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${_.divisor}`;case"unrecognized_keys":return`Óþekkt ${_.keys.length>1?"ir lyklar":"ur lykill"}: ${w(_.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${_.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${_.origin}`;default:return"Rangt gildi"}}};function dz(){return{localeError:Lb()}}var Fb=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function U(_){return $[_]??null}let v={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},J={nan:"NaN",number:"numero",array:"vettore"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Input non valido: atteso instanceof ${_.expected}, ricevuto ${W}`;return`Input non valido: atteso ${z}, ricevuto ${W}`}case"invalid_value":if(_.values.length===1)return`Input non valido: atteso ${m(_.values[0])}`;return`Opzione non valida: atteso uno tra ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Troppo grande: ${_.origin??"valore"} deve avere ${z}${_.maximum.toString()} ${K.unit??"elementi"}`;return`Troppo grande: ${_.origin??"valore"} deve essere ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Troppo piccolo: ${_.origin} deve avere ${z}${_.minimum.toString()} ${K.unit}`;return`Troppo piccolo: ${_.origin} deve essere ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${v[z.format]??_.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${_.divisor}`;case"unrecognized_keys":return`Chiav${_.keys.length>1?"i":"e"} non riconosciut${_.keys.length>1?"e":"a"}: ${w(_.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${_.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${_.origin}`;default:return"Input non valido"}}};function nz(){return{localeError:Fb()}}var Pb=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function U(_){return $[_]??null}let v={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},J={nan:"NaN",number:"数値",array:"配列"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`無効な入力: instanceof ${_.expected}が期待されましたが、${W}が入力されました`;return`無効な入力: ${z}が期待されましたが、${W}が入力されました`}case"invalid_value":if(_.values.length===1)return`無効な入力: ${m(_.values[0])}が期待されました`;return`無効な選択: ${w(_.values,"、")}のいずれかである必要があります`;case"too_big":{let z=_.inclusive?"以下である":"より小さい",K=U(_.origin);if(K)return`大きすぎる値: ${_.origin??"値"}は${_.maximum.toString()}${K.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${_.origin??"値"}は${_.maximum.toString()}${z}必要があります`}case"too_small":{let z=_.inclusive?"以上である":"より大きい",K=U(_.origin);if(K)return`小さすぎる値: ${_.origin}は${_.minimum.toString()}${K.unit}${z}必要があります`;return`小さすぎる値: ${_.origin}は${_.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${v[z.format]??_.format}`}case"not_multiple_of":return`無効な数値: ${_.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${_.keys.length>1?"群":""}: ${w(_.keys,"、")}`;case"invalid_key":return`${_.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${_.origin}内の無効な値`;default:return"無効な入力"}}};function tz(){return{localeError:Pb()}}var kb=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function U(_){return $[_]??null}let v={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},J={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${_.expected}, მიღებული ${W}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${W}`}case"invalid_value":if(_.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${m(_.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${w(_.values,"|")}-დან`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`ზედმეტად დიდი: მოსალოდნელი ${_.origin??"მნიშვნელობა"} ${K.verb} ${z}${_.maximum.toString()} ${K.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${_.origin??"მნიშვნელობა"} იყოს ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`ზედმეტად პატარა: მოსალოდნელი ${_.origin} ${K.verb} ${z}${_.minimum.toString()} ${K.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${_.origin} იყოს ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${v[z.format]??_.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${_.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${_.keys.length>1?"ები":"ი"}: ${w(_.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${_.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${_.origin}-ში`;default:return"არასწორი შეყვანა"}}};function az(){return{localeError:kb()}}var bb=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function U(_){return $[_]??null}let v={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},J={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${_.expected} ប៉ុន្តែទទួលបាន ${W}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${W}`}case"invalid_value":if(_.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${m(_.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`ធំពេក៖ ត្រូវការ ${_.origin??"តម្លៃ"} ${z} ${_.maximum.toString()} ${K.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${_.origin??"តម្លៃ"} ${z} ${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`តូចពេក៖ ត្រូវការ ${_.origin} ${z} ${_.minimum.toString()} ${K.unit}`;return`តូចពេក៖ ត្រូវការ ${_.origin} ${z} ${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${v[z.format]??_.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${_.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${w(_.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${_.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${_.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function k_(){return{localeError:bb()}}function sz(){return k_()}var Mb=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function U(_){return $[_]??null}let v={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`잘못된 입력: 예상 타입은 instanceof ${_.expected}, 받은 타입은 ${W}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${W}입니다`}case"invalid_value":if(_.values.length===1)return`잘못된 입력: 값은 ${m(_.values[0])} 이어야 합니다`;return`잘못된 옵션: ${w(_.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=_.inclusive?"이하":"미만",K=z==="미만"?"이어야 합니다":"여야 합니다",W=U(_.origin),O=W?.unit??"요소";if(W)return`${_.origin??"값"}이 너무 큽니다: ${_.maximum.toString()}${O} ${z}${K}`;return`${_.origin??"값"}이 너무 큽니다: ${_.maximum.toString()} ${z}${K}`}case"too_small":{let z=_.inclusive?"이상":"초과",K=z==="이상"?"이어야 합니다":"여야 합니다",W=U(_.origin),O=W?.unit??"요소";if(W)return`${_.origin??"값"}이 너무 작습니다: ${_.minimum.toString()}${O} ${z}${K}`;return`${_.origin??"값"}이 너무 작습니다: ${_.minimum.toString()} ${z}${K}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${v[z.format]??_.format}`}case"not_multiple_of":return`잘못된 숫자: ${_.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${w(_.keys,", ")}`;case"invalid_key":return`잘못된 키: ${_.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${_.origin}`;default:return"잘못된 입력"}}};function ez(){return{localeError:Mb()}}var b_=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function rq($){let U=Math.abs($),v=U%10,J=U%100;if(J>=11&&J<=19||v===0)return"many";if(v===1)return"one";return"few"}var Ab=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function U(_,z,K,W){let O=$[_]??null;if(O===null)return O;return{unit:O.unit[z],verb:O.verb[W][K?"inclusive":"notInclusive"]}}let v={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},J={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Gautas tipas ${W}, o tikėtasi - instanceof ${_.expected}`;return`Gautas tipas ${W}, o tikėtasi - ${z}`}case"invalid_value":if(_.values.length===1)return`Privalo būti ${m(_.values[0])}`;return`Privalo būti vienas iš ${w(_.values,"|")} pasirinkimų`;case"too_big":{let z=J[_.origin]??_.origin,K=U(_.origin,rq(Number(_.maximum)),_.inclusive??!1,"smaller");if(K?.verb)return`${b_(z??_.origin??"reikšmė")} ${K.verb} ${_.maximum.toString()} ${K.unit??"elementų"}`;let W=_.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${b_(z??_.origin??"reikšmė")} turi būti ${W} ${_.maximum.toString()} ${K?.unit}`}case"too_small":{let z=J[_.origin]??_.origin,K=U(_.origin,rq(Number(_.minimum)),_.inclusive??!1,"bigger");if(K?.verb)return`${b_(z??_.origin??"reikšmė")} ${K.verb} ${_.minimum.toString()} ${K.unit??"elementų"}`;let W=_.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${b_(z??_.origin??"reikšmė")} turi būti ${W} ${_.minimum.toString()} ${K?.unit}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${v[z.format]??_.format}`}case"not_multiple_of":return`Skaičius privalo būti ${_.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${_.keys.length>1?"i":"as"} rakt${_.keys.length>1?"ai":"as"}: ${w(_.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=J[_.origin]??_.origin;return`${b_(z??_.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function $7(){return{localeError:Ab()}}var Ib=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function U(_){return $[_]??null}let v={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},J={nan:"NaN",number:"број",array:"низа"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Грешен внес: се очекува instanceof ${_.expected}, примено ${W}`;return`Грешен внес: се очекува ${z}, примено ${W}`}case"invalid_value":if(_.values.length===1)return`Invalid input: expected ${m(_.values[0])}`;return`Грешана опција: се очекува една ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Премногу голем: се очекува ${_.origin??"вредноста"} да има ${z}${_.maximum.toString()} ${K.unit??"елементи"}`;return`Премногу голем: се очекува ${_.origin??"вредноста"} да биде ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Премногу мал: се очекува ${_.origin} да има ${z}${_.minimum.toString()} ${K.unit}`;return`Премногу мал: се очекува ${_.origin} да биде ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${v[z.format]??_.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${_.divisor}`;case"unrecognized_keys":return`${_.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${w(_.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${_.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${_.origin}`;default:return"Грешен внес"}}};function U7(){return{localeError:Ib()}}var wb=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function U(_){return $[_]??null}let v={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},J={nan:"NaN",number:"nombor"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Input tidak sah: dijangka instanceof ${_.expected}, diterima ${W}`;return`Input tidak sah: dijangka ${z}, diterima ${W}`}case"invalid_value":if(_.values.length===1)return`Input tidak sah: dijangka ${m(_.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Terlalu besar: dijangka ${_.origin??"nilai"} ${K.verb} ${z}${_.maximum.toString()} ${K.unit??"elemen"}`;return`Terlalu besar: dijangka ${_.origin??"nilai"} adalah ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Terlalu kecil: dijangka ${_.origin} ${K.verb} ${z}${_.minimum.toString()} ${K.unit}`;return`Terlalu kecil: dijangka ${_.origin} adalah ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${v[z.format]??_.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${_.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(_.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${_.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${_.origin}`;default:return"Input tidak sah"}}};function _7(){return{localeError:wb()}}var gb=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function U(_){return $[_]??null}let v={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},J={nan:"NaN",number:"getal"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ongeldige invoer: verwacht instanceof ${_.expected}, ontving ${W}`;return`Ongeldige invoer: verwacht ${z}, ontving ${W}`}case"invalid_value":if(_.values.length===1)return`Ongeldige invoer: verwacht ${m(_.values[0])}`;return`Ongeldige optie: verwacht één van ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin),W=_.origin==="date"?"laat":_.origin==="string"?"lang":"groot";if(K)return`Te ${W}: verwacht dat ${_.origin??"waarde"} ${z}${_.maximum.toString()} ${K.unit??"elementen"} ${K.verb}`;return`Te ${W}: verwacht dat ${_.origin??"waarde"} ${z}${_.maximum.toString()} is`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin),W=_.origin==="date"?"vroeg":_.origin==="string"?"kort":"klein";if(K)return`Te ${W}: verwacht dat ${_.origin} ${z}${_.minimum.toString()} ${K.unit} ${K.verb}`;return`Te ${W}: verwacht dat ${_.origin} ${z}${_.minimum.toString()} is`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${v[z.format]??_.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${_.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${_.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${_.origin}`;default:return"Ongeldige invoer"}}};function v7(){return{localeError:gb()}}var Nb=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function U(_){return $[_]??null}let v={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},J={nan:"NaN",number:"tall",array:"liste"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ugyldig input: forventet instanceof ${_.expected}, fikk ${W}`;return`Ugyldig input: forventet ${z}, fikk ${W}`}case"invalid_value":if(_.values.length===1)return`Ugyldig verdi: forventet ${m(_.values[0])}`;return`Ugyldig valg: forventet en av ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`For stor(t): forventet ${_.origin??"value"} til å ha ${z}${_.maximum.toString()} ${K.unit??"elementer"}`;return`For stor(t): forventet ${_.origin??"value"} til å ha ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`For lite(n): forventet ${_.origin} til å ha ${z}${_.minimum.toString()} ${K.unit}`;return`For lite(n): forventet ${_.origin} til å ha ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${v[z.format]??_.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${_.divisor}`;case"unrecognized_keys":return`${_.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${w(_.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${_.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${_.origin}`;default:return"Ugyldig input"}}};function J7(){return{localeError:Nb()}}var Sb=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function U(_){return $[_]??null}let v={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},J={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Fâsit giren: umulan instanceof ${_.expected}, alınan ${W}`;return`Fâsit giren: umulan ${z}, alınan ${W}`}case"invalid_value":if(_.values.length===1)return`Fâsit giren: umulan ${m(_.values[0])}`;return`Fâsit tercih: mûteberler ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Fazla büyük: ${_.origin??"value"}, ${z}${_.maximum.toString()} ${K.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${_.origin??"value"}, ${z}${_.maximum.toString()} olmalıydı.`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Fazla küçük: ${_.origin}, ${z}${_.minimum.toString()} ${K.unit} sahip olmalıydı.`;return`Fazla küçük: ${_.origin}, ${z}${_.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${v[z.format]??_.format}`}case"not_multiple_of":return`Fâsit sayı: ${_.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${_.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function z7(){return{localeError:Sb()}}var Rb=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function U(_){return $[_]??null}let v={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},J={nan:"NaN",number:"عدد",array:"ارې"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`ناسم ورودي: باید instanceof ${_.expected} وای, مګر ${W} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${W} ترلاسه شو`}case"invalid_value":if(_.values.length===1)return`ناسم ورودي: باید ${m(_.values[0])} وای`;return`ناسم انتخاب: باید یو له ${w(_.values,"|")} څخه وای`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`ډیر لوی: ${_.origin??"ارزښت"} باید ${z}${_.maximum.toString()} ${K.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${_.origin??"ارزښت"} باید ${z}${_.maximum.toString()} وي`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`ډیر کوچنی: ${_.origin} باید ${z}${_.minimum.toString()} ${K.unit} ولري`;return`ډیر کوچنی: ${_.origin} باید ${z}${_.minimum.toString()} وي`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${v[z.format]??_.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${_.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${_.keys.length>1?"کلیډونه":"کلیډ"}: ${w(_.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${_.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${_.origin} کې`;default:return"ناسمه ورودي"}}};function K7(){return{localeError:Rb()}}var Tb=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function U(_){return $[_]??null}let v={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},J={nan:"NaN",number:"liczba",array:"tablica"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${_.expected}, otrzymano ${W}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${W}`}case"invalid_value":if(_.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${m(_.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Za duża wartość: oczekiwano, że ${_.origin??"wartość"} będzie mieć ${z}${_.maximum.toString()} ${K.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${_.origin??"wartość"} będzie wynosić ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Za mała wartość: oczekiwano, że ${_.origin??"wartość"} będzie mieć ${z}${_.minimum.toString()} ${K.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${_.origin??"wartość"} będzie wynosić ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${v[z.format]??_.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${_.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${_.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${_.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function G7(){return{localeError:Tb()}}var yb=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function U(_){return $[_]??null}let v={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},J={nan:"NaN",number:"número",null:"nulo"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Tipo inválido: esperado instanceof ${_.expected}, recebido ${W}`;return`Tipo inválido: esperado ${z}, recebido ${W}`}case"invalid_value":if(_.values.length===1)return`Entrada inválida: esperado ${m(_.values[0])}`;return`Opção inválida: esperada uma das ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Muito grande: esperado que ${_.origin??"valor"} tivesse ${z}${_.maximum.toString()} ${K.unit??"elementos"}`;return`Muito grande: esperado que ${_.origin??"valor"} fosse ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Muito pequeno: esperado que ${_.origin} tivesse ${z}${_.minimum.toString()} ${K.unit}`;return`Muito pequeno: esperado que ${_.origin} fosse ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${v[z.format]??_.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${_.divisor}`;case"unrecognized_keys":return`Chave${_.keys.length>1?"s":""} desconhecida${_.keys.length>1?"s":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Chave inválida em ${_.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${_.origin}`;default:return"Campo inválido"}}};function W7(){return{localeError:yb()}}function iq($,U,v,J){let _=Math.abs($),z=_%10,K=_%100;if(K>=11&&K<=19)return J;if(z===1)return U;if(z>=2&&z<=4)return v;return J}var Cb=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function U(_){return $[_]??null}let v={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},J={nan:"NaN",number:"число",array:"массив"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Неверный ввод: ожидалось instanceof ${_.expected}, получено ${W}`;return`Неверный ввод: ожидалось ${z}, получено ${W}`}case"invalid_value":if(_.values.length===1)return`Неверный ввод: ожидалось ${m(_.values[0])}`;return`Неверный вариант: ожидалось одно из ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K){let W=Number(_.maximum),O=iq(W,K.unit.one,K.unit.few,K.unit.many);return`Слишком большое значение: ожидалось, что ${_.origin??"значение"} будет иметь ${z}${_.maximum.toString()} ${O}`}return`Слишком большое значение: ожидалось, что ${_.origin??"значение"} будет ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K){let W=Number(_.minimum),O=iq(W,K.unit.one,K.unit.few,K.unit.many);return`Слишком маленькое значение: ожидалось, что ${_.origin} будет иметь ${z}${_.minimum.toString()} ${O}`}return`Слишком маленькое значение: ожидалось, что ${_.origin} будет ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${v[z.format]??_.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${_.divisor}`;case"unrecognized_keys":return`Нераспознанн${_.keys.length>1?"ые":"ый"} ключ${_.keys.length>1?"и":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${_.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${_.origin}`;default:return"Неверные входные данные"}}};function O7(){return{localeError:Cb()}}var Db=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function U(_){return $[_]??null}let v={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},J={nan:"NaN",number:"število",array:"tabela"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Neveljaven vnos: pričakovano instanceof ${_.expected}, prejeto ${W}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${W}`}case"invalid_value":if(_.values.length===1)return`Neveljaven vnos: pričakovano ${m(_.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Preveliko: pričakovano, da bo ${_.origin??"vrednost"} imelo ${z}${_.maximum.toString()} ${K.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${_.origin??"vrednost"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Premajhno: pričakovano, da bo ${_.origin} imelo ${z}${_.minimum.toString()} ${K.unit}`;return`Premajhno: pričakovano, da bo ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${v[z.format]??_.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${_.divisor}`;case"unrecognized_keys":return`Neprepoznan${_.keys.length>1?"i ključi":" ključ"}: ${w(_.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${_.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${_.origin}`;default:return"Neveljaven vnos"}}};function Y7(){return{localeError:Db()}}var jb=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function U(_){return $[_]??null}let v={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},J={nan:"NaN",number:"antal",array:"lista"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ogiltig inmatning: förväntat instanceof ${_.expected}, fick ${W}`;return`Ogiltig inmatning: förväntat ${z}, fick ${W}`}case"invalid_value":if(_.values.length===1)return`Ogiltig inmatning: förväntat ${m(_.values[0])}`;return`Ogiltigt val: förväntade en av ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`För stor(t): förväntade ${_.origin??"värdet"} att ha ${z}${_.maximum.toString()} ${K.unit??"element"}`;return`För stor(t): förväntat ${_.origin??"värdet"} att ha ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`För lite(t): förväntade ${_.origin??"värdet"} att ha ${z}${_.minimum.toString()} ${K.unit}`;return`För lite(t): förväntade ${_.origin??"värdet"} att ha ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${v[z.format]??_.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${_.divisor}`;case"unrecognized_keys":return`${_.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${w(_.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${_.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${_.origin??"värdet"}`;default:return"Ogiltig input"}}};function Z7(){return{localeError:jb()}}var Vb=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function U(_){return $[_]??null}let v={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},J={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${_.expected}, பெறப்பட்டது ${W}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${W}`}case"invalid_value":if(_.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${m(_.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${w(_.values,"|")} இல் ஒன்று`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${_.origin??"மதிப்பு"} ${z}${_.maximum.toString()} ${K.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${_.origin??"மதிப்பு"} ${z}${_.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${_.origin} ${z}${_.minimum.toString()} ${K.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${_.origin} ${z}${_.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${v[z.format]??_.format}`}case"not_multiple_of":return`தவறான எண்: ${_.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${_.keys.length>1?"கள்":""}: ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${_.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function q7(){return{localeError:Vb()}}var fb=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function U(_){return $[_]??null}let v={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},J={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${_.expected} แต่ได้รับ ${W}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${W}`}case"invalid_value":if(_.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${m(_.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"ไม่เกิน":"น้อยกว่า",K=U(_.origin);if(K)return`เกินกำหนด: ${_.origin??"ค่า"} ควรมี${z} ${_.maximum.toString()} ${K.unit??"รายการ"}`;return`เกินกำหนด: ${_.origin??"ค่า"} ควรมี${z} ${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?"อย่างน้อย":"มากกว่า",K=U(_.origin);if(K)return`น้อยกว่ากำหนด: ${_.origin} ควรมี${z} ${_.minimum.toString()} ${K.unit}`;return`น้อยกว่ากำหนด: ${_.origin} ควรมี${z} ${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${v[z.format]??_.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${_.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${w(_.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${_.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${_.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function B7(){return{localeError:fb()}}var Eb=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function U(_){return $[_]??null}let v={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Geçersiz değer: beklenen instanceof ${_.expected}, alınan ${W}`;return`Geçersiz değer: beklenen ${z}, alınan ${W}`}case"invalid_value":if(_.values.length===1)return`Geçersiz değer: beklenen ${m(_.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Çok büyük: beklenen ${_.origin??"değer"} ${z}${_.maximum.toString()} ${K.unit??"öğe"}`;return`Çok büyük: beklenen ${_.origin??"değer"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Çok küçük: beklenen ${_.origin} ${z}${_.minimum.toString()} ${K.unit}`;return`Çok küçük: beklenen ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${v[z.format]??_.format}`}case"not_multiple_of":return`Geçersiz sayı: ${_.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${_.keys.length>1?"lar":""}: ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${_.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function X7(){return{localeError:Eb()}}var ub=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function U(_){return $[_]??null}let v={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},J={nan:"NaN",number:"число",array:"масив"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Неправильні вхідні дані: очікується instanceof ${_.expected}, отримано ${W}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${W}`}case"invalid_value":if(_.values.length===1)return`Неправильні вхідні дані: очікується ${m(_.values[0])}`;return`Неправильна опція: очікується одне з ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Занадто велике: очікується, що ${_.origin??"значення"} ${K.verb} ${z}${_.maximum.toString()} ${K.unit??"елементів"}`;return`Занадто велике: очікується, що ${_.origin??"значення"} буде ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Занадто мале: очікується, що ${_.origin} ${K.verb} ${z}${_.minimum.toString()} ${K.unit}`;return`Занадто мале: очікується, що ${_.origin} буде ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${v[z.format]??_.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${_.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${_.keys.length>1?"і":""}: ${w(_.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${_.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${_.origin}`;default:return"Неправильні вхідні дані"}}};function M_(){return{localeError:ub()}}function H7(){return M_()}var mb=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function U(_){return $[_]??null}let v={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},J={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`غلط ان پٹ: instanceof ${_.expected} متوقع تھا، ${W} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${W} موصول ہوا`}case"invalid_value":if(_.values.length===1)return`غلط ان پٹ: ${m(_.values[0])} متوقع تھا`;return`غلط آپشن: ${w(_.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`بہت بڑا: ${_.origin??"ویلیو"} کے ${z}${_.maximum.toString()} ${K.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${_.origin??"ویلیو"} کا ${z}${_.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`بہت چھوٹا: ${_.origin} کے ${z}${_.minimum.toString()} ${K.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${_.origin} کا ${z}${_.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${v[z.format]??_.format}`}case"not_multiple_of":return`غلط نمبر: ${_.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${_.keys.length>1?"ز":""}: ${w(_.keys,"، ")}`;case"invalid_key":return`${_.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${_.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Q7(){return{localeError:mb()}}var xb=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function U(_){return $[_]??null}let v={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},J={nan:"NaN",number:"raqam",array:"massiv"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${_.expected}, qabul qilingan ${W}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${W}`}case"invalid_value":if(_.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${m(_.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Juda katta: kutilgan ${_.origin??"qiymat"} ${z}${_.maximum.toString()} ${K.unit} ${K.verb}`;return`Juda katta: kutilgan ${_.origin??"qiymat"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Juda kichik: kutilgan ${_.origin} ${z}${_.minimum.toString()} ${K.unit} ${K.verb}`;return`Juda kichik: kutilgan ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${v[z.format]??_.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${_.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${_.keys.length>1?"lar":""}: ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${_.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function L7(){return{localeError:xb()}}var hb=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function U(_){return $[_]??null}let v={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},J={nan:"NaN",number:"số",array:"mảng"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${_.expected}, nhận được ${W}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${W}`}case"invalid_value":if(_.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${m(_.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Quá lớn: mong đợi ${_.origin??"giá trị"} ${K.verb} ${z}${_.maximum.toString()} ${K.unit??"phần tử"}`;return`Quá lớn: mong đợi ${_.origin??"giá trị"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Quá nhỏ: mong đợi ${_.origin} ${K.verb} ${z}${_.minimum.toString()} ${K.unit}`;return`Quá nhỏ: mong đợi ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${v[z.format]??_.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${_.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${w(_.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${_.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${_.origin}`;default:return"Đầu vào không hợp lệ"}}};function F7(){return{localeError:hb()}}var cb=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function U(_){return $[_]??null}let v={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},J={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`无效输入:期望 instanceof ${_.expected},实际接收 ${W}`;return`无效输入:期望 ${z},实际接收 ${W}`}case"invalid_value":if(_.values.length===1)return`无效输入:期望 ${m(_.values[0])}`;return`无效选项:期望以下之一 ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`数值过大:期望 ${_.origin??"值"} ${z}${_.maximum.toString()} ${K.unit??"个元素"}`;return`数值过大:期望 ${_.origin??"值"} ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`数值过小:期望 ${_.origin} ${z}${_.minimum.toString()} ${K.unit}`;return`数值过小:期望 ${_.origin} ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${v[z.format]??_.format}`}case"not_multiple_of":return`无效数字:必须是 ${_.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${w(_.keys,", ")}`;case"invalid_key":return`${_.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${_.origin} 中包含无效值(value)`;default:return"无效输入"}}};function P7(){return{localeError:cb()}}var lb=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function U(_){return $[_]??null}let v={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},J={nan:"NaN"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`無效的輸入值:預期為 instanceof ${_.expected},但收到 ${W}`;return`無效的輸入值:預期為 ${z},但收到 ${W}`}case"invalid_value":if(_.values.length===1)return`無效的輸入值:預期為 ${m(_.values[0])}`;return`無效的選項:預期為以下其中之一 ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`數值過大:預期 ${_.origin??"值"} 應為 ${z}${_.maximum.toString()} ${K.unit??"個元素"}`;return`數值過大:預期 ${_.origin??"值"} 應為 ${z}${_.maximum.toString()}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`數值過小:預期 ${_.origin} 應為 ${z}${_.minimum.toString()} ${K.unit}`;return`數值過小:預期 ${_.origin} 應為 ${z}${_.minimum.toString()}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${v[z.format]??_.format}`}case"not_multiple_of":return`無效的數字:必須為 ${_.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${_.keys.length>1?"們":""}:${w(_.keys,"、")}`;case"invalid_key":return`${_.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${_.origin} 中有無效的值`;default:return"無效的輸入值"}}};function k7(){return{localeError:lb()}}var rb=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function U(_){return $[_]??null}let v={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},J={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(_)=>{switch(_.code){case"invalid_type":{let z=J[_.expected]??_.expected,K=x(_.input),W=J[K]??K;if(/^[A-Z]/.test(_.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${_.expected}, àmọ̀ a rí ${W}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${W}`}case"invalid_value":if(_.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${m(_.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${w(_.values,"|")}`;case"too_big":{let z=_.inclusive?"<=":"<",K=U(_.origin);if(K)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${_.origin??"iye"} ${K.verb} ${z}${_.maximum} ${K.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${_.maximum}`}case"too_small":{let z=_.inclusive?">=":">",K=U(_.origin);if(K)return`Kéré ju: a ní láti jẹ́ pé ${_.origin} ${K.verb} ${z}${_.minimum} ${K.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${_.minimum}`}case"invalid_format":{let z=_;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${v[z.format]??_.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${_.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${w(_.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${_.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${_.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function b7(){return{localeError:rb()}}var pq,M7=Symbol("ZodOutput"),A7=Symbol("ZodInput");class I7{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...U){let v=U[0];if(this._map.set($,v),v&&typeof v==="object"&&"id"in v)this._idmap.set(v.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let U=this._map.get($);if(U&&typeof U==="object"&&"id"in U)this._idmap.delete(U.id);return this._map.delete($),this}get($){let U=$._zod.parent;if(U){let v={...this.get(U)??{}};delete v.id;let J={...v,...this._map.get($)};return Object.keys(J).length?J:void 0}return this._map.get($)}has($){return this._map.has($)}}function rv(){return new I7}(pq=globalThis).__zod_globalRegistry??(pq.__zod_globalRegistry=rv());var Z6=globalThis.__zod_globalRegistry;function w7($,U){return new $({type:"string",...c(U)})}function g7($,U){return new $({type:"string",coerce:!0,...c(U)})}function iv($,U){return new $({type:"string",format:"email",check:"string_format",abort:!1,...c(U)})}function I_($,U){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...c(U)})}function pv($,U){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...c(U)})}function ov($,U){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(U)})}function dv($,U){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(U)})}function nv($,U){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(U)})}function w_($,U){return new $({type:"string",format:"url",check:"string_format",abort:!1,...c(U)})}function tv($,U){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...c(U)})}function av($,U){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(U)})}function sv($,U){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...c(U)})}function ev($,U){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(U)})}function $J($,U){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...c(U)})}function UJ($,U){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...c(U)})}function _J($,U){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(U)})}function vJ($,U){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(U)})}function JJ($,U){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(U)})}function N7($,U){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...c(U)})}function zJ($,U){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(U)})}function KJ($,U){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(U)})}function GJ($,U){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...c(U)})}function WJ($,U){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...c(U)})}function OJ($,U){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...c(U)})}function YJ($,U){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...c(U)})}var S7={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function R7($,U){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(U)})}function T7($,U){return new $({type:"string",format:"date",check:"string_format",...c(U)})}function y7($,U){return new $({type:"string",format:"time",check:"string_format",precision:null,...c(U)})}function C7($,U){return new $({type:"string",format:"duration",check:"string_format",...c(U)})}function D7($,U){return new $({type:"number",checks:[],...c(U)})}function j7($,U){return new $({type:"number",coerce:!0,checks:[],...c(U)})}function V7($,U){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...c(U)})}function f7($,U){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...c(U)})}function E7($,U){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...c(U)})}function u7($,U){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...c(U)})}function m7($,U){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...c(U)})}function x7($,U){return new $({type:"boolean",...c(U)})}function h7($,U){return new $({type:"boolean",coerce:!0,...c(U)})}function c7($,U){return new $({type:"bigint",...c(U)})}function l7($,U){return new $({type:"bigint",coerce:!0,...c(U)})}function r7($,U){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...c(U)})}function i7($,U){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...c(U)})}function p7($,U){return new $({type:"symbol",...c(U)})}function o7($,U){return new $({type:"undefined",...c(U)})}function d7($,U){return new $({type:"null",...c(U)})}function n7($){return new $({type:"any"})}function t7($){return new $({type:"unknown"})}function a7($,U){return new $({type:"never",...c(U)})}function s7($,U){return new $({type:"void",...c(U)})}function e7($,U){return new $({type:"date",...c(U)})}function $K($,U){return new $({type:"date",coerce:!0,...c(U)})}function UK($,U){return new $({type:"nan",...c(U)})}function L4($,U){return new Cv({check:"less_than",...c(U),value:$,inclusive:!1})}function l6($,U){return new Cv({check:"less_than",...c(U),value:$,inclusive:!0})}function F4($,U){return new Dv({check:"greater_than",...c(U),value:$,inclusive:!1})}function y6($,U){return new Dv({check:"greater_than",...c(U),value:$,inclusive:!0})}function ZJ($){return F4(0,$)}function qJ($){return L4(0,$)}function BJ($){return l6(0,$)}function XJ($){return y6(0,$)}function K1($,U){return new U3({check:"multiple_of",...c(U),value:$})}function G1($,U){return new J3({check:"max_size",...c(U),maximum:$})}function P4($,U){return new z3({check:"min_size",...c(U),minimum:$})}function r1($,U){return new K3({check:"size_equals",...c(U),size:$})}function i1($,U){return new G3({check:"max_length",...c(U),maximum:$})}function V4($,U){return new W3({check:"min_length",...c(U),minimum:$})}function p1($,U){return new O3({check:"length_equals",...c(U),length:$})}function rU($,U){return new Y3({check:"string_format",format:"regex",...c(U),pattern:$})}function iU($){return new Z3({check:"string_format",format:"lowercase",...c($)})}function pU($){return new q3({check:"string_format",format:"uppercase",...c($)})}function oU($,U){return new B3({check:"string_format",format:"includes",...c(U),includes:$})}function dU($,U){return new X3({check:"string_format",format:"starts_with",...c(U),prefix:$})}function nU($,U){return new H3({check:"string_format",format:"ends_with",...c(U),suffix:$})}function HJ($,U,v){return new Q3({check:"property",property:$,schema:U,...c(v)})}function tU($,U){return new L3({check:"mime_type",mime:$,...c(U)})}function G4($){return new F3({check:"overwrite",tx:$})}function aU($){return G4((U)=>U.normalize($))}function sU(){return G4(($)=>$.trim())}function eU(){return G4(($)=>$.toLowerCase())}function $0(){return G4(($)=>$.toUpperCase())}function U0(){return G4(($)=>F5($))}function _K($,U,v){return new $({type:"array",element:U,...c(v)})}function pb($,U,v){return new $({type:"union",options:U,...c(v)})}function ob($,U,v){return new $({type:"union",options:U,inclusive:!1,...c(v)})}function db($,U,v,J){return new $({type:"union",options:v,discriminator:U,...c(J)})}function nb($,U,v){return new $({type:"intersection",left:U,right:v})}function tb($,U,v,J){let _=v instanceof Y$;return new $({type:"tuple",items:U,rest:_?v:null,...c(_?J:v)})}function ab($,U,v,J){return new $({type:"record",keyType:U,valueType:v,...c(J)})}function sb($,U,v,J){return new $({type:"map",keyType:U,valueType:v,...c(J)})}function eb($,U,v){return new $({type:"set",valueType:U,...c(v)})}function $M($,U,v){let J=Array.isArray(U)?Object.fromEntries(U.map((_)=>[_,_])):U;return new $({type:"enum",entries:J,...c(v)})}function UM($,U,v){return new $({type:"enum",entries:U,...c(v)})}function _M($,U,v){return new $({type:"literal",values:Array.isArray(U)?U:[U],...c(v)})}function vK($,U){return new $({type:"file",...c(U)})}function vM($,U){return new $({type:"transform",transform:U})}function JM($,U){return new $({type:"optional",innerType:U})}function zM($,U){return new $({type:"nullable",innerType:U})}function KM($,U,v){return new $({type:"default",innerType:U,get defaultValue(){return typeof v==="function"?v():k5(v)}})}function GM($,U,v){return new $({type:"nonoptional",innerType:U,...c(v)})}function WM($,U){return new $({type:"success",innerType:U})}function OM($,U,v){return new $({type:"catch",innerType:U,catchValue:typeof v==="function"?v:()=>v})}function YM($,U,v){return new $({type:"pipe",in:U,out:v})}function ZM($,U){return new $({type:"readonly",innerType:U})}function qM($,U,v){return new $({type:"template_literal",parts:U,...c(v)})}function BM($,U){return new $({type:"lazy",getter:U})}function XM($,U){return new $({type:"promise",innerType:U})}function JK($,U,v){let J=c(v);return J.abort??(J.abort=!0),new $({type:"custom",check:"custom",fn:U,...J})}function zK($,U,v){return new $({type:"custom",check:"custom",fn:U,...c(v)})}function KK($){let U=oq((v)=>{return v.addIssue=(J)=>{if(typeof J==="string")v.issues.push(fU(J,v.value,U._zod.def));else{let _=J;if(_.fatal)_.continue=!1;_.code??(_.code="custom"),_.input??(_.input=v.value),_.inst??(_.inst=U),_.continue??(_.continue=!U._zod.def.abort),v.issues.push(fU(_))}},$(v.value,v)});return U}function oq($,U){let v=new m$({check:"custom",...c(U)});return v._zod.check=$,v}function GK($){let U=new m$({check:"describe"});return U._zod.onattach=[(v)=>{let J=Z6.get(v)??{};Z6.add(v,{...J,description:$})}],U._zod.check=()=>{},U}function WK($){let U=new m$({check:"meta"});return U._zod.onattach=[(v)=>{let J=Z6.get(v)??{};Z6.add(v,{...J,...$})}],U._zod.check=()=>{},U}function OK($,U){let v=c(U),J=v.truthy??["true","1","yes","on","y","enabled"],_=v.falsy??["false","0","no","off","n","disabled"];if(v.case!=="sensitive")J=J.map((B)=>typeof B==="string"?B.toLowerCase():B),_=_.map((B)=>typeof B==="string"?B.toLowerCase():B);let z=new Set(J),K=new Set(_),W=$.Codec??F_,O=$.Boolean??Q_,Z=new($.String??l1)({type:"string",error:v.error}),q=new O({type:"boolean",error:v.error}),X=new W({type:"pipe",in:Z,out:q,transform:(B,L)=>{let P=B;if(v.case!=="sensitive")P=P.toLowerCase();if(z.has(P))return!0;else if(K.has(P))return!1;else return L.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...K],input:L.value,inst:X,continue:!1}),{}},reverseTransform:(B,L)=>{if(B===!0)return J[0]||"true";else return _[0]||"false"},error:v.error});return X}function _0($,U,v,J={}){let _=c(J),z={...c(J),check:"string_format",type:"string",format:U,fn:typeof v==="function"?v:(W)=>v.test(W),..._};if(v instanceof RegExp)z.pattern=v;return new $(z)}function W1($){let U=$?.target??"draft-2020-12";if(U==="draft-4")U="draft-04";if(U==="draft-7")U="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??Z6,target:U,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function R$($,U,v={path:[],schemaPath:[]}){var J;let _=$._zod.def,z=U.seen.get($);if(z){if(z.count++,v.schemaPath.includes($))z.cycle=v.path;return z.schema}let K={schema:{},count:1,cycle:void 0,path:v.path};U.seen.set($,K);let W=$._zod.toJSONSchema?.();if(W)K.schema=W;else{let Z={...v,schemaPath:[...v.schemaPath,$],path:v.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(U,K.schema,Z);else{let X=K.schema,B=U.processors[_.type];if(!B)throw Error(`[toJSONSchema]: Non-representable type encountered: ${_.type}`);B($,U,X,Z)}let q=$._zod.parent;if(q){if(!K.ref)K.ref=q;R$(q,U,Z),U.seen.get(q).isParent=!0}}let O=U.metadataRegistry.get($);if(O)Object.assign(K.schema,O);if(U.io==="input"&&C6($))delete K.schema.examples,delete K.schema.default;if(U.io==="input"&&K.schema._prefault)(J=K.schema).default??(J.default=K.schema._prefault);return delete K.schema._prefault,U.seen.get($).schema}function O1($,U){let v=$.seen.get(U);if(!v)throw Error("Unprocessed schema. This is a bug in Zod.");let J=new Map;for(let K of $.seen.entries()){let W=$.metadataRegistry.get(K[0])?.id;if(W){let O=J.get(W);if(O&&O!==K[0])throw Error(`Duplicate schema id "${W}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);J.set(W,K[0])}}let _=(K)=>{let W=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let q=$.external.registry.get(K[0])?.id,X=$.external.uri??((L)=>L);if(q)return{ref:X(q)};let B=K[1].defId??K[1].schema.id??`schema${$.counter++}`;return K[1].defId=B,{defId:B,ref:`${X("__shared")}#/${W}/${B}`}}if(K[1]===v)return{ref:"#"};let Y=`${"#"}/${W}/`,Z=K[1].schema.id??`__schema${$.counter++}`;return{defId:Z,ref:Y+Z}},z=(K)=>{if(K[1].schema.$ref)return;let W=K[1],{ref:O,defId:Y}=_(K);if(W.def={...W.schema},Y)W.defId=Y;let Z=W.schema;for(let q in Z)delete Z[q];Z.$ref=O};if($.cycles==="throw")for(let K of $.seen.entries()){let W=K[1];if(W.cycle)throw Error(`Cycle detected: #/${W.cycle?.join("/")}/<root>
150
150
 
151
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of $.seen.entries()){let G=J[1];if(v===J[0]){z(J);continue}if($.external){let O=$.external.registry.get(J[0])?.id;if(v!==J[0]&&O){z(J);continue}}if($.metadataRegistry.get(J[0])?.id){z(J);continue}if(G.cycle){z(J);continue}if(G.count>1){if($.reused==="ref"){z(J);continue}}}}function f4($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=(J)=>{let G=$.seen.get(J);if(G.ref===null)return;let b=G.def??G.schema,O={...b},W=G.ref;if(G.ref=null,W){_(W);let k=$.seen.get(W),Y=k.schema;if(Y.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))b.allOf=b.allOf??[],b.allOf.push(Y);else Object.assign(b,Y);if(Object.assign(b,O),J._zod.parent===W)for(let X in b){if(X==="$ref"||X==="allOf")continue;if(!(X in O))delete b[X]}if(Y.$ref&&k.def)for(let X in b){if(X==="$ref"||X==="allOf")continue;if(X in k.def&&JSON.stringify(b[X])===JSON.stringify(k.def[X]))delete b[X]}}let B=J._zod.parent;if(B&&B!==W){_(B);let k=$.seen.get(B);if(k?.schema.$ref){if(b.$ref=k.schema.$ref,k.def)for(let Y in b){if(Y==="$ref"||Y==="allOf")continue;if(Y in k.def&&JSON.stringify(b[Y])===JSON.stringify(k.def[Y]))delete b[Y]}}}$.override({zodSchema:J,jsonSchema:b,path:G.path??[]})};for(let J of[...$.seen.entries()].reverse())_(J[0]);let U={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let J=$.external.registry.get(v)?.id;if(!J)throw Error("Schema is missing an `id` property");U.$id=$.external.uri(J)}Object.assign(U,g.def??g.schema);let z=$.external?.defs??{};for(let J of $.seen.entries()){let G=J[1];if(G.def&&G.defId)z[G.defId]=G.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")U.$defs=z;else U.definitions=z;try{let J=JSON.parse(JSON.stringify(U));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:qU(v,"input",$.processors),output:qU(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function H6($,v){let g=v??{seen:new Set};if(g.seen.has($))return!1;g.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return H6(_.element,g);if(_.type==="set")return H6(_.valueType,g);if(_.type==="lazy")return H6(_.getter(),g);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return H6(_.innerType,g);if(_.type==="intersection")return H6(_.left,g)||H6(_.right,g);if(_.type==="record"||_.type==="map")return H6(_.keyType,g)||H6(_.valueType,g);if(_.type==="pipe")return H6(_.in,g)||H6(_.out,g);if(_.type==="object"){for(let U in _.shape)if(H6(_.shape[U],g))return!0;return!1}if(_.type==="union"){for(let U of _.options)if(H6(U,g))return!0;return!1}if(_.type==="tuple"){for(let U of _.items)if(H6(U,g))return!0;if(_.rest&&H6(_.rest,g))return!0;return!1}return!1}var x3=($,v={})=>(g)=>{let _=C4({...g,processors:v});return A$($,_),V4(_,$),f4(_,$)},qU=($,v,g={})=>(_)=>{let{libraryOptions:U,target:z}=_??{},J=C4({...U??{},target:z,io:v,processors:g});return A$($,J),V4(J,$),f4(J,$)};var fL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},h3=($,v,g,_)=>{let U=g;U.type="string";let{minimum:z,maximum:J,format:G,patterns:b,contentEncoding:O}=$._zod.bag;if(typeof z==="number")U.minLength=z;if(typeof J==="number")U.maxLength=J;if(G){if(U.format=fL[G]??G,U.format==="")delete U.format;if(G==="time")delete U.format}if(O)U.contentEncoding=O;if(b&&b.size>0){let W=[...b];if(W.length===1)U.pattern=W[0].source;else if(W.length>1)U.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},l3=($,v,g,_)=>{let U=g,{minimum:z,maximum:J,format:G,multipleOf:b,exclusiveMaximum:O,exclusiveMinimum:W}=$._zod.bag;if(typeof G==="string"&&G.includes("int"))U.type="integer";else U.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.minimum=W,U.exclusiveMinimum=!0;else U.exclusiveMinimum=W;if(typeof z==="number"){if(U.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete U.minimum;else delete U.exclusiveMinimum}if(typeof O==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.maximum=O,U.exclusiveMaximum=!0;else U.exclusiveMaximum=O;if(typeof J==="number"){if(U.maximum=J,typeof O==="number"&&v.target!=="draft-04")if(O<=J)delete U.maximum;else delete U.exclusiveMaximum}if(typeof b==="number")U.multipleOf=b},p3=($,v,g,_)=>{g.type="boolean"},o3=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},n3=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},t3=($,v,g,_)=>{if(v.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null"},d3=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},a3=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},s3=($,v,g,_)=>{g.not={}},e3=($,v,g,_)=>{},$5=($,v,g,_)=>{},v5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},U5=($,v,g,_)=>{let U=$._zod.def,z=K1(U.entries);if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";g.enum=z},g5=($,v,g,_)=>{let U=$._zod.def,z=[];for(let J of U.values)if(J===void 0){if(v.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(v.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(J));else z.push(J);if(z.length===0);else if(z.length===1){let J=z[0];if(g.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")g.enum=[J];else g.const=J}else{if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";if(z.every((J)=>typeof J==="boolean"))g.type="boolean";if(z.every((J)=>J===null))g.type="null";g.enum=z}},_5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},z5=($,v,g,_)=>{let U=g,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");U.type="string",U.pattern=z.source},J5=($,v,g,_)=>{let U=g,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:G,mime:b}=$._zod.bag;if(J!==void 0)z.minLength=J;if(G!==void 0)z.maxLength=G;if(b)if(b.length===1)z.contentMediaType=b[0],Object.assign(U,z);else Object.assign(U,z),U.anyOf=b.map((O)=>({contentMediaType:O}));else Object.assign(U,z)},G5=($,v,g,_)=>{g.type="boolean"},K5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},b5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},O5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},W5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},B5=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Y5=($,v,g,_)=>{let U=g,z=$._zod.def,{minimum:J,maximum:G}=$._zod.bag;if(typeof J==="number")U.minItems=J;if(typeof G==="number")U.maxItems=G;U.type="array",U.items=A$(z.element,v,{..._,path:[..._.path,"items"]})},k5=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object",U.properties={};let J=z.shape;for(let O in J)U.properties[O]=A$(J[O],v,{..._,path:[..._.path,"properties",O]});let G=new Set(Object.keys(J)),b=new Set([...G].filter((O)=>{let W=z.shape[O]._zod;if(v.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(b.size>0)U.required=Array.from(b);if(z.catchall?._zod.def.type==="never")U.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")U.additionalProperties=!1}else if(z.catchall)U.additionalProperties=A$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},L0=($,v,g,_)=>{let U=$._zod.def,z=U.inclusive===!1,J=U.options.map((G,b)=>A$(G,v,{..._,path:[..._.path,z?"oneOf":"anyOf",b]}));if(z)g.oneOf=J;else g.anyOf=J},q5=($,v,g,_)=>{let U=$._zod.def,z=A$(U.left,v,{..._,path:[..._.path,"allOf",0]}),J=A$(U.right,v,{..._,path:[..._.path,"allOf",1]}),G=(O)=>("allOf"in O)&&Object.keys(O).length===1,b=[...G(z)?z.allOf:[z],...G(J)?J.allOf:[J]];g.allOf=b},P5=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="array";let J=v.target==="draft-2020-12"?"prefixItems":"items",G=v.target==="draft-2020-12"?"items":v.target==="openapi-3.0"?"items":"additionalItems",b=z.items.map((k,Y)=>A$(k,v,{..._,path:[..._.path,J,Y]})),O=z.rest?A$(z.rest,v,{..._,path:[..._.path,G,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(U.prefixItems=b,O)U.items=O}else if(v.target==="openapi-3.0"){if(U.items={anyOf:b},O)U.items.anyOf.push(O);if(U.minItems=b.length,!O)U.maxItems=b.length}else if(U.items=b,O)U.additionalItems=O;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")U.minItems=W;if(typeof B==="number")U.maxItems=B},X5=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object";let J=z.keyType,b=J._zod.bag?.patterns;if(z.mode==="loose"&&b&&b.size>0){let W=A$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});U.patternProperties={};for(let B of b)U.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")U.propertyNames=A$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});U.additionalProperties=A$(z.valueType,v,{..._,path:[..._.path,"additionalProperties"]})}let O=J._zod.values;if(O){let W=[...O].filter((B)=>typeof B==="string"||typeof B==="number");if(W.length>0)U.required=W}},H5=($,v,g,_)=>{let U=$._zod.def,z=A$(U.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=U.innerType,g.nullable=!0;else g.anyOf=[z,{type:"null"}]},L5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},F5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.default=JSON.parse(JSON.stringify(U.defaultValue))},Z5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);if(z.ref=U.innerType,v.io==="input")g._prefault=JSON.parse(JSON.stringify(U.defaultValue))},I5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType;let J;try{J=U.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=J},Q5=($,v,g,_)=>{let U=$._zod.def,z=v.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;A$(z,v,_);let J=v.seen.get($);J.ref=z},w5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.readOnly=!0},A5=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},F0=($,v,g,_)=>{let U=$._zod.def;A$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},M5=($,v,g,_)=>{let U=$._zod.innerType;A$(U,v,_);let z=v.seen.get($);z.ref=U},H0={string:h3,number:l3,boolean:p3,bigint:o3,symbol:n3,null:t3,undefined:d3,void:a3,never:s3,any:e3,unknown:$5,date:v5,enum:U5,literal:g5,nan:_5,template_literal:z5,file:J5,success:G5,custom:K5,function:b5,transform:O5,map:W5,set:B5,array:Y5,object:k5,union:L0,intersection:q5,tuple:P5,record:X5,nullable:H5,nonoptional:L5,default:F5,prefault:Z5,catch:I5,pipe:Q5,readonly:w5,promise:A5,optional:F0,lazy:M5};function Z0($,v){if("_idmap"in $){let _=$,U=C4({...v,processors:H0}),z={};for(let b of _._idmap.entries()){let[O,W]=b;A$(W,U)}let J={},G={registry:_,uri:v?.uri,defs:z};U.external=G;for(let b of _._idmap.entries()){let[O,W]=b;V4(U,W),J[O]=f4(U,W)}if(Object.keys(z).length>0){let b=U.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[b]:z}}return{schemas:J}}let g=C4({...v,processors:H0});return A$($,g),V4(g,$),f4(g,$)}class S5{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";this.ctx=C4({processors:H0,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return A$($,this.ctx,v)}emit($,v){if(v){if(v.cycles)this.ctx.cycles=v.cycles;if(v.reused)this.ctx.reused=v.reused;if(v.external)this.ctx.external=v.external}V4(this.ctx,$);let g=f4(this.ctx,$),{"~standard":_,...U}=g;return U}}var KW={};var T1={};$4(T1,{xor:()=>sW,xid:()=>QW,void:()=>nW,uuidv7:()=>qW,uuidv6:()=>kW,uuidv4:()=>YW,uuid:()=>BW,url:()=>PW,unknown:()=>R$,union:()=>S$,undefined:()=>pW,ulid:()=>IW,uint64:()=>hW,uint32:()=>cW,tuple:()=>gG,transform:()=>o0,templateLiteral:()=>bB,symbol:()=>lW,superRefine:()=>yG,success:()=>JB,stringbool:()=>PB,stringFormat:()=>uW,string:()=>w,strictObject:()=>aW,set:()=>UB,refine:()=>NG,record:()=>j$,readonly:()=>IG,promise:()=>OB,preprocess:()=>x1,prefault:()=>qG,pipe:()=>C1,partialRecord:()=>eW,optional:()=>C$,object:()=>o,number:()=>Z$,nullish:()=>zB,nullable:()=>u1,null:()=>IU,nonoptional:()=>PG,never:()=>p0,nativeEnum:()=>gB,nanoid:()=>LW,nan:()=>GB,meta:()=>kB,map:()=>vB,mac:()=>MW,looseRecord:()=>$B,looseObject:()=>g6,literal:()=>d,lazy:()=>AG,ksuid:()=>wW,keyof:()=>dW,jwt:()=>jW,json:()=>XB,ipv6:()=>SW,ipv4:()=>AW,intersection:()=>QU,int64:()=>xW,int32:()=>mW,int:()=>S0,instanceof:()=>qB,httpUrl:()=>XW,hostname:()=>CW,hex:()=>VW,hash:()=>fW,guid:()=>WW,function:()=>WB,float64:()=>EW,float32:()=>rW,file:()=>_B,exactOptional:()=>OG,enum:()=>_6,emoji:()=>HW,email:()=>OW,e164:()=>TW,discriminatedUnion:()=>m1,describe:()=>YB,date:()=>tW,custom:()=>s0,cuid2:()=>ZW,cuid:()=>FW,codec:()=>KB,cidrv6:()=>yW,cidrv4:()=>NW,check:()=>BB,catch:()=>LG,boolean:()=>n$,bigint:()=>iW,base64url:()=>DW,base64:()=>RW,array:()=>q$,any:()=>oW,_function:()=>WB,_default:()=>YG,_ZodString:()=>N0,ZodXor:()=>e5,ZodXID:()=>C0,ZodVoid:()=>a5,ZodUnknown:()=>t5,ZodUnion:()=>E1,ZodUndefined:()=>p5,ZodUUID:()=>e6,ZodURL:()=>V1,ZodULID:()=>u0,ZodType:()=>b$,ZodTuple:()=>UG,ZodTransform:()=>KG,ZodTemplateLiteral:()=>QG,ZodSymbol:()=>l5,ZodSuccess:()=>XG,ZodStringFormat:()=>y$,ZodString:()=>XU,ZodSet:()=>zG,ZodRecord:()=>c1,ZodReadonly:()=>ZG,ZodPromise:()=>MG,ZodPrefault:()=>kG,ZodPipe:()=>d0,ZodOptional:()=>n0,ZodObject:()=>r1,ZodNumberFormat:()=>kv,ZodNumber:()=>LU,ZodNullable:()=>WG,ZodNull:()=>o5,ZodNonOptional:()=>t0,ZodNever:()=>d5,ZodNanoID:()=>D0,ZodNaN:()=>FG,ZodMap:()=>_G,ZodMAC:()=>h5,ZodLiteral:()=>JG,ZodLazy:()=>wG,ZodKSUID:()=>V0,ZodJWT:()=>h0,ZodIntersection:()=>vG,ZodIPv6:()=>r0,ZodIPv4:()=>f0,ZodGUID:()=>j1,ZodFunction:()=>SG,ZodFile:()=>GG,ZodExactOptional:()=>bG,ZodEnum:()=>PU,ZodEmoji:()=>R0,ZodEmail:()=>y0,ZodE164:()=>x0,ZodDiscriminatedUnion:()=>$G,ZodDefault:()=>BG,ZodDate:()=>f1,ZodCustomStringFormat:()=>HU,ZodCustom:()=>i1,ZodCodec:()=>a0,ZodCatch:()=>HG,ZodCUID2:()=>j0,ZodCUID:()=>T0,ZodCIDRv6:()=>m0,ZodCIDRv4:()=>E0,ZodBoolean:()=>FU,ZodBigIntFormat:()=>l0,ZodBigInt:()=>ZU,ZodBase64URL:()=>i0,ZodBase64:()=>c0,ZodArray:()=>s5,ZodAny:()=>n5});var I0={};$4(I0,{uppercase:()=>_U,trim:()=>OU,toUpperCase:()=>BU,toLowerCase:()=>WU,startsWith:()=>JU,slugify:()=>YU,size:()=>Wv,regex:()=>UU,property:()=>X0,positive:()=>Y0,overwrite:()=>x6,normalize:()=>bU,nonpositive:()=>q0,nonnegative:()=>P0,negative:()=>k0,multipleOf:()=>j4,minSize:()=>s6,minLength:()=>b4,mime:()=>KU,maxSize:()=>u4,maxLength:()=>Bv,lte:()=>y6,lt:()=>d6,lowercase:()=>gU,length:()=>Yv,includes:()=>zU,gte:()=>X6,gt:()=>a6,endsWith:()=>GU});var r4={};$4(r4,{time:()=>R5,duration:()=>D5,datetime:()=>N5,date:()=>y5,ZodISOTime:()=>A0,ZodISODuration:()=>M0,ZodISODateTime:()=>Q0,ZodISODate:()=>w0});var Q0=Z("ZodISODateTime",($,v)=>{W8.init($,v),y$.init($,v)});function N5($){return K3(Q0,$)}var w0=Z("ZodISODate",($,v)=>{B8.init($,v),y$.init($,v)});function y5($){return b3(w0,$)}var A0=Z("ZodISOTime",($,v)=>{Y8.init($,v),y$.init($,v)});function R5($){return O3(A0,$)}var M0=Z("ZodISODuration",($,v)=>{k8.init($,v),y$.init($,v)});function D5($){return W3(M0,$)}var bW=($,v)=>{Y1.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(g)=>q1($,g)},flatten:{value:(g)=>k1($,g)},addIssue:{value:(g)=>{$.issues.push(g),$.message=JSON.stringify($.issues,pv,2)}},addIssues:{value:(g)=>{$.issues.push(...g),$.message=JSON.stringify($.issues,pv,2)}},isEmpty:{get(){return $.issues.length===0}}})},EL=Z("ZodError",bW),A6=Z("ZodError",bW,{Parent:Error});var T5=tv(A6),j5=dv(A6),u5=av(A6),C5=ev(A6),V5=A_(A6),f5=M_(A6),r5=S_(A6),E5=N_(A6),m5=y_(A6),c5=R_(A6),i5=D_(A6),x5=T_(A6);var b$=Z("ZodType",($,v)=>{return z$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:qU($,"input"),output:qU($,"output")}}),$.toJSONSchema=x3($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...g)=>{return $.clone(V.mergeDefs(v,{checks:[...v.checks??[],...g.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(g,_)=>P6($,g,_),$.brand=()=>$,$.register=(g,_)=>{return g.add($,_),$},$.parse=(g,_)=>T5($,g,_,{callee:$.parse}),$.safeParse=(g,_)=>u5($,g,_),$.parseAsync=async(g,_)=>j5($,g,_,{callee:$.parseAsync}),$.safeParseAsync=async(g,_)=>C5($,g,_),$.spa=$.safeParseAsync,$.encode=(g,_)=>V5($,g,_),$.decode=(g,_)=>f5($,g,_),$.encodeAsync=async(g,_)=>r5($,g,_),$.decodeAsync=async(g,_)=>E5($,g,_),$.safeEncode=(g,_)=>m5($,g,_),$.safeDecode=(g,_)=>c5($,g,_),$.safeEncodeAsync=async(g,_)=>i5($,g,_),$.safeDecodeAsync=async(g,_)=>x5($,g,_),$.refine=(g,_)=>$.check(NG(g,_)),$.superRefine=(g)=>$.check(yG(g)),$.overwrite=(g)=>$.check(x6(g)),$.optional=()=>C$($),$.exactOptional=()=>OG($),$.nullable=()=>u1($),$.nullish=()=>C$(u1($)),$.nonoptional=(g)=>PG($,g),$.array=()=>q$($),$.or=(g)=>S$([$,g]),$.and=(g)=>QU($,g),$.transform=(g)=>C1($,o0(g)),$.default=(g)=>YG($,g),$.prefault=(g)=>qG($,g),$.catch=(g)=>LG($,g),$.pipe=(g)=>C1($,g),$.readonly=()=>IG($),$.describe=(g)=>{let _=$.clone();return U6.add(_,{description:g}),_},Object.defineProperty($,"description",{get(){return U6.get($)?.description},configurable:!0}),$.meta=(...g)=>{if(g.length===0)return U6.get($);let _=$.clone();return U6.add(_,g[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(g)=>g($),$}),N0=Z("_ZodString",($,v)=>{Ov.init($,v),b$.init($,v),$._zod.processJSONSchema=(_,U,z)=>h3($,_,U,z);let g=$._zod.bag;$.format=g.format??null,$.minLength=g.minimum??null,$.maxLength=g.maximum??null,$.regex=(..._)=>$.check(UU(..._)),$.includes=(..._)=>$.check(zU(..._)),$.startsWith=(..._)=>$.check(JU(..._)),$.endsWith=(..._)=>$.check(GU(..._)),$.min=(..._)=>$.check(b4(..._)),$.max=(..._)=>$.check(Bv(..._)),$.length=(..._)=>$.check(Yv(..._)),$.nonempty=(..._)=>$.check(b4(1,..._)),$.lowercase=(_)=>$.check(gU(_)),$.uppercase=(_)=>$.check(_U(_)),$.trim=()=>$.check(OU()),$.normalize=(..._)=>$.check(bU(..._)),$.toLowerCase=()=>$.check(WU()),$.toUpperCase=()=>$.check(BU()),$.slugify=()=>$.check(YU())}),XU=Z("ZodString",($,v)=>{Ov.init($,v),N0.init($,v),$.email=(g)=>$.check(o_(y0,g)),$.url=(g)=>$.check(D1(V1,g)),$.jwt=(g)=>$.check(B0(h0,g)),$.emoji=(g)=>$.check(s_(R0,g)),$.guid=(g)=>$.check(R1(j1,g)),$.uuid=(g)=>$.check(n_(e6,g)),$.uuidv4=(g)=>$.check(t_(e6,g)),$.uuidv6=(g)=>$.check(d_(e6,g)),$.uuidv7=(g)=>$.check(a_(e6,g)),$.nanoid=(g)=>$.check(e_(D0,g)),$.guid=(g)=>$.check(R1(j1,g)),$.cuid=(g)=>$.check($0(T0,g)),$.cuid2=(g)=>$.check(v0(j0,g)),$.ulid=(g)=>$.check(U0(u0,g)),$.base64=(g)=>$.check(b0(c0,g)),$.base64url=(g)=>$.check(O0(i0,g)),$.xid=(g)=>$.check(g0(C0,g)),$.ksuid=(g)=>$.check(_0(V0,g)),$.ipv4=(g)=>$.check(z0(f0,g)),$.ipv6=(g)=>$.check(J0(r0,g)),$.cidrv4=(g)=>$.check(G0(E0,g)),$.cidrv6=(g)=>$.check(K0(m0,g)),$.e164=(g)=>$.check(W0(x0,g)),$.datetime=(g)=>$.check(N5(g)),$.date=(g)=>$.check(y5(g)),$.time=(g)=>$.check(R5(g)),$.duration=(g)=>$.check(D5(g))});function w($){return _3(XU,$)}var y$=Z("ZodStringFormat",($,v)=>{N$.init($,v),N0.init($,v)}),y0=Z("ZodEmail",($,v)=>{U8.init($,v),y$.init($,v)});function OW($){return o_(y0,$)}var j1=Z("ZodGUID",($,v)=>{$8.init($,v),y$.init($,v)});function WW($){return R1(j1,$)}var e6=Z("ZodUUID",($,v)=>{v8.init($,v),y$.init($,v)});function BW($){return n_(e6,$)}function YW($){return t_(e6,$)}function kW($){return d_(e6,$)}function qW($){return a_(e6,$)}var V1=Z("ZodURL",($,v)=>{g8.init($,v),y$.init($,v)});function PW($){return D1(V1,$)}function XW($){return D1(V1,{protocol:/^https?$/,hostname:C6.domain,...V.normalizeParams($)})}var R0=Z("ZodEmoji",($,v)=>{_8.init($,v),y$.init($,v)});function HW($){return s_(R0,$)}var D0=Z("ZodNanoID",($,v)=>{z8.init($,v),y$.init($,v)});function LW($){return e_(D0,$)}var T0=Z("ZodCUID",($,v)=>{J8.init($,v),y$.init($,v)});function FW($){return $0(T0,$)}var j0=Z("ZodCUID2",($,v)=>{G8.init($,v),y$.init($,v)});function ZW($){return v0(j0,$)}var u0=Z("ZodULID",($,v)=>{K8.init($,v),y$.init($,v)});function IW($){return U0(u0,$)}var C0=Z("ZodXID",($,v)=>{b8.init($,v),y$.init($,v)});function QW($){return g0(C0,$)}var V0=Z("ZodKSUID",($,v)=>{O8.init($,v),y$.init($,v)});function wW($){return _0(V0,$)}var f0=Z("ZodIPv4",($,v)=>{q8.init($,v),y$.init($,v)});function AW($){return z0(f0,$)}var h5=Z("ZodMAC",($,v)=>{X8.init($,v),y$.init($,v)});function MW($){return J3(h5,$)}var r0=Z("ZodIPv6",($,v)=>{P8.init($,v),y$.init($,v)});function SW($){return J0(r0,$)}var E0=Z("ZodCIDRv4",($,v)=>{H8.init($,v),y$.init($,v)});function NW($){return G0(E0,$)}var m0=Z("ZodCIDRv6",($,v)=>{L8.init($,v),y$.init($,v)});function yW($){return K0(m0,$)}var c0=Z("ZodBase64",($,v)=>{Z8.init($,v),y$.init($,v)});function RW($){return b0(c0,$)}var i0=Z("ZodBase64URL",($,v)=>{I8.init($,v),y$.init($,v)});function DW($){return O0(i0,$)}var x0=Z("ZodE164",($,v)=>{Q8.init($,v),y$.init($,v)});function TW($){return W0(x0,$)}var h0=Z("ZodJWT",($,v)=>{w8.init($,v),y$.init($,v)});function jW($){return B0(h0,$)}var HU=Z("ZodCustomStringFormat",($,v)=>{A8.init($,v),y$.init($,v)});function uW($,v,g={}){return kU(HU,$,v,g)}function CW($){return kU(HU,"hostname",C6.hostname,$)}function VW($){return kU(HU,"hex",C6.hex,$)}function fW($,v){let g=v?.enc??"hex",_=`${$}_${g}`,U=C6[_];if(!U)throw Error(`Unrecognized hash format: ${_}`);return kU(HU,_,U,v)}var LU=Z("ZodNumber",($,v)=>{i_.init($,v),b$.init($,v),$._zod.processJSONSchema=(_,U,z)=>l3($,_,U,z),$.gt=(_,U)=>$.check(a6(_,U)),$.gte=(_,U)=>$.check(X6(_,U)),$.min=(_,U)=>$.check(X6(_,U)),$.lt=(_,U)=>$.check(d6(_,U)),$.lte=(_,U)=>$.check(y6(_,U)),$.max=(_,U)=>$.check(y6(_,U)),$.int=(_)=>$.check(S0(_)),$.safe=(_)=>$.check(S0(_)),$.positive=(_)=>$.check(a6(0,_)),$.nonnegative=(_)=>$.check(X6(0,_)),$.negative=(_)=>$.check(d6(0,_)),$.nonpositive=(_)=>$.check(y6(0,_)),$.multipleOf=(_,U)=>$.check(j4(_,U)),$.step=(_,U)=>$.check(j4(_,U)),$.finite=()=>$;let g=$._zod.bag;$.minValue=Math.max(g.minimum??Number.NEGATIVE_INFINITY,g.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(g.maximum??Number.POSITIVE_INFINITY,g.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(g.format??"").includes("int")||Number.isSafeInteger(g.multipleOf??0.5),$.isFinite=!0,$.format=g.format??null});function Z$($){return B3(LU,$)}var kv=Z("ZodNumberFormat",($,v)=>{M8.init($,v),LU.init($,v)});function S0($){return k3(kv,$)}function rW($){return q3(kv,$)}function EW($){return P3(kv,$)}function mW($){return X3(kv,$)}function cW($){return H3(kv,$)}var FU=Z("ZodBoolean",($,v)=>{I1.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>p3($,g,_,U)});function n$($){return L3(FU,$)}var ZU=Z("ZodBigInt",($,v)=>{x_.init($,v),b$.init($,v),$._zod.processJSONSchema=(_,U,z)=>o3($,_,U,z),$.gte=(_,U)=>$.check(X6(_,U)),$.min=(_,U)=>$.check(X6(_,U)),$.gt=(_,U)=>$.check(a6(_,U)),$.gte=(_,U)=>$.check(X6(_,U)),$.min=(_,U)=>$.check(X6(_,U)),$.lt=(_,U)=>$.check(d6(_,U)),$.lte=(_,U)=>$.check(y6(_,U)),$.max=(_,U)=>$.check(y6(_,U)),$.positive=(_)=>$.check(a6(BigInt(0),_)),$.negative=(_)=>$.check(d6(BigInt(0),_)),$.nonpositive=(_)=>$.check(y6(BigInt(0),_)),$.nonnegative=(_)=>$.check(X6(BigInt(0),_)),$.multipleOf=(_,U)=>$.check(j4(_,U));let g=$._zod.bag;$.minValue=g.minimum??null,$.maxValue=g.maximum??null,$.format=g.format??null});function iW($){return Z3(ZU,$)}var l0=Z("ZodBigIntFormat",($,v)=>{S8.init($,v),ZU.init($,v)});function xW($){return Q3(l0,$)}function hW($){return w3(l0,$)}var l5=Z("ZodSymbol",($,v)=>{N8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>n3($,g,_,U)});function lW($){return A3(l5,$)}var p5=Z("ZodUndefined",($,v)=>{y8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>d3($,g,_,U)});function pW($){return M3(p5,$)}var o5=Z("ZodNull",($,v)=>{R8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>t3($,g,_,U)});function IU($){return S3(o5,$)}var n5=Z("ZodAny",($,v)=>{D8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>e3($,g,_,U)});function oW(){return N3(n5)}var t5=Z("ZodUnknown",($,v)=>{T8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>$5($,g,_,U)});function R$(){return y3(t5)}var d5=Z("ZodNever",($,v)=>{j8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>s3($,g,_,U)});function p0($){return R3(d5,$)}var a5=Z("ZodVoid",($,v)=>{u8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>a3($,g,_,U)});function nW($){return D3(a5,$)}var f1=Z("ZodDate",($,v)=>{C8.init($,v),b$.init($,v),$._zod.processJSONSchema=(_,U,z)=>v5($,_,U,z),$.min=(_,U)=>$.check(X6(_,U)),$.max=(_,U)=>$.check(y6(_,U));let g=$._zod.bag;$.minDate=g.minimum?new Date(g.minimum):null,$.maxDate=g.maximum?new Date(g.maximum):null});function tW($){return T3(f1,$)}var s5=Z("ZodArray",($,v)=>{V8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Y5($,g,_,U),$.element=v.element,$.min=(g,_)=>$.check(b4(g,_)),$.nonempty=(g)=>$.check(b4(1,g)),$.max=(g,_)=>$.check(Bv(g,_)),$.length=(g,_)=>$.check(Yv(g,_)),$.unwrap=()=>$.element});function q$($,v){return C3(s5,$,v)}function dW($){let v=$._zod.def.shape;return _6(Object.keys(v))}var r1=Z("ZodObject",($,v)=>{f8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>k5($,g,_,U),V.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>_6(Object.keys($._zod.def.shape)),$.catchall=(g)=>$.clone({...$._zod.def,catchall:g}),$.passthrough=()=>$.clone({...$._zod.def,catchall:R$()}),$.loose=()=>$.clone({...$._zod.def,catchall:R$()}),$.strict=()=>$.clone({...$._zod.def,catchall:p0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(g)=>{return V.extend($,g)},$.safeExtend=(g)=>{return V.safeExtend($,g)},$.merge=(g)=>V.merge($,g),$.pick=(g)=>V.pick($,g),$.omit=(g)=>V.omit($,g),$.partial=(...g)=>V.partial(n0,$,g[0]),$.required=(...g)=>V.required(t0,$,g[0])});function o($,v){let g={type:"object",shape:$??{},...V.normalizeParams(v)};return new r1(g)}function aW($,v){return new r1({type:"object",shape:$,catchall:p0(),...V.normalizeParams(v)})}function g6($,v){return new r1({type:"object",shape:$,catchall:R$(),...V.normalizeParams(v)})}var E1=Z("ZodUnion",($,v)=>{Q1.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>L0($,g,_,U),$.options=v.options});function S$($,v){return new E1({type:"union",options:$,...V.normalizeParams(v)})}var e5=Z("ZodXor",($,v)=>{E1.init($,v),r8.init($,v),$._zod.processJSONSchema=(g,_,U)=>L0($,g,_,U),$.options=v.options});function sW($,v){return new e5({type:"union",options:$,inclusive:!1,...V.normalizeParams(v)})}var $G=Z("ZodDiscriminatedUnion",($,v)=>{E1.init($,v),E8.init($,v)});function m1($,v,g){return new $G({type:"union",options:v,discriminator:$,...V.normalizeParams(g)})}var vG=Z("ZodIntersection",($,v)=>{m8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>q5($,g,_,U)});function QU($,v){return new vG({type:"intersection",left:$,right:v})}var UG=Z("ZodTuple",($,v)=>{h_.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>P5($,g,_,U),$.rest=(g)=>$.clone({...$._zod.def,rest:g})});function gG($,v,g){let _=v instanceof z$,U=_?g:v;return new UG({type:"tuple",items:$,rest:_?v:null,...V.normalizeParams(U)})}var c1=Z("ZodRecord",($,v)=>{c8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>X5($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType});function j$($,v,g){return new c1({type:"record",keyType:$,valueType:v,...V.normalizeParams(g)})}function eW($,v,g){let _=P6($);return _._zod.values=void 0,new c1({type:"record",keyType:_,valueType:v,...V.normalizeParams(g)})}function $B($,v,g){return new c1({type:"record",keyType:$,valueType:v,mode:"loose",...V.normalizeParams(g)})}var _G=Z("ZodMap",($,v)=>{i8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>W5($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...g)=>$.check(s6(...g)),$.nonempty=(g)=>$.check(s6(1,g)),$.max=(...g)=>$.check(u4(...g)),$.size=(...g)=>$.check(Wv(...g))});function vB($,v,g){return new _G({type:"map",keyType:$,valueType:v,...V.normalizeParams(g)})}var zG=Z("ZodSet",($,v)=>{x8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>B5($,g,_,U),$.min=(...g)=>$.check(s6(...g)),$.nonempty=(g)=>$.check(s6(1,g)),$.max=(...g)=>$.check(u4(...g)),$.size=(...g)=>$.check(Wv(...g))});function UB($,v){return new zG({type:"set",valueType:$,...V.normalizeParams(v)})}var PU=Z("ZodEnum",($,v)=>{h8.init($,v),b$.init($,v),$._zod.processJSONSchema=(_,U,z)=>U5($,_,U,z),$.enum=v.entries,$.options=Object.values(v.entries);let g=new Set(Object.keys(v.entries));$.extract=(_,U)=>{let z={};for(let J of _)if(g.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new PU({...v,checks:[],...V.normalizeParams(U),entries:z})},$.exclude=(_,U)=>{let z={...v.entries};for(let J of _)if(g.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new PU({...v,checks:[],...V.normalizeParams(U),entries:z})}});function _6($,v){let g=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new PU({type:"enum",entries:g,...V.normalizeParams(v)})}function gB($,v){return new PU({type:"enum",entries:$,...V.normalizeParams(v)})}var JG=Z("ZodLiteral",($,v)=>{l8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>g5($,g,_,U),$.values=new Set(v.values),Object.defineProperty($,"value",{get(){if(v.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return v.values[0]}})});function d($,v){return new JG({type:"literal",values:Array.isArray($)?$:[$],...V.normalizeParams(v)})}var GG=Z("ZodFile",($,v)=>{p8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>J5($,g,_,U),$.min=(g,_)=>$.check(s6(g,_)),$.max=(g,_)=>$.check(u4(g,_)),$.mime=(g,_)=>$.check(KU(Array.isArray(g)?g:[g],_))});function _B($){return V3(GG,$)}var KG=Z("ZodTransform",($,v)=>{o8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>O5($,g,_,U),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new Gv($.constructor.name);g.addIssue=(z)=>{if(typeof z==="string")g.issues.push(V.issue(z,g.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=g.value),J.inst??(J.inst=$),g.issues.push(V.issue(J))}};let U=v.transform(g.value,g);if(U instanceof Promise)return U.then((z)=>{return g.value=z,g});return g.value=U,g}});function o0($){return new KG({type:"transform",transform:$})}var n0=Z("ZodOptional",($,v)=>{l_.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>F0($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function C$($){return new n0({type:"optional",innerType:$})}var bG=Z("ZodExactOptional",($,v)=>{n8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>F0($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function OG($){return new bG({type:"optional",innerType:$})}var WG=Z("ZodNullable",($,v)=>{t8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>H5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function u1($){return new WG({type:"nullable",innerType:$})}function zB($){return C$(u1($))}var BG=Z("ZodDefault",($,v)=>{d8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>F5($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function YG($,v){return new BG({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():V.shallowClone(v)}})}var kG=Z("ZodPrefault",($,v)=>{a8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Z5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function qG($,v){return new kG({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():V.shallowClone(v)}})}var t0=Z("ZodNonOptional",($,v)=>{s8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>L5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function PG($,v){return new t0({type:"nonoptional",innerType:$,...V.normalizeParams(v)})}var XG=Z("ZodSuccess",($,v)=>{e8.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>G5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function JB($){return new XG({type:"success",innerType:$})}var HG=Z("ZodCatch",($,v)=>{$9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>I5($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function LG($,v){return new HG({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var FG=Z("ZodNaN",($,v)=>{v9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>_5($,g,_,U)});function GB($){return u3(FG,$)}var d0=Z("ZodPipe",($,v)=>{U9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Q5($,g,_,U),$.in=v.in,$.out=v.out});function C1($,v){return new d0({type:"pipe",in:$,out:v})}var a0=Z("ZodCodec",($,v)=>{d0.init($,v),w1.init($,v)});function KB($,v,g){return new a0({type:"pipe",in:$,out:v,transform:g.decode,reverseTransform:g.encode})}var ZG=Z("ZodReadonly",($,v)=>{g9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>w5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function IG($){return new ZG({type:"readonly",innerType:$})}var QG=Z("ZodTemplateLiteral",($,v)=>{_9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>z5($,g,_,U)});function bB($,v){return new QG({type:"template_literal",parts:$,...V.normalizeParams(v)})}var wG=Z("ZodLazy",($,v)=>{G9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>M5($,g,_,U),$.unwrap=()=>$._zod.def.getter()});function AG($){return new wG({type:"lazy",getter:$})}var MG=Z("ZodPromise",($,v)=>{J9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>A5($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function OB($){return new MG({type:"promise",innerType:$})}var SG=Z("ZodFunction",($,v)=>{z9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>b5($,g,_,U)});function WB($){return new SG({type:"function",input:Array.isArray($?.input)?gG($?.input):$?.input??q$(R$()),output:$?.output??R$()})}var i1=Z("ZodCustom",($,v)=>{K9.init($,v),b$.init($,v),$._zod.processJSONSchema=(g,_,U)=>K5($,g,_,U)});function BB($){let v=new T$({check:"custom"});return v._zod.check=$,v}function s0($,v){return f3(i1,$??(()=>!0),v)}function NG($,v={}){return r3(i1,$,v)}function yG($){return E3($)}var YB=m3,kB=c3;function qB($,v={}){let g=new i1({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...V.normalizeParams(v)});return g._zod.bag.Class=$,g._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:g,path:[...g._zod.def.path??[]]})},g}var PB=(...$)=>i3({Codec:a0,Boolean:FU,String:XU},...$);function XB($){let v=AG(()=>{return S$([w($),Z$(),n$(),IU(),q$(v),j$(w(),v)])});return v}function x1($,v){return C1(o0($),v)}var cL={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function iL($){o$({customError:$})}function xL(){return o$().customError}var RG;(function($){})(RG||(RG={}));var h={...T1,...I0,iso:r4},hL=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function lL($,v){let g=$.$schema;if(g==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(g==="http://json-schema.org/draft-07/schema#")return"draft-7";if(g==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function pL($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let g=$.slice(1).split("/").filter(Boolean);if(g.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(g[0]===_){let U=g[1];if(!U||!v.defs[U])throw Error(`Reference not found: ${$}`);return v.defs[U]}throw Error(`Reference not found: ${$}`)}function HB($,v){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return h.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let U=$.$ref;if(v.refs.has(U))return v.refs.get(U);if(v.processing.has(U))return h.lazy(()=>{if(!v.refs.has(U))throw Error(`Circular reference not resolved: ${U}`);return v.refs.get(U)});v.processing.add(U);let z=pL(U,v),J=W6(z,v);return v.refs.set(U,J),v.processing.delete(U),J}if($.enum!==void 0){let U=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&U.length===1&&U[0]===null)return h.null();if(U.length===0)return h.never();if(U.length===1)return h.literal(U[0]);if(U.every((J)=>typeof J==="string"))return h.enum(U);let z=U.map((J)=>h.literal(J));if(z.length<2)return z[0];return h.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return h.literal($.const);let g=$.type;if(Array.isArray(g)){let U=g.map((z)=>{let J={...$,type:z};return HB(J,v)});if(U.length===0)return h.never();if(U.length===1)return U[0];return h.union(U)}if(!g)return h.any();let _;switch(g){case"string":{let U=h.string();if($.format){let z=$.format;if(z==="email")U=U.check(h.email());else if(z==="uri"||z==="uri-reference")U=U.check(h.url());else if(z==="uuid"||z==="guid")U=U.check(h.uuid());else if(z==="date-time")U=U.check(h.iso.datetime());else if(z==="date")U=U.check(h.iso.date());else if(z==="time")U=U.check(h.iso.time());else if(z==="duration")U=U.check(h.iso.duration());else if(z==="ipv4")U=U.check(h.ipv4());else if(z==="ipv6")U=U.check(h.ipv6());else if(z==="mac")U=U.check(h.mac());else if(z==="cidr")U=U.check(h.cidrv4());else if(z==="cidr-v6")U=U.check(h.cidrv6());else if(z==="base64")U=U.check(h.base64());else if(z==="base64url")U=U.check(h.base64url());else if(z==="e164")U=U.check(h.e164());else if(z==="jwt")U=U.check(h.jwt());else if(z==="emoji")U=U.check(h.emoji());else if(z==="nanoid")U=U.check(h.nanoid());else if(z==="cuid")U=U.check(h.cuid());else if(z==="cuid2")U=U.check(h.cuid2());else if(z==="ulid")U=U.check(h.ulid());else if(z==="xid")U=U.check(h.xid());else if(z==="ksuid")U=U.check(h.ksuid())}if(typeof $.minLength==="number")U=U.min($.minLength);if(typeof $.maxLength==="number")U=U.max($.maxLength);if($.pattern)U=U.regex(new RegExp($.pattern));_=U;break}case"number":case"integer":{let U=g==="integer"?h.number().int():h.number();if(typeof $.minimum==="number")U=U.min($.minimum);if(typeof $.maximum==="number")U=U.max($.maximum);if(typeof $.exclusiveMinimum==="number")U=U.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")U=U.gt($.minimum);if(typeof $.exclusiveMaximum==="number")U=U.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")U=U.lt($.maximum);if(typeof $.multipleOf==="number")U=U.multipleOf($.multipleOf);_=U;break}case"boolean":{_=h.boolean();break}case"null":{_=h.null();break}case"object":{let U={},z=$.properties||{},J=new Set($.required||[]);for(let[b,O]of Object.entries(z)){let W=W6(O,v);U[b]=J.has(b)?W:W.optional()}if($.propertyNames){let b=W6($.propertyNames,v),O=$.additionalProperties&&typeof $.additionalProperties==="object"?W6($.additionalProperties,v):h.any();if(Object.keys(U).length===0){_=h.record(b,O);break}let W=h.object(U).passthrough(),B=h.looseRecord(b,O);_=h.intersection(W,B);break}if($.patternProperties){let b=$.patternProperties,O=Object.keys(b),W=[];for(let k of O){let Y=W6(b[k],v),F=h.string().regex(new RegExp(k));W.push(h.looseRecord(F,Y))}let B=[];if(Object.keys(U).length>0)B.push(h.object(U).passthrough());if(B.push(...W),B.length===0)_=h.object({}).passthrough();else if(B.length===1)_=B[0];else{let k=h.intersection(B[0],B[1]);for(let Y=2;Y<B.length;Y++)k=h.intersection(k,B[Y]);_=k}break}let G=h.object(U);if($.additionalProperties===!1)_=G.strict();else if(typeof $.additionalProperties==="object")_=G.catchall(W6($.additionalProperties,v));else _=G.passthrough();break}case"array":{let{prefixItems:U,items:z}=$;if(U&&Array.isArray(U)){let J=U.map((b)=>W6(b,v)),G=z&&typeof z==="object"&&!Array.isArray(z)?W6(z,v):void 0;if(G)_=h.tuple(J).rest(G);else _=h.tuple(J);if(typeof $.minItems==="number")_=_.check(h.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(h.maxLength($.maxItems))}else if(Array.isArray(z)){let J=z.map((b)=>W6(b,v)),G=$.additionalItems&&typeof $.additionalItems==="object"?W6($.additionalItems,v):void 0;if(G)_=h.tuple(J).rest(G);else _=h.tuple(J);if(typeof $.minItems==="number")_=_.check(h.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(h.maxLength($.maxItems))}else if(z!==void 0){let J=W6(z,v),G=h.array(J);if(typeof $.minItems==="number")G=G.min($.minItems);if(typeof $.maxItems==="number")G=G.max($.maxItems);_=G}else _=h.array(h.any());break}default:throw Error(`Unsupported type: ${g}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function W6($,v){if(typeof $==="boolean")return $?h.any():h.never();let g=HB($,v),_=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let G=$.anyOf.map((O)=>W6(O,v)),b=h.union(G);g=_?h.intersection(g,b):b}if($.oneOf&&Array.isArray($.oneOf)){let G=$.oneOf.map((O)=>W6(O,v)),b=h.xor(G);g=_?h.intersection(g,b):b}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)g=_?g:h.any();else{let G=_?g:W6($.allOf[0],v),b=_?0:1;for(let O=b;O<$.allOf.length;O++)G=h.intersection(G,W6($.allOf[O],v));g=G}if($.nullable===!0&&v.version==="openapi-3.0")g=h.nullable(g);if($.readOnly===!0)g=h.readonly(g);let U={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let G of z)if(G in $)U[G]=$[G];let J=["contentEncoding","contentMediaType","contentSchema"];for(let G of J)if(G in $)U[G]=$[G];for(let G of Object.keys($))if(!hL.has(G))U[G]=$[G];if(Object.keys(U).length>0)v.registry.add(g,U);return g}function LB($,v){if(typeof $==="boolean")return $?h.any():h.never();let g=lL($,v?.defaultTarget),_=$.$defs||$.definitions||{},U={version:g,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??U6};return W6($,U)}var DG={};$4(DG,{string:()=>oL,number:()=>nL,date:()=>aL,boolean:()=>tL,bigint:()=>dL});function oL($){return z3(XU,$)}function nL($){return Y3(LU,$)}function tL($){return F3(FU,$)}function dL($){return I3(ZU,$)}function aL($){return j3(f1,$)}o$(A1());var E4="io.modelcontextprotocol/related-task",$2="2.0",z6=s0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),FB=S$([w(),Z$().int()]),ZB=w(),vR=g6({ttl:S$([Z$(),IU()]).optional(),pollInterval:Z$().optional()}),sL=o({ttl:Z$().optional()}),eL=o({taskId:w()}),TG=g6({progressToken:FB.optional(),[E4]:eL.optional()}),R6=o({_meta:TG.optional()}),h1=R6.extend({task:sL.optional()}),IB=($)=>h1.safeParse($).success,J6=o({method:w(),params:R6.loose().optional()}),V6=o({_meta:TG.optional()}),f6=o({method:w(),params:V6.loose().optional()}),G6=g6({_meta:TG.optional()}),AU=S$([w(),Z$().int()]),QB=o({jsonrpc:d($2),id:AU,...J6.shape}).strict(),jG=($)=>QB.safeParse($).success,wB=o({jsonrpc:d($2),...f6.shape}).strict(),AB=($)=>wB.safeParse($).success,uG=o({jsonrpc:d($2),id:AU,result:G6}).strict(),l1=($)=>uG.safeParse($).success;var M$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(M$||(M$={}));var CG=o({jsonrpc:d($2),id:AU.optional(),error:o({code:Z$().int(),message:w(),data:R$().optional()})}).strict();var MB=($)=>CG.safeParse($).success;var SB=S$([QB,wB,uG,CG]),UR=S$([uG,CG]),v2=G6.strict(),$F=V6.extend({requestId:AU.optional(),reason:w().optional()}),U2=f6.extend({method:d("notifications/cancelled"),params:$F}),vF=o({src:w(),mimeType:w().optional(),sizes:q$(w()).optional(),theme:_6(["light","dark"]).optional()}),p1=o({icons:q$(vF).optional()}),wU=o({name:w(),title:w().optional()}),o1=wU.extend({...wU.shape,...p1.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),UF=QU(o({applyDefaults:n$().optional()}),j$(w(),R$())),gF=x1(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},QU(o({form:UF.optional(),url:z6.optional()}),j$(w(),R$()).optional())),_F=g6({list:z6.optional(),cancel:z6.optional(),requests:g6({sampling:g6({createMessage:z6.optional()}).optional(),elicitation:g6({create:z6.optional()}).optional()}).optional()}),zF=g6({list:z6.optional(),cancel:z6.optional(),requests:g6({tools:g6({call:z6.optional()}).optional()}).optional()}),JF=o({experimental:j$(w(),z6).optional(),sampling:o({context:z6.optional(),tools:z6.optional()}).optional(),elicitation:gF.optional(),roots:o({listChanged:n$().optional()}).optional(),tasks:_F.optional()}),GF=R6.extend({protocolVersion:w(),capabilities:JF,clientInfo:o1}),KF=J6.extend({method:d("initialize"),params:GF});var bF=o({experimental:j$(w(),z6).optional(),logging:z6.optional(),completions:z6.optional(),prompts:o({listChanged:n$().optional()}).optional(),resources:o({subscribe:n$().optional(),listChanged:n$().optional()}).optional(),tools:o({listChanged:n$().optional()}).optional(),tasks:zF.optional()}),OF=G6.extend({protocolVersion:w(),capabilities:bF,serverInfo:o1,instructions:w().optional()}),WF=f6.extend({method:d("notifications/initialized"),params:V6.optional()});var m4=J6.extend({method:d("ping"),params:R6.optional()}),BF=o({progress:Z$(),total:C$(Z$()),message:C$(w())}),YF=o({...V6.shape,...BF.shape,progressToken:FB}),g2=f6.extend({method:d("notifications/progress"),params:YF}),kF=R6.extend({cursor:ZB.optional()}),n1=J6.extend({params:kF.optional()}),t1=G6.extend({nextCursor:ZB.optional()}),qF=_6(["working","input_required","completed","failed","cancelled"]),d1=o({taskId:w(),status:qF,ttl:S$([Z$(),IU()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:C$(Z$()),statusMessage:C$(w())}),_2=G6.extend({task:d1}),PF=V6.merge(d1),a1=f6.extend({method:d("notifications/tasks/status"),params:PF}),z2=J6.extend({method:d("tasks/get"),params:R6.extend({taskId:w()})}),J2=G6.merge(d1),G2=J6.extend({method:d("tasks/result"),params:R6.extend({taskId:w()})}),gR=G6.loose(),K2=n1.extend({method:d("tasks/list")}),b2=t1.extend({tasks:q$(d1)}),O2=J6.extend({method:d("tasks/cancel"),params:R6.extend({taskId:w()})}),NB=G6.merge(d1),yB=o({uri:w(),mimeType:C$(w()),_meta:j$(w(),R$()).optional()}),RB=yB.extend({text:w()}),VG=w().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),DB=yB.extend({blob:VG}),s1=_6(["user","assistant"]),MU=o({audience:q$(s1).optional(),priority:Z$().min(0).max(1).optional(),lastModified:r4.datetime({offset:!0}).optional()}),TB=o({...wU.shape,...p1.shape,uri:w(),description:C$(w()),mimeType:C$(w()),annotations:MU.optional(),_meta:C$(g6({}))}),XF=o({...wU.shape,...p1.shape,uriTemplate:w(),description:C$(w()),mimeType:C$(w()),annotations:MU.optional(),_meta:C$(g6({}))}),fG=n1.extend({method:d("resources/list")}),e1=t1.extend({resources:q$(TB)}),rG=n1.extend({method:d("resources/templates/list")}),EG=t1.extend({resourceTemplates:q$(XF)}),mG=R6.extend({uri:w()}),HF=mG,cG=J6.extend({method:d("resources/read"),params:HF}),$g=G6.extend({contents:q$(S$([RB,DB]))}),iG=f6.extend({method:d("notifications/resources/list_changed"),params:V6.optional()}),LF=mG,FF=J6.extend({method:d("resources/subscribe"),params:LF}),ZF=mG,IF=J6.extend({method:d("resources/unsubscribe"),params:ZF}),QF=V6.extend({uri:w()}),wF=f6.extend({method:d("notifications/resources/updated"),params:QF}),AF=o({name:w(),description:C$(w()),required:C$(n$())}),MF=o({...wU.shape,...p1.shape,description:C$(w()),arguments:C$(q$(AF)),_meta:C$(g6({}))}),xG=n1.extend({method:d("prompts/list")}),hG=t1.extend({prompts:q$(MF)}),SF=R6.extend({name:w(),arguments:j$(w(),w()).optional()}),NF=J6.extend({method:d("prompts/get"),params:SF}),lG=o({type:d("text"),text:w(),annotations:MU.optional(),_meta:j$(w(),R$()).optional()}),pG=o({type:d("image"),data:VG,mimeType:w(),annotations:MU.optional(),_meta:j$(w(),R$()).optional()}),oG=o({type:d("audio"),data:VG,mimeType:w(),annotations:MU.optional(),_meta:j$(w(),R$()).optional()}),yF=o({type:d("tool_use"),name:w(),id:w(),input:j$(w(),R$()),_meta:j$(w(),R$()).optional()}),nG=o({type:d("resource"),resource:S$([RB,DB]),annotations:MU.optional(),_meta:j$(w(),R$()).optional()}),tG=TB.extend({type:d("resource_link")}),SU=S$([lG,pG,oG,tG,nG]),RF=o({role:s1,content:SU}),DF=G6.extend({description:w().optional(),messages:q$(RF)}),dG=f6.extend({method:d("notifications/prompts/list_changed"),params:V6.optional()}),TF=o({title:w().optional(),readOnlyHint:n$().optional(),destructiveHint:n$().optional(),idempotentHint:n$().optional(),openWorldHint:n$().optional()}),jF=o({taskSupport:_6(["required","optional","forbidden"]).optional()}),W2=o({...wU.shape,...p1.shape,description:w().optional(),inputSchema:o({type:d("object"),properties:j$(w(),z6).optional(),required:q$(w()).optional()}).catchall(R$()),outputSchema:o({type:d("object"),properties:j$(w(),z6).optional(),required:q$(w()).optional()}).catchall(R$()).optional(),annotations:TF.optional(),execution:jF.optional(),_meta:j$(w(),R$()).optional()}),vg=n1.extend({method:d("tools/list")}),uF=t1.extend({tools:q$(W2)}),c4=G6.extend({content:q$(SU).default([]),structuredContent:j$(w(),R$()).optional(),isError:n$().optional()}),_R=c4.or(G6.extend({toolResult:R$()})),CF=h1.extend({name:w(),arguments:j$(w(),R$()).optional()}),Ug=J6.extend({method:d("tools/call"),params:CF}),aG=f6.extend({method:d("notifications/tools/list_changed"),params:V6.optional()}),zR=o({autoRefresh:n$().default(!0),debounceMs:Z$().int().nonnegative().default(300)}),jB=_6(["debug","info","notice","warning","error","critical","alert","emergency"]),VF=R6.extend({level:jB}),fF=J6.extend({method:d("logging/setLevel"),params:VF}),rF=V6.extend({level:jB,logger:w().optional(),data:R$()}),sG=f6.extend({method:d("notifications/message"),params:rF}),EF=o({name:w().optional()}),mF=o({hints:q$(EF).optional(),costPriority:Z$().min(0).max(1).optional(),speedPriority:Z$().min(0).max(1).optional(),intelligencePriority:Z$().min(0).max(1).optional()}),cF=o({mode:_6(["auto","required","none"]).optional()}),iF=o({type:d("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:q$(SU).default([]),structuredContent:o({}).loose().optional(),isError:n$().optional(),_meta:j$(w(),R$()).optional()}),xF=m1("type",[lG,pG,oG]),e0=m1("type",[lG,pG,oG,yF,iF]),hF=o({role:s1,content:S$([e0,q$(e0)]),_meta:j$(w(),R$()).optional()}),lF=h1.extend({messages:q$(hF),modelPreferences:mF.optional(),systemPrompt:w().optional(),includeContext:_6(["none","thisServer","allServers"]).optional(),temperature:Z$().optional(),maxTokens:Z$().int(),stopSequences:q$(w()).optional(),metadata:z6.optional(),tools:q$(W2).optional(),toolChoice:cF.optional()}),pF=J6.extend({method:d("sampling/createMessage"),params:lF}),oF=G6.extend({model:w(),stopReason:C$(_6(["endTurn","stopSequence","maxTokens"]).or(w())),role:s1,content:xF}),nF=G6.extend({model:w(),stopReason:C$(_6(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:s1,content:S$([e0,q$(e0)])}),tF=o({type:d("boolean"),title:w().optional(),description:w().optional(),default:n$().optional()}),dF=o({type:d("string"),title:w().optional(),description:w().optional(),minLength:Z$().optional(),maxLength:Z$().optional(),format:_6(["email","uri","date","date-time"]).optional(),default:w().optional()}),aF=o({type:_6(["number","integer"]),title:w().optional(),description:w().optional(),minimum:Z$().optional(),maximum:Z$().optional(),default:Z$().optional()}),sF=o({type:d("string"),title:w().optional(),description:w().optional(),enum:q$(w()),default:w().optional()}),eF=o({type:d("string"),title:w().optional(),description:w().optional(),oneOf:q$(o({const:w(),title:w()})),default:w().optional()}),$Z=o({type:d("string"),title:w().optional(),description:w().optional(),enum:q$(w()),enumNames:q$(w()).optional(),default:w().optional()}),vZ=S$([sF,eF]),UZ=o({type:d("array"),title:w().optional(),description:w().optional(),minItems:Z$().optional(),maxItems:Z$().optional(),items:o({type:d("string"),enum:q$(w())}),default:q$(w()).optional()}),gZ=o({type:d("array"),title:w().optional(),description:w().optional(),minItems:Z$().optional(),maxItems:Z$().optional(),items:o({anyOf:q$(o({const:w(),title:w()}))}),default:q$(w()).optional()}),_Z=S$([UZ,gZ]),zZ=S$([$Z,vZ,_Z]),JZ=S$([zZ,tF,dF,aF]),GZ=h1.extend({mode:d("form").optional(),message:w(),requestedSchema:o({type:d("object"),properties:j$(w(),JZ),required:q$(w()).optional()})}),KZ=h1.extend({mode:d("url"),message:w(),elicitationId:w(),url:w().url()}),bZ=S$([GZ,KZ]),OZ=J6.extend({method:d("elicitation/create"),params:bZ}),WZ=V6.extend({elicitationId:w()}),BZ=f6.extend({method:d("notifications/elicitation/complete"),params:WZ}),YZ=G6.extend({action:_6(["accept","decline","cancel"]),content:x1(($)=>$===null?void 0:$,j$(w(),S$([w(),Z$(),n$(),q$(w())])).optional())}),kZ=o({type:d("ref/resource"),uri:w()});var qZ=o({type:d("ref/prompt"),name:w()}),PZ=R6.extend({ref:S$([qZ,kZ]),argument:o({name:w(),value:w()}),context:o({arguments:j$(w(),w()).optional()}).optional()}),XZ=J6.extend({method:d("completion/complete"),params:PZ});var HZ=G6.extend({completion:g6({values:q$(w()).max(100),total:C$(Z$().int()),hasMore:C$(n$())})}),LZ=o({uri:w().startsWith("file://"),name:w().optional(),_meta:j$(w(),R$()).optional()}),FZ=J6.extend({method:d("roots/list"),params:R6.optional()}),ZZ=G6.extend({roots:q$(LZ)}),IZ=f6.extend({method:d("notifications/roots/list_changed"),params:V6.optional()}),JR=S$([m4,KF,XZ,fF,NF,xG,fG,rG,cG,FF,IF,Ug,vg,z2,G2,K2,O2]),GR=S$([U2,g2,WF,IZ,a1]),KR=S$([v2,oF,nF,YZ,ZZ,J2,b2,_2]),bR=S$([m4,pF,OZ,FZ,z2,G2,K2,O2]),OR=S$([U2,g2,sG,wF,iG,aG,dG,a1,BZ]),WR=S$([v2,OF,HZ,DF,hG,e1,EG,$g,c4,uF,J2,b2,_2]);class L$ extends Error{constructor($,v,g){super(`MCP error ${$}: ${v}`);this.code=$,this.data=g,this.name="McpError"}static fromError($,v,g){if($===M$.UrlElicitationRequired&&g){let _=g;if(_.elicitations)return new uB(_.elicitations,v)}return new L$($,v,g)}}class uB extends L${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(M$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function B2($){return!!$._zod}function Y2($,v){if(B2($))return sv($,v);return $.safeParse(v)}function CB($){if(!$)return;let v;if(B2($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function VB($){if(B2($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let g=$._def;if(g){if(g.value!==void 0)return g.value;if(Array.isArray(g.values)&&g.values.length>0)return g.values[0]}let _=$.value;if(_!==void 0)return _;return}function i4($){return $==="completed"||$==="failed"||$==="cancelled"}var QZ=Symbol("Let zodToJsonSchema decide on which parser to use");var tR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function eG($){let g=CB($)?.method;if(!g)throw Error("Schema is missing a method literal");let _=VB(g);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function $K($,v){let g=Y2($,v);if(!g.success)throw g.error;return g.data}var yZ=60000;class _g{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(U2,(v)=>{this._oncancel(v)}),this.setNotificationHandler(g2,(v)=>{this._onprogress(v)}),this.setRequestHandler(m4,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(z2,async(v,g)=>{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new L$(M$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(G2,async(v,g)=>{let _=async()=>{let U=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(U,g.sessionId)){if(J.type==="response"||J.type==="error"){let G=J.message,b=G.id,O=this._requestResolvers.get(b);if(O)if(this._requestResolvers.delete(b),J.type==="response")O(G);else{let W=G,B=new L$(W.error.code,W.error.message,W.error.data);O(B)}else{let W=J.type==="response"?"Response":"Error";this._onerror(Error(`${W} handler missing for request ${b}`))}continue}await this._transport?.send(J.message,{relatedRequestId:g.requestId})}}let z=await this._taskStore.getTask(U,g.sessionId);if(!z)throw new L$(M$.InvalidParams,`Task not found: ${U}`);if(!i4(z.status))return await this._waitForTaskUpdate(U,g.signal),await _();if(i4(z.status)){let J=await this._taskStore.getTaskResult(U,g.sessionId);return this._clearTaskQueue(U),{...J,_meta:{...J._meta,[E4]:{taskId:U}}}}return await _()};return await _()}),this.setRequestHandler(K2,async(v,g)=>{try{let{tasks:_,nextCursor:U}=await this._taskStore.listTasks(v.params?.cursor,g.sessionId);return{tasks:_,nextCursor:U,_meta:{}}}catch(_){throw new L$(M$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(O2,async(v,g)=>{try{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new L$(M$.InvalidParams,`Task not found: ${v.params.taskId}`);if(i4(_.status))throw new L$(M$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",g.sessionId),this._clearTaskQueue(v.params.taskId);let U=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!U)throw new L$(M$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...U}}catch(_){if(_ instanceof L$)throw _;throw new L$(M$.InvalidRequest,`Failed to cancel task: ${_ instanceof Error?_.message:String(_)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,v,g,_,U=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:g,resetTimeoutOnProgress:U,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let g=Date.now()-v.startTime;if(v.maxTotalTimeout&&g>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),L$.fromError(M$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:g});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout($){let v=this._timeoutInfo.get($);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let v=this.transport?.onclose;this._transport.onclose=()=>{v?.(),this._onclose()};let g=this.transport?.onerror;this._transport.onerror=(U)=>{g?.(U),this._onerror(U)};let _=this._transport?.onmessage;this._transport.onmessage=(U,z)=>{if(_?.(U,z),l1(U)||MB(U))this._onresponse(U);else if(jG(U))this._onrequest(U,z);else if(AB(U))this._onnotification(U);else this._onerror(Error(`Unknown message type: ${JSON.stringify(U)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();for(let g of this._requestHandlerAbortControllers.values())g.abort();this._requestHandlerAbortControllers.clear();let v=L$.fromError(M$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let g of $.values())g(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest($,v){let g=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,U=$.params?._meta?.[E4]?.taskId;if(g===void 0){let O={jsonrpc:"2.0",id:$.id,error:{code:M$.MethodNotFound,message:"Method not found"}};if(U&&this._taskMessageQueue)this._enqueueTaskMessage(U,{type:"error",message:O,timestamp:Date.now()},_?.sessionId).catch((W)=>this._onerror(Error(`Failed to enqueue error response: ${W}`)));else _?.send(O).catch((W)=>this._onerror(Error(`Failed to send an error response: ${W}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let J=IB($.params)?$.params.task:void 0,G=this._taskStore?this.requestTaskStore($,_?.sessionId):void 0,b={signal:z.signal,sessionId:_?.sessionId,_meta:$.params?._meta,sendNotification:async(O)=>{if(z.signal.aborted)return;let W={relatedRequestId:$.id};if(U)W.relatedTask={taskId:U};await this.notification(O,W)},sendRequest:async(O,W,B)=>{if(z.signal.aborted)throw new L$(M$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(U&&!k.relatedTask)k.relatedTask={taskId:U};let Y=k.relatedTask?.taskId??U;if(Y&&G)await G.updateTaskStatus(Y,"input_required");return await this.request(O,W,k)},authInfo:v?.authInfo,requestId:$.id,requestInfo:v?.requestInfo,taskId:U,taskStore:G,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>g($,b)).then(async(O)=>{if(z.signal.aborted)return;let W={result:O,jsonrpc:"2.0",id:$.id};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"response",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)},async(O)=>{if(z.signal.aborted)return;let W={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(O.code)?O.code:M$.InternalError,message:O.message??"Internal error",...O.data!==void 0&&{data:O.data}}};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"error",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)}).catch((O)=>this._onerror(Error(`Failed to send response: ${O}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:v,...g}=$.params,_=Number(v),U=this._progressHandlers.get(_);if(!U){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(_),J=this._timeoutInfo.get(_);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(_)}catch(G){this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),z(G);return}U(g)}_onresponse($){let v=Number($.id),g=this._requestResolvers.get(v);if(g){if(this._requestResolvers.delete(v),l1($))g($);else{let z=new L$($.error.code,$.error.message,$.error.data);g(z)}return}let _=this._responseHandlers.get(v);if(_===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(v),this._cleanupTimeout(v);let U=!1;if(l1($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")U=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!U)this._progressHandlers.delete(v);if(l1($))_($);else{let z=L$.fromError($.error.code,$.error.message,$.error.data);_(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,v,g){let{task:_}=g??{};if(!_){try{yield{type:"result",result:await this.request($,v,g)}}catch(z){yield{type:"error",error:z instanceof L$?z:new L$(M$.InternalError,String(z))}}return}let U;try{let z=await this.request($,_2,g);if(z.task)U=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new L$(M$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:U},g);if(yield{type:"taskStatus",task:J},i4(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};else if(J.status==="failed")yield{type:"error",error:new L$(M$.InternalError,`Task ${U} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new L$(M$.InternalError,`Task ${U} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};return}let G=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((b)=>setTimeout(b,G)),g?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof L$?z:new L$(M$.InternalError,String(z))}}}request($,v,g){let{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z,task:J,relatedTask:G}=g??{};return new Promise((b,O)=>{let W=(q)=>{O(q)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(q){W(q);return}g?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(g?.onprogress)this._progressHandlers.set(B,g.onprogress),k.params={...$.params,_meta:{...$.params?._meta||{},progressToken:B}};if(J)k.params={...k.params,task:J};if(G)k.params={...k.params,_meta:{...k.params?._meta||{},[E4]:G}};let Y=(q)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(q)}},{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((I)=>this._onerror(Error(`Failed to send cancellation: ${I}`)));let L=q instanceof L$?q:new L$(M$.RequestTimeout,String(q));O(L)};this._responseHandlers.set(B,(q)=>{if(g?.signal?.aborted)return;if(q instanceof Error)return O(q);try{let L=Y2(v,q.result);if(!L.success)O(L.error);else b(L.data)}catch(L){O(L)}}),g?.signal?.addEventListener("abort",()=>{Y(g?.signal?.reason)});let F=g?.timeout??yZ,X=()=>Y(L$.fromError(M$.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(B,F,g?.maxTotalTimeout,X,g?.resetTimeoutOnProgress??!1);let H=G?.taskId;if(H){let q=(L)=>{let I=this._responseHandlers.get(B);if(I)I(L);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,q),this._enqueueTaskMessage(H,{type:"request",message:k,timestamp:Date.now()}).catch((L)=>{this._cleanupTimeout(B),O(L)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((q)=>{this._cleanupTimeout(B),O(q)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},J2,v)}async getTaskResult($,v,g){return this.request({method:"tasks/result",params:$},v,g)}async listTasks($,v){return this.request({method:"tasks/list",params:$},b2,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},NB,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let g=v?.relatedTask?.taskId;if(g){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[E4]:v.relatedTask}}};await this._enqueueTaskMessage(g,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!v?.relatedRequestId&&!v?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let J={...$,jsonrpc:"2.0"};if(v?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[E4]:v.relatedTask}}};this._transport?.send(J,v).catch((G)=>this._onerror(G))});return}let z={...$,jsonrpc:"2.0"};if(v?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[E4]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let g=eG($);this.assertRequestHandlerCapability(g),this._requestHandlers.set(g,(_,U)=>{let z=$K($,_);return Promise.resolve(v(z,U))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let g=eG($);this._notificationHandlers.set(g,(_)=>{let U=$K($,_);return Promise.resolve(v(U))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,g){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let _=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,v,g,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let g=await this._taskMessageQueue.dequeueAll($,v);for(let _ of g)if(_.type==="request"&&jG(_.message)){let U=_.message.id,z=this._requestResolvers.get(U);if(z)z(new L$(M$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(U);else this._onerror(Error(`Resolver missing for request ${U} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let g=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)g=_.pollInterval}catch{}return new Promise((_,U)=>{if(v.aborted){U(new L$(M$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,g);v.addEventListener("abort",()=>{clearTimeout(z),U(new L$(M$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let g=this._taskStore;if(!g)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await g.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let U=await g.getTask(_,v);if(!U)throw new L$(M$.InvalidParams,"Failed to retrieve task: Task not found");return U},storeTaskResult:async(_,U,z)=>{await g.storeTaskResult(_,U,z,v);let J=await g.getTask(_,v);if(J){let G=a1.parse({method:"notifications/tasks/status",params:J});if(await this.notification(G),i4(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return g.getTaskResult(_,v)},updateTaskStatus:async(_,U,z)=>{let J=await g.getTask(_,v);if(!J)throw new L$(M$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(i4(J.status))throw new L$(M$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${U}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await g.updateTaskStatus(_,U,z,v);let G=await g.getTask(_,v);if(G){let b=a1.parse({method:"notifications/tasks/status",params:G});if(await this.notification(b),i4(G.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return g.listTasks(_,v)}}}}var vK="2026-01-26";var RZ="ui/notifications/tool-input-partial";var DZ=P.union([P.literal("light"),P.literal("dark")]).describe("Color theme preference for the host environment."),zg=P.union([P.literal("inline"),P.literal("fullscreen"),P.literal("pip")]).describe("Display mode for UI presentation."),TZ=P.union([P.literal("--color-background-primary"),P.literal("--color-background-secondary"),P.literal("--color-background-tertiary"),P.literal("--color-background-inverse"),P.literal("--color-background-ghost"),P.literal("--color-background-info"),P.literal("--color-background-danger"),P.literal("--color-background-success"),P.literal("--color-background-warning"),P.literal("--color-background-disabled"),P.literal("--color-text-primary"),P.literal("--color-text-secondary"),P.literal("--color-text-tertiary"),P.literal("--color-text-inverse"),P.literal("--color-text-ghost"),P.literal("--color-text-info"),P.literal("--color-text-danger"),P.literal("--color-text-success"),P.literal("--color-text-warning"),P.literal("--color-text-disabled"),P.literal("--color-border-primary"),P.literal("--color-border-secondary"),P.literal("--color-border-tertiary"),P.literal("--color-border-inverse"),P.literal("--color-border-ghost"),P.literal("--color-border-info"),P.literal("--color-border-danger"),P.literal("--color-border-success"),P.literal("--color-border-warning"),P.literal("--color-border-disabled"),P.literal("--color-ring-primary"),P.literal("--color-ring-secondary"),P.literal("--color-ring-inverse"),P.literal("--color-ring-info"),P.literal("--color-ring-danger"),P.literal("--color-ring-success"),P.literal("--color-ring-warning"),P.literal("--font-sans"),P.literal("--font-mono"),P.literal("--font-weight-normal"),P.literal("--font-weight-medium"),P.literal("--font-weight-semibold"),P.literal("--font-weight-bold"),P.literal("--font-text-xs-size"),P.literal("--font-text-sm-size"),P.literal("--font-text-md-size"),P.literal("--font-text-lg-size"),P.literal("--font-heading-xs-size"),P.literal("--font-heading-sm-size"),P.literal("--font-heading-md-size"),P.literal("--font-heading-lg-size"),P.literal("--font-heading-xl-size"),P.literal("--font-heading-2xl-size"),P.literal("--font-heading-3xl-size"),P.literal("--font-text-xs-line-height"),P.literal("--font-text-sm-line-height"),P.literal("--font-text-md-line-height"),P.literal("--font-text-lg-line-height"),P.literal("--font-heading-xs-line-height"),P.literal("--font-heading-sm-line-height"),P.literal("--font-heading-md-line-height"),P.literal("--font-heading-lg-line-height"),P.literal("--font-heading-xl-line-height"),P.literal("--font-heading-2xl-line-height"),P.literal("--font-heading-3xl-line-height"),P.literal("--border-radius-xs"),P.literal("--border-radius-sm"),P.literal("--border-radius-md"),P.literal("--border-radius-lg"),P.literal("--border-radius-xl"),P.literal("--border-radius-full"),P.literal("--border-width-regular"),P.literal("--shadow-hairline"),P.literal("--shadow-sm"),P.literal("--shadow-md"),P.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),jZ=P.record(TZ.describe(`Style variables for theming MCP apps.
151
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let W=K[1];if(U===K[0]){z(K);continue}if($.external){let Y=$.external.registry.get(K[0])?.id;if(U!==K[0]&&Y){z(K);continue}}if($.metadataRegistry.get(K[0])?.id){z(K);continue}if(W.cycle){z(K);continue}if(W.count>1){if($.reused==="ref"){z(K);continue}}}}function Y1($,U){let v=$.seen.get(U);if(!v)throw Error("Unprocessed schema. This is a bug in Zod.");let J=(K)=>{let W=$.seen.get(K);if(W.ref===null)return;let O=W.def??W.schema,Y={...O},Z=W.ref;if(W.ref=null,Z){J(Z);let X=$.seen.get(Z),B=X.schema;if(B.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))O.allOf=O.allOf??[],O.allOf.push(B);else Object.assign(O,B);if(Object.assign(O,Y),K._zod.parent===Z)for(let P in O){if(P==="$ref"||P==="allOf")continue;if(!(P in Y))delete O[P]}if(B.$ref&&X.def)for(let P in O){if(P==="$ref"||P==="allOf")continue;if(P in X.def&&JSON.stringify(O[P])===JSON.stringify(X.def[P]))delete O[P]}}let q=K._zod.parent;if(q&&q!==Z){J(q);let X=$.seen.get(q);if(X?.schema.$ref){if(O.$ref=X.schema.$ref,X.def)for(let B in O){if(B==="$ref"||B==="allOf")continue;if(B in X.def&&JSON.stringify(O[B])===JSON.stringify(X.def[B]))delete O[B]}}}$.override({zodSchema:K,jsonSchema:O,path:W.path??[]})};for(let K of[...$.seen.entries()].reverse())J(K[0]);let _={};if($.target==="draft-2020-12")_.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")_.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")_.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let K=$.external.registry.get(U)?.id;if(!K)throw Error("Schema is missing an `id` property");_.$id=$.external.uri(K)}Object.assign(_,v.def??v.schema);let z=$.external?.defs??{};for(let K of $.seen.entries()){let W=K[1];if(W.def&&W.defId)z[W.defId]=W.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")_.$defs=z;else _.definitions=z;try{let K=JSON.parse(JSON.stringify(_));return Object.defineProperty(K,"~standard",{value:{...U["~standard"],jsonSchema:{input:v0(U,"input",$.processors),output:v0(U,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function C6($,U){let v=U??{seen:new Set};if(v.seen.has($))return!1;v.seen.add($);let J=$._zod.def;if(J.type==="transform")return!0;if(J.type==="array")return C6(J.element,v);if(J.type==="set")return C6(J.valueType,v);if(J.type==="lazy")return C6(J.getter(),v);if(J.type==="promise"||J.type==="optional"||J.type==="nonoptional"||J.type==="nullable"||J.type==="readonly"||J.type==="default"||J.type==="prefault")return C6(J.innerType,v);if(J.type==="intersection")return C6(J.left,v)||C6(J.right,v);if(J.type==="record"||J.type==="map")return C6(J.keyType,v)||C6(J.valueType,v);if(J.type==="pipe")return C6(J.in,v)||C6(J.out,v);if(J.type==="object"){for(let _ in J.shape)if(C6(J.shape[_],v))return!0;return!1}if(J.type==="union"){for(let _ of J.options)if(C6(_,v))return!0;return!1}if(J.type==="tuple"){for(let _ of J.items)if(C6(_,v))return!0;if(J.rest&&C6(J.rest,v))return!0;return!1}return!1}var YK=($,U={})=>(v)=>{let J=W1({...v,processors:U});return R$($,J),O1(J,$),Y1(J,$)},v0=($,U,v={})=>(J)=>{let{libraryOptions:_,target:z}=J??{},K=W1({..._??{},target:z,io:U,processors:v});return R$($,K),O1(K,$),Y1(K,$)};var HM={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ZK=($,U,v,J)=>{let _=v;_.type="string";let{minimum:z,maximum:K,format:W,patterns:O,contentEncoding:Y}=$._zod.bag;if(typeof z==="number")_.minLength=z;if(typeof K==="number")_.maxLength=K;if(W){if(_.format=HM[W]??W,_.format==="")delete _.format;if(W==="time")delete _.format}if(Y)_.contentEncoding=Y;if(O&&O.size>0){let Z=[...O];if(Z.length===1)_.pattern=Z[0].source;else if(Z.length>1)_.allOf=[...Z.map((q)=>({...U.target==="draft-07"||U.target==="draft-04"||U.target==="openapi-3.0"?{type:"string"}:{},pattern:q.source}))]}},qK=($,U,v,J)=>{let _=v,{minimum:z,maximum:K,format:W,multipleOf:O,exclusiveMaximum:Y,exclusiveMinimum:Z}=$._zod.bag;if(typeof W==="string"&&W.includes("int"))_.type="integer";else _.type="number";if(typeof Z==="number")if(U.target==="draft-04"||U.target==="openapi-3.0")_.minimum=Z,_.exclusiveMinimum=!0;else _.exclusiveMinimum=Z;if(typeof z==="number"){if(_.minimum=z,typeof Z==="number"&&U.target!=="draft-04")if(Z>=z)delete _.minimum;else delete _.exclusiveMinimum}if(typeof Y==="number")if(U.target==="draft-04"||U.target==="openapi-3.0")_.maximum=Y,_.exclusiveMaximum=!0;else _.exclusiveMaximum=Y;if(typeof K==="number"){if(_.maximum=K,typeof Y==="number"&&U.target!=="draft-04")if(Y<=K)delete _.maximum;else delete _.exclusiveMaximum}if(typeof O==="number")_.multipleOf=O},BK=($,U,v,J)=>{v.type="boolean"},XK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},HK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},QK=($,U,v,J)=>{if(U.target==="openapi-3.0")v.type="string",v.nullable=!0,v.enum=[null];else v.type="null"},LK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},FK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},PK=($,U,v,J)=>{v.not={}},kK=($,U,v,J)=>{},bK=($,U,v,J)=>{},MK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},AK=($,U,v,J)=>{let _=$._zod.def,z=__(_.entries);if(z.every((K)=>typeof K==="number"))v.type="number";if(z.every((K)=>typeof K==="string"))v.type="string";v.enum=z},IK=($,U,v,J)=>{let _=$._zod.def,z=[];for(let K of _.values)if(K===void 0){if(U.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof K==="bigint")if(U.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(K));else z.push(K);if(z.length===0);else if(z.length===1){let K=z[0];if(v.type=K===null?"null":typeof K,U.target==="draft-04"||U.target==="openapi-3.0")v.enum=[K];else v.const=K}else{if(z.every((K)=>typeof K==="number"))v.type="number";if(z.every((K)=>typeof K==="string"))v.type="string";if(z.every((K)=>typeof K==="boolean"))v.type="boolean";if(z.every((K)=>K===null))v.type="null";v.enum=z}},wK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},gK=($,U,v,J)=>{let _=v,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");_.type="string",_.pattern=z.source},NK=($,U,v,J)=>{let _=v,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:K,maximum:W,mime:O}=$._zod.bag;if(K!==void 0)z.minLength=K;if(W!==void 0)z.maxLength=W;if(O)if(O.length===1)z.contentMediaType=O[0],Object.assign(_,z);else Object.assign(_,z),_.anyOf=O.map((Y)=>({contentMediaType:Y}));else Object.assign(_,z)},SK=($,U,v,J)=>{v.type="boolean"},RK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},TK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},yK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},CK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},DK=($,U,v,J)=>{if(U.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},jK=($,U,v,J)=>{let _=v,z=$._zod.def,{minimum:K,maximum:W}=$._zod.bag;if(typeof K==="number")_.minItems=K;if(typeof W==="number")_.maxItems=W;_.type="array",_.items=R$(z.element,U,{...J,path:[...J.path,"items"]})},VK=($,U,v,J)=>{let _=v,z=$._zod.def;_.type="object",_.properties={};let K=z.shape;for(let Y in K)_.properties[Y]=R$(K[Y],U,{...J,path:[...J.path,"properties",Y]});let W=new Set(Object.keys(K)),O=new Set([...W].filter((Y)=>{let Z=z.shape[Y]._zod;if(U.io==="input")return Z.optin===void 0;else return Z.optout===void 0}));if(O.size>0)_.required=Array.from(O);if(z.catchall?._zod.def.type==="never")_.additionalProperties=!1;else if(!z.catchall){if(U.io==="output")_.additionalProperties=!1}else if(z.catchall)_.additionalProperties=R$(z.catchall,U,{...J,path:[...J.path,"additionalProperties"]})},LJ=($,U,v,J)=>{let _=$._zod.def,z=_.inclusive===!1,K=_.options.map((W,O)=>R$(W,U,{...J,path:[...J.path,z?"oneOf":"anyOf",O]}));if(z)v.oneOf=K;else v.anyOf=K},fK=($,U,v,J)=>{let _=$._zod.def,z=R$(_.left,U,{...J,path:[...J.path,"allOf",0]}),K=R$(_.right,U,{...J,path:[...J.path,"allOf",1]}),W=(Y)=>("allOf"in Y)&&Object.keys(Y).length===1,O=[...W(z)?z.allOf:[z],...W(K)?K.allOf:[K]];v.allOf=O},EK=($,U,v,J)=>{let _=v,z=$._zod.def;_.type="array";let K=U.target==="draft-2020-12"?"prefixItems":"items",W=U.target==="draft-2020-12"?"items":U.target==="openapi-3.0"?"items":"additionalItems",O=z.items.map((X,B)=>R$(X,U,{...J,path:[...J.path,K,B]})),Y=z.rest?R$(z.rest,U,{...J,path:[...J.path,W,...U.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(U.target==="draft-2020-12"){if(_.prefixItems=O,Y)_.items=Y}else if(U.target==="openapi-3.0"){if(_.items={anyOf:O},Y)_.items.anyOf.push(Y);if(_.minItems=O.length,!Y)_.maxItems=O.length}else if(_.items=O,Y)_.additionalItems=Y;let{minimum:Z,maximum:q}=$._zod.bag;if(typeof Z==="number")_.minItems=Z;if(typeof q==="number")_.maxItems=q},uK=($,U,v,J)=>{let _=v,z=$._zod.def;_.type="object";let K=z.keyType,O=K._zod.bag?.patterns;if(z.mode==="loose"&&O&&O.size>0){let Z=R$(z.valueType,U,{...J,path:[...J.path,"patternProperties","*"]});_.patternProperties={};for(let q of O)_.patternProperties[q.source]=Z}else{if(U.target==="draft-07"||U.target==="draft-2020-12")_.propertyNames=R$(z.keyType,U,{...J,path:[...J.path,"propertyNames"]});_.additionalProperties=R$(z.valueType,U,{...J,path:[...J.path,"additionalProperties"]})}let Y=K._zod.values;if(Y){let Z=[...Y].filter((q)=>typeof q==="string"||typeof q==="number");if(Z.length>0)_.required=Z}},mK=($,U,v,J)=>{let _=$._zod.def,z=R$(_.innerType,U,J),K=U.seen.get($);if(U.target==="openapi-3.0")K.ref=_.innerType,v.nullable=!0;else v.anyOf=[z,{type:"null"}]},xK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType},hK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType,v.default=JSON.parse(JSON.stringify(_.defaultValue))},cK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);if(z.ref=_.innerType,U.io==="input")v._prefault=JSON.parse(JSON.stringify(_.defaultValue))},lK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType;let K;try{K=_.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}v.default=K},rK=($,U,v,J)=>{let _=$._zod.def,z=U.io==="input"?_.in._zod.def.type==="transform"?_.out:_.in:_.out;R$(z,U,J);let K=U.seen.get($);K.ref=z},iK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType,v.readOnly=!0},pK=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType},FJ=($,U,v,J)=>{let _=$._zod.def;R$(_.innerType,U,J);let z=U.seen.get($);z.ref=_.innerType},oK=($,U,v,J)=>{let _=$._zod.innerType;R$(_,U,J);let z=U.seen.get($);z.ref=_},QJ={string:ZK,number:qK,boolean:BK,bigint:XK,symbol:HK,null:QK,undefined:LK,void:FK,never:PK,any:kK,unknown:bK,date:MK,enum:AK,literal:IK,nan:wK,template_literal:gK,file:NK,success:SK,custom:RK,function:TK,transform:yK,map:CK,set:DK,array:jK,object:VK,union:LJ,intersection:fK,tuple:EK,record:uK,nullable:mK,nonoptional:xK,default:hK,prefault:cK,catch:lK,pipe:rK,readonly:iK,promise:pK,optional:FJ,lazy:oK};function PJ($,U){if("_idmap"in $){let J=$,_=W1({...U,processors:QJ}),z={};for(let O of J._idmap.entries()){let[Y,Z]=O;R$(Z,_)}let K={},W={registry:J,uri:U?.uri,defs:z};_.external=W;for(let O of J._idmap.entries()){let[Y,Z]=O;O1(_,Z),K[Y]=Y1(_,Z)}if(Object.keys(z).length>0){let O=_.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[O]:z}}return{schemas:K}}let v=W1({...U,processors:QJ});return R$($,v),O1(v,$),Y1(v,$)}class dK{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let U=$?.target??"draft-2020-12";if(U==="draft-4")U="draft-04";if(U==="draft-7")U="draft-07";this.ctx=W1({processors:QJ,target:U,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,U={path:[],schemaPath:[]}){return R$($,this.ctx,U)}emit($,U){if(U){if(U.cycles)this.ctx.cycles=U.cycles;if(U.reused)this.ctx.reused=U.reused;if(U.external)this.ctx.external=U.external}O1(this.ctx,$);let v=Y1(this.ctx,$),{"~standard":J,..._}=v;return _}}var dq={};var g_={};A4(g_,{xor:()=>uB,xid:()=>OB,void:()=>jB,uuidv7:()=>UB,uuidv6:()=>$B,uuidv4:()=>eq,uuid:()=>sq,url:()=>_B,unknown:()=>E$,union:()=>D$,undefined:()=>CB,ulid:()=>WB,uint64:()=>TB,uint32:()=>NB,tuple:()=>IG,transform:()=>iJ,templateLiteral:()=>nB,symbol:()=>yB,superRefine:()=>tG,success:()=>pB,stringbool:()=>_X,stringFormat:()=>kB,string:()=>g,strictObject:()=>EB,set:()=>cB,refine:()=>nG,record:()=>x$,readonly:()=>lG,promise:()=>tB,preprocess:()=>E_,prefault:()=>fG,pipe:()=>R_,partialRecord:()=>mB,optional:()=>l$,object:()=>a,number:()=>I$,nullish:()=>iB,nullable:()=>S_,null:()=>Y0,nonoptional:()=>EG,never:()=>rJ,nativeEnum:()=>lB,nanoid:()=>zB,nan:()=>oB,meta:()=>$X,map:()=>hB,mac:()=>qB,looseRecord:()=>xB,looseObject:()=>q6,literal:()=>$$,lazy:()=>pG,ksuid:()=>YB,keyof:()=>fB,jwt:()=>PB,json:()=>vX,ipv6:()=>BB,ipv4:()=>ZB,intersection:()=>Z0,int64:()=>RB,int32:()=>gB,int:()=>wJ,instanceof:()=>UX,httpUrl:()=>vB,hostname:()=>bB,hex:()=>MB,hash:()=>AB,guid:()=>aq,function:()=>aB,float64:()=>wB,float32:()=>IB,file:()=>rB,exactOptional:()=>yG,enum:()=>B6,emoji:()=>JB,email:()=>tq,e164:()=>FB,discriminatedUnion:()=>j_,describe:()=>eB,date:()=>VB,custom:()=>tJ,cuid2:()=>GB,cuid:()=>KB,codec:()=>dB,cidrv6:()=>HB,cidrv4:()=>XB,check:()=>sB,catch:()=>xG,boolean:()=>_6,bigint:()=>SB,base64url:()=>LB,base64:()=>QB,array:()=>Q$,any:()=>DB,_function:()=>aB,_default:()=>jG,_ZodString:()=>gJ,ZodXor:()=>kG,ZodXID:()=>DJ,ZodVoid:()=>FG,ZodUnknown:()=>QG,ZodUnion:()=>D_,ZodUndefined:()=>BG,ZodUUID:()=>k4,ZodURL:()=>T_,ZodULID:()=>CJ,ZodType:()=>q$,ZodTuple:()=>AG,ZodTransform:()=>RG,ZodTemplateLiteral:()=>rG,ZodSymbol:()=>qG,ZodSuccess:()=>uG,ZodStringFormat:()=>f$,ZodString:()=>z0,ZodSet:()=>gG,ZodRecord:()=>V_,ZodReadonly:()=>cG,ZodPromise:()=>oG,ZodPrefault:()=>VG,ZodPipe:()=>dJ,ZodOptional:()=>pJ,ZodObject:()=>C_,ZodNumberFormat:()=>o1,ZodNumber:()=>G0,ZodNullable:()=>CG,ZodNull:()=>XG,ZodNonOptional:()=>oJ,ZodNever:()=>LG,ZodNanoID:()=>RJ,ZodNaN:()=>hG,ZodMap:()=>wG,ZodMAC:()=>ZG,ZodLiteral:()=>NG,ZodLazy:()=>iG,ZodKSUID:()=>jJ,ZodJWT:()=>cJ,ZodIntersection:()=>MG,ZodIPv6:()=>fJ,ZodIPv4:()=>VJ,ZodGUID:()=>N_,ZodFunction:()=>dG,ZodFile:()=>SG,ZodExactOptional:()=>TG,ZodEnum:()=>J0,ZodEmoji:()=>SJ,ZodEmail:()=>NJ,ZodE164:()=>hJ,ZodDiscriminatedUnion:()=>bG,ZodDefault:()=>DG,ZodDate:()=>y_,ZodCustomStringFormat:()=>K0,ZodCustom:()=>f_,ZodCodec:()=>nJ,ZodCatch:()=>mG,ZodCUID2:()=>yJ,ZodCUID:()=>TJ,ZodCIDRv6:()=>uJ,ZodCIDRv4:()=>EJ,ZodBoolean:()=>W0,ZodBigIntFormat:()=>lJ,ZodBigInt:()=>O0,ZodBase64URL:()=>xJ,ZodBase64:()=>mJ,ZodArray:()=>PG,ZodAny:()=>HG});var kJ={};A4(kJ,{uppercase:()=>pU,trim:()=>sU,toUpperCase:()=>$0,toLowerCase:()=>eU,startsWith:()=>dU,slugify:()=>U0,size:()=>r1,regex:()=>rU,property:()=>HJ,positive:()=>ZJ,overwrite:()=>G4,normalize:()=>aU,nonpositive:()=>BJ,nonnegative:()=>XJ,negative:()=>qJ,multipleOf:()=>K1,minSize:()=>P4,minLength:()=>V4,mime:()=>tU,maxSize:()=>G1,maxLength:()=>i1,lte:()=>l6,lt:()=>L4,lowercase:()=>iU,length:()=>p1,includes:()=>oU,gte:()=>y6,gt:()=>F4,endsWith:()=>nU});var Z1={};A4(Z1,{time:()=>aK,duration:()=>sK,datetime:()=>nK,date:()=>tK,ZodISOTime:()=>AJ,ZodISODuration:()=>IJ,ZodISODateTime:()=>bJ,ZodISODate:()=>MJ});var bJ=M("ZodISODateTime",($,U)=>{C3.init($,U),f$.init($,U)});function nK($){return R7(bJ,$)}var MJ=M("ZodISODate",($,U)=>{D3.init($,U),f$.init($,U)});function tK($){return T7(MJ,$)}var AJ=M("ZodISOTime",($,U)=>{j3.init($,U),f$.init($,U)});function aK($){return y7(AJ,$)}var IJ=M("ZodISODuration",($,U)=>{V3.init($,U),f$.init($,U)});function sK($){return C7(IJ,$)}var nq=($,U)=>{G_.init($,U),$.name="ZodError",Object.defineProperties($,{format:{value:(v)=>O_($,v)},flatten:{value:(v)=>W_($,v)},addIssue:{value:(v)=>{$.issues.push(v),$.message=JSON.stringify($.issues,jU,2)}},addIssues:{value:(v)=>{$.issues.push(...v),$.message=JSON.stringify($.issues,jU,2)}},isEmpty:{get(){return $.issues.length===0}}})},LM=M("ZodError",nq),f6=M("ZodError",nq,{Parent:Error});var eK=EU(f6),$G=uU(f6),UG=mU(f6),_G=hU(f6),vG=Av(f6),JG=Iv(f6),zG=wv(f6),KG=gv(f6),GG=Nv(f6),WG=Sv(f6),OG=Rv(f6),YG=Tv(f6);var q$=M("ZodType",($,U)=>{return Y$.init($,U),Object.assign($["~standard"],{jsonSchema:{input:v0($,"input"),output:v0($,"output")}}),$.toJSONSchema=YK($,{}),$.def=U,$.type=U.type,Object.defineProperty($,"_def",{value:U}),$.check=(...v)=>{return $.clone(h.mergeDefs(U,{checks:[...U.checks??[],...v.map((J)=>typeof J==="function"?{_zod:{check:J,def:{check:"custom"},onattach:[]}}:J)]}),{parent:!0})},$.with=$.check,$.clone=(v,J)=>T6($,v,J),$.brand=()=>$,$.register=(v,J)=>{return v.add($,J),$},$.parse=(v,J)=>eK($,v,J,{callee:$.parse}),$.safeParse=(v,J)=>UG($,v,J),$.parseAsync=async(v,J)=>$G($,v,J,{callee:$.parseAsync}),$.safeParseAsync=async(v,J)=>_G($,v,J),$.spa=$.safeParseAsync,$.encode=(v,J)=>vG($,v,J),$.decode=(v,J)=>JG($,v,J),$.encodeAsync=async(v,J)=>zG($,v,J),$.decodeAsync=async(v,J)=>KG($,v,J),$.safeEncode=(v,J)=>GG($,v,J),$.safeDecode=(v,J)=>WG($,v,J),$.safeEncodeAsync=async(v,J)=>OG($,v,J),$.safeDecodeAsync=async(v,J)=>YG($,v,J),$.refine=(v,J)=>$.check(nG(v,J)),$.superRefine=(v)=>$.check(tG(v)),$.overwrite=(v)=>$.check(G4(v)),$.optional=()=>l$($),$.exactOptional=()=>yG($),$.nullable=()=>S_($),$.nullish=()=>l$(S_($)),$.nonoptional=(v)=>EG($,v),$.array=()=>Q$($),$.or=(v)=>D$([$,v]),$.and=(v)=>Z0($,v),$.transform=(v)=>R_($,iJ(v)),$.default=(v)=>jG($,v),$.prefault=(v)=>fG($,v),$.catch=(v)=>xG($,v),$.pipe=(v)=>R_($,v),$.readonly=()=>lG($),$.describe=(v)=>{let J=$.clone();return Z6.add(J,{description:v}),J},Object.defineProperty($,"description",{get(){return Z6.get($)?.description},configurable:!0}),$.meta=(...v)=>{if(v.length===0)return Z6.get($);let J=$.clone();return Z6.add(J,v[0]),J},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(v)=>v($),$}),gJ=M("_ZodString",($,U)=>{l1.init($,U),q$.init($,U),$._zod.processJSONSchema=(J,_,z)=>ZK($,J,_,z);let v=$._zod.bag;$.format=v.format??null,$.minLength=v.minimum??null,$.maxLength=v.maximum??null,$.regex=(...J)=>$.check(rU(...J)),$.includes=(...J)=>$.check(oU(...J)),$.startsWith=(...J)=>$.check(dU(...J)),$.endsWith=(...J)=>$.check(nU(...J)),$.min=(...J)=>$.check(V4(...J)),$.max=(...J)=>$.check(i1(...J)),$.length=(...J)=>$.check(p1(...J)),$.nonempty=(...J)=>$.check(V4(1,...J)),$.lowercase=(J)=>$.check(iU(J)),$.uppercase=(J)=>$.check(pU(J)),$.trim=()=>$.check(sU()),$.normalize=(...J)=>$.check(aU(...J)),$.toLowerCase=()=>$.check(eU()),$.toUpperCase=()=>$.check($0()),$.slugify=()=>$.check(U0())}),z0=M("ZodString",($,U)=>{l1.init($,U),gJ.init($,U),$.email=(v)=>$.check(iv(NJ,v)),$.url=(v)=>$.check(w_(T_,v)),$.jwt=(v)=>$.check(YJ(cJ,v)),$.emoji=(v)=>$.check(tv(SJ,v)),$.guid=(v)=>$.check(I_(N_,v)),$.uuid=(v)=>$.check(pv(k4,v)),$.uuidv4=(v)=>$.check(ov(k4,v)),$.uuidv6=(v)=>$.check(dv(k4,v)),$.uuidv7=(v)=>$.check(nv(k4,v)),$.nanoid=(v)=>$.check(av(RJ,v)),$.guid=(v)=>$.check(I_(N_,v)),$.cuid=(v)=>$.check(sv(TJ,v)),$.cuid2=(v)=>$.check(ev(yJ,v)),$.ulid=(v)=>$.check($J(CJ,v)),$.base64=(v)=>$.check(GJ(mJ,v)),$.base64url=(v)=>$.check(WJ(xJ,v)),$.xid=(v)=>$.check(UJ(DJ,v)),$.ksuid=(v)=>$.check(_J(jJ,v)),$.ipv4=(v)=>$.check(vJ(VJ,v)),$.ipv6=(v)=>$.check(JJ(fJ,v)),$.cidrv4=(v)=>$.check(zJ(EJ,v)),$.cidrv6=(v)=>$.check(KJ(uJ,v)),$.e164=(v)=>$.check(OJ(hJ,v)),$.datetime=(v)=>$.check(nK(v)),$.date=(v)=>$.check(tK(v)),$.time=(v)=>$.check(aK(v)),$.duration=(v)=>$.check(sK(v))});function g($){return w7(z0,$)}var f$=M("ZodStringFormat",($,U)=>{V$.init($,U),gJ.init($,U)}),NJ=M("ZodEmail",($,U)=>{A3.init($,U),f$.init($,U)});function tq($){return iv(NJ,$)}var N_=M("ZodGUID",($,U)=>{b3.init($,U),f$.init($,U)});function aq($){return I_(N_,$)}var k4=M("ZodUUID",($,U)=>{M3.init($,U),f$.init($,U)});function sq($){return pv(k4,$)}function eq($){return ov(k4,$)}function $B($){return dv(k4,$)}function UB($){return nv(k4,$)}var T_=M("ZodURL",($,U)=>{I3.init($,U),f$.init($,U)});function _B($){return w_(T_,$)}function vB($){return w_(T_,{protocol:/^https?$/,hostname:a6.domain,...h.normalizeParams($)})}var SJ=M("ZodEmoji",($,U)=>{w3.init($,U),f$.init($,U)});function JB($){return tv(SJ,$)}var RJ=M("ZodNanoID",($,U)=>{g3.init($,U),f$.init($,U)});function zB($){return av(RJ,$)}var TJ=M("ZodCUID",($,U)=>{N3.init($,U),f$.init($,U)});function KB($){return sv(TJ,$)}var yJ=M("ZodCUID2",($,U)=>{S3.init($,U),f$.init($,U)});function GB($){return ev(yJ,$)}var CJ=M("ZodULID",($,U)=>{R3.init($,U),f$.init($,U)});function WB($){return $J(CJ,$)}var DJ=M("ZodXID",($,U)=>{T3.init($,U),f$.init($,U)});function OB($){return UJ(DJ,$)}var jJ=M("ZodKSUID",($,U)=>{y3.init($,U),f$.init($,U)});function YB($){return _J(jJ,$)}var VJ=M("ZodIPv4",($,U)=>{f3.init($,U),f$.init($,U)});function ZB($){return vJ(VJ,$)}var ZG=M("ZodMAC",($,U)=>{u3.init($,U),f$.init($,U)});function qB($){return N7(ZG,$)}var fJ=M("ZodIPv6",($,U)=>{E3.init($,U),f$.init($,U)});function BB($){return JJ(fJ,$)}var EJ=M("ZodCIDRv4",($,U)=>{m3.init($,U),f$.init($,U)});function XB($){return zJ(EJ,$)}var uJ=M("ZodCIDRv6",($,U)=>{x3.init($,U),f$.init($,U)});function HB($){return KJ(uJ,$)}var mJ=M("ZodBase64",($,U)=>{c3.init($,U),f$.init($,U)});function QB($){return GJ(mJ,$)}var xJ=M("ZodBase64URL",($,U)=>{l3.init($,U),f$.init($,U)});function LB($){return WJ(xJ,$)}var hJ=M("ZodE164",($,U)=>{r3.init($,U),f$.init($,U)});function FB($){return OJ(hJ,$)}var cJ=M("ZodJWT",($,U)=>{i3.init($,U),f$.init($,U)});function PB($){return YJ(cJ,$)}var K0=M("ZodCustomStringFormat",($,U)=>{p3.init($,U),f$.init($,U)});function kB($,U,v={}){return _0(K0,$,U,v)}function bB($){return _0(K0,"hostname",a6.hostname,$)}function MB($){return _0(K0,"hex",a6.hex,$)}function AB($,U){let v=U?.enc??"hex",J=`${$}_${v}`,_=a6[J];if(!_)throw Error(`Unrecognized hash format: ${J}`);return _0(K0,J,_,U)}var G0=M("ZodNumber",($,U)=>{xv.init($,U),q$.init($,U),$._zod.processJSONSchema=(J,_,z)=>qK($,J,_,z),$.gt=(J,_)=>$.check(F4(J,_)),$.gte=(J,_)=>$.check(y6(J,_)),$.min=(J,_)=>$.check(y6(J,_)),$.lt=(J,_)=>$.check(L4(J,_)),$.lte=(J,_)=>$.check(l6(J,_)),$.max=(J,_)=>$.check(l6(J,_)),$.int=(J)=>$.check(wJ(J)),$.safe=(J)=>$.check(wJ(J)),$.positive=(J)=>$.check(F4(0,J)),$.nonnegative=(J)=>$.check(y6(0,J)),$.negative=(J)=>$.check(L4(0,J)),$.nonpositive=(J)=>$.check(l6(0,J)),$.multipleOf=(J,_)=>$.check(K1(J,_)),$.step=(J,_)=>$.check(K1(J,_)),$.finite=()=>$;let v=$._zod.bag;$.minValue=Math.max(v.minimum??Number.NEGATIVE_INFINITY,v.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(v.maximum??Number.POSITIVE_INFINITY,v.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(v.format??"").includes("int")||Number.isSafeInteger(v.multipleOf??0.5),$.isFinite=!0,$.format=v.format??null});function I$($){return D7(G0,$)}var o1=M("ZodNumberFormat",($,U)=>{o3.init($,U),G0.init($,U)});function wJ($){return V7(o1,$)}function IB($){return f7(o1,$)}function wB($){return E7(o1,$)}function gB($){return u7(o1,$)}function NB($){return m7(o1,$)}var W0=M("ZodBoolean",($,U)=>{Q_.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>BK($,v,J,_)});function _6($){return x7(W0,$)}var O0=M("ZodBigInt",($,U)=>{hv.init($,U),q$.init($,U),$._zod.processJSONSchema=(J,_,z)=>XK($,J,_,z),$.gte=(J,_)=>$.check(y6(J,_)),$.min=(J,_)=>$.check(y6(J,_)),$.gt=(J,_)=>$.check(F4(J,_)),$.gte=(J,_)=>$.check(y6(J,_)),$.min=(J,_)=>$.check(y6(J,_)),$.lt=(J,_)=>$.check(L4(J,_)),$.lte=(J,_)=>$.check(l6(J,_)),$.max=(J,_)=>$.check(l6(J,_)),$.positive=(J)=>$.check(F4(BigInt(0),J)),$.negative=(J)=>$.check(L4(BigInt(0),J)),$.nonpositive=(J)=>$.check(l6(BigInt(0),J)),$.nonnegative=(J)=>$.check(y6(BigInt(0),J)),$.multipleOf=(J,_)=>$.check(K1(J,_));let v=$._zod.bag;$.minValue=v.minimum??null,$.maxValue=v.maximum??null,$.format=v.format??null});function SB($){return c7(O0,$)}var lJ=M("ZodBigIntFormat",($,U)=>{d3.init($,U),O0.init($,U)});function RB($){return r7(lJ,$)}function TB($){return i7(lJ,$)}var qG=M("ZodSymbol",($,U)=>{n3.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>HK($,v,J,_)});function yB($){return p7(qG,$)}var BG=M("ZodUndefined",($,U)=>{t3.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>LK($,v,J,_)});function CB($){return o7(BG,$)}var XG=M("ZodNull",($,U)=>{a3.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>QK($,v,J,_)});function Y0($){return d7(XG,$)}var HG=M("ZodAny",($,U)=>{s3.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>kK($,v,J,_)});function DB(){return n7(HG)}var QG=M("ZodUnknown",($,U)=>{e3.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>bK($,v,J,_)});function E$(){return t7(QG)}var LG=M("ZodNever",($,U)=>{$z.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>PK($,v,J,_)});function rJ($){return a7(LG,$)}var FG=M("ZodVoid",($,U)=>{Uz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>FK($,v,J,_)});function jB($){return s7(FG,$)}var y_=M("ZodDate",($,U)=>{_z.init($,U),q$.init($,U),$._zod.processJSONSchema=(J,_,z)=>MK($,J,_,z),$.min=(J,_)=>$.check(y6(J,_)),$.max=(J,_)=>$.check(l6(J,_));let v=$._zod.bag;$.minDate=v.minimum?new Date(v.minimum):null,$.maxDate=v.maximum?new Date(v.maximum):null});function VB($){return e7(y_,$)}var PG=M("ZodArray",($,U)=>{vz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>jK($,v,J,_),$.element=U.element,$.min=(v,J)=>$.check(V4(v,J)),$.nonempty=(v)=>$.check(V4(1,v)),$.max=(v,J)=>$.check(i1(v,J)),$.length=(v,J)=>$.check(p1(v,J)),$.unwrap=()=>$.element});function Q$($,U){return _K(PG,$,U)}function fB($){let U=$._zod.def.shape;return B6(Object.keys(U))}var C_=M("ZodObject",($,U)=>{Jz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>VK($,v,J,_),h.defineLazy($,"shape",()=>{return U.shape}),$.keyof=()=>B6(Object.keys($._zod.def.shape)),$.catchall=(v)=>$.clone({...$._zod.def,catchall:v}),$.passthrough=()=>$.clone({...$._zod.def,catchall:E$()}),$.loose=()=>$.clone({...$._zod.def,catchall:E$()}),$.strict=()=>$.clone({...$._zod.def,catchall:rJ()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(v)=>{return h.extend($,v)},$.safeExtend=(v)=>{return h.safeExtend($,v)},$.merge=(v)=>h.merge($,v),$.pick=(v)=>h.pick($,v),$.omit=(v)=>h.omit($,v),$.partial=(...v)=>h.partial(pJ,$,v[0]),$.required=(...v)=>h.required(oJ,$,v[0])});function a($,U){let v={type:"object",shape:$??{},...h.normalizeParams(U)};return new C_(v)}function EB($,U){return new C_({type:"object",shape:$,catchall:rJ(),...h.normalizeParams(U)})}function q6($,U){return new C_({type:"object",shape:$,catchall:E$(),...h.normalizeParams(U)})}var D_=M("ZodUnion",($,U)=>{L_.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>LJ($,v,J,_),$.options=U.options});function D$($,U){return new D_({type:"union",options:$,...h.normalizeParams(U)})}var kG=M("ZodXor",($,U)=>{D_.init($,U),zz.init($,U),$._zod.processJSONSchema=(v,J,_)=>LJ($,v,J,_),$.options=U.options});function uB($,U){return new kG({type:"union",options:$,inclusive:!1,...h.normalizeParams(U)})}var bG=M("ZodDiscriminatedUnion",($,U)=>{D_.init($,U),Kz.init($,U)});function j_($,U,v){return new bG({type:"union",options:U,discriminator:$,...h.normalizeParams(v)})}var MG=M("ZodIntersection",($,U)=>{Gz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>fK($,v,J,_)});function Z0($,U){return new MG({type:"intersection",left:$,right:U})}var AG=M("ZodTuple",($,U)=>{cv.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>EK($,v,J,_),$.rest=(v)=>$.clone({...$._zod.def,rest:v})});function IG($,U,v){let J=U instanceof Y$,_=J?v:U;return new AG({type:"tuple",items:$,rest:J?U:null,...h.normalizeParams(_)})}var V_=M("ZodRecord",($,U)=>{Wz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>uK($,v,J,_),$.keyType=U.keyType,$.valueType=U.valueType});function x$($,U,v){return new V_({type:"record",keyType:$,valueType:U,...h.normalizeParams(v)})}function mB($,U,v){let J=T6($);return J._zod.values=void 0,new V_({type:"record",keyType:J,valueType:U,...h.normalizeParams(v)})}function xB($,U,v){return new V_({type:"record",keyType:$,valueType:U,mode:"loose",...h.normalizeParams(v)})}var wG=M("ZodMap",($,U)=>{Oz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>CK($,v,J,_),$.keyType=U.keyType,$.valueType=U.valueType,$.min=(...v)=>$.check(P4(...v)),$.nonempty=(v)=>$.check(P4(1,v)),$.max=(...v)=>$.check(G1(...v)),$.size=(...v)=>$.check(r1(...v))});function hB($,U,v){return new wG({type:"map",keyType:$,valueType:U,...h.normalizeParams(v)})}var gG=M("ZodSet",($,U)=>{Yz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>DK($,v,J,_),$.min=(...v)=>$.check(P4(...v)),$.nonempty=(v)=>$.check(P4(1,v)),$.max=(...v)=>$.check(G1(...v)),$.size=(...v)=>$.check(r1(...v))});function cB($,U){return new gG({type:"set",valueType:$,...h.normalizeParams(U)})}var J0=M("ZodEnum",($,U)=>{Zz.init($,U),q$.init($,U),$._zod.processJSONSchema=(J,_,z)=>AK($,J,_,z),$.enum=U.entries,$.options=Object.values(U.entries);let v=new Set(Object.keys(U.entries));$.extract=(J,_)=>{let z={};for(let K of J)if(v.has(K))z[K]=U.entries[K];else throw Error(`Key ${K} not found in enum`);return new J0({...U,checks:[],...h.normalizeParams(_),entries:z})},$.exclude=(J,_)=>{let z={...U.entries};for(let K of J)if(v.has(K))delete z[K];else throw Error(`Key ${K} not found in enum`);return new J0({...U,checks:[],...h.normalizeParams(_),entries:z})}});function B6($,U){let v=Array.isArray($)?Object.fromEntries($.map((J)=>[J,J])):$;return new J0({type:"enum",entries:v,...h.normalizeParams(U)})}function lB($,U){return new J0({type:"enum",entries:$,...h.normalizeParams(U)})}var NG=M("ZodLiteral",($,U)=>{qz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>IK($,v,J,_),$.values=new Set(U.values),Object.defineProperty($,"value",{get(){if(U.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return U.values[0]}})});function $$($,U){return new NG({type:"literal",values:Array.isArray($)?$:[$],...h.normalizeParams(U)})}var SG=M("ZodFile",($,U)=>{Bz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>NK($,v,J,_),$.min=(v,J)=>$.check(P4(v,J)),$.max=(v,J)=>$.check(G1(v,J)),$.mime=(v,J)=>$.check(tU(Array.isArray(v)?v:[v],J))});function rB($){return vK(SG,$)}var RG=M("ZodTransform",($,U)=>{Xz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>yK($,v,J,_),$._zod.parse=(v,J)=>{if(J.direction==="backward")throw new x1($.constructor.name);v.addIssue=(z)=>{if(typeof z==="string")v.issues.push(h.issue(z,v.value,U));else{let K=z;if(K.fatal)K.continue=!1;K.code??(K.code="custom"),K.input??(K.input=v.value),K.inst??(K.inst=$),v.issues.push(h.issue(K))}};let _=U.transform(v.value,v);if(_ instanceof Promise)return _.then((z)=>{return v.value=z,v});return v.value=_,v}});function iJ($){return new RG({type:"transform",transform:$})}var pJ=M("ZodOptional",($,U)=>{lv.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>FJ($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function l$($){return new pJ({type:"optional",innerType:$})}var TG=M("ZodExactOptional",($,U)=>{Hz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>FJ($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function yG($){return new TG({type:"optional",innerType:$})}var CG=M("ZodNullable",($,U)=>{Qz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>mK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function S_($){return new CG({type:"nullable",innerType:$})}function iB($){return l$(S_($))}var DG=M("ZodDefault",($,U)=>{Lz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>hK($,v,J,_),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function jG($,U){return new DG({type:"default",innerType:$,get defaultValue(){return typeof U==="function"?U():h.shallowClone(U)}})}var VG=M("ZodPrefault",($,U)=>{Fz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>cK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function fG($,U){return new VG({type:"prefault",innerType:$,get defaultValue(){return typeof U==="function"?U():h.shallowClone(U)}})}var oJ=M("ZodNonOptional",($,U)=>{Pz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>xK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function EG($,U){return new oJ({type:"nonoptional",innerType:$,...h.normalizeParams(U)})}var uG=M("ZodSuccess",($,U)=>{kz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>SK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function pB($){return new uG({type:"success",innerType:$})}var mG=M("ZodCatch",($,U)=>{bz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>lK($,v,J,_),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function xG($,U){return new mG({type:"catch",innerType:$,catchValue:typeof U==="function"?U:()=>U})}var hG=M("ZodNaN",($,U)=>{Mz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>wK($,v,J,_)});function oB($){return UK(hG,$)}var dJ=M("ZodPipe",($,U)=>{Az.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>rK($,v,J,_),$.in=U.in,$.out=U.out});function R_($,U){return new dJ({type:"pipe",in:$,out:U})}var nJ=M("ZodCodec",($,U)=>{dJ.init($,U),F_.init($,U)});function dB($,U,v){return new nJ({type:"pipe",in:$,out:U,transform:v.decode,reverseTransform:v.encode})}var cG=M("ZodReadonly",($,U)=>{Iz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>iK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function lG($){return new cG({type:"readonly",innerType:$})}var rG=M("ZodTemplateLiteral",($,U)=>{wz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>gK($,v,J,_)});function nB($,U){return new rG({type:"template_literal",parts:$,...h.normalizeParams(U)})}var iG=M("ZodLazy",($,U)=>{Sz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>oK($,v,J,_),$.unwrap=()=>$._zod.def.getter()});function pG($){return new iG({type:"lazy",getter:$})}var oG=M("ZodPromise",($,U)=>{Nz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>pK($,v,J,_),$.unwrap=()=>$._zod.def.innerType});function tB($){return new oG({type:"promise",innerType:$})}var dG=M("ZodFunction",($,U)=>{gz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>TK($,v,J,_)});function aB($){return new dG({type:"function",input:Array.isArray($?.input)?IG($?.input):$?.input??Q$(E$()),output:$?.output??E$()})}var f_=M("ZodCustom",($,U)=>{Rz.init($,U),q$.init($,U),$._zod.processJSONSchema=(v,J,_)=>RK($,v,J,_)});function sB($){let U=new m$({check:"custom"});return U._zod.check=$,U}function tJ($,U){return JK(f_,$??(()=>!0),U)}function nG($,U={}){return zK(f_,$,U)}function tG($){return KK($)}var eB=GK,$X=WK;function UX($,U={}){let v=new f_({type:"custom",check:"custom",fn:(J)=>J instanceof $,abort:!0,...h.normalizeParams(U)});return v._zod.bag.Class=$,v._zod.check=(J)=>{if(!(J.value instanceof $))J.issues.push({code:"invalid_type",expected:$.name,input:J.value,inst:v,path:[...v._zod.def.path??[]]})},v}var _X=(...$)=>OK({Codec:nJ,Boolean:W0,String:z0},...$);function vX($){let U=pG(()=>{return D$([g($),I$(),_6(),Y0(),Q$(U),x$(g(),U)])});return U}function E_($,U){return R_(iJ($),U)}var PM={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function kM($){U6({customError:$})}function bM(){return U6().customError}var aG;(function($){})(aG||(aG={}));var d={...g_,...kJ,iso:Z1},MM=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function AM($,U){let v=$.$schema;if(v==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(v==="http://json-schema.org/draft-07/schema#")return"draft-7";if(v==="http://json-schema.org/draft-04/schema#")return"draft-4";return U??"draft-2020-12"}function IM($,U){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let v=$.slice(1).split("/").filter(Boolean);if(v.length===0)return U.rootSchema;let J=U.version==="draft-2020-12"?"$defs":"definitions";if(v[0]===J){let _=v[1];if(!_||!U.defs[_])throw Error(`Reference not found: ${$}`);return U.defs[_]}throw Error(`Reference not found: ${$}`)}function JX($,U){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return d.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let _=$.$ref;if(U.refs.has(_))return U.refs.get(_);if(U.processing.has(_))return d.lazy(()=>{if(!U.refs.has(_))throw Error(`Circular reference not resolved: ${_}`);return U.refs.get(_)});U.processing.add(_);let z=IM(_,U),K=w6(z,U);return U.refs.set(_,K),U.processing.delete(_),K}if($.enum!==void 0){let _=$.enum;if(U.version==="openapi-3.0"&&$.nullable===!0&&_.length===1&&_[0]===null)return d.null();if(_.length===0)return d.never();if(_.length===1)return d.literal(_[0]);if(_.every((K)=>typeof K==="string"))return d.enum(_);let z=_.map((K)=>d.literal(K));if(z.length<2)return z[0];return d.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return d.literal($.const);let v=$.type;if(Array.isArray(v)){let _=v.map((z)=>{let K={...$,type:z};return JX(K,U)});if(_.length===0)return d.never();if(_.length===1)return _[0];return d.union(_)}if(!v)return d.any();let J;switch(v){case"string":{let _=d.string();if($.format){let z=$.format;if(z==="email")_=_.check(d.email());else if(z==="uri"||z==="uri-reference")_=_.check(d.url());else if(z==="uuid"||z==="guid")_=_.check(d.uuid());else if(z==="date-time")_=_.check(d.iso.datetime());else if(z==="date")_=_.check(d.iso.date());else if(z==="time")_=_.check(d.iso.time());else if(z==="duration")_=_.check(d.iso.duration());else if(z==="ipv4")_=_.check(d.ipv4());else if(z==="ipv6")_=_.check(d.ipv6());else if(z==="mac")_=_.check(d.mac());else if(z==="cidr")_=_.check(d.cidrv4());else if(z==="cidr-v6")_=_.check(d.cidrv6());else if(z==="base64")_=_.check(d.base64());else if(z==="base64url")_=_.check(d.base64url());else if(z==="e164")_=_.check(d.e164());else if(z==="jwt")_=_.check(d.jwt());else if(z==="emoji")_=_.check(d.emoji());else if(z==="nanoid")_=_.check(d.nanoid());else if(z==="cuid")_=_.check(d.cuid());else if(z==="cuid2")_=_.check(d.cuid2());else if(z==="ulid")_=_.check(d.ulid());else if(z==="xid")_=_.check(d.xid());else if(z==="ksuid")_=_.check(d.ksuid())}if(typeof $.minLength==="number")_=_.min($.minLength);if(typeof $.maxLength==="number")_=_.max($.maxLength);if($.pattern)_=_.regex(new RegExp($.pattern));J=_;break}case"number":case"integer":{let _=v==="integer"?d.number().int():d.number();if(typeof $.minimum==="number")_=_.min($.minimum);if(typeof $.maximum==="number")_=_.max($.maximum);if(typeof $.exclusiveMinimum==="number")_=_.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")_=_.gt($.minimum);if(typeof $.exclusiveMaximum==="number")_=_.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")_=_.lt($.maximum);if(typeof $.multipleOf==="number")_=_.multipleOf($.multipleOf);J=_;break}case"boolean":{J=d.boolean();break}case"null":{J=d.null();break}case"object":{let _={},z=$.properties||{},K=new Set($.required||[]);for(let[O,Y]of Object.entries(z)){let Z=w6(Y,U);_[O]=K.has(O)?Z:Z.optional()}if($.propertyNames){let O=w6($.propertyNames,U),Y=$.additionalProperties&&typeof $.additionalProperties==="object"?w6($.additionalProperties,U):d.any();if(Object.keys(_).length===0){J=d.record(O,Y);break}let Z=d.object(_).passthrough(),q=d.looseRecord(O,Y);J=d.intersection(Z,q);break}if($.patternProperties){let O=$.patternProperties,Y=Object.keys(O),Z=[];for(let X of Y){let B=w6(O[X],U),L=d.string().regex(new RegExp(X));Z.push(d.looseRecord(L,B))}let q=[];if(Object.keys(_).length>0)q.push(d.object(_).passthrough());if(q.push(...Z),q.length===0)J=d.object({}).passthrough();else if(q.length===1)J=q[0];else{let X=d.intersection(q[0],q[1]);for(let B=2;B<q.length;B++)X=d.intersection(X,q[B]);J=X}break}let W=d.object(_);if($.additionalProperties===!1)J=W.strict();else if(typeof $.additionalProperties==="object")J=W.catchall(w6($.additionalProperties,U));else J=W.passthrough();break}case"array":{let{prefixItems:_,items:z}=$;if(_&&Array.isArray(_)){let K=_.map((O)=>w6(O,U)),W=z&&typeof z==="object"&&!Array.isArray(z)?w6(z,U):void 0;if(W)J=d.tuple(K).rest(W);else J=d.tuple(K);if(typeof $.minItems==="number")J=J.check(d.minLength($.minItems));if(typeof $.maxItems==="number")J=J.check(d.maxLength($.maxItems))}else if(Array.isArray(z)){let K=z.map((O)=>w6(O,U)),W=$.additionalItems&&typeof $.additionalItems==="object"?w6($.additionalItems,U):void 0;if(W)J=d.tuple(K).rest(W);else J=d.tuple(K);if(typeof $.minItems==="number")J=J.check(d.minLength($.minItems));if(typeof $.maxItems==="number")J=J.check(d.maxLength($.maxItems))}else if(z!==void 0){let K=w6(z,U),W=d.array(K);if(typeof $.minItems==="number")W=W.min($.minItems);if(typeof $.maxItems==="number")W=W.max($.maxItems);J=W}else J=d.array(d.any());break}default:throw Error(`Unsupported type: ${v}`)}if($.description)J=J.describe($.description);if($.default!==void 0)J=J.default($.default);return J}function w6($,U){if(typeof $==="boolean")return $?d.any():d.never();let v=JX($,U),J=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let W=$.anyOf.map((Y)=>w6(Y,U)),O=d.union(W);v=J?d.intersection(v,O):O}if($.oneOf&&Array.isArray($.oneOf)){let W=$.oneOf.map((Y)=>w6(Y,U)),O=d.xor(W);v=J?d.intersection(v,O):O}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)v=J?v:d.any();else{let W=J?v:w6($.allOf[0],U),O=J?0:1;for(let Y=O;Y<$.allOf.length;Y++)W=d.intersection(W,w6($.allOf[Y],U));v=W}if($.nullable===!0&&U.version==="openapi-3.0")v=d.nullable(v);if($.readOnly===!0)v=d.readonly(v);let _={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let W of z)if(W in $)_[W]=$[W];let K=["contentEncoding","contentMediaType","contentSchema"];for(let W of K)if(W in $)_[W]=$[W];for(let W of Object.keys($))if(!MM.has(W))_[W]=$[W];if(Object.keys(_).length>0)U.registry.add(v,_);return v}function zX($,U){if(typeof $==="boolean")return $?d.any():d.never();let v=AM($,U?.defaultTarget),J=$.$defs||$.definitions||{},_={version:v,defs:J,refs:new Map,processing:new Set,rootSchema:$,registry:U?.registry??Z6};return w6($,_)}var sG={};A4(sG,{string:()=>wM,number:()=>gM,date:()=>RM,boolean:()=>NM,bigint:()=>SM});function wM($){return g7(z0,$)}function gM($){return j7(G0,$)}function NM($){return h7(W0,$)}function SM($){return l7(O0,$)}function RM($){return $K(y_,$)}U6(P_());var q1="io.modelcontextprotocol/related-task",sJ="2.0",X6=tJ(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),KX=D$([g(),I$().int()]),GX=g(),BD=q6({ttl:D$([I$(),Y0()]).optional(),pollInterval:I$().optional()}),TM=a({ttl:I$().optional()}),yM=a({taskId:g()}),eG=q6({progressToken:KX.optional(),[q1]:yM.optional()}),r6=a({_meta:eG.optional()}),u_=r6.extend({task:TM.optional()}),WX=($)=>u_.safeParse($).success,H6=a({method:g(),params:r6.loose().optional()}),s6=a({_meta:eG.optional()}),e6=a({method:g(),params:s6.loose().optional()}),Q6=q6({_meta:eG.optional()}),B0=D$([g(),I$().int()]),OX=a({jsonrpc:$$(sJ),id:B0,...H6.shape}).strict(),$W=($)=>OX.safeParse($).success,YX=a({jsonrpc:$$(sJ),...e6.shape}).strict(),ZX=($)=>YX.safeParse($).success,UW=a({jsonrpc:$$(sJ),id:B0,result:Q6}).strict(),m_=($)=>UW.safeParse($).success;var T$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(T$||(T$={}));var _W=a({jsonrpc:$$(sJ),id:B0.optional(),error:a({code:I$().int(),message:g(),data:E$().optional()})}).strict();var qX=($)=>_W.safeParse($).success;var BX=D$([OX,YX,UW,_W]),XD=D$([UW,_W]),eJ=Q6.strict(),CM=s6.extend({requestId:B0.optional(),reason:g().optional()}),$9=e6.extend({method:$$("notifications/cancelled"),params:CM}),DM=a({src:g(),mimeType:g().optional(),sizes:Q$(g()).optional(),theme:B6(["light","dark"]).optional()}),x_=a({icons:Q$(DM).optional()}),q0=a({name:g(),title:g().optional()}),h_=q0.extend({...q0.shape,...x_.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),jM=Z0(a({applyDefaults:_6().optional()}),x$(g(),E$())),VM=E_(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},Z0(a({form:jM.optional(),url:X6.optional()}),x$(g(),E$()).optional())),fM=q6({list:X6.optional(),cancel:X6.optional(),requests:q6({sampling:q6({createMessage:X6.optional()}).optional(),elicitation:q6({create:X6.optional()}).optional()}).optional()}),EM=q6({list:X6.optional(),cancel:X6.optional(),requests:q6({tools:q6({call:X6.optional()}).optional()}).optional()}),uM=a({experimental:x$(g(),X6).optional(),sampling:a({context:X6.optional(),tools:X6.optional()}).optional(),elicitation:VM.optional(),roots:a({listChanged:_6().optional()}).optional(),tasks:fM.optional()}),mM=r6.extend({protocolVersion:g(),capabilities:uM,clientInfo:h_}),xM=H6.extend({method:$$("initialize"),params:mM});var hM=a({experimental:x$(g(),X6).optional(),logging:X6.optional(),completions:X6.optional(),prompts:a({listChanged:_6().optional()}).optional(),resources:a({subscribe:_6().optional(),listChanged:_6().optional()}).optional(),tools:a({listChanged:_6().optional()}).optional(),tasks:EM.optional()}),cM=Q6.extend({protocolVersion:g(),capabilities:hM,serverInfo:h_,instructions:g().optional()}),lM=e6.extend({method:$$("notifications/initialized"),params:s6.optional()});var B1=H6.extend({method:$$("ping"),params:r6.optional()}),rM=a({progress:I$(),total:l$(I$()),message:l$(g())}),iM=a({...s6.shape,...rM.shape,progressToken:KX}),U9=e6.extend({method:$$("notifications/progress"),params:iM}),pM=r6.extend({cursor:GX.optional()}),c_=H6.extend({params:pM.optional()}),l_=Q6.extend({nextCursor:GX.optional()}),oM=B6(["working","input_required","completed","failed","cancelled"]),r_=a({taskId:g(),status:oM,ttl:D$([I$(),Y0()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:l$(I$()),statusMessage:l$(g())}),_9=Q6.extend({task:r_}),dM=s6.merge(r_),i_=e6.extend({method:$$("notifications/tasks/status"),params:dM}),v9=H6.extend({method:$$("tasks/get"),params:r6.extend({taskId:g()})}),J9=Q6.merge(r_),z9=H6.extend({method:$$("tasks/result"),params:r6.extend({taskId:g()})}),HD=Q6.loose(),K9=c_.extend({method:$$("tasks/list")}),G9=l_.extend({tasks:Q$(r_)}),W9=H6.extend({method:$$("tasks/cancel"),params:r6.extend({taskId:g()})}),XX=Q6.merge(r_),HX=a({uri:g(),mimeType:l$(g()),_meta:x$(g(),E$()).optional()}),QX=HX.extend({text:g()}),vW=g().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),LX=HX.extend({blob:vW}),p_=B6(["user","assistant"]),X0=a({audience:Q$(p_).optional(),priority:I$().min(0).max(1).optional(),lastModified:Z1.datetime({offset:!0}).optional()}),FX=a({...q0.shape,...x_.shape,uri:g(),description:l$(g()),mimeType:l$(g()),annotations:X0.optional(),_meta:l$(q6({}))}),nM=a({...q0.shape,...x_.shape,uriTemplate:g(),description:l$(g()),mimeType:l$(g()),annotations:X0.optional(),_meta:l$(q6({}))}),JW=c_.extend({method:$$("resources/list")}),o_=l_.extend({resources:Q$(FX)}),zW=c_.extend({method:$$("resources/templates/list")}),KW=l_.extend({resourceTemplates:Q$(nM)}),GW=r6.extend({uri:g()}),tM=GW,WW=H6.extend({method:$$("resources/read"),params:tM}),d_=Q6.extend({contents:Q$(D$([QX,LX]))}),OW=e6.extend({method:$$("notifications/resources/list_changed"),params:s6.optional()}),aM=GW,sM=H6.extend({method:$$("resources/subscribe"),params:aM}),eM=GW,$A=H6.extend({method:$$("resources/unsubscribe"),params:eM}),UA=s6.extend({uri:g()}),_A=e6.extend({method:$$("notifications/resources/updated"),params:UA}),vA=a({name:g(),description:l$(g()),required:l$(_6())}),JA=a({...q0.shape,...x_.shape,description:l$(g()),arguments:l$(Q$(vA)),_meta:l$(q6({}))}),YW=c_.extend({method:$$("prompts/list")}),ZW=l_.extend({prompts:Q$(JA)}),zA=r6.extend({name:g(),arguments:x$(g(),g()).optional()}),KA=H6.extend({method:$$("prompts/get"),params:zA}),qW=a({type:$$("text"),text:g(),annotations:X0.optional(),_meta:x$(g(),E$()).optional()}),BW=a({type:$$("image"),data:vW,mimeType:g(),annotations:X0.optional(),_meta:x$(g(),E$()).optional()}),XW=a({type:$$("audio"),data:vW,mimeType:g(),annotations:X0.optional(),_meta:x$(g(),E$()).optional()}),GA=a({type:$$("tool_use"),name:g(),id:g(),input:x$(g(),E$()),_meta:x$(g(),E$()).optional()}),HW=a({type:$$("resource"),resource:D$([QX,LX]),annotations:X0.optional(),_meta:x$(g(),E$()).optional()}),QW=FX.extend({type:$$("resource_link")}),H0=D$([qW,BW,XW,QW,HW]),WA=a({role:p_,content:H0}),OA=Q6.extend({description:g().optional(),messages:Q$(WA)}),LW=e6.extend({method:$$("notifications/prompts/list_changed"),params:s6.optional()}),YA=a({title:g().optional(),readOnlyHint:_6().optional(),destructiveHint:_6().optional(),idempotentHint:_6().optional(),openWorldHint:_6().optional()}),ZA=a({taskSupport:B6(["required","optional","forbidden"]).optional()}),O9=a({...q0.shape,...x_.shape,description:g().optional(),inputSchema:a({type:$$("object"),properties:x$(g(),X6).optional(),required:Q$(g()).optional()}).catchall(E$()),outputSchema:a({type:$$("object"),properties:x$(g(),X6).optional(),required:Q$(g()).optional()}).catchall(E$()).optional(),annotations:YA.optional(),execution:ZA.optional(),_meta:x$(g(),E$()).optional()}),n_=c_.extend({method:$$("tools/list")}),qA=l_.extend({tools:Q$(O9)}),X1=Q6.extend({content:Q$(H0).default([]),structuredContent:x$(g(),E$()).optional(),isError:_6().optional()}),QD=X1.or(Q6.extend({toolResult:E$()})),BA=u_.extend({name:g(),arguments:x$(g(),E$()).optional()}),t_=H6.extend({method:$$("tools/call"),params:BA}),FW=e6.extend({method:$$("notifications/tools/list_changed"),params:s6.optional()}),LD=a({autoRefresh:_6().default(!0),debounceMs:I$().int().nonnegative().default(300)}),PX=B6(["debug","info","notice","warning","error","critical","alert","emergency"]),XA=r6.extend({level:PX}),HA=H6.extend({method:$$("logging/setLevel"),params:XA}),QA=s6.extend({level:PX,logger:g().optional(),data:E$()}),PW=e6.extend({method:$$("notifications/message"),params:QA}),LA=a({name:g().optional()}),FA=a({hints:Q$(LA).optional(),costPriority:I$().min(0).max(1).optional(),speedPriority:I$().min(0).max(1).optional(),intelligencePriority:I$().min(0).max(1).optional()}),PA=a({mode:B6(["auto","required","none"]).optional()}),kA=a({type:$$("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:Q$(H0).default([]),structuredContent:a({}).loose().optional(),isError:_6().optional(),_meta:x$(g(),E$()).optional()}),bA=j_("type",[qW,BW,XW]),aJ=j_("type",[qW,BW,XW,GA,kA]),MA=a({role:p_,content:D$([aJ,Q$(aJ)]),_meta:x$(g(),E$()).optional()}),AA=u_.extend({messages:Q$(MA),modelPreferences:FA.optional(),systemPrompt:g().optional(),includeContext:B6(["none","thisServer","allServers"]).optional(),temperature:I$().optional(),maxTokens:I$().int(),stopSequences:Q$(g()).optional(),metadata:X6.optional(),tools:Q$(O9).optional(),toolChoice:PA.optional()}),IA=H6.extend({method:$$("sampling/createMessage"),params:AA}),wA=Q6.extend({model:g(),stopReason:l$(B6(["endTurn","stopSequence","maxTokens"]).or(g())),role:p_,content:bA}),gA=Q6.extend({model:g(),stopReason:l$(B6(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:p_,content:D$([aJ,Q$(aJ)])}),NA=a({type:$$("boolean"),title:g().optional(),description:g().optional(),default:_6().optional()}),SA=a({type:$$("string"),title:g().optional(),description:g().optional(),minLength:I$().optional(),maxLength:I$().optional(),format:B6(["email","uri","date","date-time"]).optional(),default:g().optional()}),RA=a({type:B6(["number","integer"]),title:g().optional(),description:g().optional(),minimum:I$().optional(),maximum:I$().optional(),default:I$().optional()}),TA=a({type:$$("string"),title:g().optional(),description:g().optional(),enum:Q$(g()),default:g().optional()}),yA=a({type:$$("string"),title:g().optional(),description:g().optional(),oneOf:Q$(a({const:g(),title:g()})),default:g().optional()}),CA=a({type:$$("string"),title:g().optional(),description:g().optional(),enum:Q$(g()),enumNames:Q$(g()).optional(),default:g().optional()}),DA=D$([TA,yA]),jA=a({type:$$("array"),title:g().optional(),description:g().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:a({type:$$("string"),enum:Q$(g())}),default:Q$(g()).optional()}),VA=a({type:$$("array"),title:g().optional(),description:g().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:a({anyOf:Q$(a({const:g(),title:g()}))}),default:Q$(g()).optional()}),fA=D$([jA,VA]),EA=D$([CA,DA,fA]),uA=D$([EA,NA,SA,RA]),mA=u_.extend({mode:$$("form").optional(),message:g(),requestedSchema:a({type:$$("object"),properties:x$(g(),uA),required:Q$(g()).optional()})}),xA=u_.extend({mode:$$("url"),message:g(),elicitationId:g(),url:g().url()}),hA=D$([mA,xA]),cA=H6.extend({method:$$("elicitation/create"),params:hA}),lA=s6.extend({elicitationId:g()}),rA=e6.extend({method:$$("notifications/elicitation/complete"),params:lA}),iA=Q6.extend({action:B6(["accept","decline","cancel"]),content:E_(($)=>$===null?void 0:$,x$(g(),D$([g(),I$(),_6(),Q$(g())])).optional())}),pA=a({type:$$("ref/resource"),uri:g()});var oA=a({type:$$("ref/prompt"),name:g()}),dA=r6.extend({ref:D$([oA,pA]),argument:a({name:g(),value:g()}),context:a({arguments:x$(g(),g()).optional()}).optional()}),nA=H6.extend({method:$$("completion/complete"),params:dA});var tA=Q6.extend({completion:q6({values:Q$(g()).max(100),total:l$(I$().int()),hasMore:l$(_6())})}),aA=a({uri:g().startsWith("file://"),name:g().optional(),_meta:x$(g(),E$()).optional()}),sA=H6.extend({method:$$("roots/list"),params:r6.optional()}),eA=Q6.extend({roots:Q$(aA)}),$I=e6.extend({method:$$("notifications/roots/list_changed"),params:s6.optional()}),FD=D$([B1,xM,nA,HA,KA,YW,JW,zW,WW,sM,$A,t_,n_,v9,z9,K9,W9]),PD=D$([$9,U9,lM,$I,i_]),kD=D$([eJ,wA,gA,iA,eA,J9,G9,_9]),bD=D$([B1,IA,cA,sA,v9,z9,K9,W9]),MD=D$([$9,U9,PW,_A,OW,FW,LW,i_,rA]),AD=D$([eJ,cM,tA,OA,ZW,o_,KW,d_,X1,qA,J9,G9,_9]);class F$ extends Error{constructor($,U,v){super(`MCP error ${$}: ${U}`);this.code=$,this.data=v,this.name="McpError"}static fromError($,U,v){if($===T$.UrlElicitationRequired&&v){let J=v;if(J.elicitations)return new kX(J.elicitations,U)}return new F$($,U,v)}}class kX extends F${constructor($,U=`URL elicitation${$.length>1?"s":""} required`){super(T$.UrlElicitationRequired,U,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function Y9($){return!!$._zod}function Z9($,U){if(Y9($))return xU($,U);return $.safeParse(U)}function bX($){if(!$)return;let U;if(Y9($))U=$._zod?.def?.shape;else U=$.shape;if(!U)return;if(typeof U==="function")try{return U()}catch{return}return U}function MX($){if(Y9($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let v=$._def;if(v){if(v.value!==void 0)return v.value;if(Array.isArray(v.values)&&v.values.length>0)return v.values[0]}let J=$.value;if(J!==void 0)return J;return}function H1($){return $==="completed"||$==="failed"||$==="cancelled"}var UI=Symbol("Let zodToJsonSchema decide on which parser to use");var Gj=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function kW($){let v=bX($)?.method;if(!v)throw Error("Schema is missing a method literal");let J=MX(v);if(typeof J!=="string")throw Error("Schema method literal must be a string");return J}function bW($,U){let v=Z9($,U);if(!v.success)throw v.error;return v.data}var GI=60000;class s_{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler($9,(U)=>{this._oncancel(U)}),this.setNotificationHandler(U9,(U)=>{this._onprogress(U)}),this.setRequestHandler(B1,(U)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(v9,async(U,v)=>{let J=await this._taskStore.getTask(U.params.taskId,v.sessionId);if(!J)throw new F$(T$.InvalidParams,"Failed to retrieve task: Task not found");return{...J}}),this.setRequestHandler(z9,async(U,v)=>{let J=async()=>{let _=U.params.taskId;if(this._taskMessageQueue){let K;while(K=await this._taskMessageQueue.dequeue(_,v.sessionId)){if(K.type==="response"||K.type==="error"){let W=K.message,O=W.id,Y=this._requestResolvers.get(O);if(Y)if(this._requestResolvers.delete(O),K.type==="response")Y(W);else{let Z=W,q=new F$(Z.error.code,Z.error.message,Z.error.data);Y(q)}else{let Z=K.type==="response"?"Response":"Error";this._onerror(Error(`${Z} handler missing for request ${O}`))}continue}await this._transport?.send(K.message,{relatedRequestId:v.requestId})}}let z=await this._taskStore.getTask(_,v.sessionId);if(!z)throw new F$(T$.InvalidParams,`Task not found: ${_}`);if(!H1(z.status))return await this._waitForTaskUpdate(_,v.signal),await J();if(H1(z.status)){let K=await this._taskStore.getTaskResult(_,v.sessionId);return this._clearTaskQueue(_),{...K,_meta:{...K._meta,[q1]:{taskId:_}}}}return await J()};return await J()}),this.setRequestHandler(K9,async(U,v)=>{try{let{tasks:J,nextCursor:_}=await this._taskStore.listTasks(U.params?.cursor,v.sessionId);return{tasks:J,nextCursor:_,_meta:{}}}catch(J){throw new F$(T$.InvalidParams,`Failed to list tasks: ${J instanceof Error?J.message:String(J)}`)}}),this.setRequestHandler(W9,async(U,v)=>{try{let J=await this._taskStore.getTask(U.params.taskId,v.sessionId);if(!J)throw new F$(T$.InvalidParams,`Task not found: ${U.params.taskId}`);if(H1(J.status))throw new F$(T$.InvalidParams,`Cannot cancel task in terminal status: ${J.status}`);await this._taskStore.updateTaskStatus(U.params.taskId,"cancelled","Client cancelled task execution.",v.sessionId),this._clearTaskQueue(U.params.taskId);let _=await this._taskStore.getTask(U.params.taskId,v.sessionId);if(!_)throw new F$(T$.InvalidParams,`Task not found after cancellation: ${U.params.taskId}`);return{_meta:{},..._}}catch(J){if(J instanceof F$)throw J;throw new F$(T$.InvalidRequest,`Failed to cancel task: ${J instanceof Error?J.message:String(J)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,U,v,J,_=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(J,U),startTime:Date.now(),timeout:U,maxTotalTimeout:v,resetTimeoutOnProgress:_,onTimeout:J})}_resetTimeout($){let U=this._timeoutInfo.get($);if(!U)return!1;let v=Date.now()-U.startTime;if(U.maxTotalTimeout&&v>=U.maxTotalTimeout)throw this._timeoutInfo.delete($),F$.fromError(T$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:U.maxTotalTimeout,totalElapsed:v});return clearTimeout(U.timeoutId),U.timeoutId=setTimeout(U.onTimeout,U.timeout),!0}_cleanupTimeout($){let U=this._timeoutInfo.get($);if(U)clearTimeout(U.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let U=this.transport?.onclose;this._transport.onclose=()=>{U?.(),this._onclose()};let v=this.transport?.onerror;this._transport.onerror=(_)=>{v?.(_),this._onerror(_)};let J=this._transport?.onmessage;this._transport.onmessage=(_,z)=>{if(J?.(_,z),m_(_)||qX(_))this._onresponse(_);else if($W(_))this._onrequest(_,z);else if(ZX(_))this._onnotification(_);else this._onerror(Error(`Unknown message type: ${JSON.stringify(_)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let v of this._timeoutInfo.values())clearTimeout(v.timeoutId);this._timeoutInfo.clear();for(let v of this._requestHandlerAbortControllers.values())v.abort();this._requestHandlerAbortControllers.clear();let U=F$.fromError(T$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let v of $.values())v(U)}_onerror($){this.onerror?.($)}_onnotification($){let U=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(U===void 0)return;Promise.resolve().then(()=>U($)).catch((v)=>this._onerror(Error(`Uncaught error in notification handler: ${v}`)))}_onrequest($,U){let v=this._requestHandlers.get($.method)??this.fallbackRequestHandler,J=this._transport,_=$.params?._meta?.[q1]?.taskId;if(v===void 0){let Y={jsonrpc:"2.0",id:$.id,error:{code:T$.MethodNotFound,message:"Method not found"}};if(_&&this._taskMessageQueue)this._enqueueTaskMessage(_,{type:"error",message:Y,timestamp:Date.now()},J?.sessionId).catch((Z)=>this._onerror(Error(`Failed to enqueue error response: ${Z}`)));else J?.send(Y).catch((Z)=>this._onerror(Error(`Failed to send an error response: ${Z}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let K=WX($.params)?$.params.task:void 0,W=this._taskStore?this.requestTaskStore($,J?.sessionId):void 0,O={signal:z.signal,sessionId:J?.sessionId,_meta:$.params?._meta,sendNotification:async(Y)=>{if(z.signal.aborted)return;let Z={relatedRequestId:$.id};if(_)Z.relatedTask={taskId:_};await this.notification(Y,Z)},sendRequest:async(Y,Z,q)=>{if(z.signal.aborted)throw new F$(T$.ConnectionClosed,"Request was cancelled");let X={...q,relatedRequestId:$.id};if(_&&!X.relatedTask)X.relatedTask={taskId:_};let B=X.relatedTask?.taskId??_;if(B&&W)await W.updateTaskStatus(B,"input_required");return await this.request(Y,Z,X)},authInfo:U?.authInfo,requestId:$.id,requestInfo:U?.requestInfo,taskId:_,taskStore:W,taskRequestedTtl:K?.ttl,closeSSEStream:U?.closeSSEStream,closeStandaloneSSEStream:U?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(K)this.assertTaskHandlerCapability($.method)}).then(()=>v($,O)).then(async(Y)=>{if(z.signal.aborted)return;let Z={result:Y,jsonrpc:"2.0",id:$.id};if(_&&this._taskMessageQueue)await this._enqueueTaskMessage(_,{type:"response",message:Z,timestamp:Date.now()},J?.sessionId);else await J?.send(Z)},async(Y)=>{if(z.signal.aborted)return;let Z={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(Y.code)?Y.code:T$.InternalError,message:Y.message??"Internal error",...Y.data!==void 0&&{data:Y.data}}};if(_&&this._taskMessageQueue)await this._enqueueTaskMessage(_,{type:"error",message:Z,timestamp:Date.now()},J?.sessionId);else await J?.send(Z)}).catch((Y)=>this._onerror(Error(`Failed to send response: ${Y}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:U,...v}=$.params,J=Number(U),_=this._progressHandlers.get(J);if(!_){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(J),K=this._timeoutInfo.get(J);if(K&&z&&K.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(W){this._responseHandlers.delete(J),this._progressHandlers.delete(J),this._cleanupTimeout(J),z(W);return}_(v)}_onresponse($){let U=Number($.id),v=this._requestResolvers.get(U);if(v){if(this._requestResolvers.delete(U),m_($))v($);else{let z=new F$($.error.code,$.error.message,$.error.data);v(z)}return}let J=this._responseHandlers.get(U);if(J===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(U),this._cleanupTimeout(U);let _=!1;if(m_($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let K=z.task;if(typeof K.taskId==="string")_=!0,this._taskProgressTokens.set(K.taskId,U)}}if(!_)this._progressHandlers.delete(U);if(m_($))J($);else{let z=F$.fromError($.error.code,$.error.message,$.error.data);J(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,U,v){let{task:J}=v??{};if(!J){try{yield{type:"result",result:await this.request($,U,v)}}catch(z){yield{type:"error",error:z instanceof F$?z:new F$(T$.InternalError,String(z))}}return}let _;try{let z=await this.request($,_9,v);if(z.task)_=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new F$(T$.InternalError,"Task creation did not return a task");while(!0){let K=await this.getTask({taskId:_},v);if(yield{type:"taskStatus",task:K},H1(K.status)){if(K.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:_},U,v)};else if(K.status==="failed")yield{type:"error",error:new F$(T$.InternalError,`Task ${_} failed`)};else if(K.status==="cancelled")yield{type:"error",error:new F$(T$.InternalError,`Task ${_} was cancelled`)};return}if(K.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:_},U,v)};return}let W=K.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((O)=>setTimeout(O,W)),v?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof F$?z:new F$(T$.InternalError,String(z))}}}request($,U,v){let{relatedRequestId:J,resumptionToken:_,onresumptiontoken:z,task:K,relatedTask:W}=v??{};return new Promise((O,Y)=>{let Z=(H)=>{Y(H)};if(!this._transport){Z(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),K)this.assertTaskCapability($.method)}catch(H){Z(H);return}v?.signal?.throwIfAborted();let q=this._requestMessageId++,X={...$,jsonrpc:"2.0",id:q};if(v?.onprogress)this._progressHandlers.set(q,v.onprogress),X.params={...$.params,_meta:{...$.params?._meta||{},progressToken:q}};if(K)X.params={...X.params,task:K};if(W)X.params={...X.params,_meta:{...X.params?._meta||{},[q1]:W}};let B=(H)=>{this._responseHandlers.delete(q),this._progressHandlers.delete(q),this._cleanupTimeout(q),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:q,reason:String(H)}},{relatedRequestId:J,resumptionToken:_,onresumptiontoken:z}).catch((b)=>this._onerror(Error(`Failed to send cancellation: ${b}`)));let F=H instanceof F$?H:new F$(T$.RequestTimeout,String(H));Y(F)};this._responseHandlers.set(q,(H)=>{if(v?.signal?.aborted)return;if(H instanceof Error)return Y(H);try{let F=Z9(U,H.result);if(!F.success)Y(F.error);else O(F.data)}catch(F){Y(F)}}),v?.signal?.addEventListener("abort",()=>{B(v?.signal?.reason)});let L=v?.timeout??GI,P=()=>B(F$.fromError(T$.RequestTimeout,"Request timed out",{timeout:L}));this._setupTimeout(q,L,v?.maxTotalTimeout,P,v?.resetTimeoutOnProgress??!1);let k=W?.taskId;if(k){let H=(F)=>{let b=this._responseHandlers.get(q);if(b)b(F);else this._onerror(Error(`Response handler missing for side-channeled request ${q}`))};this._requestResolvers.set(q,H),this._enqueueTaskMessage(k,{type:"request",message:X,timestamp:Date.now()}).catch((F)=>{this._cleanupTimeout(q),Y(F)})}else this._transport.send(X,{relatedRequestId:J,resumptionToken:_,onresumptiontoken:z}).catch((H)=>{this._cleanupTimeout(q),Y(H)})})}async getTask($,U){return this.request({method:"tasks/get",params:$},J9,U)}async getTaskResult($,U,v){return this.request({method:"tasks/result",params:$},U,v)}async listTasks($,U){return this.request({method:"tasks/list",params:$},G9,U)}async cancelTask($,U){return this.request({method:"tasks/cancel",params:$},XX,U)}async notification($,U){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let v=U?.relatedTask?.taskId;if(v){let K={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[q1]:U.relatedTask}}};await this._enqueueTaskMessage(v,{type:"notification",message:K,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!U?.relatedRequestId&&!U?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let K={...$,jsonrpc:"2.0"};if(U?.relatedTask)K={...K,params:{...K.params,_meta:{...K.params?._meta||{},[q1]:U.relatedTask}}};this._transport?.send(K,U).catch((W)=>this._onerror(W))});return}let z={...$,jsonrpc:"2.0"};if(U?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[q1]:U.relatedTask}}};await this._transport.send(z,U)}setRequestHandler($,U){let v=kW($);this.assertRequestHandlerCapability(v),this._requestHandlers.set(v,(J,_)=>{let z=bW($,J);return Promise.resolve(U(z,_))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,U){let v=kW($);this._notificationHandlers.set(v,(J)=>{let _=bW($,J);return Promise.resolve(U(_))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let U=this._taskProgressTokens.get($);if(U!==void 0)this._progressHandlers.delete(U),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,U,v){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let J=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,U,v,J)}async _clearTaskQueue($,U){if(this._taskMessageQueue){let v=await this._taskMessageQueue.dequeueAll($,U);for(let J of v)if(J.type==="request"&&$W(J.message)){let _=J.message.id,z=this._requestResolvers.get(_);if(z)z(new F$(T$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(_);else this._onerror(Error(`Resolver missing for request ${_} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,U){let v=this._options?.defaultTaskPollInterval??1000;try{let J=await this._taskStore?.getTask($);if(J?.pollInterval)v=J.pollInterval}catch{}return new Promise((J,_)=>{if(U.aborted){_(new F$(T$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(J,v);U.addEventListener("abort",()=>{clearTimeout(z),_(new F$(T$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,U){let v=this._taskStore;if(!v)throw Error("No task store configured");return{createTask:async(J)=>{if(!$)throw Error("No request provided");return await v.createTask(J,$.id,{method:$.method,params:$.params},U)},getTask:async(J)=>{let _=await v.getTask(J,U);if(!_)throw new F$(T$.InvalidParams,"Failed to retrieve task: Task not found");return _},storeTaskResult:async(J,_,z)=>{await v.storeTaskResult(J,_,z,U);let K=await v.getTask(J,U);if(K){let W=i_.parse({method:"notifications/tasks/status",params:K});if(await this.notification(W),H1(K.status))this._cleanupTaskProgressHandler(J)}},getTaskResult:(J)=>{return v.getTaskResult(J,U)},updateTaskStatus:async(J,_,z)=>{let K=await v.getTask(J,U);if(!K)throw new F$(T$.InvalidParams,`Task "${J}" not found - it may have been cleaned up`);if(H1(K.status))throw new F$(T$.InvalidParams,`Cannot update task "${J}" from terminal status "${K.status}" to "${_}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await v.updateTaskStatus(J,_,z,U);let W=await v.getTask(J,U);if(W){let O=i_.parse({method:"notifications/tasks/status",params:W});if(await this.notification(O),H1(W.status))this._cleanupTaskProgressHandler(J)}},listTasks:(J)=>{return v.listTasks(J,U)}}}}var MW="2026-01-26";var WI="ui/notifications/tool-input-partial";var OI=Q.union([Q.literal("light"),Q.literal("dark")]).describe("Color theme preference for the host environment."),e_=Q.union([Q.literal("inline"),Q.literal("fullscreen"),Q.literal("pip")]).describe("Display mode for UI presentation."),YI=Q.union([Q.literal("--color-background-primary"),Q.literal("--color-background-secondary"),Q.literal("--color-background-tertiary"),Q.literal("--color-background-inverse"),Q.literal("--color-background-ghost"),Q.literal("--color-background-info"),Q.literal("--color-background-danger"),Q.literal("--color-background-success"),Q.literal("--color-background-warning"),Q.literal("--color-background-disabled"),Q.literal("--color-text-primary"),Q.literal("--color-text-secondary"),Q.literal("--color-text-tertiary"),Q.literal("--color-text-inverse"),Q.literal("--color-text-ghost"),Q.literal("--color-text-info"),Q.literal("--color-text-danger"),Q.literal("--color-text-success"),Q.literal("--color-text-warning"),Q.literal("--color-text-disabled"),Q.literal("--color-border-primary"),Q.literal("--color-border-secondary"),Q.literal("--color-border-tertiary"),Q.literal("--color-border-inverse"),Q.literal("--color-border-ghost"),Q.literal("--color-border-info"),Q.literal("--color-border-danger"),Q.literal("--color-border-success"),Q.literal("--color-border-warning"),Q.literal("--color-border-disabled"),Q.literal("--color-ring-primary"),Q.literal("--color-ring-secondary"),Q.literal("--color-ring-inverse"),Q.literal("--color-ring-info"),Q.literal("--color-ring-danger"),Q.literal("--color-ring-success"),Q.literal("--color-ring-warning"),Q.literal("--font-sans"),Q.literal("--font-mono"),Q.literal("--font-weight-normal"),Q.literal("--font-weight-medium"),Q.literal("--font-weight-semibold"),Q.literal("--font-weight-bold"),Q.literal("--font-text-xs-size"),Q.literal("--font-text-sm-size"),Q.literal("--font-text-md-size"),Q.literal("--font-text-lg-size"),Q.literal("--font-heading-xs-size"),Q.literal("--font-heading-sm-size"),Q.literal("--font-heading-md-size"),Q.literal("--font-heading-lg-size"),Q.literal("--font-heading-xl-size"),Q.literal("--font-heading-2xl-size"),Q.literal("--font-heading-3xl-size"),Q.literal("--font-text-xs-line-height"),Q.literal("--font-text-sm-line-height"),Q.literal("--font-text-md-line-height"),Q.literal("--font-text-lg-line-height"),Q.literal("--font-heading-xs-line-height"),Q.literal("--font-heading-sm-line-height"),Q.literal("--font-heading-md-line-height"),Q.literal("--font-heading-lg-line-height"),Q.literal("--font-heading-xl-line-height"),Q.literal("--font-heading-2xl-line-height"),Q.literal("--font-heading-3xl-line-height"),Q.literal("--border-radius-xs"),Q.literal("--border-radius-sm"),Q.literal("--border-radius-md"),Q.literal("--border-radius-lg"),Q.literal("--border-radius-xl"),Q.literal("--border-radius-full"),Q.literal("--border-width-regular"),Q.literal("--shadow-hairline"),Q.literal("--shadow-sm"),Q.literal("--shadow-md"),Q.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),ZI=Q.record(YI.describe(`Style variables for theming MCP apps.
152
152
 
153
153
  Individual style keys are optional - hosts may provide any subset of these values.
154
154
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
155
155
 
156
156
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
157
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),P.union([P.string(),P.undefined()]).describe(`Style variables for theming MCP apps.
157
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),Q.union([Q.string(),Q.undefined()]).describe(`Style variables for theming MCP apps.
158
158
 
159
159
  Individual style keys are optional - hosts may provide any subset of these values.
160
160
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -166,10 +166,10 @@ Individual style keys are optional - hosts may provide any subset of these value
166
166
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
167
167
 
168
168
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
169
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),uZ=P.object({method:P.literal("ui/open-link"),params:P.object({url:P.string().describe("URL to open in the host's browser")})}),CZ=P.object({isError:P.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),VZ=P.object({isError:P.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),fZ=P.object({isError:P.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),rZ=P.object({method:P.literal("ui/notifications/sandbox-proxy-ready"),params:P.object({})}),UK=P.object({connectDomains:P.array(P.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
169
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),qI=Q.object({method:Q.literal("ui/open-link"),params:Q.object({url:Q.string().describe("URL to open in the host's browser")})}),BI=Q.object({isError:Q.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),XI=Q.object({isError:Q.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),HI=Q.object({isError:Q.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),QI=Q.object({method:Q.literal("ui/notifications/sandbox-proxy-ready"),params:Q.object({})}),AW=Q.object({connectDomains:Q.array(Q.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
170
170
 
171
171
  - Maps to CSP \`connect-src\` directive
172
- - Empty or omitted → no network connections (secure default)`),resourceDomains:P.array(P.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:P.array(P.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:P.array(P.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),gK=P.object({camera:P.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:P.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:P.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:P.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),EZ=P.object({method:P.literal("ui/notifications/size-changed"),params:P.object({width:P.number().optional().describe("New width in pixels."),height:P.number().optional().describe("New height in pixels.")})}),mZ=P.object({method:P.literal("ui/notifications/tool-input"),params:P.object({arguments:P.record(P.string(),P.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),cZ=P.object({method:P.literal("ui/notifications/tool-input-partial"),params:P.object({arguments:P.record(P.string(),P.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),iZ=P.object({method:P.literal("ui/notifications/tool-cancelled"),params:P.object({reason:P.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),xZ=P.object({fonts:P.string().optional()}),hZ=P.object({variables:jZ.optional().describe("CSS variables for theming the app."),css:xZ.optional().describe("CSS blocks that apps can inject.")}),lZ=P.object({method:P.literal("ui/resource-teardown"),params:P.object({})}),pZ=P.record(P.string(),P.unknown()),fB=P.object({text:P.object({}).optional().describe("Host supports text content blocks."),image:P.object({}).optional().describe("Host supports image content blocks."),audio:P.object({}).optional().describe("Host supports audio content blocks."),resource:P.object({}).optional().describe("Host supports resource content blocks."),resourceLink:P.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:P.object({}).optional().describe("Host supports structured content.")}),oZ=P.object({method:P.literal("ui/notifications/request-teardown"),params:P.object({}).optional()}),nZ=P.object({experimental:P.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:P.object({}).optional().describe("Host supports opening external URLs."),downloadFile:P.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:P.object({listChanged:P.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:P.object({listChanged:P.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:P.object({}).optional().describe("Host accepts log messages."),sandbox:P.object({permissions:gK.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:UK.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:fB.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:fB.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),tZ=P.object({experimental:P.object({}).optional().describe("Experimental features (structure TBD)."),tools:P.object({listChanged:P.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:P.array(zg).optional().describe("Display modes the app supports.")}),dZ=P.object({method:P.literal("ui/notifications/initialized"),params:P.object({}).optional()}),aj=P.object({csp:UK.optional().describe("Content Security Policy configuration for UI resources."),permissions:gK.optional().describe("Sandbox permissions requested by the UI resource."),domain:P.string().optional().describe(`Dedicated origin for view sandbox.
172
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:Q.array(Q.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:Q.array(Q.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:Q.array(Q.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),IW=Q.object({camera:Q.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:Q.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:Q.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:Q.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),LI=Q.object({method:Q.literal("ui/notifications/size-changed"),params:Q.object({width:Q.number().optional().describe("New width in pixels."),height:Q.number().optional().describe("New height in pixels.")})}),FI=Q.object({method:Q.literal("ui/notifications/tool-input"),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),PI=Q.object({method:Q.literal("ui/notifications/tool-input-partial"),params:Q.object({arguments:Q.record(Q.string(),Q.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),kI=Q.object({method:Q.literal("ui/notifications/tool-cancelled"),params:Q.object({reason:Q.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),bI=Q.object({fonts:Q.string().optional()}),MI=Q.object({variables:ZI.optional().describe("CSS variables for theming the app."),css:bI.optional().describe("CSS blocks that apps can inject.")}),AI=Q.object({method:Q.literal("ui/resource-teardown"),params:Q.object({})}),II=Q.record(Q.string(),Q.unknown()),AX=Q.object({text:Q.object({}).optional().describe("Host supports text content blocks."),image:Q.object({}).optional().describe("Host supports image content blocks."),audio:Q.object({}).optional().describe("Host supports audio content blocks."),resource:Q.object({}).optional().describe("Host supports resource content blocks."),resourceLink:Q.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:Q.object({}).optional().describe("Host supports structured content.")}),wI=Q.object({method:Q.literal("ui/notifications/request-teardown"),params:Q.object({}).optional()}),gI=Q.object({experimental:Q.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:Q.object({}).optional().describe("Host supports opening external URLs."),downloadFile:Q.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:Q.object({listChanged:Q.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:Q.object({listChanged:Q.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:Q.object({}).optional().describe("Host accepts log messages."),sandbox:Q.object({permissions:IW.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:AW.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:AX.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:AX.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),NI=Q.object({experimental:Q.object({}).optional().describe("Experimental features (structure TBD)."),tools:Q.object({listChanged:Q.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:Q.array(e_).optional().describe("Display modes the app supports.")}),SI=Q.object({method:Q.literal("ui/notifications/initialized"),params:Q.object({}).optional()}),YE=Q.object({csp:AW.optional().describe("Content Security Policy configuration for UI resources."),permissions:IW.optional().describe("Sandbox permissions requested by the UI resource."),domain:Q.string().optional().describe(`Dedicated origin for view sandbox.
173
173
 
174
174
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
175
175
 
@@ -177,19 +177,19 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
177
177
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
178
178
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
179
179
 
180
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:P.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
180
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:Q.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
181
181
 
182
182
  Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
183
183
 
184
184
  - \`true\`: request visible border + background
185
185
  - \`false\`: request no visible border + background
186
- - omitted: host decides border`)}),rB=P.object({method:P.literal("ui/request-display-mode"),params:P.object({mode:zg.describe("The display mode being requested.")})}),aZ=P.object({mode:zg.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),sZ=P.union([P.literal("model"),P.literal("app")]).describe("Tool visibility scope - who can access the tool."),sj=P.object({resourceUri:P.string().optional(),visibility:P.array(sZ).optional().describe(`Who can access this tool. Default: ["model", "app"]
186
+ - omitted: host decides border`)}),IX=Q.object({method:Q.literal("ui/request-display-mode"),params:Q.object({mode:e_.describe("The display mode being requested.")})}),RI=Q.object({mode:e_.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),TI=Q.union([Q.literal("model"),Q.literal("app")]).describe("Tool visibility scope - who can access the tool."),ZE=Q.object({resourceUri:Q.string().optional(),visibility:Q.array(TI).optional().describe(`Who can access this tool. Default: ["model", "app"]
187
187
  - "model": Tool visible to and callable by the agent
188
- - "app": Tool callable by the app from this server only`)}),ej=P.object({mimeTypes:P.array(P.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),eZ=P.object({method:P.literal("ui/download-file"),params:P.object({contents:P.array(P.union([nG,tG])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),$I=P.object({method:P.literal("ui/message"),params:P.object({role:P.literal("user").describe('Message role, currently only "user" is supported.'),content:P.array(SU).describe("Message content blocks (text, image, etc.).")})}),$u=P.object({method:P.literal("ui/notifications/sandbox-resource-ready"),params:P.object({html:P.string().describe("HTML content to load into the inner iframe."),sandbox:P.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:UK.optional().describe("CSP configuration from resource metadata."),permissions:gK.optional().describe("Sandbox permissions from resource metadata.")})}),vI=P.object({method:P.literal("ui/notifications/tool-result"),params:c4.describe("Standard MCP tool execution result.")}),EB=P.object({toolInfo:P.object({id:AU.optional().describe("JSON-RPC id of the tools/call request."),tool:W2.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:DZ.optional().describe("Current color theme preference."),styles:hZ.optional().describe("Style configuration for theming the app."),displayMode:zg.optional().describe("How the UI is currently displayed."),availableDisplayModes:P.array(zg).optional().describe("Display modes the host supports."),containerDimensions:P.union([P.object({height:P.number().describe("Fixed container height in pixels.")}),P.object({maxHeight:P.union([P.number(),P.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(P.union([P.object({width:P.number().describe("Fixed container width in pixels.")}),P.object({maxWidth:P.union([P.number(),P.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
189
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:P.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:P.string().optional().describe("User's timezone in IANA format."),userAgent:P.string().optional().describe("Host application identifier."),platform:P.union([P.literal("web"),P.literal("desktop"),P.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:P.object({touch:P.boolean().optional().describe("Whether the device supports touch input."),hover:P.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:P.object({top:P.number().describe("Top safe area inset in pixels."),right:P.number().describe("Right safe area inset in pixels."),bottom:P.number().describe("Bottom safe area inset in pixels."),left:P.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),UI=P.object({method:P.literal("ui/notifications/host-context-changed"),params:EB.describe("Partial context update containing only changed fields.")}),gI=P.object({method:P.literal("ui/update-model-context"),params:P.object({content:P.array(SU).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:P.record(P.string(),P.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),_I=P.object({method:P.literal("ui/initialize"),params:P.object({appInfo:o1.describe("App identification (name and version)."),appCapabilities:tZ.describe("Features and capabilities this app provides."),protocolVersion:P.string().describe("Protocol version this app supports.")})}),zI=P.object({protocolVersion:P.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:o1.describe("Host application identification and version."),hostCapabilities:nZ.describe("Features and capabilities provided by the host."),hostContext:EB.describe("Rich context about the host environment.")}).passthrough();class k2{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(g)=>{if(v&&g.source!==this.eventSource){console.debug("Ignoring message from unknown source",g);return}let _=SB.safeParse(g.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(g.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,g);else console.error("Failed to parse message",_.error.message,g),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==RZ)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class JI extends _g{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},g={autoResize:!0}){super(g);this._appInfo=$,this._capabilities=v,this.options=g,this.setRequestHandler(m4,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(mZ,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(cZ,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(vI,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(iZ,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(UI,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(lZ,(v,g)=>$(v.params,g))}set oncalltool($){this.setRequestHandler(Ug,(v,g)=>$(v.params,g))}set onlisttools($){this.setRequestHandler(vg,(v,g)=>$(v.params,g))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,v){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},c4,v)}async readServerResource($,v){return await this.request({method:"resources/read",params:$},$g,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},e1,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},fZ,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},v2,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},CZ,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},VZ,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},aZ,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,g=0,_=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,J=z.style.width,G=z.style.height;z.style.width="fit-content",z.style.height="max-content";let b=z.getBoundingClientRect();z.style.width=J,z.style.height=G;let O=window.innerWidth-z.clientWidth,W=Math.ceil(b.width+O),B=Math.ceil(b.height);if(W!==v||B!==g)v=W,g=B,this.sendSizeChanged({width:W,height:B})})};_();let U=new ResizeObserver(_);return U.observe(document.documentElement),U.observe(document.body),()=>U.disconnect()}async connect($=new k2(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let g=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:vK}},zI,v);if(g===void 0)throw Error(`Server sent invalid initialize result: ${g}`);if(this._hostCapabilities=g.hostCapabilities,this._hostInfo=g.hostInfo,this._hostContext=g.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(g){throw this.close(),g}}}function mB($){if(!$)return"";let v=[];if($.camera)v.push("camera");if($.microphone)v.push("microphone");if($.geolocation)v.push("geolocation");if($.clipboardWrite)v.push("clipboard-write");return v.join("; ")}var GI=[vK];class _K extends _g{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,g,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=g,this._hostContext=_?.hostContext||{},this.setRequestHandler(_I,(U)=>this._oninitialize(U)),this.setRequestHandler(m4,(U,z)=>{return this.onping?.(U.params,z),{}}),this.setRequestHandler(rB,(U)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(EZ,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(rZ,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(dZ,(v)=>$(v.params))}set onmessage($){this.setRequestHandler($I,async(v,g)=>{return $(v.params,g)})}set onopenlink($){this.setRequestHandler(uZ,async(v,g)=>{return $(v.params,g)})}set ondownloadfile($){this.setRequestHandler(eZ,async(v,g)=>{return $(v.params,g)})}set onrequestteardown($){this.setNotificationHandler(oZ,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(rB,async(v,g)=>{return $(v.params,g)})}set onloggingmessage($){this.setNotificationHandler(sG,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(gI,async(v,g)=>{return $(v.params,g)})}set oncalltool($){this.setRequestHandler(Ug,async(v,g)=>{return $(v.params,g)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(fG,async(v,g)=>{return $(v.params,g)})}set onlistresourcetemplates($){this.setRequestHandler(rG,async(v,g)=>{return $(v.params,g)})}set onreadresource($){this.setRequestHandler(cG,async(v,g)=>{return $(v.params,g)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(xG,async(v,g)=>{return $(v.params,g)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let v=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:GI.includes(v)?v:vK,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},g=!1;for(let _ of Object.keys($)){let U=this._hostContext[_],z=$[_];if(KI(U,z))continue;v[_]=z,g=!0}if(g)this._hostContext=$,this.sendHostContextChange(v)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,v){return this.request({method:"ui/resource-teardown",params:$},pZ,v)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let v=this._client.getServerCapabilities();if(!v)throw Error("Client server capabilities not available");if(v.tools){if(this.oncalltool=async(g,_)=>{return this._client.request({method:"tools/call",params:g},c4,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(aG,(g)=>this.sendToolListChanged(g.params))}if(v.resources){if(this.onlistresources=async(g,_)=>{return this._client.request({method:"resources/list",params:g},e1,{signal:_.signal})},this.onlistresourcetemplates=async(g,_)=>{return this._client.request({method:"resources/templates/list",params:g},EG,{signal:_.signal})},this.onreadresource=async(g,_)=>{return this._client.request({method:"resources/read",params:g},$g,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(iG,(g)=>this.sendResourceListChanged(g.params))}if(v.prompts){if(this.onlistprompts=async(g,_)=>{return this._client.request({method:"prompts/list",params:g},hG,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(dG,(g)=>this.sendPromptListChanged(g.params))}}return super.connect($)}}function KI($,v){return JSON.stringify($)===JSON.stringify(v)}function zK($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function bI($){return zK($)&&Array.isArray($.content)&&$.content.every((v)=>zK(v)&&typeof v.type==="string")}function OI(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function WI($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(v){return console.debug("[ext-app-tool-result] stringify failed",v),String($)}}function JK($){let v=$.success===!1;if(bI($.result))return{...$.result,isError:$.result.isError===!0||v};let g=zK($.result)?$.result:null,_=OI($.detailedContent,$.content,g?.detailedContent,g?.content,g?.textResultForLlm,g?.text,g?.message,typeof $.result==="string"?$.result:void 0,$.error)??WI($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function cB($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let g=JSON.stringify($),_=JSON.stringify(v);if(g===void 0||_===void 0)return!1;if(Math.abs(g.length-_.length)>2000000)return!1;return g===_}catch{return!1}}function iB($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function BI($,v){let g=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await g.json();if(!g.ok||!iB(_)||!_.ok||typeof _.url!=="string"){let U=iB(_)&&_.error?_.error:`Frame document request failed with HTTP ${g.status}`;throw Error(U)}return _.url}function xB($,v){let g=I6.value,[_,U]=i(null),[z,J]=i(0),G=D(0);r(()=>{if(U(null),!$||g!=="src")return;let O=!1;return G.current=dU.value,BI($,v).then((W)=>{if(!O)U(W)}).catch((W)=>{console.error("[iframe-document] failed to create frame document:",W)}),()=>{O=!0}},[$,v,g,z]);let b=dU.value;return r(()=>{if(g!=="src"||b===G.current)return;if(!_){J((W)=>W+1);return}let O=!1;return fetch(_,{method:"HEAD"}).then((W)=>{if(O)return;if(W.ok){G.current=b;return}J((B)=>B+1)}).catch(()=>{}),()=>{O=!0}},[b,_,g]),D$(()=>{if(g==="srcdoc"&&$)return{attributes:{srcdoc:$},ready:!0,key:`srcdoc-${mv($)}`};return{attributes:_?{src:_}:{},ready:Boolean(_),key:_??""}},[_,g,$])}function NU($){let{enabled:v,token:g,nodeId:_,sourceSurface:U,iframeRef:z}=$;r(()=>{if(!v||!g)return;function J(G){if(G.source!==z.current?.contentWindow)return;let b=G.data;if(!b||b.source!==X_||b.token!==g||b.nodeId!==_)return;let O=b.interaction;if(!O||typeof O.type!=="string")return;let W=O.type;ng({type:W,sourceNodeId:_,sourceSurface:U,...O.payload&&typeof O.payload==="object"?{payload:O.payload}:{}}).then((B)=>{if(B.ok)rv("context","AX interaction",W,[_]);else rv("remove","AX interaction rejected",B.error??B.code??"",[_]);z.current?.contentWindow?.postMessage({source:H_,token:g,...b.correlationId?{correlationId:b.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,g,_,U])}async function qv($,v){let _=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();if(!_.ok)throw Error(_.error??`Request failed: ${$}`);return _.result}function Jg($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var aB=1000,hB=7000;function L6($,v){if(typeof window>"u")return;let g=window;if(g.__PMX_EXTAPP_LOG??=[],g.__PMX_EXTAPP_LOG.length<500)g.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});YI({t:Date.now(),nodeId:$,event:v})}var lB=[],GK=null;function YI($){if(lB.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),GK)return;GK=setTimeout(()=>{GK=null;let v=lB.splice(0);if(v.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:v})}).catch(()=>{})},1500)}var pB=Promise.resolve();function oB($){pB=pB.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,aB))}).catch(()=>{})}function kI($,v){let g=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",U=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${U}:${z}:${g}`}function qI($,v){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!v,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:v};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function nB($,v,g){if(await $.sendToolInput({arguments:v}),g)await $.sendToolResult(g)}function PI($){return typeof $==="string"&&$.trim().length>0?$.trim():iz}function XI($,v){return`<script data-pmx-canvas-ax-bridge>
188
+ - "app": Tool callable by the app from this server only`)}),qE=Q.object({mimeTypes:Q.array(Q.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),yI=Q.object({method:Q.literal("ui/download-file"),params:Q.object({contents:Q.array(Q.union([HW,QW])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),CI=Q.object({method:Q.literal("ui/message"),params:Q.object({role:Q.literal("user").describe('Message role, currently only "user" is supported.'),content:Q.array(H0).describe("Message content blocks (text, image, etc.).")})}),BE=Q.object({method:Q.literal("ui/notifications/sandbox-resource-ready"),params:Q.object({html:Q.string().describe("HTML content to load into the inner iframe."),sandbox:Q.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:AW.optional().describe("CSP configuration from resource metadata."),permissions:IW.optional().describe("Sandbox permissions from resource metadata.")})}),DI=Q.object({method:Q.literal("ui/notifications/tool-result"),params:X1.describe("Standard MCP tool execution result.")}),wX=Q.object({toolInfo:Q.object({id:B0.optional().describe("JSON-RPC id of the tools/call request."),tool:O9.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:OI.optional().describe("Current color theme preference."),styles:MI.optional().describe("Style configuration for theming the app."),displayMode:e_.optional().describe("How the UI is currently displayed."),availableDisplayModes:Q.array(e_).optional().describe("Display modes the host supports."),containerDimensions:Q.union([Q.object({height:Q.number().describe("Fixed container height in pixels.")}),Q.object({maxHeight:Q.union([Q.number(),Q.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(Q.union([Q.object({width:Q.number().describe("Fixed container width in pixels.")}),Q.object({maxWidth:Q.union([Q.number(),Q.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
189
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Q.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:Q.string().optional().describe("User's timezone in IANA format."),userAgent:Q.string().optional().describe("Host application identifier."),platform:Q.union([Q.literal("web"),Q.literal("desktop"),Q.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:Q.object({touch:Q.boolean().optional().describe("Whether the device supports touch input."),hover:Q.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:Q.object({top:Q.number().describe("Top safe area inset in pixels."),right:Q.number().describe("Right safe area inset in pixels."),bottom:Q.number().describe("Bottom safe area inset in pixels."),left:Q.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),jI=Q.object({method:Q.literal("ui/notifications/host-context-changed"),params:wX.describe("Partial context update containing only changed fields.")}),VI=Q.object({method:Q.literal("ui/update-model-context"),params:Q.object({content:Q.array(H0).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Q.record(Q.string(),Q.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),fI=Q.object({method:Q.literal("ui/initialize"),params:Q.object({appInfo:h_.describe("App identification (name and version)."),appCapabilities:NI.describe("Features and capabilities this app provides."),protocolVersion:Q.string().describe("Protocol version this app supports.")})}),EI=Q.object({protocolVersion:Q.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:h_.describe("Host application identification and version."),hostCapabilities:gI.describe("Features and capabilities provided by the host."),hostContext:wX.describe("Rich context about the host environment.")}).passthrough();class q9{eventTarget;eventSource;messageListener;constructor($=window.parent,U){this.eventTarget=$,this.eventSource=U,this.messageListener=(v)=>{if(U&&v.source!==this.eventSource){console.debug("Ignoring message from unknown source",v);return}let J=BX.safeParse(v.data);if(J.success)console.debug("Parsed message",J.data),this.onmessage?.(J.data);else if(v.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",J.error.message,v);else console.error("Failed to parse message",J.error.message,v),this.onerror?.(Error("Invalid JSON-RPC message received: "+J.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,U){if($.method!==WI)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class uI extends s_{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,U={},v={autoResize:!0}){super(v);this._appInfo=$,this._capabilities=U,this.options=v,this.setRequestHandler(B1,(J)=>{return console.log("Received ping:",J.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(FI,(U)=>$(U.params))}set ontoolinputpartial($){this.setNotificationHandler(PI,(U)=>$(U.params))}set ontoolresult($){this.setNotificationHandler(DI,(U)=>$(U.params))}set ontoolcancelled($){this.setNotificationHandler(kI,(U)=>$(U.params))}set onhostcontextchanged($){this.setNotificationHandler(jI,(U)=>{this._hostContext={...this._hostContext,...U.params},$(U.params)})}set onteardown($){this.setRequestHandler(AI,(U,v)=>$(U.params,v))}set oncalltool($){this.setRequestHandler(t_,(U,v)=>$(U.params,v))}set onlisttools($){this.setRequestHandler(n_,(U,v)=>$(U.params,v))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,U){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},X1,U)}async readServerResource($,U){return await this.request({method:"resources/read",params:$},d_,U)}async listServerResources($,U){return await this.request({method:"resources/list",params:$},o_,U)}sendMessage($,U){return this.request({method:"ui/message",params:$},HI,U)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,U){return this.request({method:"ui/update-model-context",params:$},eJ,U)}openLink($,U){return this.request({method:"ui/open-link",params:$},BI,U)}sendOpenLink=this.openLink;downloadFile($,U){return this.request({method:"ui/download-file",params:$},XI,U)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,U){return this.request({method:"ui/request-display-mode",params:$},RI,U)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,U=0,v=0,J=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,K=z.style.width,W=z.style.height;z.style.width="fit-content",z.style.height="max-content";let O=z.getBoundingClientRect();z.style.width=K,z.style.height=W;let Y=window.innerWidth-z.clientWidth,Z=Math.ceil(O.width+Y),q=Math.ceil(O.height);if(Z!==U||q!==v)U=Z,v=q,this.sendSizeChanged({width:Z,height:q})})};J();let _=new ResizeObserver(J);return _.observe(document.documentElement),_.observe(document.body),()=>_.disconnect()}async connect($=new q9(window.parent,window.parent),U){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let v=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:MW}},EI,U);if(v===void 0)throw Error(`Server sent invalid initialize result: ${v}`);if(this._hostCapabilities=v.hostCapabilities,this._hostInfo=v.hostInfo,this._hostContext=v.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(v){throw this.close(),v}}}function gX($){if(!$)return"";let U=[];if($.camera)U.push("camera");if($.microphone)U.push("microphone");if($.geolocation)U.push("geolocation");if($.clipboardWrite)U.push("clipboard-write");return U.join("; ")}var mI=[MW];class wW extends s_{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,U,v,J){super(J);this._client=$,this._hostInfo=U,this._capabilities=v,this._hostContext=J?.hostContext||{},this.setRequestHandler(fI,(_)=>this._oninitialize(_)),this.setRequestHandler(B1,(_,z)=>{return this.onping?.(_.params,z),{}}),this.setRequestHandler(IX,(_)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(LI,(U)=>$(U.params))}set onsandboxready($){this.setNotificationHandler(QI,(U)=>$(U.params))}set oninitialized($){this.setNotificationHandler(SI,(U)=>$(U.params))}set onmessage($){this.setRequestHandler(CI,async(U,v)=>{return $(U.params,v)})}set onopenlink($){this.setRequestHandler(qI,async(U,v)=>{return $(U.params,v)})}set ondownloadfile($){this.setRequestHandler(yI,async(U,v)=>{return $(U.params,v)})}set onrequestteardown($){this.setNotificationHandler(wI,(U)=>$(U.params))}set onrequestdisplaymode($){this.setRequestHandler(IX,async(U,v)=>{return $(U.params,v)})}set onloggingmessage($){this.setNotificationHandler(PW,async(U)=>{$(U.params)})}set onupdatemodelcontext($){this.setRequestHandler(VI,async(U,v)=>{return $(U.params,v)})}set oncalltool($){this.setRequestHandler(t_,async(U,v)=>{return $(U.params,v)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(JW,async(U,v)=>{return $(U.params,v)})}set onlistresourcetemplates($){this.setRequestHandler(zW,async(U,v)=>{return $(U.params,v)})}set onreadresource($){this.setRequestHandler(WW,async(U,v)=>{return $(U.params,v)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(YW,async(U,v)=>{return $(U.params,v)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let U=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:mI.includes(U)?U:MW,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let U={},v=!1;for(let J of Object.keys($)){let _=this._hostContext[J],z=$[J];if(xI(_,z))continue;U[J]=z,v=!0}if(v)this._hostContext=$,this.sendHostContextChange(U)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,U){return this.request({method:"ui/resource-teardown",params:$},II,U)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let U=this._client.getServerCapabilities();if(!U)throw Error("Client server capabilities not available");if(U.tools){if(this.oncalltool=async(v,J)=>{return this._client.request({method:"tools/call",params:v},X1,{signal:J.signal})},U.tools.listChanged)this._client.setNotificationHandler(FW,(v)=>this.sendToolListChanged(v.params))}if(U.resources){if(this.onlistresources=async(v,J)=>{return this._client.request({method:"resources/list",params:v},o_,{signal:J.signal})},this.onlistresourcetemplates=async(v,J)=>{return this._client.request({method:"resources/templates/list",params:v},KW,{signal:J.signal})},this.onreadresource=async(v,J)=>{return this._client.request({method:"resources/read",params:v},d_,{signal:J.signal})},U.resources.listChanged)this._client.setNotificationHandler(OW,(v)=>this.sendResourceListChanged(v.params))}if(U.prompts){if(this.onlistprompts=async(v,J)=>{return this._client.request({method:"prompts/list",params:v},ZW,{signal:J.signal})},U.prompts.listChanged)this._client.setNotificationHandler(LW,(v)=>this.sendPromptListChanged(v.params))}}return super.connect($)}}function xI($,U){return JSON.stringify($)===JSON.stringify(U)}function gW($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function hI($){return gW($)&&Array.isArray($.content)&&$.content.every((U)=>gW(U)&&typeof U.type==="string")}function cI(...$){for(let U of $)if(typeof U==="string"){if(U.trim().length>0)return U}return}function lI($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(U){return console.debug("[ext-app-tool-result] stringify failed",U),String($)}}function NW($){let U=$.success===!1;if(hI($.result))return{...$.result,isError:$.result.isError===!0||U};let v=gW($.result)?$.result:null,J=cI($.detailedContent,$.content,v?.detailedContent,v?.content,v?.textResultForLlm,v?.text,v?.message,typeof $.result==="string"?$.result:void 0,$.error)??lI($.result);return{content:J?[{type:"text",text:J}]:[],isError:U}}function NX($,U){if($===U)return!0;if($.isError!==U.isError)return!1;try{let v=JSON.stringify($),J=JSON.stringify(U);if(v===void 0||J===void 0)return!1;if(Math.abs(v.length-J.length)>2000000)return!1;return v===J}catch{return!1}}function SX($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function rI($,U){let v=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:U})}),J=await v.json();if(!v.ok||!SX(J)||!J.ok||typeof J.url!=="string"){let _=SX(J)&&J.error?J.error:`Frame document request failed with HTTP ${v.status}`;throw Error(_)}return J.url}function RX($,U){let v=A6.value,[J,_]=f(null),[z,K]=f(0),W=C(0);u(()=>{if(_(null),!$||v!=="src")return;let Y=!1;return W.current=f1.value,rI($,U).then((Z)=>{if(!Y)_(Z)}).catch((Z)=>{console.error("[iframe-document] failed to create frame document:",Z)}),()=>{Y=!0}},[$,U,v,z]);let O=f1.value;return u(()=>{if(v!=="src"||O===W.current)return;if(!J){K((Z)=>Z+1);return}let Y=!1;return fetch(J,{method:"HEAD"}).then((Z)=>{if(Y)return;if(Z.ok){W.current=O;return}K((q)=>q+1)}).catch(()=>{}),()=>{Y=!0}},[O,J,v]),u$(()=>{if(v==="srcdoc"&&$)return{attributes:{srcdoc:$},ready:!0,key:`srcdoc-${SU($)}`};return{attributes:J?{src:J}:{},ready:Boolean(J),key:J??""}},[J,v,$])}function Q0($){let{enabled:U,token:v,nodeId:J,sourceSurface:_,iframeRef:z}=$;u(()=>{if(!U||!v)return;function K(W){if(W.source!==z.current?.contentWindow)return;let O=W.data;if(!O||O.source!==Hv||O.token!==v||O.nodeId!==J)return;let Y=O.interaction;if(!Y||typeof Y.type!=="string")return;let Z=Y.type;c2({type:Z,sourceNodeId:J,sourceSurface:_,...Y.payload&&typeof Y.payload==="object"?{payload:Y.payload}:{}}).then((q)=>{if(q.ok)FU("context","AX interaction",Z,[J]);else FU("remove","AX interaction rejected",q.error??q.code??"",[J]);z.current?.contentWindow?.postMessage({source:Qv,token:v,...O.correlationId?{correlationId:O.correlationId}:{},interaction:{type:Z},result:q},"*")})}return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[U,v,J,_])}async function d1($,U){let J=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)})).json();if(!J.ok)throw Error(J.error??`Request failed: ${$}`);return J.result}function L0($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}function iI($){let{userAgent:U,visibilityState:v,rect:J,viewport:_,alreadyRearmed:z}=$;if(z)return!1;if(!L0(U))return!1;if(v!=="hidden")return!1;if(J.width<=0||J.height<=0)return!1;return J.bottom>0&&J.right>0&&J.top<_.height&&J.left<_.width}var EX=1000,TX=7000;function g6($,U){if(typeof window>"u")return;let v=window;if(v.__PMX_EXTAPP_LOG??=[],v.__PMX_EXTAPP_LOG.length<500)v.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:U});pI({t:Date.now(),nodeId:$,event:U})}var yX=[],SW=null;function pI($){if(yX.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),SW)return;SW=setTimeout(()=>{SW=null;let U=yX.splice(0);if(U.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:U})}).catch(()=>{})},1500)}var CX=Promise.resolve();function DX($){CX=CX.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((U)=>setTimeout(U,EX))}).catch(()=>{})}function oI($,U){let v=typeof $.data.html==="string"?$.data.html:"",J=typeof $.data.serverName==="string"?$.data.serverName:"",_=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${U}:${J}:${_}:${z}:${v}`}function dI($,U){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!U,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:U};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function jX($,U,v){if(await $.sendToolInput({arguments:U}),v)await $.sendToolResult(v)}function nI($){return typeof $==="string"&&$.trim().length>0?$.trim():O5}function tI($,U){return`<script data-pmx-canvas-ax-bridge>
190
190
  (function () {
191
191
  const PMX_AX_TOKEN = ${JSON.stringify($)};
192
- const PMX_AX_NODE_ID = ${JSON.stringify(v)};
192
+ const PMX_AX_NODE_ID = ${JSON.stringify(U)};
193
193
  window.PMX_AX = window.PMX_AX || {};
194
194
  const pending = new Map();
195
195
  const ackListeners = [];
@@ -204,7 +204,7 @@ container holding the app. Specify either width or maxWidth, and either height o
204
204
  }, 10000);
205
205
  pending.set(correlationId, function (result) { clearTimeout(timer); resolve(result); });
206
206
  window.parent.postMessage({
207
- source: '${X_}',
207
+ source: '${Hv}',
208
208
  token: PMX_AX_TOKEN,
209
209
  nodeId: PMX_AX_NODE_ID,
210
210
  correlationId: correlationId,
@@ -217,7 +217,7 @@ container holding the app. Specify either width or maxWidth, and either height o
217
217
  };
218
218
  window.addEventListener('message', function (event) {
219
219
  const m = event.data;
220
- if (!m || m.source !== '${H_}' || m.token !== PMX_AX_TOKEN) return;
220
+ if (!m || m.source !== '${Qv}' || m.token !== PMX_AX_TOKEN) return;
221
221
  const result = m.result || { ok: false };
222
222
  const resolver = m.correlationId ? pending.get(m.correlationId) : undefined;
223
223
  if (resolver) { pending.delete(m.correlationId); resolver(result); }
@@ -227,11 +227,11 @@ container holding the app. Specify either width or maxWidth, and either height o
227
227
  try { window.dispatchEvent(new CustomEvent('pmx-ax-ack', { detail: { result: result, interaction: m.interaction || null } })); } catch (e) {}
228
228
  });
229
229
  })();
230
- </script>`}function HI($,v){return`<script data-pmx-canvas-boot-beacon>
230
+ </script>`}function aI($,U){return`<script data-pmx-canvas-boot-beacon>
231
231
  (function () {
232
232
  var TOKEN = ${JSON.stringify($)};
233
- var NODE_ID = ${JSON.stringify(v)};
234
- window.parent.postMessage({ source: '${L_}', token: TOKEN, nodeId: NODE_ID }, '*');
233
+ var NODE_ID = ${JSON.stringify(U)};
234
+ window.parent.postMessage({ source: '${Lv}', token: TOKEN, nodeId: NODE_ID }, '*');
235
235
  // Paint-tick answers (Finding N): a double rAF only fires when this frame's
236
236
  // rendering pipeline is actually running — a frame whose layer WebKit never
237
237
  // composites stays silent, and that silence drives the parent's recovery
@@ -239,15 +239,15 @@ container holding the app. Specify either width or maxWidth, and either height o
239
239
  function sendPaintTick() {
240
240
  requestAnimationFrame(function () {
241
241
  requestAnimationFrame(function () {
242
- window.parent.postMessage({ source: '${L_}', token: TOKEN, nodeId: NODE_ID, kind: 'paint-tick' }, '*');
242
+ window.parent.postMessage({ source: '${Lv}', token: TOKEN, nodeId: NODE_ID, kind: 'paint-tick' }, '*');
243
243
  });
244
244
  });
245
245
  }
246
246
  window.addEventListener('message', function (event) {
247
247
  var m = event.data;
248
- if (m && m.source === '${cz}' && m.token === TOKEN) sendPaintTick();
248
+ if (m && m.source === '${W5}' && m.token === TOKEN) sendPaintTick();
249
249
  });
250
250
  sendPaintTick();
251
251
  })();
252
- </script>`}function tB(){return"<style data-pmx-canvas-ext-app-base>html, body { background: transparent !important; }</style>"}function dB($,v){if(!v)return $;let g=/<head\b[^>]*>/i.exec($);if(g?.index!==void 0){let U=g.index+g[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let U=_.index+_[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}return`${v}${$}`}function yU($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function KK($,v){let g=$?.getBoundingClientRect();return{width:yU($?.clientWidth??0,yU(g?.width??0,v.width)),height:yU($?.clientHeight??0,yU(g?.height??0,v.height))}}function LI($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function FI($,v){return Math.max(yU($,1),yU(v,1))}function sB({node:$,expanded:v=!1}){let g=D(null),_=D(null),U=D(null),z=D(null),J=D({}),G=D(void 0),b=D(!1),O=D(void 0),W=D(null),B=D(!1),k=D(null),Y=D(0),F=D([]),X=D(!1),H=D(!1),q=D([]),L=D(!1),I=D(!1),N=D(!1),[T,x]=i("loading"),[S,l]=i(null),[t,M]=i(0),[R,n]=i(!1),[p,c]=i(!1),[a,J$]=i(()=>v||typeof navigator>"u"||typeof window>"u"||!Jg(navigator.userAgent)),P$=$.data.html,A=$.data.serverName,E=$.data.appSessionId,_$=$.data.toolInput??{},$$=$.data.toolResult,O$=$.data.toolName??"ext-app",W$=$.data.toolDefinition,e=$.data.toolCallId,m=typeof e==="string"||typeof e==="number"?e:void 0,s=$.data.resourceMeta,G$=$.data.sessionStatus,k$=$.data.sessionError,r$=$.size.height,v$=$.id,$6=kI($,t),b6=PI(null),xU=$.data.axCapabilities?.enabled===!0&&typeof P$==="string"&&P$.length>0,r6=D$(()=>`ax-${crypto.randomUUID()}`,[]),Xg=xU?XI(r6,v$):"",t4=typeof P$==="string"&&P$.length>0?HI(r6,v$):"",h6=xB(dB(P$??"",tB()+t4+Xg),b6);r(()=>{function U$(K$){if(K$.source!==g.current?.contentWindow)return;let Q$=K$.data;if(!Q$||Q$.source!==L_||Q$.token!==r6||Q$.nodeId!==v$)return;if(H.current=!0,Q$.kind==="paint-tick")for(let E$ of F.current.splice(0))E$()}return window.addEventListener("message",U$),()=>window.removeEventListener("message",U$)},[r6,v$]),r(()=>{if(a)return;oB({remount:()=>{if(N.current)return!1;return L6(v$,"mount-slot"),J$(!0),!0},awaitBoot:()=>new Promise((U$)=>{let K$=window.setTimeout(Q$,hB);function Q$(){window.clearTimeout(K$),U$()}q.current.push(Q$)})})},[]),NU({enabled:xU,token:r6,nodeId:v$,sourceSurface:"mcp-app",iframeRef:g});let C2=3,V2=(U$)=>{if(Y.current>=C2)return L6(v$,`remount-cap-hit (${U$})`),!1;if(L.current)return!0;return Y.current+=1,L.current=!0,L6(v$,`remount-queued #${Y.current} (${U$})`),oB({remount:()=>{if(L.current=!1,N.current||m$.value===v$)return L6(v$,"remount-skipped"),n(!1),!1;return I.current=typeof document<"u"&&document.visibilityState==="hidden",L6(v$,`remount-run #${Y.current}`),x("loading"),M((K$)=>K$+1),!0},awaitBoot:()=>new Promise((K$)=>{let Q$=window.setTimeout(E$,hB);function E$(){window.clearTimeout(Q$),K$()}q.current.push(E$)})}),!0},Tk=1500,hK=()=>new Promise((U$)=>{let K$=g.current?.contentWindow;if(!K$||N.current){U$(!1);return}let Q$=!1,E$=window.setTimeout(()=>{if(Q$)return;Q$=!0,U$(!1)},Tk);F.current.push(()=>{if(Q$)return;Q$=!0,window.clearTimeout(E$),U$(!0)}),K$.postMessage({source:cz,token:r6},"*")}),jk=()=>new Promise((U$)=>{let K$=g.current;if(!K$){U$();return}let Q$=K$.style.width,E$=K$.style.height;K$.style.width="140%",K$.style.height="140%",requestAnimationFrame(()=>{requestAnimationFrame(()=>{K$.style.width=Q$,K$.style.height=E$,L6(v$,"soft-expand-cycle"),U$()})})}),uk=async()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!Jg(navigator.userAgent))return;if(n(!0),await hK()){L6(v$,"paint-ok"),n(!1);return}if(L6(v$,"paint-fail"),await jk(),await hK()){L6(v$,"paint-ok (after soft-expand)"),n(!1);return}if(N.current)return;if(!V2("paint-fail"))L6(v$,"recovery-exhausted"),n(!1),c(!0)};r(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!Jg(navigator.userAgent))return;function U$(){if(document.visibilityState!=="visible")return;if(!I.current||N.current)return;I.current=!1,Y.current=0,c(!1),L6(v$,"visible-again-rearm"),V2("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",U$),()=>document.removeEventListener("visibilitychange",U$)},[v,v$]);let Ck=6000;r(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!Jg(navigator.userAgent))return;if(!h6.ready||!a)return;let U$=window.setTimeout(()=>{if(X.current||H.current||N.current)return;V2("boot-watchdog")},Ck);return()=>window.clearTimeout(U$)},[$6,h6.ready,v,a]),r(()=>()=>{N.current=!0;for(let U$ of q.current.splice(0))U$();for(let U$ of F.current.splice(0))U$()},[]);let f2=(U$)=>lv(U$),q4=v||m$.value===v$;J.current=_$,G.current=$$;let Hg=G$==="error"&&typeof P$==="string"&&P$.length>0,r2=G$==="error"?Hg?`Live session unavailable — showing saved content. Reopen the app to restore interactivity.${k$?` (${k$})`:""}`:k$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",E2=(U$)=>{let K$=G.current;if(!U$||!B.current||!K$)return null;if(O.current===K$)return null;if(O.current&&cB(O.current,K$))return O.current=K$,null;if(W.current)return W.current;let Q$=U$.sendToolResult(K$).then(()=>{O.current=K$,b.current=!0,x("done")}).catch((E$)=>{let d4=E$ instanceof Error?E$.message:String(E$);throw l(`Tool result delivery failed: ${d4}`),E$}).finally(()=>{W.current=null});return W.current=Q$,Q$};if(r(()=>{if(!P$||!h6.ready||!a)return;let U$=g.current;if(!U$)return;let K$=!1,Q$=null,E$=null,d4=null,Lv=null,a4=null;b.current=!1,O.current=void 0,W.current=null,B.current=!1,X.current=!1,H.current=!1;let Lg=()=>{if(!Q$)return;clearTimeout(Q$),Q$=null};return(async()=>{if(!P$)return;let P4=U$.contentWindow;if(!P4)throw Error("Ext-app iframe window is unavailable");let s4=(F$=m$.value===v$?"fullscreen":"inline")=>({theme:f2(c$.value),platform:"web",containerDimensions:KK(U$,{width:$.size.width,height:r$}),displayMode:F$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...W$?{toolInfo:{id:m,tool:W$}}:{}}),Vk=()=>{if(Lv!==null)return;Lv=requestAnimationFrame(()=>{if(Lv=null,K$||!B.current)return;u$.setHostContext?.(s4())})},lK=()=>{if(a4!==null)return;a4=requestAnimationFrame(()=>{a4=requestAnimationFrame(()=>{if(a4=null,K$||!B.current)return;u$.sendHostContextChange?.(s4())})})},pK=()=>{if(!Jg(navigator.userAgent))return;if(E$)clearTimeout(E$);E$=setTimeout(()=>{if(E$=null,K$)return;uk()},aB+200)},u$=new _K(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:s4(q4?"fullscreen":"inline")});u$.onsizechange=async({height:F$})=>{if(LI(F$,m$.value===v$)){let Y6=KK(U$.parentElement??U$,{width:$.size.width,height:r$}),D6=FI(F$,Y6.height);U$.style.height=`${D6}px`;let e4=u.value.get(v$)?.size??$.size,nK=Math.max(e4.height,D6+cv);if(Math.abs(nK-e4.height)>8){if(jv(v$,{width:e4.width,height:nK}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{a$({recordHistory:!1}),z.current=null},0)}}return{}},u$.onopenlink=async({url:F$})=>{return window.open(F$,"_blank","noopener"),{}},u$.onsandboxready=async()=>{await u$.sendSandboxResourceReady({html:dB(P$,tB()),sandbox:iz,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},u$.onrequestdisplaymode=async({mode:F$})=>{let{nextMode:Y6,shouldExpand:D6,shouldCollapse:e4}=qI(F$,q4);if(D6)J4(v$);else if(e4)_v();return{mode:Y6}},u$.oncalltool=async(F$)=>{if(!E)throw Error(r2);try{let Y6=await qv("/api/ext-app/call-tool",{sessionId:E,nodeId:v$,serverName:A,toolName:F$.name,arguments:F$.arguments??{}});return l(null),Y6}catch(Y6){let D6=Y6 instanceof Error?Y6.message:String(Y6);throw l(`Tool call failed: ${D6}`),Y6}},u$.setRequestHandler(vg,async()=>{if(!E)return{tools:[]};return qv("/api/ext-app/list-tools",{sessionId:E})}),u$.onlistresources=async()=>E?qv("/api/ext-app/list-resources",{sessionId:E}):{resources:[]},u$.onlistresourcetemplates=async()=>E?qv("/api/ext-app/list-resource-templates",{sessionId:E}):{resourceTemplates:[]},u$.onreadresource=async(F$)=>{if(!E)throw Error(r2);return qv("/api/ext-app/read-resource",{sessionId:E,uri:F$.uri})},u$.onlistprompts=async()=>E?qv("/api/ext-app/list-prompts",{sessionId:E}):{prompts:[]},u$.onupdatemodelcontext=async(F$)=>{if(!E)return{};return await qv("/api/ext-app/model-context",{nodeId:v$,...Array.isArray(F$.content)?{content:F$.content}:{},...F$.structuredContent&&typeof F$.structuredContent==="object"?{structuredContent:F$.structuredContent}:{}}),{}};let m2=new k2(P4,P4);if(u$.oninitialized=()=>{if(K$)return;Lg(),B.current=!0,X.current=!0,L6(v$,"initialized"),x("ready"),l(null),Promise.resolve(u$.sendHostContextChange(s4(q4?"fullscreen":"inline"))).then(()=>nB(u$,J.current,void 0)).then(()=>E2(u$)).then(()=>{L6(v$,"settled");for(let F$ of q.current.splice(0))F$();lK(),pK()}).catch((F$)=>{let Y6=F$ instanceof Error?F$.message:String(F$);l(`Bridge bootstrap failed: ${Y6}`)})},Q$=setTimeout(()=>{if(K$||B.current)return;let F$=G.current,Y6=s4(q4?"fullscreen":"inline");B.current=!0,u$.setHostContext?.(Y6),Promise.resolve(u$.sendHostContextChange(Y6)).then(()=>nB(u$,J.current,F$)).then(()=>{if(b.current=Boolean(F$),F$)O.current=F$;if(x(F$?"done":"ready"),l(null),lK(),pK(),H.current){L6(v$,"settled (fallback)");for(let D6 of q.current.splice(0))D6()}}).catch((D6)=>{let e4=D6 instanceof Error?D6.message:String(D6);l(`Bridge bootstrap fallback failed: ${e4}`)})},1200),await u$.connect(m2),K$){Lg(),await m2.close();return}if(_.current=u$,U.current=m2,d4=new ResizeObserver(Vk),d4.observe(U$),U$.parentElement)d4.observe(U$.parentElement);let oK=!0;k.current=c$.subscribe((F$)=>{if(oK){oK=!1;return}if(K$)return;u$.setHostContext?.({...s4(),theme:f2(F$)}),u$.sendHostContextChange?.(s4())}),E2(u$)})().catch((P4)=>{Lg(),console.error("[ext-app] Bridge init failed:",P4),l(P4?.message??"Bridge initialization failed")}),()=>{if(K$=!0,Lg(),E$)clearTimeout(E$),E$=null;if(d4?.disconnect(),d4=null,Lv!==null)cancelAnimationFrame(Lv),Lv=null;if(a4!==null)cancelAnimationFrame(a4),a4=null;if(B.current=!1,W.current=null,k.current?.(),k.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(_.current=null,U.current)U.current.close().catch((P4)=>{console.error("[ext-app] transport close failed:",P4)}),U.current=null}},[$6,h6.key,a]),r(()=>{if($$&&_.current&&(T==="ready"||T==="done"))E2(_.current)},[$$,T]),r(()=>{let U$=_.current;if(g.current)g.current.style.height="100%";if(!U$||!B.current)return;let K$=null,Q$=null;return K$=requestAnimationFrame(()=>{K$=null,Q$=requestAnimationFrame(()=>{if(Q$=null,!B.current)return;let E$={theme:f2(c$.value),platform:"web",containerDimensions:KK(g.current,{width:$.size.width,height:r$}),displayMode:q4?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};U$.setHostContext?.(E$),U$.sendHostContextChange?.(E$)})}),()=>{if(K$!==null)cancelAnimationFrame(K$);if(Q$!==null)cancelAnimationFrame(Q$)}},[q4,r$]),!P$)return K("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[K("div",{style:{opacity:0.6},children:["Loading ",O$," viewer..."]},void 0,!0,void 0,this),K("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),K("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return K("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[G$&&G$!=="ready"&&K("div",{style:{padding:"6px 10px",fontSize:"11px",background:G$==="error"&&!Hg?"var(--c-danger-12)":"var(--c-warn-10)",color:G$==="error"&&!Hg?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${G$==="error"&&!Hg?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:r2},void 0,!1,void 0,this),S&&K("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[K("span",{children:"⚠"},void 0,!1,void 0,this),K("span",{style:{flex:1},children:S},void 0,!1,void 0,this),K("button",{type:"button",onClick:()=>{l(null),x("loading"),M((U$)=>U$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),K("button",{type:"button",onClick:()=>l(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[a&&K("iframe",{ref:g,...h6.attributes,sandbox:b6,allow:mB(s?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:q4&&T!=="loading"?"auto":"none"},title:`Ext App: ${O$}`},$6,!1,void 0,this),p&&!S&&K("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-warn)",fontSize:"12px"},children:[K("div",{children:"App surface failed to paint."},void 0,!1,void 0,this),K("button",{type:"button",onClick:(U$)=>{U$.stopPropagation(),L6(v$,"manual-retry"),Y.current=0,c(!1),x("loading"),M((K$)=>K$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-warn-15)",borderRadius:"4px",color:"var(--c-warn)",cursor:"pointer",fontSize:"11px",padding:"3px 10px"},children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(T==="loading"||R)&&!S&&!p&&K("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[K("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),K("div",{children:T==="loading"?`Connecting to ${O$}...`:"Finishing paint..."},void 0,!1,void 0,this),K("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!q4&&!(p&&!S)&&K("button",{type:"button",onClick:(U$)=>{U$.stopPropagation(),J4(v$)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ZI($,v,g,_,U,z,J){if(!$)return $;try{let G=new URL($,window.location.origin);if(G.searchParams.set("theme",lv(c$.value)),v)G.searchParams.set("display","expanded");if(typeof g==="number")G.searchParams.set("v",String(g));if(_)G.searchParams.set("axToken",_);if(U)G.searchParams.set("axNodeId",U);if(z)G.searchParams.set("frameToken",z);if(J)G.searchParams.set("fit","content");return G.toString()}catch{return $}}function II($,v=window.location.origin){if(!$)return!1;try{let g=new URL(v).origin,_=new URL($,g);return _.origin===g&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function x4({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return K(sB,{node:$,expanded:v},void 0,!1,void 0,this);return K(QI,{node:$,expanded:v},void 0,!1,void 0,this)}function QI({node:$,expanded:v}){let g=D(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",U=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,G=(U||_)&&(_?z===!0:z!==!1),b=_?"mcp-app":"json-render",O=D$(()=>G?`ax-${crypto.randomUUID()}`:"",[G]),W=hz($)&&!v,B=D$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);iv($,g,B),NU({enabled:G&&Boolean(O),token:O,nodeId:$.id,sourceSurface:b,iframeRef:g});let k=I4.value,Y=()=>{if(!G||!O||k==null)return;g.current?.contentWindow?.postMessage({source:j6,type:"ax-update",token:O,state:k},"*")};r(Y,[G,O,k]);let F=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,X=ZI($.data.url||"",v,F,O||void 0,G?$.id:void 0,B||void 0,W),H=xv(X),q=$.data.sourceServer||"",L=$.data.hostMode||"hosted",I=$.data.fallbackReason,N=$.data.trustedDomain===!0||II(X);if(L==="fallback")return K("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[K("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[K("span",{children:"⚠"},void 0,!1,void 0,this),K("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I&&K("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",I]},void 0,!0,void 0,this),K("a",{href:X,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:X},void 0,!1,void 0,this),q&&K("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",q]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return K("div",{style:{height:"100%",display:"flex",flexDirection:"column",...v?{flex:1,minHeight:0,width:"100%"}:{}},children:[!N&&K("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),K("iframe",{ref:g,...H,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:I6.value==="srcdoc"?void 0:"lazy",onLoad:Y,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${q}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Gg=null;function s$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function q2(){if(Gg)return Gg;return Gg={bg:s$("--c-bg"),panel:s$("--c-panel"),panelSoft:s$("--c-panel-soft"),line:s$("--c-line"),text:s$("--c-text"),textSoft:s$("--c-text-soft"),muted:s$("--c-muted"),dim:s$("--c-dim"),accent:s$("--c-accent"),ok:s$("--c-ok"),warn:s$("--c-warn"),warnAlt:s$("--c-warn-alt"),danger:s$("--c-danger"),purple:s$("--c-purple"),thinking:s$("--c-thinking"),subagent:s$("--c-subagent"),font:s$("--font"),mono:s$("--mono")},Gg}function RU(){Gg=null}var P2={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function bK($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let g=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(g)return g;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function DU({node:$}){let v=bK($),g=$.data.detail||"",_=$.data.message||"",U=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,G=P2[v]??"var(--c-muted)",b=v!=="idle";return K("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[K("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[K("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:G,boxShadow:b?`0 0 8px ${G}`:"none",animation:b?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),K("span",{style:{fontWeight:600,color:G,textTransform:"uppercase",letterSpacing:"0.05em"},children:v},void 0,!1,void 0,this),g&&K("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&K("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[K("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),K("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&J.state!=="completed"&&K("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[K("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),K("span",{children:J.name},void 0,!1,void 0,this),K("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",J.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_&&K("div",{style:{color:U==="warn"?"var(--c-warn)":U==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TU($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function eB($){if(typeof $==="string"){let U=TU($);return U?{title:"Evidence warning",detail:U}:null}if(!$||typeof $!=="object")return null;let v=$,g=TU(v.title)??"Evidence warning",_=TU(v.detail);return _?{title:g,detail:_}:null}function wI($){let v=[],g=eB($.data.warning);if(g)v.push(g);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=eB(z);if(J)v.push(J)}let U=TU($.data.validationStatus)?.toLowerCase();if(U==="failed"||U==="invalid")v.push({title:"Image failed validation",detail:TU($.data.validationMessage)??"Review this image before using it as evidence."});return v}function AI($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((g)=>TU(g)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((g)=>v.includes(g))}function $Y($){let v=wI($);if(v.length>0)return v;if(AI($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function X2({node:$,expanded:v=!1}){let g=$.data.src||"",_=$.data.alt||$.data.title||"Image",U=$.data.caption||"",z=$Y($),J=g.startsWith("data:")||g.startsWith("http://")||g.startsWith("https://")?g:`/api/canvas/image/${$.id}`,[G,b]=i(!1),[O,W]=i(!1),[B,k]=i(1),[Y,F]=i({x:0,y:0}),[X,H]=i({w:0,h:0}),q=D(null),L=D(!1),I=D({x:0,y:0}),N=y((p)=>{let c=p.target;H({w:c.naturalWidth,h:c.naturalHeight}),b(!0),W(!1)},[]),T=y(()=>{W(!0),b(!1)},[]);r(()=>{k(1),F({x:0,y:0})},[g]);let x=y((p)=>{p.preventDefault(),p.stopPropagation();let c=p.deltaY>0?0.9:1.1;k((a)=>Math.max(0.25,Math.min(10,a*c)))},[]),S=y((p)=>{if(B<=1)return;p.stopPropagation(),L.current=!0,I.current={x:p.clientX,y:p.clientY},p.target.setPointerCapture(p.pointerId)},[B]),l=y((p)=>{if(!L.current)return;let c=p.clientX-I.current.x,a=p.clientY-I.current.y;I.current={x:p.clientX,y:p.clientY},F((J$)=>({x:J$.x+c,y:J$.y+a}))},[]),t=y(()=>{L.current=!1},[]),M=y(()=>{k(1),F({x:0,y:0})},[]);if(!g)return K("div",{class:"image-node-empty",children:[K("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),K("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let R=X.w>0?`${X.w}×${X.h}`:"",n=Math.round(B*100);return K("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:q,children:[z.length>0&&K("div",{class:"image-node-warning-stack",children:z.map((p)=>K("div",{class:"image-node-warning",children:[K("span",{class:"image-node-warning-title",children:p.title},void 0,!1,void 0,this),K("span",{class:"image-node-warning-detail",children:p.detail},void 0,!1,void 0,this)]},`${p.title}-${p.detail}`,!0,void 0,this))},void 0,!1,void 0,this),K("div",{class:"image-node-viewport",onWheel:x,onPointerDown:S,onPointerMove:l,onPointerUp:t,style:{cursor:B>1?"grab":"default"},children:[!G&&!O&&K("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),O&&K("div",{class:"image-node-error",children:[K("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),K("div",{children:"Failed to load image"},void 0,!1,void 0,this),K("div",{class:"image-node-error-path",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("img",{src:J,alt:_,onLoad:N,onError:T,draggable:!1,style:{transform:`translate(${Y.x}px, ${Y.y}px) scale(${B})`,opacity:G?1:0,display:O?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(U||R||B!==1)&&K("div",{class:"image-node-footer",children:[U&&K("span",{class:"image-node-caption",children:U},void 0,!1,void 0,this),K("span",{class:"image-node-meta",children:[R&&K("span",{children:R},void 0,!1,void 0,this),B!==1&&K("button",{type:"button",class:"image-node-zoom-reset",onClick:M,title:"Reset zoom",children:[n,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function vY({node:$}){let v=$.data.children??[],g=u.value,_=v.filter((G)=>g.has(G)),U=_.length,z={};for(let G of _){let b=g.get(G);if(b)z[b.type]=(z[b.type]??0)+1}let J=Object.entries(z).map(([G,b])=>`${b} ${G}`).join(", ");return K("div",{class:"group-node-body",children:[K("div",{class:"group-summary",children:[K("span",{class:"group-child-count",children:[U," node",U!==1?"s":""]},void 0,!0,void 0,this),J&&K("span",{class:"group-type-summary",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U===0&&K("div",{class:"group-empty-hint",children:"Drag nodes here or use the selection bar to group nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MI($){try{return new URL($).host}catch{return $}}function SI($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function H2({node:$,expanded:v=!1}){let g=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",U=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",J=typeof $.data.status==="string"?$.data.status:"idle",G=typeof $.data.error==="string"?$.data.error:"",b=SI(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),O=typeof $.data.statusCode==="number"?$.data.statusCode:null,W=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",B=$.data.frameBlocked===!0,k=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[Y,F]=i(!1),[X,H]=i(v);r(()=>{if(v)H(!0)},[v]);let q=y(async()=>{if(!g||Y)return;F(!0);try{await pg($.id)}finally{F(!1)}},[$.id,Y,g]);if(!g)return K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let L=J==="ready"?"var(--c-ok)":J==="error"?"var(--c-danger)":"var(--c-warn)";return K("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[K("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[K("div",{style:{minWidth:0,flex:1},children:[K("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:MI(g)},void 0,!1,void 0,this),K("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||g},void 0,!1,void 0,this),K("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:L,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[K("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:L}},void 0,!1,void 0,this),J]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(U||W)&&K("div",{style:{display:"grid",gridTemplateColumns:W&&v?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[W&&v&&K("img",{src:W,alt:_||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),U&&K("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[K("button",{type:"button",onClick:q,disabled:Y,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:Y?"progress":"pointer",fontSize:"12px"},children:Y||J==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),v&&!B&&K("button",{type:"button",onClick:()=>H((I)=>!I),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:X?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),K("button",{type:"button",onClick:()=>window.open(g,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&B&&K("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[K("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),K("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:k||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&X&&!B&&K("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[K("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),K("iframe",{class:"webpage-node-iframe",title:_||$.data.title||g,src:g,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:v?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(b||O!==null)&&K("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[b&&K("span",{children:["Fetched ",b]},void 0,!0,void 0,this),O!==null&&K("span",{children:["HTTP ",O]},void 0,!0,void 0,this),B&&K("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&K("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:G},void 0,!1,void 0,this),K("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:v?"14px":"10px"},children:z?K("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:v?"14px":"12px"},children:z},void 0,!1,void 0,this):K("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:J==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function UY($){return $.type==="html"&&$.data.presentation===!0}function Kg({node:$,expanded:v=!1,presentation:g=!1,presentationExitToken:_,autoFocus:U=!1}){let z=D(null),J=c$.value,G=D$(()=>`theme-${crypto.randomUUID()}`,[]),b=D$(()=>`ax-${crypto.randomUUID()}`,[]),O=D$(()=>`frame-${crypto.randomUUID()}`,[]),W=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",B=D$(()=>mv(W),[W]),k=D$(()=>W?_1($.id,{theme:J,themeToken:G,present:g,presentToken:_,v:B,axToken:b,frameToken:O}):"",[W,g,_,G,B,$.id,b,O]),Y=xv(k);iv($,z,v?"":O),NU({enabled:!0,token:b,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),r(()=>{if(z.current?.contentWindow?.postMessage({source:j6,type:"theme-update",token:G,theme:J},"*"),U)z.current?.focus()},[J,G]);let F=$.data.axCapabilities,X=F?.enabled===!0&&(!Array.isArray(F.allowed)||F.allowed.length>0),H=I4.value;r(()=>{if(!X||H==null)return;z.current?.contentWindow?.postMessage({source:j6,type:"ax-update",token:b,state:H},"*")},[X,H,b]),r(()=>{if(!U)return;let L=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(L)},[U,k]);let q=()=>{if(z.current?.contentWindow?.postMessage({source:j6,type:"theme-update",token:G,theme:J},"*"),X&&I4.value!=null)z.current?.contentWindow?.postMessage({source:j6,type:"ax-update",token:b,state:I4.value},"*");if(U)z.current?.focus()};if(!W)return K("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return K("iframe",{ref:z,class:g?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",...Y,tabIndex:U?0:void 0,onLoad:q,style:{width:"100%",height:"100%",minHeight:g?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:g?0:"6px",display:"block"}},void 0,!1,void 0,this)}var OK=null;async function gY(){if(!OK)OK=await r7();return OK}function _Y($,v){if(!$)return null;let g=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===g);if(_)return _.name;let U=v.filter((z)=>z.name.toLowerCase().startsWith(g));return U.length===1?U[0].name:null}function NI($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function yI({html:$}){let v=D(null);return r(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),K("div",{ref:v},void 0,!1,void 0,this)}function RI($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function zY({count:$}){if($===0)return null;return K("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function JY({message:$,onDismiss:v}){if(!$)return null;return K("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[K("span",{style:{flex:1},children:$},void 0,!1,void 0,this),K("button",{type:"button",onClick:v,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function L2({node:$,expanded:v=!1}){let g=Array.isArray($.data.turns)?$.data.turns:[],_=g.length===0,U=$.data.text||"",z=$.data.status||"draft",J=_?z:$.data.threadStatus||"draft",G=J==="draft",b=J==="pending"||J==="sending",O=J==="streaming",W=J==="answered",[B,k]=i(""),[Y,F]=i(""),[X,H]=i(null),[q,L]=i(new Map),I=D(null),N=D(null),T=g[g.length-1],x=`${g.length}:${T?.role??""}:${T?.status??""}:${Math.floor((T?.text?.length??0)/200)}`;r(()=>{if(v&&G&&I.current)I.current.focus()},[v,G]),r(()=>{if(!x)return;if(N.current)N.current.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},[x]);let S=D(null),l=D(g);l.current=g,r(()=>{let c=g.some((J$)=>J$.role==="assistant"&&J$.status==="streaming"),a=()=>{let J$=!1,A=l.current.map((E,_$)=>({turn:E,index:_$})).filter(({turn:E})=>E.role==="assistant"&&E.text);if(A.length===0)return;return Promise.all(A.map(async({turn:E,index:_$})=>{let $$=await _4(E.text);return{index:_$,html:NI($$)}})).then((E)=>{if(J$)return;let _$=new Map;for(let $$ of E)_$.set($$.index,$$.html);L(_$)}),()=>{J$=!0}};if(!c){if(S.current)clearTimeout(S.current),S.current=null;return a()}if(S.current)clearTimeout(S.current);return S.current=setTimeout(()=>{S.current=null,a()},400),()=>{if(S.current)clearTimeout(S.current),S.current=null}},[g]);let t=y(async()=>{let c=B.trim();if(!c)return;let a=B;H(null),g$($.id,{turns:[{role:"user",text:c,status:"pending"}],threadStatus:"pending",text:c}),k("");let J$=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await nU(c,$.position,$.id,J$,$.id)).ok)g$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),k(a),H("Failed to send prompt. Your draft has been restored.")},[B,$.id,$.position,$.data.contextNodeIds]),M=y(async()=>{let c=Y.trim();if(!c)return;let a=Y;H(null);let J$=Array.isArray($.data.turns)?[...$.data.turns]:[];if(J$.push({role:"user",text:c,status:"pending"}),g$($.id,{turns:J$,threadStatus:"pending"}),F(""),!(await E7($.id,c)).ok)J$.pop(),g$($.id,{turns:J$,threadStatus:"answered"}),F(a),H("Failed to send reply. Your draft has been restored.")},[Y,$.id,$.data.turns]),R=y((c)=>{if(c.key==="Enter"&&(c.metaKey||c.ctrlKey)){c.preventDefault(),t();return}if(c.key==="Tab"&&B.startsWith("/")){c.preventDefault();let a=B.slice(1).split(/\s/)[0];if(a)gY().then((J$)=>{let P$=_Y(a,J$);if(P$)k(`/${P$}`)})}},[t,B]),n=y((c)=>{if(c.key==="Enter"&&(c.metaKey||c.ctrlKey)){c.preventDefault(),M();return}if(c.key==="Tab"&&Y.startsWith("/")){c.preventDefault();let a=Y.slice(1).split(/\s/)[0];if(a)gY().then((J$)=>{let P$=_Y(a,J$);if(P$)F(`/${P$}`)})}},[M,Y]),p=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(G&&g.length===0)return K("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[K(zY,{count:p},void 0,!1,void 0,this),K(JY,{message:X,onDismiss:()=>H(null)},void 0,!1,void 0,this),K("textarea",{ref:I,value:B,onInput:(c)=>k(c.target.value),onKeyDown:R,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),K("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[K("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),K("button",{type:"button",onClick:t,disabled:!B.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(_)return K("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[K("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:U},void 0,!1,void 0,this),K("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:K("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:b?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:b?"Sending…":W?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return K("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[K(zY,{count:p},void 0,!1,void 0,this),K(JY,{message:X,onDismiss:()=>H(null)},void 0,!1,void 0,this),K("div",{ref:N,style:{flex:1,overflow:"auto",minHeight:0},children:g.map((c,a)=>K("div",{children:[a>0&&K("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),c.role==="user"?K("div",{class:"thread-turn-user",children:[K("div",{class:"thread-turn-role",children:[K("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),K("div",{style:{fontSize:v?"15px":"13px",lineHeight:v?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:c.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):K("div",{class:"thread-turn-assistant",children:[K("div",{class:"thread-turn-role",children:[K("span",{class:`status-dot${c.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),c.status==="streaming"&&!c.text&&K("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),K("div",{class:v?"md-reader-content":void 0,style:{fontSize:v?void 0:"13px",lineHeight:v?void 0:"1.55",opacity:c.text?1:0.4},children:q.get(a)?K(t$,{children:[K(yI,{html:q.get(a)??""},void 0,!1,void 0,this),c.status==="streaming"&&K("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):K("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:c.status==="streaming"?"Waiting for response…":c.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},RI(c,a),!0,void 0,this))},void 0,!1,void 0,this),K("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[K("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:W?"6px":0},children:[K("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-accent)":b?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:O?"Streaming…":b?"Sending…":W?"Answered":J},void 0,!1,void 0,this),K("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[g.length," turn",g.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&K("div",{class:"thread-reply-area",children:[K("textarea",{value:Y,onInput:(c)=>F(c.target.value),onKeyDown:n,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),K("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[K("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),K("button",{type:"button",onClick:M,disabled:!Y.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:Y.trim()?"var(--c-accent)":"var(--c-line)",color:Y.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:Y.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function DI($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function TI({html:$}){let v=D(null);return r(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),K("div",{ref:v},void 0,!1,void 0,this)}function F2({node:$,expanded:v=!1}){let g=$.data.content||"",_=$.data.status||"streaming",[U,z]=i(""),J=_==="streaming",G=_==="complete";r(()=>{if(!g){z("");return}let O=!1;return _4(g).then((W)=>{if(!O)z(DI(W))}),()=>{O=!0}},[g]);let b=y(()=>{nU("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return K("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[J&&K("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),K("div",{class:v?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:g?1:0.4,transition:"opacity 0.2s ease"},children:U?K("div",{class:v?"md-reader-content":void 0,children:K(TI,{html:U},void 0,!1,void 0,this)},void 0,!1,void 0,this):K("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:J?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[K("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:J?"var(--c-accent)":G?"var(--c-ok)":"var(--c-muted)"},children:J?"Streaming…":G?"Complete":_},void 0,!1,void 0,this),G&&K("button",{type:"button",onClick:b,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GY($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var KY={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},jI={running:"⠋",success:"✓",failed:"✕"},uI={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function Z2({node:$}){let{toolName:v,category:g,status:_,duration:U,resultSummary:z,error:J}=GY($.data),G=KY[g]??KY.other,b=jI[_]??"◌",O=uI[_]??"var(--c-muted)",W=_==="running",B=J?J.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return K("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[K("span",{style:{fontSize:"14px",color:O,flexShrink:0,animation:W?"pulse 1.5s infinite":"none"},children:b},void 0,!1,void 0,this),K("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[K("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:G,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v},void 0,!1,void 0,this),B&&K("div",{style:{fontSize:"10px",color:J?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&K("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BK($){let v=u.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function CI($){let v=$.map((b)=>BK(b)).filter((b)=>b!==null);if(v.length===0)return null;let g=Math.min(...v.map((b)=>b.left)),_=Math.min(...v.map((b)=>b.top)),U=Math.max(...v.map((b)=>b.left+b.width)),z=Math.max(...v.map((b)=>b.top+b.height)),J=54,G=46;return{left:g-J,top:_-G,width:U-g+J*2,height:z-_+G*2}}function WK($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function bY(){let $=Array.from(Mv.value),v=Array.from(Sv.value),g=fg.value;if($.length===0&&v.length===0)return null;return K("div",{class:"attention-field-layer","aria-hidden":"true",children:[g.map((_)=>{let U=CI(_.nodeIds);if(!U)return null;return K("div",{class:"attention-field-region",style:WK(U,42)},_.id,!1,void 0,this)}),v.map((_)=>{let U=BK(_);if(!U)return null;return K("div",{class:"attention-field-node attention-field-secondary",style:WK({left:U.left-18,top:U.top-18,width:U.width+36,height:U.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let U=BK(_);if(!U)return null;return K("div",{class:"attention-field-node attention-field-primary",style:WK({left:U.left-24,top:U.top-24,width:U.width+48,height:U.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var B6=B$(new Map),uU=B$(null),VI=480,fI=320,rI=650,bg=new Map,jU=new Map,I2=new Map,B4=null;function YK($){B6.value=$,mI()}function kK($){let v=bg.get($);if(v)clearTimeout(v),bg.delete($)}function qK($){let v=jU.get($);if(v)clearTimeout(v),jU.delete($)}function WY($){if(kK($.id),qK($.id),!B6.value.has($.id))I2.set($.id,Date.now());let v=new Map(B6.value);v.set($.id,{...$,phase:"forming"}),YK(v)}function EI($){if(kK($),qK($),I2.delete($),!B6.value.has($))return;let v=new Map(B6.value);v.delete($),YK(v)}function OY($,v,g,_){let U=B6.value.get($);if(!U||U.phase===v)return;let z=new Map(B6.value);z.set($,{...U,phase:v,..._?{settledNodeId:_}:{}}),YK(z),kK($),bg.set($,setTimeout(()=>EI($),g))}function BY($,v,g,_){qK($);let U=Date.now()-(I2.get($)??0),z=Math.max(0,rI-U);if(z===0){OY($,v,g,_);return}jU.set($,setTimeout(()=>{jU.delete($),OY($,v,g,_)},z))}function YY($,v){BY($,"settling",VI,v)}function PK($){BY($,"dissolving",fI)}function XK(){for(let $ of bg.values())clearTimeout($);bg.clear();for(let $ of jU.values())clearTimeout($);if(jU.clear(),I2.clear(),B4)clearInterval(B4),B4=null;uU.value=null,B6.value=new Map}function mI(){if(B4||B6.value.size===0)return;B4=setInterval(()=>{let $=Date.now();for(let v of B6.value.values())if(v.phase==="forming"&&v.expiresAt<=$)PK(v.id);if(B6.value.size===0&&B4)clearInterval(B4),B4=null},1000),B4.unref?.()}var cI={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function I$({size:$=16,children:v,...g}){return K("svg",{width:$,height:$,viewBox:"0 0 16 16",...cI,...g,children:v},void 0,!1,void 0,this)}function HY($){return K(I$,{...$,children:[K("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),K("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),K("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),K("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),K("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LY($){return K(I$,{...$,children:[K("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"4.5",x2:"8",y2:"6.5"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"9.5",x2:"8",y2:"11.5"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"8",x2:"6.5",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"9.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FY($){return K(I$,{...$,children:[K("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),K("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),K("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),K("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZY($){return K(I$,{...$,children:[K("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),K("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),K("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HK($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),K("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),K("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),K("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),K("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LK($){return K(I$,{...$,children:[K("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),K("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IY($){return K(I$,{...$,children:[K("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),K("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),K("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),K("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),K("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QY($){return K(I$,{...$,children:K("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function FK($){return K(I$,{...$,children:[K("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),K("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),K("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZK($){return K(I$,{...$,children:[K("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),K("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),K("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IK($){return K(I$,{...$,children:[K("path",{d:"M3 4h10"},void 0,!1,void 0,this),K("path",{d:"M8 4v8"},void 0,!1,void 0,this),K("path",{d:"M6 12h4"},void 0,!1,void 0,this),K("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),K("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QK($){return K(I$,{...$,children:[K("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),K("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wK($){return K(I$,{...$,children:[K("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AK($){return K(I$,{...$,children:[K("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),K("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),K("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MK($){return K(I$,{...$,children:[K("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),K("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SK($){return K(I$,{...$,children:[K("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),K("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),K("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wY({size:$=22,class:v}){return K("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:v,"aria-hidden":"true",children:[K("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),K("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),K("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),K("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kY($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function iI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),K("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),K("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),K("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),K("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qY($){return K(I$,{...$,children:[K("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),K("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),K("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PY($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),K("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lI($){return K(I$,{...$,children:[K("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),K("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),K("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),K("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),K("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),K("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function nI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),K("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function tI($){return K(I$,{...$,children:[K("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),K("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),K("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),K("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function aI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),K("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),K("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sI($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),K("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XY($){return K(I$,{...$,children:[K("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),K("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),K("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),K("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),K("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Og($){switch($){case"markdown":return kY;case"prompt":return iI;case"response":return xI;case"file":return qY;case"diff":return qY;case"mermaid":return XY;case"image":return hI;case"webpage":return PY;case"context":return lI;case"group":return pI;case"status":return oI;case"trace":return nI;case"ledger":return tI;case"mcp-app":return dI;case"ext-app":return aI;case"json-render":return sI;case"graph":return XY;case"html":return PY;default:return kY}}var AY={width:260,height:150},eI={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function yK($){return!!$&&$ in v6}function Y4($){if(!$)return null;let v=u.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function NK($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function Wg($){let v=typeof $.confidence!=="number"?0.82:0.4+Math.max(0,Math.min(1,$.confidence))*0.55;return $.auto?v*0.62:v}function MY($,v){let g=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+g} ${$.y}, ${v.x-g} ${v.y}, ${v.x} ${v.y}`}function RK({intent:$}){let v=yK($.nodeType)?Og($.nodeType):null,g=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return K("div",{class:"intent-info",onMouseEnter:()=>uU.value=$.id,onMouseLeave:()=>{if(uU.value===$.id)uU.value=null},children:[K("div",{class:"intent-chip",children:[typeof $.seq==="number"&&K("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),v&&K("span",{class:"intent-chip-icon","aria-hidden":"true",children:K(v,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{class:"intent-chip-label",children:g},void 0,!1,void 0,this),_&&K("span",{class:"intent-confidence",children:_},void 0,!1,void 0,this),$.phase==="forming"&&!$.auto&&K("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(U)=>{U.stopPropagation(),Kz($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&K("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SY({intent:$,rect:v}){let g=yK($.nodeType)?Og($.nodeType):null,_=yK($.nodeType)?v6[$.nodeType]:"Node";return K("div",{class:`intent-ghost intent-ghost-box is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:Wg($)},children:[K("div",{class:"intent-ghost-titlebar",children:[K("span",{class:"intent-ghost-icon","aria-hidden":"true",children:g?K(g,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),K("span",{class:"intent-ghost-badge",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(RK,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NY({intent:$,rect:v,variant:g}){return K("div",{class:`intent-ghost intent-ghost-${g} is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:Wg($)},children:[g==="edit"&&K("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),K(RK,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $Q($){let v=$.phase==="settling"?Y4($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let g=$.nodeType&&eI[$.nodeType]||AY,_=v??{left:$.position.x,top:$.position.y,...g};return K(SY,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=Y4($.nodeId)??AY,U=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return K(SY,{intent:$,rect:U},$.id,!1,void 0,this)}case"remove":{let g=v??Y4($.nodeId);if(!g)return null;return K(NY,{intent:$,rect:g,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let g=v??Y4($.nodeId);if(!g)return null;return K(NY,{intent:$,rect:g,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let g=Y4($.edge.from),_=Y4($.edge.to);if(!g||!_)return null;let U={x:(g.left+g.width/2+_.left+_.width/2)/2,y:(g.top+g.height/2+_.top+_.height/2)/2},z={left:U.x-110,top:U.y-18,width:220,height:36};return K("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:Wg($)},children:K(RK,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function yY(){let $=Array.from(B6.value.values());if(r(()=>{function v(g){if(g.key!=="Escape")return;let _=uU.value;if(!_)return;let U=B6.value.get(_);if(!U||U.phase!=="forming")return;g.stopImmediatePropagation(),g.preventDefault(),Kz(U)}return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]),$.length===0)return null;return K("div",{class:"intent-layer",children:[K("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[K("defs",{children:K("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:K("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((v)=>{if(v.kind==="connect"&&v.edge){let g=Y4(v.edge.from),_=Y4(v.edge.to);if(!g||!_)return null;return K("path",{d:MY(NK(g),NK(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:Wg(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let g=Y4(v.nodeId);if(!g)return null;let _=g,U={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return K("path",{d:MY(NK(g),U),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:Wg(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map($Q)]},void 0,!0,void 0,this)}function vQ($){let v=typeof $==="number"&&Number.isFinite($)?Math.floor($):1;return Math.max(1,Math.min(20,v))}function Q2($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function Bg($){return typeof $==="string"&&$.length>0}function RY($){let v=$.axStep;if(!Q2(v))return null;if(!Bg(v.flowId)||!Bg(v.workItemId))return null;if(typeof v.index!=="number"||typeof v.total!=="number")return null;return{flowId:v.flowId,index:v.index,total:v.total,workItemId:v.workItemId}}function DY($){let v=$.axFlow;if(!Q2(v)||!Bg(v.flowId)||!Array.isArray(v.steps))return null;let g=[];for(let U of v.steps){if(!Q2(U)||!Bg(U.nodeId)||!Bg(U.workItemId))return null;if(typeof U.index!=="number")return null;g.push({index:U.index,nodeId:U.nodeId,workItemId:U.workItemId,title:typeof U.title==="string"?U.title:""})}if(g.length===0)return null;let _=Q2(v.loop)?v.loop:{};return{flowId:v.flowId,title:typeof v.title==="string"?v.title:"Flow",steps:g,loop:{running:_.running===!0,run:typeof _.run==="number"&&Number.isFinite(_.run)?Math.max(0,Math.floor(_.run)):0,maxRuns:vQ(_.maxRuns)}}}var UQ={position:"sticky",bottom:"calc(-1 * var(--ax-dock-bleed, 12px))",marginTop:"12px",marginLeft:"calc(-1 * var(--ax-dock-bleed, 12px))",marginRight:"calc(-1 * var(--ax-dock-bleed, 12px))",marginBottom:"calc(-1 * var(--ax-dock-bleed, 12px))",padding:"9px var(--ax-dock-pad, 12px) 10px",background:"var(--c-panel-overlay)",borderTop:"1px solid var(--c-line)",backdropFilter:"blur(6px)"},jY={display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},uY={fontSize:"10px",color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginRight:"auto"},CY={...zv,background:"var(--c-accent-25)",color:"var(--c-text)"},gQ=[{status:"in-progress",label:"Start",toast:"Step started"},{status:"done",label:"Done",toast:"Step done"},{status:"blocked",label:"Blocked",toast:"Step blocked"}];async function TY($,v,g){let _={...v,loop:g};g$($.id,{axFlow:_}),await k6($.id,{data:{axFlow:_}})}function VY($){return typeof $?.axWorkStatus==="string"?$.axWorkStatus:"todo"}function _Q({node:$,flow:v}){let[g,_]=i(""),{running:U,run:z,maxRuns:J}=v.loop,G=async()=>{await TY($,v,{running:!0,run:z>=J?0:z,maxRuns:J});let O=v.steps.find((B)=>VY(u.value.get(B.nodeId)?.data)!=="done"),W=O??v.steps[v.steps.length-1];await S4($,"ax.work.update",{id:W.workItemId,status:O?"in-progress":"done"},"Loop running")},b=async()=>{let O=g.trim();if(!O)return;await S4($,"ax.steer",{message:O},"Steering sent"),_("")};return K("div",{class:"ax-flow-controls",style:{...jY,marginTop:"6px",rowGap:"4px"},children:[K("span",{class:"ax-flow-runs",style:uY,children:U?`Loop running · run ${z+1}/${J}`:`Loop idle · ${z}/${J} runs`},void 0,!1,void 0,this),U?K("button",{type:"button",class:"ax-node-action",style:CY,title:"Stop the loop now. The stop is persisted on this node, so it survives a refresh and no further step is opened.",onClick:(O)=>{O.stopPropagation(),TY($,v,{...v.loop,running:!1})},children:"Stop"},void 0,!1,void 0,this):K("button",{type:"button",class:"ax-node-action",style:zv,title:"Run this flow as a loop: each completed step opens the next one, and the last step starts the next run — until the run cap is reached or you press Stop.",onClick:(O)=>{O.stopPropagation(),G()},children:"Run loop"},void 0,!1,void 0,this),K("input",{class:"ax-flow-steer-input",value:g,placeholder:"Steer the agent…","aria-label":"Steer the agent",onInput:(O)=>_(O.target.value),onClick:(O)=>O.stopPropagation(),onKeyDown:(O)=>{if(O.key!=="Enter")return;O.stopPropagation(),b()},style:{flex:"1 1 120px",minWidth:"90px",fontSize:"10px",padding:"3px 6px",borderRadius:"4px",border:"1px solid var(--c-line)",background:"var(--c-panel-overlay)",color:"var(--c-text)"}},void 0,!1,void 0,this),K("button",{type:"button",class:"ax-node-action",style:zv,title:"Send a steering message to the agent working this flow.",onClick:(O)=>{O.stopPropagation(),b()},children:"Steer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function w2({node:$}){let v=RY($.data);if(!v)return null;let g=DY($.data),_=VY($.data);return K("div",{class:"ax-step-dock",style:UQ,children:[K("div",{class:"ax-step-controls",style:jY,children:[K("span",{class:"ax-step-position",style:uY,children:["Step ",v.index,"/",v.total]},void 0,!0,void 0,this),gQ.map((U)=>K("button",{type:"button",class:"ax-node-action","aria-pressed":_===U.status,style:_===U.status?CY:zv,title:`Set this step's work item to "${U.status}".`,onClick:(z)=>{z.stopPropagation(),S4($,"ax.work.update",{id:v.workItemId,status:U.status},U.toast)},children:U.label},U.status,!1,void 0,this))]},void 0,!0,void 0,this),g&&K(_Q,{node:$,flow:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var CU=8,Pv=B$(null),VU=[],fU=[],EY=null;function fY($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function rY($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function zQ($,v){let g=new Map(v.map((G)=>[G.id,G])),_=new Set([$]),U=g.get($);if(!U)return _;let z=fY(U);while(z&&!_.has(z))_.add(z),z=fY(g.get(z));if(U.type!=="group")return _;let J=[...rY(U)];while(J.length>0){let G=J.pop();if(!G||_.has(G))continue;_.add(G);let b=g.get(G);if(b?.type==="group")J.push(...rY(b))}return _}function mY($,v){VU=[],fU=[],EY=$;let g=Array.from(v),_=zQ($,g);for(let U of g){if(_.has(U.id)||U.dockPosition!==null)continue;let z=U.position.x,J=U.position.x+U.size.width,G=U.position.x+U.size.width/2,b=U.position.y,O=U.position.y+U.size.height,W=U.position.y+U.size.height/2;VU.push({val:z,minY:b,maxY:O}),VU.push({val:J,minY:b,maxY:O}),VU.push({val:G,minY:b,maxY:O}),fU.push({val:b,minX:z,maxX:J}),fU.push({val:O,minX:z,maxX:J}),fU.push({val:W,minX:z,maxX:J})}}function cY(){VU=[],fU=[],EY=null}function iY($,v,g,_){let U=[$,$+g/2,$+g],z=[v,v+_/2,v+_],J=[0,g/2,g],G=[0,_/2,_],b=null,O=CU+1,W=null;for(let X=0;X<3;X++){let H=U[X];for(let q of VU){let L=Math.abs(H-q.val);if(L<O)O=L,b=q.val-J[X],W={axis:"x",pos:q.val,from:Math.min(q.minY,v),to:Math.max(q.maxY,v+_)}}}let B=null,k=CU+1,Y=null;for(let X=0;X<3;X++){let H=z[X];for(let q of fU){let L=Math.abs(H-q.val);if(L<k)k=L,B=q.val-G[X],Y={axis:"y",pos:q.val,from:Math.min(q.minX,$),to:Math.max(q.maxX,$+g)}}}let F=[];if(W&&O<=CU)F.push(W);if(Y&&k<=CU)F.push(Y);return{x:b!==null&&O<=CU?b:$,y:B!==null&&k<=CU?B:v,guides:F}}function xY({nodeId:$,viewport:v,onMove:g,onDragEnd:_}){let U=D(!1),z=D({x:0,y:0}),J=D({x:0,y:0});return y((b,O,W)=>{b.stopPropagation(),b.preventDefault(),U.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:b.clientX,y:b.clientY},J.current={x:O,y:W};let B=null,k=null,Y=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let q=v.value.scale,L=(H.x-z.current.x)/q,I=(H.y-z.current.y)/q;g($,J.current.x+L,J.current.y+I)},F=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(Y)},X=()=>{if(k!==null)window.cancelAnimationFrame(k),Y();U.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",X),document.removeEventListener("pointercancel",X),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",X),document.addEventListener("pointercancel",X)},[$,v,g,_])}var JQ=200,GQ=100;function hY({nodeId:$,viewport:v,onResize:g,onResizeEnd:_}){let U=D(!1),z=D({x:0,y:0}),J=D({w:0,h:0});return y((b,O,W)=>{b.stopPropagation(),b.preventDefault(),U.current=!0,z.current={x:b.clientX,y:b.clientY},J.current={w:O,h:W},document.documentElement.classList.add("is-node-resizing");let B=null,k=null,Y=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let q=v.value.scale,L=(H.x-z.current.x)/q,I=(H.y-z.current.y)/q;g($,Math.max(JQ,J.current.w+L),Math.max(GQ,J.current.h+I))},F=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(Y)},X=()=>{if(k!==null)window.cancelAnimationFrame(k),Y();U.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",X),document.removeEventListener("pointercancel",X),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",X),document.addEventListener("pointercancel",X)},[$,v,g,_])}var KQ=0.4,bQ=0.55,OQ=175;function WQ($,v,g=0){if(!Number.isFinite($)||$>=1)return 1;let U=Math.min(2.2,1/Math.max($,0.01));if(Number.isFinite(v)&&v>0)U=Math.min(U,v*KQ/cv);if(Number.isFinite(g)&&g>0)U=Math.min(U,g*bQ/OQ);return Math.max(1,U)}function lY({node:$,children:v,onContextMenu:g}){let _=V$.value===$.id,U=p$.value.has($.id),z=f$.value.has($.id),J=Mv.value.has($.id),G=!J&&Sv.value.has($.id),b=rg.value.has($.id),O=!_&&$b.value.has($.id),W=Q4.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[Y,F]=i(!1),X=D(null),H=y((m,s,G$)=>{let k$=iY(s,G$,$.size.width,$.size.height),r$=u.value.get(m);if(r$?.position.x===k$.x&&r$.position.y===k$.y){Pv.value=k$.guides.length>0?k$.guides:null;return}q6(m,{position:{x:k$.x,y:k$.y}}),Pv.value=k$.guides.length>0?k$.guides:null},[$.size.width,$.size.height]),q=y(()=>{cY(),Pv.value=null,a$()},[]),L=xY({nodeId:$.id,viewport:X$,onMove:H,onDragEnd:q}),I=y((m,s,G$)=>{let k$=u.value.get(m);if(k$?.size.width===s&&k$.size.height===G$)return;q6(m,{size:{width:s,height:G$}})},[]),N=y(()=>{g$($.id,{userResized:!0}),k6($.id,{data:{userResized:!0}}),a$()},[$.id]),T=hY({nodeId:$.id,viewport:X$,onResize:I,onResizeEnd:N}),x=y((m)=>{if(Y)return;w4($.id),mY($.id,u.value.values()),L(m,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,L,Y]),S=y((m)=>{if(m.stopPropagation(),m.shiftKey){vb($.id);return}w4($.id)},[$.id]),l=y((m)=>{if(g)g(m,$.id)},[g,$.id]),t=y((m)=>{m.stopPropagation(),F(!0),requestAnimationFrame(()=>X.current?.focus())},[]),M=$.data.title||($.type==="file"?($.data.path||$.data.content||"").split(/[\\/]/).pop()??"":"")||v6[$.type],R=y((m)=>{let s=m.trim();if(s&&s!==M)g$($.id,{title:s}),k6($.id,{title:s});F(!1)},[$.id,M]),n=D(null),p=D(!1),c=D(null);r(()=>{if(p.current||!xz($))return;let m=n.current;if(!m)return;let s=new ResizeObserver(()=>{if(p.current){s.disconnect();return}let G$=m.scrollHeight,k$=HO($,G$);if(k$===null)return;if(Math.abs(k$-$.size.height)>8){if(jv($.id,{width:$.size.width,height:k$}),c.current!==null)window.clearTimeout(c.current);c.current=window.setTimeout(()=>{a$({recordHistory:!1}),c.current=null},0)}p.current=!0,s.disconnect()});return s.observe(m),()=>{if(s.disconnect(),c.current!==null)window.clearTimeout(c.current),c.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.dockPosition,$.size.width,$.size.height]);let a=$.pinned,J$=$.type==="trace",P$=J$&&$.data.status==="running",A=$.type==="group",E=$.data.strictSize===!0,_$=Math.max(X$.value.scale,0.01),$$=WQ(_$,$.collapsed?0:$.size.height,$.size.width),O$=A&&$.data.color?$.data.color:void 0,W$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":$$.toFixed(3),...O$?{"--group-color":O$}:{}},e=["canvas-node",_?"active":"",O?"neighbor":"",B?"search-match":"",k?"search-dimmed":"",U?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",G?"attention-focus-secondary":"",b?"attention-pulse":"",a?"pinned":"",J$?"trace-node":"",P$?"trace-running":"",A?"group-node":"",E?"strict-size":""].filter(Boolean).join(" ");return K("div",{class:e,style:W$,onPointerDown:S,onContextMenu:l,children:[K("div",{class:"node-titlebar",onPointerDown:x,children:[K("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let m=Og($.type);return K(m,{size:Math.round(14*$$)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),typeof $.data.axWorkStatus==="string"?K("span",{class:`node-ax-status node-ax-status-${$.data.axWorkStatus}`,children:$.data.axWorkStatus},void 0,!1,void 0,this):K("span",{class:"node-type-badge",children:v6[$.type]},void 0,!1,void 0,this),Y?K("input",{ref:X,class:"node-title-input",value:M,onBlur:(m)=>R(m.target.value),onKeyDown:(m)=>{if(m.key==="Enter")R(m.target.value);if(m.key==="Escape")F(!1)},onClick:(m)=>m.stopPropagation()},void 0,!1,void 0,this):K("span",{class:"node-title",onDblClick:t,title:`${M} — double-click to rename`,children:M},void 0,!1,void 0,this),K("div",{class:"node-controls",children:[a&&K("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),K("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(m)=>{m.stopPropagation(),Dv($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),F_($)&&K("button",{type:"button",onClick:(m)=>{m.stopPropagation(),Z_($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),xg.has($.type)&&K("button",{type:"button",onClick:(m)=>{m.stopPropagation(),J4($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),K("button",{type:"button",onClick:(m)=>{m.stopPropagation(),A4($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),K("button",{type:"button",onClick:(m)=>{m.stopPropagation(),Tv($.id),og($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&K("div",{ref:n,class:"node-body",children:[v,K(w2,{node:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&K("div",{class:"node-resize-handle",onPointerDown:(m)=>T(m,$.size.width,$.size.height)},void 0,!1,void 0,this),["top","right","bottom","left"].map((m)=>K("div",{class:`node-port node-port-${m}`,onPointerDown:(s)=>{s.stopPropagation(),s.preventDefault();let G$=$.position.x+$.size.width/2,k$=$.position.y+$.size.height/2,r$=$.size.width/2,v$=$.size.height/2,$6,b6;switch(m){case"top":$6=G$,b6=k$-v$;break;case"bottom":$6=G$,b6=k$+v$;break;case"left":$6=G$-r$,b6=k$;break;case"right":$6=G$+r$,b6=k$;break}T6.value={fromId:$.id,fromX:$6,fromY:b6,cursorX:$6,cursorY:b6}}},m,!1,void 0,this))]},void 0,!0,void 0,this)}var BQ={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-muted)"},YQ=new Set(["depends-on","flow"]);function kQ($){if(!Number.isFinite($)||$<=0)return 1;return $<1?1/$:1}function qQ($,v){let g=`${8*v} ${4*v}`;if($.style==="dashed")return g;if($.style==="dotted")return`${3*v} ${3*v}`;if($.type==="references"&&!$.style)return g;return}function pY($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=U-g,G=z-_,b=$.size.width/2,O=$.size.height/2,W=Math.abs(G/(J||0.001)),B=O/(b||0.001);if(W>B){let Y=G>0?1:-1;return{x:g+O/W*(J>0?1:-1),y:_+O*Y}}let k=J>0?1:-1;return{x:g+b*k,y:_+W*b*(G>0?1:-1)}}function PQ($,v,g,_,U,z,J,G){return{x:0.125*$+0.375*g+0.375*U+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*G}}function XQ({edge:$,fromNode:v,toNode:g,focused:_,dimmed:U,scale:z}){let J=pY(v,g),G=pY(g,v),b=G.x-J.x,O=G.y-J.y,W=Math.sqrt(b*b+O*O),B=Math.min(W*0.25,80),k=b/(W||1),Y=O/(W||1),F=J.x+k*B,X=J.y+Y*B,H=G.x-k*B,q=G.y-Y*B,L=`M ${J.x} ${J.y} C ${F} ${X}, ${H} ${q}, ${G.x} ${G.y}`,I=BQ[$.type],N=YQ.has($.type),T=qQ($,z),x=$.label?PQ(J.x,J.y,F,X,H,q,G.x,G.y):null,S=`edge-path-${$.id}`;return K("g",{children:[K("path",{d:L,fill:"none",stroke:"transparent","stroke-width":12*z,style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&K("path",{d:L,fill:"none",stroke:I,"stroke-width":6*z,"stroke-dasharray":T,opacity:"0.15",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),K("path",{id:S,d:L,fill:"none",stroke:I,"stroke-width":(_?2.5:1.5)*z,"stroke-dasharray":T,"marker-end":N?"url(#edge-arrow)":void 0,opacity:U?0.2:_?1:0.85,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&K("circle",{r:3*z,fill:I,opacity:"0.9",children:K("animateMotion",{dur:"2s",repeatCount:"indefinite",children:K("mpath",{href:`#${S}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),x&&$.label&&K("g",{transform:`translate(${x.x}, ${x.y})`,children:[K("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8)*z,y:-10*z,width:($.label.length*7+16)*z,height:20*z,rx:4*z},void 0,!1,void 0,this),K("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function oY({nodes:$,edges:v}){let g=$.value,_=Array.from(v.value.values()),U=V$.value,z=U!==null,J=Q4.value,G=J!==null,b=kQ(X$.value.scale);if(_.length===0)return null;let O=96,W=Array.from(g.values()),B=Math.min(...W.map((q)=>q.position.x))-O,k=Math.min(...W.map((q)=>q.position.y))-O,Y=Math.max(...W.map((q)=>q.position.x+q.size.width))+O,F=Math.max(...W.map((q)=>q.position.y+q.size.height))+O,X=Math.max(1,Y-B),H=Math.max(1,F-k);return K("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${B} ${k} ${X} ${H}`,width:X,height:H,style:{position:"absolute",top:`${k}px`,left:`${B}px`,pointerEvents:"none",overflow:"visible","--edge-chrome-scale":b.toFixed(3)},children:[K("title",{children:"Canvas connections"},void 0,!1,void 0,this),K("defs",{children:K("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:K("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((q)=>{let L=g.get(q.from),I=g.get(q.to);if(!L||!I)return null;let N=z&&(q.from===U||q.to===U),T=G&&!(J.has(q.from)||J.has(q.to));return K(XQ,{edge:q,fromNode:L,toNode:I,focused:N,dimmed:z&&!N||T,scale:b},q.id,!1,void 0,this)}),T6.value&&(()=>{let q=T6.value,L=q.cursorX-q.fromX,I=q.cursorY-q.fromY,N=Math.sqrt(L*L+I*I),T=Math.min(N*0.25,80),x=L/(N||1),S=I/(N||1),l=`M ${q.fromX} ${q.fromY} C ${q.fromX+x*T} ${q.fromY+S*T}, ${q.cursorX-x*T} ${q.cursorY-S*T}, ${q.cursorX} ${q.cursorY}`;return K("g",{children:[K("path",{d:l,fill:"none",stroke:"var(--c-accent)","stroke-width":6*b,opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),K("path",{d:l,fill:"none",stroke:"var(--c-accent)","stroke-width":2*b,"stroke-dasharray":`${6*b} ${4*b}`,opacity:"0.8"},void 0,!1,void 0,this),K("circle",{cx:q.cursorX,cy:q.cursorY,r:5*b,fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function HQ($){let[v,...g]=$;if(!v)return"";return g.reduce((_,U)=>`${_} L ${U.x} ${U.y}`,`M ${v.x} ${v.y}`)}function DK({annotations:$}){if($.length===0)return null;return K("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let g=v.color==="currentColor"?"var(--c-annotation)":v.color;if(v.type==="text"){let _=v.points[0];if(!_||!v.text)return null;return K("text",{x:_.x,y:_.y,fill:g,"font-size":v.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:v.text},v.id,!1,void 0,this)}return K("path",{d:HQ(v.points),fill:"none",stroke:g,"stroke-width":v.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},v.id,!1,void 0,this)})},void 0,!1,void 0,this)}var LQ=0.1,FQ=4,nY=1;function tY($){return Math.min(FQ,Math.max(LQ,$))}function dY({viewport:$,onViewportChange:v,onViewportCommit:g,disabled:_=!1}){let U=D(null),z=D(!1),J=D({x:0,y:0}),G=D(0),b=D(null),O=y((q)=>{if(b.current!==null)window.clearTimeout(b.current);b.current=window.setTimeout(()=>{b.current=null,g(q)},140)},[g]);function W(q){if(q.deltaMode!==0)return q.deltaX===0;return q.deltaX===0&&Number.isInteger(q.deltaY)&&Math.abs(q.deltaY)>=50}let B=y((q)=>{if(_)return;q.preventDefault();let L=$.value;if(q.ctrlKey||q.metaKey||W(q)){let I=U.current?.getBoundingClientRect();if(!I)return;let N=q.clientX-I.left,T=q.clientY-I.top,x=-q.deltaY*0.002,S=tY(L.scale*(1+x)),l=S/L.scale,t={x:N-l*(N-L.x),y:T-l*(T-L.y),scale:S};v(t),O(t)}else{let I={x:L.x-q.deltaX*nY,y:L.y-q.deltaY*nY,scale:L.scale};v(I),O(I)}},[_,$,v,O]),k=y((q)=>{if(_)return;let L=U.current;if(!L||q.target!==L)return;z.current=!0,J.current={x:q.clientX,y:q.clientY},L.setPointerCapture(q.pointerId)},[_]),Y=y((q)=>{if(!z.current)return;if(_)return;let L=q.clientX-J.current.x,I=q.clientY-J.current.y;J.current={x:q.clientX,y:q.clientY};let N=$.value;v({x:N.x+L,y:N.y+I,scale:N.scale})},[_,$,v]),F=y(()=>{if(z.current)g($.value);z.current=!1},[g,$]),X=y((q)=>{if(_)return;if(q.touches.length!==2){G.current=0;return}q.preventDefault();let L=q.touches[0],I=q.touches[1],N=Math.hypot(I.clientX-L.clientX,I.clientY-L.clientY),T=(L.clientX+I.clientX)/2,x=(L.clientY+I.clientY)/2;if(G.current>0){let S=$.value,l=U.current?.getBoundingClientRect();if(!l)return;let t=T-l.left,M=x-l.top,R=N/G.current,n=tY(S.scale*R),p=n/S.scale,c={x:t-p*(t-S.x),y:M-p*(M-S.y),scale:n};v(c),O(c)}G.current=N},[_,$,v,O]),H=y(()=>{if(b.current!==null)window.clearTimeout(b.current),b.current=null;g($.value),G.current=0},[g,$]);return r(()=>{let q=U.current;if(!q)return;return q.addEventListener("wheel",B,{passive:!1}),q.addEventListener("pointerdown",k),q.addEventListener("pointermove",Y),q.addEventListener("pointerup",F),q.addEventListener("pointercancel",F),q.addEventListener("touchmove",X,{passive:!1}),q.addEventListener("touchend",H),()=>{if(b.current!==null)window.clearTimeout(b.current);q.removeEventListener("wheel",B),q.removeEventListener("pointerdown",k),q.removeEventListener("pointermove",Y),q.removeEventListener("pointerup",F),q.removeEventListener("pointercancel",F),q.removeEventListener("touchmove",X),q.removeEventListener("touchend",H)}},[B,k,Y,F,X,H]),U}function ZQ($){switch($.type){case"markdown":return K(P_,{node:$},void 0,!1,void 0,this);case"mcp-app":return K(x4,{node:$},void 0,!1,void 0,this);case"webpage":return K(H2,{node:$},void 0,!1,void 0,this);case"json-render":return K(x4,{node:$},void 0,!1,void 0,this);case"graph":return K(x4,{node:$},void 0,!1,void 0,this);case"prompt":return K(L2,{node:$},void 0,!1,void 0,this);case"response":return K(F2,{node:$},void 0,!1,void 0,this);case"status":return K(DU,{node:$},void 0,!1,void 0,this);case"context":return K(Jv,{node:$},void 0,!1,void 0,this);case"ledger":return K(Ev,{node:$},void 0,!1,void 0,this);case"trace":return K(Z2,{node:$},void 0,!1,void 0,this);case"file":return K(O_,{node:$},void 0,!1,void 0,this);case"diff":return K(K_,{node:$},void 0,!1,void 0,this);case"mermaid":return K(I_,{node:$},void 0,!1,void 0,this);case"image":return K(X2,{node:$},void 0,!1,void 0,this);case"html":return K(Kg,{node:$},void 0,!1,void 0,this);case"group":return K(vY,{node:$},void 0,!1,void 0,this);default:return K("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function IQ($,v,g){let _=g.x-v.x,U=g.y-v.y,z=_*_+U*U;if(z===0)return Math.hypot($.x-v.x,$.y-v.y);let J=Math.max(0,Math.min(1,(($.x-v.x)*_+($.y-v.y)*U)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*U))}function QQ($,v,g){for(let _=$.length-1;_>=0;_--){let U=$[_];if(!U)continue;let z=g+U.width;if(v.x<U.bounds.x-z||v.x>U.bounds.x+U.bounds.width+z||v.y<U.bounds.y-z||v.y>U.bounds.y+U.bounds.height+z)continue;if(U.type==="text")return U;for(let J=1;J<U.points.length;J++){let G=U.points[J-1],b=U.points[J];if(G&&b&&IQ(v,G,b)<=g+U.width/2)return U}}return null}var TK="currentColor",aY=4,sY=24,wQ=14,AQ=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),MQ=new Set(["md","mdx","markdown"]),eY={width:520,height:420};function SQ($){let v=$.trim();if(!v||/\s/.test(v))return null;let g=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(g);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function jK($){let v=$.trim();if(!v)return[];let g=v.includes(`
253
- `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,U=[];for(let z of g){let J=z.trim();if(!J||J.startsWith("#"))continue;let G=SQ(J);if(!G||_.has(G))continue;_.add(G),U.push(G)}return U}function NQ($){let v=jK($.getData("text/uri-list"));if(v.length>0)return v;return jK($.getData("text/plain"))}function yQ($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function $k($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function RQ($){let v=$.split(".").pop()?.toLowerCase()??"";if(AQ.has(v))return"image";if(MQ.has(v))return"markdown";return"file"}function DQ($,v){let g=[],_=0;for(let U of $){if(U.dockPosition!==null)continue;if(v&&U.id===v)continue;if(U.type==="group")g.splice(_++,0,U);else g.push(U)}return g}function vk({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:g=!1,annotationTool:_=null}){let U=X$.value,z=D(!1),J=D(!1),G=D([]),[b,O]=i(null),[W,B]=i(null),[k,Y]=i(null),F=D(null),[X,H]=i(!1),q=D(0),L=D(null),I=dY({viewport:X$,disabled:g,onViewportChange:(A)=>{if(z.current||g)return;Cv(),Ob(A)},onViewportCommit:(A)=>{if(z.current||g)return;Cv(),Bb(A)}}),N=y((A)=>{F.current=A,Y(A)},[]),T=y(async(A,E,_$)=>{if(A.length===0)return;let{width:$$,height:O$}=eY,W$=24,e=Math.ceil(Math.sqrt(A.length)),m=Math.ceil(A.length/e),s=e*$$+Math.max(0,e-1)*W$,G$=m*O$+Math.max(0,m-1)*W$;for(let k$=0;k$<A.length;k$++){let r$=k$%e,v$=Math.floor(k$/e),$6=E-s/2+r$*($$+W$),b6=_$-G$/2+v$*(O$+W$);await l6({type:"webpage",content:A[k$],x:$6,y:b6,width:$$,height:O$})}},[]),x=y((A)=>{let E=I.current;if(!E)return;if(_==="eraser"){if((A.target instanceof Element?A.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;A.preventDefault(),A.stopPropagation();let m=E.getBoundingClientRect(),s=X$.value,G$={x:(A.clientX-m.left-s.x)/s.scale,y:(A.clientY-m.top-s.y)/s.scale},k$=QQ(Array.from(Rv.value.values()),G$,wQ/s.scale);if(k$)Kb(k$.id);return}if(_==="text"){if((A.target instanceof Element?A.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;A.preventDefault(),A.stopPropagation(),V$.value=null,E6();let m=E.getBoundingClientRect(),s=X$.value;N({x:(A.clientX-m.left-s.x)/s.scale,y:(A.clientY-m.top-s.y)/s.scale,value:""});return}if(_==="pen"){if((A.target instanceof Element?A.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;A.preventDefault(),A.stopPropagation(),V$.value=null,E6(),J.current=!0;let m=E.getBoundingClientRect(),s=X$.value,G$={x:(A.clientX-m.left-s.x)/s.scale,y:(A.clientY-m.top-s.y)/s.scale};G.current=[G$],B({id:"draft-annotation",type:"freehand",points:[G$],bounds:{x:0,y:0,width:0,height:0},color:TK,width:aY,createdAt:""}),E.setPointerCapture(A.pointerId);return}if(A.target!==E)return;if(!A.shiftKey){if(!L.current)V$.value=null,E6();return}A.preventDefault(),A.stopPropagation(),z.current=!0;let _$=E.getBoundingClientRect(),$$=A.clientX-_$.left,O$=A.clientY-_$.top,W$={startX:$$,startY:O$,currentX:$$,currentY:O$};L.current=W$,O(W$),E.setPointerCapture(A.pointerId)},[_,I]),S=y((A)=>{if(J.current){let $$=I.current;if(!$$)return;let O$=$$.getBoundingClientRect(),W$=X$.value,e={x:(A.clientX-O$.left-W$.x)/W$.scale,y:(A.clientY-O$.top-W$.y)/W$.scale},m=G.current.at(-1);if(m&&Math.hypot(e.x-m.x,e.y-m.y)<2)return;G.current=[...G.current,e],B((s)=>s?{...s,points:G.current}:null);return}if(!z.current||!L.current)return;let E=I.current?.getBoundingClientRect();if(!E)return;let _$={...L.current,currentX:A.clientX-E.left,currentY:A.clientY-E.top};L.current=_$,O(_$)},[I]),l=y((A)=>{if(J.current){J.current=!1;let e=G.current;if(G.current=[],B(null),e.length>=2)Wz({points:e,color:TK,width:aY});let m=I.current;if(m?.hasPointerCapture(A.pointerId))m.releasePointerCapture(A.pointerId);return}let E=L.current;if(!z.current||!E)return;z.current=!1,L.current=null;let _$=Math.min(E.startX,E.currentX),$$=Math.max(E.startX,E.currentX),O$=Math.min(E.startY,E.currentY),W$=Math.max(E.startY,E.currentY);if($$-_$>5||W$-O$>5){let e=X$.value,m=(_$-e.x)/e.scale,s=($$-e.x)/e.scale,G$=(O$-e.y)/e.scale,k$=(W$-e.y)/e.scale,r$=[];for(let v$ of u.value.values()){if(v$.dockPosition!==null)continue;let $6=v$.position.x,b6=v$.position.y;if($6+v$.size.width>m&&$6<s&&b6+v$.size.height>G$&&b6<k$)r$.push(v$.id)}if(r$.length>0)Ub(r$)}O(null)},[]);r(()=>{if(g)return;if(!J.current&&!W&&!k)return;J.current=!1,G.current=[],B(null),N(null)},[g,W,N,k]);let t=y(()=>{let A=F.current;if(!A)return;let E=A.value.trim();if(N(null),!E)return;let _$={x:A.x,y:A.y};Wz({type:"text",points:[_$],color:TK,width:sY,text:E})},[N]);r(()=>{if(_!=="text"&&k)N(null)},[_,N,k]),r(()=>{function A(_$){if(!T6.value)return;let $$=I.current;if(!$$)return;let O$=$$.getBoundingClientRect(),W$=X$.value;T6.value={...T6.value,cursorX:(_$.clientX-O$.left-W$.x)/W$.scale,cursorY:(_$.clientY-O$.top-W$.y)/W$.scale}}function E(_$){let $$=T6.value;if(!$$)return;T6.value=null;let O$=I.current;if(!O$)return;let W$=O$.getBoundingClientRect(),e=X$.value,m=(_$.clientX-W$.left-e.x)/e.scale,s=(_$.clientY-W$.top-e.y)/e.scale;for(let G$ of u.value.values()){if(G$.id===$$.fromId||G$.dockPosition!==null)continue;if(m>=G$.position.x&&m<=G$.position.x+G$.size.width&&s>=G$.position.y&&s<=G$.position.y+G$.size.height){Nv($$.fromId,G$.id,"relation");return}}}return document.addEventListener("pointermove",A),document.addEventListener("pointerup",E),()=>{document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",E)}},[I]);let M=y((A)=>{if(g)return;let E=I.current;if(!E||A.target!==E)return;let _$=E.getBoundingClientRect(),$$=X$.value,O$=(A.clientX-_$.left-$$.x)/$$.scale,W$=(A.clientY-_$.top-$$.y)/$$.scale,e=520,m=360;l6({type:"markdown",title:"New note",x:O$-e/2,y:W$-m/2,width:e,height:m})},[g,I]),R=y((A)=>{if(g)return;if(!v)return;let E=I.current;if(!E)return;if((A.target instanceof Element?A.target:null)?.closest(".canvas-node"))return;let $$=E.getBoundingClientRect(),O$=X$.value,W$=(A.clientX-$$.left-O$.x)/O$.scale,e=(A.clientY-$$.top-O$.y)/O$.scale;v(A,W$,e)},[g,I,v]),n=y((A)=>{if(A.preventDefault(),q.current++,A.dataTransfer?.types.includes("Files")||yQ(A.dataTransfer))H(!0)},[]),p=y((A)=>{if(A.preventDefault(),A.dataTransfer)A.dataTransfer.dropEffect="copy"},[]),c=y((A)=>{if(A.preventDefault(),q.current--,q.current<=0)q.current=0,H(!1)},[]),a=y(async(A)=>{A.preventDefault(),H(!1),q.current=0;let E=I.current;if(!E||!A.dataTransfer)return;let _$=E.getBoundingClientRect(),$$=X$.value,O$=(A.clientX-_$.left-$$.x)/$$.scale,W$=(A.clientY-_$.top-$$.y)/$$.scale,e=Array.from(A.dataTransfer.files);if(e.length===0){let r$=NQ(A.dataTransfer);await T(r$,O$,W$);return}let m=400,s=300,G$=20,k$=Math.ceil(Math.sqrt(e.length));for(let r$=0;r$<e.length;r$++){let v$=e[r$],$6=r$%k$,b6=Math.floor(r$/k$),u2=O$-k$*(m+G$)/2+$6*(m+G$),xU=W$-s/2+b6*(s+G$),r6=RQ(v$.name),Xg=v$.name;if(r6==="image"){let t4=new FileReader,h6=await new Promise((C2)=>{t4.onload=()=>C2(t4.result),t4.readAsDataURL(v$)});await l6({type:"image",title:Xg,content:h6,x:u2,y:xU,width:m,height:s})}else{let t4=await v$.text(),h6=r6==="markdown"||r6==="file";await l6({type:r6,title:Xg,content:t4,x:u2,y:xU,width:h6?720:m,height:h6?500:s})}}},[I,T]);r(()=>{let A=async(E)=>{if(E.defaultPrevented)return;if($k(E.target instanceof Element?E.target:null))return;if($k(document.activeElement))return;let _$=E.clipboardData?.getData("text/plain")??"",$$=jK(_$);if($$.length===0)return;let O$=I.current;if(!O$)return;E.preventDefault();let W$=O$.getBoundingClientRect(),e=X$.value,m=(W$.width/2-e.x)/e.scale,s=(W$.height/2-e.y)/e.scale;await T($$,m,s)};return document.addEventListener("paste",A),()=>{document.removeEventListener("paste",A)}},[I,T]);let J$=DQ(u.value.values(),m$.value),P$=null;if(b){let A=Math.min(b.startX,b.currentX),E=Math.min(b.startY,b.currentY),_$=Math.abs(b.currentX-b.startX),$$=Math.abs(b.currentY-b.startY);P$={position:"absolute",left:`${A}px`,top:`${E}px`,width:`${_$}px`,height:`${$$}px`,pointerEvents:"none"}}return K("div",{class:"canvas-viewport",ref:I,tabIndex:0,onPointerDown:x,onPointerMove:S,onPointerUp:l,onContextMenu:R,onDblClick:M,onDragEnter:n,onDragOver:p,onDragLeave:c,onDrop:a,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":g||T6.value||z.current?"crosshair":"grab"},children:[K("div",{style:{transform:`matrix(${U.scale}, 0, 0, ${U.scale}, ${U.x}, ${U.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[K(bY,{},void 0,!1,void 0,this),K(yY,{},void 0,!1,void 0,this),K(oY,{nodes:u,edges:h$},void 0,!1,void 0,this),K(DK,{annotations:Array.from(Rv.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&K(DK,{annotations:[W]},void 0,!1,void 0,this),J$.map((A)=>K(lY,{node:A,onContextMenu:$,children:ZQ(A)},A.id,!1,void 0,this)),Pv.value&&K("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:Pv.value.map((A,E)=>A.axis==="x"?K("line",{x1:A.pos,y1:A.from-20,x2:A.pos,y2:A.to+20,class:"snap-guide-line"},E,!1,void 0,this):K("line",{x1:A.from-20,y1:A.pos,x2:A.to+20,y2:A.pos,class:"snap-guide-line"},E,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&K("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),k&&K("input",{class:"annotation-text-input",value:k.value,autoFocus:!0,style:{left:`${k.x*U.scale+U.x}px`,top:`${k.y*U.scale+U.y}px`,fontSize:`${sY*U.scale}px`},onInput:(A)=>N({...k,value:A.target.value}),onBlur:t,onPointerDown:(A)=>A.stopPropagation(),onKeyDown:(A)=>{if(A.key==="Enter")A.preventDefault(),t();if(A.key==="Escape")A.preventDefault(),N(null)}},void 0,!1,void 0,this),P$&&K("div",{class:"lasso-rect",style:P$},void 0,!1,void 0,this),X&&K("div",{class:"drop-zone-overlay",children:K("div",{class:"drop-zone-indicator",children:[K("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),K("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var A2=!1,Uk=!1,Xv=null,rU=null;function uK(){return A2}function M2(){A2=!1,Uk=!0,gk()}function gk(){if(Xv&&rU)Xv.removeEventListener("change",rU);Xv=null,rU=null}function TQ(){if(typeof window>"u"||!window.location)return null;let $=new URLSearchParams(window.location.search).get("theme");if($==="auto")return"auto";return z1($)?$:null}function _k($){if(Uk)return;let v=TQ();if(!v)return;if(gk(),A2=!0,v!=="auto"){$(v);return}Xv=window.matchMedia("(prefers-color-scheme: light)"),rU=()=>{if(A2&&Xv)$(Xv.matches?"light":"dark")},rU(),Xv.addEventListener("change",rU)}function jQ($,v){let g=$.toLowerCase(),_=v.toLowerCase(),U=[],z=0,J=0,G=-1;for(let b=0;b<_.length&&z<g.length;b++)if(_[b]===g[z]){if(U.push(b),J+=G===b-1?10:1,b===0||_[b-1]===" "||_[b-1]==="-"||_[b-1]==="_")J+=5;G=b,z++}return{match:z===g.length,score:J,indices:U}}function uQ($,v){if(v.length===0)return $;let g=[],_=0;for(let U of v){if(U>_)g.push($.slice(_,U));g.push(K("mark",{children:$[U]},U,!1,void 0,this)),_=U+1}if(_<$.length)g.push($.slice(_));return g}var CK={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function CQ($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let g=v.slice(5).trim(),U=Object.keys(v6).find((J)=>J.startsWith(g));if(U)return{typeFilter:U,remaining:""};let z=CK[g];if(z)return{typeFilter:z,remaining:""}}if(CK[v])return{typeFilter:CK[v],remaining:""};return{typeFilter:null,remaining:$}}function zk({onClose:$,onToggleMinimap:v}){let[g,_]=i(""),[U,z]=i(0),J=D(null),G=D(null);r(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let b=y(()=>{let X=[];for(let q of u.value.values()){let L=q.data.title||v6[q.type],I=q.data.content||q.data.path||"";X.push({id:`node:${q.id}`,kind:"node",label:L,description:I.length>80?I.slice(0,80)+"...":I||void 0,badge:v6[q.type],nodeType:q.type,action:()=>{F6(q.id),$()}})}let H=[{label:"New note (markdown node)",badge:"CREATE",action:()=>{l6({type:"markdown",title:"New note",width:520,height:360}),$()}},{label:"Fit all nodes",badge:"VIEW",action:()=>{g_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{sU(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{eU(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let q=c$.value==="dark"?"light":"dark";M2(),document.documentElement.setAttribute("data-theme",q),RU(),c$.value=q,lg(q),$()}}];for(let q of H)X.push({id:`action:${q.label}`,kind:"action",label:q.label,badge:q.badge,badgeClass:"command-palette-badge--action",action:q.action});return X},[$,v]),{typeFilter:O,remaining:W}=CQ(g),B=b(),k;if(!g.trim())k=B.map((X)=>({...X,score:0,indices:[]}));else{k=[];for(let X of B){if(O){if(X.kind!=="node"||X.nodeType!==O)continue;if(!W){k.push({...X,score:0,indices:[]});continue}}let H=jQ(W||g,X.label);if(H.match)k.push({...X,score:H.score,indices:H.indices})}k.sort((X,H)=>H.score-X.score)}r(()=>{if(!g.trim()){Q4.value=null;return}let X=new Set;for(let H of k)if(H.kind==="node")X.add(H.id.slice(5));Q4.value=X.size>0?X:null},[g,k]),r(()=>{return()=>{Q4.value=null}},[]);let Y=Math.min(U,Math.max(0,k.length-1)),F=y((X)=>{if(X.key==="ArrowDown")X.preventDefault(),z((H)=>Math.min(H+1,k.length-1));else if(X.key==="ArrowUp")X.preventDefault(),z((H)=>Math.max(H-1,0));else if(X.key==="Enter"){if(X.preventDefault(),k[Y])k[Y].action()}else if(X.key==="Escape")X.preventDefault(),X.stopPropagation(),$()},[k,Y,$]);return r(()=>{let X=G.current;if(!X)return;X.children[Y]?.scrollIntoView({block:"nearest"})},[Y]),r(()=>{z(0)},[g]),K("div",{class:"command-palette-backdrop",onMouseDown:$,children:K("div",{class:"command-palette",onMouseDown:(X)=>X.stopPropagation(),children:[K("input",{ref:J,type:"text",class:"command-palette-input",value:g,onInput:(X)=>_(X.target.value),onKeyDown:F,placeholder:`Search nodes and actions... (${S6}+K)`},void 0,!1,void 0,this),K("div",{class:"command-palette-hint",children:[K("span",{children:[K("kbd",{children:"↑"},void 0,!1,void 0,this),K("kbd",{children:"↓"},void 0,!1,void 0,this)," navigate"]},void 0,!0,void 0,this),K("span",{children:[K("kbd",{children:"↵"},void 0,!1,void 0,this)," select"]},void 0,!0,void 0,this),K("span",{children:[K("kbd",{children:"esc"},void 0,!1,void 0,this)," close"]},void 0,!0,void 0,this),K("span",{children:[K("kbd",{children:"type:"},void 0,!1,void 0,this)," filter by type"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"command-palette-results",ref:G,children:[k.length===0&&K("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),k.map((X,H)=>K("button",{type:"button",class:`command-palette-item${H===Y?" selected":""}`,onMouseEnter:()=>z(H),onClick:()=>X.action(),children:[K("span",{class:`command-palette-badge${X.badgeClass?` ${X.badgeClass}`:""}`,children:X.badge},void 0,!1,void 0,this),K("span",{class:"command-palette-label",children:X.indices.length>0?uQ(X.label,X.indices):X.label},void 0,!1,void 0,this),X.description&&K("span",{class:"command-palette-desc",children:X.description},void 0,!1,void 0,this)]},X.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Jk(){let[$,v]=i(null),g=y((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=y((z,J,G)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:G})},[]),U=y(()=>v(null),[]);return r(()=>{if(!$)return;let z=()=>v(null),J=(G)=>{if(G.key==="Escape")v(null)};return document.addEventListener("click",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("click",z),document.removeEventListener("keydown",J)}},[$]),{menu:$,openNodeMenu:g,openCanvasMenu:_,closeMenu:U}}var VQ="#4bbcFF",fQ=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function Gk({menu:$,onClose:v}){let g;if($.kind==="node"){let G=u.value.get($.nodeId);if(!G)return null;g=xQ(G)}else g=iQ($.canvasX,$.canvasY);let _=new Map,U=g.some((G)=>G.render)?g.length*32+168:g.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-U));return K("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${J}px`,zIndex:1e4},onPointerDown:(G)=>G.stopPropagation(),onClick:(G)=>G.stopPropagation(),children:g.map((G)=>{let b=G.separator?"separator":G.render?"custom":`${G.label??"item"}:${G.shortcut??""}`,O=(_.get(b)??0)+1;_.set(b,O);let W=`${b}:${O}`;if(G.separator)return K("div",{class:"context-menu-separator"},W,!1,void 0,this);if(G.render)return K("div",{class:"context-menu-custom",children:G.render(v)},W,!1,void 0,this);return K("button",{type:"button",class:"context-menu-item",onClick:()=>{G.action?.(),v()},children:[K("span",{class:"context-menu-label",children:G.label},void 0,!1,void 0,this),G.shortcut&&K("span",{class:"context-menu-shortcut",children:G.shortcut},void 0,!1,void 0,this)]},W,!0,void 0,this)})},void 0,!1,void 0,this)}function rQ($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function S2($){let v=$.trim().toLowerCase(),g=v.match(/^#([0-9a-f]{3})$/);if(g){let[_,U,z]=g[1].split("");return`#${_}${_}${U}${U}${z}${z}`}return v}function Kk($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return S2($.data.color)}function EQ($){let v=Kk($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:S2(VQ)}function VK($,v){let g=v?S2(v):null;q6($.id,{data:{...$.data,color:g}}),k6($.id,{data:{color:g}})}function mQ($,v){let g=Kk($);return K("div",{class:"context-menu-section",children:[K("div",{class:"context-menu-section-header",children:[K("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),K("button",{type:"button",class:"context-menu-reset",onClick:()=>{VK($,null),v()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"context-menu-color-grid",children:fQ.map((_)=>{let U=S2(_.value);return K("button",{type:"button",class:`context-menu-color-swatch${g===U?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{VK($,_.value),v()},children:[K("span",{class:"context-menu-color-dot",style:{"--swatch-color":_.value}},void 0,!1,void 0,this),K("span",{children:_.label},void 0,!1,void 0,this)]},_.value,!0,void 0,this)})},void 0,!1,void 0,this),K("label",{class:"context-menu-color-custom",children:[K("span",{children:"Custom"},void 0,!1,void 0,this),K("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:EQ($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{VK($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function rK($,v,g,_){return{x:$-g/2,y:v-_/2}}function cQ($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function fK($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let g=v.trim();if(!g)return;let _=rK($.canvasX,$.canvasY,$.width,$.height);if(!(await l6({type:$.type,...$.type!=="webpage"?{title:cQ(g,$.titleFallback)}:{},content:g,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function iQ($,v){return[{label:"New note",action:()=>{let U=rK($,v,520,360);l6({type:"markdown",title:"New note",x:U.x,y:U.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{fK({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:v,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{fK({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:v,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{fK({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:v,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let U=rK($,v,600,400);dg({title:"Group",x:U.x,y:U.y,width:600,height:400})}}]}function xQ($){let v=[],g=rQ($);if(v.push({label:"Focus",action:()=>F6($.id)}),xg.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>J4($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>A4($.id)});let _=f$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>Dv($.id)}),v.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let J=!$.pinned;q6($.id,{pinned:J}),k6($.id,{pinned:J}),a$()}});let U=eg.value;if(U&&U.from!==$.id){let J=u.value.get(U.from),G=J?(J.data.title||J.id).slice(0,20):U.from;v.push({label:`Connect from "${G}"`,action:()=>{Nv(U.from,$.id,"relation"),eg.value=null}})}v.push({label:U?"Connect from here (replace)":"Connect from here",action:()=>{eg.value={from:$.id}}});let z=Array.from(h$.value.values()).filter((J)=>J.from===$.id||J.to===$.id).length;if(z>0)v.push({label:`${z} edge${z!==1?"s":""} connected`});if(v.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&g)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(g)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(g)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let J=$.data.chartConfig.title||"chart";v.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let J=$.data.url;if(v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank")}}),v.push({label:"Focus in TUI",action:()=>V7("mcp-app-focus",{url:J})}),$.type==="json-render"||$.type==="graph")v.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let J=typeof $.data.url==="string"?$.data.url:"";v.push({label:"Refresh webpage",action:()=>{pg($.id)}}),v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank","noopener")}}),v.push({label:"Copy URL",action:()=>{if(J)navigator.clipboard.writeText(J)}})}if($.type==="group"){let J=$.data.children??[];if(v.push({separator:!0}),v.push({render:(G)=>mQ($,G)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>l7($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>uv($.id)});else v.push({label:"Dock left of toolbar",action:()=>Bz($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>Bz($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{Tv($.id),og($.id)}}),v}function bk(){let $=f$.value.size;if($===0||L4.value||U_.value)return null;return K("div",{class:"context-pin-bar",children:[K("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),K("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:_b,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ok({node:$}){let v=bK($),g=$.data.activeTool,_=$.data.subagent,U=P2[v]??"var(--c-muted)";return K("span",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1,minWidth:0},children:[K("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:U,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),K("span",{style:{color:U,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),g&&K("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",g]},void 0,!0,void 0,this),_&&_.state!=="completed"&&K("span",{style:{color:"var(--c-subagent)",fontSize:"10px"},children:["⠉ ",_.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function hQ($){switch($.type){case"status":return K(DU,{node:$},void 0,!1,void 0,this);case"ledger":return K(Ev,{node:$},void 0,!1,void 0,this);case"context":return K(Jv,{node:$},void 0,!1,void 0,this);default:return null}}function lQ($){let v=Array.isArray($.data.cards)?$.data.cards:[],g=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+g.length}function pQ({node:$}){let v=Jb(),g=v.length>0?v.length:lQ($),_=g>0,U=$.collapsed===!0,z=()=>{mg(),A4($.id)};if(U)return K("div",{class:"docked-node docked-node--collapsed","data-docked-node":"true",children:K("div",{class:"docked-node-header",children:[K("span",{class:"node-type-badge",children:"Context"},void 0,!1,void 0,this),_&&K("span",{class:"docked-node-count","aria-hidden":"true",children:g>99?"99+":g},void 0,!1,void 0,this),K("div",{class:"docked-node-controls",children:[K("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${g} item${g===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${g} item${g===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),K("button",{type:"button",onClick:(J)=>{J.stopPropagation(),uv($.id)},title:"Undock to canvas","aria-label":"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return K("aside",{class:"context-dock-panel","data-docked-node":"true","aria-label":"Agent context",children:[K("div",{class:"context-dock-header",children:[K("div",{class:"context-dock-header-text",children:[K("span",{class:"context-dock-title",children:"Context"},void 0,!1,void 0,this),K("span",{class:"context-dock-subtitle",children:_?`${g} item${g===1?"":"s"} in agent context`:"Active agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"context-dock-controls",children:[K("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),uv($.id)},"aria-label":"Undock to canvas",title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this),K("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),A4($.id)},"aria-label":"Collapse context panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"context-dock-body",children:K(Jv,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EK({node:$}){if($.type==="context")return K(pQ,{node:$},void 0,!1,void 0,this);return K("div",{class:`docked-node${$.collapsed?" docked-node--collapsed":""}`,"data-docked-node":"true",children:[K("div",{class:"docked-node-header",children:[K("span",{class:"node-type-badge",children:v6[$.type]??$.type},void 0,!1,void 0,this),$.type==="status"&&$.collapsed&&K(Ok,{node:$},void 0,!1,void 0,this),K("div",{class:"docked-node-controls",children:[K("button",{type:"button",onClick:(v)=>{v.stopPropagation(),A4($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),K("button",{type:"button",onClick:(v)=>{v.stopPropagation(),uv($.id)},title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&K("div",{class:"docked-node-body",children:hQ($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Wk($,v){switch($.type){case"markdown":return K(P_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return K(x4,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return K(H2,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return K(x4,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return K(x4,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return K(L2,{node:$},void 0,!1,void 0,this);case"response":return K(F2,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return K(DU,{node:$},void 0,!1,void 0,this);case"context":return K(Jv,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return K(Ev,{node:$},void 0,!1,void 0,this);case"trace":return K(Z2,{node:$},void 0,!1,void 0,this);case"file":return K(O_,{node:$,expanded:v},void 0,!1,void 0,this);case"diff":return K(K_,{node:$},void 0,!1,void 0,this);case"mermaid":return K(I_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return K(X2,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return K(Kg,{node:$,expanded:v},void 0,!1,void 0,this);default:return K("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function Bk($){switch($.type){case"markdown":return $.data.content||"";case"diff":return $.data.content||"";case"mermaid":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function oQ($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function nQ($,v){return $!==null&&typeof $==="object"&&$.source===j6&&$.type==="presentation-exit"&&$.token===v}function tQ($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function Yk($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function kk(){let $=m$.value,v=$?u.value.get($):void 0,[g,_]=i(!1),[U,z]=i(!1),[J,G]=i(""),b=D(null),O=D(null),W=y(()=>{z(!1),_v()},[]),B=y(()=>{G(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=y((M)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:j6,token:J,...M},"*")},[J]),Y=y(()=>{z(!1)},[]),F=y((M)=>{if(M.key==="Escape"){M.preventDefault(),M.stopPropagation(),z(!1);return}if(M.key==="Tab"&&!Yk(M.target)){M.preventDefault(),M.stopPropagation(),O.current?.focus();return}if((M.key===" "||M.key==="Enter")&&Yk(M.target))return;if(!tQ(M.key))return;M.preventDefault(),M.stopPropagation(),k({type:"presentation-key",key:M.key})},[k]),X=y((M)=>{if(M.target.classList.contains("expanded-overlay-backdrop"))_v()},[]),H=y(()=>{if(!v)return;let M=Bk(v);if(!M)return;navigator.clipboard.writeText(M).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),q=y(()=>{if(!$)return;Dv($)},[$]);if(r(()=>{z(!1)},[$]),yg(()=>{if(!U)return;let M=()=>{let p=b.current;if(!p||p.contains(document.activeElement))return;p.focus()},R=[0,50,150].map((p)=>window.setTimeout(M,p)),n=(p)=>{if(!nQ(p.data,J))return;z(!1)};return document.addEventListener("keydown",F,!0),window.addEventListener("message",n),()=>{R.forEach((p)=>{window.clearTimeout(p)}),document.removeEventListener("keydown",F,!0),window.removeEventListener("message",n)}},[F,J,U]),!v)return null;let L=v.data.title||v.data.path?.split("/").pop()||v6[v.type],I=Bk(v),N=oQ(I),T=$?f$.value.has($):!1,x=I.length>0,S=p6.value===$,l=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",t=UY(v);return K("div",{class:"expanded-overlay-backdrop",onPointerDown:X,style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(10,14,30,0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"32px",pointerEvents:S?"none":"auto"},children:K("div",{class:"expanded-overlay-panel",style:{flex:1,maxWidth:"1200px",display:"flex",flexDirection:"column",background:"var(--c-panel)",border:`1px solid ${T?"var(--c-warn)":"var(--c-accent)"}`,borderRadius:"var(--radius)",boxShadow:`0 0 0 1px ${T?"var(--c-warn)":"var(--c-accent)"}, 0 24px 80px rgba(0,0,0,0.6)`,overflow:"hidden"},children:[K("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",background:"var(--c-panel-glass)",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[K("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--c-accent-12)",color:"var(--c-accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:v6[v.type]},void 0,!1,void 0,this),K("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"var(--c-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:L},void 0,!1,void 0,this),K("div",{class:"expanded-actions",children:[K("button",{type:"button",class:`expanded-action-btn ${T?"expanded-action-active":""}`,onClick:q,title:T?"Remove from context":"Pin as context",children:T?"✦ In context":"✦ Pin as context"},void 0,!1,void 0,this),x&&K("button",{type:"button",class:"expanded-action-btn",onClick:H,title:"Copy content to clipboard",children:g?"Copied!":"Copy"},void 0,!1,void 0,this),F_(v)&&K("button",{type:"button",class:"expanded-action-btn",onClick:()=>void Z_(v),title:"Open as a full-page site in the system browser",children:"Open as site"},void 0,!1,void 0,this),t&&K("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:B,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this),N>0&&K("span",{class:"expanded-meta",children:[N.toLocaleString()," word",N!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("span",{style:{fontSize:"10px",color:S?"var(--c-warn)":"var(--c-muted)"},children:S?"Saving edits...":"Esc to close"},void 0,!1,void 0,this),K("button",{type:"button",onClick:W,style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 6px",fontSize:"16px",lineHeight:1,borderRadius:"4px"},onMouseEnter:(M)=>{M.target.style.color="var(--c-text)"},onMouseLeave:(M)=>{M.target.style.color="var(--c-muted)"},title:"Close (Esc)",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{style:{flex:1,overflow:"auto",padding:"16px",minHeight:0,...l?{display:"flex",flexDirection:"column"}:{}},children:l?K("div",{style:{flex:1,minHeight:0,display:"flex"},children:Wk(v,!0)},void 0,!1,void 0,this):Wk(v,!0)},void 0,!1,void 0,this),K("div",{style:{"--ax-dock-bleed":"0px","--ax-dock-pad":"16px"},children:K(w2,{node:v},void 0,!1,void 0,this)},void 0,!1,void 0,this),t&&U&&K("div",{ref:b,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${L}`,tabIndex:-1,onKeyDownCapture:F,children:[K("button",{ref:O,type:"button",class:"html-presentation-exit",onClick:Y,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),K("div",{class:"html-presentation-stage",children:K(Kg,{node:v,expanded:!0,presentation:!0,presentationExitToken:J},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var EU=180,mU=120,N2=20;function dQ(){let $=q2();return{markdown:$.accent,"mcp-app":$.ok,webpage:$.warn,"json-render":$.ok,graph:$.purple,prompt:$.accent,response:$.ok,status:$.warn,context:$.muted,ledger:$.dim,trace:$.purple,file:$.accent,diff:$.ok,mermaid:$.purple,image:$.ok,html:$.warn,group:$.dim}}function aQ(){let $=q2();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function qk($,v,g,_){let U=Array.from($.values()),z=0,J=0,G=1000,b=800;if(U.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY,b=Number.NEGATIVE_INFINITY;for(let H of U)z=Math.min(z,H.position.x),J=Math.min(J,H.position.y),G=Math.max(G,H.position.x+H.size.width),b=Math.max(b,H.position.y+H.size.height)}let O=-v.x/v.scale,W=-v.y/v.scale,B=O+g/v.scale,k=W+_/v.scale,Y={minX:Math.min(z,O)-N2,minY:Math.min(J,W)-N2,maxX:Math.max(G,B)+N2,maxY:Math.max(b,k)+N2},F=Y.maxX-Y.minX||1,X=Y.maxY-Y.minY||1;return{bounds:Y,scale:Math.min(EU/F,mU/X)}}function Pk({viewport:$,nodes:v,edges:g,onNavigate:_,containerWidth:U,containerHeight:z}){let J=D(null),G=D(!1),b=D(null),O=D(null),W=y(()=>{let X=J.current;if(!X)return;let H=X.getContext("2d");if(!H)return;let q=v.value,L=g.value,I=$.value,N=window.devicePixelRatio||1;X.width=EU*N,X.height=mU*N,H.scale(N,N),H.clearRect(0,0,EU,mU);let T=q2();H.fillStyle=T.panel+"d9",H.fillRect(0,0,EU,mU);let x=qk(q,I,U,z);b.current=x;let{bounds:S,scale:l}=x,t=(A)=>(A-S.minX)*l,M=(A)=>(A-S.minY)*l,R=Array.from(q.values()),n=dQ();for(let A of R)H.fillStyle=n[A.type]??T.muted,H.globalAlpha=0.6,H.fillRect(t(A.position.x),M(A.position.y),Math.max(4,A.size.width*l),Math.max(3,A.size.height*l));let p=aQ();for(let A of L.values()){let E=q.get(A.from),_$=q.get(A.to);if(!E||!_$)continue;let $$=t(E.position.x+E.size.width/2),O$=M(E.position.y+E.size.height/2),W$=t(_$.position.x+_$.size.width/2),e=M(_$.position.y+_$.size.height/2);H.beginPath(),H.moveTo($$,O$),H.lineTo(W$,e),H.strokeStyle=p[A.type]??T.muted,H.globalAlpha=0.3,H.lineWidth=0.5,H.stroke()}let c=-I.x/I.scale,a=-I.y/I.scale,J$=U/I.scale,P$=z/I.scale;H.globalAlpha=1,H.strokeStyle=T.accent,H.lineWidth=1.5,H.strokeRect(t(c),M(a),J$*l,P$*l)},[v,g,$,U,z]),B=D(W);B.current=W;let k=y(()=>{if(O.current!==null)return;O.current=window.requestAnimationFrame(()=>{O.current=null,B.current()})},[]);R7(()=>{c$.value,v.value,g.value,$.value,k()}),r(()=>{k()},[U,z,k]),r(()=>()=>{if(O.current!==null)window.cancelAnimationFrame(O.current),O.current=null},[]);let Y=y((X)=>{let H=J.current;if(!H)return;let q=H.getBoundingClientRect(),L=X.clientX-q.left,I=X.clientY-q.top,N=b.current??qk(v.value,$.value,U,z);b.current=N;let{bounds:T,scale:x}=N,S=$.value,l=U/S.scale,t=z/S.scale,M=L/x+T.minX,R=I/x+T.minY;_(-(M-l/2)*S.scale,-(R-t/2)*S.scale)},[v,$,U,z,_]),F=y((X)=>{X.stopPropagation(),G.current=!0,Y(X);let H=(L)=>{if(G.current)Y(L)},q=()=>{G.current=!1,document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",q)};document.addEventListener("pointermove",H),document.addEventListener("pointerup",q)},[Y]);return K("div",{style:{position:"fixed",bottom:"16px",right:"16px",zIndex:9998,border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",overflow:"hidden",boxShadow:"0 4px 16px var(--c-shadow)"},children:K("canvas",{ref:J,width:EU,height:mU,style:{width:`${EU}px`,height:`${mU}px`,display:"block",cursor:"pointer"},onPointerDown:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Xk(){let $=p$.value.size,v=y(()=>{let U=Array.from(p$.value);if(U.length===0)return;gb(U),E6()},[]),g=y(()=>{let U=Array.from(p$.value);if(U.length===0)return;dg({title:"Group",childIds:U}),E6()},[]),_=y(()=>{let U=Array.from(p$.value);for(let z=0;z<U.length;z++)for(let J=z+1;J<U.length;J++)Nv(U[z],U[J],"relation");E6()},[]);if($===0)return null;return K("div",{class:"selection-bar",children:[K("span",{class:"selection-bar-count",children:["✦"," ",$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),K("button",{type:"button",class:"selection-bar-btn selection-bar-pin-ctx",onClick:v,children:"Pin as context"},void 0,!1,void 0,this),$>=2&&K("button",{type:"button",class:"selection-bar-btn",onClick:g,children:"Group"},void 0,!1,void 0,this),$>=2&&K("button",{type:"button",class:"selection-bar-btn",onClick:_,children:"Connect"},void 0,!1,void 0,this),K("button",{type:"button",class:"selection-bar-btn selection-bar-clear",onClick:E6,title:"Clear selection",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var sQ=[{title:"Navigation",shortcuts:[{keys:`${S6}+K`,desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:`${S6}+0`,desc:"Reset viewport to origin"},{keys:`${S6}++ / ${S6}+−`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Shift+Drag",desc:"Lasso select multiple nodes"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in toolbar)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function Hk({onClose:$}){return K("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:K("div",{class:"shortcut-overlay",onMouseDown:(v)=>v.stopPropagation(),children:[K("div",{class:"shortcut-overlay-header",children:[K("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),K("span",{class:"shortcut-overlay-hint",children:["Press ",K("kbd",{children:"?"},void 0,!1,void 0,this)," or ",K("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"shortcut-overlay-body",children:sQ.map((v)=>K("div",{class:"shortcut-group",children:[K("div",{class:"shortcut-group-title",children:v.title},void 0,!1,void 0,this),v.shortcuts.map((g)=>K("div",{class:"shortcut-row",children:[K("kbd",{class:"shortcut-keys",children:g.keys},void 0,!1,void 0,this),K("span",{class:"shortcut-desc",children:g.desc},void 0,!1,void 0,this)]},g.keys,!0,void 0,this))]},v.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function eQ($){let v=Date.now()-new Date($).getTime(),g=Math.floor(v/60000);if(g<1)return"just now";if(g<60)return`${g}m ago`;let _=Math.floor(g/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function Lk({open:$,onClose:v,anchorRef:g}){let[_,U]=i([]),[z,J]=i(!1),[G,b]=i(!1),[O,W]=i(null),[B,k]=i(""),[Y,F]=i(null),X=D(null),H=D(null);r(()=>{if(!$)return;J(!0),p7().then((S)=>{U(S),J(!1)})},[$]),r(()=>{if($)setTimeout(()=>H.current?.focus(),50)},[$]),r(()=>{if(!$)return;let S=(l)=>{let t=X.current,M=g.current;if(t&&!t.contains(l.target)&&M&&!M.contains(l.target))v()};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[$,v]),r(()=>{if(!$)return;let S=(l)=>{if(l.key==="Escape")v()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[$,v]);let q=y(async()=>{let S=B.trim();if(!S)return;b(!0);let l=await o7(S);if(b(!1),l.ok&&l.snapshot)U((t)=>[l.snapshot,...t]),k("")},[B]),L=y(async(S)=>{F(null),W(S);let l=await n7(S);if(W(null),l.ok)v()},[v]),I=y(async(S)=>{if((await t7(S)).ok)U((t)=>t.filter((M)=>M.id!==S));F(null)},[]);if(!$)return null;let N=g.current?.getBoundingClientRect(),T=N?Math.max(8,N.left-120):100,x=N?N.bottom+8:48;return K("div",{ref:X,class:"snapshot-panel",style:{left:`${T}px`,top:`${x}px`},children:[K("div",{class:"snapshot-panel-header",children:[K("span",{class:"snapshot-panel-title",children:"Snapshots"},void 0,!1,void 0,this),K("button",{type:"button",class:"snapshot-panel-close",onClick:v,title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"snapshot-save-form",children:[K("input",{ref:H,type:"text",class:"snapshot-name-input",value:B,onInput:(S)=>k(S.target.value),onKeyDown:(S)=>{if(S.key==="Enter")q()},placeholder:"Snapshot name...",maxLength:80,disabled:G},void 0,!1,void 0,this),K("button",{type:"button",class:"snapshot-save-btn",onClick:q,disabled:!B.trim()||G,children:G?"...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),K("div",{class:"snapshot-list",children:[z&&K("div",{class:"snapshot-empty",children:"Loading..."},void 0,!1,void 0,this),!z&&_.length===0&&K("div",{class:"snapshot-empty",children:"No snapshots yet. Save one to capture the current canvas state."},void 0,!1,void 0,this),!z&&_.map((S)=>K("div",{class:"snapshot-item",children:[K("div",{class:"snapshot-item-info",children:[K("span",{class:"snapshot-item-name",children:S.name},void 0,!1,void 0,this),K("span",{class:"snapshot-item-meta",children:[S.nodeCount," node",S.nodeCount!==1?"s":"",S.edgeCount>0?` · ${S.edgeCount} edge${S.edgeCount!==1?"s":""}`:""," · ",eQ(S.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"snapshot-item-actions",children:Y?.id===S.id?K(t$,{children:[K("button",{type:"button",class:`snapshot-action-btn ${Y.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>Y.action==="delete"?I(S.id):L(S.id),title:Y.action==="delete"?"Confirm delete":"Confirm restore",disabled:O!==null,children:Y.action==="delete"?"Delete":O===S.id?"Restoring...":"Confirm"},void 0,!1,void 0,this),K("button",{type:"button",class:"snapshot-action-btn",onClick:()=>F(null),title:"Cancel",disabled:O!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):K(t$,{children:[K("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>F({id:S.id,action:"restore"}),title:"Restore this snapshot",disabled:O!==null,children:O===S.id?"Restoring...":"Restore"},void 0,!1,void 0,this),K("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>F({id:S.id,action:"delete"}),title:"Delete this snapshot",disabled:O!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},S.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Fk($,v,g,_,U){return $.x<_.position.x+_.size.width+U&&$.x+v+U>_.position.x&&$.y<_.position.y+_.size.height+U&&$.y+g+U>_.position.y}function $w($,v,g,_,U){return _.some((z)=>Fk($,v,g,z,U))}function vw($,v,g,_,U){return _.find((z)=>Fk($,v,g,z,U))}function y2($,v,g,_=24){if($.length===0)return{x:40,y:80};let U=$[$.length-1],z={x:U.position.x+U.size.width+_,y:U.position.y};if(!$w(z,v,g,$,_))return z;let J=40,G=80,b=3000,O=G;for(let B=0;B<20;B++){let k=J;while(k+v<b){let X=vw({x:k,y:O},v,g,$,_);if(!X)return{x:k,y:O};k=X.position.x+X.size.width+_}O=$.filter((X)=>X.position.y<=O+g+_&&X.position.y+X.size.height+_>O).reduce((X,H)=>Math.max(X,H.position.y+H.size.height),O)+_}let W=$.reduce((B,k)=>Math.max(B,k.position.y+k.size.height),0);return{x:J,y:W+_}}var h4={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},diff:{x:380,y:80,w:640,h:420},mermaid:{x:380,y:80,w:640,h:460},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function Yg($,v,g,_={}){let U=h4[v];return{id:$,type:v,position:_.position??{x:U.x,y:U.y},size:_.size??{width:U.w,height:U.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_.dockPosition??null,data:g}}var Hv=null,D2=null,mK=0,l4=null,Uw=3000,gw=2000,_w=5000,kg=!1,k4=null,cU=null,o4=0,p4=null;function zw(){if(typeof location>"u"||typeof window>"u")return null;let $=new URLSearchParams(location.search).get("transport");if($==="poll"||$==="sse")return $;if(window.__PMX_AMP_ORB===!0)return"poll";return null}var iU=new Map;function qg($){let v=0;for(let g=0;g<$.length;g++)v=(v<<5)-v+$.charCodeAt(g)|0;return Math.abs(v).toString(36)}function T2($){if(!D2)return $;let v=D2.get($.id);if(!v)return $;return{...$,position:v.position??$.position,size:v.size??$.size,collapsed:v.collapsed??$.collapsed,pinned:v.pinned??$.pinned,dockPosition:v.dockPosition!==void 0?v.dockPosition:$.dockPosition}}function Pg($,v,g,_=null){return T2(Yg($,v,g,{dockPosition:_}))}function Jw(){return y2([...u.value.values()],h4.markdown.w,h4.markdown.h)}function n4(){if(!u.value.has("status-main"))z4(Pg("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function Gw($,v){let g=`md-${qg($)}`;if(u.value.get(g))g$(g,{path:$,title:v}),V$.value=g;else{let U=Jw(),z=Pg(g,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=U,z4(z),!z.dockPosition)F6(g)}}function Kw($){if(u.value.get("context-main"))g$("context-main",{cards:$});else if($.length>0){let _=Pg("context-main","context",{cards:$});z4(_)}}function bw($){let v=$.url,g=`mcp-${qg(v)}`;if(u.value.get(g))g$(g,$);else z4(Pg(g,"mcp-app",$)),F6(g)}function Ow($){let v=$.toolCallId,_=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(v.startsWith("ext-app-")?v:`ext-app-${v}`);if(u.value.get(_)){g$(_,$);return}let{serverName:z,toolName:J}=$;if(z&&J){for(let[H,q]of u.value.entries())if(q.type==="mcp-app"&&q.data.mode==="ext-app"&&q.data.serverName===z&&q.data.toolName===J&&!q.data.toolResult){g$(H,{...$});return}}let{_x:G,_y:b,_width:O,_height:W}=$,B=h4["mcp-app"],k=O??B.w,Y=W??B.h,F=G===void 0||b===void 0?y2([...u.value.values()],k,Y):null,X=T2(Yg(_,"mcp-app",{mode:"ext-app",...$},{position:{x:G??F?.x??B.x,y:b??F?.y??B.y},size:{width:k,height:Y}}));if(z4(X),!X.dockPosition)F6(_,{recordHistory:!1})}function Ww($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(u.value.has(v))return v;let g=`ext-app-${$}`;if(g!==v&&u.value.has(g))return g;for(let[_,U]of u.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.toolCallId===$)return _;return null}function wk($){let v=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(v&&u.value.has(v))return v;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return Ww($.toolCallId)}function Ak($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let g=null;for(let[_,U]of u.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.serverName===$&&U.data.toolName===v&&!U.data.toolResult){if(g)return null;g=_}return g}function Mk($){if(u.value.get("ledger-main"))g$("ledger-main",$);else{let _=Pg("ledger-main","ledger",$,"right");_.collapsed=!0,z4(_)}}function cK($){if(!z1($))return;if(document.documentElement.setAttribute("data-theme",$),RU(),c$.value!==$)c$.value=$}function Bw($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="diff"||$==="mermaid"||$==="image"||$==="html"||$==="group"}function Yw($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function iK($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.x!=="number"||typeof v.y!=="number")return null;return{x:v.x,y:v.y}}function Sk($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.width!=="number"||typeof v.height!=="number")return null;return{width:v.width,height:v.height}}function kw($){let v=iK($),g=Sk($);return v&&g?{...v,...g}:null}function qw($){if(typeof $.id!=="string"||!$.id)return null;if(!Bw($.type))return null;let v=iK($.position),g=Sk($.size);if(!v||!g)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,U=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:g,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:U}}function Pw($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!Yw($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function Xw($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>iK(_)).filter((_)=>_!==null),g=kw($.bounds);if(v.length<($.type==="text"?1:2)||!g)return null;return{id:$.id,type:$.type,points:v,bounds:g,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}var Zk="pmx-canvas-version-reload";function Hw($){if(typeof $!=="string"||!$||$==="unknown")return;if(typeof window>"u")return;let v=window.__PMX_BOOT_SERVER_VERSION;if(typeof v!=="string"||!v||v==="unknown")return;if($===v)return;try{if(window.sessionStorage.getItem(Zk)===$)return;window.sessionStorage.setItem(Zk,$)}catch{return}window.location.reload()}function Lw($){if(Uv.value=$.sessionId||"",o6.value="connected",dU.value+=1,Hw($.version),tg(),typeof $.theme==="string"&&!uK())cK($.theme);if($.ledgerSummary)Mk($.ledgerSummary)}function Fw($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,g=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(Gw(v,g),$.ledgerSummary)Mk($.ledgerSummary)}function Zw($){n4(),g$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function Iw($){n4(),g$("status-main",{phase:$.phase,detail:$.detail})}function Qw($){let v=$.cards??[];Kw(v)}function ww($){if(typeof $.url==="string"&&$.url)bw({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function Aw($){let v=$.sessions??[];for(let g of v){let _=g.url;if(!_)continue;let U=`mcp-${qg(_)}`;if(u.value.has(U))g$(U,{sessionState:g.state,lastSeenAt:g.lastSeenAt})}}function Mw($){if(typeof $.url==="string"&&$.url){let v=`mcp-${qg($.url)}`;if(u.value.has(v))g$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function Sw($){let g=u.value.get("context-main");if(!g)return;let _=(g.data.auxTabs??[]).concat($);g$("context-main",{auxTabs:_})}function Nw($){if(u.value.has("context-main"))if($.mode==="all")g$("context-main",{auxTabs:[]});else{let _=u.value.get("context-main");if(!_)return;let U=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);g$("context-main",{auxTabs:U})}}function yw($){n4(),g$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function Rw($){n4(),g$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function Dw($){n4(),g$("status-main",{activeTool:null})}function Tw($){if($.state==="active"&&$.path){let g=`md-${qg($.path)}`;if(u.value.has(g))g$(g,{reviewActive:!0})}}function jw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;Ow({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function uw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=wk($)??Ak($.serverName,$.toolName);if(!v)return;if(u.value.has(v))g$(v,{html:$.html})}function Cw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=wk($)??Ak($.serverName,$.toolName);if(!v)return;if(u.value.has(v)){if($.success===!1){Tv(v);return}g$(v,{toolResult:JK({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function Vw($){n4(),g$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function fw($){let v=$.nodeId;if(!v)return;let g=$.text||"",_=$.position,U=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&u.value.has($.threadNodeId)){let J=$.threadNodeId,G=u.value.get(J);if(!G)return;let b=Array.isArray(G.data.turns)?[...G.data.turns]:[],O=b[b.length-1];if(!O||O.role!=="user"||O.text!==g)b.push({role:"user",text:g,status:"pending"});g$(J,{turns:b,threadStatus:"pending"});return}if(!u.value.has(v)){let J=_??h4.prompt;z4(T2(Yg(v,"prompt",{text:g,turns:g?[{role:"user",text:g,status:"pending"}]:[],threadStatus:g?"pending":"draft",status:g?"pending":"draft",parentNodeId:U,contextNodeIds:z},{position:{x:J.x,y:J.y}}))),F6(v)}if(U&&u.value.has(U))v_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",style:"dashed"})}function rw($){let{nodeId:v,status:g}=$;if(v&&u.value.has(v))g$(v,{status:g})}function Ew($){let{responseNodeId:v,promptNodeId:g}=$;if(!v)return;let _=g?u.value.get(g):void 0;if(_&&Array.isArray(_.data.turns)){iU.set(v,g);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),g$(g,{turns:z,threadStatus:"streaming",_activeResponseId:v}),F6(g);return}let U=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:h4.response.x,y:h4.response.y};if(!u.value.has(v))z4(T2(Yg(v,"response",{content:"",status:"streaming",promptNodeId:g},{position:U})));if(g)v_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",animated:!0});F6(v)}function mw($){let v=$.responseNodeId;if(!v)return;let g=iU.get(v);if(g){let _=u.value.get(g);if(_&&Array.isArray(_.data.turns)){let U=[..._.data.turns],z=U[U.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";g$(g,{turns:U,threadStatus:"streaming"})}return}if(!u.value.has(v))return;g$(v,{content:$.content,status:"streaming"})}function cw($){let v=$.responseNodeId;if(!v)return;let g=iU.get(v);if(g){let z=u.value.get(g);if(z&&Array.isArray(z.data.turns)){let J=[...z.data.turns],G=J[J.length-1];if(G&&G.role==="assistant")G.text=$.content,G.status="complete";g$(g,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}iU.delete(v);return}if(!u.value.has(v))return;g$(v,{content:$.content,status:"complete"});let U=u.value.get(v)?.data.promptNodeId;if(U){let z=`edge-${U}-${v}`,J=h$.value.get(z);if(J)Gb(z),v_({...J,animated:!1})}}function iw($){let v=$.layout;if(!v?.nodes)return;let g=!Z4.value;Z4.value=!0;let _=v.nodes.map(qw).filter((G)=>G!==null),U=Array.isArray(v.edges)?v.edges.map(Pw).filter((G)=>G!==null):Array.from(h$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(Xw).filter((G)=>G!==null):void 0,J=v.viewport?{x:typeof v.viewport.x==="number"?v.viewport.x:0,y:typeof v.viewport.y==="number"?v.viewport.y:0,scale:typeof v.viewport.scale==="number"?v.viewport.scale:1}:void 0;Cv(),kb({...J?{viewport:J}:{},nodes:_,edges:U,...z?{annotations:z}:{}},{applyViewport:g}),Iz({event:"canvas-layout-update",data:$})}function xw($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function hw($){let v=$.nodeId;if(v&&u.value.has(v)){if($.noPan===!0){w4(v);return}F6(v)}}function lw($){let v=$.viewport;if(!v)return;let g=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,U=typeof v.scale==="number"?v.scale:1;Cv(),Wb({x:g,y:_,scale:U})}function pw($){if(u.value.get("context-main"))g$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function ow($){sg.value=$.enabled===!0}function nw($){if(typeof $.theme==="string"&&!uK())cK($.theme)}function tw($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((g)=>typeof g==="string"):[];zb(v),Iz({event:"context-pins-changed",data:$})}var R2=null;function Ik(){if(R2)clearTimeout(R2);R2=setTimeout(()=>{R2=null,c7().then(($)=>{I4.value=$})},150)}function dw($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;WY(v)}function aw($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)YY(v,typeof $.nodeId==="string"?$.nodeId:void 0);else PK(v)}var Nk={connected:Lw,"workbench-open":Fw,"canvas-status":Zw,"execution-phase":Iw,"context-cards":Qw,"mcp-app-candidate":ww,"mcp-app-host-snapshot":Aw,"mcp-app-host-fallback":Mw,"aux-open":Sw,"aux-close":Nw,"assistant-complete":yw,"tool-start":Rw,"tool-complete":Dw,"review-state":Tw,"subagent-status":Vw,"ext-app-open":jw,"ext-app-update":uw,"ext-app-result":Cw,"context-pins-changed":tw,"canvas-layout-update":iw,"canvas-focus-node":hw,"canvas-viewport-update":lw,"context-usage":pw,"trace-state":ow,"theme-changed":nw,"canvas-prompt-created":fw,"canvas-prompt-status":rw,"canvas-response-start":Ew,"canvas-response-delta":mw,"canvas-response-complete":cw,"ax-state-changed":Ik,"ax-event-created":Ik,"ax-intent":dw,"ax-intent-clear":aw};function yk($,v){let g=Nk[$];if(!g)return;let _=g;try{_(v)}catch(U){console.warn(`[sse-bridge] Handler for "${$}" failed:`,U)}}function Qk(){kg=!0,o4+=1;let $=o4;o6.value="connecting";let v=null,g=!1,_=async()=>{if($!==o4)return;try{let U=new URLSearchParams;if(cU!==null)U.set("since",String(cU));let z=Uv.value;if(z)U.set("session",z);let J=U.toString(),G=await fetch(`/api/workbench/poll${J?`?${J}`:""}`);if($!==o4)return;if(!G.ok)throw Error(`poll failed with HTTP ${G.status}`);let b=await G.json();if($!==o4)return;if(!b.ok)throw Error("poll returned ok: false");let O=v;if(v=b.sessionId??null,O!==null&&b.sessionId&&O!==b.sessionId&&!b.snapshot){cU=null,k4=setTimeout(()=>void _(),0);return}if(b.snapshot&&g)D2=Yz(),n4(),Z4.value=!1,Zz(),XK(),iU.clear();for(let W of b.events)yk(W.event,W.payload);g=!0,cU=b.seq,o6.value="connected",k4=setTimeout(()=>void _(),gw)}catch(U){if($!==o4)return;console.warn("[sse-bridge] poll transport error:",U),o6.value="disconnected",k4=setTimeout(()=>void _(),_w)}};return _(),()=>{if(o4+=1,kg=!1,cU=null,k4)clearTimeout(k4),k4=null}}function xK(){if(_k(cK),D2=Yz(),n4(),Z4.value=!1,Zz(),XK(),iU.clear(),l4)clearTimeout(l4),l4=null;let $=zw();if($==="poll"||kg)return Qk();let v=Uv.value,g=v?`/api/workbench/events?session=${v}`:"/api/workbench/events";o6.value="connecting";let _=new EventSource(g);Hv=_;let U=!1;if(p4)clearTimeout(p4);if(p4=null,$!=="sse")p4=setTimeout(()=>{if(p4=null,U||Hv!==_)return;console.warn("[sse-bridge] No SSE event within watchdog window — switching to polling transport."),window.dispatchEvent(new Event("pmx-canvas-boot-extend")),_.close(),Hv=null,Qk()},Uw);for(let[z]of Object.entries(Nk))_.addEventListener(z,(J)=>{U=!0;try{yk(z,JSON.parse(J.data))}catch(G){console.warn(`[sse-bridge] Failed to parse "${z}" event:`,G)}});return _.onopen=()=>{if(Hv!==_)return;mK=0,o6.value="connected"},_.onerror=()=>{if(Hv!==_)return;o6.value="disconnected",_.close(),Hv=null,mK+=1,l4=setTimeout(()=>{l4=null,xK()},xw(mK))},()=>{if(l4)clearTimeout(l4),l4=null;if(p4)clearTimeout(p4),p4=null;if(kg){if(o4+=1,kg=!1,cU=null,k4)clearTimeout(k4),k4=null}_.close(),Hv=null}}function sw($,v){console.error(`[app] ${$} failed`,v)}function j2($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((g)=>{sw("sendIntent",g)})}function e$({label:$,detail:v,shortcut:g,align:_="center",children:U}){return K("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[U,K("span",{class:"toolbar-tooltip",role:"tooltip",children:[K("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||g)&&K("span",{class:"toolbar-tooltip-meta",children:[v&&K("span",{children:v},void 0,!1,void 0,this),g&&K("kbd",{class:"toolbar-tooltip-shortcut",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ew({minimapVisible:$,onToggleMinimap:v,snapshotOpen:g,onToggleSnapshot:_,snapshotBtnRef:U,onOpenPalette:z,onOpenShortcuts:J,annotationTool:G,onToggleAnnotationMode:b,onToggleAnnotationEraser:O,onToggleTextAnnotation:W}){let B=o6.value,k=Z4.value,Y=X$.value,F=u.value.size,X=h$.value.size,H=sg.value,q=Array.from(u.value.values()).filter((n)=>n.type==="trace").length,L=B==="connected"&&!k?"syncing":B,I=L.charAt(0).toUpperCase()+L.slice(1),N=k?[`${F} node${F!==1?"s":""}`,...X>0?[`${X} edge${X!==1?"s":""}`]:[],...q>0?[`${q} trace${q!==1?"s":""}`]:H?["trace armed"]:[]].join(" · "):"Syncing canvas…",[T,x]=i(null),S=D(null);r(()=>{if(!T)return;let n=(c)=>{if(S.current&&c.target instanceof Node&&!S.current.contains(c.target))x(null)},p=(c)=>{if(c.key==="Escape")x(null)};return document.addEventListener("pointerdown",n),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("keydown",p)}},[T]);let l=(n)=>{M2(),document.documentElement.setAttribute("data-theme",n),RU(),c$.value=n,lg(n),x(null)},t=(n)=>()=>{n(),x(null)},M=pz(c$.value),R=lz.map((n)=>K("button",{type:"button",role:"menuitemradio","aria-checked":M===n,class:`toolbar-menu-item${M===n?" active":""}`,onClick:()=>l(n),children:[K("span",{class:"theme-swatch",style:{background:hv[n].swatchBg},children:K("span",{class:"theme-swatch-dot",style:{background:hv[n].swatchAccent}},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{children:hv[n].label},void 0,!1,void 0,this),M===n&&K("span",{class:"toolbar-menu-check","aria-hidden":"true",children:"✓"},void 0,!1,void 0,this)]},n,!0,void 0,this));return K("div",{class:"toolbar-group",ref:S,children:[K("div",{class:"canvas-toolbar",children:[K(e$,{label:"PMX Canvas",detail:"Focus Field · spatial workbench for coding agents",align:"start",children:K("span",{class:"canvas-brand","aria-label":"PMX Canvas",children:K(wY,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("div",{class:"separator"},void 0,!1,void 0,this),K(e$,{label:"Canvas status",detail:k?I:"Syncing canvas from server",align:"start",children:K("span",{class:`connection-dot ${B}`,"aria-label":`Canvas status: ${L}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{class:"hud-collapsible-text",style:{fontSize:"11px",color:"var(--c-muted)"},children:Uv.value?Uv.value.slice(0,12):"…"},void 0,!1,void 0,this),K("div",{class:"separator"},void 0,!1,void 0,this),K(e$,{label:"Fit canvas",detail:"Frame every node on screen",children:K("button",{type:"button",onClick:()=>g_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:K(HY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:"Reset view",shortcut:`${S6}+0`,children:K("button",{type:"button",onClick:()=>gv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:K(LY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:"Zoom in",shortcut:`${S6}++`,children:K("button",{type:"button",onClick:()=>aU(1.25),"aria-label":"Zoom in",children:K(FY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:"Zoom out",shortcut:`${S6}+-`,children:K("button",{type:"button",onClick:()=>aU(0.8),"aria-label":"Zoom out",children:K(ZY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)",minWidth:"36px",textAlign:"center"},children:[Math.round(Y.scale*100),"%"]},void 0,!0,void 0,this),K("span",{class:"toolbar-collapsible",children:[K("div",{class:"separator"},void 0,!1,void 0,this),K(e$,{label:"Arrange layout",detail:X>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:K("button",{type:"button",onClick:()=>X>0?eU():sU(),"aria-label":"Arrange layout",children:K(HK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:$?"Hide minimap":"Show minimap",detail:"Quickly navigate large canvases",children:K("button",{type:"button",onClick:v,"aria-label":$?"Hide minimap":"Show minimap",style:{color:$?"var(--c-accent)":void 0},children:K(LK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{class:"toolbar-menu-anchor",children:[K(e$,{label:"Theme",detail:`Current theme: ${hv[M].label}`,children:K("button",{type:"button",onClick:()=>x(T==="theme"?null:"theme"),"aria-label":"Choose theme","aria-haspopup":"menu","aria-expanded":T==="theme",style:{color:T==="theme"?"var(--c-accent)":void 0},children:lv(M)==="dark"?K(IY,{},void 0,!1,void 0,this):K(QY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),T==="theme"&&K("div",{class:"toolbar-menu",role:"menu","aria-label":"Theme",children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(e$,{label:"Snapshots",detail:"Capture and restore canvas states",align:"end",children:K("button",{ref:U,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:g?"var(--c-accent)":void 0},children:K(QK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("span",{class:"toolbar-more toolbar-menu-anchor",children:[K(e$,{label:"More",detail:"All canvas actions",align:"end",children:K("button",{type:"button",onClick:()=>x(T==="more"?null:"more"),"aria-label":"More actions","aria-haspopup":"menu","aria-expanded":T==="more",style:{color:T==="more"?"var(--c-accent)":void 0},children:K("span",{class:"toolbar-more-glyph","aria-hidden":"true",children:"⋯"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),T==="more"&&K("div",{class:"toolbar-menu",role:"menu","aria-label":"Canvas actions",children:[K("button",{type:"button",class:"toolbar-menu-item",onClick:t(()=>X>0?eU():sU()),children:[K(HK,{},void 0,!1,void 0,this),K("span",{children:"Arrange layout"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(v),children:[K(LK,{},void 0,!1,void 0,this),K("span",{children:$?"Hide minimap":"Show minimap"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(_),children:[K(QK,{},void 0,!1,void 0,this),K("span",{children:"Snapshots"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"toolbar-menu-separator"},void 0,!1,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(()=>j2("trace-toggle",{enabled:!H})),children:[K(wK,{},void 0,!1,void 0,this),K("span",{children:H?"Disable trace":"Enable trace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(H||q>0)&&K("button",{type:"button",class:"toolbar-menu-item",onClick:t(()=>j2("trace-clear")),children:[K(AK,{},void 0,!1,void 0,this),K("span",{children:"Clear trace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(b),children:[K(FK,{},void 0,!1,void 0,this),K("span",{children:G==="pen"?"Stop annotating":"Annotate canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(O),children:[K(ZK,{},void 0,!1,void 0,this),K("span",{children:G==="eraser"?"Stop erasing":"Erase annotations"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(W),children:[K(IK,{},void 0,!1,void 0,this),K("span",{children:G==="text"?"Stop text annotations":"Text annotations"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"toolbar-menu-separator"},void 0,!1,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(z),children:[K(MK,{},void 0,!1,void 0,this),K("span",{children:"Search nodes and actions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("button",{type:"button",class:"toolbar-menu-item",onClick:t(J),children:[K(SK,{},void 0,!1,void 0,this),K("span",{children:"Keyboard shortcuts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"toolbar-menu-separator"},void 0,!1,void 0,this),K("div",{class:"toolbar-menu-heading",children:"Theme"},void 0,!1,void 0,this),R]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"canvas-toolbar toolbar-actions-bar",children:[K(e$,{label:H?"Disable trace":"Enable trace",detail:H?"Stop collecting new trace nodes":"Capture agent execution on the canvas",children:K("button",{type:"button",onClick:()=>j2("trace-toggle",{enabled:!H}),"aria-label":H?"Disable trace":"Enable trace",style:{color:H?"var(--c-purple)":void 0},children:K(wK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||q>0)&&K(e$,{label:"Clear trace",detail:q>0?`Remove ${q} trace node${q===1?"":"s"}`:"Trace is enabled but still empty",children:K("button",{type:"button",onClick:()=>j2("trace-clear"),"aria-label":"Clear trace",children:K(AK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("div",{class:"separator"},void 0,!1,void 0,this),K(e$,{label:G==="pen"?"Stop annotating":"Annotate canvas",detail:"Draw directly on the canvas for human-visible markup",children:K("button",{type:"button",onClick:b,"aria-label":G==="pen"?"Stop annotating":"Annotate canvas","aria-pressed":G==="pen",style:{color:G==="pen"?"var(--c-accent)":void 0},children:K(FK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:G==="eraser"?"Stop erasing":"Erase annotations",detail:"Click a drawn annotation to remove it",children:K("button",{type:"button",onClick:O,"aria-label":G==="eraser"?"Stop erasing":"Erase annotations","aria-pressed":G==="eraser",style:{color:G==="eraser"?"var(--c-accent)":void 0},children:K(ZK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:G==="text"?"Stop text annotations":"Text annotations",detail:"Click anywhere to type an intent note",children:K("button",{type:"button",onClick:W,"aria-label":G==="text"?"Stop text annotations":"Text annotations","aria-pressed":G==="text",style:{color:G==="text"?"var(--c-accent)":void 0},children:K(IK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("div",{class:"separator"},void 0,!1,void 0,this),K(e$,{label:"Search nodes and actions",shortcut:`${S6}+K`,children:K("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:K(MK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K(e$,{label:"Keyboard shortcuts",shortcut:"?",align:"end",children:K("button",{type:"button",onClick:J,"aria-label":"Keyboard shortcuts",children:K(SK,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)"},children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $A({onOpenPalette:$}){return K("div",{class:"welcome-card",children:[K("div",{class:"welcome-icon",children:"◇"},void 0,!1,void 0,this),K("div",{class:"welcome-title",children:"Shape What The Agent Sees"},void 0,!1,void 0,this),K("div",{class:"welcome-subtitle",children:"Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The board will reflect the active focus."},void 0,!1,void 0,this),K("div",{class:"welcome-hints",children:[K("button",{type:"button",class:"welcome-hint",onClick:$,children:[K("kbd",{children:[S6,"+K"]},void 0,!0,void 0,this),K("span",{children:"Create a note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"welcome-hint",children:[K("kbd",{children:"Drop files"},void 0,!1,void 0,this),K("span",{children:"Add evidence to the board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"welcome-hint",children:[K("kbd",{children:"✦"},void 0,!1,void 0,this),K("span",{children:"Pin important nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"welcome-hint",children:[K("kbd",{children:"Move nearby"},void 0,!1,void 0,this),K("span",{children:"Shape the focus field"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K("div",{class:"welcome-footer",children:"The canvas is a shared attention surface, not just an editor."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rk(){let[$,v]=i(!0),[g,_]=i(!1),[U,z]=i(!1),[J,G]=i(!1),[b,O]=i(null),W=D(null),{menu:B,openNodeMenu:k,openCanvasMenu:Y,closeMenu:F}=Jk(),X=Z4.value,H=y(()=>v((M)=>!M),[]),q=y(()=>_((M)=>!M),[]),L=y(()=>_(!1),[]),I=y(()=>O((M)=>M==="pen"?null:"pen"),[]),N=y(()=>O((M)=>M==="eraser"?null:"eraser"),[]),T=y(()=>O((M)=>M==="text"?null:"text"),[]),x=y((M,R)=>{gv({x:M,y:R,scale:X$.value.scale},200)},[]);r(()=>{return xK()},[]),r(()=>{let M=null,R=()=>{if(M!==null)window.clearTimeout(M);M=window.setTimeout(()=>{M=null,tg()},400)};return window.addEventListener("resize",R),()=>{if(M!==null)window.clearTimeout(M);window.removeEventListener("resize",R)}},[]),r(()=>{let M=(R)=>{let n=R.metaKey||R.ctrlKey;if(n&&R.key==="k"){R.preventDefault(),z((c)=>!c);return}if(R.key==="Escape"&&b){R.preventDefault(),O(null);return}if(R.key==="Escape"&&m$.value&&!p6.value){R.preventDefault(),_v();return}if(R.key==="Escape"&&U){R.preventDefault(),z(!1);return}if(R.key==="Escape"&&J){R.preventDefault(),G(!1);return}let p=R.target?.tagName;if(p==="INPUT"||p==="TEXTAREA")return;if(R.key==="?"||R.key==="/"&&R.shiftKey){R.preventDefault(),G((c)=>!c);return}if(n&&R.key==="0")R.preventDefault(),gv({x:0,y:0,scale:1},250);else if(n&&(R.key==="="||R.key==="+"))R.preventDefault(),aU(1.25);else if(n&&R.key==="-")R.preventDefault(),aU(0.8);else if(R.key==="Escape"){if(p$.value.size>0){E6();return}V$.value=null,F()}else if(R.key==="Tab")R.preventDefault(),Pb(R.shiftKey?-1:1);else if(V$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(R.key)){R.preventDefault();let c=R.key.replace("Arrow","").toLowerCase();Xb(c)}};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M)}},[b,F,U,J]),r(()=>{if(!X)return;let M=window.__pmxCanvasBootstrapReady;if(typeof M==="function")M()},[X]);let S=Array.from(u.value.values()),l=S.filter((M)=>M.dockPosition==="left"),t=S.filter((M)=>M.dockPosition==="right").sort((M,R)=>{let n={context:0,ledger:1};return(n[M.type]??2)-(n[R.type]??2)});return K("div",{style:{width:"100%",height:"100%",position:"relative"},children:[K("div",{class:"hud-layer",children:[K("div",{class:"hud-left",children:l.map((M)=>K(EK,{node:M},M.id,!1,void 0,this))},void 0,!1,void 0,this),K(ew,{minimapVisible:$,onToggleMinimap:H,snapshotOpen:g,onToggleSnapshot:q,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>G((M)=>!M),annotationTool:b,onToggleAnnotationMode:I,onToggleAnnotationEraser:N,onToggleTextAnnotation:T},void 0,!1,void 0,this),K("div",{class:"hud-right",children:t.map((M)=>K(EK,{node:M},M.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K(Lb,{},void 0,!1,void 0,this),K(Hb,{},void 0,!1,void 0,this),K(vk,{onNodeContextMenu:k,onCanvasContextMenu:Y,annotationMode:b!==null,annotationTool:b},void 0,!1,void 0,this),X&&S.filter((M)=>!M.dockPosition).length===0&&B6.value.size===0&&K($A,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),p$.value.size>0&&K(Xk,{},void 0,!1,void 0,this),f$.value.size>0&&K(bk,{},void 0,!1,void 0,this),m$.value&&K(kk,{},void 0,!1,void 0,this),K(Lk,{open:g,onClose:L,anchorRef:W},void 0,!1,void 0,this),$&&K(Pk,{viewport:X$,nodes:u,edges:h$,onNavigate:x,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&K(Gk,{menu:B,onClose:F},void 0,!1,void 0,this),U&&K(zk,{onClose:()=>z(!1),onToggleMinimap:H},void 0,!1,void 0,this),J&&K(Hk,{onClose:()=>G(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}Tb();var Dk=document.getElementById("app");if(Dk)b7(K(Rk,{},void 0,!1,void 0,this),Dk);
252
+ </script>`}function VX(){return"<style data-pmx-canvas-ext-app-base>html, body { background: transparent !important; }</style>"}function fX($,U){if(!U)return $;let v=/<head\b[^>]*>/i.exec($);if(v?.index!==void 0){let _=v.index+v[0].length;return`${$.slice(0,_)}${U}${$.slice(_)}`}let J=/<body\b[^>]*>/i.exec($);if(J?.index!==void 0){let _=J.index+J[0].length;return`${$.slice(0,_)}${U}${$.slice(_)}`}return`${U}${$}`}function F0($,U){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(U)&&U>0)return Math.round(U);return 1}function RW($,U){let v=$?.getBoundingClientRect();return{width:F0($?.clientWidth??0,F0(v?.width??0,U.width)),height:F0($?.clientHeight??0,F0(v?.height??0,U.height))}}function sI($,U){return typeof $==="number"&&Number.isFinite($)&&$>0&&!U}function eI($,U){return Math.max(F0($,1),F0(U,1))}function uX({node:$,expanded:U=!1}){let v=C(null),J=C(null),_=C(null),z=C(null),K=C({}),W=C(void 0),O=C(!1),Y=C(void 0),Z=C(null),q=C(!1),X=C(null),B=C(0),L=C([]),P=C(!1),k=C(!1),H=C([]),F=C(!1),b=C(!1),V=C(!1),E=C(!1),[A,I]=f("loading"),[N,R]=f(null),[p,l]=f(0),[T,r]=f(!1),[t,i]=f(!1),[o,z$]=f(()=>U||typeof navigator>"u"||typeof window>"u"||!L0(navigator.userAgent)),B$=$.data.html,N6=$.data.serverName,g$=$.data.appSessionId,t$=$.data.toolInput??{},W4=$.data.toolResult,b4=$.data.toolName??"ext-app",S=$.data.toolDefinition,e=$.data.toolCallId,H$=typeof e==="string"||typeof e==="number"?e:void 0,K$=$.data.resourceMeta,U$=$.data.sessionStatus,_$=$.data.sessionError,J$=$.size.height,n=$.id,O$=oI($,p),P6=nI(null),O4=$.data.axCapabilities?.enabled===!0&&typeof B$==="string"&&B$.length>0,k6=u$(()=>`ax-${crypto.randomUUID()}`,[]),y=O4?tI(k6,n):"",L$=typeof B$==="string"&&B$.length>0?aI(k6,n):"",i$=RX(fX(B$??"",VX()+L$+y),P6);u(()=>{function v$(Z$){if(Z$.source!==v.current?.contentWindow)return;let N$=Z$.data;if(!N$||N$.source!==Lv||N$.token!==k6||N$.nodeId!==n)return;if(k.current=!0,N$.kind==="paint-tick")for(let p$ of L.current.splice(0))p$()}return window.addEventListener("message",v$),()=>window.removeEventListener("message",v$)},[k6,n]),u(()=>{if(o)return;DX({remount:()=>{if(E.current)return!1;return g6(n,"mount-slot"),z$(!0),!0},awaitBoot:()=>new Promise((v$)=>{let Z$=window.setTimeout(N$,TX);function N$(){window.clearTimeout(Z$),v$()}H.current.push(N$)})})},[]),Q0({enabled:O4,token:k6,nodeId:n,sourceSurface:"mcp-app",iframeRef:v});let y$=3,Y4=(v$)=>{if(B.current>=y$)return g6(n,`remount-cap-hit (${v$})`),!1;if(F.current)return!0;return B.current+=1,F.current=!0,g6(n,`remount-queued #${B.current} (${v$})`),DX({remount:()=>{if(F.current=!1,E.current||n$.value===n)return g6(n,"remount-skipped"),r(!1),!1;return b.current=typeof document<"u"&&document.visibilityState==="hidden",g6(n,`remount-run #${B.current}`),I("loading"),l((Z$)=>Z$+1),!0},awaitBoot:()=>new Promise((Z$)=>{let N$=window.setTimeout(p$,TX);function p$(){window.clearTimeout(N$),Z$()}H.current.push(p$)})}),!0},B2=1500,M4=()=>new Promise((v$)=>{let Z$=v.current?.contentWindow;if(!Z$||E.current){v$(!1);return}let N$=!1,p$=window.setTimeout(()=>{if(N$)return;N$=!0,v$(!1)},B2);L.current.push(()=>{if(N$)return;N$=!0,window.clearTimeout(p$),v$(!0)}),Z$.postMessage({source:W5,token:k6},"*")}),r4=()=>new Promise((v$)=>{let Z$=v.current;if(!Z$){v$();return}let N$=Z$.style.width,p$=Z$.style.height;Z$.style.width="140%",Z$.style.height="140%",requestAnimationFrame(()=>{requestAnimationFrame(()=>{Z$.style.width=N$,Z$.style.height=p$,g6(n,"soft-expand-cycle"),v$()})})}),BL=600,U8=()=>{if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;let v$=v.current;if(!v$||E.current)return;if(!iI({userAgent:navigator.userAgent,visibilityState:document.visibilityState,rect:v$.getBoundingClientRect(),viewport:{width:window.innerWidth,height:window.innerHeight},alreadyRearmed:V.current}))return;V.current=!0,window.setTimeout(()=>{if(E.current||document.visibilityState==="visible")return;B.current=0,i(!1),b.current=!1,g6(n,"assume-visible-rearm"),Y4("assume-visible")},BL)},bO=(v$="")=>typeof document<"u"&&document.visibilityState==="hidden"?`paint-ok${v$} (unverified: host hidden)`:`paint-ok${v$}`,XL=async()=>{if(U)return;if(typeof navigator>"u"||typeof window>"u")return;if(!L0(navigator.userAgent))return;if(r(!0),await M4()){g6(n,bO()),r(!1),U8();return}if(g6(n,"paint-fail"),await r4(),await M4()){g6(n,bO(" (after soft-expand)")),r(!1),U8();return}if(E.current)return;if(!Y4("paint-fail"))g6(n,"recovery-exhausted"),r(!1),i(!0),U8()};u(()=>{if(U)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!L0(navigator.userAgent))return;function v$(){if(document.visibilityState!=="visible")return;if(!b.current||E.current)return;b.current=!1,B.current=0,i(!1),g6(n,"visible-again-rearm"),Y4("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",v$),()=>document.removeEventListener("visibilitychange",v$)},[U,n]);let HL=6000;u(()=>{if(U)return;if(typeof navigator>"u"||typeof window>"u")return;if(!L0(navigator.userAgent))return;if(!i$.ready||!o)return;let v$=window.setTimeout(()=>{if(P.current||k.current||E.current)return;Y4("boot-watchdog")},HL);return()=>window.clearTimeout(v$)},[O$,i$.ready,U,o]),u(()=>()=>{E.current=!0;for(let v$ of H.current.splice(0))v$();for(let v$ of L.current.splice(0))v$()},[]);let _8=(v$)=>DU(v$),i4=U||n$.value===n;K.current=t$,W.current=W4;let X2=U$==="error"&&typeof B$==="string"&&B$.length>0,v8=U$==="error"?X2?`Live session unavailable — showing saved content. Reopen the app to restore interactivity.${_$?` (${_$})`:""}`:_$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",J8=(v$)=>{let Z$=W.current;if(!v$||!q.current||!Z$)return null;if(Y.current===Z$)return null;if(Y.current&&NX(Y.current,Z$))return Y.current=Z$,null;if(Z.current)return Z.current;let N$=v$.sendToolResult(Z$).then(()=>{Y.current=Z$,O.current=!0,I("done")}).catch((p$)=>{let N1=p$ instanceof Error?p$.message:String(p$);throw R(`Tool result delivery failed: ${N1}`),p$}).finally(()=>{Z.current=null});return Z.current=N$,N$};if(u(()=>{if(!B$||!i$.ready||!o)return;let v$=v.current;if(!v$)return;let Z$=!1,N$=null,p$=null,N1=null,JU=null,S1=null;O.current=!1,Y.current=void 0,Z.current=null,q.current=!1,P.current=!1,k.current=!1;let H2=()=>{if(!N$)return;clearTimeout(N$),N$=null};return(async()=>{if(!B$)return;let p4=v$.contentWindow;if(!p4)throw Error("Ext-app iframe window is unavailable");let R1=(P$=n$.value===n?"fullscreen":"inline")=>({theme:_8($6.value),platform:"web",containerDimensions:RW(v$,{width:$.size.width,height:J$}),displayMode:P$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...S?{toolInfo:{id:H$,tool:S}}:{}}),QL=()=>{if(JU!==null)return;JU=requestAnimationFrame(()=>{if(JU=null,Z$||!q.current)return;h$.setHostContext?.(R1())})},MO=()=>{if(S1!==null)return;S1=requestAnimationFrame(()=>{S1=requestAnimationFrame(()=>{if(S1=null,Z$||!q.current)return;h$.sendHostContextChange?.(R1())})})},AO=()=>{if(!L0(navigator.userAgent))return;if(p$)clearTimeout(p$);p$=setTimeout(()=>{if(p$=null,Z$)return;XL()},EX+200)},h$=new wW(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:R1(i4?"fullscreen":"inline")});h$.onsizechange=async({height:P$})=>{if(sI(P$,n$.value===n)){let S6=RW(v$.parentElement??v$,{width:$.size.width,height:J$}),p6=eI(P$,S6.height);v$.style.height=`${p6}px`;let T1=D.value.get(n)?.size??$.size,wO=Math.max(T1.height,p6+RU);if(Math.abs(wO-T1.height)>8){if(AU(n,{width:T1.width,height:wO}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{v6({recordHistory:!1}),z.current=null},0)}}return{}},h$.onopenlink=async({url:P$})=>{return window.open(P$,"_blank","noopener"),{}},h$.onsandboxready=async()=>{await h$.sendSandboxResourceReady({html:fX(B$,VX()),sandbox:O5,...K$?.csp?{csp:K$.csp}:{},...K$?.permissions?{permissions:K$.permissions}:{}})},h$.onrequestdisplaymode=async({mode:P$})=>{let{nextMode:S6,shouldExpand:p6,shouldCollapse:T1}=dI(P$,i4);if(p6)X4(n);else if(T1)m1();return{mode:S6}},h$.oncalltool=async(P$)=>{if(!g$)throw Error(v8);try{let S6=await d1("/api/ext-app/call-tool",{sessionId:g$,nodeId:n,serverName:N6,toolName:P$.name,arguments:P$.arguments??{}});return R(null),S6}catch(S6){let p6=S6 instanceof Error?S6.message:String(S6);throw R(`Tool call failed: ${p6}`),S6}},h$.setRequestHandler(n_,async()=>{if(!g$)return{tools:[]};return d1("/api/ext-app/list-tools",{sessionId:g$})}),h$.onlistresources=async()=>g$?d1("/api/ext-app/list-resources",{sessionId:g$}):{resources:[]},h$.onlistresourcetemplates=async()=>g$?d1("/api/ext-app/list-resource-templates",{sessionId:g$}):{resourceTemplates:[]},h$.onreadresource=async(P$)=>{if(!g$)throw Error(v8);return d1("/api/ext-app/read-resource",{sessionId:g$,uri:P$.uri})},h$.onlistprompts=async()=>g$?d1("/api/ext-app/list-prompts",{sessionId:g$}):{prompts:[]},h$.onupdatemodelcontext=async(P$)=>{if(!g$)return{};return await d1("/api/ext-app/model-context",{nodeId:n,...Array.isArray(P$.content)?{content:P$.content}:{},...P$.structuredContent&&typeof P$.structuredContent==="object"?{structuredContent:P$.structuredContent}:{}}),{}};let z8=new q9(p4,p4);if(h$.oninitialized=()=>{if(Z$)return;H2(),q.current=!0,P.current=!0,g6(n,"initialized"),I("ready"),R(null),Promise.resolve(h$.sendHostContextChange(R1(i4?"fullscreen":"inline"))).then(()=>jX(h$,K.current,void 0)).then(()=>J8(h$)).then(()=>{g6(n,"settled");for(let P$ of H.current.splice(0))P$();MO(),AO()}).catch((P$)=>{let S6=P$ instanceof Error?P$.message:String(P$);R(`Bridge bootstrap failed: ${S6}`)})},N$=setTimeout(()=>{if(Z$||q.current)return;let P$=W.current,S6=R1(i4?"fullscreen":"inline");q.current=!0,h$.setHostContext?.(S6),Promise.resolve(h$.sendHostContextChange(S6)).then(()=>jX(h$,K.current,P$)).then(()=>{if(O.current=Boolean(P$),P$)Y.current=P$;if(I(P$?"done":"ready"),R(null),MO(),AO(),k.current){g6(n,"settled (fallback)");for(let p6 of H.current.splice(0))p6()}}).catch((p6)=>{let T1=p6 instanceof Error?p6.message:String(p6);R(`Bridge bootstrap fallback failed: ${T1}`)})},1200),await h$.connect(z8),Z$){H2(),await z8.close();return}if(J.current=h$,_.current=z8,N1=new ResizeObserver(QL),N1.observe(v$),v$.parentElement)N1.observe(v$.parentElement);let IO=!0;X.current=$6.subscribe((P$)=>{if(IO){IO=!1;return}if(Z$)return;h$.setHostContext?.({...R1(),theme:_8(P$)}),h$.sendHostContextChange?.(R1())}),J8(h$)})().catch((p4)=>{H2(),console.error("[ext-app] Bridge init failed:",p4),R(p4?.message??"Bridge initialization failed")}),()=>{if(Z$=!0,H2(),p$)clearTimeout(p$),p$=null;if(N1?.disconnect(),N1=null,JU!==null)cancelAnimationFrame(JU),JU=null;if(S1!==null)cancelAnimationFrame(S1),S1=null;if(q.current=!1,Z.current=null,X.current?.(),X.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(J.current=null,_.current)_.current.close().catch((p4)=>{console.error("[ext-app] transport close failed:",p4)}),_.current=null}},[O$,i$.key,o]),u(()=>{if(W4&&J.current&&(A==="ready"||A==="done"))J8(J.current)},[W4,A]),u(()=>{let v$=J.current;if(v.current)v.current.style.height="100%";if(!v$||!q.current)return;let Z$=null,N$=null;return Z$=requestAnimationFrame(()=>{Z$=null,N$=requestAnimationFrame(()=>{if(N$=null,!q.current)return;let p$={theme:_8($6.value),platform:"web",containerDimensions:RW(v.current,{width:$.size.width,height:J$}),displayMode:i4?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};v$.setHostContext?.(p$),v$.sendHostContextChange?.(p$)})}),()=>{if(Z$!==null)cancelAnimationFrame(Z$);if(N$!==null)cancelAnimationFrame(N$)}},[i4,J$]),!B$)return G("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[G("div",{style:{opacity:0.6},children:["Loading ",b4," viewer..."]},void 0,!0,void 0,this),G("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[U$&&U$!=="ready"&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:U$==="error"&&!X2?"var(--c-danger-12)":"var(--c-warn-10)",color:U$==="error"&&!X2?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${U$==="error"&&!X2?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:v8},void 0,!1,void 0,this),N&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{style:{flex:1},children:N},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>{R(null),I("loading"),l((v$)=>v$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>R(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[o&&G("iframe",{ref:v,...i$.attributes,sandbox:P6,allow:gX(K$?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:i4&&A!=="loading"?"auto":"none"},title:`Ext App: ${b4}`},O$,!1,void 0,this),t&&!N&&G("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-warn)",fontSize:"12px"},children:[G("div",{children:"App surface failed to paint."},void 0,!1,void 0,this),G("button",{type:"button",onClick:(v$)=>{v$.stopPropagation(),g6(n,"manual-retry"),B.current=0,i(!1),I("loading"),l((Z$)=>Z$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-warn-15)",borderRadius:"4px",color:"var(--c-warn)",cursor:"pointer",fontSize:"11px",padding:"3px 10px"},children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(A==="loading"||T)&&!N&&!t&&G("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[G("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("div",{children:A==="loading"?`Connecting to ${b4}...`:"Finishing paint..."},void 0,!1,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!i4&&!(t&&!N)&&G("button",{type:"button",onClick:(v$)=>{v$.stopPropagation(),X4(n)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $w($,U,v,J,_,z,K){if(!$)return $;try{let W=new URL($,window.location.origin);if(W.searchParams.set("theme",DU($6.value)),U)W.searchParams.set("display","expanded");if(typeof v==="number")W.searchParams.set("v",String(v));if(J)W.searchParams.set("axToken",J);if(_)W.searchParams.set("axNodeId",_);if(z)W.searchParams.set("frameToken",z);if(K)W.searchParams.set("fit","content");return W.toString()}catch{return $}}function Uw($,U=window.location.origin){if(!$)return!1;try{let v=new URL(U).origin,J=new URL($,v);return J.origin===v&&J.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function Q1({node:$,expanded:U=!1}){if($.data.mode==="ext-app")return G(uX,{node:$,expanded:U},void 0,!1,void 0,this);return G(_w,{node:$,expanded:U},void 0,!1,void 0,this)}function _w({node:$,expanded:U}){let v=C(null),J=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",_=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,W=(_||J)&&(J?z===!0:z!==!1),O=J?"mcp-app":"json-render",Y=u$(()=>W?`ax-${crypto.randomUUID()}`:"",[W]),Z=Z5($)&&!U,q=u$(()=>Z?`frame-${crypto.randomUUID()}`:"",[Z]);TU($,v,q),Q0({enabled:W&&Boolean(Y),token:Y,nodeId:$.id,sourceSurface:O,iframeRef:v});let X=K4.value,B=()=>{if(!W||!Y||X==null)return;v.current?.contentWindow?.postMessage({source:n6,type:"ax-update",token:Y,state:X},"*")};u(B,[W,Y,X]);let L=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,P=$w($.data.url||"",U,L,Y||void 0,W?$.id:void 0,q||void 0,Z),k=yU(P),H=$.data.sourceServer||"",F=$.data.hostMode||"hosted",b=$.data.fallbackReason,V=$.data.trustedDomain===!0||Uw(P);if(F==="fallback")return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&G("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",b]},void 0,!0,void 0,this),G("a",{href:P,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:P},void 0,!1,void 0,this),H&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",H]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",display:"flex",flexDirection:"column",...U?{flex:1,minHeight:0,width:"100%"}:{}},children:[!V&&G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),G("iframe",{ref:v,...k,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:A6.value==="srcdoc"?void 0:"lazy",onLoad:B,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${H}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var vw=null;function P0(){vw=null}var mX={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function Jw($){let U=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(U)return U;let v=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(v)return v;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function B9({node:$}){let U=Jw($),v=$.data.detail||"",J=$.data.message||"",_=$.data.level||"ok",z=$.data.activeTool,K=$.data.subagent,W=mX[U]??"var(--c-muted)",O=U!=="idle";return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[G("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:W,boxShadow:O?`0 0 8px ${W}`:"none",animation:O?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{fontWeight:600,color:W,textTransform:"uppercase",letterSpacing:"0.05em"},children:U},void 0,!1,void 0,this),v&&G("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[G("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),G("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&K.state!=="completed"&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[G("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),G("span",{children:K.name},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",K.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&G("div",{style:{color:_==="warn"?"var(--c-warn)":_==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function k0($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function xX($){if(typeof $==="string"){let _=k0($);return _?{title:"Evidence warning",detail:_}:null}if(!$||typeof $!=="object")return null;let U=$,v=k0(U.title)??"Evidence warning",J=k0(U.detail);return J?{title:v,detail:J}:null}function zw($){let U=[],v=xX($.data.warning);if(v)U.push(v);let J=$.data.warnings;if(Array.isArray(J))for(let z of J){let K=xX(z);if(K)U.push(K)}let _=k0($.data.validationStatus)?.toLowerCase();if(_==="failed"||_==="invalid")U.push({title:"Image failed validation",detail:k0($.data.validationMessage)??"Review this image before using it as evidence."});return U}function Kw($){let U=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((v)=>k0(v)?.toLowerCase()??"").join(" ");if(U.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((v)=>U.includes(v))}function hX($){let U=zw($);if(U.length>0)return U;if(Kw($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function X9({node:$,expanded:U=!1}){let v=$.data.src||"",J=$.data.alt||$.data.title||"Image",_=$.data.caption||"",z=hX($),K=v.startsWith("data:")||v.startsWith("http://")||v.startsWith("https://")?v:`/api/canvas/image/${$.id}`,[W,O]=f(!1),[Y,Z]=f(!1),[q,X]=f(1),[B,L]=f({x:0,y:0}),[P,k]=f({w:0,h:0}),H=C(null),F=C(!1),b=C({x:0,y:0}),V=j((r)=>{let t=r.target;k({w:t.naturalWidth,h:t.naturalHeight}),O(!0),Z(!1)},[]),E=j(()=>{Z(!0),O(!1)},[]);u(()=>{X(1),L({x:0,y:0})},[v]);let A=j((r)=>{r.preventDefault(),r.stopPropagation();let t=r.deltaY>0?0.9:1.1;X((i)=>Math.max(0.25,Math.min(10,i*t)))},[]),I=j((r)=>{if(q<=1)return;r.stopPropagation(),F.current=!0,b.current={x:r.clientX,y:r.clientY},r.target.setPointerCapture(r.pointerId)},[q]),N=j((r)=>{if(!F.current)return;let t=r.clientX-b.current.x,i=r.clientY-b.current.y;b.current={x:r.clientX,y:r.clientY},L((o)=>({x:o.x+t,y:o.y+i}))},[]),R=j(()=>{F.current=!1},[]),p=j(()=>{X(1),L({x:0,y:0})},[]);if(!v)return G("div",{class:"image-node-empty",children:[G("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),G("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let l=P.w>0?`${P.w}×${P.h}`:"",T=Math.round(q*100);return G("div",{class:`image-node ${U?"image-node-expanded":""}`,ref:H,children:[z.length>0&&G("div",{class:"image-node-warning-stack",children:z.map((r)=>G("div",{class:"image-node-warning",children:[G("span",{class:"image-node-warning-title",children:r.title},void 0,!1,void 0,this),G("span",{class:"image-node-warning-detail",children:r.detail},void 0,!1,void 0,this)]},`${r.title}-${r.detail}`,!0,void 0,this))},void 0,!1,void 0,this),G("div",{class:"image-node-viewport",onWheel:A,onPointerDown:I,onPointerMove:N,onPointerUp:R,style:{cursor:q>1?"grab":"default"},children:[!W&&!Y&&G("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),Y&&G("div",{class:"image-node-error",children:[G("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),G("div",{children:"Failed to load image"},void 0,!1,void 0,this),G("div",{class:"image-node-error-path",children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("img",{src:K,alt:J,onLoad:V,onError:E,draggable:!1,style:{transform:`translate(${B.x}px, ${B.y}px) scale(${q})`,opacity:W?1:0,display:Y?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(_||l||q!==1)&&G("div",{class:"image-node-footer",children:[_&&G("span",{class:"image-node-caption",children:_},void 0,!1,void 0,this),G("span",{class:"image-node-meta",children:[l&&G("span",{children:l},void 0,!1,void 0,this),q!==1&&G("button",{type:"button",class:"image-node-zoom-reset",onClick:p,title:"Reset zoom",children:[T,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function cX({node:$}){if(($.data.children??[]).filter((J)=>D.value.has(J)).length>0)return null;return G("div",{class:"group-empty-hint",children:"Drop nodes here — release while the frame lights up to add them"},void 0,!1,void 0,this)}function Gw($){try{return new URL($).host}catch{return $}}function Ww($){if(!$)return null;let U=new Date($);return Number.isNaN(U.getTime())?null:U.toLocaleString()}function H9({node:$,expanded:U=!1}){let v=typeof $.data.url==="string"?$.data.url:"",J=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",_=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",K=typeof $.data.status==="string"?$.data.status:"idle",W=typeof $.data.error==="string"?$.data.error:"",O=Ww(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),Y=typeof $.data.statusCode==="number"?$.data.statusCode:null,Z=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",q=$.data.frameBlocked===!0,X=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[B,L]=f(!1),[P,k]=f(U);u(()=>{if(U)k(!0)},[U]);let H=j(async()=>{if(!v||B)return;L(!0);try{await h2($.id)}finally{L(!1)}},[$.id,B,v]);if(!v)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let F=K==="ready"?"var(--c-ok)":K==="error"?"var(--c-danger)":"var(--c-warn)";return G("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[G("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[G("div",{style:{minWidth:0,flex:1},children:[G("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:Gw(v)},void 0,!1,void 0,this),G("div",{style:{fontSize:U?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:J||$.data.title||v},void 0,!1,void 0,this),G("a",{href:v,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:F,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[G("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:F}},void 0,!1,void 0,this),K]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(_||Z)&&G("div",{style:{display:"grid",gridTemplateColumns:Z&&U?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[Z&&U&&G("img",{src:Z,alt:J||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),_&&G("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:U?"14px":"12px"},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[G("button",{type:"button",onClick:H,disabled:B,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:B?"progress":"pointer",fontSize:"12px"},children:B||K==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),U&&!q&&G("button",{type:"button",onClick:()=>k((b)=>!b),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:P?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>window.open(v,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&q&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),G("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:X||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&P&&!q&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),G("iframe",{class:"webpage-node-iframe",title:J||$.data.title||v,src:v,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:U?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(O||Y!==null)&&G("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[O&&G("span",{children:["Fetched ",O]},void 0,!0,void 0,this),Y!==null&&G("span",{children:["HTTP ",Y]},void 0,!0,void 0,this),q&&G("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&G("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:W},void 0,!1,void 0,this),G("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:U?"14px":"10px"},children:z?G("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:U?"14px":"12px"},children:z},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:K==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lX($){return $.type==="html"&&$.data.presentation===!0}function $2({node:$,expanded:U=!1,presentation:v=!1,presentationExitToken:J,autoFocus:_=!1}){let z=C(null),K=$6.value,W=u$(()=>`theme-${crypto.randomUUID()}`,[]),O=u$(()=>`ax-${crypto.randomUUID()}`,[]),Y=u$(()=>`frame-${crypto.randomUUID()}`,[]),Z=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",q=u$(()=>SU(Z),[Z]),X=u$(()=>Z?s0($.id,{theme:K,themeToken:W,present:v,presentToken:J,v:q,axToken:O,frameToken:Y}):"",[Z,v,J,W,q,$.id,O,Y]),B=yU(X);TU($,z,U?"":Y),Q0({enabled:!0,token:O,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),u(()=>{if(z.current?.contentWindow?.postMessage({source:n6,type:"theme-update",token:W,theme:K},"*"),_)z.current?.focus()},[K,W]);let L=$.data.axCapabilities,P=L?.enabled===!0&&(!Array.isArray(L.allowed)||L.allowed.length>0),k=K4.value;u(()=>{if(!P||k==null)return;z.current?.contentWindow?.postMessage({source:n6,type:"ax-update",token:O,state:k},"*")},[P,k,O]),u(()=>{if(!_)return;let F=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(F)},[_,X]);let H=()=>{if(z.current?.contentWindow?.postMessage({source:n6,type:"theme-update",token:W,theme:K},"*"),P&&K4.value!=null)z.current?.contentWindow?.postMessage({source:n6,type:"ax-update",token:O,state:K4.value},"*");if(_)z.current?.focus()};if(!Z)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return G("iframe",{ref:z,class:v?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",...B,tabIndex:_?0:void 0,onLoad:H,style:{width:"100%",height:"100%",minHeight:v?0:U?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:v?0:"6px",display:"block"}},void 0,!1,void 0,this)}var TW=null;async function rX(){if(!TW)TW=await FY();return TW}function iX($,U){if(!$)return null;let v=$.toLowerCase(),J=U.find((z)=>z.name.toLowerCase()===v);if(J)return J.name;let _=U.filter((z)=>z.name.toLowerCase().startsWith(v));return _.length===1?_[0].name:null}function Ow($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function Yw({html:$}){let U=C(null);return u(()=>{let v=U.current;if(!v)return;if(v.replaceChildren(),!$)return;let J=document.createElement("template");J.innerHTML=$,v.append(J.content.cloneNode(!0))},[$]),G("div",{ref:U},void 0,!1,void 0,this)}function Zw($,U){return`${$.role}:${$.status??"none"}:${U}:${$.text}`}function pX({count:$}){if($===0)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function oX({message:$,onDismiss:U}){if(!$)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[G("span",{style:{flex:1},children:$},void 0,!1,void 0,this),G("button",{type:"button",onClick:U,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Q9({node:$,expanded:U=!1}){let v=Array.isArray($.data.turns)?$.data.turns:[],J=v.length===0,_=$.data.text||"",z=$.data.status||"draft",K=J?z:$.data.threadStatus||"draft",W=K==="draft",O=K==="pending"||K==="sending",Y=K==="streaming",Z=K==="answered",[q,X]=f(""),[B,L]=f(""),[P,k]=f(null),[H,F]=f(new Map),b=C(null),V=C(null),E=v[v.length-1],A=`${v.length}:${E?.role??""}:${E?.status??""}:${Math.floor((E?.text?.length??0)/200)}`;u(()=>{if(U&&W&&b.current)b.current.focus()},[U,W]),u(()=>{if(!A)return;if(V.current)V.current.scrollTo({top:V.current.scrollHeight,behavior:"smooth"})},[A]);let I=C(null),N=C(v);N.current=v,u(()=>{let t=v.some((o)=>o.role==="assistant"&&o.status==="streaming"),i=()=>{let o=!1,B$=N.current.map((N6,g$)=>({turn:N6,index:g$})).filter(({turn:N6})=>N6.role==="assistant"&&N6.text);if(B$.length===0)return;return Promise.all(B$.map(async({turn:N6,index:g$})=>{let t$=await N4(N6.text);return{index:g$,html:Ow(t$)}})).then((N6)=>{if(o)return;let g$=new Map;for(let t$ of N6)g$.set(t$.index,t$.html);F(g$)}),()=>{o=!0}};if(!t){if(I.current)clearTimeout(I.current),I.current=null;return i()}if(I.current)clearTimeout(I.current);return I.current=setTimeout(()=>{I.current=null,i()},400),()=>{if(I.current)clearTimeout(I.current),I.current=null}},[v]);let R=j(async()=>{let t=q.trim();if(!t)return;let i=q;k(null),W$($.id,{turns:[{role:"user",text:t,status:"pending"}],threadStatus:"pending",text:t}),X("");let o=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await c0(t,$.position,$.id,o,$.id)).ok)W$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),X(i),k("Failed to send prompt. Your draft has been restored.")},[q,$.id,$.position,$.data.contextNodeIds]),p=j(async()=>{let t=B.trim();if(!t)return;let i=B;k(null);let o=Array.isArray($.data.turns)?[...$.data.turns]:[];if(o.push({role:"user",text:t,status:"pending"}),W$($.id,{turns:o,threadStatus:"pending"}),L(""),!(await PY($.id,t)).ok)o.pop(),W$($.id,{turns:o,threadStatus:"answered"}),L(i),k("Failed to send reply. Your draft has been restored.")},[B,$.id,$.data.turns]),l=j((t)=>{if(t.key==="Enter"&&(t.metaKey||t.ctrlKey)){t.preventDefault(),R();return}if(t.key==="Tab"&&q.startsWith("/")){t.preventDefault();let i=q.slice(1).split(/\s/)[0];if(i)rX().then((o)=>{let z$=iX(i,o);if(z$)X(`/${z$}`)})}},[R,q]),T=j((t)=>{if(t.key==="Enter"&&(t.metaKey||t.ctrlKey)){t.preventDefault(),p();return}if(t.key==="Tab"&&B.startsWith("/")){t.preventDefault();let i=B.slice(1).split(/\s/)[0];if(i)rX().then((o)=>{let z$=iX(i,o);if(z$)L(`/${z$}`)})}},[p,B]),r=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(W&&v.length===0)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[G(pX,{count:r},void 0,!1,void 0,this),G(oX,{message:P,onDismiss:()=>k(null)},void 0,!1,void 0,this),G("textarea",{ref:b,value:q,onInput:(t)=>X(t.target.value),onKeyDown:l,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:R,disabled:!q.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:q.trim()?"var(--c-accent)":"var(--c-line)",color:q.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:q.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(J)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:_},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-warn)":Z?"var(--c-ok)":"var(--c-muted)"},children:O?"Sending…":Z?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G(pX,{count:r},void 0,!1,void 0,this),G(oX,{message:P,onDismiss:()=>k(null)},void 0,!1,void 0,this),G("div",{ref:V,style:{flex:1,overflow:"auto",minHeight:0},children:v.map((t,i)=>G("div",{children:[i>0&&G("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),t.role==="user"?G("div",{class:"thread-turn-user",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),G("div",{style:{fontSize:U?"15px":"13px",lineHeight:U?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:t.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{class:"thread-turn-assistant",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:`status-dot${t.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),t.status==="streaming"&&!t.text&&G("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),G("div",{class:U?"md-reader-content":void 0,style:{fontSize:U?void 0:"13px",lineHeight:U?void 0:"1.55",opacity:t.text?1:0.4},children:H.get(i)?G(M$,{children:[G(Yw,{html:H.get(i)??""},void 0,!1,void 0,this),t.status==="streaming"&&G("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:t.status==="streaming"?"Waiting for response…":t.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Zw(t,i),!0,void 0,this))},void 0,!1,void 0,this),G("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:Z?"6px":0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:Y?"var(--c-accent)":O?"var(--c-warn)":Z?"var(--c-ok)":"var(--c-muted)"},children:Y?"Streaming…":O?"Sending…":Z?"Answered":K},void 0,!1,void 0,this),G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[v.length," turn",v.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z&&G("div",{class:"thread-reply-area",children:[G("textarea",{value:B,onInput:(t)=>L(t.target.value),onKeyDown:T,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:p,disabled:!B.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qw($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function Bw({html:$}){let U=C(null);return u(()=>{let v=U.current;if(!v)return;if(v.replaceChildren(),!$)return;let J=document.createElement("template");J.innerHTML=$,v.append(J.content.cloneNode(!0))},[$]),G("div",{ref:U},void 0,!1,void 0,this)}function L9({node:$,expanded:U=!1}){let v=$.data.content||"",J=$.data.status||"streaming",[_,z]=f(""),K=J==="streaming",W=J==="complete";u(()=>{if(!v){z("");return}let Y=!1;return N4(v).then((Z)=>{if(!Y)z(qw(Z))}),()=>{Y=!0}},[v]);let O=j(()=>{c0("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return G("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[K&&G("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),G("div",{class:U?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:v?1:0.4,transition:"opacity 0.2s ease"},children:_?G("div",{class:U?"md-reader-content":void 0,children:G(Bw,{html:_},void 0,!1,void 0,this)},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:K?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:K?"var(--c-accent)":W?"var(--c-ok)":"var(--c-muted)"},children:K?"Streaming…":W?"Complete":J},void 0,!1,void 0,this),W&&G("button",{type:"button",onClick:O,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function dX($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var nX={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},Xw={running:"⠋",success:"✓",failed:"✕"},Hw={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function F9({node:$}){let{toolName:U,category:v,status:J,duration:_,resultSummary:z,error:K}=dX($.data),W=nX[v]??nX.other,O=Xw[J]??"◌",Y=Hw[J]??"var(--c-muted)",Z=J==="running",q=K?K.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[G("span",{style:{fontSize:"14px",color:Y,flexShrink:0,animation:Z?"pulse 1.5s infinite":"none"},children:O},void 0,!1,void 0,this),G("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[G("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:W,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:U},void 0,!1,void 0,this),q&&G("div",{style:{fontSize:"10px",color:K?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:q},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&G("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function CW($){let U=D.value.get($);if(!U)return null;return{left:U.position.x,top:U.position.y,width:U.size.width,height:U.size.height}}function Qw($){let U=$.map((O)=>CW(O)).filter((O)=>O!==null);if(U.length===0)return null;let v=Math.min(...U.map((O)=>O.left)),J=Math.min(...U.map((O)=>O.top)),_=Math.max(...U.map((O)=>O.left+O.width)),z=Math.max(...U.map((O)=>O.top+O.height)),K=54,W=46;return{left:v-K,top:J-W,width:_-v+K*2,height:z-J+W*2}}function yW($,U){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${U}px`}}function tX(){let $=Array.from(ZU.value),U=Array.from(qU.value),v=D2.value;if($.length===0&&U.length===0)return null;let J=[...D.value.values()],_=J.length>0?(Math.max(...J.map((z)=>z.position.x+z.size.width))-Math.min(...J.map((z)=>z.position.x)))*(Math.max(...J.map((z)=>z.position.y+z.size.height))-Math.min(...J.map((z)=>z.position.y))):0;return G("div",{class:"attention-field-layer","aria-hidden":"true",children:[v.map((z)=>{let K=Qw(z.nodeIds);if(!K)return null;if(_>0&&K.width*K.height>=_*0.75)return null;return G("div",{class:"attention-field-region",style:yW(K,42)},z.id,!1,void 0,this)}),U.map((z)=>{let K=CW(z);if(!K)return null;return G("div",{class:"attention-field-node attention-field-secondary",style:yW({left:K.left-18,top:K.top-18,width:K.width+36,height:K.height+36},28)},`secondary-${z}`,!1,void 0,this)}),$.map((z)=>{let K=CW(z);if(!K)return null;return G("div",{class:"attention-field-node attention-field-primary",style:yW({left:K.left-24,top:K.top-24,width:K.width+48,height:K.height+48},30)},`primary-${z}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Lw=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),Fw=new Set(["md","mdx","markdown"]);function Pw($){let U=$.split(".").pop()?.toLowerCase()??"";if(Lw.has(U))return"image";if(Fw.has(U))return"markdown";return"file"}async function P9($,U,v){let K=Math.ceil(Math.sqrt($.length));for(let W=0;W<$.length;W++){let O=$[W],Y=W%K,Z=Math.floor(W/K),q=U-K*420/2+Y*420,X=v-150+Z*320,B=Pw(O.name),L=O.name;if(B==="image"){let P=new FileReader,k=await new Promise((H)=>{P.onload=()=>H(P.result),P.readAsDataURL(O)});await d6({type:"image",title:L,content:k,x:q,y:X,width:400,height:300})}else{let P=await O.text(),k=B==="markdown"||B==="file";await d6({type:B,title:L,content:P,x:q,y:X,width:k?720:400,height:k?500:300})}}}var s$=s(new Map),M0=s(null),kw=480,bw=320,Mw=650,U2=new Map,b0=new Map,k9=new Map,u4=null;function DW($){s$.value=$,Aw()}function jW($){let U=U2.get($);if(U)clearTimeout(U),U2.delete($)}function VW($){let U=b0.get($);if(U)clearTimeout(U),b0.delete($)}function sX($){if(jW($.id),VW($.id),!s$.value.has($.id))k9.set($.id,Date.now());let U=new Map(s$.value);U.set($.id,{...$,phase:"forming"}),DW(U)}function _2($){if(jW($),VW($),k9.delete($),!s$.value.has($))return;let U=new Map(s$.value);U.delete($),DW(U)}function aX($,U,v,J){let _=s$.value.get($);if(!_||_.phase===U)return;let z=new Map(s$.value);z.set($,{..._,phase:U,...J?{settledNodeId:J}:{}}),DW(z),jW($),U2.set($,setTimeout(()=>_2($),v))}function eX($,U,v,J){VW($);let _=Date.now()-(k9.get($)??0),z=Math.max(0,Mw-_);if(z===0){aX($,U,v,J);return}b0.set($,setTimeout(()=>{b0.delete($),aX($,U,v,J)},z))}function $H($,U){eX($,"settling",kw,U)}function fW($){eX($,"dissolving",bw)}function EW(){for(let $ of U2.values())clearTimeout($);U2.clear();for(let $ of b0.values())clearTimeout($);if(b0.clear(),k9.clear(),u4)clearInterval(u4),u4=null;M0.value=null,s$.value=new Map}function Aw(){if(u4||s$.value.size===0)return;u4=setInterval(()=>{let $=Date.now();for(let U of s$.value.values())if(U.phase==="forming"&&U.expiresAt<=$)fW(U.id);if(s$.value.size===0&&u4)clearInterval(u4),u4=null},1000),u4.unref?.()}var Iw={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function w$({size:$=16,children:U,...v}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",...Iw,...v,children:U},void 0,!1,void 0,this)}function M9($){return G(w$,{...$,children:[G("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),G("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),G("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),G("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _H($){return G(w$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),G("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function vH($){return G(w$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function n1($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),G("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function A9($){return G(w$,{...$,children:[G("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JH($){return G(w$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),G("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function I9($){return G(w$,{...$,children:G("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function uW($){return G(w$,{...$,children:[G("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),G("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),G("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mW($){return G(w$,{...$,children:[G("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),G("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),G("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xW($){return G(w$,{...$,children:[G("path",{d:"M3 4h10"},void 0,!1,void 0,this),G("path",{d:"M8 4v8"},void 0,!1,void 0,this),G("path",{d:"M6 12h4"},void 0,!1,void 0,this),G("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),G("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zH($){return G(w$,{...$,children:[G("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KH($){return G(w$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function GH($){return G(w$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function WH($){return G(w$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OH($){return G(w$,{...$,children:[G("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function I0($){return G(w$,{...$,children:G("path",{d:"M2 13 L2 4 A2 2 0 0 1 4 2 L12 2 A2 2 0 0 1 14 4 L14 9 A2 2 0 0 1 12 11 L5 11 Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function YH({size:$=22,class:U}){return G("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:U,"aria-hidden":"true",children:[G("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),G("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),G("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),G("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZH({size:$=15}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:G("path",{d:"M3 2l10 5.5-4.2 1.3L7.5 13z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function qH({size:$=15}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:G("path",{d:"M5 7.5V3.8a1 1 0 0 1 2 0V7m0-3.9a1 1 0 0 1 2 0V7m0-2.7a1 1 0 0 1 2 0V7.4m0-.9a1 1 0 0 1 2 0v3.2A4.3 4.3 0 0 1 8.7 14H8a4.3 4.3 0 0 1-3.6-2L2.7 9.3a1 1 0 0 1 1.6-1.2L5 9.2"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function BH({size:$=15}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:G("path",{d:"M6 4.5L2.5 8 6 11.5M10 4.5L13.5 8 10 11.5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function L1($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ww($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function b9($){return G(w$,{...$,children:[G("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),G("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hW($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),G("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function A0($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),G("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nw($){return G(w$,{...$,children:[G("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),G("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cW($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Sw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),G("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Tw($){return G(w$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),G("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),G("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Cw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),G("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Dw($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),G("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function UH($){return G(w$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),G("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function m4($){switch($){case"markdown":return L1;case"prompt":return ww;case"response":return gw;case"file":return b9;case"diff":return b9;case"mermaid":return UH;case"image":return hW;case"webpage":return A0;case"context":return Nw;case"group":return cW;case"status":return Sw;case"trace":return Rw;case"ledger":return Tw;case"mcp-app":return yw;case"ext-app":return Cw;case"json-render":return Dw;case"graph":return UH;case"html":return A0;default:return L1}}var XH={width:260,height:150},jw={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function rW($){return!!$&&$ in O6}function x4($){if(!$)return null;let U=D.value.get($);if(!U)return null;return{left:U.position.x,top:U.position.y,width:U.size.width,height:U.size.height}}function lW($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function v2($){let U=typeof $.confidence!=="number"?0.82:0.4+Math.max(0,Math.min(1,$.confidence))*0.55;return $.auto?U*0.62:U}function HH($,U){let v=Math.max(40,Math.abs(U.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+v} ${$.y}, ${U.x-v} ${U.y}, ${U.x} ${U.y}`}function iW({intent:$}){let U=rW($.nodeType)?m4($.nodeType):null,v=$.label||$.kind,J=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return G("div",{class:"intent-info",onMouseEnter:()=>M0.value=$.id,onMouseLeave:()=>{if(M0.value===$.id)M0.value=null},children:[G("div",{class:"intent-chip",children:[typeof $.seq==="number"&&G("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),U&&G("span",{class:"intent-chip-icon","aria-hidden":"true",children:G(U,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"intent-chip-label",children:v},void 0,!1,void 0,this),J&&G("span",{class:"intent-confidence",children:J},void 0,!1,void 0,this),$.phase==="forming"&&!$.auto&&G("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(_)=>{_.stopPropagation(),D1($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&G("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QH({intent:$,rect:U}){let v=rW($.nodeType)?m4($.nodeType):null,J=rW($.nodeType)?O6[$.nodeType]:"Node";return G("div",{class:`intent-ghost intent-ghost-box is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${U.left}px`,top:`${U.top}px`,width:`${U.width}px`,height:`${U.height}px`,opacity:v2($)},children:[G("div",{class:"intent-ghost-titlebar",children:[G("span",{class:"intent-ghost-icon","aria-hidden":"true",children:v?G(v,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),G("span",{class:"intent-ghost-badge",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(iW,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LH({intent:$,rect:U,variant:v}){return G("div",{class:`intent-ghost intent-ghost-${v} is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${U.left}px`,top:`${U.top}px`,width:`${U.width}px`,height:`${U.height}px`,opacity:v2($)},children:[v==="edit"&&G("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),G(iW,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Vw($){let U=$.phase==="settling"?x4($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let v=$.nodeType&&jw[$.nodeType]||XH,J=U??{left:$.position.x,top:$.position.y,...v};return G(QH,{intent:$,rect:J},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let J=x4($.nodeId)??XH,_=U??{left:$.position.x,top:$.position.y,width:J.width,height:J.height};return G(QH,{intent:$,rect:_},$.id,!1,void 0,this)}case"remove":{let v=U??x4($.nodeId);if(!v)return null;return G(LH,{intent:$,rect:v,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let v=U??x4($.nodeId);if(!v)return null;return G(LH,{intent:$,rect:v,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let v=x4($.edge.from),J=x4($.edge.to);if(!v||!J)return null;let _={x:(v.left+v.width/2+J.left+J.width/2)/2,y:(v.top+v.height/2+J.top+J.height/2)/2},z={left:_.x-110,top:_.y-18,width:220,height:36};return G("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}${$.auto?" is-auto":""}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:v2($)},children:G(iW,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function FH(){let $=Array.from(s$.value.values());if(u(()=>{function U(v){if(v.key!=="Escape")return;let J=M0.value;if(!J)return;let _=s$.value.get(J);if(!_||_.phase!=="forming")return;v.stopImmediatePropagation(),v.preventDefault(),D1(_)}return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[]),$.length===0)return null;return G("div",{class:"intent-layer",children:[G("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[G("defs",{children:G("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:G("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((U)=>{if(U.kind==="connect"&&U.edge){let v=x4(U.edge.from),J=x4(U.edge.to);if(!v||!J)return null;return G("path",{d:HH(lW(v),lW(J)),class:`intent-edge type-${U.edge.type}`,style:{opacity:v2(U)}},`line-${U.id}`,!1,void 0,this)}if(U.kind==="move"&&U.position){let v=x4(U.nodeId);if(!v)return null;let J=v,_={x:U.position.x+J.width/2,y:U.position.y+J.height/2};return G("path",{d:HH(lW(v),_),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:v2(U)}},`line-${U.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(Vw)]},void 0,!0,void 0,this)}var PH=32000;var w9="Agent session";function kH($){return $.some((U)=>U.attached)}function bH($){return $.filter((U)=>!U.attached)}function w0($){switch($.phase){case"thinking":return"Thinking";case"tooling":return $.detail?`Running ${$.detail}`:"Working";case"waiting-approval":return"Waiting on you";default:return"Idle"}}function F1($){let U=5381;for(let v=0;v<$.length;v++)U=(U<<5)+U+$.charCodeAt(v)|0;return(U%360+360)%360}var G6=s([]),oW=s({used:0,total:PH}),P1=s([]),t1=s(!1),g0=s(!1),dW=s(null),MH=["var(--c-purple)","var(--c-accent)","var(--c-ok)","var(--c-warn)","var(--c-danger)"],pW=new Map;function g9($){let U=pW.get($);if(U)return U;let v=MH[pW.size%MH.length];return pW.set($,v),v}function AH($){return($.trim().replace(/^[^a-z0-9]+/i,"").charAt(0)||$.trim().charAt(0)||"?").toUpperCase()}function N9($,U=Date.now()){let v=U-Date.parse($);if(!Number.isFinite(v)||v<5000)return"now";if(v<60000)return`${Math.floor(v/1000)}s`;if(v<3600000)return`${Math.floor(v/60000)}m`;return`${Math.floor(v/3600000)}h`}var F6=r$(()=>kH(G6.value)),nW=r$(()=>bH(G6.value)),IH=r$(()=>{let $=new Set;return[...G6.value].filter((U)=>U.label!==w9).sort((U,v)=>Number(v.attached)-Number(U.attached)).map((U)=>({value:U.sessionId==="browser"?U.label:U.sessionId,label:U.label,attached:U.attached,steerable:U.attached||U.steerable===!0,pendingSteers:U.pendingSteers??0,polling:U.lastClaimAt!==void 0&&Date.now()-Date.parse(U.lastClaimAt)<300000})).filter((U)=>$.has(U.value)?!1:($.add(U.value),!0))}),wH=r$(()=>G6.value.filter(($)=>$.attached)),N0=r$(()=>G6.value.find(($)=>$.attached)??null);function fw($){let U=new Set;for(let v of $)if(v.nodeId&&v.kind!=="create")U.add(v.nodeId);return U}var gH=r$(()=>fw(s$.value.values()));function S9($,U){if($.cursor)return{x:$.cursor.x,y:$.cursor.y};if(!$.focusNodeId)return null;let v=U($.focusNodeId);if(!v)return null;return{x:v.position.x+Math.max(24,v.size.width-28),y:v.position.y+16}}function tW($){if(!$)return;if(Array.isArray($.presences))G6.value=$.presences;if($.budget&&Number.isFinite($.budget.used)&&Number.isFinite($.budget.total))oW.value={used:$.budget.used,total:$.budget.total};if(Array.isArray($.activity))P1.value=$.activity}function NH(){let $=C(new Map),U=G$.value.scale,v=D.value,J=1/Math.max(0.05,U),_=G6.value.map((z)=>{let K=S9(z,(O)=>v.get(O));if(K)$.current.set(z.sessionId,K);let W=K??$.current.get(z.sessionId)??null;return W?{presence:z,position:W}:null}).filter((z)=>z!==null);if(_.length===0)return null;return G("div",{class:"agent-presence-layer","aria-hidden":"true",children:_.map(({presence:z,position:K})=>G("div",{class:`agent-cursor phase-${z.phase}${z.attached?"":" is-external"}${z.parentAgentId?" is-worker":""}`,"data-session-id":z.sessionId,style:{transform:`translate(${K.x}px, ${K.y}px)`,"--identity-color":`hsl(${F1(z.sessionId)} 65% 62%)`},children:G("div",{class:"agent-cursor-inner",style:{transform:`scale(${J})`},children:[G("svg",{class:"agent-cursor-glyph",width:"16",height:"18",viewBox:"0 0 16 18","aria-hidden":"true",children:G("path",{d:"M1.5 1.5L14.5 9.2 8.3 10.6 5.2 16.5z",fill:"currentColor",stroke:"var(--c-bg)","stroke-width":"1.2"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"agent-cursor-chip",children:[G("span",{class:"agent-cursor-dot"},void 0,!1,void 0,this),G("span",{class:"agent-cursor-label",children:w0(z)},void 0,!1,void 0,this),G("span",{class:"agent-cursor-who",children:z.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},z.sessionId,!1,void 0,this))},void 0,!1,void 0,this)}var SH=30000;var aW=80;function Ew($,U){try{let v=window.sessionStorage.getItem($);if(v)return v;let J=U();return window.sessionStorage.setItem($,J),J}catch{return U()}}var C9=Ew("pmx-canvas-human-client",()=>`tab-${Math.random().toString(36).slice(2,8)}`);function uw(){try{let $=new URLSearchParams(window.location.search).get("name")?.trim();if($)return window.localStorage.setItem("pmx-canvas-human-name",$),$;let U=window.localStorage.getItem("pmx-canvas-human-name")?.trim();if(U)return U}catch{}return`guest-${C9.slice(-4)}`}var TH=s(uw()),yH=s([]),sW=r$(()=>yH.value.filter(($)=>$.clientId!==C9)),a1=s(new Map);function eW($){if(!$||!Array.isArray($.humans))return;yH.value=$.humans}var T9=null,D9=null,CH=0,J2=null;function y9($){U4("humanPresence","/api/canvas/human-presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:C9,name:TH.value,...$})})}function RH(){J2=null,CH=Date.now(),y9({cursor:D9,grabbingNodeId:T9})}function j9($){D9=$;let U=Date.now()-CH;if(U>=aW){if(J2)clearTimeout(J2);RH()}else if(!J2)J2=setTimeout(RH,aW-U)}function $O($){T9=$,y9({cursor:D9,grabbingNodeId:$})}function mw($,U){let v=new Map(a1.value);v.set($,U),a1.value=v,setTimeout(()=>{let J=new Map(a1.value);if(J.get($)===U)J.delete($),a1.value=J},6000)}function DH($,U){let v=[...s$.value.values()].filter((_)=>_.nodeId===$&&!_.auto&&_.phase==="forming");if(v.length===0)return;let J=TH.value;mw($,J);for(let _ of v)D1({id:_.id,kind:_.kind,label:_.label,reason:`${J} took over “${U}” mid-edit — yield and requeue the change once it is released`}).then((z)=>{if(z)_2(_.id)});U4("yieldEvent","/api/canvas/ax/event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"yield",summary:`${J} grabbed “${U}” mid-edit — agent yielded, change requeued`,nodeIds:[$],source:"browser"})})}var R9=null;function jH(){y9({cursor:D9,grabbingNodeId:T9}),R9=setInterval(()=>y9({grabbingNodeId:T9}),3000);let $=()=>{try{navigator.sendBeacon?.("/api/canvas/human-presence",new Blob([JSON.stringify({clientId:C9,left:!0})],{type:"application/json"}))}catch{}};return window.addEventListener("pagehide",$),()=>{if(R9)clearInterval(R9);R9=null,window.removeEventListener("pagehide",$)}}function h4($=1000){let[U,v]=f(()=>Date.now());return u(()=>{if($<=0)return;v(Date.now());let J=window.setInterval(()=>v(Date.now()),$);return()=>window.clearInterval(J)},[$]),U}function VH(){let $=h4(sW.value.length>0?5000:0),U=sW.value.filter((J)=>J.cursor!==null&&(!J.lastSeenAt||$-Date.parse(J.lastSeenAt)<SH+5000));if(U.length===0)return null;let v=1/Math.max(0.05,G$.value.scale);return G("div",{class:"human-presence-layer","aria-hidden":"true",children:U.map((J)=>G("div",{class:`human-cursor${J.grabbingNodeId?" is-grabbing":""}`,"data-client-id":J.clientId,style:{transform:`translate(${J.cursor.x}px, ${J.cursor.y}px)`},children:G("div",{class:"human-cursor-inner",style:{transform:`scale(${v})`},children:[G("svg",{class:"human-cursor-glyph",width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:G("path",{d:"M3 2 L13 8 L8.5 9.5 L6.5 14 Z",fill:"currentColor",stroke:"var(--c-bg)","stroke-width":"1"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"human-cursor-tag",children:J.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},J.clientId,!1,void 0,this))},void 0,!1,void 0,this)}function V9($,U){let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:J,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:z}=Number,K=0;for(let W of $)K+=1,v=Math.min(v,W.position.x),J=Math.min(J,W.position.y),_=Math.max(_,W.position.x+W.size.width),z=Math.max(z,W.position.y+W.size.height);if(K===0)return null;return{x:v-U,y:J-U,width:_-v+U*2,height:z-J+U*2}}function _O(){let $=K4.value;return $&&typeof $==="object"?$:{}}var fH=r$(()=>_O().workItems??[]),EH=r$(()=>_O().approvalGates??[]),s1=r$(()=>EH.value.filter(($)=>$.status==="pending")),k1=r$(()=>{let $=_O().policy?.scope;return $&&Array.isArray($.nodeIds)&&$.nodeIds.length>0?{nodeIds:$.nodeIds,padding:typeof $.padding==="number"?$.padding:40}:null});async function uH($){return(await u6("setScopeFence","/api/canvas/ax/policy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:$&&$.length>0?{nodeIds:$}:null,source:"browser"})})).ok}var mH=r$(()=>EH.value.filter(($)=>$.status==="held")),xH=s({events:[],evidence:[],steering:[]}),e1=s("all");function vO($){if($==="update")return"update";if($==="steer"||$==="steering"||$==="yield")return"steer";if($==="assistant-message")return"assistant";if($==="evidence")return"evidence";return"event"}var xw=new Set(["api","mcp","sdk","cli"]);function UO($,U){if($?.trim())return $.trim();let v=U?.trim();if(v&&!xw.has(v))return v;return null}var hw=/^(node|edge|group|annotation|jsonrender|graph|render)\.|^arrange$|^canvas\.clear$|^snapshot\.restore$/,hH=s(null),z2=s(new Set),cw={prompt:"Prompt","assistant-message":"Assistant","tool-start":"Tool run","tool-result":"Tool result",failure:"Failure",approval:"Approval",steering:"Steering",command:"Command",note:"Note",policy:"Policy",yield:"Yield"};function lw($,U=40,v=[],J=null,_="all"){let z=v.find((O)=>hw.test(O.op)),K=[...v.map((O)=>({id:`update-${O.id}`,kind:"update",label:"Update",body:O.summary,createdAt:O.at,who:O.sessionId??null,...J?.actor==="agent"&&z?.id===O.id?{undoable:!0}:{}})),...$.events.map((O)=>({id:`event-${O.id}`,kind:O.kind,label:cw[O.kind]??O.kind,body:O.detail?`${O.summary} — ${O.detail}`:O.summary,createdAt:O.createdAt,who:UO(O.agentId,O.source)})),...$.evidence.map((O)=>({id:`evidence-${O.id}`,kind:"evidence",label:"Evidence",body:O.body?`${O.title} — ${O.body}`:O.title,createdAt:O.createdAt,who:UO(O.agentId,O.source)})),...$.steering.map((O)=>{let Y=O.agentId??(O.source&&O.source!=="browser"?O.source:null),Z=O.target?`→ ${O.target} · `:Y?"→ all · ":"",q=O.target&&O.delivered===!1?` — waiting for ${O.target} to pick it up`:"";return{id:`steer-${O.id}`,kind:"steer",label:"Steer",body:`${Y?`${Y} `:""}${Z}${O.message}${q}`,createdAt:O.createdAt,who:UO(O.agentId,O.source)}})],W=_==="all"?K:K.filter((O)=>vO(O.kind)===_);return W.sort((O,Y)=>O.createdAt<Y.createdAt?1:O.createdAt>Y.createdAt?-1:0),W.slice(0,U)}var cH=r$(()=>lw(xH.value,40,P1.value,hH.value,e1.value));async function b1(){let[$,U]=await Promise.all([b$("refreshTimeline","/api/canvas/ax/timeline?limit=40",null),b$("refreshHistoryTop","/api/canvas/history",null)]);if(U)hH.value=U.top??null;if(!$)return;xH.value={events:Array.isArray($.events)?$.events:[],evidence:Array.isArray($.evidence)?$.evidence:[],steering:Array.isArray($.steering)?$.steering:[]}}async function JO($){if(!(await u6("undoAgentEdit","/api/canvas/undo",{method:"POST"})).ok)return!1;return z2.value=new Set([...z2.value,$.id]),await U4("undoAgentEditSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:`Undid your edit: ${$.body} — it was reverted on the board.`,source:"browser"})}),b1(),!0}async function zO($=!1){let U=await u6($?"redo":"undo",$?"/api/canvas/redo":"/api/canvas/undo",{method:"POST"});if(U.ok)b1();return U.ok}async function lH($,U){if(!(await u6("resolveGate",`/api/canvas/ax/approval/${encodeURIComponent($.id)}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({decision:U,source:"browser"})})).ok)return!1;if(U==="rejected")await U4("rejectGateSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:`Rejected gate "${$.title}" — do not proceed with it.`,source:"browser"})});return!0}async function rH($){return(await u6("reopenGate",`/api/canvas/ax/approval/${encodeURIComponent($.id)}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"browser"})})).ok}async function iH($,U){return(await u6("sendSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:$,source:"browser",...U?{target:U}:{}})})).ok}async function M1(){return(await u6("startSession","/api/canvas/ax/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"browser",label:w9,attached:!0,phase:"idle"})})).ok}async function f9($){return(await u6("endSession","/api/canvas/ax/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:$.source,agentId:$.agentId,attached:!1,endedBy:"human"})})).ok}var E9=s(null);function pH($){let{counts:U,snapshot:v}=$;if(typeof $.label!=="string"||typeof $.endedAt!=="string")return;E9.value={label:$.label,endedAt:$.endedAt,endedBy:$.endedBy==="human"||$.endedBy==="agent"||$.endedBy==="idle-timeout"?$.endedBy:void 0,unchanged:$.unchanged===!0,counts:{items:Number(U?.items??0)||0,done:Number(U?.done??0)||0,cancelled:Number(U?.cancelled??0)||0,rejected:Number(U?.rejected??0)||0,held:Number(U?.held??0)||0},snapshot:v&&typeof v.id==="string"?{id:v.id,name:String(v.name??"")}:null}}function oH(){E9.value=null}function dH(){if(!F6.value)return null;let $=k1.value;if(!$)return null;let U=D.value,v=$.nodeIds.map((z)=>U.get(z)).filter((z)=>z!==void 0),J=V9(v,$.padding);if(!J)return null;let _=1/Math.max(0.05,G$.value.scale);return G("div",{class:"scope-fence","data-fenced-count":v.length,style:{transform:`translate(${J.x}px, ${J.y}px)`,width:`${J.width}px`,height:`${J.height}px`},"aria-hidden":"true",children:[G("span",{class:"scope-fence-pill scope-fence-pill-top",style:{transform:`scale(${_})`},children:["Agent scope · ",v.length," node",v.length===1?"":"s"]},void 0,!0,void 0,this),G("span",{class:"scope-fence-pill scope-fence-pill-bottom",style:{transform:`scale(${_})`},children:"writes outside are blocked · reads allowed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var u9={markdown:"var(--c-accent)","mcp-app":"var(--c-ok)",webpage:"var(--c-warn)","json-render":"var(--c-ok)",graph:"var(--c-purple)",prompt:"var(--c-accent)",response:"var(--c-ok)",status:"var(--c-warn)",context:"var(--c-muted)",ledger:"var(--c-dim)",trace:"var(--c-purple)",file:"var(--c-accent)",diff:"var(--c-ok)",mermaid:"var(--c-purple)",image:"var(--c-ok)",html:"var(--c-warn)",group:"var(--c-accent)"};function rw($){let U=typeof $==="number"&&Number.isFinite($)?Math.floor($):1;return Math.max(1,Math.min(20,U))}function m9($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function K2($){return typeof $==="string"&&$.length>0}function nH($){let U=$.axStep;if(!m9(U))return null;if(!K2(U.flowId)||!K2(U.workItemId))return null;if(typeof U.index!=="number"||typeof U.total!=="number")return null;return{flowId:U.flowId,index:U.index,total:U.total,workItemId:U.workItemId}}function tH($){let U=$.axFlow;if(!m9(U)||!K2(U.flowId)||!Array.isArray(U.steps))return null;let v=[];for(let _ of U.steps){if(!m9(_)||!K2(_.nodeId)||!K2(_.workItemId))return null;if(typeof _.index!=="number")return null;v.push({index:_.index,nodeId:_.nodeId,workItemId:_.workItemId,title:typeof _.title==="string"?_.title:""})}if(v.length===0)return null;let J=m9(U.loop)?U.loop:{};return{flowId:U.flowId,title:typeof U.title==="string"?U.title:"Flow",steps:v,loop:{running:J.running===!0,run:typeof J.run==="number"&&Number.isFinite(J.run)?Math.max(0,Math.floor(J.run)):0,maxRuns:rw(J.maxRuns)}}}var iw={position:"sticky",bottom:"calc(-1 * var(--ax-dock-bleed, 12px))",marginTop:"12px",marginLeft:"calc(-1 * var(--ax-dock-bleed, 12px))",marginRight:"calc(-1 * var(--ax-dock-bleed, 12px))",marginBottom:"calc(-1 * var(--ax-dock-bleed, 12px))",padding:"9px var(--ax-dock-pad, 12px) 10px",background:"var(--c-panel-overlay)",borderTop:"1px solid var(--c-line)",backdropFilter:"blur(6px)"},sH={display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},eH={fontSize:"10px",color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginRight:"auto"},$Q={...V1,background:"var(--c-accent-25)",color:"var(--c-text)"},pw=[{status:"in-progress",label:"Start",toast:"Step started"},{status:"done",label:"Done",toast:"Step done"},{status:"blocked",label:"Blocked",toast:"Step blocked"}];async function aH($,U,v){let J={...U,loop:v};W$($.id,{axFlow:J}),await b6($.id,{data:{axFlow:J}})}function UQ($){return typeof $?.axWorkStatus==="string"?$.axWorkStatus:"todo"}function ow({node:$,flow:U}){let[v,J]=f(""),{running:_,run:z,maxRuns:K}=U.loop,W=async()=>{await aH($,U,{running:!0,run:z>=K?0:z,maxRuns:K});let Y=U.steps.find((q)=>UQ(D.value.get(q.nodeId)?.data)!=="done"),Z=Y??U.steps[U.steps.length-1];await t4($,"ax.work.update",{id:Z.workItemId,status:Y?"in-progress":"done"},"Loop running")},O=async()=>{let Y=v.trim();if(!Y)return;await t4($,"ax.steer",{message:Y},"Steering sent"),J("")};return G("div",{class:"ax-flow-controls",style:{...sH,marginTop:"6px",rowGap:"4px"},children:[G("span",{class:"ax-flow-runs",style:eH,children:_?`Loop running · run ${z+1}/${K}`:`Loop idle · ${z}/${K} runs`},void 0,!1,void 0,this),_?G("button",{type:"button",class:"ax-node-action",style:$Q,title:"Stop the loop now. The stop is persisted on this node, so it survives a refresh and no further step is opened.",onClick:(Y)=>{Y.stopPropagation(),aH($,U,{...U.loop,running:!1})},children:"Stop"},void 0,!1,void 0,this):G("button",{type:"button",class:"ax-node-action",style:V1,title:"Run this flow as a loop: each completed step opens the next one, and the last step starts the next run — until the run cap is reached or you press Stop.",onClick:(Y)=>{Y.stopPropagation(),W()},children:"Run loop"},void 0,!1,void 0,this),G("input",{class:"ax-flow-steer-input",value:v,placeholder:"Steer the agent…","aria-label":"Steer the agent",onInput:(Y)=>J(Y.target.value),onClick:(Y)=>Y.stopPropagation(),onKeyDown:(Y)=>{if(Y.key!=="Enter")return;Y.stopPropagation(),O()},style:{flex:"1 1 120px",minWidth:"90px",fontSize:"10px",padding:"3px 6px",borderRadius:"4px",border:"1px solid var(--c-line)",background:"var(--c-panel-overlay)",color:"var(--c-text)"}},void 0,!1,void 0,this),G("button",{type:"button",class:"ax-node-action",style:V1,title:"Send a steering message to the agent working this flow.",onClick:(Y)=>{Y.stopPropagation(),O()},children:"Steer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function x9({node:$}){let U=nH($.data);if(!U)return null;let v=tH($.data),J=UQ($.data);return G("div",{class:"ax-step-dock",style:iw,children:[G("div",{class:"ax-step-controls",style:sH,children:[G("span",{class:"ax-step-position",style:eH,children:["Step ",U.index,"/",U.total]},void 0,!0,void 0,this),pw.map((_)=>G("button",{type:"button",class:"ax-node-action","aria-pressed":J===_.status,style:J===_.status?$Q:V1,title:`Set this step's work item to "${_.status}".`,onClick:(z)=>{z.stopPropagation(),t4($,"ax.work.update",{id:U.workItemId,status:_.status},_.toast)},children:_.label},_.status,!1,void 0,this))]},void 0,!0,void 0,this),v&&G(ow,{node:$,flow:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var S0=8,$U=s(null),R0=[],T0=[],JQ=null;function _Q($){let U=$?.data.parentGroup;return typeof U==="string"&&U.length>0?U:null}function vQ($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((U)=>typeof U==="string")}function dw($,U){let v=new Map(U.map((W)=>[W.id,W])),J=new Set([$]),_=v.get($);if(!_)return J;let z=_Q(_);while(z&&!J.has(z))J.add(z),z=_Q(v.get(z));if(_.type!=="group")return J;let K=[...vQ(_)];while(K.length>0){let W=K.pop();if(!W||J.has(W))continue;J.add(W);let O=v.get(W);if(O?.type==="group")K.push(...vQ(O))}return J}function zQ($,U){R0=[],T0=[],JQ=$;let v=Array.from(U),J=dw($,v);for(let _ of v){if(J.has(_.id))continue;let z=_.position.x,K=_.position.x+_.size.width,W=_.position.x+_.size.width/2,O=_.position.y,Y=_.position.y+_.size.height,Z=_.position.y+_.size.height/2;R0.push({val:z,minY:O,maxY:Y}),R0.push({val:K,minY:O,maxY:Y}),R0.push({val:W,minY:O,maxY:Y}),T0.push({val:O,minX:z,maxX:K}),T0.push({val:Y,minX:z,maxX:K}),T0.push({val:Z,minX:z,maxX:K})}}function KQ(){R0=[],T0=[],JQ=null}function GQ($,U,v,J){let _=[$,$+v/2,$+v],z=[U,U+J/2,U+J],K=[0,v/2,v],W=[0,J/2,J],O=null,Y=S0+1,Z=null;for(let P=0;P<3;P++){let k=_[P];for(let H of R0){let F=Math.abs(k-H.val);if(F<Y)Y=F,O=H.val-K[P],Z={axis:"x",pos:H.val,from:Math.min(H.minY,U),to:Math.max(H.maxY,U+J)}}}let q=null,X=S0+1,B=null;for(let P=0;P<3;P++){let k=z[P];for(let H of T0){let F=Math.abs(k-H.val);if(F<X)X=F,q=H.val-W[P],B={axis:"y",pos:H.val,from:Math.min(H.minX,$),to:Math.max(H.maxX,$+v)}}}let L=[];if(Z&&Y<=S0)L.push(Z);if(B&&X<=S0)L.push(B);return{x:O!==null&&Y<=S0?O:$,y:q!==null&&X<=S0?q:U,guides:L}}function WQ({nodeId:$,viewport:U,onMove:v,onDragEnd:J}){let _=C(!1),z=C({x:0,y:0}),K=C({x:0,y:0});return j((O,Y,Z)=>{O.stopPropagation(),O.preventDefault(),_.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:O.clientX,y:O.clientY},K.current={x:Y,y:Z};let q=null,X=null,B=()=>{if(X=null,!_.current||!q)return;let k=q;q=null;let H=U.value.scale,F=(k.x-z.current.x)/H,b=(k.y-z.current.y)/H;v($,K.current.x+F,K.current.y+b)},L=(k)=>{if(!_.current)return;if(q={x:k.clientX,y:k.clientY},X!==null)return;X=window.requestAnimationFrame(B)},P=()=>{if(X!==null)window.cancelAnimationFrame(X),B();_.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",P),document.removeEventListener("pointercancel",P),J()};document.addEventListener("pointermove",L),document.addEventListener("pointerup",P),document.addEventListener("pointercancel",P)},[$,U,v,J])}var nw=200,tw=100;function OQ({nodeId:$,viewport:U,onResize:v,onResizeEnd:J}){let _=C(!1),z=C({x:0,y:0}),K=C({w:0,h:0});return j((O,Y,Z)=>{O.stopPropagation(),O.preventDefault(),_.current=!0,z.current={x:O.clientX,y:O.clientY},K.current={w:Y,h:Z},document.documentElement.classList.add("is-node-resizing");let q=null,X=null,B=()=>{if(X=null,!_.current||!q)return;let k=q;q=null;let H=U.value.scale,F=(k.x-z.current.x)/H,b=(k.y-z.current.y)/H;v($,Math.max(nw,K.current.w+F),Math.max(tw,K.current.h+b))},L=(k)=>{if(!_.current)return;if(q={x:k.clientX,y:k.clientY},X!==null)return;X=window.requestAnimationFrame(B)},P=()=>{if(X!==null)window.cancelAnimationFrame(X),B();_.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",P),document.removeEventListener("pointercancel",P),J()};document.addEventListener("pointermove",L),document.addEventListener("pointerup",P),document.addEventListener("pointercancel",P)},[$,U,v,J])}var aw={ArrowLeft:{dx:-1,dy:0},ArrowRight:{dx:1,dy:0},ArrowUp:{dx:0,dy:-1},ArrowDown:{dx:0,dy:1}};function sw($,U,v){let J=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,z=null,K=Number.POSITIVE_INFINITY;for(let W of v){if(W.id===$.id)continue;let O=W.position.x+W.size.width/2-J,Y=W.position.y+W.size.height/2-_,Z=O*U.dx+Y*U.dy;if(Z<=0)continue;let q=Math.abs(O*U.dy)+Math.abs(Y*U.dx);if(q>Z)continue;let X=Z+q*2;if(X<K)K=X,z=W}return z}var ew=0.4,$g=0.55,Ug=175;function _g($,U,v=0){if(!Number.isFinite($)||$>=1)return 1;let _=Math.min(2.2,1/Math.max($,0.01));if(Number.isFinite(U)&&U>0)_=Math.min(_,U*ew/RU);if(Number.isFinite(v)&&v>0)_=Math.min(_,v*$g/Ug);return Math.max(1,_)}function YQ({node:$,children:U,onContextMenu:v}){let J=C$.value===$.id,_=A$.value.has($.id),z=j$.value.has($.id),K=ZU.value.has($.id),W=!K&&qU.value.has($.id),O=j2.value.has($.id),Y=!J&&nY.value.has($.id),Z=s4.value,q=Z!==null&&Z.has($.id),X=Z!==null&&!Z.has($.id),[B,L]=f(!1),P=C(null),k=j((y,L$,i$)=>{let y$=GQ(L$,i$,$.size.width,$.size.height),Y4=D.value.get(y);if(Y4?.position.x===y$.x&&Y4.position.y===y$.y){$U.value=y$.guides.length>0?y$.guides:null;return}Y6(y,{position:{x:y$.x,y:y$.y}}),$U.value=y$.guides.length>0?y$.guides:null,eY(y)},[$.size.width,$.size.height]),H=C(null),F=j(()=>{if(KQ(),$U.value=null,$O(null),H.current)document.removeEventListener("keydown",H.current),H.current=null;v6();let y=R4.value;if(sY(),!y||y.nodeId!==$.id)return;if(y.mode==="add")g8(y.groupId,[$.id]);else{let L$=D.value.get(y.groupId),i$=Array.isArray(L$?.data.children)?L$.data.children.filter((y$)=>typeof y$==="string"&&y$!==$.id):[];l2(y.groupId,i$)}},[$.id]),b=WQ({nodeId:$.id,viewport:G$,onMove:k,onDragEnd:F}),V=j((y,L$,i$)=>{let y$=D.value.get(y);if(y$?.size.width===L$&&y$.size.height===i$)return;Y6(y,{size:{width:L$,height:i$}})},[]),E=j(()=>{W$($.id,{userResized:!0}),b6($.id,{data:{userResized:!0}}),v6()},[$.id]),A=OQ({nodeId:$.id,viewport:G$,onResize:V,onResizeEnd:E}),I=j((y)=>{y.stopPropagation(),y.preventDefault(),o$.value={fromId:$.id,fromX:$.position.x+$.size.width/2,fromY:$.position.y+$.size.height/2,cursorX:$.position.x+$.size.width/2,cursorY:$.position.y+$.size.height/2,targetId:null}},[$.id,$.position.x,$.position.y,$.size.width,$.size.height]),N=j((y)=>{if(B)return;if(R6.value==="connect"){I(y);return}if(y.shiftKey){y.stopPropagation(),u8($.id);return}if(D4($.id),$O($.id),DH($.id,typeof $.data.title==="string"&&$.data.title?$.data.title:$.type),zQ($.id,D.value.values()),$.type!=="group"){let L$=(i$)=>{if(i$.key==="Escape")aY()};H.current=L$,document.addEventListener("keydown",L$)}b(y,$.position.x,$.position.y)},[$.id,$.type,$.data.title,$.position.x,$.position.y,b,B,I]),R=j((y)=>{if(y.stopPropagation(),R6.value==="connect"){I(y);return}if(y.shiftKey){u8($.id);return}D4($.id)},[$.id,I]),p=j((y)=>{if(v)v(y,$.id)},[v,$.id]),l=j((y)=>{let L$=y.target;if(L$&&L$!==y.currentTarget&&L$.closest('input, textarea, [contenteditable="true"]'))return;let i$=aw[y.key];if(i$){y.preventDefault();let y$=sw($,i$,D.value.values());if(!y$)return;D4(y$.id),requestAnimationFrame(()=>{document.querySelector(`.canvas-node[data-node-id="${CSS.escape(y$.id)}"]`)?.focus()})}else if(y.key==="Enter"&&y.target===y.currentTarget&&r0.has($.type))y.preventDefault(),X4($.id)},[$]),T=j((y)=>{y.stopPropagation(),L(!0),requestAnimationFrame(()=>P.current?.focus())},[]),r=$.data.title||($.type==="file"?($.data.path||$.data.content||"").split(/[\\/]/).pop()??"":"")||O6[$.type],t=j((y)=>{let L$=y.trim();if(L$&&L$!==r)W$($.id,{title:L$}),b6($.id,{title:L$});L(!1)},[$.id,r]),i=C(null),o=C(!1),z$=C(null);u(()=>{if(o.current||!Y5($))return;let y=i.current;if(!y)return;let L$=new ResizeObserver(()=>{if(o.current){L$.disconnect();return}let i$=y.scrollHeight,y$=Jq($,i$);if(y$===null)return;if(Math.abs(y$-$.size.height)>8){if(AU($.id,{width:$.size.width,height:y$}),z$.current!==null)window.clearTimeout(z$.current);z$.current=window.setTimeout(()=>{v6({recordHistory:!1}),z$.current=null},0)}o.current=!0,L$.disconnect()});return L$.observe(y),()=>{if(L$.disconnect(),z$.current!==null)window.clearTimeout(z$.current),z$.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.size.width,$.size.height]);let B$=$.pinned,N6=$.type==="trace",g$=N6&&$.data.status==="running",t$=$.type==="group",W4=$.data.strictSize===!0,b4=Math.max(G$.value.scale,0.01),S=_g(b4,$.collapsed?0:$.size.height,$.size.width),e=t$&&$.data.color?$.data.color:void 0,H$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":S.toFixed(3),...e?{"--group-color":e}:{}},K$=F6.value&&gH.value.has($.id),U$=["canvas-node",J?"active":"",Y?"neighbor":"",q?"search-match":"",X?"search-dimmed":"",_?"selected":"",z?"context-pinned":"",K?"attention-focus-primary":"",W?"attention-focus-secondary":"",O?"attention-pulse":"",B$?"pinned":"",N6?"trace-node":"",g$?"trace-running":"",t$?"group-node":"",W4?"strict-size":"",K$?"agent-mutating":""].filter(Boolean).join(" "),_$=t$?(Array.isArray($.data.children)?$.data.children:[]).filter((y)=>typeof y==="string"&&D.value.has(y)):[],[J$,n]=f(!1),O$=R4.value,P6=t$&&O$?.groupId===$.id&&O$.mode==="add",E6=t$&&O$?.groupId===$.id&&O$.mode==="remove",O4=o$.value?.targetId===$.id,k6=t$?[...new Set(_$.map((y)=>D.value.get(y)?.type).filter((y)=>!!y))].slice(0,4):[];if(t$&&$.collapsed)return G("div",{class:`${U$} group-chip`,"data-node-type":$.type,style:{...H$,width:"auto",height:"auto"},onPointerDown:R,onContextMenu:p,title:"Expand group","data-testid":"group-chip",children:G("div",{class:"node-titlebar group-chip-inner",onPointerDown:N,children:[G("button",{type:"button",class:"group-chip-expand","aria-label":`Expand group ${r}`,onClick:(y)=>{y.stopPropagation(),IU($.id)},children:"▸"},void 0,!1,void 0,this),G("div",{class:"group-chip-text",children:[G("div",{class:"group-chip-name",children:r},void 0,!1,void 0,this),G("div",{class:"group-chip-meta",children:[k6.map((y)=>G("span",{class:"group-kind-dot",style:{background:u9[y]},"aria-hidden":"true"},y,!1,void 0,this)),G("span",{class:"group-chip-count",children:[_$.length," node",_$.length===1?"":"s"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return G("div",{class:`${U$}${P6?" is-drop-target":""}${E6?" is-drop-source":""}${O4?" is-edge-target":""}${t$&&J$?" group-menu-open":""}`,"data-node-type":$.type,"data-node-id":$.id,style:H$,tabIndex:J?0:-1,onKeyDown:l,onPointerDown:R,onMouseDown:(y)=>{if(y.shiftKey)y.preventDefault()},onContextMenu:p,children:[t$&&G("div",{class:"node-titlebar group-edge-row",onPointerDown:N,children:[G("span",{class:"group-name-pill",children:[B?G("input",{ref:P,class:"node-title-input group-title-input",value:r,onBlur:(y)=>t(y.target.value),onKeyDown:(y)=>{if(y.key==="Enter")t(y.target.value);if(y.key==="Escape")L(!1)},onClick:(y)=>y.stopPropagation()},void 0,!1,void 0,this):G("span",{class:"group-name",onDblClick:T,title:`${r} — double-click to rename`,children:r},void 0,!1,void 0,this),G("span",{class:"group-count",children:_$.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"group-edge-spacer"},void 0,!1,void 0,this),G("span",{class:"group-actions",role:"toolbar","aria-label":`${r} actions`,children:[G("button",{type:"button",class:"group-action",title:"Auto-arrange children","aria-label":"Auto-arrange children",disabled:_$.length===0,onClick:(y)=>{y.stopPropagation(),g8($.id,_$,"grid")},children:G("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"group-action",title:"Collapse group","aria-label":"Collapse group",onClick:(y)=>{y.stopPropagation(),IU($.id)},children:G("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:G("path",{d:"M3 10 L8 5 L13 10"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"group-action",title:"Rename · Ungroup · Pin all to context","aria-label":"Group menu","aria-expanded":J$,onClick:(y)=>{y.stopPropagation(),n((L$)=>!L$)},children:"⋯"},void 0,!1,void 0,this),J$&&G("div",{class:"group-menu",role:"menu",onPointerDown:(y)=>y.stopPropagation(),children:[G("button",{type:"button",role:"menuitem",onClick:(y)=>{y.stopPropagation(),n(!1),L(!0),requestAnimationFrame(()=>P.current?.focus())},children:"Rename"},void 0,!1,void 0,this),G("button",{type:"button",role:"menuitem",onClick:(y)=>{y.stopPropagation(),n(!1),h6($.id),XU($.id)},children:"Ungroup"},void 0,!1,void 0,this),G("button",{type:"button",role:"menuitem",disabled:_$.length===0,onClick:(y)=>{y.stopPropagation(),n(!1),$v(_$)},children:"Pin all to context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!t$&&G("div",{class:"node-titlebar",onPointerDown:N,children:[G("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let y=m4($.type);return G(y,{size:Math.round(14*S)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),typeof $.data.axWorkStatus==="string"&&G("span",{class:`node-ax-status node-ax-status-${$.data.axWorkStatus}`,children:$.data.axWorkStatus},void 0,!1,void 0,this),B?G("input",{ref:P,class:"node-title-input",value:r,onBlur:(y)=>t(y.target.value),onKeyDown:(y)=>{if(y.key==="Enter")t(y.target.value);if(y.key==="Escape")L(!1)},onClick:(y)=>y.stopPropagation()},void 0,!1,void 0,this):G("span",{class:"node-title",onDblClick:T,title:`${r} — double-click to rename`,children:r},void 0,!1,void 0,this),G("div",{class:"node-controls",children:[B$&&G("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(y)=>{y.stopPropagation(),e4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),Fv($)&&G("button",{type:"button",onClick:(y)=>{y.stopPropagation(),Pv($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),r0.has($.type)&&G("button",{type:"button",onClick:(y)=>{y.stopPropagation(),X4($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(y)=>{y.stopPropagation(),IU($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(y)=>{y.stopPropagation(),h6($.id),d4($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{ref:i,class:"node-body",children:[U,G(x9,{node:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{class:"node-resize-handle",onPointerDown:(y)=>A(y,$.size.width,$.size.height)},void 0,!1,void 0,this),_&&["tl","tr","bl","br"].map((y)=>G("span",{class:`node-selection-handle is-${y}`,"aria-hidden":"true"},y,!1,void 0,this)),a1.value.has($.id)&&G("span",{class:"node-yield-pill","data-testid":"yield-pill",children:[G("span",{class:"node-yield-dot","aria-hidden":"true"},void 0,!1,void 0,this),a1.value.get($.id)," took over — agent yielded"]},void 0,!0,void 0,this),!t$&&["top","right","bottom","left"].map((y)=>G("div",{class:`node-port node-port-${y}`,onPointerDown:(L$)=>{L$.stopPropagation(),L$.preventDefault();let i$=$.position.x+$.size.width/2,y$=$.position.y+$.size.height/2,Y4=$.size.width/2,B2=$.size.height/2,M4,r4;switch(y){case"top":M4=i$,r4=y$-B2;break;case"bottom":M4=i$,r4=y$+B2;break;case"left":M4=i$-Y4,r4=y$;break;case"right":M4=i$+Y4,r4=y$;break}o$.value={fromId:$.id,fromX:M4,fromY:r4,cursorX:M4,cursorY:r4}}},y,!1,void 0,this))]},void 0,!0,void 0,this)}var vg={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-muted)"},Jg=new Set(["depends-on","flow"]);function zg($){if(!Number.isFinite($)||$<=0)return 1;return $<1?1/$:1}function Kg($,U){let v=`${8*U} ${4*U}`;if($.style==="dashed")return v;if($.style==="dotted")return`${3*U} ${3*U}`;if($.type==="references"&&!$.style)return v;return}function h9($,U){let v=$.position.x+$.size.width/2,J=$.position.y+$.size.height/2,_=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2,K=_-v,W=z-J,O=$.size.width/2,Y=$.size.height/2,Z=Math.abs(W/(K||0.001)),q=Y/(O||0.001);if(Z>q){let B=W>0?1:-1;return{x:v+Y/Z*(K>0?1:-1),y:J+Y*B,side:B>0?"bottom":"top"}}let X=K>0?1:-1;return{x:v+O*X,y:J+Z*O*(W>0?1:-1),side:X>0?"right":"left"}}function c9($,U){switch($.side){case"top":return{x:$.x,y:$.y-U};case"bottom":return{x:$.x,y:$.y+U};case"left":return{x:$.x-U,y:$.y};case"right":return{x:$.x+U,y:$.y}}}function Gg($,U,v,J,_,z,K,W){return{x:0.125*$+0.375*v+0.375*_+0.125*K,y:0.125*U+0.375*J+0.375*z+0.125*W}}function Wg({edge:$,fromNode:U,toNode:v,focused:J,dimmed:_,selected:z,scale:K,onContextMenu:W}){let O=h9(U,v),Y=h9(v,U),Z=Y.x-O.x,q=Y.y-O.y,X=Math.sqrt(Z*Z+q*q),B=Math.min(Math.max(X*0.35,32),160),L=c9(O,B),P=c9(Y,B),k=`M ${O.x} ${O.y} C ${L.x} ${L.y}, ${P.x} ${P.y}, ${Y.x} ${Y.y}`,H=vg[$.type],F=Jg.has($.type),b=Kg($,K),V=Math.min(K,2.2),E=$.label&&K<=3.4?Gg(O.x,O.y,L.x,L.y,P.x,P.y,Y.x,Y.y):null,A=`edge-path-${$.id}`;return G("g",{children:[G("path",{d:k,fill:"none",stroke:"transparent","stroke-width":12*K,style:{cursor:"pointer",pointerEvents:"stroke"},onClick:(I)=>{I.stopPropagation(),T4.value=$.id},onContextMenu:W?(I)=>W(I,$.id):void 0},void 0,!1,void 0,this),(J||z)&&G("path",{d:k,fill:"none",stroke:H,"stroke-width":6*K,"stroke-dasharray":b,opacity:z?0.3:0.15,style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{id:A,d:k,class:z?"edge-selected":void 0,fill:"none",stroke:H,"stroke-width":(z?3:J?2.5:1.5)*K,"stroke-dasharray":b,"marker-end":F?"url(#edge-arrow)":void 0,opacity:z?1:_?0.2:J?1:0.85,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&G("circle",{r:3*K,fill:H,opacity:"0.9",children:G("animateMotion",{dur:"2s",repeatCount:"indefinite",children:G("mpath",{href:`#${A}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),E&&$.label&&G("g",{transform:`translate(${E.x}, ${E.y})`,children:[G("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8)*V,y:-10*V,width:($.label.length*7+16)*V,height:20*V,rx:4*V},void 0,!1,void 0,this),G("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ZQ({nodes:$,edges:U,onEdgeContextMenu:v}){let J=$.value,_=Array.from(U.value.values()),z=C$.value,K=z!==null,W=s4.value,O=W!==null,Y=zg(G$.value.scale);if(_.length===0&&!o$.value)return null;let Z=96,q=Array.from(J.values());if(q.length===0)return null;let X=Math.min(...q.map((F)=>F.position.x))-Z,B=Math.min(...q.map((F)=>F.position.y))-Z,L=Math.max(...q.map((F)=>F.position.x+F.size.width))+Z,P=Math.max(...q.map((F)=>F.position.y+F.size.height))+Z,k=Math.max(1,L-X),H=Math.max(1,P-B);return G("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${X} ${B} ${k} ${H}`,width:k,height:H,style:{position:"absolute",top:`${B}px`,left:`${X}px`,pointerEvents:"none",overflow:"visible","--edge-chrome-scale":Y.toFixed(3),"--edge-label-scale":Math.min(Y,2.2).toFixed(3)},children:[G("title",{children:"Canvas connections"},void 0,!1,void 0,this),G("defs",{children:G("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerUnits:"userSpaceOnUse",markerWidth:8*Math.min(Y,2.2),markerHeight:8*Math.min(Y,2.2),orient:"auto-start-reverse",children:G("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((F)=>{let b=e2(F.from),V=e2(F.to);if(!b||!V||b.id===V.id)return null;let E=K&&(F.from===z||F.to===z),A=O&&!(W.has(F.from)||W.has(F.to));return G(Wg,{edge:F,fromNode:b,toNode:V,focused:E,dimmed:K&&!E||A,selected:T4.value===F.id,scale:Y,onContextMenu:v},F.id,!1,void 0,this)}),o$.value&&(()=>{let F=o$.value,b=e2(F.fromId),V={position:{x:F.cursorX,y:F.cursorY},size:{width:1,height:1}},E;if(b){let A=h9(b,V),I=h9(V,b),N=I.x-A.x,R=I.y-A.y,p=Math.sqrt(N*N+R*R),l=Math.min(Math.max(p*0.35,32),160),T=c9(A,l),r=c9(I,l);E=`M ${A.x} ${A.y} C ${T.x} ${T.y}, ${r.x} ${r.y}, ${I.x} ${I.y}`}else{let A=F.cursorX-F.fromX,I=F.cursorY-F.fromY,N=Math.sqrt(A*A+I*I),R=Math.min(N*0.25,80),p=A/(N||1),l=I/(N||1);E=`M ${F.fromX} ${F.fromY} C ${F.fromX+p*R} ${F.fromY+l*R}, ${F.cursorX-p*R} ${F.cursorY-l*R}, ${F.cursorX} ${F.cursorY}`}return G("g",{children:[G("path",{d:E,fill:"none",stroke:"var(--c-accent)","stroke-width":6*Y,opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{d:E,fill:"none",stroke:"var(--c-accent)","stroke-width":2*Y,"stroke-dasharray":`${6*Y} ${4*Y}`,opacity:"0.8"},void 0,!1,void 0,this),G("circle",{cx:F.cursorX,cy:F.cursorY,r:5*Y,fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function Og($){let[U,...v]=$;if(!U)return"";return v.reduce((J,_)=>`${J} L ${_.x} ${_.y}`,`M ${U.x} ${U.y}`)}function KO({annotations:$}){if($.length===0)return null;return G("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((U)=>{let v=U.color==="currentColor"?"var(--c-annotation)":U.color;if(U.type==="text"){let J=U.points[0];if(!J||!U.text)return null;return G("text",{x:J.x,y:J.y,fill:v,"font-size":U.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:U.text},U.id,!1,void 0,this)}return G("path",{d:Og(U.points),fill:"none",stroke:v,"stroke-width":U.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},U.id,!1,void 0,this)})},void 0,!1,void 0,this)}var Yg=0.1,Zg=4,qQ=1;function BQ($){return Math.min(Zg,Math.max(Yg,$))}function XQ({viewport:$,onViewportChange:U,onViewportCommit:v,disabled:J=!1}){let _=C(null),z=C(!1),K=C({x:0,y:0}),W=C(0),O=C(null),Y=j((H)=>{if(O.current!==null)window.clearTimeout(O.current);O.current=window.setTimeout(()=>{O.current=null,v(H)},140)},[v]);function Z(H){if(H.deltaMode!==0)return H.deltaX===0;return H.deltaX===0&&Number.isInteger(H.deltaY)&&Math.abs(H.deltaY)>=50}let q=j((H)=>{if(J)return;H.preventDefault();let F=$.value;if(H.ctrlKey||H.metaKey||Z(H)){let b=_.current?.getBoundingClientRect();if(!b)return;let V=H.clientX-b.left,E=H.clientY-b.top,A=-H.deltaY*0.002,I=BQ(F.scale*(1+A)),N=I/F.scale,R={x:V-N*(V-F.x),y:E-N*(E-F.y),scale:I};U(R),Y(R)}else{let b={x:F.x-H.deltaX*qQ,y:F.y-H.deltaY*qQ,scale:F.scale};U(b),Y(b)}},[J,$,U,Y]),X=j((H)=>{if(J)return;let F=_.current;if(!F)return;if(H.button===1)H.preventDefault();else if(MU()){if(H.target!==F)return}else return;z.current=!0,K.current={x:H.clientX,y:H.clientY},F.setPointerCapture(H.pointerId)},[J]),B=j((H)=>{if(!z.current)return;if(J)return;let F=H.clientX-K.current.x,b=H.clientY-K.current.y;K.current={x:H.clientX,y:H.clientY};let V=$.value;U({x:V.x+F,y:V.y+b,scale:V.scale})},[J,$,U]),L=j(()=>{if(z.current)v($.value);z.current=!1},[v,$]),P=j((H)=>{if(J)return;if(H.touches.length!==2){W.current=0;return}H.preventDefault();let F=H.touches[0],b=H.touches[1],V=Math.hypot(b.clientX-F.clientX,b.clientY-F.clientY),E=(F.clientX+b.clientX)/2,A=(F.clientY+b.clientY)/2;if(W.current>0){let I=$.value,N=_.current?.getBoundingClientRect();if(!N)return;let R=E-N.left,p=A-N.top,l=V/W.current,T=BQ(I.scale*l),r=T/I.scale,t={x:R-r*(R-I.x),y:p-r*(p-I.y),scale:T};U(t),Y(t)}W.current=V},[J,$,U,Y]),k=j(()=>{if(O.current!==null)window.clearTimeout(O.current),O.current=null;v($.value),W.current=0},[v,$]);return u(()=>{let H=_.current;if(!H)return;return H.addEventListener("wheel",q,{passive:!1}),H.addEventListener("pointerdown",X),H.addEventListener("pointermove",B),H.addEventListener("pointerup",L),H.addEventListener("pointercancel",L),H.addEventListener("touchmove",P,{passive:!1}),H.addEventListener("touchend",k),()=>{if(O.current!==null)window.clearTimeout(O.current);H.removeEventListener("wheel",q),H.removeEventListener("pointerdown",X),H.removeEventListener("pointermove",B),H.removeEventListener("pointerup",L),H.removeEventListener("pointercancel",L),H.removeEventListener("touchmove",P),H.removeEventListener("touchend",k)}},[q,X,B,L,P,k]),_}function qg($){switch($.type){case"markdown":return G(Xv,{node:$},void 0,!1,void 0,this);case"mcp-app":return G(Q1,{node:$},void 0,!1,void 0,this);case"webpage":return G(H9,{node:$},void 0,!1,void 0,this);case"json-render":return G(Q1,{node:$},void 0,!1,void 0,this);case"graph":return G(Q1,{node:$},void 0,!1,void 0,this);case"prompt":return G(Q9,{node:$},void 0,!1,void 0,this);case"response":return G(L9,{node:$},void 0,!1,void 0,this);case"status":return G(B9,{node:$},void 0,!1,void 0,this);case"context":return G(t2,{node:$},void 0,!1,void 0,this);case"ledger":return G(Wv,{node:$},void 0,!1,void 0,this);case"trace":return G(F9,{node:$},void 0,!1,void 0,this);case"file":return G(Gv,{node:$},void 0,!1,void 0,this);case"diff":return G(a2,{node:$},void 0,!1,void 0,this);case"mermaid":return G(kv,{node:$},void 0,!1,void 0,this);case"image":return G(X9,{node:$},void 0,!1,void 0,this);case"html":return G($2,{node:$},void 0,!1,void 0,this);case"group":return G(cX,{node:$},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function Bg($,U,v){let J=v.x-U.x,_=v.y-U.y,z=J*J+_*_;if(z===0)return Math.hypot($.x-U.x,$.y-U.y);let K=Math.max(0,Math.min(1,(($.x-U.x)*J+($.y-U.y)*_)/z));return Math.hypot($.x-(U.x+K*J),$.y-(U.y+K*_))}function Xg($,U,v){for(let J=$.length-1;J>=0;J--){let _=$[J];if(!_)continue;let z=v+_.width;if(U.x<_.bounds.x-z||U.x>_.bounds.x+_.bounds.width+z||U.y<_.bounds.y-z||U.y>_.bounds.y+_.bounds.height+z)continue;if(_.type==="text")return _;for(let K=1;K<_.points.length;K++){let W=_.points[K-1],O=_.points[K];if(W&&O&&Bg(U,W,O)<=v+_.width/2)return _}}return null}var GO="currentColor",HQ=4,QQ=24,Hg=14,LQ={width:520,height:420};function Qg($){let U=$.trim();if(!U||/\s/.test(U))return null;let v=/^[a-z][a-z0-9+.-]*:/i.test(U)?U:`https://${U}`;try{let J=new URL(v);if(J.protocol!=="http:"&&J.protocol!=="https:")return null;return J.toString()}catch{return null}}function WO($){let U=$.trim();if(!U)return[];let v=U.includes(`
253
+ `)?U.split(/\r?\n/):U.split(/\s+/),J=new Set,_=[];for(let z of v){let K=z.trim();if(!K||K.startsWith("#"))continue;let W=Qg(K);if(!W||J.has(W))continue;J.add(W),_.push(W)}return _}function Lg($){let U=WO($.getData("text/uri-list"));if(U.length>0)return U;return WO($.getData("text/plain"))}function Fg($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function FQ($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function Pg($,U,v=new Set){let J=[],_=0;for(let z of $){if(v.has(z.id))continue;if(U&&z.id===U)continue;if(z.type==="group")J.splice(_++,0,z);else J.push(z)}return J}function PQ({onNodeContextMenu:$,onEdgeContextMenu:U,onCanvasContextMenu:v,annotationMode:J=!1,annotationTool:_=null}){let z=G$.value,K=C(!1),W=C(null),O=C(!1),Y=C([]),[Z,q]=f(null),[X,B]=f(null),[L,P]=f(null),k=C(null),[H,F]=f(!1),b=C(0),V=C(null),E=C(null);u(()=>{let S=null,e=Z4(()=>{G$.value;let H$=E.current;if(!H$)return;if(H$.style.willChange="transform",S)clearTimeout(S);S=setTimeout(()=>{H$.style.willChange="auto"},180)});return()=>{if(S)clearTimeout(S);e()}},[]);let A=XQ({viewport:G$,disabled:J,onViewportChange:(S)=>{if(K.current||J)return;gU(),GZ(S)},onViewportCommit:(S)=>{if(K.current||J)return;gU(),OZ(S)}}),I=j((S)=>{k.current=S,P(S)},[]),N=j(async(S,e,H$)=>{if(S.length===0)return;let{width:K$,height:U$}=LQ,_$=24,J$=Math.ceil(Math.sqrt(S.length)),n=Math.ceil(S.length/J$),O$=J$*K$+Math.max(0,J$-1)*_$,P6=n*U$+Math.max(0,n-1)*_$;for(let E6=0;E6<S.length;E6++){let O4=E6%J$,k6=Math.floor(E6/J$),y=e-O$/2+O4*(K$+_$),L$=H$-P6/2+k6*(U$+_$);await d6({type:"webpage",content:S[E6],x:y,y:L$,width:K$,height:U$})}},[]),R=j((S)=>{let e=A.current;if(!e)return;if(_==="eraser"){if((S.target instanceof Element?S.target:null)?.closest(".tool-rail, .top-bar, .snapshot-panel, .context-menu, .command-palette"))return;S.preventDefault(),S.stopPropagation();let n=e.getBoundingClientRect(),O$=G$.value,P6={x:(S.clientX-n.left-O$.x)/O$.scale,y:(S.clientY-n.top-O$.y)/O$.scale},E6=Xg(Array.from(kU.value.values()),P6,Hg/O$.scale);if(E6)KZ(E6.id);return}if(_==="text"){if((S.target instanceof Element?S.target:null)?.closest(".tool-rail, .top-bar, .snapshot-panel, .context-menu, .command-palette"))return;S.preventDefault(),S.stopPropagation(),C$.value=null,M6();let n=e.getBoundingClientRect(),O$=G$.value;I({x:(S.clientX-n.left-O$.x)/O$.scale,y:(S.clientY-n.top-O$.y)/O$.scale,value:""});return}if(_==="pen"){if((S.target instanceof Element?S.target:null)?.closest(".tool-rail, .top-bar, .snapshot-panel, .context-menu, .command-palette"))return;S.preventDefault(),S.stopPropagation(),C$.value=null,M6(),O.current=!0;let n=e.getBoundingClientRect(),O$=G$.value,P6={x:(S.clientX-n.left-O$.x)/O$.scale,y:(S.clientY-n.top-O$.y)/O$.scale};Y.current=[P6],B({id:"draft-annotation",type:"freehand",points:[P6],bounds:{x:0,y:0,width:0,height:0},color:GO,width:HQ,createdAt:""}),e.setPointerCapture(S.pointerId);return}if(S.target!==e)return;if(MU()||S.button===1){if(!S.shiftKey&&!V.current)C$.value=null,M6();return}S.preventDefault(),S.stopPropagation(),K.current=!0;let H$=e.getBoundingClientRect(),K$=S.clientX-H$.left,U$=S.clientY-H$.top,_$={startX:K$,startY:U$,currentX:K$,currentY:U$};V.current=_$,q(_$),e.setPointerCapture(S.pointerId)},[_,A]);u(()=>{return Z4(()=>{let S=G$.value,e=W.current,H$=A.current;if(!e||!H$)return;let K$=H$.getBoundingClientRect();j9({x:(e.x-K$.left-S.x)/S.scale,y:(e.y-K$.top-S.y)/S.scale})})},[]);let p=j((S)=>{{let K$=A.current;if(K$){W.current={x:S.clientX,y:S.clientY};let U$=K$.getBoundingClientRect(),_$=G$.value;j9({x:(S.clientX-U$.left-_$.x)/_$.scale,y:(S.clientY-U$.top-_$.y)/_$.scale})}}if(O.current){let K$=A.current;if(!K$)return;let U$=K$.getBoundingClientRect(),_$=G$.value,J$={x:(S.clientX-U$.left-_$.x)/_$.scale,y:(S.clientY-U$.top-_$.y)/_$.scale},n=Y.current.at(-1);if(n&&Math.hypot(J$.x-n.x,J$.y-n.y)<2)return;Y.current=[...Y.current,J$],B((O$)=>O$?{...O$,points:Y.current}:null);return}if(!K.current||!V.current)return;let e=A.current?.getBoundingClientRect();if(!e)return;let H$={...V.current,currentX:S.clientX-e.left,currentY:S.clientY-e.top};V.current=H$,q(H$)},[A]),l=j((S)=>{if(O.current){O.current=!1;let J$=Y.current;if(Y.current=[],B(null),J$.length>=2)l8({points:J$,color:GO,width:HQ});let n=A.current;if(n?.hasPointerCapture(S.pointerId))n.releasePointerCapture(S.pointerId);return}let e=V.current;if(!K.current||!e)return;K.current=!1,V.current=null;let H$=Math.min(e.startX,e.currentX),K$=Math.max(e.startX,e.currentX),U$=Math.min(e.startY,e.currentY),_$=Math.max(e.startY,e.currentY);if(K$-H$<=5&&_$-U$<=5)C$.value=null,M6();if(K$-H$>5||_$-U$>5){let J$=G$.value,n=(H$-J$.x)/J$.scale,O$=(K$-J$.x)/J$.scale,P6=(U$-J$.y)/J$.scale,E6=(_$-J$.y)/J$.scale,O4=[];for(let k6 of D.value.values()){let y=k6.position.x,L$=k6.position.y;if(y+k6.size.width>n&&y<O$&&L$+k6.size.height>P6&&L$<E6)O4.push(k6.id)}if(O4.length>0)tY(O4)}q(null)},[]);u(()=>{if(J)return;if(!O.current&&!X&&!L)return;O.current=!1,Y.current=[],B(null),I(null)},[J,X,I,L]);let T=j(()=>{let S=k.current;if(!S)return;let e=S.value.trim();if(I(null),!e)return;let H$={x:S.x,y:S.y};l8({type:"text",points:[H$],color:GO,width:QQ,text:e})},[I]);u(()=>{if(_!=="text"&&L)I(null)},[_,I,L]),u(()=>{let S=(U$,_$,J$)=>{let n=null;for(let O$ of D.value.values()){if(O$.id===J$||O$.type==="group")continue;if(U$>=O$.position.x&&U$<=O$.position.x+O$.size.width&&_$>=O$.position.y&&_$<=O$.position.y+O$.size.height)n=O$.id}return n};function e(U$){if(!o$.value)return;let _$=A.current;if(!_$)return;let J$=_$.getBoundingClientRect(),n=G$.value,O$=(U$.clientX-J$.left-n.x)/n.scale,P6=(U$.clientY-J$.top-n.y)/n.scale;o$.value={...o$.value,cursorX:O$,cursorY:P6,targetId:S(O$,P6,o$.value.fromId)}}function H$(){let U$=o$.value;if(!U$)return;o$.value=null;let _$=U$.targetId;if(!_$)return;if(U$.withLabel){g4("Edge label","label text").then((J$)=>{j1(U$.fromId,_$,"relation",J$??void 0)});return}j1(U$.fromId,_$,"relation",void 0)}function K$(U$){let _$=o$.value;if(!_$)return;if(U$.key==="Escape")U$.preventDefault(),o$.value=null;else if(U$.key==="l"||U$.key==="L")U$.preventDefault(),o$.value={..._$,withLabel:!_$.withLabel}}return document.addEventListener("pointermove",e),document.addEventListener("pointerup",H$),document.addEventListener("keydown",K$),()=>{document.removeEventListener("pointermove",e),document.removeEventListener("pointerup",H$),document.removeEventListener("keydown",K$)}},[A]);let r=j((S)=>{if(J)return;let e=A.current;if(!e||S.target!==e)return;let H$=e.getBoundingClientRect(),K$=G$.value,U$=(S.clientX-H$.left-K$.x)/K$.scale,_$=(S.clientY-H$.top-K$.y)/K$.scale,J$=520,n=360;d6({type:"markdown",title:"New note",x:U$-J$/2,y:_$-n/2,width:J$,height:n})},[J,A]),t=j((S)=>{if(J)return;if(!v)return;let e=A.current;if(!e)return;if((S.target instanceof Element?S.target:null)?.closest(".canvas-node"))return;let K$=e.getBoundingClientRect(),U$=G$.value,_$=(S.clientX-K$.left-U$.x)/U$.scale,J$=(S.clientY-K$.top-U$.y)/U$.scale;v(S,_$,J$)},[J,A,v]),i=j((S)=>{if(S.preventDefault(),b.current++,S.dataTransfer?.types.includes("Files")||Fg(S.dataTransfer))F(!0)},[]),o=j((S)=>{if(S.preventDefault(),S.dataTransfer)S.dataTransfer.dropEffect="copy"},[]),z$=j((S)=>{if(S.preventDefault(),b.current--,b.current<=0)b.current=0,F(!1)},[]),B$=j(async(S)=>{S.preventDefault(),F(!1),b.current=0;let e=A.current;if(!e||!S.dataTransfer)return;let H$=e.getBoundingClientRect(),K$=G$.value,U$=(S.clientX-H$.left-K$.x)/K$.scale,_$=(S.clientY-H$.top-K$.y)/K$.scale,J$=Array.from(S.dataTransfer.files);if(J$.length===0){let n=Lg(S.dataTransfer);await N(n,U$,_$);return}await P9(J$,U$,_$)},[A,N]);u(()=>{let S=async(e)=>{if(e.defaultPrevented)return;if(FQ(e.target instanceof Element?e.target:null))return;if(FQ(document.activeElement))return;let H$=e.clipboardData?.getData("text/plain")??"",K$=WO(H$);if(K$.length===0)return;let U$=A.current;if(!U$)return;e.preventDefault();let _$=U$.getBoundingClientRect(),J$=G$.value,n=(_$.width/2-J$.x)/J$.scale,O$=(_$.height/2-J$.y)/J$.scale;await N(K$,n,O$)};return document.addEventListener("paste",S),()=>{document.removeEventListener("paste",S)}},[A,N]);let N6=Pg(D.value.values(),n$.value,new Set(x8.value.keys())),g$=R4.value,t$=g$?D.value.get(g$.groupId):void 0,W4=g$?D.value.get(g$.nodeId):void 0,b4=null;if(Z){let S=Math.min(Z.startX,Z.currentX),e=Math.min(Z.startY,Z.currentY),H$=Math.abs(Z.currentX-Z.startX),K$=Math.abs(Z.currentY-Z.startY);b4={position:"absolute",left:`${S}px`,top:`${e}px`,width:`${H$}px`,height:`${K$}px`,pointerEvents:"none"}}return G("div",{class:`canvas-viewport${MU()?" pan-mode":""}`,ref:A,tabIndex:0,onPointerDown:R,onPointerMove:p,onPointerLeave:()=>{W.current=null,j9(null)},onPointerUp:l,onContextMenu:t,onDblClick:r,onDragEnter:i,onDragOver:o,onDragLeave:z$,onDrop:B$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":J||o$.value||K.current||R6.value==="connect"?"crosshair":MU()?"grab":"default"},children:[G("div",{ref:E,class:"canvas-world",style:{transform:`matrix(${z.scale}, 0, 0, ${z.scale}, ${z.x}, ${z.y})`,transformOrigin:"0 0",position:"absolute",top:0,left:0},children:[G(tX,{},void 0,!1,void 0,this),G(dH,{},void 0,!1,void 0,this),G(FH,{},void 0,!1,void 0,this),G(NH,{},void 0,!1,void 0,this),G(VH,{},void 0,!1,void 0,this),G(ZQ,{nodes:D,edges:c$,onEdgeContextMenu:U},void 0,!1,void 0,this),o$.value&&G("div",{class:"edge-hint-pill","data-testid":"edge-hint",style:{left:`${o$.value.cursorX+14}px`,top:`${o$.value.cursorY+14}px`},children:[G("span",{class:"edge-hint-main",children:o$.value.targetId?"release to connect":"drag onto a node"},void 0,!1,void 0,this),G("span",{class:"edge-hint-keys",children:["esc cancels · L labels",o$.value.withLabel?" · label on":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),g$&&t$&&W4&&G("div",{class:"drop-pill","data-testid":"drop-pill",style:{left:`${W4.position.x}px`,top:`${W4.position.y+W4.size.height+10}px`},children:[G("span",{class:"drop-pill-text",children:g$.mode==="add"?`release to add to ${String(t$.data.title??"group")}`:`release to remove from ${String(t$.data.title??"group")}`},void 0,!1,void 0,this),G("span",{class:"drop-pill-hint",children:g$.mode==="add"?"esc keeps it out":"esc keeps it in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(KO,{annotations:Array.from(kU.value.values())},void 0,!1,void 0,this),X&&X.points.length>=2&&G(KO,{annotations:[X]},void 0,!1,void 0,this),N6.map((S)=>G(YQ,{node:S,onContextMenu:$,children:qg(S)},S.id,!1,void 0,this)),$U.value&&G("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:$U.value.map((S,e)=>S.axis==="x"?G("line",{x1:S.pos,y1:S.from-20,x2:S.pos,y2:S.to+20,class:"snap-guide-line"},e,!1,void 0,this):G("line",{x1:S.from-20,y1:S.pos,x2:S.to+20,y2:S.pos,class:"snap-guide-line"},e,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&G("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),L&&G("input",{class:"annotation-text-input",value:L.value,autoFocus:!0,style:{left:`${L.x*z.scale+z.x}px`,top:`${L.y*z.scale+z.y}px`,fontSize:`${QQ*z.scale}px`},onInput:(S)=>I({...L,value:S.target.value}),onBlur:T,onPointerDown:(S)=>S.stopPropagation(),onKeyDown:(S)=>{if(S.key==="Enter")S.preventDefault(),T();if(S.key==="Escape")S.preventDefault(),I(null)}},void 0,!1,void 0,this),b4&&G("div",{class:"lasso-rect",style:b4},void 0,!1,void 0,this),H&&G("div",{class:"drop-zone-overlay",children:G("div",{class:"drop-zone-indicator",children:[G("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),G("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kQ(){let $=[...j$.value],U=D.value,[v,J]=f(""),[_,z]=f(!1),K=IH.value,[W,O]=f(null),Y=K.length>=2,Z=!Y&&K.length===1&&K[0].steerable?K[0]:null,q=Y?W?K.find((L)=>L.value===W&&L.steerable)??null:null:Z,X=q?.value??null,B=async()=>{let L=v.trim();if(!L||_)return;z(!0);let P=await iH(L,X);if(z(!1),P)J("")};return G("div",{class:"command-bar","data-testid":"command-bar",children:[$.length>0&&G("div",{class:"command-bar-chips","aria-label":"Pinned context",children:[$.map((L)=>{let P=U.get(L),k=typeof P?.data.title==="string"&&P.data.title.trim()?P.data.title:P?.type??L;return G("span",{class:"command-bar-chip","data-node-id":L,children:[G("span",{class:"command-bar-chip-glyph","aria-hidden":"true",children:"✦"},void 0,!1,void 0,this),G("span",{class:"command-bar-chip-label",title:k,children:k},void 0,!1,void 0,this),G("button",{type:"button",class:"command-bar-chip-unpin","aria-label":`Unpin ${k}`,title:"Remove from context",onClick:()=>e4(L),children:"×"},void 0,!1,void 0,this)]},L,!0,void 0,this)}),G("span",{class:"command-bar-chips-note",children:"in agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"command-bar-composer",children:[G(I0,{size:15,class:"command-bar-icon"},void 0,!1,void 0,this),Y&&G("select",{class:"command-bar-target","aria-label":"Steer which agent",title:"Connected agents — steering reaches all of them unless you address one",value:X??"",onChange:(L)=>O(L.target.value||null),children:[G("option",{value:"",children:"All agents"},void 0,!1,void 0,this),K.map((L)=>{let P=L.pendingSteers&&L.pendingSteers>0?` · ${L.pendingSteers} queued`:"",k=L.polling?" · polling":"";return G("option",{value:L.value,disabled:!L.steerable,children:L.attached?`${L.label}${k}${P}`:L.steerable?`${L.label} · writer${k}${P}`:`${L.label} · no inbox`},L.value,!1,void 0,this)})]},void 0,!0,void 0,this),G("input",{class:"command-bar-input",type:"text",value:v,placeholder:`Steer ${q?.label??"the agent"}, or ${d$("K")} to search the board…`,"aria-label":"Steer the agent",disabled:_,onInput:(L)=>J(L.target.value),onKeyDown:(L)=>{if(L.key==="Enter")L.preventDefault(),B()}},void 0,!1,void 0,this),G("button",{type:"button",class:"command-bar-send",disabled:_||!v.trim(),onClick:()=>void B(),children:_?"Sending…":"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var OO=r$(()=>{if(x6.value==="disconnected")return"reconnecting";if(x6.value==="connected"&&!z4.value&&f1.value>1)return"resyncing";return null});function bQ(){let $=OO.value;if(!$)return null;if($==="reconnecting"){let U=E1.value,v=u1.value;return G("div",{class:"connection-banner is-reconnecting",role:"status","data-testid":"connection-banner",children:[G("span",{class:"connection-banner-glyph","aria-hidden":"true",children:"↻"},void 0,!1,void 0,this),G("span",{class:"connection-banner-text",children:[G("b",{children:"Reconnecting…"},void 0,!1,void 0,this)," live updates are paused; edits still save, the board may be stale until the stream returns."]},void 0,!0,void 0,this),G("span",{class:"connection-banner-meta",children:[U>0?`retry ${U}`:"retrying",v>0?` · ${Math.max(1,Math.round(v/1000))}s`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return G("div",{class:"connection-banner is-resyncing",role:"status","data-testid":"connection-banner",children:[G("span",{class:"connection-banner-glyph","aria-hidden":"true",children:"⟳"},void 0,!1,void 0,this),G("span",{class:"connection-banner-text",children:[G("b",{children:"Resyncing from snapshot"},void 0,!1,void 0,this)," — the event cursor went stale; the board reloads without losing local edits."]},void 0,!0,void 0,this),G("span",{class:"connection-banner-progress","aria-hidden":"true",children:G("span",{class:"connection-banner-progress-fill"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var kg={markdown:{width:520,height:360},group:{width:600,height:400},html:{width:720,height:640},image:{width:720,height:520},file:{width:720,height:600},webpage:{width:520,height:420}};async function i6($){if($.x!==void 0&&$.y!==void 0)return d6($);let U=kg[$.type]??{width:360,height:200},v=$.width??U.width,J=$.height??U.height,_=C1(),z=G$.value,K=await d6({...$,width:v,height:J,x:Math.round((_.x-z.x)/z.scale-v/2),y:Math.round((_.y-z.y)/z.scale-J/2)});if(K.ok&&K.id)K6(K.id);return K}var l9=!1,MQ=!1,UU=null,y0=null;function YO(){return l9}function r9(){l9=!1,MQ=!0,AQ()}function AQ(){if(UU&&y0)UU.removeEventListener("change",y0);UU=null,y0=null}function bg(){if(typeof window>"u"||!window.location)return null;let $=new URLSearchParams(window.location.search).get("theme");if($==="auto")return"auto";return e0($)?$:null}function IQ($){if(MQ)return;let U=bg();if(!U)return;if(AQ(),l9=!0,U!=="auto"){$(U);return}UU=window.matchMedia("(prefers-color-scheme: light)"),y0=()=>{if(l9&&UU)$(UU.matches?"light":"dark")},y0(),UU.addEventListener("change",y0)}var Mg='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function C0($,U,v={}){u(()=>{if(!U)return;let J=$.current;if(!J)return;let _=document.activeElement,z=v.restoreTo,K=()=>Array.from(J.querySelectorAll(Mg)),W=v.initial?.current??K()[0];if(W&&!J.contains(document.activeElement))W.focus();let O=(Y)=>{if(Y.key!=="Tab")return;let Z=K();if(Z.length===0)return;let q=Z[0],X=Z[Z.length-1],B=document.activeElement;if(Y.shiftKey&&(B===q||!J.contains(B)))Y.preventDefault(),X.focus();else if(!Y.shiftKey&&B===X)Y.preventDefault(),q.focus()};return J.addEventListener("keydown",O),()=>{if(J.removeEventListener("keydown",O),z)requestAnimationFrame(()=>z()?.focus());else if(_&&document.contains(_)&&_!==document.body)_.focus()}},[$,U,v.initial,v.restoreTo])}function Ag($,U){let v=$.toLowerCase(),J=U.toLowerCase(),_=[],z=0,K=0,W=-1;for(let O=0;O<J.length&&z<v.length;O++)if(J[O]===v[z]){if(_.push(O),K+=W===O-1?10:1,O===0||J[O-1]===" "||J[O-1]==="-"||J[O-1]==="_")K+=5;W=O,z++}return{match:z===v.length,score:K,indices:_}}function Ig($,U){if(U.length===0)return $;let v=[],J=0;for(let _ of U){if(_>J)v.push($.slice(J,_));v.push(G("mark",{children:$[_]},_,!1,void 0,this)),J=_+1}if(J<$.length)v.push($.slice(J));return v}var ZO={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function wg($){let U=$.toLowerCase().trim();if(U.startsWith("type:")){let v=U.slice(5).trim(),_=Object.keys(O6).find((K)=>K.startsWith(v));if(_)return{typeFilter:_,remaining:""};let z=ZO[v];if(z)return{typeFilter:z,remaining:""}}if(ZO[U])return{typeFilter:ZO[U],remaining:""};return{typeFilter:null,remaining:$}}function wQ({onClose:$,onToggleMinimap:U}){let[v,J]=f(""),[_,z]=f(0),K=C(null),W=C(null),O=C(null);C0(O,!0,{initial:K}),u(()=>{setTimeout(()=>K.current?.focus(),30)},[]);let Y=j(()=>{let H=[];for(let b of D.value.values()){let V=b.data.title||O6[b.type],E=b.data.content||b.data.path||"",A=b.type==="group"&&Array.isArray(b.data.children)?b.data.children.length:0;H.push({id:`node:${b.id}`,kind:"node",label:V,description:b.type==="group"?`group · ${A} node${A===1?"":"s"}`:E.length>60?`${O6[b.type].toLowerCase()} · ${E.slice(0,60)}…`:E?`${O6[b.type].toLowerCase()} · ${E}`:O6[b.type].toLowerCase(),icon:m4(b.type),nodeType:b.type,action:()=>{K6(b.id),$()}})}let F=[{label:"New markdown note",shortcut:"M",icon:L1,iconTone:"accent",action:()=>{i6({type:"markdown",title:"New note",width:520,height:360}),$()}},...F6.value?[]:[{label:"Start agent session",icon:I0,iconTone:"purple",action:()=>{M1(),$()}}],{label:"Fit view",shortcut:"F",icon:M9,iconTone:"muted",action:()=>{NU($4().width,$4().height),$()}},{label:"Auto-arrange (grid)",icon:n1,iconTone:"muted",action:()=>{Jv(),$()}},{label:"Auto-arrange (graph-aware)",icon:n1,iconTone:"muted",action:()=>{zv(),$()}},{label:"Toggle minimap",icon:A9,iconTone:"muted",action:()=>{U(),$()}},{label:"Toggle theme (dark/light)",icon:I9,iconTone:"muted",action:()=>{let b=$6.value==="dark"?"light":"dark";r9(),document.documentElement.setAttribute("data-theme",b),P0(),$6.value=b,x2(b),$()}}];for(let b of F)H.push({id:`action:${b.label}`,kind:"action",label:b.label,...b.shortcut?{shortcut:b.shortcut}:{},icon:b.icon,...b.iconTone?{iconTone:b.iconTone}:{},action:b.action});return H},[$,U]),{typeFilter:Z,remaining:q}=wg(v),X=Y(),B;if(!v.trim())B=X.map((H)=>({...H,score:0,indices:[]}));else{B=[];for(let H of X){if(Z){if(H.kind!=="node"||H.nodeType!==Z)continue;if(!q){B.push({...H,score:0,indices:[]});continue}}let F=Ag(q||v,H.label);if(F.match)B.push({...H,score:F.score,indices:F.indices})}B.sort((H,F)=>F.score-H.score)}B=[...B.filter((H)=>H.kind==="action"),...B.filter((H)=>H.kind==="node")];let L=B.findIndex((H)=>H.kind==="node");u(()=>{if(!v.trim()){s4.value=null;return}let H=new Set;for(let F of B)if(F.kind==="node")H.add(F.id.slice(5));s4.value=H.size>0?H:null},[v,B]),u(()=>{return()=>{s4.value=null}},[]);let P=Math.min(_,Math.max(0,B.length-1)),k=j((H)=>{if(H.key==="ArrowDown")H.preventDefault(),z((F)=>Math.min(F+1,B.length-1));else if(H.key==="ArrowUp")H.preventDefault(),z((F)=>Math.max(F-1,0));else if(H.key==="Enter"){if(H.preventDefault(),B[P])B[P].action()}else if(H.key==="Escape")H.preventDefault(),H.stopPropagation(),$()},[B,P,$]);return u(()=>{let H=W.current;if(!H)return;H.children[P]?.scrollIntoView({block:"nearest"})},[P]),u(()=>{z(0)},[v]),G("div",{class:"command-palette-backdrop",onMouseDown:$,children:G("div",{ref:O,class:"command-palette",role:"dialog","aria-modal":"true","aria-label":"Search and commands",onMouseDown:(H)=>H.stopPropagation(),children:[G("div",{class:"command-palette-search",children:[G("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","aria-hidden":"true",children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("input",{ref:K,type:"text",class:"command-palette-input",value:v,onInput:(H)=>J(H.target.value),onKeyDown:k,placeholder:"Search nodes, run actions, jump to…","aria-label":"Search nodes, run actions, jump to"},void 0,!1,void 0,this),G("kbd",{class:"command-palette-esc",children:"esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"command-palette-results",ref:W,children:[B.length===0&&G("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),B.map((H,F)=>{let b=H.icon,V=F===0&&H.kind==="action"?"Actions":F===L?"Jump to":null;return G("div",{class:"command-palette-row",children:[V&&G("div",{class:"command-palette-group",children:V},void 0,!1,void 0,this),G("button",{type:"button",class:`command-palette-item${F===P?" selected":""}`,onMouseEnter:()=>z(F),onClick:()=>H.action(),children:[G("span",{class:`command-palette-icon tone-${H.iconTone??"kind"}`,"aria-hidden":"true",children:G(b,{size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"command-palette-label",children:[H.indices.length>0?Ig(H.label,H.indices):H.label,H.description&&G("span",{class:"command-palette-desc",children:[" — ",H.description]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.shortcut&&G("kbd",{class:"command-palette-kbd",children:H.shortcut},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},H.id,!0,void 0,this)})]},void 0,!0,void 0,this),G("div",{class:"command-palette-hint",children:[G("span",{children:"↑↓ navigate"},void 0,!1,void 0,this),G("span",{children:"↵ open"},void 0,!1,void 0,this),G("span",{children:"esc close"},void 0,!1,void 0,this),G("span",{children:"type: filter"},void 0,!1,void 0,this),G("span",{class:"command-palette-hint-spacer"},void 0,!1,void 0,this),G("span",{children:d$("K")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function gQ(){let[$,U]=f(null),v=j((K,W)=>{K.preventDefault(),K.stopPropagation(),U({kind:"node",x:K.clientX,y:K.clientY,nodeId:W})},[]),J=j((K,W,O)=>{K.preventDefault(),K.stopPropagation(),U({kind:"canvas",x:K.clientX,y:K.clientY,canvasX:W,canvasY:O})},[]),_=j((K,W)=>{K.preventDefault(),K.stopPropagation(),U({kind:"edge",x:K.clientX,y:K.clientY,edgeId:W})},[]),z=j(()=>U(null),[]);return u(()=>{if(!$)return;let K=()=>U(null),W=(O)=>{if(O.key==="Escape")U(null)};return document.addEventListener("click",K),document.addEventListener("keydown",W),()=>{document.removeEventListener("click",K),document.removeEventListener("keydown",W)}},[$]),{menu:$,openNodeMenu:v,openCanvasMenu:J,openEdgeMenu:_,closeMenu:z}}var gg="#4bbcFF",Ng=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function NQ({menu:$,onClose:U}){let v;if($.kind==="node"){let W=D.value.get($.nodeId);if(!W)return null;v=Dg(W)}else if($.kind==="edge"){let W=$.edgeId,O=c$.value.get(W);v=[{label:O?.label?`Edit label “${O.label.slice(0,18)}${O.label.length>18?"…":""}”`:"Add label…",action:()=>{g4("Edge label (empty clears it)","label text",{initial:O?.label??"",allowEmpty:!0,confirm:"Save"}).then((Y)=>{if(Y===null)return;r2(W,{label:Y})})}},{separator:!0},...["flow","depends-on","relation","references"].map((Y)=>({label:`${O?.type===Y?"✓":" "} ${Y}`,action:()=>void r2(W,{type:Y})})),{separator:!0},...["solid","dashed","dotted"].map((Y)=>({label:`${(O?.style??"solid")===Y?"✓":" "} ${Y}`,action:()=>void r2(W,{style:Y})})),{separator:!0},{label:"Delete edge",danger:!0,action:()=>void i2(W)}]}else v=Cg($.canvasX,$.canvasY);let J=new Map,_=v.some((W)=>W.render)?v.length*32+168:v.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),K=Math.min($.y,Math.max(12,window.innerHeight-_));return G("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${K}px`,zIndex:1e4},onPointerDown:(W)=>W.stopPropagation(),onClick:(W)=>W.stopPropagation(),children:v.map((W)=>{let O=W.separator?"separator":W.render?"custom":`${W.label??"item"}:${W.shortcut??""}`,Y=(J.get(O)??0)+1;J.set(O,Y);let Z=`${O}:${Y}`;if(W.separator)return G("div",{class:"context-menu-separator"},Z,!1,void 0,this);if(W.render)return G("div",{class:"context-menu-custom",children:W.render(U)},Z,!1,void 0,this);return G("button",{type:"button",class:`context-menu-item${W.danger?" is-danger":""}`,onClick:()=>{W.action?.(),U()},children:[G("span",{class:"context-menu-label",children:W.label},void 0,!1,void 0,this),W.shortcut&&G("span",{class:"context-menu-shortcut",children:W.shortcut},void 0,!1,void 0,this)]},Z,!0,void 0,this)})},void 0,!1,void 0,this)}function Sg($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function i9($){let U=$.trim().toLowerCase(),v=U.match(/^#([0-9a-f]{3})$/);if(v){let[J,_,z]=v[1].split("");return`#${J}${J}${_}${_}${z}${z}`}return U}function SQ($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return i9($.data.color)}function Rg($){let U=SQ($);return U&&/^#[0-9a-f]{6}$/.test(U)?U:i9(gg)}function qO($,U){let v=U?i9(U):null;Y6($.id,{data:{...$.data,color:v}}),b6($.id,{data:{color:v}})}function Tg($,U){let v=SQ($);return G("div",{class:"context-menu-section",children:[G("div",{class:"context-menu-section-header",children:[G("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-menu-reset",onClick:()=>{qO($,null),U()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-menu-color-grid",children:Ng.map((J)=>{let _=i9(J.value);return G("button",{type:"button",class:`context-menu-color-swatch${v===_?" active":""}`,"aria-label":`Set group color to ${J.label}`,title:J.label,style:{"--swatch-color":J.value},onClick:()=>{qO($,J.value),U()},children:[G("span",{class:"context-menu-color-dot",style:{"--swatch-color":J.value}},void 0,!1,void 0,this),G("span",{children:J.label},void 0,!1,void 0,this)]},J.value,!0,void 0,this)})},void 0,!1,void 0,this),G("label",{class:"context-menu-color-custom",children:[G("span",{children:"Custom"},void 0,!1,void 0,this),G("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:Rg($),onClick:(J)=>J.stopPropagation(),onInput:(J)=>{qO($,J.currentTarget.value),U()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function XO($,U,v,J){return{x:$-v/2,y:U-J/2}}function yg($,U){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||U}async function BO($){let U=await g4($.promptLabel,$.placeholder??"");if(!U)return;let v=U.trim();if(!v)return;let J=XO($.canvasX,$.canvasY,$.width,$.height);if(!(await d6({type:$.type,...$.type!=="webpage"?{title:yg(v,$.titleFallback)}:{},content:v,x:J.x,y:J.y,width:$.width,height:$.height})).ok)console.error(`[canvas-menu] ${$.errorMessage}`)}function Cg($,U){return[{label:"New note",action:()=>{let _=XO($,U,520,360);d6({type:"markdown",title:"New note",x:_.x,y:_.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{BO({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:U,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{BO({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:U,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{BO({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:U,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let _=XO($,U,600,400);BU({title:"Group",x:_.x,y:_.y,width:600,height:400})}}]}function Dg($){let U=[],v=Sg($);if(U.push({label:"Focus",action:()=>K6($.id)}),r0.has($.type))U.push({label:"Expand",shortcut:"⤢",action:()=>X4($.id)});U.push({label:$.collapsed?"Expand":"Collapse",action:()=>IU($.id)});let J=j$.value.has($.id);U.push({label:J?"Unpin from context":"Pin as context",action:()=>e4($.id)}),U.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let O=!$.pinned;Y6($.id,{pinned:O}),b6($.id,{pinned:O}),v6()}});let _=s2.value;if(_&&_.from!==$.id){let O=D.value.get(_.from),Y=O?(O.data.title||O.id).slice(0,20):_.from;U.push({label:`Connect from "${Y}"`,action:()=>{j1(_.from,$.id,"relation"),s2.value=null}})}U.push({label:_?"Connect from here (replace)":"Connect from here",action:()=>{s2.value={from:$.id}}});let z=Array.from(c$.value.values()).filter((O)=>O.from===$.id||O.to===$.id).length;if(z>0)U.push({label:`${z} edge${z!==1?"s":""} connected`});if(U.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&v)U.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(v)}`,"_blank","noopener")}}),U.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(v)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let O=$.data.chartConfig.title||"chart";U.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let O=$.data.url;if(U.push({label:"Open in browser",action:()=>{if(O)window.open(O,"_blank")}}),U.push({label:"Focus in TUI",action:()=>QY("mcp-app-focus",{url:O})}),$.type==="json-render"||$.type==="graph")U.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let O=typeof $.data.url==="string"?$.data.url:"";U.push({label:"Refresh webpage",action:()=>{h2($.id)}}),U.push({label:"Open in browser",action:()=>{if(O)window.open(O,"_blank","noopener")}}),U.push({label:"Copy URL",action:()=>{if(O)navigator.clipboard.writeText(O)}})}if($.type==="group"){let O=$.data.children??[];if(U.push({separator:!0}),U.push({render:(Y)=>Tg($,Y)}),O.length>0)U.push({label:`Ungroup (${O.length} node${O.length!==1?"s":""})`,action:()=>{h6($.id),XU($.id)}})}let K=typeof $.data.parentGroup==="string"?$.data.parentGroup:null,W=K?D.value.get(K):void 0;if(W&&W.type==="group"){let O=typeof W.data.title==="string"&&W.data.title?W.data.title:"frame",Y=Array.isArray(W.data.children)?W.data.children.filter((Z)=>Z!==$.id):[];U.push({label:`Remove from “${O}”`,action:()=>{l2(W.id,Y)}})}return U.push({separator:!0}),U.push({label:$.type==="group"?"Delete frame (children stay)":"Delete",danger:!0,action:()=>{h6($.id),d4($.id)}}),U}function RQ(){let $=j$.value.size;if($===0||q4.value)return null;return G("div",{class:"context-pin-bar",children:[G("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),G("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:vZ,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function G2($,U){console.error(`[tool-rail] ${$} failed`,U)}function c4($){let U={image:{message:"Image URL (https://… or data:image/…)",placeholder:"https://example.com/diagram.png"},file:{message:"Workspace file path",placeholder:"src/server/server.ts"},webpage:{message:"Page URL",placeholder:"https://example.com"}};g4(U[$].message,U[$].placeholder).then((v)=>{if(!v)return;i6({type:$,content:v}).catch((J)=>G2(`create ${$}`,J))})}function W6({label:$,shortcut:U,detail:v,ariaLabel:J,active:_,menuOpen:z,onClick:K,btnRef:W,children:O}){let[Y,Z]=f(null),q=(L)=>{let P=L.currentTarget.getBoundingClientRect();Z({left:P.right+10,top:P.top+P.height/2})},X=()=>Z(null),B=J??(U?`${$} (${U})`:v?`${$} (${v})`:$);return G(M$,{children:[G("button",{ref:W,type:"button",class:`rail-btn${_?" active":""}`,"aria-label":B,"aria-pressed":_===void 0?void 0:_,onClick:(L)=>{X(),K(L)},onPointerEnter:q,onPointerLeave:X,onFocus:q,onBlur:X,children:O},void 0,!1,void 0,this),Y&&!z&&G("span",{class:"toolbar-tooltip rail-tooltip",role:"tooltip","data-testid":"rail-tooltip",style:{left:`${Y.left}px`,top:`${Y.top}px`},children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(U||v)&&G("span",{class:"toolbar-tooltip-meta",children:[U&&G("kbd",{class:"toolbar-tooltip-shortcut",children:U},void 0,!1,void 0,this),v&&G("span",{children:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function TQ({minimapVisible:$,onToggleMinimap:U,snapshotOpen:v,onToggleSnapshot:J,snapshotBtnRef:_,onOpenPalette:z,onOpenShortcuts:K,annotationTool:W,onSetAnnotationTool:O}){let Y=R6.value,Z=bU.value,q=Array.from(D.value.values()).filter((I)=>I.type==="trace").length,X=c$.value.size,[B,L]=f(null),[P,k]=f(null),H=C(null),F=(I)=>(N)=>{if(B===I){L(null);return}let R=N.currentTarget.getBoundingClientRect();k({top:R.top,bottom:R.bottom,right:R.right}),L(I)},b=(I)=>P?I?{position:"fixed",left:`${P.right+8}px`,bottom:`${window.innerHeight-P.bottom}px`,top:"auto",right:"auto"}:{position:"fixed",left:`${P.right+8}px`,top:`${P.top}px`,right:"auto"}:void 0;u(()=>{if(!B)return;let I=(R)=>{if(H.current&&R.target instanceof Node&&!H.current.contains(R.target))L(null)},N=(R)=>{if(R.key==="Escape")L(null)};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",N),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",N)}},[B]);let V=(I)=>{r9(),document.documentElement.setAttribute("data-theme",I),P0(),$6.value=I,x2(I),L(null)},E=B5($6.value),A=(I,N={})=>{fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:I,payload:N})}).catch((R)=>G2("sendIntent",R))};return G("div",{class:"tool-rail",ref:H,role:"toolbar","aria-label":"Canvas tools","aria-orientation":"vertical",children:[G("span",{class:"rail-brand",title:"PMX Canvas","aria-label":"PMX Canvas",children:G(YH,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"rail-divider"},void 0,!1,void 0,this),G(W6,{label:"Select",shortcut:"V",active:Y==="select",onClick:()=>R6.value="select",children:G(ZH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Pan",shortcut:"Space",active:Y==="pan",onClick:()=>R6.value="pan",children:G(qH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Connect",shortcut:"C",active:Y==="connect",onClick:()=>R6.value="connect",children:G("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","aria-hidden":"true",children:[G("circle",{cx:"4",cy:"4",r:"2"},void 0,!1,void 0,this),G("circle",{cx:"12",cy:"12",r:"2"},void 0,!1,void 0,this),G("path",{d:"M5.5 5.5 C 8 8, 8 8, 10.5 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),G("div",{class:"rail-divider"},void 0,!1,void 0,this),G(W6,{label:"Markdown note",shortcut:"M",onClick:()=>void i6({type:"markdown",title:"New note",width:520,height:360}).catch((I)=>G2("create markdown",I)),children:G(L1,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Image",shortcut:"I",onClick:()=>c4("image"),children:G(hW,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"File",shortcut:"Shift+F",onClick:()=>c4("file"),children:G(b9,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Webpage",shortcut:"W",onClick:()=>c4("webpage"),children:G(A0,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"HTML surface",shortcut:"H",onClick:()=>void i6({type:"html",title:"HTML surface"}).catch((I)=>G2("create html",I)),children:G(BH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Group",shortcut:"G",onClick:()=>void i6({type:"group",title:"Group"}).catch((I)=>G2("create group",I)),children:G(cW,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"toolbar-menu-anchor",children:[G(W6,{label:"Annotate",shortcut:"A",detail:"Draw · Text note · Eraser",active:W!==null,menuOpen:B==="annotate",onClick:F("annotate"),children:W==="eraser"?G(mW,{},void 0,!1,void 0,this):W==="text"?G(xW,{},void 0,!1,void 0,this):G(uW,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),B==="annotate"&&G("div",{class:"toolbar-menu",style:b(!1),role:"menu","aria-label":"Annotate",children:[G("button",{type:"button",class:`toolbar-menu-item${W==="pen"?" active":""}`,onClick:()=>{O(W==="pen"?null:"pen"),L(null)},children:[G(uW,{},void 0,!1,void 0,this),G("span",{children:W==="pen"?"Stop annotating":"Draw (A)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:`toolbar-menu-item${W==="text"?" active":""}`,onClick:()=>{O(W==="text"?null:"text"),L(null)},children:[G(xW,{},void 0,!1,void 0,this),G("span",{children:W==="text"?"Stop text notes":"Text note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:`toolbar-menu-item${W==="eraser"?" active":""}`,onClick:()=>{O(W==="eraser"?null:"eraser"),L(null)},children:[G(mW,{},void 0,!1,void 0,this),G("span",{children:W==="eraser"?"Stop erasing":"Eraser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"rail-spacer"},void 0,!1,void 0,this),G(W6,{label:"Search & commands",shortcut:d$("K"),onClick:z,children:G(WH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Arrange",detail:X>0?"graph-aware":"grid",onClick:()=>X>0?zv():Jv(),children:G(n1,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:Z?"Disable trace":"Enable trace",active:Z,onClick:()=>A("trace-toggle",{enabled:!Z}),children:G(KH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),(Z||q>0)&&G(W6,{label:"Clear trace",onClick:()=>A("trace-clear"),children:G(GH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:$?"Hide minimap":"Show minimap",active:$,onClick:U,children:G(A9,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(W6,{label:"Snapshots",active:v,onClick:J,btnRef:_,children:G(zH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"toolbar-menu-anchor",children:[G(W6,{label:"Theme",detail:CU[E].label,menuOpen:B==="theme",ariaLabel:"Choose theme",active:B==="theme",onClick:F("theme"),children:DU(E)==="dark"?G(JH,{},void 0,!1,void 0,this):G(I9,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),B==="theme"&&G("div",{class:"toolbar-menu",style:b(!0),role:"menu","aria-label":"Theme",children:q5.map((I)=>G("button",{type:"button",role:"menuitemradio","aria-checked":E===I,class:`toolbar-menu-item${E===I?" active":""}`,onClick:()=>V(I),children:[G("span",{class:"theme-swatch",style:{background:CU[I].swatchBg},children:G("span",{class:"theme-swatch-dot",style:{background:CU[I].swatchAccent}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{children:CU[I].label},void 0,!1,void 0,this),E===I&&G("span",{class:"toolbar-menu-check","aria-hidden":"true",children:"✓"},void 0,!1,void 0,this)]},I,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(W6,{label:"Shortcuts",shortcut:"?",onClick:K,children:G(OH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yQ({onOpenPalette:$}){let U=C(null),v=()=>{i6({type:"markdown",title:"New note",width:520,height:360}).catch(()=>{})},J=async(_)=>{if(!_||_.length===0)return;let z=C1(),K=G$.value;await P9(Array.from(_),(z.x-K.x)/K.scale,(z.y-K.y)/K.scale)};return G("div",{class:"empty-state","data-testid":"empty-state",children:[G("svg",{class:"empty-state-mark",width:"52",height:"52",viewBox:"0 0 64 64",fill:"none","aria-hidden":"true",children:[G("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7"},void 0,!1,void 0,this),G("rect",{x:"20",y:"20",width:"24",height:"24",rx:"4","stroke-dasharray":"4 4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{children:[G("div",{class:"empty-state-title",children:"Nothing on this board yet"},void 0,!1,void 0,this),G("div",{class:"empty-state-sub",children:"Drop files anywhere, paste a link, or start from a note."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"empty-state-grid",children:[G("button",{type:"button",class:"empty-state-action",onClick:v,children:[G(L1,{size:16,class:"tone-accent"},void 0,!1,void 0,this),G("span",{class:"empty-state-action-label",children:"New markdown note"},void 0,!1,void 0,this),G("kbd",{children:"M"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"empty-state-action",onClick:()=>U.current?.click(),children:[G("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",class:"tone-warn","aria-hidden":"true",children:[G("path",{d:"M8 10 V2 M8 2 L5 5 M8 2 L11 5"},void 0,!1,void 0,this),G("path",{d:"M2 10 V13 H14 V10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"empty-state-action-label",children:"Drop files"},void 0,!1,void 0,this),G("span",{class:"empty-state-action-hint",children:"or pick"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"empty-state-action",onClick:()=>c4("webpage"),children:[G(A0,{size:16,class:"tone-ok"},void 0,!1,void 0,this),G("span",{class:"empty-state-action-label",children:"Paste a link"},void 0,!1,void 0,this),G("kbd",{children:d$("V")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"empty-state-action is-agent",onClick:()=>void M1(),children:[G(I0,{size:16,class:"tone-purple"},void 0,!1,void 0,this),G("span",{class:"empty-state-action-label",children:"Start agent session"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"empty-state-hint",onClick:$,children:["? shortcuts · ",d$("K")," palette"]},void 0,!0,void 0,this),G("input",{ref:U,type:"file",multiple:!0,hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:(_)=>{let z=_.currentTarget;J(z.files).finally(()=>{z.value=""})}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HO({presence:$,size:U=18}){return G("span",{class:"writer-avatar",style:{background:g9($.sessionId),width:`${U}px`,height:`${U}px`},"aria-hidden":"true",children:AH($.label)},void 0,!1,void 0,this)}function CQ(){let $=nW.value;if(F6.value||$.length===0)return null;let U=$.reduce((_,z)=>_+z.opCount,0),v=$.length===1?$[0].label:`${$.length} writers`,J=t1.value;return G("button",{type:"button",class:"external-indicator","data-testid":"external-indicator","aria-expanded":J,title:`${$.length} external writer${$.length===1?"":"s"} on this board — click for activity`,onClick:()=>{t1.value=!J},children:[G("span",{class:"external-indicator-avatars",children:$.slice(0,3).map((_)=>G(HO,{presence:_},_.sessionId,!1,void 0,this))},void 0,!1,void 0,this),G("span",{class:"external-indicator-label",children:v},void 0,!1,void 0,this),G("span",{class:"external-indicator-ops hud-collapsible-text",children:[U," op",U===1?"":"s"]},void 0,!0,void 0,this),G("span",{class:"external-indicator-dot","aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function jg($){if($==="node.add"||$==="jsonrender.add"||$==="graph.add"||$==="group.create")return{glyph:"+",tone:"ok"};if($==="node.remove"||$==="edge.remove"||$==="canvas.clear")return{glyph:"×",tone:"danger"};if($==="edge.add")return{glyph:"⟶",tone:"accent"};if($.startsWith("ax."))return{glyph:"◆",tone:"purple"};return{glyph:"✎",tone:"accent"}}function Vg($){return $.reduce((U,v)=>v.lastSeenAt>U?v.lastSeenAt:U,"")}function fg(){return[...s$.value.values()].filter(($)=>!$.auto&&$.phase==="forming")}function DQ(){let $=t1.value,U=nW.value,v=h4($?1e4:0);if(u(()=>{if(!$)return;let W=(O)=>{if(O.key!=="Escape")return;if(g0.value)g0.value=!1;else t1.value=!1};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[$]),!$||F6.value||U.length===0)return null;let J=dW.value,_=fg().filter((W)=>!J||(W.source??"")===J),z=P1.value.filter((W)=>!J||W.sessionId===J),K=(W,O)=>G("button",{type:"button",class:`activity-filter${J===W?" is-active":""}`,style:W?{"--writer":g9(W)}:void 0,"aria-pressed":J===W,onClick:()=>{dW.value=W},children:O},void 0,!1,void 0,this);return G("div",{class:"activity-feed","data-testid":"activity-feed",role:"dialog","aria-label":"External activity",children:[G("div",{class:"activity-feed-head",children:[G("span",{class:"external-indicator-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("div",{class:"activity-feed-titles",children:[G("div",{class:"activity-feed-title",children:["External activity — ",U.length," writer",U.length===1?"":"s"]},void 0,!0,void 0,this),G("div",{class:"activity-feed-sub",children:[U.reduce((W,O)=>W+O.opCount,0)," writes · last"," ",N9(Vg(U),v)," · no session attached"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"activity-feed-close","aria-label":"Close activity feed",onClick:()=>{t1.value=!1},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"activity-filters",children:[K(null,"All"),U.map((W)=>K(W.sessionId,W.label))]},void 0,!0,void 0,this),G("div",{class:"activity-rows",children:[_.map((W)=>G("div",{class:"activity-row is-pending","data-testid":"activity-proposal",children:[G("span",{class:"activity-glyph tone-purple","aria-hidden":"true",children:"▢"},void 0,!1,void 0,this),G("div",{class:"activity-main",children:[G("div",{class:"activity-text",children:["Proposing: ",G("b",{children:W.label?.trim()||`${W.kind} intent`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"activity-meta",children:[W.reason?.trim()||"Intent signalled — a real veto window before the mutation",W.source?` · ${W.source}`:""]},void 0,!0,void 0,this),G("div",{class:"activity-actions",children:[G("button",{type:"button",class:"activity-veto",onClick:()=>{D1(W).then((O)=>{if(O)_2(W.id)})},children:"Veto"},void 0,!1,void 0,this),G("span",{class:"activity-hint",children:"or hover ghost + Esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"activity-age",children:"now"},void 0,!1,void 0,this)]},W.id,!0,void 0,this)),z.length===0&&_.length===0&&G("div",{class:"activity-empty",children:"No writes yet."},void 0,!1,void 0,this),z.map((W)=>{let{glyph:O,tone:Y}=jg(W.op);return G("div",{class:"activity-row","data-testid":"activity-row","data-op":W.op,children:[G("span",{class:`activity-glyph tone-${Y}`,"aria-hidden":"true",children:O},void 0,!1,void 0,this),G("div",{class:"activity-main",children:[G("div",{class:"activity-text",children:W.summary},void 0,!1,void 0,this),G("div",{class:"activity-writer",style:{color:g9(W.sessionId)},children:W.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"activity-age",children:N9(W.at,v)},void 0,!1,void 0,this)]},W.id,!0,void 0,this)})]},void 0,!0,void 0,this),G("div",{class:"activity-feed-foot",children:[G("span",{class:"activity-feed-note",children:"All writes ghost first · Esc vetoes"},void 0,!1,void 0,this),G("button",{type:"button",class:"activity-feed-link",onClick:()=>{g0.value=!0},children:"Writers"},void 0,!1,void 0,this),G("button",{type:"button",class:"activity-feed-link is-accent",onClick:()=>{t1.value=!1,M1()},children:"Start session ↗"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Eg(){let $=[];if(k1.value)$.push("scoped");if(s1.value.length>0)$.push("gated");return $.length>0?$.join(" + "):"open"}function jQ(){let $=g0.value,U=h4($?1e4:0),v=C(null);if(C0(v,$),!$)return null;let J=G6.value.filter((K)=>K.attached),_=G6.value.filter((K)=>!K.attached),z=()=>{g0.value=!1};return G(M$,{children:[G("div",{class:"writers-scrim",onClick:z,"aria-hidden":"true"},void 0,!1,void 0,this),G("div",{ref:v,class:"writers-sheet","data-testid":"writers-sheet",role:"dialog","aria-modal":"true","aria-label":"Connected writers",children:[G("div",{class:"writers-head",children:[G("span",{class:"writers-title",children:"Connected writers"},void 0,!1,void 0,this),G("span",{class:"writers-board",children:y4.value.slice(0,12)},void 0,!1,void 0,this),G("button",{type:"button",class:"activity-feed-close","aria-label":"Close writers",onClick:z,children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"writers-body",children:[G("div",{class:"writers-section",children:"Agent sessions"},void 0,!1,void 0,this),J.length===0&&G("div",{class:"writers-empty",children:"None attached — start one from the top bar."},void 0,!1,void 0,this),J.map((K)=>G("div",{class:"writers-row",children:[G(HO,{presence:K,size:20},void 0,!1,void 0,this),G("span",{class:"writers-name",children:K.label},void 0,!1,void 0,this),G("span",{class:"writers-config",children:Eg()},void 0,!1,void 0,this)]},K.sessionId,!0,void 0,this)),G("div",{class:"writers-section",children:"External writers · MCP"},void 0,!1,void 0,this),_.length===0&&G("div",{class:"writers-empty",children:"No external writers right now."},void 0,!1,void 0,this),_.map((K)=>G("div",{class:"writers-row",children:[G(HO,{presence:K,size:20},void 0,!1,void 0,this),G("span",{class:"writers-name is-mono",children:K.label},void 0,!1,void 0,this),G("span",{class:"writers-meta",children:[K.source!==K.label?`${K.source} · `:"","wrote"," ",N9(K.lastSeenAt,U)," ago"]},void 0,!0,void 0,this)]},K.sessionId,!0,void 0,this))]},void 0,!0,void 0,this),G("div",{class:"writers-foot",children:[G("span",{class:"writers-note",children:"Local-first: any process on this machine can connect and write. Every write ghosts first — veto is the control, not permissions."},void 0,!1,void 0,this),G("button",{type:"button",class:"writers-done",onClick:z,children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function VQ($,U){switch($.type){case"markdown":return G(Xv,{node:$,expanded:U},void 0,!1,void 0,this);case"mcp-app":return G(Q1,{node:$,expanded:U},void 0,!1,void 0,this);case"webpage":return G(H9,{node:$,expanded:U},void 0,!1,void 0,this);case"json-render":return G(Q1,{node:$,expanded:U},void 0,!1,void 0,this);case"graph":return G(Q1,{node:$,expanded:U},void 0,!1,void 0,this);case"prompt":return G(Q9,{node:$},void 0,!1,void 0,this);case"response":return G(L9,{node:$,expanded:U},void 0,!1,void 0,this);case"status":return G(B9,{node:$},void 0,!1,void 0,this);case"context":return G(t2,{node:$,expanded:U},void 0,!1,void 0,this);case"ledger":return G(Wv,{node:$},void 0,!1,void 0,this);case"trace":return G(F9,{node:$},void 0,!1,void 0,this);case"file":return G(Gv,{node:$,expanded:U},void 0,!1,void 0,this);case"diff":return G(a2,{node:$},void 0,!1,void 0,this);case"mermaid":return G(kv,{node:$,expanded:U},void 0,!1,void 0,this);case"image":return G(X9,{node:$,expanded:U},void 0,!1,void 0,this);case"html":return G($2,{node:$,expanded:U},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function fQ($){switch($.type){case"markdown":return $.data.content||"";case"diff":return $.data.content||"";case"mermaid":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function ug($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function mg($,U){return $!==null&&typeof $==="object"&&$.source===n6&&$.type==="presentation-exit"&&$.token===U}function xg($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function EQ($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function uQ(){let $=n$.value,U=$?D.value.get($):void 0,[v,J]=f(!1),[_,z]=f(!1),[K,W]=f(""),O=C(null),Y=C(null),Z=j(()=>{z(!1),m1()},[]),q=j(()=>{W(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),X=j((i)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:n6,token:K,...i},"*")},[K]),B=j(()=>{z(!1)},[]),L=j((i)=>{if(i.key==="Escape"){i.preventDefault(),i.stopPropagation(),z(!1);return}if(i.key==="Tab"&&!EQ(i.target)){i.preventDefault(),i.stopPropagation(),Y.current?.focus();return}if((i.key===" "||i.key==="Enter")&&EQ(i.target))return;if(!xg(i.key))return;i.preventDefault(),i.stopPropagation(),X({type:"presentation-key",key:i.key})},[X]),P=j((i)=>{if(i.target.classList.contains("expanded-overlay-backdrop"))m1()},[]),k=j(()=>{if(!U)return;let i=fQ(U);if(!i)return;navigator.clipboard.writeText(i).then(()=>{J(!0),setTimeout(()=>J(!1),1500)})},[U]),H=j(()=>{if(!$)return;e4($)},[$]);u(()=>{z(!1)},[$]),w2(()=>{if(!_)return;let i=()=>{let B$=O.current;if(!B$||B$.contains(document.activeElement))return;B$.focus()},o=[0,50,150].map((B$)=>window.setTimeout(i,B$)),z$=(B$)=>{if(!mg(B$.data,K))return;z(!1)};return document.addEventListener("keydown",L,!0),window.addEventListener("message",z$),()=>{o.forEach((B$)=>{window.clearTimeout(B$)}),document.removeEventListener("keydown",L,!0),window.removeEventListener("message",z$)}},[L,K,_]);let F=C(null),b=j(()=>$?document.querySelector(`.canvas-node[data-node-id="${CSS.escape($)}"]`):null,[$]);if(C0(F,U!==void 0,{restoreTo:b}),!U)return null;let V=U.data.title||U.data.path?.split("/").pop()||O6[U.type],E=fQ(U),A=ug(E),I=$?j$.value.has($):!1,N=E.length>0,R=B4.value===$,p=U.type==="mcp-app"||U.type==="webpage"||U.type==="json-render"||U.type==="graph",l=lX(U),T=m4(U.type),r=U.data.provenance&&typeof U.data.provenance==="object"?U.data.provenance:null,t=r?[r.sourceKind,r.sourceUri,r.syncedAt?`synced ${r.syncedAt.slice(11,16)}`:null].filter((i)=>typeof i==="string"&&i.length>0).join(" · "):null;return G("div",{class:"expanded-overlay-backdrop",onPointerDown:P,style:{pointerEvents:R?"none":"auto"},children:G("div",{ref:F,class:`expanded-overlay-panel${I?" is-pinned":""}`,role:"dialog","aria-modal":"true","aria-label":V,"data-testid":"expanded-node",children:[G("div",{class:"expanded-header",children:[G("span",{class:"expanded-kind-icon","aria-hidden":"true",children:G(T,{size:15},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"expanded-title",children:V},void 0,!1,void 0,this),G("span",{class:"expanded-kind-pill",children:O6[U.type]},void 0,!1,void 0,this),G("button",{type:"button",class:`expanded-pin${I?" is-on":""}`,onClick:H,title:I?"In agent context — click to unpin":"Pin as agent context","aria-pressed":I,children:"✦"},void 0,!1,void 0,this),G("span",{class:"expanded-spacer"},void 0,!1,void 0,this),G("div",{class:"expanded-actions",children:[N&&G("button",{type:"button",class:"expanded-action-btn",onClick:k,title:"Copy content to clipboard",children:v?"Copied!":"Copy"},void 0,!1,void 0,this),Fv(U)&&G("button",{type:"button",class:"expanded-action-btn",onClick:()=>void Pv(U),title:"Open as a full-page site in the system browser",children:"Open in tab ↗"},void 0,!1,void 0,this),l&&G("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:q,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"expanded-close",onClick:Z,title:"Close (Esc)","aria-label":"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:`expanded-body${p?" is-embedded":""}`,children:p?G("div",{style:{flex:1,minHeight:0,display:"flex"},children:VQ(U,!0)},void 0,!1,void 0,this):VQ(U,!0)},void 0,!1,void 0,this),G("div",{style:{"--ax-dock-bleed":"0px","--ax-dock-pad":"16px"},children:G(x9,{node:U},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"expanded-footer",children:[G("span",{class:"expanded-footer-meta",children:[t,A>0?`${A.toLocaleString()} word${A!==1?"s":""}`:null].filter(Boolean).join(" · ")||O6[U.type].toLowerCase()},void 0,!1,void 0,this),G("span",{class:"expanded-spacer"},void 0,!1,void 0,this),G("span",{class:`expanded-footer-hint${R?" is-saving":""}`,children:R?"Saving edits…":"esc or click outside to close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&_&&G("div",{ref:O,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${V}`,tabIndex:-1,onKeyDownCapture:L,children:[G("button",{ref:Y,type:"button",class:"html-presentation-exit",onClick:B,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),G("div",{class:"html-presentation-stage",children:G($2,{node:U,expanded:!0,presentation:!0,presentationExitToken:K},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var xQ=168,hQ=112,p9=20;function mQ($,U,v,J){let _=Array.from($.values()),z=0,K=0,W=1000,O=800;if(_.length>0){z=Number.POSITIVE_INFINITY,K=Number.POSITIVE_INFINITY,W=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let k of _)z=Math.min(z,k.position.x),K=Math.min(K,k.position.y),W=Math.max(W,k.position.x+k.size.width),O=Math.max(O,k.position.y+k.size.height)}let Y=-U.x/U.scale,Z=-U.y/U.scale,q=Y+v/U.scale,X=Z+J/U.scale,B={minX:Math.min(z,Y)-p9,minY:Math.min(K,Z)-p9,maxX:Math.max(W,q)+p9,maxY:Math.max(O,X)+p9},L=B.maxX-B.minX||1,P=B.maxY-B.minY||1;return{bounds:B,scale:Math.min(xQ/L,hQ/P)}}function cQ({viewport:$,nodes:U,onNavigate:v,containerWidth:J,containerHeight:_}){let z=C(null),K=C(!1),W=U.value,O=$.value,Y=mQ(W,O,J,_),{bounds:Z,scale:q}=Y,X=(A)=>(A-Z.minX)*q,B=(A)=>(A-Z.minY)*q,L=j((A)=>{let I=z.current;if(!I)return;let N=I.getBoundingClientRect(),R=(A.clientX-N.left)/N.width*xQ,p=(A.clientY-N.top)/N.height*hQ,l=mQ(U.value,$.value,J,_),T=$.value,r=J/T.scale,t=_/T.scale,i=R/l.scale+l.bounds.minX,o=p/l.scale+l.bounds.minY;v(-(i-r/2)*T.scale,-(o-t/2)*T.scale)},[U,$,J,_,v]),P=j((A)=>{A.stopPropagation(),A.preventDefault(),K.current=!0,L(A);let I=(R)=>{if(K.current)L(R)},N=()=>{K.current=!1,document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",N)};document.addEventListener("pointermove",I),document.addEventListener("pointerup",N)},[L]),k=A$.value,H=k1.value,F=H?V9(H.nodeIds.map((A)=>W.get(A)).filter((A)=>A!==void 0),H.padding):null,b=G6.value.map((A)=>({id:A.sessionId,phase:A.phase,worker:A.parentAgentId!=null,external:!A.attached,at:S9(A,(I)=>W.get(I))})).filter((A)=>A.at!==null),V=-O.x/O.scale,E=-O.y/O.scale;return G("div",{ref:z,class:"minimap","data-testid":"minimap",title:"Click to jump · drag the frame to pan",onPointerDown:P,children:[Array.from(W.values()).map((A)=>{let I=A.type==="group";return G("span",{class:`minimap-node${I?" is-group":""}${k.has(A.id)?" is-selected":""}`,"data-kind":A.type,style:{left:`${X(A.position.x)}px`,top:`${B(A.position.y)}px`,width:`${Math.max(I?6:4,A.size.width*q)}px`,height:`${Math.max(I?5:3,A.size.height*q)}px`,"--kind":u9[A.type]}},A.id,!1,void 0,this)}),F&&G("span",{class:"minimap-fence",style:{left:`${X(F.x)}px`,top:`${B(F.y)}px`,width:`${F.width*q}px`,height:`${F.height*q}px`}},void 0,!1,void 0,this),b.map((A)=>G("span",{class:`minimap-presence phase-${A.phase}${A.worker?" is-worker":""}${A.external?" is-external":""}`,style:{left:`${X(A.at.x)-4}px`,top:`${B(A.at.y)-4}px`,"--identity-color":`hsl(${F1(A.id)} 65% 62%)`}},A.id,!1,void 0,this)),G("span",{class:"minimap-frame",style:{left:`${X(V)}px`,top:`${B(E)}px`,width:`${J/O.scale*q}px`,height:`${_/O.scale*q}px`}},void 0,!1,void 0,this),G("span",{class:"minimap-zoom",children:[Math.round(O.scale*100),"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function J6({label:$,shortcut:U,body:v,align:J="center",side:_="down",tapToOpen:z=!1,children:K}){return G("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${J}${_==="up"?" toolbar-tooltip-anchor-up":""}${z?" toolbar-tooltip-anchor-tap":""}`,tabIndex:z?-1:void 0,children:[K,G("span",{class:"toolbar-tooltip",role:"tooltip",children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),v&&G("span",{class:"toolbar-tooltip-body",children:v},void 0,!1,void 0,this),U&&G("span",{class:"toolbar-tooltip-meta",children:G("kbd",{class:"toolbar-tooltip-shortcut",children:U},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function lQ(){let $=A$.value.size,U=j(()=>{let W=Array.from(A$.value);if(W.length===0)return;$v(W),M6()},[]),v=j(()=>{let W=Array.from(A$.value);if(W.length===0)return;BU({title:"Group",childIds:W}),M6()},[]),J=j(()=>{let W=Array.from(A$.value);for(let O=0;O<W.length;O++)for(let Y=O+1;Y<W.length;Y++)j1(W[O],W[Y],"relation");M6()},[]),_=j(()=>{let W=Array.from(A$.value);for(let O of W)h6(O),d4(O);M6()},[]);if($===0)return null;let z=$>=2,K=!F6.value&&j$.value.size>0&&!q4.value;return G("div",{class:`selection-bar${K?" is-above-pin-bar":""}`,role:"toolbar","aria-label":"Selection",children:[G("span",{class:"selection-bar-count",children:[$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),z&&G(M$,{children:[G("span",{class:"selection-bar-sep"},void 0,!1,void 0,this),G(J6,{label:"Align left",side:"up",children:G("button",{type:"button",class:"selection-bar-icon","aria-label":"Align left",onClick:()=>h8("left"),children:G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","aria-hidden":"true",children:[G("line",{x1:"2.5",y1:"2",x2:"2.5",y2:"14"},void 0,!1,void 0,this),G("rect",{x:"5",y:"3.5",width:"8",height:"3.5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"5",y:"9",width:"5",height:"3.5",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Align top",side:"up",children:G("button",{type:"button",class:"selection-bar-icon","aria-label":"Align top",onClick:()=>h8("top"),children:G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","aria-hidden":"true",children:[G("line",{x1:"2",y1:"2.5",x2:"14",y2:"2.5"},void 0,!1,void 0,this),G("rect",{x:"3.5",y:"5",width:"3.5",height:"8",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9",y:"5",width:"3.5",height:"5",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Distribute horizontally",body:"Evens the gaps. A selection that cannot fit flows into a clean row instead of overlapping.",side:"up",children:G("button",{type:"button",class:"selection-bar-icon","aria-label":"Distribute",disabled:$<3,onClick:()=>UZ(),children:G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"5",width:"3.5",height:"6",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"6.25",y:"5",width:"3.5",height:"6",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"11",y:"5",width:"3.5",height:"6",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Auto-arrange selection",side:"up",children:G("button",{type:"button",class:"selection-bar-icon","aria-label":"Auto-arrange",onClick:()=>_Z(),children:G(n1,{size:14},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"selection-bar-sep"},void 0,!1,void 0,this),G(J6,{label:"Group the selection",shortcut:"G",side:"up",children:G("button",{type:"button",class:"selection-bar-action",onClick:v,children:[G("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 2.5","aria-hidden":"true",children:G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Group"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Connect every pair",side:"up",children:G("button",{type:"button",class:"selection-bar-action",onClick:J,children:"Connect"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(J6,{label:"Pin to agent context",side:"up",children:G("button",{type:"button",class:"selection-bar-action is-pin",onClick:U,children:[G("span",{"aria-hidden":"true",children:"✦"},void 0,!1,void 0,this),"Pin as context"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),G("span",{class:"selection-bar-sep"},void 0,!1,void 0,this),G(J6,{label:"Delete selection",side:"up",children:G("button",{type:"button",class:"selection-bar-icon is-danger","aria-label":"Delete selection",onClick:_,children:G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","aria-hidden":"true",children:[G("path",{d:"M2.5 4 H13.5"},void 0,!1,void 0,this),G("path",{d:"M5.5 4 V2.5 H10.5 V4"},void 0,!1,void 0,this),G("path",{d:"M4 4 L4.8 13.5 H11.2 L12 4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Clear selection",shortcut:"Esc",side:"up",children:G("button",{type:"button",class:"selection-bar-icon",onClick:M6,"aria-label":"Clear selection",children:"×"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function o9($,U=Date.now()){if(!$.expiresAt)return null;let v=Date.parse($.expiresAt);if(!Number.isFinite(v))return null;return Math.max(0,v-U)}function d9($){let U=Math.max(0,Math.ceil($/1000)),v=Math.floor(U/60),J=U%60;return`${v}:${String(J).padStart(2,"0")}`}var hg={todo:"queued","in-progress":"running",blocked:"awaiting",done:"done",cancelled:"vetoed"},cg={todo:"queued","in-progress":"running",blocked:"awaiting",done:"done",cancelled:"cancelled"},rQ=[{id:"all",label:"All",hint:"Everything below in one feed, newest first"},{id:"update",label:"Updates",hint:"Board edits agents made — nodes, edges, pins, work items"},{id:"steer",label:"Steer",hint:"Instructions sent to agents — by you from the composer, or agent-to-agent"},{id:"assistant",label:"Assistant",hint:"Messages agents posted for you to read"},{id:"event",label:"Events",hint:"Run telemetry — tool runs, approvals, failures, policy notes"},{id:"evidence",label:"Evidence",hint:"Proof agents recorded — test results, artifacts, links"}],iQ=Object.fromEntries(rQ.map(($)=>[$.id,$.hint])),lg={policy:"warn",prompt:"accent","assistant-message":"muted","tool-start":"accent","tool-result":"ok",failure:"danger",approval:"warn",steering:"purple",command:"accent",note:"muted",evidence:"ok",steer:"purple",update:"purple",yield:"warn"};function QO($){let U=new Date($);if(Number.isNaN(U.getTime()))return"";return`${String(U.getHours()).padStart(2,"0")}:${String(U.getMinutes()).padStart(2,"0")}`}function rg({item:$}){let U=hg[$.status]??"queued",v=$.nodeIds[0];return G("li",{class:`session-item status-${U}`,"data-work-item-id":$.id,children:[G("span",{class:"session-glyph","aria-hidden":"true"},void 0,!1,void 0,this),G("div",{class:"session-item-main",children:[G("button",{type:"button",class:"session-item-title",title:v?"Focus the linked node":void 0,disabled:!v,onClick:()=>v&&K6(v),children:$.title},void 0,!1,void 0,this),$.detail&&G("div",{class:"session-item-detail",children:$.detail},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"session-item-status",children:cg[$.status]??U},void 0,!1,void 0,this),G("span",{class:"session-item-time",children:QO($.updatedAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ig({gate:$,now:U}){let[v,J]=f(null),_=async(W)=>{J(W),await lH($,W),J(null)},z=$.nodeIds[0],K=o9($,U);return G("li",{class:"session-item status-awaiting session-gate","data-gate-id":$.id,children:[G("span",{class:"session-glyph","aria-hidden":"true"},void 0,!1,void 0,this),G("div",{class:"session-item-main",children:[G("button",{type:"button",class:"session-item-title",title:z?"Focus the linked node":void 0,disabled:!z,onClick:()=>z&&K6(z),children:$.title},void 0,!1,void 0,this),$.detail&&G("div",{class:"session-item-detail",children:$.detail},void 0,!1,void 0,this),K!==null&&G("div",{class:"session-gate-ttl","data-testid":"gate-countdown",children:["auto-holds in ",d9(K)," if unanswered"]},void 0,!0,void 0,this),G("div",{class:"session-gate-actions",children:[G("button",{type:"button",class:"session-gate-approve",disabled:v!==null,onClick:()=>void _("approved"),children:v==="approved"?"Approving…":"Approve"},void 0,!1,void 0,this),G("button",{type:"button",class:"session-gate-reject",disabled:v!==null,onClick:()=>void _("rejected"),children:v==="rejected"?"Rejecting…":"Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"session-item-time",children:QO($.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pg({gate:$}){let[U,v]=f(!1);return G("li",{class:"session-item status-vetoed session-gate-held","data-gate-id":$.id,children:[G("span",{class:"session-glyph","aria-hidden":"true"},void 0,!1,void 0,this),G("div",{class:"session-item-main",children:[G("span",{class:"session-item-title",children:$.title},void 0,!1,void 0,this),G("div",{class:"session-item-detail",children:"Auto-held — no answer in time, the action did not proceed."},void 0,!1,void 0,this),G("div",{class:"session-gate-actions",children:G("button",{type:"button",class:"session-gate-reject",disabled:U,onClick:()=>{v(!0),rH($).finally(()=>v(!1))},children:U?"Reopening…":"Reopen"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"session-item-status",children:"held"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function og(){let $=k1.value,U=A$.value.size,[v,J]=f(!1),_=(z)=>{J(!0),uH(z).finally(()=>J(!1))};return G("div",{class:`session-scope${$?" is-fenced":""}`,"data-testid":"session-scope",children:[G("span",{class:"session-scope-dot","aria-hidden":"true"},void 0,!1,void 0,this),$?G(M$,{children:[G("span",{class:"session-scope-text",children:["Scoped to ",G("strong",{children:$.nodeIds.length},void 0,!1,void 0,this)," node",$.nodeIds.length===1?"":"s"," · writes outside are blocked"]},void 0,!0,void 0,this),G("button",{type:"button",class:"session-scope-action",disabled:v,onClick:()=>_(null),children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(M$,{children:[G("span",{class:"session-scope-text",children:"Unscoped — the agent may write anywhere"},void 0,!1,void 0,this),G("button",{type:"button",class:"session-scope-action",disabled:v||U===0,title:U===0?"Select nodes on the canvas first":"Fence the agent to the selected nodes",onClick:()=>_([...A$.value]),children:["Fence to selection",U>0?` (${U})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function dg($){if($==="browser")return"you";return G6.value.find((v)=>v.sessionId===$||v.source===$)?.label??$}function ng({entry:$}){let U=z2.value.has($.id);return G("li",{class:`session-timeline-row tone-${lg[$.kind]??"muted"}`,children:[G("span",{class:"session-timeline-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("div",{class:"session-timeline-main",children:[G("div",{class:"session-timeline-head",children:[G("span",{class:"session-timeline-label",title:iQ[vO($.kind)],children:$.label},void 0,!1,void 0,this),$.who&&G("span",{class:"session-timeline-who",style:{"--identity-color":`hsl(${F1($.who)} 65% 62%)`},children:dg($.who)},void 0,!1,void 0,this),G("span",{class:"session-item-time",children:QO($.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"session-timeline-body",children:$.body},void 0,!1,void 0,this),$.undoable&&!U&&G("button",{type:"button",class:"session-timeline-undo","data-testid":"timeline-undo",onClick:()=>void JO($),children:"↩ undo this edit"},void 0,!1,void 0,this),U&&G("div",{class:"session-timeline-undone",children:"undone · steering sent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pQ(){let[$,U]=f(!1),v=N0.value,J=fH.value,_=s1.value,z=mH.value,K=cH.value,[W,O]=f(!1),[Y,Z]=f(null),q=h4();if(u(()=>{b1()},[]),$)return G("aside",{class:"session-panel is-collapsed","aria-label":"Session (collapsed)",children:[G("button",{type:"button",class:"session-collapse",onClick:()=>U(!1),title:"Expand session panel",children:"‹"},void 0,!1,void 0,this),G("span",{class:"session-collapsed-label",children:"Session"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("aside",{class:"session-panel","aria-label":"Session",children:[G("header",{class:"session-panel-header",children:[G("span",{class:"session-panel-title",children:"Session"},void 0,!1,void 0,this),v&&G("span",{class:`session-live phase-${v.phase}`,title:w0(v),children:[G("span",{class:"session-live-dot","aria-hidden":"true"},void 0,!1,void 0,this),"live"]},void 0,!0,void 0,this),G("span",{class:"top-bar-spacer"},void 0,!1,void 0,this),v&&G("button",{type:"button",class:"session-end",title:"End this session — a receipt and a snapshot of the board follow",onClick:()=>void f9(v),children:"End"},void 0,!1,void 0,this),G("button",{type:"button",class:"session-collapse",onClick:()=>U(!0),title:"Collapse session panel",children:"›"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(og,{},void 0,!1,void 0,this),(()=>{let X=K.find((B)=>B.undoable&&!z2.value.has(B.id));if(!X)return null;return G("div",{class:"session-undo-row","data-testid":"session-undo-row",children:[G("span",{class:"session-undo-text",title:X.body,children:["Agent edit on top: ",X.body]},void 0,!0,void 0,this),G("button",{type:"button",class:"session-undo-btn",onClick:()=>void JO(X),children:"↩ Undo"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})(),G("div",{class:"session-panel-body",children:[G("section",{class:"session-section",children:(()=>{let X=J.filter((b)=>b.status==="in-progress"||b.status==="todo").length,B=J.filter((b)=>b.status!=="cancelled"),L=B.filter((b)=>b.status==="done").length,P=J.length-B.length,k=_.length>0,H=W||k,F=X>0?`${X} running`:B.length>0?`${L}/${B.length} done${P>0?` · ${P} cancelled`:""}`:J.length>0?`${J.length} cancelled`:"none yet";return G(M$,{children:[G("button",{type:"button",class:"session-section-toggle","aria-expanded":H,"data-testid":"work-items-toggle",onClick:()=>O((b)=>!b),children:[G("span",{class:"session-section-title",children:"Work items"},void 0,!1,void 0,this),G("span",{class:"session-work-summary",children:[X>0&&G("span",{class:"session-work-dot","aria-hidden":"true"},void 0,!1,void 0,this),F]},void 0,!0,void 0,this),G("span",{class:`session-section-chevron${H?" is-open":""}`,"aria-hidden":"true",children:"›"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&(_.length===0&&z.length===0&&J.length===0?G("div",{class:"session-empty",children:"No work items yet — the agent's tasks and gates appear here."},void 0,!1,void 0,this):G("ul",{class:"session-list","aria-live":"polite","aria-label":"Work items and gates",children:[_.map((b)=>G(ig,{gate:b,now:q},b.id,!1,void 0,this)),z.map((b)=>G(pg,{gate:b},b.id,!1,void 0,this)),J.map((b)=>G(rg,{item:b},b.id,!1,void 0,this))]},void 0,!0,void 0,this))]},void 0,!0,void 0,this)})()},void 0,!1,void 0,this),G("section",{class:"session-section",children:[G("h3",{class:"session-section-title",children:"Timeline"},void 0,!1,void 0,this),G("div",{class:"session-timeline-filters",role:"group","aria-label":"Filter timeline",children:rQ.map((X)=>G("button",{type:"button",class:`activity-filter${e1.value===X.id?" is-active":""}`,"aria-pressed":e1.value===X.id,title:X.hint,onMouseEnter:()=>Z(X.id),onMouseLeave:()=>Z((B)=>B===X.id?null:B),onFocus:()=>Z(X.id),onBlur:()=>Z((B)=>B===X.id?null:B),onClick:()=>{e1.value=X.id},children:X.label},X.id,!1,void 0,this))},void 0,!1,void 0,this),G("div",{class:"session-timeline-hint","data-testid":"timeline-filter-hint",children:iQ[Y??e1.value]},void 0,!1,void 0,this),K.length===0?G("div",{class:"session-empty",children:e1.value==="all"?"Nothing recorded yet.":"Nothing of this kind yet."},void 0,!1,void 0,this):G("ul",{class:"session-list session-timeline","aria-live":"polite","aria-label":"Timeline",children:K.map((X)=>G(ng,{entry:X},X.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function LO($){if(!$||typeof $!=="object")return null;let U=$,v=(J)=>Array.isArray(J)?J.length:0;return{added:v(U.addedNodes)+v(U.addedEdges),removed:v(U.removedNodes)+v(U.removedEdges),modified:v(U.modifiedNodes)}}function oQ({onOpenSnapshots:$}){let U=E9.value,[v,J]=f(null),[_,z]=f(!1);if(!U)return null;let K=async()=>{if(!U.snapshot)return;z(!0);try{let Y=await fetch(`/api/canvas/snapshots/${encodeURIComponent(U.snapshot.id)}/diff`,{headers:{"x-pmx-workbench":"1"}});if(Y.ok){let Z=await Y.json();J(LO(Z.diff)??{added:0,removed:0,modified:0})}}finally{z(!1)}},W=new Date(U.endedAt),O=Number.isNaN(W.getTime())?"":`${String(W.getHours()).padStart(2,"0")}:${String(W.getMinutes()).padStart(2,"0")}`;return G("div",{class:"session-receipt","data-testid":"session-receipt",role:"status",children:[G("div",{class:"session-receipt-head",children:[G("span",{class:"session-receipt-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"session-receipt-title",children:[U.endedBy==="human"?"Session ended by you":U.endedBy==="idle-timeout"?"Session ended — idle timeout":U.endedBy==="agent"?"Session ended by the agent":"Session ended",O?` · ${O}`:""]},void 0,!0,void 0,this),G("button",{type:"button",class:"session-receipt-close",onClick:oH,"aria-label":"Dismiss receipt",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"session-receipt-tiles",children:[G("div",{class:"session-receipt-tile",children:[G("span",{class:"session-receipt-tile-label",children:"Items"},void 0,!1,void 0,this),G("span",{class:"session-receipt-tile-value",children:U.counts.items},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"session-receipt-tile",children:[G("span",{class:"session-receipt-tile-label",children:"Done"},void 0,!1,void 0,this),G("span",{class:"session-receipt-tile-value tone-ok",children:U.counts.done},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.counts.cancelled>0&&G("div",{class:"session-receipt-tile",children:[G("span",{class:"session-receipt-tile-label",children:"Cancelled"},void 0,!1,void 0,this),G("span",{class:"session-receipt-tile-value tone-muted",children:U.counts.cancelled},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.counts.rejected>0&&G("div",{class:"session-receipt-tile",children:[G("span",{class:"session-receipt-tile-label",children:"Rejected"},void 0,!1,void 0,this),G("span",{class:"session-receipt-tile-value tone-danger",children:U.counts.rejected},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.counts.held>0&&G("div",{class:"session-receipt-tile",children:[G("span",{class:"session-receipt-tile-label",children:"Held"},void 0,!1,void 0,this),G("span",{class:"session-receipt-tile-value tone-warn",children:U.counts.held},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"session-receipt-note",children:U.snapshot?"A snapshot of the board from before this session is saved — restore it to undo the session.":U.unchanged?"This session changed nothing on the board — no snapshot kept.":"The board was empty when the session started — nothing to restore."},void 0,!1,void 0,this),v&&G("div",{class:"session-receipt-diff","data-testid":"session-receipt-diff",children:["This session: ",v.added," added · ",v.removed," removed · ",v.modified," modified"]},void 0,!0,void 0,this),G("div",{class:"session-receipt-actions",children:[U.snapshot&&G("button",{type:"button",class:"session-receipt-primary",disabled:_,onClick:()=>void K(),children:_?"Comparing…":"View diff"},void 0,!1,void 0,this),G("button",{type:"button",class:"session-receipt-secondary",title:"Open the History drawer — saved boards and past sessions",onClick:$,children:"History"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var tg=[{title:"Tools",shortcuts:[{keys:"V",desc:"Select tool — drag empty space to lasso"},{keys:"Space (hold)",desc:"Pan — drag anywhere moves the board"},{keys:"A",desc:"Annotate — draw on the canvas"}]},{title:"Navigation",shortcuts:[{keys:d$("K"),desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:"F",desc:"Fit all nodes on screen"},{keys:d$("0"),desc:"Reset viewport to origin"},{keys:`${d$("+")} / ${d$("−")}`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"M",desc:"New markdown note"},{keys:"I / W / H",desc:"New image / webpage / HTML surface"},{keys:"Shift+F",desc:"New file node (workspace path)"},{keys:"G / Shift+G",desc:"Group the selection (new frame when empty) / ungroup"},{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Drag empty space",desc:"Lasso select multiple nodes"},{keys:n0?"Delete / ⌫":"Delete / Backspace",desc:"Delete the selection (or the focused node)"},{keys:n0?"⌘Z / ⇧⌘Z":"Ctrl+Z / Ctrl+Y",desc:"Undo / redo — agent edits included"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in the rail)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function dQ({onClose:$}){return G("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:G("div",{class:"shortcut-overlay",onMouseDown:(U)=>U.stopPropagation(),children:[G("div",{class:"shortcut-overlay-header",children:[G("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),G("span",{class:"shortcut-overlay-hint",children:["Press ",G("kbd",{children:"?"},void 0,!1,void 0,this)," or ",G("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"shortcut-overlay-body",children:tg.map((U)=>G("div",{class:"shortcut-group",children:[G("div",{class:"shortcut-group-title",children:U.title},void 0,!1,void 0,this),U.shortcuts.map((v)=>G("div",{class:"shortcut-row",children:[G("kbd",{class:"shortcut-keys",children:v.keys},void 0,!1,void 0,this),G("span",{class:"shortcut-desc",children:v.desc},void 0,!1,void 0,this)]},v.keys,!0,void 0,this))]},U.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var nQ="Before session · ";function tQ($){let U=new Date($);if(Number.isNaN(U.getTime()))return"";return`${String(U.getHours()).padStart(2,"0")}:${String(U.getMinutes()).padStart(2,"0")}`}function ag($){let U=Date.now()-new Date($).getTime(),v=Math.floor(U/60000);if(v<1)return"just now";if(v<60)return`${v}m ago`;let J=Math.floor(v/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}function n9($){if(!$.startsWith(nQ))return null;let U=$.slice(nQ.length),v=U.lastIndexOf(" · ");return v>0?U.slice(0,v):U}function aQ({open:$,onClose:U,anchorRef:v}){let[J,_]=f([]),[z,K]=f(!1),[W,O]=f(!1),[Y,Z]=f(null),[q,X]=f(""),[B,L]=f(null),[P,k]=f({}),H=C(null),F=C(null);u(()=>{if(!$)return;K(!0),wY().then((N)=>{_(N),K(!1)})},[$]),u(()=>{if($)setTimeout(()=>F.current?.focus(),50)},[$]),u(()=>{if(!$)return;let N=(R)=>{let p=H.current,l=v.current;if(p&&!p.contains(R.target)&&l&&!l.contains(R.target))U()};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[$,U]),u(()=>{if(!$)return;let N=(R)=>{if(R.key==="Escape")U()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[$,U]);let b=j(async()=>{let N=q.trim();if(!N)return;O(!0);let R=await gY(N);if(O(!1),R.ok&&R.snapshot)_((p)=>[R.snapshot,...p]),X("")},[q]),V=j(async(N)=>{L(null),Z(N);let R=await NY(N);if(Z(null),R.ok)U()},[U]),E=j(async(N)=>{if((await SY(N)).ok)_((p)=>p.filter((l)=>l.id!==N));L(null)},[]),A=j(async(N)=>{k((p)=>({...p,[N]:"loading"}));let R=await b$("snapshotDiff",`/api/canvas/snapshots/${encodeURIComponent(N)}/diff`,{});k((p)=>({...p,[N]:LO(R.diff)??{added:0,removed:0,modified:0}}))},[]);if(!$)return null;let I=(N,R)=>B?.id===N.id?G(M$,{children:[G("button",{type:"button",class:`snapshot-action-btn ${B.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>B.action==="delete"?E(N.id):V(N.id),title:B.action==="delete"?"Confirm delete":"Confirm restore",disabled:Y!==null,children:B.action==="delete"?"Delete":Y===N.id?"Restoring…":"Confirm"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn",onClick:()=>L(null),title:"Cancel",disabled:Y!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(M$,{children:[G("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>L({id:N.id,action:"restore"}),title:"Restore this snapshot — replaces the current canvas (undoable)",disabled:Y!==null,children:Y===N.id?"Restoring…":R},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>L({id:N.id,action:"delete"}),title:"Delete this snapshot","aria-label":"Delete snapshot",disabled:Y!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{ref:H,class:"snapshot-panel","data-testid":"history-drawer",role:"dialog","aria-label":"History",children:[G("div",{class:"snapshot-panel-header",children:[G("span",{class:"snapshot-panel-title",children:"History"},void 0,!1,void 0,this),G("span",{class:"snapshot-panel-sub",children:"snapshots + sessions"},void 0,!1,void 0,this),G("span",{class:"snapshot-panel-spacer"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-panel-close",onClick:U,title:"Close","aria-label":"Close history",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-save-form",children:[G("input",{ref:F,type:"text",class:"snapshot-name-input",value:q,onInput:(N)=>X(N.target.value),onKeyDown:(N)=>{if(N.key==="Enter")b()},placeholder:"Save a snapshot as…","aria-label":"Snapshot name",maxLength:80,disabled:W},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-save-btn",onClick:b,disabled:!q.trim()||W,children:W?"…":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),G("div",{class:"snapshot-list",children:[z&&G("div",{class:"snapshot-empty",children:"Loading…"},void 0,!1,void 0,this),!z&&J.length===0&&G("div",{class:"snapshot-empty",children:"No history yet. Save a snapshot, or start an agent session — it snapshots for you."},void 0,!1,void 0,this),!z&&[...J.filter((N)=>n9(N.name)===null),...J.some((N)=>n9(N.name)!==null)?[{id:"__sessions-header__"}]:[],...J.filter((N)=>n9(N.name)!==null)].map((N)=>{if(N.id==="__sessions-header__")return G("div",{class:"snapshot-section-header","data-testid":"history-sessions-header",children:"Sessions"},N.id,!1,void 0,this);let R=n9(N.name),p=P[N.id];if(R!==null)return G("div",{class:"snapshot-item is-session","data-testid":"history-session",children:[G("div",{class:"snapshot-item-head",children:[G("span",{class:"snapshot-session-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"snapshot-item-name",children:["Agent session — ",R]},void 0,!0,void 0,this),G("span",{class:"snapshot-item-time",children:tQ(N.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-meta",children:["snapshot at session start · ",N.nodeCount," node",N.nodeCount!==1?"s":"",p&&p!=="loading"&&G("span",{class:"snapshot-item-diff",children:[" ","· since: ",p.added," added · ",p.removed," removed · ",p.modified," modified"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-actions is-session",children:[G("button",{type:"button",class:"snapshot-action-btn snapshot-action-diff",disabled:p==="loading",onClick:()=>void A(N.id),children:p==="loading"?"Comparing…":"View diff"},void 0,!1,void 0,this),I(N,"Restore pre-state")]},void 0,!0,void 0,this)]},N.id,!0,void 0,this);return G("div",{class:"snapshot-item","data-testid":"history-snapshot",children:[G("div",{class:"snapshot-item-head",children:[G("span",{class:"snapshot-item-glyph","aria-hidden":"true",children:"◫"},void 0,!1,void 0,this),G("span",{class:"snapshot-item-name",children:N.name},void 0,!1,void 0,this),G("span",{class:"snapshot-item-time",children:tQ(N.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-meta",children:[N.nodeCount," node",N.nodeCount!==1?"s":"",N.edgeCount>0?` · ${N.edgeCount} edge${N.edgeCount!==1?"s":""}`:""," · ",ag(N.createdAt)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-actions",children:I(N,"Restore")},void 0,!1,void 0,this)]},N.id,!0,void 0,this)})]},void 0,!0,void 0,this),G("div",{class:"snapshot-panel-foot",children:"Every agent session start writes a snapshot automatically."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sg(){let $=wH.value;if($.length===0)return null;return G(M$,{children:$.map((U)=>{let v=G6.value.filter((J)=>J.parentAgentId!=null&&(J.parentAgentId===U.sessionId||J.parentAgentId===U.source)).length;return G(J6,{label:`Agent session — ${U.label}`,tapToOpen:!0,body:"What this attached agent is doing right now: idle, thinking, running a tool, or waiting on your approval. Steer it from the composer below.",children:G("span",{class:`agent-chip phase-${U.phase}`,"data-phase":U.phase,style:{"--identity-color":`hsl(${F1(U.sessionId)} 65% 62%)`},children:[G("span",{class:"agent-chip-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"agent-chip-label",children:w0(U)},void 0,!1,void 0,this),G("span",{class:"agent-chip-who hud-collapsible-text",children:U.label},void 0,!1,void 0,this),v>0&&G("span",{class:"agent-chip-workers",children:["+",v," worker",v===1?"":"s"]},void 0,!0,void 0,this),G("button",{type:"button",class:"agent-chip-end","aria-label":`End ${U.label} session`,title:`End ${U.label}'s session`,onClick:(J)=>{J.stopPropagation(),f9({source:U.source,agentId:U.agentId})},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},U.sessionId,!1,void 0,this)})},void 0,!1,void 0,this)}function eg(){let $=s1.value.length,U=N0.value!==null&&$>0,v=h4(U?1000:0);if(!U)return null;let J=s1.value.map((_)=>o9(_,v)).filter((_)=>_!==null).sort((_,z)=>_-z)[0];return G(J6,{label:"Approval gates waiting on you",tapToOpen:!0,body:"The agent is blocked until you approve or reject in the session panel; unanswered gates auto-hold when the countdown runs out.",children:G("span",{class:"gate-badge",children:[$," gate",$===1?"":"s",J!==void 0&&` · ${d9(J)}`]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function $N($){if($>0.9)return"danger";if($>=0.7)return"warn";return"ok"}function W2($){return $>=1000?`${($/1000).toFixed($>=1e4?0:1)}k`:String($)}function UN(){let $=N0.value;if(!$)return null;let U=oW.value,v=$.contextUsage,J=v?v.used:U.used,_=v?v.total:U.total,z=_>0?Math.min(1,J/_):0,K=Math.round(z*100),W=v?{label:`Context window — reported by ${$.label}`,body:`${W2(v.used)} of ${W2(v.total)} tokens of the agent's actual context window are used. Your ✦-pinned nodes account for ≈ ${W2(U.used)} tokens of it.`}:{label:"Pins — pinned-context size (estimate)",body:`The nodes you pinned (✦) are what the agent is asked to carry as context: ≈ ${W2(U.used)} of a ${W2(U.total)}-token budget. When the agent's host reports its real context window, this meter switches to showing that instead.`};return G(J6,{label:W.label,body:W.body,tapToOpen:!0,children:G("span",{class:`context-budget tone-${$N(z)}`,"data-mode":v?"window":"pins",children:[G("span",{class:"context-budget-caption hud-collapsible-text",children:v?"Context":"Pins"},void 0,!1,void 0,this),G("span",{class:"context-budget-track","aria-hidden":"true",children:G("span",{class:"context-budget-fill",style:{width:`${K}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"context-budget-label","data-testid":"budget-label",children:[J>0&&K===0?"<1":K,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function _N(){let[$,U]=f(!1);if(N0.value)return null;return G(J6,{label:"Start an agent session",body:"Attaches a session to this board: the next agent that writes here is adopted into it, and you get the panel, composer, and receipt.",children:G("button",{type:"button",class:"start-session-btn",disabled:$,onClick:()=>{U(!0),M1().finally(()=>U(!1))},children:[G("span",{class:"start-session-dot","aria-hidden":"true"},void 0,!1,void 0,this),"Start agent session",G("span",{class:"beta-tag",children:"beta"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function sQ(){let $=x6.value,U=z4.value,v=G$.value,J=D.value.size,_=c$.value.size,z=bU.value,K=Array.from(D.value.values()).filter((B)=>B.type==="trace").length,[W,O]=f("");u(()=>{let B=!1;return fetch("/health").then((L)=>L.ok?L.json():null).then((L)=>{if(B||typeof L?.workspace!=="string"||!L.workspace)return;let P=L.workspace.replace(/[\\/]+$/,"").split(/[\\/]/).pop();if(P)O(P)}).catch(()=>{}),()=>{B=!0}},[]);let Y=OO.value,Z=Y??($==="connected"&&!U?"syncing":$),q=U?[`${J} node${J!==1?"s":""}`,..._>0?[`${_} edge${_!==1?"s":""}`]:[],...K>0?[`${K} trace${K!==1?"s":""}`]:z?["trace armed"]:[]].join(" · "):"Syncing canvas…",X=()=>{let B=$4();NU(B.width,B.height)};return G("div",{class:"top-bar",children:[G(J6,{label:`Canvas status: ${Z}`,tapToOpen:!0,body:"Live updates stream in over SSE; amber means reconnecting.",align:"start",children:G("span",{class:`connection-dot ${Y??$}`,"aria-label":`Canvas status: ${Z}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"top-bar-title",title:W||"PMX Canvas",children:W||"PMX Canvas"},void 0,!1,void 0,this),G("span",{class:"top-bar-meta hud-collapsible-text",children:y4.value?y4.value.slice(0,12):"…"},void 0,!1,void 0,this),G("span",{class:"top-bar-meta hud-collapsible-text",children:q},void 0,!1,void 0,this),G("span",{class:"top-bar-spacer"},void 0,!1,void 0,this),G(sg,{},void 0,!1,void 0,this),G(eg,{},void 0,!1,void 0,this),G(UN,{},void 0,!1,void 0,this),G(CQ,{},void 0,!1,void 0,this),G(_N,{},void 0,!1,void 0,this),G("div",{class:"top-bar-sep"},void 0,!1,void 0,this),G(J6,{label:"Zoom out",shortcut:d$("−"),children:G("button",{type:"button",class:"top-bar-btn",onClick:()=>wU(0.8),"aria-label":"Zoom out",children:G(vH,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Reset zoom",shortcut:d$("0"),children:G("button",{type:"button",class:"top-bar-zoom-label",onClick:()=>$1({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:[Math.round(v.scale*100),"%"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Zoom in",shortcut:d$("+"),children:G("button",{type:"button",class:"top-bar-btn",onClick:()=>wU(1.25),"aria-label":"Zoom in",children:G(_H,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(J6,{label:"Fit all",shortcut:"F",align:"end",children:G("button",{type:"button",class:"top-bar-btn",onClick:X,"aria-label":"Fit canvas",children:G(M9,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eQ($,U,v,J,_){return $.x<J.position.x+J.size.width+_&&$.x+U+_>J.position.x&&$.y<J.position.y+J.size.height+_&&$.y+v+_>J.position.y}function vN($,U,v,J,_){return J.some((z)=>eQ($,U,v,z,_))}function JN($,U,v,J,_){return J.find((z)=>eQ($,U,v,z,_))}function t9($,U,v,J=24){if($.length===0)return{x:40,y:80};let _=$[$.length-1],z={x:_.position.x+_.size.width+J,y:_.position.y};if(!vN(z,U,v,$,J))return z;let K=40,W=80,O=3000,Y=W;for(let q=0;q<20;q++){let X=K;while(X+U<O){let P=JN({x:X,y:Y},U,v,$,J);if(!P)return{x:X,y:Y};X=P.position.x+P.size.width+J}Y=$.filter((P)=>P.position.y<=Y+v+J&&P.position.y+P.size.height+J>Y).reduce((P,k)=>Math.max(P,k.position.y+k.size.height),Y)+J}let Z=$.reduce((q,X)=>Math.max(q,X.position.y+X.size.height),0);return{x:K,y:Z+J}}var A1={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},diff:{x:380,y:80,w:640,h:420},mermaid:{x:380,y:80,w:640,h:460},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function O2($,U,v,J={}){let _=A1[U];return{id:$,type:U,position:J.position??{x:_.x,y:_.y},size:J.size??{width:_.w,height:_.h},zIndex:U==="status"?0:1,collapsed:!1,pinned:!1,data:v}}var _U=null,e9=null,a9=0,I1=null,zN=3000,KN=2000,$L=5000,Y2=!1,l4=null,D0=null,g1=0,w1=null;function GN(){if(typeof location>"u"||typeof window>"u")return null;let $=new URLSearchParams(location.search).get("transport");if($==="poll"||$==="sse")return $;if(window.__PMX_AMP_ORB===!0)return"poll";return null}var j0=new Map;function Z2($){let U=0;for(let v=0;v<$.length;v++)U=(U<<5)-U+$.charCodeAt(v)|0;return Math.abs(U).toString(36)}function $8($){if(!e9)return $;let U=e9.get($.id);if(!U)return $;return{...$,position:U.position??$.position,size:U.size??$.size,collapsed:U.collapsed??$.collapsed,pinned:U.pinned??$.pinned}}function q2($,U,v){return $8(O2($,U,v))}function WN(){return t9([...D.value.values()],A1.markdown.w,A1.markdown.h)}function V0(){if(!D.value.has("status-main"))C4(q2("status-main","status",{phase:"idle",message:"",elapsed:0}))}function ON($,U){let v=`md-${Z2($)}`;if(D.value.get(v))W$(v,{path:$,title:U}),C$.value=v;else{let _=WN(),z=q2(v,"markdown",{path:$,title:U,content:"",rendered:""});z.position=_,C4(z),K6(v)}}function YN($){if(D.value.get("context-main"))W$("context-main",{cards:$});else if($.length>0){let J=q2("context-main","context",{cards:$});C4(J)}}function ZN($){let U=$.url,v=`mcp-${Z2(U)}`;if(D.value.get(v))W$(v,$);else C4(q2(v,"mcp-app",$)),K6(v)}function qN($){let U=$.toolCallId,J=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(U.startsWith("ext-app-")?U:`ext-app-${U}`);if(D.value.get(J)){W$(J,$);return}let{serverName:z,toolName:K}=$;if(z&&K){for(let[k,H]of D.value.entries())if(H.type==="mcp-app"&&H.data.mode==="ext-app"&&H.data.serverName===z&&H.data.toolName===K&&!H.data.toolResult){W$(k,{...$});return}}let{_x:W,_y:O,_width:Y,_height:Z}=$,q=A1["mcp-app"],X=Y??q.w,B=Z??q.h,L=W===void 0||O===void 0?t9([...D.value.values()],X,B):null,P=$8(O2(J,"mcp-app",{mode:"ext-app",...$},{position:{x:W??L?.x??q.x,y:O??L?.y??q.y},size:{width:X,height:B}}));C4(P),K6(J,{recordHistory:!1})}function BN($){let U=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(D.value.has(U))return U;let v=`ext-app-${$}`;if(v!==U&&D.value.has(v))return v;for(let[J,_]of D.value.entries())if(_.type==="mcp-app"&&_.data.mode==="ext-app"&&_.data.toolCallId===$)return J;return null}function zL($){let U=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(U&&D.value.has(U))return U;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return BN($.toolCallId)}function KL($,U){if(typeof $!=="string"||!$)return null;if(typeof U!=="string"||!U)return null;let v=null;for(let[J,_]of D.value.entries())if(_.type==="mcp-app"&&_.data.mode==="ext-app"&&_.data.serverName===$&&_.data.toolName===U&&!_.data.toolResult){if(v)return null;v=J}return v}function GL($){if(D.value.get("ledger-main"))W$("ledger-main",$);else{let J=q2("ledger-main","ledger",$);J.collapsed=!0,C4(J)}}function FO($){if(!e0($))return;if(document.documentElement.setAttribute("data-theme",$),P0(),$6.value!==$)$6.value=$}function XN($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="diff"||$==="mermaid"||$==="image"||$==="html"||$==="group"}function HN($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function PO($){if(!$||typeof $!=="object")return null;let U=$;if(typeof U.x!=="number"||typeof U.y!=="number")return null;return{x:U.x,y:U.y}}function WL($){if(!$||typeof $!=="object")return null;let U=$;if(typeof U.width!=="number"||typeof U.height!=="number")return null;return{width:U.width,height:U.height}}function QN($){let U=PO($),v=WL($);return U&&v?{...U,...v}:null}function LN($){if(typeof $.id!=="string"||!$.id)return null;if(!XN($.type))return null;let U=PO($.position),v=WL($.size);if(!U||!v)return null;let J=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:U,size:v,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,data:J}}function FN($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!HN($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function PN($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let U=$.points.map((J)=>PO(J)).filter((J)=>J!==null),v=QN($.bounds);if(U.length<($.type==="text"?1:2)||!v)return null;return{id:$.id,type:$.type,points:U,bounds:v,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}var UL="pmx-canvas-version-reload";function kN($,U){if(typeof window>"u")return;let v=window,J=(z,K)=>typeof z==="string"&&z!==""&&z!=="unknown"&&typeof K==="string"&&K!==""&&K!=="unknown"&&z!==K;if(!J($,v.__PMX_BOOT_SERVER_VERSION)&&!J(U,v.__PMX_BOOT_BUNDLE_STAMP))return;let _=`${String($)}::${String(U)}`;try{if(window.sessionStorage.getItem(UL)===_)return;window.sessionStorage.setItem(UL,_)}catch{return}window.location.reload()}function bN($){let U=P1.value[0]?.id;if(tW($),F6.value&&P1.value[0]?.id!==U)b1()}function MN($){pH($)}var _L=null;function AN($){eW($)}function IN($){if(y4.value=$.sessionId||"",x6.value="connected",f1.value+=1,kN($.version,$.bundleStamp),l0(),bY().then(tW),_L?.(),!u2)_L=jH();if(b$("fetchHumanPresence","/api/canvas/human-presence",null).then(eW),w8().then((U)=>{if(K4.value=U,F6.value)b1()}),typeof $.theme==="string"&&!YO())FO($.theme);if($.ledgerSummary)GL($.ledgerSummary)}function wN($){if(typeof $.path!=="string"||!$.path)return;let U=$.path,v=(typeof $.title==="string"?$.title:"")||U.split("/").pop()||"Untitled";if(ON(U,v),$.ledgerSummary)GL($.ledgerSummary)}function gN($){V0(),W$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function NN($){V0(),W$("status-main",{phase:$.phase,detail:$.detail})}function SN($){let U=$.cards??[];YN(U)}function RN($){if(typeof $.url==="string"&&$.url)ZN({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function TN($){let U=$.sessions??[];for(let v of U){let J=v.url;if(!J)continue;let _=`mcp-${Z2(J)}`;if(D.value.has(_))W$(_,{sessionState:v.state,lastSeenAt:v.lastSeenAt})}}function yN($){if(typeof $.url==="string"&&$.url){let U=`mcp-${Z2($.url)}`;if(D.value.has(U))W$(U,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function CN($){let v=D.value.get("context-main");if(!v)return;let J=(v.data.auxTabs??[]).concat($);W$("context-main",{auxTabs:J})}function DN($){if(D.value.has("context-main"))if($.mode==="all")W$("context-main",{auxTabs:[]});else{let J=D.value.get("context-main");if(!J)return;let _=(J.data.auxTabs??[]).filter((z)=>z.id!==$.id);W$("context-main",{auxTabs:_})}}function jN($){V0(),W$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function VN($){V0(),W$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function fN($){V0(),W$("status-main",{activeTool:null})}function EN($){if($.state==="active"&&$.path){let v=`md-${Z2($.path)}`;if(D.value.has(v))W$(v,{reviewActive:!0})}}function uN($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;qN({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function mN($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let U=zL($)??KL($.serverName,$.toolName);if(!U)return;if(D.value.has(U))W$(U,{html:$.html})}function xN($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let U=zL($)??KL($.serverName,$.toolName);if(!U)return;if(D.value.has(U)){if($.success===!1){h6(U);return}W$(U,{toolResult:NW({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function hN($){V0(),W$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function cN($){let U=$.nodeId;if(!U)return;let v=$.text||"",J=$.position,_=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&D.value.has($.threadNodeId)){let K=$.threadNodeId,W=D.value.get(K);if(!W)return;let O=Array.isArray(W.data.turns)?[...W.data.turns]:[],Y=O[O.length-1];if(!Y||Y.role!=="user"||Y.text!==v)O.push({role:"user",text:v,status:"pending"});W$(K,{turns:O,threadStatus:"pending"});return}if(!D.value.has(U)){let K=J??A1.prompt;C4($8(O2(U,"prompt",{text:v,turns:v?[{role:"user",text:v,status:"pending"}]:[],threadStatus:v?"pending":"draft",status:v?"pending":"draft",parentNodeId:_,contextNodeIds:z},{position:{x:K.x,y:K.y}}))),K6(U)}if(_&&D.value.has(_))vv({id:`edge-${_}-${U}`,from:_,to:U,type:"flow",style:"dashed"})}function lN($){let{nodeId:U,status:v}=$;if(U&&D.value.has(U))W$(U,{status:v})}function rN($){let{responseNodeId:U,promptNodeId:v}=$;if(!U)return;let J=v?D.value.get(v):void 0;if(J&&Array.isArray(J.data.turns)){j0.set(U,v);let z=[...J.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),W$(v,{turns:z,threadStatus:"streaming",_activeResponseId:U}),K6(v);return}let _=J?{x:J.position.x,y:J.position.y+J.size.height+24}:{x:A1.response.x,y:A1.response.y};if(!D.value.has(U))C4($8(O2(U,"response",{content:"",status:"streaming",promptNodeId:v},{position:_})));if(v)vv({id:`edge-${v}-${U}`,from:v,to:U,type:"flow",animated:!0});K6(U)}function iN($){let U=$.responseNodeId;if(!U)return;let v=j0.get(U);if(v){let J=D.value.get(v);if(J&&Array.isArray(J.data.turns)){let _=[...J.data.turns],z=_[_.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";W$(v,{turns:_,threadStatus:"streaming"})}return}if(!D.value.has(U))return;W$(U,{content:$.content,status:"streaming"})}function pN($){let U=$.responseNodeId;if(!U)return;let v=j0.get(U);if(v){let z=D.value.get(v);if(z&&Array.isArray(z.data.turns)){let K=[...z.data.turns],W=K[K.length-1];if(W&&W.role==="assistant")W.text=$.content,W.status="complete";W$(v,{turns:K,threadStatus:"answered",_activeResponseId:void 0})}j0.delete(U);return}if(!D.value.has(U))return;W$(U,{content:$.content,status:"complete"});let _=D.value.get(U)?.data.promptNodeId;if(_){let z=`edge-${_}-${U}`,K=c$.value.get(z);if(K)zZ(z),vv({...K,animated:!1})}}function oN($){let U=$.layout;if(!U?.nodes)return;let v=!z4.value;z4.value=!0;let J=U.nodes.map(LN).filter((W)=>W!==null),_=Array.isArray(U.edges)?U.edges.map(FN).filter((W)=>W!==null):Array.from(c$.value.values()),z=Array.isArray(U.annotations)?U.annotations.map(PN).filter((W)=>W!==null):void 0,K=U.viewport?{x:typeof U.viewport.x==="number"?U.viewport.x:0,y:typeof U.viewport.y==="number"?U.viewport.y:0,scale:typeof U.viewport.scale==="number"?U.viewport.scale:1}:void 0;gU(),ZZ({...K?{viewport:K}:{},nodes:J,edges:_,...z?{annotations:z}:{}},{applyViewport:v}),j8({event:"canvas-layout-update",data:$})}function dN($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function nN($){let U=$.nodeId;if(U&&D.value.has(U)){if($.noPan===!0){D4(U);return}K6(U)}}function tN($){let U=$.viewport;if(!U)return;let v=typeof U.x==="number"?U.x:0,J=typeof U.y==="number"?U.y:0,_=typeof U.scale==="number"?U.scale:1;gU(),WZ({x:v,y:J,scale:_})}function aN($){if(D.value.get("context-main"))W$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function sN($){bU.value=$.enabled===!0}function eN($){if(typeof $.theme==="string"&&!YO())FO($.theme)}function $S($){let U=Array.isArray($.nodeIds)?$.nodeIds.filter((v)=>typeof v==="string"):[];JZ(U),j8({event:"context-pins-changed",data:$})}var s9=null;function vL(){if(s9)clearTimeout(s9);s9=setTimeout(()=>{if(s9=null,w8().then(($)=>{K4.value=$}),F6.value)b1()},150)}function US($){let U=$.intent;if(!U||typeof U.id!=="string"||typeof U.kind!=="string"||typeof U.expiresAt!=="number")return;sX(U)}function _S($){let U=typeof $.id==="string"?$.id:"";if(!U)return;if($.settled===!0)$H(U,typeof $.nodeId==="string"?$.nodeId:void 0);else fW(U)}var OL={connected:IN,"workbench-open":wN,"canvas-status":gN,"execution-phase":NN,"context-cards":SN,"mcp-app-candidate":RN,"mcp-app-host-snapshot":TN,"mcp-app-host-fallback":yN,"aux-open":CN,"aux-close":DN,"assistant-complete":jN,"tool-start":VN,"tool-complete":fN,"review-state":EN,"subagent-status":hN,"ext-app-open":uN,"ext-app-update":mN,"ext-app-result":xN,"context-pins-changed":$S,"canvas-layout-update":oN,"canvas-focus-node":nN,"canvas-viewport-update":tN,"context-usage":aN,"trace-state":sN,"theme-changed":eN,"canvas-prompt-created":cN,"canvas-prompt-status":lN,"canvas-response-start":rN,"canvas-response-delta":iN,"canvas-response-complete":pN,"ax-state-changed":vL,"ax-event-created":vL,"ax-intent":US,"ax-intent-clear":_S,"agent-presence":bN,"human-presence":AN,"agent-session-ended":MN};function YL($,U){let v=OL[$];if(!v)return;let J=v;try{J(U)}catch(_){console.warn(`[sse-bridge] Handler for "${$}" failed:`,_)}}function JL(){Y2=!0,g1+=1;let $=g1;x6.value="connecting";let U=null,v=!1,J=async()=>{if($!==g1)return;try{let _=new URLSearchParams;if(D0!==null)_.set("since",String(D0));let z=y4.value;if(z)_.set("session",z);let K=_.toString(),W=await fetch(`/api/workbench/poll${K?`?${K}`:""}`);if($!==g1)return;if(!W.ok)throw Error(`poll failed with HTTP ${W.status}`);let O=await W.json();if($!==g1)return;if(!O.ok)throw Error("poll returned ok: false");let Y=U;if(U=O.sessionId??null,Y!==null&&O.sessionId&&Y!==O.sessionId&&!O.snapshot){D0=null,l4=setTimeout(()=>void J(),0);return}if(O.snapshot&&v)e9=r8(),z4.value=!1,D8(),EW(),j0.clear();for(let Z of O.events)YL(Z.event,Z.payload);v=!0,D0=O.seq,E1.value=0,u1.value=0,x6.value="connected",l4=setTimeout(()=>void J(),KN)}catch(_){if($!==g1)return;console.warn("[sse-bridge] poll transport error:",_),x6.value="disconnected",E1.value+=1,u1.value=$L,l4=setTimeout(()=>void J(),$L)}};return J(),()=>{if(g1+=1,Y2=!1,D0=null,l4)clearTimeout(l4),l4=null}}function kO(){if(IQ(FO),e9=r8(),z4.value=!1,D8(),EW(),j0.clear(),I1)clearTimeout(I1),I1=null;let $=GN();if($==="poll"||Y2)return JL();let U=y4.value,v=U?`/api/workbench/events?session=${U}`:"/api/workbench/events";x6.value="connecting";let J=new EventSource(v);_U=J;let _=!1;if(w1)clearTimeout(w1);if(w1=null,$!=="sse")w1=setTimeout(()=>{if(w1=null,_||_U!==J)return;console.warn("[sse-bridge] No SSE event within watchdog window — switching to polling transport."),window.dispatchEvent(new Event("pmx-canvas-boot-extend")),J.close(),_U=null,JL()},zN);for(let[z]of Object.entries(OL))J.addEventListener(z,(K)=>{_=!0;try{YL(z,JSON.parse(K.data))}catch(W){console.warn(`[sse-bridge] Failed to parse "${z}" event:`,W)}});return J.onopen=()=>{if(_U!==J)return;a9=0,E1.value=0,u1.value=0,x6.value="connected"},J.onerror=()=>{if(_U!==J)return;x6.value="disconnected",J.close(),_U=null,a9+=1;let z=dN(a9);E1.value=a9,u1.value=z,I1=setTimeout(()=>{I1=null,kO()},z)},()=>{if(I1)clearTimeout(I1),I1=null;if(w1)clearTimeout(w1),w1=null;if(Y2){if(g1+=1,Y2=!1,D0=null,l4)clearTimeout(l4),l4=null}J.close(),_U=null}}function vU($,U){console.error(`[app] ${$} failed`,U)}function ZL(){let[$,U]=f(!0),[v,J]=f(!1),[_,z]=f(!1),[K,W]=f(!1),[O,Y]=f(null),Z=C(null),{menu:q,openNodeMenu:X,openCanvasMenu:B,openEdgeMenu:L,closeMenu:P}=gQ(),k=z4.value,H=F6.value,F=j(()=>U((R)=>!R),[]),b=j(()=>J((R)=>!R),[]),V=j(()=>J(!1),[]),E=j((R)=>Y(R),[]),A=j((R,p)=>{$1({x:R,y:p,scale:G$.value.scale},200)},[]);u(()=>{return kO()},[]),u(()=>{let R=null,p=()=>{if(R!==null)window.clearTimeout(R);R=window.setTimeout(()=>{R=null,l0()},400)};return window.addEventListener("resize",p),()=>{if(R!==null)window.clearTimeout(R);window.removeEventListener("resize",p)}},[]),u(()=>{let R=(T)=>{let r=(T.metaKey||T.ctrlKey)&&!T.altKey;if(r&&T.key==="k"){T.preventDefault(),z((o)=>!o);return}if(T.key==="Escape"&&O){T.preventDefault(),Y(null);return}if(T.key==="Escape"&&n$.value&&!B4.value){T.preventDefault(),m1();return}if(T.key==="Escape"&&_){T.preventDefault(),z(!1);return}if(T.key==="Escape"&&K){T.preventDefault(),W(!1);return}let t=T.target,i=t?.tagName;if(i==="INPUT"||i==="TEXTAREA"||t?.isContentEditable)return;if(T.key===" "&&!T.repeat&&!r){T.preventDefault(),d0.value=!0;return}if(T.key==="?"||T.key==="/"&&T.shiftKey){T.preventDefault(),W((o)=>!o);return}if(r&&(T.key==="z"||T.key==="Z"))T.preventDefault(),zO(T.shiftKey);else if(r&&(T.key==="y"||T.key==="Y"))T.preventDefault(),zO(!0);else if(r&&T.key==="0")T.preventDefault(),$1({x:0,y:0,scale:1},250);else if(r&&(T.key==="="||T.key==="+"))T.preventDefault(),wU(1.25);else if(r&&T.key==="-")T.preventDefault(),wU(0.8);else if(T.key==="Escape"){if(A$.value.size>0||T4.value!==null){M6();return}C$.value=null,P()}else if(T.key==="Tab")T.preventDefault(),BZ(T.shiftKey?-1:1);else if(T.key==="Delete"||T.key==="Backspace"){if(T4.value!==null){let z$=T4.value;T.preventDefault(),T4.value=null,i2(z$).catch((B$)=>vU("delete-edge",B$));return}let o=A$.value.size>0?[...A$.value]:C$.value?[C$.value]:[];if(o.length===0)return;T.preventDefault();for(let z$ of o)h6(z$),d4(z$).catch((B$)=>vU("delete",B$));M6(),C$.value=null}else if(C$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(T.key)){T.preventDefault();let o=T.key.replace("Arrow","").toLowerCase();XZ(o)}else if(!r&&!T.altKey){let o=T.key.toLowerCase();if(o==="v"&&!T.shiftKey)R6.value="select";else if(o==="c"&&!T.shiftKey&&!r)T.preventDefault(),R6.value=R6.value==="connect"?"select":"connect";else if(o==="m"&&!T.shiftKey)T.preventDefault(),i6({type:"markdown",title:"New note",width:520,height:360}).catch((z$)=>vU("create markdown",z$));else if(o==="a"&&!T.shiftKey)T.preventDefault(),Y((z$)=>z$==="pen"?null:"pen");else if(o==="g"&&!T.shiftKey){T.preventDefault();let z$=Array.from(A$.value);if(z$.length>=2)BU({title:"Group",childIds:z$}).catch((B$)=>vU("group selection",B$)),M6();else i6({type:"group",title:"Group"}).catch((B$)=>vU("create group",B$))}else if(o==="g"&&T.shiftKey){T.preventDefault();for(let z$ of $Z())h6(z$),XU(z$).catch((B$)=>vU("ungroup",B$));M6()}else if(o==="i"&&!T.shiftKey)T.preventDefault(),c4("image");else if(o==="w"&&!T.shiftKey)T.preventDefault(),c4("webpage");else if(o==="h"&&!T.shiftKey)T.preventDefault(),i6({type:"html",title:"HTML surface"}).catch((z$)=>vU("create html",z$));else if(o==="f"&&T.shiftKey)T.preventDefault(),c4("file");else if(o==="f"&&!T.shiftKey){T.preventDefault();let z$=$4();NU(z$.width,z$.height)}}},p=(T)=>{if(T.key===" ")d0.value=!1},l=()=>{d0.value=!1};return document.addEventListener("keydown",R),document.addEventListener("keyup",p),window.addEventListener("blur",l),()=>{document.removeEventListener("keydown",R),document.removeEventListener("keyup",p),window.removeEventListener("blur",l)}},[O,P,_,K]),u(()=>{let R=window.setTimeout(()=>void l0(),250);return()=>window.clearTimeout(R)},[H]),u(()=>{if(!k)return;let R=window.__pmxCanvasBootstrapReady;if(typeof R==="function")R()},[k]);let I=Array.from(D.value.values()),N=$4();return G("div",{class:"app-shell","data-session-active":H?"true":"false",children:[G(TQ,{minimapVisible:$,onToggleMinimap:F,snapshotOpen:v,onToggleSnapshot:b,snapshotBtnRef:Z,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>W((R)=>!R),annotationTool:O,onSetAnnotationTool:E},void 0,!1,void 0,this),G("div",{class:"app-main",children:[G(sQ,{},void 0,!1,void 0,this),G(bQ,{},void 0,!1,void 0,this),G("div",{class:"canvas-region",ref:(R)=>BY(R),children:[G(PQ,{onNodeContextMenu:X,onCanvasContextMenu:B,onEdgeContextMenu:L,annotationMode:O!==null,annotationTool:O},void 0,!1,void 0,this),G(qY,{},void 0,!1,void 0,this),G(ZY,{},void 0,!1,void 0,this),G(DQ,{},void 0,!1,void 0,this),G(jQ,{},void 0,!1,void 0,this),k&&I.length===0&&s$.value.size===0&&G(yQ,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),A$.value.size>0&&G(lQ,{},void 0,!1,void 0,this),H?G(kQ,{},void 0,!1,void 0,this):j$.value.size>0&&G(RQ,{},void 0,!1,void 0,this),G(oQ,{onOpenSnapshots:()=>J(!0)},void 0,!1,void 0,this),G(HY,{},void 0,!1,void 0,this),n$.value&&G(uQ,{},void 0,!1,void 0,this),G(aQ,{open:v,onClose:V,anchorRef:Z},void 0,!1,void 0,this),$&&G(cQ,{viewport:G$,nodes:D,edges:c$,onNavigate:A,containerWidth:N.width,containerHeight:N.height},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H&&G(pQ,{},void 0,!1,void 0,this),q&&G(NQ,{menu:q,onClose:P},void 0,!1,void 0,this),_&&G(wQ,{onClose:()=>z(!1),onToggleMinimap:F},void 0,!1,void 0,this),K&&G(dQ,{onClose:()=>W(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}LZ();var qL=document.getElementById("app");if(qL)xO(G(ZL,{},void 0,!1,void 0,this),qL);