allyhub 0.2.0 → 0.3.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.
- package/dist/cli-version.js +2 -0
- package/dist/commands/add.js +5 -5
- package/dist/commands/dev.js +2 -2
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/model.js +1 -1
- package/dist/commands/render.js +1 -1
- package/dist/commands/skills.js +3 -3
- package/dist/main.js +7 -7
- package/dist/works.js +1 -1
- package/editor-app/view.html +3 -3
- package/editor-web/assets/chevron-left-W6sP7nB1.js +1 -0
- package/editor-web/assets/{chevron-up-BMNXDEBs.js → chevron-up-566GQpAm.js} +1 -1
- package/editor-web/assets/{dist-B4VKfY-H.js → dist-BKDr73BR.js} +4 -4
- package/editor-web/assets/dist-CPCNTYVu.js +8 -0
- package/editor-web/assets/{dist-Coblfc3T.js → dist-C_NajYp0.js} +1 -1
- package/editor-web/assets/{dist-BcInw4os.js → dist-mA6NrAKh.js} +34 -34
- package/editor-web/assets/{floating-ui.react-dom-DSyn5TRd.js → floating-ui.react-dom-BUxFRF6t.js} +1 -1
- package/editor-web/assets/index-CFZhjTQW.js +56 -0
- package/editor-web/assets/index-DgU-lyX6.css +2 -0
- package/editor-web/assets/{react-Bo429Bov.js → react-Ff_buMj8.js} +1 -1
- package/editor-web/assets/{undo-2-CWgOKQ3L.js → undo-2-BKFItM3X.js} +1 -1
- package/editor-web/index.html +4 -4
- package/node_modules/@allyhub-next/audio/package.json +1 -1
- package/node_modules/@allyhub-next/browser/package.json +1 -1
- package/node_modules/@allyhub-next/build/dist/scan.js +1 -1
- package/node_modules/@allyhub-next/build/package.json +1 -1
- package/node_modules/@allyhub-next/check/dist/check.js +3 -3
- package/node_modules/@allyhub-next/check/package.json +1 -1
- package/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
- package/node_modules/@allyhub-next/cloud/dist/token.js +1 -1
- package/node_modules/@allyhub-next/cloud/package.json +1 -1
- package/node_modules/@allyhub-next/components/package.json +1 -1
- package/node_modules/@allyhub-next/dev-server/dist/live.js +1 -1
- package/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -1
- package/node_modules/@allyhub-next/dev-server/package.json +1 -1
- package/node_modules/@allyhub-next/doc/package.json +1 -1
- package/node_modules/@allyhub-next/export/dist/export.d.ts +5 -2
- package/node_modules/@allyhub-next/export/dist/export.js +2 -2
- package/node_modules/@allyhub-next/export/package.json +1 -1
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +5 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/layout.d.ts +2 -0
- package/node_modules/@allyhub-next/formats/dist/layout.js +1 -1
- package/node_modules/@allyhub-next/formats/package.json +1 -1
- package/node_modules/@allyhub-next/measure/package.json +1 -1
- package/node_modules/@allyhub-next/media/package.json +1 -1
- package/node_modules/@allyhub-next/model/dist/report.d.ts +1 -1
- package/node_modules/@allyhub-next/model/package.json +1 -1
- package/node_modules/@allyhub-next/project/package.json +1 -1
- package/node_modules/@allyhub-next/protocol/dist/app.d.ts +3 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +17 -0
- package/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +4 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +3 -1
- package/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +1 -0
- package/node_modules/@allyhub-next/protocol/package.json +1 -1
- package/node_modules/@allyhub-next/registry/package.json +1 -1
- package/node_modules/@allyhub-next/render/package.json +1 -1
- package/node_modules/@allyhub-next/runtime/dist/page.js +1 -1
- package/node_modules/@allyhub-next/runtime/package.json +1 -1
- package/node_modules/@allyhub-next/runtimes/package.json +1 -1
- package/node_modules/@allyhub-next/scaffold/dist/index.js +5 -5
- package/node_modules/@allyhub-next/scaffold/package.json +1 -1
- package/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/node_modules/@allyhub-next/scenery-host/dist/bundle.d.ts +1 -0
- package/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
- package/node_modules/@allyhub-next/scenery-host/dist/model-stage.d.ts +32 -0
- package/node_modules/@allyhub-next/scenery-host/dist/model-stage.js +3 -0
- package/node_modules/@allyhub-next/scenery-host/package.json +1 -1
- package/node_modules/@allyhub-next/sheet/package.json +1 -1
- package/node_modules/@allyhub-next/site/package.json +1 -1
- package/node_modules/@allyhub-next/stage/package.json +1 -1
- package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
- package/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/package.json +28 -28
- package/editor-web/assets/chevron-left-D1vfOP5S.js +0 -1
- package/editor-web/assets/dist-BIEloJVS.js +0 -8
- package/editor-web/assets/index-BSFR4plz.css +0 -2
- package/editor-web/assets/index-Dc8FX_sp.js +0 -56
|
@@ -53,7 +53,7 @@ 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(),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(`
|
|
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`},model:{entries:Jc(`model`),editor:`scenery`,name:`3D model`},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()}))}),U({to:P().startsWith(`/`)}),H({url:I()}),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`,`allyhub:lib`],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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./react-
|
|
1
|
+
import{c as e}from"./react-Ff_buMj8.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};
|
package/editor-web/index.html
CHANGED
|
@@ -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
|
-
<link rel="modulepreload" crossorigin href="/assets/react-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/floating-ui.react-dom-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CFZhjTQW.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/react-Ff_buMj8.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/floating-ui.react-dom-BUxFRF6t.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DgU-lyX6.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{builtinModules as A}from"node:module";import{parseSync as g,visitorKeys as E}from"oxc-parser";import{problem as f,repoPath as K}from"@allyhub-next/video-core";export function parse(t,
|
|
2
|
+
import{builtinModules as A}from"node:module";import{parseSync as g,visitorKeys as E}from"oxc-parser";import{problem as f,repoPath as K}from"@allyhub-next/video-core";export function parse(t,n){const e=g(t,n,{sourceType:"module"});return{program:e.program,errors:e.errors.map(o=>({message:o.message,...o.labels[0]?{start:o.labels[0].start}:{}})),source:n}}export function lineAt(t,n){let e=1;for(let o=0;o<n&&o<t.length;o++)t.charCodeAt(o)===10&&e++;return e}const m=t=>typeof t=="object"&&t!==null&&typeof t.type=="string",I=new Set(["typeAnnotation","typeParameters","typeArguments","returnType","superTypeArguments","implements"]);export function walk(t,n){const e=[],o=r=>{if(r.type.startsWith("TS")){const i=r.expression;m(i)&&(e.push(r),o(i),e.pop());return}if(!((r.type==="ImportDeclaration"||r.type==="ExportNamedDeclaration")&&r.importKind==="type")){n(r,e),e.push(r);for(const i of E[r.type]??Object.keys(r)){if(I.has(i))continue;const p=r[i];if(Array.isArray(p))for(const a of p)m(a)&&o(a);else m(p)&&o(p)}e.pop()}};o(t)}export const SDK="@allyhub/sdk",SDK_ENTRIES=new Set([SDK,`${SDK}/dom`,`${SDK}/media`,`${SDK}/scenery`]),LENT=new Set(["three","@allyhub-next/model"]);function S(t,n){const e=new Set;for(const o of t.body)if(!(o.type!=="ImportDeclaration"||o.source.value!==SDK))for(const i of o.specifiers??[]){if(i.type!=="ImportSpecifier")continue;const p=i.imported;(p.name??p.value)===n&&e.add(i.local.name)}return e}function d(t){let n=t;for(;["TSAsExpression","TSSatisfiesExpression","ParenthesizedExpression","TSNonNullExpression"].includes(n.type)&&m(n.expression);)n=n.expression;return n}const h=(t,n)=>{if(!t)return!1;const e=d(t);if(e.type!=="CallExpression")return!1;const o=e.callee;return o.type==="Identifier"&&n.has(o.name)},w=["video","slides"];export function discover(t,n){const e=[],{program:o,source:r}=n,i=new Set(w.flatMap(l=>[...S(o,l)])),p=S(o,"defineComponent").size>0,a=o.body,u=a.find(l=>l.type==="ExportDefaultDeclaration"),s=l=>({file:t,line:lineAt(r,l.start)});if(!u)return i.size>0&&/\bexport\s+\{[^}]*\bdefault\b/.test(r)&&e.push(f("AK-M001",`${t} imports ${[...i].join(" and ")}, but its default export is a re-export. An item's entry file writes export default video({ … }) (or slides({ … })) itself: AllyHub does not look in other files.`,{where:{file:t}})),{piece:!1,components:p,problems:e};const c=u.declaration;if(h(c,i))return{piece:!0,components:p,problems:e};const y=d(c);if(y.type==="Identifier"){const l=y.name;for(const x of a)if(x.type==="VariableDeclaration")for(const $ of x.declarations){const b=$.id;if(b.type==="Identifier"&&b.name===l&&h($.init,i))return{piece:!0,components:p,problems:e}}}return i.size>0?e.push(f("AK-M001",`${t} imports ${[...i].join(" and ")}, but its default export is not a video(…) or slides(…) call. Write export default video({ … }), or const film = video({ … }); export default film. AllyHub does not follow factory functions or conditional expressions.`,{where:s(u)})):h(c,new Set(w))&&e.push(f("AK-M001",`The ${String(d(c).callee.name)} that ${t} calls is not imported from ${SDK}. Write import { video } from "${SDK}" (slides for a deck).`,{where:s(u)})),{piece:!1,components:p,problems:e}}const T=new Set([...A,...A.map(t=>`node:${t}`)]);export function packageName(t){const n=t.split("/");return t.startsWith("@")?n.slice(0,2).join("/"):n[0]??t}export function checkImports(t,n,e,o=new Set){const r=[],{program:i,source:p}=n;for(const a of i.body){if(!/^(Import|ExportNamed|ExportAll)Declaration$/.test(a.type)||a.importKind==="type"||a.exportKind==="type")continue;const s=a.source?.value;if(typeof s!="string")continue;const c={file:t,line:lineAt(p,a.start)};if(/^(https?:)?\/\//i.test(s)){r.push(f("AK-B005",`${t} imports the remote address ${s}. The build has no network: install it as an npm package, or put it in the project.`,{where:c}));continue}if(s.startsWith(".")||s.startsWith("/")){K(t,s)===void 0&&r.push(f("AK-B005",`${t} imports ${s}, a file outside the project. Put it in the project.`,{where:c}));continue}if(packageName(s)===SDK){SDK_ENTRIES.has(s)||r.push(f("AK-B006",s===`${SDK}/components`?`${t} imports ${s}: the components are not part of the SDK. A project has its own copies: allyhub add lists the starter components and copies one in (allyhub add component/screen-demo).`:`${t} imports ${s}, which ${SDK} does not have. Its entry points: ${[...SDK_ENTRIES].join(", ")}.`,{where:c}));continue}T.has(s)||LENT.has(packageName(s))||o.has(packageName(s))||e.has(packageName(s))||r.push(f("AK-B005",`${t} imports ${s}, but package.json does not declare ${packageName(s)}. Add it with npm install ${packageName(s)}.`,{where:c}))}return r}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createHash as te}from"node:crypto";import{
|
|
3
|
-
`)}}function
|
|
4
|
-
`)[0]??""}`}}return await
|
|
2
|
+
import{createHash as te}from"node:crypto";import{join as se}from"node:path";import{uniformInt as ne}from"pure-rand/distribution/uniformInt";import{xoroshiro128plus as ge}from"pure-rand/generator/xoroshiro128plus";import{CACHE_DIR as we}from"@allyhub-next/formats";import{buildModule as xe}from"@allyhub-next/model/build";import{ffmpegOf as be,ffmpegRuns as ye,postPlaces as $e,postProblems as ke,readPng as oe}from"@allyhub-next/render";import{comboIdOf as U,comboKey as B,comboMatches as Se,countLevels as Me,coverCombos as Fe,cutThroughout as ie,pieceNamed as ae,problem as N,CONSOLE_LIMIT as ve}from"@allyhub-next/video-core";import{OutputCache as Ce,cacheKey as Le,checkerId as De}from"./cache.js";import{consoleOf as Ee,baseDigest as Ae,outputDigest as re,dedupe as ce,StuckError as me,CheckSession as Pe,runtimeDigest as _e,extraCombos as Ie}from"@allyhub-next/project";import{matrixFacts as Ke,measuredFacts as Oe,screenFidelity as Te,flatFrames as Re,cutSeams as je,flashFrames as He,stillPicture as Be}from"@allyhub-next/measure";import{generatedFact as Ne,generatedPagedFact as ze,mismatchFacts as Ue}from"./generated.js";import{StretchLoudness as fe,estimatePlan as Ge,loadedPlan as Ye,planProblems as qe}from"./plans.js";import{sceneryLayerFacts as Je,withBakes as Qe}from"./scenery.js";export function checkStats(s,t,n,e=0){const i=t.length;return{loaded:t,reused:n,outputs:{total:s,checked:i,reused:Math.max(0,s-i-e),covered:e}}}const Ve=new Set(["text-time","words-on-screen","text-covered","flat-frames","still-picture"]);export const plural=(s,t)=>`${String(s)} ${t}${s===1?"":"s"}`;const le=s=>ge(te("sha256").update(s).digest().readInt32BE(0));export function samplesFor(s,t,n,e){const i=new Set(s.slice(0,e)),r=le(n),c=Math.floor(t*30);for(let m=0;i.size<Math.min(e,c)&&m<e*20;m++)i.add(ne(r,0,c-1)/30);return[...i]}export function shuffled(s,t){const n=[...s],e=le(t);for(let i=n.length-1;i>0;i--){const r=ne(e,0,i),c=n[i],m=n[r];c===void 0||m===void 0||(n[i]=m,n[r]=c)}return n}export const RASTER_NOISE=3,RASTER_SPECKS=8;export function frameDifference(s,t){const n=oe(s),e=oe(t);if(n.width!==e.width||n.height!==e.height)return{max:255,pixels:Math.max(n.width*n.height,1)};let i=0,r=0;for(let c=0;c<n.data.length;c+=4){let m=0;for(let f=0;f<4;f++)m=Math.max(m,Math.abs((n.data[c+f]??0)-(e.data[c+f]??0)));m>RASTER_NOISE&&r++,m>i&&(i=m)}return{max:i,pixels:r}}export const CUT_RECHECK={most:48,every:2};export async function recheckCuts(s,t,n,e){const i=ie(t);if(i.length===0)return t;const r=CUT_RECHECK.every/n,c=new Set;for(const f of i){const a=e.find(h=>h.key===f.part);if(!a)continue;const p=t.moments.filter(h=>h.part===f.part).map(h=>h.t).sort((h,C)=>h-C),x=f.moments[0]??f.t,b=f.moments.at(-1)??f.t,v=Math.max(a.start,p.filter(h=>h<x).at(-1)??a.start),I=Math.min(a.end-1/n,p.find(h=>h>b)??a.end),E=Math.min(CUT_RECHECK.most,Math.floor((I-v)/r)+1),R=E>1?(I-v)/(E-1):0;for(let h=0;h<E;h++){const C=Math.round((v+R*h)*n)/n;p.includes(C)||c.add(C)}}if(c.size===0)return t;const m=await s.measure([...c].sort((f,a)=>f-a));return{...t,moments:[...t.moments,...m.moments].sort((f,a)=>f.t-a.t)}}export function offFrameProblems(s,t){const n=e=>`${e.toFixed(2)} s`;return ie(s).map(e=>{const i=e.moments[0]??0,r=e.moments.at(-1)??i,c=e.moments.length===1?`at ${n(i)}, the one moment measured that shows it`:`at all ${String(e.moments.length)} moments measured that show it (${i.toFixed(2)}–${n(r)})`,m=e.worst.edges.map(f=>`${String(f.px)} pixels past the ${f.side} edge`).join(" and ");return N("AK-L002",`Text goes off the frame: the frame cuts "${e.text.text.length>40?`${e.text.text.slice(0,40)}…`:e.text.text}" ${c}; its letters reach ${m} at ${t.format} (${String(Math.round(e.worst.share*100))}% of them outside). Move it inside the frame or make it smaller (fitText in a component); text that is part of a picture the frame crops on purpose (a mocked interface) goes inside an element with data-ak-picture. allyhub inspect --kind text-off-frame has each moment.`,{piece:t.piece,output:t.output,combo:t.combo,format:t.format,part:e.part,t:e.t,where:{bbox:e.worst.glyphs}})})}const de=s=>te("sha256").update(s).digest("hex");export async function determinism(s,t,n){const e=s.timeline,i=samplesFor(e.parts.map(a=>a.still),e.duration,t,n),r=new Map;for(const a of[...i].sort((p,x)=>p-x))r.set(a,await s.shot(a));const c=[];let m=0;for(const a of shuffled(i,`${t}:shuffle`)){const p=r.get(a),x=await s.shot(a);if(!p||de(x)===de(p))continue;const b=frameDifference(p,x);b.pixels>RASTER_SPECKS&&(c.push(a),m=Math.max(m,b.max))}if(c.length===0)return[];c.sort((a,p)=>a-p);const f=[...new Set(c.flatMap(a=>e.parts.filter(p=>a>=p.start&&a<p.end).map(p=>p.key)))];return[N("AK-D002",`${plural(c.length,"moment")} drew differently in order and out of order (${c.map(a=>`${a.toFixed(2)}s`).join(", ")}; pixels differ by up to ${String(m)} levels). render must depend only on t, not on state left by an earlier frame.`,{piece:s.target.piece,output:s.target.output,combo:s.target.combo,format:s.target.format,t:c[0]??0,...f.length===1&&f[0]?{part:f[0]}:{}})]}export function summarize(s){const t=Me(s);return{status:t.errors>0?"failed":t.warnings>0?"warnings":"passed",...t}}function We(s,t){const n=r=>[r.piece??"",r.output??"",r.combo?B(r.combo):"",r.format??"",r.part??"",r.where?.file??"",String(r.where?.line??0).padStart(6,"0"),r.code].join("\0"),e=n(s),i=n(t);return e<i?-1:e>i?1:0}class Xe{spent=new Map;on=process.env.ALLYHUB_CHECK_TIMINGS==="1";async time(t,n){if(!this.on)return n();const e=performance.now();try{return await n()}finally{this.spent.set(t,(this.spent.get(t)??0)+(performance.now()-e)/1e3)}}report(){if(!this.on)return;const t=[...this.spent].sort((n,e)=>e[1]-n[1]);process.stderr.write(`Check timings (s): ${t.map(([n,e])=>`${n} ${e.toFixed(2)}`).join(", ")}
|
|
3
|
+
`)}}function Ze(s){const t=s.options,n=t.post,e=typeof n=="object"&&n!==null?n.filter:void 0;return{transparent:t.transparent===!0,deliverable:t.deliverable!==!1,...typeof t.maxDuration=="number"?{maxDuration:t.maxDuration}:{},...typeof e=="string"?{post:e}:{}}}async function et(s){let t;try{t=await be(s===void 0?{}:{ffmpeg:s})}catch(n){return{missing:`the pinned ffmpeg could not be had: ${(n instanceof Error?n.message:String(n)).split(`
|
|
4
|
+
`)[0]??""}`}}return await ye(t)?{ffmpeg:t}:{missing:`${t} does not run`}}export async function runCheck(s){const t=new Xe,n=s.session??await t.time("prepare (discover, metadata, bundle)",()=>Pe.open({root:s.dir,...s.buildDir===void 0?{}:{buildDir:s.buildDir},...s.gpu===void 0?{}:{gpu:s.gpu},...s.consoleLimit===void 0?{}:{consoleLimit:s.consoleLimit}}));try{const e=n.prepared,i=s.samples??12,r=n.consoleLimit,c=await _e(),m=await Ce.open(e.root,await De({runtimeSha:c,samples:i,gpu:n.gpu,...r===ve?{}:{consoleLimit:r}}));let f;const a=()=>f??=et(s.ffmpeg),p=[],x=[...e.problems],b=[],v=[],I=[],E=[];let R=0,h=0;const C=[];let L;const ue=e.pieces.filter(o=>s.piece===void 0||ae({id:o.id,path:o.place},s.piece));for(const o of ue){if(!e.bundle?.chunks.entries[o.id.replaceAll("/","__")])continue;const S=Ze(o),A=o.kind,K=o.format,Y=await Ae(e,o,c);b.push(...Ke(o));const q=new Set,j=[...o.combos.filter(u=>!s.combos?.length||s.combos.some(d=>Se(u,d,U(o.matrix,u)))),...Ie(o,s.combos)],pe=new Set(o.matrix?Fe(o.matrix.space,o.dims,j):j.keys()),P=[],J=u=>{I.push(u);for(const d of u.reads?.media??[])q.add(d.path);u.timeline&&P.push({...u,timeline:u.timeline})};let z=!1;const he=(u,d,_)=>{if(s.fresh===!0)return;const l=m.get(u),k=l?.result.reads,F=l?.result.timeline;return!l||!k||!F||_&&!l.sampled||l.factless===!0&&s.facts!==!1?void 0:re(e,Y,o,d,k,F.parts.map(g=>g.key))===l.digest?l:void 0};for(const[u,d]of j.entries()){const _=U(o.matrix,d),l={piece:o.id,output:A,combo:d,format:K},k=B(d);if(v.push({...l,..._?{id:_}:{},key:k}),!pe.has(u)){h++;continue}const F=o.kind==="video"&&!z,D=Le(o.id,A,k,K),g=he(D,d,F);if(g){R++,g.sampled&&(z=!0),x.push(...g.problems),b.push(...g.facts),p.push({version:l,log:g.console}),J({...g.result,digest:g.digest}),m.set(D,g);continue}E.push(`${o.id}/${A}/${k}/${K}`);const w=await t.time("load (mount, stills)",()=>n.open(o,l));try{const $=w.summary,O=[],M=[...$?.facts??[]];let Q=!1;try{if($){const y=$.timeline;try{const T=await t.time("layout measure",()=>w.measure());O.push(...offFrameProblems(await t.time("recheck cut text",()=>recheckCuts(w,T,y.fps,y.parts)),l));const ee=await a();M.push(...await t.time("layout facts",()=>Oe(T,y,l,{root:e.root,media:e.media,ffmpeg:"ffmpeg"in ee?ee.ffmpeg:"ffmpeg"},y.profile?.label)))}catch(T){if(T instanceof me)throw T}s.facts!==!1&&M.push(...await t.time("scenery facts",()=>Je(w)))}$&&F&&(z=!0,Q=!0,O.push(...await t.time("determinism",()=>determinism(w,`${o.id}:${A}:${K}`,i))),s.facts!==!1&&!S.transparent&&M.push(...await t.time("flat frames",()=>Re(w))),s.facts!==!1&&M.push(...await t.time("still picture",()=>Be(w))),s.facts!==!1&&(M.push(...await t.time("cut seams",()=>je(w))),S.transparent||M.push(...await t.time("flash",()=>He(w))))),$&&s.facts!==!1&&M.push(...(await t.time("scenery screen fidelity",()=>Te(w))).facts)}catch(y){if(!(y instanceof me))throw y;y.kept||O.push(N("AK-P003",y.message,{piece:l.piece,output:l.output,combo:l.combo,format:l.format}))}O.push(...await w.problems());const V=ce(O);x.push(...V);const W=S.deliverable?M:M.filter(y=>!Ve.has(y.kind));b.push(...W);const X=await w.console();p.push({version:l,log:X});const H=$?re(e,Y,o,d,$.reads,$.timeline.parts.map(y=>y.key)):void 0,Z={...l,...$?{timeline:$.timeline,reads:$.reads,text:$.text}:{}};J({...Z,...H?{digest:H}:{}}),H&&m.set(D,{digest:H,result:Z,problems:V,facts:W,sampled:Q,...s.facts===!1?{factless:!0}:{},console:X})}finally{await w.close()}}if(o.kind==="video"){const u=$e(S.post,P.map(d=>d.timeline));if(u.length>0){const d=await a();"ffmpeg"in d&&x.push(...await t.time("post chains",()=>ke(u,{piece:o.id,output:A},d.ffmpeg)))}}if(o.kind!=="video")for(const u of P){const d=ze(u,e.media);d&&b.push(d)}else for(const u of j){const d=U(o.matrix,u),_=B(u),l=P.find(g=>B(g.combo)===_),k=l?Ye(l,d):Ge(o,u,d,A,K,P);if(!k)continue;if(C.push(k),o.matrix&&L===void 0){const g=await a();if("ffmpeg"in g){const w=new fe(e.root,g.ffmpeg);await w.open(),L=w}else L={missing:"ffmpeg",why:`${g.missing} (set ALLYHUB_FFMPEG to an ffmpeg, or let the runtime manager fetch its pinned one)`}}const F=await t.time("plans (loudness, music)",()=>qe(k,{...S.maxDuration===void 0?{}:{maxDuration:S.maxDuration},fps:l?.timeline.fps??P[0]?.timeline.fps??30,media:e.media,local:g=>n.mediaPath(g),...o.matrix&&L?{loudness:L}:{}}));x.push(...F.problems),b.push(...F.facts);const D=Ne(k,e.media);D&&b.push(D)}b.push(...Ue({piece:o.id},q,e.media))}for(const o of e.items)if(o.kind==="model"&&!(s.piece!==void 0&&!ae({id:o.dir,path:o.dir},s.piece)))try{await t.time("models",()=>xe(se(e.root,o.entry),{root:e.root,cache:se(e.root,we,"model"),log:()=>{}}))}catch(S){x.push(N("AK-B010",`${o.entry} does not build: ${S instanceof Error?S.message:String(S)}`,{piece:o.dir,where:{file:o.entry}}))}L instanceof fe&&await L.save(),await m.save(new Set(e.pieces.map(o=>o.id)));const G=ce(x).sort(We);return t.report(),{targets:v,check:summarize(G),problems:G,facts:await Qe(b,e.root),results:I,plans:C,stats:checkStats(v.length,E,R,h),console:Ee(r,p)}}finally{s.session||await n.close()}}
|