allyhub 0.2.0-next.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/commands/add.js +5 -5
  2. package/dist/commands/cloud-tools.js +9 -10
  3. package/dist/commands/index.js +1 -1
  4. package/dist/commands/mcp.js +1 -1
  5. package/dist/commands/orgs.js +2 -2
  6. package/dist/commands/skills.js +4 -0
  7. package/dist/commands/voice.js +2 -2
  8. package/dist/main.js +4 -4
  9. package/dist/resources.js +2 -0
  10. package/dist/works.js +1 -1
  11. package/editor-app/view.html +4 -4
  12. package/editor-web/assets/chevron-left-D1vfOP5S.js +1 -0
  13. package/editor-web/assets/{chevron-up-C-TmFeHp.js → chevron-up-BMNXDEBs.js} +1 -1
  14. package/editor-web/assets/{dist-Cdp4CLOB.js → dist-B4VKfY-H.js} +1 -1
  15. package/editor-web/assets/{dist-49NTUm82.js → dist-BIEloJVS.js} +1 -1
  16. package/editor-web/assets/{dist-DJIfS4Mh.js → dist-BcInw4os.js} +1 -1
  17. package/editor-web/assets/{dist-Cun2C_27.js → dist-Coblfc3T.js} +1 -1
  18. package/editor-web/assets/{floating-ui.react-dom-iFhm-7Xc.js → floating-ui.react-dom-DSyn5TRd.js} +1 -1
  19. package/editor-web/assets/index-BSFR4plz.css +2 -0
  20. package/editor-web/assets/{index-9-pcRXol.js → index-Dc8FX_sp.js} +3 -3
  21. package/editor-web/assets/{react-DAVp_9d7.js → react-Bo429Bov.js} +3 -3
  22. package/editor-web/assets/{undo-2-57uMP9M_.js → undo-2-CWgOKQ3L.js} +1 -1
  23. package/editor-web/index.html +4 -4
  24. package/node_modules/@allyhub-next/audio/package.json +1 -1
  25. package/node_modules/@allyhub-next/browser/package.json +1 -1
  26. package/node_modules/@allyhub-next/build/package.json +1 -1
  27. package/node_modules/@allyhub-next/check/package.json +1 -1
  28. package/node_modules/@allyhub-next/cloud/dist/call.js +2 -2
  29. package/node_modules/@allyhub-next/cloud/dist/client.js +1 -1
  30. package/node_modules/@allyhub-next/cloud/dist/errors.js +1 -1
  31. package/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
  32. package/node_modules/@allyhub-next/cloud/dist/signin.js +2 -2
  33. package/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
  34. package/node_modules/@allyhub-next/cloud/package.json +1 -1
  35. package/node_modules/@allyhub-next/components/package.json +1 -1
  36. package/node_modules/@allyhub-next/components/r/callout.json +5 -1
  37. package/node_modules/@allyhub-next/components/r/caption-line.json +5 -1
  38. package/node_modules/@allyhub-next/components/r/caption-subtitle.json +5 -1
  39. package/node_modules/@allyhub-next/components/r/caption-word.json +5 -1
  40. package/node_modules/@allyhub-next/components/r/chart.json +5 -1
  41. package/node_modules/@allyhub-next/components/r/code-panel.json +5 -1
  42. package/node_modules/@allyhub-next/components/r/screen-demo.json +5 -1
  43. package/node_modules/@allyhub-next/dev-server/package.json +1 -1
  44. package/node_modules/@allyhub-next/doc/package.json +1 -1
  45. package/node_modules/@allyhub-next/export/package.json +1 -1
  46. package/node_modules/@allyhub-next/formats/package.json +1 -1
  47. package/node_modules/@allyhub-next/measure/package.json +1 -1
  48. package/node_modules/@allyhub-next/media/package.json +1 -1
  49. package/node_modules/@allyhub-next/model/package.json +1 -1
  50. package/node_modules/@allyhub-next/project/package.json +1 -1
  51. package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +23 -84
  52. package/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
  53. package/node_modules/@allyhub-next/protocol/dist/index.d.ts +1 -0
  54. package/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
  55. package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +2 -0
  56. package/node_modules/@allyhub-next/protocol/dist/routes.d.ts +14 -0
  57. package/node_modules/@allyhub-next/protocol/dist/routes.js +2 -0
  58. package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +1 -7
  59. package/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
  60. package/node_modules/@allyhub-next/protocol/package.json +1 -1
  61. package/node_modules/@allyhub-next/registry/package.json +1 -1
  62. package/node_modules/@allyhub-next/render/package.json +1 -1
  63. package/node_modules/@allyhub-next/runtime/package.json +1 -1
  64. package/node_modules/@allyhub-next/runtimes/package.json +1 -1
  65. package/node_modules/@allyhub-next/scaffold/LICENSE +241 -0
  66. package/node_modules/@allyhub-next/scaffold/dist/index.js +16 -0
  67. package/node_modules/@allyhub-next/scaffold/package.json +13 -0
  68. package/node_modules/@allyhub-next/scenery/package.json +1 -1
  69. package/node_modules/@allyhub-next/scenery-host/package.json +1 -1
  70. package/node_modules/@allyhub-next/sheet/package.json +1 -1
  71. package/node_modules/@allyhub-next/site/package.json +1 -1
  72. package/node_modules/@allyhub-next/stage/package.json +1 -1
  73. package/node_modules/@allyhub-next/video-core/package.json +1 -1
  74. package/package.json +29 -27
  75. package/dist/charge.js +0 -2
  76. package/editor-web/assets/chevron-left-BzSzrFR5.js +0 -1
  77. package/editor-web/assets/index-DRbemuuR.css +0 -2
  78. package/node_modules/@allyhub-next/cloud/dist/price.js +0 -2
@@ -53,9 +53,9 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
53
53
 
