@hearsay-tools/squawk 0.18.0-dev.5926 → 0.18.0-dev.5935

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 (145) hide show
  1. package/dist/ci-wait/controller.d.ts +37 -37
  2. package/dist/contract/delegation.d.ts +8 -2
  3. package/dist/contract/index.js +7 -1
  4. package/dist/contract/runs.d.ts +28 -0
  5. package/dist/contract/workspace-events.d.ts +8 -0
  6. package/dist/core/claude-cli-runner.js +13 -0
  7. package/dist/core/claude-cli-runner.js.map +1 -1
  8. package/dist/core/managed-session.js +13 -1
  9. package/dist/core/managed-session.js.map +1 -1
  10. package/dist/core/provider-error.d.ts +21 -0
  11. package/dist/core/provider-error.js +32 -0
  12. package/dist/core/provider-error.js.map +1 -0
  13. package/dist/delegation/conversation-send.js +2 -1
  14. package/dist/delegation/conversation-send.js.map +1 -1
  15. package/dist/delegation/conversations.d.ts +2 -0
  16. package/dist/delegation/results.js +7 -1
  17. package/dist/delegation/results.js.map +1 -1
  18. package/dist/delegation/retry-backoff.d.ts +6 -0
  19. package/dist/delegation/retry-backoff.js +6 -0
  20. package/dist/delegation/retry-backoff.js.map +1 -1
  21. package/dist/delegation/routes.d.ts +1 -1
  22. package/dist/delegation/service.d.ts +7 -1
  23. package/dist/delegation/service.js +33 -2
  24. package/dist/delegation/service.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +1 -1
  26. package/dist/runs/record-write-rules.js +1 -0
  27. package/dist/runs/record-write-rules.js.map +1 -1
  28. package/dist/runs/run-exits.d.ts +13 -0
  29. package/dist/runs/run-exits.js +4 -1
  30. package/dist/runs/run-exits.js.map +1 -1
  31. package/dist/runs/store.d.ts +5 -0
  32. package/dist/runs/store.js +2 -2
  33. package/dist/runs/store.js.map +1 -1
  34. package/dist/server/live-routes.d.ts +6 -6
  35. package/dist/server/reports-api.d.ts +2 -2
  36. package/dist/server/server.d.ts +58 -34
  37. package/dist/server/workspace-live-routes.d.ts +6 -6
  38. package/dist/task-cli/projections.d.ts +3 -1
  39. package/dist/task-cli/projections.js +1 -1
  40. package/dist/task-cli/projections.js.map +1 -1
  41. package/dist/workflows/continuation-admission.d.ts +15 -2
  42. package/dist/workflows/continuation-admission.js +12 -8
  43. package/dist/workflows/continuation-admission.js.map +1 -1
  44. package/dist/workflows/run/auto-resume.d.ts +27 -7
  45. package/dist/workflows/run/auto-resume.js +87 -39
  46. package/dist/workflows/run/auto-resume.js.map +1 -1
  47. package/dist/workflows/run/continuation-acceptance.js +1 -0
  48. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  49. package/dist/workflows/run/family-reconciler.d.ts +4 -2
  50. package/dist/workflows/run/family-reconciler.js +6 -2
  51. package/dist/workflows/run/family-reconciler.js.map +1 -1
  52. package/dist/workflows/run/launch-read-resolver.d.ts +11 -0
  53. package/dist/workflows/run/launch-read-resolver.js +31 -3
  54. package/dist/workflows/run/launch-read-resolver.js.map +1 -1
  55. package/dist/workflows/run/queued-revival.js +4 -2
  56. package/dist/workflows/run/queued-revival.js.map +1 -1
  57. package/dist/workflows/run/run-cancel.d.ts +8 -0
  58. package/dist/workflows/run/run-cancel.js +21 -8
  59. package/dist/workflows/run/run-cancel.js.map +1 -1
  60. package/dist/workflows/run/run-recovery.d.ts +2 -1
  61. package/dist/workflows/run/run-recovery.js +7 -2
  62. package/dist/workflows/run/run-recovery.js.map +1 -1
  63. package/dist/workflows/run/run-settlement.js +5 -1
  64. package/dist/workflows/run/run-settlement.js.map +1 -1
  65. package/dist/workflows/run/wait-engine.d.ts +1 -0
  66. package/dist/workflows/run-scheduling.d.ts +4 -3
  67. package/dist/workflows/run-scheduling.js +6 -3
  68. package/dist/workflows/run-scheduling.js.map +1 -1
  69. package/dist/workflows/run-states.js +7 -6
  70. package/dist/workflows/run-states.js.map +1 -1
  71. package/package.json +4 -4
  72. package/scripts/mock-claude.mjs +16 -2
  73. package/scripts/mock-codex-app-server.mjs +15 -7
  74. package/scripts/mock-cursor-print.mjs +6 -5
  75. package/scripts/mock-omp-rpc.mjs +11 -8
  76. package/scripts/mock-opencode-serve.mjs +6 -6
  77. package/scripts/mock-pi-rpc.mjs +8 -7
  78. package/scripts/mock-provider-failures.mjs +60 -0
  79. package/scripts/mock-scenario.d.mts +5 -1
  80. package/scripts/mock-scenario.mjs +21 -2
  81. package/web/dist/assets/{activity-motion-CjqsbE_g.js → activity-motion-XsGcc9eM.js} +2 -2
  82. package/web/dist/assets/{activity-route-DzEsfT7t.js → activity-route-DIDXHV7J.js} +1 -1
  83. package/web/dist/assets/agent-accounts-CuRvwNoA.js +18 -0
  84. package/web/dist/assets/{cez-idle-CeCZT-sG.js → cez-idle-DtpdVf_5.js} +1 -1
  85. package/web/dist/assets/commit-diff-panel-DtHg36xc.js +1 -0
  86. package/web/dist/assets/{control-locations-DaOulsa3.js → control-locations-CljaLD_b.js} +1 -1
  87. package/web/dist/assets/dialog-Dw7fMdDQ.js +1 -0
  88. package/web/dist/assets/diff-ImdJ4tPA.js +3 -0
  89. package/web/dist/assets/{diff-view-CfmxxyUY.js → diff-view-BMqNpcSH.js} +5 -5
  90. package/web/dist/assets/dist-DvNdR7gM.js +1 -0
  91. package/web/dist/assets/dropdown-menu-D7f0O7xR.js +1 -0
  92. package/web/dist/assets/{file-preview-B2nE-3__.js → file-preview-C58stPPw.js} +2 -2
  93. package/web/dist/assets/git-toolbar-Dzp24LO7.js +1 -0
  94. package/web/dist/assets/github-Cn0hlJsH.js +1 -0
  95. package/web/dist/assets/github-sidebar-model-BSNdxNKJ.js +1 -0
  96. package/web/dist/assets/global-activity-route-D5ke1ZQa.js +1 -0
  97. package/web/dist/assets/index-lMBPAedr.js +17 -0
  98. package/web/dist/assets/input-DIwJvCgi.js +1 -0
  99. package/web/dist/assets/{live-protocol-BW7Tcgel.js → live-protocol-BAiIX_Mf.js} +1 -1
  100. package/web/dist/assets/{live-refetch-C6SMj0X0.js → live-refetch-CstQIN6c.js} +1 -1
  101. package/web/dist/assets/{popover-s-Wchzjn.js → popover-N-u5z2xh.js} +1 -1
  102. package/web/dist/assets/preview-pane-connected-Cl-W1pDv.js +3 -0
  103. package/web/dist/assets/{project-router-BwqiOWKJ.js → project-router-Dd63wBeA.js} +1 -1
  104. package/web/dist/assets/{project-scope-context-uluvs2wj.js → project-scope-context-wlB-Y0ii.js} +2 -2
  105. package/web/dist/assets/{queries-DAqy62ZE.js → queries-BPdWfTBN.js} +1 -1
  106. package/web/dist/assets/repo-git-YYivBJ2x.js +1 -0
  107. package/web/dist/assets/report-reader-gGAlVnKU.js +1 -0
  108. package/web/dist/assets/reports-B_xpuTvK.js +1 -0
  109. package/web/dist/assets/run-header-CxRJxVsR.js +2 -0
  110. package/web/dist/assets/skills-CEFXcZA5.js +1 -0
  111. package/web/dist/assets/skills-DFBiAuJG.js +1 -0
  112. package/web/dist/assets/{tab-link-BVvvlYuP.js → tab-link-CDrve3Rf.js} +1 -1
  113. package/web/dist/assets/task-changes-Bm4gjXBb.js +1 -0
  114. package/web/dist/assets/task-commits-DYHV533w.js +1 -0
  115. package/web/dist/assets/task-files-Bqvj0rbX.js +1 -0
  116. package/web/dist/assets/{task-github-item-CLNenReR.js → task-github-item-YkTV2--_.js} +1 -1
  117. package/web/dist/assets/{task-thread-pXfmMMjX.js → task-thread-CempX7k0.js} +9 -9
  118. package/web/dist/assets/thread-state-BpcneWuV.js +4 -0
  119. package/web/dist/assets/use-hand-to-agent-state-B9qtivFb.js +1 -0
  120. package/web/dist/assets/{useInfiniteQuery-CiEosCuj.js → useInfiniteQuery-hrWYY8aw.js} +1 -1
  121. package/web/dist/assets/useQuery-BHmKi9_o.js +1 -0
  122. package/web/dist/assets/workflows-z-CqJ0JW.js +7 -0
  123. package/web/dist/assets/{ws-z9YXOZTu.js → ws-Cn8d-Fu-.js} +1 -1
  124. package/web/dist/index.html +20 -14
  125. package/web/dist/live-worker.js +1 -1
  126. package/web/dist/assets/commit-diff-panel-Bb4wf_W3.js +0 -1
  127. package/web/dist/assets/diff-B4RS7DWt.js +0 -3
  128. package/web/dist/assets/dropdown-menu-CjLqyqwB.js +0 -1
  129. package/web/dist/assets/git-toolbar-DU2zSHiS.js +0 -1
  130. package/web/dist/assets/github-CShk5cMR.js +0 -1
  131. package/web/dist/assets/global-activity-route-DIrLcZYG.js +0 -1
  132. package/web/dist/assets/index-BwivPbDv.js +0 -34
  133. package/web/dist/assets/preview-pane-connected-B3ojHAud.js +0 -3
  134. package/web/dist/assets/repo-git-CEsX0Pl_.js +0 -1
  135. package/web/dist/assets/report-reader-D-FCqQhz.js +0 -1
  136. package/web/dist/assets/reports-K_AU9caA.js +0 -1
  137. package/web/dist/assets/run-header-DoMR2dGB.js +0 -2
  138. package/web/dist/assets/skills-uCeis1zN.js +0 -1
  139. package/web/dist/assets/task-changes-Dt5-ONyP.js +0 -1
  140. package/web/dist/assets/task-commits-B1tTk4UH.js +0 -1
  141. package/web/dist/assets/task-files-DHR8W6JG.js +0 -1
  142. package/web/dist/assets/thread-state-C3eeB47-.js +0 -4
  143. package/web/dist/assets/use-hand-to-agent-state-DJx0K6um.js +0 -1
  144. package/web/dist/assets/useQuery-CT5sY3PJ.js +0 -1
  145. package/web/dist/assets/workflows-CKZKf_HF.js +0 -7
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{u as e}from"./button-CS5tOblf.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";t();var r=n();function i({className:t,type:n,...i}){return(0,r.jsx)(`input`,{type:n,"data-slot":`input`,className:e(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,t),...i})}export{i as t};
@@ -61,4 +61,4 @@ var e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInte
61
61
 
