@halcyonlabs/app 0.47.0-halcyon.333 → 0.47.0-halcyon.337

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 (85) hide show
  1. package/dist/index.d.ts +24 -24
  2. package/package.json +1 -1
  3. package/server/dist/builtin-plugins/orbit/dist/app.js +2 -2
  4. package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/config/policy.toml +5 -5
  5. package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/codex.sh +1 -1
  6. package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux.toml +1 -1
  7. package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/default-linux.toml +1 -1
  8. package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/default.toml +1 -1
  9. package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/revision +1 -0
  10. package/server/dist/builtin-plugins/orbit/dist/assets/plugins/{orbit → moonlet}/back/CLAUDE.md +1 -1
  11. package/server/dist/builtin-plugins/orbit/dist/host.js +70 -70
  12. package/server/dist/builtin-plugins/orbit/dist/host.meta.json +1 -1
  13. package/server/dist/builtin-plugins/orbit/dist/server.js +272 -272
  14. package/server/dist/builtin-plugins/orbit/skills/documents/SKILL.md +2 -2
  15. package/server/dist/builtin-plugins/orbit/skills/github-change/references/branches.md +3 -3
  16. package/server/dist/builtin-plugins/orbit/skills/github-change/references/merging.md +3 -3
  17. package/server/dist/builtin-plugins/orbit/skills/github-change/references/work-queue.md +1 -1
  18. package/server/dist/builtin-plugins/orbit/skills/station-build/SKILL.md +7 -7
  19. package/server/dist/start-server.js +20 -4
  20. package/server/dist/builtin-plugins/orbit/dist/assets/orbit/revision +0 -1
  21. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/bundle/scripts/orbit-job-supervisor +0 -0
  22. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/docs/handoff-to-new-conversation.md +0 -0
  23. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/a11y-launchers.sh +0 -0
  24. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/antfly.sh +0 -0
  25. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/apps.sh +0 -0
  26. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/bwrap-userns.sh +0 -0
  27. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/chrome.sh +0 -0
  28. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/codex-model.sh +0 -0
  29. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/cua-driver.sh +0 -0
  30. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/desktop.sh +0 -0
  31. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/dev-tools.sh +0 -0
  32. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/doc-tools.sh +0 -0
  33. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/gh.sh +0 -0
  34. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/library.sh +0 -0
  35. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/linger.sh +0 -0
  36. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/networkd.sh +0 -0
  37. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/no-ipv6.sh +0 -0
  38. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/node.sh +0 -0
  39. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/npm-prefix.sh +0 -0
  40. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/op.sh +0 -0
  41. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/orbit-data.sh +0 -0
  42. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/packages.sh +0 -0
  43. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/proton-bridge.sh +0 -0
  44. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/proton-mail.sh +0 -0
  45. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/rclone.sh +0 -0
  46. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/shell-path.sh +0 -0
  47. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/signin.sh +0 -0
  48. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-linux/swap.sh +0 -0
  49. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/antfly.sh +0 -0
  50. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/apps.sh +0 -0
  51. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/chrome-headless-shell.sh +0 -0
  52. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/chrome-policy.sh +0 -0
  53. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/cua-driver-agent.sh +0 -0
  54. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/cua-driver-telemetry.sh +0 -0
  55. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/cua-driver.sh +0 -0
  56. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/dev-tools.sh +0 -0
  57. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/doc-tools.sh +0 -0
  58. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/gnupg.sh +0 -0
  59. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/groups.sh +0 -0
  60. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/homebrew.sh +0 -0
  61. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/launchd-path.sh +0 -0
  62. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/library.sh +0 -0
  63. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/no-ipv6.sh +0 -0
  64. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/no-screen-saver.sh +0 -0
  65. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/node.sh +0 -0
  66. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/op.sh +0 -0
  67. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/orbit-data.sh +0 -0
  68. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/proton-bridge.sh +0 -0
  69. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/rclone.sh +0 -0
  70. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/retire-desktop.sh +0 -0
  71. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/screen-sharing.sh +0 -0
  72. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/shell-path.sh +0 -0
  73. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/skip-setup-assistant.sh +0 -0
  74. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/stay-awake.sh +0 -0
  75. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos/tailscale.sh +0 -0
  76. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/base-macos.toml +0 -0
  77. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/codex-npm.sh +0 -0
  78. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/bb-address.sh +0 -0
  79. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/library-pull.sh +0 -0
  80. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/libvirt.sh +0 -0
  81. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/linger.sh +0 -0
  82. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/packages.sh +0 -0
  83. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux/swap.sh +0 -0
  84. /package/server/dist/builtin-plugins/orbit/dist/assets/{orbit → moonlet}/recipes/server-linux.toml +0 -0
  85. /package/server/dist/builtin-plugins/orbit/dist/assets/plugins/{orbit → moonlet}/front/CLAUDE.md +0 -0
package/dist/index.d.ts CHANGED
@@ -524,8 +524,8 @@ declare const environmentSchema: z$1.ZodObject<{
524
524
  retireAt: z$1.ZodNullable<z$1.ZodNumber>;
525
525
  teardown: z$1.ZodNullable<z$1.ZodObject<{
526
526
  status: z$1.ZodEnum<{
527
- failed: "failed";
528
527
  running: "running";
528
+ failed: "failed";
529
529
  removed: "removed";
530
530
  }>;
531
531
  attempt: z$1.ZodNumber;
@@ -620,8 +620,8 @@ declare const hostSchema: z$1.ZodObject<{
620
620
  pendingLog: z$1.ZodString;
621
621
  teardown: z$1.ZodNullable<z$1.ZodObject<{
622
622
  status: z$1.ZodEnum<{
623
- failed: "failed";
624
623
  running: "running";
624
+ failed: "failed";
625
625
  removed: "removed";
626
626
  }>;
627
627
  attempt: z$1.ZodNumber;
@@ -732,8 +732,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
732
732
  providerThreadId: z$1.ZodString;
733
733
  objective: z$1.ZodString;
734
734
  status: z$1.ZodEnum<{
735
- active: "active";
736
735
  paused: "paused";
736
+ active: "active";
737
737
  budgetLimited: "budgetLimited";
738
738
  complete: "complete";
739
739
  }>;
@@ -1304,9 +1304,9 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
1304
1304
  step: z$1.ZodString;
1305
1305
  status: z$1.ZodOptional<z$1.ZodEnum<{
1306
1306
  pending: "pending";
1307
- active: "active";
1308
1307
  completed: "completed";
1309
1308
  failed: "failed";
1309
+ active: "active";
1310
1310
  }>>;
1311
1311
  }, z$1.core.$strip>>;
1312
1312
  explanation: z$1.ZodOptional<z$1.ZodString>;
@@ -1385,10 +1385,10 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
1385
1385
  }>;
1386
1386
  taskStatus: z$1.ZodEnum<{
1387
1387
  pending: "pending";
1388
+ running: "running";
1389
+ paused: "paused";
1388
1390
  completed: "completed";
1389
1391
  failed: "failed";
1390
- paused: "paused";
1391
- running: "running";
1392
1392
  killed: "killed";
1393
1393
  stopped: "stopped";
1394
1394
  }>;
@@ -1405,8 +1405,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
1405
1405
  index: z$1.ZodNumber;
1406
1406
  label: z$1.ZodString;
1407
1407
  state: z$1.ZodEnum<{
1408
- failed: "failed";
1409
1408
  running: "running";
1409
+ failed: "failed";
1410
1410
  queued: "queued";
1411
1411
  done: "done";
1412
1412
  skipped: "skipped";
@@ -2076,9 +2076,9 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2076
2076
  step: z$1.ZodString;
2077
2077
  status: z$1.ZodOptional<z$1.ZodEnum<{
2078
2078
  pending: "pending";
2079
- active: "active";
2080
2079
  completed: "completed";
2081
2080
  failed: "failed";
2081
+ active: "active";
2082
2082
  }>>;
2083
2083
  }, z$1.core.$strip>>;
2084
2084
  explanation: z$1.ZodOptional<z$1.ZodString>;
@@ -2157,10 +2157,10 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2157
2157
  }>;
2158
2158
  taskStatus: z$1.ZodEnum<{
2159
2159
  pending: "pending";
2160
+ running: "running";
2161
+ paused: "paused";
2160
2162
  completed: "completed";
2161
2163
  failed: "failed";
2162
- paused: "paused";
2163
- running: "running";
2164
2164
  killed: "killed";
2165
2165
  stopped: "stopped";
2166
2166
  }>;
@@ -2177,8 +2177,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2177
2177
  index: z$1.ZodNumber;
2178
2178
  label: z$1.ZodString;
2179
2179
  state: z$1.ZodEnum<{
2180
- failed: "failed";
2181
2180
  running: "running";
2181
+ failed: "failed";
2182
2182
  queued: "queued";
2183
2183
  done: "done";
2184
2184
  skipped: "skipped";
@@ -2389,10 +2389,10 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2389
2389
  }>;
2390
2390
  taskStatus: z$1.ZodEnum<{
2391
2391
  pending: "pending";
2392
+ running: "running";
2393
+ paused: "paused";
2392
2394
  completed: "completed";
2393
2395
  failed: "failed";
2394
- paused: "paused";
2395
- running: "running";
2396
2396
  killed: "killed";
2397
2397
  stopped: "stopped";
2398
2398
  }>;
@@ -2409,8 +2409,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2409
2409
  index: z$1.ZodNumber;
2410
2410
  label: z$1.ZodString;
2411
2411
  state: z$1.ZodEnum<{
2412
- failed: "failed";
2413
2412
  running: "running";
2413
+ failed: "failed";
2414
2414
  queued: "queued";
2415
2415
  done: "done";
2416
2416
  skipped: "skipped";
@@ -2488,10 +2488,10 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2488
2488
  }>;
2489
2489
  taskStatus: z$1.ZodEnum<{
2490
2490
  pending: "pending";
2491
+ running: "running";
2492
+ paused: "paused";
2491
2493
  completed: "completed";
2492
2494
  failed: "failed";
2493
- paused: "paused";
2494
- running: "running";
2495
2495
  killed: "killed";
2496
2496
  stopped: "stopped";
2497
2497
  }>;
@@ -2508,8 +2508,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2508
2508
  index: z$1.ZodNumber;
2509
2509
  label: z$1.ZodString;
2510
2510
  state: z$1.ZodEnum<{
2511
- failed: "failed";
2512
2511
  running: "running";
2512
+ failed: "failed";
2513
2513
  queued: "queued";
2514
2514
  done: "done";
2515
2515
  skipped: "skipped";
@@ -2704,9 +2704,9 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2704
2704
  step: z$1.ZodString;
2705
2705
  status: z$1.ZodOptional<z$1.ZodEnum<{
2706
2706
  pending: "pending";
2707
- active: "active";
2708
2707
  completed: "completed";
2709
2708
  failed: "failed";
2709
+ active: "active";
2710
2710
  }>>;
2711
2711
  }, z$1.core.$strip>>;
2712
2712
  explanation: z$1.ZodOptional<z$1.ZodString>;
@@ -2715,8 +2715,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
2715
2715
  threadId: z$1.ZodString;
2716
2716
  providerThreadId: z$1.ZodString;
2717
2717
  state: z$1.ZodEnum<{
2718
- idle: "idle";
2719
2718
  running: "running";
2719
+ idle: "idle";
2720
2720
  }>;
2721
2721
  }, z$1.core.$strip>, z$1.ZodObject<{
2722
2722
  type: z$1.ZodLiteral<"turn/diff/updated">;
@@ -3578,9 +3578,9 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
3578
3578
  threadId: z$1.ZodString;
3579
3579
  provisioningId: z$1.ZodString;
3580
3580
  status: z$1.ZodEnum<{
3581
- active: "active";
3582
3581
  completed: "completed";
3583
3582
  failed: "failed";
3583
+ active: "active";
3584
3584
  cancelled: "cancelled";
3585
3585
  }>;
3586
3586
  environmentId: z$1.ZodNullable<z$1.ZodString>;
@@ -7865,9 +7865,9 @@ declare const hostDaemonCommandRegistry: {
7865
7865
  base64: "base64";
7866
7866
  utf8: "utf8";
7867
7867
  }>;
7868
- sha256: z$1.ZodString;
7869
- sizeBytes: z$1.ZodNumber;
7870
7868
  mimeType: z$1.ZodOptional<z$1.ZodString>;
7869
+ sizeBytes: z$1.ZodNumber;
7870
+ sha256: z$1.ZodString;
7871
7871
  modifiedAtMs: z$1.ZodOptional<z$1.ZodNumber>;
7872
7872
  notModified: z$1.ZodLiteral<true>;
7873
7873
  }, z$1.core.$strip>]>, "onlineRpc", true>;
