@ggui-ai/console 0.1.0-rc.1 → 0.1.0-rc.3
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.
|
@@ -84,7 +84,7 @@ Error generating stack: `+o.message+`
|
|
|
84
84
|
|
|
85
85
|
`)}k.write("payload.value = newResult;"),k.write("return payload;");const $=k.compile();return(R,x)=>$(j,R,x)};let u;const d=Xo,p=!Cv.jitless,h=p&&wx.value,y=n.catchall;let v;e._zod.parse=(j,k)=>{v??(v=s.value);const b=j.value;return d(b)?p&&h&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(u||(u=c(n.shape)),j=u(j,k),y?Gv([],b,j,k,v,e):j):i(j,k):(j.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),j)}});function rh(e,n,i,s){for(const u of e)if(u.issues.length===0)return n.value=u.value,n;const c=e.filter(u=>!Ti(u));return c.length===1?(n.value=c[0].value,c[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:i,errors:e.map(u=>u.issues.map(d=>fr(d,s,dr())))}),n)}const Fv=ne("$ZodUnion",(e,n)=>{at.init(e,n),He(e._zod,"optin",()=>n.options.some(c=>c._zod.optin==="optional")?"optional":void 0),He(e._zod,"optout",()=>n.options.some(c=>c._zod.optout==="optional")?"optional":void 0),He(e._zod,"values",()=>{if(n.options.every(c=>c._zod.values))return new Set(n.options.flatMap(c=>Array.from(c._zod.values)))}),He(e._zod,"pattern",()=>{if(n.options.every(c=>c._zod.pattern)){const c=n.options.map(u=>u._zod.pattern);return new RegExp(`^(${c.map(u=>Df(u.source)).join("|")})$`)}});const i=n.options.length===1,s=n.options[0]._zod.run;e._zod.parse=(c,u)=>{if(i)return s(c,u);let d=!1;const p=[];for(const g of n.options){const h=g._zod.run({value:c.value,issues:[]},u);if(h instanceof Promise)p.push(h),d=!0;else{if(h.issues.length===0)return h;p.push(h)}}return d?Promise.all(p).then(g=>rh(g,c,e,u)):rh(p,c,e,u)}}),p4=ne("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Fv.init(e,n);const i=e._zod.parse;He(e._zod,"propValues",()=>{const c={};for(const u of n.options){const d=u._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(u)}"`);for(const[p,g]of Object.entries(d)){c[p]||(c[p]=new Set);for(const h of g)c[p].add(h)}}return c});const s=$c(()=>{var d;const c=n.options,u=new Map;for(const p of c){const g=(d=p._zod.propValues)==null?void 0:d[n.discriminator];if(!g||g.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(p)}"`);for(const h of g){if(u.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);u.set(h,p)}}return u});e._zod.parse=(c,u)=>{const d=c.value;if(!Xo(d))return c.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),c;const p=s.value.get(d==null?void 0:d[n.discriminator]);return p?p._zod.run(c,u):n.unionFallback?i(c,u):(c.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:d,path:[n.discriminator],inst:e}),c)}}),g4=ne("$ZodIntersection",(e,n)=>{at.init(e,n),e._zod.parse=(i,s)=>{const c=i.value,u=n.left._zod.run({value:c,issues:[]},s),d=n.right._zod.run({value:c,issues:[]},s);return u instanceof Promise||d instanceof Promise?Promise.all([u,d]).then(([g,h])=>ih(i,g,h)):ih(i,u,d)}});function jf(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(Di(e)&&Di(n)){const i=Object.keys(n),s=Object.keys(e).filter(u=>i.indexOf(u)!==-1),c={...e,...n};for(const u of s){const d=jf(e[u],n[u]);if(!d.valid)return{valid:!1,mergeErrorPath:[u,...d.mergeErrorPath]};c[u]=d.data}return{valid:!0,data:c}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let s=0;s<e.length;s++){const c=e[s],u=n[s],d=jf(c,u);if(!d.valid)return{valid:!1,mergeErrorPath:[s,...d.mergeErrorPath]};i.push(d.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function ih(e,n,i){const s=new Map;let c;for(const p of n.issues)if(p.code==="unrecognized_keys"){c??(c=p);for(const g of p.keys)s.has(g)||s.set(g,{}),s.get(g).l=!0}else e.issues.push(p);for(const p of i.issues)if(p.code==="unrecognized_keys")for(const g of p.keys)s.has(g)||s.set(g,{}),s.get(g).r=!0;else e.issues.push(p);const u=[...s].filter(([,p])=>p.l&&p.r).map(([p])=>p);if(u.length&&c&&e.issues.push({...c,keys:u}),Ti(e))return e;const d=jf(n.value,i.value);if(!d.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(d.mergeErrorPath)}`);return e.value=d.data,e}const m4=ne("$ZodRecord",(e,n)=>{at.init(e,n),e._zod.parse=(i,s)=>{const c=i.value;if(!Di(c))return i.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),i;const u=[],d=n.keyType._zod.values;if(d){i.value={};const p=new Set;for(const h of d)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){p.add(typeof h=="number"?h.toString():h);const y=n.valueType._zod.run({value:c[h],issues:[]},s);y instanceof Promise?u.push(y.then(v=>{v.issues.length&&i.issues.push(...Mi(h,v.issues)),i.value[h]=v.value})):(y.issues.length&&i.issues.push(...Mi(h,y.issues)),i.value[h]=y.value)}let g;for(const h in c)p.has(h)||(g=g??[],g.push(h));g&&g.length>0&&i.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:g})}else{i.value={};for(const p of Reflect.ownKeys(c)){if(p==="__proto__")continue;let g=n.keyType._zod.run({value:p,issues:[]},s);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&Lv.test(p)&&g.issues.length){const v=n.keyType._zod.run({value:Number(p),issues:[]},s);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(g=v)}if(g.issues.length){n.mode==="loose"?i.value[p]=c[p]:i.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(v=>fr(v,s,dr())),input:p,path:[p],inst:e});continue}const y=n.valueType._zod.run({value:c[p],issues:[]},s);y instanceof Promise?u.push(y.then(v=>{v.issues.length&&i.issues.push(...Mi(p,v.issues)),i.value[g.value]=v.value})):(y.issues.length&&i.issues.push(...Mi(p,y.issues)),i.value[g.value]=y.value)}}return u.length?Promise.all(u).then(()=>i):i}}),h4=ne("$ZodEnum",(e,n)=>{at.init(e,n);const i=Ev(n.entries),s=new Set(i);e._zod.values=s,e._zod.pattern=new RegExp(`^(${i.filter(c=>kx.has(typeof c)).map(c=>typeof c=="string"?Ii(c):c.toString()).join("|")})$`),e._zod.parse=(c,u)=>{const d=c.value;return s.has(d)||c.issues.push({code:"invalid_value",values:i,input:d,inst:e}),c}}),y4=ne("$ZodLiteral",(e,n)=>{if(at.init(e,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const i=new Set(n.values);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.values.map(s=>typeof s=="string"?Ii(s):s?Ii(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,c)=>{const u=s.value;return i.has(u)||s.issues.push({code:"invalid_value",values:n.values,input:u,inst:e}),s}}),v4=ne("$ZodTransform",(e,n)=>{at.init(e,n),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new zv(e.constructor.name);const c=n.transform(i.value,i);if(s.async)return(c instanceof Promise?c:Promise.resolve(c)).then(d=>(i.value=d,i));if(c instanceof Promise)throw new Ri;return i.value=c,i}});function oh(e,n){return e.issues.length&&n===void 0?{issues:[],value:void 0}:e}const Yv=ne("$ZodOptional",(e,n)=>{at.init(e,n),e._zod.optin="optional",e._zod.optout="optional",He(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),He(e._zod,"pattern",()=>{const i=n.innerType._zod.pattern;return i?new RegExp(`^(${Df(i.source)})?$`):void 0}),e._zod.parse=(i,s)=>{if(n.innerType._zod.optin==="optional"){const c=n.innerType._zod.run(i,s);return c instanceof Promise?c.then(u=>oh(u,i.value)):oh(c,i.value)}return i.value===void 0?i:n.innerType._zod.run(i,s)}}),$4=ne("$ZodExactOptional",(e,n)=>{Yv.init(e,n),He(e._zod,"values",()=>n.innerType._zod.values),He(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(i,s)=>n.innerType._zod.run(i,s)}),b4=ne("$ZodNullable",(e,n)=>{at.init(e,n),He(e._zod,"optin",()=>n.innerType._zod.optin),He(e._zod,"optout",()=>n.innerType._zod.optout),He(e._zod,"pattern",()=>{const i=n.innerType._zod.pattern;return i?new RegExp(`^(${Df(i.source)}|null)$`):void 0}),He(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(i,s)=>i.value===null?i:n.innerType._zod.run(i,s)}),x4=ne("$ZodDefault",(e,n)=>{at.init(e,n),e._zod.optin="optional",He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return n.innerType._zod.run(i,s);if(i.value===void 0)return i.value=n.defaultValue,i;const c=n.innerType._zod.run(i,s);return c instanceof Promise?c.then(u=>sh(u,n)):sh(c,n)}});function sh(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const j4=ne("$ZodPrefault",(e,n)=>{at.init(e,n),e._zod.optin="optional",He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(i,s)=>(s.direction==="backward"||i.value===void 0&&(i.value=n.defaultValue),n.innerType._zod.run(i,s))}),_4=ne("$ZodNonOptional",(e,n)=>{at.init(e,n),He(e._zod,"values",()=>{const i=n.innerType._zod.values;return i?new Set([...i].filter(s=>s!==void 0)):void 0}),e._zod.parse=(i,s)=>{const c=n.innerType._zod.run(i,s);return c instanceof Promise?c.then(u=>lh(u,e)):lh(c,e)}});function lh(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const S4=ne("$ZodCatch",(e,n)=>{at.init(e,n),He(e._zod,"optin",()=>n.innerType._zod.optin),He(e._zod,"optout",()=>n.innerType._zod.optout),He(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return n.innerType._zod.run(i,s);const c=n.innerType._zod.run(i,s);return c instanceof Promise?c.then(u=>(i.value=u.value,u.issues.length&&(i.value=n.catchValue({...i,error:{issues:u.issues.map(d=>fr(d,s,dr()))},input:i.value}),i.issues=[]),i)):(i.value=c.value,c.issues.length&&(i.value=n.catchValue({...i,error:{issues:c.issues.map(u=>fr(u,s,dr()))},input:i.value}),i.issues=[]),i)}}),w4=ne("$ZodPipe",(e,n)=>{at.init(e,n),He(e._zod,"values",()=>n.in._zod.values),He(e._zod,"optin",()=>n.in._zod.optin),He(e._zod,"optout",()=>n.out._zod.optout),He(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(i,s)=>{if(s.direction==="backward"){const u=n.out._zod.run(i,s);return u instanceof Promise?u.then(d=>$l(d,n.in,s)):$l(u,n.in,s)}const c=n.in._zod.run(i,s);return c instanceof Promise?c.then(u=>$l(u,n.out,s)):$l(c,n.out,s)}});function $l(e,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},i)}const k4=ne("$ZodReadonly",(e,n)=>{at.init(e,n),He(e._zod,"propValues",()=>n.innerType._zod.propValues),He(e._zod,"values",()=>n.innerType._zod.values),He(e._zod,"optin",()=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optin}),He(e._zod,"optout",()=>{var i,s;return(s=(i=n.innerType)==null?void 0:i._zod)==null?void 0:s.optout}),e._zod.parse=(i,s)=>{if(s.direction==="backward")return n.innerType._zod.run(i,s);const c=n.innerType._zod.run(i,s);return c instanceof Promise?c.then(ch):ch(c)}});function ch(e){return e.value=Object.freeze(e.value),e}const N4=ne("$ZodLazy",(e,n)=>{at.init(e,n),He(e._zod,"innerType",()=>n.getter()),He(e._zod,"pattern",()=>{var i,s;return(s=(i=e._zod.innerType)==null?void 0:i._zod)==null?void 0:s.pattern}),He(e._zod,"propValues",()=>{var i,s;return(s=(i=e._zod.innerType)==null?void 0:i._zod)==null?void 0:s.propValues}),He(e._zod,"optin",()=>{var i,s;return((s=(i=e._zod.innerType)==null?void 0:i._zod)==null?void 0:s.optin)??void 0}),He(e._zod,"optout",()=>{var i,s;return((s=(i=e._zod.innerType)==null?void 0:i._zod)==null?void 0:s.optout)??void 0}),e._zod.parse=(i,s)=>e._zod.innerType._zod.run(i,s)}),z4=ne("$ZodCustom",(e,n)=>{ia.init(e,n),at.init(e,n),e._zod.parse=(i,s)=>i,e._zod.check=i=>{const s=i.value,c=n.fn(s);if(c instanceof Promise)return c.then(u=>uh(u,i,s,e));uh(c,i,s,e)}});function uh(e,n,i,s){if(!e){const c={code:"custom",input:i,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(c.params=s._zod.def.params),n.issues.push(Jo(c))}}var dh;class C4{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...i){const s=i[0];return this._map.set(n,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const i=this._map.get(n);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(n),this}get(n){const i=n._zod.parent;if(i){const s={...this.get(i)??{}};delete s.id;const c={...s,...this._map.get(n)};return Object.keys(c).length?c:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function E4(){return new C4}(dh=globalThis).__zod_globalRegistry??(dh.__zod_globalRegistry=E4());const Wo=globalThis.__zod_globalRegistry;function T4(e,n){return new e({type:"string",..._e(n)})}function M4(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(n)})}function fh(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(n)})}function R4(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(n)})}function O4(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(n)})}function A4(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(n)})}function D4(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(n)})}function Kv(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(n)})}function I4(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(n)})}function U4(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(n)})}function L4(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(n)})}function V4(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(n)})}function H4(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(n)})}function B4(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(n)})}function q4(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(n)})}function P4(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(n)})}function Z4(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(n)})}function G4(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(n)})}function F4(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(n)})}function Y4(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(n)})}function K4(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(n)})}function W4(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(n)})}function X4(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(n)})}function J4(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(n)})}function Q4(e,n){return new e({type:"string",format:"date",check:"string_format",..._e(n)})}function ej(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(n)})}function tj(e,n){return new e({type:"string",format:"duration",check:"string_format",..._e(n)})}function aj(e,n){return new e({type:"number",checks:[],..._e(n)})}function nj(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(n)})}function rj(e,n){return new e({type:"boolean",..._e(n)})}function ij(e,n){return new e({type:"null",..._e(n)})}function oj(e){return new e({type:"unknown"})}function sj(e,n){return new e({type:"never",..._e(n)})}function ph(e,n){return new Hv({check:"less_than",..._e(n),value:e,inclusive:!1})}function Wd(e,n){return new Hv({check:"less_than",..._e(n),value:e,inclusive:!0})}function gh(e,n){return new Bv({check:"greater_than",..._e(n),value:e,inclusive:!1})}function Xd(e,n){return new Bv({check:"greater_than",..._e(n),value:e,inclusive:!0})}function mh(e,n){return new b5({check:"multiple_of",..._e(n),value:e})}function Wv(e,n){return new j5({check:"max_length",..._e(n),maximum:e})}function fc(e,n){return new _5({check:"min_length",..._e(n),minimum:e})}function Xv(e,n){return new S5({check:"length_equals",..._e(n),length:e})}function lj(e,n){return new w5({check:"string_format",format:"regex",..._e(n),pattern:e})}function cj(e){return new k5({check:"string_format",format:"lowercase",..._e(e)})}function uj(e){return new N5({check:"string_format",format:"uppercase",..._e(e)})}function dj(e,n){return new z5({check:"string_format",format:"includes",..._e(n),includes:e})}function fj(e,n){return new C5({check:"string_format",format:"starts_with",..._e(n),prefix:e})}function pj(e,n){return new E5({check:"string_format",format:"ends_with",..._e(n),suffix:e})}function Hi(e){return new T5({check:"overwrite",tx:e})}function gj(e){return Hi(n=>n.normalize(e))}function mj(){return Hi(e=>e.trim())}function hj(){return Hi(e=>e.toLowerCase())}function yj(){return Hi(e=>e.toUpperCase())}function vj(){return Hi(e=>Sx(e))}function $j(e,n,i){return new e({type:"array",element:n,..._e(i)})}function bj(e,n,i){return new e({type:"custom",check:"custom",fn:n,..._e(i)})}function xj(e){const n=jj(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(Jo(s,i.value,n._zod.def));else{const c=s;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=n),c.continue??(c.continue=!n._zod.def.abort),i.issues.push(Jo(c))}},e(i.value,i)));return n}function jj(e,n){const i=new ia({check:"custom",..._e(n)});return i._zod.check=e,i}function Jv(e){let n=(e==null?void 0:e.target)??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Wo,target:n,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function yt(e,n,i={path:[],schemaPath:[]}){var y,v;var s;const c=e._zod.def,u=n.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const d={schema:{},count:1,cycle:void 0,path:i.path};n.seen.set(e,d);const p=(v=(y=e._zod).toJSONSchema)==null?void 0:v.call(y);if(p)d.schema=p;else{const j={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,d.schema,j);else{const b=d.schema,C=n.processors[c.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${c.type}`);C(e,n,b,j)}const k=e._zod.parent;k&&(d.ref||(d.ref=k),yt(k,n,j),n.seen.get(k).isParent=!0)}const g=n.metadataRegistry.get(e);return g&&Object.assign(d.schema,g),n.io==="input"&&Wt(e)&&(delete d.schema.examples,delete d.schema.default),n.io==="input"&&d.schema._prefault&&((s=d.schema).default??(s.default=d.schema._prefault)),delete d.schema._prefault,n.seen.get(e).schema}function Qv(e,n){var d,p,g,h;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const y of e.seen.entries()){const v=(d=e.metadataRegistry.get(y[0]))==null?void 0:d.id;if(v){const j=s.get(v);if(j&&j!==y[0])throw new Error(`Duplicate schema id "${v}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(v,y[0])}}const c=y=>{var C;const v=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const z=(C=e.external.registry.get(y[0]))==null?void 0:C.id,N=e.external.uri??(w=>w);if(z)return{ref:N(z)};const $=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=$,{defId:$,ref:`${N("__shared")}#/${v}/${$}`}}if(y[1]===i)return{ref:"#"};const k=`#/${v}/`,b=y[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:k+b}},u=y=>{if(y[1].schema.$ref)return;const v=y[1],{ref:j,defId:k}=c(y);v.def={...v.schema},k&&(v.defId=k);const b=v.schema;for(const C in b)delete b[C];b.$ref=j};if(e.cycles==="throw")for(const y of e.seen.entries()){const v=y[1];if(v.cycle)throw new Error(`Cycle detected: #/${(p=v.cycle)==null?void 0:p.join("/")}/<root>
|
|
86
86
|
|
|
87
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const v=y[1];if(n===y[0]){u(y);continue}if(e.external){const k=(g=e.external.registry.get(y[0]))==null?void 0:g.id;if(n!==y[0]&&k){u(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){u(y);continue}if(v.cycle){u(y);continue}if(v.count>1&&e.reused==="ref"){u(y);continue}}}function e1(e,n){var d,p,g;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=h=>{const y=e.seen.get(h);if(y.ref===null)return;const v=y.def??y.schema,j={...v},k=y.ref;if(y.ref=null,k){s(k);const C=e.seen.get(k),z=C.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(z)):Object.assign(v,z),Object.assign(v,j),h._zod.parent===k)for(const $ in v)$==="$ref"||$==="allOf"||$ in j||delete v[$];if(z.$ref&&C.def)for(const $ in v)$==="$ref"||$==="allOf"||$ in C.def&&JSON.stringify(v[$])===JSON.stringify(C.def[$])&&delete v[$]}const b=h._zod.parent;if(b&&b!==k){s(b);const C=e.seen.get(b);if(C!=null&&C.schema.$ref&&(v.$ref=C.schema.$ref,C.def))for(const z in v)z==="$ref"||z==="allOf"||z in C.def&&JSON.stringify(v[z])===JSON.stringify(C.def[z])&&delete v[z]}e.override({zodSchema:h,jsonSchema:v,path:y.path??[]})};for(const h of[...e.seen.entries()].reverse())s(h[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,(d=e.external)!=null&&d.uri){const h=(p=e.external.registry.get(n))==null?void 0:p.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(h)}Object.assign(c,i.def??i.schema);const u=((g=e.external)==null?void 0:g.defs)??{};for(const h of e.seen.entries()){const y=h[1];y.def&&y.defId&&(u[y.defId]=y.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{const h=JSON.parse(JSON.stringify(c));return Object.defineProperty(h,"~standard",{value:{...n["~standard"],jsonSchema:{input:pc(n,"input",e.processors),output:pc(n,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Wt(e,n){const i=n??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Wt(s.element,i);if(s.type==="set")return Wt(s.valueType,i);if(s.type==="lazy")return Wt(s.getter(),i);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Wt(s.innerType,i);if(s.type==="intersection")return Wt(s.left,i)||Wt(s.right,i);if(s.type==="record"||s.type==="map")return Wt(s.keyType,i)||Wt(s.valueType,i);if(s.type==="pipe")return Wt(s.in,i)||Wt(s.out,i);if(s.type==="object"){for(const c in s.shape)if(Wt(s.shape[c],i))return!0;return!1}if(s.type==="union"){for(const c of s.options)if(Wt(c,i))return!0;return!1}if(s.type==="tuple"){for(const c of s.items)if(Wt(c,i))return!0;return!!(s.rest&&Wt(s.rest,i))}return!1}const _j=(e,n={})=>i=>{const s=Jv({...i,processors:n});return yt(e,s),Qv(s,e),e1(s,e)},pc=(e,n,i={})=>s=>{const{libraryOptions:c,target:u}=s??{},d=Jv({...c??{},target:u,io:n,processors:i});return yt(e,d),Qv(d,e),e1(d,e)},Sj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wj=(e,n,i,s)=>{const c=i;c.type="string";const{minimum:u,maximum:d,format:p,patterns:g,contentEncoding:h}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof d=="number"&&(c.maxLength=d),p&&(c.format=Sj[p]??p,c.format===""&&delete c.format,p==="time"&&delete c.format),h&&(c.contentEncoding=h),g&&g.size>0){const y=[...g];y.length===1?c.pattern=y[0].source:y.length>1&&(c.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},kj=(e,n,i,s)=>{const c=i,{minimum:u,maximum:d,format:p,multipleOf:g,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof p=="string"&&p.includes("int")?c.type="integer":c.type="number",typeof y=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(c.minimum=y,c.exclusiveMinimum=!0):c.exclusiveMinimum=y),typeof u=="number"&&(c.minimum=u,typeof y=="number"&&n.target!=="draft-04"&&(y>=u?delete c.minimum:delete c.exclusiveMinimum)),typeof h=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(c.maximum=h,c.exclusiveMaximum=!0):c.exclusiveMaximum=h),typeof d=="number"&&(c.maximum=d,typeof h=="number"&&n.target!=="draft-04"&&(h<=d?delete c.maximum:delete c.exclusiveMaximum)),typeof g=="number"&&(c.multipleOf=g)},Nj=(e,n,i,s)=>{i.type="boolean"},zj=(e,n,i,s)=>{n.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Cj=(e,n,i,s)=>{i.not={}},Ej=(e,n,i,s)=>{},Tj=(e,n,i,s)=>{const c=e._zod.def,u=Ev(c.entries);u.every(d=>typeof d=="number")&&(i.type="number"),u.every(d=>typeof d=="string")&&(i.type="string"),i.enum=u},Mj=(e,n,i,s)=>{const c=e._zod.def,u=[];for(const d of c.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(d))}else u.push(d);if(u.length!==0)if(u.length===1){const d=u[0];i.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?i.enum=[d]:i.const=d}else u.every(d=>typeof d=="number")&&(i.type="number"),u.every(d=>typeof d=="string")&&(i.type="string"),u.every(d=>typeof d=="boolean")&&(i.type="boolean"),u.every(d=>d===null)&&(i.type="null"),i.enum=u},Rj=(e,n,i,s)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Oj=(e,n,i,s)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Aj=(e,n,i,s)=>{const c=i,u=e._zod.def,{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(c.minItems=d),typeof p=="number"&&(c.maxItems=p),c.type="array",c.items=yt(u.element,n,{...s,path:[...s.path,"items"]})},Dj=(e,n,i,s)=>{var h;const c=i,u=e._zod.def;c.type="object",c.properties={};const d=u.shape;for(const y in d)c.properties[y]=yt(d[y],n,{...s,path:[...s.path,"properties",y]});const p=new Set(Object.keys(d)),g=new Set([...p].filter(y=>{const v=u.shape[y]._zod;return n.io==="input"?v.optin===void 0:v.optout===void 0}));g.size>0&&(c.required=Array.from(g)),((h=u.catchall)==null?void 0:h._zod.def.type)==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=yt(u.catchall,n,{...s,path:[...s.path,"additionalProperties"]})):n.io==="output"&&(c.additionalProperties=!1)},Ij=(e,n,i,s)=>{const c=e._zod.def,u=c.inclusive===!1,d=c.options.map((p,g)=>yt(p,n,{...s,path:[...s.path,u?"oneOf":"anyOf",g]}));u?i.oneOf=d:i.anyOf=d},Uj=(e,n,i,s)=>{const c=e._zod.def,u=yt(c.left,n,{...s,path:[...s.path,"allOf",0]}),d=yt(c.right,n,{...s,path:[...s.path,"allOf",1]}),p=h=>"allOf"in h&&Object.keys(h).length===1,g=[...p(u)?u.allOf:[u],...p(d)?d.allOf:[d]];i.allOf=g},Lj=(e,n,i,s)=>{const c=i,u=e._zod.def;c.type="object";const d=u.keyType,p=d._zod.bag,g=p==null?void 0:p.patterns;if(u.mode==="loose"&&g&&g.size>0){const y=yt(u.valueType,n,{...s,path:[...s.path,"patternProperties","*"]});c.patternProperties={};for(const v of g)c.patternProperties[v.source]=y}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(c.propertyNames=yt(u.keyType,n,{...s,path:[...s.path,"propertyNames"]})),c.additionalProperties=yt(u.valueType,n,{...s,path:[...s.path,"additionalProperties"]});const h=d._zod.values;if(h){const y=[...h].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(c.required=y)}},Vj=(e,n,i,s)=>{const c=e._zod.def,u=yt(c.innerType,n,s),d=n.seen.get(e);n.target==="openapi-3.0"?(d.ref=c.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},Hj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType},Bj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,i.default=JSON.parse(JSON.stringify(c.defaultValue))},qj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,n.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},Pj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType;let d;try{d=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=d},Zj=(e,n,i,s)=>{const c=e._zod.def,u=n.io==="input"?c.in._zod.def.type==="transform"?c.out:c.in:c.out;yt(u,n,s);const d=n.seen.get(e);d.ref=u},Gj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,i.readOnly=!0},t1=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType},Fj=(e,n,i,s)=>{const c=e._zod.innerType;yt(c,n,s);const u=n.seen.get(e);u.ref=c},Yj=ne("ZodISODateTime",(e,n)=>{Z5.init(e,n),st.init(e,n)});function Kj(e){return J4(Yj,e)}const Wj=ne("ZodISODate",(e,n)=>{G5.init(e,n),st.init(e,n)});function Xj(e){return Q4(Wj,e)}const Jj=ne("ZodISOTime",(e,n)=>{F5.init(e,n),st.init(e,n)});function Qj(e){return ej(Jj,e)}const e_=ne("ZodISODuration",(e,n)=>{Y5.init(e,n),st.init(e,n)});function t_(e){return tj(e_,e)}const a_=(e,n)=>{Ov.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>Ix(e,i)},flatten:{value:i=>Dx(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,xf,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,xf,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ca=ne("ZodError",a_,{Parent:Error}),n_=Uf(Ca),r_=Lf(Ca),i_=bc(Ca),o_=xc(Ca),s_=Vx(Ca),l_=Hx(Ca),c_=Bx(Ca),u_=qx(Ca),d_=Px(Ca),f_=Zx(Ca),p_=Gx(Ca),g_=Fx(Ca),nt=ne("ZodType",(e,n)=>(at.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:pc(e,"input"),output:pc(e,"output")}}),e.toJSONSchema=_j(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...i)=>e.clone(pr(n,{checks:[...n.checks??[],...i.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(i,s)=>gr(e,i,s),e.brand=()=>e,e.register=((i,s)=>(i.add(e,s),e)),e.parse=(i,s)=>n_(e,i,s,{callee:e.parse}),e.safeParse=(i,s)=>i_(e,i,s),e.parseAsync=async(i,s)=>r_(e,i,s,{callee:e.parseAsync}),e.safeParseAsync=async(i,s)=>o_(e,i,s),e.spa=e.safeParseAsync,e.encode=(i,s)=>s_(e,i,s),e.decode=(i,s)=>l_(e,i,s),e.encodeAsync=async(i,s)=>c_(e,i,s),e.decodeAsync=async(i,s)=>u_(e,i,s),e.safeEncode=(i,s)=>d_(e,i,s),e.safeDecode=(i,s)=>f_(e,i,s),e.safeEncodeAsync=async(i,s)=>p_(e,i,s),e.safeDecodeAsync=async(i,s)=>g_(e,i,s),e.refine=(i,s)=>e.check(cS(i,s)),e.superRefine=i=>e.check(uS(i)),e.overwrite=i=>e.check(Hi(i)),e.optional=()=>vh(e),e.exactOptional=()=>K_(e),e.nullable=()=>$h(e),e.nullish=()=>vh($h(e)),e.nonoptional=i=>tS(e,i),e.array=()=>pt(e),e.or=i=>hn([e,i]),e.and=i=>q_(e,i),e.transform=i=>bh(e,F_(i)),e.default=i=>J_(e,i),e.prefault=i=>eS(e,i),e.catch=i=>nS(e,i),e.pipe=i=>bh(e,i),e.readonly=()=>oS(e),e.describe=i=>{const s=e.clone();return Wo.add(s,{description:i}),s},Object.defineProperty(e,"description",{get(){var i;return(i=Wo.get(e))==null?void 0:i.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return Wo.get(e);const s=e.clone();return Wo.add(s,i[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),a1=ne("_ZodString",(e,n)=>{Vf.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>wj(e,s,c);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...s)=>e.check(lj(...s)),e.includes=(...s)=>e.check(dj(...s)),e.startsWith=(...s)=>e.check(fj(...s)),e.endsWith=(...s)=>e.check(pj(...s)),e.min=(...s)=>e.check(fc(...s)),e.max=(...s)=>e.check(Wv(...s)),e.length=(...s)=>e.check(Xv(...s)),e.nonempty=(...s)=>e.check(fc(1,...s)),e.lowercase=s=>e.check(cj(s)),e.uppercase=s=>e.check(uj(s)),e.trim=()=>e.check(mj()),e.normalize=(...s)=>e.check(gj(...s)),e.toLowerCase=()=>e.check(hj()),e.toUpperCase=()=>e.check(yj()),e.slugify=()=>e.check(vj())}),m_=ne("ZodString",(e,n)=>{Vf.init(e,n),a1.init(e,n),e.email=i=>e.check(M4(h_,i)),e.url=i=>e.check(Kv(n1,i)),e.jwt=i=>e.check(X4(T_,i)),e.emoji=i=>e.check(I4(y_,i)),e.guid=i=>e.check(fh(hh,i)),e.uuid=i=>e.check(R4(bl,i)),e.uuidv4=i=>e.check(O4(bl,i)),e.uuidv6=i=>e.check(A4(bl,i)),e.uuidv7=i=>e.check(D4(bl,i)),e.nanoid=i=>e.check(U4(v_,i)),e.guid=i=>e.check(fh(hh,i)),e.cuid=i=>e.check(L4($_,i)),e.cuid2=i=>e.check(V4(b_,i)),e.ulid=i=>e.check(H4(x_,i)),e.base64=i=>e.check(Y4(z_,i)),e.base64url=i=>e.check(K4(C_,i)),e.xid=i=>e.check(B4(j_,i)),e.ksuid=i=>e.check(q4(__,i)),e.ipv4=i=>e.check(P4(S_,i)),e.ipv6=i=>e.check(Z4(w_,i)),e.cidrv4=i=>e.check(G4(k_,i)),e.cidrv6=i=>e.check(F4(N_,i)),e.e164=i=>e.check(W4(E_,i)),e.datetime=i=>e.check(Kj(i)),e.date=i=>e.check(Xj(i)),e.time=i=>e.check(Qj(i)),e.duration=i=>e.check(t_(i))});function F(e){return T4(m_,e)}const st=ne("ZodStringFormat",(e,n)=>{rt.init(e,n),a1.init(e,n)}),h_=ne("ZodEmail",(e,n)=>{D5.init(e,n),st.init(e,n)}),hh=ne("ZodGUID",(e,n)=>{O5.init(e,n),st.init(e,n)}),bl=ne("ZodUUID",(e,n)=>{A5.init(e,n),st.init(e,n)}),n1=ne("ZodURL",(e,n)=>{I5.init(e,n),st.init(e,n)});function xl(e){return Kv(n1,e)}const y_=ne("ZodEmoji",(e,n)=>{U5.init(e,n),st.init(e,n)}),v_=ne("ZodNanoID",(e,n)=>{L5.init(e,n),st.init(e,n)}),$_=ne("ZodCUID",(e,n)=>{V5.init(e,n),st.init(e,n)}),b_=ne("ZodCUID2",(e,n)=>{H5.init(e,n),st.init(e,n)}),x_=ne("ZodULID",(e,n)=>{B5.init(e,n),st.init(e,n)}),j_=ne("ZodXID",(e,n)=>{q5.init(e,n),st.init(e,n)}),__=ne("ZodKSUID",(e,n)=>{P5.init(e,n),st.init(e,n)}),S_=ne("ZodIPv4",(e,n)=>{K5.init(e,n),st.init(e,n)}),w_=ne("ZodIPv6",(e,n)=>{W5.init(e,n),st.init(e,n)}),k_=ne("ZodCIDRv4",(e,n)=>{X5.init(e,n),st.init(e,n)}),N_=ne("ZodCIDRv6",(e,n)=>{J5.init(e,n),st.init(e,n)}),z_=ne("ZodBase64",(e,n)=>{Q5.init(e,n),st.init(e,n)}),C_=ne("ZodBase64URL",(e,n)=>{t4.init(e,n),st.init(e,n)}),E_=ne("ZodE164",(e,n)=>{a4.init(e,n),st.init(e,n)}),T_=ne("ZodJWT",(e,n)=>{r4.init(e,n),st.init(e,n)}),r1=ne("ZodNumber",(e,n)=>{Pv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>kj(e,s,c),e.gt=(s,c)=>e.check(gh(s,c)),e.gte=(s,c)=>e.check(Xd(s,c)),e.min=(s,c)=>e.check(Xd(s,c)),e.lt=(s,c)=>e.check(ph(s,c)),e.lte=(s,c)=>e.check(Wd(s,c)),e.max=(s,c)=>e.check(Wd(s,c)),e.int=s=>e.check(yh(s)),e.safe=s=>e.check(yh(s)),e.positive=s=>e.check(gh(0,s)),e.nonnegative=s=>e.check(Xd(0,s)),e.negative=s=>e.check(ph(0,s)),e.nonpositive=s=>e.check(Wd(0,s)),e.multipleOf=(s,c)=>e.check(mh(s,c)),e.step=(s,c)=>e.check(mh(s,c)),e.finite=()=>e;const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function Fe(e){return aj(r1,e)}const M_=ne("ZodNumberFormat",(e,n)=>{i4.init(e,n),r1.init(e,n)});function yh(e){return nj(M_,e)}const R_=ne("ZodBoolean",(e,n)=>{o4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Nj(e,i,s)});function Gt(e){return rj(R_,e)}const O_=ne("ZodNull",(e,n)=>{s4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>zj(e,i,s)});function A_(e){return ij(O_,e)}const D_=ne("ZodUnknown",(e,n)=>{l4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Ej()});function Pa(){return oj(D_)}const I_=ne("ZodNever",(e,n)=>{c4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Cj(e,i,s)});function U_(e){return sj(I_,e)}const L_=ne("ZodArray",(e,n)=>{u4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Aj(e,i,s,c),e.element=n.element,e.min=(i,s)=>e.check(fc(i,s)),e.nonempty=i=>e.check(fc(1,i)),e.max=(i,s)=>e.check(Wv(i,s)),e.length=(i,s)=>e.check(Xv(i,s)),e.unwrap=()=>e.element});function pt(e,n){return $j(L_,e,n)}const V_=ne("ZodObject",(e,n)=>{f4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Dj(e,i,s,c),He(e,"shape",()=>n.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=i=>e.clone({...e._zod.def,catchall:i}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Pa()}),e.loose=()=>e.clone({...e._zod.def,catchall:Pa()}),e.strict=()=>e.clone({...e._zod.def,catchall:U_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>Tx(e,i),e.safeExtend=i=>Mx(e,i),e.merge=i=>Rx(e,i),e.pick=i=>Cx(e,i),e.omit=i=>Ex(e,i),e.partial=(...i)=>Ox(o1,e,i[0]),e.required=(...i)=>Ax(s1,e,i[0])});function de(e,n){const i={type:"object",shape:e??{},..._e(n)};return new V_(i)}const i1=ne("ZodUnion",(e,n)=>{Fv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Ij(e,i,s,c),e.options=n.options});function hn(e,n){return new i1({type:"union",options:e,..._e(n)})}const H_=ne("ZodDiscriminatedUnion",(e,n)=>{i1.init(e,n),p4.init(e,n)});function ns(e,n,i){return new H_({type:"union",options:n,discriminator:e,..._e(i)})}const B_=ne("ZodIntersection",(e,n)=>{g4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Uj(e,i,s,c)});function q_(e,n){return new B_({type:"intersection",left:e,right:n})}const P_=ne("ZodRecord",(e,n)=>{m4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Lj(e,i,s,c),e.keyType=n.keyType,e.valueType=n.valueType});function St(e,n,i){return new P_({type:"record",keyType:e,valueType:n,..._e(i)})}const _f=ne("ZodEnum",(e,n)=>{h4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>Tj(e,s,c),e.enum=n.entries,e.options=Object.values(n.entries);const i=new Set(Object.keys(n.entries));e.extract=(s,c)=>{const u={};for(const d of s)if(i.has(d))u[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new _f({...n,checks:[],..._e(c),entries:u})},e.exclude=(s,c)=>{const u={...n.entries};for(const d of s)if(i.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new _f({...n,checks:[],..._e(c),entries:u})}});function dt(e,n){const i=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new _f({type:"enum",entries:i,..._e(n)})}const Z_=ne("ZodLiteral",(e,n)=>{y4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Mj(e,i,s),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Re(e,n){return new Z_({type:"literal",values:Array.isArray(e)?e:[e],..._e(n)})}const G_=ne("ZodTransform",(e,n)=>{v4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Oj(e,i),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new zv(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(Jo(u,i.value,n));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=i.value),d.inst??(d.inst=e),i.issues.push(Jo(d))}};const c=n.transform(i.value,i);return c instanceof Promise?c.then(u=>(i.value=u,i)):(i.value=c,i)}});function F_(e){return new G_({type:"transform",transform:e})}const o1=ne("ZodOptional",(e,n)=>{Yv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>t1(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function vh(e){return new o1({type:"optional",innerType:e})}const Y_=ne("ZodExactOptional",(e,n)=>{$4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>t1(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function K_(e){return new Y_({type:"optional",innerType:e})}const W_=ne("ZodNullable",(e,n)=>{b4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Vj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function $h(e){return new W_({type:"nullable",innerType:e})}const X_=ne("ZodDefault",(e,n)=>{x4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Bj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function J_(e,n){return new X_({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Mv(n)}})}const Q_=ne("ZodPrefault",(e,n)=>{j4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>qj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function eS(e,n){return new Q_({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Mv(n)}})}const s1=ne("ZodNonOptional",(e,n)=>{_4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Hj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function tS(e,n){return new s1({type:"nonoptional",innerType:e,..._e(n)})}const aS=ne("ZodCatch",(e,n)=>{S4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Pj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nS(e,n){return new aS({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const rS=ne("ZodPipe",(e,n)=>{w4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Zj(e,i,s,c),e.in=n.in,e.out=n.out});function bh(e,n){return new rS({type:"pipe",in:e,out:n})}const iS=ne("ZodReadonly",(e,n)=>{k4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Gj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new iS({type:"readonly",innerType:e})}const sS=ne("ZodLazy",(e,n)=>{N4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Fj(e,i,s,c),e.unwrap=()=>e._zod.def.getter()});function l1(e){return new sS({type:"lazy",getter:e})}const lS=ne("ZodCustom",(e,n)=>{z4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Rj(e,i)});function cS(e,n={}){return bj(lS,e,n)}function uS(e){return xj(e)}const c1="@ggui-ai/gadgets",dS="0.1.0-rc.1",fS=[{package:c1,version:dS,exports:[{hook:"useCamera",permission:"camera",description:"Capture stills or live video from the device camera.",usage:"Mount when the intent names photo capture, QR / barcode scanning, video recording, or anything that requires a camera feed. The hook returns a stream once `start()` resolves; thread the resulting blob or stream URL into a contextSpec slot or an actionSpec payload to surface it to the agent.",example:{call:"const cam = useCamera();",returns:{status:"ready",value:{stream:"<MediaStream>",kind:"video"}}}},{hook:"useClipboardPaste",permission:"clipboard-read",description:"Read the system clipboard contents on user gesture.",usage:"Mount when the intent involves importing copied content (paste-into-form, paste-image-to-upload, paste-link). The Permissions API requires a user gesture; gate `start()` behind a button click. Returned value lands in a contextSpec slot or an actionSpec payload.",example:{call:"const paste = useClipboardPaste();",returns:{status:"ready",value:"pasted clipboard text"}}},{hook:"useClipboardWrite",permission:"clipboard-write",description:"Write to the system clipboard on user gesture.",usage:"Mount when the intent includes copying generated text, share links, codes, or transcripts to the system clipboard. Fire an actionSpec event so the agent observes the act (it does not see the written value — that stays component-local).",example:{call:"const write = useClipboardWrite(); write.write('hello');",returns:{status:"ready"}}},{hook:"useFilePicker",description:"Open the native file picker and read selected files.",usage:"Mount when the intent names file upload, attachment selection, or document import. No permission required. The hook returns the picked files plus metadata; thread file refs / data URLs into a contextSpec slot or actionSpec payload.",example:{call:'const picker = useFilePicker({ accept: "image/*" });',returns:{status:"ready",value:[{name:"photo.png",type:"image/png",size:12345}]}}},{hook:"useGeolocation",permission:"geolocation",description:"Resolve the device's current geolocation.",usage:'Mount when the intent names "current location", maps, nearby search, location-aware UI. Browser prompts the user on `start()`; the hook returns coordinates once granted. Thread the resolved coords into a contextSpec slot so the agent observes the latest fix.',example:{call:"const geo = useGeolocation();",returns:{status:"ready",value:{latitude:37.7749,longitude:-122.4194,accuracy:20}}}},{hook:"useMicrophone",permission:"microphone",description:"Capture audio from the device microphone.",usage:"Mount when the intent names voice memos, audio messages, dictation, voice-driven UI. Returns an audio stream / blob; thread it into an actionSpec payload at recording-stop, or into a contextSpec slot for live transcription pipelines.",example:{call:"const mic = useMicrophone();",returns:{status:"ready",value:{stream:"<MediaStream>",kind:"audio"}}}},{hook:"useNotifications",permission:"notifications",description:"Show system / browser notifications to the user.",usage:"Mount when the intent involves alerting the user about something (reminders, completion of long tasks, incoming messages) and the UI may be in the background. Permission is prompted on first `start()`; the agent does NOT see notification dismissal directly — surface it via an actionSpec if needed.",example:{call:"const notify = useNotifications(); notify.show({ title: 'Done' });",returns:{status:"ready",value:{granted:!0}}}}]}];Object.freeze(new Set(fS.flatMap(e=>e.exports).map(e=>e.hook).filter(e=>e!==void 0)));const Hf=/^use[A-Z][A-Za-z0-9]*$/,Bf=/^[A-Z][A-Za-z0-9]*$/,qf=["geolocation","notifications","microphone","camera","persistent-storage","midi","clipboard-read","clipboard-write","speaker-selection","storage-access","background-sync","accelerometer","gyroscope","magnetometer","ambient-light-sensor","screen-wake-lock"];new Set(qf);const ft=l1(()=>hn([F(),Fe(),Gt(),A_(),pt(ft),St(F(),ft)])),mn=l1(()=>de({type:dt(["string","number","integer","boolean","array","object","null"]).optional(),description:F().optional(),enum:pt(ft).optional(),default:ft.optional(),example:ft.optional(),items:mn.optional(),properties:St(F(),mn).optional(),required:pt(F()).optional(),additionalProperties:hn([mn,Gt()]).optional(),format:F().optional()}).passthrough()),pS=de({description:F().optional(),schema:mn,required:Gt().optional(),default:ft.optional(),example:ft.optional(),sourceTool:F().optional()}).strict(),gS=de({description:F().optional(),properties:St(F(),pS)}).strict(),mS=de({description:F().optional(),label:F(),schema:mn.optional(),example:ft.optional(),icon:F().optional(),confirm:Gt().optional(),nextStep:F().min(1).optional()}).strict(),hS=St(F(),mS),yS=de({description:F().optional(),schema:mn,example:ft.optional(),mode:dt(["append","replace"]).optional(),replay:dt(["latest","all","none"]).optional(),complete:Gt().optional(),tool:F().optional(),source:de({tool:F(),args:St(F(),ft).optional()}).strict().optional()}).strict(),vS=St(F(),yS),$S=de({description:F().optional(),schema:mn,default:ft.optional(),debounceMs:Fe().int().nonnegative().optional(),example:ft.optional()}).strict(),bS=St(F(),$S),xS=de({description:F().optional(),usage:F().optional(),inputSchema:mn.optional(),outputSchema:mn.optional(),required:Gt().optional(),example:de({input:ft,output:ft}).strict().optional()}).strict(),jS=de({tools:St(F(),xS)}).passthrough(),u1=/^GGUI_PUBLIC_APP_[A-Z0-9_]+$/,_S=pt(F().regex(u1)).readonly(),xh=/^sha384-[A-Za-z0-9+/]+=*$/,d1=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,SS=/^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/,wS=/^[a-z0-9.-]+(:\d+)?$/,f1={gotchas:F().optional(),required:Gt().optional()},jh={...f1,description:F().optional(),usage:F().optional(),example:ft.optional(),permission:F().optional()},_h={...f1,description:F().min(1),usage:F().min(1),example:ft,permission:dt(qf).optional()},p1={version:F().regex(SS),package:F().regex(d1),bundleUrl:xl().optional(),bundleHost:F().regex(wS).optional(),bundleSri:F().regex(xh).optional(),styleUrl:xl().optional(),connect:pt(xl()).readonly().optional(),requires:_S.optional(),typesUrl:xl().optional(),typesSri:F().regex(xh).optional()},kS=hn([de({hook:F().regex(Hf),...jh}).strict(),de({component:F().regex(Bf),...jh}).strict()]),NS=hn([de({hook:F().regex(Hf),..._h}).strict(),de({component:F().regex(Bf),..._h}).strict()]);de({...p1,exports:pt(kS).min(1)}).strict();const zS=de({...p1,exports:pt(NS).min(1)}).strict();zS.refine(e=>e.package===c1||typeof e.typesUrl=="string",{message:"registered GadgetDescriptor MUST declare a `typesUrl` (HTTPS URL to the package's .d.ts) — the code-gen sandbox loads it to typecheck generated component code against the export signatures. Run `tsup --dts` (or `tsc --declaration`) in the wrapper build and publish the emitted .d.ts. Only the first-party `@ggui-ai/gadgets` stdlib is exempt.",path:["typesUrl"]});const CS=de({description:F().optional(),usage:F().optional()}).strict(),ES=St(F().refine(e=>Hf.test(e)||Bf.test(e),{message:"gadget export name must be a `use`-prefixed hook or a PascalCase component identifier"}),CS).refine(e=>Object.keys(e).length>0,{message:"a `clientCapabilities.gadgets` package entry must declare at least one export"}),TS=de({gadgets:St(F().regex(d1),ES)}).strict();St(F().regex(u1),F()).readonly();const _c=de({propsSpec:gS.optional(),actionSpec:hS.optional(),streamSpec:vS.optional(),contextSpec:bS.optional(),agentCapabilities:jS.optional(),clientCapabilities:TS.optional()}).passthrough(),Pf=de({persona:F().optional(),aesthetic:F().optional(),context:St(F(),ft).optional(),seedPrompt:F().optional()}).strict(),MS=de({blueprintId:F().min(1),contractHash:F().min(1),appId:F().min(1),codeS3Url:F().optional(),codeHash:F().optional(),generator:F().min(1),validatorScore:Fe().min(0).max(1).optional(),variance:Pf,isOperatorDefault:Re(!0).optional(),createdAt:F().min(1),createdBy:dt(["agent","operator"]),contract:_c,contractEmbedding:pt(Fe()).optional()}).strict();de({hash:Fe().min(0),embed:Fe().min(0),struct:Fe().min(0),variance:Fe().min(0),intent:Fe().min(0)}).strict();const RS=de({hash:Fe().min(0).optional(),embed:Fe().min(0).optional(),struct:Fe().min(0).optional(),variance:Fe().min(0).optional(),intent:Fe().min(0).optional()}).strict();de({weights:RS.optional(),threshold:Fe().min(0).max(1).optional(),topK:Fe().int().min(1).optional()}).strict();const OS=dt(["cache","agent","synth"]),AS=hn([de({op:Re("add"),path:F(),value:ft}).strict(),de({op:Re("remove"),path:F()}).strict(),de({op:Re("replace"),path:F(),value:ft}).strict()]),DS=pt(AS),IS=de({contract:_c,variance:de({persona:F().optional(),aesthetic:F().optional(),context:St(F(),ft).optional(),seedPrompt:F().optional()}).strict().optional(),generator:F().optional()}).strict(),g1=IS,US=de({blueprintId:F().min(1),contractHash:F().min(1),codeHash:F().optional(),generator:F().min(1),variance:Pf,selectedReason:F().optional()}).strict(),LS=de({code:F().min(1),severity:dt(["error","warn"]),path:F(),message:F()}).strict(),VS=de({contractDiff:DS,reasoning:F()}).strict(),HS=de({origin:OS,rationale:F(),blueprintMeta:US,amendments:VS.optional(),validationFindings:pt(LS).optional()}).strict(),BS=hn([de({kind:Re("accept")}).strict(),de({kind:Re("override"),blueprintDraft:g1}).strict()]),qS=de({width:Fe(),height:Fe()}),PS=de({viewport:qS,platform:dt(["web","mobile","desktop"]),deviceType:dt(["phone","tablet","desktop"]),orientation:dt(["portrait","landscape"]),devicePixelRatio:Fe().optional(),touchPrimary:Gt().optional(),shellType:dt(["chat","fullscreen","spatial"]).optional(),colorScheme:dt(["light","dark"]).optional(),reducedMotion:Gt().optional()}).passthrough();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),timeout:Fe().min(0).max(25).optional().describe("Long-poll timeout in seconds (default short; max 25).")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session."),channel:F().describe("Channel name declared on the active stack item streamSpec."),payload:Pa().describe("Payload — must match streamSpec[channel].schema."),complete:Gt().optional().describe("True marks the stream complete; subsequent emits on this channel reject."),stackItemId:F().optional().describe("Stack item to scope this emit to; defaults to session top.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({level:dt(["primitive","component","composite","template"]).optional(),category:F().optional(),tags:pt(F()).optional(),limit:Fe().optional()}).strict();de({query:F(),limit:Fe().optional()}).strict();de({blueprintId:F(),props:St(F(),Pa()).optional()}).strict();de({}).strict();de({serviceId:F().describe('OAuth service ID (e.g., "bashdoor", "ubot")'),reason:F().optional().describe("Why the agent needs this credential (shown to user)"),sessionId:F().optional().describe("Existing session ID to push consent UI into")}).strict();de({}).strict();de({sessionId:F().describe("Thread this through every subsequent ggui_handshake / ggui_update call in this chat."),appId:F(),createdAt:F().describe("ISO 8601 — creation timestamp of the freshly-minted session."),nextStep:de({tool:Re("ggui_handshake"),description:F(),example:F()}).describe("Wire-shape recovery hint — a worked literal example of the next call.")});de({sessionId:F().min(1).describe("Session handle minted by ggui_new_session. Required — call ggui_new_session({seed?}) first to obtain one. Reuse the same sessionId across multiple handshake/push pairs in the same chat to grow the session stack."),intent:F().min(1).describe('Concise purpose — same intent = same component reused. e.g. "Gmail inbox for email triage"'),blueprintDraft:g1.describe("Agent's draft: contract (required) + optional variance + optional generator slug hint. The server combines this with cached blueprints + validator outcomes to produce a three-mode suggestion (cache / agent / synth)."),forceCreate:Gt().optional()}).strict();de({handshakeId:F().describe("Stable id — pass to ggui_push / ggui_update"),action:dt(["create","reuse","update","replace","compose","declined"]),suggestion:HS.describe("Server's suggestion — origin-routed (cache | agent | synth). Always carries a provisional `blueprintMeta` the agent reuses by sending `decision: 'accept'` on push."),reason:F().max(280).optional().describe("Short rationale (≤280 chars) for the `action` value. Surfaced for agent + operator visibility; truncated to keep the structuredContent payload predictable."),nextStep:de({tool:Re("ggui_push"),description:F(),example:F()}).optional().describe("Wire-shape recovery hint. A worked literal example of the next ggui_push call the agent should emit — the example string can be copied verbatim and tweaked (e.g. fill in `props` placeholders). Top-level field so a skimming agent finds it immediately.")});de({handshakeId:F({message:"ggui_push: handshakeId is REQUIRED. Call ggui_handshake({sessionId, intent, blueprintDraft}) first to negotiate — handshake returns a handshakeId + suggestion. Then push with {handshakeId, decision: {kind: 'accept'}} (accept the suggestion) or {handshakeId, decision: {kind: 'override', blueprintDraft: {...}}} (override with a fresh draft). Direct-push without a handshakeId is not supported."}).min(1,"ggui_push: handshakeId must be a non-empty string from a prior ggui_handshake call."),props:St(F(),Pa()).optional(),decision:BS.describe("Accept the handshake suggestion (use provisional blueprintId verbatim) or override with a fresh draft (mint new blueprintId).")}).strict();de({stackItemId:F(),url:F().url(),action:dt(["create","reuse","update","replace","compose","declined"]),nextStep:de({tool:Re("ggui_consume"),description:F(),example:F(),args:de({stackItemId:F()})}).optional().describe("Recovery hint — when the pushed contract has actions, points the agent at ggui_consume({stackItemId}) for the inbound action loop. Absent for pure-display pushes.")});ns("kind",[de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),kind:Re("replace"),props:St(F(),Pa()).describe("Full replacement props map. New map IS the new state.")}).strict(),de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),kind:Re("merge"),patch:St(F(),Pa()).describe("RFC 7396 JSON Merge Patch — null deletes a key; arrays fully replace.")}).strict()]);de({stackItemId:F(),updated:Gt()});const ZS=de({type:Re("text"),text:F()}),GS=de({type:Re("tool_use"),id:F(),name:F(),input:St(F(),Pa())}),FS=de({type:Re("tool_result"),tool_use_id:F(),content:Pa(),is_error:Gt().optional()}),m1=ns("type",[ZS,GS,FS]),YS=de({type:Re("text_delta"),text:F()}),KS=de({type:Re("input_json_delta"),partial_json:F()}),WS=ns("type",[YS,KS]),XS=de({type:Re("message_start"),message:de({id:F(),role:Re("assistant"),model:F().optional()})}),JS=de({type:Re("content_block_start"),index:Fe().int().nonnegative(),content_block:m1}),QS=de({type:Re("content_block_delta"),index:Fe().int().nonnegative(),delta:WS}),e3=de({type:Re("content_block_stop"),index:Fe().int().nonnegative()}),t3=de({type:Re("message_delta"),delta:de({stop_reason:dt(["end_turn","max_tokens","tool_use","error"]),stop_sequence:F().nullable().optional()}),usage:de({input_tokens:Fe().int().nonnegative(),output_tokens:Fe().int().nonnegative()})}),a3=de({type:Re("message_stop")}),n3=de({type:Re("ping")}),r3=dt(["invalid_request","unauthorized","rate_limited","invoke_in_progress","upstream_error","tool_error","internal"]),i3=de({type:Re("error"),error:de({code:r3,message:F(),retryAfterMs:Fe().int().nonnegative().optional()})});ns("type",[XS,JS,QS,e3,t3,a3,n3,i3]);const o3=de({role:dt(["user","assistant"]),content:hn([F(),pt(m1)])});de({message:F(),history:pt(o3).optional(),interfaceContext:PS.optional(),requestId:F().optional()});de({contract:_c,generator:F().min(1).optional().describe("Generator slug (e.g. `ui-gen-default-haiku-4-5`). When omitted, dispatches through `GeneratorRegistry.defaultGenerator()`."),persona:F().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:F().optional().describe("Free-form aesthetic tag (e.g. 'glassmorphic', 'brutalist', 'editorial'). Persisted on `Blueprint.variance.aesthetic`. Distinct from persona — persona names the user mental model; aesthetic names the visual treatment."),context:St(F(),ft).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:F().optional().describe("The raw operator prompt that produced this variant. Round-trip input for the variant-selector + audit trail."),setAsOperatorDefault:Gt().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();de({blueprintId:F().min(1),codeHash:F().optional().describe("Content hash of the generated code body. Absent when the generator returned a non-`ok` result and persistence skipped — the failure mode is surfaced through generator-level error reporting elsewhere."),validatorScore:Fe().min(0).max(1).optional().describe("Advanced generator's iterative-loop validator score (0-1). Absent for default-generator output."),generator:F().min(1).describe("Slug of the generator the dispatch resolved to.")}).strict();de({contract:_c,componentCode:F().min(1).describe("Verbatim component-code body to persist. Stored as-is — no LLM call, no validator pass. Operator owns correctness; the handler computes the canonical sha256 codeHash and routes the bytes through the same persistence seams as `*_generate_*`."),generator:F().min(1).optional().describe("Optional generator slug to stamp on the persisted Blueprint.generator field — purely an audit/provenance hint for downstream `*_list_blueprints` consumers. Defaults to the registry default slug."),persona:F().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:F().optional().describe("Free-form aesthetic tag. Persisted on `Blueprint.variance.aesthetic`."),context:St(F(),ft).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:F().optional().describe("Optional originating prompt for audit + round-tripping (e.g. the prose the operator originally fed into `*_generate_*` before exporting)."),setAsOperatorDefault:Gt().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();de({blueprintId:F().min(1),codeHash:F().min(1).describe("Content hash of the persisted code body (full sha256 hex)."),generator:F().min(1).describe("Resolved generator slug stamped on the Blueprint.generator field — either the supplied input or the registry default.")}).strict();de({contractHash:F().min(1).optional().describe("Filter to a single `(appId, contractHash)` group. Combine with `generator` / `persona` to narrow within the group."),generator:F().min(1).optional().describe("Filter to blueprints produced by a specific generator slug."),persona:F().optional().describe("Filter on `variance.persona`. Normalized to match persisted form (lowercase+trim)."),intentKeywords:pt(F().min(1)).optional().describe("Semantic-search tokens. When set, dispatches through `BlueprintSearch.search()` rather than indexed `list()`.")}).strict();de({blueprints:pt(MS)}).strict();de({blueprintId:F().min(1),isOperatorDefault:Re(!0).optional().describe("When `true`, pins this blueprint as the operator default for its `(appId, contractHash)` group. Clears any prior default. Cannot set to `false` — to unpin, set another blueprint in the same group as default, or delete this one."),variance:Pf.optional().describe('Partial-merge into the existing variance. Supplied keys overwrite; omitted keys preserve. Pass `{persona: ""}` to clear a persona (handler treats empty string as removal).')}).strict();de({blueprintId:F().min(1),updatedAt:F().min(1)}).strict();de({blueprintId:F().min(1)}).strict();de({deleted:Re(!0)}).strict();const Sh={AGENT_DATA:"ggui:agent-data"};function s3(e){return"schemaVersion"in e?e.schemaVersion:jx}function l3(e){const n={sessionId:e.sessionId,type:e.type};e.payload!==void 0&&(n.payload=e.payload),e.stackIndex!==void 0&&(n.stackIndex=e.stackIndex),e.stackItemId!==void 0&&(n.stackItemId=e.stackItemId),e.clientSeq!==void 0&&(n.clientSeq=e.clientSeq);const i=s3(e);return i!==void 0&&(n.schemaVersion=i),n}var jl={exports:{}},Jd={},dn={},Lr={},Qd={},ef={},tf={},wh;function gc(){return wh||(wh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class n{}e._CodeOrName=n,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=i;class s extends n{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((w,R)=>`${w}${R}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((w,R)=>(R instanceof i&&(w[R.str]=(w[R.str]||0)+1),w),{})}}e._Code=s,e.nil=new s("");function c(N,...$){const w=[N[0]];let R=0;for(;R<$.length;)p(w,$[R]),w.push(N[++R]);return new s(w)}e._=c;const u=new s("+");function d(N,...$){const w=[k(N[0])];let R=0;for(;R<$.length;)w.push(u),p(w,$[R]),w.push(u,k(N[++R]));return g(w),new s(w)}e.str=d;function p(N,$){$ instanceof s?N.push(...$._items):$ instanceof i?N.push($):N.push(v($))}e.addCodeArg=p;function g(N){let $=1;for(;$<N.length-1;){if(N[$]===u){const w=h(N[$-1],N[$+1]);if(w!==void 0){N.splice($-1,3,w);continue}N[$++]="+"}$++}}function h(N,$){if($==='""')return N;if(N==='""')return $;if(typeof N=="string")return $ instanceof i||N[N.length-1]!=='"'?void 0:typeof $!="string"?`${N.slice(0,-1)}${$}"`:$[0]==='"'?N.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(N instanceof i))return`"${N}${$.slice(1)}`}function y(N,$){return $.emptyStr()?N:N.emptyStr()?$:d`${N}${$}`}e.strConcat=y;function v(N){return typeof N=="number"||typeof N=="boolean"||N===null?N:k(Array.isArray(N)?N.join(","):N)}function j(N){return new s(k(N))}e.stringify=j;function k(N){return JSON.stringify(N).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=k;function b(N){return typeof N=="string"&&e.IDENTIFIER.test(N)?new s(`.${N}`):c`[${N}]`}e.getProperty=b;function C(N){if(typeof N=="string"&&e.IDENTIFIER.test(N))return new s(`${N}`);throw new Error(`CodeGen: invalid export name: ${N}, use explicit $id name mapping`)}e.getEsmExportName=C;function z(N){return new s(N.toString())}e.regexpCode=z})(tf)),tf}var af={},kh;function Nh(){return kh||(kh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const n=gc();class i extends Error{constructor(h){super(`CodeGen: "code" for ${h} not defined`),this.value=h.value}}var s;(function(g){g[g.Started=0]="Started",g[g.Completed=1]="Completed"})(s||(e.UsedValueState=s={})),e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class c{constructor({prefixes:h,parent:y}={}){this._names={},this._prefixes=h,this._parent=y}toName(h){return h instanceof n.Name?h:this.name(h)}name(h){return new n.Name(this._newName(h))}_newName(h){const y=this._names[h]||this._nameGroup(h);return`${h}${y.index++}`}_nameGroup(h){var y,v;if(!((v=(y=this._parent)===null||y===void 0?void 0:y._prefixes)===null||v===void 0)&&v.has(h)||this._prefixes&&!this._prefixes.has(h))throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);return this._names[h]={prefix:h,index:0}}}e.Scope=c;class u extends n.Name{constructor(h,y){super(y),this.prefix=h}setValue(h,{property:y,itemIndex:v}){this.value=h,this.scopePath=(0,n._)`.${new n.Name(y)}[${v}]`}}e.ValueScopeName=u;const d=(0,n._)`\n`;class p extends c{constructor(h){super(h),this._values={},this._scope=h.scope,this.opts={...h,_n:h.lines?d:n.nil}}get(){return this._scope}name(h){return new u(h,this._newName(h))}value(h,y){var v;if(y.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const j=this.toName(h),{prefix:k}=j,b=(v=y.key)!==null&&v!==void 0?v:y.ref;let C=this._values[k];if(C){const $=C.get(b);if($)return $}else C=this._values[k]=new Map;C.set(b,j);const z=this._scope[k]||(this._scope[k]=[]),N=z.length;return z[N]=y.ref,j.setValue(y,{property:k,itemIndex:N}),j}getValue(h,y){const v=this._values[h];if(v)return v.get(y)}scopeRefs(h,y=this._values){return this._reduceValues(y,v=>{if(v.scopePath===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return(0,n._)`${h}${v.scopePath}`})}scopeCode(h=this._values,y,v){return this._reduceValues(h,j=>{if(j.value===void 0)throw new Error(`CodeGen: name "${j}" has no value`);return j.value.code},y,v)}_reduceValues(h,y,v={},j){let k=n.nil;for(const b in h){const C=h[b];if(!C)continue;const z=v[b]=v[b]||new Map;C.forEach(N=>{if(z.has(N))return;z.set(N,s.Started);let $=y(N);if($){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;k=(0,n._)`${k}${w} ${N} = ${$};${this.opts._n}`}else if($=j==null?void 0:j(N))k=(0,n._)`${k}${$}${this.opts._n}`;else throw new i(N);z.set(N,s.Completed)})}return k}}e.ValueScope=p})(af)),af}var zh;function De(){return zh||(zh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const n=gc(),i=Nh();var s=gc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return s.Name}});var c=Nh();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),e.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class u{optimizeNodes(){return this}optimizeNames(E,V){return this}}class d extends u{constructor(E,V,W){super(),this.varKind=E,this.name=V,this.rhs=W}render({es5:E,_n:V}){const W=E?i.varKinds.var:this.varKind,he=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${he};`+V}optimizeNames(E,V){if(E[this.name.str])return this.rhs&&(this.rhs=le(this.rhs,E,V)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class p extends u{constructor(E,V,W){super(),this.lhs=E,this.rhs=V,this.sideEffects=W}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,V){if(!(this.lhs instanceof n.Name&&!E[this.lhs.str]&&!this.sideEffects))return this.rhs=le(this.rhs,E,V),this}get names(){const E=this.lhs instanceof n.Name?{}:{...this.lhs.names};return re(E,this.rhs)}}class g extends p{constructor(E,V,W,he){super(E,W,he),this.op=V}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}}class h extends u{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}}class y extends u{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}}class v extends u{constructor(E){super(),this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}}class j extends u{constructor(E){super(),this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,V){return this.code=le(this.code,E,V),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class k extends u{constructor(E=[]){super(),this.nodes=E}render(E){return this.nodes.reduce((V,W)=>V+W.render(E),"")}optimizeNodes(){const{nodes:E}=this;let V=E.length;for(;V--;){const W=E[V].optimizeNodes();Array.isArray(W)?E.splice(V,1,...W):W?E[V]=W:E.splice(V,1)}return E.length>0?this:void 0}optimizeNames(E,V){const{nodes:W}=this;let he=W.length;for(;he--;){const pe=W[he];pe.optimizeNames(E,V)||($e(E,pe.names),W.splice(he,1))}return W.length>0?this:void 0}get names(){return this.nodes.reduce((E,V)=>J(E,V.names),{})}}class b extends k{render(E){return"{"+E._n+super.render(E)+"}"+E._n}}class C extends k{}class z extends b{}z.kind="else";class N extends b{constructor(E,V){super(V),this.condition=E}render(E){let V=`if(${this.condition})`+super.render(E);return this.else&&(V+="else "+this.else.render(E)),V}optimizeNodes(){super.optimizeNodes();const E=this.condition;if(E===!0)return this.nodes;let V=this.else;if(V){const W=V.optimizeNodes();V=this.else=Array.isArray(W)?new z(W):W}if(V)return E===!1?V instanceof N?V:V.nodes:this.nodes.length?this:new N(ce(E),V instanceof N?[V]:V.nodes);if(!(E===!1||!this.nodes.length))return this}optimizeNames(E,V){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(E,V),!!(super.optimizeNames(E,V)||this.else))return this.condition=le(this.condition,E,V),this}get names(){const E=super.names;return re(E,this.condition),this.else&&J(E,this.else.names),E}}N.kind="if";class $ extends b{}$.kind="for";class w extends ${constructor(E){super(),this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,V){if(super.optimizeNames(E,V))return this.iteration=le(this.iteration,E,V),this}get names(){return J(super.names,this.iteration.names)}}class R extends ${constructor(E,V,W,he){super(),this.varKind=E,this.name=V,this.from=W,this.to=he}render(E){const V=E.es5?i.varKinds.var:this.varKind,{name:W,from:he,to:pe}=this;return`for(${V} ${W}=${he}; ${W}<${pe}; ${W}++)`+super.render(E)}get names(){const E=re(super.names,this.from);return re(E,this.to)}}class x extends ${constructor(E,V,W,he){super(),this.loop=E,this.varKind=V,this.name=W,this.iterable=he}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,V){if(super.optimizeNames(E,V))return this.iterable=le(this.iterable,E,V),this}get names(){return J(super.names,this.iterable.names)}}class _ extends b{constructor(E,V,W){super(),this.name=E,this.args=V,this.async=W}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}}_.kind="func";class T extends k{render(E){return"return "+super.render(E)}}T.kind="return";class A extends b{render(E){let V="try"+super.render(E);return this.catch&&(V+=this.catch.render(E)),this.finally&&(V+=this.finally.render(E)),V}optimizeNodes(){var E,V;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(V=this.finally)===null||V===void 0||V.optimizeNodes(),this}optimizeNames(E,V){var W,he;return super.optimizeNames(E,V),(W=this.catch)===null||W===void 0||W.optimizeNames(E,V),(he=this.finally)===null||he===void 0||he.optimizeNames(E,V),this}get names(){const E=super.names;return this.catch&&J(E,this.catch.names),this.finally&&J(E,this.finally.names),E}}class I extends b{constructor(E){super(),this.error=E}render(E){return`catch(${this.error})`+super.render(E)}}I.kind="catch";class P extends b{render(E){return"finally"+super.render(E)}}P.kind="finally";class H{constructor(E,V={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...V,_n:V.lines?`
|
|
87
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const v=y[1];if(n===y[0]){u(y);continue}if(e.external){const k=(g=e.external.registry.get(y[0]))==null?void 0:g.id;if(n!==y[0]&&k){u(y);continue}}if((h=e.metadataRegistry.get(y[0]))==null?void 0:h.id){u(y);continue}if(v.cycle){u(y);continue}if(v.count>1&&e.reused==="ref"){u(y);continue}}}function e1(e,n){var d,p,g;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=h=>{const y=e.seen.get(h);if(y.ref===null)return;const v=y.def??y.schema,j={...v},k=y.ref;if(y.ref=null,k){s(k);const C=e.seen.get(k),z=C.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(v.allOf=v.allOf??[],v.allOf.push(z)):Object.assign(v,z),Object.assign(v,j),h._zod.parent===k)for(const $ in v)$==="$ref"||$==="allOf"||$ in j||delete v[$];if(z.$ref&&C.def)for(const $ in v)$==="$ref"||$==="allOf"||$ in C.def&&JSON.stringify(v[$])===JSON.stringify(C.def[$])&&delete v[$]}const b=h._zod.parent;if(b&&b!==k){s(b);const C=e.seen.get(b);if(C!=null&&C.schema.$ref&&(v.$ref=C.schema.$ref,C.def))for(const z in v)z==="$ref"||z==="allOf"||z in C.def&&JSON.stringify(v[z])===JSON.stringify(C.def[z])&&delete v[z]}e.override({zodSchema:h,jsonSchema:v,path:y.path??[]})};for(const h of[...e.seen.entries()].reverse())s(h[0]);const c={};if(e.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?c.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?c.$schema="http://json-schema.org/draft-04/schema#":e.target,(d=e.external)!=null&&d.uri){const h=(p=e.external.registry.get(n))==null?void 0:p.id;if(!h)throw new Error("Schema is missing an `id` property");c.$id=e.external.uri(h)}Object.assign(c,i.def??i.schema);const u=((g=e.external)==null?void 0:g.defs)??{};for(const h of e.seen.entries()){const y=h[1];y.def&&y.defId&&(u[y.defId]=y.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{const h=JSON.parse(JSON.stringify(c));return Object.defineProperty(h,"~standard",{value:{...n["~standard"],jsonSchema:{input:pc(n,"input",e.processors),output:pc(n,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Wt(e,n){const i=n??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Wt(s.element,i);if(s.type==="set")return Wt(s.valueType,i);if(s.type==="lazy")return Wt(s.getter(),i);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Wt(s.innerType,i);if(s.type==="intersection")return Wt(s.left,i)||Wt(s.right,i);if(s.type==="record"||s.type==="map")return Wt(s.keyType,i)||Wt(s.valueType,i);if(s.type==="pipe")return Wt(s.in,i)||Wt(s.out,i);if(s.type==="object"){for(const c in s.shape)if(Wt(s.shape[c],i))return!0;return!1}if(s.type==="union"){for(const c of s.options)if(Wt(c,i))return!0;return!1}if(s.type==="tuple"){for(const c of s.items)if(Wt(c,i))return!0;return!!(s.rest&&Wt(s.rest,i))}return!1}const _j=(e,n={})=>i=>{const s=Jv({...i,processors:n});return yt(e,s),Qv(s,e),e1(s,e)},pc=(e,n,i={})=>s=>{const{libraryOptions:c,target:u}=s??{},d=Jv({...c??{},target:u,io:n,processors:i});return yt(e,d),Qv(d,e),e1(d,e)},Sj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wj=(e,n,i,s)=>{const c=i;c.type="string";const{minimum:u,maximum:d,format:p,patterns:g,contentEncoding:h}=e._zod.bag;if(typeof u=="number"&&(c.minLength=u),typeof d=="number"&&(c.maxLength=d),p&&(c.format=Sj[p]??p,c.format===""&&delete c.format,p==="time"&&delete c.format),h&&(c.contentEncoding=h),g&&g.size>0){const y=[...g];y.length===1?c.pattern=y[0].source:y.length>1&&(c.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},kj=(e,n,i,s)=>{const c=i,{minimum:u,maximum:d,format:p,multipleOf:g,exclusiveMaximum:h,exclusiveMinimum:y}=e._zod.bag;typeof p=="string"&&p.includes("int")?c.type="integer":c.type="number",typeof y=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(c.minimum=y,c.exclusiveMinimum=!0):c.exclusiveMinimum=y),typeof u=="number"&&(c.minimum=u,typeof y=="number"&&n.target!=="draft-04"&&(y>=u?delete c.minimum:delete c.exclusiveMinimum)),typeof h=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(c.maximum=h,c.exclusiveMaximum=!0):c.exclusiveMaximum=h),typeof d=="number"&&(c.maximum=d,typeof h=="number"&&n.target!=="draft-04"&&(h<=d?delete c.maximum:delete c.exclusiveMaximum)),typeof g=="number"&&(c.multipleOf=g)},Nj=(e,n,i,s)=>{i.type="boolean"},zj=(e,n,i,s)=>{n.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Cj=(e,n,i,s)=>{i.not={}},Ej=(e,n,i,s)=>{},Tj=(e,n,i,s)=>{const c=e._zod.def,u=Ev(c.entries);u.every(d=>typeof d=="number")&&(i.type="number"),u.every(d=>typeof d=="string")&&(i.type="string"),i.enum=u},Mj=(e,n,i,s)=>{const c=e._zod.def,u=[];for(const d of c.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");u.push(Number(d))}else u.push(d);if(u.length!==0)if(u.length===1){const d=u[0];i.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?i.enum=[d]:i.const=d}else u.every(d=>typeof d=="number")&&(i.type="number"),u.every(d=>typeof d=="string")&&(i.type="string"),u.every(d=>typeof d=="boolean")&&(i.type="boolean"),u.every(d=>d===null)&&(i.type="null"),i.enum=u},Rj=(e,n,i,s)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Oj=(e,n,i,s)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Aj=(e,n,i,s)=>{const c=i,u=e._zod.def,{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(c.minItems=d),typeof p=="number"&&(c.maxItems=p),c.type="array",c.items=yt(u.element,n,{...s,path:[...s.path,"items"]})},Dj=(e,n,i,s)=>{var h;const c=i,u=e._zod.def;c.type="object",c.properties={};const d=u.shape;for(const y in d)c.properties[y]=yt(d[y],n,{...s,path:[...s.path,"properties",y]});const p=new Set(Object.keys(d)),g=new Set([...p].filter(y=>{const v=u.shape[y]._zod;return n.io==="input"?v.optin===void 0:v.optout===void 0}));g.size>0&&(c.required=Array.from(g)),((h=u.catchall)==null?void 0:h._zod.def.type)==="never"?c.additionalProperties=!1:u.catchall?u.catchall&&(c.additionalProperties=yt(u.catchall,n,{...s,path:[...s.path,"additionalProperties"]})):n.io==="output"&&(c.additionalProperties=!1)},Ij=(e,n,i,s)=>{const c=e._zod.def,u=c.inclusive===!1,d=c.options.map((p,g)=>yt(p,n,{...s,path:[...s.path,u?"oneOf":"anyOf",g]}));u?i.oneOf=d:i.anyOf=d},Uj=(e,n,i,s)=>{const c=e._zod.def,u=yt(c.left,n,{...s,path:[...s.path,"allOf",0]}),d=yt(c.right,n,{...s,path:[...s.path,"allOf",1]}),p=h=>"allOf"in h&&Object.keys(h).length===1,g=[...p(u)?u.allOf:[u],...p(d)?d.allOf:[d]];i.allOf=g},Lj=(e,n,i,s)=>{const c=i,u=e._zod.def;c.type="object";const d=u.keyType,p=d._zod.bag,g=p==null?void 0:p.patterns;if(u.mode==="loose"&&g&&g.size>0){const y=yt(u.valueType,n,{...s,path:[...s.path,"patternProperties","*"]});c.patternProperties={};for(const v of g)c.patternProperties[v.source]=y}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(c.propertyNames=yt(u.keyType,n,{...s,path:[...s.path,"propertyNames"]})),c.additionalProperties=yt(u.valueType,n,{...s,path:[...s.path,"additionalProperties"]});const h=d._zod.values;if(h){const y=[...h].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(c.required=y)}},Vj=(e,n,i,s)=>{const c=e._zod.def,u=yt(c.innerType,n,s),d=n.seen.get(e);n.target==="openapi-3.0"?(d.ref=c.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},Hj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType},Bj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,i.default=JSON.parse(JSON.stringify(c.defaultValue))},qj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,n.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(c.defaultValue)))},Pj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType;let d;try{d=c.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=d},Zj=(e,n,i,s)=>{const c=e._zod.def,u=n.io==="input"?c.in._zod.def.type==="transform"?c.out:c.in:c.out;yt(u,n,s);const d=n.seen.get(e);d.ref=u},Gj=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType,i.readOnly=!0},t1=(e,n,i,s)=>{const c=e._zod.def;yt(c.innerType,n,s);const u=n.seen.get(e);u.ref=c.innerType},Fj=(e,n,i,s)=>{const c=e._zod.innerType;yt(c,n,s);const u=n.seen.get(e);u.ref=c},Yj=ne("ZodISODateTime",(e,n)=>{Z5.init(e,n),st.init(e,n)});function Kj(e){return J4(Yj,e)}const Wj=ne("ZodISODate",(e,n)=>{G5.init(e,n),st.init(e,n)});function Xj(e){return Q4(Wj,e)}const Jj=ne("ZodISOTime",(e,n)=>{F5.init(e,n),st.init(e,n)});function Qj(e){return ej(Jj,e)}const e_=ne("ZodISODuration",(e,n)=>{Y5.init(e,n),st.init(e,n)});function t_(e){return tj(e_,e)}const a_=(e,n)=>{Ov.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>Ix(e,i)},flatten:{value:i=>Dx(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,xf,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,xf,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ca=ne("ZodError",a_,{Parent:Error}),n_=Uf(Ca),r_=Lf(Ca),i_=bc(Ca),o_=xc(Ca),s_=Vx(Ca),l_=Hx(Ca),c_=Bx(Ca),u_=qx(Ca),d_=Px(Ca),f_=Zx(Ca),p_=Gx(Ca),g_=Fx(Ca),nt=ne("ZodType",(e,n)=>(at.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:pc(e,"input"),output:pc(e,"output")}}),e.toJSONSchema=_j(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...i)=>e.clone(pr(n,{checks:[...n.checks??[],...i.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(i,s)=>gr(e,i,s),e.brand=()=>e,e.register=((i,s)=>(i.add(e,s),e)),e.parse=(i,s)=>n_(e,i,s,{callee:e.parse}),e.safeParse=(i,s)=>i_(e,i,s),e.parseAsync=async(i,s)=>r_(e,i,s,{callee:e.parseAsync}),e.safeParseAsync=async(i,s)=>o_(e,i,s),e.spa=e.safeParseAsync,e.encode=(i,s)=>s_(e,i,s),e.decode=(i,s)=>l_(e,i,s),e.encodeAsync=async(i,s)=>c_(e,i,s),e.decodeAsync=async(i,s)=>u_(e,i,s),e.safeEncode=(i,s)=>d_(e,i,s),e.safeDecode=(i,s)=>f_(e,i,s),e.safeEncodeAsync=async(i,s)=>p_(e,i,s),e.safeDecodeAsync=async(i,s)=>g_(e,i,s),e.refine=(i,s)=>e.check(cS(i,s)),e.superRefine=i=>e.check(uS(i)),e.overwrite=i=>e.check(Hi(i)),e.optional=()=>vh(e),e.exactOptional=()=>K_(e),e.nullable=()=>$h(e),e.nullish=()=>vh($h(e)),e.nonoptional=i=>tS(e,i),e.array=()=>pt(e),e.or=i=>hn([e,i]),e.and=i=>q_(e,i),e.transform=i=>bh(e,F_(i)),e.default=i=>J_(e,i),e.prefault=i=>eS(e,i),e.catch=i=>nS(e,i),e.pipe=i=>bh(e,i),e.readonly=()=>oS(e),e.describe=i=>{const s=e.clone();return Wo.add(s,{description:i}),s},Object.defineProperty(e,"description",{get(){var i;return(i=Wo.get(e))==null?void 0:i.description},configurable:!0}),e.meta=(...i)=>{if(i.length===0)return Wo.get(e);const s=e.clone();return Wo.add(s,i[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=i=>i(e),e)),a1=ne("_ZodString",(e,n)=>{Vf.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>wj(e,s,c);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,e.regex=(...s)=>e.check(lj(...s)),e.includes=(...s)=>e.check(dj(...s)),e.startsWith=(...s)=>e.check(fj(...s)),e.endsWith=(...s)=>e.check(pj(...s)),e.min=(...s)=>e.check(fc(...s)),e.max=(...s)=>e.check(Wv(...s)),e.length=(...s)=>e.check(Xv(...s)),e.nonempty=(...s)=>e.check(fc(1,...s)),e.lowercase=s=>e.check(cj(s)),e.uppercase=s=>e.check(uj(s)),e.trim=()=>e.check(mj()),e.normalize=(...s)=>e.check(gj(...s)),e.toLowerCase=()=>e.check(hj()),e.toUpperCase=()=>e.check(yj()),e.slugify=()=>e.check(vj())}),m_=ne("ZodString",(e,n)=>{Vf.init(e,n),a1.init(e,n),e.email=i=>e.check(M4(h_,i)),e.url=i=>e.check(Kv(n1,i)),e.jwt=i=>e.check(X4(T_,i)),e.emoji=i=>e.check(I4(y_,i)),e.guid=i=>e.check(fh(hh,i)),e.uuid=i=>e.check(R4(bl,i)),e.uuidv4=i=>e.check(O4(bl,i)),e.uuidv6=i=>e.check(A4(bl,i)),e.uuidv7=i=>e.check(D4(bl,i)),e.nanoid=i=>e.check(U4(v_,i)),e.guid=i=>e.check(fh(hh,i)),e.cuid=i=>e.check(L4($_,i)),e.cuid2=i=>e.check(V4(b_,i)),e.ulid=i=>e.check(H4(x_,i)),e.base64=i=>e.check(Y4(z_,i)),e.base64url=i=>e.check(K4(C_,i)),e.xid=i=>e.check(B4(j_,i)),e.ksuid=i=>e.check(q4(__,i)),e.ipv4=i=>e.check(P4(S_,i)),e.ipv6=i=>e.check(Z4(w_,i)),e.cidrv4=i=>e.check(G4(k_,i)),e.cidrv6=i=>e.check(F4(N_,i)),e.e164=i=>e.check(W4(E_,i)),e.datetime=i=>e.check(Kj(i)),e.date=i=>e.check(Xj(i)),e.time=i=>e.check(Qj(i)),e.duration=i=>e.check(t_(i))});function F(e){return T4(m_,e)}const st=ne("ZodStringFormat",(e,n)=>{rt.init(e,n),a1.init(e,n)}),h_=ne("ZodEmail",(e,n)=>{D5.init(e,n),st.init(e,n)}),hh=ne("ZodGUID",(e,n)=>{O5.init(e,n),st.init(e,n)}),bl=ne("ZodUUID",(e,n)=>{A5.init(e,n),st.init(e,n)}),n1=ne("ZodURL",(e,n)=>{I5.init(e,n),st.init(e,n)});function xl(e){return Kv(n1,e)}const y_=ne("ZodEmoji",(e,n)=>{U5.init(e,n),st.init(e,n)}),v_=ne("ZodNanoID",(e,n)=>{L5.init(e,n),st.init(e,n)}),$_=ne("ZodCUID",(e,n)=>{V5.init(e,n),st.init(e,n)}),b_=ne("ZodCUID2",(e,n)=>{H5.init(e,n),st.init(e,n)}),x_=ne("ZodULID",(e,n)=>{B5.init(e,n),st.init(e,n)}),j_=ne("ZodXID",(e,n)=>{q5.init(e,n),st.init(e,n)}),__=ne("ZodKSUID",(e,n)=>{P5.init(e,n),st.init(e,n)}),S_=ne("ZodIPv4",(e,n)=>{K5.init(e,n),st.init(e,n)}),w_=ne("ZodIPv6",(e,n)=>{W5.init(e,n),st.init(e,n)}),k_=ne("ZodCIDRv4",(e,n)=>{X5.init(e,n),st.init(e,n)}),N_=ne("ZodCIDRv6",(e,n)=>{J5.init(e,n),st.init(e,n)}),z_=ne("ZodBase64",(e,n)=>{Q5.init(e,n),st.init(e,n)}),C_=ne("ZodBase64URL",(e,n)=>{t4.init(e,n),st.init(e,n)}),E_=ne("ZodE164",(e,n)=>{a4.init(e,n),st.init(e,n)}),T_=ne("ZodJWT",(e,n)=>{r4.init(e,n),st.init(e,n)}),r1=ne("ZodNumber",(e,n)=>{Pv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>kj(e,s,c),e.gt=(s,c)=>e.check(gh(s,c)),e.gte=(s,c)=>e.check(Xd(s,c)),e.min=(s,c)=>e.check(Xd(s,c)),e.lt=(s,c)=>e.check(ph(s,c)),e.lte=(s,c)=>e.check(Wd(s,c)),e.max=(s,c)=>e.check(Wd(s,c)),e.int=s=>e.check(yh(s)),e.safe=s=>e.check(yh(s)),e.positive=s=>e.check(gh(0,s)),e.nonnegative=s=>e.check(Xd(0,s)),e.negative=s=>e.check(ph(0,s)),e.nonpositive=s=>e.check(Wd(0,s)),e.multipleOf=(s,c)=>e.check(mh(s,c)),e.step=(s,c)=>e.check(mh(s,c)),e.finite=()=>e;const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function Fe(e){return aj(r1,e)}const M_=ne("ZodNumberFormat",(e,n)=>{i4.init(e,n),r1.init(e,n)});function yh(e){return nj(M_,e)}const R_=ne("ZodBoolean",(e,n)=>{o4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Nj(e,i,s)});function Gt(e){return rj(R_,e)}const O_=ne("ZodNull",(e,n)=>{s4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>zj(e,i,s)});function A_(e){return ij(O_,e)}const D_=ne("ZodUnknown",(e,n)=>{l4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Ej()});function Pa(){return oj(D_)}const I_=ne("ZodNever",(e,n)=>{c4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Cj(e,i,s)});function U_(e){return sj(I_,e)}const L_=ne("ZodArray",(e,n)=>{u4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Aj(e,i,s,c),e.element=n.element,e.min=(i,s)=>e.check(fc(i,s)),e.nonempty=i=>e.check(fc(1,i)),e.max=(i,s)=>e.check(Wv(i,s)),e.length=(i,s)=>e.check(Xv(i,s)),e.unwrap=()=>e.element});function pt(e,n){return $j(L_,e,n)}const V_=ne("ZodObject",(e,n)=>{f4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Dj(e,i,s,c),He(e,"shape",()=>n.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=i=>e.clone({...e._zod.def,catchall:i}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Pa()}),e.loose=()=>e.clone({...e._zod.def,catchall:Pa()}),e.strict=()=>e.clone({...e._zod.def,catchall:U_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=i=>Tx(e,i),e.safeExtend=i=>Mx(e,i),e.merge=i=>Rx(e,i),e.pick=i=>Cx(e,i),e.omit=i=>Ex(e,i),e.partial=(...i)=>Ox(o1,e,i[0]),e.required=(...i)=>Ax(s1,e,i[0])});function de(e,n){const i={type:"object",shape:e??{},..._e(n)};return new V_(i)}const i1=ne("ZodUnion",(e,n)=>{Fv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Ij(e,i,s,c),e.options=n.options});function hn(e,n){return new i1({type:"union",options:e,..._e(n)})}const H_=ne("ZodDiscriminatedUnion",(e,n)=>{i1.init(e,n),p4.init(e,n)});function ns(e,n,i){return new H_({type:"union",options:n,discriminator:e,..._e(i)})}const B_=ne("ZodIntersection",(e,n)=>{g4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Uj(e,i,s,c)});function q_(e,n){return new B_({type:"intersection",left:e,right:n})}const P_=ne("ZodRecord",(e,n)=>{m4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Lj(e,i,s,c),e.keyType=n.keyType,e.valueType=n.valueType});function St(e,n,i){return new P_({type:"record",keyType:e,valueType:n,..._e(i)})}const _f=ne("ZodEnum",(e,n)=>{h4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(s,c,u)=>Tj(e,s,c),e.enum=n.entries,e.options=Object.values(n.entries);const i=new Set(Object.keys(n.entries));e.extract=(s,c)=>{const u={};for(const d of s)if(i.has(d))u[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new _f({...n,checks:[],..._e(c),entries:u})},e.exclude=(s,c)=>{const u={...n.entries};for(const d of s)if(i.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new _f({...n,checks:[],..._e(c),entries:u})}});function dt(e,n){const i=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new _f({type:"enum",entries:i,..._e(n)})}const Z_=ne("ZodLiteral",(e,n)=>{y4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Mj(e,i,s),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Re(e,n){return new Z_({type:"literal",values:Array.isArray(e)?e:[e],..._e(n)})}const G_=ne("ZodTransform",(e,n)=>{v4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Oj(e,i),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new zv(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(Jo(u,i.value,n));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=i.value),d.inst??(d.inst=e),i.issues.push(Jo(d))}};const c=n.transform(i.value,i);return c instanceof Promise?c.then(u=>(i.value=u,i)):(i.value=c,i)}});function F_(e){return new G_({type:"transform",transform:e})}const o1=ne("ZodOptional",(e,n)=>{Yv.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>t1(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function vh(e){return new o1({type:"optional",innerType:e})}const Y_=ne("ZodExactOptional",(e,n)=>{$4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>t1(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function K_(e){return new Y_({type:"optional",innerType:e})}const W_=ne("ZodNullable",(e,n)=>{b4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Vj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function $h(e){return new W_({type:"nullable",innerType:e})}const X_=ne("ZodDefault",(e,n)=>{x4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Bj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function J_(e,n){return new X_({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Mv(n)}})}const Q_=ne("ZodPrefault",(e,n)=>{j4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>qj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function eS(e,n){return new Q_({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Mv(n)}})}const s1=ne("ZodNonOptional",(e,n)=>{_4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Hj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function tS(e,n){return new s1({type:"nonoptional",innerType:e,..._e(n)})}const aS=ne("ZodCatch",(e,n)=>{S4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Pj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nS(e,n){return new aS({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const rS=ne("ZodPipe",(e,n)=>{w4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Zj(e,i,s,c),e.in=n.in,e.out=n.out});function bh(e,n){return new rS({type:"pipe",in:e,out:n})}const iS=ne("ZodReadonly",(e,n)=>{k4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Gj(e,i,s,c),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new iS({type:"readonly",innerType:e})}const sS=ne("ZodLazy",(e,n)=>{N4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Fj(e,i,s,c),e.unwrap=()=>e._zod.def.getter()});function l1(e){return new sS({type:"lazy",getter:e})}const lS=ne("ZodCustom",(e,n)=>{z4.init(e,n),nt.init(e,n),e._zod.processJSONSchema=(i,s,c)=>Rj(e,i)});function cS(e,n={}){return bj(lS,e,n)}function uS(e){return xj(e)}const c1="@ggui-ai/gadgets",dS="0.1.0-rc.3",fS=[{package:c1,version:dS,exports:[{hook:"useCamera",permission:"camera",description:"Capture stills or live video from the device camera.",usage:"Mount when the intent names photo capture, QR / barcode scanning, video recording, or anything that requires a camera feed. The hook returns a stream once `start()` resolves; thread the resulting blob or stream URL into a contextSpec slot or an actionSpec payload to surface it to the agent.",example:{call:"const cam = useCamera();",returns:{status:"ready",value:{stream:"<MediaStream>",kind:"video"}}}},{hook:"useClipboardPaste",permission:"clipboard-read",description:"Read the system clipboard contents on user gesture.",usage:"Mount when the intent involves importing copied content (paste-into-form, paste-image-to-upload, paste-link). The Permissions API requires a user gesture; gate `start()` behind a button click. Returned value lands in a contextSpec slot or an actionSpec payload.",example:{call:"const paste = useClipboardPaste();",returns:{status:"ready",value:"pasted clipboard text"}}},{hook:"useClipboardWrite",permission:"clipboard-write",description:"Write to the system clipboard on user gesture.",usage:"Mount when the intent includes copying generated text, share links, codes, or transcripts to the system clipboard. Fire an actionSpec event so the agent observes the act (it does not see the written value — that stays component-local).",example:{call:"const write = useClipboardWrite(); write.write('hello');",returns:{status:"ready"}}},{hook:"useFilePicker",description:"Open the native file picker and read selected files.",usage:"Mount when the intent names file upload, attachment selection, or document import. No permission required. The hook returns the picked files plus metadata; thread file refs / data URLs into a contextSpec slot or actionSpec payload.",example:{call:'const picker = useFilePicker({ accept: "image/*" });',returns:{status:"ready",value:[{name:"photo.png",type:"image/png",size:12345}]}}},{hook:"useGeolocation",permission:"geolocation",description:"Resolve the device's current geolocation.",usage:'Mount when the intent names "current location", maps, nearby search, location-aware UI. Browser prompts the user on `start()`; the hook returns coordinates once granted. Thread the resolved coords into a contextSpec slot so the agent observes the latest fix.',example:{call:"const geo = useGeolocation();",returns:{status:"ready",value:{latitude:37.7749,longitude:-122.4194,accuracy:20}}}},{hook:"useMicrophone",permission:"microphone",description:"Capture audio from the device microphone.",usage:"Mount when the intent names voice memos, audio messages, dictation, voice-driven UI. Returns an audio stream / blob; thread it into an actionSpec payload at recording-stop, or into a contextSpec slot for live transcription pipelines.",example:{call:"const mic = useMicrophone();",returns:{status:"ready",value:{stream:"<MediaStream>",kind:"audio"}}}},{hook:"useNotifications",permission:"notifications",description:"Show system / browser notifications to the user.",usage:"Mount when the intent involves alerting the user about something (reminders, completion of long tasks, incoming messages) and the UI may be in the background. Permission is prompted on first `start()`; the agent does NOT see notification dismissal directly — surface it via an actionSpec if needed.",example:{call:"const notify = useNotifications(); notify.show({ title: 'Done' });",returns:{status:"ready",value:{granted:!0}}}}]}];Object.freeze(new Set(fS.flatMap(e=>e.exports).map(e=>e.hook).filter(e=>e!==void 0)));const Hf=/^use[A-Z][A-Za-z0-9]*$/,Bf=/^[A-Z][A-Za-z0-9]*$/,qf=["geolocation","notifications","microphone","camera","persistent-storage","midi","clipboard-read","clipboard-write","speaker-selection","storage-access","background-sync","accelerometer","gyroscope","magnetometer","ambient-light-sensor","screen-wake-lock"];new Set(qf);const ft=l1(()=>hn([F(),Fe(),Gt(),A_(),pt(ft),St(F(),ft)])),mn=l1(()=>de({type:dt(["string","number","integer","boolean","array","object","null"]).optional(),description:F().optional(),enum:pt(ft).optional(),default:ft.optional(),example:ft.optional(),items:mn.optional(),properties:St(F(),mn).optional(),required:pt(F()).optional(),additionalProperties:hn([mn,Gt()]).optional(),format:F().optional()}).passthrough()),pS=de({description:F().optional(),schema:mn,required:Gt().optional(),default:ft.optional(),example:ft.optional(),sourceTool:F().optional()}).strict(),gS=de({description:F().optional(),properties:St(F(),pS)}).strict(),mS=de({description:F().optional(),label:F(),schema:mn.optional(),example:ft.optional(),icon:F().optional(),confirm:Gt().optional(),nextStep:F().min(1).optional()}).strict(),hS=St(F(),mS),yS=de({description:F().optional(),schema:mn,example:ft.optional(),mode:dt(["append","replace"]).optional(),replay:dt(["latest","all","none"]).optional(),complete:Gt().optional(),tool:F().optional(),source:de({tool:F(),args:St(F(),ft).optional()}).strict().optional()}).strict(),vS=St(F(),yS),$S=de({description:F().optional(),schema:mn,default:ft.optional(),debounceMs:Fe().int().nonnegative().optional(),example:ft.optional()}).strict(),bS=St(F(),$S),xS=de({description:F().optional(),usage:F().optional(),inputSchema:mn.optional(),outputSchema:mn.optional(),required:Gt().optional(),example:de({input:ft,output:ft}).strict().optional()}).strict(),jS=de({tools:St(F(),xS)}).passthrough(),u1=/^GGUI_PUBLIC_APP_[A-Z0-9_]+$/,_S=pt(F().regex(u1)).readonly(),xh=/^sha384-[A-Za-z0-9+/]+=*$/,d1=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,SS=/^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/,wS=/^[a-z0-9.-]+(:\d+)?$/,f1={gotchas:F().optional(),required:Gt().optional()},jh={...f1,description:F().optional(),usage:F().optional(),example:ft.optional(),permission:F().optional()},_h={...f1,description:F().min(1),usage:F().min(1),example:ft,permission:dt(qf).optional()},p1={version:F().regex(SS),package:F().regex(d1),bundleUrl:xl().optional(),bundleHost:F().regex(wS).optional(),bundleSri:F().regex(xh).optional(),styleUrl:xl().optional(),connect:pt(xl()).readonly().optional(),requires:_S.optional(),typesUrl:xl().optional(),typesSri:F().regex(xh).optional()},kS=hn([de({hook:F().regex(Hf),...jh}).strict(),de({component:F().regex(Bf),...jh}).strict()]),NS=hn([de({hook:F().regex(Hf),..._h}).strict(),de({component:F().regex(Bf),..._h}).strict()]);de({...p1,exports:pt(kS).min(1)}).strict();const zS=de({...p1,exports:pt(NS).min(1)}).strict();zS.refine(e=>e.package===c1||typeof e.typesUrl=="string",{message:"registered GadgetDescriptor MUST declare a `typesUrl` (HTTPS URL to the package's .d.ts) — the code-gen sandbox loads it to typecheck generated component code against the export signatures. Run `tsup --dts` (or `tsc --declaration`) in the wrapper build and publish the emitted .d.ts. Only the first-party `@ggui-ai/gadgets` stdlib is exempt.",path:["typesUrl"]});const CS=de({description:F().optional(),usage:F().optional()}).strict(),ES=St(F().refine(e=>Hf.test(e)||Bf.test(e),{message:"gadget export name must be a `use`-prefixed hook or a PascalCase component identifier"}),CS).refine(e=>Object.keys(e).length>0,{message:"a `clientCapabilities.gadgets` package entry must declare at least one export"}),TS=de({gadgets:St(F().regex(d1),ES)}).strict();St(F().regex(u1),F()).readonly();const _c=de({propsSpec:gS.optional(),actionSpec:hS.optional(),streamSpec:vS.optional(),contextSpec:bS.optional(),agentCapabilities:jS.optional(),clientCapabilities:TS.optional()}).passthrough(),Pf=de({persona:F().optional(),aesthetic:F().optional(),context:St(F(),ft).optional(),seedPrompt:F().optional()}).strict(),MS=de({blueprintId:F().min(1),contractHash:F().min(1),appId:F().min(1),codeS3Url:F().optional(),codeHash:F().optional(),generator:F().min(1),validatorScore:Fe().min(0).max(1).optional(),variance:Pf,isOperatorDefault:Re(!0).optional(),createdAt:F().min(1),createdBy:dt(["agent","operator"]),contract:_c,contractEmbedding:pt(Fe()).optional()}).strict();de({hash:Fe().min(0),embed:Fe().min(0),struct:Fe().min(0),variance:Fe().min(0),intent:Fe().min(0)}).strict();const RS=de({hash:Fe().min(0).optional(),embed:Fe().min(0).optional(),struct:Fe().min(0).optional(),variance:Fe().min(0).optional(),intent:Fe().min(0).optional()}).strict();de({weights:RS.optional(),threshold:Fe().min(0).max(1).optional(),topK:Fe().int().min(1).optional()}).strict();const OS=dt(["cache","agent","synth"]),AS=hn([de({op:Re("add"),path:F(),value:ft}).strict(),de({op:Re("remove"),path:F()}).strict(),de({op:Re("replace"),path:F(),value:ft}).strict()]),DS=pt(AS),IS=de({contract:_c,variance:de({persona:F().optional(),aesthetic:F().optional(),context:St(F(),ft).optional(),seedPrompt:F().optional()}).strict().optional(),generator:F().optional()}).strict(),g1=IS,US=de({blueprintId:F().min(1),contractHash:F().min(1),codeHash:F().optional(),generator:F().min(1),variance:Pf,selectedReason:F().optional()}).strict(),LS=de({code:F().min(1),severity:dt(["error","warn"]),path:F(),message:F()}).strict(),VS=de({contractDiff:DS,reasoning:F()}).strict(),HS=de({origin:OS,rationale:F(),blueprintMeta:US,amendments:VS.optional(),validationFindings:pt(LS).optional()}).strict(),BS=hn([de({kind:Re("accept")}).strict(),de({kind:Re("override"),blueprintDraft:g1}).strict()]),qS=de({width:Fe(),height:Fe()}),PS=de({viewport:qS,platform:dt(["web","mobile","desktop"]),deviceType:dt(["phone","tablet","desktop"]),orientation:dt(["portrait","landscape"]),devicePixelRatio:Fe().optional(),touchPrimary:Gt().optional(),shellType:dt(["chat","fullscreen","spatial"]).optional(),colorScheme:dt(["light","dark"]).optional(),reducedMotion:Gt().optional()}).passthrough();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),timeout:Fe().min(0).max(25).optional().describe("Long-poll timeout in seconds (default short; max 25).")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session."),channel:F().describe("Channel name declared on the active stack item streamSpec."),payload:Pa().describe("Payload — must match streamSpec[channel].schema."),complete:Gt().optional().describe("True marks the stream complete; subsequent emits on this channel reject."),stackItemId:F().optional().describe("Stack item to scope this emit to; defaults to session top.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({sessionId:F().describe("Session opaque id from ggui_new_session.")}).strict();de({level:dt(["primitive","component","composite","template"]).optional(),category:F().optional(),tags:pt(F()).optional(),limit:Fe().optional()}).strict();de({query:F(),limit:Fe().optional()}).strict();de({blueprintId:F(),props:St(F(),Pa()).optional()}).strict();de({}).strict();de({serviceId:F().describe('OAuth service ID (e.g., "bashdoor", "ubot")'),reason:F().optional().describe("Why the agent needs this credential (shown to user)"),sessionId:F().optional().describe("Existing session ID to push consent UI into")}).strict();de({}).strict();de({sessionId:F().describe("Thread this through every subsequent ggui_handshake / ggui_update call in this chat."),appId:F(),createdAt:F().describe("ISO 8601 — creation timestamp of the freshly-minted session."),nextStep:de({tool:Re("ggui_handshake"),description:F(),example:F()}).describe("Wire-shape recovery hint — a worked literal example of the next call.")});de({sessionId:F().min(1).describe("Session handle minted by ggui_new_session. Required — call ggui_new_session({seed?}) first to obtain one. Reuse the same sessionId across multiple handshake/push pairs in the same chat to grow the session stack."),intent:F().min(1).describe('Concise purpose — same intent = same component reused. e.g. "Gmail inbox for email triage"'),blueprintDraft:g1.describe("Agent's draft: contract (required) + optional variance + optional generator slug hint. The server combines this with cached blueprints + validator outcomes to produce a three-mode suggestion (cache / agent / synth)."),forceCreate:Gt().optional()}).strict();de({handshakeId:F().describe("Stable id — pass to ggui_push / ggui_update"),action:dt(["create","reuse","update","replace","compose","declined"]),suggestion:HS.describe("Server's suggestion — origin-routed (cache | agent | synth). Always carries a provisional `blueprintMeta` the agent reuses by sending `decision: 'accept'` on push."),reason:F().max(280).optional().describe("Short rationale (≤280 chars) for the `action` value. Surfaced for agent + operator visibility; truncated to keep the structuredContent payload predictable."),nextStep:de({tool:Re("ggui_push"),description:F(),example:F()}).optional().describe("Wire-shape recovery hint. A worked literal example of the next ggui_push call the agent should emit — the example string can be copied verbatim and tweaked (e.g. fill in `props` placeholders). Top-level field so a skimming agent finds it immediately.")});de({handshakeId:F({message:"ggui_push: handshakeId is REQUIRED. Call ggui_handshake({sessionId, intent, blueprintDraft}) first to negotiate — handshake returns a handshakeId + suggestion. Then push with {handshakeId, decision: {kind: 'accept'}} (accept the suggestion) or {handshakeId, decision: {kind: 'override', blueprintDraft: {...}}} (override with a fresh draft). Direct-push without a handshakeId is not supported."}).min(1,"ggui_push: handshakeId must be a non-empty string from a prior ggui_handshake call."),props:St(F(),Pa()).optional(),decision:BS.describe("Accept the handshake suggestion (use provisional blueprintId verbatim) or override with a fresh draft (mint new blueprintId).")}).strict();de({stackItemId:F(),url:F().url(),action:dt(["create","reuse","update","replace","compose","declined"]),nextStep:de({tool:Re("ggui_consume"),description:F(),example:F(),args:de({stackItemId:F()})}).optional().describe("Recovery hint — when the pushed contract has actions, points the agent at ggui_consume({stackItemId}) for the inbound action loop. Absent for pure-display pushes.")});ns("kind",[de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),kind:Re("replace"),props:St(F(),Pa()).describe("Full replacement props map. New map IS the new state.")}).strict(),de({stackItemId:F().describe("Stack item opaque id (UUID) — returned by ggui_push."),kind:Re("merge"),patch:St(F(),Pa()).describe("RFC 7396 JSON Merge Patch — null deletes a key; arrays fully replace.")}).strict()]);de({stackItemId:F(),updated:Gt()});const ZS=de({type:Re("text"),text:F()}),GS=de({type:Re("tool_use"),id:F(),name:F(),input:St(F(),Pa())}),FS=de({type:Re("tool_result"),tool_use_id:F(),content:Pa(),is_error:Gt().optional()}),m1=ns("type",[ZS,GS,FS]),YS=de({type:Re("text_delta"),text:F()}),KS=de({type:Re("input_json_delta"),partial_json:F()}),WS=ns("type",[YS,KS]),XS=de({type:Re("message_start"),message:de({id:F(),role:Re("assistant"),model:F().optional()})}),JS=de({type:Re("content_block_start"),index:Fe().int().nonnegative(),content_block:m1}),QS=de({type:Re("content_block_delta"),index:Fe().int().nonnegative(),delta:WS}),e3=de({type:Re("content_block_stop"),index:Fe().int().nonnegative()}),t3=de({type:Re("message_delta"),delta:de({stop_reason:dt(["end_turn","max_tokens","tool_use","error"]),stop_sequence:F().nullable().optional()}),usage:de({input_tokens:Fe().int().nonnegative(),output_tokens:Fe().int().nonnegative()})}),a3=de({type:Re("message_stop")}),n3=de({type:Re("ping")}),r3=dt(["invalid_request","unauthorized","rate_limited","invoke_in_progress","upstream_error","tool_error","internal"]),i3=de({type:Re("error"),error:de({code:r3,message:F(),retryAfterMs:Fe().int().nonnegative().optional()})});ns("type",[XS,JS,QS,e3,t3,a3,n3,i3]);const o3=de({role:dt(["user","assistant"]),content:hn([F(),pt(m1)])});de({message:F(),history:pt(o3).optional(),interfaceContext:PS.optional(),requestId:F().optional()});de({contract:_c,generator:F().min(1).optional().describe("Generator slug (e.g. `ui-gen-default-haiku-4-5`). When omitted, dispatches through `GeneratorRegistry.defaultGenerator()`."),persona:F().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:F().optional().describe("Free-form aesthetic tag (e.g. 'glassmorphic', 'brutalist', 'editorial'). Persisted on `Blueprint.variance.aesthetic`. Distinct from persona — persona names the user mental model; aesthetic names the visual treatment."),context:St(F(),ft).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:F().optional().describe("The raw operator prompt that produced this variant. Round-trip input for the variant-selector + audit trail."),setAsOperatorDefault:Gt().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();de({blueprintId:F().min(1),codeHash:F().optional().describe("Content hash of the generated code body. Absent when the generator returned a non-`ok` result and persistence skipped — the failure mode is surfaced through generator-level error reporting elsewhere."),validatorScore:Fe().min(0).max(1).optional().describe("Advanced generator's iterative-loop validator score (0-1). Absent for default-generator output."),generator:F().min(1).describe("Slug of the generator the dispatch resolved to.")}).strict();de({contract:_c,componentCode:F().min(1).describe("Verbatim component-code body to persist. Stored as-is — no LLM call, no validator pass. Operator owns correctness; the handler computes the canonical sha256 codeHash and routes the bytes through the same persistence seams as `*_generate_*`."),generator:F().min(1).optional().describe("Optional generator slug to stamp on the persisted Blueprint.generator field — purely an audit/provenance hint for downstream `*_list_blueprints` consumers. Defaults to the registry default slug."),persona:F().optional().describe("Free-form persona tag (e.g. 'minimalist', 'data-dense'). Normalized via lowercase+trim before persistence; logged as a warning when within Levenshtein distance < 2 of an existing tag for the same appId."),aesthetic:F().optional().describe("Free-form aesthetic tag. Persisted on `Blueprint.variance.aesthetic`."),context:St(F(),ft).optional().describe("Small structured signal carried alongside the persona. Persisted on `Blueprint.variance.context`."),seedPrompt:F().optional().describe("Optional originating prompt for audit + round-tripping (e.g. the prose the operator originally fed into `*_generate_*` before exporting)."),setAsOperatorDefault:Gt().optional().describe("When true, pins the new blueprint as the operator default for its `(appId, contractHash)` group, clearing any prior default in the same group.")}).strict();de({blueprintId:F().min(1),codeHash:F().min(1).describe("Content hash of the persisted code body (full sha256 hex)."),generator:F().min(1).describe("Resolved generator slug stamped on the Blueprint.generator field — either the supplied input or the registry default.")}).strict();de({contractHash:F().min(1).optional().describe("Filter to a single `(appId, contractHash)` group. Combine with `generator` / `persona` to narrow within the group."),generator:F().min(1).optional().describe("Filter to blueprints produced by a specific generator slug."),persona:F().optional().describe("Filter on `variance.persona`. Normalized to match persisted form (lowercase+trim)."),intentKeywords:pt(F().min(1)).optional().describe("Semantic-search tokens. When set, dispatches through `BlueprintSearch.search()` rather than indexed `list()`.")}).strict();de({blueprints:pt(MS)}).strict();de({blueprintId:F().min(1),isOperatorDefault:Re(!0).optional().describe("When `true`, pins this blueprint as the operator default for its `(appId, contractHash)` group. Clears any prior default. Cannot set to `false` — to unpin, set another blueprint in the same group as default, or delete this one."),variance:Pf.optional().describe('Partial-merge into the existing variance. Supplied keys overwrite; omitted keys preserve. Pass `{persona: ""}` to clear a persona (handler treats empty string as removal).')}).strict();de({blueprintId:F().min(1),updatedAt:F().min(1)}).strict();de({blueprintId:F().min(1)}).strict();de({deleted:Re(!0)}).strict();const Sh={AGENT_DATA:"ggui:agent-data"};function s3(e){return"schemaVersion"in e?e.schemaVersion:jx}function l3(e){const n={sessionId:e.sessionId,type:e.type};e.payload!==void 0&&(n.payload=e.payload),e.stackIndex!==void 0&&(n.stackIndex=e.stackIndex),e.stackItemId!==void 0&&(n.stackItemId=e.stackItemId),e.clientSeq!==void 0&&(n.clientSeq=e.clientSeq);const i=s3(e);return i!==void 0&&(n.schemaVersion=i),n}var jl={exports:{}},Jd={},dn={},Lr={},Qd={},ef={},tf={},wh;function gc(){return wh||(wh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class n{}e._CodeOrName=n,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=i;class s extends n{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((w,R)=>`${w}${R}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((w,R)=>(R instanceof i&&(w[R.str]=(w[R.str]||0)+1),w),{})}}e._Code=s,e.nil=new s("");function c(N,...$){const w=[N[0]];let R=0;for(;R<$.length;)p(w,$[R]),w.push(N[++R]);return new s(w)}e._=c;const u=new s("+");function d(N,...$){const w=[k(N[0])];let R=0;for(;R<$.length;)w.push(u),p(w,$[R]),w.push(u,k(N[++R]));return g(w),new s(w)}e.str=d;function p(N,$){$ instanceof s?N.push(...$._items):$ instanceof i?N.push($):N.push(v($))}e.addCodeArg=p;function g(N){let $=1;for(;$<N.length-1;){if(N[$]===u){const w=h(N[$-1],N[$+1]);if(w!==void 0){N.splice($-1,3,w);continue}N[$++]="+"}$++}}function h(N,$){if($==='""')return N;if(N==='""')return $;if(typeof N=="string")return $ instanceof i||N[N.length-1]!=='"'?void 0:typeof $!="string"?`${N.slice(0,-1)}${$}"`:$[0]==='"'?N.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(N instanceof i))return`"${N}${$.slice(1)}`}function y(N,$){return $.emptyStr()?N:N.emptyStr()?$:d`${N}${$}`}e.strConcat=y;function v(N){return typeof N=="number"||typeof N=="boolean"||N===null?N:k(Array.isArray(N)?N.join(","):N)}function j(N){return new s(k(N))}e.stringify=j;function k(N){return JSON.stringify(N).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=k;function b(N){return typeof N=="string"&&e.IDENTIFIER.test(N)?new s(`.${N}`):c`[${N}]`}e.getProperty=b;function C(N){if(typeof N=="string"&&e.IDENTIFIER.test(N))return new s(`${N}`);throw new Error(`CodeGen: invalid export name: ${N}, use explicit $id name mapping`)}e.getEsmExportName=C;function z(N){return new s(N.toString())}e.regexpCode=z})(tf)),tf}var af={},kh;function Nh(){return kh||(kh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const n=gc();class i extends Error{constructor(h){super(`CodeGen: "code" for ${h} not defined`),this.value=h.value}}var s;(function(g){g[g.Started=0]="Started",g[g.Completed=1]="Completed"})(s||(e.UsedValueState=s={})),e.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class c{constructor({prefixes:h,parent:y}={}){this._names={},this._prefixes=h,this._parent=y}toName(h){return h instanceof n.Name?h:this.name(h)}name(h){return new n.Name(this._newName(h))}_newName(h){const y=this._names[h]||this._nameGroup(h);return`${h}${y.index++}`}_nameGroup(h){var y,v;if(!((v=(y=this._parent)===null||y===void 0?void 0:y._prefixes)===null||v===void 0)&&v.has(h)||this._prefixes&&!this._prefixes.has(h))throw new Error(`CodeGen: prefix "${h}" is not allowed in this scope`);return this._names[h]={prefix:h,index:0}}}e.Scope=c;class u extends n.Name{constructor(h,y){super(y),this.prefix=h}setValue(h,{property:y,itemIndex:v}){this.value=h,this.scopePath=(0,n._)`.${new n.Name(y)}[${v}]`}}e.ValueScopeName=u;const d=(0,n._)`\n`;class p extends c{constructor(h){super(h),this._values={},this._scope=h.scope,this.opts={...h,_n:h.lines?d:n.nil}}get(){return this._scope}name(h){return new u(h,this._newName(h))}value(h,y){var v;if(y.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const j=this.toName(h),{prefix:k}=j,b=(v=y.key)!==null&&v!==void 0?v:y.ref;let C=this._values[k];if(C){const $=C.get(b);if($)return $}else C=this._values[k]=new Map;C.set(b,j);const z=this._scope[k]||(this._scope[k]=[]),N=z.length;return z[N]=y.ref,j.setValue(y,{property:k,itemIndex:N}),j}getValue(h,y){const v=this._values[h];if(v)return v.get(y)}scopeRefs(h,y=this._values){return this._reduceValues(y,v=>{if(v.scopePath===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return(0,n._)`${h}${v.scopePath}`})}scopeCode(h=this._values,y,v){return this._reduceValues(h,j=>{if(j.value===void 0)throw new Error(`CodeGen: name "${j}" has no value`);return j.value.code},y,v)}_reduceValues(h,y,v={},j){let k=n.nil;for(const b in h){const C=h[b];if(!C)continue;const z=v[b]=v[b]||new Map;C.forEach(N=>{if(z.has(N))return;z.set(N,s.Started);let $=y(N);if($){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;k=(0,n._)`${k}${w} ${N} = ${$};${this.opts._n}`}else if($=j==null?void 0:j(N))k=(0,n._)`${k}${$}${this.opts._n}`;else throw new i(N);z.set(N,s.Completed)})}return k}}e.ValueScope=p})(af)),af}var zh;function De(){return zh||(zh=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const n=gc(),i=Nh();var s=gc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return s.Name}});var c=Nh();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),e.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class u{optimizeNodes(){return this}optimizeNames(E,V){return this}}class d extends u{constructor(E,V,W){super(),this.varKind=E,this.name=V,this.rhs=W}render({es5:E,_n:V}){const W=E?i.varKinds.var:this.varKind,he=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${he};`+V}optimizeNames(E,V){if(E[this.name.str])return this.rhs&&(this.rhs=le(this.rhs,E,V)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class p extends u{constructor(E,V,W){super(),this.lhs=E,this.rhs=V,this.sideEffects=W}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,V){if(!(this.lhs instanceof n.Name&&!E[this.lhs.str]&&!this.sideEffects))return this.rhs=le(this.rhs,E,V),this}get names(){const E=this.lhs instanceof n.Name?{}:{...this.lhs.names};return re(E,this.rhs)}}class g extends p{constructor(E,V,W,he){super(E,W,he),this.op=V}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}}class h extends u{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}}class y extends u{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}}class v extends u{constructor(E){super(),this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}}class j extends u{constructor(E){super(),this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,V){return this.code=le(this.code,E,V),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class k extends u{constructor(E=[]){super(),this.nodes=E}render(E){return this.nodes.reduce((V,W)=>V+W.render(E),"")}optimizeNodes(){const{nodes:E}=this;let V=E.length;for(;V--;){const W=E[V].optimizeNodes();Array.isArray(W)?E.splice(V,1,...W):W?E[V]=W:E.splice(V,1)}return E.length>0?this:void 0}optimizeNames(E,V){const{nodes:W}=this;let he=W.length;for(;he--;){const pe=W[he];pe.optimizeNames(E,V)||($e(E,pe.names),W.splice(he,1))}return W.length>0?this:void 0}get names(){return this.nodes.reduce((E,V)=>J(E,V.names),{})}}class b extends k{render(E){return"{"+E._n+super.render(E)+"}"+E._n}}class C extends k{}class z extends b{}z.kind="else";class N extends b{constructor(E,V){super(V),this.condition=E}render(E){let V=`if(${this.condition})`+super.render(E);return this.else&&(V+="else "+this.else.render(E)),V}optimizeNodes(){super.optimizeNodes();const E=this.condition;if(E===!0)return this.nodes;let V=this.else;if(V){const W=V.optimizeNodes();V=this.else=Array.isArray(W)?new z(W):W}if(V)return E===!1?V instanceof N?V:V.nodes:this.nodes.length?this:new N(ce(E),V instanceof N?[V]:V.nodes);if(!(E===!1||!this.nodes.length))return this}optimizeNames(E,V){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(E,V),!!(super.optimizeNames(E,V)||this.else))return this.condition=le(this.condition,E,V),this}get names(){const E=super.names;return re(E,this.condition),this.else&&J(E,this.else.names),E}}N.kind="if";class $ extends b{}$.kind="for";class w extends ${constructor(E){super(),this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,V){if(super.optimizeNames(E,V))return this.iteration=le(this.iteration,E,V),this}get names(){return J(super.names,this.iteration.names)}}class R extends ${constructor(E,V,W,he){super(),this.varKind=E,this.name=V,this.from=W,this.to=he}render(E){const V=E.es5?i.varKinds.var:this.varKind,{name:W,from:he,to:pe}=this;return`for(${V} ${W}=${he}; ${W}<${pe}; ${W}++)`+super.render(E)}get names(){const E=re(super.names,this.from);return re(E,this.to)}}class x extends ${constructor(E,V,W,he){super(),this.loop=E,this.varKind=V,this.name=W,this.iterable=he}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,V){if(super.optimizeNames(E,V))return this.iterable=le(this.iterable,E,V),this}get names(){return J(super.names,this.iterable.names)}}class _ extends b{constructor(E,V,W){super(),this.name=E,this.args=V,this.async=W}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}}_.kind="func";class T extends k{render(E){return"return "+super.render(E)}}T.kind="return";class A extends b{render(E){let V="try"+super.render(E);return this.catch&&(V+=this.catch.render(E)),this.finally&&(V+=this.finally.render(E)),V}optimizeNodes(){var E,V;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(V=this.finally)===null||V===void 0||V.optimizeNodes(),this}optimizeNames(E,V){var W,he;return super.optimizeNames(E,V),(W=this.catch)===null||W===void 0||W.optimizeNames(E,V),(he=this.finally)===null||he===void 0||he.optimizeNames(E,V),this}get names(){const E=super.names;return this.catch&&J(E,this.catch.names),this.finally&&J(E,this.finally.names),E}}class I extends b{constructor(E){super(),this.error=E}render(E){return`catch(${this.error})`+super.render(E)}}I.kind="catch";class P extends b{render(E){return"finally"+super.render(E)}}P.kind="finally";class H{constructor(E,V={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...V,_n:V.lines?`
|
|
88
88
|
`:""},this._extScope=E,this._scope=new i.Scope({parent:E}),this._nodes=[new C]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,V){const W=this._extScope.value(E,V);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(E,V){return this._extScope.getValue(E,V)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,V,W,he){const pe=this._scope.toName(V);return W!==void 0&&he&&(this._constants[pe.str]=W),this._leafNode(new d(E,pe,W)),pe}const(E,V,W){return this._def(i.varKinds.const,E,V,W)}let(E,V,W){return this._def(i.varKinds.let,E,V,W)}var(E,V,W){return this._def(i.varKinds.var,E,V,W)}assign(E,V,W){return this._leafNode(new p(E,V,W))}add(E,V){return this._leafNode(new g(E,e.operators.ADD,V))}code(E){return typeof E=="function"?E():E!==n.nil&&this._leafNode(new j(E)),this}object(...E){const V=["{"];for(const[W,he]of E)V.length>1&&V.push(","),V.push(W),(W!==he||this.opts.es5)&&(V.push(":"),(0,n.addCodeArg)(V,he));return V.push("}"),new n._Code(V)}if(E,V,W){if(this._blockNode(new N(E)),V&&W)this.code(V).else().code(W).endIf();else if(V)this.code(V).endIf();else if(W)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new N(E))}else(){return this._elseNode(new z)}endIf(){return this._endBlockNode(N,z)}_for(E,V){return this._blockNode(E),V&&this.code(V).endFor(),this}for(E,V){return this._for(new w(E),V)}forRange(E,V,W,he,pe=this.opts.es5?i.varKinds.var:i.varKinds.let){const we=this._scope.toName(E);return this._for(new R(pe,we,V,W),()=>he(we))}forOf(E,V,W,he=i.varKinds.const){const pe=this._scope.toName(E);if(this.opts.es5){const we=V instanceof n.Name?V:this.var("_arr",V);return this.forRange("_i",0,(0,n._)`${we}.length`,xe=>{this.var(pe,(0,n._)`${we}[${xe}]`),W(pe)})}return this._for(new x("of",he,pe,V),()=>W(pe))}forIn(E,V,W,he=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,(0,n._)`Object.keys(${V})`,W);const pe=this._scope.toName(E);return this._for(new x("in",he,pe,V),()=>W(pe))}endFor(){return this._endBlockNode($)}label(E){return this._leafNode(new h(E))}break(E){return this._leafNode(new y(E))}return(E){const V=new T;if(this._blockNode(V),this.code(E),V.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(E,V,W){if(!V&&!W)throw new Error('CodeGen: "try" without "catch" and "finally"');const he=new A;if(this._blockNode(he),this.code(E),V){const pe=this.name("e");this._currNode=he.catch=new I(pe),V(pe)}return W&&(this._currNode=he.finally=new P,this.code(W)),this._endBlockNode(I,P)}throw(E){return this._leafNode(new v(E))}block(E,V){return this._blockStarts.push(this._nodes.length),E&&this.code(E).endBlock(V),this}endBlock(E){const V=this._blockStarts.pop();if(V===void 0)throw new Error("CodeGen: not in self-balancing block");const W=this._nodes.length-V;if(W<0||E!==void 0&&W!==E)throw new Error(`CodeGen: wrong number of nodes: ${W} vs ${E} expected`);return this._nodes.length=V,this}func(E,V=n.nil,W,he){return this._blockNode(new _(E,V,W)),he&&this.code(he).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(E=1){for(;E-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,V){const W=this._currNode;if(W instanceof E||V&&W instanceof V)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${V?`${E.kind}/${V.kind}`:E.kind}"`)}_elseNode(E){const V=this._currNode;if(!(V instanceof N))throw new Error('CodeGen: "else" without "if"');return this._currNode=V.else=E,this}get _root(){return this._nodes[0]}get _currNode(){const E=this._nodes;return E[E.length-1]}set _currNode(E){const V=this._nodes;V[V.length-1]=E}}e.CodeGen=H;function J(B,E){for(const V in E)B[V]=(B[V]||0)+(E[V]||0);return B}function re(B,E){return E instanceof n._CodeOrName?J(B,E.names):B}function le(B,E,V){if(B instanceof n.Name)return W(B);if(!he(B))return B;return new n._Code(B._items.reduce((pe,we)=>(we instanceof n.Name&&(we=W(we)),we instanceof n._Code?pe.push(...we._items):pe.push(we),pe),[]));function W(pe){const we=V[pe.str];return we===void 0||E[pe.str]!==1?pe:(delete E[pe.str],we)}function he(pe){return pe instanceof n._Code&&pe._items.some(we=>we instanceof n.Name&&E[we.str]===1&&V[we.str]!==void 0)}}function $e(B,E){for(const V in E)B[V]=(B[V]||0)-(E[V]||0)}function ce(B){return typeof B=="boolean"||typeof B=="number"||B===null?!B:(0,n._)`!${ee(B)}`}e.not=ce;const me=U(e.operators.AND);function fe(...B){return B.reduce(me)}e.and=fe;const Ee=U(e.operators.OR);function D(...B){return B.reduce(Ee)}e.or=D;function U(B){return(E,V)=>E===n.nil?V:V===n.nil?E:(0,n._)`${ee(E)} ${B} ${ee(V)}`}function ee(B){return B instanceof n.Name?B:(0,n._)`(${B})`}})(ef)),ef}var Ae={},Ch;function qe(){if(Ch)return Ae;Ch=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.checkStrictMode=Ae.getErrorPath=Ae.Type=Ae.useFunc=Ae.setEvaluated=Ae.evaluatedPropsToName=Ae.mergeEvaluated=Ae.eachItem=Ae.unescapeJsonPointer=Ae.escapeJsonPointer=Ae.escapeFragment=Ae.unescapeFragment=Ae.schemaRefOrVal=Ae.schemaHasRulesButRef=Ae.schemaHasRules=Ae.checkUnknownRules=Ae.alwaysValidSchema=Ae.toHash=void 0;const e=De(),n=gc();function i(x){const _={};for(const T of x)_[T]=!0;return _}Ae.toHash=i;function s(x,_){return typeof _=="boolean"?_:Object.keys(_).length===0?!0:(c(x,_),!u(_,x.self.RULES.all))}Ae.alwaysValidSchema=s;function c(x,_=x.schema){const{opts:T,self:A}=x;if(!T.strictSchema||typeof _=="boolean")return;const I=A.RULES.keywords;for(const P in _)I[P]||R(x,`unknown keyword: "${P}"`)}Ae.checkUnknownRules=c;function u(x,_){if(typeof x=="boolean")return!x;for(const T in x)if(_[T])return!0;return!1}Ae.schemaHasRules=u;function d(x,_){if(typeof x=="boolean")return!x;for(const T in x)if(T!=="$ref"&&_.all[T])return!0;return!1}Ae.schemaHasRulesButRef=d;function p({topSchemaRef:x,schemaPath:_},T,A,I){if(!I){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,e._)`${T}`}return(0,e._)`${x}${_}${(0,e.getProperty)(A)}`}Ae.schemaRefOrVal=p;function g(x){return v(decodeURIComponent(x))}Ae.unescapeFragment=g;function h(x){return encodeURIComponent(y(x))}Ae.escapeFragment=h;function y(x){return typeof x=="number"?`${x}`:x.replace(/~/g,"~0").replace(/\//g,"~1")}Ae.escapeJsonPointer=y;function v(x){return x.replace(/~1/g,"/").replace(/~0/g,"~")}Ae.unescapeJsonPointer=v;function j(x,_){if(Array.isArray(x))for(const T of x)_(T);else _(x)}Ae.eachItem=j;function k({mergeNames:x,mergeToName:_,mergeValues:T,resultToName:A}){return(I,P,H,J)=>{const re=H===void 0?P:H instanceof e.Name?(P instanceof e.Name?x(I,P,H):_(I,P,H),H):P instanceof e.Name?(_(I,H,P),P):T(P,H);return J===e.Name&&!(re instanceof e.Name)?A(I,re):re}}Ae.mergeEvaluated={props:k({mergeNames:(x,_,T)=>x.if((0,e._)`${T} !== true && ${_} !== undefined`,()=>{x.if((0,e._)`${_} === true`,()=>x.assign(T,!0),()=>x.assign(T,(0,e._)`${T} || {}`).code((0,e._)`Object.assign(${T}, ${_})`))}),mergeToName:(x,_,T)=>x.if((0,e._)`${T} !== true`,()=>{_===!0?x.assign(T,!0):(x.assign(T,(0,e._)`${T} || {}`),C(x,T,_))}),mergeValues:(x,_)=>x===!0?!0:{...x,..._},resultToName:b}),items:k({mergeNames:(x,_,T)=>x.if((0,e._)`${T} !== true && ${_} !== undefined`,()=>x.assign(T,(0,e._)`${_} === true ? true : ${T} > ${_} ? ${T} : ${_}`)),mergeToName:(x,_,T)=>x.if((0,e._)`${T} !== true`,()=>x.assign(T,_===!0?!0:(0,e._)`${T} > ${_} ? ${T} : ${_}`)),mergeValues:(x,_)=>x===!0?!0:Math.max(x,_),resultToName:(x,_)=>x.var("items",_)})};function b(x,_){if(_===!0)return x.var("props",!0);const T=x.var("props",(0,e._)`{}`);return _!==void 0&&C(x,T,_),T}Ae.evaluatedPropsToName=b;function C(x,_,T){Object.keys(T).forEach(A=>x.assign((0,e._)`${_}${(0,e.getProperty)(A)}`,!0))}Ae.setEvaluated=C;const z={};function N(x,_){return x.scopeValue("func",{ref:_,code:z[_.code]||(z[_.code]=new n._Code(_.code))})}Ae.useFunc=N;var $;(function(x){x[x.Num=0]="Num",x[x.Str=1]="Str"})($||(Ae.Type=$={}));function w(x,_,T){if(x instanceof e.Name){const A=_===$.Num;return T?A?(0,e._)`"[" + ${x} + "]"`:(0,e._)`"['" + ${x} + "']"`:A?(0,e._)`"/" + ${x}`:(0,e._)`"/" + ${x}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,e.getProperty)(x).toString():"/"+y(x)}Ae.getErrorPath=w;function R(x,_,T=x.opts.strictSchema){if(T){if(_=`strict mode: ${_}`,T===!0)throw new Error(_);x.self.logger.warn(_)}}return Ae.checkStrictMode=R,Ae}var _l={},Eh;function mr(){if(Eh)return _l;Eh=1,Object.defineProperty(_l,"__esModule",{value:!0});const e=De(),n={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return _l.default=n,_l}var Th;function Sc(){return Th||(Th=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const n=De(),i=qe(),s=mr();e.keywordError={message:({keyword:z})=>(0,n.str)`must pass "${z}" keyword validation`},e.keyword$DataError={message:({keyword:z,schemaType:N})=>N?(0,n.str)`"${z}" keyword must be ${N} ($data)`:(0,n.str)`"${z}" keyword is invalid ($data)`};function c(z,N=e.keywordError,$,w){const{it:R}=z,{gen:x,compositeRule:_,allErrors:T}=R,A=v(z,N,$);w??(_||T)?g(x,A):h(R,(0,n._)`[${A}]`)}e.reportError=c;function u(z,N=e.keywordError,$){const{it:w}=z,{gen:R,compositeRule:x,allErrors:_}=w,T=v(z,N,$);g(R,T),x||_||h(w,s.default.vErrors)}e.reportExtraError=u;function d(z,N){z.assign(s.default.errors,N),z.if((0,n._)`${s.default.vErrors} !== null`,()=>z.if(N,()=>z.assign((0,n._)`${s.default.vErrors}.length`,N),()=>z.assign(s.default.vErrors,null)))}e.resetErrorsCount=d;function p({gen:z,keyword:N,schemaValue:$,data:w,errsCount:R,it:x}){if(R===void 0)throw new Error("ajv implementation error");const _=z.name("err");z.forRange("i",R,s.default.errors,T=>{z.const(_,(0,n._)`${s.default.vErrors}[${T}]`),z.if((0,n._)`${_}.instancePath === undefined`,()=>z.assign((0,n._)`${_}.instancePath`,(0,n.strConcat)(s.default.instancePath,x.errorPath))),z.assign((0,n._)`${_}.schemaPath`,(0,n.str)`${x.errSchemaPath}/${N}`),x.opts.verbose&&(z.assign((0,n._)`${_}.schema`,$),z.assign((0,n._)`${_}.data`,w))})}e.extendErrors=p;function g(z,N){const $=z.const("err",N);z.if((0,n._)`${s.default.vErrors} === null`,()=>z.assign(s.default.vErrors,(0,n._)`[${$}]`),(0,n._)`${s.default.vErrors}.push(${$})`),z.code((0,n._)`${s.default.errors}++`)}function h(z,N){const{gen:$,validateName:w,schemaEnv:R}=z;R.$async?$.throw((0,n._)`new ${z.ValidationError}(${N})`):($.assign((0,n._)`${w}.errors`,N),$.return(!1))}const y={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function v(z,N,$){const{createErrors:w}=z.it;return w===!1?(0,n._)`{}`:j(z,N,$)}function j(z,N,$={}){const{gen:w,it:R}=z,x=[k(R,$),b(z,$)];return C(z,N,x),w.object(...x)}function k({errorPath:z},{instancePath:N}){const $=N?(0,n.str)`${z}${(0,i.getErrorPath)(N,i.Type.Str)}`:z;return[s.default.instancePath,(0,n.strConcat)(s.default.instancePath,$)]}function b({keyword:z,it:{errSchemaPath:N}},{schemaPath:$,parentSchema:w}){let R=w?N:(0,n.str)`${N}/${z}`;return $&&(R=(0,n.str)`${R}${(0,i.getErrorPath)($,i.Type.Str)}`),[y.schemaPath,R]}function C(z,{params:N,message:$},w){const{keyword:R,data:x,schemaValue:_,it:T}=z,{opts:A,propertyName:I,topSchemaRef:P,schemaPath:H}=T;w.push([y.keyword,R],[y.params,typeof N=="function"?N(z):N||(0,n._)`{}`]),A.messages&&w.push([y.message,typeof $=="function"?$(z):$]),A.verbose&&w.push([y.schema,_],[y.parentSchema,(0,n._)`${P}${H}`],[s.default.data,x]),I&&w.push([y.propertyName,I])}})(Qd)),Qd}var Mh;function c3(){if(Mh)return Lr;Mh=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.boolOrEmptySchema=Lr.topBoolOrEmptySchema=void 0;const e=Sc(),n=De(),i=mr(),s={message:"boolean schema is false"};function c(p){const{gen:g,schema:h,validateName:y}=p;h===!1?d(p,!1):typeof h=="object"&&h.$async===!0?g.return(i.default.data):(g.assign((0,n._)`${y}.errors`,null),g.return(!0))}Lr.topBoolOrEmptySchema=c;function u(p,g){const{gen:h,schema:y}=p;y===!1?(h.var(g,!1),d(p)):h.var(g,!0)}Lr.boolOrEmptySchema=u;function d(p,g){const{gen:h,data:y}=p,v={gen:h,keyword:"false schema",data:y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:p};(0,e.reportError)(v,s,void 0,g)}return Lr}var Ut={},Vr={},Rh;function h1(){if(Rh)return Vr;Rh=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.getRules=Vr.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],n=new Set(e);function i(c){return typeof c=="string"&&n.has(c)}Vr.isJSONType=i;function s(){const c={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...c,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},c.number,c.string,c.array,c.object],post:{rules:[]},all:{},keywords:{}}}return Vr.getRules=s,Vr}var fn={},Oh;function y1(){if(Oh)return fn;Oh=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.shouldUseRule=fn.shouldUseGroup=fn.schemaHasRulesForType=void 0;function e({schema:s,self:c},u){const d=c.RULES.types[u];return d&&d!==!0&&n(s,d)}fn.schemaHasRulesForType=e;function n(s,c){return c.rules.some(u=>i(s,u))}fn.shouldUseGroup=n;function i(s,c){var u;return s[c.keyword]!==void 0||((u=c.definition.implements)===null||u===void 0?void 0:u.some(d=>s[d]!==void 0))}return fn.shouldUseRule=i,fn}var Ah;function mc(){if(Ah)return Ut;Ah=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.reportTypeError=Ut.checkDataTypes=Ut.checkDataType=Ut.coerceAndCheckDataType=Ut.getJSONTypes=Ut.getSchemaTypes=Ut.DataType=void 0;const e=h1(),n=y1(),i=Sc(),s=De(),c=qe();var u;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(u||(Ut.DataType=u={}));function d($){const w=p($.type);if(w.includes("null")){if($.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!w.length&&$.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');$.nullable===!0&&w.push("null")}return w}Ut.getSchemaTypes=d;function p($){const w=Array.isArray($)?$:$?[$]:[];if(w.every(e.isJSONType))return w;throw new Error("type must be JSONType or JSONType[]: "+w.join(","))}Ut.getJSONTypes=p;function g($,w){const{gen:R,data:x,opts:_}=$,T=y(w,_.coerceTypes),A=w.length>0&&!(T.length===0&&w.length===1&&(0,n.schemaHasRulesForType)($,w[0]));if(A){const I=b(w,x,_.strictNumbers,u.Wrong);R.if(I,()=>{T.length?v($,w,T):z($)})}return A}Ut.coerceAndCheckDataType=g;const h=new Set(["string","number","integer","boolean","null"]);function y($,w){return w?$.filter(R=>h.has(R)||w==="array"&&R==="array"):[]}function v($,w,R){const{gen:x,data:_,opts:T}=$,A=x.let("dataType",(0,s._)`typeof ${_}`),I=x.let("coerced",(0,s._)`undefined`);T.coerceTypes==="array"&&x.if((0,s._)`${A} == 'object' && Array.isArray(${_}) && ${_}.length == 1`,()=>x.assign(_,(0,s._)`${_}[0]`).assign(A,(0,s._)`typeof ${_}`).if(b(w,_,T.strictNumbers),()=>x.assign(I,_))),x.if((0,s._)`${I} !== undefined`);for(const H of R)(h.has(H)||H==="array"&&T.coerceTypes==="array")&&P(H);x.else(),z($),x.endIf(),x.if((0,s._)`${I} !== undefined`,()=>{x.assign(_,I),j($,I)});function P(H){switch(H){case"string":x.elseIf((0,s._)`${A} == "number" || ${A} == "boolean"`).assign(I,(0,s._)`"" + ${_}`).elseIf((0,s._)`${_} === null`).assign(I,(0,s._)`""`);return;case"number":x.elseIf((0,s._)`${A} == "boolean" || ${_} === null
|
|
89
89
|
|| (${A} == "string" && ${_} && ${_} == +${_})`).assign(I,(0,s._)`+${_}`);return;case"integer":x.elseIf((0,s._)`${A} === "boolean" || ${_} === null
|
|
90
90
|
|| (${A} === "string" && ${_} && ${_} == +${_} && !(${_} % 1))`).assign(I,(0,s._)`+${_}`);return;case"boolean":x.elseIf((0,s._)`${_} === "false" || ${_} === 0 || ${_} === null`).assign(I,!1).elseIf((0,s._)`${_} === "true" || ${_} === 1`).assign(I,!0);return;case"null":x.elseIf((0,s._)`${_} === "" || ${_} === 0 || ${_} === false`),x.assign(I,null);return;case"array":x.elseIf((0,s._)`${A} === "string" || ${A} === "number"
|
|
@@ -162,7 +162,7 @@ ${s.cssKeyframes}
|
|
|
162
162
|
grid-template-columns: 1fr !important;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
`})]})}function c9({feature:e}){return r.jsxs("div",{style:{padding:"var(--ggui-spacing-6, 24px)",borderRadius:"var(--ggui-shape-radius-xl, 16px)",backgroundColor:"var(--ggui-color-surface, #ffffff)",border:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)",transition:"box-shadow 0.2s ease, transform 0.2s ease",cursor:"default"},onMouseEnter:n=>{n.currentTarget.style.boxShadow="var(--ggui-shape-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1))",n.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:n=>{n.currentTarget.style.boxShadow="none",n.currentTarget.style.transform="translateY(0)"},children:[e.icon&&r.jsx("div",{style:{fontSize:"32px",marginBottom:"var(--ggui-spacing-4, 16px)",lineHeight:1},children:e.icon}),r.jsx("h3",{style:{fontSize:"var(--ggui-font-size-xl, 20px)",fontWeight:"var(--ggui-font-weight-semibold, 600)",lineHeight:1.3,color:"var(--ggui-color-onSurface, #18181b)",margin:"0 0 8px 0"},children:e.title}),r.jsx("p",{style:{fontSize:"var(--ggui-font-size-base, 16px)",lineHeight:1.6,color:"var(--ggui-color-onSurfaceVariant, #52525b)",margin:0},children:e.description})]})}function u9({headline:e,description:n,action:i,variant:s="filled",style:c,className:u}){const d=s==="filled";return r.jsx("section",{className:u,style:{backgroundColor:d?"var(--ggui-color-primary-600, #0284c7)":"var(--ggui-color-surface, #ffffff)",...d?{}:{borderTop:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)",borderBottom:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)"},...c},children:r.jsxs("div",{style:{maxWidth:"800px",margin:"0 auto",padding:"80px 24px",textAlign:"center"},children:[r.jsx("h2",{style:{fontSize:"var(--ggui-font-size-3xl, 30px)",fontWeight:"var(--ggui-font-weight-bold, 700)",lineHeight:1.2,color:d?"#ffffff":"var(--ggui-color-onSurface, #18181b)",margin:"0 0 16px 0"},children:e}),n&&r.jsx("p",{style:{fontSize:"var(--ggui-font-size-lg, 18px)",lineHeight:1.6,color:d?"rgba(255, 255, 255, 0.85)":"var(--ggui-color-onSurfaceVariant, #52525b)",margin:"0 0 32px 0",maxWidth:"560px",marginLeft:"auto",marginRight:"auto"},children:n}),r.jsx(d9,{action:i,filled:d})]})})}function d9({action:e,filled:n}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"14px 36px",fontSize:"var(--ggui-font-size-lg, 18px)",fontWeight:600,borderRadius:"var(--ggui-shape-radius-lg, 12px)",cursor:"pointer",transition:"all 0.2s ease",textDecoration:"none",border:"none",lineHeight:"1.5",...n?{backgroundColor:"#ffffff",color:"var(--ggui-color-primary-700, #0369a1)"}:{backgroundColor:"var(--ggui-color-primary-600, #0284c7)",color:"#ffffff"}};return e.href?r.jsx("a",{href:e.href,onClick:e.onClick,style:i,role:"button",children:e.label}):r.jsx("button",{type:"button",onClick:e.onClick,style:i,children:e.label})}var Ef={};Ec(Ef,{Clickable:()=>f9,Hoverable:()=>p9,Pressable:()=>g9});var f9=O.forwardRef(function({children:n,onClick:i,onDoubleClick:s,hoverStyle:c,activeStyle:u,cursor:d,transition:p="all 200ms ease",disabled:g=!1,role:h,"aria-label":y,tabIndex:v,style:j,className:k,...b},C){const[z,N]=O.useState(!1),[$,w]=O.useState(!1),R=!!i,x=g?"not-allowed":d??(R?"pointer":void 0),_=h??(R?"button":void 0),T=v??(R?0:void 0),A=P=>{g||!i||(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),i(P))},I={...j,cursor:x,transition:p,opacity:g?.5:void 0,...z&&!g?c:{},...$&&!g?u:{}};return r.jsx("div",{ref:C,className:k,style:I,onClick:g?void 0:i,onDoubleClick:g?void 0:s,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),w(!1)},onMouseDown:()=>w(!0),onMouseUp:()=>w(!1),onKeyDown:A,role:_,"aria-label":y,"aria-disabled":g||void 0,tabIndex:T,...b,children:n})}),p9=O.forwardRef(function({children:n,hoverStyle:i,onHoverChange:s,transition:c="all 200ms ease",style:u,className:d,...p},g){const[h,y]=O.useState(!1),v={...u,transition:c,...h?i:{}};return r.jsx("div",{ref:g,className:d,style:v,onMouseEnter:()=>{y(!0),s==null||s(!0)},onMouseLeave:()=>{y(!1),s==null||s(!1)},...p,children:n})}),g9=O.forwardRef(function({children:n,onPress:i,onLongPress:s,longPressDelay:c=500,hoverStyle:u,pressStyle:d,disabled:p=!1,transition:g="all 150ms ease",role:h,"aria-label":y,tabIndex:v,style:j,className:k,...b},C){const[z,N]=O.useState(!1),[$,w]=O.useState(!1),[R,x]=O.useState(null),_=!!i||!!s,T=J=>{if(!p&&(w(!0),s)){const re=setTimeout(()=>{s(J)},c);x(re)}},A=J=>{p||(w(!1),R?(clearTimeout(R),x(null),i==null||i(J)):s||i==null||i(J))},I=J=>{p||!i||(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),i(J))},P={...j,cursor:p?"not-allowed":_?"pointer":void 0,transition:g,opacity:p?.5:void 0,userSelect:_?"none":void 0,...z&&!p?u:{},...$&&!p?d:{}},H=typeof n=="function"?n({pressed:$,hovered:z}):n;return r.jsx("div",{ref:C,className:k,style:P,onMouseDown:T,onMouseUp:A,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),w(!1),R&&clearTimeout(R)},onKeyDown:I,role:h??(_?"button":void 0),"aria-label":y,"aria-disabled":p||void 0,tabIndex:v??(_?0:void 0),...b,children:H})});function m9(e){const n=e.split(";"),i=[],s=[];for(const c of n)c.trimStart().startsWith("import")?i.push(c):s.push(c);return i.length===0?e:i.join(";")+";"+s.join(";")}async function h9(e){const n=new Blob([e],{type:"application/javascript"}),i=URL.createObjectURL(n);try{return await import(i)}finally{URL.revokeObjectURL(i)}}var y9=0;function v9(e){return`ggui-rcr-${e.replace(/[^a-z0-9]/gi,"")}`}var $9=1,b9=500,x9=class extends Ai.Component{constructor(){super(...arguments);Bn(this,"state",{error:null,catchCount:0,autoRetrying:!1,repairRequested:!1});Bn(this,"retryTimer",null)}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n){var s,c;const i=this.state.catchCount+1;this.setState({catchCount:i}),i<=$9?(this.setState({autoRetrying:!0}),this.retryTimer=setTimeout(()=>{this.setState({error:null,autoRetrying:!1})},b9)):((c=(s=this.props).onError)==null||c.call(s,n),this.props.onRequestRepair&&!this.state.repairRequested&&(this.setState({repairRequested:!0}),this.props.onRequestRepair(n)))}componentWillUnmount(){this.retryTimer&&clearTimeout(this.retryTimer)}render(){const{error:n,autoRetrying:i,repairRequested:s,catchCount:c}=this.state;return n?i?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,minHeight:80,gap:8,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:13,color:"rgba(255,255,255,0.4)"},children:[r.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(255,255,255,0.15)",borderTopColor:"rgba(255,255,255,0.5)",borderRadius:"50%",animation:"ggui-err-spin 0.6s linear infinite"}}),"Retrying...",r.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):s?r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:10,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(139,92,246,0.2)",borderTopColor:"rgba(139,92,246,0.7)",borderRadius:"50%",animation:"ggui-err-spin 0.8s linear infinite"}}),r.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.5)"},children:"Repairing component..."}),r.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),r.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Something went wrong"}),r.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:"This component encountered an error. Try asking for a different view."}),r.jsx("button",{onClick:()=>this.setState({error:null,catchCount:0,repairRequested:!1}),style:{marginTop:4,padding:"8px 20px",borderRadius:8,border:"1px solid rgba(255,255,255,0.15)",background:"rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.7)",fontSize:13,fontWeight:500,cursor:"pointer"},children:"Retry"}),c>1&&r.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:n.message})]}):this.props.children}};function j9({code:e,props:n={},themeId:i,cssOverrides:s,fallback:c=r.jsx("div",{children:"Loading component..."}),onError:u,onRequestRepair:d}){const p=O.useId(),[g]=O.useState(()=>v9(p)||`ggui-rcr-${++y9}`),[h,y]=O.useState(null),[v,j]=O.useState(null),[k,b]=O.useState(!0);O.useEffect(()=>{if(!e||e.trim().length===0){y(null),b(!1);return}let z=!1;b(!0),j(null),y(null);async function N(){try{let $=e;if(e.startsWith("https://")){const P=await fetch(e);if(!P.ok)throw new Error(`Failed to fetch component code: ${P.status}`);$=await P.text()}const w=Gw($),R=globalThis;let x={};try{x=await bx(()=>import("./index-DryGuv0A.js").then(P=>P.i),[])}catch{}R.__ggui__={react:Ai,reactDom:x,primitives:kf,components:zf,compositions:Cf,interact:Ef,wire:nk},R.__REACT=Ai,R.__GGUI_PRIMITIVES=kf,R.__GGUI_COMPONENTS=zf,R.__GGUI_COMPOSITIONS=Cf,R.__GGUI_INTERACT=Ef;const _=m9(w),T=V6(_,{mode:"data-url"}),A=await h9(T);if(z)return;const I=A.default??Object.values(A).find(P=>typeof P=="function");if(!I)throw new Error("Module does not export a default component");y(()=>I),j(null)}catch($){if(z)return;const w=$ instanceof Error?$:new Error(String($));j(w),y(null),u==null||u(w)}finally{z||b(!1)}}return N(),()=>{z=!0}},[e]);const C=i?Xf(i,g):w6(g);return!e||e.trim().length===0?r.jsx("div",{children:c}):k?r.jsx("div",{children:c}):v?r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),r.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Failed to load component"}),r.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:v.message})]}):h?r.jsxs("div",{className:g,children:[r.jsxs("style",{children:[C,s??""]}),r.jsx(x9,{onError:u,onRequestRepair:d,children:r.jsx(h,{...n})},e.length)]}):r.jsx("div",{children:c})}var sv="ggui-preview-keyframes",_9=`@keyframes ggui-preview-shimmer {
|
|
165
|
+
`})]})}function c9({feature:e}){return r.jsxs("div",{style:{padding:"var(--ggui-spacing-6, 24px)",borderRadius:"var(--ggui-shape-radius-xl, 16px)",backgroundColor:"var(--ggui-color-surface, #ffffff)",border:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)",transition:"box-shadow 0.2s ease, transform 0.2s ease",cursor:"default"},onMouseEnter:n=>{n.currentTarget.style.boxShadow="var(--ggui-shape-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1))",n.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:n=>{n.currentTarget.style.boxShadow="none",n.currentTarget.style.transform="translateY(0)"},children:[e.icon&&r.jsx("div",{style:{fontSize:"32px",marginBottom:"var(--ggui-spacing-4, 16px)",lineHeight:1},children:e.icon}),r.jsx("h3",{style:{fontSize:"var(--ggui-font-size-xl, 20px)",fontWeight:"var(--ggui-font-weight-semibold, 600)",lineHeight:1.3,color:"var(--ggui-color-onSurface, #18181b)",margin:"0 0 8px 0"},children:e.title}),r.jsx("p",{style:{fontSize:"var(--ggui-font-size-base, 16px)",lineHeight:1.6,color:"var(--ggui-color-onSurfaceVariant, #52525b)",margin:0},children:e.description})]})}function u9({headline:e,description:n,action:i,variant:s="filled",style:c,className:u}){const d=s==="filled";return r.jsx("section",{className:u,style:{backgroundColor:d?"var(--ggui-color-primary-600, #0284c7)":"var(--ggui-color-surface, #ffffff)",...d?{}:{borderTop:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)",borderBottom:"1px solid var(--ggui-color-outlineVariant, #e4e4e7)"},...c},children:r.jsxs("div",{style:{maxWidth:"800px",margin:"0 auto",padding:"80px 24px",textAlign:"center"},children:[r.jsx("h2",{style:{fontSize:"var(--ggui-font-size-3xl, 30px)",fontWeight:"var(--ggui-font-weight-bold, 700)",lineHeight:1.2,color:d?"#ffffff":"var(--ggui-color-onSurface, #18181b)",margin:"0 0 16px 0"},children:e}),n&&r.jsx("p",{style:{fontSize:"var(--ggui-font-size-lg, 18px)",lineHeight:1.6,color:d?"rgba(255, 255, 255, 0.85)":"var(--ggui-color-onSurfaceVariant, #52525b)",margin:"0 0 32px 0",maxWidth:"560px",marginLeft:"auto",marginRight:"auto"},children:n}),r.jsx(d9,{action:i,filled:d})]})})}function d9({action:e,filled:n}){const i={display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"14px 36px",fontSize:"var(--ggui-font-size-lg, 18px)",fontWeight:600,borderRadius:"var(--ggui-shape-radius-lg, 12px)",cursor:"pointer",transition:"all 0.2s ease",textDecoration:"none",border:"none",lineHeight:"1.5",...n?{backgroundColor:"#ffffff",color:"var(--ggui-color-primary-700, #0369a1)"}:{backgroundColor:"var(--ggui-color-primary-600, #0284c7)",color:"#ffffff"}};return e.href?r.jsx("a",{href:e.href,onClick:e.onClick,style:i,role:"button",children:e.label}):r.jsx("button",{type:"button",onClick:e.onClick,style:i,children:e.label})}var Ef={};Ec(Ef,{Clickable:()=>f9,Hoverable:()=>p9,Pressable:()=>g9});var f9=O.forwardRef(function({children:n,onClick:i,onDoubleClick:s,hoverStyle:c,activeStyle:u,cursor:d,transition:p="all 200ms ease",disabled:g=!1,role:h,"aria-label":y,tabIndex:v,style:j,className:k,...b},C){const[z,N]=O.useState(!1),[$,w]=O.useState(!1),R=!!i,x=g?"not-allowed":d??(R?"pointer":void 0),_=h??(R?"button":void 0),T=v??(R?0:void 0),A=P=>{g||!i||(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),i(P))},I={...j,cursor:x,transition:p,opacity:g?.5:void 0,...z&&!g?c:{},...$&&!g?u:{}};return r.jsx("div",{ref:C,className:k,style:I,onClick:g?void 0:i,onDoubleClick:g?void 0:s,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),w(!1)},onMouseDown:()=>w(!0),onMouseUp:()=>w(!1),onKeyDown:A,role:_,"aria-label":y,"aria-disabled":g||void 0,tabIndex:T,...b,children:n})}),p9=O.forwardRef(function({children:n,hoverStyle:i,onHoverChange:s,transition:c="all 200ms ease",style:u,className:d,...p},g){const[h,y]=O.useState(!1),v={...u,transition:c,...h?i:{}};return r.jsx("div",{ref:g,className:d,style:v,onMouseEnter:()=>{y(!0),s==null||s(!0)},onMouseLeave:()=>{y(!1),s==null||s(!1)},...p,children:n})}),g9=O.forwardRef(function({children:n,onPress:i,onLongPress:s,longPressDelay:c=500,hoverStyle:u,pressStyle:d,disabled:p=!1,transition:g="all 150ms ease",role:h,"aria-label":y,tabIndex:v,style:j,className:k,...b},C){const[z,N]=O.useState(!1),[$,w]=O.useState(!1),[R,x]=O.useState(null),_=!!i||!!s,T=J=>{if(!p&&(w(!0),s)){const re=setTimeout(()=>{s(J)},c);x(re)}},A=J=>{p||(w(!1),R?(clearTimeout(R),x(null),i==null||i(J)):s||i==null||i(J))},I=J=>{p||!i||(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),i(J))},P={...j,cursor:p?"not-allowed":_?"pointer":void 0,transition:g,opacity:p?.5:void 0,userSelect:_?"none":void 0,...z&&!p?u:{},...$&&!p?d:{}},H=typeof n=="function"?n({pressed:$,hovered:z}):n;return r.jsx("div",{ref:C,className:k,style:P,onMouseDown:T,onMouseUp:A,onMouseEnter:()=>N(!0),onMouseLeave:()=>{N(!1),w(!1),R&&clearTimeout(R)},onKeyDown:I,role:h??(_?"button":void 0),"aria-label":y,"aria-disabled":p||void 0,tabIndex:v??(_?0:void 0),...b,children:H})});function m9(e){const n=e.split(";"),i=[],s=[];for(const c of n)c.trimStart().startsWith("import")?i.push(c):s.push(c);return i.length===0?e:i.join(";")+";"+s.join(";")}async function h9(e){const n=new Blob([e],{type:"application/javascript"}),i=URL.createObjectURL(n);try{return await import(i)}finally{URL.revokeObjectURL(i)}}var y9=0;function v9(e){return`ggui-rcr-${e.replace(/[^a-z0-9]/gi,"")}`}var $9=1,b9=500,x9=class extends Ai.Component{constructor(){super(...arguments);Bn(this,"state",{error:null,catchCount:0,autoRetrying:!1,repairRequested:!1});Bn(this,"retryTimer",null)}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n){var s,c;const i=this.state.catchCount+1;this.setState({catchCount:i}),i<=$9?(this.setState({autoRetrying:!0}),this.retryTimer=setTimeout(()=>{this.setState({error:null,autoRetrying:!1})},b9)):((c=(s=this.props).onError)==null||c.call(s,n),this.props.onRequestRepair&&!this.state.repairRequested&&(this.setState({repairRequested:!0}),this.props.onRequestRepair(n)))}componentWillUnmount(){this.retryTimer&&clearTimeout(this.retryTimer)}render(){const{error:n,autoRetrying:i,repairRequested:s,catchCount:c}=this.state;return n?i?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,minHeight:80,gap:8,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:13,color:"rgba(255,255,255,0.4)"},children:[r.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(255,255,255,0.15)",borderTopColor:"rgba(255,255,255,0.5)",borderRadius:"50%",animation:"ggui-err-spin 0.6s linear infinite"}}),"Retrying...",r.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):s?r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:10,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:16,height:16,border:"2px solid rgba(139,92,246,0.2)",borderTopColor:"rgba(139,92,246,0.7)",borderRadius:"50%",animation:"ggui-err-spin 0.8s linear infinite"}}),r.jsx("div",{style:{fontSize:13,color:"rgba(255,255,255,0.5)"},children:"Repairing component..."}),r.jsx("style",{children:"@keyframes ggui-err-spin { to { transform: rotate(360deg); } }"})]}):r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),r.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Something went wrong"}),r.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:"This component encountered an error. Try asking for a different view."}),r.jsx("button",{onClick:()=>this.setState({error:null,catchCount:0,repairRequested:!1}),style:{marginTop:4,padding:"8px 20px",borderRadius:8,border:"1px solid rgba(255,255,255,0.15)",background:"rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.7)",fontSize:13,fontWeight:500,cursor:"pointer"},children:"Retry"}),c>1&&r.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.2)"},children:n.message})]}):this.props.children}};function j9({code:e,props:n={},themeId:i,cssOverrides:s,fallback:c=r.jsx("div",{children:"Loading component..."}),onError:u,onRequestRepair:d}){const p=O.useId(),[g]=O.useState(()=>v9(p)||`ggui-rcr-${++y9}`),[h,y]=O.useState(null),[v,j]=O.useState(null),[k,b]=O.useState(!0);O.useEffect(()=>{if(!e||e.trim().length===0){y(null),b(!1);return}let z=!1;b(!0),j(null),y(null);async function N(){try{let $=e;if(e.startsWith("https://")){const P=await fetch(e);if(!P.ok)throw new Error(`Failed to fetch component code: ${P.status}`);$=await P.text()}const w=Gw($),R=globalThis;let x={};try{x=await bx(()=>import("./index-D12OtMXA.js").then(P=>P.i),[])}catch{}R.__ggui__={react:Ai,reactDom:x,primitives:kf,components:zf,compositions:Cf,interact:Ef,wire:nk},R.__REACT=Ai,R.__GGUI_PRIMITIVES=kf,R.__GGUI_COMPONENTS=zf,R.__GGUI_COMPOSITIONS=Cf,R.__GGUI_INTERACT=Ef;const _=m9(w),T=V6(_,{mode:"data-url"}),A=await h9(T);if(z)return;const I=A.default??Object.values(A).find(P=>typeof P=="function");if(!I)throw new Error("Module does not export a default component");y(()=>I),j(null)}catch($){if(z)return;const w=$ instanceof Error?$:new Error(String($));j(w),y(null),u==null||u(w)}finally{z||b(!1)}}return N(),()=>{z=!0}},[e]);const C=i?Xf(i,g):w6(g);return!e||e.trim().length===0?r.jsx("div",{children:c}):k?r.jsx("div",{children:c}):v?r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 24px",minHeight:120,gap:12,textAlign:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[r.jsx("div",{style:{width:48,height:48,borderRadius:14,background:"rgba(239, 68, 68, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22},children:"!"}),r.jsx("div",{style:{fontSize:14,fontWeight:600,color:"rgba(255,255,255,0.8)"},children:"Failed to load component"}),r.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.4)",maxWidth:280,lineHeight:1.4},children:v.message})]}):h?r.jsxs("div",{className:g,children:[r.jsxs("style",{children:[C,s??""]}),r.jsx(x9,{onError:u,onRequestRepair:d,children:r.jsx(h,{...n})},e.length)]}):r.jsx("div",{children:c})}var sv="ggui-preview-keyframes",_9=`@keyframes ggui-preview-shimmer {
|
|
166
166
|
0% { transform: translateX(-100%); }
|
|
167
167
|
100% { transform: translateX(100%); }
|
|
168
168
|
}`,S9=`@keyframes ggui-preview-caret {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as s,r as c}from"./index-
|
|
1
|
+
import{g as s,r as c}from"./index-B5d3Vke1.js";function f(t,a){for(var o=0;o<a.length;o++){const e=a[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const n=Object.getOwnPropertyDescriptor(e,r);n&&Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var i=c();const p=s(i),g=f({__proto__:null,default:p},[i]);export{g as i};
|
package/dist/index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Single-letter mark reads cleanly at 16px tab size.
|
|
21
21
|
-->
|
|
22
22
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath d='M 0 0 H 50 V 25 H 25 V 50 H 0 Z' fill='%23292929'/%3E%3Crect x='33' y='33' width='17' height='17' fill='%23f4f3ed'/%3E%3C/svg%3E" />
|
|
23
|
-
<script type="module" crossorigin src="/assets/index-
|
|
23
|
+
<script type="module" crossorigin src="/assets/index-B5d3Vke1.js"></script>
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-CHgj9yqx.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggui-ai/console",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.3",
|
|
4
4
|
"description": "Operator console for a self-hosted @ggui-ai/mcp-server instance — a single-origin admin and devtools surface served by the server itself.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ggui",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"react": "^19.0.0",
|
|
29
29
|
"react-dom": "^19.0.0",
|
|
30
|
-
"@ggui-ai/
|
|
31
|
-
"@ggui-ai/react": "0.1.0-rc.
|
|
32
|
-
"@ggui-ai/
|
|
30
|
+
"@ggui-ai/design": "0.1.0-rc.3",
|
|
31
|
+
"@ggui-ai/react": "0.1.0-rc.3",
|
|
32
|
+
"@ggui-ai/project-config": "0.1.0-rc.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@testing-library/react": "^16.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
43
|
"vite": "^6.4.2",
|
|
44
44
|
"vitest": "^3.0.0",
|
|
45
|
-
"@ggui-ai/protocol": "0.1.0-rc.
|
|
45
|
+
"@ggui-ai/protocol": "0.1.0-rc.3"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|