62
62
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ce,s=!u.jitless,c=s&&le.value,l=t.catchall,d;e._zod.parse=(u,f)=>{d??=r.value;let p=u.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),u=a(u,f),l?Tn([],p,u,f,d,e):u):n(u,f):(u.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),u)}});function On(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!x(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>C(e,r,d())))}),t)}var kn=s(`$ZodUnion`,(e,t)=>{T.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ne(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>On(t,r,e,i)):On(o,r,e,i)}}),An=s(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,kn.init(e,t);let n=e._zod.parse;m(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ee(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ce(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),jn=s(`$ZodIntersection`,(e,t)=>{T.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Nn(e,t,n)):Nn(e,i,a)}});function Mn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_(e)&&_(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Mn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Mn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Nn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),x(e))return e;let o=Mn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Pn=s(`$ZodRecord`,(e,t)=>{T.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!_(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>C(e,r,d())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...S(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...S(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&_t.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>C(e,r,d())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...S(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...S(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Fn=s(`$ZodEnum`,(e,t)=>{T.init(e,t);let n=f(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>de.has(typeof e)).map(e=>typeof e==`string`?v(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),In=s(`$ZodLiteral`,(e,t)=>{if(T.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?v(e):e?v(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ln=s(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new c;return n.value=i,n.fallback=!0,n}});function Rn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var zn=s(`$ZodOptional`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ne(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Rn(e,r)):Rn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Bn=s(`$ZodExactOptional`,(e,t)=>{zn.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Vn=s(`$ZodNullable`,(e,t)=>{T.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ne(e.source)}|null)$`):void 0}),m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Hn=s(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Un(e,t)):Un(r,t)}});function Un(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Wn=s(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Gn=s(`$ZodNonOptional`,(e,t)=>{T.init(e,t),m(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Kn(t,e)):Kn(i,e)}});function Kn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var qn=s(`$ZodCatch`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>C(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>C(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Jn=s(`$ZodPipe`,(e,t)=>{T.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Yn(e,t.in,n)):Yn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Yn(e,t.out,n)):Yn(r,t.out,n)}});function Yn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Xn=s(`$ZodPreprocess`,(e,t)=>{Jn.init(e,t)}),Zn=s(`$ZodReadonly`,(e,t)=>{T.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Qn):Qn(r)}});function Qn(e){return e.value=Object.freeze(e.value),e}var $n=s(`$ZodCustom`,(e,t)=>{w.init(e,t),T.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>er(t,n,r,e));er(i,n,r,e)}});function er(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(we(e))}}var tr,nr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function rr(){return new nr}(tr=globalThis).__zod_globalRegistry??(tr.__zod_globalRegistry=rr());var ir=globalThis.__zod_globalRegistry;function ar(e,t){return new e({type:`string`,...b(t)})}function or(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function sr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function ur(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function dr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function fr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function pr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function mr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function hr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function gr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function _r(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function vr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function yr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function br(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function xr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function Sr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function Cr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function wr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function Tr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function Er(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function Dr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function Or(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function kr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function Ar(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function jr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function Mr(e,t){return new e({type:`number`,checks:[],...b(t)})}function Nr(e,t){return new e({type:`number`,coerce:!0,checks:[],...b(t)})}function Pr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function Fr(e,t){return new e({type:`boolean`,...b(t)})}function Ir(e,t){return new e({type:`null`,...b(t)})}function Lr(e){return new e({type:`any`})}function Rr(e){return new e({type:`unknown`})}function zr(e,t){return new e({type:`never`,...b(t)})}function Br(e,t){return new Ct({check:`less_than`,...b(t),value:e,inclusive:!1})}function Vr(e,t){return new Ct({check:`less_than`,...b(t),value:e,inclusive:!0})}function Hr(e,t){return new wt({check:`greater_than`,...b(t),value:e,inclusive:!1})}function Ur(e,t){return new wt({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Wr(e,t){return new Tt({check:`multiple_of`,...b(t),value:e})}function Gr(e,t){return new Dt({check:`max_length`,...b(t),maximum:e})}function Kr(e,t){return new Ot({check:`min_length`,...b(t),minimum:e})}function qr(e,t){return new kt({check:`length_equals`,...b(t),length:e})}function Jr(e,t){return new jt({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Yr(e){return new Mt({check:`string_format`,format:`lowercase`,...b(e)})}function Xr(e){return new Nt({check:`string_format`,format:`uppercase`,...b(e)})}function Zr(e,t){return new Pt({check:`string_format`,format:`includes`,...b(t),includes:e})}function Qr(e,t){return new Ft({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function $r(e,t){return new It({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function D(e){return new Lt({check:`overwrite`,tx:e})}function ei(e){return D(t=>t.normalize(e))}function ti(){return D(e=>e.trim())}function ni(){return D(e=>e.toLowerCase())}function ri(){return D(e=>e.toUpperCase())}function ii(){return D(e=>oe(e))}function ai(e,t,n){return new e({type:`array`,element:t,...b(n)})}function oi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function si(e,t){let n=ci(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(we(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(we(r))}},e(t.value,t)),t);return n}function ci(e,t){let n=new w({check:`custom`,...b(t)});return n._zod.check=e,n}function li(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ir,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function O(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,O(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&k(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ui(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
63
 
64
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function di(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:pi(t,`input`,e.processors),output:pi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}var fi=(e,t={})=>n=>{let r=li({...n,processors:t});return O(e,r),ui(r,e),di(r,e)},pi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=li({...i??{},target:a,io:t,processors:n});return O(e,o),ui(o,e),di(o,e)},mi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=mi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},gi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},_i=(e,t,n,r)=>{n.type=`boolean`},vi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},yi=(e,t,n,r)=>{n.not={}},bi=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},xi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ci=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=O(a.element,t,{...r,path:[...r.path,`items`]})},Ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=O(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ei=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Di=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Oi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=O(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=O(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ki=(e,t,n,r)=>{let i=e._zod.def,a=O(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ai=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ji=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Mi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ni=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Pi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;O(o,t,r);let s=t.seen.get(e);s.ref=o},Fi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ii=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=s(`ZodISODateTime`,(e,t)=>{Qt.init(e,t),P.init(e,t)});function A(e){return Or(Li,e)}var Ri=s(`ZodISODate`,(e,t)=>{$t.init(e,t),P.init(e,t)});function zi(e){return kr(Ri,e)}var Bi=s(`ZodISOTime`,(e,t)=>{en.init(e,t),P.init(e,t)});function Vi(e){return Ar(Bi,e)}var Hi=s(`ZodISODuration`,(e,t)=>{tn.init(e,t),P.init(e,t)});function Ui(e){return jr(Hi,e)}var j=s(`ZodError`,(e,t)=>{Ee.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ke(e,t)},flatten:{value:t=>Oe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wi=Ae(j),Gi=je(j),Ki=Me(j),qi=Pe(j),Ji=Ie(j),Yi=Le(j),Xi=Re(j),Zi=ze(j),Qi=Be(j),$i=Ve(j),ea=He(j),ta=Ue(j),na=new WeakMap;function ra(e,t,n){let r=Object.getPrototypeOf(e),i=na.get(r);if(i||(i=new Set,na.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var M=s(`ZodType`,(e,t)=>(T.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pi(e,`input`),output:pi(e,`output`)}}),e.toJSONSchema=fi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Wi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ki(e,t,n),e.parseAsync=async(t,n)=>Gi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>qi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ji(e,t,n),e.decode=(t,n)=>Yi(e,t,n),e.encodeAsync=async(t,n)=>Xi(e,t,n),e.decodeAsync=async(t,n)=>Zi(e,t,n),e.safeEncode=(t,n)=>Qi(e,t,n),e.safeDecode=(t,n)=>$i(e,t,n),e.safeEncodeAsync=async(t,n)=>ea(e,t,n),e.safeDecodeAsync=async(t,n)=>ta(e,t,n),ra(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return y(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_o(e,t))},superRefine(e,t){return this.check(vo(e,t))},overwrite(e){return this.check(D(e))},optional(){return Za(this)},exactOptional(){return $a(this)},nullable(){return to(this)},nullish(){return Za(to(this))},nonoptional(e){return so(this,e)},array(){return R(this)},or(e){return V([this,e])},and(e){return Wa(this,e)},transform(e){return fo(this,Ya(e))},default(e){return ro(this,e)},prefault(e){return ao(this,e)},catch(e){return lo(this,e)},pipe(e){return fo(this,e)},readonly(){return ho(this)},describe(e){let t=this.clone();return ir.add(t,{description:e}),t},meta(...e){if(e.length===0)return ir.get(this);let t=this.clone();return ir.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return ir.get(e)?.description},configurable:!0}),e)),ia=s(`_ZodString`,(e,t)=>{Bt.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ra(e,`_ZodString`,{regex(...e){return this.check(Jr(...e))},includes(...e){return this.check(Zr(...e))},startsWith(...e){return this.check(Qr(...e))},endsWith(...e){return this.check($r(...e))},min(...e){return this.check(Kr(...e))},max(...e){return this.check(Gr(...e))},length(...e){return this.check(qr(...e))},nonempty(...e){return this.check(Kr(1,...e))},lowercase(e){return this.check(Yr(e))},uppercase(e){return this.check(Xr(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(ii())}})}),aa=s(`ZodString`,(e,t)=>{Bt.init(e,t),ia.init(e,t),e.email=t=>e.check(or(oa,t)),e.url=t=>e.check(fr(la,t)),e.jwt=t=>e.check(Dr(Ta,t)),e.emoji=t=>e.check(pr(da,t)),e.guid=t=>e.check(sr(sa,t)),e.uuid=t=>e.check(cr(ca,t)),e.uuidv4=t=>e.check(lr(ca,t)),e.uuidv6=t=>e.check(ur(ca,t)),e.uuidv7=t=>e.check(dr(ca,t)),e.nanoid=t=>e.check(mr(fa,t)),e.guid=t=>e.check(sr(sa,t)),e.cuid=t=>e.check(hr(pa,t)),e.cuid2=t=>e.check(gr(ma,t)),e.ulid=t=>e.check(_r(ha,t)),e.base64=t=>e.check(wr(Sa,t)),e.base64url=t=>e.check(Tr(Ca,t)),e.xid=t=>e.check(vr(ga,t)),e.ksuid=t=>e.check(yr(_a,t)),e.ipv4=t=>e.check(br(va,t)),e.ipv6=t=>e.check(xr(ya,t)),e.cidrv4=t=>e.check(Sr(ba,t)),e.cidrv6=t=>e.check(Cr(xa,t)),e.e164=t=>e.check(Er(wa,t)),e.datetime=t=>e.check(A(t)),e.date=t=>e.check(zi(t)),e.time=t=>e.check(Vi(t)),e.duration=t=>e.check(Ui(t))});function N(e){return ar(aa,e)}var P=s(`ZodStringFormat`,(e,t)=>{E.init(e,t),ia.init(e,t)}),oa=s(`ZodEmail`,(e,t)=>{Ut.init(e,t),P.init(e,t)}),sa=s(`ZodGUID`,(e,t)=>{Vt.init(e,t),P.init(e,t)}),ca=s(`ZodUUID`,(e,t)=>{Ht.init(e,t),P.init(e,t)});function F(e){return cr(ca,e)}var la=s(`ZodURL`,(e,t)=>{Wt.init(e,t),P.init(e,t)});function ua(e){return fr(la,e)}var da=s(`ZodEmoji`,(e,t)=>{Gt.init(e,t),P.init(e,t)}),fa=s(`ZodNanoID`,(e,t)=>{Kt.init(e,t),P.init(e,t)}),pa=s(`ZodCUID`,(e,t)=>{qt.init(e,t),P.init(e,t)}),ma=s(`ZodCUID2`,(e,t)=>{Jt.init(e,t),P.init(e,t)}),ha=s(`ZodULID`,(e,t)=>{Yt.init(e,t),P.init(e,t)}),ga=s(`ZodXID`,(e,t)=>{Xt.init(e,t),P.init(e,t)}),_a=s(`ZodKSUID`,(e,t)=>{Zt.init(e,t),P.init(e,t)}),va=s(`ZodIPv4`,(e,t)=>{nn.init(e,t),P.init(e,t)}),ya=s(`ZodIPv6`,(e,t)=>{rn.init(e,t),P.init(e,t)}),ba=s(`ZodCIDRv4`,(e,t)=>{an.init(e,t),P.init(e,t)}),xa=s(`ZodCIDRv6`,(e,t)=>{on.init(e,t),P.init(e,t)}),Sa=s(`ZodBase64`,(e,t)=>{cn.init(e,t),P.init(e,t)}),Ca=s(`ZodBase64URL`,(e,t)=>{un.init(e,t),P.init(e,t)}),wa=s(`ZodE164`,(e,t)=>{dn.init(e,t),P.init(e,t)}),Ta=s(`ZodJWT`,(e,t)=>{pn.init(e,t),P.init(e,t)}),Ea=s(`ZodNumber`,(e,t)=>{mn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r),ra(e,`ZodNumber`,{gt(e,t){return this.check(Hr(e,t))},gte(e,t){return this.check(Ur(e,t))},min(e,t){return this.check(Ur(e,t))},lt(e,t){return this.check(Br(e,t))},lte(e,t){return this.check(Vr(e,t))},max(e,t){return this.check(Vr(e,t))},int(e){return this.check(Oa(e))},safe(e){return this.check(Oa(e))},positive(e){return this.check(Hr(0,e))},nonnegative(e){return this.check(Ur(0,e))},negative(e){return this.check(Br(0,e))},nonpositive(e){return this.check(Vr(0,e))},multipleOf(e,t){return this.check(Wr(e,t))},step(e,t){return this.check(Wr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Mr(Ea,e)}var Da=s(`ZodNumberFormat`,(e,t)=>{hn.init(e,t),Ea.init(e,t)});function Oa(e){return Pr(Da,e)}var ka=s(`ZodBoolean`,(e,t)=>{gn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function L(e){return Fr(ka,e)}var Aa=s(`ZodNull`,(e,t)=>{_n.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function ja(e){return Ir(Aa,e)}var Ma=s(`ZodAny`,(e,t)=>{vn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Na(){return Lr(Ma)}var Pa=s(`ZodUnknown`,(e,t)=>{yn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Fa(){return Rr(Pa)}var Ia=s(`ZodNever`,(e,t)=>{bn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function La(e){return zr(Ia,e)}var Ra=s(`ZodArray`,(e,t)=>{Sn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.element=t.element,ra(e,`ZodArray`,{min(e,t){return this.check(Kr(e,t))},nonempty(e){return this.check(Kr(1,e))},max(e,t){return this.check(Gr(e,t))},length(e,t){return this.check(qr(e,t))},unwrap(){return this.element}})});function R(e,t){return ai(Ra,e,t)}var za=s(`ZodObject`,(e,t)=>{Dn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),m(e,`shape`,()=>t.shape),ra(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Fa()})},loose(){return this.clone({...this._zod.def,catchall:Fa()})},strict(){return this.clone({...this._zod.def,catchall:La()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ge(this,e)},safeExtend(e){return _e(this,e)},merge(e){return ve(this,e)},pick(e){return me(this,e)},omit(e){return he(this,e)},partial(...e){return ye(Xa,this,e[0])},required(...e){return be(oo,this,e[0])}})});function z(e,t){return new za({type:`object`,shape:e??{},...b(t)})}function Ba(e,t){return new za({type:`object`,shape:e,catchall:La(),...b(t)})}function B(e,t){return new za({type:`object`,shape:e,catchall:Fa(),...b(t)})}var Va=s(`ZodUnion`,(e,t)=>{kn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.options=t.options});function V(e,t){return new Va({type:`union`,options:e,...b(t)})}var Ha=s(`ZodDiscriminatedUnion`,(e,t)=>{Va.init(e,t),An.init(e,t)});function H(e,t,n){return new Ha({type:`union`,options:t,discriminator:e,...b(n)})}var Ua=s(`ZodIntersection`,(e,t)=>{jn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function Wa(e,t){return new Ua({type:`intersection`,left:e,right:t})}var Ga=s(`ZodRecord`,(e,t)=>{Pn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new Ga({type:`record`,keyType:N(),valueType:e,...b(t)}):new Ga({type:`record`,keyType:e,valueType:t,...b(n)})}var Ka=s(`ZodEnum`,(e,t)=>{Fn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ka({...t,checks:[],...b(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ka({...t,checks:[],...b(r),entries:i})}});function W(e,t){return new Ka({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var qa=s(`ZodLiteral`,(e,t)=>{In.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new qa({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Ja=s(`ZodTransform`,(e,t)=>{Ln.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(we(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(we(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ya(e){return new Ja({type:`transform`,transform:e})}var Xa=s(`ZodOptional`,(e,t)=>{zn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Za(e){return new Xa({type:`optional`,innerType:e})}var Qa=s(`ZodExactOptional`,(e,t)=>{Bn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`optional`,innerType:e})}var eo=s(`ZodNullable`,(e,t)=>{Vn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function to(e){return new eo({type:`nullable`,innerType:e})}var no=s(`ZodDefault`,(e,t)=>{Hn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ro(e,t){return new no({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var io=s(`ZodPrefault`,(e,t)=>{Wn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e,t){return new io({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var oo=s(`ZodNonOptional`,(e,t)=>{Gn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function so(e,t){return new oo({type:`nonoptional`,innerType:e,...b(t)})}var co=s(`ZodCatch`,(e,t)=>{qn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lo(e,t){return new co({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var uo=s(`ZodPipe`,(e,t)=>{Jn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.in=t.in,e.out=t.out});function fo(e,t){return new uo({type:`pipe`,in:e,out:t})}var po=s(`ZodPreprocess`,(e,t)=>{uo.init(e,t),Xn.init(e,t)}),mo=s(`ZodReadonly`,(e,t)=>{Zn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e){return new mo({type:`readonly`,innerType:e})}var go=s(`ZodCustom`,(e,t)=>{$n.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function _o(e,t={}){return oi(go,e,t)}function vo(e,t){return si(e,t)}function yo(e,t){return new po({type:`pipe`,in:Ya(e),out:t})}var bo={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},xo;xo||={};function So(e){return Nr(Ea,e)}var K=W([`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`]),q={questions:4,id:64,header:12,question:400,minOptions:2,maxOptions:4,label:60,description:280,context:2e4},Co=N().min(1).max(q.context),wo=z({label:N().min(1).max(q.label),description:N().max(q.description).optional()}).strict(),To=z({id:N().min(1).max(q.id).optional(),header:N().min(1).max(q.header),question:N().min(1).max(q.question),options:R(wo).min(q.minOptions).max(q.maxOptions).refine(e=>new Set(e.map(e=>e.label)).size===e.length,{message:`option labels must be unique within a question`}).optional(),multiSelect:L().optional()}).strict(),Eo=z({context:Co.optional(),questions:R(To).min(1).max(q.questions).refine(e=>new Set(e.map(e=>e.question)).size===e.length,{message:`question texts must be unique`})}).strict(),Do=W([`family`,`peer`]),Oo=z({senderRunId:F(),recipientRunId:F(),kind:W([`request`,`progress`,`follow-up`,`reply`]),requestId:F().optional(),relationship:Do.optional()}).strict(),ko=Oo.extend({id:F(),text:N().min(1).max(1e5),createdAt:A(),deadline:A().optional(),requestHash:N().regex(/^[0-9a-f]{64}$/),state:W([`accepted`,`continuation-required`,`destroyed`,`late`]),resumed:G(!0).optional(),instruction:N().max(2048).optional(),question:Eo.optional()}),J=z({requestId:F(),status:W([`replied`,`replied-late`,`completed-without-reply`,`failed`,`cancelled`,`destroyed`,`timed-out`,`sender-closed`,`human-fallback`,`deleted`]),observedAt:A(),replyId:F().optional()}).strict(),Ao=z({messages:R(ko).max(1024),outcomes:R(J).max(1024)}).strict(),jo=N().max(128).regex(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i,`Not a history cursor; pass nextBefore from an earlier page`);Ao.extend({hint:N().optional(),nextBefore:jo.optional()}),z({messages:R(ko).max(32),outcomes:R(J).max(32),receiptId:F().optional(),expiresAt:A().optional()}).strict().refine(e=>e.messages.length>0?e.receiptId!==void 0&&e.expiresAt!==void 0:e.receiptId===void 0&&e.expiresAt===void 0,{message:`A nonempty inbox batch requires a receipt and expiry`}),z({receiptId:F()}).strict(),z({receiptId:F(),status:W([`acknowledged`,`already-acknowledged`,`released`])}).strict(),z({id:F(),recipientRunId:F(),kind:Oo.shape.kind,requestId:F().optional(),text:N().min(1).max(1e5).refine(e=>e.trim().length>0),timeoutSeconds:I().int().min(1).max(86400).default(600),resume:L().optional()}).strict().refine(e=>e.timeoutSeconds<=7200||e.resume===!0&&e.kind===`request`,{path:[`timeoutSeconds`],message:`Only --resume requests accept deadlines above 7200 seconds (maximum 86400)`}).refine(e=>(e.kind===`reply`||e.kind===`follow-up`)==(e.requestId!==void 0),{message:`Replies and follow-ups require a request ID; new messages must omit it`}).refine(e=>!e.resume||e.kind===`request`||e.kind===`progress`,{message:`--resume requires a new request or progress instruction`});var Mo=W([`applied`,`unchanged`,`refused`,`unknown`]);z({message:ko,delivery:W([`queued`,`delivered`,`consumed`,`not-delivered`]),outcome:J.optional(),effect:Mo.optional()}).strict(),z({recipientRunId:F(),before:jo.optional()}).strict(),z({requestId:F()}).strict(),z({requestIds:R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length),mode:W([`one`,`any`,`all`]).optional(),timeoutSeconds:I().int().min(1).max(7200).default(600)}).strict().refine(e=>e.mode!==`one`||e.requestIds.length===1,{message:`one requires exactly one request`});var No=W([`low`,`medium`,`high`,`xhigh`,`max`]),Po=N().max(32).optional();function Fo(){return z({claude:N().optional(),codex:N().optional(),opencode:N().optional(),pi:N().optional(),cursor:N().optional(),omp:N().optional()})}var Io=z({repo:N().min(1).max(500),name:N().min(1).max(200)}).strict();z({browseRoot:N(),projectsDir:N(),archiveOnMerge:L().nullable(),effectiveArchiveOnMerge:L(),archiveOnMergeSource:W([`global`,`environment`,`default`]),composerDefaults:z({autonomous:L().nullable(),worktree:L().nullable(),inheritedAutonomous:V([L(),G(`source-dependent`)]),inheritedWorktree:L()}),resources:z({maxParallel:I(),maxMonitoringSessions:I(),monitoringWakeIntervalMinutes:I().nullable(),autoResumeOnUsageLimit:L(),memoryLimitMb:I().nullable(),worktreeRetentionDefault:I()}),agentDefaults:z({runner:K.optional(),models:Fo().optional()})}),z({browseRoot:N().trim().min(1).max(4096).optional(),projectsDir:N().trim().min(1).max(4096).optional(),archiveOnMerge:L().nullable().optional(),composerDefaults:z({autonomous:L().nullable().optional(),worktree:L().nullable().optional()}).optional(),agentDefaults:z({runner:K.nullable().optional(),models:z({claude:N().trim().min(1).max(200).nullable().optional(),codex:N().trim().min(1).max(200).nullable().optional(),opencode:N().trim().min(1).max(200).nullable().optional(),pi:N().trim().min(1).max(200).nullable().optional(),cursor:N().trim().min(1).max(200).nullable().optional(),omp:N().trim().min(1).max(200).nullable().optional()}).optional()}).optional(),resources:z({maxParallel:I().int().min(1).max(16).optional(),maxMonitoringSessions:I().int().min(0).max(16).optional(),monitoringWakeIntervalMinutes:I().int().min(1).max(60).nullable().optional(),autoResumeOnUsageLimit:L().optional(),memoryLimitMb:I().int().min(0).max(1048576).nullable().optional(),worktreeRetentionDefault:I().int().min(0).max(1e3).optional()}).optional()});var Lo=z({accent:W([`cezarion`,`lime`,`violet`]).optional(),density:W([`comfortable`,`compact`,`ultra`]).optional(),width:W([`narrow`,`wide`]).optional()}),Ro=B({expandedColumns:U(N(),L()).optional()}),zo=z({overall:I().int().positive().nullable().optional(),needsYou:I().int().positive().nullable().optional(),finished:I().int().positive().nullable().optional(),working:I().int().positive().nullable().optional()});function Bo(e){let t={overall:10,needsYou:null,finished:null,working:null},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let e of Object.keys(t)){let r=zo.shape[e].safeParse(n[e]);r.success&&r.data!==void 0&&(t[e]=r.data)}return t}B({sidebarLimits:zo.optional(),lastTask:z({source:W([`workflow`,`skill`]),ref:N()}).nullable().optional(),recentSources:R(z({source:W([`workflow`,`skill`]),ref:N()})).optional(),lastWorktree:L().optional(),lastAutonomous:L().optional(),disabledTeamSkills:R(Io).max(200).optional(),skillUsage:U(N(),I()).optional(),runsView:W([`list`,`table`]).optional(),githubView:W([`issues`,`prs`]).optional(),appearance:Lo.optional(),promptTemplates:R(z({id:N(),label:N(),text:N(),skills:R(N()).optional()})).optional()});var Vo=Ba({projectId:N().min(1).max(64),pathname:N().min(1).max(2048).startsWith(`/p/`),search:N().max(4096).startsWith(`?`).optional(),hash:N().max(2048).startsWith(`#`).optional()}),Ho=B({sidebar:B({collapsed:U(N(),L()).optional(),projectOrder:R(N()).optional()}).optional(),dismissedProviderAuthFailures:Fo().optional(),appearance:Lo.optional(),notifications:B({enabled:L().optional()}).optional(),taskTable:Ro.optional(),lastLocation:Vo.optional()}),Uo=200,Wo=50;B({...Ho.shape,sidebar:B({collapsed:U(N().min(1).max(64),L()).refine(e=>Object.keys(e).length<=Uo,{message:`sidebar.collapsed must have at most ${Uo} entries`}).optional(),projectOrder:R(N().min(1).max(64)).max(Uo).optional()}).optional(),dismissedProviderAuthFailures:Ba({claude:N().min(1).max(128).optional(),codex:N().min(1).max(128).optional(),opencode:N().min(1).max(128).optional(),pi:N().min(1).max(128).optional(),cursor:N().min(1).max(128).optional(),omp:N().min(1).max(128).optional()}).optional(),taskTable:Ro.extend({expandedColumns:U(N().min(1).max(64),L()).refine(e=>Object.keys(e).length<=Wo,{message:`taskTable.expandedColumns must have at most ${Wo} entries`}).optional()}).optional()}).superRefine((e,t)=>{Object.keys(e).length>Uo&&t.addIssue({code:`custom`,message:`ui-state has too many keys (max ${Uo})`})});var Go=Fo(),Ko=4e3,qo=7200,Jo=z({commands:R(N().trim().min(1).max(Ko)).max(20),timeoutSeconds:I().int().min(1).max(qo).optional()}).strict();z({archiveOnMerge:L().nullable(),effectiveArchiveOnMerge:L(),archiveOnMergeSource:W([`project`,`global`,`environment`,`default`]),baseBranch:N().nullable(),defaultRunner:K,systemPrompt:N().nullable(),defaultModels:Go,modelsLocked:L(),maxParallel:I(),memoryLimitMb:I().nullable(),worktreeRetention:I(),liveTitleUpdates:L().nullable(),reviewGate:L().nullable(),worktreeSetup:z({commands:R(N()),timeoutSeconds:I()}).nullable(),worktreeSetupIssue:N().nullable()}),z({archiveOnMerge:L().nullable().optional(),baseBranch:N().trim().min(1).max(200).nullable().optional(),defaultRunner:K.optional(),systemPrompt:N().trim().max(2e4).nullable().optional(),defaultModels:z({claude:N().trim().max(200).nullable().optional(),codex:N().trim().max(200).nullable().optional(),opencode:N().trim().max(200).nullable().optional(),pi:N().trim().max(200).nullable().optional(),cursor:N().trim().max(200).nullable().optional(),omp:N().trim().max(200).nullable().optional()}).optional(),maxParallel:I().int().min(1).max(16).optional(),memoryLimitMb:I().int().min(0).max(1048576).nullable().optional(),worktreeRetention:I().int().min(0).max(1e3).nullable().optional(),liveTitleUpdates:L().nullable().optional(),reviewGate:L().nullable().optional(),worktreeSetup:Jo.nullable().optional()});var Yo=K,Xo=z({provider:Yo,status:W([`connected`,`disconnected`,`not-installed`,`unknown`]),enabled:L().optional(),hint:N().optional(),authFailureId:N().optional(),profileId:N().optional()});z({providers:R(Xo)}),H(`opened`,[z({opened:G(!0),command:N()}),z({opened:G(!1),connected:G(!0),command:N()})]);var Zo=W([`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`]),Qo=Zo.options;function $o(e){return Qo.includes(e)}var es=z({id:N(),label:N(),description:N(),effortLevels:R(No).optional()}),ts=z({runner:K,models:R(es),source:W([`live`,`cache`,`unavailable`]),stale:L(),reason:N().optional()}),ns=z({runner:Zo,requestedModel:N(),availableModels:R(es),otherRunners:R(Zo)});z({targets:R(z({id:N(),label:N(),icon:N().optional()}))}),z({target:N().trim().min(1,`target required`).max(200)}),z({opened:G(!0),path:N()});var rs=W([`spawn`,`inspect`,`steer`,`stop`,`destroy`,`diff`,`wait`]),Y=N().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),is=N().regex(/^[0-9a-f]{64}$/),as=R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length),os=R(rs).max(7).refine(e=>new Set(e).size===e.length),ss=R(W([`process`,`worktree`,`branch`])).max(3).refine(e=>new Set(e).size===e.length),cs=N().max(2e3),ls=z({ownerRunId:F(),resourceId:F(),kind:G(`owned-isolated`),path:N().min(1),branch:N().min(1),baselineSha:Y}).strict(),X=z({workerId:F(),status:W([`review`,`done`,`failed`,`cancelled`]),observedAt:A(),summary:N().max(4e3).optional(),revision:I().int().nonnegative().optional()}).strict(),us=W([`one`,`any`,`all`]),Z=z({id:F(),workerIds:R(F()).max(32).refine(e=>new Set(e).size===e.length),requestIds:R(F()).min(1).max(32).optional(),requestOutcomes:R(J).max(32).optional(),deadline:A(),mode:us.optional(),revisions:R(z({workerId:F(),revision:I().int().nonnegative()}).strict()).max(32).optional(),reason:W([`outcome`,`timeout`,`cancelled`,`message`]).optional(),phase:W([`registered`,`parked`,`wake-pending`]),outcomes:R(X).max(32),wakeId:F().optional()}).strict(),ds=Z.omit({deadline:!0,requestIds:!0,requestOutcomes:!0}).extend({via:G(`completion`)}).strict(),fs=z({attempts:I().int().positive(),nextAt:A(),needsAttention:G(!0).optional()}).strict(),ps=z({requestedAt:A(),phase:W([`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),remaining:ss,error:cs.optional()}).strict(),ms=ps.extend({retry:fs.optional()}).strict(),hs=z({requestId:F(),workerId:F(),requestHash:is,deletion:z({phase:W([`pending`,`complete`]),revision:I().int().nonnegative(),resourceId:F(),generation:F()}).strict().optional()}).strict(),gs=W(K.options),_s=N().min(1).max(4096).refine(e=>!/[\\\u0000-\u001f\u007f:]/.test(e)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`));function vs(e){return e.split(`/`).at(-1)?.toLowerCase()===`.gitignore`?`--attach cannot attach a .gitignore: ${e}; ignore rules must come from the baseline`:void 0}var ys=H(`kind`,[z({kind:G(`baseline-file`),path:_s}).strict(),z({kind:G(`parent-attachment`),id:N().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))}).strict(),z({kind:G(`parent-file`),path:_s}).strict().superRefine(({path:e},t)=>{let n=vs(e);n&&t.addIssue({code:`custom`,path:[`path`],message:n})})]),bs=z({text:N().max(1e5).optional(),artifacts:R(ys).max(32).optional()}).strict().superRefine(({artifacts:e=[]},t)=>{let n=new Set;for(let[r,i]of e.entries())i.kind===`parent-file`&&(n.has(i.path)&&t.addIssue({code:bo.custom,path:[`artifacts`,r,`path`],message:`duplicate --attach path: ${i.path}`}),n.add(i.path))}),xs=z({source:ys,path:N().min(1).max(8192),sha256:is,bytes:I().int().min(0).max(2**53-1)}).strict(),Ss=z({text:N().max(1e5).optional(),inputs:R(xs).max(32)}).strict(),Cs=z({state:G(`unavailable`),reason:W([`no-assistant-output`,`missing`,`unreadable`,`unverified`]),detail:cs.optional()}).strict(),ws=z({state:G(`deleted`),reason:G(`missing`)}).strict(),Ts=W([`running`,`review-ready`,`completed`,`failed`,`cancelled`]),Es=H(`state`,[z({state:G(`available`),id:N().max(255),path:N().max(8192)}).strict(),Cs.extend({id:N().max(255),path:N().max(8192)}),ws.extend({id:N().max(255),path:N().max(8192)})]);z({result:z({workerId:F(),parentRunId:F(),revision:I().int().nonnegative(),observedAt:A(),status:W([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),outcome:W([`running`,`review-ready`,`completed`,`failed`,`cancelled`,`destroyed`]),lastExecutionOutcome:Ts,partial:L(),settled:L(),error:cs.optional(),backend:gs.optional(),model:N().max(512).optional(),baselineSha:Y,workspace:ls.extend({state:W([`available`,`unavailable`,`deleted`]).optional()}),cleanup:W([`retained`,`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),summary:H(`state`,[z({state:G(`available`),text:N().min(1).max(4e3),source:G(`assistant`),seq:I().int().nonnegative(),truncated:L()}).strict(),Cs,ws]),head:H(`state`,[z({state:G(`available`),sha:Y}).strict(),Cs.extend({sha:Y.optional()}),ws.extend({sha:Y.optional()})]),diff:H(`state`,[z({state:G(`available`),snapshotId:F(),path:N().min(1).max(8192),truncated:L()}).strict(),Cs,ws]),artifacts:H(`state`,[z({state:G(`available`),items:R(Es).max(32),truncated:L()}).strict(),Cs,ws])}).strict(),diffSnapshot:N().max(4e5).optional()}).strict();var Ds=z({workerId:F(),revision:I().int().nonnegative(),snapshotId:F(),observedAt:A(),lastExecutionOutcome:Ts,previous:z({revision:I().int().nonnegative(),observedAt:A(),lastExecutionOutcome:Ts}).strict().optional()}).strict(),Os=H(`role`,[z({role:G(`root`),conversation:Ao.optional(),permissions:os,receipts:R(hs).max(1024).refine(e=>new Set(e.map(e=>e.requestId)).size===e.length&&new Set(e.map(e=>e.workerId)).size===e.length),wait:Z.optional(),lastWait:Z.optional(),results:R(Ds).max(1024).refine(e=>new Set(e.map(e=>e.workerId)).size===e.length).optional(),finishRequestedAt:A().optional(),historyDeletion:G(`pending`).optional(),completion:z({phase:W([`waiting`,`attention`]),waitId:F().optional()}).strict().optional()}).strict(),z({role:G(`worker`),wait:Z.optional(),lastWait:Z.optional(),permissions:os,parentRunId:F(),workspace:ls,destroy:ps.optional(),context:Ss.optional(),executionRevision:I().int().nonnegative().optional(),executionStartSeq:I().int().nonnegative().optional()}).strict(),z({role:G(`invalid`)}).strict()]),ks=H(`role`,[Os.options[0].pick({role:!0}).strip().extend({wait:Z.pick({phase:!0,requestIds:!0,workerIds:!0}).partial({workerIds:!0}).strip().extend({outcomes:R(X.pick({workerId:!0}).strip()).max(32).optional()}).optional()}),Os.options[1].pick({role:!0,parentRunId:!0}).strip().extend({wait:Z.pick({phase:!0,requestIds:!0}).strip().optional()}),Os.options[2].strip()]);z({task:N().min(1).max(1e5),baseline:N().min(1).max(1024),requestId:F(),context:bs.optional(),backend:gs.optional(),model:N().trim().min(1).max(512).optional(),effort:Po,workflow:N().trim().min(1).max(200).optional(),skill:N().trim().min(1).max(200).optional()}).strict().refine(e=>e.skill===void 0||e.workflow===void 0,{message:`--skill and --workflow cannot be used together`}).refine(e=>e.task.length+(e.context?.text?.length??0)<=1e5,{message:`Combined task and context exceed 100000 characters`}),z({text:N().max(1e5).refine(e=>e.trim().length>0)}).strict(),z({workerIds:as,timeoutSeconds:I().int().min(1).max(7200).default(600),mode:us.optional()}).strict().refine(e=>e.mode!==`one`||e.workerIds.length===1,{message:`one mode requires exactly one worker`});var As=z({receiptId:F(),generation:F(),expiresAt:A(),acknowledgedAt:A().optional(),memberIds:R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length).optional()}).strict(),js=z({conversation:Oo.optional(),id:F(),source:W([`agent`,`lifecycle`]),parentRunId:F(),text:N().min(1).max(1e5),createdAt:A(),deliveredAt:A().optional(),consumedAt:A().optional(),awaitingRead:G(!0).optional(),inboxClaim:As.optional(),purpose:W([`completion-refusal`,`undelivered-question`]).optional(),requestHash:N().regex(/^[0-9a-f]{64}$/).optional(),deadline:A().optional()}).strict(),Ms=z({workerId:F(),parentRunId:F(),status:W([`queued`,`running`,`waiting`,...X.shape.status.options]),currentStepId:N().optional(),workspace:ls,backend:gs.optional(),model:N().max(512).optional(),inputs:R(xs).max(32).optional(),wait:Z.optional(),completionWait:ds.optional(),destroy:ms.optional(),outcome:X.optional()}),Ns=Ms.pick({workerId:!0,parentRunId:!0,status:!0,workspace:!0,destroy:!0}).extend({revision:I().int().nonnegative(),settled:L(),destroyed:L()}).strict(),Ps=z({workers:R(Ns).max(1024)}).strict();z({offset:N().regex(/^\d{1,4}$/).refine(e=>Number(e)<=1024).optional()}).strict(),Ps.extend({workers:R(Ns).max(32),nextOffset:I().int().min(1).max(1024).optional()}).strict(),z({workerId:F(),baselineSha:Y,diff:N().max(4e5),truncated:L()}),z({workerId:F(),state:W([`stopping`,`terminated`])}),z({workerId:F(),state:W([`complete`,`incomplete`]),deleted:R(H(`kind`,[z({kind:G(`worktree`),path:N().max(8192)}).strict(),z({kind:G(`branch`),ref:N().max(1024)}).strict()])).max(2).optional(),remaining:ss,error:cs.optional()});var Fs=z({outstanding:I().int().nonnegative(),limit:I().int().nonnegative(),created:I().int().nonnegative(),creationLimit:I().int().nonnegative()}).strict(),Is=z({id:N(),title:N(),titleSummary:N().optional(),titleOrigin:W([`user`,`auto`,`marker`]).optional()}),Ls=z({parentRunId:F().optional(),workers:R(Ms).max(1024),titles:R(Is).max(1025).optional(),capacity:Fs.optional()});z({code:W([`unavailable_transport`,`unauthenticated`,`denied_scope`,`invalid_input`,`invalid_baseline`,`incompatible_state`,`capacity_limit`,`unavailable_diff`,`incomplete_cleanup`]),error:cs,modelChoices:ns.optional()}),z({workerId:F()}).strict(),z({workerId:F(),baselineSha:Y}).strict(),z({workerId:F(),state:W([`queued`,`delivered`])}).strict();var Rs=z({wait:Z,instruction:N().min(1).max(1e3)}).strict();z({}).strict(),z({waitId:F()}).strict();var zs=z({wait:Z}).strict();z({peerIds:as,timeoutSeconds:I().int().min(1).max(7200).default(600)}).strict();var Bs=H(`reason`,[z({reason:G(`message`),peerRunId:F(),messageId:F()}).strict(),z({reason:G(`settled`),peerRunId:F()}).strict(),z({reason:G(`timeout`)}).strict()]);function Vs(e,t){(e.phase===`resolved`||e.phase===`delivered`)&&!e.result&&t.addIssue({code:`custom`,message:`a ${e.phase} peer wait has a result`,path:[`result`]}),e.phase===`open`&&e.result&&t.addIssue({code:`custom`,message:`an open peer wait has no result`,path:[`result`]})}var Hs=z({id:F(),peerIds:as,deadline:A(),phase:W([`open`,`resolved`,`delivered`,`cancelled`]),result:Bs.optional()}).strict().superRefine(Vs),Us=z({wait:Hs,instruction:N().min(1).max(1e3)}).strict(),Ws=z({wait:Hs}).strict();V([Rs,Us]),V([zs,Ws]);var Q=B({seq:I(),ts:N(),stepId:N().optional(),type:N()}),Gs=Q.extend({type:G(`conversation-message`),message:ko,delivery:W([`queued`,`delivered`,`consumed`,`not-delivered`]),deliveredAt:A().optional(),consumedAt:A().optional()}),Ks=Q.extend({type:G(`request-outcome`),outcome:J}),qs=Q.extend({type:G(`agent-input`),input:js}),Js=Q.extend({type:G(`human-input-delivered`),askSeq:I().int().nonnegative(),source:W([`human`,`parent`,`cezar`]).optional()}),Ys=Q.extend({type:G(`human-ask-closed`),askSeq:I().int().nonnegative(),reason:W([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`])});Q.extend({type:G(`worker-question-routed`),askSeq:I().int().nonnegative(),messageId:F(),parentRunId:F()}),Q.extend({type:G(`worker-question-fallback`),askSeq:I().int().nonnegative(),reason:N().min(1).max(200)}),Q.extend({type:G(`worker-question-undelivered`),askSeq:I().int().nonnegative(),reason:N().min(1).max(200)}),Q.extend({type:G(`worker-outcome`),outcome:X});var Xs=z({id:N().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)}),$=N().min(1).max(2048);z({cursor:$.optional()}),z({cursor:$.optional(),afterSeq:So().int().nonnegative().optional()});var Zs=z({seq:I(),ts:N(),stepId:N().optional(),type:N()}).catchall(Na()),Qs=z({events:R(Zs),itemCount:I().int().min(0).max(100),olderCursor:$.optional(),newerCursor:$.optional(),liveCursor:$,asOfSeq:I().int().nonnegative(),hasOlder:L()}),$s=z({contextEvents:R(Zs),asOfSeq:I().int().nonnegative()}),ec=z({checkoutId:N().optional(),name:N(),phase:W([`cloning`,`done`,`error`]),line:N().optional(),error:N().optional(),warning:N().optional()}),tc=1024*1024,nc=z({projectId:N().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),runId:Xs.shape.id,cursor:$.optional(),afterSeq:I().int().nonnegative().safe()});z({runs:R(nc).min(1).max(32)}).refine(({runs:e})=>new Set(e.map(e=>`${e.projectId}/${e.runId}`)).size===e.length,{message:`duplicate run demand`});var rc=nc.pick({projectId:!0,runId:!0}),ic=rc.extend({type:W([`error`,`reset`]),status:V([G(400),G(404),G(409),G(413),G(503)]),error:N()}),ac=V([rc.extend({type:G(`batch`),events:R(Zs).max(256),cursor:$,afterSeq:I().int().nonnegative(),hasMore:L()}),ic]),oc=z({generation:N(),results:R(ac)}),sc=V([z({type:G(`ready`),generation:N()}),z({type:G(`ping`)}),rc.extend({type:G(`event`),name:W([`run-event`,`ui-event`]),event:Zs}),ic]),cc=`cezar-live-v3`,lc=15e3,uc=5e3;function dc(e){return!e.startsWith(`/api/v1/`)||e.includes(`#`)||/[\\\r\n]/.test(e)?!1:/^\/api\/v1\/(?:workspace\/(?:runs-index|activity)|p\/[a-zA-Z0-9_-]+\/(?:reports\/state|runs\/[a-zA-Z0-9._-]+\/(?:changes|commits)|github(?:\/(?:checks|ref-status))?))(?:\?[^#]*)?$/.test(e)}var fc=H(`kind`,[z({kind:G(`workspace`)}),nc.extend({kind:G(`run`)}),z({kind:G(`topic`),topic:N().min(1).max(128)}),z({kind:G(`read`),path:N().max(4096).refine(dc),intervalMs:I().int().min(1e3).max(2147483647)})]),pc=z({id:N().min(1).max(128),demand:fc}),mc=z({version:G(3),documentId:N().min(1).max(128),epoch:I().int().nonnegative()}),hc=H(`type`,[mc.extend({type:G(`sync`),entries:R(pc).max(64),workspaceReady:G(!0).optional()}).refine(e=>new Set(e.entries.map(e=>e.id)).size===e.entries.length),mc.extend({type:G(`ack`),id:N(),seq:I().int().nonnegative()}),mc.extend({type:G(`refresh`),id:N()})]),gc=z({event:N(),data:N(),id:N()}),_c=H(`type`,[z({type:G(`unavailable`),version:G(3),epoch:I(),reason:N()}),z({type:G(`hello`),version:G(3)}),z({type:G(`alive`),version:G(3),epoch:I()}),z({type:G(`frame`),version:G(3),epoch:I(),id:N(),frame:V([gc,sc])}),z({type:G(`value`),version:G(3),epoch:I(),id:N(),value:Fa(),error:N().optional()}),z({type:G(`reset`),version:G(3),epoch:I(),id:N(),reason:N()})]),vc=e=>`${e.projectId}/${e.runId}`;export{I as $,us as A,Fo as B,Bs as C,fs as D,Ls as E,Xo as F,So as G,Co as H,$o as I,R as J,W as K,ts as L,qo as M,Bo as N,as as O,Yo as P,La as Q,zo as R,Os as S,ks as T,Eo as U,J as V,K as W,H as X,L as Y,G as Z,Ks as _,fc as a,Fa as at,Xs as b,vc as c,A as ct,tc as d,z as et,qs as f,Js as g,Ys as h,dc as i,V as it,Ko as j,X as k,oc as l,a as lt,Gs as m,cc as n,U as nt,hc as o,ua as ot,ec as p,ja as q,uc as r,N as rt,_c as s,F as st,lc as t,yo as tt,sc as u,t as ut,$s as v,Vs as w,js as x,Qs as y,Io as z};
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function di(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:pi(t,`input`,e.processors),output:pi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}var fi=(e,t={})=>n=>{let r=li({...n,processors:t});return O(e,r),ui(r,e),di(r,e)},pi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=li({...i??{},target:a,io:t,processors:n});return O(e,o),ui(o,e),di(o,e)},mi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=mi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},gi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},_i=(e,t,n,r)=>{n.type=`boolean`},vi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},yi=(e,t,n,r)=>{n.not={}},bi=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},xi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ci=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},wi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=O(a.element,t,{...r,path:[...r.path,`items`]})},Ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=O(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ei=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Di=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Oi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=O(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=O(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ki=(e,t,n,r)=>{let i=e._zod.def,a=O(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ai=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ji=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Mi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ni=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Pi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;O(o,t,r);let s=t.seen.get(e);s.ref=o},Fi=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ii=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=s(`ZodISODateTime`,(e,t)=>{Qt.init(e,t),P.init(e,t)});function A(e){return Or(Li,e)}var Ri=s(`ZodISODate`,(e,t)=>{$t.init(e,t),P.init(e,t)});function zi(e){return kr(Ri,e)}var Bi=s(`ZodISOTime`,(e,t)=>{en.init(e,t),P.init(e,t)});function Vi(e){return Ar(Bi,e)}var Hi=s(`ZodISODuration`,(e,t)=>{tn.init(e,t),P.init(e,t)});function Ui(e){return jr(Hi,e)}var j=s(`ZodError`,(e,t)=>{Ee.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ke(e,t)},flatten:{value:t=>Oe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Wi=Ae(j),Gi=je(j),Ki=Me(j),qi=Pe(j),Ji=Ie(j),Yi=Le(j),Xi=Re(j),Zi=ze(j),Qi=Be(j),$i=Ve(j),ea=He(j),ta=Ue(j),na=new WeakMap;function ra(e,t,n){let r=Object.getPrototypeOf(e),i=na.get(r);if(i||(i=new Set,na.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var M=s(`ZodType`,(e,t)=>(T.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pi(e,`input`),output:pi(e,`output`)}}),e.toJSONSchema=fi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Wi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ki(e,t,n),e.parseAsync=async(t,n)=>Gi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>qi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ji(e,t,n),e.decode=(t,n)=>Yi(e,t,n),e.encodeAsync=async(t,n)=>Xi(e,t,n),e.decodeAsync=async(t,n)=>Zi(e,t,n),e.safeEncode=(t,n)=>Qi(e,t,n),e.safeDecode=(t,n)=>$i(e,t,n),e.safeEncodeAsync=async(t,n)=>ea(e,t,n),e.safeDecodeAsync=async(t,n)=>ta(e,t,n),ra(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return y(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_o(e,t))},superRefine(e,t){return this.check(vo(e,t))},overwrite(e){return this.check(D(e))},optional(){return Za(this)},exactOptional(){return $a(this)},nullable(){return to(this)},nullish(){return Za(to(this))},nonoptional(e){return so(this,e)},array(){return R(this)},or(e){return V([this,e])},and(e){return Wa(this,e)},transform(e){return fo(this,Ya(e))},default(e){return ro(this,e)},prefault(e){return ao(this,e)},catch(e){return lo(this,e)},pipe(e){return fo(this,e)},readonly(){return ho(this)},describe(e){let t=this.clone();return ir.add(t,{description:e}),t},meta(...e){if(e.length===0)return ir.get(this);let t=this.clone();return ir.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return ir.get(e)?.description},configurable:!0}),e)),ia=s(`_ZodString`,(e,t)=>{Bt.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ra(e,`_ZodString`,{regex(...e){return this.check(Jr(...e))},includes(...e){return this.check(Zr(...e))},startsWith(...e){return this.check(Qr(...e))},endsWith(...e){return this.check($r(...e))},min(...e){return this.check(Kr(...e))},max(...e){return this.check(Gr(...e))},length(...e){return this.check(qr(...e))},nonempty(...e){return this.check(Kr(1,...e))},lowercase(e){return this.check(Yr(e))},uppercase(e){return this.check(Xr(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(ii())}})}),aa=s(`ZodString`,(e,t)=>{Bt.init(e,t),ia.init(e,t),e.email=t=>e.check(or(oa,t)),e.url=t=>e.check(fr(la,t)),e.jwt=t=>e.check(Dr(Ta,t)),e.emoji=t=>e.check(pr(da,t)),e.guid=t=>e.check(sr(sa,t)),e.uuid=t=>e.check(cr(ca,t)),e.uuidv4=t=>e.check(lr(ca,t)),e.uuidv6=t=>e.check(ur(ca,t)),e.uuidv7=t=>e.check(dr(ca,t)),e.nanoid=t=>e.check(mr(fa,t)),e.guid=t=>e.check(sr(sa,t)),e.cuid=t=>e.check(hr(pa,t)),e.cuid2=t=>e.check(gr(ma,t)),e.ulid=t=>e.check(_r(ha,t)),e.base64=t=>e.check(wr(Sa,t)),e.base64url=t=>e.check(Tr(Ca,t)),e.xid=t=>e.check(vr(ga,t)),e.ksuid=t=>e.check(yr(_a,t)),e.ipv4=t=>e.check(br(va,t)),e.ipv6=t=>e.check(xr(ya,t)),e.cidrv4=t=>e.check(Sr(ba,t)),e.cidrv6=t=>e.check(Cr(xa,t)),e.e164=t=>e.check(Er(wa,t)),e.datetime=t=>e.check(A(t)),e.date=t=>e.check(zi(t)),e.time=t=>e.check(Vi(t)),e.duration=t=>e.check(Ui(t))});function N(e){return ar(aa,e)}var P=s(`ZodStringFormat`,(e,t)=>{E.init(e,t),ia.init(e,t)}),oa=s(`ZodEmail`,(e,t)=>{Ut.init(e,t),P.init(e,t)}),sa=s(`ZodGUID`,(e,t)=>{Vt.init(e,t),P.init(e,t)}),ca=s(`ZodUUID`,(e,t)=>{Ht.init(e,t),P.init(e,t)});function F(e){return cr(ca,e)}var la=s(`ZodURL`,(e,t)=>{Wt.init(e,t),P.init(e,t)});function ua(e){return fr(la,e)}var da=s(`ZodEmoji`,(e,t)=>{Gt.init(e,t),P.init(e,t)}),fa=s(`ZodNanoID`,(e,t)=>{Kt.init(e,t),P.init(e,t)}),pa=s(`ZodCUID`,(e,t)=>{qt.init(e,t),P.init(e,t)}),ma=s(`ZodCUID2`,(e,t)=>{Jt.init(e,t),P.init(e,t)}),ha=s(`ZodULID`,(e,t)=>{Yt.init(e,t),P.init(e,t)}),ga=s(`ZodXID`,(e,t)=>{Xt.init(e,t),P.init(e,t)}),_a=s(`ZodKSUID`,(e,t)=>{Zt.init(e,t),P.init(e,t)}),va=s(`ZodIPv4`,(e,t)=>{nn.init(e,t),P.init(e,t)}),ya=s(`ZodIPv6`,(e,t)=>{rn.init(e,t),P.init(e,t)}),ba=s(`ZodCIDRv4`,(e,t)=>{an.init(e,t),P.init(e,t)}),xa=s(`ZodCIDRv6`,(e,t)=>{on.init(e,t),P.init(e,t)}),Sa=s(`ZodBase64`,(e,t)=>{cn.init(e,t),P.init(e,t)}),Ca=s(`ZodBase64URL`,(e,t)=>{un.init(e,t),P.init(e,t)}),wa=s(`ZodE164`,(e,t)=>{dn.init(e,t),P.init(e,t)}),Ta=s(`ZodJWT`,(e,t)=>{pn.init(e,t),P.init(e,t)}),Ea=s(`ZodNumber`,(e,t)=>{mn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r),ra(e,`ZodNumber`,{gt(e,t){return this.check(Hr(e,t))},gte(e,t){return this.check(Ur(e,t))},min(e,t){return this.check(Ur(e,t))},lt(e,t){return this.check(Br(e,t))},lte(e,t){return this.check(Vr(e,t))},max(e,t){return this.check(Vr(e,t))},int(e){return this.check(Oa(e))},safe(e){return this.check(Oa(e))},positive(e){return this.check(Hr(0,e))},nonnegative(e){return this.check(Ur(0,e))},negative(e){return this.check(Br(0,e))},nonpositive(e){return this.check(Vr(0,e))},multipleOf(e,t){return this.check(Wr(e,t))},step(e,t){return this.check(Wr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Mr(Ea,e)}var Da=s(`ZodNumberFormat`,(e,t)=>{hn.init(e,t),Ea.init(e,t)});function Oa(e){return Pr(Da,e)}var ka=s(`ZodBoolean`,(e,t)=>{gn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function L(e){return Fr(ka,e)}var Aa=s(`ZodNull`,(e,t)=>{_n.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function ja(e){return Ir(Aa,e)}var Ma=s(`ZodAny`,(e,t)=>{vn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Na(){return Lr(Ma)}var Pa=s(`ZodUnknown`,(e,t)=>{yn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Fa(){return Rr(Pa)}var Ia=s(`ZodNever`,(e,t)=>{bn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function La(e){return zr(Ia,e)}var Ra=s(`ZodArray`,(e,t)=>{Sn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.element=t.element,ra(e,`ZodArray`,{min(e,t){return this.check(Kr(e,t))},nonempty(e){return this.check(Kr(1,e))},max(e,t){return this.check(Gr(e,t))},length(e,t){return this.check(qr(e,t))},unwrap(){return this.element}})});function R(e,t){return ai(Ra,e,t)}var za=s(`ZodObject`,(e,t)=>{Dn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),m(e,`shape`,()=>t.shape),ra(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Fa()})},loose(){return this.clone({...this._zod.def,catchall:Fa()})},strict(){return this.clone({...this._zod.def,catchall:La()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ge(this,e)},safeExtend(e){return _e(this,e)},merge(e){return ve(this,e)},pick(e){return me(this,e)},omit(e){return he(this,e)},partial(...e){return ye(Xa,this,e[0])},required(...e){return be(oo,this,e[0])}})});function z(e,t){return new za({type:`object`,shape:e??{},...b(t)})}function Ba(e,t){return new za({type:`object`,shape:e,catchall:La(),...b(t)})}function B(e,t){return new za({type:`object`,shape:e,catchall:Fa(),...b(t)})}var Va=s(`ZodUnion`,(e,t)=>{kn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.options=t.options});function V(e,t){return new Va({type:`union`,options:e,...b(t)})}var Ha=s(`ZodDiscriminatedUnion`,(e,t)=>{Va.init(e,t),An.init(e,t)});function H(e,t,n){return new Ha({type:`union`,options:t,discriminator:e,...b(n)})}var Ua=s(`ZodIntersection`,(e,t)=>{jn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function Wa(e,t){return new Ua({type:`intersection`,left:e,right:t})}var Ga=s(`ZodRecord`,(e,t)=>{Pn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function U(e,t,n){return!t||!t._zod?new Ga({type:`record`,keyType:N(),valueType:e,...b(t)}):new Ga({type:`record`,keyType:e,valueType:t,...b(n)})}var Ka=s(`ZodEnum`,(e,t)=>{Fn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ka({...t,checks:[],...b(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ka({...t,checks:[],...b(r),entries:i})}});function W(e,t){return new Ka({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var qa=s(`ZodLiteral`,(e,t)=>{In.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new qa({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Ja=s(`ZodTransform`,(e,t)=>{Ln.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(we(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(we(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ya(e){return new Ja({type:`transform`,transform:e})}var Xa=s(`ZodOptional`,(e,t)=>{zn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Za(e){return new Xa({type:`optional`,innerType:e})}var Qa=s(`ZodExactOptional`,(e,t)=>{Bn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Qa({type:`optional`,innerType:e})}var eo=s(`ZodNullable`,(e,t)=>{Vn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function to(e){return new eo({type:`nullable`,innerType:e})}var no=s(`ZodDefault`,(e,t)=>{Hn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ro(e,t){return new no({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var io=s(`ZodPrefault`,(e,t)=>{Wn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e,t){return new io({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ue(t)}})}var oo=s(`ZodNonOptional`,(e,t)=>{Gn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function so(e,t){return new oo({type:`nonoptional`,innerType:e,...b(t)})}var co=s(`ZodCatch`,(e,t)=>{qn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lo(e,t){return new co({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var uo=s(`ZodPipe`,(e,t)=>{Jn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.in=t.in,e.out=t.out});function fo(e,t){return new uo({type:`pipe`,in:e,out:t})}var po=s(`ZodPreprocess`,(e,t)=>{uo.init(e,t),Xn.init(e,t)}),mo=s(`ZodReadonly`,(e,t)=>{Zn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e){return new mo({type:`readonly`,innerType:e})}var go=s(`ZodCustom`,(e,t)=>{$n.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r)});function _o(e,t={}){return oi(go,e,t)}function vo(e,t){return si(e,t)}function yo(e,t){return new po({type:`pipe`,in:Ya(e),out:t})}var bo={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},xo;xo||={};function So(e){return Nr(Ea,e)}var K=W([`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`]),q={questions:4,id:64,header:12,question:400,minOptions:2,maxOptions:4,label:60,description:280,context:2e4},Co=N().min(1).max(q.context),wo=z({label:N().min(1).max(q.label),description:N().max(q.description).optional()}).strict(),To=z({id:N().min(1).max(q.id).optional(),header:N().min(1).max(q.header),question:N().min(1).max(q.question),options:R(wo).min(q.minOptions).max(q.maxOptions).refine(e=>new Set(e.map(e=>e.label)).size===e.length,{message:`option labels must be unique within a question`}).optional(),multiSelect:L().optional()}).strict(),Eo=z({context:Co.optional(),questions:R(To).min(1).max(q.questions).refine(e=>new Set(e.map(e=>e.question)).size===e.length,{message:`question texts must be unique`})}).strict(),Do=W([`family`,`peer`]),Oo=z({senderRunId:F(),recipientRunId:F(),kind:W([`request`,`progress`,`follow-up`,`reply`]),requestId:F().optional(),relationship:Do.optional()}).strict(),ko=Oo.extend({id:F(),text:N().min(1).max(1e5),createdAt:A(),deadline:A().optional(),requestHash:N().regex(/^[0-9a-f]{64}$/),state:W([`accepted`,`continuation-required`,`destroyed`,`late`]),resumed:G(!0).optional(),instruction:N().max(2048).optional(),question:Eo.optional()}),J=z({requestId:F(),status:W([`replied`,`replied-late`,`completed-without-reply`,`failed`,`cancelled`,`destroyed`,`timed-out`,`sender-closed`,`human-fallback`,`deleted`]),observedAt:A(),replyId:F().optional()}).strict(),Ao=z({messages:R(ko).max(1024),outcomes:R(J).max(1024)}).strict(),jo=N().max(128).regex(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i,`Not a history cursor; pass nextBefore from an earlier page`);Ao.extend({hint:N().optional(),nextBefore:jo.optional()}),z({messages:R(ko).max(32),outcomes:R(J).max(32),receiptId:F().optional(),expiresAt:A().optional()}).strict().refine(e=>e.messages.length>0?e.receiptId!==void 0&&e.expiresAt!==void 0:e.receiptId===void 0&&e.expiresAt===void 0,{message:`A nonempty inbox batch requires a receipt and expiry`}),z({receiptId:F()}).strict(),z({receiptId:F(),status:W([`acknowledged`,`already-acknowledged`,`released`])}).strict(),z({id:F(),recipientRunId:F(),kind:Oo.shape.kind,requestId:F().optional(),text:N().min(1).max(1e5).refine(e=>e.trim().length>0),timeoutSeconds:I().int().min(1).max(86400).default(600),resume:L().optional()}).strict().refine(e=>e.timeoutSeconds<=7200||e.resume===!0&&e.kind===`request`,{path:[`timeoutSeconds`],message:`Only --resume requests accept deadlines above 7200 seconds (maximum 86400)`}).refine(e=>(e.kind===`reply`||e.kind===`follow-up`)==(e.requestId!==void 0),{message:`Replies and follow-ups require a request ID; new messages must omit it`}).refine(e=>!e.resume||e.kind===`request`||e.kind===`progress`,{message:`--resume requires a new request or progress instruction`});var Mo=W([`applied`,`unchanged`,`refused`,`unknown`]);z({message:ko,delivery:W([`queued`,`delivered`,`consumed`,`not-delivered`]),outcome:J.optional(),effect:Mo.optional()}).strict(),z({recipientRunId:F(),before:jo.optional()}).strict(),z({requestId:F()}).strict(),z({requestIds:R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length),mode:W([`one`,`any`,`all`]).optional(),timeoutSeconds:I().int().min(1).max(7200).default(600)}).strict().refine(e=>e.mode!==`one`||e.requestIds.length===1,{message:`one requires exactly one request`});var No=W([`low`,`medium`,`high`,`xhigh`,`max`]),Po=N().max(32).optional();function Fo(){return z({claude:N().optional(),codex:N().optional(),opencode:N().optional(),pi:N().optional(),cursor:N().optional(),omp:N().optional()})}var Io=z({repo:N().min(1).max(500),name:N().min(1).max(200)}).strict();z({browseRoot:N(),projectsDir:N(),archiveOnMerge:L().nullable(),effectiveArchiveOnMerge:L(),archiveOnMergeSource:W([`global`,`environment`,`default`]),composerDefaults:z({autonomous:L().nullable(),worktree:L().nullable(),inheritedAutonomous:V([L(),G(`source-dependent`)]),inheritedWorktree:L()}),resources:z({maxParallel:I(),maxMonitoringSessions:I(),monitoringWakeIntervalMinutes:I().nullable(),autoResumeOnUsageLimit:L(),memoryLimitMb:I().nullable(),worktreeRetentionDefault:I()}),agentDefaults:z({runner:K.optional(),models:Fo().optional()})}),z({browseRoot:N().trim().min(1).max(4096).optional(),projectsDir:N().trim().min(1).max(4096).optional(),archiveOnMerge:L().nullable().optional(),composerDefaults:z({autonomous:L().nullable().optional(),worktree:L().nullable().optional()}).optional(),agentDefaults:z({runner:K.nullable().optional(),models:z({claude:N().trim().min(1).max(200).nullable().optional(),codex:N().trim().min(1).max(200).nullable().optional(),opencode:N().trim().min(1).max(200).nullable().optional(),pi:N().trim().min(1).max(200).nullable().optional(),cursor:N().trim().min(1).max(200).nullable().optional(),omp:N().trim().min(1).max(200).nullable().optional()}).optional()}).optional(),resources:z({maxParallel:I().int().min(1).max(16).optional(),maxMonitoringSessions:I().int().min(0).max(16).optional(),monitoringWakeIntervalMinutes:I().int().min(1).max(60).nullable().optional(),autoResumeOnUsageLimit:L().optional(),memoryLimitMb:I().int().min(0).max(1048576).nullable().optional(),worktreeRetentionDefault:I().int().min(0).max(1e3).optional()}).optional()});var Lo=z({accent:W([`cezarion`,`lime`,`violet`]).optional(),density:W([`comfortable`,`compact`,`ultra`]).optional(),width:W([`narrow`,`wide`]).optional()}),Ro=B({expandedColumns:U(N(),L()).optional()}),zo=z({overall:I().int().positive().nullable().optional(),needsYou:I().int().positive().nullable().optional(),finished:I().int().positive().nullable().optional(),working:I().int().positive().nullable().optional()});function Bo(e){let t={overall:10,needsYou:null,finished:null,working:null},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let e of Object.keys(t)){let r=zo.shape[e].safeParse(n[e]);r.success&&r.data!==void 0&&(t[e]=r.data)}return t}B({sidebarLimits:zo.optional(),lastTask:z({source:W([`workflow`,`skill`]),ref:N()}).nullable().optional(),recentSources:R(z({source:W([`workflow`,`skill`]),ref:N()})).optional(),lastWorktree:L().optional(),lastAutonomous:L().optional(),disabledTeamSkills:R(Io).max(200).optional(),skillUsage:U(N(),I()).optional(),runsView:W([`list`,`table`]).optional(),githubView:W([`issues`,`prs`]).optional(),appearance:Lo.optional(),promptTemplates:R(z({id:N(),label:N(),text:N(),skills:R(N()).optional()})).optional()});var Vo=Ba({projectId:N().min(1).max(64),pathname:N().min(1).max(2048).startsWith(`/p/`),search:N().max(4096).startsWith(`?`).optional(),hash:N().max(2048).startsWith(`#`).optional()}),Ho=B({sidebar:B({collapsed:U(N(),L()).optional(),projectOrder:R(N()).optional()}).optional(),dismissedProviderAuthFailures:Fo().optional(),appearance:Lo.optional(),notifications:B({enabled:L().optional()}).optional(),taskTable:Ro.optional(),lastLocation:Vo.optional()}),Uo=200,Wo=50;B({...Ho.shape,sidebar:B({collapsed:U(N().min(1).max(64),L()).refine(e=>Object.keys(e).length<=Uo,{message:`sidebar.collapsed must have at most ${Uo} entries`}).optional(),projectOrder:R(N().min(1).max(64)).max(Uo).optional()}).optional(),dismissedProviderAuthFailures:Ba({claude:N().min(1).max(128).optional(),codex:N().min(1).max(128).optional(),opencode:N().min(1).max(128).optional(),pi:N().min(1).max(128).optional(),cursor:N().min(1).max(128).optional(),omp:N().min(1).max(128).optional()}).optional(),taskTable:Ro.extend({expandedColumns:U(N().min(1).max(64),L()).refine(e=>Object.keys(e).length<=Wo,{message:`taskTable.expandedColumns must have at most ${Wo} entries`}).optional()}).optional()}).superRefine((e,t)=>{Object.keys(e).length>Uo&&t.addIssue({code:`custom`,message:`ui-state has too many keys (max ${Uo})`})});var Go=Fo(),Ko=4e3,qo=7200,Jo=z({commands:R(N().trim().min(1).max(Ko)).max(20),timeoutSeconds:I().int().min(1).max(qo).optional()}).strict();z({archiveOnMerge:L().nullable(),effectiveArchiveOnMerge:L(),archiveOnMergeSource:W([`project`,`global`,`environment`,`default`]),baseBranch:N().nullable(),defaultRunner:K,systemPrompt:N().nullable(),defaultModels:Go,modelsLocked:L(),maxParallel:I(),memoryLimitMb:I().nullable(),worktreeRetention:I(),liveTitleUpdates:L().nullable(),reviewGate:L().nullable(),worktreeSetup:z({commands:R(N()),timeoutSeconds:I()}).nullable(),worktreeSetupIssue:N().nullable()}),z({archiveOnMerge:L().nullable().optional(),baseBranch:N().trim().min(1).max(200).nullable().optional(),defaultRunner:K.optional(),systemPrompt:N().trim().max(2e4).nullable().optional(),defaultModels:z({claude:N().trim().max(200).nullable().optional(),codex:N().trim().max(200).nullable().optional(),opencode:N().trim().max(200).nullable().optional(),pi:N().trim().max(200).nullable().optional(),cursor:N().trim().max(200).nullable().optional(),omp:N().trim().max(200).nullable().optional()}).optional(),maxParallel:I().int().min(1).max(16).optional(),memoryLimitMb:I().int().min(0).max(1048576).nullable().optional(),worktreeRetention:I().int().min(0).max(1e3).nullable().optional(),liveTitleUpdates:L().nullable().optional(),reviewGate:L().nullable().optional(),worktreeSetup:Jo.nullable().optional()});var Yo=K,Xo=z({provider:Yo,status:W([`connected`,`disconnected`,`not-installed`,`unknown`]),enabled:L().optional(),hint:N().optional(),authFailureId:N().optional(),profileId:N().optional()});z({providers:R(Xo)}),H(`opened`,[z({opened:G(!0),command:N()}),z({opened:G(!1),connected:G(!0),command:N()})]);var Zo=W([`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`]),Qo=Zo.options;function $o(e){return Qo.includes(e)}var es=z({id:N(),label:N(),description:N(),effortLevels:R(No).optional()}),ts=z({runner:K,models:R(es),source:W([`live`,`cache`,`unavailable`]),stale:L(),reason:N().optional()}),ns=z({runner:Zo,requestedModel:N(),availableModels:R(es),otherRunners:R(Zo)});z({targets:R(z({id:N(),label:N(),icon:N().optional()}))}),z({target:N().trim().min(1,`target required`).max(200)}),z({opened:G(!0),path:N()});var rs=W([`spawn`,`inspect`,`steer`,`stop`,`destroy`,`diff`,`wait`]),Y=N().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),is=N().regex(/^[0-9a-f]{64}$/),as=R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length),os=R(rs).max(7).refine(e=>new Set(e).size===e.length),ss=R(W([`process`,`worktree`,`branch`])).max(3).refine(e=>new Set(e).size===e.length),cs=N().max(2e3),ls=z({ownerRunId:F(),resourceId:F(),kind:G(`owned-isolated`),path:N().min(1),branch:N().min(1),baselineSha:Y}).strict(),X=z({workerId:F(),status:W([`review`,`done`,`failed`,`cancelled`]),observedAt:A(),summary:N().max(4e3).optional(),revision:I().int().nonnegative().optional()}).strict(),us=W([`one`,`any`,`all`]),Z=z({id:F(),workerIds:R(F()).max(32).refine(e=>new Set(e).size===e.length),requestIds:R(F()).min(1).max(32).optional(),requestOutcomes:R(J).max(32).optional(),deadline:A(),mode:us.optional(),revisions:R(z({workerId:F(),revision:I().int().nonnegative()}).strict()).max(32).optional(),reason:W([`outcome`,`timeout`,`cancelled`,`message`]).optional(),phase:W([`registered`,`parked`,`wake-pending`]),outcomes:R(X).max(32),wakeId:F().optional()}).strict(),ds=Z.omit({deadline:!0,requestIds:!0,requestOutcomes:!0}).extend({via:G(`completion`)}).strict(),fs=z({attempts:I().int().positive(),nextAt:A(),needsAttention:G(!0).optional()}).strict(),ps=z({requestedAt:A(),phase:W([`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),remaining:ss,error:cs.optional()}).strict(),ms=ps.extend({retry:fs.optional()}).strict(),hs=z({requestId:F(),workerId:F(),requestHash:is,deletion:z({phase:W([`pending`,`complete`]),revision:I().int().nonnegative(),resourceId:F(),generation:F()}).strict().optional()}).strict(),gs=W(K.options),_s=N().min(1).max(4096).refine(e=>!/[\\\u0000-\u001f\u007f:]/.test(e)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`));function vs(e){return e.split(`/`).at(-1)?.toLowerCase()===`.gitignore`?`--attach cannot attach a .gitignore: ${e}; ignore rules must come from the baseline`:void 0}var ys=H(`kind`,[z({kind:G(`baseline-file`),path:_s}).strict(),z({kind:G(`parent-attachment`),id:N().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))}).strict(),z({kind:G(`parent-file`),path:_s}).strict().superRefine(({path:e},t)=>{let n=vs(e);n&&t.addIssue({code:`custom`,path:[`path`],message:n})})]),bs=z({text:N().max(1e5).optional(),artifacts:R(ys).max(32).optional()}).strict().superRefine(({artifacts:e=[]},t)=>{let n=new Set;for(let[r,i]of e.entries())i.kind===`parent-file`&&(n.has(i.path)&&t.addIssue({code:bo.custom,path:[`artifacts`,r,`path`],message:`duplicate --attach path: ${i.path}`}),n.add(i.path))}),xs=z({source:ys,path:N().min(1).max(8192),sha256:is,bytes:I().int().min(0).max(2**53-1)}).strict(),Ss=z({text:N().max(1e5).optional(),inputs:R(xs).max(32)}).strict(),Cs=z({state:G(`unavailable`),reason:W([`no-assistant-output`,`missing`,`unreadable`,`unverified`]),detail:cs.optional()}).strict(),ws=z({state:G(`deleted`),reason:G(`missing`)}).strict(),Ts=W([`running`,`review-ready`,`completed`,`failed`,`cancelled`]),Es=H(`state`,[z({state:G(`available`),id:N().max(255),path:N().max(8192)}).strict(),Cs.extend({id:N().max(255),path:N().max(8192)}),ws.extend({id:N().max(255),path:N().max(8192)})]);z({result:z({workerId:F(),parentRunId:F(),revision:I().int().nonnegative(),observedAt:A(),status:W([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),outcome:W([`running`,`review-ready`,`completed`,`failed`,`cancelled`,`destroyed`]),lastExecutionOutcome:Ts,partial:L(),settled:L(),error:cs.optional(),backend:gs.optional(),model:N().max(512).optional(),baselineSha:Y,workspace:ls.extend({state:W([`available`,`unavailable`,`deleted`]).optional()}),cleanup:W([`retained`,`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),summary:H(`state`,[z({state:G(`available`),text:N().min(1).max(4e3),source:W([`assistant`,`failure`]),seq:I().int().nonnegative(),truncated:L()}).strict(),Cs,ws]),head:H(`state`,[z({state:G(`available`),sha:Y}).strict(),Cs.extend({sha:Y.optional()}),ws.extend({sha:Y.optional()})]),diff:H(`state`,[z({state:G(`available`),snapshotId:F(),path:N().min(1).max(8192),truncated:L()}).strict(),Cs,ws]),artifacts:H(`state`,[z({state:G(`available`),items:R(Es).max(32),truncated:L()}).strict(),Cs,ws])}).strict(),diffSnapshot:N().max(4e5).optional()}).strict();var Ds=z({workerId:F(),revision:I().int().nonnegative(),snapshotId:F(),observedAt:A(),lastExecutionOutcome:Ts,previous:z({revision:I().int().nonnegative(),observedAt:A(),lastExecutionOutcome:Ts}).strict().optional()}).strict(),Os=H(`role`,[z({role:G(`root`),conversation:Ao.optional(),permissions:os,receipts:R(hs).max(1024).refine(e=>new Set(e.map(e=>e.requestId)).size===e.length&&new Set(e.map(e=>e.workerId)).size===e.length),wait:Z.optional(),lastWait:Z.optional(),results:R(Ds).max(1024).refine(e=>new Set(e.map(e=>e.workerId)).size===e.length).optional(),finishRequestedAt:A().optional(),historyDeletion:G(`pending`).optional(),completion:z({phase:W([`waiting`,`attention`]),waitId:F().optional()}).strict().optional()}).strict(),z({role:G(`worker`),wait:Z.optional(),lastWait:Z.optional(),permissions:os,parentRunId:F(),workspace:ls,destroy:ps.optional(),context:Ss.optional(),executionRevision:I().int().nonnegative().optional(),executionStartSeq:I().int().nonnegative().optional()}).strict(),z({role:G(`invalid`)}).strict()]),ks=H(`role`,[Os.options[0].pick({role:!0}).strip().extend({wait:Z.pick({phase:!0,requestIds:!0,workerIds:!0}).partial({workerIds:!0}).strip().extend({outcomes:R(X.pick({workerId:!0}).strip()).max(32).optional()}).optional()}),Os.options[1].pick({role:!0,parentRunId:!0}).strip().extend({wait:Z.pick({phase:!0,requestIds:!0}).strip().optional()}),Os.options[2].strip()]);z({task:N().min(1).max(1e5),baseline:N().min(1).max(1024),requestId:F(),context:bs.optional(),backend:gs.optional(),model:N().trim().min(1).max(512).optional(),effort:Po,workflow:N().trim().min(1).max(200).optional(),skill:N().trim().min(1).max(200).optional()}).strict().refine(e=>e.skill===void 0||e.workflow===void 0,{message:`--skill and --workflow cannot be used together`}).refine(e=>e.task.length+(e.context?.text?.length??0)<=1e5,{message:`Combined task and context exceed 100000 characters`}),z({text:N().max(1e5).refine(e=>e.trim().length>0)}).strict(),z({workerIds:as,timeoutSeconds:I().int().min(1).max(7200).default(600),mode:us.optional()}).strict().refine(e=>e.mode!==`one`||e.workerIds.length===1,{message:`one mode requires exactly one worker`});var As=z({receiptId:F(),generation:F(),expiresAt:A(),acknowledgedAt:A().optional(),memberIds:R(F()).min(1).max(32).refine(e=>new Set(e).size===e.length).optional()}).strict(),js=z({conversation:Oo.optional(),id:F(),source:W([`agent`,`lifecycle`]),parentRunId:F(),text:N().min(1).max(1e5),createdAt:A(),deliveredAt:A().optional(),consumedAt:A().optional(),awaitingRead:G(!0).optional(),inboxClaim:As.optional(),purpose:W([`completion-refusal`,`undelivered-question`]).optional(),requestHash:N().regex(/^[0-9a-f]{64}$/).optional(),deadline:A().optional()}).strict(),Ms=z({workerId:F(),parentRunId:F(),status:W([`queued`,`running`,`waiting`,...X.shape.status.options]),currentStepId:N().optional(),workspace:ls,backend:gs.optional(),model:N().max(512).optional(),inputs:R(xs).max(32).optional(),wait:Z.optional(),completionWait:ds.optional(),destroy:ms.optional(),outcome:X.optional()}),Ns=Ms.pick({workerId:!0,parentRunId:!0,status:!0,workspace:!0,destroy:!0}).extend({revision:I().int().nonnegative(),settled:L(),destroyed:L()}).strict(),Ps=z({workers:R(Ns).max(1024)}).strict();z({offset:N().regex(/^\d{1,4}$/).refine(e=>Number(e)<=1024).optional()}).strict(),Ps.extend({workers:R(Ns).max(32),nextOffset:I().int().min(1).max(1024).optional()}).strict(),z({workerId:F(),baselineSha:Y,diff:N().max(4e5),truncated:L()}),z({workerId:F(),state:W([`stopping`,`terminated`])}),z({workerId:F(),state:W([`complete`,`incomplete`]),deleted:R(H(`kind`,[z({kind:G(`worktree`),path:N().max(8192)}).strict(),z({kind:G(`branch`),ref:N().max(1024)}).strict()])).max(2).optional(),remaining:ss,error:cs.optional()});var Fs=z({outstanding:I().int().nonnegative(),limit:I().int().nonnegative(),created:I().int().nonnegative(),creationLimit:I().int().nonnegative()}).strict(),Is=z({id:N(),title:N(),titleSummary:N().optional(),titleOrigin:W([`user`,`auto`,`marker`]).optional()}),Ls=z({parentRunId:F().optional(),workers:R(Ms).max(1024),titles:R(Is).max(1025).optional(),capacity:Fs.optional()});z({code:W([`unavailable_transport`,`unauthenticated`,`denied_scope`,`invalid_input`,`invalid_baseline`,`incompatible_state`,`capacity_limit`,`unavailable_diff`,`incomplete_cleanup`]),error:cs,modelChoices:ns.optional()}),z({workerId:F()}).strict(),z({workerId:F(),baselineSha:Y}).strict(),z({workerId:F(),state:W([`queued`,`delivered`])}).strict();var Rs=z({wait:Z,instruction:N().min(1).max(1e3)}).strict();z({}).strict(),z({waitId:F()}).strict();var zs=z({wait:Z}).strict();z({peerIds:as,timeoutSeconds:I().int().min(1).max(7200).default(600)}).strict();var Bs=H(`reason`,[z({reason:G(`message`),peerRunId:F(),messageId:F()}).strict(),z({reason:G(`settled`),peerRunId:F()}).strict(),z({reason:G(`timeout`)}).strict()]);function Vs(e,t){(e.phase===`resolved`||e.phase===`delivered`)&&!e.result&&t.addIssue({code:`custom`,message:`a ${e.phase} peer wait has a result`,path:[`result`]}),e.phase===`open`&&e.result&&t.addIssue({code:`custom`,message:`an open peer wait has no result`,path:[`result`]})}var Hs=z({id:F(),peerIds:as,deadline:A(),phase:W([`open`,`resolved`,`delivered`,`cancelled`]),result:Bs.optional()}).strict().superRefine(Vs),Us=z({wait:Hs,instruction:N().min(1).max(1e3)}).strict(),Ws=z({wait:Hs}).strict();V([Rs,Us]),V([zs,Ws]);var Q=B({seq:I(),ts:N(),stepId:N().optional(),type:N()}),Gs=Q.extend({type:G(`conversation-message`),message:ko,delivery:W([`queued`,`delivered`,`consumed`,`not-delivered`]),deliveredAt:A().optional(),consumedAt:A().optional()}),Ks=Q.extend({type:G(`request-outcome`),outcome:J}),qs=Q.extend({type:G(`agent-input`),input:js}),Js=Q.extend({type:G(`human-input-delivered`),askSeq:I().int().nonnegative(),source:W([`human`,`parent`,`cezar`]).optional()}),Ys=Q.extend({type:G(`human-ask-closed`),askSeq:I().int().nonnegative(),reason:W([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`])});Q.extend({type:G(`worker-question-routed`),askSeq:I().int().nonnegative(),messageId:F(),parentRunId:F()}),Q.extend({type:G(`worker-question-fallback`),askSeq:I().int().nonnegative(),reason:N().min(1).max(200)}),Q.extend({type:G(`worker-question-undelivered`),askSeq:I().int().nonnegative(),reason:N().min(1).max(200)}),Q.extend({type:G(`worker-outcome`),outcome:X});var Xs=z({id:N().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)}),$=N().min(1).max(2048);z({cursor:$.optional()}),z({cursor:$.optional(),afterSeq:So().int().nonnegative().optional()});var Zs=z({seq:I(),ts:N(),stepId:N().optional(),type:N()}).catchall(Na()),Qs=z({events:R(Zs),itemCount:I().int().min(0).max(100),olderCursor:$.optional(),newerCursor:$.optional(),liveCursor:$,asOfSeq:I().int().nonnegative(),hasOlder:L()}),$s=z({contextEvents:R(Zs),asOfSeq:I().int().nonnegative()}),ec=z({checkoutId:N().optional(),name:N(),phase:W([`cloning`,`done`,`error`]),line:N().optional(),error:N().optional(),warning:N().optional()}),tc=1024*1024,nc=z({projectId:N().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),runId:Xs.shape.id,cursor:$.optional(),afterSeq:I().int().nonnegative().safe()});z({runs:R(nc).min(1).max(32)}).refine(({runs:e})=>new Set(e.map(e=>`${e.projectId}/${e.runId}`)).size===e.length,{message:`duplicate run demand`});var rc=nc.pick({projectId:!0,runId:!0}),ic=rc.extend({type:W([`error`,`reset`]),status:V([G(400),G(404),G(409),G(413),G(503)]),error:N()}),ac=V([rc.extend({type:G(`batch`),events:R(Zs).max(256),cursor:$,afterSeq:I().int().nonnegative(),hasMore:L()}),ic]),oc=z({generation:N(),results:R(ac)}),sc=V([z({type:G(`ready`),generation:N()}),z({type:G(`ping`)}),rc.extend({type:G(`event`),name:W([`run-event`,`ui-event`]),event:Zs}),ic]),cc=`cezar-live-v3`,lc=15e3,uc=5e3;function dc(e){return!e.startsWith(`/api/v1/`)||e.includes(`#`)||/[\\\r\n]/.test(e)?!1:/^\/api\/v1\/(?:workspace\/(?:runs-index|activity)|p\/[a-zA-Z0-9_-]+\/(?:reports\/state|runs\/[a-zA-Z0-9._-]+\/(?:changes|commits)|github(?:\/(?:checks|ref-status))?))(?:\?[^#]*)?$/.test(e)}var fc=H(`kind`,[z({kind:G(`workspace`)}),nc.extend({kind:G(`run`)}),z({kind:G(`topic`),topic:N().min(1).max(128)}),z({kind:G(`read`),path:N().max(4096).refine(dc),intervalMs:I().int().min(1e3).max(2147483647)})]),pc=z({id:N().min(1).max(128),demand:fc}),mc=z({version:G(3),documentId:N().min(1).max(128),epoch:I().int().nonnegative()}),hc=H(`type`,[mc.extend({type:G(`sync`),entries:R(pc).max(64),workspaceReady:G(!0).optional()}).refine(e=>new Set(e.entries.map(e=>e.id)).size===e.entries.length),mc.extend({type:G(`ack`),id:N(),seq:I().int().nonnegative()}),mc.extend({type:G(`refresh`),id:N()})]),gc=z({event:N(),data:N(),id:N()}),_c=H(`type`,[z({type:G(`unavailable`),version:G(3),epoch:I(),reason:N()}),z({type:G(`hello`),version:G(3)}),z({type:G(`alive`),version:G(3),epoch:I()}),z({type:G(`frame`),version:G(3),epoch:I(),id:N(),frame:V([gc,sc])}),z({type:G(`value`),version:G(3),epoch:I(),id:N(),value:Fa(),error:N().optional()}),z({type:G(`reset`),version:G(3),epoch:I(),id:N(),reason:N()})]),vc=e=>`${e.projectId}/${e.runId}`;export{I as $,us as A,Fo as B,Bs as C,fs as D,Ls as E,Xo as F,So as G,Co as H,$o as I,R as J,W as K,ts as L,qo as M,Bo as N,as as O,Yo as P,La as Q,zo as R,Os as S,ks as T,Eo as U,J as V,K as W,H as X,L as Y,G as Z,Ks as _,fc as a,Fa as at,Xs as b,vc as c,A as ct,tc as d,z as et,qs as f,Js as g,Ys as h,dc as i,V as it,Ko as j,X as k,oc as l,a as lt,Gs as m,cc as n,U as nt,hc as o,ua as ot,ec as p,ja as q,uc as r,N as rt,_c as s,F as st,lc as t,yo as tt,sc as u,t as ut,$s as v,Vs as w,js as x,Qs as y,Io as z};
@@ -1 +1 @@
1
- import{Bn as e,Fn as t}from"./project-scope-context-uluvs2wj.js";function n(e,t){return e??t}function r(e,t){let r=n(e,t);return r===`1`||r===`true`}function i(e,t,r){return e?.trim()||n(t,r)||``}function a(){return r(void 0,void 0)}function o(n){return t[e(n).bucket]<=t.waiting}function s(e){return!a()&&e}export{i,o as n,a as r,s as t};
1
+ import{Bn as e,Fn as t}from"./project-scope-context-wlB-Y0ii.js";function n(e,t){return e??t}function r(e,t){let r=n(e,t);return r===`1`||r===`true`}function i(e,t,r){return e?.trim()||n(t,r)||``}function a(){return r(void 0,void 0)}function o(n){return t[e(n).bucket]<=t.waiting}function s(e){return!a()&&e}export{i,o as n,a as r,s as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{a as s,d as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as ee,t as g,u as _}from"./es2015-CX0rgbM5.js";import{_ as v,b as y,v as b,x,y as te}from"./dropdown-menu-CjLqyqwB.js";var ne=o(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),S=e(i(),1),C=a(),w=`Popover`,[T,re]=f(w,[x]),E=x(),[ie,D]=T(w),O=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=E(t),l=S.useRef(null),[u,f]=S.useState(!1),[p,m]=c({prop:r,defaultProp:i??!1,onChange:a,caller:w});return(0,C.jsx)(y,{...s,children:(0,C.jsx)(ie,{scope:t,contentId:d(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:S.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>f(!0),[]),onCustomAnchorRemove:S.useCallback(()=>f(!1),[]),modal:o,children:n})})};O.displayName=w;var k=`PopoverAnchor`,A=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(k,n),a=E(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return S.useEffect(()=>(o(),()=>s()),[o,s]),(0,C.jsx)(v,{...a,...r,ref:t})});A.displayName=k;var j=`PopoverTrigger`,M=S.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=D(j,r),o=E(r),s=n(t,a.triggerRef),c=(0,C.jsx)(l.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":K(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,C.jsx)(v,{asChild:!0,...o,children:c})});M.displayName=j;var N=`PopoverPortal`,[P,ae]=T(N,{forceMount:void 0}),F=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=D(N,t);return(0,C.jsx)(P,{scope:t,forceMount:n,children:(0,C.jsx)(_,{present:n||a.open,children:(0,C.jsx)(u,{asChild:!0,container:i,children:r})})})};F.displayName=N;var I=`PopoverContent`,L=S.forwardRef((e,t)=>{let n=ae(I,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=D(I,e.__scopePopover);return(0,C.jsx)(_,{present:r||a.open,children:a.modal?(0,C.jsx)(z,{...i,ref:t}):(0,C.jsx)(B,{...i,ref:t})})});L.displayName=I;var R=t(`PopoverContent.RemoveScroll`),z=S.forwardRef((e,t)=>{let r=D(I,e.__scopePopover),i=S.useRef(null),a=n(t,i),o=S.useRef(!1);return S.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,C.jsx)(p,{as:R,allowPinchZoom:!0,children:(0,C.jsx)(V,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=S.forwardRef((e,t)=>{let n=D(I,e.__scopePopover),r=S.useRef(!1),i=S.useRef(!1);return(0,C.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=S.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=D(I,n),h=E(n);return ee(),(0,C.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,C.jsx)(m,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,C.jsx)(te,{"data-state":K(p.open),role:`dialog`,id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),H=`PopoverClose`,U=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(H,n);return(0,C.jsx)(l.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;var W=`PopoverArrow`,G=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=E(n);return(0,C.jsx)(b,{...i,...r,ref:t})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=O,J=A,oe=M,Y=F,se=L;function X(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ce(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=X(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(X(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function le(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:X(e)}:{top:0,bottom:0}}function ue(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function de(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(le(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function fe(){let[e,t]=(0,S.useState)({top:0,bottom:0});return(0,S.useEffect)(()=>de(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function pe(e){let t=(0,S.useRef)(e);t.current=e,(0,S.useEffect)(()=>{let e=document.documentElement;return ce(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var me=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function he(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?me.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var Z=new WeakMap;function ge(e){let t=Z.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return Z.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function _e(e){let t=ge(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&X(e)>80||t>80&&he(e.document?.activeElement)}function ve(){let[e,t]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let e=window,n=()=>t(_e(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}var Q=S.createContext(null);function ye({...e}){let t=S.useRef(!1);return(0,C.jsx)(Q,{value:t,children:(0,C.jsx)(q,{"data-slot":`popover`,...e})})}function be({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=S.useContext(Q);return(0,C.jsx)(oe,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function xe({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=fe(),c=S.useContext(Q);return(0,C.jsx)(Y,{children:(0,C.jsx)(se,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:ue(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function $({...e}){return(0,C.jsx)(J,{"data-slot":`popover-anchor`,...e})}export{pe as a,be as i,$ as n,ve as o,xe as r,ne as s,ye as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,s as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{a as s,d as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as ee,t as g,u as _}from"./es2015-CX0rgbM5.js";import{_ as v,b as y,v as b,x,y as te}from"./dropdown-menu-D7f0O7xR.js";var ne=o(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),S=e(i(),1),C=a(),w=`Popover`,[T,re]=f(w,[x]),E=x(),[ie,D]=T(w),O=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=E(t),l=S.useRef(null),[u,f]=S.useState(!1),[p,m]=c({prop:r,defaultProp:i??!1,onChange:a,caller:w});return(0,C.jsx)(y,{...s,children:(0,C.jsx)(ie,{scope:t,contentId:d(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:S.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>f(!0),[]),onCustomAnchorRemove:S.useCallback(()=>f(!1),[]),modal:o,children:n})})};O.displayName=w;var k=`PopoverAnchor`,A=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(k,n),a=E(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return S.useEffect(()=>(o(),()=>s()),[o,s]),(0,C.jsx)(v,{...a,...r,ref:t})});A.displayName=k;var j=`PopoverTrigger`,M=S.forwardRef((e,t)=>{let{__scopePopover:r,...i}=e,a=D(j,r),o=E(r),s=n(t,a.triggerRef),c=(0,C.jsx)(l.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":K(a.open),...i,ref:s,onClick:h(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,C.jsx)(v,{asChild:!0,...o,children:c})});M.displayName=j;var N=`PopoverPortal`,[P,ae]=T(N,{forceMount:void 0}),F=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=D(N,t);return(0,C.jsx)(P,{scope:t,forceMount:n,children:(0,C.jsx)(_,{present:n||a.open,children:(0,C.jsx)(u,{asChild:!0,container:i,children:r})})})};F.displayName=N;var I=`PopoverContent`,L=S.forwardRef((e,t)=>{let n=ae(I,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=D(I,e.__scopePopover);return(0,C.jsx)(_,{present:r||a.open,children:a.modal?(0,C.jsx)(z,{...i,ref:t}):(0,C.jsx)(B,{...i,ref:t})})});L.displayName=I;var R=t(`PopoverContent.RemoveScroll`),z=S.forwardRef((e,t)=>{let r=D(I,e.__scopePopover),i=S.useRef(null),a=n(t,i),o=S.useRef(!1);return S.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,C.jsx)(p,{as:R,allowPinchZoom:!0,children:(0,C.jsx)(V,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=S.forwardRef((e,t)=>{let n=D(I,e.__scopePopover),r=S.useRef(!1),i=S.useRef(!1);return(0,C.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=S.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=D(I,n),h=E(n);return ee(),(0,C.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,C.jsx)(m,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,C.jsx)(te,{"data-state":K(p.open),role:`dialog`,id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),H=`PopoverClose`,U=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(H,n);return(0,C.jsx)(l.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;var W=`PopoverArrow`,G=S.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=E(n);return(0,C.jsx)(b,{...i,...r,ref:t})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=O,J=A,oe=M,Y=F,se=L;function X(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ce(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=X(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(X(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function le(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:X(e)}:{top:0,bottom:0}}function ue(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function de(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(le(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function fe(){let[e,t]=(0,S.useState)({top:0,bottom:0});return(0,S.useEffect)(()=>de(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function pe(e){let t=(0,S.useRef)(e);t.current=e,(0,S.useEffect)(()=>{let e=document.documentElement;return ce(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var me=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function he(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?me.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var Z=new WeakMap;function ge(e){let t=Z.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return Z.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function _e(e){let t=ge(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&X(e)>80||t>80&&he(e.document?.activeElement)}function ve(){let[e,t]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let e=window,n=()=>t(_e(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}var Q=S.createContext(null);function ye({...e}){let t=S.useRef(!1);return(0,C.jsx)(Q,{value:t,children:(0,C.jsx)(q,{"data-slot":`popover`,...e})})}function be({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=S.useContext(Q);return(0,C.jsx)(oe,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function xe({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=fe(),c=S.useContext(Q);return(0,C.jsx)(Y,{children:(0,C.jsx)(se,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:ue(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function $({...e}){return(0,C.jsx)(J,{"data-slot":`popover-anchor`,...e})}export{pe as a,be as i,$ as n,ve as o,xe as r,ne as s,ye as t};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{L as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Mr as o,Nr as s,Pr as c,mr as l}from"./project-scope-context-wlB-Y0ii.js";import{n as u}from"./toaster-CRVRHlMR.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./arrow-right-Dh_Lx3um.js";import{n as p,r as m,t as h}from"./hourglass-B0lPAJvT.js";import{t as g}from"./info-DA1x_4bz.js";import{a as _}from"./format-BNCkW110.js";import{t as v}from"./play-CmVAj_fu.js";import{c as y,n as ee,o as b,s as x}from"./thread-state-BpcneWuV.js";import{a as S,c as C,i as w,l as T,p as E,r as D,s as O,t as k}from"./dropdown-menu-D7f0O7xR.js";import{s as te}from"./project-router-Dd63wBeA.js";import{Bt as A,J as j,K as ne,Rt as re,Vt as ie,X as M,Xt as N,Y as ae,Z as oe,_n as P,cn as se,et as ce,fn as le,gn as ue,hn as de,ln as fe,nn as pe,nt as me,on as he,pn as F,q as ge,rn as _e,sn as ve,tn as I,tt as ye,zt as be}from"./index-lMBPAedr.js";var xe=d(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),L=d(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),R=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),z=d(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),B=d(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),V=d(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Se=d(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Ce=d(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),H=d(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),U=d(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),W=d(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),G=d(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),K=d(`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`}]]),q=d(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),we=d(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Te=d(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Ee=d(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),De=d(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Oe=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),J=e(i(),1),ke=1e3,Ae=[500,1e3,2e3,4e3,8e3],je=1;function Me(e,t){let n=`/api/v1/p/${encodeURIComponent(e.projectId)}/runs/${encodeURIComponent(e.runId)}/preview/ws`,r=()=>`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${n}`,i=null,a,c=!1,u=!1,d=0,f=0,p=()=>typeof document>`u`||o(),m=()=>{if(c||!p())return;let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(r());n.binaryType=`blob`,i=n,n.addEventListener(`open`,()=>{n===i&&(u=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==i)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=l.safeParse(e);n.success&&t.onMessage(n.data);return}r instanceof Blob&&(f=0,t.onFrame(r))}),n.addEventListener(`error`,()=>void 0),n.addEventListener(`close`,()=>{if(n!==i||c)return;if(i=null,!u){if(d+=1,d>=2){c=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,d),a=setTimeout(m,ke);return}if(f>=5){c=!0,t.onTransport(`closed`);return}let e=Ae[Math.min(f,Ae.length-1)];f+=1,t.onTransport(`reconnecting`,f),a=setTimeout(m,e)})},h=s(e=>{if(!c)if(e)i||m();else{clearTimeout(a),a=void 0;let e=i;i=null,e?.close()}});return t.onTransport(`connecting`),m(),{send(e){i?.readyState===je&&i.send(JSON.stringify(e))},close(){c=!0,h(),clearTimeout(a),a=void 0;let e=i;i=null,e?.close()}}}var Y=a();function Ne({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,Y.jsx)(A,{children:(0,Y.jsxs)(re,{children:[(0,Y.jsx)(ie,{asChild:!0,children:(0,Y.jsxs)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex h-7 min-w-7 shrink-0 items-center justify-center gap-0 rounded-full bg-muted px-0 text-xs font-semibold text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none @min-[640px]:gap-1.5 @min-[640px]:px-2.5`,n),children:[(0,Y.jsx)(B,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[640px]:inline`,children:`Experimental`})]})}),(0,Y.jsx)(be,{children:`Experimental`})]})}):e?(0,Y.jsx)(A,{children:(0,Y.jsxs)(re,{children:[(0,Y.jsx)(ie,{asChild:!0,children:(0,Y.jsx)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,Y.jsx)(B,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(be,{children:`Experimental`})]})}):(0,Y.jsxs)(`span`,{"data-slot":`preview-experimental`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-semibold text-muted-foreground`,n),children:[(0,Y.jsx)(B,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function Pe({text:e,source:t,onCopy:n,className:i}){let a=e.replace(/\s+$/,``).split(`
2
+ `);return(0,Y.jsxs)(`div`,{"data-slot":`preview-log-tail`,className:r(`min-w-0 rounded-lg bg-muted px-3.5 py-3 font-mono text-xs`,i),children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 font-sans text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Log tail`}),` last ${a.length} ${a.length===1?`line`:`lines`} · ${t}`]}),(0,Y.jsxs)(`button`,{type:`button`,className:`-m-2 inline-flex min-h-11 items-center gap-1.5 rounded-sm p-2 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:min-h-0 md:p-0`,onClick:()=>n(e),children:[(0,Y.jsx)(F,{className:`size-3.5`,"aria-hidden":`true`}),`Copy`]})]}),(0,Y.jsx)(`pre`,{className:`max-h-48 overflow-auto break-words whitespace-pre-wrap text-foreground`,children:e.replace(/\s+$/,``)})]})}var Fe=/^([a-z][a-z0-9+.-]*):/i;function Ie(e,t){let n=e.trim();if(n===``)return{kind:`error`,message:`Type a URL or a port.`};if(/^\d{1,5}$/.test(n)){let e=Number(n);return e<1||e>65535?{kind:`error`,message:`A port is a number from 1 to 65535.`}:t.some(t=>t.port===e)?{kind:`server`,port:e}:{kind:`url`,url:`http://localhost:${e}`}}let r=Fe.exec(n)?.[1]?.toLowerCase();return r&&!/^[a-z0-9.-]+:\d/i.test(n)?r!==`http`&&r!==`https`?{kind:`error`,message:`Only http and https addresses open here.`}:Le(n):Le(`http://${n}`)}function Le(e){let t={kind:`error`,message:`That is not a valid address.`};if(/\s/.test(e))return t;try{new URL(e)}catch{return t}return{kind:`url`,url:e}}function Re(e){return e.replace(/^https?:\/\//i,``)}var ze=`https://github.com/hearsay-tools/squawk#environment-variables`;function Be({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,Y.jsx)(We,{state:e,actions:t});case`downloading`:return(0,Y.jsx)(Ke,{state:e,actions:t});case`download-failed`:return(0,Y.jsx)(qe,{state:e,actions:t});case`sandbox-failed`:return(0,Y.jsx)(Je,{state:e,actions:t});case`browser-exited`:return(0,Y.jsx)(Ye,{state:e,actions:t});case`needs-approval`:return(0,Y.jsx)(Qe,{state:e,actions:t});case`port-held`:return(0,Y.jsx)($e,{state:e,actions:t});case`server-starting`:return(0,Y.jsx)(et,{state:e,actions:t});case`server-stalled`:return(0,Y.jsx)(tt,{state:e,actions:t});case`server-exited`:return(0,Y.jsx)(nt,{state:e,actions:t});case`server-stopped`:return(0,Y.jsx)(rt,{state:e,actions:t});case`loading`:return(0,Y.jsx)(at,{step:e.step,url:n});case`worktree-removed`:return(0,Y.jsx)(ot,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,Y.jsx)(st,{actions:t});case`taken-over`:return(0,Y.jsx)(lt,{state:e,actions:t})}}function X({icon:e,title:t,children:n,state:r}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":r,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:e}),(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:t}),n]})}var Z=({children:e})=>(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),Q=({children:e})=>(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function Ve({server:e}){return(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(pe,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Runs ${M(e.command)} in this task's worktree, on the host.`})]})}function He({copy:e,command:t,label:n}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-install-command`,className:`min-w-0 rounded-lg bg-muted px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:[(0,Y.jsx)(`span`,{children:n}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,className:`-m-2 inline-flex size-11 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:size-6`,onClick:()=>e(t),children:(0,Y.jsx)(F,{className:`size-4`,"aria-hidden":`true`})})]}),(0,Y.jsx)(`code`,{className:`block font-mono text-sm break-words whitespace-pre-wrap text-foreground`,children:t})]})}function Ue({server:e,status:t}){return(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,Y.jsx)(N,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,Y.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,Y.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.command}),e.cwd?(0,Y.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,Y.jsx)(`span`,{children:`cwd`}),(0,Y.jsx)(`span`,{className:`break-all`,children:e.cwd})]}):null]}),(0,Y.jsx)(`div`,{className:`mt-2.5`,children:(0,Y.jsx)(Ve,{server:e})})]})}function We({state:e,actions:r}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(z,{}),title:`This host has no browser yet`,children:[(0,Y.jsx)(Z,{children:e.canDownload?`Preview runs Chromium on the machine ${t(`cezar`)} runs on. ${t(`cezar`)} can download it into ~/.cache/cez/ (about 150 MB). Nothing else on the host changes.`:`Preview runs Chromium on the machine ${t(`cezar`)} runs on. ${t(`cezar`)} has no download for this platform, so install it with the system package manager.`}),e.canDownload?(0,Y.jsx)(Q,{children:(0,Y.jsxs)(n,{variant:`contrast`,onClick:r.download,children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,Y.jsx)(He,{command:e.installCommand,copy:r.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function Ge(e){return Math.round(e/1e6)}function Ke({state:e,actions:t}){let r=(0,J.useRef)(null);r.current??={at:Date.now(),received:e.received};let i=e.total>0?Math.min(100,Math.floor(e.received/e.total*100)):0,a=(Date.now()-r.current.at)/1e3,o=a>=1?(e.received-r.current.received)/a:0,s=o>0?Math.ceil((e.total-e.received)/o):void 0;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(z,{}),title:`Downloading Chromium`,children:[(0,Y.jsx)(Z,{children:`Into ~/.cache/cez/, no root needed. Nothing else on the host changes.`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{role:`progressbar`,"aria-label":`Chromium download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-success`,style:{width:`${i}%`}})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:`${Ge(e.received)} of ${Ge(e.total)} MB · ${i}%`}),s===void 0?null:(0,Y.jsx)(`span`,{children:`about ${s} s left`})]})]}),(0,Y.jsx)(Q,{children:(0,Y.jsx)(n,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function qe({state:e,actions:t}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(Ee,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,Y.jsx)(Z,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,Y.jsx)(He,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(n,{variant:`contrast`,onClick:t.download,children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),`Retry download`]}),(0,Y.jsxs)(n,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function Je({state:e,actions:r}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(we,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,Y.jsxs)(Z,{children:[`The host blocks the sandbox Chromium needs. This usually means `,t(`cezar`),` runs as root, or inside a container without user namespaces.`]}),(0,Y.jsx)(Pe,{text:e.stderrTail,source:`chromium`,onCopy:r.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(n,{variant:`contrast`,onClick:r.retryBrowser,children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(n,{variant:`outline`,onClick:()=>r.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,Y.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:ze,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function Ye({state:e,actions:t}){let r=e.reason===`timeout`,i=e.signal?` (${e.signal})`:e.exitCode===void 0?``:` (code ${e.exitCode})`,a=e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`,o=r?`Chromium did not start in time`:`Chromium exited${i}`;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(p,{className:`text-danger`}),title:r?`The browser did not start`:`The browser stopped`,children:[(0,Y.jsx)(Z,{children:r?`Chromium did not open its DevTools port in time. ${a}`:`Chromium exited unexpectedly${i}. ${a}`}),(0,Y.jsx)(Pe,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(n,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(n,{variant:`outline`,onClick:()=>t.copy(`${o}\n${e.stderrTail}`),children:[(0,Y.jsx)(F,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Xe=2;function Ze(e){let[t,n]=(0,J.useState)(()=>Date.now());return(0,J.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Qe({state:e,actions:r}){let{server:i,wasRunning:a}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:a?(0,Y.jsx)(De,{className:`text-pending-strong`}):(0,Y.jsx)(v,{}),title:a?`Nothing answers on :${i.port} anymore`:`${i.label} isn't running yet`,children:[(0,Y.jsx)(Z,{children:a?`${i.label} was running when the agent registered it, likely inside the agent's own session, which has ended. ${t(`cezar`)} can start it with the registered command.`:`The agent registered this server. Nothing runs until you approve it here.`}),(0,Y.jsx)(Ue,{server:i,status:a?`was running when registered · silent now`:`registered · not started`}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(n,{variant:`contrast`,onClick:()=>r.run(i.port),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Run and open`]})})]})}function $e({state:e,actions:t}){let{server:r,ownerTitle:i}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(Ee,{className:`text-pending-strong`}),title:`${r.label} :${r.port} is in use by another task`,children:[(0,Y.jsx)(Z,{children:`Task "${i}" is running its own server on :${r.port}. Register a different port for this task, or stop that task's server.`}),(0,Y.jsx)(Q,{children:(0,Y.jsx)(n,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function et({state:e,actions:r}){let{server:i}=e,a=Ze(1e3),o=Math.max(0,Math.floor((a-Date.parse(e.startedAt))/1e3)),[s,c]=(0,J.useState)(()=>Date.now());(0,J.useEffect)(()=>c(Date.now()),[e.attempt]);let l=Math.max(0,Math.ceil(Xe-(a-s)/1e3));return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(v,{}),title:`Starting ${i.label}`,children:[(0,Y.jsx)(Z,{children:`${t(`cezar`)} ran ${M(i.command)} in the worktree. The page opens as soon as :${i.port} answers.`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border px-3.5 py-3 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2.5 font-semibold text-foreground`,children:[(0,Y.jsx)(_,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),l>0?`Attempt ${e.attempt} · next try in ${l} s`:`Attempt ${e.attempt}`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${o} s ago`})]}),e.logTail.length>0?(0,Y.jsx)(Pe,{text:e.logTail.join(`
3
+ `),source:M(i.command),onCopy:r.copy}):null,(0,Y.jsx)(Q,{children:(0,Y.jsx)(n,{variant:`outline`,onClick:()=>r.stop(i.port),children:`Stop server`})})]})}function tt({state:e,actions:t}){let{server:r}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(h,{className:`text-pending-strong`}),title:`${r.label} is running, but :${r.port} is silent`,children:[(0,Y.jsx)(Z,{children:`The process has run for 2 min without opening the port. It may be waiting on another service, or listening somewhere else.`}),(0,Y.jsx)(Pe,{text:e.logTail,source:M(r.command),onCopy:t.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsx)(n,{variant:`contrast`,onClick:()=>t.keepWaiting(r.port),children:`Keep waiting`}),(0,Y.jsx)(n,{variant:`outline`,onClick:()=>t.stop(r.port),children:`Stop server`})]})]})}function nt({state:e,actions:t}){let{server:r}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(p,{className:`text-danger`}),title:e.exitCode===null?`${r.label} was stopped by a signal`:`${r.label} exited with code ${e.exitCode}`,children:[(0,Y.jsx)(Z,{children:`${M(r.command)} stopped.`}),(0,Y.jsx)(Pe,{text:e.logTail,source:M(r.command),onCopy:t.copy}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(n,{variant:`contrast`,onClick:()=>t.run(r.port),children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(Ve,{server:r})]})}function rt({state:e,actions:r}){let{server:i}=e,a=e.reason===`idle`;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(he,{}),title:a?`Stopped after 15 min idle`:`${i.label} stopped`,children:[(0,Y.jsx)(Z,{children:a?`Nobody had this pane open for 15 min, so ${t(`cezar`)} stopped ${i.label} :${i.port} and the browser to free memory. Start again reopens ${Re(e.lastUrl)}.`:`You stopped ${i.label} :${i.port}. Start again reopens ${Re(e.lastUrl)}.`}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(n,{variant:`contrast`,onClick:()=>r.run(i.port),children:[(0,Y.jsx)(y,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(Ve,{server:i})]})}var it=[`browser`,`page`,`frame`];function at({step:e,url:t}){let n=it.indexOf(e),i=t?Re(t):`the page`;return(0,Y.jsx)(`div`,{"data-slot":`preview-state`,"data-state":`loading`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center px-6 py-8`,children:(0,Y.jsx)(`ol`,{"aria-label":`Opening the page`,className:`mx-auto flex flex-col gap-4 text-sm`,children:[{done:`Browser started`,active:`Starting the browser`},{done:`Opened ${i}`,active:`Opening ${i}`},{done:`First frame`,active:`First frame`}].map((e,t)=>{let i=t<n,a=t===n;return(0,Y.jsxs)(`li`,{"aria-current":a?`step`:void 0,className:r(`flex items-center gap-3`,a?`font-semibold text-foreground`:i?`text-foreground`:`text-soft-foreground`),children:[i?(0,Y.jsx)(m,{className:`size-5 text-success`,"aria-hidden":`true`}):a?(0,Y.jsx)(_,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,Y.jsx)(R,{className:`size-5 text-border`,"aria-hidden":`true`}),i?e.done:a?e.active:e.done]},t)})})})}function ot({state:e,actions:t,worktree:r}){let i=r?/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+/.exec(r)?.[0]:void 0,a=e.server?.label;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(V,{}),title:`This task's worktree is gone`,children:[(0,Y.jsx)(Z,{children:`${a??`The server`} ran in ${i??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,Y.jsx)(b,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,Y.jsx)(Q,{children:(0,Y.jsx)(n,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function st({actions:e}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`proxy-blocked`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(Ne,{})}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Preview doesn't work behind this proxy yet`}),(0,Y.jsxs)(Z,{children:[`The proxy in front of `,t(`cezar`),` didn't let the preview's WebSocket through. This is a known gap behind Basic Auth. Everything else in `,t(`cezar`),` keeps working.`]}),(0,Y.jsxs)(Q,{children:[(0,Y.jsx)(n,{variant:`outline`,onClick:e.close,children:`Close preview`}),(0,Y.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:ze,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function ct(e){let t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?`Mac`:/Linux|X11/.test(e)?`Linux`:``,n=/Edg\//.test(e)?`Edge`:/Firefox\/|FxiOS/.test(e)?`Firefox`:/Chrome\/|CriOS/.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n&&t?`${n} on ${t}`:n||t}function lt({state:e,actions:t}){let r=ct(e.by);return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(W,{}),title:`Preview is open somewhere else`,children:[(0,Y.jsx)(Z,{children:`Another tab took this browser${r?` (${r})`:``}. Only one tab can view and drive it at a time.`}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(n,{variant:`contrast`,onClick:t.useHere,children:[(0,Y.jsx)(z,{"aria-hidden":`true`}),`Use it here`]}),(0,Y.jsx)(n,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function ut({attempt:e,exhausted:t,onReconnect:r}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-connection-banner`,role:`status`,className:`absolute inset-x-3 top-3 z-10 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-3.5 py-2.5 text-sm shadow-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(Oe,{className:`size-4 shrink-0 text-danger`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Lost the connection to the host`}),t?null:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` · reconnecting (attempt ${e} of 5)`})]})]}),(0,Y.jsx)(n,{variant:`outline`,onClick:r,children:t?`Reconnect`:`Reconnect now`})]})}function dt({servers:e,states:t,onOpen:r,agentLive:i=!1,agentIdle:a=!1,onOpenAgent:o}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":a?`agent-idle`:`empty`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Open a page in this task's browser`}),(0,Y.jsx)(Z,{children:`The browser runs on the host, next to the worktree. Type a URL, a bare port such as 3000, or open a server the agent registered.`}),a?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-start gap-2 text-sm text-foreground`,children:[(0,Y.jsx)(De,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`The agent is not driving the browser now.`})]}):null,i&&o!==void 0?(0,Y.jsxs)(`section`,{"aria-labelledby":`preview-agent`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,Y.jsx)(`h3`,{id:`preview-agent`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Driven by the agent`}),(0,Y.jsxs)(`div`,{"data-slot":`preview-agent-entry`,className:`flex items-center justify-between gap-3 px-3.5 py-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,Y.jsx)(N,{tone:`success`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Agent's page`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`The agent drives this page through agent-browser.`})]}),(0,Y.jsx)(n,{variant:`outline`,size:`sm`,className:`max-md:h-11`,"aria-label":`Open the agent's page`,onClick:o,children:`Open`})]})]}):null,e.length>0?(0,Y.jsxs)(`section`,{"aria-labelledby":`preview-registered`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,Y.jsx)(`h3`,{id:`preview-registered`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Registered in this task`}),(0,Y.jsx)(`ul`,{children:e.map(e=>{let i=j(e,t),a=oe(i);return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border px-3.5 py-2 text-sm last:border-b-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,Y.jsx)(N,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:a.text})]}),(0,Y.jsx)(n,{variant:`outline`,size:`sm`,className:`max-md:h-11`,onClick:()=>r(e.port),children:ae(i)?`Open`:`Review`})]},e.port)})})]}):null,(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(g,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Review opens a server's approval in this pane: its command, cwd and Run and open. Nothing runs from this list. Paste works; copying text out, file pickers and downloads don't yet.`})]})]})}function ft({dialog:e,onResult:t}){let[r,i]=(0,J.useState)(e.defaultPrompt??``),a=e.type===`beforeunload`,o=(0,J.useRef)(null),s=(0,J.useRef)(null);(0,J.useEffect)(()=>{(e.type===`prompt`?s.current:o.current)?.focus()},[e.type]);let c=(0,J.useRef)(t);c.current=t,(0,J.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target instanceof Element?e.target:null;t&&t!==document.body&&!t.closest(`[data-slot="preview-pane-body"], [data-slot="preview-page-dialog"]`)||(e.stopPropagation(),c.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let l=()=>t(e.type===`prompt`?{accept:!0,text:r}:{accept:!0});return(0,Y.jsx)(`div`,{"data-slot":`preview-page-dialog`,className:`absolute inset-0 z-20 flex items-center justify-center bg-foreground/30 p-4`,children:(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":`${e.origin} says`,className:`w-full max-w-[380px] rounded-xl border border-border bg-card p-4 shadow-lg`,children:[(0,Y.jsx)(`p`,{className:`mb-3 truncate font-mono text-xs text-muted-foreground`,children:`${e.origin} says`}),(0,Y.jsx)(`p`,{className:`mb-4 text-sm break-words whitespace-pre-wrap text-foreground`,children:e.message||(a?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,Y.jsx)(`input`,{ref:s,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},className:`mb-4 h-11 w-full rounded-md border border-border bg-background px-3 text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.type===`alert`?null:(0,Y.jsx)(n,{variant:`outline`,onClick:()=>t({accept:!1}),children:a?`Stay`:`Cancel`}),(0,Y.jsx)(n,{ref:o,variant:`contrast`,onClick:l,children:a?`Leave`:`OK`})]})]})})}var pt=10,mt=500,ht=500,gt=4,_t=16,vt=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function yt(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function bt(e,t){return{rect:e,scale:t,touches:new Map,multiTouch:!1,click:{at:-1/0,x:0,y:0,button:-1,count:1}}}var xt=[`left`,`middle`,`right`];function $(e,t,n,r){let i=yt(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:xt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:vt(n),...r}}var St=e=>e===0?0:-e;function Ct(e,t,n,r,i){let a=yt(t,n,e.rect,e.scale);return{t:`mouse`,type:`mouseWheel`,x:a.x,y:a.y,button:`none`,buttons:0,deltaX:St(r/e.scale),deltaY:St(i/e.scale),modifiers:0}}function wt(e,t){let{touches:n}=t,r=n.get(e.pointerId),i=()=>{n.delete(e.pointerId),n.size===0&&(t.multiTouch=!1)};switch(e.type){case`pointerdown`:return n.set(e.pointerId,{startX:e.clientX,startY:e.clientY,startAt:e.timeStamp,lastX:e.clientX,lastY:e.clientY,scrolling:!1}),n.size>1&&(t.multiTouch=!0),[];case`pointermove`:{if(!r)return[];if(t.multiTouch)return r.lastX=e.clientX,r.lastY=e.clientY,[];if(!r.scrolling){if(Math.hypot(e.clientX-r.startX,e.clientY-r.startY)<=pt)return[];r.scrolling=!0}let n=e.clientX-r.lastX,i=e.clientY-r.lastY;return r.lastX=e.clientX,r.lastY=e.clientY,n===0&&i===0?[]:[Ct(t,e.clientX,e.clientY,n,i)]}case`pointerup`:{let n=r!==void 0&&!t.multiTouch&&!r.scrolling&&e.timeStamp-r.startAt<=mt;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[$(`mouseMoved`,t,a,{button:`none`,buttons:0}),$(`mousePressed`,t,a,{button:`left`,buttons:1}),$(`mouseReleased`,t,a,{button:`left`,buttons:0})]}case`pointercancel`:return i(),[]}}function Tt(e,t){if(e.pointerType===`touch`)return wt(e,t);switch(e.type){case`pointerdown`:{let n=t.click,r=n.button===e.button&&e.timeStamp-n.at<=ht&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=gt;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[$(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[$(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[$(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function Et(e,t,n){let r=yt(e.clientX,e.clientY,t,n),i=e.deltaMode===1?_t:1;return{t:`mouse`,type:`mouseWheel`,x:r.x,y:r.y,button:`none`,buttons:e.buttons??0,deltaX:e.deltaX*i/n,deltaY:e.deltaY*i/n,modifiers:vt(e)}}var Dt={a:`selectAll`,c:`copy`,x:`cut`,z:`undo`,y:`redo`};function Ot(e){let t=e.key.toLowerCase(),n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);if(n&&(t===`v`||t===`k`))return;let r={t:`key`,key:e.key,code:e.code,modifiers:vt(e),vk:e.keyCode};if(e.type===`keyup`)return{...r,type:`keyUp`};let i=n?``:e.key.length===1?e.key:e.key===`Enter`?`\r`:e.key===`Tab`?` `:``,a=n?t===`z`&&e.shiftKey?`redo`:Dt[t]:void 0,o={t:`key`,type:i?`keyDown`:`rawKeyDown`,key:e.key,code:e.code,text:i,modifiers:vt(e),vk:e.keyCode};return a?{...o,commands:[a]}:o}function kt(e){return e?{t:`insertText`,text:e}:void 0}var At=e=>e,jt=e=>e.key===`Escape`&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function Mt({scale:e,send:t,onLeave:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(bt({left:0,top:0},e)),a=(0,J.useRef)(e);a.current=e;let o=(0,J.useRef)(t);o.current=t;let s=(0,J.useRef)(void 0),c=()=>{let e=r.current;e&&(i.current.rect=e.getBoundingClientRect()),i.current.scale=a.current},l=e=>{c();for(let t of Tt(At(e),i.current))o.current(t)},u=()=>{let e=s.current;e&&(s.current=void 0,cancelAnimationFrame(e.frame),l(e.event))};(0,J.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current.frame)},[]),(0,J.useEffect)(()=>{document.activeElement===document.body&&r.current?.focus({preventScroll:!0})},[]),(0,J.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{e.preventDefault(),c(),o.current(Et(e,i.current.rect,i.current.scale))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,J.useEffect)(()=>{let e=e=>{if(document.activeElement!==r.current)return;let t=kt(e.clipboardData?.getData(`text`)??``);t&&(e.preventDefault(),o.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[]);let d=e=>{u(),r.current?.focus({preventScroll:!0});try{r.current?.setPointerCapture(e.pointerId)}catch{}l(e.nativeEvent)},f=e=>{let t=e.nativeEvent;if(t.pointerType===`touch`)return l(t);let n=s.current;if(n){n.event=t;return}s.current={event:t,frame:requestAnimationFrame(()=>{let e=s.current;s.current=void 0,e&&l(e.event)})}},p=e=>{u(),l(e.nativeEvent)},m=e=>{if(jt(e)){e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&(n?n():r.current?.blur());return}let i=Ot(e.nativeEvent);i&&(e.preventDefault(),e.stopPropagation(),t(i))};return(0,Y.jsx)(`div`,{ref:r,"data-slot":`preview-input`,role:`application`,"aria-label":`Page preview, interactive`,"aria-description":`Keys go to the page, Tab included. Press Shift+Escape to return to the cockpit.`,tabIndex:0,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onContextMenu:e=>e.preventDefault(),onKeyDown:m,onKeyUp:m,className:`absolute inset-0 touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset`})}async function Nt(e){if(typeof createImageBitmap==`function`){let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,release:()=>t.close()}}let t=URL.createObjectURL(e),n=new Image;return n.src=t,await n.decode(),{source:n,width:n.naturalWidth,height:n.naturalHeight,release:()=>URL.revokeObjectURL(t)}}function Pt({ref:e,viewport:t,dimmed:n=!1,cursor:i,onSize:a,renderInput:s,children:c}){let l=(0,J.useRef)(0),u=(0,J.useRef)(null),d=(0,J.useRef)(null),[f,p]=(0,J.useState)(null),m=(0,J.useRef)(a);m.current=a,(0,J.useImperativeHandle)(e,()=>({async draw(e){let t=++l.current,n=d.current,r=n?.getContext(`2d`);if(!(!n||!r||!o()))try{let i=await Nt(e);try{if(t!==l.current||!o()||d.current!==n)return;n.width!==i.width&&(n.width=i.width),n.height!==i.height&&(n.height=i.height),r.drawImage(i.source,0,0)}finally{i.release()}}catch{}}}),[]),(0,J.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth),n=Math.round(e.clientHeight);t===0||n===0||(p(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n}),m.current?.({w:t,h:n}))};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=t===`fit`?f:t,g=t===`fit`||!f?1:Math.min(1,(f.w-24)/t.w,(f.h-24)/t.h),_=h?{width:Math.floor(h.w*g),height:Math.floor(h.h*g)}:void 0;return(0,Y.jsxs)(`div`,{ref:u,"data-slot":`preview-stage`,"data-viewport":t===`fit`?`fit`:`${t.w}x${t.h}`,className:r(`relative min-h-0 flex-1 overflow-hidden bg-muted`,t!==`fit`&&`flex items-start justify-center overflow-auto p-3`),children:[h?(0,Y.jsxs)(`div`,{"data-slot":`preview-surface`,"data-scale":g,style:{..._,cursor:i},className:r(`relative shrink-0 bg-card`,t!==`fit`&&`shadow-md`,n&&`opacity-60 saturate-50`),children:[(0,Y.jsx)(`canvas`,{ref:d,"aria-label":`Page preview`,role:`img`,style:_,className:`block touch-none select-none`}),s?.({canvas:d.current,scale:g,viewport:h})]}):null,c]})}var Ft=`cez-preview-quality`,It=[{value:`normal`,label:`Normal`,detail:`The default. Lighter on CPU and network.`},{value:`high`,label:`High`,detail:`Sharper text and fine detail. Uses more CPU and network.`},{value:`ultra`,label:`Ultra`,detail:`High at your screen's pixel density, up to 2×. Uses the most CPU and network.`}];function Lt(e){return It.find(t=>t.value===e)?.value??`normal`}var Rt=e=>It.find(t=>t.value===e)?.label??`Normal`;function zt(){try{return Lt(localStorage.getItem(Ft))}catch{return`normal`}}function Bt(e){try{localStorage.setItem(Ft,e)}catch{}}var Vt=[{w:390,h:844,icon:_e},{w:820,h:1180,icon:Te},{w:1440,h:900,icon:ve}],Ht=`size-8 shrink-0 max-md:size-11`,Ut=e=>e===`fit`?`Fit`:`${e.w} × ${e.h}`;function Wt(e){let[t,n]=(0,J.useState)(()=>Date.now());return(0,J.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Gt=e=>`${e.fps} fps · ${e.kbps} KB/s${e.rttMs===void 0?``:` · ${e.rttMs} ms`}`;function Kt({stats:e,shrunk:t}){let n=Wt(250),r=e.lastFrameAt===void 0||n-e.lastFrameAt>=1e3;return t?(0,Y.jsx)(N,{"data-slot":`preview-stats`,tone:r?`neutral`:`success`,"aria-label":`Preview is live`,role:`img`}):(0,Y.jsxs)(`span`,{"data-slot":`preview-stats`,role:`img`,"aria-label":r?`idle`:Gt(e),className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,Y.jsx)(N,{tone:r?`neutral`:`success`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[640px]:inline-block w-[28ch] overflow-hidden text-ellipsis`,children:r?`idle`:Gt(e)})]})}function qt({current:e,agentShown:t,...r}){let i=e?e.label:t?`Agent's page`:`Server`;return(0,Y.jsxs)(n,{variant:`outline`,size:`sm`,className:`max-w-[11rem] min-w-0 gap-1.5 max-md:h-11`,"aria-label":e?`Server: ${e.label} :${e.port}`:t?`Server: ${i}`:`Server`,...r,children:[e||t?(0,Y.jsx)(N,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,Y.jsx)(x,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:i}),e?(0,Y.jsxs)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:[`:`,e.port]}):null,(0,Y.jsx)(de,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}function Jt({shown:e,live:t,onSelect:n}){return(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:n,children:[(0,Y.jsx)(N,{tone:t?`success`:`neutral`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Agent's page`}),(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`agent-browser`}),e?(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":`true`}):null]})}function Yt(e,t){return e?`${e.label} :${e.port}`:t?`Agent's page`:`Preview`}function Xt(e){let t=e.onPickAgent!==void 0,n=e.agentLive===!0&&t,r=e.agentShown===!0;return{agentLive:n,agentShown:r,agentListed:n||r&&t}}function Zt(e){let{compact:t=!1,navEnabled:r,loading:i=!1}=e,a=(0,J.useRef)(null),o=e.urlInputRef??a,s=(0,J.useRef)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),p=(0,Y.jsx)(n,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Back`,disabled:!r,onClick:e.onBack,children:(0,Y.jsx)(xe,{"aria-hidden":`true`})}),m=(0,Y.jsx)(n,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Forward`,disabled:!r,onClick:e.onForward,children:(0,Y.jsx)(f,{"aria-hidden":`true`})}),h=(0,Y.jsx)(n,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Reload`,"aria-busy":i||void 0,disabled:!r||i,onClick:()=>e.onReload(!1),children:(0,Y.jsx)(q,{"aria-hidden":`true`})}),g=e.onSession?(0,Y.jsxs)(n,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1 max-md:h-11`,onClick:e.onSession,children:[(0,Y.jsx)(ue,{"aria-hidden":`true`}),`Session`]}):null,_=i?(0,Y.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading the page`,className:`absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-transparent`,children:(0,Y.jsx)(`div`,{className:`preview-progress h-full w-2/5 bg-success`})}):null,v=(0,Y.jsx)($t,{props:e,input:o,draft:c,setDraft:l,focused:u,setFocused:d}),{agentListed:y}=Xt(e),ee=e.servers.length+ +!!y>=2,b=ee||e.adopted,x={back:p,forward:m,reload:h,address:v,more:(0,Y.jsx)(an,{props:e,compact:t,crowded:b}),session:g,progress:_};return t?(0,Y.jsx)(on,{props:e,elements:x}):(0,Y.jsx)(sn,{props:e,elements:x,switcher:ee,crowded:b,input:o,focusUrlAfterMenu:s})}function Qt({props:e,input:t,focusUrlAfterMenu:n}){let{servers:r,current:i}=e,{agentLive:a,agentShown:o,agentListed:s}=Xt(e);return(0,Y.jsxs)(k,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsx)(qt,{current:i,agentShown:o})}),(0,Y.jsxs)(D,{align:`start`,className:`min-w-64`,onCloseAutoFocus:e=>{n.current&&(n.current=!1,e.preventDefault(),t.current?.focus())},children:[s?(0,Y.jsx)(Jt,{shown:o,live:a,onSelect:()=>e.onPickAgent?.()}):null,r.map(t=>{let n=oe(j(t,e.serverStates));return(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onPickServer(t.port),children:[(0,Y.jsx)(N,{tone:n.tone,shape:n.ring?`ring`:`filled`,pulse:n.pulse,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold`,children:t.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,t.port]}),(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:n.text}),i?.port===t.port?(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,Y.jsx)(T,{}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{n.current=!0},children:[(0,Y.jsx)(fe,{"aria-hidden":`true`}),`Type a URL instead`]})]})]})}function $t({props:e,input:n,draft:i,setDraft:a,focused:o,setFocused:s}){let{url:c,adopted:l}=e;return(0,Y.jsxs)(`div`,{className:`relative flex min-w-[9rem] flex-1 items-center`,children:[(0,Y.jsx)(fe,{className:`pointer-events-none absolute left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{ref:n,type:`text`,"aria-label":`Page address`,placeholder:`Type a URL or a port`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:i??(o?c:Re(c)),title:c||void 0,className:r(`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-muted pl-8 font-mono text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:bg-background focus-visible:ring-[3px] focus-visible:ring-ring/30 max-md:h-11`,l?`pr-40`:`pr-2.5`),onFocus:e=>{let t=e.currentTarget;s(!0),requestAnimationFrame(()=>{document.activeElement===t&&t.select()})},onBlur:()=>{s(!1),a(null)},onChange:e=>a(e.target.value),onKeyDown:t=>{t.key===`Enter`?(e.onNavigate(i??c),t.currentTarget.blur()):t.key===`Escape`&&t.currentTarget.blur()}}),l&&!o?(0,Y.jsxs)(`span`,{className:`pointer-events-none absolute right-2 inline-flex h-6 items-center gap-1 rounded-full border border-border bg-card px-2 text-xs font-semibold text-muted-foreground`,children:[(0,Y.jsx)(Ce,{className:`size-3`,"aria-hidden":`true`}),`Not started by `,t(`cezar`)]}):null]})}function en({props:e}){let{viewport:t}=e;return(0,Y.jsxs)(k,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(n,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${Ut(t)}`,children:[t===`fit`?(0,Y.jsx)(U,{"aria-hidden":`true`}):(0,Y.jsx)(ve,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:r(`hidden @min-[500px]:inline`,t!==`fit`&&`font-mono font-normal`),children:Ut(t)}),(0,Y.jsx)(de,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(D,{align:`start`,className:`min-w-56`,children:[(0,Y.jsxs)(w,{className:`gap-2.5`,onSelect:()=>e.onViewport(`fit`),children:[(0,Y.jsx)(U,{"aria-hidden":`true`}),`Fit`,(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),t===`fit`?(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":`true`}):null]}),Vt.map(({w:n,h:r,icon:i})=>(0,Y.jsxs)(w,{className:`gap-2.5 font-mono`,onSelect:()=>e.onViewport({w:n,h:r}),children:[(0,Y.jsx)(i,{"aria-hidden":`true`}),n,` × `,r,t!==`fit`&&t.w===n&&t.h===r?(0,Y.jsx)(P,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${n}x${r}`))]})]})}function tn({quality:e,onQuality:t,compact:n}){return(0,Y.jsx)(O,{value:e,onValueChange:e=>t(Lt(e)),children:It.map(e=>(0,Y.jsx)(C,{value:e.value,"data-quality":e.value,className:r(`items-start`,n&&`min-h-11`),children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:e.detail})]})},e.value))})}function nn({props:e}){let{quality:t}=e;return(0,Y.jsxs)(k,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(n,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Stream quality: ${Rt(t)}`,children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[560px]:inline`,children:Rt(t)}),(0,Y.jsx)(de,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(D,{align:`start`,className:`w-64`,children:[(0,Y.jsx)(S,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,Y.jsx)(tn,{quality:t,onQuality:e.onQuality,compact:!1})]})]})}function rn({stats:e,status:t,crowded:n}){return e?(0,Y.jsx)(Kt,{stats:e,shrunk:n}):t?(0,Y.jsxs)(`span`,{"data-slot":`preview-status`,className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,Y.jsx)(N,{tone:t.tone,"aria-hidden":`true`}),t.label]}):null}function an({props:e,compact:r,crowded:i}){let{stats:a,navEnabled:o,url:s,current:c,adopted:l}=e;return(0,Y.jsxs)(k,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsx)(n,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`More`,children:(0,Y.jsx)(le,{"aria-hidden":`true`})})}),(0,Y.jsxs)(D,{align:`end`,className:`min-w-64`,children:[i&&a&&!r?(0,Y.jsx)(S,{className:`font-mono text-xs font-normal text-muted-foreground`,children:Gt(a)}):null,(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!o,onSelect:()=>e.onReload(!0),children:[(0,Y.jsx)(K,{"aria-hidden":`true`}),`Reload without cache`]}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:s===``,onSelect:e.onCopyUrl,children:[(0,Y.jsx)(se,{"aria-hidden":`true`}),`Copy page URL`]}),c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{}),l?(0,Y.jsxs)(w,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,Y.jsx)(H,{className:`mt-0.5 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Stop server · ${c.label} :${c.port}`}),(0,Y.jsxs)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:[t(`cezar`),` didn't start this server, so it won't stop it. Stop it where it was started.`]})]})]}):(0,Y.jsxs)(w,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(c.port),children:[(0,Y.jsx)(L,{"aria-hidden":`true`}),`Stop server · ${c.label} :${c.port}`]})]}):null,r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{}),(0,Y.jsx)(S,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,Y.jsx)(tn,{quality:e.quality,onQuality:e.onQuality,compact:!0}),(0,Y.jsx)(T,{}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Close preview`]})]}):null]})]})}function on({props:e,elements:t}){let{stats:n,current:r,badge:i=!0}=e,{agentShown:a}=Xt(e),{back:o,forward:s,reload:c,address:l,more:u,session:d,progress:f}=t;return(0,Y.jsxs)(`div`,{"data-slot":`preview-toolbar`,"data-compact":``,className:`relative flex shrink-0 flex-col border-b border-border bg-background`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pt-[max(0.25rem,env(safe-area-inset-top))]`,children:[d,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center leading-tight`,children:[(0,Y.jsxs)(`span`,{className:`flex max-w-full items-center gap-1.5 text-sm font-semibold text-foreground`,children:[n?(0,Y.jsx)(N,{tone:`success`,"aria-hidden":`true`}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:Yt(r,a)})]}),i?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Experimental`}):null]}),u]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[o,s,c,l]}),f]})}function sn({props:e,elements:t,switcher:r,crowded:i,input:a,focusUrlAfterMenu:o}){let{badge:s=!0,stats:c,status:l}=e,{back:u,forward:d,reload:f,address:p,more:m,session:h,progress:g}=t;return(0,Y.jsxs)(`div`,{"data-slot":`preview-toolbar`,className:`@container relative flex shrink-0 items-center gap-1.5 border-b border-border bg-background px-2.5 py-2`,children:[h,u,d,f,r?(0,Y.jsx)(Qt,{props:e,input:a,focusUrlAfterMenu:o}):null,p,(0,Y.jsx)(en,{props:e}),(0,Y.jsx)(nn,{props:e}),(0,Y.jsx)(rn,{stats:c,status:l,crowded:i}),s?(0,Y.jsx)(Ne,{iconOnly:i,responsive:!i}):null,(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px shrink-0 bg-border`}),m,(0,Y.jsx)(n,{variant:`ghost`,size:`icon-sm`,className:Ht,"aria-label":`Close preview`,onClick:e.onClose,children:(0,Y.jsx)(I,{"aria-hidden":`true`})}),g]})}function cn({transport:e,takenOver:t,empty:n,stage:r,hasFrame:i,lost:a,url:o,worktree:s}){let c=a||e!==`blocked`&&t!==void 0;return e===`blocked`?{content:{kind:`state`,state:{stage:`proxy-blocked`}},dim:c}:t===void 0?n||r?.stage===`agent-idle`?{content:{kind:`empty`,agentIdle:!n&&r?.stage===`agent-idle`},dim:c}:r?.stage===`streaming`||r?.stage===`loading`&&i?{content:{kind:`none`},dim:c}:r?{content:{kind:`state`,state:r,url:o,worktree:s},dim:c}:a?{content:{kind:`none`},dim:c}:{content:{kind:`state`,state:{t:`state`,stage:`loading`,step:`browser`},url:o},dim:c}:{content:{kind:`state`,state:{stage:`taken-over`,by:t}},dim:c}}function ln(e,{servers:t,serverStates:n,agentLive:r,openServer:i,openAgent:a,actions:o}){switch(e.kind){case`none`:return null;case`state`:{let{kind:t,...n}=e;return(0,Y.jsx)(Be,{...n,actions:o})}case`empty`:return(0,Y.jsx)(dt,{servers:t,states:n,onOpen:e=>i(e),agentLive:r===!0,agentIdle:e.agentIdle,onOpenAgent:a})}}function un(){let e=typeof window>`u`?void 0:window.devicePixelRatio;return typeof e==`number`&&e>0?e:1}function dn(){let[e,t]=(0,J.useState)(un);return(0,J.useEffect)(()=>{let n=window.matchMedia?.(`(resolution: ${e}dppx)`);if(!n)return;let r=()=>t(un());return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e]),e}var fn=2e3,pn=500,mn=1e3;function hn(e,t){switch(e.stage){case`needs-approval`:case`port-held`:case`server-starting`:case`server-stalled`:case`server-exited`:case`server-stopped`:return e.server.port===t;case`loading`:case`streaming`:return!0;default:return!1}}function gn(e){navigator.clipboard?.writeText(e).then(()=>u(`Copied`),()=>u(`Couldn't copy to the clipboard`,{tone:`danger`}))}var _n=e=>`http://localhost:${e.port}${e.path&&e.path!==`/`?e.path:``}`;function vn(e,t){return e?.port===void 0?e?.agent===!0||e?.url!==void 0:e.restored!==!0||t.some(t=>t.port===e.port)}function yn(e){return`port`in e?{port:e.port}:`agent`in e?{agent:!0}:{url:e.url}}function bn({run:e,servers:t,request:n,onTarget:r,onLive:i,onClose:a}){let s=dn(),l=(0,J.useRef)(s);l.current=s;let u=c(),d=(0,J.useRef)(crypto.randomUUID()),f=(0,J.useRef)(!1),p=te(),m=ye(ce,!1),[h,g]=(0,J.useState)(0),[_,v]=(0,J.useState)({state:`connecting`,attempt:0}),[y,ee]=(0,J.useState)(!1),[b,x]=(0,J.useState)(void 0),[S,C]=(0,J.useState)(void 0),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(void 0),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(void 0),[ne,re]=(0,J.useState)(!1),[ie,M]=(0,J.useState)(!1),[N,ae]=(0,J.useState)(void 0),[oe,P]=(0,J.useState)(void 0),[se,le]=(0,J.useState)(void 0),[ue,de]=(0,J.useState)(`fit`),[fe,pe]=(0,J.useState)(zt),[me,he]=(0,J.useState)(null),[F,ge]=(0,J.useState)(void 0),[_e,ve]=(0,J.useState)(0),I=(0,J.useRef)(void 0),be=(0,J.useRef)(null),xe=(0,J.useRef)(null),L=(0,J.useRef)(void 0),R=(0,J.useRef)(void 0),z=(0,J.useRef)(fe);z.current=fe;let B=(0,J.useRef)({port:E,stage:S,agent:O});B.current={port:E,stage:S,agent:O};let V=(0,J.useRef)([]),Se=(0,J.useRef)(void 0),Ce=(0,J.useRef)(!1),H=(0,J.useRef)(!1),U=(0,J.useCallback)(e=>{H.current&&I.current?.send(e)},[]);(0,J.useEffect)(()=>{let t;return t=Me({projectId:p??`default`,runId:e.id},{onFrame(e){if(!o())return;let n=Date.now();V.current.push({at:n,bytes:e.size}),Ce.current||(Ce.current=!0,M(!0)),(be.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(C(e),(e.stage===`streaming`||e.stage===`loading`)&&ve(e=>e+1),R.current!==void 0&&hn(e,R.current)){let n=R.current;R.current=void 0,(e.stage===`needs-approval`||e.stage===`server-exited`||e.stage===`server-stopped`)&&t?.send({t:`run`,port:n})}return;case`url`:return T(e.url);case`cursor`:return ae(e.cursor);case`dialog`:return P(e);case`pong`:Se.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:C(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:x(e.by),H.current=!1,t?.close();return}},onTransport(e,n){H.current=e===`open`,v({state:e,attempt:n??0}),e===`open`&&(ee(!0),L.current&&(t?.send({t:`open`,target:L.current,viewerId:d.current,resume:f.current,quality:z.current,dpr:l.current}),f.current=!0))}}),I.current=t,()=>{H.current=!1,t?.close(),I.current===t&&(I.current=void 0)}},[p,e.id,h]);let W=u&&_.state===`open`&&b===void 0,G=m||ue===`fit`?me:ue;(0,J.useEffect)(()=>{G&&W&&(S?.stage===`streaming`||S?.stage===`loading`)&&U({t:`resize`,w:G.w,h:G.h,...s===1?{}:{dpr:s}})},[G?.w,G?.h,s,W,S?.stage,_e,U]),(0,J.useEffect)(()=>{if(!W)return;let e=setInterval(()=>U({t:`ping`,ts:Date.now()}),fn);return()=>clearInterval(e)},[W,U]);let K=W&&S?.stage===`streaming`;(0,J.useEffect)(()=>{if(!K){le(void 0);return}let e=setInterval(()=>{let e=Date.now();V.current=V.current.filter(t=>e-t.at<=mn);let t={fps:V.current.length,kbps:Math.round(V.current.reduce((e,t)=>e+t.bytes,0)/1024),...Se.current===void 0?{}:{rttMs:Se.current},...V.current.length>0?{lastFrameAt:V.current.at(-1).at}:{}};le(e=>{let n=t.lastFrameAt??e?.lastFrameAt,r={...t,...n===void 0?{}:{lastFrameAt:n}};return e&&e.fps===r.fps&&e.kbps===r.kbps&&e.rttMs===r.rttMs&&e.lastFrameAt===r.lastFrameAt?e:r})},pn);return()=>clearInterval(e)},[K]),(0,J.useEffect)(()=>(i?.(K),()=>i?.(!1)),[K,i]),(0,J.useEffect)(()=>{A&&r?.(A)},[A,r]);let q=(0,J.useCallback)((e,t,n=!1)=>{L.current=e,R.current=n&&`port`in e?e.port:void 0,re(!0),C(void 0),x(void 0),ge(void 0),T(t),D(`port`in e?e.port:void 0),k(`agent`in e),j(yn(e)),U({t:`open`,target:e,viewerId:d.current,quality:z.current,dpr:l.current}),f.current=H.current},[U]),we=(0,J.useCallback)((e,n=!1)=>{let r=t.find(t=>t.port===e);q({port:e},r?_n(r):`http://localhost:${e}`,n)},[t,q]),Te=(0,J.useCallback)(()=>q({agent:!0},``),[q]);(0,J.useEffect)(()=>{if(n?.agent){if(B.current.agent&&B.current.stage?.stage===`streaming`)return;Te();return}if(n?.url!==void 0){let e=Ie(n.url,t);e.kind===`server`?we(e.port):e.kind===`url`&&q({url:e.url},e.url);return}n?.port!==void 0&&(n.restored&&!t.some(e=>e.port===n.port)||B.current.port===n.port&&B.current.stage?.stage===`streaming`&&n.run!==!0||we(n.port,n.run===!0))},[n]);let Ee=!ne&&!b&&_.state!==`blocked`,De=vn(n,t);(0,J.useEffect)(()=>{Ee&&!De&&xe.current?.focus()},[Ee,De]);let Oe=e=>{let n=Ie(e,t);if(n.kind===`error`)return ge(n.message);if(n.kind===`server`)return we(n.port);if(B.current.stage?.stage===`streaming`&&!B.current.agent)return L.current={url:n.url},R.current=void 0,D(void 0),j({url:n.url}),ge(void 0),T(n.url),U({t:`nav`,url:n.url});q({url:n.url},n.url)},ke=(0,J.useCallback)(e=>{z.current=e,pe(e),Bt(e),U({t:`quality`,quality:e})},[U]),Ae=()=>{f.current=!1,x(void 0),v({state:`connecting`,attempt:0}),Ce.current=!1,g(e=>e+1)};return{compact:m,transport:_,everOpened:y,takenOver:b,stage:S,url:w,port:E,agent:O,hasFrame:ie,cursor:N,dialog:oe,setDialog:P,stats:se,viewport:ue,setViewport:de,quality:fe,chooseQuality:ke,setStageSize:he,addressError:F,stageHandle:be,urlInput:xe,send:U,connected:W,streaming:K,openServer:we,openAgent:Te,empty:Ee,navigate:Oe,reconnect:Ae,actions:(0,J.useMemo)(()=>({download:()=>U({t:`download`}),cancelDownload:()=>U({t:`cancelDownload`}),retryBrowser:()=>U({t:`retryBrowser`}),run:e=>U({t:`run`,port:e}),stop:e=>U({t:`stop`,port:e}),keepWaiting:e=>U({t:`keepWaiting`,port:e}),close:a,useHere:Ae,copy:gn}),[U,a])}}function xn(e){return(0,Y.jsx)(me,{onClose:e.onClose,children:(0,Y.jsx)(wn,{...e})})}function Sn(e,t,n,r){return e.state===`blocked`?{tone:`neutral`,label:`not supported`}:n?{tone:`neutral`,label:`paused`}:t&&(e.state===`reconnecting`||e.state===`closed`)?{tone:`danger`,label:`offline`}:e.state===`open`?r?Cn(r):void 0:{tone:`neutral`,label:`connecting…`}}function Cn(e){switch(e.stage){case`downloading`:return{tone:`pending`,label:`downloading`};case`download-failed`:return{tone:`danger`,label:`download failed`};case`sandbox-failed`:return{tone:`danger`,label:`browser failed`};case`browser-exited`:return{tone:`danger`,label:e.reason===`timeout`?`browser timed out`:`browser exited`};case`needs-approval`:return{tone:`neutral`,label:`not started`};case`port-held`:return{tone:`danger`,label:`port in use`};case`server-starting`:return{tone:`pending`,label:`waiting for :${e.server.port}`};case`server-stalled`:return{tone:`pending`,label:`waiting · 2 min`};case`server-exited`:return{tone:`danger`,label:`server exited`};case`server-stopped`:return{tone:`neutral`,label:`stopped`};case`agent-idle`:return{tone:`neutral`,label:`agent idle`};case`loading`:return{tone:`neutral`,label:`connecting…`};default:return}}function wn(e){let{run:t,servers:n,serverStates:r,agentLive:i,onSession:a,onClose:o}=e,s=bn(e),{compact:c,transport:l,everOpened:u,takenOver:d,stage:f,url:p,port:m,agent:h,hasFrame:g,stats:_,viewport:v,setViewport:y,quality:ee,chooseQuality:b,addressError:x,urlInput:S,send:C,streaming:w,openServer:T,openAgent:E,empty:D,navigate:O,actions:k}=s,te=n.find(e=>e.port===m),A=f?.stage===`streaming`&&f.adopted,j=u&&(l.state===`reconnecting`||l.state===`closed`),{content:ne,dim:re}=cn({transport:l.state,takenOver:d,empty:D,stage:f,hasFrame:g,lost:j,url:p,worktree:t.worktreePath}),ie=ln(ne,{servers:n,serverStates:r,agentLive:i,openServer:T,openAgent:E,actions:k});return(0,Y.jsxs)(`section`,{"data-slot":`preview-pane-body`,"aria-label":`Live preview`,className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[(0,Y.jsx)(Zt,{url:p,servers:n,serverStates:r,badge:l.state!==`blocked`,current:te,agentLive:i===!0,agentShown:h,adopted:A,viewport:c?`fit`:v,quality:ee,compact:c,navEnabled:w,loading:f?.stage===`loading`,stats:w?_??{fps:0,kbps:0}:void 0,status:w?void 0:Sn(l,u,d!==void 0,f),urlInputRef:S,onSession:a,onNavigate:O,onBack:()=>C({t:`back`}),onForward:()=>C({t:`forward`}),onReload:e=>C({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>T(e),onPickAgent:E,onViewport:y,onQuality:b,onCopyUrl:()=>gn(p),onStop:e=>C({t:`stop`,port:e}),onClose:o}),x?(0,Y.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:x}):null,(0,Y.jsx)(Tn,{transportState:s,overlay:ie,dim:re,lost:j})]})}function Tn({transportState:e,overlay:t,dim:n,lost:r}){let{connected:i,dialog:a,hasFrame:o,stage:s,stageHandle:c,compact:l,viewport:u,cursor:d,setStageSize:f,send:p,urlInput:m,transport:h,reconnect:g,setDialog:_}=e,v=s?.stage,y=i&&t===null&&!a;return(0,Y.jsxs)(Pt,{ref:c,viewport:l?`fit`:u,dimmed:n&&o&&(v===`streaming`||v===`loading`||n),cursor:d,onSize:f,renderInput:e=>y?(0,Y.jsx)(Mt,{scale:e.scale,send:p,onLeave:()=>m.current?.focus()}):null,children:[r?(0,Y.jsx)(ut,{attempt:h.attempt,exhausted:h.state===`closed`,onReconnect:g}):null,t?(0,Y.jsx)(`div`,{"data-slot":`preview-overlay`,className:n&&o?`absolute inset-0 overflow-auto bg-background/85`:`absolute inset-0 overflow-auto bg-background`,children:t}):null,a?(0,Y.jsx)(ft,{dialog:a,onResult:e=>{_(void 0),p({t:`dialogResult`,...e})}}):null]})}function En(e){let{visibleEvents:t}=ge(e);return(0,J.useMemo)(()=>{let e=new Map;for(let n of ee(t,{activeTurn:!1}).turns)for(let t of n.items)t.kind===`preview-server`&&e.set(t.server.port,t);return e},[t])}function Dn(e){let t=En(e.run.id),n=ne(e.run.id);return(0,Y.jsx)(xn,{...e,serverStates:t,agentLive:n})}export{Dn as ConnectedPreviewPane};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,b as n,h as r,m as i,p as a,w as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{r as l}from"./project-scope-context-uluvs2wj.js";var u=e(s(),1),d=c(),f=/^\/p\/([^/]+)(?=\/|$)/;function p(e){let t=f.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function m(e){let t=f.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function h(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function g(e,t){return e===null?t:typeof t==`string`?h(e,t):t.pathname===void 0?t:{...t,pathname:h(e,t.pathname)}}function _(){let{projectId:e}=l(),{pathname:n}=t();return e??p(n)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(){let{pathname:e}=t();return(0,u.useMemo)(()=>m(e),[e])}function b(e){let{pathname:r}=t();return(0,u.useMemo)(()=>n(e,m(r)),[e,r])}function x({to:e,...t}){let n=v();return(0,d.jsx)(a,{...t,to:n(e)})}function S({to:e,...t}){let n=v();return(0,d.jsx)(i,{...t,to:n(e)})}function C({to:e,...t}){let n=v();return(0,d.jsx)(r,{...t,to:n(e)})}function w(){let e=o(),t=v();return(0,u.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{g as a,w as c,p as i,b as l,S as n,m as o,C as r,_ as s,x as t,y as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,b as n,h as r,m as i,p as a,w as o}from"./button-CS5tOblf.js";import{i as s,t as c}from"./react-runtime-CCIEwYL0.js";import{r as l}from"./project-scope-context-wlB-Y0ii.js";var u=e(s(),1),d=c(),f=/^\/p\/([^/]+)(?=\/|$)/;function p(e){let t=f.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function m(e){let t=f.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function h(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function g(e,t){return e===null?t:typeof t==`string`?h(e,t):t.pathname===void 0?t:{...t,pathname:h(e,t.pathname)}}function _(){let{projectId:e}=l(),{pathname:n}=t();return e??p(n)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(){let{pathname:e}=t();return(0,u.useMemo)(()=>m(e),[e])}function b(e){let{pathname:r}=t();return(0,u.useMemo)(()=>n(e,m(r)),[e,r])}function x({to:e,...t}){let n=v();return(0,d.jsx)(a,{...t,to:n(e)})}function S({to:e,...t}){let n=v();return(0,d.jsx)(i,{...t,to:n(e)})}function C({to:e,...t}){let n=v();return(0,d.jsx)(r,{...t,to:n(e)})}function w(){let e=o(),t=v();return(0,u.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{g as a,w as c,p as i,b as l,S as n,m as o,C as r,_ as s,x as t,y as u};