@@ -8132,10 +8132,10 @@ declare const hostDaemonCommandRegistry: {
8132
8132
  health: z$1.ZodObject<{
8133
8133
  status: z$1.ZodEnum<{
8134
8134
  unknown: "unknown";
8135
- ready: "ready";
8136
8135
  not_installed: "not_installed";
8137
8136
  unauthenticated: "unauthenticated";
8138
8137
  expired: "expired";
8138
+ ready: "ready";
8139
8139
  unsupported_version: "unsupported_version";
8140
8140
  }>;
8141
8141
  statusMessage: z$1.ZodNullable<z$1.ZodString>;
@@ -8631,8 +8631,8 @@ declare const hostDaemonCommandRegistry: {
8631
8631
  message: z$1.ZodNullable<z$1.ZodString>;
8632
8632
  state: z$1.ZodNullable<z$1.ZodEnum<{
8633
8633
  pending: "pending";
8634
- activating: "activating";
8635
8634
  ready: "ready";
8635
+ activating: "activating";
8636
8636
  }>>;
8637
8637
  }, z$1.core.$strict>, "onlineRpc", true>;
8638
8638
  "server_move.prepare": HostDaemonCommandDescriptor<"server_move.prepare", z$1.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyonlabs/app",
3
- "version": "0.47.0-halcyon.333",
3
+ "version": "0.47.0-halcyon.337",
4
4
  "description": "bb app launcher for npx",
5
5
  "keywords": [
6
6
  "bb",
@@ -2,7 +2,7 @@ var lk=Object.defineProperty;var St=(e,t)=>{for(var n in t)lk(e,n,{get:t[n],enum
2
2
  `),this._sock.flush(),ne("Sent ProtocolVersion: "+r),this._rfbInitState="Security"}_isSupportedSecurityType(t){return[i_,qs,o_,s_,Iu,a_,l_,c_,d_].includes(t)}_negotiateSecurity(){if(this._rfbVersion>=3.7){let t=this._sock.rQshift8();if(this._sock.rQwait("security type",t,1))return!1;if(t===0)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,!0;let n=this._sock.rQshiftBytes(t);ne("Server security types: "+n),this._rfbAuthScheme=-1;for(let r of n)if(this._isSupportedSecurityType(r)){this._rfbAuthScheme=r;break}if(this._rfbAuthScheme===-1)return this._fail("Unsupported security types (types: "+n+")");this._sock.sQpush8(this._rfbAuthScheme),this._sock.flush()}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),this._rfbAuthScheme==0)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,!0}return this._rfbInitState="Authentication",ne("Authenticating using scheme: "+this._rfbAuthScheme),!0}_handleSecurityReason(){if(this._sock.rQwait("reason length",4))return!1;let t=this._sock.rQshift32(),n="";if(t>0){if(this._sock.rQwait("reason",t,4))return!1;n=this._sock.rQshiftStr(t)}return n!==""?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:n}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+n+")")):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext))}_negotiateXvpAuth(){return this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0||this._rfbCredentials.target===void 0?(this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1):(this._sock.sQpush8(this._rfbCredentials.username.length),this._sock.sQpush8(this._rfbCredentials.target.length),this._sock.sQpushString(this._rfbCredentials.username),this._sock.sQpushString(this._rfbCredentials.target),this._sock.flush(),this._rfbAuthScheme=qs,this._negotiateAuthentication())}_negotiateVeNCryptAuth(){if(this._rfbVeNCryptState==0){if(this._sock.rQwait("vencrypt version",2))return!1;let t=this._sock.rQshift8(),n=this._sock.rQshift8();if(!(t==0&&n==2))return this._fail("Unsupported VeNCrypt version "+t+"."+n);this._sock.sQpush8(0),this._sock.sQpush8(2),this._sock.flush(),this._rfbVeNCryptState=1}if(this._rfbVeNCryptState==1){if(this._sock.rQwait("vencrypt ack",1))return!1;let t=this._sock.rQshift8();if(t!=0)return this._fail("VeNCrypt failure "+t);this._rfbVeNCryptState=2}if(this._rfbVeNCryptState==2){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;let t=this._sock.rQshift8();if(t<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=t,this._rfbVeNCryptState=3}if(this._rfbVeNCryptState==3){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;let t=[];for(let n=0;n<this._rfbVeNCryptSubtypesLength;n++)t.push(this._sock.rQshift32());this._rfbAuthScheme=-1;for(let n of t)if(n!==Iu&&this._isSupportedSecurityType(n)){this._rfbAuthScheme=n;break}return this._rfbAuthScheme===-1?this._fail("Unsupported security types (types: "+t+")"):(this._sock.sQpush32(this._rfbAuthScheme),this._sock.flush(),this._rfbVeNCryptState=4,!0)}}_negotiatePlainAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;let t=xt(this._rfbCredentials.username),n=xt(this._rfbCredentials.password);return this._sock.sQpush32(t.length),this._sock.sQpush32(n.length),this._sock.sQpushString(t),this._sock.sQpushString(n),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateStdVNCAuth(){if(this._sock.rQwait("auth challenge",16))return!1;if(this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["password"]}})),!1;let t=Array.prototype.slice.call(this._sock.rQshiftBytes(16)),n=e.genDES(this._rfbCredentials.password,t);return this._sock.sQpushBytes(n),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateARDAuth(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;if(this._rfbCredentials.ardPublicKey!=null&&this._rfbCredentials.ardCredentials!=null)return this._sock.sQpushBytes(this._rfbCredentials.ardCredentials),this._sock.sQpushBytes(this._rfbCredentials.ardPublicKey),this._sock.flush(),this._rfbCredentials.ardCredentials=null,this._rfbCredentials.ardPublicKey=null,this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("read ard",4))return!1;let t=this._sock.rQshiftBytes(2),n=this._sock.rQshift16();if(this._sock.rQwait("read ard keylength",n*2,4))return!1;let r=this._sock.rQshiftBytes(n),i=this._sock.rQshiftBytes(n),o=Ce.generateKey({name:"DH",g:t,p:r},!1,["deriveBits"]);return this._negotiateARDAuthAsync(n,i,o),!1}async _negotiateARDAuthAsync(t,n,r){let i=Ce.exportKey("raw",r.publicKey),o=Ce.deriveBits({name:"DH",public:n},r.privateKey,t*8),s=xt(this._rfbCredentials.username).substring(0,63),a=xt(this._rfbCredentials.password).substring(0,63),c=window.crypto.getRandomValues(new Uint8Array(128));for(let p=0;p<s.length;p++)c[p]=s.charCodeAt(p);c[s.length]=0;for(let p=0;p<a.length;p++)c[64+p]=a.charCodeAt(p);c[64+a.length]=0;let l=await Ce.digest("MD5",o),u=await Ce.importKey("raw",l,{name:"AES-ECB"},!1,["encrypt"]),f=await Ce.encrypt({name:"AES-ECB"},u,c);this._rfbCredentials.ardCredentials=f,this._rfbCredentials.ardPublicKey=i,this._resumeAuthentication()}_negotiateTightUnixAuth(){return this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0?(this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1):(this._sock.sQpush32(this._rfbCredentials.username.length),this._sock.sQpush32(this._rfbCredentials.password.length),this._sock.sQpushString(this._rfbCredentials.username),this._sock.sQpushString(this._rfbCredentials.password),this._sock.flush(),this._rfbInitState="SecurityResult",!0)}_negotiateTightTunnels(t){let n={0:{vendor:"TGHT",signature:"NOTUNNEL"}},r={};for(let i=0;i<t;i++){let o=this._sock.rQshift32(),s=this._sock.rQshiftStr(4),a=this._sock.rQshiftStr(8);r[o]={vendor:s,signature:a}}return ne("Server Tight tunnel types: "+r),r[1]&&r[1].vendor==="SICR"&&r[1].signature==="SCHANNEL"&&(ne("Detected Siemens server. Assuming NOTUNNEL support."),r[0]={vendor:"TGHT",signature:"NOTUNNEL"}),r[0]?r[0].vendor!=n[0].vendor||r[0].signature!=n[0].signature?this._fail("Client's tunnel type had the incorrect vendor or signature"):(ne("Selected tunnel type: "+n[0]),this._sock.sQpush32(0),this._sock.flush(),!1):this._fail("Server wanted tunnels, but doesn't support the notunnel type")}_negotiateTightAuth(){if(!this._rfbTightVNC){if(this._sock.rQwait("num tunnels",4))return!1;let i=this._sock.rQshift32();if(i>0&&this._sock.rQwait("tunnel capabilities",16*i,4))return!1;if(this._rfbTightVNC=!0,i>0)return this._negotiateTightTunnels(i),!1}if(this._sock.rQwait("sub auth count",4))return!1;let t=this._sock.rQshift32();if(t===0)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*t,4))return!1;let n={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},r=[];for(let i=0;i<t;i++){this._sock.rQshift32();let o=this._sock.rQshiftStr(12);r.push(o)}ne("Server Tight authentication types: "+r);for(let i in n)if(r.indexOf(i)!=-1)switch(this._sock.sQpush32(n[i]),this._sock.flush(),ne("Selected authentication type: "+i),i){case"STDVNOAUTH__":return this._rfbInitState="SecurityResult",!0;case"STDVVNCAUTH_":return this._rfbAuthScheme=qs,!0;case"TGHTULGNAUTH":return this._rfbAuthScheme=u_,!0;default:return this._fail("Unsupported tiny auth scheme (scheme: "+i+")")}return this._fail("No supported sub-auth types!")}_handleRSAAESCredentialsRequired(t){this.dispatchEvent(t)}_handleRSAAESServerVerification(t){this.dispatchEvent(t)}_negotiateRA2neAuth(){return this._rfbRSAAESAuthenticationState===null&&(this._rfbRSAAESAuthenticationState=new Zi(this._sock,()=>this._rfbCredentials),this._rfbRSAAESAuthenticationState.addEventListener("serververification",this._eventHandlers.handleRSAAESServerVerification),this._rfbRSAAESAuthenticationState.addEventListener("credentialsrequired",this._eventHandlers.handleRSAAESCredentialsRequired)),this._rfbRSAAESAuthenticationState.checkInternalEvents(),this._rfbRSAAESAuthenticationState.hasStarted||this._rfbRSAAESAuthenticationState.negotiateRA2neAuthAsync().catch(t=>{t.message!=="disconnect normally"&&this._fail(t.message)}).then(()=>(this._rfbInitState="SecurityResult",!0)).finally(()=>{this._rfbRSAAESAuthenticationState.removeEventListener("serververification",this._eventHandlers.handleRSAAESServerVerification),this._rfbRSAAESAuthenticationState.removeEventListener("credentialsrequired",this._eventHandlers.handleRSAAESCredentialsRequired),this._rfbRSAAESAuthenticationState=null}),!1}_negotiateMSLogonIIAuth(){if(this._sock.rQwait("mslogonii dh param",24))return!1;if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;let t=this._sock.rQshiftBytes(8),n=this._sock.rQshiftBytes(8),r=this._sock.rQshiftBytes(8),i=Ce.generateKey({name:"DH",g:t,p:n},!0,["deriveBits"]),o=Ce.exportKey("raw",i.publicKey),s=Ce.deriveBits({name:"DH",public:r},i.privateKey,64),a=Ce.importKey("raw",s,{name:"DES-CBC"},!1,["encrypt"]),c=xt(this._rfbCredentials.username).substring(0,255),l=xt(this._rfbCredentials.password).substring(0,63),u=new Uint8Array(256),f=new Uint8Array(64);window.crypto.getRandomValues(u),window.crypto.getRandomValues(f);for(let p=0;p<c.length;p++)u[p]=c.charCodeAt(p);u[c.length]=0;for(let p=0;p<l.length;p++)f[p]=l.charCodeAt(p);return f[l.length]=0,u=Ce.encrypt({name:"DES-CBC",iv:s},a,u),f=Ce.encrypt({name:"DES-CBC",iv:s},a,f),this._sock.sQpushBytes(o),this._sock.sQpushBytes(u),this._sock.sQpushBytes(f),this._sock.flush(),this._rfbInitState="SecurityResult",!0}_negotiateAuthentication(){switch(this._rfbAuthScheme){case i_:return this._rfbVersion>=3.8?this._rfbInitState="SecurityResult":this._rfbInitState="ClientInitialisation",!0;case a_:return this._negotiateXvpAuth();case l_:return this._negotiateARDAuth();case qs:return this._negotiateStdVNCAuth();case s_:return this._negotiateTightAuth();case Iu:return this._negotiateVeNCryptAuth();case d_:return this._negotiatePlainAuth();case u_:return this._negotiateTightUnixAuth();case o_:return this._negotiateRA2neAuth();case c_:return this._negotiateMSLogonIIAuth();default:return this._fail("Unsupported auth scheme (scheme: "+this._rfbAuthScheme+")")}}_handleSecurityResult(){if(this._sock.rQwait("VNC auth response ",4))return!1;let t=this._sock.rQshift32();return t===0?(this._rfbInitState="ClientInitialisation",ne("Authentication OK"),!0):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=t,!0):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:t}})),this._fail("Security handshake failed"))}_negotiateServerInit(){if(this._sock.rQwait("server initialization",24))return!1;let t=this._sock.rQshift16(),n=this._sock.rQshift16(),r=this._sock.rQshift8(),i=this._sock.rQshift8(),o=this._sock.rQshift8(),s=this._sock.rQshift8(),a=this._sock.rQshift16(),c=this._sock.rQshift16(),l=this._sock.rQshift16(),u=this._sock.rQshift8(),f=this._sock.rQshift8(),p=this._sock.rQshift8();this._sock.rQskipBytes(3);let h=this._sock.rQshift32();if(this._sock.rQwait("server init name",h,24))return!1;let m=this._sock.rQshiftStr(h);if(m=Ss(m,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+h))return!1;let x=this._sock.rQshift16(),_=this._sock.rQshift16(),b=this._sock.rQshift16();this._sock.rQskipBytes(2);let E=(x+_+b)*16;if(this._sock.rQwait("TightVNC extended server init header",E,32+h))return!1;this._sock.rQskipBytes(16*x),this._sock.rQskipBytes(16*_),this._sock.rQskipBytes(16*b)}return Re("Screen: "+t+"x"+n+", bpp: "+r+", depth: "+i+", bigEndian: "+o+", trueColor: "+s+", redMax: "+a+", greenMax: "+c+", blueMax: "+l+", redShift: "+u+", greenShift: "+f+", blueShift: "+p),this._setDesktopName(m),this._resize(t,n),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,this._fbName==="Intel(r) AMT KVM"&&(Pe("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),e.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),e.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}_sendEncodings(){let t=[];t.push(oe.encodingCopyRect),this._fbDepth==24&&(Qc&&t.push(oe.encodingH264),t.push(oe.encodingTight),t.push(oe.encodingTightPNG),t.push(oe.encodingZRLE),t.push(oe.encodingJPEG),t.push(oe.encodingHextile),t.push(oe.encodingRRE),t.push(oe.encodingZlib)),t.push(oe.encodingRaw),t.push(oe.pseudoEncodingQualityLevel0+this._qualityLevel),t.push(oe.pseudoEncodingCompressLevel0+this._compressionLevel),t.push(oe.pseudoEncodingDesktopSize),t.push(oe.pseudoEncodingLastRect),t.push(oe.pseudoEncodingQEMUExtendedKeyEvent),t.push(oe.pseudoEncodingQEMULedEvent),t.push(oe.pseudoEncodingExtendedDesktopSize),t.push(oe.pseudoEncodingXvp),t.push(oe.pseudoEncodingFence),t.push(oe.pseudoEncodingContinuousUpdates),t.push(oe.pseudoEncodingDesktopName),t.push(oe.pseudoEncodingExtendedClipboard),t.push(oe.pseudoEncodingExtendedMouseButtons),this._fbDepth==24&&(t.push(oe.pseudoEncodingVMwareCursor),t.push(oe.pseudoEncodingCursor)),e.messages.clientEncodings(this._sock,t)}_initMsg(){switch(this._rfbInitState){case"ProtocolVersion":return this._negotiateProtocolVersion();case"Security":return this._negotiateSecurity();case"Authentication":return this._negotiateAuthentication();case"SecurityResult":return this._handleSecurityResult();case"SecurityReason":return this._handleSecurityReason();case"ClientInitialisation":return this._sock.sQpush8(this._shared?1:0),this._sock.flush(),this._rfbInitState="ServerInitialisation",!0;case"ServerInitialisation":return this._negotiateServerInit();default:return this._fail("Unknown init state (state: "+this._rfbInitState+")")}}_resumeAuthentication(){setTimeout(this._initMsg.bind(this),0)}_handleSetColourMapMsg(){return ne("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}_handleServerCutText(){if(ne("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);let t=this._sock.rQshift32();if(t=wi(t),this._sock.rQwait("ServerCutText content",Math.abs(t),8))return!1;if(t>=0){let n=this._sock.rQshiftStr(t);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:n}}))}else{t=Math.abs(t);let n=this._sock.rQshift32(),r=n&65535,i=n&4278190080;if(!!(i&f_)){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(let a=0;a<=15;a++){let c=1<<a;r&c&&(this._clipboardServerCapabilitiesFormats[c]=!0,this._sock.rQshift32())}for(let a=24;a<=31;a++){let c=1<<a;this._clipboardServerCapabilitiesActions[c]=!!(i&c)}let s=[f_,Ys,p_,eo,Js];e.messages.extendedClipboardCaps(this._sock,s,{extendedClipboardFormatText:0})}else if(i===Ys){if(this._viewOnly)return!0;this._clipboardText!=null&&this._clipboardServerCapabilitiesActions[Js]&&r&Nt&&e.messages.extendedClipboardProvide(this._sock,[Nt],[this._clipboardText])}else if(i===p_){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[eo]&&(this._clipboardText!=null?e.messages.extendedClipboardNotify(this._sock,[Nt]):e.messages.extendedClipboardNotify(this._sock,[]))}else if(i===eo){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[Ys]&&r&Nt&&e.messages.extendedClipboardRequest(this._sock,[Nt])}else if(i===Js){if(this._viewOnly||!(r&Nt))return!0;this._clipboardText=null;let s=this._sock.rQshiftBytes(t-4),a=new _t,c=null;a.setInput(s);for(let l=0;l<=15;l++){let u=1<<l;if(r&u){let f=0,p=a.inflate(4);f|=p[0]<<24,f|=p[1]<<16,f|=p[2]<<8,f|=p[3];let h=a.inflate(f);u===Nt&&(c=h)}}if(a.setInput(null),c!==null){let l="";for(let u=0;u<c.length;u++)l+=String.fromCharCode(c[u]);c=l,c=Ss(c),c.length>0&&c.charAt(c.length-1)==="\0"&&(c=c.slice(0,-1)),c=c.replaceAll(`\r
3
3
  `,`
4
4
  `),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:c}}))}}else return this._fail("Unexpected action in extended clipboard message: "+i)}return!0}_handleServerFenceMsg(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);let t=this._sock.rQshift32(),n=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",n,9))return!1;n>64&&(Pe("Bad payload length ("+n+") in fence response"),n=64);let r=this._sock.rQshiftStr(n);return this._supportsFence=!0,t&1<<31?(t&=3,e.messages.clientFence(this._sock,t,r),!0):this._fail("Unexpected fence response")}_handleXvpMsg(){if(this._sock.rQwait("XVP version and message",3,1))return!1;this._sock.rQskipBytes(1);let t=this._sock.rQshift8(),n=this._sock.rQshift8();switch(n){case 0:Se("XVP operation failed");break;case 1:this._rfbXvpVer=t,Re("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+n+")");break}return!0}_normalMsg(){let t;this._FBU.rects>0?t=0:t=this._sock.rQshift8();let n,r;switch(t){case 0:return r=this._framebufferUpdate(),r&&!this._enabledContinuousUpdates&&e.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),r;case 1:return this._handleSetColourMapMsg();case 2:return ne("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return n=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,n&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),Re("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+t+")"),ne("sock.rQpeekBytes(30): "+this._sock.rQpeekBytes(30)),!0}}_framebufferUpdate(){if(this._FBU.rects===0){if(this._sock.rQwait("FBU header",3,1))return!1;if(this._sock.rQskipBytes(1),this._FBU.rects=this._sock.rQshift16(),this._display.pending())return this._flushing=!0,this._display.flush().then(()=>{this._flushing=!1,this._sock.rQwait("message",1)||this._handleMessage()}),!1}for(;this._FBU.rects>0;){if(this._FBU.encoding===null){if(this._sock.rQwait("rect header",12))return!1;this._FBU.x=this._sock.rQshift16(),this._FBU.y=this._sock.rQshift16(),this._FBU.width=this._sock.rQshift16(),this._FBU.height=this._sock.rQshift16(),this._FBU.encoding=this._sock.rQshift32(),this._FBU.encoding>>=0}if(!this._handleRect())return!1;this._FBU.rects--,this._FBU.encoding=null}return this._display.flip(),!0}_handleRect(){switch(this._FBU.encoding){case oe.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case oe.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case oe.pseudoEncodingCursor:return this._handleCursor();case oe.pseudoEncodingQEMUExtendedKeyEvent:return this._qemuExtKeyEventSupported=!0,!0;case oe.pseudoEncodingDesktopName:return this._handleDesktopName();case oe.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case oe.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();case oe.pseudoEncodingExtendedMouseButtons:return this._extendedPointerEventSupported=!0,!0;case oe.pseudoEncodingQEMULedEvent:return this._handleLedEvent();default:return this._handleDataRect()}}_handleVMwareCursor(){let t=this._FBU.x,n=this._FBU.y,r=this._FBU.width,i=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;let o=this._sock.rQshift8();this._sock.rQshift8();let s,a=4;if(o==0){if(s=new Array(r*i*a),this._sock.rQwait("VMware cursor classic encoding",r*i*a*2,2))return!1;let l=new Array(r*i);for(let f=0;f<r*i;f++)l[f]=this._sock.rQshift32();let u=new Array(r*i);for(let f=0;f<r*i;f++)u[f]=this._sock.rQshift32();for(let f=0;f<r*i;f++)if(l[f]==0){let p=u[f],h=p>>8&255,m=p>>16&255,x=p>>24&255;s[f*a]=h,s[f*a+1]=m,s[f*a+2]=x,s[f*a+3]=255}else(l[f]&-256)==-256?u[f]==0?(s[f*a]=0,s[f*a+1]=0,s[f*a+2]=0,s[f*a+3]=0):(u[f]&-256,s[f*a]=0,s[f*a+1]=0,s[f*a+2]=0,s[f*a+3]=255):(s[f*a]=0,s[f*a+1]=0,s[f*a+2]=0,s[f*a+3]=255)}else if(o==1){if(this._sock.rQwait("VMware cursor alpha encoding",r*i*4,2))return!1;s=new Array(r*i*a);for(let c=0;c<r*i;c++){let l=this._sock.rQshift32();s[c*4]=l>>24&255,s[c*4+1]=l>>16&255,s[c*4+2]=l>>8&255,s[c*4+3]=l&255}}else return Pe("The given cursor type is not supported: "+o+" given."),!1;return this._updateCursor(s,t,n,r,i),!0}_handleCursor(){let t=this._FBU.x,n=this._FBU.y,r=this._FBU.width,i=this._FBU.height,o=r*i*4,s=Math.ceil(r/8)*i,a=o+s;if(this._sock.rQwait("cursor encoding",a))return!1;let c=this._sock.rQshiftBytes(o),l=this._sock.rQshiftBytes(s),u=new Uint8Array(r*i*4),f=0;for(let p=0;p<i;p++)for(let h=0;h<r;h++){let m=p*Math.ceil(r/8)+Math.floor(h/8),x=l[m]<<h%8&128?255:0;u[f]=c[f+2],u[f+1]=c[f+1],u[f+2]=c[f],u[f+3]=x,f+=4}return this._updateCursor(u,t,n,r,i),!0}_handleDesktopName(){if(this._sock.rQwait("DesktopName",4))return!1;let t=this._sock.rQshift32();if(this._sock.rQwait("DesktopName",t,4))return!1;let n=this._sock.rQshiftStr(t);return n=Ss(n,!0),this._setDesktopName(n),!0}_handleLedEvent(){if(this._sock.rQwait("LED status",1))return!1;let t=this._sock.rQshift8(),n=!!(t&2),r=!!(t&4);return this._remoteCapsLock=r,this._remoteNumLock=n,!0}_handleExtendedDesktopSize(){if(this._sock.rQwait("ExtendedDesktopSize",4))return!1;let t=this._sock.rQpeek8(),n=4+t*16;if(this._sock.rQwait("ExtendedDesktopSize",n))return!1;let r=!this._supportsSetDesktopSize;this._supportsSetDesktopSize=!0,this._sock.rQskipBytes(1),this._sock.rQskipBytes(3);for(let i=0;i<t;i+=1)i===0?(this._screenID=this._sock.rQshift32(),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._screenFlags=this._sock.rQshift32()):this._sock.rQskipBytes(16);if(this._FBU.x===1&&(this._pendingRemoteResize=!1),this._FBU.x===1&&this._FBU.y!==0){let i="";switch(this._FBU.y){case 1:i="Resize is administratively prohibited";break;case 2:i="Out of resources";break;case 3:i="Invalid screen layout";break;default:i="Unknown reason";break}Pe("Server did not accept the resize request: "+i)}else this._resize(this._FBU.width,this._FBU.height);return r&&this._requestRemoteResize(),this._FBU.x===1&&this._FBU.y===0&&this._requestRemoteResize(),!0}_handleDataRect(){let t=this._decoders[this._FBU.encoding];if(!t)return this._fail("Unsupported encoding (encoding: "+this._FBU.encoding+")"),!1;try{return t.decodeRect(this._FBU.x,this._FBU.y,this._FBU.width,this._FBU.height,this._sock,this._display,this._fbDepth)}catch(n){return this._fail("Error decoding rect: "+n),!1}}_updateContinuousUpdates(){this._enabledContinuousUpdates&&e.messages.enableContinuousUpdates(this._sock,!0,0,0,this._fbWidth,this._fbHeight)}_resize(t,n){this._fbWidth=t,this._fbHeight=n,this._display.resize(this._fbWidth,this._fbHeight),this._updateClip(),this._updateScale(),this._updateContinuousUpdates(),this._saveExpectedClientSize()}_xvpOp(t,n){this._rfbXvpVer<t||(Re("Sending XVP operation "+n+" (version "+t+")"),e.messages.xvpOp(this._sock,t,n))}_updateCursor(t,n,r,i,o){this._cursorImage={rgbaPixels:t,hotx:n,hoty:r,w:i,h:o},this._refreshCursor()}_shouldShowDotCursor(){if(!this._showDotCursor)return!1;for(let t=3;t<this._cursorImage.rgbaPixels.length;t+=4)if(this._cursorImage.rgbaPixels[t])return!1;return!0}_refreshCursor(){if(this._rfbConnectionState!=="connecting"&&this._rfbConnectionState!=="connected")return;let t=this._shouldShowDotCursor()?e.cursors.dot:this._cursorImage;this._cursor.change(t.rgbaPixels,t.hotx,t.hoty,t.w,t.h)}static genDES(t,n){let r=t.split("").map(o=>o.charCodeAt(0)),i=Ce.importKey("raw",r,{name:"DES-ECB"},!1,["encrypt"]);return Ce.encrypt({name:"DES-ECB"},i,n)}};Qe.messages={keyEvent(e,t,n){e.sQpush8(4),e.sQpush8(n),e.sQpush16(0),e.sQpush32(t),e.flush()},QEMUExtendedKeyEvent(e,t,n,r){function i(s){let a=r>>8,c=r&255;return a===224&&c<127?c|128:s}e.sQpush8(255),e.sQpush8(0),e.sQpush16(n),e.sQpush32(t);let o=i(r);e.sQpush32(o),e.flush()},pointerEvent(e,t,n,r){e.sQpush8(5),r=r&127,e.sQpush8(r),e.sQpush16(t),e.sQpush16(n),e.flush()},extendedPointerEvent(e,t,n,r){e.sQpush8(5);let i=r>>7&255;if(i&252)throw new Error("Invalid mouse button mask: "+r);let o=r&127;o|=128,e.sQpush8(o),e.sQpush16(t),e.sQpush16(n),e.sQpush8(i),e.flush()},_buildExtendedClipboardFlags(e,t){let n=new Uint8Array(4),r=0,i=0;for(let o=0;o<e.length;o++)i|=e[o];for(let o=0;o<t.length;o++)r|=t[o];return n[0]=i>>24,n[1]=0,n[2]=0,n[3]=r,n},extendedClipboardProvide(e,t,n){let r=new Oi,i=[];for(let a=0;a<t.length;a++){if(t[a]!=Nt)throw new Error("Unsupported extended clipboard format for Provide message.");n[a]=n[a].replace(/\r\n|\r|\n/gm,`\r
5
- `);let c=xt(n[a]+"\0");i.push(c.length>>24&255,c.length>>16&255,c.length>>8&255,c.length&255);for(let l=0;l<c.length;l++)i.push(c.charCodeAt(l))}let o=r.deflate(new Uint8Array(i)),s=new Uint8Array(4+o.length);s.set(Qe.messages._buildExtendedClipboardFlags([Js],t)),s.set(o,4),Qe.messages.clientCutText(e,s,!0)},extendedClipboardNotify(e,t){let n=Qe.messages._buildExtendedClipboardFlags([eo],t);Qe.messages.clientCutText(e,n,!0)},extendedClipboardRequest(e,t){let n=Qe.messages._buildExtendedClipboardFlags([Ys],t);Qe.messages.clientCutText(e,n,!0)},extendedClipboardCaps(e,t,n){let r=Object.keys(n),i=new Uint8Array(4+4*r.length);r.map(s=>parseInt(s)),r.sort((s,a)=>s-a),i.set(Qe.messages._buildExtendedClipboardFlags(t,[]));let o=4;for(let s=0;s<r.length;s++)i[o]=n[r[s]]>>24,i[o+1]=n[r[s]]>>16,i[o+2]=n[r[s]]>>8,i[o+3]=n[r[s]]>>0,o+=4,i[3]|=1<<r[s];Qe.messages.clientCutText(e,i,!0)},clientCutText(e,t,n=!1){e.sQpush8(6),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0);let r;n?r=gg(-t.length):r=t.length,e.sQpush32(r),e.sQpushBytes(t),e.flush()},setDesktopSize(e,t,n,r,i){e.sQpush8(251),e.sQpush8(0),e.sQpush16(t),e.sQpush16(n),e.sQpush8(1),e.sQpush8(0),e.sQpush32(r),e.sQpush16(0),e.sQpush16(0),e.sQpush16(t),e.sQpush16(n),e.sQpush32(i),e.flush()},clientFence(e,t,n){e.sQpush8(248),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush32(t),e.sQpush8(n.length),e.sQpushString(n),e.flush()},enableContinuousUpdates(e,t,n,r,i,o){e.sQpush8(150),e.sQpush8(t),e.sQpush16(n),e.sQpush16(r),e.sQpush16(i),e.sQpush16(o),e.flush()},pixelFormat(e,t,n){let r;t>16?r=32:t>8?r=16:r=8;let i=Math.floor(t/3);e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush8(r),e.sQpush8(t),e.sQpush8(0),e.sQpush8(n?1:0),e.sQpush16((1<<i)-1),e.sQpush16((1<<i)-1),e.sQpush16((1<<i)-1),e.sQpush8(i*0),e.sQpush8(i*1),e.sQpush8(i*2),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.flush()},clientEncodings(e,t){e.sQpush8(2),e.sQpush8(0),e.sQpush16(t.length);for(let n=0;n<t.length;n++)e.sQpush32(t[n]);e.flush()},fbUpdateRequest(e,t,n,r,i,o){typeof n>"u"&&(n=0),typeof r>"u"&&(r=0),e.sQpush8(3),e.sQpush8(t?1:0),e.sQpush16(n),e.sQpush16(r),e.sQpush16(i),e.sQpush16(o),e.flush()},xvpOp(e,t,n){e.sQpush8(250),e.sQpush8(0),e.sQpush8(t),e.sQpush8(n),e.flush()}};Qe.cursors={none:{rgbaPixels:new Uint8Array,w:0,h:0,hotx:0,hoty:0},dot:{rgbaPixels:new Uint8Array([255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255]),w:3,h:3,hotx:1,hoty:1}};var Tt="home",to="thread",Ru="desktop",Pu="notifications";function h_(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return Object.keys(t).length===3&&typeof t.threadId=="string"&&/^thr_[a-z0-9]+$/.test(t.threadId)&&typeof t.rootSeq=="number"&&Number.isInteger(t.rootSeq)&&t.rootSeq>=0&&typeof t.rootText=="string"&&t.rootText.length<=600}function Fu(e){return e.experimental_messageSeq}function IS(e,t){let n=Math.floor(Math.max(0,t-e)/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Lu(e,t){let n=e.replies===1?"1 reply":`${e.replies} replies`;return e.replies===0?"Thread started":`${n} \xB7 last ${IS(e.lastActivityAt,t)}`}function m_(e,t){let n=new Set(t.filter(i=>i.running).map(i=>i.threadId));return e===null?{open:n.size>0,running:n}:{open:[...n].some(i=>!e.has(i))?!0:null,running:n}}function g_(e,t){let n=e.outcomes.at(-1);return n?`\u21B3 ${n.text}`:Lu(e,t)}var zu=null,no=null;function x_(e){return no?(no(e),!0):(zu=e,!1)}function __(e){no=e;let t=zu;return zu=null,t&&e(t),()=>{no===e&&(no=null)}}function ea({orbitThread:e,threadId:t,done:n}){let r=G(),[i,o]=w(!1),[s,a]=w(null),c=async()=>{o(!0),a(null);try{await r.call("threads.done",{orbitThread:e,threadId:t})}catch(l){a(l instanceof Error?l.message:"Couldn't save Done. Try again.")}finally{o(!1)}};return g("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[d("button",{type:"button",disabled:i||n,onClick:()=>{c()},"aria-label":"Mark as Done",className:"rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-state-hover hover:text-foreground disabled:opacity-50",children:i?"Saving\u2026":n?"\u2713 Done":"Done"}),s?d("span",{role:"alert",className:"max-w-48 text-xs text-destructive",children:s}):null]})}var M={};St(M,{$brand:()=>qu,$input:()=>kp,$output:()=>wp,INVALID:()=>qe,NEVER:()=>Gu,TimePrecision:()=>Fp,ZodAny:()=>vm,ZodArray:()=>Em,ZodBase64:()=>ql,ZodBase64URL:()=>Yl,ZodBigInt:()=>ui,ZodBigIntFormat:()=>tc,ZodBoolean:()=>ci,ZodCIDRv4:()=>Wl,ZodCIDRv6:()=>Gl,ZodCUID:()=>Bl,ZodCUID2:()=>Zl,ZodCatch:()=>Hm,ZodCodec:()=>Go,ZodCompileAsyncError:()=>vt,ZodCompileUnsupportedError:()=>fe,ZodCreditCard:()=>pm,ZodCustom:()=>qo,ZodCustomStringFormat:()=>er,ZodDate:()=>Uo,ZodDefault:()=>Xm,ZodDiscriminatedUnion:()=>Cm,ZodE164:()=>Jl,ZodEmail:()=>Dl,ZodEmoji:()=>Xl,ZodEnum:()=>si,ZodError:()=>MC,ZodExactOptional:()=>oc,ZodFile:()=>zm,ZodFirstPartyTypeKind:()=>s0,ZodFunction:()=>n0,ZodGUID:()=>Kl,ZodIBAN:()=>hm,ZodIPv4:()=>jl,ZodIPv6:()=>Ql,ZodISODate:()=>pn,ZodISODateTime:()=>fn,ZodISODuration:()=>mn,ZodISOTime:()=>hn,ZodInstanceOf:()=>o0,ZodIntersection:()=>Nm,ZodIssueCode:()=>UC,ZodJWT:()=>ec,ZodKSUID:()=>Hl,ZodLazy:()=>Jm,ZodLiteral:()=>Lm,ZodMAC:()=>fm,ZodMap:()=>Pm,ZodNaN:()=>Qm,ZodNanoID:()=>Ml,ZodNever:()=>km,ZodNonOptional:()=>sc,ZodNull:()=>bm,ZodNullable:()=>Km,ZodNumber:()=>li,ZodNumberFormat:()=>tr,ZodObject:()=>Ho,ZodOptional:()=>Qo,ZodPipe:()=>Wo,ZodPrefault:()=>Bm,ZodPreprocess:()=>Wm,ZodPromise:()=>t0,ZodReadonly:()=>Gm,ZodRealError:()=>at,ZodRecord:()=>oi,ZodSet:()=>Fm,ZodString:()=>ai,ZodStringFormat:()=>ke,ZodSuccess:()=>Vm,ZodSymbol:()=>xm,ZodTemplateLiteral:()=>Ym,ZodTransform:()=>Om,ZodTuple:()=>$m,ZodType:()=>ue,ZodULID:()=>Ul,ZodURL:()=>Zo,ZodUUID:()=>Pt,ZodUndefined:()=>_m,ZodUnion:()=>jo,ZodUnknown:()=>wm,ZodVoid:()=>Sm,ZodXID:()=>Vl,ZodXor:()=>Am,_ZodString:()=>Ol,_default:()=>Mm,_function:()=>By,any:()=>by,array:()=>Vo,base64:()=>Jb,base64url:()=>ey,bigint:()=>hy,boolean:()=>gm,catch:()=>jm,check:()=>Zy,cidrv4:()=>qb,cidrv6:()=>Yb,clone:()=>be,codec:()=>Dy,coerce:()=>l0,compile:()=>Cp,config:()=>Ie,core:()=>Qt,creditCard:()=>ny,cuid:()=>Zb,cuid2:()=>Ub,currencyCode:()=>ly,custom:()=>Uy,date:()=>vy,decode:()=>om,decodeAsync:()=>am,deepPartial:()=>rv,describe:()=>Vy,discriminatedUnion:()=>Cy,e164:()=>ty,email:()=>Pb,emoji:()=>Mb,encode:()=>im,encodeAsync:()=>sm,endsWith:()=>Qr,enum:()=>rc,exactOptional:()=>Dm,file:()=>Fy,flattenError:()=>po,float32:()=>uy,float64:()=>dy,formatError:()=>ho,fromJSONSchema:()=>tv,function:()=>By,getDiscriminatedOption:()=>Gf,getErrorMap:()=>HC,globalRegistry:()=>Xe,gt:()=>It,gte:()=>ut,guid:()=>Fb,hash:()=>cy,hex:()=>ay,hostname:()=>sy,httpUrl:()=>Xb,iban:()=>ry,includes:()=>Hr,input:()=>ov,instanceof:()=>jy,int:()=>Ll,int32:()=>fy,int64:()=>my,intersection:()=>Tm,invertCodec:()=>Ky,ipv4:()=>Qb,ipv6:()=>Gb,iso:()=>Yo,json:()=>Wy,jwt:()=>iy,keyof:()=>wy,ksuid:()=>jb,lazy:()=>e0,length:()=>Wn,literal:()=>Py,locales:()=>Po,looseObject:()=>Ey,looseRecord:()=>Ty,lowercase:()=>Ur,lt:()=>$t,lte:()=>ct,mac:()=>Wb,map:()=>$y,maxLength:()=>Qn,maxSize:()=>ln,memoizer:()=>Ro,meta:()=>Hy,mime:()=>Gr,minLength:()=>jt,minSize:()=>Rt,multipleOf:()=>an,nan:()=>Oy,nanoid:()=>Bb,nativeEnum:()=>Ry,negative:()=>Sl,never:()=>nc,nonnegative:()=>Al,nonoptional:()=>Um,nonpositive:()=>El,normalize:()=>qr,null:()=>ym,nullable:()=>Bo,nullish:()=>Ly,number:()=>mm,object:()=>ky,optional:()=>Yn,output:()=>sv,overwrite:()=>wt,parse:()=>em,parseAsync:()=>tm,partialRecord:()=>Ny,pipe:()=>zl,positive:()=>kl,prefault:()=>Zm,preprocess:()=>Gy,prettifyError:()=>nd,promise:()=>My,properties:()=>Wr,property:()=>Cl,readonly:()=>qm,record:()=>Rm,refine:()=>r0,regex:()=>Zr,regexes:()=>gt,registry:()=>Ya,safeDecode:()=>cm,safeDecodeAsync:()=>dm,safeEncode:()=>lm,safeEncodeAsync:()=>um,safeParse:()=>nm,safeParseAsync:()=>rm,set:()=>Iy,setErrorMap:()=>VC,size:()=>jn,slugify:()=>ti,startsWith:()=>jr,strictObject:()=>Sy,string:()=>Mo,stringFormat:()=>oy,stringbool:()=>Qy,success:()=>zy,superRefine:()=>i0,symbol:()=>xy,templateLiteral:()=>Xy,toJSONSchema:()=>Il,toLowerCase:()=>Jr,toUpperCase:()=>ei,toZod:()=>ro,transform:()=>ic,treeifyError:()=>td,trim:()=>Yr,tuple:()=>Im,uint32:()=>py,uint64:()=>gy,ulid:()=>Vb,undefined:()=>_y,union:()=>di,unknown:()=>qn,uppercase:()=>Vr,url:()=>Kb,util:()=>W,uuid:()=>Lb,uuidv4:()=>zb,uuidv6:()=>Ob,uuidv7:()=>Db,validate:()=>mo,validateAsync:()=>go,void:()=>yy,withParser:()=>Ja,xid:()=>Hb,xor:()=>Ay});var Qt={};St(Qt,{$ZodAny:()=>Bf,$ZodArray:()=>jf,$ZodAsyncError:()=>ot,$ZodBase64:()=>$f,$ZodBase64URL:()=>If,$ZodBigInt:()=>Xa,$ZodBigIntFormat:()=>Df,$ZodBoolean:()=>Ao,$ZodCIDRv4:()=>Nf,$ZodCIDRv6:()=>Tf,$ZodCUID:()=>gf,$ZodCUID2:()=>xf,$ZodCatch:()=>fp,$ZodCheck:()=>Ee,$ZodCheckBigIntFormat:()=>Bd,$ZodCheckEndsWith:()=>ef,$ZodCheckGreaterThan:()=>Sa,$ZodCheckIncludes:()=>Yd,$ZodCheckLengthEquals:()=>Qd,$ZodCheckLessThan:()=>ka,$ZodCheckLowerCase:()=>Gd,$ZodCheckMaxLength:()=>Hd,$ZodCheckMaxSize:()=>Zd,$ZodCheckMimeType:()=>rf,$ZodCheckMinLength:()=>jd,$ZodCheckMinSize:()=>Ud,$ZodCheckMultipleOf:()=>Xd,$ZodCheckNumberFormat:()=>Md,$ZodCheckOverwrite:()=>of,$ZodCheckProperties:()=>nf,$ZodCheckProperty:()=>tf,$ZodCheckRegex:()=>Wd,$ZodCheckSizeEquals:()=>Vd,$ZodCheckStartsWith:()=>Jd,$ZodCheckStringFormat:()=>Kr,$ZodCheckUpperCase:()=>qd,$ZodCodec:()=>No,$ZodCreditCard:()=>Pf,$ZodCustom:()=>bp,$ZodCustomStringFormat:()=>zf,$ZodCyclicError:()=>ja,$ZodDate:()=>Hf,$ZodDefault:()=>lp,$ZodDiscriminatedUnion:()=>qf,$ZodE164:()=>Rf,$ZodEmail:()=>uf,$ZodEmoji:()=>hf,$ZodEncodeError:()=>sn,$ZodEnum:()=>np,$ZodError:()=>ed,$ZodExactOptional:()=>sp,$ZodFile:()=>ip,$ZodFunction:()=>xp,$ZodGUID:()=>lf,$ZodIBAN:()=>Ff,$ZodIPv4:()=>Ef,$ZodIPv6:()=>Af,$ZodISODate:()=>wf,$ZodISODateTime:()=>vf,$ZodISODuration:()=>Sf,$ZodISOTime:()=>kf,$ZodIntersection:()=>Yf,$ZodJWT:()=>Lf,$ZodKSUID:()=>yf,$ZodLazy:()=>To,$ZodLiteral:()=>rp,$ZodMAC:()=>Cf,$ZodMap:()=>ep,$ZodNaN:()=>pp,$ZodNanoID:()=>mf,$ZodNever:()=>Uf,$ZodNonOptional:()=>up,$ZodNull:()=>Mf,$ZodNullable:()=>ap,$ZodNumber:()=>Ka,$ZodNumberFormat:()=>Of,$ZodObject:()=>J_,$ZodObjectJIT:()=>Qf,$ZodOptional:()=>Ba,$ZodPipe:()=>Za,$ZodPrefault:()=>cp,$ZodPreprocess:()=>hp,$ZodPromise:()=>_p,$ZodReadonly:()=>mp,$ZodRealError:()=>st,$ZodRecord:()=>Jf,$ZodRegistry:()=>qa,$ZodSet:()=>tp,$ZodString:()=>Bn,$ZodStringFormat:()=>ye,$ZodSuccess:()=>dp,$ZodSymbol:()=>Kf,$ZodTemplateLiteral:()=>gp,$ZodTransform:()=>op,$ZodTuple:()=>Ma,$ZodType:()=>ie,$ZodULID:()=>_f,$ZodURL:()=>pf,$ZodUUID:()=>cf,$ZodUndefined:()=>Xf,$ZodUnion:()=>Co,$ZodUnknown:()=>Zf,$ZodVoid:()=>Vf,$ZodXID:()=>bf,$ZodXor:()=>Wf,$brand:()=>qu,$constructor:()=>C,$input:()=>kp,$output:()=>wp,Doc:()=>Mn,INVALID:()=>qe,JSONSchema:()=>$b,JSONSchemaGenerator:()=>Rl,NEVER:()=>Gu,TimePrecision:()=>Fp,URL_BAD_FORMAT:()=>df,URL_UNPARSEABLE:()=>vo,ZodCompileAsyncError:()=>vt,ZodCompileUnsupportedError:()=>fe,_any:()=>qp,_array:()=>ih,_base64:()=>bl,_base64url:()=>yl,_bigint:()=>Up,_boolean:()=>Bp,_catch:()=>TC,_check:()=>hb,_cidrv4:()=>xl,_cidrv6:()=>_l,_coercedBigint:()=>Vp,_coercedBoolean:()=>Zp,_coercedDate:()=>nh,_coercedNumber:()=>zp,_coercedString:()=>$p,_creditCard:()=>Rp,_cuid:()=>ul,_cuid2:()=>dl,_custom:()=>sh,_date:()=>th,_decode:()=>fa,_decodeAsync:()=>ha,_default:()=>AC,_discriminatedUnion:()=>hC,_e164:()=>vl,_email:()=>nl,_emoji:()=>ll,_encode:()=>da,_encodeAsync:()=>pa,_endsWith:()=>Qr,_enum:()=>yC,_file:()=>oh,_float32:()=>Dp,_float64:()=>Kp,_gt:()=>It,_gte:()=>ut,_guid:()=>rl,_iban:()=>Pp,_includes:()=>Hr,_int:()=>Op,_int32:()=>Xp,_int64:()=>Hp,_intersection:()=>mC,_ipv4:()=>ml,_ipv6:()=>gl,_isoDate:()=>zo,_isoDateTime:()=>Lo,_isoDuration:()=>Do,_isoTime:()=>Oo,_jwt:()=>wl,_ksuid:()=>hl,_lazy:()=>PC,_length:()=>Wn,_literal:()=>wC,_lowercase:()=>Ur,_lt:()=>$t,_lte:()=>ct,_mac:()=>Ip,_map:()=>_C,_max:()=>ct,_maxLength:()=>Qn,_maxSize:()=>ln,_mime:()=>Gr,_min:()=>ut,_minLength:()=>jt,_minSize:()=>Rt,_multipleOf:()=>an,_nan:()=>rh,_nanoid:()=>cl,_nativeEnum:()=>vC,_negative:()=>Sl,_never:()=>Jp,_nonnegative:()=>Al,_nonoptional:()=>CC,_nonpositive:()=>El,_normalize:()=>qr,_null:()=>Gp,_nullable:()=>EC,_number:()=>Lp,_optional:()=>SC,_overwrite:()=>wt,_parse:()=>Lr,_parseAsync:()=>zr,_pipe:()=>$C,_positive:()=>kl,_promise:()=>FC,_properties:()=>Wr,_property:()=>Cl,_readonly:()=>IC,_record:()=>xC,_refine:()=>ah,_regex:()=>Zr,_safeDecode:()=>ga,_safeDecodeAsync:()=>_a,_safeEncode:()=>ma,_safeEncodeAsync:()=>xa,_safeParse:()=>Or,_safeParseAsync:()=>Dr,_set:()=>bC,_size:()=>jn,_slugify:()=>ti,_startsWith:()=>jr,_string:()=>Tp,_stringFormat:()=>Gn,_stringbool:()=>dh,_success:()=>NC,_superRefine:()=>lh,_symbol:()=>Qp,_templateLiteral:()=>RC,_toLowerCase:()=>Jr,_toUpperCase:()=>ei,_transform:()=>kC,_trim:()=>Yr,_tuple:()=>gC,_uint32:()=>Mp,_uint64:()=>jp,_ulid:()=>fl,_undefined:()=>Wp,_union:()=>fC,_unknown:()=>Yp,_uppercase:()=>Vr,_url:()=>Fo,_uuid:()=>il,_uuidv4:()=>ol,_uuidv6:()=>sl,_uuidv7:()=>al,_void:()=>eh,_xid:()=>pl,_xor:()=>pC,base64Charset:()=>Fa,base64urlCharset:()=>Eo,canParseURL:()=>ff,clone:()=>be,compile:()=>Cp,compileFn:()=>el,config:()=>Ie,createStandardJSONSchemaMethod:()=>ni,createToJSONSchemaMethod:()=>ph,decode:()=>wE,decodeAsync:()=>SE,describe:()=>ch,encode:()=>vE,encodeAsync:()=>kE,extractDefs:()=>un,finalize:()=>dn,flattenError:()=>po,formatError:()=>ho,getDiscriminatedOption:()=>Gf,globalConfig:()=>Oe,globalRegistry:()=>Xe,handleUnrepresentable:()=>Le,initializeContext:()=>cn,isBackEdge:()=>Wa,isRecursiveSchema:()=>Qa,isValidBase64:()=>So,isValidBase64URL:()=>La,isValidCIDRv6:()=>Pa,isValidCreditCard:()=>za,isValidIBAN:()=>Oa,isValidIPv6:()=>ko,isValidJWT:()=>Da,locales:()=>Po,memoizer:()=>Ro,mergeValues:()=>Xr,meta:()=>uh,parse:()=>ca,parseAsync:()=>ua,parseURLObject:()=>G_,prettifyError:()=>nd,process:()=>ve,processSchema:()=>ve,regexes:()=>gt,registry:()=>Ya,safeDecode:()=>AE,safeDecodeAsync:()=>NE,safeEncode:()=>EE,safeEncodeAsync:()=>CE,safeParse:()=>gE,safeParseAsync:()=>xE,standardProps:()=>Ta,stripTabAndNewline:()=>wo,toDotPath:()=>T_,toJSONSchema:()=>Il,toZod:()=>ro,treeifyError:()=>td,urlHostnameOk:()=>Ia,urlProtocolOk:()=>Ra,util:()=>W,validate:()=>mo,validateAsync:()=>go,validateURL:()=>$a,version:()=>sf,withParser:()=>Ja});var W={};St(W,{BIGINT_FORMAT_RANGES:()=>lo,CONSTANT_CATCH:()=>aa,Class:()=>Ku,NUMBER_FORMAT_RANGES:()=>ao,aborted:()=>Ge,allowsEval:()=>Bu,assert:()=>zS,assertEqual:()=>RS,assertIs:()=>FS,assertNever:()=>LS,assertNotEqual:()=>PS,assignProp:()=>Ke,attachSchema:()=>sa,base64ToUint8Array:()=>k_,base64urlToUint8Array:()=>tE,cached:()=>Rr,captureStackTrace:()=>ra,cleanEnum:()=>eE,cleanRegex:()=>Vt,clone:()=>be,cloneDef:()=>KS,codePointLength:()=>Kn,constantCatch:()=>Qu,createTransparentProxy:()=>VS,defineLazy:()=>Xu,defineLazyInternal:()=>de,derived:()=>oE,esc:()=>We,escapeRegex:()=>mt,explicitlyAborted:()=>Vu,extend:()=>QS,finalizeIssue:()=>it,floatSafeRemainder:()=>io,getElementAtPath:()=>XS,getEnumValues:()=>$r,getLengthableOrigin:()=>uo,getParsedType:()=>US,getSizableOrigin:()=>co,hexToUint8Array:()=>rE,hide:()=>fo,installLazyProp:()=>cE,isObject:()=>Dn,isPlainObject:()=>ht,issue:()=>Fr,joinValues:()=>ta,jsonStringifyReplacer:()=>Ir,members:()=>ju,merge:()=>GS,mergeDefs:()=>yt,normalizeParams:()=>B,nullish:()=>na,numKeys:()=>ZS,objectClone:()=>OS,omit:()=>jS,optionalKeys:()=>Uu,own:()=>on,parsedType:()=>Hu,partial:()=>qS,pick:()=>HS,prefixIssues:()=>rt,primitiveTypes:()=>Zu,promiseAllObject:()=>MS,propertyKeyTypes:()=>so,randomString:()=>BS,rawShape:()=>Pr,required:()=>YS,safeExtend:()=>WS,shallowClone:()=>oo,slugify:()=>Mu,stringifyPrimitive:()=>ia,toZod:()=>ro,uint8ArrayToBase64:()=>S_,uint8ArrayToBase64url:()=>nE,uint8ArrayToHex:()=>iE,unwrapMessage:()=>Tr});function RS(e){return e}function PS(e){return e}function ro(){return e=>e}function FS(e){}function LS(e){throw new Error("Unexpected value in exhaustive check")}function zS(e){}function $r(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function ta(e,t="|"){return e.map(n=>ia(n)).join(t)}function Ir(e,t){return typeof t=="bigint"?t.toString():t}var Du=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Rr(e){return new Du(e)}function na(e){return e==null}function Vt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function io(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var b_=Symbol("evaluating");function Xu(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==b_)return r===void 0&&(r=b_,r=n()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function OS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ke(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ut(e){return Pr(e._zod.def)??e._zod.def.shape}function y_(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Ke(this,t,r),r},enumerable:!0,configurable:!0})}function v_(e,t,n){t in e?Ke(e,t,n):e[t]=n}function On(e,t,n,r){let i=Ut(t);for(let o of n){let s=Object.getOwnPropertyDescriptor(i,o);s.enumerable&&(s.get?y_(e,o,()=>{let a=t._zod.def.shape[o];return r?r(a,o):a}):v_(e,o,r?r(s.value,o):s.value))}}function DS(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?y_(e,n,()=>t[n]):v_(e,n,r.value))}}function yt(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function KS(e){return yt(e._zod.def)}function XS(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function MS(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=r[o];return i})}function BS(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function We(e){return JSON.stringify(e)}function Mu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ra="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Bu=Rr(()=>{if(Oe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ht(e){if(Dn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Dn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oo(e){return ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ZS(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var US=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},so=new Set(["string","number","symbol"]),Zu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function VS(e){let t;return new Proxy({},{get(n,r,i){return t??(t=e()),Reflect.get(t,r,i)},set(n,r,i,o){return t??(t=e()),Reflect.set(t,r,i,o)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??(t=e()),Reflect.defineProperty(t,r,i)}})}function ia(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Uu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ao={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function HS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return On(o,e,oa(e,t)),be(e,yt(n,{shape:o,checks:[]}))}function oa(e,t){let n=Ut(e),r=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function jS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(oa(e,t)),s={};return On(s,e,Reflect.ownKeys(Ut(e)).filter(a=>!o.has(a))),be(e,yt(n,{shape:s,checks:[]}))}function QS(e,t){if(!ht(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=Ut(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return be(e,yt(e._zod.def,{shape:w_(e,t)}))}function w_(e,t){let n={};return On(n,e,Reflect.ownKeys(Ut(e))),DS(n,t),n}function WS(e,t){if(!ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");return be(e,yt(e._zod.def,{shape:w_(e,t)}))}function GS(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};On(n,e,Reflect.ownKeys(Ut(e))),On(n,t,Reflect.ownKeys(Ut(t)));let r=yt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return be(e,r)}function qS(e,t,n,r="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(oa(t,n)):void 0,c={};return On(c,t,Reflect.ownKeys(Ut(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),be(t,yt(t._zod.def,{shape:c,checks:[]}))}function YS(e,t,n){let r=n?new Set(oa(t,n)):void 0,i={};return On(i,t,Reflect.ownKeys(Ut(t)),(o,s)=>r&&!r.has(s)?o:new e({type:"nonoptional",innerType:o})),be(t,yt(t._zod.def,{shape:i}))}function Ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Vu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Tr(e){return typeof e=="string"?e:e?.message}function sa(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function it(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Tr(e.inst?._zod.def?.error?.(e))??Tr(o?.(e))??Tr(t?.error?.(e))??Tr(n.customError?.(e))??Tr(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function co(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var JS=/[\uD800-\uDBFF]/;function Kn(e){let t=e.length;if(!JS.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function uo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hu(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Fr(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function eE(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function k_(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function S_(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function tE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return k_(t+n)}function nE(e){return S_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function rE(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function iE(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ku=class{constructor(...t){}};function ju(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):sE(e,n,r.value)}}function on(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function fo(e,t,n){return on(e,t,n,!1)}function oE(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return on(this,n,r(this))},set(i){on(this,n,i)}})}return t}function sE(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:on(this,t,n.bind(this))},set(r){on(this,t,r)}})}function aE(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ou,rn=!1,lE={configurable:!0,get(){rn=!0}};function de(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ou!==e._zod){Ou=void 0;return}Ou=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,lE);let i=rn;rn=!1;try{let o=n(this);return rn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),rn=rn||i,o}catch(o){throw delete this[t],rn=rn||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function cE(e,t,n,r){let i=aE(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:o})}})}var aa="~constantCatch";function Qu(e){let t=()=>e;return t[aa]=!0,t}var E_,Gu=Object.freeze({status:"aborted"}),Wu={value:void 0,enumerable:!1},A_="captureStackTrace"in Error?Error:null;function uE(e){let t=A_;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return A_=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function C(e,t,n,r){let i={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=i;let s=n,a=s&&new WeakSet;function c(p,h){if(p._zod){if(p._zod.traits.has(e))return}else{Wu.value=new o(h);try{Object.defineProperty(p,"_zod",Wu)}finally{Wu.value=void 0}}if(p._zod.traits.add(e),t(p,h),a){let x=Object.getPrototypeOf(p),_=p._zod.constr.prototype,b=x;for(;b&&b!==_;)b=Object.getPrototypeOf(b);let E=b??x;a.has(E)||(a.add(E),ju(E,s))}let m=f.prototype;for(let x in m)Object.prototype.hasOwnProperty.call(m,x)&&(x in p||(p[x]=m[x].bind(p)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function f(p){let h=r?.Parent?uE(u):this;c(h,p);let m=h._zod.deferred;if(m){for(let _ of m)_();h._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(h),h}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var qu=Symbol("zod_brand"),ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},sn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(E_=globalThis).__zod_globalConfig??(E_.__zod_globalConfig={});var Oe=globalThis.__zod_globalConfig;function Ie(e){return e&&Object.assign(Oe,e),Oe}function dE(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ir,2)),e.message}function fE(e){this._zod.message=e}var pE={get:dE,set:fE,enumerable:!0,configurable:!0},Ju={value:void 0,enumerable:!1},C_=new WeakSet([Object.prototype,Error.prototype]),N_=(e,t)=>{e.name="$ZodError",Ju.value=t,Object.defineProperty(e,"issues",Ju),Ju.value=void 0,Object.defineProperty(e,"message",pE);let n=Object.getPrototypeOf(e);C_.has(n)||(C_.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},ed=C("$ZodError",N_),st=C("$ZodError",N_,void 0,{Parent:Error});function hE(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function po(e,t=n=>n.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hE(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ho(e,t=n=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;for(;l<a.length;){let u=a[l],f=l===a.length-1;if(u==="_errors"){f&&c._errors.push(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[u];f&&p._errors.push(t(s)),c=p,l++}}}};return r(e),n}function td(e,t=n=>n.message){let n={errors:[]},r=(i,o=[])=>{var s;for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0){n.errors.push(t(a));continue}let l=n,u=0;for(;u<c.length;){let f=c[u],p=u===c.length-1;typeof f=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,f)||Object.defineProperty(l.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[f]):(l.items??(l.items=[]),(s=l.items)[f]??(s[f]={errors:[]}),l=l.items[f]),p&&l.errors.push(t(a)),u++}}};return r(e),n}function T_(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function nd(e){let t=[],n=[...e.issues].sort((r,i)=>(r.path??[]).length-(i.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${T_(r.path)}`);return t.join(`
5
+ `);let c=xt(n[a]+"\0");i.push(c.length>>24&255,c.length>>16&255,c.length>>8&255,c.length&255);for(let l=0;l<c.length;l++)i.push(c.charCodeAt(l))}let o=r.deflate(new Uint8Array(i)),s=new Uint8Array(4+o.length);s.set(Qe.messages._buildExtendedClipboardFlags([Js],t)),s.set(o,4),Qe.messages.clientCutText(e,s,!0)},extendedClipboardNotify(e,t){let n=Qe.messages._buildExtendedClipboardFlags([eo],t);Qe.messages.clientCutText(e,n,!0)},extendedClipboardRequest(e,t){let n=Qe.messages._buildExtendedClipboardFlags([Ys],t);Qe.messages.clientCutText(e,n,!0)},extendedClipboardCaps(e,t,n){let r=Object.keys(n),i=new Uint8Array(4+4*r.length);r.map(s=>parseInt(s)),r.sort((s,a)=>s-a),i.set(Qe.messages._buildExtendedClipboardFlags(t,[]));let o=4;for(let s=0;s<r.length;s++)i[o]=n[r[s]]>>24,i[o+1]=n[r[s]]>>16,i[o+2]=n[r[s]]>>8,i[o+3]=n[r[s]]>>0,o+=4,i[3]|=1<<r[s];Qe.messages.clientCutText(e,i,!0)},clientCutText(e,t,n=!1){e.sQpush8(6),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0);let r;n?r=gg(-t.length):r=t.length,e.sQpush32(r),e.sQpushBytes(t),e.flush()},setDesktopSize(e,t,n,r,i){e.sQpush8(251),e.sQpush8(0),e.sQpush16(t),e.sQpush16(n),e.sQpush8(1),e.sQpush8(0),e.sQpush32(r),e.sQpush16(0),e.sQpush16(0),e.sQpush16(t),e.sQpush16(n),e.sQpush32(i),e.flush()},clientFence(e,t,n){e.sQpush8(248),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush32(t),e.sQpush8(n.length),e.sQpushString(n),e.flush()},enableContinuousUpdates(e,t,n,r,i,o){e.sQpush8(150),e.sQpush8(t),e.sQpush16(n),e.sQpush16(r),e.sQpush16(i),e.sQpush16(o),e.flush()},pixelFormat(e,t,n){let r;t>16?r=32:t>8?r=16:r=8;let i=Math.floor(t/3);e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.sQpush8(r),e.sQpush8(t),e.sQpush8(0),e.sQpush8(n?1:0),e.sQpush16((1<<i)-1),e.sQpush16((1<<i)-1),e.sQpush16((1<<i)-1),e.sQpush8(i*0),e.sQpush8(i*1),e.sQpush8(i*2),e.sQpush8(0),e.sQpush8(0),e.sQpush8(0),e.flush()},clientEncodings(e,t){e.sQpush8(2),e.sQpush8(0),e.sQpush16(t.length);for(let n=0;n<t.length;n++)e.sQpush32(t[n]);e.flush()},fbUpdateRequest(e,t,n,r,i,o){typeof n>"u"&&(n=0),typeof r>"u"&&(r=0),e.sQpush8(3),e.sQpush8(t?1:0),e.sQpush16(n),e.sQpush16(r),e.sQpush16(i),e.sQpush16(o),e.flush()},xvpOp(e,t,n){e.sQpush8(250),e.sQpush8(0),e.sQpush8(t),e.sQpush8(n),e.flush()}};Qe.cursors={none:{rgbaPixels:new Uint8Array,w:0,h:0,hotx:0,hoty:0},dot:{rgbaPixels:new Uint8Array([255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255]),w:3,h:3,hotx:1,hoty:1}};var Tt="home",to="thread",Ru="desktop",Pu="notifications";function h_(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return Object.keys(t).length===3&&typeof t.threadId=="string"&&/^thr_[a-z0-9]+$/.test(t.threadId)&&typeof t.rootSeq=="number"&&Number.isInteger(t.rootSeq)&&t.rootSeq>=0&&typeof t.rootText=="string"&&t.rootText.length<=600}function Fu(e){return e.experimental_messageSeq}function IS(e,t){let n=Math.floor(Math.max(0,t-e)/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Lu(e,t){let n=e.replies===1?"1 reply":`${e.replies} replies`;return e.replies===0?"Thread started":`${n} \xB7 last ${IS(e.lastActivityAt,t)}`}function m_(e,t){let n=new Set(t.filter(i=>i.running).map(i=>i.threadId));return e===null?{openSidebar:t.length>0,running:n}:{openSidebar:[...n].some(i=>!e.has(i)),running:n}}function g_(e,t){let n=e.outcomes.at(-1);return n?`\u21B3 ${n.text}`:Lu(e,t)}var zu=null,no=null;function x_(e){return no?(no(e),!0):(zu=e,!1)}function __(e){no=e;let t=zu;return zu=null,t&&e(t),()=>{no===e&&(no=null)}}function ea({orbitThread:e,threadId:t,done:n}){let r=G(),[i,o]=w(!1),[s,a]=w(null),c=async()=>{o(!0),a(null);try{await r.call("threads.done",{orbitThread:e,threadId:t})}catch(l){a(l instanceof Error?l.message:"Couldn't save Done. Try again.")}finally{o(!1)}};return g("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[d("button",{type:"button",disabled:i||n,onClick:()=>{c()},"aria-label":"Mark as Done",className:"rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-state-hover hover:text-foreground disabled:opacity-50",children:i?"Saving\u2026":n?"\u2713 Done":"Done"}),s?d("span",{role:"alert",className:"max-w-48 text-xs text-destructive",children:s}):null]})}var M={};St(M,{$brand:()=>qu,$input:()=>kp,$output:()=>wp,INVALID:()=>qe,NEVER:()=>Gu,TimePrecision:()=>Fp,ZodAny:()=>vm,ZodArray:()=>Em,ZodBase64:()=>ql,ZodBase64URL:()=>Yl,ZodBigInt:()=>ui,ZodBigIntFormat:()=>tc,ZodBoolean:()=>ci,ZodCIDRv4:()=>Wl,ZodCIDRv6:()=>Gl,ZodCUID:()=>Bl,ZodCUID2:()=>Zl,ZodCatch:()=>Hm,ZodCodec:()=>Go,ZodCompileAsyncError:()=>vt,ZodCompileUnsupportedError:()=>fe,ZodCreditCard:()=>pm,ZodCustom:()=>qo,ZodCustomStringFormat:()=>er,ZodDate:()=>Uo,ZodDefault:()=>Xm,ZodDiscriminatedUnion:()=>Cm,ZodE164:()=>Jl,ZodEmail:()=>Dl,ZodEmoji:()=>Xl,ZodEnum:()=>si,ZodError:()=>MC,ZodExactOptional:()=>oc,ZodFile:()=>zm,ZodFirstPartyTypeKind:()=>s0,ZodFunction:()=>n0,ZodGUID:()=>Kl,ZodIBAN:()=>hm,ZodIPv4:()=>jl,ZodIPv6:()=>Ql,ZodISODate:()=>pn,ZodISODateTime:()=>fn,ZodISODuration:()=>mn,ZodISOTime:()=>hn,ZodInstanceOf:()=>o0,ZodIntersection:()=>Nm,ZodIssueCode:()=>UC,ZodJWT:()=>ec,ZodKSUID:()=>Hl,ZodLazy:()=>Jm,ZodLiteral:()=>Lm,ZodMAC:()=>fm,ZodMap:()=>Pm,ZodNaN:()=>Qm,ZodNanoID:()=>Ml,ZodNever:()=>km,ZodNonOptional:()=>sc,ZodNull:()=>bm,ZodNullable:()=>Km,ZodNumber:()=>li,ZodNumberFormat:()=>tr,ZodObject:()=>Ho,ZodOptional:()=>Qo,ZodPipe:()=>Wo,ZodPrefault:()=>Bm,ZodPreprocess:()=>Wm,ZodPromise:()=>t0,ZodReadonly:()=>Gm,ZodRealError:()=>at,ZodRecord:()=>oi,ZodSet:()=>Fm,ZodString:()=>ai,ZodStringFormat:()=>ke,ZodSuccess:()=>Vm,ZodSymbol:()=>xm,ZodTemplateLiteral:()=>Ym,ZodTransform:()=>Om,ZodTuple:()=>$m,ZodType:()=>ue,ZodULID:()=>Ul,ZodURL:()=>Zo,ZodUUID:()=>Pt,ZodUndefined:()=>_m,ZodUnion:()=>jo,ZodUnknown:()=>wm,ZodVoid:()=>Sm,ZodXID:()=>Vl,ZodXor:()=>Am,_ZodString:()=>Ol,_default:()=>Mm,_function:()=>By,any:()=>by,array:()=>Vo,base64:()=>Jb,base64url:()=>ey,bigint:()=>hy,boolean:()=>gm,catch:()=>jm,check:()=>Zy,cidrv4:()=>qb,cidrv6:()=>Yb,clone:()=>be,codec:()=>Dy,coerce:()=>l0,compile:()=>Cp,config:()=>Ie,core:()=>Qt,creditCard:()=>ny,cuid:()=>Zb,cuid2:()=>Ub,currencyCode:()=>ly,custom:()=>Uy,date:()=>vy,decode:()=>om,decodeAsync:()=>am,deepPartial:()=>rv,describe:()=>Vy,discriminatedUnion:()=>Cy,e164:()=>ty,email:()=>Pb,emoji:()=>Mb,encode:()=>im,encodeAsync:()=>sm,endsWith:()=>Qr,enum:()=>rc,exactOptional:()=>Dm,file:()=>Fy,flattenError:()=>po,float32:()=>uy,float64:()=>dy,formatError:()=>ho,fromJSONSchema:()=>tv,function:()=>By,getDiscriminatedOption:()=>Gf,getErrorMap:()=>HC,globalRegistry:()=>Xe,gt:()=>It,gte:()=>ut,guid:()=>Fb,hash:()=>cy,hex:()=>ay,hostname:()=>sy,httpUrl:()=>Xb,iban:()=>ry,includes:()=>Hr,input:()=>ov,instanceof:()=>jy,int:()=>Ll,int32:()=>fy,int64:()=>my,intersection:()=>Tm,invertCodec:()=>Ky,ipv4:()=>Qb,ipv6:()=>Gb,iso:()=>Yo,json:()=>Wy,jwt:()=>iy,keyof:()=>wy,ksuid:()=>jb,lazy:()=>e0,length:()=>Wn,literal:()=>Py,locales:()=>Po,looseObject:()=>Ey,looseRecord:()=>Ty,lowercase:()=>Ur,lt:()=>$t,lte:()=>ct,mac:()=>Wb,map:()=>$y,maxLength:()=>Qn,maxSize:()=>ln,memoizer:()=>Ro,meta:()=>Hy,mime:()=>Gr,minLength:()=>jt,minSize:()=>Rt,multipleOf:()=>an,nan:()=>Oy,nanoid:()=>Bb,nativeEnum:()=>Ry,negative:()=>Sl,never:()=>nc,nonnegative:()=>Al,nonoptional:()=>Um,nonpositive:()=>El,normalize:()=>qr,null:()=>ym,nullable:()=>Bo,nullish:()=>Ly,number:()=>mm,object:()=>ky,optional:()=>Yn,output:()=>sv,overwrite:()=>wt,parse:()=>em,parseAsync:()=>tm,partialRecord:()=>Ny,pipe:()=>zl,positive:()=>kl,prefault:()=>Zm,preprocess:()=>Gy,prettifyError:()=>nd,promise:()=>My,properties:()=>Wr,property:()=>Cl,readonly:()=>qm,record:()=>Rm,refine:()=>r0,regex:()=>Zr,regexes:()=>gt,registry:()=>Ya,safeDecode:()=>cm,safeDecodeAsync:()=>dm,safeEncode:()=>lm,safeEncodeAsync:()=>um,safeParse:()=>nm,safeParseAsync:()=>rm,set:()=>Iy,setErrorMap:()=>VC,size:()=>jn,slugify:()=>ti,startsWith:()=>jr,strictObject:()=>Sy,string:()=>Mo,stringFormat:()=>oy,stringbool:()=>Qy,success:()=>zy,superRefine:()=>i0,symbol:()=>xy,templateLiteral:()=>Xy,toJSONSchema:()=>Il,toLowerCase:()=>Jr,toUpperCase:()=>ei,toZod:()=>ro,transform:()=>ic,treeifyError:()=>td,trim:()=>Yr,tuple:()=>Im,uint32:()=>py,uint64:()=>gy,ulid:()=>Vb,undefined:()=>_y,union:()=>di,unknown:()=>qn,uppercase:()=>Vr,url:()=>Kb,util:()=>W,uuid:()=>Lb,uuidv4:()=>zb,uuidv6:()=>Ob,uuidv7:()=>Db,validate:()=>mo,validateAsync:()=>go,void:()=>yy,withParser:()=>Ja,xid:()=>Hb,xor:()=>Ay});var Qt={};St(Qt,{$ZodAny:()=>Bf,$ZodArray:()=>jf,$ZodAsyncError:()=>ot,$ZodBase64:()=>$f,$ZodBase64URL:()=>If,$ZodBigInt:()=>Xa,$ZodBigIntFormat:()=>Df,$ZodBoolean:()=>Ao,$ZodCIDRv4:()=>Nf,$ZodCIDRv6:()=>Tf,$ZodCUID:()=>gf,$ZodCUID2:()=>xf,$ZodCatch:()=>fp,$ZodCheck:()=>Ee,$ZodCheckBigIntFormat:()=>Bd,$ZodCheckEndsWith:()=>ef,$ZodCheckGreaterThan:()=>Sa,$ZodCheckIncludes:()=>Yd,$ZodCheckLengthEquals:()=>Qd,$ZodCheckLessThan:()=>ka,$ZodCheckLowerCase:()=>Gd,$ZodCheckMaxLength:()=>Hd,$ZodCheckMaxSize:()=>Zd,$ZodCheckMimeType:()=>rf,$ZodCheckMinLength:()=>jd,$ZodCheckMinSize:()=>Ud,$ZodCheckMultipleOf:()=>Xd,$ZodCheckNumberFormat:()=>Md,$ZodCheckOverwrite:()=>of,$ZodCheckProperties:()=>nf,$ZodCheckProperty:()=>tf,$ZodCheckRegex:()=>Wd,$ZodCheckSizeEquals:()=>Vd,$ZodCheckStartsWith:()=>Jd,$ZodCheckStringFormat:()=>Kr,$ZodCheckUpperCase:()=>qd,$ZodCodec:()=>No,$ZodCreditCard:()=>Pf,$ZodCustom:()=>bp,$ZodCustomStringFormat:()=>zf,$ZodCyclicError:()=>ja,$ZodDate:()=>Hf,$ZodDefault:()=>lp,$ZodDiscriminatedUnion:()=>qf,$ZodE164:()=>Rf,$ZodEmail:()=>uf,$ZodEmoji:()=>hf,$ZodEncodeError:()=>sn,$ZodEnum:()=>np,$ZodError:()=>ed,$ZodExactOptional:()=>sp,$ZodFile:()=>ip,$ZodFunction:()=>xp,$ZodGUID:()=>lf,$ZodIBAN:()=>Ff,$ZodIPv4:()=>Ef,$ZodIPv6:()=>Af,$ZodISODate:()=>wf,$ZodISODateTime:()=>vf,$ZodISODuration:()=>Sf,$ZodISOTime:()=>kf,$ZodIntersection:()=>Yf,$ZodJWT:()=>Lf,$ZodKSUID:()=>yf,$ZodLazy:()=>To,$ZodLiteral:()=>rp,$ZodMAC:()=>Cf,$ZodMap:()=>ep,$ZodNaN:()=>pp,$ZodNanoID:()=>mf,$ZodNever:()=>Uf,$ZodNonOptional:()=>up,$ZodNull:()=>Mf,$ZodNullable:()=>ap,$ZodNumber:()=>Ka,$ZodNumberFormat:()=>Of,$ZodObject:()=>J_,$ZodObjectJIT:()=>Qf,$ZodOptional:()=>Ba,$ZodPipe:()=>Za,$ZodPrefault:()=>cp,$ZodPreprocess:()=>hp,$ZodPromise:()=>_p,$ZodReadonly:()=>mp,$ZodRealError:()=>st,$ZodRecord:()=>Jf,$ZodRegistry:()=>qa,$ZodSet:()=>tp,$ZodString:()=>Bn,$ZodStringFormat:()=>ye,$ZodSuccess:()=>dp,$ZodSymbol:()=>Kf,$ZodTemplateLiteral:()=>gp,$ZodTransform:()=>op,$ZodTuple:()=>Ma,$ZodType:()=>ie,$ZodULID:()=>_f,$ZodURL:()=>pf,$ZodUUID:()=>cf,$ZodUndefined:()=>Xf,$ZodUnion:()=>Co,$ZodUnknown:()=>Zf,$ZodVoid:()=>Vf,$ZodXID:()=>bf,$ZodXor:()=>Wf,$brand:()=>qu,$constructor:()=>C,$input:()=>kp,$output:()=>wp,Doc:()=>Mn,INVALID:()=>qe,JSONSchema:()=>$b,JSONSchemaGenerator:()=>Rl,NEVER:()=>Gu,TimePrecision:()=>Fp,URL_BAD_FORMAT:()=>df,URL_UNPARSEABLE:()=>vo,ZodCompileAsyncError:()=>vt,ZodCompileUnsupportedError:()=>fe,_any:()=>qp,_array:()=>ih,_base64:()=>bl,_base64url:()=>yl,_bigint:()=>Up,_boolean:()=>Bp,_catch:()=>TC,_check:()=>hb,_cidrv4:()=>xl,_cidrv6:()=>_l,_coercedBigint:()=>Vp,_coercedBoolean:()=>Zp,_coercedDate:()=>nh,_coercedNumber:()=>zp,_coercedString:()=>$p,_creditCard:()=>Rp,_cuid:()=>ul,_cuid2:()=>dl,_custom:()=>sh,_date:()=>th,_decode:()=>fa,_decodeAsync:()=>ha,_default:()=>AC,_discriminatedUnion:()=>hC,_e164:()=>vl,_email:()=>nl,_emoji:()=>ll,_encode:()=>da,_encodeAsync:()=>pa,_endsWith:()=>Qr,_enum:()=>yC,_file:()=>oh,_float32:()=>Dp,_float64:()=>Kp,_gt:()=>It,_gte:()=>ut,_guid:()=>rl,_iban:()=>Pp,_includes:()=>Hr,_int:()=>Op,_int32:()=>Xp,_int64:()=>Hp,_intersection:()=>mC,_ipv4:()=>ml,_ipv6:()=>gl,_isoDate:()=>zo,_isoDateTime:()=>Lo,_isoDuration:()=>Do,_isoTime:()=>Oo,_jwt:()=>wl,_ksuid:()=>hl,_lazy:()=>PC,_length:()=>Wn,_literal:()=>wC,_lowercase:()=>Ur,_lt:()=>$t,_lte:()=>ct,_mac:()=>Ip,_map:()=>_C,_max:()=>ct,_maxLength:()=>Qn,_maxSize:()=>ln,_mime:()=>Gr,_min:()=>ut,_minLength:()=>jt,_minSize:()=>Rt,_multipleOf:()=>an,_nan:()=>rh,_nanoid:()=>cl,_nativeEnum:()=>vC,_negative:()=>Sl,_never:()=>Jp,_nonnegative:()=>Al,_nonoptional:()=>CC,_nonpositive:()=>El,_normalize:()=>qr,_null:()=>Gp,_nullable:()=>EC,_number:()=>Lp,_optional:()=>SC,_overwrite:()=>wt,_parse:()=>Lr,_parseAsync:()=>zr,_pipe:()=>$C,_positive:()=>kl,_promise:()=>FC,_properties:()=>Wr,_property:()=>Cl,_readonly:()=>IC,_record:()=>xC,_refine:()=>ah,_regex:()=>Zr,_safeDecode:()=>ga,_safeDecodeAsync:()=>_a,_safeEncode:()=>ma,_safeEncodeAsync:()=>xa,_safeParse:()=>Or,_safeParseAsync:()=>Dr,_set:()=>bC,_size:()=>jn,_slugify:()=>ti,_startsWith:()=>jr,_string:()=>Tp,_stringFormat:()=>Gn,_stringbool:()=>dh,_success:()=>NC,_superRefine:()=>lh,_symbol:()=>Qp,_templateLiteral:()=>RC,_toLowerCase:()=>Jr,_toUpperCase:()=>ei,_transform:()=>kC,_trim:()=>Yr,_tuple:()=>gC,_uint32:()=>Mp,_uint64:()=>jp,_ulid:()=>fl,_undefined:()=>Wp,_union:()=>fC,_unknown:()=>Yp,_uppercase:()=>Vr,_url:()=>Fo,_uuid:()=>il,_uuidv4:()=>ol,_uuidv6:()=>sl,_uuidv7:()=>al,_void:()=>eh,_xid:()=>pl,_xor:()=>pC,base64Charset:()=>Fa,base64urlCharset:()=>Eo,canParseURL:()=>ff,clone:()=>be,compile:()=>Cp,compileFn:()=>el,config:()=>Ie,createStandardJSONSchemaMethod:()=>ni,createToJSONSchemaMethod:()=>ph,decode:()=>wE,decodeAsync:()=>SE,describe:()=>ch,encode:()=>vE,encodeAsync:()=>kE,extractDefs:()=>un,finalize:()=>dn,flattenError:()=>po,formatError:()=>ho,getDiscriminatedOption:()=>Gf,globalConfig:()=>Oe,globalRegistry:()=>Xe,handleUnrepresentable:()=>Le,initializeContext:()=>cn,isBackEdge:()=>Wa,isRecursiveSchema:()=>Qa,isValidBase64:()=>So,isValidBase64URL:()=>La,isValidCIDRv6:()=>Pa,isValidCreditCard:()=>za,isValidIBAN:()=>Oa,isValidIPv6:()=>ko,isValidJWT:()=>Da,locales:()=>Po,memoizer:()=>Ro,mergeValues:()=>Xr,meta:()=>uh,parse:()=>ca,parseAsync:()=>ua,parseURLObject:()=>G_,prettifyError:()=>nd,process:()=>ve,processSchema:()=>ve,regexes:()=>gt,registry:()=>Ya,safeDecode:()=>AE,safeDecodeAsync:()=>NE,safeEncode:()=>EE,safeEncodeAsync:()=>CE,safeParse:()=>gE,safeParseAsync:()=>xE,standardProps:()=>Ta,stripTabAndNewline:()=>wo,toDotPath:()=>T_,toJSONSchema:()=>Il,toZod:()=>ro,treeifyError:()=>td,urlHostnameOk:()=>Ia,urlProtocolOk:()=>Ra,util:()=>W,validate:()=>mo,validateAsync:()=>go,validateURL:()=>$a,version:()=>sf,withParser:()=>Ja});var W={};St(W,{BIGINT_FORMAT_RANGES:()=>lo,CONSTANT_CATCH:()=>aa,Class:()=>Ku,NUMBER_FORMAT_RANGES:()=>ao,aborted:()=>Ge,allowsEval:()=>Bu,assert:()=>zS,assertEqual:()=>RS,assertIs:()=>FS,assertNever:()=>LS,assertNotEqual:()=>PS,assignProp:()=>Ke,attachSchema:()=>sa,base64ToUint8Array:()=>k_,base64urlToUint8Array:()=>tE,cached:()=>Rr,captureStackTrace:()=>ra,cleanEnum:()=>eE,cleanRegex:()=>Vt,clone:()=>be,cloneDef:()=>KS,codePointLength:()=>Kn,constantCatch:()=>Qu,createTransparentProxy:()=>VS,defineLazy:()=>Xu,defineLazyInternal:()=>de,derived:()=>oE,esc:()=>We,escapeRegex:()=>mt,explicitlyAborted:()=>Vu,extend:()=>QS,finalizeIssue:()=>it,floatSafeRemainder:()=>io,getElementAtPath:()=>XS,getEnumValues:()=>$r,getLengthableOrigin:()=>uo,getParsedType:()=>US,getSizableOrigin:()=>co,hexToUint8Array:()=>rE,hide:()=>fo,installLazyProp:()=>cE,isObject:()=>Dn,isPlainObject:()=>ht,issue:()=>Fr,joinValues:()=>ta,jsonStringifyReplacer:()=>Ir,members:()=>ju,merge:()=>GS,mergeDefs:()=>yt,normalizeParams:()=>B,nullish:()=>na,numKeys:()=>ZS,objectClone:()=>OS,omit:()=>jS,optionalKeys:()=>Uu,own:()=>on,parsedType:()=>Hu,partial:()=>qS,pick:()=>HS,prefixIssues:()=>rt,primitiveTypes:()=>Zu,promiseAllObject:()=>MS,propertyKeyTypes:()=>so,randomString:()=>BS,rawShape:()=>Pr,required:()=>YS,safeExtend:()=>WS,shallowClone:()=>oo,slugify:()=>Mu,stringifyPrimitive:()=>ia,toZod:()=>ro,uint8ArrayToBase64:()=>S_,uint8ArrayToBase64url:()=>nE,uint8ArrayToHex:()=>iE,unwrapMessage:()=>Tr});function RS(e){return e}function PS(e){return e}function ro(){return e=>e}function FS(e){}function LS(e){throw new Error("Unexpected value in exhaustive check")}function zS(e){}function $r(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function ta(e,t="|"){return e.map(n=>ia(n)).join(t)}function Ir(e,t){return typeof t=="bigint"?t.toString():t}var Du=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Rr(e){return new Du(e)}function na(e){return e==null}function Vt(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function io(e,t){let n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var b_=Symbol("evaluating");function Xu(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==b_)return r===void 0&&(r=b_,r=n()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function OS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ke(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ut(e){return Pr(e._zod.def)??e._zod.def.shape}function y_(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Ke(this,t,r),r},enumerable:!0,configurable:!0})}function v_(e,t,n){t in e?Ke(e,t,n):e[t]=n}function On(e,t,n,r){let i=Ut(t);for(let o of n){let s=Object.getOwnPropertyDescriptor(i,o);s.enumerable&&(s.get?y_(e,o,()=>{let a=t._zod.def.shape[o];return r?r(a,o):a}):v_(e,o,r?r(s.value,o):s.value))}}function DS(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?y_(e,n,()=>t[n]):v_(e,n,r.value))}}function yt(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function KS(e){return yt(e._zod.def)}function XS(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function MS(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=r[o];return i})}function BS(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function We(e){return JSON.stringify(e)}function Mu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ra="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Bu=Rr(()=>{if(Oe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ht(e){if(Dn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Dn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oo(e){return ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ZS(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var US=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},so=new Set(["string","number","symbol"]),Zu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function be(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function VS(e){let t;return new Proxy({},{get(n,r,i){return t??(t=e()),Reflect.get(t,r,i)},set(n,r,i,o){return t??(t=e()),Reflect.set(t,r,i,o)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??(t=e()),Reflect.defineProperty(t,r,i)}})}function ia(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Uu(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ao={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function HS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return On(o,e,oa(e,t)),be(e,yt(n,{shape:o,checks:[]}))}function oa(e,t){let n=Ut(e),r=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function jS(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(oa(e,t)),s={};return On(s,e,Reflect.ownKeys(Ut(e)).filter(a=>!o.has(a))),be(e,yt(n,{shape:s,checks:[]}))}function QS(e,t){if(!ht(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=Ut(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return be(e,yt(e._zod.def,{shape:w_(e,t)}))}function w_(e,t){let n={};return On(n,e,Reflect.ownKeys(Ut(e))),DS(n,t),n}function WS(e,t){if(!ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");return be(e,yt(e._zod.def,{shape:w_(e,t)}))}function GS(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};On(n,e,Reflect.ownKeys(Ut(e))),On(n,t,Reflect.ownKeys(Ut(t)));let r=yt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return be(e,r)}function qS(e,t,n,r="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(oa(t,n)):void 0,c={};return On(c,t,Reflect.ownKeys(Ut(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),be(t,yt(t._zod.def,{shape:c,checks:[]}))}function YS(e,t,n){let r=n?new Set(oa(t,n)):void 0,i={};return On(i,t,Reflect.ownKeys(Ut(t)),(o,s)=>r&&!r.has(s)?o:new e({type:"nonoptional",innerType:o})),be(t,yt(t._zod.def,{shape:i}))}function Ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Vu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Tr(e){return typeof e=="string"?e:e?.message}function sa(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function it(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has("$ZodType")&&(i.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Tr(e.inst?._zod.def?.error?.(e))??Tr(o?.(e))??Tr(t?.error?.(e))??Tr(n.customError?.(e))??Tr(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function co(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var JS=/[\uD800-\uDBFF]/;function Kn(e){let t=e.length;if(!JS.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function uo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hu(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Fr(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function eE(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function k_(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function S_(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function tE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return k_(t+n)}function nE(e){return S_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function rE(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function iE(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ku=class{constructor(...t){}};function ju(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):sE(e,n,r.value)}}function on(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function fo(e,t,n){return on(e,t,n,!1)}function oE(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return on(this,n,r(this))},set(i){on(this,n,i)}})}return t}function sE(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:on(this,t,n.bind(this))},set(r){on(this,t,r)}})}function aE(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ou,rn=!1,lE={configurable:!0,get(){rn=!0}};function de(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ou!==e._zod){Ou=void 0;return}Ou=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,lE);let i=rn;rn=!1;try{let o=n(this);return rn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),rn=rn||i,o}catch(o){throw delete this[t],rn=rn||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function cE(e,t,n,r){let i=aE(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:o})}})}var aa="~constantCatch";function Qu(e){let t=()=>e;return t[aa]=!0,t}var E_,Gu=Object.freeze({status:"aborted"}),Wu={value:void 0,enumerable:!1},A_="captureStackTrace"in Error?Error:null;function uE(e){let t=A_;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return A_=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function C(e,t,n,r){let i={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=i;let s=n,a=s&&new WeakSet;function c(p,h){if(p._zod){if(p._zod.traits.has(e))return}else{Wu.value=new o(h);try{Object.defineProperty(p,"_zod",Wu)}finally{Wu.value=void 0}}if(p._zod.traits.add(e),t(p,h),a){let x=Object.getPrototypeOf(p),_=p._zod.constr.prototype,b=x;for(;b&&b!==_;)b=Object.getPrototypeOf(b);let E=b??x;a.has(E)||(a.add(E),ju(E,s))}let m=f.prototype;for(let x in m)Object.prototype.hasOwnProperty.call(m,x)&&(x in p||(p[x]=m[x].bind(p)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function f(p){let h=r?.Parent?uE(u):this;c(h,p);let m=h._zod.deferred;if(m){for(let _ of m)_();h._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(h),h}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var qu=Symbol("zod_brand"),ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},sn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(E_=globalThis).__zod_globalConfig??(E_.__zod_globalConfig={});var Oe=globalThis.__zod_globalConfig;function Ie(e){return e&&Object.assign(Oe,e),Oe}function dE(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ir,2)),e.message}function fE(e){this._zod.message=e}var pE={get:dE,set:fE,enumerable:!0,configurable:!0},Ju={value:void 0,enumerable:!1},C_=new WeakSet([Object.prototype,Error.prototype]),N_=(e,t)=>{e.name="$ZodError",Ju.value=t,Object.defineProperty(e,"issues",Ju),Ju.value=void 0,Object.defineProperty(e,"message",pE);let n=Object.getPrototypeOf(e);C_.has(n)||(C_.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},ed=C("$ZodError",N_),st=C("$ZodError",N_,void 0,{Parent:Error});function hE(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function po(e,t=n=>n.message){let n={},r=[];for(let i of e.issues)i.path.length>0?hE(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ho(e,t=n=>n.message){let n={_errors:[]},r=(i,o=[])=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;for(;l<a.length;){let u=a[l],f=l===a.length-1;if(u==="_errors"){f&&c._errors.push(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[u];f&&p._errors.push(t(s)),c=p,l++}}}};return r(e),n}function td(e,t=n=>n.message){let n={errors:[]},r=(i,o=[])=>{var s;for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0){n.errors.push(t(a));continue}let l=n,u=0;for(;u<c.length;){let f=c[u],p=u===c.length-1;typeof f=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,f)||Object.defineProperty(l.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[f]):(l.items??(l.items=[]),(s=l.items)[f]??(s[f]={errors:[]}),l=l.items[f]),p&&l.errors.push(t(a)),u++}}};return r(e),n}function T_(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function nd(e){let t=[],n=[...e.issues].sort((r,i)=>(r.path??[]).length-(i.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${T_(r.path)}`);return t.join(`
6
6
  `)}function la(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Lr=e=>{let t=(n,r,i,o)=>{let s=i?{...i,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ot;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>it(l,s,Ie())));throw ra(c,o?.callee??t),c}return a.value};return t},ca=Lr(st),zr=e=>{let t=async(n,r,i,o)=>{let s=i?{...i,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>it(l,s,Ie())));throw ra(c,o?.callee??t),c}return a.value};return t},ua=zr(st),Or=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new ot;return o.issues.length?$_(e,o.issues,i):{success:!0,data:o.value}},gE=Or(st);function $_(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(i=>it(i,n,Ie()))),t=void 0,n=void 0),r},set error(i){r=i,t=void 0,n=void 0}}}var Dr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?$_(e,o.issues,i):{success:!0,data:o.value}},xE=Dr(st),_E=Symbol.for("zod.compile.invalid"),bE=Symbol.for("zod.compile.fallback"),mo=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_E)return!0;if(r.definite===!0&&n===void 0)return!1}return yE(e,t,n)});function yE(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,o;if(i?(r[bE]=!0,o=i({value:t,issues:[]},r)):o=e._zod.run({value:t,issues:[]},r),o instanceof Promise)throw new ot;return o.issues.length===0}var go=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},da=e=>{let t=Lr(e),n=(r,i,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(r,i,a,la(n,s))};return n},vE=da(st),fa=e=>{let t=Lr(e),n=(r,i,o,s)=>t(r,i,o,la(n,s));return n},wE=fa(st),pa=e=>{let t=zr(e),n=async(r,i,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(r,i,a,la(n,s))};return n},kE=pa(st),ha=e=>{let t=zr(e),n=async(r,i,o,s)=>await t(r,i,o,la(n,s));return n},SE=ha(st),ma=e=>(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Or(e)(t,n,i)},EE=ma(st),ga=e=>(t,n,r)=>Or(e)(t,n,r),AE=ga(st),xa=e=>async(t,n,r)=>{let i=r?{...r,direction:"backward"}:{direction:"backward"};return Dr(e)(t,n,i)},CE=xa(st),_a=e=>async(t,n,r)=>Dr(e)(t,n,r),NE=_a(st);var gt={};St(gt,{anyString:()=>Td,base64:()=>yd,base64url:()=>vd,bigint:()=>Id,boolean:()=>Rd,browserEmail:()=>zE,cidrv4:()=>_d,cidrv6:()=>bd,creditCard:()=>ba,cuid:()=>id,cuid2:()=>od,currencyCode:()=>Ed,date:()=>Ad,datetime:()=>Nd,domain:()=>kd,duration:()=>dd,e164:()=>Sd,email:()=>pd,emoji:()=>hd,extendedDuration:()=>TE,guid:()=>fd,hex:()=>Od,hostname:()=>wd,html5Email:()=>PE,httpProtocol:()=>xo,iban:()=>ya,idnEmail:()=>LE,integer:()=>_o,ipv4:()=>md,ipv6:()=>gd,ksuid:()=>ld,lowercase:()=>Ld,mac:()=>xd,md5_base64:()=>XE,md5_base64url:()=>ME,md5_hex:()=>KE,nanoid:()=>cd,nanoidOfLength:()=>ud,null:()=>Pd,number:()=>Ht,rfc5322Email:()=>FE,sha1_base64:()=>ZE,sha1_base64url:()=>UE,sha1_hex:()=>BE,sha256_base64:()=>HE,sha256_base64url:()=>jE,sha256_hex:()=>VE,sha384_base64:()=>WE,sha384_base64url:()=>GE,sha384_hex:()=>QE,sha512_base64:()=>YE,sha512_base64url:()=>JE,sha512_hex:()=>qE,string:()=>$d,time:()=>Cd,ulid:()=>sd,undefined:()=>Fd,unicodeEmail:()=>I_,uppercase:()=>zd,uuid:()=>Xn,uuid4:()=>$E,uuid6:()=>IE,uuid7:()=>RE,xid:()=>ad});var id=/^[cC][0-9a-z]{6,}$/,od=/^[0-9a-z]+$/,sd=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ad=/^[0-9a-vA-V]{20}$/,ld=/^[A-Za-z0-9]{27}$/,cd=/^[a-zA-Z0-9_-]{21}$/;function ud(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var dd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,TE=/^[-+]?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)?)??$/,fd=/^([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})$/,Xn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$E=Xn(4),IE=Xn(6),RE=Xn(7),pd=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,PE=/^[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])?)*$/,FE=/^(([^<>()\[\]\\.,;:\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,}))$/,I_=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,LE=I_,zE=/^[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])?)*$/,OE="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function hd(){return new RegExp(OE,"u")}var md=/^(?:(?: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])$/,gd=/^(([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}|:))$/,xd=e=>{let t=mt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},_d=/^((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])$/,bd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vd=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,wd=/^(?=.{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])?)*\.?$/,kd=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,xo=/^https?$/,Sd=/^\+[1-9]\d{6,14}$/,ba=/^\d(?:[ -]?\d){11,18}$/,Ed=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,ya=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,R_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function DE(e){return new RegExp(`^${e}$`)}var Ad=DE(R_);function rd(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cd(e){return new RegExp(`^${rd(e)}$`)}function Nd(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${rd({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${rd({precision:e.precision})}`:n;return new RegExp(`^${R_}T(?:${r})$`)}var Td=/^[\s\S]{0,}$/,$d=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Id=/^-?\d+n?$/,_o=/^-?\d+$/,Ht=/^-?\d+(?:\.\d+)?$/,Rd=/^(?:true|false)$/i,Pd=/^null$/i;var Fd=/^undefined$/i;var Ld=/^[^A-Z]*$/,zd=/^[^a-z]*$/,Od=/^[0-9a-fA-F]*$/;function bo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function yo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var KE=/^[0-9a-fA-F]{32}$/,XE=bo(22,"=="),ME=yo(22),BE=/^[0-9a-fA-F]{40}$/,ZE=bo(27,"="),UE=yo(27),VE=/^[0-9a-fA-F]{64}$/,HE=bo(43,"="),jE=yo(43),QE=/^[0-9a-fA-F]{96}$/,WE=bo(64,""),GE=yo(64),qE=/^[0-9a-fA-F]{128}$/,YE=bo(86,"=="),JE=yo(86);var Ee=C("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Dd=e=>{let t=e.value;return!na(t)&&t.size!==void 0},Kd=e=>{let t=e.value;return!na(t)&&t.length!==void 0},va={number:"number",bigint:"bigint",object:"date"},ka=C("$ZodCheckLessThan",(e,t)=>{Ee.init(e,t);let n=va[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:va[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sa=C("$ZodCheckGreaterThan",(e,t)=>{Ee.init(e,t);let n=va[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:va[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xd=C("$ZodCheckMultipleOf",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):io(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Md=C("$ZodCheckNumberFormat",(e,t)=>{Ee.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=ao[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Bd=C("$ZodCheckBigIntFormat",(e,t)=>{Ee.init(e,t);let[n,r]=lo[t.format];e._zod.check=i=>{let o=i.value;o<n&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>r&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Zd=C("$ZodCheckMaxSize",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Dd),e._zod.check=r=>{let i=r.value;i.size<=t.maximum||r.issues.push({origin:co(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ud=C("$ZodCheckMinSize",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Dd),e._zod.check=r=>{let i=r.value;i.size>=t.minimum||r.issues.push({origin:co(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Vd=C("$ZodCheckSizeEquals",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Dd),e._zod.check=r=>{let i=r.value,o=i.size;if(o===t.size)return;let s=o>t.size;r.issues.push({origin:co(i),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Hd=C("$ZodCheckMaxLength",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Kd),e._zod.check=r=>{let i=r.value,o=i.length;if((typeof i=="string"&&o>t.maximum?Kn(i):o)<=t.maximum)return;let a=uo(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),jd=C("$ZodCheckMinLength",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Kd),e._zod.check=r=>{let i=r.value,o=i.length;if((typeof i=="string"&&o>=t.minimum&&o<t.minimum*2?Kn(i):o)>=t.minimum)return;let a=uo(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Qd=C("$ZodCheckLengthEquals",(e,t)=>{var n;Ee.init(e,t),(n=e._zod.def).when??(n.when=Kd),e._zod.check=r=>{let i=r.value,o=i.length,s=typeof i=="string"&&o>=t.length&&o<=t.length*2?Kn(i):o;if(s===t.length)return;let a=uo(i),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Kr=C("$ZodCheckStringFormat",(e,t)=>{var n,r;Ee.init(e,t),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Wd=C("$ZodCheckRegex",(e,t)=>{Kr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Gd=C("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ld),Kr.init(e,t)}),qd=C("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zd),Kr.init(e,t)}),Yd=C("$ZodCheckIncludes",(e,t)=>{Ee.init(e,t);let n=mt(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Jd=C("$ZodCheckStartsWith",(e,t)=>{Ee.init(e,t);let n=new RegExp(`^${mt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ef=C("$ZodCheckEndsWith",(e,t)=>{Ee.init(e,t);let n=new RegExp(`.*${mt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function wa(e,t,n){e.issues.length&&t.issues.push(...rt(n,e.issues))}var tf=C("$ZodCheckProperty",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(i=>wa(i,n,t.property));wa(r,n,t.property)}}),nf=C("$ZodCheckProperties",(e,t)=>{Ee.init(e,t),fo(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let i=r.value,o;for(let[s,a]of n){let c=a._zod.run({value:i[s],issues:[]},{});c instanceof Promise?(o??(o=[]),o.push(c.then(l=>wa(l,r,s)))):wa(c,r,s)}if(o)return Promise.all(o).then(()=>{})}}),rf=C("$ZodCheckMimeType",(e,t)=>{Ee.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),of=C("$ZodCheckOverwrite",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Mn=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
7
7
  `).filter(s=>s),i=Math.min(...r.map(s=>s.length-s.trimStart().length)),o=r.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
8
8
  ${n.join(`
@@ -69,7 +69,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
69
69
  `);return`${r}{display:none!important}
70
70
  ${i}{height:1px!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important;overflow:hidden!important}
71
71
  ${o}{display:none!important}`}function _0({threadId:e}){let{hideIds:t,hide:n,stale:r}=x0(e);return n&&!r&&t.length>0?d("style",{children:y2(t)}):null}var lc=new Map,h0=new Set,v2=e=>(h0.add(e),()=>{h0.delete(e)}),m0=e=>Math.max(e.time,e.replyAt??e.time,...e.parts.map(t=>t.time??e.time));function b0(e){let{items:t,seenAt:n,lang:r}=x0(e),i=fs(v2,()=>(e?lc.get(e):void 0)??0);if(!e||!t.length||!r)return null;let o=u0[r],s=Math.max(n??1/0,i),a=t.filter(c=>m0(c)>s).length;return{title:o.title,label:o.button(a?o.fresh(a):t.length),fresh:a}}var w2=e=>{if(!e)return n=>n;let t=new RegExp(`(^|\\n)[ \\t]*${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}[ \\t]*`,"g");return n=>n.replace(t,"$1")},ac=e=>e.kind==="done"?"done":["interrupted","failed","attention"].includes(e.kind)?"attention":"info",y0=e=>e==="done"?"ok":e==="failed"?"bad":e==="interrupted"||e==="attention"?"warn":"plain",k2={ok:"m7 12.5 3.5 3.5L17 9",warn:"M12 6v8m0 3.5v.5",bad:"m7.5 7.5 9 9m0-9-9 9",plain:"M12 11.5v1"},S2={message:"M6 7h12v8h-6l-3 3v-3H6z",notify:"M6 7h12v8h-6l-3 3v-3H6z",digest:"M7 8h10M7 12h10M7 16h6",reply:"m10 8-4 4 4 4M6 12h8a4 4 0 0 1 4 4v1"},E2=["all","done","attention","info"],A2=(e,t)=>{let n=new Date,r=e.toLocaleDateString(t.locale,{day:"numeric",month:"long"});return e.toDateString()===n.toDateString()?`${t.today}, ${r}`:(n.setDate(n.getDate()-1),e.toDateString()===n.toDateString()?`${t.yesterday}, ${r}`:r)};function pv({text:e}){let t=le(null),n=le(null),[r,i]=w(null),[o,s]=w(!1);return V(()=>{let a=t.current;if(!a||r!==null)return;let c=a.parentElement;for(;c&&!/auto|scroll/.test(getComputedStyle(c).overflowY);)c=c.parentElement;let l=new IntersectionObserver(u=>{u.some(f=>f.isIntersecting)&&s(!0)},{root:c,rootMargin:"600px 0px"});return l.observe(a),()=>l.disconnect()},[r]),V(()=>{let a=n.current;if(!a)return;let c=0,l=()=>{window.clearTimeout(c),c=window.setTimeout(()=>{let f=a.innerText.replace(/\s+/g," ").trim();f&&i(f)},120)};l();let u=new MutationObserver(l);return u.observe(a,{childList:!0,subtree:!0,characterData:!0}),()=>{u.disconnect(),window.clearTimeout(c)}},[o]),g(he,{children:[d("div",{className:"nf-snippet",ref:t,"data-plain":r!==null||void 0,children:r??e.replace(/\s+/g," ").trim()}),o&&r===null&&d("div",{className:"nf-probe","aria-hidden":"true",inert:!0,ref:n,children:d(Kt,{content:e})})]})}function C2({item:e,fresh:t,t:n,textOf:r}){let{toThread:i}=Et(),[o,s]=w(!1),a=y0(e.kind),c=e.kind==="notify"?e.sender:v0(e.kind,n),l=new Date(e.time),u=r(e.text),f=r(e.reply),p=e.senderThreadId;return g("article",{className:`nf-card nf-${a}`,"data-open":o||void 0,children:[d("span",{className:"nf-marker","aria-hidden":"true",children:d("svg",{viewBox:"0 0 24 24",children:d("path",{d:S2[e.kind]??k2[a]})})}),g("div",{className:"nf-sum",role:"button",tabIndex:0,"aria-expanded":o,onClick:()=>s(!o),onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),s(!o))},children:[g("div",{className:"nf-head",children:[t&&d("i",{className:"nf-new",role:"img","aria-label":n.isNew,title:n.isNew}),d("time",{dateTime:l.toISOString(),title:l.toLocaleString(n.locale,{dateStyle:"long",timeStyle:"short"}),children:l.toLocaleTimeString(n.locale,{hour:"2-digit",minute:"2-digit"})}),d("b",{className:"nf-kind",children:c}),p?d("button",{type:"button",className:"nf-source",title:e.senderTitle||e.sender,onClick:h=>{h.stopPropagation(),i(p)},children:d(eg,{threadId:p})}):d("span",{className:"nf-source",title:e.sender}),g("span",{className:"nf-tail",children:[(f||e.parts.some(h=>h.kind==="reply"))&&d("span",{className:"nf-reply-tag",title:n.hasReply,children:n.replyTag}),d("span",{className:"nf-expand",children:o?n.less:n.more})]})]}),!o&&d(pv,{text:u},u)]}),o&&g("div",{className:"nf-body",children:[d(Kt,{content:u}),e.parts.map((h,m)=>h.kind==="message"?g("div",{className:"nf-reply nf-message",children:[d("b",{children:n.threadMessage}),d(Kt,{content:r(h.text)})]},m):g("div",{className:"nf-reply",children:[d("b",{children:n.agentReply}),d(Kt,{content:r(h.text)})]},m)),f&&g("div",{className:"nf-reply",children:[d("b",{children:n.agentReply}),d(Kt,{content:f})]})]})]})}var N2=e=>{let t=new Map;for(let n of e){let r=n.senderThreadId??`name:${n.sender}`,i=t.get(r);i?i.items.push(n):t.set(r,{key:r,threadId:n.senderThreadId??null,name:n.senderTitle||n.sender,items:[n]})}return[...t.values()]},hv=(e,t,n)=>{let r=[];for(let o of[...e.items].reverse())o.parts.forEach((s,a)=>r.push({id:`${o.id}:${a}`,time:s.time??o.time,who:s.kind==="message"?"thread":"agent",text:s.text})),r.push({id:o.id,time:o.time,who:o.kind==="message"||o.kind==="notify"?"thread":o.kind==="reply"?"agent":"state",kind:o.kind,text:o.text}),o.reply&&r.push({id:`${o.id}:reply`,time:o.replyAt??o.time,who:"agent",text:o.reply});let i=new Set(r.map(o=>o.id));for(let o of t)i.has(o.id)||r.push({...o,who:"agent"});for(let o of n)o.to===e.threadId&&r.push({id:o.id,time:o.time,who:"you",text:o.text});return r.map((o,s)=>({entry:o,index:s})).sort((o,s)=>o.entry.time-s.entry.time||o.index-s.index).map(({entry:o})=>o)},v0=(e,t)=>t.kinds[e]??e.charAt(0).toUpperCase()+e.slice(1),mv=(e,t)=>{let n=e.toLocaleTimeString(t.locale,{hour:"2-digit",minute:"2-digit"});return e.toDateString()===new Date().toDateString()?n:`${e.toLocaleDateString(t.locale,{day:"numeric",month:"short"})} ${n}`},uv=e=>{let t=e;return t?.name==="BbHttpError"&&typeof t.status=="number"&&typeof t.body=="object"&&t.body!==null},T2=1500,dv=e=>(e instanceof Error?e.message:String(e)).replace(/[.\s]+$/,"").slice(0,200);function $2({group:e,count:t,t:n,textOf:r,onOpen:i}){let o=e.items[0],s=new Date(o.time),a=r(o.text);return g("div",{className:`nf-trow nf-${y0(o.kind)}`,role:"button",tabIndex:0,onClick:i,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),i())},children:[d("i",{className:"nf-dot","aria-hidden":"true"}),g("div",{className:"nf-trow-main",children:[d("b",{title:e.name,children:e.name}),g("div",{className:"nf-trow-last",children:[d("time",{dateTime:s.toISOString(),children:mv(s,n)}),o.kind!=="notify"&&d("span",{children:v0(o.kind,n)}),d(pv,{text:a},a)]})]}),d("span",{className:"nf-count",title:n.entries(t),children:t})]})}function I2({threadId:e,peerId:t,title:n,t:r,onSent:i}){let o=Gt(),s=cc(),[a,c]=w(""),[l,u]=w(!1),[f,p]=w(!1),[h,m]=w(""),x=a.trim().length,_=x>2e4?r.tooLong(x,2e4):h,b=async()=>{let E=a.trim();if(!E||f||E.length>2e4)return;p(!0),m("");let N=(A,$)=>o.threads.send({threadId:A,mode:"auto",input:[{type:"text",text:$,mentions:[]}]}),v=Date.now(),k=null;if(await N(t,E).catch(A=>{k=A??new Error("unknown")}),k&&!uv(k)){if(await new Promise($=>setTimeout($,T2)),!await s("delivered",{threadId:e,peerId:t,text:E,since:v}).then($=>$.found).catch(()=>!1)){m(r.maybeSent),p(!1);return}k=null}if(k){m(r.sendFailed(dv(k))),p(!1);return}i({id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,to:t,text:E,time:Date.now()}),c(""),l&&await N(e,`[notify:You]
72
- ${r.noteText(n,E)}`).catch(A=>m(uv(A)?r.noteFailed(dv(A)):r.noteUnknown)),p(!1)};return g("form",{className:"nf-form",onSubmit:E=>{E.preventDefault(),b()},children:[g("div",{className:"nf-send",children:[d("textarea",{rows:1,value:a,readOnly:f,"aria-label":r.replyLabel,placeholder:r.replyPlaceholder,"aria-invalid":!!_||void 0,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),b())}}),d("button",{type:"submit",disabled:f||!x||x>2e4,"aria-busy":f||void 0,children:f?r.sending:r.send})]}),_&&d("p",{className:"nf-error",role:"alert",children:_}),g("label",{className:"nf-note",children:[d("input",{type:"checkbox",checked:l,onChange:E=>u(E.target.checked)}),d("span",{children:r.noteLabel})]}),d("p",{className:"nf-hint",children:r.noteHint})]})}function R2({threadId:e,group:t,closed:n,sent:r,shown:i,tick:o,t:s,textOf:a,onSent:c,onBack:l}){let u=cc(),f=t.threadId,[p,h]=w({ok:!0,out:[]});V(()=>{if(!f||!i)return;let x=!0;return u("talk",{threadId:e,peerId:f}).then(_=>{x&&h(_)}).catch(()=>{x&&h(_=>({..._,ok:!1}))}),()=>{x=!1}},[u,e,f,i,o]);let m=hv(t,p.out,r);return g(he,{children:[g("header",{className:"nf-bar",children:[d("button",{type:"button",onClick:l,children:`\u2190 ${s.back}`}),d("b",{title:t.name,children:t.name})]}),d("div",{className:"nf-scroll",children:d("div",{className:"nf-talk",children:m.map(x=>{let _=new Date(x.time),b=x.who==="state"?v0(x.kind??"",s):x.who==="you"?s.you:x.who==="agent"?s.agent:f?s.thread:t.name;return g("div",{className:`nf-msg nf-${x.who==="state"?y0(x.kind??""):"plain"}`,"data-who":x.who,children:[g("div",{className:"nf-msg-head",children:[d("b",{children:b}),d("time",{dateTime:_.toISOString(),children:mv(_,s)})]}),d(Kt,{content:a(x.text)})]},x.id)})})}),!p.ok&&d("p",{className:"nf-hint",children:s.outFailed}),d("div",{className:"nf-foot",children:f&&!n?d(I2,{threadId:e,peerId:f,title:t.name,t:s,onSent:c}):d("p",{className:"nf-hint",children:f?s.closed[n??"gone"]:s.closed.none})})]})}function w0({threadId:e}){return d(P2,{threadId:e},e)}function P2({threadId:e}){let t=cc(),n=x0(e),{items:r,seenAt:i,lang:o,marker:s=""}=n,a=ft(()=>w2(s),[s]),[c,l]=w("all"),u=le(null),[f,p]=w(!1);V(()=>{let U=u.current;if(!U)return;let ge=new IntersectionObserver(et=>p(et[et.length-1].isIntersecting));return ge.observe(U),()=>ge.disconnect()},[]);let[h,m]=w(null),x=r.reduce((U,ge)=>Math.max(U,m0(ge)),0);V(()=>{if(!f){m(null);return}if(i===void 0)return;let U=Math.max(i,lc.get(e)??0);m(ge=>ge??U),!(x<=i)&&(lc.set(e,Math.max(x,lc.get(e)??0)),h0.forEach(ge=>ge()),t("seen",{threadId:e,at:x}).catch(()=>{}))},[t,e,f,n]);let[_,b]=w(null),E=_??n.view??"time",[N,v]=w(null),[k,A]=w([]),$=ft(()=>c0([...n.sent??[],...k]),[n.sent,k]),Z=le(new Set);if(V(()=>{for(let U of k)Z.current.has(U.id)||n.sent?.some(ge=>ge.id===U.id)||t("sent",{threadId:e,...U}).then(()=>{Z.current.add(U.id)}).catch(()=>{})},[t,e,n,k]),!o)return d("div",{className:"nf-panel",ref:u});let K=u0[o];if(!r.length)return d("div",{className:"nf-panel",ref:u,children:d("p",{className:"nf-empty",children:K.empty})});let X=N2(r),Y=E==="threads"?X.find(U=>U.key===N):void 0;if(Y)return d("div",{className:"nf-panel nf-chat",ref:u,children:d(R2,{threadId:e,group:Y,closed:Y.threadId?n.closed?.[Y.threadId]:void 0,sent:$,shown:f,tick:n,t:K,textOf:a,onSent:U=>A(ge=>c0([...ge,{...U,time:Math.max(U.time,($.at(-1)?.time??0)+1)}])),onBack:()=>v(null)},Y.key)});let se=r.filter(U=>c==="all"||ac(U)===c),ce=X.filter(U=>c==="all"||ac(U.items[0])===c),we=U=>E==="threads"?U==="all"?X.length:X.filter(ge=>ac(ge.items[0])===U).length:U==="all"?r.length:r.filter(ge=>ac(ge)===U).length,ee=new Map;for(let U of se){let ge=new Date(U.time).toDateString();ee.set(ge,[...ee.get(ge)??[],U])}let q=U=>{b(U),v(null),t("view",{threadId:e,view:U}).catch(()=>{})};return g("div",{className:"nf-panel",ref:u,children:[g("header",{className:"nf-top",children:[d("nav",{"aria-label":K.filtersLabel,children:E2.map(U=>g("button",{type:"button","aria-pressed":c===U,onClick:()=>l(U),children:[K.filters[U]," ",d("b",{children:we(U)})]},U))}),d("div",{className:"nf-views",role:"group","aria-label":K.viewsLabel,children:["time","threads"].map(U=>d("button",{type:"button","aria-pressed":E===U,onClick:()=>q(U),children:K.views[U]},U))})]}),E==="threads"?g(he,{children:[!ce.length&&d("p",{className:"nf-empty",children:K.emptyThreads}),d("div",{className:"nf-threads",children:ce.map(U=>d($2,{group:U,count:hv(U,[],$).length,t:K,textOf:a,onOpen:()=>v(U.key)},U.key))})]}):g(he,{children:[!se.length&&d("p",{className:"nf-empty",children:K.emptyFilter}),[...ee].map(([U,ge])=>g("section",{className:"nf-day",children:[g("h2",{children:[d("span",{children:A2(new Date(ge[0].time),K)}),d("small",{children:ge.length})]}),d("div",{className:"nf-stream",children:ge.map(et=>d(C2,{item:et,fresh:h!==null&&m0(et)>h,t:K,textOf:a},et.id))})]},U))]})]})}function uc({children:e}){let t=Gt(),n=ft(()=>(async(r,i)=>t.plugins.callRpc({pluginId:lv,method:r,input:i,outputSchema:cv[r].output})),[t]);return d(g0.Provider,{value:n,children:e})}var F2={id:to,context:{kind:"nav-panel",panelId:Tt},availability:"action"};function L2(e){let t=e.replace(/\s+/g," ").trim();return t.length>32?`${t.slice(0,31)}\u2026`:t||"Thread"}function dc(){let e=G(),[t,n]=w(void 0),[r,i]=w(0);return Te("config",ae(()=>i(o=>o+1),[])),V(()=>{let o=!0;return e.call("threads.home",null).then(({orbitThread:s})=>{o&&n(s)},()=>{o&&n(s=>s??null)}),()=>{o=!1}},[e,r]),t}function fc(){let e=G(),[t,n]=w(void 0),[r,i]=w(null),[o,s]=w(0),a=ae(()=>s(c=>c+1),[]);return Te("threads",a),Te("config",a),V(()=>{let c=!0;return(async()=>{try{let{orbitThread:l}=await e.call("threads.home",null);if(!c)return;if(n(l),!l)return i([]);let u=await e.call("threads.list",{orbitThread:l});c&&i(u.threads)}catch{c&&(n(l=>l??null),i(l=>l??[]))}})(),()=>{c=!1}},[e,o]),{orbit:t,threads:r}}function z2({thread:e,now:t,onOpen:n}){let[r,i]=w(null),o=async()=>{i(null);try{await n()}catch(a){i(a instanceof Error?a.message:"Couldn't open the thread. Try again.")}},s=e.outcomes.slice(-3);return g("div",{className:"flex min-w-0 flex-col gap-0.5 text-sm",children:[s.map(a=>g("button",{type:"button",onClick:()=>{o()},className:"min-w-0 truncate text-left text-foreground",children:["\u21B3 ",a.text]},a.at)),d("button",{type:"button",onClick:()=>{o()},className:"text-left text-muted-foreground hover:text-foreground",children:Lu(e,t)}),r?d("span",{role:"alert",className:"text-xs text-destructive",children:r}):null]})}function O2(e){let t=ig(),n=le(null),{setOpen:r,isCompactViewport:i}=t;V(()=>{if(e===null)return;let{open:o,running:s}=m_(n.current,e);n.current=s,o!==null&&!i&&r(o)},[i,r,e])}function xv(e){let t=G(),n=rg(),{orbit:r,threads:i}=fc(),o=ft(()=>i??[],[i]);O2(i);let[s,a]=w(()=>Date.now());V(()=>{let h=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(h)},[]);let c=ft(()=>new Map(o.map(h=>[h.rootSeq,h])),[o]),l=ae((h,m,x)=>n.experimental_openTab({surface:{kind:"current"},tab:F2,params:{threadId:h,rootSeq:m,rootText:x.slice(0,600)},title:L2(x)}),[n]);V(()=>__(h=>l(h.threadId,h.rootSeq,h.rootText)),[l]);let u=ae(async h=>{if(!r)return;let m=Fu(h),{threadId:x}=await t.call("threads.open",{orbitThread:r,rootSeq:m,forkAt:h.sourceSeqEnd,rootText:h.text});l(x,m,h.text)},[r,t,l]),f=ft(()=>[{id:"reply-in-thread",title:"Reply in thread",icon:"MessageCirclePlus",run:u}],[u]),p=ae(h=>{let m=Fu(h),x=c.get(m);return x?d(z2,{thread:x,now:s,onOpen:()=>u(h)}):null},[c,s,u]);return r===void 0?null:r===null?g("div",{className:"mx-auto flex max-w-[560px] flex-col gap-4 p-8 text-sm text-muted-foreground",children:[d("p",{children:"There's no conversation with your moonlet yet. It starts once your moonlet has a machine to run on and its setup is finished."}),d(D2,{})]}):d(uc,{children:d("div",{className:"flex h-full min-h-0 flex-col",children:g("div",{className:"relative min-h-0 flex-1",children:[d(_0,{threadId:r}),d(Lc,{experimental_sendMode:"steer-if-active",threadId:r,variant:"full",messageActions:f,experimental_messageFooter:p})]})})})}function _v({params:e}){let{orbit:t,threads:n}=fc();if(!h_(e))return d("div",{className:"p-4 text-sm text-muted-foreground",children:"This thread can't be shown. Open it again from its message."});let{threadId:r,rootText:i}=e;return g("div",{className:"flex h-full min-h-0 flex-col",children:[t?d("div",{className:"flex justify-end border-b border-border px-2 py-1",children:d(ea,{orbitThread:t,threadId:r,done:n?.find(o=>o.threadId===r)?.done??!1})}):null,d(Lc,{threadId:r,variant:"full",experimental_sendMode:"steer-if-active",leadingContent:d(Kt,{className:"mb-4 px-2",content:i.length>=600?`${i}\u2026`:i})},r)]})}function D2(){let e=G(),[t,n]=w(!1),[r,i]=w(null);return g("div",{className:"flex flex-col gap-1",children:[d("div",{children:d("button",{type:"button",className:"underline disabled:opacity-60",disabled:t,onClick:()=>{n(!0),i(null),e.call("welcome.reopen",null).then(()=>n(!1),o=>{i(o instanceof Error?o.message:String(o)),n(!1)})},children:t?"Opening setup\u2026":"Finish setting up"})}),r&&d("p",{role:"alert",className:"text-destructive",children:r})]})}function k0({threadId:e}){let t=G(),n=le(null),r=le(null),[i,o]=w(null),[s,a]=w("Connecting\u2026"),[c,l]=w(!1),[u,f]=w(0);return V(()=>{t.call("desktop.station",{threadId:e}).then(o,p=>a(p instanceof Error?p.message:String(p)))},[t,e,u]),V(()=>{if(!i?.station||!n.current)return;let p=`${location.origin.replace(/^http/,"ws")}/api/v1/plugins/orbit/http/desktop?station=${encodeURIComponent(i.station)}`,h=new Qe(n.current,p,{shared:!0});return h.viewOnly=!0,h.scaleViewport=!0,h.resizeSession=!1,h.background="transparent",h.addEventListener("connect",()=>a("")),h.addEventListener("disconnect",m=>{let x=m.detail?.clean;a(x?"Disconnected.":`Couldn't reach ${i.station}'s desktop.`)}),r.current=h,l(!1),()=>{h.disconnect(),r.current=null}},[i,u]),V(()=>{r.current&&(r.current.viewOnly=!c)},[c]),i&&!i.station?d("p",{className:"p-3 text-sm text-muted-foreground",children:"The desktop is your moonlet's own computer, where its conversation and the work it starts run."}):g("div",{className:"flex h-full flex-col",children:[g("div",{className:"flex items-center gap-2 border-b px-3 py-2 text-xs",children:[d("span",{className:"font-medium",children:i?.station??"\u2026"}),d("span",{className:"flex-1 text-muted-foreground",children:s||(c?"You're in control: clicks and keys go to the desktop.":"Watching.")}),s?d(I,{size:"sm",variant:"secondary",onClick:()=>f(p=>p+1),children:"Retry"}):d(I,{size:"sm",variant:c?"destructive":"default",onClick:()=>l(p=>!p),children:c?"Give back control":"Take control"})]}),d("div",{ref:n,className:"min-h-0 flex-1 bg-black"})]})}function bv(e){let t=dc();return t===void 0?null:t===null?d("p",{className:"p-3 text-sm text-muted-foreground",children:"There's no conversation with your moonlet yet, so there's no desktop to show."}):d(k0,{threadId:t},t)}var S0="default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' blob: data: https://cdn.jsdelivr.net https://esm.sh https://unpkg.com; style-src 'unsafe-inline' blob: data: https://cdn.jsdelivr.net https://esm.sh https://unpkg.com; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",rr=`<!doctype html><html><head><meta charset="utf-8"><meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="${S0}">`,K2=["<meta","<link","<base","<iframe","<frame","<object","<embed","<form","<portal"];function yv(e,t){if(new TextEncoder().encode(t).length>524288)return`a page is at most ${524288/1024} KiB`;if(e==="html"){if(!t.startsWith(rr))return"this HTML page doesn't start with the Content Security Policy every page starts with, so it isn't shown";let n=t.slice(rr.length).toLowerCase(),r=K2.find(i=>n.includes(i));return r?`this HTML page has a ${r}\u2026> tag after its head, so it isn't shown`:null}return t.includes("![")?"this Markdown page has an image, so it isn't shown":/<[A-Za-z/!?]/.test(t)?"this Markdown page has raw HTML, so it isn't shown":null}var X2=500,VL=`set -u
72
+ ${r.noteText(n,E)}`).catch(A=>m(uv(A)?r.noteFailed(dv(A)):r.noteUnknown)),p(!1)};return g("form",{className:"nf-form",onSubmit:E=>{E.preventDefault(),b()},children:[g("div",{className:"nf-send",children:[d("textarea",{rows:1,value:a,readOnly:f,"aria-label":r.replyLabel,placeholder:r.replyPlaceholder,"aria-invalid":!!_||void 0,onChange:E=>c(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),b())}}),d("button",{type:"submit",disabled:f||!x||x>2e4,"aria-busy":f||void 0,children:f?r.sending:r.send})]}),_&&d("p",{className:"nf-error",role:"alert",children:_}),g("label",{className:"nf-note",children:[d("input",{type:"checkbox",checked:l,onChange:E=>u(E.target.checked)}),d("span",{children:r.noteLabel})]}),d("p",{className:"nf-hint",children:r.noteHint})]})}function R2({threadId:e,group:t,closed:n,sent:r,shown:i,tick:o,t:s,textOf:a,onSent:c,onBack:l}){let u=cc(),f=t.threadId,[p,h]=w({ok:!0,out:[]});V(()=>{if(!f||!i)return;let x=!0;return u("talk",{threadId:e,peerId:f}).then(_=>{x&&h(_)}).catch(()=>{x&&h(_=>({..._,ok:!1}))}),()=>{x=!1}},[u,e,f,i,o]);let m=hv(t,p.out,r);return g(he,{children:[g("header",{className:"nf-bar",children:[d("button",{type:"button",onClick:l,children:`\u2190 ${s.back}`}),d("b",{title:t.name,children:t.name})]}),d("div",{className:"nf-scroll",children:d("div",{className:"nf-talk",children:m.map(x=>{let _=new Date(x.time),b=x.who==="state"?v0(x.kind??"",s):x.who==="you"?s.you:x.who==="agent"?s.agent:f?s.thread:t.name;return g("div",{className:`nf-msg nf-${x.who==="state"?y0(x.kind??""):"plain"}`,"data-who":x.who,children:[g("div",{className:"nf-msg-head",children:[d("b",{children:b}),d("time",{dateTime:_.toISOString(),children:mv(_,s)})]}),d(Kt,{content:a(x.text)})]},x.id)})})}),!p.ok&&d("p",{className:"nf-hint",children:s.outFailed}),d("div",{className:"nf-foot",children:f&&!n?d(I2,{threadId:e,peerId:f,title:t.name,t:s,onSent:c}):d("p",{className:"nf-hint",children:f?s.closed[n??"gone"]:s.closed.none})})]})}function w0({threadId:e}){return d(P2,{threadId:e},e)}function P2({threadId:e}){let t=cc(),n=x0(e),{items:r,seenAt:i,lang:o,marker:s=""}=n,a=ft(()=>w2(s),[s]),[c,l]=w("all"),u=le(null),[f,p]=w(!1);V(()=>{let U=u.current;if(!U)return;let ge=new IntersectionObserver(et=>p(et[et.length-1].isIntersecting));return ge.observe(U),()=>ge.disconnect()},[]);let[h,m]=w(null),x=r.reduce((U,ge)=>Math.max(U,m0(ge)),0);V(()=>{if(!f){m(null);return}if(i===void 0)return;let U=Math.max(i,lc.get(e)??0);m(ge=>ge??U),!(x<=i)&&(lc.set(e,Math.max(x,lc.get(e)??0)),h0.forEach(ge=>ge()),t("seen",{threadId:e,at:x}).catch(()=>{}))},[t,e,f,n]);let[_,b]=w(null),E=_??n.view??"time",[N,v]=w(null),[k,A]=w([]),$=ft(()=>c0([...n.sent??[],...k]),[n.sent,k]),Z=le(new Set);if(V(()=>{for(let U of k)Z.current.has(U.id)||n.sent?.some(ge=>ge.id===U.id)||t("sent",{threadId:e,...U}).then(()=>{Z.current.add(U.id)}).catch(()=>{})},[t,e,n,k]),!o)return d("div",{className:"nf-panel",ref:u});let K=u0[o];if(!r.length)return d("div",{className:"nf-panel",ref:u,children:d("p",{className:"nf-empty",children:K.empty})});let X=N2(r),Y=E==="threads"?X.find(U=>U.key===N):void 0;if(Y)return d("div",{className:"nf-panel nf-chat",ref:u,children:d(R2,{threadId:e,group:Y,closed:Y.threadId?n.closed?.[Y.threadId]:void 0,sent:$,shown:f,tick:n,t:K,textOf:a,onSent:U=>A(ge=>c0([...ge,{...U,time:Math.max(U.time,($.at(-1)?.time??0)+1)}])),onBack:()=>v(null)},Y.key)});let se=r.filter(U=>c==="all"||ac(U)===c),ce=X.filter(U=>c==="all"||ac(U.items[0])===c),we=U=>E==="threads"?U==="all"?X.length:X.filter(ge=>ac(ge.items[0])===U).length:U==="all"?r.length:r.filter(ge=>ac(ge)===U).length,ee=new Map;for(let U of se){let ge=new Date(U.time).toDateString();ee.set(ge,[...ee.get(ge)??[],U])}let q=U=>{b(U),v(null),t("view",{threadId:e,view:U}).catch(()=>{})};return g("div",{className:"nf-panel",ref:u,children:[g("header",{className:"nf-top",children:[d("nav",{"aria-label":K.filtersLabel,children:E2.map(U=>g("button",{type:"button","aria-pressed":c===U,onClick:()=>l(U),children:[K.filters[U]," ",d("b",{children:we(U)})]},U))}),d("div",{className:"nf-views",role:"group","aria-label":K.viewsLabel,children:["time","threads"].map(U=>d("button",{type:"button","aria-pressed":E===U,onClick:()=>q(U),children:K.views[U]},U))})]}),E==="threads"?g(he,{children:[!ce.length&&d("p",{className:"nf-empty",children:K.emptyThreads}),d("div",{className:"nf-threads",children:ce.map(U=>d($2,{group:U,count:hv(U,[],$).length,t:K,textOf:a,onOpen:()=>v(U.key)},U.key))})]}):g(he,{children:[!se.length&&d("p",{className:"nf-empty",children:K.emptyFilter}),[...ee].map(([U,ge])=>g("section",{className:"nf-day",children:[g("h2",{children:[d("span",{children:A2(new Date(ge[0].time),K)}),d("small",{children:ge.length})]}),d("div",{className:"nf-stream",children:ge.map(et=>d(C2,{item:et,fresh:h!==null&&m0(et)>h,t:K,textOf:a},et.id))})]},U))]})]})}function uc({children:e}){let t=Gt(),n=ft(()=>(async(r,i)=>t.plugins.callRpc({pluginId:lv,method:r,input:i,outputSchema:cv[r].output})),[t]);return d(g0.Provider,{value:n,children:e})}var F2={id:to,context:{kind:"nav-panel",panelId:Tt},availability:"action"};function L2(e){let t=e.replace(/\s+/g," ").trim();return t.length>32?`${t.slice(0,31)}\u2026`:t||"Thread"}function dc(){let e=G(),[t,n]=w(void 0),[r,i]=w(0);return Te("config",ae(()=>i(o=>o+1),[])),V(()=>{let o=!0;return e.call("threads.home",null).then(({orbitThread:s})=>{o&&n(s)},()=>{o&&n(s=>s??null)}),()=>{o=!1}},[e,r]),t}function fc(){let e=G(),[t,n]=w(void 0),[r,i]=w(null),[o,s]=w(0),a=ae(()=>s(c=>c+1),[]);return Te("threads",a),Te("config",a),V(()=>{let c=!0;return(async()=>{try{let{orbitThread:l}=await e.call("threads.home",null);if(!c)return;if(n(l),!l)return i([]);let u=await e.call("threads.list",{orbitThread:l});c&&i(u.threads)}catch{c&&(n(l=>l??null),i(l=>l??[]))}})(),()=>{c=!1}},[e,o]),{orbit:t,threads:r}}function z2({thread:e,now:t,onOpen:n}){let[r,i]=w(null),o=async()=>{i(null);try{await n()}catch(a){i(a instanceof Error?a.message:"Couldn't open the thread. Try again.")}},s=e.outcomes.slice(-3);return g("div",{className:"flex min-w-0 flex-col gap-0.5 text-sm",children:[s.map(a=>g("button",{type:"button",onClick:()=>{o()},className:"min-w-0 truncate text-left text-foreground",children:["\u21B3 ",a.text]},a.at)),d("button",{type:"button",onClick:()=>{o()},className:"text-left text-muted-foreground hover:text-foreground",children:Lu(e,t)}),r?d("span",{role:"alert",className:"text-xs text-destructive",children:r}):null]})}function O2(e){let t=ig(),n=le(null),{setOpen:r,isCompactViewport:i}=t;V(()=>{if(e===null)return;let{openSidebar:o,running:s}=m_(n.current,e);n.current=s,o&&!i&&r(!0)},[i,r,e])}function xv(e){let t=G(),n=rg(),{orbit:r,threads:i}=fc(),o=ft(()=>i??[],[i]);O2(i);let[s,a]=w(()=>Date.now());V(()=>{let h=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(h)},[]);let c=ft(()=>new Map(o.map(h=>[h.rootSeq,h])),[o]),l=ae((h,m,x)=>n.experimental_openTab({surface:{kind:"current"},tab:F2,params:{threadId:h,rootSeq:m,rootText:x.slice(0,600)},title:L2(x)}),[n]);V(()=>__(h=>l(h.threadId,h.rootSeq,h.rootText)),[l]);let u=ae(async h=>{if(!r)return;let m=Fu(h),{threadId:x}=await t.call("threads.open",{orbitThread:r,rootSeq:m,forkAt:h.sourceSeqEnd,rootText:h.text});l(x,m,h.text)},[r,t,l]),f=ft(()=>[{id:"reply-in-thread",title:"Reply in thread",icon:"MessageCirclePlus",run:u}],[u]),p=ae(h=>{let m=Fu(h),x=c.get(m);return x?d(z2,{thread:x,now:s,onOpen:()=>u(h)}):null},[c,s,u]);return r===void 0?null:r===null?g("div",{className:"mx-auto flex max-w-[560px] flex-col gap-4 p-8 text-sm text-muted-foreground",children:[d("p",{children:"There's no conversation with your moonlet yet. It starts once your moonlet has a machine to run on and its setup is finished."}),d(D2,{})]}):d(uc,{children:d("div",{className:"flex h-full min-h-0 flex-col",children:g("div",{className:"relative min-h-0 flex-1",children:[d(_0,{threadId:r}),d(Lc,{experimental_sendMode:"steer-if-active",threadId:r,variant:"full",messageActions:f,experimental_messageFooter:p})]})})})}function _v({params:e}){let{orbit:t,threads:n}=fc();if(!h_(e))return d("div",{className:"p-4 text-sm text-muted-foreground",children:"This thread can't be shown. Open it again from its message."});let{threadId:r,rootText:i}=e;return g("div",{className:"flex h-full min-h-0 flex-col",children:[t?d("div",{className:"flex justify-end border-b border-border px-2 py-1",children:d(ea,{orbitThread:t,threadId:r,done:n?.find(o=>o.threadId===r)?.done??!1})}):null,d(Lc,{threadId:r,variant:"full",experimental_sendMode:"steer-if-active",leadingContent:d(Kt,{className:"mb-4 px-2",content:i.length>=600?`${i}\u2026`:i})},r)]})}function D2(){let e=G(),[t,n]=w(!1),[r,i]=w(null);return g("div",{className:"flex flex-col gap-1",children:[d("div",{children:d("button",{type:"button",className:"underline disabled:opacity-60",disabled:t,onClick:()=>{n(!0),i(null),e.call("welcome.reopen",null).then(()=>n(!1),o=>{i(o instanceof Error?o.message:String(o)),n(!1)})},children:t?"Opening setup\u2026":"Finish setting up"})}),r&&d("p",{role:"alert",className:"text-destructive",children:r})]})}function k0({threadId:e}){let t=G(),n=le(null),r=le(null),[i,o]=w(null),[s,a]=w("Connecting\u2026"),[c,l]=w(!1),[u,f]=w(0);return V(()=>{t.call("desktop.station",{threadId:e}).then(o,p=>a(p instanceof Error?p.message:String(p)))},[t,e,u]),V(()=>{if(!i?.station||!n.current)return;let p=`${location.origin.replace(/^http/,"ws")}/api/v1/plugins/orbit/http/desktop?station=${encodeURIComponent(i.station)}`,h=new Qe(n.current,p,{shared:!0});return h.viewOnly=!0,h.scaleViewport=!0,h.resizeSession=!1,h.background="transparent",h.addEventListener("connect",()=>a("")),h.addEventListener("disconnect",m=>{let x=m.detail?.clean;a(x?"Disconnected.":`Couldn't reach ${i.station}'s desktop.`)}),r.current=h,l(!1),()=>{h.disconnect(),r.current=null}},[i,u]),V(()=>{r.current&&(r.current.viewOnly=!c)},[c]),i&&!i.station?d("p",{className:"p-3 text-sm text-muted-foreground",children:"The desktop is your moonlet's own computer, where its conversation and the work it starts run."}):g("div",{className:"flex h-full flex-col",children:[g("div",{className:"flex items-center gap-2 border-b px-3 py-2 text-xs",children:[d("span",{className:"font-medium",children:i?.station??"\u2026"}),d("span",{className:"flex-1 text-muted-foreground",children:s||(c?"You're in control: clicks and keys go to the desktop.":"Watching.")}),s?d(I,{size:"sm",variant:"secondary",onClick:()=>f(p=>p+1),children:"Retry"}):d(I,{size:"sm",variant:c?"destructive":"default",onClick:()=>l(p=>!p),children:c?"Give back control":"Take control"})]}),d("div",{ref:n,className:"min-h-0 flex-1 bg-black"})]})}function bv(e){let t=dc();return t===void 0?null:t===null?d("p",{className:"p-3 text-sm text-muted-foreground",children:"There's no conversation with your moonlet yet, so there's no desktop to show."}):d(k0,{threadId:t},t)}var S0="default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval' blob: data: https://cdn.jsdelivr.net https://esm.sh https://unpkg.com; style-src 'unsafe-inline' blob: data: https://cdn.jsdelivr.net https://esm.sh https://unpkg.com; img-src data:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",rr=`<!doctype html><html><head><meta charset="utf-8"><meta name="referrer" content="no-referrer"><meta http-equiv="Content-Security-Policy" content="${S0}">`,K2=["<meta","<link","<base","<iframe","<frame","<object","<embed","<form","<portal"];function yv(e,t){if(new TextEncoder().encode(t).length>524288)return`a page is at most ${524288/1024} KiB`;if(e==="html"){if(!t.startsWith(rr))return"this HTML page doesn't start with the Content Security Policy every page starts with, so it isn't shown";let n=t.slice(rr.length).toLowerCase(),r=K2.find(i=>n.includes(i));return r?`this HTML page has a ${r}\u2026> tag after its head, so it isn't shown`:null}return t.includes("![")?"this Markdown page has an image, so it isn't shown":/<[A-Za-z/!?]/.test(t)?"this Markdown page has raw HTML, so it isn't shown":null}var X2=500,VL=`set -u
73
73
  dir=$1
74
74
  thread=\${dir%/pages}
75
75
  if [ ! -e "$dir" ] && [ -d "$thread" ] && [ ! -L "$thread" ]; then printf 'DIR %s\\nEND-PAGES\\n' "$dir"; exit 0; fi