54
54
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=pe,c=!w.jitless,l=c&&me.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?zr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Hr(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=>Re(e,r,T())))}),t)}var Ur=C(`$ZodUnion`,(e,t)=>{D.init(e,t),S(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),S(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),S(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),S(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>re(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=>Hr(t,r,e,i)):Hr(o,r,e,i)}});function Wr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Gr=C(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ur.init(e,t);let n=e._zod.parse;S(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=se(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=te(()=>Wr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!pe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._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()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Kr=C(`$ZodIntersection`,(e,t)=>{D.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])=>Jr(e,t,n)):Jr(e,i,a)}});function qr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(he(e)&&he(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=qr(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=qr(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 Jr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=qr(t.value,n.value);if(!c.valid){if(x(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Yr=C(`$ZodTuple`,(e,t)=>{D.init(e,t);let n=t.items,r=w.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Xr(n,`optin`),l=Xr(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=x(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(x(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Zr(t,i,e))):Zr(r,i,e)}}return s.length?Promise.all(s).then(()=>Qr(u,i,n,o,l)):Qr(u,i,n,o,l)}});function Xr(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Zr(e,t,n){e.issues.length&&t.issues.push(...Pe(n,e.issues)),t.value[n]=e.value}function Qr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Pe(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var $r=C(`$ZodRecord`,(e,t)=>{D.init(e,t);let n=w.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!he(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Re(e,i,T())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Pe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Pe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&mn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Re(e,i,T())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Pe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Pe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ei=C(`$ZodEnum`,(e,t)=>{D.init(e,t);let n=f(t.entries),r=new Set(n);e._zod.values=r,S(e,`pattern`,e=>{let t=f(e.def.entries).filter(e=>_e.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ve(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),ti=C(`$ZodLiteral`,(e,t)=>{D.init(e,t);let n=new Set(t.values);e._zod.values=n,S(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ve(e):e?ve(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),ni=C(`$ZodTransform`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,w.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new st(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));if(i instanceof Promise)throw new ot;return n.value=i,n}});function ri(e,t){return e.value=t.issues.length?void 0:t.value,e}var ii=C(`$ZodOptional`,(e,t)=>{D.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,S(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${re(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ri(e,t)):ri(e,r)}return t.innerType._zod.run(e,n)}}),ai=C(`$ZodExactOptional`,(e,t)=>{ii.init(e,t),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),oi=C(`$ZodNullable`,(e,t)=>{D.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin),S(e,`optout`,e=>e.def.innerType._zod.optout),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${re(t.source)}|null)$`):void 0}),S(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),si=C(`$ZodDefault`,(e,t)=>{D.init(e,t),e._zod.optin=`defaulted`,S(e,`values`,e=>e.def.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=>ci(e,t)):ci(r,t)}});function ci(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var li=C(`$ZodPrefault`,(e,t)=>{D.init(e,t),e._zod.optin=`defaulted`,S(e,`values`,e=>e.def.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))}),ui=C(`$ZodNonOptional`,(e,t)=>{D.init(e,t),S(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>di(t,e)):di(i,e)}});function di(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function fi(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Re(e,r,T()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var pi=C(`$ZodCatch`,(e,t)=>{D.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),S(e,`optout`,e=>e.def.innerType._zod.optout),S(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>fi(e,r,t,n)):fi(e,r,t,n)}}),mi=C(`$ZodPipe`,(e,t)=>{D.init(e,t),S(e,`values`,e=>e.def.in._zod.values),S(e,`optin`,e=>e.def.in._zod.optin),S(e,`optout`,e=>e.def.out._zod.optout),S(e,`propValues`,e=>e.def.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=>hi(e,t.in,n)):hi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>hi(e,t.out,n)):hi(r,t.out,n)}});function hi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var gi=C(`$ZodReadonly`,(e,t)=>{D.init(e,t),S(e,`propValues`,e=>e.def.innerType._zod.propValues),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`optin`,e=>e.def.innerType?._zod?.optin),S(e,`optout`,e=>e.def.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(_i):_i(r)}});function _i(e){return e.memo||(e.value=Object.freeze(e.value)),e}var vi=C(`$ZodLazy`,(e,t)=>{D.init(e,t),oe(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),S(e,`pattern`,e=>e.innerType?._zod?.pattern),S(e,`propValues`,e=>e.innerType?._zod?.propValues),S(e,`optin`,e=>e.innerType?._zod?.optin??void 0),S(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),yi=C(`$ZodCustom`,(e,t)=>{E.init(e,t),D.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=>bi(t,n,r,e));bi(i,n,r,e)}});function bi(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(Ue(e))}}var xi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Si=`~memo`,Ci=[];function wi(e){return typeof e==`object`&&!!e}function Ti(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ei=new WeakMap,Di=0,Oi=1,ki=2;function Ai(e,t,n){let r=Ei.get(e);if(r!==void 0)return r?ki:Di;if(t.has(e))return ki;t.add(e);let i=Di,a=e=>{if(i!==ki&&e?._zod){let r=Ai(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Di;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Oi:o.value?._zod?Ai(o.value,t,n):Di;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=se(c);s(e?o(e,!0):Oi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ai(r,t,!1):Oi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ji(e,i)}function ji(e,t){return t!==Oi&&Ei.set(e,t===ki),t}function Mi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ni,Pi=[],Fi={alloc(e,t,n){let r=Ni;if(!r)return n;Ni=void 0;let i={value:n,issues:null};return r.set(t.value,i),Pi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Li(n,e.value))throw new xi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ai(e,new Set,!1);if(i===Di)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===ki||r?n=!0:r=!0}let l=s.value;if(!wi(l))return t(s,c);let u=c[Si];u||(u={buckets:new WeakMap,backEdges:void 0},c[Si]=u);let d;i===c?d=a:(d=Mi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Ti(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ni=d;let p=Pi.length,m=t(s,c);Ni=void 0;let ee=Pi.length>p?Pi.pop():void 0;return m instanceof Promise?m.then(e=>(ee&&(ee.issues=e.issues.length?Ti(e.issues):Ci),e)):(ee&&(ee.issues=m.issues.length?Ti(m.issues):Ci),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ii(){return Fi}function Li(e,t){let n=e[Si]?.backEdges;return n!==void 0&&wi(t)&&n.has(t)}var Ri=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(He(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${be(e.values[0])}`:`Invalid option: expected one of ${p(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${p(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function zi(){return{localeError:Ri()}}var Bi,Vi=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 Hi(){return new Vi}(Bi=globalThis).__zod_globalRegistry??(Bi.__zod_globalRegistry=Hi());var Ui=globalThis.__zod_globalRegistry;function Wi(e){return e.checks&&=[...e.checks],e}function Gi(e,t){return new e(Wi({type:`string`,...b(t)}))}function Ki(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function qi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function Yi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function Xi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function Zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function Qi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function $i(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function ea(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function ta(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function na(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function ra(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function ia(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function aa(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function oa(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function sa(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function ca(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function la(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function ua(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function da(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function fa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function pa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function ma(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function ha(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function ga(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function _a(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function va(e,t){return new e(Wi({type:`number`,checks:[],...b(t)}))}function ya(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...b(t)})}function ba(e,t){return new e({type:`boolean`,...b(t)})}function xa(e,t){return new e({type:`null`,...b(t)})}function Sa(e){return new e({type:`unknown`})}function Ca(e,t){return new e({type:`never`,...b(t)})}function wa(e,t){return new xn({check:`less_than`,...b(t),value:e,inclusive:!1})}function Ta(e,t){return new xn({check:`less_than`,...b(t),value:e,inclusive:!0})}function Ea(e,t){return new Sn({check:`greater_than`,...b(t),value:e,inclusive:!1})}function Da(e,t){return new Sn({check:`greater_than`,...b(t),value:e,inclusive:!0})}function Oa(e,t){return new Cn({check:`multiple_of`,...b(t),value:e})}function ka(e,t){return new Tn({check:`max_length`,...b(t),maximum:e})}function Aa(e,t){return new En({check:`min_length`,...b(t),minimum:e})}function ja(e,t){return new Dn({check:`length_equals`,...b(t),length:e})}function Ma(e,t){return new kn({check:`string_format`,format:`regex`,...b(t),pattern:e})}function Na(e){return new An({check:`string_format`,format:`lowercase`,...b(e)})}function Pa(e){return new jn({check:`string_format`,format:`uppercase`,...b(e)})}function Fa(e,t){return new Mn({check:`string_format`,format:`includes`,...b(t),includes:e})}function Ia(e,t){return new Nn({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function La(e,t){return new Pn({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function Ra(e){return new Fn({check:`overwrite`,tx:e})}function za(e){return Ra(t=>t.normalize(e))}function Ba(){return Ra(e=>e.trim())}function Va(){return Ra(e=>e.toLowerCase())}function Ha(){return Ra(e=>e.toUpperCase())}function Ua(){return Ra(e=>de(e))}function Wa(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Ka(e,t){let n=qa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ue(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ue(r))}},e(t.value,t)),t);return n}function qa(e,t){let n=new E({check:`custom`,...b(t)});return n._zod.check=e,n}function Ja(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function Ya(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??Ui,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Xa(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function k(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,k(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ja(o.schema,c),t.io===`input`&&A(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 Za(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${Za(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Za(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>
55
55
 
56
- 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function $a(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;$a(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var eo=new Set([`type`,`properties`,`required`,`additionalProperties`]),to=[`oneOf`,`anyOf`];function no(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ro(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!eo.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??no(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:ro(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=no(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function io(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of eo)if(t in e)return;let n=t.filter(e=>to.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ro(t);else{let e=n[0],i=to.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ro([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ja(e,r))}function ao(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)):Ja(i,s),Ja(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())$a(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])io(e)}}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)}Ja(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:so(t,`input`,e.processors),output:so(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function A(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 A(r.element,n);if(r.type===`set`)return A(r.valueType,n);if(r.type===`lazy`)return A(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`||r.type===`catch`)return A(r.innerType,n);if(r.type===`intersection`)return A(r.left,n)||A(r.right,n);if(r.type===`record`||r.type===`map`)return A(r.keyType,n)||A(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:A(r.in,n)||A(r.out,n);if(r.type===`object`){for(let e in r.shape)if(A(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(A(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(A(e,n))return!0;return!!(r.rest&&A(r.rest,n))}return!1}var oo=(e,t={})=>n=>{let r=Ya({...n,processors:t});return k(e,r),Qa(r,e),ao(r,e)},so=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return k(e,o),Qa(o,e),ao(o,e)},co=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},lo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},uo=(e,t)=>{co(e,`minimum`,t),lo(e,`maximum`,t)},fo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},po=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},mo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ho=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},go=(e,t)=>co(e,`minimum`,t.minimum),_o=(e,t)=>lo(e,`maximum`,t.maximum),vo=e=>(t,n)=>{ho(t,n.format);let[r,i]=e[n.format];co(t,`minimum`,r),lo(t,`maximum`,i)},yo={greater_than:(e,t)=>co(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>lo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>fo(e,t.value),number_format:vo(Se),bigint_format:vo(Ce),min_length:go,max_length:_o,length_equals:(e,t)=>uo(e,t.length),min_size:go,max_size:_o,size_equals:(e,t)=>uo(e,t.size),string_format:(e,t)=>{ho(e,t.format),t.pattern&&po(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>mo(e,t.mime)};function j(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)yo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&co(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&co(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&lo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&lo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&fo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&mo(t,i.mime);for(let e of i.patterns??[])po(t,e);return t}var bo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},xo=new Map([[vr,tn],[br,nn]]),So=e=>xo.get(e)??e,Co=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=j(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=bo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(So);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}))])}},wo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=j(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Xa(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},To=(e,t,n,r)=>{n.type=`boolean`},Eo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Do=(e,t,n,r)=>{n.not={}},Oo=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},ko=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Xa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Xa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Ao=(e,t,n,r)=>{Xa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{Xa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=j(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k(a.element,t,{...r,path:[...r.path,`items`]})};function No(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?No(t.out):t.type===`catch`?No(t.innerType):e._zod.optin}var Po=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Xa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,k(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?No(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=k(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Io=(e,t,n,r)=>{let i=e._zod.def,a=k(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>k(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?k(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?No(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=j(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Ro(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ro(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ro(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?mn:pn).source)),p}var zo=new WeakMap;function Bo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of zo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ro(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Vo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=j(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=k(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,So(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=k(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=zo.get(t);n||(n=[],zo.set(t,n),t.deferred.push(()=>Bo(t))),n.push(e)}i.additionalProperties=k(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&No(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ho=(e,t,n,r)=>{let i=e._zod.def,a=k(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`}]},Uo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wo=Symbol();function Go(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Xa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Wo):JSON.parse(o)}var Ko=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Go(i.defaultValue,e,t,n,r);o!==Wo&&(n.default=o)},qo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Go(i.defaultValue,e,t,n,r);o!==Wo&&(n._prefault=o)},Jo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Xa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Yo=(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;k(o,t,r);let s=t.seen.get(e);s.ref=o},Xo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Zo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qo=(e,t,n,r)=>{let i=e._zod.innerType;k(i,t,r);let a=t.seen.get(e);a.ref=i},$o=new WeakSet([Object.prototype,Error.prototype]);function es(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var M=C(`ZodError`,(e,t)=>{pt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);$o.has(n)||($o.add(n),es(n,`format`,e=>t=>gt(e,t)),es(n,`flatten`,e=>t=>ht(e,t)),es(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,m,2)}),es(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,m,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ts=bt(M),ns=xt(M),rs=St(M),is=wt(M),as=At(M),os=jt(M),ss=Mt(M),cs=Nt(M),ls=Pt(M),us=Ft(M),ds=It(M),fs=Lt(M);function ps(){w.localeError||T(zi())}function ms(){w.memoizer||T({memoizer:Ii()})}var N=C(`ZodType`,(e,t)=>(ps(),D.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(y(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 ye(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Nc(e,t))},superRefine(e,t){return this.check(Pc(e,t))},overwrite(e){return this.check(Ra(e))},optional(){return pc(this)},exactOptional(){return hc(this)},nullable(){return _c(this)},nullish(){return pc(_c(this))},nonoptional(e){return Cc(this,e)},array(){return V(this)},or(e){return W([this,e])},and(e){return rc(this,e)},transform(e){return Dc(this,dc(e))},default(e){return yc(this,e)},prefault(e){return xc(this,e)},catch(e){return Tc(this,e)},pipe(e){return Dc(this,e)},readonly(){return kc(this)},describe(e){let t=this.clone();return Ui.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ui.get(this);let t=this.clone();return Ui.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ke(this,`~standard`,{...Bn(this),jsonSchema:{input:so(this,`input`),output:so(this,`output`)}})},set"~standard"(e){Ge(this,`~standard`,e)},parse:function e(t,n){return ts(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ns(this,t,n,{callee:e})},safeParse(e,t){return rs(this,e,t)},async safeParseAsync(e,t){return is(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ge(this,`spa`,e)},validate(e,t){return Dt(this,e,t)},validateAsync(e,t){return kt(this,e,t)},encode:function e(t,n){return as(this,t,n,{callee:e})},decode:function e(t,n){return os(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ss(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await cs(this,t,n,{callee:e})},safeEncode(e,t){return ls(this,e,t)},safeDecode(e,t){return us(this,e,t)},async safeEncodeAsync(e,t){return ds(this,e,t)},async safeDecodeAsync(e,t){return fs(this,e,t)},toJSONSchema(e){return oo(this,{})(e)},get description(){return Ui.get(this)?.description},get _def(){return this._zod.def}}),hs=C(`_ZodString`,(e,t)=>{Vn.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)},qe({format:e=>j(e).format??null,minLength:e=>j(e).minimum??null,maxLength:e=>j(e).maximum??null},{regex(...e){return this.check(Ma(...e))},includes(...e){return this.check(Fa(...e))},startsWith(...e){return this.check(Ia(...e))},endsWith(...e){return this.check(La(...e))},min(...e){return this.check(Aa(...e))},max(...e){return this.check(ka(...e))},length(...e){return this.check(ja(...e))},nonempty(...e){return this.check(Aa(1,...e))},lowercase(e){return this.check(Na(e))},uppercase(e){return this.check(Pa(e))},trim(){return this.check(Ba())},normalize(...e){return this.check(za(...e))},toLowerCase(){return this.check(Va())},toUpperCase(){return this.check(Ha())},slugify(){return this.check(Ua())}})),gs=C(`ZodString`,(e,t)=>{Vn.init(e,t),hs.init(e,t)},{email(e){return this.check(Ki(xs,e))},url(e){return this.check(Qi(Ts,e))},jwt(e){return this.check(pa(Vs,e))},emoji(e){return this.check($i(Es,e))},guid(e){return this.check(qi(Cs,e))},uuid(e){return this.check(Ji(ws,e))},uuidv4(e){return this.check(Yi(ws,e))},uuidv6(e){return this.check(Xi(ws,e))},uuidv7(e){return this.check(Zi(ws,e))},nanoid(e){return this.check(ea(Ds,e))},cuid(e){return this.check(ta(Os,e))},cuid2(e){return this.check(na(ks,e))},ulid(e){return this.check(ra(As,e))},base64(e){return this.check(ua(Ls,e))},base64url(e){return this.check(da(zs,e))},xid(e){return this.check(ia(js,e))},ksuid(e){return this.check(aa(Ms,e))},ipv4(e){return this.check(oa(Ns,e))},ipv6(e){return this.check(sa(Ps,e))},cidrv4(e){return this.check(ca(Fs,e))},cidrv6(e){return this.check(la(Is,e))},e164(e){return this.check(fa(Bs,e))},datetime(e){return this.check(ma(_s,e))},date(e){return this.check(ha(vs,e))},time(e){return this.check(ga(ys,e))},duration(e){return this.check(_a(bs,e))}});function P(e){return Gi(gs,e)}var F=C(`ZodStringFormat`,(e,t)=>{O.init(e,t),hs.init(e,t)}),_s=C(`ZodISODateTime`,(e,t)=>{or.init(e,t),F.init(e,t)}),vs=C(`ZodISODate`,(e,t)=>{sr.init(e,t),F.init(e,t)}),ys=C(`ZodISOTime`,(e,t)=>{cr.init(e,t),F.init(e,t)}),bs=C(`ZodISODuration`,(e,t)=>{lr.init(e,t),F.init(e,t)}),xs=C(`ZodEmail`,(e,t)=>{Wn.init(e,t),F.init(e,t)});function Ss(e){return Ki(xs,e)}var Cs=C(`ZodGUID`,(e,t)=>{Hn.init(e,t),F.init(e,t)}),ws=C(`ZodUUID`,(e,t)=>{Un.init(e,t),F.init(e,t)}),Ts=C(`ZodURL`,(e,t)=>{Qn.init(e,t),F.init(e,t)});function I(e){return Qi(Ts,e)}var Es=C(`ZodEmoji`,(e,t)=>{$n.init(e,t),F.init(e,t)}),Ds=C(`ZodNanoID`,(e,t)=>{er.init(e,t),F.init(e,t)}),Os=C(`ZodCUID`,(e,t)=>{tr.init(e,t),F.init(e,t)}),ks=C(`ZodCUID2`,(e,t)=>{nr.init(e,t),F.init(e,t)}),As=C(`ZodULID`,(e,t)=>{rr.init(e,t),F.init(e,t)}),js=C(`ZodXID`,(e,t)=>{ir.init(e,t),F.init(e,t)}),Ms=C(`ZodKSUID`,(e,t)=>{ar.init(e,t),F.init(e,t)}),Ns=C(`ZodIPv4`,(e,t)=>{ur.init(e,t),F.init(e,t)}),Ps=C(`ZodIPv6`,(e,t)=>{pr.init(e,t),F.init(e,t)}),Fs=C(`ZodCIDRv4`,(e,t)=>{mr.init(e,t),F.init(e,t)}),Is=C(`ZodCIDRv6`,(e,t)=>{gr.init(e,t),F.init(e,t)}),Ls=C(`ZodBase64`,(e,t)=>{yr.init(e,t),F.init(e,t)});function Rs(e){return ua(Ls,e)}var zs=C(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),F.init(e,t)}),Bs=C(`ZodE164`,(e,t)=>{Cr.init(e,t),F.init(e,t)}),Vs=C(`ZodJWT`,(e,t)=>{Tr.init(e,t),F.init(e,t)}),Hs=C(`ZodNumber`,(e,t)=>{Er.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.isFinite=!0},qe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=j(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=j(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=j(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>j(e).format??null},{gt(e,t){return this.check(Ea(e,t))},gte(e,t){return this.check(Da(e,t))},min(e,t){return this.check(Da(e,t))},lt(e,t){return this.check(wa(e,t))},lte(e,t){return this.check(Ta(e,t))},max(e,t){return this.check(Ta(e,t))},int(e){return this.check(R(e))},safe(e){return this.check(R(e))},positive(e){return this.check(Ea(0,e))},nonnegative(e){return this.check(Da(0,e))},negative(e){return this.check(wa(0,e))},nonpositive(e){return this.check(Ta(0,e))},multipleOf(e,t){return this.check(Oa(e,t))},step(e,t){return this.check(Oa(e,t))},finite(){return this}}));function L(e){return va(Hs,e)}var Us=C(`ZodNumberFormat`,(e,t)=>{Dr.init(e,t),Hs.init(e,t)});function R(e){return ya(Us,e)}var Ws=C(`ZodBoolean`,(e,t)=>{Or.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function z(e){return ba(Ws,e)}var Gs=C(`ZodNull`,(e,t)=>{kr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Ks(e){return xa(Gs,e)}var qs=C(`ZodUnknown`,(e,t)=>{Ar.init(e,t),N.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function B(){return Sa(qs)}var Js=C(`ZodNever`,(e,t)=>{jr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Ys(e){return Ca(Js,e)}var Xs=C(`ZodArray`,(e,t)=>{ms(),Fr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Aa(e,t))},nonempty(e){return this.check(Aa(1,e))},max(e,t){return this.check(ka(e,t))},length(e,t){return this.check(ja(e,t))},unwrap(){return this.element}});function V(e,t){return Wa(Xs,e,t)}var Zs=C(`ZodObject`,(e,t)=>{ms(),Vr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),$e(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(y(this._zod.def,{catchall:e}))},passthrough(){return this.clone(y(this._zod.def,{catchall:B()}))},loose(){return this.clone(y(this._zod.def,{catchall:B()}))},strict(){return this.clone(y(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(y(this._zod.def,{catchall:void 0}))},extend(e){return De(this,e)},safeExtend(e){return ke(this,e)},merge(e){return Ae(this,e)},pick(e){return we(this,e)},omit(e){return Ee(this,e)},partial(...e){return je(fc,this,e[0])},exactPartial(...e){return je(mc,this,e[0],`exactPartial`)},required(...e){return Me(Sc,this,e[0])}});function H(e,t){return new Zs({type:`object`,shape:e??{},...b(t)})}function U(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...b(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:B(),...b(t)})}var $s=C(`ZodUnion`,(e,t)=>{Ur.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.options=t.options});function W(e,t){return new $s({type:`union`,options:e,...b(t)})}var ec=C(`ZodDiscriminatedUnion`,(e,t)=>{$s.init(e,t),Gr.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...b(n)})}var nc=C(`ZodIntersection`,(e,t)=>{Kr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}var ic=C(`ZodTuple`,(e,t)=>{ms(),Yr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new fc({type:`optional`,innerType:e}))})}});function ac(e,t,n){let r=t instanceof D;return new ic({type:`tuple`,items:e,rest:r?t:null,...b(r?n:t)})}var oc=C(`ZodRecord`,(e,t)=>{ms(),$r.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,n){return!t||!t._zod?new oc({type:`record`,keyType:P(),valueType:e,...b(t)}):new oc({type:`record`,keyType:e,valueType:t,...b(n)})}function sc(e,t,n){return new oc({type:`record`,keyType:e,valueType:t,...b(n),partial:!0})}var cc=C(`ZodEnum`,(e,t)=>{ei.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 cc({...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 cc({...t,checks:[],...b(r),entries:i})}});function K(e,t){return new cc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var lc=C(`ZodLiteral`,(e,t)=>{ti.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(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 q(e,t){return new lc({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var uc=C(`ZodTransform`,(e,t)=>{ms(),ni.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new st(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ue(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ue(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function dc(e){return new uc({type:`transform`,transform:e})}var fc=C(`ZodOptional`,(e,t)=>{ii.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}var mc=C(`ZodExactOptional`,(e,t)=>{ai.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`optional`,innerType:e})}var gc=C(`ZodNullable`,(e,t)=>{oi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new gc({type:`nullable`,innerType:e})}var vc=C(`ZodDefault`,(e,t)=>{si.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yc(e,t){return new vc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ge(t)}})}var bc=C(`ZodPrefault`,(e,t)=>{li.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ge(t)}})}var Sc=C(`ZodNonOptional`,(e,t)=>{ui.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e,t){return new Sc({type:`nonoptional`,innerType:e,...b(t)})}var wc=C(`ZodCatch`,(e,t)=>{pi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tc(e,t){return new wc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:tt(t)})}var Ec=C(`ZodPipe`,(e,t)=>{mi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.in=t.in,e.out=t.out});function Dc(e,t){return new Ec({type:`pipe`,in:e,out:t})}var Oc=C(`ZodReadonly`,(e,t)=>{gi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`readonly`,innerType:e})}var Ac=C(`ZodLazy`,(e,t)=>{vi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function jc(e){return new Ac({type:`lazy`,getter:e})}var Mc=C(`ZodCustom`,(e,t)=>{yi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function Nc(e,t={}){return Ga(Mc,e,t)}function Pc(e,t){return Ka(e,t)}function Fc(e){return ma(_s,e)}function Ic(e){return ha(vs,e)}U({jsonrpc:q(`2.0`),id:W([P(),R()]),method:P().min(1),params:B().optional()}),U({jsonrpc:q(`2.0`),method:P().min(1),params:B().optional()});var Lc=U({code:R(),message:P(),data:B().optional()});W([U({jsonrpc:q(`2.0`),id:W([P(),R()]),result:B()}),U({jsonrpc:q(`2.0`),id:W([P(),R(),Ks()]),error:Lc})]);var Rc={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,conflict:-32001,notFound:-32002,invalid:-32003,forbidden:-32004,unavailable:-32005},J=(e,t,n)=>({params:e,result:t,about:n}),zc=(e,t)=>({params:e,about:t}),Bc=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RpcError`,this.code=e,this.data=n}};async function Vc(e,t,n){let{id:r}=n,i=Object.hasOwn(e,n.method)?e[n.method]:void 0;if(!i)return{jsonrpc:`2.0`,id:r,error:{code:Rc.methodNotFound,message:`There is no method "${n.method}".`}};let a=i.params.safeParse(n.params??{});if(!a.success)return{jsonrpc:`2.0`,id:r,error:{code:Rc.invalidParams,message:vt(a.error)}};try{let e=t[n.method],o=await e(a.data);return{jsonrpc:`2.0`,id:r,result:i.result.parse(o)}}catch(e){return e instanceof Bc?{jsonrpc:`2.0`,id:r,error:{code:e.code,message:e.message,...e.data===void 0?{}:{data:e.data}}}:{jsonrpc:`2.0`,id:r,error:{code:Rc.internal,message:e instanceof Error?e.message:String(e)}}}}var Y=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(`/`).includes(`..`),{message:`A path is inside the project.`}),Hc=P().regex(/^[0-9a-f]{64}$/u).nullable(),Uc=U({kind:K([`person`,`agent`,`tool`]),name:P().min(1)}),Wc=U({path:Y,size:R().nonnegative(),modified:L()}),Gc={"files/read":J(U({path:Y}),U({text:P(),version:Hc}),`A text file, with its version; a file that is not there reads as empty with version null.`),"files/write":J(U({path:Y,text:P(),over:Hc}),U({version:Hc}),`Writes a text file over the version read. Errors: conflict (data: { text, version }) when it changed; invalid (data: { problems }) when its format refuses it.`),"files/upload":J(U({dir:Y,name:P().min(1),data:Rs()}),U({path:Y}),`Keeps a file the person added, under a free name in the folder.`),"files/url":J(U({path:Y}),U({url:P()}),`An address a page can load the file from (a picture, a video).`),"files/list":J(U({dir:P()}),U({files:V(Wc),dirs:V(Y)}),`A folder's files and folders, as on disk.`),"files/move":J(U({from:Y,to:Y}),U({rewritten:V(Y)}),`Moves a file or a folder, and rewrites the relative imports and links that pointed at it, as an editor does.`),"files/remove":J(U({path:Y}),U({trash:P()}),`Moves a file or folder to the recycle bin (nothing is deleted).`),"files/trash":J(U({}),U({entries:V(U({id:P(),path:Y,removed:L()}))}),`What the recycle bin holds.`),"files/restore":J(U({id:P()}),U({path:Y}),`Puts a removed thing back where it was; refused while something is there.`),"files/watch":J(U({paths:V(Y).min(1)}),U({watch:P()}),"Starts telling `files/changed` for these files or folders."),"files/unwatch":J(U({watch:P()}),U({}),`Stops a watch.`)},Kc={"files/changed":zc(U({watch:P(),changes:V(U({path:Y,version:Hc,by:Uc.optional()}))}),`Files under a watch changed, other than by this client's own writes.`)},qc=[`ts`,`tsx`,`mts`,`js`,`jsx`,`mjs`],Jc=e=>qc.map(t=>`${e}.${t}`),Yc=[`video`,`slides`,`doc`,`sheet`,`scenery`,`website`],Xc={video:{entries:Jc(`video`),editor:`video`,name:`video`},slides:{entries:Jc(`slides`),editor:`slides`,name:`slides`},doc:{entries:[`doc.mdx`],editor:`doc`,name:`doc`},sheet:{entries:[`sheet.csv`],editor:`sheet`,name:`sheet`},scenery:{entries:Jc(`scenery`),editor:`scenery`,name:`3D scenery`},website:{entries:[`astro.config.mjs`,`astro.config.ts`,`astro.config.mts`,`astro.config.js`],editor:`website`,name:`website`}},Zc=Object.keys(Xc);new Map(Zc.flatMap(e=>Xc[e].entries.map(t=>[t,e])));var Qc=P().regex(/^[0-9a-f]{64}$/u,`A sha256 is 64 lowercase hexadecimal digits.`),X=L().nonnegative(),$c=Fc({offset:!0});function el(e){return U({$schema:P().optional(),...e})}var tl=tc(`type`,[U({type:q(`quote`),exact:P().min(1),prefix:P().optional(),suffix:P().optional()}),U({type:q(`cells`),range:P().regex(/^[A-Z]+[1-9]\d*(?::[A-Z]+[1-9]\d*)?$/u)}),U({type:q(`item`)})]),nl=U({kind:K([`person`,`agent`]),name:P().min(1)}),rl=U({id:P().min(1),author:nl,text:P().min(1),at:$c}),il=U({id:P().min(1),target:tl,resolved:z().default(!1),comments:V(rl).min(1)}),al=el({version:q(1),threads:V(il).default([])}),ol=U({fonts:V(P().min(1)).default([]),text:P().optional(),locales:V(P().min(2)).min(1).optional(),look:G(P(),B()).optional(),defaults:G(P(),B()).optional()}),sl=U({from:X,to:X}).refine(e=>e.to>e.from,{message:`A stretch ends after its start.`,path:[`to`]}),cl=L().min(0).max(2),ll=el({version:q(1),take:P().optional(),remove:V(U({from:R().nonnegative(),to:R().nonnegative(),text:P().optional()}).refine(e=>e.to>=e.from,{message:`A range ends at or after its start.`,path:[`to`]})).optional(),sounds:V(sl).optional(),inWord:V(sl).optional(),maxPause:L().min(.05).max(10).optional(),pad:U({before:cl.optional(),after:cl.optional()}).optional()}),ul=ac([L(),L(),L().nonnegative(),L().nonnegative()]),dl=G(P().min(1),ul);U({omitted:q(!0),sha256:Qc,bytes:R().nonnegative()});var fl=el({version:q(1),ai:z(),tool:P().optional(),model:P().optional(),input:G(P(),B()).optional(),inputHash:Qc.optional(),output:G(P(),B()).optional(),credits:L().nonnegative().optional(),at:$c,sha256:Qc,bytes:R().nonnegative(),source:U({library:P(),page:I(),authors:V(P()).default([]),license:P()}).optional()}),pl=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/u,ml=U({display:P(),speak:P()}),hl=U({declarations:V(P()).default([]),selectors:V(P()).default([]),match:G(P(),P()).refine(e=>Object.keys(e).length>0,`A match needs at least one case.`)}),gl=W([P(),ml,ac([hl])]),_l=G(P(),B()).superRefine((e,t)=>{for(let[n,r]of Object.entries(e)){if(n===`$schema`){typeof r!=`string`&&t.addIssue({code:`custom`,path:[n],message:`$schema is a string.`});continue}pl.test(n)||t.addIssue({code:`custom`,path:[n],message:`"${n}" is not a message key: letters, digits, _ and -, in segments joined by dots.`});let e=gl.safeParse(r);e.success||t.addIssue({code:`custom`,path:[n],message:Array.isArray(r)?`A message with variants is [{ "declarations": […], "selectors": […], "match": {…} }]: ${e.error.issues.map(e=>e.message).join(`; `)}`:`A message is a string, { display, speak }, or [{ declarations, selectors, match }].`})}}).transform(e=>{let t={...e};return delete t.$schema,t}),vl=ac([L(),L(),L(),L()]),yl=H({t:X,score:L()}),Z=L().nullable(),Q=L().int().nonnegative(),bl=H({index:Q,start:X,end:X,words:ac([L().int(),L().int()]),text:P(),punctuation:z(),pauseAfter:X.optional()}),xl=H({after:Q,start:X,end:X,dur:X}),Sl=H({t:X,cut:yl.optional(),weak:yl.optional(),pause:H({start:X,end:X,dur:X}).optional(),sentence:Q.optional()}),Cl=H({id:Q,text:P(),box:vl,height:L(),conf:L(),words:Q,upper:L().min(0).max(1),start:X,end:X,spans:V(ac([X,X])),seconds:X,seen:L().int().positive(),frames:L().min(0).max(1),spread:L().min(0).max(1),said:L().min(0).max(1)}),wl=H({start:X,end:X,dur:X,said:P(),words:Q,wordsPerMinute:L().nonnegative(),cuts:V(X),shots:L().int().positive(),cutsPerMinute:L().nonnegative(),text:V(Q),textSeconds:X}).extend({index:Q,name:P(),sentences:ac([L().int(),L().int()]).optional()}),Tl=H({cutsPerMinute:L().nonnegative(),meanShot:X,medianShot:X,wordsPerMinute:L().nonnegative(),speakingRate:L().nonnegative(),timeToFirstWord:X.optional(),timeToFirstCut:X.optional(),textShare:L().min(0).max(1),speechShare:L().min(0).max(1),tempo:H({bpm:L().positive(),confidence:L().min(0),candidates:V(H({bpm:L(),r:L(),score:L()})).optional(),prior:L().optional()}).optional(),onsetsPerMinute:L().nonnegative()}),El=H({seconds:X,p10:L(),median:L(),p90:L()}),Dl=H({gap:X,edge:X,voiced:L().min(0).max(100),whole:El,words:El.optional(),between:El.extend({voicedShare:L().min(0).max(1),onsetsPerMinute:L().nonnegative()}).optional(),floor:L()}),Ol=H({params:G(P(),B()),frames:H({tone:Q,color:Q,motion:Q}),luma:H({p1:Z,p50:Z,p99:Z}),blackShare:Z,noise:Z,sharpness:Z,saturation:Z,warmth:Z,motion:H({speed:H({p50:Z,p90:Z}),shake:H({p50:Z,p90:Z}),stillShare:Z,runs:Q}),sharpnessBySpeed:V(H({from:L(),to:Z,frames:Q,sharpness:Z})),noiseByLuma:V(H({from:L(),to:L(),blocks:Q,noise:Z,median:Z})),shake:V(H({start:X,end:X,rms:L(),peaks:V(H({hz:L(),share:L()})),flatness:L()}))}),kl=H({frames:Q,reach:V(H({drop:L(),hz:Z})),rolloff95:Z,rolloff99:Z,steps:V(H({hz:L(),db:L()}))}),Al=H({loudness:H({integrated:Z,range:Z,truePeak:Z}),recording:H({params:G(P(),B()),spectrum:V(H({hz:L(),db:L()})),dynamics:H({spread:L(),crest:L()})}).loose(),bandwidth:kl.extend({params:G(P(),B())}),voice:kl.optional()}),jl=H({item:P(),combo:G(P(),P()),format:P(),platform:P().optional(),export:H({type:P(),crf:L().optional(),maxKbps:L().optional()}),video:H({codec:P(),profile:P().optional(),kbps:L(),width:L().int().positive(),height:L().int().positive(),fps:L().positive(),preset:P().optional()}).optional(),audio:W([H({codec:P(),kbps:L(),rate:L(),channels:L()}),H({missing:P(),instead:P()})]),joins:V(H({t:X,kind:P(),part:P().optional(),score:L(),margin:L(),cut:z()})),unmeant:V(H({t:X,score:L(),margin:L()}))});H({version:q(1),id:P(),source:H({file:P(),url:P().optional(),title:P().optional(),sha256:Qc}),analysedAt:P(),duration:X,width:L().int().positive(),height:L().int().positive(),fps:L().positive(),encoding:H({codec:P().optional(),bitrate:L().positive().optional(),audio:H({codec:P().optional(),profile:P().optional(),bitrate:L().positive().optional(),rate:L().positive().optional(),channels:L().int().positive().optional()}).optional()}).optional(),words:P().optional(),wordCount:Q,asr:P().optional(),wordsMissing:H({code:P().optional(),message:P(),hint:P().optional(),instead:P()}).optional(),shots:H({threshold:L().min(0).max(1),minShot:L().nonnegative(),weakFloor:L().min(0).max(1),prominence:L().nonnegative(),cuts:V(yl),weak:V(yl),candidates:V(H({t:X,score:L(),source:K([`jump`,`change`]),around:L(),passes:z()})).optional()}),speech:H({pause:X,sentences:V(bl),pauses:V(xl),gaps:V(xl).optional()}),boundaries:H({cutWithin:X,candidates:V(Sl)}),ocr:H({engine:P(),confidence:H({word:L().min(0).max(100),short:L().min(0).max(100)}),frames:Q,samePlace:L(),saidWithin:X,low:V(H({t:X,text:P(),conf:L(),box:vl})).optional()}),text:V(Cl),pacing:Tl,sound:Dl.optional(),segments:H({rule:P(),pause:X,cutWithin:X,minLength:X,list:V(wl).min(1)}),sheets:V(P()),picture:Ol,audio:Al.optional(),served:jl.optional()});var Ml=U({start:X,end:X,name:P().min(1).optional(),role:P().min(1).optional(),picture:P().optional(),onScreen:V(P()).optional(),notes:P().optional()}),Nl=el({version:q(1).default(1),summary:P().optional(),layout:P().optional(),hook:P().optional(),sections:V(Ml).min(1),captions:U({lines:V(Q).optional(),style:P().optional()}).optional(),watermarks:V(Q).optional(),notes:P().optional(),labels:G(P(),W([P(),L(),z(),V(P())])).optional()}),Pl=P().regex(/^[A-Za-z0-9_-]+$/u,`A name is letters, digits, _ and -.`),Fl=jc(()=>W([P(),ml,hl,V(Fl),G(Pl,Fl)])),Il=U({id:Pl,say:W([P(),hl]).optional(),screen:G(Pl,Fl).optional()}),Ll=U({title:P().optional(),text:G(Pl,Fl).optional(),parts:V(Il).default([])}).superRefine((e,t)=>{let n=new Set;e.parts.forEach((e,r)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`parts`,r,`id`],message:`Two parts are "${e.id}".`}),n.add(e.id)})}),Rl=[`text`,`number`,`select`,`multi-select`,`date`,`checkbox`,`url`,`email`,`phone`,`file`],zl=[`gray`,`brown`,`red`,`orange`,`yellow`,`green`,`blue`,`purple`,`pink`],Bl=P().regex(/\S/u),Vl=W([P().regex(/\S/u),L(),z(),U({name:W([P().regex(/\S/u),L()]),color:K(zl).optional()})]),Hl=e=>String(typeof e==`object`?e.name:e).trim(),Ul=P().regex(/^[^"]*[^"\s][^"]*$/u),Wl=K([`plain`,`percent`,`currency`]),Gl=W([Wl,U({style:Wl.nullable().optional(),decimals:R().min(0).max(10).optional(),currency:P().regex(/^[A-Za-z]{3}$/u).optional(),thousands:z().optional()})]),Kl=K([`iso`,`short`,`long`]),ql=W([Kl,U({style:Kl.nullable().optional(),time:z().optional()})]),Jl={width:L().positive().optional(),wrap:z().optional()};function Yl(e,t){let n=e.separator??`;`,r=new Set;(e.options??[]).forEach((e,i)=>{let a=Hl(e);a.includes(n)&&t.addIssue({code:`custom`,path:[`options`,i],message:`"${a}" has the separator ${JSON.stringify(n)} in it`}),r.has(a)&&t.addIssue({code:`custom`,path:[`options`,i],message:`"${a}" is an option twice`}),r.add(a)})}var Xl=W([U({type:K([`text`,`checkbox`,`url`,`email`,`phone`]).nullable().optional(),...Jl}),U({type:q(`number`),format:Gl.optional(),...Jl}),U({type:q(`date`),format:ql.optional(),...Jl}),U({type:q(`select`),options:V(Vl).optional(),...Jl}).superRefine(Yl),U({type:q(`multi-select`),options:V(Vl).optional(),separator:Ul.optional(),...Jl}).superRefine(Yl),U({type:q(`file`),separator:Ul.optional(),height:L().positive().optional(),...Jl})]),Zl=W([Ks(),K(Rl),Xl]),Ql=W([Ks(),U({title:W([P(),L()]).optional(),key:Bl.optional(),primary:Bl.optional(),columns:W([Ks(),G(P(),Zl)]).optional()})]),$l=U({text:P().min(1),start:X,end:X,confidence:L().min(0).max(1).optional()}).refine(e=>e.end>=e.start,{message:`A word ends at or after its start.`,path:[`end`]}),eu={words:{schema:el({version:q(1),language:P().min(2).optional(),duration:X.optional(),model:P().optional(),words:V($l)}).refine(e=>e.words.every((t,n)=>n===0||t.start>=(e.words[n-1]?.start??0)),{message:`Words are in the order they are said.`,path:[`words`]}),files:[`**/*.words.json`],about:`The words said in an audio or video file, with their times.`},edits:{schema:ll,files:[`**/edits/*.json`],about:`A recording's cut list.`},elements:{schema:dl,files:[`**/*.elements.json`],about:`A page screenshot's named elements, each its box in the picture's pixels.`},gen:{schema:fl,files:[`**/*.gen.json`],about:`How a media file was made, and where it came from.`},comments:{schema:al,files:[`**/comments.json`],about:`What was said about an item, in threads.`},script:{schema:Ll,files:[`**/script.*.yaml`],about:`An item's words in one language.`},messages:{schema:_l,files:[`assets/text/*.json`],about:`Words several items share, in one language.`},sheet:{schema:Ql,files:[`**/sheet.yaml`],about:`What a sheet's columns are.`},interpretation:{schema:Nl,files:[`**/reference/*/interpretation.json`],about:`What the agent concludes of a reference video: its sections, captions, watermarks and labels.`},config:{schema:ol,files:[],about:`allyhub.config.ts's settings.`}};function tu(e,t){let n=eu[e].schema.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,problems:n.error.issues.map(e=>({path:e.path.map(String).join(`.`),message:e.message}))}}var nu={item:Y,version:P().optional()},ru=U({mime:P().regex(/^image\//u),data:Rs()}),iu=Qs({code:P(),level:K([`error`,`warn`]),message:P(),piece:P().optional(),part:P().optional(),t:L().optional()}),au=Qs({kind:P(),data:B()}),ou=Qs({fps:L(),width:L(),height:L(),duration:L(),parts:V(B())}),su=U({status:K([`off`,`waiting`,`running`,`done`,`failed`]),revision:R().nonnegative(),problems:V(iu),facts:V(au),versions:U({total:R(),loaded:R(),reused:R()}).optional(),error:P().optional()}),cu=U({id:P(),item:Y,versions:V(P()),types:V(P()),state:K([`queued`,`running`,`done`,`failed`,`cancelled`]),progress:L().min(0).max(1),files:V(Y),error:P().optional()}),lu=U({file:Y,status:K([`running`,`done`,`failed`]),message:P(),share:L().min(0).max(1).optional()}),uu=ac([L(),L(),L()]),du=U({url:P(),probe:P()}),fu={"project/items":J(U({}),U({items:V(U({kind:K(Zc),dir:Y,entry:Y,title:P().optional()})),folder:P(),name:P(),revision:R().nonnegative()}),`The project's items, as the build finds them.`),"video/versions":J(U({item:Y}),U({piece:P(),kind:K([`video`,`slides`]),title:P().optional(),width:L(),height:L(),versions:V(U({key:P(),lang:P().optional()}))}),`A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for.`),"video/stage":J(U({...nu,start:U({t:L().nonnegative().optional(),part:P().optional(),offset:L().nonnegative().optional(),dur:L().positive().optional()}).optional(),play:z().optional(),chrome:z().optional()}),du,`The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage.`),"video/timeline":J(U(nu),U({timeline:ou,text:V(B())}),`A version's timeline, drawn nowhere.`),"video/still":J(U({...nu,t:L().nonnegative().optional()}),U({t:L(),image:ru,width:R().positive(),height:R().positive(),duration:L().nonnegative()}),`A moment of a version as the render draws it, as a picture.`),"check/results":J(U({}),su,`The check run after edits, as it stands.`),"check/run":J(U({}),U({}),`Runs the check again now.`),"export/start":J(U({item:Y,versions:V(P()).optional(),types:V(P().min(1)).max(10).optional()}),U({job:cu}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":J(U({job:P()}),U({}),`Stops an export.`),"export/list":J(U({}),U({jobs:V(cu)}),`The exports asked for since the server started.`),"scenery/viewer":J(U({item:Y,camera:U({position:uu,target:uu}).optional()}),du,`The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.`)},pu={"project/changed":zc(U({revision:R().nonnegative()}),`The build saw a change: a stage or a timeline asked for now is the new one's.`),"check/changed":zc(su,`The check started, ended or failed.`),"export/changed":zc(U({job:cu}),`An export moved on.`),"index/changed":zc(U({jobs:V(lu)}),`Making what the media index lacks moved on.`)},mu=K([`light`,`dark`]),hu=U({locale:P().min(2),theme:mu,agent:U({name:P().min(1)}).optional(),project:U({name:P().min(1)}),item:U({kind:K(Zc),dir:Y,entry:Y}),editor:K(Yc)}),gu=tc(`type`,[U({type:q(`file`),path:Y,line:R().positive().optional()}),U({type:q(`browser`),url:I({protocol:/^https?$/u}).optional(),tabId:P().min(1).optional()})]),_u={"host/context":J(U({}),hu,`Where the editor runs.`),"items/open":J(U({target:gu}),U({}),`Shows another item, a file or a page, where the host shows things.`),"storage/get":J(U({key:P().min(1)}),U({value:B()}),`What the editor kept for this person on this computer (a hand sort, what was last seen), or null.`),"storage/set":J(U({key:P().min(1),value:B()}),U({}),`Keeps a value for this person on this computer; null removes it.`),"editor/state":J(U({state:K([`saved`,`saving`,`unsaved`,`error`]),message:P().optional()}),U({}),`Says whether what the person typed is saved.`),"editor/context":J(U({text:P(),at:U({t:L().nonnegative(),version:P()}).optional(),picture:U({x:L(),y:L(),width:L().positive(),height:L().positive()}).optional()}),U({}),`Tells the host what the editor shows, as MCP Apps' ui/update-model-context does: what a note the person makes on it is about.`),"tools/call":J(U({name:P().min(1),arguments:G(P(),B()).default({})}),U({result:B()}),`Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).`)};({...Kc,...pu});var vu={...Gc,..._u};U({error:U({code:P().regex(/^[a-z][a-z0-9-]*$/u),message:P().min(1),hint:P().optional()})}),H({issuer:I(),authorization_endpoint:I(),token_endpoint:I(),device_authorization_endpoint:I(),revocation_endpoint:I(),code_challenge_methods_supported:V(P()).refine(e=>e.includes(`S256`),{message:`The server must take S256 PKCE challenges.`})}),H({devices:V(H({id:P(),client:P(),signedInAt:Fc(),lastActiveAt:Fc()}))}),H({access_token:P().min(1),token_type:P(),expires_in:L().positive(),refresh_token:P().min(1).optional(),scope:P().optional()}),H({error:P(),error_description:P().optional()}),H({device_code:P().min(1),user_code:P().min(1),verification_uri:I(),verification_uri_complete:I().optional(),expires_in:L().positive(),interval:L().positive().optional()});var yu=U({id:P().min(1),email:Ss(),name:P().optional(),organization:U({id:P().min(1),name:P()}).optional()});U({version:q(1),url:I(),issuer:I(),account:yu,refreshToken:P().min(1),access:U({token:P().min(1),expiresAt:Fc({offset:!0})}).optional(),since:Fc({offset:!0})}),U({accessToken:P().min(1),expiresAt:Fc({offset:!0}),account:yu});var bu=[`allyhub:component`,`allyhub:template`,`allyhub:scenery`,`allyhub:model`,`allyhub:skill`],xu=P().regex(/^[a-z0-9][a-z0-9-]*$/u),Su=U({path:P().min(1),target:P().min(1),sha256:P().regex(/^[0-9a-f]{64}$/u),content:P().optional()}),Cu=U({source:q(`polyhaven`),id:P().min(1),resolution:P().min(1).optional(),maps:V(P().min(1)).optional()}),wu=U({scenery:P().min(1),digest:P().regex(/^[0-9a-f]+$/u),renderer:P().min(1),sha256:P().regex(/^[0-9a-f]{64}$/u),size:L().int().positive(),url:I()}),Tu=U({title:P().min(1),description:P().min(1),prompt:P().min(1).optional()}),Eu=U({category:K([`video`,`writing`,`research`]),order:L().int().positive(),cover:P().optional(),words:Tu,languages:G(P(),Tu.partial()).default({})}),Du=U({$schema:P().optional(),name:xu,type:K(bu),title:P().min(1),description:P().min(1),author:P().optional(),license:P().min(1),dependencies:V(P()).default([]),registryDependencies:V(xu).default([]),files:V(Su).min(1),assets:V(Cu).default([]),bakes:V(wu).default([]),categories:V(P()).default([]),preview:P().optional(),version:P().optional(),card:Eu.optional()});U({$schema:P().optional(),name:P().min(1),homepage:I().optional(),items:V(Du.pick({name:!0,type:!0,title:!0,description:!0,categories:!0,preview:!0,version:!0,card:!0}))});var Ou=[`darwin-arm64`,`darwin-x64`,`linux-x64`,`linux-arm64`,`win32-x64`],ku=P().regex(/^[0-9a-f]{64}$/u),Au=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/u).includes(`..`),{message:`A path stays inside the runtime's folder.`}),ju=U({url:I({protocol:/^https$/u}),sha256:ku,size:R().positive(),unpack:K([`none`,`zip`,`tgz`]).default(`none`),name:Au.optional(),check:V(U({path:Au,sha256:ku})).default([]),executable:z().default(!1),bins:G(P().regex(/^[a-z0-9][a-z0-9-]*$/u),Au).default({})}),Mu=U({about:P().min(1),version:P().min(1),license:P().min(1),homepage:I().optional(),platforms:sc(W([K(Ou),q(`any`)]),V(ju).min(1))});U({$schema:P().optional(),version:q(1),runtimes:G(P().regex(/^[a-z0-9][a-z0-9-]*$/u),Mu)}),H({credits:L(),held:L(),owed:L(),plan:H({id:P(),name:P(),interval:K([`month`,`year`]),status:P(),renewsAt:Fc().nullable(),endsAt:Fc().nullable()}).nullable(),autoTopUp:H({below:L(),amountCents:L(),stopped:P().nullable()}).nullable()}),H({plans:V(H({id:P(),name:P(),monthlyCredits:L(),prices:V(H({interval:K([`month`,`year`]),amountCents:L(),currency:P()}))})),topUp:H({currency:P(),creditsPerDollar:L(),minCents:L(),maxCents:L()})}),H({days:V(H({day:Ic(),credits:L()}))}),W([U({plan:P(),interval:K([`month`,`year`])}),U({topUpCents:L().int()})]),U({below:L().nonnegative(),amountCents:L().int().positive()});var Nu={tier:K([`premium`,`standard`,`efficient`]).optional(),maker:P().min(1).optional()};H({models:V(Qs({id:P().min(1),name:P().min(1),...Nu,reasoning:z().optional(),input:V(P()).optional(),contextWindow:L().int().positive().optional(),maxOutput:L().int().positive().optional()})).min(1),defaultModel:P().min(1),needPlan:V(Qs({id:P().min(1),name:P().min(1),...Nu})).default([])});var Pu=G(P(),B()),Fu=H({meter:P().min(1),credits:L().nonnegative(),field:P().optional(),size:L().int().positive().optional(),free:L().int().nonnegative().optional(),tierField:P().optional(),tiers:G(P(),L().nonnegative()).optional(),typical:L().nonnegative().optional()}),Iu=H({baseCredits:L().nonnegative(),parts:V(Fu)}),Lu=H({id:P().min(1),title:P().min(1),description:P().min(1)}),Ru=H({name:P().min(1),work:P().min(1),title:P().min(1),description:P().min(1),input:Pu,output:Pu,price:Iu,long:z()});H({version:P().min(1),works:V(Lu),tools:V(Ru)}),H({tool:P().min(1),title:P().min(1),credits:L().nonnegative(),estimated:z(),unknown:z()}),U({input:G(P(),B())}),H({id:P().min(1),tool:P().min(1),status:K([`working`,`completed`,`failed`]),output:B().optional(),error:H({kind:P().min(1),message:P().min(1)}).optional(),credits:L().nonnegative().optional(),pollAfterMs:L().int().nonnegative().optional(),createdAt:P(),endedAt:P().optional()}),U({name:P().min(1).max(255),size:R().positive().max(1073741824),sha256:P().regex(/^[0-9a-f]{64}$/u),contentType:P().min(1).max(255)}),H({id:P().min(1),upload:H({url:I(),headers:G(P(),P())}).nullable()}),H({id:P().min(1),name:P()}),H({url:I()}),H({organizations:V(H({id:P(),name:P(),slug:P(),kind:K([`personal`,`team`]),role:P(),dissolvedAt:Fc().nullable()}))}),H({members:V(H({userId:P(),email:P(),name:P(),role:P(),limit:L().nullable(),used:L()}))}),U({monthly:L().nonnegative().nullable()}),H({studio:H({state:K([`running`,`paused`]),organizationId:P()}).nullable(),creditsPerHour:L()}),U({at:Fc().nullable()}),U({path:P().min(1).optional().describe(`The item to open: its folder or entry file, absolute or from the folder allyhub mcp runs in (launch/plan, launch/plan/doc.mdx); leave it out for the project's items`)});var zu=tc(`type`,[U({type:q(`picture`),image:ru,width:R().positive(),height:R().positive(),duration:L().nonnegative().optional()}),U({type:q(`text`),lines:V(P())}),U({type:q(`table`),columns:V(P()),rows:V(V(P())),count:R().nonnegative()})]),Bu=U({kind:K(Zc),dir:Y,entry:Y,title:P().optional()});U({project:U({name:P().min(1)}),url:P().min(1),item:Bu.optional(),preview:zu.optional(),items:V(Bu).optional()});var Vu=3e5,Hu=class{next=1;pending=new Map;listeners=new Map;stop;channel;timeout;constructor(e,t={}){this.channel=e,this.timeout=t.timeout??Vu,this.stop=e.listen(e=>{this.receive(e)})}request(e,t){let n=this.next++;return new Promise((r,i)=>{let a=setTimeout(()=>{this.pending.delete(n),i(new Bc(Rc.unavailable,`${e} had no answer.`))},this.timeout);this.pending.set(n,{resolve:r,reject:i,timer:a});try{this.channel.send({jsonrpc:`2.0`,id:n,method:e,params:t})}catch(e){clearTimeout(a),this.pending.delete(n),i(e instanceof Error?e:Error(String(e)))}})}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}fail(e){for(let[t,n]of this.pending)clearTimeout(n.timer),n.reject(new Bc(Rc.unavailable,e)),this.pending.delete(t)}close(){this.stop(),this.fail(`The host closed.`),this.channel.close?.()}receive(e){if(typeof e!=`object`||!e)return;let t=e;if(t.jsonrpc!==`2.0`)return;if(typeof t.method==`string`&&!(`id`in t)){for(let e of this.listeners.get(t.method)??[])e(t.params);return}if(typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),clearTimeout(n.timer);let r=t.error;r?n.reject(new Bc(r.code,r.message,r.data)):n.resolve(t.result)}},Uu=(e,t,n)=>{let r=e.result.safeParse(t);if(!r.success)throw new Bc(Rc.internal,`The host's answer to ${n} is not what the protocol says.`);return r.data};function Wu(e){let t={on:(t,n)=>e.on(t,n)};for(let[n,r]of Object.entries(vu))t[n]=async t=>Uu(r,await e.request(n,t??{}),n);return t}function Gu(e,t){let n=new Map,r={...e};for(let e of Object.keys(t)){let n=_u[e];r[e]=async r=>{let i=await Vc({[e]:n},{[e]:t[e]},{jsonrpc:`2.0`,id:0,method:e,params:r??{}});if(`error`in i)throw new Bc(i.error.code,i.error.message,i.error.data);return Uu(n,i.result,e)}}return r.on=(t,r)=>{let i=e.on(t,r),a=n.get(t);return a||(a=new Set,n.set(t,a)),a.add(r),()=>{i(),a.delete(r)}},r.notify=(e,t)=>{for(let r of n.get(e)??[])r(t)},r}var Ku=`/rpc`;function qu(e,t){let n=new URL(e);return n.protocol===`http:`?n.protocol=`ws:`:n.protocol===`https:`&&(n.protocol=`wss:`),(n.pathname===`/`||n.pathname===``)&&(n.pathname=Ku),n.searchParams.set(`token`,t),n.toString()}function Ju(e,t){let n=new WebSocket(qu(e,t)),r=[],i,a,o=new Promise((e,t)=>{i=e,a=t});o.catch(()=>void 0);let s,c=new Promise(e=>{s=e}),l=new Hu({send(e){let t=JSON.stringify(e);if(n.readyState===WebSocket.OPEN)n.send(t);else if(n.readyState===WebSocket.CONNECTING)r.push(t);else throw Error(`The connection to allyhub dev is closed.`)},listen(e){let t=t=>{if(typeof t.data==`string`)try{e(JSON.parse(t.data))}catch{}};return n.addEventListener(`message`,t),()=>{n.removeEventListener(`message`,t)}},close(){n.close()}});return n.addEventListener(`open`,()=>{for(let e of r.splice(0))n.send(e);i()}),n.addEventListener(`close`,()=>{a(Error(`The connection to allyhub dev did not open.`)),l.fail(`The connection to allyhub dev closed.`),s()}),Object.assign(Wu(l),{opened:o,closed:c,close:()=>{l.close()}})}async function Yu(e,t,n){let{result:r}=await e[`tools/call`]({name:t,arguments:n}),i=fu[t].result.safeParse(r);if(!i.success)throw new Bc(Rc.internal,`The answer to the tool ${t} is not what the protocol says.`);return i.data}var Xu=8,Zu=e=>{if(!(e instanceof Bc)||e.code!==Rc.conflict)return;let t=e.data;return typeof t?.text==`string`&&(typeof t.version==`string`||t.version===null)?{text:t.text,version:t.version}:void 0},Qu=class e{path;text;version;state=`saved`;error;host;delay;report;format;running;timer;dirty=!1;stale=!1;closed=!1;stops=[];stateListeners=new Set;constructor(e,t,n,r){this.host=e,this.path=t,this.text=n.text,this.version=n.version,this.delay=r.delay??500,this.report=r.report??!0}static async open(t,n,r={}){let i=new e(t,n,await t[`files/read`]({path:n}),r),{watch:a}=await t[`files/watch`]({paths:[n]});return i.stops.push(t.on(`files/changed`,e=>{e.watch===a&&e.changes.some(e=>e.path===n&&e.version!==i.version)&&i.changed()}),()=>{t[`files/unwatch`]({watch:a}).catch(()=>void 0)}),i}attach(e){this.format=e}onState(e){return this.stateListeners.add(e),()=>this.stateListeners.delete(e)}edited(){this.closed||(this.dirty=!0,this.set(`unsaved`),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.kick()},this.delay))}flush(){return clearTimeout(this.timer),this.kick()}changed(){return this.stale=!0,this.kick()}async close(){await this.flush(),this.closed=!0;for(let e of this.stops.splice(0))e()}set(e,t){if(this.error=t,e!==this.state||t!==void 0){this.state=e;for(let t of this.stateListeners)t(e);this.report&&this.host[`editor/state`]&&this.host[`editor/state`]({state:e,...t===void 0?{}:{message:t}}).catch(()=>void 0)}}take(e,t){let n=this.text;this.text=e,this.version=t,e!==n&&this.format?.take(e,n)}waiting(){return this.dirty}kick(){return this.running??=this.loop(),this.running}async loop(){await Promise.resolve();let e=0;try{for(;this.dirty||this.stale;){if(this.stale){this.stale=!1;let e=await this.host[`files/read`]({path:this.path});this.take(e.text,e.version)}if(!this.dirty||!this.format)continue;this.dirty=!1;let t=this.format.save(this.text);if(t===void 0)this.set(`saved`);else{this.set(`saving`);try{let{version:e}=await this.host[`files/write`]({path:this.path,text:t,over:this.version});this.text=t,this.version=e,this.waiting()||this.set(this.format.save(this.text)===void 0?`saved`:`unsaved`)}catch(t){let n=Zu(t);if(!n){this.set(`error`,t instanceof Error?t.message:String(t));continue}if(this.take(n.text,n.version),++e>=Xu){this.set(`error`,`${this.path} keeps changing.`);continue}this.dirty=!0}}}}catch(e){this.dirty=!1,this.stale=!1,this.set(`error`,e instanceof Error?e.message:String(e))}finally{this.running=void 0}}},$u=`allyhub.stage-sandbox`;function ed(e){let t=e;return typeof t==`object`&&!!t&&t.allyhub===!0&&t.type===`probe`}function td(e){try{let t=e?.getItem($u);return t===`1`||t!==`0`&&void 0}catch{return}}async function nd(e){let t=td(e.storage);if(t!==void 0)return t;let n,r=()=>void 0,i=await new Promise(t=>{n=setTimeout(()=>{t(!1)},e.ms??1500),r=e.open(()=>{t(!0)})});clearTimeout(n),r();try{e.storage?.setItem($u,i?`1`:`0`)}catch{}return i}function rd(e){return t=>{let n=document.createElement(`iframe`);n.setAttribute(`sandbox`,`allow-scripts`),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.cssText=`position:fixed;width:1px;height:1px;left:-10px;top:-10px;border:0;opacity:0`;let r=e=>{e.source===n.contentWindow&&ed(e.data)&&t()};return window.addEventListener(`message`,r),n.src=e,document.body.append(n),()=>{window.removeEventListener(`message`,r),n.remove()}}}var id;function ad(e){let t;try{t=sessionStorage}catch{t=void 0}return id??=nd({open:rd(e),storage:t}),id}var od=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,ee=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let ee=c&&c.oldPos+1<o;if(!u&&!ee)d[r]=void 0;else{if(s=!ee||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);ee()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=ee();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends od{};function sd(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function cd(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function ld(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function ud(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function dd(e,t){return ld(e,t,``)}function fd(e,t){return ud(e,t,``)}function pd(e,t){return t.slice(0,md(e,t))}function md(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function hd(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function gd(e,t){if(t)return vd(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function _d(e,t){if(t)return vd(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function vd(e,t){if(!t)return[_d(e),gd(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=hd(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var yd=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,bd=RegExp(`[${yd}]+|\\s+|[^${yd}]`,`ug`);new class extends od{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=hd(e,r)}else n=e.match(bd)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&xd(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&xd(n,i,r,null,t.intlSegmenter),e}};function xd(e,t,n,r,i){if(t&&n){let[a,o]=vd(t.value,i),[s,c]=vd(n.value,i);if(e){let r=sd(a,s);e.value=ud(e.value,s,r),t.value=dd(t.value,r),n.value=dd(n.value,r)}if(r){let e=cd(o,c);r.value=ld(r.value,c,e),t.value=fd(t.value,e),n.value=fd(n.value,e)}}else if(n){if(e){let e=_d(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=_d(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=_d(r.value,i),[a,o]=vd(t.value,i),s=sd(n,a);t.value=dd(t.value,s);let c=cd(dd(n,s),o);t.value=fd(t.value,c),r.value=ld(r.value,n,c),e.value=ud(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=_d(r.value,i),n=pd(gd(t.value,i),e);t.value=fd(t.value,n)}else if(e){let n=pd(gd(e.value,i),_d(t.value,i));t.value=dd(t.value,n)}}new class extends od{tokenize(e){let t=RegExp(`(\\r?\\n)|[${yd}]+|[^\\S\\n\\r]+|[^${yd}]`,`ug`);return e.match(t)||[]}},new class extends od{constructor(){super(...arguments),this.tokenize=Sd}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
56
+ 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function $a(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;$a(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var eo=new Set([`type`,`properties`,`required`,`additionalProperties`]),to=[`oneOf`,`anyOf`];function no(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ro(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!eo.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??no(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:ro(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=no(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function io(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of eo)if(t in e)return;let n=t.filter(e=>to.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ro(t);else{let e=n[0],i=to.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ro([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ja(e,r))}function ao(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)):Ja(i,s),Ja(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())$a(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])io(e)}}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)}Ja(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:so(t,`input`,e.processors),output:so(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function A(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 A(r.element,n);if(r.type===`set`)return A(r.valueType,n);if(r.type===`lazy`)return A(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`||r.type===`catch`)return A(r.innerType,n);if(r.type===`intersection`)return A(r.left,n)||A(r.right,n);if(r.type===`record`||r.type===`map`)return A(r.keyType,n)||A(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:A(r.in,n)||A(r.out,n);if(r.type===`object`){for(let e in r.shape)if(A(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(A(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(A(e,n))return!0;return!!(r.rest&&A(r.rest,n))}return!1}var oo=(e,t={})=>n=>{let r=Ya({...n,processors:t});return k(e,r),Qa(r,e),ao(r,e)},so=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ya({...i??{},target:a,io:t,processors:n});return k(e,o),Qa(o,e),ao(o,e)},co=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},lo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},uo=(e,t)=>{co(e,`minimum`,t),lo(e,`maximum`,t)},fo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},po=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},mo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ho=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},go=(e,t)=>co(e,`minimum`,t.minimum),_o=(e,t)=>lo(e,`maximum`,t.maximum),vo=e=>(t,n)=>{ho(t,n.format);let[r,i]=e[n.format];co(t,`minimum`,r),lo(t,`maximum`,i)},yo={greater_than:(e,t)=>co(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>lo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>fo(e,t.value),number_format:vo(Se),bigint_format:vo(Ce),min_length:go,max_length:_o,length_equals:(e,t)=>uo(e,t.length),min_size:go,max_size:_o,size_equals:(e,t)=>uo(e,t.size),string_format:(e,t)=>{ho(e,t.format),t.pattern&&po(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>mo(e,t.mime)};function j(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)yo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&co(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&co(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&lo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&lo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&fo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&mo(t,i.mime);for(let e of i.patterns??[])po(t,e);return t}var bo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},xo=new Map([[vr,tn],[br,nn]]),So=e=>xo.get(e)??e,Co=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=j(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=bo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(So);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}))])}},wo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=j(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Xa(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},To=(e,t,n,r)=>{n.type=`boolean`},Eo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Do=(e,t,n,r)=>{n.not={}},Oo=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},ko=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Xa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Xa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Ao=(e,t,n,r)=>{Xa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{Xa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=j(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=k(a.element,t,{...r,path:[...r.path,`items`]})};function No(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?No(t.out):t.type===`catch`?No(t.innerType):e._zod.optin}var Po=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Xa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,k(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?No(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=k(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>k(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Io=(e,t,n,r)=>{let i=e._zod.def,a=k(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>k(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?k(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?No(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=j(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Ro(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ro(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ro(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?mn:pn).source)),p}var zo=new WeakMap;function Bo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of zo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ro(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Vo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=j(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=k(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,So(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=k(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=zo.get(t);n||(n=[],zo.set(t,n),t.deferred.push(()=>Bo(t))),n.push(e)}i.additionalProperties=k(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&No(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ho=(e,t,n,r)=>{let i=e._zod.def,a=k(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`}]},Uo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wo=Symbol();function Go(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Xa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Wo):JSON.parse(o)}var Ko=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Go(i.defaultValue,e,t,n,r);o!==Wo&&(n.default=o)},qo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Go(i.defaultValue,e,t,n,r);o!==Wo&&(n._prefault=o)},Jo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Xa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Yo=(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;k(o,t,r);let s=t.seen.get(e);s.ref=o},Xo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Zo=(e,t,n,r)=>{let i=e._zod.def;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qo=(e,t,n,r)=>{let i=e._zod.innerType;k(i,t,r);let a=t.seen.get(e);a.ref=i},$o=new WeakSet([Object.prototype,Error.prototype]);function es(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var M=C(`ZodError`,(e,t)=>{pt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);$o.has(n)||($o.add(n),es(n,`format`,e=>t=>gt(e,t)),es(n,`flatten`,e=>t=>ht(e,t)),es(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,m,2)}),es(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,m,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ts=bt(M),ns=xt(M),rs=St(M),is=wt(M),as=At(M),os=jt(M),ss=Mt(M),cs=Nt(M),ls=Pt(M),us=Ft(M),ds=It(M),fs=Lt(M);function ps(){w.localeError||T(zi())}function ms(){w.memoizer||T({memoizer:Ii()})}var N=C(`ZodType`,(e,t)=>(ps(),D.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(y(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 ye(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Nc(e,t))},superRefine(e,t){return this.check(Pc(e,t))},overwrite(e){return this.check(Ra(e))},optional(){return pc(this)},exactOptional(){return hc(this)},nullable(){return _c(this)},nullish(){return pc(_c(this))},nonoptional(e){return Cc(this,e)},array(){return V(this)},or(e){return W([this,e])},and(e){return rc(this,e)},transform(e){return Dc(this,dc(e))},default(e){return yc(this,e)},prefault(e){return xc(this,e)},catch(e){return Tc(this,e)},pipe(e){return Dc(this,e)},readonly(){return kc(this)},describe(e){let t=this.clone();return Ui.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ui.get(this);let t=this.clone();return Ui.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ke(this,`~standard`,{...Bn(this),jsonSchema:{input:so(this,`input`),output:so(this,`output`)}})},set"~standard"(e){Ge(this,`~standard`,e)},parse:function e(t,n){return ts(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ns(this,t,n,{callee:e})},safeParse(e,t){return rs(this,e,t)},async safeParseAsync(e,t){return is(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ge(this,`spa`,e)},validate(e,t){return Dt(this,e,t)},validateAsync(e,t){return kt(this,e,t)},encode:function e(t,n){return as(this,t,n,{callee:e})},decode:function e(t,n){return os(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ss(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await cs(this,t,n,{callee:e})},safeEncode(e,t){return ls(this,e,t)},safeDecode(e,t){return us(this,e,t)},async safeEncodeAsync(e,t){return ds(this,e,t)},async safeDecodeAsync(e,t){return fs(this,e,t)},toJSONSchema(e){return oo(this,{})(e)},get description(){return Ui.get(this)?.description},get _def(){return this._zod.def}}),hs=C(`_ZodString`,(e,t)=>{Vn.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)},qe({format:e=>j(e).format??null,minLength:e=>j(e).minimum??null,maxLength:e=>j(e).maximum??null},{regex(...e){return this.check(Ma(...e))},includes(...e){return this.check(Fa(...e))},startsWith(...e){return this.check(Ia(...e))},endsWith(...e){return this.check(La(...e))},min(...e){return this.check(Aa(...e))},max(...e){return this.check(ka(...e))},length(...e){return this.check(ja(...e))},nonempty(...e){return this.check(Aa(1,...e))},lowercase(e){return this.check(Na(e))},uppercase(e){return this.check(Pa(e))},trim(){return this.check(Ba())},normalize(...e){return this.check(za(...e))},toLowerCase(){return this.check(Va())},toUpperCase(){return this.check(Ha())},slugify(){return this.check(Ua())}})),gs=C(`ZodString`,(e,t)=>{Vn.init(e,t),hs.init(e,t)},{email(e){return this.check(Ki(xs,e))},url(e){return this.check(Qi(Ts,e))},jwt(e){return this.check(pa(Vs,e))},emoji(e){return this.check($i(Es,e))},guid(e){return this.check(qi(Cs,e))},uuid(e){return this.check(Ji(ws,e))},uuidv4(e){return this.check(Yi(ws,e))},uuidv6(e){return this.check(Xi(ws,e))},uuidv7(e){return this.check(Zi(ws,e))},nanoid(e){return this.check(ea(Ds,e))},cuid(e){return this.check(ta(Os,e))},cuid2(e){return this.check(na(ks,e))},ulid(e){return this.check(ra(As,e))},base64(e){return this.check(ua(Ls,e))},base64url(e){return this.check(da(zs,e))},xid(e){return this.check(ia(js,e))},ksuid(e){return this.check(aa(Ms,e))},ipv4(e){return this.check(oa(Ns,e))},ipv6(e){return this.check(sa(Ps,e))},cidrv4(e){return this.check(ca(Fs,e))},cidrv6(e){return this.check(la(Is,e))},e164(e){return this.check(fa(Bs,e))},datetime(e){return this.check(ma(_s,e))},date(e){return this.check(ha(vs,e))},time(e){return this.check(ga(ys,e))},duration(e){return this.check(_a(bs,e))}});function P(e){return Gi(gs,e)}var F=C(`ZodStringFormat`,(e,t)=>{O.init(e,t),hs.init(e,t)}),_s=C(`ZodISODateTime`,(e,t)=>{or.init(e,t),F.init(e,t)}),vs=C(`ZodISODate`,(e,t)=>{sr.init(e,t),F.init(e,t)}),ys=C(`ZodISOTime`,(e,t)=>{cr.init(e,t),F.init(e,t)}),bs=C(`ZodISODuration`,(e,t)=>{lr.init(e,t),F.init(e,t)}),xs=C(`ZodEmail`,(e,t)=>{Wn.init(e,t),F.init(e,t)});function Ss(e){return Ki(xs,e)}var Cs=C(`ZodGUID`,(e,t)=>{Hn.init(e,t),F.init(e,t)}),ws=C(`ZodUUID`,(e,t)=>{Un.init(e,t),F.init(e,t)}),Ts=C(`ZodURL`,(e,t)=>{Qn.init(e,t),F.init(e,t)});function I(e){return Qi(Ts,e)}var Es=C(`ZodEmoji`,(e,t)=>{$n.init(e,t),F.init(e,t)}),Ds=C(`ZodNanoID`,(e,t)=>{er.init(e,t),F.init(e,t)}),Os=C(`ZodCUID`,(e,t)=>{tr.init(e,t),F.init(e,t)}),ks=C(`ZodCUID2`,(e,t)=>{nr.init(e,t),F.init(e,t)}),As=C(`ZodULID`,(e,t)=>{rr.init(e,t),F.init(e,t)}),js=C(`ZodXID`,(e,t)=>{ir.init(e,t),F.init(e,t)}),Ms=C(`ZodKSUID`,(e,t)=>{ar.init(e,t),F.init(e,t)}),Ns=C(`ZodIPv4`,(e,t)=>{ur.init(e,t),F.init(e,t)}),Ps=C(`ZodIPv6`,(e,t)=>{pr.init(e,t),F.init(e,t)}),Fs=C(`ZodCIDRv4`,(e,t)=>{mr.init(e,t),F.init(e,t)}),Is=C(`ZodCIDRv6`,(e,t)=>{gr.init(e,t),F.init(e,t)}),Ls=C(`ZodBase64`,(e,t)=>{yr.init(e,t),F.init(e,t)});function Rs(e){return ua(Ls,e)}var zs=C(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),F.init(e,t)}),Bs=C(`ZodE164`,(e,t)=>{Cr.init(e,t),F.init(e,t)}),Vs=C(`ZodJWT`,(e,t)=>{Tr.init(e,t),F.init(e,t)}),Hs=C(`ZodNumber`,(e,t)=>{Er.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.isFinite=!0},qe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=j(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=j(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=j(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>j(e).format??null},{gt(e,t){return this.check(Ea(e,t))},gte(e,t){return this.check(Da(e,t))},min(e,t){return this.check(Da(e,t))},lt(e,t){return this.check(wa(e,t))},lte(e,t){return this.check(Ta(e,t))},max(e,t){return this.check(Ta(e,t))},int(e){return this.check(R(e))},safe(e){return this.check(R(e))},positive(e){return this.check(Ea(0,e))},nonnegative(e){return this.check(Da(0,e))},negative(e){return this.check(wa(0,e))},nonpositive(e){return this.check(Ta(0,e))},multipleOf(e,t){return this.check(Oa(e,t))},step(e,t){return this.check(Oa(e,t))},finite(){return this}}));function L(e){return va(Hs,e)}var Us=C(`ZodNumberFormat`,(e,t)=>{Dr.init(e,t),Hs.init(e,t)});function R(e){return ya(Us,e)}var Ws=C(`ZodBoolean`,(e,t)=>{Or.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function z(e){return ba(Ws,e)}var Gs=C(`ZodNull`,(e,t)=>{kr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function Ks(e){return xa(Gs,e)}var qs=C(`ZodUnknown`,(e,t)=>{Ar.init(e,t),N.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function B(){return Sa(qs)}var Js=C(`ZodNever`,(e,t)=>{jr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Ys(e){return Ca(Js,e)}var Xs=C(`ZodArray`,(e,t)=>{ms(),Fr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Aa(e,t))},nonempty(e){return this.check(Aa(1,e))},max(e,t){return this.check(ka(e,t))},length(e,t){return this.check(ja(e,t))},unwrap(){return this.element}});function V(e,t){return Wa(Xs,e,t)}var Zs=C(`ZodObject`,(e,t)=>{ms(),Vr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),$e(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(y(this._zod.def,{catchall:e}))},passthrough(){return this.clone(y(this._zod.def,{catchall:B()}))},loose(){return this.clone(y(this._zod.def,{catchall:B()}))},strict(){return this.clone(y(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(y(this._zod.def,{catchall:void 0}))},extend(e){return De(this,e)},safeExtend(e){return ke(this,e)},merge(e){return Ae(this,e)},pick(e){return we(this,e)},omit(e){return Ee(this,e)},partial(...e){return je(fc,this,e[0])},exactPartial(...e){return je(mc,this,e[0],`exactPartial`)},required(...e){return Me(Sc,this,e[0])}});function H(e,t){return new Zs({type:`object`,shape:e??{},...b(t)})}function U(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...b(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:B(),...b(t)})}var $s=C(`ZodUnion`,(e,t)=>{Ur.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.options=t.options});function W(e,t){return new $s({type:`union`,options:e,...b(t)})}var ec=C(`ZodDiscriminatedUnion`,(e,t)=>{$s.init(e,t),Gr.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...b(n)})}var nc=C(`ZodIntersection`,(e,t)=>{Kr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}var ic=C(`ZodTuple`,(e,t)=>{ms(),Yr.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new fc({type:`optional`,innerType:e}))})}});function ac(e,t,n){let r=t instanceof D;return new ic({type:`tuple`,items:e,rest:r?t:null,...b(r?n:t)})}var oc=C(`ZodRecord`,(e,t)=>{ms(),$r.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,n){return!t||!t._zod?new oc({type:`record`,keyType:P(),valueType:e,...b(t)}):new oc({type:`record`,keyType:e,valueType:t,...b(n)})}function sc(e,t,n){return new oc({type:`record`,keyType:e,valueType:t,...b(n),partial:!0})}var cc=C(`ZodEnum`,(e,t)=>{ei.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 cc({...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 cc({...t,checks:[],...b(r),entries:i})}});function K(e,t){return new cc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var lc=C(`ZodLiteral`,(e,t)=>{ti.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(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 q(e,t){return new lc({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var uc=C(`ZodTransform`,(e,t)=>{ms(),ni.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new st(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ue(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ue(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function dc(e){return new uc({type:`transform`,transform:e})}var fc=C(`ZodOptional`,(e,t)=>{ii.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}var mc=C(`ZodExactOptional`,(e,t)=>{ai.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`optional`,innerType:e})}var gc=C(`ZodNullable`,(e,t)=>{oi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new gc({type:`nullable`,innerType:e})}var vc=C(`ZodDefault`,(e,t)=>{si.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yc(e,t){return new vc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ge(t)}})}var bc=C(`ZodPrefault`,(e,t)=>{li.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ge(t)}})}var Sc=C(`ZodNonOptional`,(e,t)=>{ui.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e,t){return new Sc({type:`nonoptional`,innerType:e,...b(t)})}var wc=C(`ZodCatch`,(e,t)=>{pi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tc(e,t){return new wc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:tt(t)})}var Ec=C(`ZodPipe`,(e,t)=>{mi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.in=t.in,e.out=t.out});function Dc(e,t){return new Ec({type:`pipe`,in:e,out:t})}var Oc=C(`ZodReadonly`,(e,t)=>{gi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`readonly`,innerType:e})}var Ac=C(`ZodLazy`,(e,t)=>{vi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function jc(e){return new Ac({type:`lazy`,getter:e})}var Mc=C(`ZodCustom`,(e,t)=>{yi.init(e,t),N.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function Nc(e,t={}){return Ga(Mc,e,t)}function Pc(e,t){return Ka(e,t)}function Fc(e){return ma(_s,e)}function Ic(e){return ha(vs,e)}U({jsonrpc:q(`2.0`),id:W([P(),R()]),method:P().min(1),params:B().optional()}),U({jsonrpc:q(`2.0`),method:P().min(1),params:B().optional()});var Lc=U({code:R(),message:P(),data:B().optional()});W([U({jsonrpc:q(`2.0`),id:W([P(),R()]),result:B()}),U({jsonrpc:q(`2.0`),id:W([P(),R(),Ks()]),error:Lc})]);var Rc={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,conflict:-32001,notFound:-32002,invalid:-32003,forbidden:-32004,unavailable:-32005},J=(e,t,n)=>({params:e,result:t,about:n}),zc=(e,t)=>({params:e,about:t}),Bc=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RpcError`,this.code=e,this.data=n}};async function Vc(e,t,n){let{id:r}=n,i=Object.hasOwn(e,n.method)?e[n.method]:void 0;if(!i)return{jsonrpc:`2.0`,id:r,error:{code:Rc.methodNotFound,message:`There is no method "${n.method}".`}};let a=i.params.safeParse(n.params??{});if(!a.success)return{jsonrpc:`2.0`,id:r,error:{code:Rc.invalidParams,message:vt(a.error)}};try{let e=t[n.method],o=await e(a.data);return{jsonrpc:`2.0`,id:r,result:i.result.parse(o)}}catch(e){return e instanceof Bc?{jsonrpc:`2.0`,id:r,error:{code:e.code,message:e.message,...e.data===void 0?{}:{data:e.data}}}:{jsonrpc:`2.0`,id:r,error:{code:Rc.internal,message:e instanceof Error?e.message:String(e)}}}}var Y=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(`/`).includes(`..`),{message:`A path is inside the project.`}),Hc=P().regex(/^[0-9a-f]{64}$/u).nullable(),Uc=U({kind:K([`person`,`agent`,`tool`]),name:P().min(1)}),Wc=U({path:Y,size:R().nonnegative(),modified:L()}),Gc={"files/read":J(U({path:Y}),U({text:P(),version:Hc}),`A text file, with its version; a file that is not there reads as empty with version null.`),"files/write":J(U({path:Y,text:P(),over:Hc}),U({version:Hc}),`Writes a text file over the version read. Errors: conflict (data: { text, version }) when it changed; invalid (data: { problems }) when its format refuses it.`),"files/upload":J(U({dir:Y,name:P().min(1),data:Rs()}),U({path:Y}),`Keeps a file the person added, under a free name in the folder.`),"files/url":J(U({path:Y}),U({url:P()}),`An address a page can load the file from (a picture, a video).`),"files/list":J(U({dir:P()}),U({files:V(Wc),dirs:V(Y)}),`A folder's files and folders, as on disk.`),"files/move":J(U({from:Y,to:Y}),U({rewritten:V(Y)}),`Moves a file or a folder, and rewrites the relative imports and links that pointed at it, as an editor does.`),"files/remove":J(U({path:Y}),U({trash:P()}),`Moves a file or folder to the recycle bin (nothing is deleted).`),"files/trash":J(U({}),U({entries:V(U({id:P(),path:Y,removed:L()}))}),`What the recycle bin holds.`),"files/restore":J(U({id:P()}),U({path:Y}),`Puts a removed thing back where it was; refused while something is there.`),"files/watch":J(U({paths:V(Y).min(1)}),U({watch:P()}),"Starts telling `files/changed` for these files or folders."),"files/unwatch":J(U({watch:P()}),U({}),`Stops a watch.`)},Kc={"files/changed":zc(U({watch:P(),changes:V(U({path:Y,version:Hc,by:Uc.optional()}))}),`Files under a watch changed, other than by this client's own writes.`)},qc=[`ts`,`tsx`,`mts`,`js`,`jsx`,`mjs`],Jc=e=>qc.map(t=>`${e}.${t}`),Yc=[`video`,`slides`,`doc`,`sheet`,`scenery`,`website`],Xc={video:{entries:Jc(`video`),editor:`video`,name:`video`},slides:{entries:Jc(`slides`),editor:`slides`,name:`slides`},doc:{entries:[`doc.mdx`],editor:`doc`,name:`doc`},sheet:{entries:[`sheet.csv`],editor:`sheet`,name:`sheet`},scenery:{entries:Jc(`scenery`),editor:`scenery`,name:`3D scenery`},website:{entries:[`astro.config.mjs`,`astro.config.ts`,`astro.config.mts`,`astro.config.js`],editor:`website`,name:`website`}},Zc=Object.keys(Xc);new Map(Zc.flatMap(e=>Xc[e].entries.map(t=>[t,e])));var Qc=P().regex(/^[0-9a-f]{64}$/u,`A sha256 is 64 lowercase hexadecimal digits.`),X=L().nonnegative(),$c=Fc({offset:!0});function el(e){return U({$schema:P().optional(),...e})}var tl=tc(`type`,[U({type:q(`quote`),exact:P().min(1),prefix:P().optional(),suffix:P().optional()}),U({type:q(`cells`),range:P().regex(/^[A-Z]+[1-9]\d*(?::[A-Z]+[1-9]\d*)?$/u)}),U({type:q(`item`)})]),nl=U({kind:K([`person`,`agent`]),name:P().min(1)}),rl=U({id:P().min(1),author:nl,text:P().min(1),at:$c}),il=U({id:P().min(1),target:tl,resolved:z().default(!1),comments:V(rl).min(1)}),al=el({version:q(1),threads:V(il).default([])}),ol=U({fonts:V(P().min(1)).default([]),text:P().optional(),locales:V(P().min(2)).min(1).optional(),look:G(P(),B()).optional(),defaults:G(P(),B()).optional()}),sl=U({from:X,to:X}).refine(e=>e.to>e.from,{message:`A stretch ends after its start.`,path:[`to`]}),cl=L().min(0).max(2),ll=el({version:q(1),take:P().optional(),remove:V(U({from:R().nonnegative(),to:R().nonnegative(),text:P().optional()}).refine(e=>e.to>=e.from,{message:`A range ends at or after its start.`,path:[`to`]})).optional(),sounds:V(sl).optional(),inWord:V(sl).optional(),maxPause:L().min(.05).max(10).optional(),pad:U({before:cl.optional(),after:cl.optional()}).optional()}),ul=ac([L(),L(),L().nonnegative(),L().nonnegative()]),dl=G(P().min(1),ul);U({omitted:q(!0),sha256:Qc,bytes:R().nonnegative()});var fl=el({version:q(1),ai:z(),tool:P().optional(),model:P().optional(),input:G(P(),B()).optional(),inputHash:Qc.optional(),output:G(P(),B()).optional(),credits:L().nonnegative().optional(),at:$c,sha256:Qc,bytes:R().nonnegative(),source:U({library:P(),page:I(),authors:V(P()).default([]),license:P()}).optional()}),pl=/^[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/u,ml=U({display:P(),speak:P()}),hl=U({declarations:V(P()).default([]),selectors:V(P()).default([]),match:G(P(),P()).refine(e=>Object.keys(e).length>0,`A match needs at least one case.`)}),gl=W([P(),ml,ac([hl])]),_l=G(P(),B()).superRefine((e,t)=>{for(let[n,r]of Object.entries(e)){if(n===`$schema`){typeof r!=`string`&&t.addIssue({code:`custom`,path:[n],message:`$schema is a string.`});continue}pl.test(n)||t.addIssue({code:`custom`,path:[n],message:`"${n}" is not a message key: letters, digits, _ and -, in segments joined by dots.`});let e=gl.safeParse(r);e.success||t.addIssue({code:`custom`,path:[n],message:Array.isArray(r)?`A message with variants is [{ "declarations": […], "selectors": […], "match": {…} }]: ${e.error.issues.map(e=>e.message).join(`; `)}`:`A message is a string, { display, speak }, or [{ declarations, selectors, match }].`})}}).transform(e=>{let t={...e};return delete t.$schema,t}),vl=ac([L(),L(),L(),L()]),yl=H({t:X,score:L()}),Z=L().nullable(),Q=L().int().nonnegative(),bl=H({index:Q,start:X,end:X,words:ac([L().int(),L().int()]),text:P(),punctuation:z(),pauseAfter:X.optional()}),xl=H({after:Q,start:X,end:X,dur:X}),Sl=H({t:X,cut:yl.optional(),weak:yl.optional(),pause:H({start:X,end:X,dur:X}).optional(),sentence:Q.optional()}),Cl=H({id:Q,text:P(),box:vl,height:L(),conf:L(),words:Q,upper:L().min(0).max(1),start:X,end:X,spans:V(ac([X,X])),seconds:X,seen:L().int().positive(),frames:L().min(0).max(1),spread:L().min(0).max(1),said:L().min(0).max(1)}),wl=H({start:X,end:X,dur:X,said:P(),words:Q,wordsPerMinute:L().nonnegative(),cuts:V(X),shots:L().int().positive(),cutsPerMinute:L().nonnegative(),text:V(Q),textSeconds:X}).extend({index:Q,name:P(),sentences:ac([L().int(),L().int()]).optional()}),Tl=H({cutsPerMinute:L().nonnegative(),meanShot:X,medianShot:X,wordsPerMinute:L().nonnegative(),speakingRate:L().nonnegative(),timeToFirstWord:X.optional(),timeToFirstCut:X.optional(),textShare:L().min(0).max(1),speechShare:L().min(0).max(1),tempo:H({bpm:L().positive(),confidence:L().min(0),candidates:V(H({bpm:L(),r:L(),score:L()})).optional(),prior:L().optional()}).optional(),onsetsPerMinute:L().nonnegative()}),El=H({seconds:X,p10:L(),median:L(),p90:L()}),Dl=H({gap:X,edge:X,voiced:L().min(0).max(100),whole:El,words:El.optional(),between:El.extend({voicedShare:L().min(0).max(1),onsetsPerMinute:L().nonnegative()}).optional(),floor:L()}),Ol=H({params:G(P(),B()),frames:H({tone:Q,color:Q,motion:Q}),luma:H({p1:Z,p50:Z,p99:Z}),blackShare:Z,noise:Z,sharpness:Z,saturation:Z,warmth:Z,motion:H({speed:H({p50:Z,p90:Z}),shake:H({p50:Z,p90:Z}),stillShare:Z,runs:Q}),sharpnessBySpeed:V(H({from:L(),to:Z,frames:Q,sharpness:Z})),noiseByLuma:V(H({from:L(),to:L(),blocks:Q,noise:Z,median:Z})),shake:V(H({start:X,end:X,rms:L(),peaks:V(H({hz:L(),share:L()})),flatness:L()}))}),kl=H({frames:Q,reach:V(H({drop:L(),hz:Z})),rolloff95:Z,rolloff99:Z,steps:V(H({hz:L(),db:L()}))}),Al=H({loudness:H({integrated:Z,range:Z,truePeak:Z}),recording:H({params:G(P(),B()),spectrum:V(H({hz:L(),db:L()})),dynamics:H({spread:L(),crest:L()})}).loose(),bandwidth:kl.extend({params:G(P(),B())}),voice:kl.optional()}),jl=H({item:P(),combo:G(P(),P()),format:P(),platform:P().optional(),export:H({type:P(),crf:L().optional(),maxKbps:L().optional()}),video:H({codec:P(),profile:P().optional(),kbps:L(),width:L().int().positive(),height:L().int().positive(),fps:L().positive(),preset:P().optional()}).optional(),audio:W([H({codec:P(),kbps:L(),rate:L(),channels:L()}),H({missing:P(),instead:P()})]),joins:V(H({t:X,kind:P(),part:P().optional(),score:L(),margin:L(),cut:z()})),unmeant:V(H({t:X,score:L(),margin:L()}))});H({version:q(1),id:P(),source:H({file:P(),url:P().optional(),title:P().optional(),sha256:Qc}),analysedAt:P(),duration:X,width:L().int().positive(),height:L().int().positive(),fps:L().positive(),encoding:H({codec:P().optional(),bitrate:L().positive().optional(),audio:H({codec:P().optional(),profile:P().optional(),bitrate:L().positive().optional(),rate:L().positive().optional(),channels:L().int().positive().optional()}).optional()}).optional(),words:P().optional(),wordCount:Q,asr:P().optional(),wordsMissing:H({code:P().optional(),message:P(),hint:P().optional(),instead:P()}).optional(),shots:H({threshold:L().min(0).max(1),minShot:L().nonnegative(),weakFloor:L().min(0).max(1),prominence:L().nonnegative(),cuts:V(yl),weak:V(yl),candidates:V(H({t:X,score:L(),source:K([`jump`,`change`]),around:L(),passes:z()})).optional()}),speech:H({pause:X,sentences:V(bl),pauses:V(xl),gaps:V(xl).optional()}),boundaries:H({cutWithin:X,candidates:V(Sl)}),ocr:H({engine:P(),confidence:H({word:L().min(0).max(100),short:L().min(0).max(100)}),frames:Q,samePlace:L(),saidWithin:X,low:V(H({t:X,text:P(),conf:L(),box:vl})).optional()}),text:V(Cl),pacing:Tl,sound:Dl.optional(),segments:H({rule:P(),pause:X,cutWithin:X,minLength:X,list:V(wl).min(1)}),sheets:V(P()),picture:Ol,audio:Al.optional(),served:jl.optional()});var Ml=U({start:X,end:X,name:P().min(1).optional(),role:P().min(1).optional(),picture:P().optional(),onScreen:V(P()).optional(),notes:P().optional()}),Nl=el({version:q(1).default(1),summary:P().optional(),layout:P().optional(),hook:P().optional(),sections:V(Ml).min(1),captions:U({lines:V(Q).optional(),style:P().optional()}).optional(),watermarks:V(Q).optional(),notes:P().optional(),labels:G(P(),W([P(),L(),z(),V(P())])).optional()}),Pl=P().regex(/^[A-Za-z0-9_-]+$/u,`A name is letters, digits, _ and -.`),Fl=jc(()=>W([P(),ml,hl,V(Fl),G(Pl,Fl)])),Il=U({id:Pl,say:W([P(),hl]).optional(),screen:G(Pl,Fl).optional()}),Ll=U({title:P().optional(),text:G(Pl,Fl).optional(),parts:V(Il).default([])}).superRefine((e,t)=>{let n=new Set;e.parts.forEach((e,r)=>{n.has(e.id)&&t.addIssue({code:`custom`,path:[`parts`,r,`id`],message:`Two parts are "${e.id}".`}),n.add(e.id)})}),Rl=[`text`,`number`,`select`,`multi-select`,`date`,`checkbox`,`url`,`email`,`phone`,`file`],zl=[`gray`,`brown`,`red`,`orange`,`yellow`,`green`,`blue`,`purple`,`pink`],Bl=P().regex(/\S/u),Vl=W([P().regex(/\S/u),L(),z(),U({name:W([P().regex(/\S/u),L()]),color:K(zl).optional()})]),Hl=e=>String(typeof e==`object`?e.name:e).trim(),Ul=P().regex(/^[^"]*[^"\s][^"]*$/u),Wl=K([`plain`,`percent`,`currency`]),Gl=W([Wl,U({style:Wl.nullable().optional(),decimals:R().min(0).max(10).optional(),currency:P().regex(/^[A-Za-z]{3}$/u).optional(),thousands:z().optional()})]),Kl=K([`iso`,`short`,`long`]),ql=W([Kl,U({style:Kl.nullable().optional(),time:z().optional()})]),Jl={width:L().positive().optional(),wrap:z().optional()};function Yl(e,t){let n=e.separator??`;`,r=new Set;(e.options??[]).forEach((e,i)=>{let a=Hl(e);a.includes(n)&&t.addIssue({code:`custom`,path:[`options`,i],message:`"${a}" has the separator ${JSON.stringify(n)} in it`}),r.has(a)&&t.addIssue({code:`custom`,path:[`options`,i],message:`"${a}" is an option twice`}),r.add(a)})}var Xl=W([U({type:K([`text`,`checkbox`,`url`,`email`,`phone`]).nullable().optional(),...Jl}),U({type:q(`number`),format:Gl.optional(),...Jl}),U({type:q(`date`),format:ql.optional(),...Jl}),U({type:q(`select`),options:V(Vl).optional(),...Jl}).superRefine(Yl),U({type:q(`multi-select`),options:V(Vl).optional(),separator:Ul.optional(),...Jl}).superRefine(Yl),U({type:q(`file`),separator:Ul.optional(),height:L().positive().optional(),...Jl})]),Zl=W([Ks(),K(Rl),Xl]),Ql=W([Ks(),U({title:W([P(),L()]).optional(),key:Bl.optional(),primary:Bl.optional(),columns:W([Ks(),G(P(),Zl)]).optional()})]),$l=U({text:P().min(1),start:X,end:X,confidence:L().min(0).max(1).optional()}).refine(e=>e.end>=e.start,{message:`A word ends at or after its start.`,path:[`end`]}),eu={words:{schema:el({version:q(1),language:P().min(2).optional(),duration:X.optional(),model:P().optional(),words:V($l)}).refine(e=>e.words.every((t,n)=>n===0||t.start>=(e.words[n-1]?.start??0)),{message:`Words are in the order they are said.`,path:[`words`]}),files:[`**/*.words.json`],about:`The words said in an audio or video file, with their times.`},edits:{schema:ll,files:[`**/edits/*.json`],about:`A recording's cut list.`},elements:{schema:dl,files:[`**/*.elements.json`],about:`A page screenshot's named elements, each its box in the picture's pixels.`},gen:{schema:fl,files:[`**/*.gen.json`],about:`How a media file was made, and where it came from.`},comments:{schema:al,files:[`**/comments.json`],about:`What was said about an item, in threads.`},script:{schema:Ll,files:[`**/script.*.yaml`],about:`An item's words in one language.`},messages:{schema:_l,files:[`assets/text/*.json`],about:`Words several items share, in one language.`},sheet:{schema:Ql,files:[`**/sheet.yaml`],about:`What a sheet's columns are.`},interpretation:{schema:Nl,files:[`**/reference/*/interpretation.json`],about:`What the agent concludes of a reference video: its sections, captions, watermarks and labels.`},config:{schema:ol,files:[],about:`allyhub.config.ts's settings.`}};function tu(e,t){let n=eu[e].schema.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,problems:n.error.issues.map(e=>({path:e.path.map(String).join(`.`),message:e.message}))}}var nu={item:Y,version:P().optional()},ru=U({mime:P().regex(/^image\//u),data:Rs()}),iu=Qs({code:P(),level:K([`error`,`warn`]),message:P(),piece:P().optional(),part:P().optional(),t:L().optional()}),au=Qs({kind:P(),data:B()}),ou=Qs({fps:L(),width:L(),height:L(),duration:L(),parts:V(B())}),su=U({status:K([`off`,`waiting`,`running`,`done`,`failed`]),revision:R().nonnegative(),problems:V(iu),facts:V(au),versions:U({total:R(),loaded:R(),reused:R()}).optional(),error:P().optional()}),cu=U({id:P(),item:Y,versions:V(P()),types:V(P()),state:K([`queued`,`running`,`done`,`failed`,`cancelled`]),progress:L().min(0).max(1),files:V(Y),error:P().optional()}),lu=U({file:Y,status:K([`running`,`done`,`failed`]),message:P(),share:L().min(0).max(1).optional()}),uu=ac([L(),L(),L()]),du=U({url:P(),probe:P()}),fu={"project/items":J(U({}),U({items:V(U({kind:K(Zc),dir:Y,entry:Y,title:P().optional()})),folder:P(),name:P(),revision:R().nonnegative()}),`The project's items, as the build finds them.`),"video/versions":J(U({item:Y}),U({piece:P(),kind:K([`video`,`slides`]),title:P().optional(),width:L(),height:L(),versions:V(U({key:P(),lang:P().optional()}))}),`A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for.`),"video/stage":J(U({...nu,start:U({t:L().nonnegative().optional(),part:P().optional(),offset:L().nonnegative().optional(),dur:L().positive().optional()}).optional(),play:z().optional(),chrome:z().optional()}),du,`The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage.`),"video/timeline":J(U(nu),U({timeline:ou,text:V(B())}),`A version's timeline, drawn nowhere.`),"video/still":J(U({...nu,t:L().nonnegative().optional()}),U({t:L(),image:ru,width:R().positive(),height:R().positive(),duration:L().nonnegative()}),`A moment of a version as the render draws it, as a picture.`),"check/results":J(U({}),su,`The check run after edits, as it stands.`),"check/run":J(U({}),U({}),`Runs the check again now.`),"export/start":J(U({item:Y,versions:V(P()).optional(),types:V(P().min(1)).max(10).optional()}),U({job:cu}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":J(U({job:P()}),U({}),`Stops an export.`),"export/list":J(U({}),U({jobs:V(cu)}),`The exports asked for since the server started.`),"scenery/viewer":J(U({item:Y,camera:U({position:uu,target:uu}).optional()}),du,`The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.`)},pu={"project/changed":zc(U({revision:R().nonnegative()}),`The build saw a change: a stage or a timeline asked for now is the new one's.`),"check/changed":zc(su,`The check started, ended or failed.`),"export/changed":zc(U({job:cu}),`An export moved on.`),"index/changed":zc(U({jobs:V(lu)}),`Making what the media index lacks moved on.`)},mu=K([`light`,`dark`]),hu=U({locale:P().min(2),theme:mu,agent:U({name:P().min(1)}).optional(),project:U({name:P().min(1)}),item:U({kind:K(Zc),dir:Y,entry:Y}),editor:K(Yc)}),gu=tc(`type`,[U({type:q(`file`),path:Y,line:R().positive().optional()}),U({type:q(`browser`),url:I({protocol:/^https?$/u}).optional(),tabId:P().min(1).optional()})]),_u={"host/context":J(U({}),hu,`Where the editor runs.`),"items/open":J(U({target:gu}),U({}),`Shows another item, a file or a page, where the host shows things.`),"storage/get":J(U({key:P().min(1)}),U({value:B()}),`What the editor kept for this person on this computer (a hand sort, what was last seen), or null.`),"storage/set":J(U({key:P().min(1),value:B()}),U({}),`Keeps a value for this person on this computer; null removes it.`),"editor/state":J(U({state:K([`saved`,`saving`,`unsaved`,`error`]),message:P().optional()}),U({}),`Says whether what the person typed is saved.`),"editor/context":J(U({text:P(),at:U({t:L().nonnegative(),version:P()}).optional(),picture:U({x:L(),y:L(),width:L().positive(),height:L().positive()}).optional()}),U({}),`Tells the host what the editor shows, as MCP Apps' ui/update-model-context does: what a note the person makes on it is about.`),"tools/call":J(U({name:P().min(1),arguments:G(P(),B()).default({})}),U({result:B()}),`Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).`)};({...Kc,...pu});var vu={...Gc,..._u};U({error:U({code:P().regex(/^[a-z][a-z0-9-]*$/u),message:P().min(1),hint:P().optional()})}),H({issuer:I(),authorization_endpoint:I(),token_endpoint:I(),device_authorization_endpoint:I(),revocation_endpoint:I(),code_challenge_methods_supported:V(P()).refine(e=>e.includes(`S256`),{message:`The server must take S256 PKCE challenges.`})}),H({devices:V(H({id:P(),client:P(),signedInAt:Fc(),lastActiveAt:Fc()}))}),H({access_token:P().min(1),token_type:P(),expires_in:L().positive(),refresh_token:P().min(1).optional(),scope:P().optional()}),H({error:P(),error_description:P().optional()}),H({device_code:P().min(1),user_code:P().min(1),verification_uri:I(),verification_uri_complete:I().optional(),expires_in:L().positive(),interval:L().positive().optional()});var yu=U({id:P().min(1),email:Ss(),name:P().optional(),organization:U({id:P().min(1),name:P()}).optional()});U({version:q(1),url:I(),issuer:I(),account:yu,refreshToken:P().min(1),access:U({token:P().min(1),expiresAt:Fc({offset:!0})}).optional(),since:Fc({offset:!0})}),U({accessToken:P().min(1),expiresAt:Fc({offset:!0}),account:yu});var bu=[`allyhub:component`,`allyhub:template`,`allyhub:scenery`,`allyhub:model`,`allyhub:skill`],xu=P().regex(/^[a-z0-9][a-z0-9-]*$/u),Su=U({path:P().min(1),target:P().min(1),sha256:P().regex(/^[0-9a-f]{64}$/u),content:P().optional()}),Cu=U({source:q(`polyhaven`),id:P().min(1),resolution:P().min(1).optional(),maps:V(P().min(1)).optional()}),wu=U({scenery:P().min(1),digest:P().regex(/^[0-9a-f]+$/u),renderer:P().min(1),sha256:P().regex(/^[0-9a-f]{64}$/u),size:L().int().positive(),url:I()}),Tu=U({title:P().min(1),description:P().min(1),prompt:P().min(1).optional()}),Eu=U({category:K([`video`,`writing`,`research`]),order:L().int().positive(),cover:P().optional(),words:Tu,languages:G(P(),Tu.partial()).default({})}),Du=U({$schema:P().optional(),name:xu,type:K(bu),title:P().min(1),description:P().min(1),author:P().optional(),license:P().min(1),dependencies:V(P()).default([]),registryDependencies:V(xu).default([]),files:V(Su).min(1),assets:V(Cu).default([]),bakes:V(wu).default([]),categories:V(P()).default([]),preview:P().optional(),version:P().optional(),card:Eu.optional()});U({$schema:P().optional(),name:P().min(1),homepage:I().optional(),items:V(Du.pick({name:!0,type:!0,title:!0,description:!0,categories:!0,preview:!0,version:!0,card:!0}))});var Ou=[`darwin-arm64`,`darwin-x64`,`linux-x64`,`linux-arm64`,`win32-x64`],ku=P().regex(/^[0-9a-f]{64}$/u),Au=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(/[\\/]/u).includes(`..`),{message:`A path stays inside the runtime's folder.`}),ju=U({url:I({protocol:/^https$/u}),sha256:ku,size:R().positive(),unpack:K([`none`,`zip`,`tgz`]).default(`none`),name:Au.optional(),check:V(U({path:Au,sha256:ku})).default([]),executable:z().default(!1),bins:G(P().regex(/^[a-z0-9][a-z0-9-]*$/u),Au).default({})}),Mu=U({about:P().min(1),version:P().min(1),license:P().min(1),homepage:I().optional(),platforms:sc(W([K(Ou),q(`any`)]),V(ju).min(1))});U({$schema:P().optional(),version:q(1),runtimes:G(P().regex(/^[a-z0-9][a-z0-9-]*$/u),Mu)}),H({credits:L(),held:L(),owed:L(),frozen:P().nullable().default(null),plan:H({id:P(),name:P(),interval:K([`month`,`year`]),status:P(),renewsAt:Fc().nullable(),endsAt:Fc().nullable()}).nullable(),autoTopUp:H({below:L(),amountCents:L(),stopped:K([`no_card`,`saving_card`,`not_a_card`,`declined`,`needs_authentication`,`not_charged`,`under_line`,`refunded`,`disputed`]).nullable()}).nullable()}),H({plans:V(H({id:P(),name:P(),monthlyCredits:L(),prices:V(H({interval:K([`month`,`year`]),amountCents:L(),currency:P()}))})),topUp:H({currency:P(),creditsPerDollar:L(),minCents:L(),maxCents:L()})}),H({days:V(H({day:Ic(),credits:L()}))}),W([U({plan:P(),interval:K([`month`,`year`])}),U({topUpCents:L().int()})]),U({below:L().nonnegative(),amountCents:L().int().positive()});var Nu={tier:K([`premium`,`standard`,`efficient`]).optional(),maker:P().min(1).optional()};H({models:V(Qs({id:P().min(1),name:P().min(1),...Nu,reasoning:z().optional(),input:V(P()).optional(),contextWindow:L().int().positive().optional(),maxOutput:L().int().positive().optional()})).min(1),defaultModel:P().min(1),needPlan:V(Qs({id:P().min(1),name:P().min(1),...Nu})).default([])});var Pu=G(P(),B()),Fu=H({id:P().min(1),title:P().min(1),description:P().min(1)}),Iu=H({name:P().min(1),work:P().min(1),title:P().min(1),description:P().min(1),input:Pu,output:Pu,long:z()});H({version:P().min(1),works:V(Fu),tools:V(Iu)}),U({input:G(P(),B())}),H({id:P().min(1),tool:P().min(1),status:K([`working`,`completed`,`failed`]),output:B().optional(),error:H({kind:P().min(1),message:P().min(1)}).optional(),credits:L().nonnegative().optional(),pollAfterMs:L().int().nonnegative().optional(),createdAt:P(),endedAt:P().optional()}),U({name:P().min(1).max(255),size:R().positive().max(1073741824),sha256:P().regex(/^[0-9a-f]{64}$/u),contentType:P().min(1).max(255)}),H({id:P().min(1),upload:H({url:I(),headers:G(P(),P())}).nullable()}),H({id:P().min(1),name:P()}),H({url:I()}),H({organizations:V(H({id:P(),name:P(),slug:P(),role:P(),dissolvedAt:Fc().nullable()}))}),H({members:V(H({userId:P(),email:P(),name:P(),role:P(),limit:L().nullable(),used:L()}))}),U({monthly:L().nonnegative().nullable()}),H({studio:H({state:K([`running`,`paused`]),organizationId:P()}).nullable(),creditsPerHour:L()}),U({at:Fc().nullable()}),U({path:P().min(1).optional().describe(`The item to open: its folder or entry file, absolute or from the folder allyhub mcp runs in (launch/plan, launch/plan/doc.mdx); leave it out for the project's items`)});var Lu=tc(`type`,[U({type:q(`picture`),image:ru,width:R().positive(),height:R().positive(),duration:L().nonnegative().optional()}),U({type:q(`text`),lines:V(P())}),U({type:q(`table`),columns:V(P()),rows:V(V(P())),count:R().nonnegative()})]),Ru=U({kind:K(Zc),dir:Y,entry:Y,title:P().optional()});U({project:U({name:P().min(1)}),url:P().min(1),item:Ru.optional(),preview:Lu.optional(),items:V(Ru).optional()});var zu=3e5,Bu=class{next=1;pending=new Map;listeners=new Map;stop;channel;timeout;constructor(e,t={}){this.channel=e,this.timeout=t.timeout??zu,this.stop=e.listen(e=>{this.receive(e)})}request(e,t){let n=this.next++;return new Promise((r,i)=>{let a=setTimeout(()=>{this.pending.delete(n),i(new Bc(Rc.unavailable,`${e} had no answer.`))},this.timeout);this.pending.set(n,{resolve:r,reject:i,timer:a});try{this.channel.send({jsonrpc:`2.0`,id:n,method:e,params:t})}catch(e){clearTimeout(a),this.pending.delete(n),i(e instanceof Error?e:Error(String(e)))}})}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}fail(e){for(let[t,n]of this.pending)clearTimeout(n.timer),n.reject(new Bc(Rc.unavailable,e)),this.pending.delete(t)}close(){this.stop(),this.fail(`The host closed.`),this.channel.close?.()}receive(e){if(typeof e!=`object`||!e)return;let t=e;if(t.jsonrpc!==`2.0`)return;if(typeof t.method==`string`&&!(`id`in t)){for(let e of this.listeners.get(t.method)??[])e(t.params);return}if(typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),clearTimeout(n.timer);let r=t.error;r?n.reject(new Bc(r.code,r.message,r.data)):n.resolve(t.result)}},Vu=(e,t,n)=>{let r=e.result.safeParse(t);if(!r.success)throw new Bc(Rc.internal,`The host's answer to ${n} is not what the protocol says.`);return r.data};function Hu(e){let t={on:(t,n)=>e.on(t,n)};for(let[n,r]of Object.entries(vu))t[n]=async t=>Vu(r,await e.request(n,t??{}),n);return t}function Uu(e,t){let n=new Map,r={...e};for(let e of Object.keys(t)){let n=_u[e];r[e]=async r=>{let i=await Vc({[e]:n},{[e]:t[e]},{jsonrpc:`2.0`,id:0,method:e,params:r??{}});if(`error`in i)throw new Bc(i.error.code,i.error.message,i.error.data);return Vu(n,i.result,e)}}return r.on=(t,r)=>{let i=e.on(t,r),a=n.get(t);return a||(a=new Set,n.set(t,a)),a.add(r),()=>{i(),a.delete(r)}},r.notify=(e,t)=>{for(let r of n.get(e)??[])r(t)},r}var Wu=`/rpc`;function Gu(e,t){let n=new URL(e);return n.protocol===`http:`?n.protocol=`ws:`:n.protocol===`https:`&&(n.protocol=`wss:`),(n.pathname===`/`||n.pathname===``)&&(n.pathname=Wu),n.searchParams.set(`token`,t),n.toString()}function Ku(e,t){let n=new WebSocket(Gu(e,t)),r=[],i,a,o=new Promise((e,t)=>{i=e,a=t});o.catch(()=>void 0);let s,c=new Promise(e=>{s=e}),l=new Bu({send(e){let t=JSON.stringify(e);if(n.readyState===WebSocket.OPEN)n.send(t);else if(n.readyState===WebSocket.CONNECTING)r.push(t);else throw Error(`The connection to allyhub dev is closed.`)},listen(e){let t=t=>{if(typeof t.data==`string`)try{e(JSON.parse(t.data))}catch{}};return n.addEventListener(`message`,t),()=>{n.removeEventListener(`message`,t)}},close(){n.close()}});return n.addEventListener(`open`,()=>{for(let e of r.splice(0))n.send(e);i()}),n.addEventListener(`close`,()=>{a(Error(`The connection to allyhub dev did not open.`)),l.fail(`The connection to allyhub dev closed.`),s()}),Object.assign(Hu(l),{opened:o,closed:c,close:()=>{l.close()}})}async function qu(e,t,n){let{result:r}=await e[`tools/call`]({name:t,arguments:n}),i=fu[t].result.safeParse(r);if(!i.success)throw new Bc(Rc.internal,`The answer to the tool ${t} is not what the protocol says.`);return i.data}var Ju=8,Yu=e=>{if(!(e instanceof Bc)||e.code!==Rc.conflict)return;let t=e.data;return typeof t?.text==`string`&&(typeof t.version==`string`||t.version===null)?{text:t.text,version:t.version}:void 0},Xu=class e{path;text;version;state=`saved`;error;host;delay;report;format;running;timer;dirty=!1;stale=!1;closed=!1;stops=[];stateListeners=new Set;constructor(e,t,n,r){this.host=e,this.path=t,this.text=n.text,this.version=n.version,this.delay=r.delay??500,this.report=r.report??!0}static async open(t,n,r={}){let i=new e(t,n,await t[`files/read`]({path:n}),r),{watch:a}=await t[`files/watch`]({paths:[n]});return i.stops.push(t.on(`files/changed`,e=>{e.watch===a&&e.changes.some(e=>e.path===n&&e.version!==i.version)&&i.changed()}),()=>{t[`files/unwatch`]({watch:a}).catch(()=>void 0)}),i}attach(e){this.format=e}onState(e){return this.stateListeners.add(e),()=>this.stateListeners.delete(e)}edited(){this.closed||(this.dirty=!0,this.set(`unsaved`),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.kick()},this.delay))}flush(){return clearTimeout(this.timer),this.kick()}changed(){return this.stale=!0,this.kick()}async close(){await this.flush(),this.closed=!0;for(let e of this.stops.splice(0))e()}set(e,t){if(this.error=t,e!==this.state||t!==void 0){this.state=e;for(let t of this.stateListeners)t(e);this.report&&this.host[`editor/state`]&&this.host[`editor/state`]({state:e,...t===void 0?{}:{message:t}}).catch(()=>void 0)}}take(e,t){let n=this.text;this.text=e,this.version=t,e!==n&&this.format?.take(e,n)}waiting(){return this.dirty}kick(){return this.running??=this.loop(),this.running}async loop(){await Promise.resolve();let e=0;try{for(;this.dirty||this.stale;){if(this.stale){this.stale=!1;let e=await this.host[`files/read`]({path:this.path});this.take(e.text,e.version)}if(!this.dirty||!this.format)continue;this.dirty=!1;let t=this.format.save(this.text);if(t===void 0)this.set(`saved`);else{this.set(`saving`);try{let{version:e}=await this.host[`files/write`]({path:this.path,text:t,over:this.version});this.text=t,this.version=e,this.waiting()||this.set(this.format.save(this.text)===void 0?`saved`:`unsaved`)}catch(t){let n=Yu(t);if(!n){this.set(`error`,t instanceof Error?t.message:String(t));continue}if(this.take(n.text,n.version),++e>=Ju){this.set(`error`,`${this.path} keeps changing.`);continue}this.dirty=!0}}}}catch(e){this.dirty=!1,this.stale=!1,this.set(`error`,e instanceof Error?e.message:String(e))}finally{this.running=void 0}}},Zu=`allyhub.stage-sandbox`;function Qu(e){let t=e;return typeof t==`object`&&!!t&&t.allyhub===!0&&t.type===`probe`}function $u(e){try{let t=e?.getItem(Zu);return t===`1`||t!==`0`&&void 0}catch{return}}async function ed(e){let t=$u(e.storage);if(t!==void 0)return t;let n,r=()=>void 0,i=await new Promise(t=>{n=setTimeout(()=>{t(!1)},e.ms??1500),r=e.open(()=>{t(!0)})});clearTimeout(n),r();try{e.storage?.setItem(Zu,i?`1`:`0`)}catch{}return i}function td(e){return t=>{let n=document.createElement(`iframe`);n.setAttribute(`sandbox`,`allow-scripts`),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.cssText=`position:fixed;width:1px;height:1px;left:-10px;top:-10px;border:0;opacity:0`;let r=e=>{e.source===n.contentWindow&&Qu(e.data)&&t()};return window.addEventListener(`message`,r),n.src=e,document.body.append(n),()=>{window.removeEventListener(`message`,r),n.remove()}}}var nd;function rd(e){let t;try{t=sessionStorage}catch{t=void 0}return nd??=ed({open:td(e),storage:t}),nd}var id=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,ee=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let ee=c&&c.oldPos+1<o;if(!u&&!ee)d[r]=void 0;else{if(s=!ee||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);ee()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=ee();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends id{};function ad(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function od(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function sd(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function cd(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function ld(e,t){return sd(e,t,``)}function ud(e,t){return cd(e,t,``)}function dd(e,t){return t.slice(0,fd(e,t))}function fd(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function pd(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function md(e,t){if(t)return gd(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function hd(e,t){if(t)return gd(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function gd(e,t){if(!t)return[hd(e),md(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=pd(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var _d=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,vd=RegExp(`[${_d}]+|\\s+|[^${_d}]`,`ug`);new class extends id{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=pd(e,r)}else n=e.match(vd)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&yd(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&yd(n,i,r,null,t.intlSegmenter),e}};function yd(e,t,n,r,i){if(t&&n){let[a,o]=gd(t.value,i),[s,c]=gd(n.value,i);if(e){let r=ad(a,s);e.value=cd(e.value,s,r),t.value=ld(t.value,r),n.value=ld(n.value,r)}if(r){let e=od(o,c);r.value=sd(r.value,c,e),t.value=ud(t.value,e),n.value=ud(n.value,e)}}else if(n){if(e){let e=hd(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=hd(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=hd(r.value,i),[a,o]=gd(t.value,i),s=ad(n,a);t.value=ld(t.value,s);let c=od(ld(n,s),o);t.value=ud(t.value,c),r.value=sd(r.value,n,c),e.value=cd(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=hd(r.value,i),n=dd(md(t.value,i),e);t.value=ud(t.value,n)}else if(e){let n=dd(md(e.value,i),hd(t.value,i));t.value=ld(t.value,n)}}new class extends id{tokenize(e){let t=RegExp(`(\\r?\\n)|[${_d}]+|[^\\S\\n\\r]+|[^${_d}]`,`ug`);return e.match(t)||[]}},new class extends id{constructor(){super(...arguments),this.tokenize=bd}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
57
57
  `)||(e=e.trim()),n.newlineIsToken&&t.includes(`
58
58
  `)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
59
59
  `)&&(e=e.slice(0,-1)),t.endsWith(`
60
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Sd(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
61
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Cd(e){return e==`.`||e==`!`||e==`?`}new class extends od{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Cd(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends od{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends od{constructor(){super(...arguments),this.tokenize=Sd}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(wd(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function wd(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=wd(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=wd(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}var Td=new class extends od{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Ed(e,t,n){return Td.diff(e,t,n)}var Dd=1e3;function Od(e,t,n=Dd){let r=[],i=0;for(;i<e.length&&i<t.length&&e[i]===t[i];)r.push([i,i]),i++;let a=e.length,o=t.length,s=[];for(;a>i&&o>i&&e[a-1]===t[o-1];)a--,o--,s.push([a,o]);let c=Ed(e.slice(i,a),t.slice(i,o),{maxEditLength:n});if(c){let e=i,t=i;for(let n of c)if(n.added)t+=n.count;else if(n.removed)e+=n.count;else for(let i=0;i<n.count;i++)r.push([e++,t++])}return r.push(...s.reverse()),r}function kd(e,t,n){let r=Od(e.map(n),t.map(n)),i=[],a=0,o=0;for(let[n,s]of[...r,[e.length,t.length]])(n>a||s>o)&&i.push({at:a,remove:n-a,insert:t.slice(o,s)}),a=n+1,o=s+1;return i.reverse()}var Ad=[`en`,`zh-cn`,`zh-tw`,`ja`,`ko`,`es`,`fr`,`de`,`it`,`pt`,`ru`,`tr`,`vi`,`th`,`hi`],jd={en:`en`,"zh-cn":`zh-CN`,"zh-tw":`zh-TW`,ja:`ja`,ko:`ko`,es:`es`,fr:`fr`,de:`de`,it:`it`,pt:`pt-BR`,ru:`ru`,tr:`tr`,vi:`vi`,th:`th`,hi:`hi`};function Md(e){return typeof e==`string`&&Ad.includes(e)}var Nd=new Set([`hant`,`tw`,`hk`,`mo`]);function Pd(e){for(let t of e){let e=t.trim().toLowerCase().replaceAll(`_`,`-`).split(`-`),n=e[0];if(n!==void 0&&n!==``){if(n===`zh`){let t=e.slice(1);return t.includes(`hans`)?`zh-cn`:t.some(e=>Nd.has(e))?`zh-tw`:`zh-cn`}if(Md(n))return n}}}function Fd(e){return e===void 0?`en`:Pd([e])??`en`}function Id(e,t){return e[Fd(t)]}function Ld(e){return{all:e,of:t=>Id(e,t)}}var Rd=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),zd=o(((e,t)=>{t.exports=Rd()})),$=l(d()),Bd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Vd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Hd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ud=e=>{let t=Hd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wd={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Gd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Kd=(0,$.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,$.createElement)(`svg`,{ref:c,...Wd,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Bd(`lucide`,i),...!a&&!Gd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,$.createElement)(e,t)),...Array.isArray(a)?a:[a]])),qd=(e,t)=>{let n=(0,$.forwardRef)(({className:n,...r},i)=>(0,$.createElement)(Kd,{ref:i,iconNode:t,className:Bd(`lucide-${Vd(Ud(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ud(e),n};function Jd(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Jd(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Yd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Jd(e))&&(r&&(r+=` `),r+=t);return r}var Xd=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Zd=Yd,Qd=(e,t)=>n=>{if(t?.variants==null)return Zd(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Xd(t)||Xd(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Zd(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},$d=zd(),ef=(0,$.createContext)(null);function tf(e){return(0,$d.jsx)(ef.Provider,{value:e.host,children:e.children})}function nf(){let e=(0,$.useContext)(ef);if(!e)throw Error(`An editor runs inside a HostProvider.`);return e}function rf(e,t){let n=nf(),r=(0,$.useEffectEvent)(t);(0,$.useEffect)(()=>n.on(e,e=>{r(e)}),[n,e])}function af(){let e=nf(),[t,n]=(0,$.useState)();return(0,$.useEffect)(()=>{let t=!0;e[`host/context`]({}).then(e=>{t&&n(e)},()=>void 0);let r=e.on(`host/context-changed`,e=>{n(e)});return()=>{t=!1,r()}},[e]),t}function of(){try{return td(sessionStorage)}catch{return}}function sf(e){let[t,n]=(0,$.useState)(of);return(0,$.useEffect)(()=>{if(t!==void 0||e===void 0)return;let r=!0;return ad(e).then(e=>{r&&n(e)}),()=>{r=!1}},[t,e]),t}export{s as A,zl as C,Bc as D,Rc as E,d as O,Rl as S,Zc as T,Qu as _,sf as a,Gu as b,qd as c,Ld as d,Fd as f,kd as g,Od as h,rf as i,l as j,o as k,zd as l,Id as m,nf as n,Qd as o,Pd as p,af as r,Yd as s,tf as t,jd as u,Yu as v,Xc as w,tu as x,Ju as y};
60
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function bd(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
61
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function xd(e){return e==`.`||e==`!`||e==`?`}new class extends id{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(xd(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends id{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends id{constructor(){super(...arguments),this.tokenize=bd}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Sd(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Sd(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Sd(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Sd(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}var Cd=new class extends id{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function wd(e,t,n){return Cd.diff(e,t,n)}var Td=1e3;function Ed(e,t,n=Td){let r=[],i=0;for(;i<e.length&&i<t.length&&e[i]===t[i];)r.push([i,i]),i++;let a=e.length,o=t.length,s=[];for(;a>i&&o>i&&e[a-1]===t[o-1];)a--,o--,s.push([a,o]);let c=wd(e.slice(i,a),t.slice(i,o),{maxEditLength:n});if(c){let e=i,t=i;for(let n of c)if(n.added)t+=n.count;else if(n.removed)e+=n.count;else for(let i=0;i<n.count;i++)r.push([e++,t++])}return r.push(...s.reverse()),r}function Dd(e,t,n){let r=Ed(e.map(n),t.map(n)),i=[],a=0,o=0;for(let[n,s]of[...r,[e.length,t.length]])(n>a||s>o)&&i.push({at:a,remove:n-a,insert:t.slice(o,s)}),a=n+1,o=s+1;return i.reverse()}var Od=[`en`,`zh-cn`,`zh-tw`,`ja`,`ko`,`es`,`fr`,`de`,`it`,`pt`,`ru`,`tr`,`vi`,`th`,`hi`],kd={en:`en`,"zh-cn":`zh-CN`,"zh-tw":`zh-TW`,ja:`ja`,ko:`ko`,es:`es`,fr:`fr`,de:`de`,it:`it`,pt:`pt-BR`,ru:`ru`,tr:`tr`,vi:`vi`,th:`th`,hi:`hi`};function Ad(e){return typeof e==`string`&&Od.includes(e)}var jd=new Set([`hant`,`tw`,`hk`,`mo`]);function Md(e){for(let t of e){let e=t.trim().toLowerCase().replaceAll(`_`,`-`).split(`-`),n=e[0];if(n!==void 0&&n!==``){if(n===`zh`){let t=e.slice(1);return t.includes(`hans`)?`zh-cn`:t.some(e=>jd.has(e))?`zh-tw`:`zh-cn`}if(Ad(n))return n}}}function Nd(e){return e===void 0?`en`:Md([e])??`en`}function Pd(e,t){return e[Nd(t)]}function Fd(e){return{all:e,of:t=>Pd(e,t)}}var Id=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ld=o(((e,t)=>{t.exports=Id()})),$=l(d()),Rd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),zd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Bd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Vd=e=>{let t=Bd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hd={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Ud=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Wd=(0,$.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,$.createElement)(`svg`,{ref:c,...Hd,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Rd(`lucide`,i),...!a&&!Ud(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,$.createElement)(e,t)),...Array.isArray(a)?a:[a]])),Gd=(e,t)=>{let n=(0,$.forwardRef)(({className:n,...r},i)=>(0,$.createElement)(Wd,{ref:i,iconNode:t,className:Rd(`lucide-${zd(Vd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Vd(e),n};function Kd(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Kd(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function qd(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Kd(e))&&(r&&(r+=` `),r+=t);return r}var Jd=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Yd=qd,Xd=(e,t)=>n=>{if(t?.variants==null)return Yd(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Jd(t)||Jd(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Yd(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Zd=Ld(),Qd=(0,$.createContext)(null);function $d(e){return(0,Zd.jsx)(Qd.Provider,{value:e.host,children:e.children})}function ef(){let e=(0,$.useContext)(Qd);if(!e)throw Error(`An editor runs inside a HostProvider.`);return e}function tf(e,t){let n=ef(),r=(0,$.useEffectEvent)(t);(0,$.useEffect)(()=>n.on(e,e=>{r(e)}),[n,e])}function nf(){let e=ef(),[t,n]=(0,$.useState)();return(0,$.useEffect)(()=>{let t=!0;e[`host/context`]({}).then(e=>{t&&n(e)},()=>void 0);let r=e.on(`host/context-changed`,e=>{n(e)});return()=>{t=!1,r()}},[e]),t}function rf(){try{return $u(sessionStorage)}catch{return}}function af(e){let[t,n]=(0,$.useState)(rf);return(0,$.useEffect)(()=>{if(t!==void 0||e===void 0)return;let r=!0;return rd(e).then(e=>{r&&n(e)}),()=>{r=!1}},[t,e]),t}export{s as A,zl as C,Bc as D,Rc as E,d as O,Rl as S,Zc as T,Xu as _,af as a,Uu as b,Gd as c,Fd as d,Nd as f,Dd as g,Ed as h,tf as i,l as j,o as k,Ld as l,Pd as m,ef as n,Xd as o,Md as p,nf as r,qd as s,$d as t,kd as u,qu as v,Xc as w,tu as x,Ku as y};
@@ -1 +1 @@
1
- import{c as e}from"./react-DAVp_9d7.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),r=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),i=e(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]);export{t as i,r as n,n as r,i as t};
1
+ import{c as e}from"./react-Bo429Bov.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),r=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),i=e(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]);export{t as i,r as n,n as r,i as t};
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>AllyHub</title>
8
- <script type="module" crossorigin src="/assets/index-9-pcRXol.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/react-DAVp_9d7.js">
10
- <link rel="modulepreload" crossorigin href="/assets/floating-ui.react-dom-iFhm-7Xc.js">
11
- <link rel="stylesheet" crossorigin href="/assets/index-DRbemuuR.css">
8
+ <script type="module" crossorigin src="/assets/index-Dc8FX_sp.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/react-Bo429Bov.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/floating-ui.react-dom-DSyn5TRd.js">
11
+ <link rel="stylesheet" crossorigin href="/assets/index-BSFR4plz.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/audio",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/browser",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/build",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/check",
3
- "version": "0.2.0-next.3",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,3 +1,3 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{mkdir as b,readFile as F,rm as P,writeFile as $}from"node:fs/promises";import{basename as y,dirname as j,extname as x,join as k}from"node:path";import{EXIT as s,FileContentResponseSchema as T,ToolCallSchema as S,callPath as D,fileContentPath as v,parseAllyFilePath as E,toolCallsPath as J}from"@allyhub-next/protocol";import{genFileFor as C}from"@allyhub-next/formats";import{CloudError as d}from"./errors.js";import{genRecord as O,inputHash as _,namedFile as N,readGen as I,toolWords as R,writeGen as L,writeWords as M}from"./records.js";import{withKnownUploads as W}from"./uploads.js";export const declined=i=>new d("declined",`The person did not allow the credits for ${i}: nothing was called or charged.`,{hint:"Ask them what to do instead, or call it again to ask again."}),WAIT_SECONDS=900,POLL_SECONDS={least:1,most:60};const h=(i,t)=>k(i.config.cacheDir,"jobs",`${t.replace(/[^A-Za-z0-9_-]/gu,"_")}.json`);async function B(i,t,a){await b(j(h(i,t)),{recursive:!0}),await $(h(i,t),`${JSON.stringify(a,null,2)}
3
- `)}const G=(i,t)=>P(h(i,t),{force:!0});async function H(i,t){try{return JSON.parse(await F(h(i,t),"utf8"))}catch{throw new d("unknown-job",`No job ${t} was started on this computer.`,{exit:s.notFound,hint:"Call the tool again: that is a new call."})}}async function z(i,t,a,e){const{url:l}=T.parse(await i.json(v(t,"attachment"))),f=await i.config.fetch(l);if(!f.ok)throw new d("download-failed",`Downloading ${a} answered ${String(f.status)}.`,{exit:s.platform});const c="dir"in e?k(e.dir,y(a)):x(e.file)?e.file:`${e.file}${x(a)}`;return await b(j(c),{recursive:!0}),await $(c,Buffer.from(await f.arrayBuffer())),c}const K=(i,t)=>new Promise((a,e)=>{const l=setTimeout(a,i*1e3);t?.addEventListener("abort",()=>{clearTimeout(l),e(t.reason instanceof Error?t.reason:new Error("Stopped."))},{once:!0})});export async function callTool(i,t,a,e){const l=e.file,f=await W(i,a,e.base);let c=!1;if(l!==void 0&&e.jobId===void 0){const n=await N(l),r=n?await I(n):void 0;if(e.force===!0)c=r!==void 0;else{if(n&&!r)throw new d("file-exists",`${n} is there, without a record (${y(C(n))}) saying a tool call made it.`,{exit:s.conflict,hint:"Choose another --file, or pass --force to replace it."});if(n&&r){if(r.tool===t&&r.inputHash===_(t,f))return{tool:t,output:r.output??{},file:n,gen:C(n),kept:{at:r.at}};throw new d("file-exists",`${n} was made by ${r.tool??"another tool"} from another input on ${r.at}.`,{exit:s.conflict,hint:"Choose another --file to keep it, or pass --force to make it again over it (charged again)."})}}}if(e.jobId===void 0&&e.approve!==void 0&&!await e.approve())throw declined(t);const A=Date.now()+(e.timeoutSeconds??WAIT_SECONDS)*1e3;let o=S.parse(e.jobId===void 0?await i.json(J(t),{method:"POST",body:{input:a},...e.signal?{signal:e.signal}:{}}):await i.json(D(e.jobId),{...e.signal?{signal:e.signal}:{}}));for(o.status==="working"&&e.jobId===void 0&&await B(i,o.id,{tool:t,input:{...a},outDir:e.outDir,...l===void 0?{}:{file:l}});o.status==="working";){const n=(Date.now()-Date.parse(o.createdAt))/1e3;if(e.wait===!1||Date.now()>A)return{tool:t,jobId:o.id,status:"running",elapsedSeconds:n};e.onRunning?.(o),await K(Math.min(Math.max((o.pollAfterMs??0)/1e3,POLL_SECONDS.least),POLL_SECONDS.most),e.signal),o=S.parse(await i.json(D(o.id),{...e.signal?{signal:e.signal}:{}}))}if(await G(i,o.id),o.status==="failed")throw new d(`tool-${(o.error?.kind??"failed").replaceAll("_","-")}`,o.error?.message??"The tool failed.",{exit:o.error?.kind==="input"?s.usage:s.platform,hint:o.error?.kind==="input"||o.error?.kind==="not_found"?"A failed call is not charged. Change the input and call again.":"A failed call is not charged. Call it again; a supplier's failure often passes."});const u=typeof o.output=="object"&&o.output!==null?o.output:{value:o.output},m=u.allyFilePath,g=typeof m=="string"?E(m):void 0,w={tool:t,output:u,...o.credits===void 0?{}:{credits:o.credits}};if(g){const n=await z(i,g.id,g.name,l!==void 0?{file:l}:{dir:e.outDir});w.file=n,w.gen=await L(n,await O(n,{tool:t,input:f,output:u,credits:o.credits}));const r=R(u),p=u.durationSeconds;r&&(w.words=await M(n,r,typeof p=="number"&&p>=0?p:void 0)),c&&(w.replaced=!0)}return w}export async function resumeJob(i,t,a){const e=await H(i,t);if(a.tool!==void 0&&a.tool!==e.tool)throw new d("wrong-job",`Job ${t} is ${e.tool}'s, not ${a.tool}'s.`,{exit:s.usage,hint:`Resume it with ${e.tool}.`});return await callTool(i,e.tool,e.input,{...a,outDir:e.outDir,...e.file===void 0?{}:{file:e.file},jobId:t})}
2
+ import{mkdir as k,readdir as I,readFile as A,rm as M,writeFile as E}from"node:fs/promises";import{basename as T,dirname as F,extname as N,join as b}from"node:path";import{EXIT as w,FileContentResponseSchema as W,ToolCallSchema as O,callPath as L,fileContentPath as B,parseAllyFilePath as G,toolCallsPath as z}from"@allyhub-next/protocol";import{genFileFor as P}from"@allyhub-next/formats";import{CloudError as d}from"./errors.js";import{genRecord as K,inputHash as U,namedFile as X,readGen as Y,toolWords as Z,writeGen as q,writeWords as Q}from"./records.js";import{withKnownUploads as V}from"./uploads.js";export const WAIT_SECONDS=900,POLL_SECONDS={least:1,most:60},RETRY_SECONDS={least:1,most:30},READ_SECONDS=120;const tt=new Set([408,429,500,502,503,504]),et=t=>t instanceof d&&(t.code==="network"||t.status!==void 0&&tt.has(t.status)),x=t=>b(t.config.cacheDir,"jobs"),y=(t,n)=>b(x(t),`${n.replace(/[^A-Za-z0-9_-]/gu,"_")}.json`);async function nt(t,n,i){await k(F(y(t,n)),{recursive:!0}),await E(y(t,n),`${JSON.stringify(i,null,2)}
3
+ `)}const D=(t,n)=>M(y(t,n),{force:!0});async function at(t,n,i){const e=await I(x(t)).catch(()=>[]);for(const o of e.filter(s=>s.endsWith(".json")).sort()){const s=await A(b(x(t),o),"utf8").then(r=>JSON.parse(r)).catch(()=>{});if(s?.jobId!==void 0&&s.file===n&&s.inputHash===i)return s.jobId}}async function ot(t,n){try{return JSON.parse(await A(y(t,n),"utf8"))}catch{throw new d("unknown-job",`No job ${n} was started on this computer.`,{exit:w.notFound,hint:"Call the tool again: that is a new call."})}}async function it(t,n,i,e,o){const{url:s}=W.parse(await t.json(B(n,"attachment"),{signal:R(o)}));let r;try{const l=await t.config.fetch(s,o?{signal:o}:{});if(!l.ok)throw new d("download-failed",`Downloading ${i} answered ${String(l.status)}.`,{exit:w.platform,status:l.status});r=Buffer.from(await l.arrayBuffer())}catch(l){throw l instanceof d||o?.aborted===!0?l:new d("network",`Downloading ${i} failed: ${l instanceof Error?l.message:String(l)}`,{exit:w.platform,cause:l})}const u="dir"in e?b(e.dir,T(i)):N(e.file)?e.file:`${e.file}${N(i)}`;return await k(F(u),{recursive:!0}),await E(u,r),u}const R=t=>t?AbortSignal.any([t,AbortSignal.timeout(READ_SECONDS*1e3)]):AbortSignal.timeout(READ_SECONDS*1e3),J=(t,n)=>new Promise((i,e)=>{const o=setTimeout(i,t*1e3);n?.addEventListener("abort",()=>{clearTimeout(o),e(n.reason instanceof Error?n.reason:new Error("Stopped."))},{once:!0})});export async function callTool(t,n,i,e){const o=e.file,s=await V(t,i,e.base),r=U(n,s);let u=e.jobId,l=!1;if(o!==void 0&&u===void 0){u=await at(t,o,r);const c=u===void 0?await X(o):void 0,f=c?await Y(c):void 0;if(e.force===!0)l=f!==void 0;else{if(c&&!f)throw new d("file-exists",`${c} is there, without a record (${T(P(c))}) saying a tool call made it.`,{exit:w.conflict,hint:"Choose another --file, or pass --force to replace it."});if(c&&f){if(f.tool===n&&f.inputHash===r)return{tool:n,output:f.output??{},file:c,gen:P(c),kept:{at:f.at}};throw new d("file-exists",`${c} was made by ${f.tool??"another tool"} from another input on ${f.at}.`,{exit:w.conflict,hint:"Choose another --file to keep it, or pass --force to make it again over it (charged again)."})}}}const p=Date.now()+(e.timeoutSeconds??WAIT_SECONDS)*1e3,g=e.signal;let a=u===void 0?O.parse(await t.json(z(n),{method:"POST",body:{input:i},...g?{signal:g}:{}})):await _(t,u,p,e);a.status==="working"&&u===void 0&&await nt(t,a.id,{jobId:a.id,tool:n,input:{...i},inputHash:r,outDir:e.outDir,...o===void 0?{}:{file:o}});const H=()=>({tool:n,jobId:a.id,status:"running",elapsedSeconds:(Date.now()-Date.parse(a.createdAt))/1e3,...o===void 0?{}:{file:o}});for(;a.status==="working";){if(e.wait===!1||Date.now()>p)return H();e.onRunning?.(a),await J(Math.min(Math.max((a.pollAfterMs??0)/1e3,POLL_SECONDS.least),POLL_SECONDS.most),g),a=await _(t,a.id,p,e)}if(a.status==="failed")throw await D(t,a.id),new d(`tool-${(a.error?.kind??"failed").replaceAll("_","-")}`,a.error?.message??"The tool failed.",{exit:a.error?.kind==="input"?w.usage:w.platform,hint:a.error?.kind==="input"||a.error?.kind==="not_found"?"A failed call is not charged. Change the input and call again.":"A failed call is not charged. Call it again; a supplier's failure often passes."});const h=typeof a.output=="object"&&a.output!==null?a.output:{value:a.output},j=h.allyFilePath,S=typeof j=="string"?G(j):void 0,m={tool:n,output:h,...a.credits===void 0?{}:{credits:a.credits}};if(S){const c=a.id,f=await v(c,()=>it(t,S.id,S.name,o!==void 0?{file:o}:{dir:e.outDir},g),p,e);m.file=f,m.gen=await q(f,await K(f,{tool:n,input:s,output:h,credits:a.credits}));const C=Z(h),$=h.durationSeconds;C&&(m.words=await Q(f,C,typeof $=="number"&&$>=0?$:void 0)),l&&(m.replaced=!0)}return await D(t,a.id),m}async function _(t,n,i,e){try{return await v(n,async()=>O.parse(await t.json(L(n),{signal:R(e.signal)})),i,e)}catch(o){throw o instanceof d&&o.status===404&&await D(t,n),o}}async function v(t,n,i,e){const o=e.retrySeconds??RETRY_SECONDS;for(let s=o.least;;)try{return await n()}catch(r){if(!et(r)||e.signal?.aborted===!0)throw r;if(Date.now()+s*1e3>i)throw new d(r.code,r.message,{exit:r.exit,...r.status===void 0?{}:{status:r.status},hint:`Call ${t} goes on at AllyHub, charged once when it works: --resume ${t} waits for it again (so does the same call to the same --file).`,cause:r});e.onRetry?.(t,r,s),await J(s,e.signal),s=Math.min(s*2,o.most)}}export async function resumeJob(t,n,i){const e=await ot(t,n);if(i.tool!==void 0&&i.tool!==e.tool)throw new d("wrong-job",`Job ${n} is ${e.tool}'s, not ${i.tool}'s.`,{exit:w.usage,hint:`Resume it with ${e.tool}.`});return await callTool(t,e.tool,e.input,{...i,outDir:e.outDir,...e.file===void 0?{}:{file:e.file},jobId:n})}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{createHash as l}from"node:crypto";import{EXIT as r,ORGANIZATION_HEADER as y}from"@allyhub-next/protocol";import{accessOf as g,SignedOut as p}from"./credentials.js";import{CloudError as s,notSignedIn as f,unreachable as h}from"./errors.js";export function scrub(c,t){let e=c.replace(/(authorization)\s*[:=]\s*[^\r\n]+/giu,"$1: <redacted>");return e=e.replace(/\bahk_[A-Za-z0-9_-]+/gu,"<api-key>"),e=e.replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/gu,"<token>"),t&&(e=e.split(t).join("<key>")),e}export class Cloud{config;constructor(t){this.config=t}get url(){return this.config.url}async key(){const t=this.config.apiKey;if(t)return{key:t,source:"env",account:l("sha256").update(t).digest("hex")};try{const e=await g(this.config);if(!e)return;const n=e.credentials.account.organization?.id;return{key:e.token,source:"oauth",account:e.credentials.account.id,expiresAt:e.expiresAt,...n===void 0?{}:{organization:n}}}catch(e){if(e instanceof p)return;throw h(this.url,e)}}async requireKey(){const t=await this.key();if(!t)throw f();return t}keyedFetch=async(t,e)=>{const n=i=>{const a=new Headers(e?.headers);return a.set("authorization",`Bearer ${i.key}`),i.organization!==void 0&&a.set(y,i.organization),this.config.fetch(t,{...e,headers:a})},o=await this.requireKey();return n(o)};async json(t,e={}){const n=e.auth!==!1,o=n?(await this.requireKey()).key:void 0;let i;try{i=await(n?this.keyedFetch:this.config.fetch)(`${this.url}${t}`,{redirect:"error",signal:e.signal??AbortSignal.timeout(3e4),method:e.method??"GET",headers:{accept:"application/json",...e.body===void 0?{}:{"content-type":"application/json"}},...e.body===void 0?{}:{body:JSON.stringify(e.body)}})}catch(u){throw u instanceof s?u:h(this.url,u)}const a=await i.text(),d=i.ok?void 0:m(a,o);if(d&&i.status!==401)throw d;if(i.status===403)throw new s("forbidden","This AllyHub account does not have access to this operation.",{exit:r.auth});if(i.status===401)throw f(n?"This computer's AllyHub sign-in is not valid any more.":void 0);if(!i.ok)throw new s("api-error",`${this.url}${t} answered ${String(i.status)}: ${scrub(a.slice(0,300),o)}`,{exit:i.status>=500?r.platform:r.usage});try{return JSON.parse(a)}catch{throw new s("api-error",`${this.url}${t} did not answer JSON.`,{exit:r.platform})}}}const w={bad_input:r.usage,insufficient_credits:r.auth,limit_reached:r.auth,forbidden:r.auth,not_found:r.notFound,conflict:r.conflict};function m(c,t){let e;try{e=JSON.parse(c)}catch{return}const n=e?.error;if(typeof n?.code!="string"||typeof n.message!="string")return;const o=typeof n.hint=="string"?n.hint:n.code==="insufficient_credits"?"Add credits to the AllyHub account.":void 0;return new s(n.code.replaceAll("_","-"),scrub(n.message,t),{exit:w[n.code]??r.platform,...o===void 0?{}:{hint:o}})}
2
+ import{createHash as l}from"node:crypto";import{EXIT as o,ORGANIZATION_HEADER as y}from"@allyhub-next/protocol";import{accessOf as g,SignedOut as p}from"./credentials.js";import{CloudError as a,notSignedIn as f,unreachable as h}from"./errors.js";export function scrub(c,e){let t=c.replace(/(authorization)\s*[:=]\s*[^\r\n]+/giu,"$1: <redacted>");return t=t.replace(/\bahk_[A-Za-z0-9_-]+/gu,"<api-key>"),t=t.replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/gu,"<token>"),e&&(t=t.split(e).join("<key>")),t}export class Cloud{config;constructor(e){this.config=e}get url(){return this.config.url}async key(){const e=this.config.apiKey;if(e)return{key:e,source:"env",account:l("sha256").update(e).digest("hex")};try{const t=await g(this.config);if(!t)return;const r=t.credentials.account.organization?.id;return{key:t.token,source:"oauth",account:t.credentials.account.id,expiresAt:t.expiresAt,...r===void 0?{}:{organization:r}}}catch(t){if(t instanceof p)return;throw h(this.url,t)}}async requireKey(){const e=await this.key();if(!e)throw f();return e}keyedFetch=async(e,t)=>{const r=n=>{const s=new Headers(t?.headers);return s.set("authorization",`Bearer ${n.key}`),n.organization!==void 0&&s.set(y,n.organization),this.config.fetch(e,{...t,headers:s})},i=await this.requireKey();return r(i)};async json(e,t={}){const r=t.auth!==!1,i=r?(await this.requireKey()).key:void 0;let n;try{n=await(r?this.keyedFetch:this.config.fetch)(`${this.url}${e}`,{redirect:"error",signal:t.signal??AbortSignal.timeout(3e4),method:t.method??"GET",headers:{accept:"application/json",...t.body===void 0?{}:{"content-type":"application/json"}},...t.body===void 0?{}:{body:JSON.stringify(t.body)}})}catch(u){throw u instanceof a?u:h(this.url,u)}const s=await n.text(),d=n.ok?void 0:m(s,n.status,i);if(d&&n.status!==401)throw d;if(n.status===403)throw new a("forbidden","This AllyHub account does not have access to this operation.",{exit:o.auth,status:403});if(n.status===401)throw f(r?"This computer's AllyHub sign-in is not valid any more.":void 0);if(!n.ok)throw new a("api-error",`${this.url}${e} answered ${String(n.status)}: ${scrub(s.slice(0,300),i)}`,{exit:n.status>=500?o.platform:o.usage,status:n.status});try{return JSON.parse(s)}catch{throw new a("api-error",`${this.url}${e} did not answer JSON.`,{exit:o.platform,status:n.status})}}}const w={bad_input:o.usage,insufficient_credits:o.auth,limit_reached:o.auth,forbidden:o.auth,not_found:o.notFound,conflict:o.conflict};function m(c,e,t){let r;try{r=JSON.parse(c)}catch{return}const i=r?.error;if(typeof i?.code!="string"||typeof i.message!="string")return;const n=typeof i.hint=="string"?i.hint:i.code==="insufficient_credits"?"Add credits to the AllyHub account.":void 0;return new a(i.code.replaceAll("_","-"),scrub(i.message,t),{exit:w[i.code]??o.platform,status:e,...n===void 0?{}:{hint:n}})}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{EXIT as r}from"@allyhub-next/protocol";export class CloudError extends Error{code;hint;exit;constructor(e,o,n={}){super(o,n.cause===void 0?void 0:{cause:n.cause}),this.name="CloudError",this.code=e,this.hint=n.hint,this.exit=n.exit??r.failed}}export const SIGN_IN="Run allyhub auth login (or set ALLYHUB_API_KEY).",notSignedIn=(t,e)=>new CloudError("not-signed-in",t??"This computer is not signed in to AllyHub.",{exit:r.auth,hint:e??SIGN_IN}),unreachable=(t,e)=>new CloudError("network",`Cannot reach ${t}: ${e instanceof Error?e.message:String(e)}`,{exit:r.platform,hint:"Check the connection; ALLYHUB_URL sets another address.",cause:e});
2
+ import{EXIT as r}from"@allyhub-next/protocol";export class CloudError extends Error{code;hint;exit;status;constructor(t,s,e={}){super(s,e.cause===void 0?void 0:{cause:e.cause}),this.name="CloudError",this.code=t,this.hint=e.hint,this.exit=e.exit??r.failed,this.status=e.status}}export const SIGN_IN="Run allyhub auth login (or set ALLYHUB_API_KEY).",notSignedIn=(n,t)=>new CloudError("not-signed-in",n??"This computer is not signed in to AllyHub.",{exit:r.auth,hint:t??SIGN_IN}),unreachable=(n,t)=>new CloudError("network",`Cannot reach ${n}: ${t instanceof Error?t.message:String(t)}`,{exit:r.platform,hint:"Check the connection; ALLYHUB_URL sets another address.",cause:t});