loopable-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/_connectorId-m67WbiJ8.js +1 -0
  3. package/.output/public/assets/_loopId-Bf4K5sdd.js +1 -0
  4. package/.output/public/assets/_taskId-eCKkcVOx.js +1 -0
  5. package/.output/public/assets/alert-BT2EVMJP.js +1 -0
  6. package/.output/public/assets/arrow-left-CWUZt6k2.js +1 -0
  7. package/.output/public/assets/arrow-right-dy_oOg_c.js +1 -0
  8. package/.output/public/assets/connection-status-DCqqmY_6.js +1 -0
  9. package/.output/public/assets/connector-icon-qGpNsPgH.js +1 -0
  10. package/.output/public/assets/connectors-DxXlc9zF.js +1 -0
  11. package/.output/public/assets/{external-link-D46X-bXa.js → external-link-DC11orFA.js} +1 -1
  12. package/.output/public/assets/gaps-CoTA-PzA.js +1 -0
  13. package/.output/public/assets/inbox-CLEXUXCI.js +1 -0
  14. package/.output/public/assets/index-Cndsw84p.js +16 -0
  15. package/.output/public/assets/{loader-CcBl2u8m.js → loader-B4Epchm_.js} +1 -1
  16. package/.output/public/assets/loop-form-BvizlZdR.js +1 -0
  17. package/.output/public/assets/loops-Dbe_mf5T.js +1 -0
  18. package/.output/public/assets/new-DPEaXKAY.js +1 -0
  19. package/.output/public/assets/play-DD4xQgvi.js +1 -0
  20. package/.output/public/assets/preload-helper-CfdAYKD7.js +3 -0
  21. package/.output/public/assets/rolldown-runtime-CbXtAM7H.js +1 -0
  22. package/.output/public/assets/runners-BVBggS5B.js +1 -0
  23. package/.output/public/assets/select-Cppu-hti.js +1 -0
  24. package/.output/public/assets/setting-fields-BT1naVJX.js +3 -0
  25. package/.output/public/assets/{styles-DZL5V1o7.css → styles-D3sonCfX.css} +1 -1
  26. package/.output/public/assets/switch-hRIbNGOj.js +1 -0
  27. package/.output/public/assets/task-list-CrptnI1N.js +1 -0
  28. package/.output/public/assets/textarea-Fyuzi6Vp.js +1 -0
  29. package/.output/public/assets/{trash-2-D6u6NpzO.js → trash-2-BXZzBsoV.js} +1 -1
  30. package/.output/public/assets/useValueChanged-VVyq4hb9.js +1 -0
  31. package/.output/server/{_connectorId-8nb5yOzG.mjs → _connectorId-DcSnoRjk.mjs} +8 -8
  32. package/.output/server/_libs/@base-ui/react+[...].mjs +427 -427
  33. package/.output/server/{_loopId-BsUL1SeL.mjs → _loopId-G_TAkYtS.mjs} +8 -8
  34. package/.output/server/_ssr/{access-zIl15o8y.mjs → access-B7TcOZ7F.mjs} +2 -2
  35. package/.output/server/_ssr/{agents-Btql102J.mjs → agents-CrUmIQpi.mjs} +3 -3
  36. package/.output/server/_ssr/{agents-DAOZPgO2.mjs → agents-Dms_6TBF.mjs} +3 -3
  37. package/.output/server/_ssr/{alert-NEiOCTOl.mjs → alert-DQvzE7bu.mjs} +1 -1
  38. package/.output/server/_ssr/{callback-CUINvl7M.mjs → callback-D20cVD2w.mjs} +21 -4
  39. package/.output/server/_ssr/{client-CKkOfh-s.mjs → client-BtVRVhQ2.mjs} +4 -2
  40. package/.output/server/_ssr/{connection-status-Bi5peUAk.mjs → connection-status-BZr3Y-IC.mjs} +2 -2
  41. package/.output/server/_ssr/{connections-qnw2GVlP.mjs → connections-ypex3qUd.mjs} +3 -3
  42. package/.output/server/_ssr/{connector-icon-DZXQLLFo.mjs → connector-icon-CFrrHjzR.mjs} +2 -2
  43. package/.output/server/_ssr/{connectors-BHNwuIMj.mjs → connectors-4yzKb0KG.mjs} +5 -5
  44. package/.output/server/_ssr/{connectors-C28g0i4c.mjs → connectors-BZly0yGF.mjs} +2 -2
  45. package/.output/server/_ssr/{gaps-RAFSXLZf.mjs → gaps-D2Zh8sEo.mjs} +3 -3
  46. package/.output/server/_ssr/inbox-C2VBGLa5.mjs +114 -0
  47. package/.output/server/_ssr/{loop-form-DlObSewZ.mjs → loop-form-D-U-kU4k.mjs} +8 -7
  48. package/.output/server/_ssr/{loops-xt2Bn7_q.mjs → loops-D0XJ8eBb.mjs} +8 -8
  49. package/.output/server/_ssr/{loops-APFcP0y6.mjs → loops-Og_G3KyZ.mjs} +6 -6
  50. package/.output/server/_ssr/{new-DfKyd2Wa.mjs → new-CajvgIog.mjs} +5 -5
  51. package/.output/server/_ssr/{router-3WmpE5b_.mjs → router-BbrBz36P.mjs} +63 -62
  52. package/.output/server/_ssr/{runners-By-mwc3F.mjs → runners-B_WuF8UJ.mjs} +3 -3
  53. package/.output/server/_ssr/{runners-DtXs4Q8a.mjs → runners-D-0_lfiq.mjs} +3 -3
  54. package/.output/server/_ssr/{runners-DI_NxpHC.mjs → runners-zqF_zbEc.mjs} +4 -4
  55. package/.output/server/_ssr/{secrets-Hqti-niS.mjs → secrets-CRnpwGBh.mjs} +2 -2
  56. package/.output/server/_ssr/{setting-fields-8vKFj4df.mjs → setting-fields-mpXfGftI.mjs} +6 -13
  57. package/.output/server/_ssr/ssr.mjs +37 -33
  58. package/.output/server/_ssr/{start-Bdc2GJUI.mjs → start-BgTj-h_C.mjs} +4 -4
  59. package/.output/server/_ssr/{switch-ReNglgH6.mjs → switch-1pnd_bPJ.mjs} +2 -2
  60. package/.output/server/_ssr/{task-list-CUITIqkb.mjs → task-list-BnQJ94Dk.mjs} +9 -8
  61. package/.output/server/_ssr/{tasks-vcoodp_D.mjs → tasks-B_QmDFVs.mjs} +87 -8
  62. package/.output/server/_ssr/{tasks-SAjNovX6.mjs → tasks-LIi-W4cy.mjs} +15 -6
  63. package/.output/server/_ssr/textarea-CHJTKtsJ.mjs +14 -0
  64. package/.output/server/{_tanstack-start-manifest_v-C0cP5F0M.mjs → _tanstack-start-manifest_v-BCHAazE8.mjs} +52 -48
  65. package/.output/server/{_taskId-CXS3lod0.mjs → _taskId-CIv0ajIx.mjs} +17 -10
  66. package/.output/server/index.mjs +160 -160
  67. package/README.md +3 -3
  68. package/dist/cli.mjs +7181 -16
  69. package/dist/dispatcher.mjs +33 -2
  70. package/drizzle/0024_prompt_tasks.sql +44 -0
  71. package/drizzle/meta/_journal.json +7 -0
  72. package/package.json +1 -1
  73. package/.output/public/assets/_connectorId-BWjYn5tm.js +0 -1
  74. package/.output/public/assets/_loopId-Ds4RkyEc.js +0 -1
  75. package/.output/public/assets/_taskId-BOzICXDf.js +0 -1
  76. package/.output/public/assets/alert-Bn9-Zm0l.js +0 -1
  77. package/.output/public/assets/arrow-left-BF9juV9T.js +0 -1
  78. package/.output/public/assets/arrow-right-CzqvnOY1.js +0 -1
  79. package/.output/public/assets/button-HCY6DCY-.js +0 -1
  80. package/.output/public/assets/connection-status-CYZB8kLy.js +0 -1
  81. package/.output/public/assets/connector-icon-BZ_MUJV_.js +0 -1
  82. package/.output/public/assets/connectors-BvzttfSu.js +0 -1
  83. package/.output/public/assets/connectors-DdJNwRN_.js +0 -1
  84. package/.output/public/assets/gaps-D-I6xiDc.js +0 -1
  85. package/.output/public/assets/inbox-BUUu9xxE.js +0 -1
  86. package/.output/public/assets/index-ztzex0FN.js +0 -10
  87. package/.output/public/assets/loop-form-dB3CLcZb.js +0 -1
  88. package/.output/public/assets/loops-DRunQrxL.js +0 -1
  89. package/.output/public/assets/loops-oSdqMd29.js +0 -1
  90. package/.output/public/assets/manifests-DNMqf7Vi.js +0 -7
  91. package/.output/public/assets/new-uyFxVjuB.js +0 -1
  92. package/.output/public/assets/preload-helper-ORbuV86A.js +0 -3
  93. package/.output/public/assets/runners-DSU3r5Ww.js +0 -1
  94. package/.output/public/assets/setting-fields-ixkpdBb-.js +0 -3
  95. package/.output/public/assets/switch-d5ummmHY.js +0 -1
  96. package/.output/public/assets/task-list-BpOStt9v.js +0 -1
  97. package/.output/public/assets/tasks-B8MsKgic.js +0 -1
  98. package/.output/server/_ssr/inbox-k5zHergU.mjs +0 -35
@@ -8408,7 +8408,7 @@ var tasks = sqliteTable(
8408
8408
  "tasks",
8409
8409
  {
8410
8410
  id: text2("id").primaryKey(),
8411
- loopId: text2("loop_id").notNull().references(() => loops.id, { onDelete: "cascade" }),
8411
+ loopId: text2("loop_id").references(() => loops.id, { onDelete: "cascade" }),
8412
8412
  connectorId: text2("connector_id").notNull(),
8413
8413
  state: text2("state").$type().notNull().default("queued"),
8414
8414
  /** What the task is about, resolved once so the record survives the source. */
@@ -8423,6 +8423,8 @@ var tasks = sqliteTable(
8423
8423
  * when the dispatcher fetches rather than when the task is queued.
8424
8424
  */
8425
8425
  sourceTitle: text2("source_title"),
8426
+ /** Inbox test runs: the ask itself. Loop runs leave this null and read loops.prompt. */
8427
+ prompt: text2("prompt"),
8426
8428
  /** Set when a run was asked to stop before writing anything. */
8427
8429
  dryRun: integer("dry_run", { mode: "boolean" }).notNull().default(false),
8428
8430
  agentId: text2("agent_id"),
@@ -9057,13 +9059,14 @@ function toView3(row) {
9057
9059
  return {
9058
9060
  id: row.id,
9059
9061
  loopId: row.loopId,
9060
- loopName: row.loopName ?? "Deleted loop",
9062
+ loopName: row.loopName ?? (row.loopId ? "Deleted loop" : "Test run"),
9061
9063
  connectorId: row.connectorId,
9062
9064
  state: row.state,
9063
9065
  sourceUrl: row.sourceUrl,
9064
9066
  sourceKind: row.sourceKind,
9065
9067
  sourceRef: row.sourceRef,
9066
9068
  sourceTitle: row.sourceTitle,
9069
+ prompt: row.prompt ?? null,
9067
9070
  dryRun: row.dryRun,
9068
9071
  agentId: row.agentId,
9069
9072
  runnerId: row.runnerId,
@@ -9092,6 +9095,7 @@ function select() {
9092
9095
  sourceKind: tasks.sourceKind,
9093
9096
  sourceRef: tasks.sourceRef,
9094
9097
  sourceTitle: tasks.sourceTitle,
9098
+ prompt: tasks.prompt,
9095
9099
  dryRun: tasks.dryRun,
9096
9100
  agentId: tasks.agentId,
9097
9101
  runnerId: tasks.runnerId,
@@ -9147,6 +9151,9 @@ async function queue(input) {
9147
9151
  }).run();
9148
9152
  return await getTask(id);
9149
9153
  }
9154
+ function isPromptTask(task) {
9155
+ return task.loopId == null;
9156
+ }
9150
9157
  async function runnable(loopId) {
9151
9158
  const loop = await db().select().from(loops).where(eq(loops.id, loopId)).get();
9152
9159
  if (!loop) throw new Error("Loop not found");
@@ -9216,6 +9223,8 @@ async function loadWork(id, signal) {
9216
9223
  const task = await taskRow(id);
9217
9224
  if (!task) throw new Error(`Task not found: ${id}`);
9218
9225
  if (signal?.aborted || task.cancelRequested) throw new TaskCancelled();
9226
+ if (isPromptTask(task)) throw new Error("A prompt run has no work item to load.");
9227
+ if (!task.loopId) throw new Error("The loop behind this task has been deleted.");
9219
9228
  const loop = await db().select().from(loops).where(eq(loops.id, task.loopId)).get();
9220
9229
  if (!loop) throw new Error("The loop behind this task has been deleted.");
9221
9230
  const workflow = connectorWorkflow(loop.connectorId, loop.workflowId);
@@ -9236,7 +9245,29 @@ async function loadWork(id, signal) {
9236
9245
  });
9237
9246
  return { task, loop, workflow, writer, action, credential, item };
9238
9247
  }
9248
+ async function preparePromptTask(id, signal) {
9249
+ const task = await taskRow(id);
9250
+ if (signal?.aborted || task.cancelRequested) throw new TaskCancelled();
9251
+ if (!task.agentId) throw new Error("This task has no agent yet.");
9252
+ let logPath = null;
9253
+ if (!isHosted()) {
9254
+ const workspace = runDir(id);
9255
+ logPath = join6(workspace, "agent.log");
9256
+ writeFileSync2(logPath, "", { flag: "a" });
9257
+ }
9258
+ const runnerId = await pickRunner({ agentId: task.agentId, requiresHost: false });
9259
+ await updateTask(id, {
9260
+ state: "awaiting_agent",
9261
+ runnerId,
9262
+ logPath,
9263
+ leaseUntil: null
9264
+ });
9265
+ return await getTask(id);
9266
+ }
9239
9267
  async function prepareTask(id, signal) {
9268
+ const existing = await taskRow(id);
9269
+ if (!existing) throw new Error(`Task not found: ${id}`);
9270
+ if (isPromptTask(existing)) return await preparePromptTask(id, signal);
9240
9271
  const { loop, workflow, item } = await loadWork(id, signal);
9241
9272
  await updateTask(id, { sourceTitle: item.title });
9242
9273
  const task = await taskRow(id);
@@ -0,0 +1,44 @@
1
+ -- Inbox prompt runs have no loop. SQLite cannot drop NOT NULL, so rebuild.
2
+ CREATE TABLE `__new_tasks` (
3
+ `id` text PRIMARY KEY NOT NULL,
4
+ `loop_id` text,
5
+ `connector_id` text NOT NULL,
6
+ `state` text DEFAULT 'queued' NOT NULL,
7
+ `source_url` text NOT NULL,
8
+ `source_kind` text NOT NULL,
9
+ `source_ref` text NOT NULL,
10
+ `source_payload` text,
11
+ `source_title` text,
12
+ `prompt` text,
13
+ `dry_run` integer DEFAULT false NOT NULL,
14
+ `agent_id` text,
15
+ `runner_id` text,
16
+ `agent_command` text,
17
+ `output` text,
18
+ `comments` text,
19
+ `action_connector_id` text NOT NULL,
20
+ `action_id` text NOT NULL,
21
+ `action_target` text DEFAULT '{}' NOT NULL,
22
+ `result_url` text,
23
+ `error` text,
24
+ `log_path` text,
25
+ `log_text` text DEFAULT '' NOT NULL,
26
+ `attempts` integer DEFAULT 0 NOT NULL,
27
+ `run_after` integer DEFAULT (unixepoch() * 1000) NOT NULL,
28
+ `lease_until` integer,
29
+ `cancel_requested` integer DEFAULT false NOT NULL,
30
+ `dedupe_key` text,
31
+ `duration_ms` integer,
32
+ `created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
33
+ `started_at` integer,
34
+ `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
35
+ FOREIGN KEY (`loop_id`) REFERENCES `loops`(`id`) ON UPDATE no action ON DELETE cascade
36
+ );--> statement-breakpoint
37
+ INSERT INTO `__new_tasks` (`id`, `loop_id`, `connector_id`, `state`, `source_url`, `source_kind`, `source_ref`, `source_payload`, `source_title`, `dry_run`, `agent_id`, `runner_id`, `agent_command`, `output`, `comments`, `action_connector_id`, `action_id`, `action_target`, `result_url`, `error`, `log_path`, `log_text`, `attempts`, `run_after`, `lease_until`, `cancel_requested`, `dedupe_key`, `duration_ms`, `created_at`, `started_at`, `updated_at`)
38
+ SELECT `id`, `loop_id`, `connector_id`, `state`, `source_url`, `source_kind`, `source_ref`, `source_payload`, `source_title`, `dry_run`, `agent_id`, `runner_id`, `agent_command`, `output`, `comments`, `action_connector_id`, `action_id`, `action_target`, `result_url`, `error`, `log_path`, `log_text`, `attempts`, `run_after`, `lease_until`, `cancel_requested`, `dedupe_key`, `duration_ms`, `created_at`, `started_at`, `updated_at` FROM `tasks`;--> statement-breakpoint
39
+ DROP TABLE `tasks`;--> statement-breakpoint
40
+ ALTER TABLE `__new_tasks` RENAME TO `tasks`;--> statement-breakpoint
41
+ CREATE INDEX `tasks_loop_idx` ON `tasks` (`loop_id`);--> statement-breakpoint
42
+ CREATE INDEX `tasks_created_idx` ON `tasks` (`created_at`);--> statement-breakpoint
43
+ CREATE INDEX `tasks_claim_idx` ON `tasks` (`state`,`run_after`);--> statement-breakpoint
44
+ CREATE UNIQUE INDEX `tasks_dedupe_idx` ON `tasks` (`dedupe_key`);
@@ -169,6 +169,13 @@
169
169
  "when": 1789100000008,
170
170
  "tag": "0023_shared_host",
171
171
  "breakpoints": true
172
+ },
173
+ {
174
+ "idx": 24,
175
+ "version": "6",
176
+ "when": 1789100000009,
177
+ "tag": "0024_prompt_tasks",
178
+ "breakpoints": true
172
179
  }
173
180
  ]
174
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopable-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI to run Loopable: App, Dispatcher, and Runner.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{I as e,M as t,St as n,T as r,a as i,b as a,bt as o,c as s,g as c,i as l,n as u,o as d,p as f,r as p,u as m}from"./preload-helper-ORbuV86A.js";import{k as h,o as g,s as _,t as v}from"./button-HCY6DCY-.js";import{t as y}from"./arrow-left-BF9juV9T.js";import{t as b}from"./connector-icon-BZ_MUJV_.js";import{t as x}from"./external-link-D46X-bXa.js";import{t as S}from"./loader-CcBl2u8m.js";import{i as C}from"./manifests-DNMqf7Vi.js";import{t as w}from"./trash-2-D6u6NpzO.js";import{a as T,n as E,o as ee,r as te,t as D}from"./connectors-BvzttfSu.js";import{J as O,X as k,Y as A,Z as j,l as M,mt as N,z as P}from"./index-ztzex0FN.js";import{n as F,t as I}from"./setting-fields-ixkpdBb-.js";import{t as L}from"./connection-status-CYZB8kLy.js";import{n as R,r as z,t as B}from"./alert-Bn9-Zm0l.js";var V=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),H=a(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),U=n(o(),1),W=e();function G({fields:e,connection:n}){let r=t(),[i,a]=(0,U.useState)(()=>F(e,n.settings)),[o,s]=(0,U.useState)(!1);return e.length===0?null:(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,W.jsx)(I,{fields:e,values:i,onChange:(e,t)=>a(n=>({...n,[e]:t}))}),(0,W.jsx)(`div`,{children:(0,W.jsx)(v,{onClick:async()=>{s(!0);try{await T({data:{id:n.id,settings:i}}),await r.invalidate(),h.success(`Settings saved`)}catch(e){h.error(e instanceof Error?e.message:String(e))}finally{s(!1)}},disabled:o,children:o?`Saving...`:`Save settings`})})]})}var K=2e3;function ne({connectorId:e,note:n,onDone:r}){let i=t(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),[l,d]=(0,U.useState)(null),[f,m]=(0,U.useState)(!0),g=(0,U.useRef)(null),_=async()=>{m(!0),d(null),c(null);try{let t=await D({data:{connectorId:e}});g.current=t.attempt,o({image:t.image,attempt:t.attempt})}catch(e){d(e instanceof Error?e.message:String(e)),o(null)}finally{m(!1)}};return(0,U.useEffect)(()=>{_()},[e]),(0,U.useEffect)(()=>{if(!a||l)return;let t=!1;return(async()=>{for(;!t;){if(await new Promise(e=>setTimeout(e,K)),t||g.current===null)return;try{let n=await E({data:{connectorId:e,attempt:g.current}});if(t)return;if(n.state===`connected`){h.success(`Connected ${n.accountLabel??e}`),await i.invalidate(),r?.();return}if(n.state===`expired`){d(n.reason??`The code expired before it was scanned.`);return}g.current=n.attempt,c(n.hint??null)}catch(e){if(t)return;c(e instanceof Error?e.message:String(e))}}})(),()=>{t=!0}},[a,l,e,i,r]),(0,W.jsx)(u,{children:(0,W.jsxs)(p,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,W.jsx)(`p`,{className:`max-w-md text-center text-sm text-muted-foreground`,children:n}),l?(0,W.jsxs)(B,{variant:`destructive`,className:`max-w-md`,children:[(0,W.jsx)(N,{}),(0,W.jsx)(R,{children:l})]}):(0,W.jsx)(`div`,{className:`flex size-[240px] items-center justify-center rounded-lg border bg-white`,children:f||!a?(0,W.jsx)(S,{className:`size-5 animate-spin text-muted-foreground`}):(0,W.jsx)(`img`,{src:a.image,alt:`Scan with WeChat to connect`,className:`size-[240px]`})}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l?`Ask for another and scan it this time.`:s??`Waiting for a scan...`}),(0,W.jsx)(v,{variant:l?`default`:`outline`,size:`sm`,onClick:_,disabled:f,children:l?`New code`:`Start over`})]})})}var q=U.createContext(void 0);function J(){let e=U.useContext(q);if(e===void 0)throw Error(c(13));return e}var Y={imageLoadingStatus:()=>null},X=U.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=U.useState(`idle`),c={imageLoadingStatus:o},l=U.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=m(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:Y});return(0,W.jsx)(q.Provider,{value:l,children:u})});function Z(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i}){let[a,o]=U.useState(`idle`);return g(()=>{if(!e&&!i)return o(`error`),f;let a=!0,s=new window.Image,c=e=>()=>{a&&o(e)};return o(`loading`),s.onload=c(`loaded`),s.onerror=c(`error`),t&&(s.referrerPolicy=t),s.crossOrigin=n??null,r&&(s.sizes=r),i&&(s.srcset=i),e&&(s.src=e),s.complete&&o(s.naturalWidth>0?`loaded`:`error`),()=>{a=!1}},[e,i,r,n,t]),a}var re={...Y,...A},ie=U.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,style:a,...o}=e,{setImageLoadingStatus:s}=J(),c=Z(o.src,o),l=c===`loaded`,{mounted:u,transitionStatus:d,setMounted:f}=O(l),p=U.useRef(null),h=_(e=>{i?.(e),s(e)});g(()=>{c!==`idle`&&h(c)},[c,h]),g(()=>()=>s(`idle`),[s]),k({open:l,ref:p,onComplete(){l||f(!1)}});let v=m(`img`,e,{state:{imageLoadingStatus:c,transitionStatus:d},ref:[t,p],props:o,stateAttributesMapping:re,enabled:u});return u?v:null}),ae=U.forwardRef(function(e,t){let{className:n,render:r,delay:i=0,style:a,...o}=e,{imageLoadingStatus:s}=J(),[c,l]=U.useState(i===0),u=j();return U.useEffect(()=>(i>0?u.start(i,()=>l(!0)):l(!0),u.clear),[u,i]),m(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:Y,enabled:s!==`loaded`&&(i===0||c)})});function oe({className:e,size:t=`default`,...n}){return(0,W.jsx)(X,{"data-slot":`avatar`,"data-size":t,className:s(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function se({className:e,...t}){return(0,W.jsx)(ie,{"data-slot":`avatar-image`,className:s(`aspect-square size-full rounded-full object-cover`,e),...t})}function Q({className:e,...t}){return(0,W.jsx)(ae,{"data-slot":`avatar-fallback`,className:s(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function ce(){return{}.LOOPABLE_BASE_URL?.replace(/\/$/,``)||null}function le(e){return e===`127.0.0.1`||e===`localhost`||e===`::1`}function ue(e){if(le(e))return!0;let t=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(e);if(t){let e=Number(t[1]),n=Number(t[2]);return e===10||e===127||e===192&&n===168||e===172&&n>=16&&n<=31||e===169&&n===254}let n=e.toLowerCase();return!!(n.includes(`:`)&&(n.startsWith(`fe80:`)||n.startsWith(`fc`)||n.startsWith(`fd`)))}function de(){let e=ce();if(!e)return null;try{return ue(new URL(e).hostname)?null:e}catch{return null}}function fe(e){let t=de();return t?`${t}/api/connectors/${e}/callback`:`http://127.0.0.1/api/connectors/${e}/callback`}function pe(){let{connectorId:e}=M.useParams(),t=M.useLoaderData(),n=C(e),a=n.allowsMultipleAccounts||t.connections.length===0,o=n.auth.kind===`qr_scan`,[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsxs)(r,{to:`/connectors`,className:`flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,W.jsx)(y,{className:`size-4`}),`Connectors`]}),(0,W.jsxs)(`header`,{className:`flex items-start gap-4`,children:[(0,W.jsx)(b,{icon:n.icon,accent:n.accent,className:`size-11`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n.name}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n.tagline})]}),t.readiness.ready&&a?o?(0,W.jsx)(v,{onClick:()=>c(e=>!e),children:s?`Cancel`:`Connect`}):(0,W.jsx)(v,{render:(0,W.jsx)(`a`,{href:`/api/connectors/${e}/authorize`}),children:t.connections.length>0?`Add another account`:`Connect`}):null]}),s&&n.auth.kind===`qr_scan`?(0,W.jsx)(ne,{connectorId:e,note:n.auth.note,onDone:()=>c(!1)}):null,t.readiness.ready?null:(0,W.jsxs)(B,{variant:`destructive`,children:[(0,W.jsxs)(z,{children:[n.name,` is not available in this build`]}),(0,W.jsxs)(R,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(`span`,{children:t.readiness.reason}),t.readiness.fixHint?(0,W.jsx)(`span`,{children:t.readiness.fixHint}):null,n.auth.kind===`oauth_redirect`?(0,W.jsxs)(`span`,{className:`text-xs`,children:[`Callback URL to register: `,(0,W.jsx)(`code`,{children:fe(e)})]}):null]})]}),t.connections.length===0&&t.readiness.ready&&!s?(0,W.jsx)(u,{children:(0,W.jsxs)(p,{className:`py-8 text-center text-sm text-muted-foreground`,children:[`No account connected yet.`,n.auth.kind===`oauth_redirect`?(0,W.jsxs)(W.Fragment,{children:[` `,`Connecting opens `,n.name,` and asks for`,` `,n.auth.scopes.join(`, `),`.`]}):null,n.auth.kind===`qr_scan`?` Connecting shows a code to scan.`:null]})}):null,t.connections.map(e=>(0,W.jsx)(me,{connection:e,manifest:n},e.id)),(0,W.jsxs)(u,{children:[(0,W.jsx)(l,{children:(0,W.jsx)(i,{className:`text-base`,children:`What this connector can do`})}),(0,W.jsxs)(p,{className:`flex flex-col gap-4`,children:[(0,W.jsx)($,{title:`Workflows it offers`,note:`Turn one on from the loops page.`,empty:`None yet. An account can be connected, but no loop can be built on it.`,items:n.workflows.map(e=>({id:e.id,name:e.name,summary:e.summary}))}),(0,W.jsx)(P,{}),(0,W.jsx)($,{title:`What it writes`,note:`A loop writes these back on its own.`,empty:`Nothing. Loopable can read this account but cannot write to it.`,items:n.actions.map(e=>({id:e.id,name:e.name,summary:e.summary}))}),n.docsUrl?(0,W.jsxs)(`a`,{href:n.docsUrl,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[`API documentation`,(0,W.jsx)(x,{className:`size-3.5`})]}):null]})]})]})}function $({title:e,note:t,empty:n,items:r}){return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-medium`,children:e}),t&&r.length>0?(0,W.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t}):null,r.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:n}):(0,W.jsx)(`ul`,{className:`mt-3 flex flex-col gap-2`,children:r.map(e=>(0,W.jsxs)(`li`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,e.summary]})]},e.id))})]})}function me({connection:e,manifest:n}){let r=t(),[i,a]=(0,U.useState)(null),o=e.status===`needs_reauth`||e.status===`error`,s=async t=>{a(t);try{if(t===`verify`){let t=await ee({data:{id:e.id}});h[t.status===`connected`?`success`:`error`](t.status===`connected`?`${t.accountLabel} is reachable`:t.lastError??`This connection is not usable`)}else await te({data:{id:e.id}}),h.success(`Disconnected ${e.accountLabel}`);await r.invalidate()}catch(e){h.error(e instanceof Error?e.message:String(e))}finally{a(null)}};return(0,W.jsxs)(u,{children:[(0,W.jsxs)(l,{className:`flex flex-row items-center gap-3`,children:[(0,W.jsxs)(oe,{children:[(0,W.jsx)(se,{src:e.avatarUrl??void 0,alt:e.accountLabel}),(0,W.jsx)(Q,{children:e.accountLabel.slice(0,2).toUpperCase()})]}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:e.accountLabel}),(0,W.jsx)(L,{status:e.status})]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.lastSyncedAt?`Last checked ${new Date(e.lastSyncedAt).toLocaleString()}`:`Not checked yet`})]}),(0,W.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>s(`verify`),disabled:i!==null,children:[(0,W.jsx)(V,{className:i===`verify`?`animate-spin`:void 0}),`Verify`]}),o?(0,W.jsxs)(v,{size:`sm`,render:(0,W.jsx)(`a`,{href:`/api/connectors/${e.connectorId}/authorize`}),children:[(0,W.jsx)(H,{}),`Reconnect`]}):null,(0,W.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>s(`disconnect`),disabled:i!==null,children:[(0,W.jsx)(w,{}),`Disconnect`]})]}),(0,W.jsxs)(p,{className:`flex flex-col gap-5 border-t pt-5`,children:[e.lastError?(0,W.jsx)(B,{variant:`destructive`,children:(0,W.jsx)(R,{children:e.lastError})}):null,e.scopes.length>0?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-medium`,children:`Granted access`}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.scopes.map(e=>(0,W.jsx)(d,{variant:`outline`,children:e},e))})]}):null,(0,W.jsx)(G,{fields:n.settings,connection:e})]})]})}export{pe as component};
@@ -1 +0,0 @@
1
- import{I as e,M as t,St as n,T as r,b as i,bt as a,c as o,d as s,f as c,g as l,h as u,l as d,n as f,r as p,u as m}from"./preload-helper-ORbuV86A.js";import{a as h,i as g,k as _,n as v,o as y,s as b,t as x}from"./button-HCY6DCY-.js";import{t as S}from"./arrow-left-BF9juV9T.js";import{t as C}from"./loop-form-dB3CLcZb.js";import{s as w}from"./tasks-B8MsKgic.js";import{n as T}from"./task-list-BpOStt9v.js";import{i as E}from"./manifests-DNMqf7Vi.js";import{t as D}from"./switch-d5ummmHY.js";import{s as O}from"./loops-oSdqMd29.js";import{$ as k,A,B as j,C as M,D as N,F as P,G as F,H as ee,I,J as L,M as R,O as z,P as B,Q as V,S as te,T as H,U as ne,V as re,W as ie,X as U,Y as ae,a as oe,at as se,ct as ce,d as le,et as ue,ft as de,it as fe,j as pe,k as me,mt as he,nt as ge,q as _e,rt as ve,tt as W,w as G,x as ye}from"./index-ztzex0FN.js";import{n as K,r as q,t as J}from"./alert-Bn9-Zm0l.js";import{n as be}from"./gaps-D-I6xiDc.js";var xe=i(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Se=i(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Y=n(a(),1),Ce=Y.createContext(void 0);function X(){let e=Y.useContext(Ce);if(e===void 0)throw Error(l(64));return e}var Z={tabActivationDirection:e=>({"data-activation-direction":e})},Q=e(),we=Y.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=Y.useRef([]),[f,p]=Y.useState(()=>new Map),[h,g]=_e({controlled:s,default:r,name:`Tabs`,state:`value`}),_=s!==void 0,[v,x]=Y.useState(()=>new Map),S=Y.useRef(void 0),C=Y.useCallback(e=>$(v,e),[v]),[w,T]=Y.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:E,tabActivationDirection:D}=w,O=D,k=!1;E!==h&&(O=Te(E,h,a,v),k=E!=null&&h!=null&&C(h)==null);let A=k?E:h,j=E!==A||D!==O;y(()=>{j&&T({previousValue:A,tabActivationDirection:O})},[A,j,O]);let M=b((e,t)=>{t.activationDirection=Te(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),N=b((e,t)=>{i?.(e,re(t,void 0,void 0,{activationDirection:`none`}))}),P=b((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),F=Y.useCallback(e=>f.get(e),[f]),I=Y.useCallback(e=>{for(let t of v.values())if(e===t.value)return t.id},[v]),L=Y.useMemo(()=>({getTabElementBySelectedValue:C,getTabIdByPanelValue:I,getTabPanelIdByValue:F,onValueChange:M,orientation:a,registerMountedTabPanel:P,setTabMap:x,tabActivationDirection:O,value:h}),[C,I,F,M,a,P,x,O,h]),R=Y.useMemo(()=>{for(let e of v.values())if(e.value===h)return e},[v,h]),z=Y.useMemo(()=>{for(let e of v.values())if(!e.disabled)return e.value},[v]),B=Y.useRef(!u),V=Y.useRef(r),H=Y.useRef(u),U=Y.useRef(!1);y(()=>{if(_)return;function e(e,t){g(e),T({previousValue:e,tabActivationDirection:`none`}),N(e,t),B.current=!1}if(v.size===0){U.current&&h!==null&&!S.current?.isConnected&&e(null,ie);return}U.current=!0,S.current=v.keys().next().value;let t=R?.disabled,n=R==null&&h!==null;if(!t&&h===V.current&&(H.current=!1),H.current&&t&&h===V.current)return;let r=B.current;if(t||n){let n=z??null;if(h===n){B.current=!1;return}let i=ie;r?i=ne:t&&(i=ee),e(n,i);return}r&&R!=null&&(N(h,ne),B.current=!1)},[z,_,N,R,g,v,h]);let ae=m(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:l,stateAttributesMapping:Z});return(0,Q.jsx)(Ce.Provider,{value:L,children:(0,Q.jsx)(te,{elementsRef:d,children:ae})})});function $(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Te(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=$(r,e),c=$(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var Ee=`data-composite-item-active`;function De(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=h(),{ref:i,index:a}=ye(e),o=n===a,s=Y.useRef(null),c=u(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var Oe=Y.createContext(void 0);function ke(){let e=Y.useContext(Oe);if(e===void 0)throw Error(l(65));return e}var Ae=Y.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:g}=X(),{activateOnFocus:_,registerTabResizeObserverElement:x,tabsListElement:S}=ke(),{highlightedIndex:C,onHighlightedIndexChange:w}=h(),T=ce(o),{compositeProps:E,compositeRef:D,index:O}=De({metadata:Y.useMemo(()=>({disabled:r,id:T,value:a}),[r,T,a])}),k=a===u,A=Y.useRef(!1),j=Y.useRef(null),M=b(e=>{j.current?.(),j.current=e?x(e):null});y(()=>{if(A.current){A.current=!1;return}if(!(k&&O>-1&&C!==O))return;let e=S;if(e!=null){let t=ve(de(e));if(t&&fe(e,t))return}r||w(O)},[k,O,C,w,r,S]);let{getButtonProps:N,buttonRef:P}=v({disabled:r,native:s,focusableWhenDisabled:!0}),ee=d(a),I=Y.useRef(!1),L=Y.useRef(!1);function R(e){f(a,re(F,e.nativeEvent,void 0,{activationDirection:`none`}))}function z(e){k||r||R(e)}function B(e){k||r||_&&(!I.current||L.current)&&R(e)}function V(e){if(k||r)return;I.current=!0,L.current=e.button===0;let t=de(e.currentTarget);function n(){I.current=!1,L.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return m(`button`,e,{state:{disabled:r,active:k,orientation:p,tabActivationDirection:g},ref:[t,P,D,M],props:[E,{role:`tab`,"aria-controls":ee,"aria-selected":k,id:T,onClick:z,onFocus:B,onPointerDown:V,[Ee]:k?``:void 0,onKeyDownCapture(){A.current=!0}},l,N],stateAttributesMapping:Z})}),je={...Z,...ae},Me=Y.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=X(),p=ce(),{ref:h,index:g}=ye(),_=r===c,{mounted:v,transitionStatus:b,setMounted:x}=L(_),S=!v,C=l(r),w={hidden:S,orientation:u,tabActivationDirection:d,transitionStatus:b},T=Y.useRef(null),E=m(`div`,e,{state:w,ref:[t,h,T],props:[{"aria-labelledby":C,hidden:S,id:p,role:`tabpanel`,tabIndex:_?0:-1,inert:N(!_),"data-index":g},s],stateAttributesMapping:je});return U({open:_,ref:T,onComplete(){_||x(!1)}}),y(()=>{if(!(p==null||S&&!a))return f(r,p)},[S,a,r,p,f]),a||v?E:null}),Ne=[];function Pe(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:d,disabledIndices:f,modifierKeys:p=Ne}=e,[m,h]=Y.useState(0),g=r!=null,_=Y.useRef(null),v=u(_,c),x=Y.useRef([]),S=Y.useRef(!1),C=o??m,w=b((e,t=!1)=>{if((s??h)(e),t){let t=x.current[e];I(_.current,t,a,n)}}),T=b(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)w(i);else if(ge(t,C,f)){let e=V(t,{disabledIndices:f});W(t,e)||w(e)}I(_.current,r,a,n)});y(()=>{if(f==null||o!=null||!S.current)return;let e=x.current;if(ge(e,C,f)){let t=V(e,{disabledIndices:f});W(e,t)||w(t)}},[f,o,C,x,w]);let E=b((e,t,n)=>i?i(e,t,n,x):n),D=b(e=>{let o=e.key===`Home`||e.key===`End`;if(!R.has(e.key)||!l&&o||Fe(e,p)||!_.current)return;let s=a===`rtl`,c=s?me:A,u=s?A:me,m=n===`vertical`?z:c,h=n===`vertical`?pe:u,v=se(e.nativeEvent);if(v!=null&&P(v)&&!M(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==m&&t>0)return}let y=C,b=ue(x,f),S=k(x,f);r!=null&&(y=r({disabledIndices:f,elementsRef:x,event:e,highlightedIndex:C,loopFocus:t,maxIndex:S,minIndex:b,onLoop:E,orientation:n,rtl:s}));let T=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===u||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?y=b:e.key===`End`&&(y=S)),y===C&&(T||D)&&(t&&y===S&&T?(y=b,i&&(y=i(e,C,y,x))):t&&y===b&&D?(y=S,i&&(y=i(e,C,y,x))):y=V(x.current,{startingIndex:y,decrement:D,disabledIndices:f})),y!==C&&!W(x.current,y)&&(d&&e.stopPropagation(),(g||o||T||D)&&e.preventDefault(),w(y,!0),queueMicrotask(()=>{x.current[y]?.focus()}))});return{props:{ref:v,onFocus(e){let t=_.current,n=se(e.nativeEvent);!t||n==null||!P(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:D},highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,onMapChange:T,relayKeyboardEvent:D}}function Fe(e,t){for(let n of B)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Ie(e){let{render:t,className:n,style:r,refs:i=s,props:a=s,state:o=c,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:d,orientation:f,grid:p,loopFocus:h,onLoop:_,enableHomeAndEndKeys:v,onMapChange:y,stopEventPropagation:b=!0,rootRef:x,disabledIndices:S,modifierKeys:C,highlightItemOnHover:w=!1,tag:T=`div`,...E}=e,{props:D,highlightedIndex:O,onHighlightedIndexChange:k,elementsRef:A,onMapChange:j,relayKeyboardEvent:M}=Pe({grid:p,loopFocus:h,onLoop:_,orientation:f,highlightedIndex:u,onHighlightedIndexChange:d,rootRef:x,stopEventPropagation:b,enableHomeAndEndKeys:v,direction:H(),disabledIndices:S,modifierKeys:C}),N=m(T,e,{state:o,ref:i,props:[D,...a,E],stateAttributesMapping:l}),P=Y.useMemo(()=>({highlightedIndex:O,onHighlightedIndexChange:k,highlightItemOnHover:w,relayKeyboardEvent:M}),[O,k,w,M]);return(0,Q.jsx)(g.Provider,{value:P,children:(0,Q.jsx)(te,{elementsRef:A,onMapChange:e=>{y?.(e),j(e)},children:N})})}var Le=Y.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...c}=e,{orientation:l,setTabMap:u,tabActivationDirection:d}=X(),[f,p]=Y.useState(0),[m,h]=Y.useState(null),g=Y.useRef(new Set),_=Y.useRef(new Set),v=Y.useRef(null);y(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{g.current.forEach(e=>{e()})});return v.current=e,m&&e.observe(m),_.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),v.current=null}},[m]);let x=b(e=>(g.current.add(e),()=>{g.current.delete(e)})),S=b(e=>(_.current.add(e),v.current?.observe(e),()=>{_.current.delete(e),v.current?.unobserve(e)})),C={orientation:l,tabActivationDirection:d},w={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},T=Y.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,tabsListElement:m}),[n,x,S,m]);return(0,Q.jsx)(Oe.Provider,{value:T,children:(0,Q.jsx)(Ie,{render:a,className:r,style:o,state:C,refs:[t,h],props:[w,c],stateAttributesMapping:Z,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:p,onMapChange:u,disabledIndices:s})})});function Re({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(we,{"data-slot":`tabs`,"data-orientation":t,className:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var ze=d(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Be({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(Le,{"data-slot":`tabs-list`,"data-variant":t,className:o(ze({variant:t}),e),...n})}function Ve({className:e,...t}){return(0,Q.jsx)(Ae,{"data-slot":`tabs-trigger`,className:o(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function He({className:e,...t}){return(0,Q.jsx)(Me,{"data-slot":`tabs-content`,className:o(`flex-1 text-sm outline-none`,e),...t})}function Ue(){let{loop:e,tasks:t,poll:n,readiness:i}=oe.useLoaderData();le();let a=be(i,e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(r,{to:`/loops`,className:`flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(S,{className:`size-4`}),`Loops`]}),(0,Q.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.name}),a.length>0?(0,Q.jsxs)(J,{children:[(0,Q.jsx)(he,{}),(0,Q.jsx)(q,{children:`This loop cannot run yet`}),(0,Q.jsx)(K,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Q.jsx)(`span`,{children:e},e))})]}):null,(0,Q.jsx)(Ge,{loop:e,poll:n}),(0,Q.jsxs)(Re,{defaultValue:`settings`,children:[(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(Ve,{value:`settings`,children:`Settings`}),(0,Q.jsx)(Ve,{value:`tasks`,children:`Tasks`})]}),(0,Q.jsx)(He,{value:`settings`,className:`pt-2`,children:(0,Q.jsx)(C,{loop:e})}),(0,Q.jsxs)(He,{value:`tasks`,className:`flex flex-col gap-4 pt-2`,children:[(0,Q.jsx)(Ke,{loop:e}),(0,Q.jsx)(T,{tasks:t,showLoop:!1,empty:`This loop has not run yet.`})]})]})]})}function We(e){return new Date(e).toLocaleString()}function Ge({loop:e,poll:n}){let r=t(),[i,a]=(0,Y.useState)(!1);return e.enabled?n.pollError?(0,Q.jsxs)(J,{variant:`destructive`,children:[(0,Q.jsx)(he,{}),(0,Q.jsx)(q,{children:`The last look did not work`}),(0,Q.jsx)(K,{children:n.pollError})]}):(0,Q.jsx)(f,{children:(0,Q.jsxs)(p,{className:`flex flex-col gap-4 pt-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsx)(xe,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:n.polledAt?`Watching. Last looked ${We(n.polledAt)}.`:`Not looked yet. The dispatcher checks every couple of minutes; the first look records what is already waiting without running it.`})]}),n.backlog.length>0?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:n.backlog.length===1?`One thing is waiting`:`${n.backlog.length} things are waiting`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Matched, but not run: either it was already there before the loop was made, or it was held back for the reason shown. Run them if you want them dealt with too.`})]}),(0,Q.jsx)(x,{variant:`outline`,size:`sm`,disabled:i,onClick:async()=>{a(!0);try{let{queued:t}=await O({data:{id:e.id}});await r.invalidate(),_.success(t===1?`Queued 1 run`:`Queued ${t} runs`)}catch(e){_.error(e instanceof Error?e.message:String(e))}finally{a(!1)}},children:i?`Queueing...`:`Run these too`})]}),(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[n.backlog.slice(0,8).map(e=>(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.sourceRef,` · `,e.sourceTitle,e.hold?(0,Q.jsxs)(`span`,{className:`text-foreground`,children:[` · `,e.hold]}):null]},e.key)),n.backlog.length>8?(0,Q.jsxs)(`li`,{children:[`and `,n.backlog.length-8,` more`]}):null]})]}):null]})}):(0,Q.jsxs)(J,{children:[(0,Q.jsx)(q,{children:`This loop is off`}),(0,Q.jsx)(K,{children:`Nothing is being watched for until you turn it back on.`})]})}function Ke({loop:e}){let n=t(),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!0),[s,c]=(0,Y.useState)(!1),l=E(e.connectorId),u=l?.byHand??{kind:`none`},d=async()=>{c(!0);try{await w({data:{loopId:e.id,url:r.trim(),dryRun:a}}),await n.invalidate(),i(``),_.success(a?`Queued as a dry run`:`Queued`)}catch(e){_.error(e instanceof Error?e.message:String(e))}finally{c(!1)}};return u.kind===`none`?(0,Q.jsx)(f,{children:(0,Q.jsx)(p,{className:`pt-6 text-sm text-muted-foreground`,children:`This loop can only run on something arriving, so there is nothing to start by hand. What it does with what arrives is worth trying on the first one, with dry run left on.`})}):(0,Q.jsx)(f,{children:(0,Q.jsxs)(p,{className:`flex flex-col gap-4 pt-6`,children:[(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.kind===`now`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{children:`Run it now, without waiting for the time`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Runs exactly as it would when the clock came round, and does not count as that run: the next scheduled one still happens.`}),(0,Q.jsxs)(x,{onClick:d,disabled:s,children:[(0,Q.jsx)(Se,{}),`Run`]})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(G,{htmlFor:`run-url`,children:[`Try this loop on a `,l?.name??``,` link`]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(j,{id:`run-url`,value:r,placeholder:u.placeholder,onChange:e=>i(e.target.value)}),(0,Q.jsxs)(x,{onClick:d,disabled:s||r.trim()===``,children:[(0,Q.jsx)(Se,{}),`Run`]})]})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(G,{htmlFor:`run-dry`,children:`Dry run`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:a?`Prepare the result and show it to you, without writing anything.`:`Write the result back, exactly as the loop would on its own.`})]}),(0,Q.jsx)(D,{id:`run-dry`,checked:a,onCheckedChange:o})]})]})})}export{Ue as component};
@@ -1 +0,0 @@
1
- import{I as e,M as t,St as n,T as r,a as i,b as a,bt as o,i as s,n as c,o as l,r as u}from"./preload-helper-ORbuV86A.js";import{k as d,t as f}from"./button-HCY6DCY-.js";import{t as p}from"./arrow-left-BF9juV9T.js";import{c as m}from"./tasks-B8MsKgic.js";import{i as h,r as g,t as _}from"./task-list-BpOStt9v.js";import{t as v}from"./external-link-D46X-bXa.js";import{t as y}from"./loader-CcBl2u8m.js";import{i as b,r as x}from"./manifests-DNMqf7Vi.js";import{f as S,p as C,s as w}from"./index-ztzex0FN.js";import{n as T,r as E,t as D}from"./alert-Bn9-Zm0l.js";var O=a(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),k=a(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),A=n(o()),j=e();function M(){let{task:e,log:t}=w.useLoaderData(),n=b(e.actionConnectorId),a=x(e.actionConnectorId,e.actionId);return S([e]),(0,j.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,j.jsxs)(r,{to:`/inbox`,className:`flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,j.jsx)(p,{className:`size-4`}),`Inbox`]}),(0,j.jsxs)(`header`,{className:`flex items-start gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex-1`,children:[(0,j.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:h(e)}),(0,j.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[e.sourceRef,` ·`,` `,(0,j.jsx)(r,{to:`/loops/$loopId`,params:{loopId:e.loopId},className:`underline`,children:e.loopName})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,j.jsx)(g,{state:e.state}),e.dryRun?(0,j.jsx)(l,{variant:`outline`,children:`Dry run`}):null,C(e.state)?(0,j.jsx)(F,{task:e}):null]})]}),e.error?(0,j.jsxs)(D,{variant:e.state===`failed`?`destructive`:void 0,children:[(0,j.jsx)(E,{children:e.state===`failed`?`This run failed`:e.state===`cancelled`?`Stopped before it finished`:`Waiting to try again`}),(0,j.jsx)(T,{className:`whitespace-pre-wrap`,children:e.error})]}):null,e.state===`skipped`?(0,j.jsxs)(D,{children:[(0,j.jsx)(E,{children:`Nothing was written`}),(0,j.jsx)(T,{children:`The agent judged there was nothing worth posting, so Loopable stayed quiet.`})]}):null,e.output?(0,j.jsxs)(c,{children:[(0,j.jsxs)(s,{className:`flex flex-row items-center gap-3`,children:[(0,j.jsx)(i,{className:`flex-1 text-base`,children:e.state===`done`?`What was written`:`What the agent wrote`}),e.resultUrl?(0,j.jsxs)(f,{variant:`outline`,size:`sm`,nativeButton:!1,render:(0,j.jsx)(`a`,{href:e.resultUrl,target:`_blank`,rel:`noreferrer`}),children:[`See it on `,n?.name??e.actionConnectorId,(0,j.jsx)(v,{})]}):null]}),(0,j.jsxs)(u,{className:`flex flex-col gap-4`,children:[(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-sm`,children:e.output}),e.comments.length>0?(0,j.jsx)(N,{comments:e.comments}):null]})]}):null,t?(0,j.jsx)(P,{log:t,live:C(e.state)}):null,(0,j.jsxs)(c,{children:[(0,j.jsx)(s,{children:(0,j.jsx)(i,{className:`text-base`,children:`How this ran`})}),(0,j.jsxs)(u,{className:`flex flex-col gap-3 text-sm`,children:[(0,j.jsx)(I,{label:`Source`,children:e.sourceUrl?(0,j.jsxs)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline`,children:[_[e.sourceKind],` `,e.sourceRef,(0,j.jsx)(v,{className:`size-3`})]}):(0,j.jsxs)(`span`,{children:[_[e.sourceKind],` `,e.sourceRef]})}),(0,j.jsxs)(I,{label:`Action`,children:[a?.name??e.actionId,e.actionConnectorId===e.connectorId?null:` on ${n?.name??e.actionConnectorId}`]}),(0,j.jsx)(I,{label:`Agent`,children:e.agentId??`unknown`}),(0,j.jsx)(I,{label:`Queued`,children:new Date(e.createdAt).toLocaleString()}),e.attempts>1?(0,j.jsx)(I,{label:`Attempt`,children:e.attempts}):null,e.durationMs?(0,j.jsxs)(I,{label:`Took`,children:[(e.durationMs/1e3).toFixed(1),`s`]}):null,e.agentCommand?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Command`}),(0,j.jsx)(`pre`,{className:`mt-1 overflow-x-auto rounded-md bg-muted p-2.5 text-xs`,children:e.agentCommand})]}):null]})]})]})}function N({comments:e}){return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 border-t pt-4`,children:[(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.length===1?`One comment, on the line it is about`:`${e.length} comments, each on the line it is about`}),e.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsxs)(`p`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,j.jsx)(k,{className:`size-3.5 shrink-0`}),(0,j.jsxs)(`span`,{className:`truncate`,children:[e.path,`:`,e.startLine?`${e.startLine}-${e.line}`:e.line]})]}),(0,j.jsx)(`pre`,{className:`whitespace-pre-wrap break-words border-l-2 pl-3 text-sm`,children:e.body})]},`${e.path}:${e.line}:${t}`))]})}function P({log:e,live:t}){let n=(0,A.useRef)(null);return(0,A.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[t,e]),(0,j.jsxs)(c,{children:[(0,j.jsxs)(s,{className:`flex flex-row items-center gap-3`,children:[(0,j.jsx)(i,{className:`flex-1 text-base`,children:`Agent log`}),t?(0,j.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,j.jsx)(y,{className:`size-3.5 animate-spin`}),`still running`]}):null]}),(0,j.jsx)(u,{children:(0,j.jsx)(`pre`,{ref:n,className:`max-h-80 overflow-auto rounded-md bg-muted p-2.5 text-xs leading-relaxed whitespace-pre-wrap break-words`,children:e})})]})}function F({task:e}){let n=t(),[r,i]=(0,A.useState)(e.cancelRequested);return(0,j.jsxs)(f,{variant:`outline`,size:`sm`,onClick:async()=>{i(!0);try{await m({data:{id:e.id}}),await n.invalidate()}catch(e){i(!1),d.error(e instanceof Error?e.message:String(e))}},disabled:r,children:[(0,j.jsx)(O,{}),r?`Stopping`:`Stop`]})}function I({label:e,children:t}){return(0,j.jsxs)(`div`,{className:`flex gap-3`,children:[(0,j.jsx)(`span`,{className:`w-20 shrink-0 text-xs text-muted-foreground`,children:e}),(0,j.jsx)(`span`,{className:`text-sm`,children:t})]})}export{M as component};
@@ -1 +0,0 @@
1
- import{I as e,bt as t,c as n,l as r}from"./preload-helper-ORbuV86A.js";t();var i=e(),a=r(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function o({className:e,variant:t,...r}){return(0,i.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:n(a({variant:t}),e),...r})}function s({className:e,...t}){return(0,i.jsx)(`div`,{"data-slot":`alert-title`,className:n(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function c({className:e,...t}){return(0,i.jsx)(`div`,{"data-slot":`alert-description`,className:n(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}export{c as n,s as r,o as t};
@@ -1 +0,0 @@
1
- import{b as e}from"./preload-helper-ORbuV86A.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{b as e}from"./preload-helper-ORbuV86A.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{I as e,St as t,_ as n,bt as r,c as i,g as a,l as o,u as s,v as c,xt as l,y as u}from"./preload-helper-ORbuV86A.js";var d=l((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.0`})),f=l(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()})),p=t(r(),1),ee=t(f(),1);function te(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var ne=e=>{switch(e){case`success`:return ie;case`info`:return oe;case`warning`:return ae;case`error`:return h;default:return null}},re=Array(12).fill(0),m=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},re.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),ie=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},p.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),ae=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},p.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),oe=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),h=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),se=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},p.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),p.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),g=()=>{let[e,t]=p.useState(document.hidden);return p.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},_=1,v=100,y=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:_++,b=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-v;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=y(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],p.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(ce(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=y(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},x=(e,t)=>b.message(e,t),ce=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,S=Object.assign(x,{success:b.success,info:b.info,warning:b.warning,error:b.error,custom:b.custom,message:b.message,promise:b.promise,dismiss:b.dismiss,loading:b.loading},{getHistory:()=>b.toasts,getToasts:()=>b.getActiveToasts()});te(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function C(e){return e.label!==void 0}var w=3,T=`24px`,E=`16px`,le=4e3,D=356,ue=14,O=45,k=200;function A(...e){return e.filter(Boolean).join(` `)}function j(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var de=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:ee,style:te,cancelButtonStyle:re,actionButtonStyle:ie,className:ae=``,descriptionClassName:oe=``,duration:h,position:_,gap:v,expandByDefault:y,classNames:b,icons:x,closeButtonAriaLabel:ce=`Close toast`}=e,[S,w]=p.useState(null),[T,E]=p.useState(null),[D,ue]=p.useState(!1),[de,fe]=p.useState(!1),[pe,M]=p.useState(!1),[N,P]=p.useState(!1),[F,I]=p.useState(!1),[L,R]=p.useState(0),[z,B]=p.useState(0),V=p.useRef(n.duration||h||le),me=p.useRef(null),H=p.useRef(null),he=c===0,ge=c+1<=o,U=n.type,W=U??`default`,G=n.dismissible!==!1,_e=n.className||``,ve=n.descriptionClassName||``,K=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ye=p.useMemo(()=>n.closeButton??ee,[n.closeButton,ee]),be=p.useMemo(()=>n.duration||h||le,[n.duration,h]),q=p.useRef(0),J=p.useRef(0),Y=p.useRef(0),X=p.useRef(null),[xe,Se]=_.split(`-`),Ce=p.useMemo(()=>s.reduce((e,t,n)=>n>=K?e:e+t.height,0),[s,K]),we=g(),Z=p.useMemo(()=>e.swipeDirections??j(_),[e.swipeDirections,_]),Te=n.invert||t,Q=U===`loading`;J.current=p.useMemo(()=>K*v+Ce,[K,Ce]),p.useEffect(()=>{V.current=be},[be]),p.useEffect(()=>{ue(!0)},[]),p.useEffect(()=>{let e=H.current;if(e){let t=e.getBoundingClientRect().height;return B(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!D)return;let e=H.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,B(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[D,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let $=p.useCallback(()=>{fe(!0),R(J.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},k)},[n,d,a,J]);p.useEffect(()=>{if(n.promise&&U===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||we?(()=>{if(Y.current<q.current){let e=new Date().getTime()-q.current;V.current-=e}Y.current=new Date().getTime()})():V.current!==1/0&&(q.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},V.current)),()=>clearTimeout(e)},[u,i,n,U,we,$]),p.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function Ee(){return x?.loading?p.createElement(`div`,{className:A(b?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":U===`loading`},x.loading):p.createElement(m,{className:A(b?.loader,n?.classNames?.loader),visible:U===`loading`})}let De=n.icon||x?.[U]||ne(U);return p.createElement(`li`,{tabIndex:0,ref:H,className:A(ae,_e,b?.toast,n?.classNames?.toast,b?.[W],n?.classNames?.[W]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":D,"data-promise":!!n.promise,"data-swiped":F,"data-removed":de,"data-visible":ge,"data-y-position":xe,"data-x-position":Se,"data-index":c,"data-front":he,"data-swiping":pe,"data-dismissible":G,"data-type":U,"data-invert":Te,"data-swipe-out":N,"data-swipe-direction":T,"data-expanded":!!(u||y&&D),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${de?L:J.current}px`,"--initial-height":y?`auto`:`${z}px`,...te,...n.style},onDragEnd:()=>{M(!1),w(null),X.current=null},onPointerDown:e=>{e.button!==2&&(Q||!G||(me.current=new Date,R(J.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(M(!0),X.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(N||!G)return;X.current=null;let e=Number(H.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(H.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-me.current?.getTime(),i=S===`x`?e:t,a=Math.abs(i)/r;if((S===`x`?Z.includes(e>0?`right`:`left`):Z.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=O||a>.11)){R(J.current),n.onDismiss==null||n.onDismiss.call(n,n),E(S===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),P(!0);return}var o,s;(o=H.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=H.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),I(!1),M(!1),w(null)},onPointerMove:e=>{var t,n;if(!X.current||!G||window.getSelection()?.toString().length>0)return;let r=e.clientY-X.current.y,i=e.clientX-X.current.x;!S&&(Math.abs(i)>1||Math.abs(r)>1)&&w(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(S===`y`){if(Z.includes(`top`)||Z.includes(`bottom`)){if(Z.includes(`top`)&&r<0||Z.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(S===`x`&&(Z.includes(`left`)||Z.includes(`right`))){if(Z.includes(`left`)&&i<0||Z.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&I(!0),(t=H.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=H.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},ye&&!n.jsx&&U!==`loading`?p.createElement(`button`,{"aria-label":ce,"data-disabled":Q,"data-close-button":!0,onClick:Q||!G?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:A(b?.closeButton,n?.classNames?.closeButton)},x?.close??se):null,(U||n.icon||n.promise)&&n.icon!==null&&(x?.[U]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:A(b?.icon,n?.classNames?.icon)},U===`loading`?n.icon||Ee():n.promise?Ee():null,U===`loading`?null:De):null,p.createElement(`div`,{"data-content":``,className:A(b?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:A(b?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?p.createElement(`div`,{"data-description":``,className:A(oe,ve,b?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&C(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||re,onClick:e=>{C(n.cancel)&&G&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:A(b?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&C(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||ie,onClick:e=>{C(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:A(b?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function fe(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function pe(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?E:T;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var M=p.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:te,style:ne,visibleToasts:re=w,toastOptions:m,dir:ie=fe(),gap:ae=ue,icons:oe,customAriaLabel:h,containerAriaLabel:se=`Notifications`}=e,[g,_]=p.useState([]),v=p.useMemo(()=>n?g.filter(e=>e.toasterId===n):g.filter(e=>!e.toasterId),[g,n]),y=p.useMemo(()=>Array.from(new Set([i].concat(v.filter(e=>e.position).map(e=>e.position)))),[v,i]),[x,ce]=p.useState([]),[S,C]=p.useState(!1),[T,E]=p.useState(!1),[le,O]=p.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),k=p.useRef(null),A=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),j=p.useRef(null),M=p.useRef(!1),N=p.useCallback(e=>{_(t=>(t.find(t=>t.id===e.id)?.delete||b.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>b.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{_(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{ee.flushSync(()=>{_(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),p.useEffect(()=>{if(d!==`system`){O(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?O(`dark`):O(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{O(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{O(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),p.useEffect(()=>{g.length<=1&&C(!1)},[g]),p.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;C(!0),(t=k.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===k.current||k.current?.contains(document.activeElement))&&C(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),p.useEffect(()=>{if(k.current)return()=>{j.current&&(j.current.focus({preventScroll:!0}),j.current=null,M.current=!1)}},[k.current]),p.createElement(`section`,{ref:t,"aria-label":h??`${se} ${A}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},y.map((t,n)=>{let[i,a]=t.split(`-`);return v.length?p.createElement(`ol`,{key:t,dir:ie===`auto`?fe():ie,tabIndex:-1,ref:k,className:c,"data-sonner-toaster":!0,"data-sonner-theme":le,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${x[0]?.height||0}px`,"--width":`${D}px`,"--gap":`${ae}px`,...ne,...pe(l,u)},onBlur:e=>{M.current&&!e.currentTarget.contains(e.relatedTarget)&&(M.current=!1,j.current&&=(j.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M.current||(M.current=!0,j.current=e.relatedTarget)},onMouseEnter:()=>C(!0),onMouseMove:()=>C(!0),onMouseLeave:()=>{T||C(!1)},onDragEnd:()=>C(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||E(!0)},onPointerUp:()=>E(!1)},v.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>p.createElement(de,{key:n.id,icons:oe,index:i,toast:n,defaultRichColors:f,duration:m?.duration??te,className:m?.className,descriptionClassName:m?.descriptionClassName,invert:r,visibleToasts:re,closeButton:m?.closeButton??s,interacting:T,position:t,style:m?.style,unstyled:m?.unstyled,classNames:m?.classNames,cancelButtonStyle:m?.cancelButtonStyle,actionButtonStyle:m?.actionButtonStyle,closeButtonAriaLabel:m?.closeButtonAriaLabel,removeToast:N,toasts:v.filter(e=>e.position==n.position),heights:x.filter(e=>e.position==n.position),setHeights:ce,expandByDefault:o,gap:ae,expanded:S,swipeDirections:e.swipeDirections}))):null}))});function N(){return typeof window<`u`}function P(e){return L(e)?(e.nodeName||``).toLowerCase():`#document`}function F(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function I(e){return((L(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function L(e){return N()?e instanceof Node||e instanceof F(e).Node:!1}function R(e){return N()?e instanceof Element||e instanceof F(e).Element:!1}function z(e){return N()?e instanceof HTMLElement||e instanceof F(e).HTMLElement:!1}function B(e){return!N()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof F(e).ShadowRoot}function V(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ye(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function me(e){return/^(table|td|th)$/.test(P(e))}function H(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var he=/transform|translate|scale|rotate|perspective|filter/,ge=/paint|layout|strict|content/,U=e=>!!e&&e!==`none`,W;function G(e){let t=R(e)?ye(e):e;return U(t.transform)||U(t.translate)||U(t.scale)||U(t.rotate)||U(t.perspective)||!ve()&&(U(t.backdropFilter)||U(t.filter))||he.test(t.willChange||``)||ge.test(t.contain||``)}function _e(e){let t=q(e);for(;z(t)&&!K(t);){if(G(t))return t;if(H(t))return null;t=q(t)}return null}function ve(){return W??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),W}function K(e){return/^(html|body|#document)$/.test(P(e))}function ye(e){return F(e).getComputedStyle(e)}function be(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function q(e){if(P(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||B(e)&&e.host||I(e);return B(t)?t.host:t}function J(e){let t=q(e);return K(t)?(e.ownerDocument||e).body:z(t)&&V(t)?t:J(t)}function Y(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=J(e),i=r===e.ownerDocument?.body,a=F(r);if(i){let e=X(a);return t.concat(a,a.visualViewport||[],V(r)?r:[],e&&n?Y(e):[])}return t.concat(r,Y(r,[],n))}function X(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var xe={...p},Se=xe.useInsertionEffect,Ce=Se&&Se!==xe.useLayoutEffect?Se:e=>e();function we(e){let t=u(Z).current;return t.next=e,Ce(t.effect),t.trampoline}function Z(){let e={next:void 0,callback:Te,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Te(){}var Q=typeof document<`u`?p.useLayoutEffect:()=>{},$=p.createContext(void 0);function Ee(e=!1){let t=p.useContext($);if(t===void 0&&!e)throw Error(a(16));return t}function De(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:p.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Oe(e,t,{detail:n=0}={}){e.dispatchEvent(new(F(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function ke(e={}){let{disabled:t=!1,focusableWhenDisabled:r,tabIndex:i=0,native:a=!0,composite:o}=e,s=p.useRef(null),l=Ee(!0),u=o??l!==void 0,{props:d}=De({focusableWhenDisabled:r,disabled:t,composite:u,tabIndex:i,isNativeButton:a}),f=p.useCallback(()=>{let e=s.current;Ae(e)&&u&&t&&d.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,d.disabled,u]);return Q(f,[f]),{getButtonProps:p.useCallback((e={})=>{let{onClick:r,onMouseDown:i,onKeyUp:o,onKeyDown:s,onPointerDown:l,...f}=e;return c({onClick(e){if(t){e.preventDefault();return}r?.(e)},onMouseDown(e){t||i?.(e)},onKeyDown(e){if(t||(n(e),s?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,i=e.currentTarget,o=Ae(i),c=!a&&je(i),l=r&&(a?o:!c),d=e.key===`Enter`,f=e.key===` `,p=i.getAttribute(`role`),ee=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&u&&f){if(e.defaultPrevented&&ee)return;e.preventDefault(),(!a||o)&&(e.preventBaseUIHandler(),Oe(i,e));return}if(!l||a||!f&&!d){r&&c&&f&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),d&&(e.preventBaseUIHandler(),Oe(i,e)))},onKeyUp(e){if(!t){if(n(e),o?.(e),e.target===e.currentTarget&&a&&u&&Ae(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!a&&!u&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Oe(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},a?{type:`button`}:{role:`button`},d,f)},[t,d,u,a]),buttonRef:we(e=>{s.current=e,f()})}}function Ae(e){return z(e)&&e.tagName===`BUTTON`}function je(e){return z(e)&&e.tagName===`A`&&!!e.href}var Me=p.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:c,...l}=e,{getButtonProps:u,buttonRef:d}=ke({disabled:i,focusableWhenDisabled:a,native:o});return s(`button`,e,{state:{disabled:i},ref:[t,d],props:[l,u]})}),Ne=e(),Pe=o(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function Fe({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Ne.jsx)(Me,{"data-slot":`button`,className:i(Pe({variant:t,size:n,className:e})),...r})}export{f as A,V as C,ve as D,H as E,M as O,L as S,me as T,F as _,Ee as a,z as b,xe as c,I as d,X as f,q as g,Y as h,$ as i,S as k,ye as l,be as m,ke as n,Q as o,P as p,Oe as r,we as s,Fe as t,_e as u,G as v,B as w,K as x,R as y};
@@ -1 +0,0 @@
1
- import{I as e,o as t}from"./preload-helper-ORbuV86A.js";var n=e(),r={connected:{text:`Connected`,variant:`default`},needs_reauth:{text:`Needs reconnecting`,variant:`destructive`},error:{text:`Error`,variant:`destructive`},paused:{text:`Paused`,variant:`secondary`}};function i({status:e}){let i=r[e]??r.error;return(0,n.jsx)(t,{variant:i.variant,children:i.text})}export{i as t};
@@ -1 +0,0 @@
1
- import{I as e,b as t,c as n}from"./preload-helper-ORbuV86A.js";import{s as r}from"./manifests-DNMqf7Vi.js";var i=t(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),a=e();function o(e,t){return function({className:n}){return(0,a.jsx)(`svg`,{viewBox:e,fill:`currentColor`,"aria-hidden":!0,className:n,children:(0,a.jsx)(`path`,{d:t})})}}var s={Github:o(`0 0 16 16`,`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-2.65-.89-2.65-2.5 0-.77.27-1.4.72-1.9-.07-.18-.31-.9.07-1.87 0 0 .59-.19 1.93.72a6.5 6.5 0 0 1 1.76-.24c.6 0 1.2.08 1.76.24 1.34-.91 1.93-.72 1.93-.72.38.97.14 1.69.07 1.87.45.5.72 1.13.72 1.9 0 1.62-.88 2.3-2.66 2.5.28.24.52.71.52 1.44 0 1.03-.01 1.87-.01 2.13 0 .21.15.46.55.38A7.99 7.99 0 0 0 16 8c0-4.42-3.58-8-8-8Z`),Gmail:o(`0 0 24 24`,`M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-.904.732-1.636 1.636-1.636h.749L12 10.907l9.615-7.086h.749c.904 0 1.636.732 1.636 1.636Z`),Wechat:o(`0 0 24 24`,`M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 4.882-2.235 7.621-1.552-.983-3.29-4.269-5.653-8.163-5.653zm-2.877 3.63a1.09 1.09 0 0 1 1.089 1.089 1.09 1.09 0 0 1-1.089 1.09 1.09 1.09 0 0 1-1.089-1.09 1.09 1.09 0 0 1 1.09-1.089zm5.807 0a1.09 1.09 0 0 1 1.089 1.089 1.09 1.09 0 0 1-1.09 1.09 1.09 1.09 0 0 1-1.088-1.09 1.09 1.09 0 0 1 1.089-1.089zm5.463 3.573C13.008 9.39 9.9 12.06 9.9 15.354c0 1.874 1.017 3.582 2.67 4.834a.492.492 0 0 1 .177.554l-.324 1.235c-.016.058-.04.117-.04.177 0 .136.108.246.242.246a.271.271 0 0 0 .14-.045l1.586-.928a.72.72 0 0 1 .597-.082c.786.226 1.633.336 2.517.336 4 0 7.245-2.741 7.245-6.122 0-3.38-3.245-6.121-7.245-6.121zm-2.203 3.026a.908.908 0 0 1 .907.907.908.908 0 0 1-.907.908.908.908 0 0 1-.908-.908.908.908 0 0 1 .908-.907zm4.839 0a.908.908 0 0 1 .907.907.908.908 0 0 1-.907.908.908.908 0 0 1-.908-.908.908.908 0 0 1 .908-.907z`),Clock:i,Plug:r};function c({icon:e,accent:t,className:i}){let o=s[e]??r;return(0,a.jsx)(`span`,{className:n(`flex size-9 shrink-0 items-center justify-center rounded-lg`,t,i),children:(0,a.jsx)(o,{className:`size-5`})})}export{i as n,c as t};
@@ -1 +0,0 @@
1
- import{x as e,z as t}from"./preload-helper-ORbuV86A.js";var n=e({method:`GET`}).handler(t(`0e209afb63fad4a95a5cfeaf4831610f23673145cbf5b8054765d79804a62d31`)),r=e({method:`POST`}).handler(t(`794964d675b97edaa881ab5cb209225ef0a4507e3d2771d6577658a058e7621f`)),i=e({method:`POST`}).handler(t(`43b97e3644ad73286fe5de3e99134bff099e1a8704f1ae91fe643d419eceba73`)),a=e({method:`POST`}).handler(t(`f94f0787ce6704ea24f18add66832e0367a0feb9a690d8ad6454abec5e5df193`)),o=e({method:`POST`}).handler(t(`f9ade3084971078ee9f2bc16fcdcdfb5a8d66a0f9b634803bb611287c14e21d7`)),s=e({method:`POST`}).handler(t(`18bae5deb2a19571893f0067e374e537f16d6774f9b4e04f9b7349360f6f8fdc`));export{s as a,n as i,i as n,o,a as r,r as t};
@@ -1 +0,0 @@
1
- import{I as e,St as t,T as n,bt as r,i,n as a,o,r as s}from"./preload-helper-ORbuV86A.js";import{k as c,t as l}from"./button-HCY6DCY-.js";import{t as u}from"./arrow-right-CzqvnOY1.js";import{t as d}from"./connector-icon-BZ_MUJV_.js";import{o as f,t as p}from"./manifests-DNMqf7Vi.js";import{mt as m,u as h}from"./index-ztzex0FN.js";import{t as g}from"./connection-status-CYZB8kLy.js";var _=t(r()),v=e();function y(){let e=h.useLoaderData(),{connected:t,error:r}=h.useSearch(),y=h.useNavigate();return(0,_.useEffect)(()=>{!t&&!r||(t&&c.success(`Connected as ${t}`),r&&c.error(r),y({search:{},replace:!0}))},[t,r,y]),(0,v.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,v.jsxs)(`header`,{children:[(0,v.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Connectors`}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect the services a loop should watch. Credentials stay with Loopable.`})]}),(0,v.jsx)(`div`,{className:`flex flex-col gap-4`,children:p.filter(e=>f(e.id)).map(t=>{let r=e.find(e=>e.connectorId===t.id),c=r?.connections??[],f=r?.readiness,p=f&&!f.ready?f:null;return(0,v.jsxs)(a,{children:[(0,v.jsxs)(i,{className:`flex flex-row items-start gap-4`,children:[(0,v.jsx)(d,{icon:t.icon,accent:t.accent}),(0,v.jsxs)(`div`,{className:`flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:t.name}),c.length>0?(0,v.jsxs)(o,{variant:`secondary`,children:[c.length,` account`,c.length>1?`s`:``]}):null]}),(0,v.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t.tagline})]}),(0,v.jsxs)(l,{variant:`outline`,render:(0,v.jsx)(n,{to:`/connectors/$connectorId`,params:{connectorId:t.id}}),children:[c.length>0?`Manage`:`Set up`,(0,v.jsx)(u,{})]})]}),(c.length>0||p)&&(0,v.jsxs)(s,{className:`flex flex-col gap-2 border-t pt-4`,children:[p?(0,v.jsxs)(`p`,{className:`flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,v.jsx)(m,{className:`mt-0.5 size-4 shrink-0`}),(0,v.jsx)(`span`,{children:p.reason})]}):null,c.map(e=>(0,v.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,v.jsx)(`span`,{className:`font-medium`,children:e.accountLabel}),(0,v.jsx)(g,{status:e.status}),e.lastError?(0,v.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.lastError}):null]},e.id))]})]},t.id)})})]})}export{y as component};
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n}from"./manifests-DNMqf7Vi.js";import{h as r}from"./index-ztzex0FN.js";function i(e){return r(e)?.name??e}function a(e,t){return e.agentId??t.defaultAgentId}function o(t){return e(t.connectorId,t.workflowId)?.runsIn===`folder`}function s(e,t){if(!t.enabled)return[];let n=[],r=a(t,e),s=o(t)?e.hostAgentIds:e.availableAgentIds;return r?s.includes(r)||n.push(o(t)?`${t.name} needs a runner on this host with ${i(r)} signed in.`:`${t.name} uses ${i(r)}, which no online runner has signed in.`):n.push(t.agentId?`${t.name} uses ${i(t.agentId)}, which no online runner has signed in.`:`No default agent is chosen, so this loop cannot run.`),n}function c(e,r){let i=[],a=new Set(e.connectedConnectorIds);if(a.size===0&&i.push(`No account is connected yet, so no signal can arrive.`),e.availableAgentIds.length===0?i.push(`No coding agent is signed in on any runner, so nothing can be prepared.`):e.defaultAgentId||i.push(`No default agent is chosen, so loops that do not name one cannot run.`),a.size>0){let e=e=>t(e)?.name??e;for(let t of r)t.enabled&&(n(t.connectorId)&&!a.has(t.connectorId)&&i.push(`${t.name} watches ${e(t.connectorId)}, which has no account.`),n(t.actionConnectorId)&&!a.has(t.actionConnectorId)&&i.push(`${t.name} answers on ${e(t.actionConnectorId)}, which has no account.`))}if(e.availableAgentIds.length>0)for(let t of r)for(let n of s(e,t))n!==`No default agent is chosen, so this loop cannot run.`&&i.push(n);return i}export{s as n,c as t};
@@ -1 +0,0 @@
1
- import{I as e,T as t}from"./preload-helper-ORbuV86A.js";import{n}from"./task-list-BpOStt9v.js";import{c as r}from"./index-ztzex0FN.js";var i=e();function a(){let{tasks:e}=r.useLoaderData();return(0,i.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,i.jsxs)(`header`,{children:[(0,i.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Inbox`}),(0,i.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Every run, in the order it happened, whether it wrote something or decided there was nothing to say.`})]}),(0,i.jsx)(n,{tasks:e,empty:`Nothing has run yet. Open a loop and try it against a pull request or issue link.`}),e.length===0?(0,i.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,i.jsx)(t,{to:`/loops`,className:`underline`,children:`Go to loops`})}):null]})}export{a as component};