@fieldia/viewer 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/fieldia.js CHANGED
@@ -1,47 +1,47 @@
1
- /*! Fieldia 0.1.0 · MIT · https://fieldia.dev */
2
- "use strict";var Fieldia=(()=>{var tr=Object.defineProperty;var Xu=Object.getOwnPropertyDescriptor;var Qu=Object.getOwnPropertyNames;var el=Object.prototype.hasOwnProperty;var tl=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Do=(e,t)=>{for(var r in t)tr(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Qu(t))!el.call(e,o)&&o!==r&&tr(e,o,{get:()=>t[o],enumerable:!(n=Xu(t,o))||n.enumerable});return e};var nl=e=>rl(tr({},"__esModule",{value:!0}),e);var Qe=(e,t,r)=>tl(e,typeof t!="symbol"?t+"":t,r);var Sp={};Do(Sp,{DEFAULT_LABELS:()=>wp,FIELDIA_CSS:()=>Yu,FIELD_NAME:()=>qe,FIELD_TYPES:()=>cu,FORMAT_VERSION:()=>wo,FieldSchema:()=>_o,FieldsSchema:()=>Lr,FilterConditionSchema:()=>yo,LayoutNodeSchema:()=>it,LineFieldSchema:()=>vo,MESSAGES:()=>Ye,ModifierSchema:()=>Wt,OptionSchema:()=>Ir,PageSchema:()=>wt,RootLayoutSchema:()=>Fr,VERSION:()=>$p,VIEWER_LABELS:()=>Mo,WIDGET_LABELS:()=>we,binaryWidget:()=>To,builtInWidgets:()=>qu,checkValue:()=>qt,compileModifier:()=>Ge,createForm:()=>Vr,createMemoryDataSource:()=>ju,createWidget:()=>Xt,emptyValue:()=>So,evaluateModifier:()=>Lu,expressionContext:()=>Kt,fill:()=>Dr,formatBytes:()=>Gt,hostScheduler:()=>Yt,htmlWidget:()=>Lo,imageWidget:()=>Ro,initialValues:()=>kt,installStyles:()=>Co,isEmpty:()=>Mr,isModifierValid:()=>Fu,jsonWidget:()=>Br,linesWidget:()=>Ao,linkCheckboxesWidget:()=>No,many2oneWidget:()=>Oo,mountViewer:()=>zp,pageJsonSchema:()=>Iu,referenceWidget:()=>Zo,sanitizeHtml:()=>Io,summary:()=>Ku,tagsWidget:()=>Ur,validatePage:()=>Cr,wait:()=>jr});var Z={};Do(Z,{BIGINT_FORMAT_RANGES:()=>ir,CONSTANT_CATCH:()=>Go,Class:()=>qr,NUMBER_FORMAT_RANGES:()=>Pt,aborted:()=>xe,allowsEval:()=>tn,assert:()=>ul,assertEqual:()=>ol,assertIs:()=>al,assertNever:()=>cl,assertNotEqual:()=>il,assignProp:()=>ge,attachSchema:()=>ar,base64ToUint8Array:()=>Ko,base64urlToUint8Array:()=>Pl,cached:()=>mt,captureStackTrace:()=>nr,cleanEnum:()=>El,cleanRegex:()=>Et,clone:()=>$e,cloneDef:()=>fl,codePointLength:()=>Ot,constantCatch:()=>Yo,createTransparentProxy:()=>yl,defineLazy:()=>Xr,defineLazyInternal:()=>F,derived:()=>Al,esc:()=>Qr,escapeRegex:()=>Ce,explicitlyAborted:()=>on,extend:()=>_l,finalizeIssue:()=>Ee,floatSafeRemainder:()=>Yr,getElementAtPath:()=>pl,getEnumValues:()=>ft,getLengthableOrigin:()=>Nt,getParsedType:()=>bl,getSizableOrigin:()=>Ho,hexToUint8Array:()=>Nl,hide:()=>cr,installLazyProp:()=>Ll,isObject:()=>tt,isPlainObject:()=>Je,issue:()=>gt,joinValues:()=>rr,jsonStringifyReplacer:()=>pt,members:()=>an,merge:()=>kl,mergeDefs:()=>Fe,normalizeParams:()=>O,nullish:()=>Gr,numKeys:()=>gl,objectClone:()=>ll,omit:()=>vl,optionalKeys:()=>nn,own:()=>Be,parsedType:()=>sn,partial:()=>zl,pick:()=>xl,prefixIssues:()=>Se,primitiveTypes:()=>Jo,promiseAllObject:()=>ml,propertyKeyTypes:()=>rn,randomString:()=>hl,rawShape:()=>ht,required:()=>$l,safeExtend:()=>wl,shallowClone:()=>Bo,slugify:()=>en,stringifyPrimitive:()=>or,toZod:()=>sl,uint8ArrayToBase64:()=>qo,uint8ArrayToBase64url:()=>Ol,uint8ArrayToHex:()=>Zl,unwrapMessage:()=>dt});function ol(e){return e}function il(e){return e}function sl(){return e=>e}function al(e){}function cl(e){throw new Error("Unexpected value in exhaustive check")}function ul(e){}function ft(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function rr(e,t="|"){return e.map(r=>or(r)).join(t)}function pt(e,t){return typeof t=="bigint"?t.toString():t}var Kr=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function mt(e){return new Kr(e)}function Gr(e){return e==null}function Et(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Yr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var jo=Symbol("evaluating");function Xr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jo)return n===void 0&&(n=jo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ll(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ht(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Le(e){return ht(e._zod.def)??e._zod.def.shape}function Vo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ge(this,t,n),n},enumerable:!0,configurable:!0})}function Uo(e,t,r){t in e?ge(e,t,r):e[t]=r}function et(e,t,r,n){let o=Le(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Vo(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Uo(e,i,n?n(s.value,i):s.value))}}function dl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Vo(e,r,()=>t[r]):Uo(e,r,n.value))}}function Fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fl(e){return Fe(e._zod.def)}function pl(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function ml(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function hl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Qr(e){return JSON.stringify(e)}function en(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var tn=mt(()=>{if(pe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Je(e){if(tt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(tt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Bo(e){return Je(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function gl(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var bl=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},rn=new Set(["string","number","symbol"]),Jo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function O(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function yl(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function or(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function nn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Pt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ir={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return et(i,e,sr(e,t)),$e(e,Fe(r,{shape:i,checks:[]}))}function sr(e,t){let r=Le(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function vl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(sr(e,t)),s={};return et(s,e,Reflect.ownKeys(Le(e)).filter(a=>!i.has(a))),$e(e,Fe(r,{shape:s,checks:[]}))}function _l(e,t){if(!Je(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Le(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $e(e,Fe(e._zod.def,{shape:Wo(e,t)}))}function Wo(e,t){let r={};return et(r,e,Reflect.ownKeys(Le(e))),dl(r,t),r}function wl(e,t){if(!Je(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $e(e,Fe(e._zod.def,{shape:Wo(e,t)}))}function kl(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};et(r,e,Reflect.ownKeys(Le(e))),et(r,t,Reflect.ownKeys(Le(t)));let n=Fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return $e(e,n)}function zl(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(sr(t,r)):void 0,c={};return et(c,t,Reflect.ownKeys(Le(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),$e(t,Fe(t._zod.def,{shape:c,checks:[]}))}function $l(e,t,r){let n=r?new Set(sr(t,r)):void 0,o={};return et(o,t,Reflect.ownKeys(Le(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),$e(t,Fe(t._zod.def,{shape:o}))}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function on(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function dt(e){return typeof e=="string"?e:e?.message}function ar(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Ee(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(r.customError?.(e))??dt(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Ho(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Sl=/[\uD800-\uDBFF]/;function Ot(e){let t=e.length;if(!Sl.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Nt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function sn(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function gt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function El(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ko(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function qo(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Pl(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Ko(t+r)}function Ol(e){return qo(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Nl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Zl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var qr=class{constructor(...t){}};function an(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Tl(e,r,n.value)}}function Be(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function cr(e,t,r){return Be(e,t,r,!1)}function Al(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Be(this,r,n(this))},set(o){Be(this,r,o)}})}return t}function Tl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Be(this,t,r.bind(this))},set(n){Be(this,t,n)}})}function Rl(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Hr,Ue=!1,Il={configurable:!0,get(){Ue=!0}};function F(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Hr!==e._zod){Hr=void 0;return}Hr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Il);let o=Ue;Ue=!1;try{let i=r(this);return Ue?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ue=Ue||o,i}catch(i){throw delete this[t],Ue=Ue||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Ll(e,t,r,n){let o=Rl(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Go="~constantCatch";function Yo(e){let t=()=>e;return t[Go]=!0,t}var Xo;var cn={value:void 0,enumerable:!1},Qo="captureStackTrace"in Error?Error:null;function Fl(e){let t=Qo;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Qo=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(m,d){if(m._zod){if(m._zod.traits.has(e))return}else{cn.value=new i(d);try{Object.defineProperty(m,"_zod",cn)}finally{cn.value=void 0}}if(m._zod.traits.add(e),t(m,d),a){let x=Object.getPrototypeOf(m),f=m._zod.constr.prototype,v=x;for(;v&&v!==f;)v=Object.getPrototypeOf(v);let P=v??x;a.has(P)||(a.add(P),an(P,s))}let h=p.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in m||(m[x]=h[x].bind(m)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let d=n?.Parent?Fl(l):this;c(d,m);let h=d._zod.deferred;if(h){for(let f of h)f();d._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(d),d}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>n?.Parent&&m instanceof n.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var Pe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},bt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Xo=globalThis).__zod_globalConfig??(Xo.__zod_globalConfig={});var pe=globalThis.__zod_globalConfig;function ve(e){return e&&Object.assign(pe,e),pe}function Cl(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,pt,2)),e.message}function Ml(e){this._zod.message=e}var Dl={get:Cl,set:Ml,enumerable:!0,configurable:!0},ln={value:void 0,enumerable:!1},ei=new WeakSet([Object.prototype,Error.prototype]),ti=(e,t)=>{e.name="$ZodError",ln.value=t,Object.defineProperty(e,"issues",ln),ln.value=void 0,Object.defineProperty(e,"message",Dl);let r=Object.getPrototypeOf(e);ei.has(r)||(ei.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ri=b("$ZodError",ti),Zp=b("$ZodError",ti,void 0,{Parent:Error});function jl(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function ni(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?jl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function oi(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],p=u===a.length-1;if(l==="_errors"){p&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];p&&m._errors.push(t(s)),c=m,u++}}}};return n(e),r}function ur(e,t){return{callee:t?.callee??e,Err:t?.Err}}var lr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Pe;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw nr(c,i?.callee??t),c}return a.value};return t};var dr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw nr(c,i?.callee??t),c}return a.value};return t};var fr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Pe;return i.issues.length?ii(e,i.issues,o):{success:!0,data:i.value}};function ii(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Ee(o,r,ve()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var pr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?ii(e,i.issues,o):{success:!0,data:i.value}};var Vl=Symbol.for("zod.compile.invalid"),Ul=Symbol.for("zod.compile.fallback"),dn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Vl)return!0;if(n.definite===!0&&r===void 0)return!1}return Bl(e,t,r)});function Bl(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Ul]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Pe;return i.issues.length===0}var fn=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},si=e=>{let t=lr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,ur(r,s))};return r};var ai=e=>{let t=lr(e),r=(n,o,i,s)=>t(n,o,i,ur(r,s));return r};var ci=e=>{let t=dr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,ur(r,s))};return r};var ui=e=>{let t=dr(e),r=async(n,o,i,s)=>await t(n,o,i,ur(r,s));return r};var li=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return fr(e)(t,r,o)};var di=e=>(t,r,n)=>fr(e)(t,r,n);var fi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return pr(e)(t,r,o)};var pi=e=>async(t,r,n)=>pr(e)(t,r,n);var mi=/^[cC][0-9a-z]{6,}$/,hi=/^[0-9a-z]+$/,gi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bi=/^[0-9a-vA-V]{20}$/,yi=/^[A-Za-z0-9]{27}$/,xi=/^[a-zA-Z0-9_-]{21}$/;function vi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _i=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var ki=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Jl="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zi(){return new RegExp(Jl,"u")}var $i=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Si=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Ei=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Pi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Oi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ni=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Zi=/^https?$/,Ai=/^\+[1-9]\d{6,14}$/;var Ti="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Wl(e){return new RegExp(`^${e}$`)}var Ri=Wl(Ti);function pn(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ii(e){return new RegExp(`^${pn(e)}$`)}function Li(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${pn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${pn({precision:e.precision})}`:r;return new RegExp(`^${Ti}T(?:${n})$`)}var Fi=/^[\s\S]{0,}$/;var hn=/^-?\d+$/,Zt=/^-?\d+(?:\.\d+)?$/,Ci=/^(?:true|false)$/i,Mi=/^null$/i;var Di=/^[^A-Z]*$/,ji=/^[^a-z]*$/;var le=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var gn=e=>{let t=e.value;return!Gr(t)&&t.length!==void 0},mr={number:"number",bigint:"bigint",object:"date"},bn=b("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=mr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:mr[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yn=b("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);let r=mr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:mr[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vi=b("$ZodCheckMultipleOf",(e,t)=>{le.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Yr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ui=b("$ZodCheckNumberFormat",(e,t)=>{le.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Pt[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Bi=b("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ot(o):i)<=t.maximum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ji=b("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ot(o):i)>=t.minimum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wi=b("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ot(o):i;if(s===t.length)return;let a=Nt(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tt=b("$ZodCheckStringFormat",(e,t)=>{var r,n;le.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Hi=b("$ZodCheckRegex",(e,t)=>{Tt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ki=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Di),Tt.init(e,t)}),qi=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ji),Tt.init(e,t)}),Gi=b("$ZodCheckIncludes",(e,t)=>{le.init(e,t);let r=Ce(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Yi=b("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`^${Ce(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Xi=b("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`.*${Ce(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Qi=b("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var hr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
1
+ /*! Fieldia 0.2.0 · MIT · https://fieldia.dev */
2
+ "use strict";var Fieldia=(()=>{var rr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var el=Object.getOwnPropertyNames;var tl=Object.prototype.hasOwnProperty;var rl=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var jo=(e,t)=>{for(var r in t)rr(e,r,{get:t[r],enumerable:!0})},nl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of el(t))!tl.call(e,o)&&o!==r&&rr(e,o,{get:()=>t[o],enumerable:!(n=Qu(t,o))||n.enumerable});return e};var ol=e=>nl(rr({},"__esModule",{value:!0}),e);var ot=(e,t,r)=>rl(e,typeof t!="symbol"?t+"":t,r);var Ep={};jo(Ep,{DEFAULT_LABELS:()=>kp,FIELDIA_CSS:()=>Xu,FIELD_NAME:()=>Ye,FIELD_TYPES:()=>uu,FORMAT_VERSION:()=>ko,FieldSchema:()=>wo,FieldsSchema:()=>Fr,FilterConditionSchema:()=>xo,LayoutNodeSchema:()=>lt,LineFieldSchema:()=>_o,MESSAGES:()=>Qe,ModifierSchema:()=>Wt,OptionSchema:()=>Lr,PageSchema:()=>zt,RootLayoutSchema:()=>Cr,VERSION:()=>Sp,VIEWER_LABELS:()=>Do,WIDGET_LABELS:()=>we,binaryWidget:()=>Ro,builtInWidgets:()=>Gu,checkValue:()=>qt,compileModifier:()=>Xe,createForm:()=>Ur,createMemoryDataSource:()=>Vu,createWidget:()=>Xt,emptyValue:()=>Eo,evaluateModifier:()=>Fu,expressionContext:()=>Kt,fill:()=>jr,formatBytes:()=>Gt,hostScheduler:()=>Yt,htmlWidget:()=>Fo,imageWidget:()=>Io,initialValues:()=>$t,installStyles:()=>Mo,isEmpty:()=>Dr,isModifierValid:()=>Cu,jsonWidget:()=>Jr,linesWidget:()=>Ao,linkCheckboxesWidget:()=>Zo,many2oneWidget:()=>No,mountViewer:()=>$p,pageJsonSchema:()=>Lu,referenceWidget:()=>To,sanitizeHtml:()=>Lo,summary:()=>qu,tagsWidget:()=>Br,validatePage:()=>Mr,wait:()=>Vr});var A={};jo(A,{BIGINT_FORMAT_RANGES:()=>sr,CONSTANT_CATCH:()=>Yo,Class:()=>Gr,NUMBER_FORMAT_RANGES:()=>Pt,aborted:()=>xe,allowsEval:()=>rn,assert:()=>ll,assertEqual:()=>il,assertIs:()=>cl,assertNever:()=>ul,assertNotEqual:()=>sl,assignProp:()=>ge,attachSchema:()=>cr,base64ToUint8Array:()=>qo,base64urlToUint8Array:()=>Ol,cached:()=>gt,captureStackTrace:()=>or,cleanEnum:()=>Pl,cleanRegex:()=>Et,clone:()=>$e,cloneDef:()=>pl,codePointLength:()=>Ot,constantCatch:()=>Xo,createTransparentProxy:()=>xl,defineLazy:()=>Qr,defineLazyInternal:()=>M,derived:()=>Al,esc:()=>en,escapeRegex:()=>Me,explicitlyAborted:()=>sn,extend:()=>wl,finalizeIssue:()=>Ee,floatSafeRemainder:()=>Xr,getElementAtPath:()=>ml,getEnumValues:()=>mt,getLengthableOrigin:()=>Nt,getParsedType:()=>yl,getSizableOrigin:()=>Ko,hexToUint8Array:()=>Zl,hide:()=>ur,installLazyProp:()=>Fl,isObject:()=>st,isPlainObject:()=>He,issue:()=>yt,joinValues:()=>nr,jsonStringifyReplacer:()=>ht,members:()=>cn,merge:()=>zl,mergeDefs:()=>Ce,normalizeParams:()=>O,nullish:()=>Yr,numKeys:()=>bl,objectClone:()=>dl,omit:()=>_l,optionalKeys:()=>on,own:()=>We,parsedType:()=>an,partial:()=>$l,pick:()=>vl,prefixIssues:()=>Se,primitiveTypes:()=>Wo,promiseAllObject:()=>hl,propertyKeyTypes:()=>nn,randomString:()=>gl,rawShape:()=>bt,required:()=>Sl,safeExtend:()=>kl,shallowClone:()=>Jo,slugify:()=>tn,stringifyPrimitive:()=>ir,toZod:()=>al,uint8ArrayToBase64:()=>Go,uint8ArrayToBase64url:()=>Nl,uint8ArrayToHex:()=>Tl,unwrapMessage:()=>pt});function il(e){return e}function sl(e){return e}function al(){return e=>e}function cl(e){}function ul(e){throw new Error("Unexpected value in exhaustive check")}function ll(e){}function mt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function nr(e,t="|"){return e.map(r=>ir(r)).join(t)}function ht(e,t){return typeof t=="bigint"?t.toString():t}var qr=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function gt(e){return new qr(e)}function Yr(e){return e==null}function Et(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Xr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Vo=Symbol("evaluating");function Qr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Vo)return n===void 0&&(n=Vo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dl(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function bt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Fe(e){return bt(e._zod.def)??e._zod.def.shape}function Uo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ge(this,t,n),n},enumerable:!0,configurable:!0})}function Bo(e,t,r){t in e?ge(e,t,r):e[t]=r}function it(e,t,r,n){let o=Fe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Uo(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Bo(e,i,n?n(s.value,i):s.value))}}function fl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Uo(e,r,()=>t[r]):Bo(e,r,n.value))}}function Ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function pl(e){return Ce(e._zod.def)}function ml(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hl(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function gl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function en(e){return JSON.stringify(e)}function tn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var or="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function st(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var rn=gt(()=>{if(me.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function He(e){if(st(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(st(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jo(e){return He(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function bl(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var yl=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},nn=new Set(["string","number","symbol"]),Wo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function O(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xl(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ir(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function on(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Pt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function vl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return it(i,e,ar(e,t)),$e(e,Ce(r,{shape:i,checks:[]}))}function ar(e,t){let r=Fe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function _l(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ar(e,t)),s={};return it(s,e,Reflect.ownKeys(Fe(e)).filter(a=>!i.has(a))),$e(e,Ce(r,{shape:s,checks:[]}))}function wl(e,t){if(!He(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Fe(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $e(e,Ce(e._zod.def,{shape:Ho(e,t)}))}function Ho(e,t){let r={};return it(r,e,Reflect.ownKeys(Fe(e))),fl(r,t),r}function kl(e,t){if(!He(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $e(e,Ce(e._zod.def,{shape:Ho(e,t)}))}function zl(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};it(r,e,Reflect.ownKeys(Fe(e))),it(r,t,Reflect.ownKeys(Fe(t)));let n=Ce(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return $e(e,n)}function $l(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(ar(t,r)):void 0,c={};return it(c,t,Reflect.ownKeys(Fe(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),$e(t,Ce(t._zod.def,{shape:c,checks:[]}))}function Sl(e,t,r){let n=r?new Set(ar(t,r)):void 0,o={};return it(o,t,Reflect.ownKeys(Fe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),$e(t,Ce(t._zod.def,{shape:o}))}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function sn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function pt(e){return typeof e=="string"?e:e?.message}function cr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Ee(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:pt(e.inst?._zod.def?.error?.(e))??pt(i?.(e))??pt(t?.error?.(e))??pt(r.customError?.(e))??pt(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Ko(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var El=/[\uD800-\uDBFF]/;function Ot(e){let t=e.length;if(!El.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Nt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function an(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function yt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Pl(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function qo(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Go(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ol(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return qo(t+r)}function Nl(e){return Go(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Tl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gr=class{constructor(...t){}};function cn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Rl(e,r,n.value)}}function We(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ur(e,t,r){return We(e,t,r,!1)}function Al(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return We(this,r,n(this))},set(o){We(this,r,o)}})}return t}function Rl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:We(this,t,r.bind(this))},set(n){We(this,t,n)}})}function Il(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Kr,Je=!1,Ll={configurable:!0,get(){Je=!0}};function M(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Kr!==e._zod){Kr=void 0;return}Kr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ll);let o=Je;Je=!1;try{let i=r(this);return Je?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Je=Je||o,i}catch(i){throw delete this[t],Je=Je||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Fl(e,t,r,n){let o=Il(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Yo="~constantCatch";function Xo(e){let t=()=>e;return t[Yo]=!0,t}var Qo;var un={value:void 0,enumerable:!1},ei="captureStackTrace"in Error?Error:null;function Cl(e){let t=ei;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ei=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(m,f){if(m._zod){if(m._zod.traits.has(e))return}else{un.value=new i(f);try{Object.defineProperty(m,"_zod",un)}finally{un.value=void 0}}if(m._zod.traits.add(e),t(m,f),a){let x=Object.getPrototypeOf(m),d=m._zod.constr.prototype,v=x;for(;v&&v!==d;)v=Object.getPrototypeOf(v);let P=v??x;a.has(P)||(a.add(P),cn(P,s))}let h=p.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in m||(m[x]=h[x].bind(m)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let f=n?.Parent?Cl(l):this;c(f,m);let h=f._zod.deferred;if(h){for(let d of h)d();f._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(f),f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>n?.Parent&&m instanceof n.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var Pe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},xt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qo=globalThis).__zod_globalConfig??(Qo.__zod_globalConfig={});var me=globalThis.__zod_globalConfig;function ve(e){return e&&Object.assign(me,e),me}function Ml(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ht,2)),e.message}function Dl(e){this._zod.message=e}var jl={get:Ml,set:Dl,enumerable:!0,configurable:!0},dn={value:void 0,enumerable:!1},ti=new WeakSet([Object.prototype,Error.prototype]),ri=(e,t)=>{e.name="$ZodError",dn.value=t,Object.defineProperty(e,"issues",dn),dn.value=void 0,Object.defineProperty(e,"message",jl);let r=Object.getPrototypeOf(e);ti.has(r)||(ti.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ni=b("$ZodError",ri),Tp=b("$ZodError",ri,void 0,{Parent:Error});function Vl(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function oi(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Vl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ii(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],p=u===a.length-1;if(l==="_errors"){p&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];p&&m._errors.push(t(s)),c=m,u++}}}};return n(e),r}function lr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var dr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Pe;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw or(c,i?.callee??t),c}return a.value};return t};var fr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw or(c,i?.callee??t),c}return a.value};return t};var pr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Pe;return i.issues.length?si(e,i.issues,o):{success:!0,data:i.value}};function si(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Ee(o,r,ve()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var mr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?si(e,i.issues,o):{success:!0,data:i.value}};var Ul=Symbol.for("zod.compile.invalid"),Bl=Symbol.for("zod.compile.fallback"),fn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ul)return!0;if(n.definite===!0&&r===void 0)return!1}return Jl(e,t,r)});function Jl(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Bl]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Pe;return i.issues.length===0}var pn=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},ai=e=>{let t=dr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,lr(r,s))};return r};var ci=e=>{let t=dr(e),r=(n,o,i,s)=>t(n,o,i,lr(r,s));return r};var ui=e=>{let t=fr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,lr(r,s))};return r};var li=e=>{let t=fr(e),r=async(n,o,i,s)=>await t(n,o,i,lr(r,s));return r};var di=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return pr(e)(t,r,o)};var fi=e=>(t,r,n)=>pr(e)(t,r,n);var pi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mr(e)(t,r,o)};var mi=e=>async(t,r,n)=>mr(e)(t,r,n);var hi=/^[cC][0-9a-z]{6,}$/,gi=/^[0-9a-z]+$/,bi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yi=/^[0-9a-vA-V]{20}$/,xi=/^[A-Za-z0-9]{27}$/,vi=/^[a-zA-Z0-9_-]{21}$/;function _i(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var wi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ki=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var zi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wl="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $i(){return new RegExp(Wl,"u")}var Si=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ei=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Pi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Oi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ni=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ti=/^https?$/,Ai=/^\+[1-9]\d{6,14}$/;var Ri="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Hl(e){return new RegExp(`^${e}$`)}var Ii=Hl(Ri);function mn(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Li(e){return new RegExp(`^${mn(e)}$`)}function Fi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${mn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${mn({precision:e.precision})}`:r;return new RegExp(`^${Ri}T(?:${n})$`)}var Ci=/^[\s\S]{0,}$/;var gn=/^-?\d+$/,Zt=/^-?\d+(?:\.\d+)?$/,Mi=/^(?:true|false)$/i,Di=/^null$/i;var ji=/^[^A-Z]*$/,Vi=/^[^a-z]*$/;var fe=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var bn=e=>{let t=e.value;return!Yr(t)&&t.length!==void 0},hr={number:"number",bigint:"bigint",object:"date"},yn=b("$ZodCheckLessThan",(e,t)=>{fe.init(e,t);let r=hr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:hr[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xn=b("$ZodCheckGreaterThan",(e,t)=>{fe.init(e,t);let r=hr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:hr[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=b("$ZodCheckMultipleOf",(e,t)=>{fe.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Xr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Bi=b("$ZodCheckNumberFormat",(e,t)=>{fe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Pt[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Ji=b("$ZodCheckMaxLength",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ot(o):i)<=t.maximum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wi=b("$ZodCheckMinLength",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ot(o):i)>=t.minimum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hi=b("$ZodCheckLengthEquals",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ot(o):i;if(s===t.length)return;let a=Nt(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),At=b("$ZodCheckStringFormat",(e,t)=>{var r,n;fe.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ki=b("$ZodCheckRegex",(e,t)=>{At.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qi=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ji),At.init(e,t)}),Gi=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vi),At.init(e,t)}),Yi=b("$ZodCheckIncludes",(e,t)=>{fe.init(e,t);let r=Me(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Xi=b("$ZodCheckStartsWith",(e,t)=>{fe.init(e,t);let r=new RegExp(`^${Me(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qi=b("$ZodCheckEndsWith",(e,t)=>{fe.init(e,t);let r=new RegExp(`.*${Me(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var es=b("$ZodCheckOverwrite",(e,t)=>{fe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var gr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
3
3
  `).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
4
  ${r.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}};var ts={major:4,minor:6,patch:5};var U=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=xe(a),p;for(let m of c){if(m._zod.def.when){if(on(a)||!m._zod.def.when(a))continue}else if(l)continue;let d=a.issues.length,h=m._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new Pe;if(p||h instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await h,a.issues.length!==d&&(ar(a.issues,d,e),l||(l=xe(a,d)))});else{if(a.issues.length===d)continue;ar(a.issues,d,e),l||(l=xe(a,d))}}return p?p.then(()=>a):a},s=(a,c,u)=>{if(xe(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new Pe;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(p=>s(p,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Pe;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return cr(this,"~standard",vn(this))},set"~standard"(e){Be(this,"~standard",e)}}),hs=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ee(r,t,ve()))}:{value:e.value};async function Hl(e,t){let r={async:!0};return hs(await e._zod.run({value:t,issues:[]},r),r)}function vn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return hs(n,r)}catch{}return Hl(e,t)},vendor:"zod",version:1}}var xr=b("$ZodString",(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??Fi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),X=b("$ZodStringFormat",(e,t)=>{Tt.init(e,t),xr.init(e,t)}),gs=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wi),X.init(e,t)}),bs=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mn(n))}else t.pattern??(t.pattern=mn());X.init(e,t)}),ys=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ki),X.init(e,t)}),xs=1,br=2;function vs(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Kl(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?vs(e)||br:ql(e,t)}function ql(e,t){if(!t.normalize&&t.protocol?.source===Zi.source&&!/^https?:\/\//i.test(e))return xs;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??br}return new URL(e)}catch{return br}}var Gl=/[\t\n\r]/g;function rs(e){return e.replace(Gl,"")}function Yl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var _s=b("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Kl(n,t);if(o===xs){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===br){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=rs(n);return}t.hostname&&!Yl(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Xl(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:rs(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ws=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zi()),X.init(e,t)}),ks=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?xi:vi(t.length)),X.init(e,t)}),zs=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mi),X.init(e,t)}),$s=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hi),X.init(e,t)}),Ss=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gi),X.init(e,t)}),Es=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bi),X.init(e,t)}),Ps=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yi),X.init(e,t)}),Os=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Li(t)),X.init(e,t)}),Ns=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ri),X.init(e,t)}),Zs=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ii(t)),X.init(e,t)}),As=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_i),X.init(e,t)}),Ts=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$i),X.init(e,t)}),Ql=/^[0-9a-fA-F:.]+$/;function Rs(e){return Ql.test(e)?vs(`http://[${e}]`):!1}var Is=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Si),X.init(e,t),e._zod.check=r=>{Rs(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ls=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ei),X.init(e,t)});function ed(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Rs(r)}var Fs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pi),X.init(e,t),e._zod.check=r=>{ed(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Cs(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var _n=/^[0-9a-zA-Z+/]*={0,2}$/,Ms=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_n),X.init(e,t),e._zod.check=r=>{Cs(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),vr=/^[A-Za-z0-9_-]*$/;function td(e){if(!vr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Cs(r)}var Ds=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vr),X.init(e,t),e._zod.check=r=>{td(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),js=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ai),X.init(e,t)});function rd(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Vs=b("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=r=>{rd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wn=b("$ZodNumber",(e,t)=>{U.init(e,t),e._zod.pattern=Zt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Us=b("$ZodNumberFormat",(e,t)=>{Ui.init(e,t),wn.init(e,t)}),Bs=b("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=Ci,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Js=b("$ZodNull",(e,t)=>{U.init(e,t),e._zod.pattern=Mi,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Ws=b("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=r=>r}),Hs=b("$ZodNever",(e,t)=>{U.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ns(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}var Ks=b("$ZodArray",(e,t)=>{U.init(e,t);let r=pe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(p=>ns(p,n,c)));else if(ns(l,n,c),a&&l.issues.length!==0&&xe(l))break}return s.length?Promise.all(s).then(()=>n):n}});function yr(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var nd=[];function qs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:nd,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=nn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Gs(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,p=u.optin,m=u.optout,d=0;for(let h in t){if(s&&r.issues.length!==d){if(xe(r,d))break;d=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let x=u.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(f=>yr(f,r,h,t,p,m))):yr(x,r,h,t,p,m)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var od=b("$ZodObject",(e,t)=>{U.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=mt(()=>qs(t));F(e,"propValues",u=>{let l=u.def.shape,p={};for(let m in l){let d=l[m]._zod;if(d.values){Object.prototype.hasOwnProperty.call(p,m)||ge(p,m,new Set);for(let h of d.values)p[m].add(h);d.optin!==void 0&&p[m].add(void 0)}}return p});let i=tt,s=t.catchall,a,c=pe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],d=a.shape,h=l?.abortEarly,x=u.issues.length;for(let f of a.allKeys){if(h&&u.issues.length!==x){if(xe(u,x))break;x=u.issues.length}if(f==="__proto__")continue;let v=d[f],P=v._zod.optin,D=v._zod.optout,S=v._zod.run({value:p[f],issues:[]},l);S instanceof Promise?m.push(S.then(w=>yr(w,u,f,p,P,D))):yr(S,u,f,p,P,D)}return s?Gs(m,p,u,l,o.value,e,h===!0):m.length?Promise.all(m).then(()=>u):u}}),Ys=b("$ZodObjectJIT",(e,t)=>{od.init(e,t);let r=e._zod.parse,n=mt(()=>qs(t)),o=pe.memoizer,i=d=>{let h=n.value,x=h.symbolKeys,f=new hr(["payload","ctx"],{shape:d,inst:e,memo:o,syms:x}),v=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,P=(w,z)=>`
6
+ };`)(...Object.values(this.closed))}};var rs={major:4,minor:6,patch:5};var W=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rs;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=xe(a),p;for(let m of c){if(m._zod.def.when){if(sn(a)||!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=m._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new Pe;if(p||h instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(cr(a.issues,f,e),l||(l=xe(a,f)))});else{if(a.issues.length===f)continue;cr(a.issues,f,e),l||(l=xe(a,f))}}return p?p.then(()=>a):a},s=(a,c,u)=>{if(xe(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new Pe;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(p=>s(p,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Pe;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return ur(this,"~standard",_n(this))},set"~standard"(e){We(this,"~standard",e)}}),gs=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ee(r,t,ve()))}:{value:e.value};async function Kl(e,t){let r={async:!0};return gs(await e._zod.run({value:t,issues:[]},r),r)}function _n(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return gs(n,r)}catch{}return Kl(e,t)},vendor:"zod",version:1}}var vr=b("$ZodString",(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??Ci,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),X=b("$ZodStringFormat",(e,t)=>{At.init(e,t),vr.init(e,t)}),bs=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ki),X.init(e,t)}),ys=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=hn(n))}else t.pattern??(t.pattern=hn());X.init(e,t)}),xs=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zi),X.init(e,t)}),vs=1,yr=2;function _s(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ql(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?_s(e)||yr:Gl(e,t)}function Gl(e,t){if(!t.normalize&&t.protocol?.source===Ti.source&&!/^https?:\/\//i.test(e))return vs;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??yr}return new URL(e)}catch{return yr}}var Yl=/[\t\n\r]/g;function ns(e){return e.replace(Yl,"")}function Xl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ql(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ws=b("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ql(n,t);if(o===vs){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===yr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=ns(n);return}t.hostname&&!Xl(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Ql(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:ns(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ks=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$i()),X.init(e,t)}),zs=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?vi:_i(t.length)),X.init(e,t)}),$s=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hi),X.init(e,t)}),Ss=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gi),X.init(e,t)}),Es=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=bi),X.init(e,t)}),Ps=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yi),X.init(e,t)}),Os=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xi),X.init(e,t)}),Ns=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Fi(t)),X.init(e,t)}),Zs=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ii),X.init(e,t)}),Ts=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Li(t)),X.init(e,t)}),As=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wi),X.init(e,t)}),Rs=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Si),X.init(e,t)}),ed=/^[0-9a-fA-F:.]+$/;function Is(e){return ed.test(e)?_s(`http://[${e}]`):!1}var Ls=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ei),X.init(e,t),e._zod.check=r=>{Is(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Fs=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pi),X.init(e,t)});function td(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Is(r)}var Cs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oi),X.init(e,t),e._zod.check=r=>{td(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Ms(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var wn=/^[0-9a-zA-Z+/]*={0,2}$/,Ds=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wn),X.init(e,t),e._zod.check=r=>{Ms(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),_r=/^[A-Za-z0-9_-]*$/;function rd(e){if(!_r.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ms(r)}var js=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_r),X.init(e,t),e._zod.check=r=>{rd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Vs=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ai),X.init(e,t)});function nd(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Us=b("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=r=>{nd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var kn=b("$ZodNumber",(e,t)=>{W.init(e,t),e._zod.pattern=Zt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Bs=b("$ZodNumberFormat",(e,t)=>{Bi.init(e,t),kn.init(e,t)}),Js=b("$ZodBoolean",(e,t)=>{W.init(e,t),e._zod.pattern=Mi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Ws=b("$ZodNull",(e,t)=>{W.init(e,t),e._zod.pattern=Di,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Hs=b("$ZodUnknown",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),Ks=b("$ZodNever",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function os(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}var qs=b("$ZodArray",(e,t)=>{W.init(e,t);let r=me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(p=>os(p,n,c)));else if(os(l,n,c),a&&l.issues.length!==0&&xe(l))break}return s.length?Promise.all(s).then(()=>n):n}});function xr(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var od=[];function Gs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:od,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=on(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ys(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,p=u.optin,m=u.optout,f=0;for(let h in t){if(s&&r.issues.length!==f){if(xe(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let x=u.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(d=>xr(d,r,h,t,p,m))):xr(x,r,h,t,p,m)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var id=b("$ZodObject",(e,t)=>{W.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=gt(()=>Gs(t));M(e,"propValues",u=>{let l=u.def.shape,p={};for(let m in l){let f=l[m]._zod;if(f.values){Object.prototype.hasOwnProperty.call(p,m)||ge(p,m,new Set);for(let h of f.values)p[m].add(h);f.optin!==void 0&&p[m].add(void 0)}}return p});let i=st,s=t.catchall,a,c=me.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],f=a.shape,h=l?.abortEarly,x=u.issues.length;for(let d of a.allKeys){if(h&&u.issues.length!==x){if(xe(u,x))break;x=u.issues.length}if(d==="__proto__")continue;let v=f[d],P=v._zod.optin,j=v._zod.optout,S=v._zod.run({value:p[d],issues:[]},l);S instanceof Promise?m.push(S.then(w=>xr(w,u,d,p,P,j))):xr(S,u,d,p,P,j)}return s?Ys(m,p,u,l,o.value,e,h===!0):m.length?Promise.all(m).then(()=>u):u}}),Xs=b("$ZodObjectJIT",(e,t)=>{id.init(e,t);let r=e._zod.parse,n=gt(()=>Gs(t)),o=me.memoizer,i=f=>{let h=n.value,x=h.symbolKeys,d=new gr(["payload","ctx"],{shape:f,inst:e,memo:o,syms:x}),v=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,P=(w,$)=>`
7
7
  let ${w}_ab = false;
8
8
  for (let i = 0; i < ${w}.issues.length; i++) {
9
9
  const iss = ${w}.issues[i];
10
- iss.path = iss.path ? [${z}, ...iss.path] : [${z}];
10
+ iss.path = iss.path ? [${$}, ...iss.path] : [${$}];
11
11
  payload.issues.push(iss);
12
12
  if (iss.continue !== true) ${w}_ab = true;
13
13
  }
14
14
  if (${w}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;f.write("const input = payload.value;");let D=Object.create(null),S=0;for(let w of h.allKeys)D[w]=`key_${S++}`;f.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let z=D[w],B=typeof w=="symbol"?`syms[${x.indexOf(w)}]`:Qr(w),te=`${B} in input`,re=d[w],ie=re?._zod?.optin,V=ie!==void 0,Q=re?._zod?.optout==="optional";if(f.write(`const ${z} = ${v(B)};`),V&&Q){let he=ie==="optional"?`${z}_present`:`${z}.value !== undefined || ${z}_present`;f.write(`
18
- const ${z}_present = ${te};
19
- if (!${z}.issues.length || ${z}_present) {
20
- if (${z}.issues.length) {${P(z,B)}
17
+ }`;d.write("const input = payload.value;");let j=Object.create(null),S=0;for(let w of h.allKeys)j[w]=`key_${S++}`;d.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let $=j[w],H=typeof w=="symbol"?`syms[${x.indexOf(w)}]`:en(w),te=`${H} in input`,Q=f[w],oe=Q?._zod?.optin,B=oe!==void 0,se=Q?._zod?.optout==="optional";if(d.write(`const ${$} = ${v(H)};`),B&&se){let de=oe==="optional"?`${$}_present`:`${$}.value !== undefined || ${$}_present`;d.write(`
18
+ const ${$}_present = ${te};
19
+ if (!${$}.issues.length || ${$}_present) {
20
+ if (${$}.issues.length) {${P($,H)}
21
21
  }
22
22
 
23
- if (${he}) {
24
- newResult[${B}] = ${z}.value;
23
+ if (${de}) {
24
+ newResult[${H}] = ${$}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else V?(f.write(`
29
- if (${z}.issues.length) {${P(z,B)}
28
+ `)}else B?(d.write(`
29
+ if (${$}.issues.length) {${P($,H)}
30
30
  }
31
- `),ie==="defaulted"?f.write(`newResult[${B}] = ${z}.value;`):f.write(`
32
- if (${z}.value !== undefined || ${te}) {
33
- newResult[${B}] = ${z}.value;
31
+ `),oe==="defaulted"?d.write(`newResult[${H}] = ${$}.value;`):d.write(`
32
+ if (${$}.value !== undefined || ${te}) {
33
+ newResult[${H}] = ${$}.value;
34
34
  }
35
- `)):f.write(`
36
- const ${z}_present = ${te};
37
- if (${z}.issues.length) {${P(z,B)}
35
+ `)):d.write(`
36
+ const ${$}_present = ${te};
37
+ if (${$}.issues.length) {${P($,H)}
38
38
  }
39
- if (!${z}_present && !${z}.issues.length) {
39
+ if (!${$}_present && !${$}.issues.length) {
40
40
  payload.issues.push({
41
41
  code: "invalid_type",
42
42
  expected: "nonoptional",
43
43
  input: undefined,
44
- path: [${B}]
44
+ path: [${H}]
45
45
  });
46
46
  if (ctx && ctx.abortEarly) {
47
47
  payload.value = newResult;
@@ -49,13 +49,13 @@ ${r.join(`
49
49
  }
50
50
  }
51
51
 
52
- if (${z}_present) {
53
- newResult[${B}] = ${z}.value;
52
+ if (${$}_present) {
53
+ newResult[${H}] = ${$}.value;
54
54
  }
55
55
 
56
- `)}return f.write("payload.value = newResult;"),f.write("return payload;"),f.compile()},s,a=tt,c=!pe.jitless,l=c&&tn.value,p=t.catchall,m;e._zod.parse=(d,h)=>{m??(m=n.value);let x=d.value;return a(x)?c&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),d=s(d,h),p?Gs([],x,d,h,m,e,h?.abortEarly===!0):d):r(d,h):(d.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),d)}});function os(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!xe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ee(s,n,ve())))}),t)}var kn=b("$ZodUnion",(e,t)=>{U.init(e,t),F(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),F(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),F(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),F(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Et(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>os(a,n,e,o)):os(s,n,e,o)}});function id(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Xs=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kn.init(e,t);let r=e._zod.parse;F(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ge(i,u,new Set);for(let p of l)i[u].add(p)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=ht(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=mt(()=>id(t));e._zod.parse=(o,i)=>{let s=o.value;if(!tt(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),Qs=b("$ZodIntersection",(e,t)=>{U.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>is(r,c,u)):is(r,i,s)}});function xn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Je(e)&&Je(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=xn(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=xn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function is(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);i.has(m)||i.set(m,u),p=[m]}else return!1;for(let m of p)n.has(m)||n.set(m,{}),n.get(m)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=xn(t.value,r.value);if(!c.valid){if(xe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ea=b("$ZodTuple",(e,t)=>{U.init(e,t);let r=t.items,n=pe.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=ss(r,"optin"),u=ss(r,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:s[d],issues:[]},i);h instanceof Promise?a.push(h.then(x=>{l[d]=x})):(l[d]=h,p&&!m&&h.issues.length&&(m=xe(h)))}if(t.rest&&!m){let d=r.length-1,h=s.slice(r.length),x=o.issues.length;for(let f of h){if(p&&o.issues.length!==x){if(xe(o,x))break;x=o.issues.length}d++;let v=t.rest._zod.run({value:f,issues:[]},i);v instanceof Promise?a.push(v.then(P=>as(P,o,d))):as(v,o,d)}}return a.length?Promise.all(a).then(()=>cs(l,o,r,s,u)):cs(l,o,r,s,u)}});function ss(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function as(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}function cs(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...Se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ta=b("$ZodRecord",(e,t)=>{U.init(e,t);let r=pe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Je(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(h=>Ee(h,o,ve())),input:l,path:[l],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Se(l,h.issues)),n.value[m]=h.value})):(d.issues.length&&n.issues.push(...Se(l,d.issues)),n.value[m]=d.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Zt.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Ee(h,o,ve())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Se(u,h.issues)),n.value[m]=h.value})):(d.issues.length&&n.issues.push(...Se(u,d.issues)),n.value[m]=d.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var ra=b("$ZodEnum",(e,t)=>{U.init(e,t);let r=ft(t.entries),n=new Set(r);e._zod.values=n,F(e,"pattern",o=>{let i=ft(o.def.entries).filter(s=>rn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Ce(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),na=b("$ZodLiteral",(e,t)=>{U.init(e,t);let r=new Set(t.values);e._zod.values=r,F(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Ce(i):i?Ce(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var oa=b("$ZodTransform",(e,t)=>{U.init(e,t),e._zod.optin="optional",pe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new bt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Pe;return r.value=o,r}});function us(e,t){return e.value=t.issues.length?void 0:t.value,e}var zn=b("$ZodOptional",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",F(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),F(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>us(r,i)):us(r,o)}return t.innerType._zod.run(r,n)}}),ia=b("$ZodExactOptional",(e,t)=>{zn.init(e,t),F(e,"values",r=>r.def.innerType._zod.values),F(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),sa=b("$ZodNullable",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin),F(e,"optout",r=>r.def.innerType._zod.optout),F(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)}|null)$`):void 0}),F(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),aa=b("$ZodDefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",F(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ls(i,t)):ls(o,t)}});function ls(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ca=b("$ZodPrefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",F(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ua=b("$ZodNonOptional",(e,t)=>{U.init(e,t),F(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ds(i,e)):ds(o,e)}});function ds(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function fs(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ee(o,n,ve()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var la=b("$ZodCatch",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),F(e,"optout",r=>r.def.innerType._zod.optout),F(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>fs(r,i,t,n)):fs(r,o,t,n)}});var da=b("$ZodPipe",(e,t)=>{U.init(e,t),F(e,"values",r=>r.def.in._zod.values),F(e,"optin",r=>r.def.in._zod.optin),F(e,"optout",r=>r.def.out._zod.optout),F(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>gr(s,t.in,n)):gr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>gr(i,t.out,n)):gr(o,t.out,n)}});function gr(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var fa=b("$ZodReadonly",(e,t)=>{U.init(e,t),F(e,"propValues",r=>r.def.innerType._zod.propValues),F(e,"values",r=>r.def.innerType._zod.values),F(e,"optin",r=>r.def.innerType?._zod?.optin),F(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(ps):ps(o)}});function ps(e){return e.memo||(e.value=Object.freeze(e.value)),e}var pa=b("$ZodLazy",(e,t)=>{U.init(e,t),Xr(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),F(e,"pattern",r=>r.innerType?._zod?.pattern),F(e,"propValues",r=>r.innerType?._zod?.propValues),F(e,"optin",r=>r.innerType?._zod?.optin??void 0),F(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ma=b("$ZodCustom",(e,t)=>{le.init(e,t),U.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>ms(i,r,n,e));ms(o,r,n,e)}});function ms(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(gt(o))}}var Sn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},En="~memo",ha=[];function ga(e){return e!==null&&typeof e=="object"}function $n(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ba=new WeakMap,Rt=0,kr=1,It=2;function zr(e,t,r){let n=ba.get(e);if(n!==void 0)return n?It:Rt;if(t.has(e))return It;t.add(e);let o=Rt,i=l=>{if(o!==It&&l?._zod){let p=zr(l,t,r);p>o&&(o=p)}},s=(l,p)=>{let m=Rt;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(p&&!h.enumerable)continue;let x=h.get?kr:h.value?._zod?zr(h.value,t,r):Rt;x>m&&(m=x)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=ht(c);a(l?s(l,!0):kr),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?zr(l,t,!1):kr);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let m=p.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let d of m)i(d)}}}return t.delete(e),sd(e,o)}function sd(e,t){return t!==kr&&ba.set(e,t===It),t}function ad(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var _r,wr=[],cd={alloc(e,t,r){let n=_r;if(!n)return r;_r=void 0;let o={value:r,issues:null};return n.set(t.value,o),wr.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ud(i,o.value))throw new Sn;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=zr(e,new Set,!1);if(v===Rt)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);v===It||n?r=!0:n=!0}let l=c.value;if(!ga(l))return s(c,u);let p=u[En];p||(p={buckets:new WeakMap,backEdges:void 0},u[En]=p);let m;o===u?m=i:(m=ad(p,e),o=u,i=m);let d=m.get(l);if(d)return c.value=d.value,d.issues?d.issues.length&&c.issues.push(...$n(d.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(d.value)),c;_r=m;let h=wr.length,x=s(c,u);_r=void 0;let f=wr.length>h?wr.pop():void 0;return x instanceof Promise?x.then(v=>(f&&(f.issues=v.issues.length?$n(v.issues):ha),v)):(f&&(f.issues=x.issues.length?$n(x.issues):ha),x)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function ya(){return cd}function ud(e,t){let r=e[En]?.backEdges;return r!==void 0&&ga(t)&&r.has(t)}var ld=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=sn(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${or(i.values[0])}`:`Invalid option: expected one of ${rr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${rr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function xa(){return{localeError:ld()}}var va;var Pn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function dd(){return new Pn}(va=globalThis).__zod_globalRegistry??(va.__zod_globalRegistry=dd());var rt=globalThis.__zod_globalRegistry;function _a(e){return e.checks&&(e.checks=[...e.checks]),e}function wa(e,t){return new e(_a({type:"string",...O(t)}))}function ka(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function za(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function $a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Sa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Oa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Na(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Aa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Ta(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Ia(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Ca(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function ja(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Wa(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ha(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Ka(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function qa(e,t){return new e(_a({type:"number",checks:[],...O(t)}))}function Ga(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Ya(e,t){return new e({type:"boolean",...O(t)})}function Xa(e,t){return new e({type:"null",...O(t)})}function Qa(e){return new e({type:"unknown"})}function ec(e,t){return new e({type:"never",...O(t)})}function $r(e,t){return new bn({check:"less_than",...O(t),value:e,inclusive:!1})}function Lt(e,t){return new bn({check:"less_than",...O(t),value:e,inclusive:!0})}function Sr(e,t){return new yn({check:"greater_than",...O(t),value:e,inclusive:!1})}function Ft(e,t){return new yn({check:"greater_than",...O(t),value:e,inclusive:!0})}function Er(e,t){return new Vi({check:"multiple_of",...O(t),value:e})}function Pr(e,t){return new Bi({check:"max_length",...O(t),maximum:e})}function yt(e,t){return new Ji({check:"min_length",...O(t),minimum:e})}function Or(e,t){return new Wi({check:"length_equals",...O(t),length:e})}function On(e,t){return new Hi({check:"string_format",format:"regex",...O(t),pattern:e})}function Nn(e){return new Ki({check:"string_format",format:"lowercase",...O(e)})}function Zn(e){return new qi({check:"string_format",format:"uppercase",...O(e)})}function An(e,t){return new Gi({check:"string_format",format:"includes",...O(t),includes:e})}function Tn(e,t){return new Yi({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Rn(e,t){return new Xi({check:"string_format",format:"ends_with",...O(t),suffix:e})}function We(e){return new Qi({check:"overwrite",tx:e})}function In(e){return We(t=>t.normalize(e))}function Ln(){return We(e=>e.trim())}function Fn(){return We(e=>e.toLowerCase())}function Cn(){return We(e=>e.toUpperCase())}function Mn(){return We(e=>en(e))}function tc(e,t,r){return new e({type:"array",element:t,...O(r)})}function rc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function nc(e,t){let r=fd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(gt(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(gt(i))}},e(n.value,n)),t);return r}function fd(e,t){let r=new le({check:"custom",...O(t)});return r._zod.check=e,r}function Ct(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ge(e,n,r[n]);return e}function Dt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??rt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ae(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function H(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),H(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ct(s.schema,c),t.io==="input"&&me(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function oc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function jt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??(h=>h);if(p)return{ref:m(p)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${a}/${oc(d)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+oc(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
56
+ `)}return d.write("payload.value = newResult;"),d.write("return payload;"),d.compile()},s,a=st,c=!me.jitless,l=c&&rn.value,p=t.catchall,m;e._zod.parse=(f,h)=>{m??(m=n.value);let x=f.value;return a(x)?c&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),f=s(f,h),p?Ys([],x,f,h,m,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),f)}});function is(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!xe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ee(s,n,ve())))}),t)}var zn=b("$ZodUnion",(e,t)=>{W.init(e,t),M(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),M(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),M(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),M(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Et(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>is(a,n,e,o)):is(s,n,e,o)}});function sd(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Qs=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,zn.init(e,t);let r=e._zod.parse;M(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ge(i,u,new Set);for(let p of l)i[u].add(p)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=bt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=gt(()=>sd(t));e._zod.parse=(o,i)=>{let s=o.value;if(!st(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),ea=b("$ZodIntersection",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>ss(r,c,u)):ss(r,i,s)}});function vn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(He(e)&&He(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=vn(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=vn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ss(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);i.has(m)||i.set(m,u),p=[m]}else return!1;for(let m of p)n.has(m)||n.set(m,{}),n.get(m)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=vn(t.value,r.value);if(!c.valid){if(xe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ta=b("$ZodTuple",(e,t)=>{W.init(e,t);let r=t.items,n=me.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=as(r,"optin"),u=as(r,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<r.length;f++){let h=r[f]._zod.run({value:s[f],issues:[]},i);h instanceof Promise?a.push(h.then(x=>{l[f]=x})):(l[f]=h,p&&!m&&h.issues.length&&(m=xe(h)))}if(t.rest&&!m){let f=r.length-1,h=s.slice(r.length),x=o.issues.length;for(let d of h){if(p&&o.issues.length!==x){if(xe(o,x))break;x=o.issues.length}f++;let v=t.rest._zod.run({value:d,issues:[]},i);v instanceof Promise?a.push(v.then(P=>cs(P,o,f))):cs(v,o,f)}}return a.length?Promise.all(a).then(()=>us(l,o,r,s,u)):us(l,o,r,s,u)}});function as(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function cs(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}function us(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...Se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ra=b("$ZodRecord",(e,t)=>{W.init(e,t);let r=me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!He(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(h=>Ee(h,o,ve())),input:l,path:[l],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);f instanceof Promise?s.push(f.then(h=>{h.issues.length&&n.issues.push(...Se(l,h.issues)),n.value[m]=h.value})):(f.issues.length&&n.issues.push(...Se(l,f.issues)),n.value[m]=f.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Zt.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Ee(h,o,ve())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);f instanceof Promise?s.push(f.then(h=>{h.issues.length&&n.issues.push(...Se(u,h.issues)),n.value[m]=h.value})):(f.issues.length&&n.issues.push(...Se(u,f.issues)),n.value[m]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var na=b("$ZodEnum",(e,t)=>{W.init(e,t);let r=mt(t.entries),n=new Set(r);e._zod.values=n,M(e,"pattern",o=>{let i=mt(o.def.entries).filter(s=>nn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Me(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),oa=b("$ZodLiteral",(e,t)=>{W.init(e,t);let r=new Set(t.values);e._zod.values=r,M(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Me(i):i?Me(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var ia=b("$ZodTransform",(e,t)=>{W.init(e,t),e._zod.optin="optional",me.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Pe;return r.value=o,r}});function ls(e,t){return e.value=t.issues.length?void 0:t.value,e}var $n=b("$ZodOptional",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",M(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),M(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ls(r,i)):ls(r,o)}return t.innerType._zod.run(r,n)}}),sa=b("$ZodExactOptional",(e,t)=>{$n.init(e,t),M(e,"values",r=>r.def.innerType._zod.values),M(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),aa=b("$ZodNullable",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin),M(e,"optout",r=>r.def.innerType._zod.optout),M(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)}|null)$`):void 0}),M(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ca=b("$ZodDefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ds(i,t)):ds(o,t)}});function ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ua=b("$ZodPrefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),la=b("$ZodNonOptional",(e,t)=>{W.init(e,t),M(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fs(i,e)):fs(o,e)}});function fs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ps(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ee(o,n,ve()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var da=b("$ZodCatch",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),M(e,"optout",r=>r.def.innerType._zod.optout),M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ps(r,i,t,n)):ps(r,o,t,n)}});var fa=b("$ZodPipe",(e,t)=>{W.init(e,t),M(e,"values",r=>r.def.in._zod.values),M(e,"optin",r=>r.def.in._zod.optin),M(e,"optout",r=>r.def.out._zod.optout),M(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>br(s,t.in,n)):br(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>br(i,t.out,n)):br(o,t.out,n)}});function br(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var pa=b("$ZodReadonly",(e,t)=>{W.init(e,t),M(e,"propValues",r=>r.def.innerType._zod.propValues),M(e,"values",r=>r.def.innerType._zod.values),M(e,"optin",r=>r.def.innerType?._zod?.optin),M(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(ms):ms(o)}});function ms(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ma=b("$ZodLazy",(e,t)=>{W.init(e,t),Qr(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),M(e,"pattern",r=>r.innerType?._zod?.pattern),M(e,"propValues",r=>r.innerType?._zod?.propValues),M(e,"optin",r=>r.innerType?._zod?.optin??void 0),M(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ha=b("$ZodCustom",(e,t)=>{fe.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>hs(i,r,n,e));hs(o,r,n,e)}});function hs(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(yt(o))}}var En=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Pn="~memo",ga=[];function ba(e){return e!==null&&typeof e=="object"}function Sn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ya=new WeakMap,Rt=0,zr=1,It=2;function $r(e,t,r){let n=ya.get(e);if(n!==void 0)return n?It:Rt;if(t.has(e))return It;t.add(e);let o=Rt,i=l=>{if(o!==It&&l?._zod){let p=$r(l,t,r);p>o&&(o=p)}},s=(l,p)=>{let m=Rt;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(p&&!h.enumerable)continue;let x=h.get?zr:h.value?._zod?$r(h.value,t,r):Rt;x>m&&(m=x)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=bt(c);a(l?s(l,!0):zr),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?$r(l,t,!1):zr);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let m=p.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}}return t.delete(e),ad(e,o)}function ad(e,t){return t!==zr&&ya.set(e,t===It),t}function cd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var wr,kr=[],ud={alloc(e,t,r){let n=wr;if(!n)return r;wr=void 0;let o={value:r,issues:null};return n.set(t.value,o),kr.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ld(i,o.value))throw new En;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=$r(e,new Set,!1);if(v===Rt)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);v===It||n?r=!0:n=!0}let l=c.value;if(!ba(l))return s(c,u);let p=u[Pn];p||(p={buckets:new WeakMap,backEdges:void 0},u[Pn]=p);let m;o===u?m=i:(m=cd(p,e),o=u,i=m);let f=m.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Sn(f.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value)),c;wr=m;let h=kr.length,x=s(c,u);wr=void 0;let d=kr.length>h?kr.pop():void 0;return x instanceof Promise?x.then(v=>(d&&(d.issues=v.issues.length?Sn(v.issues):ga),v)):(d&&(d.issues=x.issues.length?Sn(x.issues):ga),x)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function xa(){return ud}function ld(e,t){let r=e[Pn]?.backEdges;return r!==void 0&&ba(t)&&r.has(t)}var dd=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=an(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${ir(i.values[0])}`:`Invalid option: expected one of ${nr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${nr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function va(){return{localeError:dd()}}var _a;var On=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function fd(){return new On}(_a=globalThis).__zod_globalRegistry??(_a.__zod_globalRegistry=fd());var at=globalThis.__zod_globalRegistry;function wa(e){return e.checks&&(e.checks=[...e.checks]),e}function ka(e,t){return new e(wa({type:"string",...O(t)}))}function za(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function $a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Sa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Na(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Za(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ta(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Aa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Ia(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Ca(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function ja(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Wa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Ha(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ka(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function qa(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function Ga(e,t){return new e(wa({type:"number",checks:[],...O(t)}))}function Ya(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Xa(e,t){return new e({type:"boolean",...O(t)})}function Qa(e,t){return new e({type:"null",...O(t)})}function ec(e){return new e({type:"unknown"})}function tc(e,t){return new e({type:"never",...O(t)})}function Sr(e,t){return new yn({check:"less_than",...O(t),value:e,inclusive:!1})}function Lt(e,t){return new yn({check:"less_than",...O(t),value:e,inclusive:!0})}function Er(e,t){return new xn({check:"greater_than",...O(t),value:e,inclusive:!1})}function Ft(e,t){return new xn({check:"greater_than",...O(t),value:e,inclusive:!0})}function Pr(e,t){return new Ui({check:"multiple_of",...O(t),value:e})}function Or(e,t){return new Ji({check:"max_length",...O(t),maximum:e})}function vt(e,t){return new Wi({check:"min_length",...O(t),minimum:e})}function Nr(e,t){return new Hi({check:"length_equals",...O(t),length:e})}function Nn(e,t){return new Ki({check:"string_format",format:"regex",...O(t),pattern:e})}function Zn(e){return new qi({check:"string_format",format:"lowercase",...O(e)})}function Tn(e){return new Gi({check:"string_format",format:"uppercase",...O(e)})}function An(e,t){return new Yi({check:"string_format",format:"includes",...O(t),includes:e})}function Rn(e,t){return new Xi({check:"string_format",format:"starts_with",...O(t),prefix:e})}function In(e,t){return new Qi({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Ke(e){return new es({check:"overwrite",tx:e})}function Ln(e){return Ke(t=>t.normalize(e))}function Fn(){return Ke(e=>e.trim())}function Cn(){return Ke(e=>e.toLowerCase())}function Mn(){return Ke(e=>e.toUpperCase())}function Dn(){return Ke(e=>tn(e))}function rc(e,t,r){return new e({type:"array",element:t,...O(r)})}function nc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function oc(e,t){let r=pd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(yt(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(yt(i))}},e(n.value,n)),t);return r}function pd(e,t){let r=new fe({check:"custom",...O(t)});return r._zod.check=e,r}function Ct(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ge(e,n,r[n]);return e}function Dt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??at,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ce(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function q(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),q(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ct(s.schema,c),t.io==="input"&&he(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ic(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function jt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??(h=>h);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${ic(f)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+ic(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
57
57
 
58
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function ac(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;ac(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var cc=new Set(["type","properties","required","additionalProperties"]),ic=["oneOf","anyOf"];function sc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Dn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!cc.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??sc(u);l!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Dn(a)??{allOf:a};ge(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=sc(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function pd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of cc)if(o in e)return;let r=t.filter(o=>ic.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dn(t);else{let o=r[0],i=ic.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>Dn([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,Ct(e,n))}function Vt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){n(p);let d=e.seen.get(p),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Ct(u,h),Ct(u,l),a._zod.parent===p)for(let f in u)f==="$ref"||f==="allOf"||f in l||delete u[f];if(h.$ref&&d.def)for(let f in u)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(u[f])===JSON.stringify(d.def[f])&&delete u[f]}let m=a._zod.parent;if(m&&m!==p){n(m);let d=e.seen.get(m);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let h in u)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())ac(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);p?p.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])pd(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Ct(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ge(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mt(t,"input",e.processors),output:Mt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function me(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return me(n.element,r);if(n.type==="set")return me(n.valueType,r);if(n.type==="lazy")return me(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return me(n.innerType,r);if(n.type==="intersection")return me(n.left,r)||me(n.right,r);if(n.type==="record"||n.type==="map")return me(n.keyType,r)||me(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:me(n.in,r)||me(n.out,r);if(n.type==="object"){for(let o in n.shape)if(me(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(me(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(me(o,r))return!0;return!!(n.rest&&me(n.rest,r))}return!1}var uc=(e,t={})=>r=>{let n=Dt({...r,processors:t});return H(e,n),jt(n,e),Vt(n,e)},Mt=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Dt({...o??{},target:i,io:t,processors:r});return H(e,s),jt(s,e),Vt(s,e)};var xt=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},vt=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},lc=(e,t)=>{xt(e,"minimum",t),vt(e,"maximum",t)},hc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},gc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},bc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},yc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},dc=(e,t)=>xt(e,"minimum",t.minimum),fc=(e,t)=>vt(e,"maximum",t.maximum),pc=e=>(t,r)=>{yc(t,r.format);let[n,o]=e[r.format];xt(t,"minimum",n),vt(t,"maximum",o)},md={greater_than:(e,t)=>xt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>vt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>hc(e,t.value),number_format:pc(Pt),bigint_format:pc(ir),min_length:dc,max_length:fc,length_equals:(e,t)=>lc(e,t.length),min_size:dc,max_size:fc,size_equals:(e,t)=>lc(e,t.size),string_format:(e,t)=>{yc(e,t.format),t.pattern&&gc(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bc(e,t.mime)};function be(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)md[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&xt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&xt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&vt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&vt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&hc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&bc(t,o.mime);for(let i of o.patterns??[])gc(t,i);return t}var hd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gd=new Map([[_n,Oi],[vr,Ni]]),xc=e=>gd.get(e)??e,Un=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=be(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=hd[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let p=[...c].map(xc);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Bn=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=be(e);o.type=l?"integer":"number";let p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(p?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?d?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let h=new Set;for(let v of a)Number.isFinite(v)&&v!==0?h.add(Math.abs(v)):ae(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[x,...f]=h;x!==void 0&&(o.multipleOf=x),f.length&&(o.allOf=[...o.allOf??[],...f.map(v=>({multipleOf:v}))])}},Jn=(e,t,r,n)=>{r.type="boolean"},vc=(e,t,r,n)=>{ae(e,t,r,n,"BigInt cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{ae(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Wn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},wc=(e,t,r,n)=>{ae(e,t,r,n,"Undefined cannot be represented in JSON Schema")},kc=(e,t,r,n)=>{ae(e,t,r,n,"Void cannot be represented in JSON Schema")},Hn=(e,t,r,n)=>{r.not={}},zc=(e,t,r,n)=>{},Kn=(e,t,r,n)=>{},$c=(e,t,r,n)=>{ae(e,t,r,n,"Date cannot be represented in JSON Schema")},qn=(e,t,r,n)=>{let o=e._zod.def,i=ft(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},Gn=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(ae(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ae(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Sc=(e,t,r,n)=>{ae(e,t,r,n,"NaN cannot be represented in JSON Schema")},Ec=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Pc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=be(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Oc=(e,t,r,n)=>{r.type="boolean"},Yn=(e,t,r,n)=>{ae(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Nc=(e,t,r,n)=>{ae(e,t,r,n,"Function types cannot be represented in JSON Schema")},Xn=(e,t,r,n)=>{ae(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Zc=(e,t,r,n)=>{ae(e,t,r,n,"Map cannot be represented in JSON Schema")},Ac=(e,t,r,n)=>{ae(e,t,r,n,"Set cannot be represented in JSON Schema")},Qn=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=be(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=H(i.element,t,{...n,path:[...n.path,"items"]})};function Ut(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ut(t.out):t.type==="catch"?Ut(t.innerType):e._zod.optin}var eo=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ae(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ge(o.properties,u,H(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Ut(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=H(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},to=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>H(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},ro=(e,t,r,n)=>{let o=e._zod.def,i=H(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=H(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},no=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((x,f)=>H(x,t,{...n,path:[...n.path,s,f]})),u=i.rest?H(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let x=i.items[l-1];if(!(t.io==="input"?Ut(x)!==void 0:x._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),m&&(o.maxItems=p));let{minimum:d,maximum:h}=be(e);typeof d=="number"&&(o.minItems=d),typeof h=="number"&&(o.maxItems=h)};function jn(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let x=jn(e,h,r);return x===h?t:x}for(let h of["anyOf","oneOf"]){let x=t[h];if(!Array.isArray(x))continue;let f=x.map(v=>jn(e,v,r));f.some((v,P)=>v!==x[P])&&(t={...t,[h]:f})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(h=>typeof h=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:m,...d}=t;return d.enum?d.enum=d.enum.map(h=>typeof h=="number"?String(h):h):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(n.includes("number")?Zt:hn).source)),d}var Vn=new WeakMap;function bd(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Vn.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=jn(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var oo=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=be(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=H(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)ge(o.patternProperties,xc(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=H(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Vn.get(t);l||(l=[],Vn.set(t,l),t.deferred.push(()=>bd(t))),l.push(e)}o.additionalProperties=H(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&Ut(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l.map(String))}},io=(e,t,r,n)=>{let o=e._zod.def,i=H(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},so=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},ao=Symbol();function Tc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(ae(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ao):JSON.parse(s)}var co=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Tc(o.defaultValue,e,t,r,n);s!==ao&&(r.default=s)},uo=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Tc(o.defaultValue,e,t,r,n);s!==ao&&(r._prefault=s)},lo=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ae(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},fo=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;H(s,t,n);let a=t.seen.get(e);a.ref=s},po=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Rc=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Nr=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},mo=(e,t,r,n)=>{let o=e._zod.innerType;H(o,t,n);let i=t.seen.get(e);i.ref=o},mc={string:Un,number:Bn,boolean:Jn,bigint:vc,symbol:_c,null:Wn,undefined:wc,void:kc,never:Hn,any:zc,unknown:Kn,date:$c,enum:qn,literal:Gn,nan:Sc,template_literal:Ec,file:Pc,success:Oc,custom:Yn,function:Nc,transform:Xn,map:Zc,set:Ac,array:Qn,object:eo,union:to,intersection:ro,tuple:no,record:oo,nullable:io,nonoptional:so,default:co,prefault:uo,catch:lo,pipe:fo,readonly:po,promise:Rc,optional:Nr,lazy:mo};function ho(e,t){if("_idmap"in e){let n=e,o=Dt({...t,processors:mc}),i={};for(let c of n._idmap.entries()){let[u,l]=c;H(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;jt(o,l),ge(s,u,Vt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Dt({...t,processors:mc});return H(e,r),jt(r,e),Vt(r,e)}var Ic=new WeakSet([Object.prototype,Error.prototype]);function Ar(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Sd=(e,t)=>{ri.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Ic.has(r)||(Ic.add(r),Ar(r,"format",n=>o=>oi(n,o)),Ar(r,"flatten",n=>o=>ni(n,o)),Ar(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,pt,2)}),Ar(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,pt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var _e=b("ZodError",Sd,void 0,{Parent:Error});var Lc=lr(_e),Fc=dr(_e),Cc=fr(_e),Mc=pr(_e),Dc=si(_e),jc=ai(_e),Vc=ci(_e),Uc=ui(_e),Bc=li(_e),Jc=di(_e),Wc=fi(_e),Hc=pi(_e);function Pd(){pe.localeError||ve(xa())}function Bt(){pe.memoizer||ve({memoizer:ya()})}var K=b("ZodType",(e,t)=>(Pd(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Z.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $e(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pf(e,t))},superRefine(e,t){return this.check(Of(e,t))},overwrite(e){return this.check(We(e))},optional(){return Gc(this)},exactOptional(){return pf(this)},nullable(){return Yc(this)},nullish(){return Gc(Yc(this))},nonoptional(e){return xf(this,e)},array(){return se(this)},or(e){return He([this,e])},and(e){return cf(this,e)},transform(e){return Xc(this,ff(e))},default(e){return gf(this,e)},prefault(e){return yf(this,e)},catch(e){return _f(this,e)},pipe(e){return Xc(this,e)},readonly(){return zf(this)},describe(e){let t=this.clone();return rt.add(t,{description:e}),t},meta(...e){if(e.length===0)return rt.get(this);let t=this.clone();return rt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Z.hide(this,"~standard",{...vn(this),jsonSchema:{input:Mt(this,"input"),output:Mt(this,"output")}})},set"~standard"(e){Z.own(this,"~standard",e)},parse:function e(t,r){return Lc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Fc(this,t,r,{callee:e})},safeParse(e,t){return Cc(this,e,t)},async safeParseAsync(e,t){return Mc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Z.own(this,"spa",e)},validate(e,t){return dn(this,e,t)},validateAsync(e,t){return fn(this,e,t)},encode:function e(t,r){return Dc(this,t,r,{callee:e})},decode:function e(t,r){return jc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Vc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Uc(this,t,r,{callee:e})},safeEncode(e,t){return Bc(this,e,t)},safeDecode(e,t){return Jc(this,e,t)},async safeEncodeAsync(e,t){return Wc(this,e,t)},async safeDecodeAsync(e,t){return Hc(this,e,t)},toJSONSchema(e){return uc(this,{})(e)},get description(){return rt.get(this)?.description},get _def(){return this._zod.def}}),Qc=b("_ZodString",(e,t)=>{xr.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Un(e,r,n,o)},Z.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(On(...e))},includes(...e){return this.check(An(...e))},startsWith(...e){return this.check(Tn(...e))},endsWith(...e){return this.check(Rn(...e))},min(...e){return this.check(yt(...e))},max(...e){return this.check(Pr(...e))},length(...e){return this.check(Or(...e))},nonempty(...e){return this.check(yt(1,...e))},lowercase(e){return this.check(Nn(e))},uppercase(e){return this.check(Zn(e))},trim(){return this.check(Ln())},normalize(...e){return this.check(In(...e))},toLowerCase(){return this.check(Fn())},toUpperCase(){return this.check(Cn())},slugify(){return this.check(Mn())}})),Od=b("ZodString",(e,t)=>{xr.init(e,t),Qc.init(e,t)},{email(e){return this.check(ka(Rd,e))},url(e){return this.check(Oa(Ld,e))},jwt(e){return this.check(Ba(Yd,e))},emoji(e){return this.check(Na(Fd,e))},guid(e){return this.check(za(Id,e))},uuid(e){return this.check($a(Tr,e))},uuidv4(e){return this.check(Sa(Tr,e))},uuidv6(e){return this.check(Ea(Tr,e))},uuidv7(e){return this.check(Pa(Tr,e))},nanoid(e){return this.check(Za(Cd,e))},cuid(e){return this.check(Aa(Md,e))},cuid2(e){return this.check(Ta(Dd,e))},ulid(e){return this.check(Ra(jd,e))},base64(e){return this.check(ja(Kd,e))},base64url(e){return this.check(Va(qd,e))},xid(e){return this.check(Ia(Vd,e))},ksuid(e){return this.check(La(Ud,e))},ipv4(e){return this.check(Fa(Bd,e))},ipv6(e){return this.check(Ca(Jd,e))},cidrv4(e){return this.check(Ma(Wd,e))},cidrv6(e){return this.check(Da(Hd,e))},e164(e){return this.check(Ua(Gd,e))},datetime(e){return this.check(Ja(Nd,e))},date(e){return this.check(Wa(Zd,e))},time(e){return this.check(Ha(Ad,e))},duration(e){return this.check(Ka(Td,e))}});function N(e){return wa(Od,e)}var ee=b("ZodStringFormat",(e,t)=>{X.init(e,t),Qc.init(e,t)}),Nd=b("ZodISODateTime",(e,t)=>{Os.init(e,t),ee.init(e,t)}),Zd=b("ZodISODate",(e,t)=>{Ns.init(e,t),ee.init(e,t)}),Ad=b("ZodISOTime",(e,t)=>{Zs.init(e,t),ee.init(e,t)}),Td=b("ZodISODuration",(e,t)=>{As.init(e,t),ee.init(e,t)}),Rd=b("ZodEmail",(e,t)=>{ys.init(e,t),ee.init(e,t)});var Id=b("ZodGUID",(e,t)=>{gs.init(e,t),ee.init(e,t)});var Tr=b("ZodUUID",(e,t)=>{bs.init(e,t),ee.init(e,t)});var Ld=b("ZodURL",(e,t)=>{_s.init(e,t),ee.init(e,t)});var Fd=b("ZodEmoji",(e,t)=>{ws.init(e,t),ee.init(e,t)});var Cd=b("ZodNanoID",(e,t)=>{ks.init(e,t),ee.init(e,t)});var Md=b("ZodCUID",(e,t)=>{zs.init(e,t),ee.init(e,t)});var Dd=b("ZodCUID2",(e,t)=>{$s.init(e,t),ee.init(e,t)});var jd=b("ZodULID",(e,t)=>{Ss.init(e,t),ee.init(e,t)});var Vd=b("ZodXID",(e,t)=>{Es.init(e,t),ee.init(e,t)});var Ud=b("ZodKSUID",(e,t)=>{Ps.init(e,t),ee.init(e,t)});var Bd=b("ZodIPv4",(e,t)=>{Ts.init(e,t),ee.init(e,t)});var Jd=b("ZodIPv6",(e,t)=>{Is.init(e,t),ee.init(e,t)});var Wd=b("ZodCIDRv4",(e,t)=>{Ls.init(e,t),ee.init(e,t)});var Hd=b("ZodCIDRv6",(e,t)=>{Fs.init(e,t),ee.init(e,t)});var Kd=b("ZodBase64",(e,t)=>{Ms.init(e,t),ee.init(e,t)});var qd=b("ZodBase64URL",(e,t)=>{Ds.init(e,t),ee.init(e,t)});var Gd=b("ZodE164",(e,t)=>{js.init(e,t),ee.init(e,t)});var Yd=b("ZodJWT",(e,t)=>{Vs.init(e,t),ee.init(e,t)});var eu=b("ZodNumber",(e,t)=>{wn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bn(e,r,n,o),e.isFinite=!0},Z.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=be(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=be(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=be(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>be(e).format??null},{gt(e,t){return this.check(Sr(e,t))},gte(e,t){return this.check(Ft(e,t))},min(e,t){return this.check(Ft(e,t))},lt(e,t){return this.check($r(e,t))},lte(e,t){return this.check(Lt(e,t))},max(e,t){return this.check(Lt(e,t))},int(e){return this.check(Te(e))},safe(e){return this.check(Te(e))},positive(e){return this.check(Sr(0,e))},nonnegative(e){return this.check(Ft(0,e))},negative(e){return this.check($r(0,e))},nonpositive(e){return this.check(Lt(0,e))},multipleOf(e,t){return this.check(Er(e,t))},step(e,t){return this.check(Er(e,t))},finite(){return this}}));function Oe(e){return qa(eu,e)}var Xd=b("ZodNumberFormat",(e,t)=>{Us.init(e,t),eu.init(e,t)});function Te(e){return Ga(Xd,e)}var Qd=b("ZodBoolean",(e,t)=>{Bs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jn(e,r,n,o)});function Me(e){return Ya(Qd,e)}var ef=b("ZodNull",(e,t)=>{Js.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wn(e,r,n,o)});function tf(e){return Xa(ef,e)}var rf=b("ZodUnknown",(e,t)=>{Ws.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)});function Kc(){return Qa(rf)}var nf=b("ZodNever",(e,t)=>{Hs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o)});function tu(e){return ec(nf,e)}var of=b("ZodArray",(e,t)=>{Bt(),Ks.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qn(e,r,n,o),e.element=t.element},{min(e,t){return this.check(yt(e,t))},nonempty(e){return this.check(yt(1,e))},max(e,t){return this.check(Pr(e,t))},length(e,t){return this.check(Or(e,t))},unwrap(){return this.element}});function se(e,t){return tc(of,e,t)}var ru=b("ZodObject",(e,t)=>{Bt(),Ys.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n,o),Z.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return nt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Z.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:Kc()}))},loose(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:Kc()}))},strict(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:tu()}))},strip(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return Z.extend(this,e)},safeExtend(e){return Z.safeExtend(this,e)},merge(e){return Z.merge(this,e)},pick(e){return Z.pick(this,e)},omit(e){return Z.omit(this,e)},partial(...e){return Z.partial(bo,this,e[0])},exactPartial(...e){return Z.partial(iu,this,e[0],"exactPartial")},required(...e){return Z.required(su,this,e[0])}});function ne(e,t){let r={type:"object",shape:e??{},...Z.normalizeParams(t)};return new ru(r)}function oe(e,t){return new ru({type:"object",shape:e,catchall:tu(),...Z.normalizeParams(t)})}var nu=b("ZodUnion",(e,t)=>{kn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o),e.options=t.options});function He(e,t){return new nu({type:"union",options:e,...Z.normalizeParams(t)})}var sf=b("ZodDiscriminatedUnion",(e,t)=>{nu.init(e,t),Xs.init(e,t)});function Ke(e,t,r){return new sf({type:"union",options:t,discriminator:e,...Z.normalizeParams(r)})}var af=b("ZodIntersection",(e,t)=>{Qs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o)});function cf(e,t){return new af({type:"intersection",left:e,right:t})}var uf=b("ZodTuple",(e,t)=>{Bt(),ea.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new bo({type:"optional",innerType:t}))})}});function ou(e,t,r){let n=t instanceof U,o=n?r:t,i=n?t:null;return new uf({type:"tuple",items:e,rest:i,...Z.normalizeParams(o)})}var qc=b("ZodRecord",(e,t)=>{Bt(),ta.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function _t(e,t,r){return!t||!t._zod?new qc({type:"record",keyType:N(),valueType:e,...Z.normalizeParams(t)}):new qc({type:"record",keyType:e,valueType:t,...Z.normalizeParams(r)})}var go=b("ZodEnum",(e,t)=>{ra.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>qn(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new go({...t,checks:[],...Z.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new go({...t,checks:[],...Z.normalizeParams(o),entries:i})}});function nt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new go({type:"enum",entries:r,...Z.normalizeParams(t)})}var lf=b("ZodLiteral",(e,t)=>{na.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gn(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function L(e,t){return new lf({type:"literal",values:Array.isArray(e)?e:[e],...Z.normalizeParams(t)})}var df=b("ZodTransform",(e,t)=>{Bt(),oa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new bt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Z.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Z.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function ff(e){return new df({type:"transform",transform:e})}var bo=b("ZodOptional",(e,t)=>{zn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new bo({type:"optional",innerType:e})}var iu=b("ZodExactOptional",(e,t)=>{ia.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new iu({type:"optional",innerType:e})}var mf=b("ZodNullable",(e,t)=>{sa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new mf({type:"nullable",innerType:e})}var hf=b("ZodDefault",(e,t)=>{aa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gf(e,t){return new hf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}var bf=b("ZodPrefault",(e,t)=>{ca.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new bf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}var su=b("ZodNonOptional",(e,t)=>{ua.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new su({type:"nonoptional",innerType:e,...Z.normalizeParams(t)})}var vf=b("ZodCatch",(e,t)=>{la.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _f(e,t){return new vf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Z.constantCatch(t)})}var wf=b("ZodPipe",(e,t)=>{da.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.in=t.in,e.out=t.out});function Xc(e,t){return new wf({type:"pipe",in:e,out:t})}var kf=b("ZodReadonly",(e,t)=>{fa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new kf({type:"readonly",innerType:e})}var $f=b("ZodLazy",(e,t)=>{pa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Sf(e){return new $f({type:"lazy",getter:e})}var Ef=b("ZodCustom",(e,t)=>{ma.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o)});function Pf(e,t={}){return rc(Ef,e,t)}function Of(e,t){return nc(e,t)}function au(e){let t=Sf(()=>He([N(e),Oe(),Me(),tf(),se(t),_t(N(),t)]));return t}var Jt=au().meta({id:"JsonValue"});var qe=/^[A-Za-z_][A-Za-z0-9_]*$/,cu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Ir=ne({value:He([N(),Oe()]),label:N()}).strict().meta({id:"Option"}),yo=ne({field:N().min(1),op:nt(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Jt.optional(),valueFrom:N().regex(qe).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ce={label:N(),help:N().optional(),required:Me().optional(),readonly:Me().optional(),default:Jt.optional()},uu=Te().positive().optional(),lu=ou([Te().positive(),Te().nonnegative()]).optional(),xo=N().min(1),du=se(yo).optional(),fu=ne({type:L("char"),...ce,size:uu,pattern:N().optional()}).strict(),pu=ne({type:L("text"),...ce,size:uu}).strict(),mu=ne({type:L("html"),...ce}).strict(),hu=ne({type:L("integer"),...ce,min:Oe().optional(),max:Oe().optional()}).strict(),gu=ne({type:L("float"),...ce,min:Oe().optional(),max:Oe().optional(),digits:lu}).strict(),bu=ne({type:L("monetary"),...ce,currencyField:N().regex(qe).optional(),currency:N().regex(/^[A-Z]{3}$/).optional(),min:Oe().optional(),max:Oe().optional(),digits:lu}).strict(),yu=ne({type:L("boolean"),...ce}).strict(),xu=ne({type:L("date"),...ce}).strict(),vu=ne({type:L("datetime"),...ce}).strict(),_u=ne({type:L("selection"),...ce,options:se(Ir).min(1),multiple:Me().optional()}).strict(),wu=ne({type:L("binary"),...ce,accept:se(N()).optional(),maxSize:Te().positive().optional()}).strict(),ku=ne({type:L("image"),...ce,maxSize:Te().positive().optional()}).strict(),zu=ne({type:L("many2one"),...ce,relation:xo,filter:du}).strict(),$u=ne({type:L("many2many"),...ce,relation:xo,filter:du}).strict(),Su=ne({type:L("reference"),...ce,models:se(Ir).min(1)}).strict(),Eu=ne({type:L("properties"),...ce}).strict(),Pu=ne({type:L("json"),...ce}).strict(),vo=Ke("type",[fu,pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu]).meta({id:"LineField"}),Nf=ne({type:L("one2many"),...ce,relation:xo,fields:_t(N().regex(qe),vo)}).strict(),_o=Ke("type",[fu,pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Nf,Su,Eu,Pu]).meta({id:"Field"}),Lr=_t(N().regex(qe),_o);var Wt=He([Me(),N().min(1)]).meta({id:"Modifier"}),ye=N().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),ot=N().regex(qe),Ou=nt(["info","success","warning","danger","muted"]),Ne=Wt.optional(),Zf=oe({type:L("field"),id:ye,field:ot,label:N().optional(),widget:N().min(1).optional(),placeholder:N().optional(),help:N().optional(),colspan:Te().min(1).max(4).optional(),columns:se(ot).min(1).optional(),invisible:Ne,readonly:Wt.optional(),required:Wt.optional()}),Nu=oe({type:L("button"),id:ye,label:N(),action:N().min(1),params:_t(N(),Jt).optional(),style:nt(["primary","secondary","danger","link"]).optional(),confirm:N().optional(),icon:N().optional(),invisible:Ne}),Af=oe({type:L("text"),id:ye,text:N(),style:nt(["heading","paragraph","note"]).optional(),invisible:Ne}),Zu=oe({type:L("slot"),id:ye,name:N().min(1),invisible:Ne}),Tf=oe({type:L("section"),id:ye,title:N().optional(),description:N().optional(),columns:He([L(1),L(2),L(3),L(4)]).optional(),collapsible:Me().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"SectionNode"}),Rf=oe({type:L("tab"),id:ye,label:N(),icon:N().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"TabNode"}),Au=oe({type:L("tabs"),id:ye,invisible:Ne,children:se(Rf).min(1)}).meta({id:"TabsNode"}),it=Ke("type",[Zf,Nu,Af,Zu,Tf,Au]).meta({id:"LayoutNode"}),If=oe({type:L("step"),id:ye,label:N(),description:N().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"StepNode"}),Lf=oe({type:L("wizard"),id:ye,children:se(If).min(1)}).meta({id:"WizardNode"}),Ff=oe({type:L("sections"),id:ye,get children(){return se(it)}}).meta({id:"SectionsNode"}),Cf=oe({id:ye,label:N(),action:N().min(1),field:ot.optional(),icon:N().optional(),invisible:Ne}),Mf=oe({id:ye,label:N(),tone:Ou.optional(),invisible:Ne}),Df=oe({id:ye,message:N(),tone:Ou.optional(),invisible:Ne}),jf=oe({type:L("sheet"),id:ye,title:oe({field:ot,subtitleField:ot.optional(),avatarField:ot.optional(),placeholder:N().optional()}).optional(),statusbar:oe({field:ot,visibleStates:se(He([N(),Oe()])).optional(),clickable:Me().optional()}).optional(),buttons:se(Nu).optional(),statButtons:se(Cf).optional(),ribbon:Mf.optional(),alerts:se(Df).optional(),get children(){return se(it)},sidePanel:Zu.optional()}).meta({id:"SheetNode"}),Fr=Ke("type",[jf,Ff,Au,Lf]).meta({id:"RootLayout"});var wo="0.1",Vf=Ke("kind",[oe({kind:L("record"),model:N().min(1)}),oe({kind:L("responses")})]),wt=oe({fieldia:L(wo),id:N().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:N().optional(),description:N().optional(),data:Vf,fields:Lr,layout:Fr}).meta({title:"Fieldia page",description:"A form, survey or record screen as data. This schema checks shape; validatePage() also checks that every reference resolves."});function st(e,t){switch(e.type){case"BinaryOp":return Uf(e,t);case"UnaryOp":return Bf(e,t);case"Literal":return e.value;case"Identifier":return Jf(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Uf(e,t){let r=Tu(st(e.left,t)),n=Tu(st(e.right,t)),o=e.operator.toLowerCase(),i=r!==null&&n!==null;switch(o){case"==":return r===n;case"!=":case"<>":return r!==n;case"<":return i&&r<n;case">":return i&&r>n;case"<=":return i&&r<=n;case">=":return i&&r>=n;case"in":return Array.isArray(n)&&n.includes(r);case"not in":return Array.isArray(n)&&!n.includes(r);case"and":return De(r)&&De(n);case"or":return De(r)||De(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function Bf(e,t){let r=st(e.operand,t);if(e.operator.toLowerCase()==="not")return!De(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Tu(e){return e===void 0?null:e}function De(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Jf(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var ko=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Ht(e){let t=[];if(!e)return t;let r=/(\(|\)|==|!=|<=|>=|<>|<|>|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|-?\d+\.?\d*|\w+(?:\.\w+)*)/iy,n=/\s*/y,o=0;for(;;){if(n.lastIndex=o,n.exec(e),o=n.lastIndex,o>=e.length)return t;r.lastIndex=o;let i=r.exec(e);if(!i)throw new Error(`Unexpected "${e[o]}" at character ${o+1} of: ${e}`);t.push({type:Wf(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function Wf(e){let t=e.toLowerCase().trim();return ko.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^-?\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var at=class{constructor(t){Qe(this,"tokens");Qe(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let r=this.previous().value,n=this.parseAnd();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let r=this.previous().value,n=this.parseNot();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,r=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:r}}return this.parseComparison()}parseComparison(){let t=this.parseValue(),r=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...r)){let n=this.previous().value,o=this.parseValue();return{type:"BinaryOp",operator:n.toLowerCase(),left:t,right:o}}return t}parseValue(){if(this.match("PAREN","(")){let t=this.parseOr();return this.consume("PAREN",")","Expected closing parenthesis"),t}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:ko.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:Hf(t.value)}}if(this.check("IDENTIFIER"))return{type:"Identifier",name:this.advance().value};throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...r){if(this.check(t)){if(r.length===0)return this.advance(),!0;let n=this.peek();if(n&&r.includes(n.value))return this.advance(),!0}return!1}matchLogical(...t){let r=this.peek();if(r&&r.type==="LOGICAL"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}matchOperator(...t){let r=this.peek();if(r&&r.type==="OPERATOR"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,r,n){if(this.check(t)){let o=this.peek();if(o&&o.value===r)return this.advance()}throw new Error(n)}};function Hf(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let r=[],n="",o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];(a==="'"||a==='"')&&(s===0||t[s-1]!=="\\")&&(o?a===i&&(o=!1,i=""):(o=!0,i=a)),a===","&&!o?(r.push(Ru(n.trim())),n=""):n+=a}return n.trim()&&r.push(Ru(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Ru(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function Ge(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new at(Ht(e)).parse();return{source:e,fields:Kf(t),evaluate(r){try{return De(st(t,r))}catch{return!1}}}}function Kf(e){let t=[],r=n=>{switch(n.type){case"Identifier":{let o=n.name.split(".")[0];t.includes(o)||t.push(o);return}case"BinaryOp":r(n.left),r(n.right);return;case"UnaryOp":r(n.operand);return;default:return}};return r(e),t}function Cr(e){let t=wt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:qf(o.path),message:Gf(o)}))};let r=t.data,n=new $o(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function qf(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Gf(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var zo=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$o=class{constructor(t){Qe(this,"page",t);Qe(this,"issues",[]);Qe(this,"ids",new Map)}run(){return this.checkFields(this.page.fields,"fields"),this.walkRoot(this.page.layout,"layout"),this.issues}report(t,r){this.issues.push({path:t,message:r})}claim(t,r){let n=this.ids.get(t);n!==void 0?this.report(r,`duplicate id "${t}", also used at ${n}`):this.ids.set(t,r)}need(t,r,n=this.page.fields){if(zo(n,t))return n[t];this.report(r,`no field "${t}"`)}checkModifiers(t,r,n=["invisible"]){for(let o of n){let i=t[o];if(typeof i!="string")continue;let s;try{s=Ge(i).fields}catch(a){this.report(`${r}.${o}`,`cannot read "${i}": ${a.message}`);continue}for(let a of s)zo(this.page.fields,a)||this.report(`${r}.${o}`,`"${i}" reads "${a}", which is not a field of this page`)}}checkFields(t,r){for(let[n,o]of Object.entries(t)){let i=`${r}.${n}`;if(o.type==="monetary"&&o.currencyField!==void 0){let s=this.need(o.currencyField,`${i}.currencyField`,t);s&&!["many2one","selection","char"].includes(s.type)&&this.report(`${i}.currencyField`,`"${o.currencyField}" is a ${s.type}; a currency field must be a many2one, selection or char`)}(o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,a)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${a}].valueFrom`,t)}),o.type==="one2many"&&this.checkFields(o.fields,`${i}.fields`)}}walkRoot(t,r){if(t.type==="tabs")return this.walkNode(t,r);if(this.claim(t.id,r),t.type==="sheet")return this.walkSheet(t,r);if(t.type==="sections")return this.walkChildren(t.children,r);t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkChildren(t,r){t.forEach((n,o)=>this.walkNode(n,`${r}.children[${o}]`))}walkNode(t,r){switch(this.claim(t.id,r),this.checkModifiers(t,r,t.type==="field"?["invisible","readonly","required"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,r);case"section":return this.walkChildren(t.children,r);case"tabs":return this.walkTabs(t,r);default:return}}walkTabs(t,r){t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkSheet(t,r){if(t.title&&(this.need(t.title.field,`${r}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${r}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${r}.title.avatarField`)),t.statusbar){let{field:n,visibleStates:o}=t.statusbar,i=this.need(n,`${r}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${r}.statusbar.field`,`"${n}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&o){let s=new Set(i.options.map(a=>a.value));o.forEach((a,c)=>{s.has(a)||this.report(`${r}.statusbar.visibleStates[${c}]`,`"${a}" is not an option of "${n}"`)})}}t.buttons?.forEach((n,o)=>{this.claim(n.id,`${r}.buttons[${o}]`),this.checkModifiers(n,`${r}.buttons[${o}]`)}),t.statButtons?.forEach((n,o)=>{this.claim(n.id,`${r}.statButtons[${o}]`),this.checkModifiers(n,`${r}.statButtons[${o}]`),n.field!==void 0&&this.need(n.field,`${r}.statButtons[${o}].field`)}),t.ribbon&&(this.claim(t.ribbon.id,`${r}.ribbon`),this.checkModifiers(t.ribbon,`${r}.ribbon`)),t.alerts?.forEach((n,o)=>{this.claim(n.id,`${r}.alerts[${o}]`),this.checkModifiers(n,`${r}.alerts[${o}]`)}),this.walkChildren(t.children,r),t.sidePanel&&(this.claim(t.sidePanel.id,`${r}.sidePanel`),this.checkModifiers(t.sidePanel,`${r}.sidePanel`))}checkFieldNode(t,r){let n=this.need(t.field,`${r}.field`);!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{zo(n.fields,o)||this.report(`${r}.columns[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}):n.type!=="many2many"&&this.report(`${r}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${n.type}`))}};function Iu(){return ho(wt,{target:"draft-2020-12"})}function Lu(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let r=Ht(e);if(r.length===0)return!1;let o=new at(r).parse(),i=st(o,t);return De(i)}catch{return!1}}function Fu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Ht(e);return t.length===0||new at(t).parse(),!0}catch{return!1}}function So(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function kt(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?q(n.default):So(n);return t}function Mr(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Kt(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?Yf(i,o):o}return r}function Yf(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(r=>r.id);case"one2many":return t.map(r=>r.key);case"reference":{let r=t;return`${r.model},${r.id}`}case"binary":case"image":return t.name;default:return t}}function q(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var Ye={en:{required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",or:"or"},ar:{required:"{label} \u0645\u0637\u0644\u0648\u0628",maxLength:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627",pattern:"\u0635\u064A\u063A\u0629 {label} \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629",text:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0635\u064B\u0627",number:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627",integer:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",min:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 {label} \u0639\u0646 {min}",max:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F {label} \u0639\u0646 {max}",decimals:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {digits} \u0645\u0646\u0627\u0632\u0644 \u0639\u0634\u0631\u064A\u0629",boolean:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627",dateFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DD)",dateInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D (\u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u0644\u0634\u0647\u0631 \u0648\u0627\u0644\u064A\u0648\u0645)",datetimeFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u064A\u0646",choice:"\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0642\u064A\u0645\u0629 \u0648\u0627\u062D\u062F\u0629 \u0645\u0646: {options}",choices:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A",record:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0633\u062C\u0644\u064B\u0627",records:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0633\u062C\u0644\u0627\u062A",reference:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0634\u064A\u0631 {label} \u0625\u0644\u0649 {models}",file:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641\u064B\u0627",fileSize:"\u062D\u062C\u0645 {label} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}",fileType:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641 {types}",or:"\u0623\u0648"},de:{required:"{label} ist erforderlich",maxLength:"Maximal {max} Zeichen erlaubt",pattern:"{label} hat nicht das erwartete Format",text:"{label} muss Text sein",number:"{label} muss eine Zahl sein",integer:"{label} muss eine ganze Zahl sein",min:"{label} muss mindestens {min} sein",max:"{label} darf h\xF6chstens {max} sein",decimals:"Maximal {digits} Nachkommastellen erlaubt",boolean:"{label} muss ja oder nein sein",dateFormat:"Ung\xFCltiges Datumsformat (erwartet JJJJ-MM-TT)",dateInvalid:"Ung\xFCltiges Datum (Monat und Tag pr\xFCfen)",datetimeFormat:"Ung\xFCltiges Datums- und Zeitformat (erwartet JJJJ-MM-TTTHH:MM:SS)",datetimeInvalid:"Ung\xFCltiges Datum oder ung\xFCltige Uhrzeit",choice:"Muss eines davon sein: {options}",choices:"{label} muss eine Liste von Optionen sein",record:"{label} muss ein Datensatz sein",records:"{label} muss eine Liste von Datens\xE4tzen sein",reference:"{label} muss auf {models} verweisen",file:"{label} muss eine Datei sein",fileSize:"{label} ist gr\xF6\xDFer als {size}",fileType:"{label} muss eine {types}-Datei sein",or:"oder"},fr:{required:"{label} est obligatoire",maxLength:"{max} caract\xE8res au maximum",pattern:"{label} n'a pas le format attendu",text:"{label} doit \xEAtre du texte",number:"{label} doit \xEAtre un nombre",integer:"{label} doit \xEAtre un nombre entier",min:"{label} doit \xEAtre au moins {min}",max:"{label} doit \xEAtre au plus {max}",decimals:"{digits} d\xE9cimales au maximum",boolean:"{label} doit \xEAtre oui ou non",dateFormat:"Format de date invalide (attendu AAAA-MM-JJ)",dateInvalid:"Date invalide (v\xE9rifiez le mois et le jour)",datetimeFormat:"Format de date et heure invalide (attendu AAAA-MM-JJTHH:MM:SS)",datetimeInvalid:"Date ou heure invalide",choice:"Doit \xEAtre parmi : {options}",choices:"{label} doit \xEAtre une liste de choix",record:"{label} doit \xEAtre un enregistrement",records:"{label} doit \xEAtre une liste d'enregistrements",reference:"{label} doit pointer vers {models}",file:"{label} doit \xEAtre un fichier",fileSize:"{label} d\xE9passe {size}",fileType:"{label} doit \xEAtre un fichier {types}",or:"ou"}};function Dr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function qt(e,t,r,n=Ye.en){let o=e.label||"This field",i=(s,a={})=>Dr(n[s],{label:o,...a});if(Mr(e,t))return r?i("required"):void 0;switch(e.type){case"char":case"text":case"html":return typeof t!="string"?i("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?i("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?i("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?i("number"):e.type==="integer"&&!Number.isInteger(t)?i("integer"):e.min!==void 0&&t<e.min?i("min",{min:e.min}):e.max!==void 0&&t>e.max?i("max",{max:e.max}):e.type!=="integer"&&e.digits&&Xf(t)>e.digits[1]?i("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:i("boolean");case"date":return Qf(t,i);case"datetime":return tp(t,i);case"selection":{let s=new Set(e.options.map(c=>c.value)),a=i("choice",{options:e.options.map(c=>c.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(c=>s.has(c))?void 0:a:i("choices"):s.has(t)?void 0:a}case"many2one":return Eo(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Eo)?void 0:i("records");case"reference":{let s=t;if(!Eo(t)||typeof s.model!="string")return i("record");if(!e.models.some(a=>a.value===s.model)){let a=Mu(e.models.map(c=>c.label),n.or);return i("reference",{models:a,aModels:Du(a)})}return}case"binary":case"image":return rp(e,t,i,n);default:return}}function Xf(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let r=t.indexOf(".");return r===-1?0:t.length-r-1}function Eo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function Qf(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[r,n,o]=e.split("-").map(Number);return Cu(r,n,o)?void 0:t("dateInvalid")}var ep=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function tp(e,t){let r=typeof e=="string"?ep.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,a,c]=r.slice(1).map(u=>Number(u??0));return Cu(n,o,i)&&s<24&&a<60&&c<60?void 0:t("datetimeInvalid")}function Cu(e,t,r){if(t<1||t>12||r<1)return!1;let n=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return r<=n[t-1]}function rp(e,t,r,n){let o=t;if(!np(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:Gt(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>op(i,o.type))){let i=Mu(e.accept.map(ip),n.or);return r("fileType",{types:i,aTypes:Du(i)})}}function np(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function op(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function ip(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Mu(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function Du(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function Gt(e){let t=["bytes","KB","MB","GB"],r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${Number(r.toFixed(1))} ${t[n]}`}var Yt={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function jr(e,t=Yt){return new Promise(r=>{t.setTimeout(r,e)})}function ju(e={}){let t=q(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?jr(e.delayMs,e.scheduler):Promise.resolve(),s=d=>t[d]??(t[d]={}),a=(d,h)=>{let x=s(d)[String(h)]?.[e.labelField?.[d]??"name"];return typeof x=="string"?x:String(h)},c=d=>Math.max(0,...Object.keys(s(d)).map(Number).filter(Number.isFinite))+1,u=d=>Number.isFinite(Number(d))?Number(d):d;function l(d,h){let x=[...d];for(let f of h)f.op==="create"?x.push({key:f.key,id:++o,values:q(f.values)}):f.op==="update"?x=x.map(v=>v.id===f.id?{...v,values:{...v.values,...q(f.values)}}:v):x=x.filter(v=>v.id!==f.id);return x}function p(d,h,x){let f=[...d],v=P=>({id:P,label:a(x,P)});for(let P of h)P.op==="link"&&!f.some(D=>D.id===P.id)?f.push(v(P.id)):P.op==="unlink"?f=f.filter(D=>D.id!==P.id):P.op==="set"?f=P.ids.map(v):P.op==="clear"&&(f=[]);return f}function m(d,h){let x=d[h];return x&&"relation"in x?x.relation:h}return{records:t,responses:r,calls:n,async load(d){n.push({method:"load",request:d}),await i();let h=s(d.model)[String(d.id)];if(!h)throw new Error(`No ${d.model} record with id ${d.id}`);return q(h)},async save(d){n.push({method:"save",request:d}),await i();let h=d.id??c(d.model),x={...s(d.model)[String(h)]??{},...q(d.changes.values)};for(let[f,v]of Object.entries(d.changes.lines))x[f]=l(x[f]??[],v);for(let[f,v]of Object.entries(d.changes.links))x[f]=p(x[f]??[],v,m(d.fields,f));return s(d.model)[String(h)]=x,{id:h,values:q(x)}},async onchange(d){n.push({method:"onchange",request:d}),await i();let h=e.onchange?.[d.model]?.[d.changed];return h?{values:h(q(d.values))}:{}},async search(d){n.push({method:"search",request:d}),await i();let h=d.query.trim().toLowerCase();return Object.entries(s(d.model)).filter(([,x])=>(d.filter??[]).every(f=>sp(x,f))).map(([x])=>({id:u(x),label:a(d.model,u(x))})).filter(x=>x.label.toLowerCase().includes(h)).slice(0,d.limit??8)},async submit(d){return n.push({method:"submit",request:d}),await i(),r.push(q(d)),{id:r.length}}}}function sp(e,t){let r=e[t.field],n=r!==null&&typeof r=="object"&&"id"in r?r.id:r,o=t.value;switch(t.op){case"=":return n===o;case"!=":return n!==o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;case"in":return Array.isArray(o)&&o.includes(n);case"not in":return Array.isArray(o)&&!o.includes(n);case"like":return String(n??"").includes(String(o));case"ilike":return String(n??"").toLowerCase().includes(String(o).toLowerCase())}}function Vr(e){let{page:t}=e,r=e.scheduler??Yt,n=e.messages??Ye.en,o=up(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(y=>y.id):[],s=()=>`fieldia:draft:${t.id}:${c.recordId??"new"}`,a={...kt(t.fields),...q(e.values??{})},c={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:q(a),errors:{},dirty:[],warning:null,error:null,draft:null,step:i[0]??null},u=0,l=0,p=null,m=null,d=new Set,h=new Set,x=null;function f(y){c={...c,...y};for(let _ of[...h])_(c)}function v(y){d.add(y);let _=()=>d.delete(y);return y.then(_,_),y}function P(){return x?.values!==c.values&&(x={values:c.values,context:Kt(c.values,t.fields)}),x.context}function D(y){let _=t.fields[y];if(!_)throw new Error(`The page has no field "${y}"`);return _}function S(y){return Object.keys(t.fields).filter(_=>JSON.stringify(y[_]??null)!==JSON.stringify(a[_]??null))}function w(y){let _=o.get(y);if(!_)throw new Error(`The page has no element "${y}"`);let k=P(),T=_.invisible.evaluate(k);for(let G=_.parent;!T&&G;G=o.get(G)?.parent??null)T=o.get(G)?.invisible.evaluate(k)??!1;let M=_.field?t.fields[_.field]:void 0;return{invisible:T,readonly:_.readonly.evaluate(k)||M?.readonly===!0,required:_.required.evaluate(k)||M?.required===!0}}function z(y){let _=k=>{if(!y)return!0;for(let T=k.id;T;T=o.get(T)?.parent??null)if(T===y)return!0;return!1};return[...o.values()].filter(k=>k.kind==="field"&&_(k)&&!w(k.id).invisible)}function B(y){let _={};for(let k of z(y)){let T=k.field;if(_[T])continue;let M=t.fields[T],G=qt(M,c.values[T],w(k.id).required,n);if(G&&(_[T]=G),M.type==="one2many")for(let de of c.values[T]??[])for(let[Ae,ze]of Object.entries(M.fields)){let lt=qt(ze,de.values[Ae],ze.required===!0,n);lt&&(_[`${T}.${de.key}.${Ae}`]=lt)}}return _}function te(y,_={}){let k=Object.keys(c.errors).length?re(y):c.errors;f({values:y,dirty:S(y),errors:k,..._})}function re(y){let _=c;c={...c,values:y};let k=B(c.step??void 0);c=_;let T={};for(let M of Object.keys(c.errors))k[M]&&(T[M]=k[M]);return T}function ie(){let y=e.drafts;y&&(p!==null&&r.clearTimeout(p),p=r.setTimeout(()=>{p=null,y.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:c.values}))},y.delayMs??400))}function V(){p!==null&&r.clearTimeout(p),p=null,e.drafts?.store.removeItem(s())}function Q(){let y=e.drafts;if(!y)return;let _=y.store.getItem(s());if(!_)return;let k;try{k=JSON.parse(_)}catch{y.store.removeItem(s());return}y.restore==="auto"?te({...c.values,...k.values},{draft:null}):f({draft:{savedAt:k.savedAt}})}function he(){let y=e.autosave;!y||t.data.kind!=="record"||(m!==null&&r.clearTimeout(m),m=r.setTimeout(()=>{m=null,c.dirty.length&&Object.keys(B()).length===0&&v(ke())},y.delayMs))}function ct(y){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let k=++l,T={model:t.data.model,id:c.recordId,changed:y,values:q(c.values)};v(_.onchange(T).then(M=>{if(k!==l)return;let G={...c.values,...M.values??{}};te(G,{warning:M.warning??null})},()=>{}))}function Ze(y){ie(),he(),ct(y)}function Ve(){let y={values:{},lines:{},links:{}};for(let _ of c.dirty){let k=t.fields[_],T=c.values[_],M=a[_];k.type==="one2many"?y.lines[_]=ap(M??[],T??[]):k.type==="many2many"?y.links[_]=cp(M??[],T??[]):y.values[_]=q(T)}return y}function Re(){let y={};for(let _ of z()){let k=_.field;y[k]=q(c.values[k])}return y}async function ke(){let y=B();if(Object.keys(y).length)return f({errors:y}),!1;let _=e.dataSource;f({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!_?.submit)throw new Error("This page has no data source to send its answers to");return await _.submit({pageId:t.id,values:Re()}),V(),f({status:"saved"}),!0}if(!_?.save)throw new Error("This page has no data source to save to");let k=await _.save({model:t.data.model,id:c.recordId,fields:t.fields,changes:Ve(),values:q(c.values)});V();let T=k.values?{...c.values,...k.values}:c.values;return a=q(T),f({status:"saved",recordId:k.id,values:T,dirty:[]}),!0}catch(k){return f({status:"error",error:k.message}),!1}}async function zt(y,_,k,T,M,G){if(y.type!=="many2one"&&y.type!=="many2many"&&y.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(y.type==="reference"&&!G)throw new Error(`Searching "${_}" needs a model`);let de=e.dataSource;if(!de?.search)return[];let Ae=y.type==="reference"?void 0:y.filter?.map(({field:lt,op:g,value:$,valueFrom:I})=>({field:lt,op:g,value:I!==void 0?k[I]??null:$??null})),ze=y.type==="reference"?G:y.relation;return v(de.search({model:ze,query:T,...Ae?{filter:Ae}:{},limit:M}))}function Ie(y){let _=D(y);if(_.type!=="one2many")throw new Error(`"${y}" is a ${_.type}, not a one2many`);return _}function $t(){return c.step?i.indexOf(c.step):-1}async function Wr(){let y=e.dataSource;if(!(c.recordId==null||t.data.kind!=="record")){if(!y?.load){f({status:"error",error:"This page has no data source to load from"});return}f({status:"loading",error:null});try{let _=await y.load({model:t.data.model,id:c.recordId,fields:t.fields});a={...kt(t.fields),..._},f({status:"ready",values:q(a),dirty:[],errors:{}}),Q()}catch(_){f({status:"error",error:_.message})}}}let ut={page:t,getState:()=>c,subscribe(y){return h.add(y),()=>h.delete(y)},load:()=>v(Wr()),setValue(y,_){D(y),te({...c.values,[y]:q(_)}),Ze(y)},node:w,fieldReadonly:y=>D(y).readonly===!0,validate(){let y=B();return f({errors:y}),Object.keys(y).length===0},save:()=>v(ke()),reset(){V(),f({values:q(a),dirty:[],errors:{},warning:null,draft:null,step:i[0]??null})},changes:Ve,addLine(y,_={}){let k=Ie(y),T=`new-${++u}`,M={key:T,values:{...kt(k.fields),...q(_)}},G=[...c.values[y]??[],M];return te({...c.values,[y]:G}),Ze(y),T},updateLine(y,_,k,T){if(!Ie(y).fields[k])throw new Error(`The lines of "${y}" have no field "${k}"`);let G=(c.values[y]??[]).map(de=>de.key===_?{...de,values:{...de.values,[k]:q(T)}}:de);te({...c.values,[y]:G}),Ze(y)},removeLine(y,_){Ie(y);let k=(c.values[y]??[]).filter(T=>T.key!==_);te({...c.values,[y]:k}),Ze(y)},async search(y,_,k=8,T={}){return zt(D(y),y,P(),_,k,T.model)},async searchLine(y,_,k,T,M=8){let G=Ie(y),de=G.fields[k];if(!de)throw new Error(`The lines of "${y}" have no field "${k}"`);let Ae=(c.values[y]??[]).find(ze=>ze.key===_);if(!Ae)throw new Error(`"${y}" has no line "${_}"`);return zt(de,k,Kt(Ae.values,G.fields),T,M)},steps:()=>i.filter(y=>!w(y).invisible),next(){if(!c.step)return!1;let y=B(c.step);if(Object.keys(y).length)return f({errors:y}),!1;let _=ut.steps(),k=i.slice($t()+1).find(T=>_.includes(T));return k?(f({step:k,errors:{}}),!0):!1},back(){if(!c.step)return!1;let y=ut.steps(),_=i.slice(0,$t()).reverse().find(k=>y.includes(k));return _?(f({step:_,errors:{}}),!0):!1},async runAction(y){let _=o.get(y);if(!_||_.kind!=="button"&&_.kind!=="stat")throw new Error(`The page has no button "${y}"`);if(w(y).invisible)return;let k=_.source;await v(Promise.resolve(e.onAction?.({id:y,action:k.action,..."params"in k&&k.params?{params:k.params}:{},recordId:c.recordId,values:q(c.values)})))},restoreDraft(){let y=e.drafts?.store.getItem(s());if(!y)return;let _=JSON.parse(y);te({...c.values,..._.values},{draft:null})},discardDraft(){V(),f({draft:null})},async settled(){for(;d.size;)await Promise.allSettled([...d])},dispose(){p!==null&&r.clearTimeout(p),m!==null&&r.clearTimeout(m),h.clear()}};return c.recordId==null&&Q(),ut}function ap(e,t){let r=[],n=new Map(e.filter(i=>i.id!==void 0).map(i=>[i.key,i]));for(let i of t){let s=n.get(i.key);if(i.id===void 0||!s){r.push({op:"create",key:i.key,values:q(i.values)});continue}let a={};for(let[c,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[c])&&(a[c]=q(u));Object.keys(a).length&&r.push({op:"update",id:i.id,values:a})}let o=new Set(t.map(i=>i.key));for(let i of e)i.id!==void 0&&!o.has(i.key)&&r.push({op:"delete",id:i.id});return r}function cp(e,t){let r=new Set(e.map(o=>o.id)),n=new Set(t.map(o=>o.id));return[...t.filter(o=>!r.has(o.id)).map(o=>({op:"link",id:o.id})),...e.filter(o=>!n.has(o.id)).map(o=>({op:"unlink",id:o.id}))]}function up(e){let t=new Map,r=(o,i,s,a)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:a.field,invisible:Ge(a.invisible),readonly:Ge(a.readonly),required:Ge(a.required),source:o})},n=(o,i)=>{for(let s of o)if(s.type==="field")r(s,i,"field",{invisible:s.invisible,readonly:s.readonly,required:s.required,field:s.field});else if(s.type==="button")r(s,i,"button",{invisible:s.invisible});else if(s.type==="tabs"){r(s,i,"other",{invisible:s.invisible});for(let a of s.children)r(a,s.id,"other",{invisible:a.invisible}),n(a.children,a.id)}else r(s,i,"other",{invisible:s.invisible}),s.type==="section"&&n(s.children,s.id)};if(e.type==="tabs")return n([e],""),t.get(e.id).parent=null,t;if(r(e,null,"other",{}),e.type==="wizard")for(let o of e.children)r(o,e.id,"step",{invisible:o.invisible}),n(o.children,o.id);else if(e.type==="sections")n(e.children,e.id);else{let o=(i,s)=>{s&&r({id:i},e.id,"field",{field:s})};o("#title",e.title?.field),o("#subtitle",e.title?.subtitleField),o("#avatar",e.title?.avatarField),o("#statusbar",e.statusbar?.field);for(let i of e.buttons??[])r(i,e.id,"button",{invisible:i.invisible});for(let i of e.statButtons??[])r(i,e.id,"stat",{invisible:i.invisible});e.ribbon&&r(e.ribbon,e.id,"other",{invisible:e.ribbon.invisible});for(let i of e.alerts??[])r(i,e.id,"other",{invisible:i.invisible});n(e.children,e.id),e.sidePanel&&r(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible})}return t}var we={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",deleteLine:"Delete line",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",deleteLine:"Supprimer la ligne",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var lp=180;function Vu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function Po(e){let{document:t,id:r,labels:n}=e,o=`${r}-list`,i=t.createElement("input");Object.assign(i,{id:r,className:"fd-input fd-combo-input",autocomplete:"off"}),i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",o),i.placeholder=n.search;let s=t.createElement("ul");s.id=o,s.className="fd-listbox",s.setAttribute("role","listbox"),s.hidden=!0;let a=t.createElement("div");a.className="fd-combo",a.append(i,s);let c="",u=!1,l=[],p=-1,m=0,d,h=!1;function x(){if(s.replaceChildren(),l.forEach((S,w)=>{let z=t.createElement("li");z.id=`${o}-${w}`,z.setAttribute("role","option"),z.setAttribute("aria-selected",String(w===p)),z.className=w===p?"fd-option fd-active":"fd-option",z.textContent=S.label,z.addEventListener("mousedown",B=>B.preventDefault()),z.addEventListener("click",()=>P(w)),s.append(z)}),!l.length){let S=t.createElement("li");S.className="fd-empty",S.textContent=n.noResults,s.append(S)}p>=0?i.setAttribute("aria-activedescendant",`${o}-${p}`):i.removeAttribute("aria-activedescendant")}function f(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function v(){s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),p=-1}function P(S){let w=l[S];w&&(v(),u=!1,e.pick(w))}function D(S){clearTimeout(d);let w=++m;d=setTimeout(async()=>{let z=await e.search(S).catch(()=>[]);if(w!==m||t.activeElement!==i)return;let B=e.exclude?.()??new Set;l=z.filter(te=>!B.has(te.id)),p=-1,x(),f()},lp)}return i.addEventListener("input",()=>{u=!0,h||D(i.value)}),i.addEventListener("focus",()=>{h||D("")}),i.addEventListener("keydown",S=>{if(!h)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return D(i.value);if(!l.length)return;p=(p+(S.key==="ArrowDown"?1:-1)+l.length)%l.length,x(),s.children[p]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&p>=0&&(S.preventDefault(),P(p));return;case"Escape":s.hidden||S.preventDefault(),v(),u=!1,i.value=c;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{m++,clearTimeout(d),v();let S=u&&i.value.trim()===""&&c!=="";u=!1,S?e.onCommitEmpty?.():i.value=c}),{element:a,input:i,setText(S){c=S,u||(i.value=S)},setReadonly(S){h=S,i.readOnly=S,S&&v()},close:v}}var Oo=({form:e,name:t,field:r,id:n,document:o,labels:i=we.en})=>{let s=Po({document:o,id:n,labels:i,search:c=>e.search(t,c),pick:c=>e.setValue(t,c),onCommitEmpty:()=>e.setValue(t,null)}),a=o.createElement("button");return a.type="button",a.className="fd-combo-clear",a.textContent="\xD7",a.setAttribute("aria-label",Vu(i.clear,{label:r.label})),a.addEventListener("click",()=>{e.setValue(t,null),s.input.focus()}),s.element.append(a),{element:s.element,focus:()=>s.input.focus(),update(c){let u=c.value;s.setText(u?.label??""),s.setReadonly(c.readonly),a.hidden=!u||c.readonly,s.input.setAttribute("aria-invalid",String(c.invalid)),s.input.setAttribute("aria-required",String(c.required)),c.describedBy&&s.input.setAttribute("aria-describedby",c.describedBy)}}},Ur=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=()=>e.getState().values[t]??[],s=n.createElement("div");s.className="fd-tags",s.setAttribute("role","group");let a=n.createElement("ul");a.className="fd-chips";let c=Po({document:n,id:r,labels:o,search:p=>e.search(t,p),pick:p=>{e.setValue(t,[...i(),p]),c.input.value=""},exclude:()=>new Set(i().map(p=>p.id)),onEmptyBackspace:()=>{let p=i();p.length&&e.setValue(t,p.slice(0,-1))}});s.append(a,c.element);let u=!1,l="";return{element:s,focus:()=>c.input.focus(),update(p){let m=p.value??[],d=JSON.stringify([p.readonly,m]);u=p.readonly,c.setReadonly(u),c.element.hidden=u,c.input.setAttribute("aria-invalid",String(p.invalid)),p.describedBy&&c.input.setAttribute("aria-describedby",p.describedBy),d!==l&&(l=d,a.replaceChildren(...m.map(h=>{let x=n.createElement("li");x.className="fd-chip";let f=n.createElement("span");if(f.className="fd-chip-label",f.textContent=h.label,x.append(f),!u){let v=n.createElement("button");v.type="button",v.className="fd-chip-remove",v.textContent="\xD7",v.setAttribute("aria-label",Vu(o.remove,{name:h.label})),v.addEventListener("click",()=>e.setValue(t,i().filter(P=>P.id!==h.id))),x.append(v)}return x})),c.setText(""))}}},No=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-choices fd-choices-checkbox",o.setAttribute("role","group");let i=[],s={readonly:!1,value:[]},a=()=>{let c=new Set(s.value.map(u=>u.id));for(let{record:u,box:l}of i)l.checked=c.has(u.id),l.disabled=s.readonly};return e.search(t,"",50).then(c=>{i=c.map((u,l)=>{let p=n.createElement("input");p.type="checkbox",p.id=`${r}-${l}`,p.addEventListener("change",()=>{let h=e.getState().values[t]??[];e.setValue(t,p.checked?[...h,u]:h.filter(x=>x.id!==u.id))});let m=n.createElement("label");m.className="fd-choice",m.htmlFor=p.id;let d=n.createElement("span");return d.textContent=u.label,m.append(p,d),o.append(m),{record:u,box:p}}),a()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(c){s={readonly:c.readonly,value:c.value??[]},a()}}},Zo=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=we.en}=e,a=n.type==="reference"?n.models:[],c=i.createElement("div");c.className="fd-reference";let u=i.createElement("select");u.className="fd-input fd-select",u.setAttribute("aria-label",n.label),u.append(i.createElement("option"));for(let m of a){let d=i.createElement("option");d.value=String(m.value),d.textContent=m.label,u.append(d)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let p=Po({document:i,id:o,labels:s,search:m=>l?t.search(r,m,8,{model:l}):Promise.resolve([]),pick:m=>t.setValue(r,{model:l,id:m.id,label:m.label}),onCommitEmpty:()=>t.setValue(r,null)});return c.append(u,p.element),{element:c,focus:()=>l?p.input.focus():u.focus(),update(m){let d=m.value;d&&(l=d.model),u.value=l,u.disabled=m.readonly,p.setText(d?.label??""),p.setReadonly(m.readonly||!l)}}};function dp(e,t,r){let n=()=>(e.getState().values[t]??[]).find(o=>o.key===r)?.values??{};return{...e,getState:()=>({...e.getState(),values:n()}),setValue:(o,i)=>e.updateLine(t,r,o,i),search:(o,i,s)=>e.searchLine(t,r,o,i,s)}}var Ao=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=we.en})=>{let a=r,c=(n.columns??Object.keys(a.fields)).filter(w=>a.fields[w]),u=i.createElement("div");u.className="fd-lines",u.id=o,u.setAttribute("role","group");let l=i.createElement("div");l.className="fd-lines-scroll";let p=i.createElement("table");p.className="fd-lines-table";let m=i.createElement("thead"),d=i.createElement("tr");for(let w of c){let z=i.createElement("th");z.scope="col",z.textContent=a.fields[w].label,d.append(z)}let h=i.createElement("th");h.className="fd-lines-tools",d.append(h),m.append(d);let x=i.createElement("tbody");p.append(m,x),l.append(p);let f=i.createElement("button");f.type="button",f.className="fd-button fd-button-link fd-lines-add",f.textContent=`+ ${s.addLine}`,u.append(l,f);let v=new Map,P=null,D=!1;f.addEventListener("click",()=>{P=e.addLine(t);let w=v.get(P);w&&(w.cells[0]?.widget.focus(),P=null)});function S(w){let z=i.createElement("tr");z.dataset.line=w.key;let B=dp(e,t,w.key),te=c.map(V=>{let Q=a.fields[V],he=`${o}-${w.key}-${V}`,ct={type:"field",id:`${n.id}.${w.key}.${V}`,field:V},Ze=Xt({form:B,name:V,field:Q,node:ct,id:he,document:i,labels:s}),Ve=i.createElement("td"),Re=i.createElement("label");Re.className="fd-sr-only",Re.htmlFor=he,Re.textContent=Q.label;let ke=i.createElement("div");return ke.className="fd-cell-error",ke.hidden=!0,Ve.append(Re,Ze.element,ke),z.append(Ve),{name:V,def:Q,widget:Ze,error:ke}}),re=i.createElement("td");re.className="fd-lines-tools";let ie=i.createElement("button");return ie.type="button",ie.className="fd-line-delete",ie.textContent="\xD7",ie.setAttribute("aria-label",s.deleteLine),ie.addEventListener("click",()=>e.removeLine(t,w.key)),re.append(ie),z.append(re),{element:z,cells:te,remove:ie}}return{element:u,focus:()=>(x.querySelector("input, select, textarea")??f).focus(),update(w){D=w.readonly,f.hidden=D;let z=w.value??[],B=e.getState().errors,te=new Set(z.map(re=>re.key));for(let[re,ie]of v)te.has(re)||(ie.element.remove(),v.delete(re));z.forEach((re,ie)=>{let V=v.get(re.key);V||(V=S(re),v.set(re.key,V)),x.children[ie]!==V.element&&x.insertBefore(V.element,x.children[ie]??null),V.remove.hidden=D,D?V.remove.remove():V.remove.isConnected||V.element.lastElementChild?.append(V.remove);for(let Q of V.cells){let he=B[`${t}.${re.key}.${Q.name}`];Q.error.hidden=!he,Q.error.textContent=he??"",Q.widget.update({value:re.values[Q.name],values:re.values,readonly:D||Q.def.readonly===!0,required:Q.def.required===!0,invalid:!!he})}}),P&&v.has(P)&&(v.get(P)?.cells[0]?.widget.focus(),P=null)}}};function fp(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{let o=String(n.result??"");t({name:e.name,type:e.type,size:e.size,data:o.slice(o.indexOf(",")+1)})},n.onerror=()=>r(n.error),n.readAsDataURL(e)})}function Uu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=we.en})=>{let a=i.createElement("div");a.className=`fd-file fd-file-${e}`;let c=i.createElement("input");c.type="file",c.id=o,c.className="fd-sr-only";let u=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;u&&(c.accept=u.join(","));let l=i.createElement("img");l.className="fd-image-preview",l.alt=n.label,l.hidden=!0;let p=i.createElement("label");p.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",p.htmlFor=o;let m=i.createElement("span");m.className="fd-button",m.textContent=e==="image"?s.uploadImage:s.upload;let d=i.createElement("span");d.className="fd-help",d.textContent=s.dropHere,p.append(m,d);let h=i.createElement("div");h.className="fd-file-chosen";let x=i.createElement("span");x.className="fd-file-name";let f=i.createElement("button");f.type="button",f.className="fd-button fd-button-link",f.textContent=s.replace,f.addEventListener("click",()=>c.click());let v=i.createElement("button");v.type="button",v.className="fd-button fd-button-link",v.textContent=s.removeFile,v.addEventListener("click",()=>t.setValue(r,null)),h.append(x,f,v),a.append(c,...e==="image"?[l]:[],p,h);let P=!1,D=async S=>{!S||P||t.setValue(r,await fp(S))};return c.addEventListener("change",()=>{D(c.files?.[0]),c.value=""}),a.addEventListener("dragover",S=>{P||(S.preventDefault(),a.classList.add("fd-dragging"))}),a.addEventListener("dragleave",()=>a.classList.remove("fd-dragging")),a.addEventListener("drop",S=>{S.preventDefault(),a.classList.remove("fd-dragging"),D(S.dataTransfer?.files?.[0])}),{element:a,focus:()=>(p.hidden?f:c).focus(),update(S){P=S.readonly;let w=S.value;if(p.hidden=!!w||P,h.hidden=!w,f.hidden=v.hidden=P,c.disabled=P,c.setAttribute("aria-invalid",String(S.invalid)),S.describedBy&&c.setAttribute("aria-describedby",S.describedBy),x.textContent=w?`${w.name} \xB7 ${Gt(w.size)}`:"",e==="image"){let z=w?w.data?`data:${w.type};base64,${w.data}`:w.url??"":"";l.hidden=!z,l.getAttribute("src")!==z&&(z?l.src=z:l.removeAttribute("src"))}}}}}var To=Uu("binary"),Ro=Uu("image");var pp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),mp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function Io(e,t=globalThis.document){let r=t.createElement("template");r.innerHTML=e;let n=i=>{for(let s of[...i.childNodes]){if(s.nodeType===Node.TEXT_NODE)continue;if(s.nodeType!==Node.ELEMENT_NODE){s.remove();continue}let a=s;if(mp.has(a.tagName)){a.remove();continue}if(n(a),!pp.has(a.tagName)){a.replaceWith(...a.childNodes);continue}let c=a.tagName==="A"?a.getAttribute("href"):null;for(let u of[...a.attributes])a.removeAttribute(u.name);c&&/^(https?:|mailto:)/i.test(c.trim())&&a.setAttribute("href",c.trim())}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}var Lo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-input fd-richtext",o.setAttribute("role","textbox"),o.setAttribute("aria-multiline","true"),o.setAttribute("contenteditable","true");let i="";return o.addEventListener("input",()=>{let s=Io(o.innerHTML,n);i=s,e.setValue(t,s.trim()===""?null:s)}),o.addEventListener("blur",()=>{o.innerHTML!==i&&(o.innerHTML=i)}),{element:o,focus:()=>o.focus(),update(s){let a=Io(typeof s.value=="string"?s.value:"",n);(a!==i||n.activeElement!==o)&&(o.innerHTML!==a&&(o.innerHTML=a),i=a),o.setAttribute("contenteditable",String(!s.readonly)),o.setAttribute("aria-readonly",String(s.readonly)),o.setAttribute("aria-invalid",String(s.invalid)),s.describedBy&&o.setAttribute("aria-describedby",s.describedBy)}}},Br=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=n.createElement("div");i.className="fd-json";let s=n.createElement("textarea");s.id=r,s.className="fd-input fd-textarea fd-code",s.spellcheck=!1;let a=n.createElement("div");return a.className="fd-cell-error",a.hidden=!0,i.append(s,a),s.addEventListener("input",()=>{if(s.value.trim()===""){a.hidden=!0,e.setValue(t,null);return}try{let c=JSON.parse(s.value);a.hidden=!0,e.setValue(t,c)}catch{a.hidden=!1,a.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(c){if(n.activeElement!==s){let u=c.value===null||c.value===void 0?"":JSON.stringify(c.value,null,2);s.value!==u&&(s.value=u)}s.readOnly=c.readonly,s.setAttribute("aria-invalid",String(c.invalid||!a.hidden))}}};function Xt(e,t={}){let{field:r,node:n}=e,o=[n.widget?`${r.type}.${n.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type].filter(i=>i!==null);for(let i of o){let s=t[i]??qu[i];if(s)return s(e)}return _p(e)}function ue(e,t,r={},...n){let o=e.createElement(t);for(let[i,s]of Object.entries(r))s!==void 0&&o.setAttribute(i,s);return o.append(...n),o}function je(e,t){e.setAttribute("aria-invalid",String(t.invalid)),e.setAttribute("aria-required",String(t.required)),t.describedBy?e.setAttribute("aria-describedby",t.describedBy):e.removeAttribute("aria-describedby")}var er=e=>e==null?"":String(e);function Qt(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let a=ue(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(a.maxLength=n.size),o.placeholder&&(a.placeholder=o.placeholder),a.addEventListener("input",()=>t.setValue(r,a.value===""?null:a.value)),{element:a,focus:()=>a.focus(),update(c){let u=er(c.value);a.value!==u&&(a.value=u),a.readOnly=c.readonly,je(a,c)}}}}var hp=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=ue(i,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});return r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),n.placeholder&&(s.placeholder=n.placeholder),s.addEventListener("input",()=>e.setValue(t,s.value===""?null:s.value)),{element:s,focus:()=>s.focus(),update(a){let c=er(a.value);s.value!==c&&(s.value=c),s.readOnly=a.readonly,je(s,a)}}},gp=/^-?(\d+\.?\d*|\.\d+)$/,bp=/^-?\.?$/,Fo=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,a=n.type==="integer",c=ue(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=a?"numeric":"decimal",o.placeholder&&(c.placeholder=o.placeholder);let u=m=>{let d=m.trim();if(d==="")return null;if(gp.test(d))return Number(d);if(!bp.test(d))return d};c.addEventListener("input",()=>{let m=u(c.value);m!==void 0&&t.setValue(r,m)}),c.addEventListener("blur",()=>{c.value=er(t.getState().values[r])});let l=n.type==="monetary"?ue(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?ue(s,"span",{class:"fd-number"},l,c):c,focus:()=>c.focus(),update(m){let d=s.activeElement===c,h=u(c.value),x=h===void 0||h===m.value;if(!(d&&x)){let f=er(m.value);c.value!==f&&(c.value=f)}if(c.readOnly=m.readonly,je(c,m),l&&n.type==="monetary"){let f=n.currencyField?m.values[n.currencyField]:null;l.textContent=f&&typeof f=="object"&&"label"in f?f.label:typeof f=="string"?f:n.currency??""}}}};function Bu(e){return({form:t,name:r,id:n,document:o})=>{let i=ue(o,"input",{id:n,type:"checkbox",class:e?"fd-switch":"fd-checkbox",role:e});return i.addEventListener("change",()=>t.setValue(r,i.checked)),{element:i,focus:()=>i.focus(),update(s){i.checked=s.value===!0,i.disabled=s.readonly,je(i,s)}}}}function Hu(e){return e.type==="selection"?e.options:[]}var yp=({form:e,name:t,field:r,id:n,document:o})=>{let i=Hu(r),s=ue(o,"select",{id:n,class:"fd-input fd-select"},ue(o,"option",{value:""}));return i.forEach((a,c)=>s.append(ue(o,"option",{value:String(c)},a.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(a){let c=i.findIndex(u=>u.value===a.value);s.value=c===-1?"":String(c),s.disabled=a.readonly,je(s,a)}}};function Ju(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Hu(n),a=ue(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),c=s.map((u,l)=>{let p=ue(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return a.append(ue(i,"label",{class:"fd-choice",for:`${o}-${l}`},p,ue(i,"span",{},u.label))),p});return a.addEventListener("change",()=>{if(e==="radio"){let u=c.findIndex(l=>l.checked);t.setValue(r,u===-1?null:s[u].value)}else t.setValue(r,s.filter((u,l)=>c[l].checked).map(u=>u.value))}),{element:a,focus:()=>(c.find(u=>u.checked)??c[0])?.focus(),update(u){let l=Array.isArray(u.value)?u.value:[u.value];c.forEach((p,m)=>{p.checked=l.includes(s[m].value),p.disabled=u.readonly}),je(a,u)}}}}function Wu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s="min"in n&&n.min!==void 0?n.min:e==="rating"?1:0,a="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,c=ue(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=a;l++){let p=ue(i,"button",{type:"button",role:"radio","aria-label":`${l} of ${a}`,"data-value":String(l)},e==="rating"?"\u2605":String(l));e==="scale"&&p.removeAttribute("aria-label"),p.addEventListener("click",()=>t.setValue(r,l)),u.push(p),c.append(p)}return c.addEventListener("keydown",l=>{let p=t.getState().values[r],m=typeof p=="number"?p:s-1,d=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!d)return;l.preventDefault();let h=Math.min(a,Math.max(s,m+d));t.setValue(r,h),u[h-s]?.focus()}),{element:c,focus:()=>(u.find(l=>l.getAttribute("aria-checked")==="true")??u[0])?.focus(),update(l){let p=typeof l.value=="number"?l.value:null;u.forEach((m,d)=>{let h=s+d;m.setAttribute("aria-checked",String(h===p)),m.classList.toggle("fd-on",e==="rating"?p!==null&&h<=p:h===p),m.tabIndex=h===p||p===null&&d===0?0:-1,m.disabled=l.readonly}),je(c,l)}}}}var xp=({form:e,name:t,id:r,document:n})=>{let o=ue(n,"input",{id:r,type:"date",class:"fd-input fd-date"});return o.addEventListener("input",()=>e.setValue(t,o.value||null)),{element:o,focus:()=>o.focus(),update(i){let s=er(i.value);o.value!==s&&(o.value=s),o.readOnly=i.readonly,je(o,i)}}},Jr=e=>String(e).padStart(2,"0"),vp=({form:e,name:t,id:r,document:n})=>{let o=ue(n,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),i=s=>{if(typeof s!="string"||!s)return"";let a=new Date(s);return Number.isNaN(a.getTime())?"":`${a.getFullYear()}-${Jr(a.getMonth()+1)}-${Jr(a.getDate())}T${Jr(a.getHours())}:${Jr(a.getMinutes())}`};return o.addEventListener("input",()=>{if(!o.value)return e.setValue(t,null);let s=new Date(o.value);Number.isNaN(s.getTime())||e.setValue(t,s.toISOString())}),{element:o,focus:()=>o.focus(),update(s){let a=i(s.value);o.value!==a&&(o.value=a),o.readOnly=s.readonly,je(o,s)}}};function _p({field:e,id:t,document:r}){let n=ue(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=Ku(o.value,e)}}}function Ku(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(r=>r.label).join(", ");case"one2many":{let r=e.length;return`${r} ${r===1?"line":"lines"}`}case"binary":case"image":return e.name;case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var qu={char:Qt("text"),"char.email":Qt("email"),"char.phone":Qt("tel"),"char.url":Qt("url"),"char.password":Qt("password"),text:hp,integer:Fo,float:Fo,monetary:Fo,"integer.rating":Wu("rating"),"integer.scale":Wu("scale"),boolean:Bu(),"boolean.toggle":Bu("switch"),selection:yp,"selection.radio":Ju("radio"),"selection.checkboxes":Ju("checkbox"),date:xp,datetime:vp,many2one:Oo,many2many:Ur,"many2many.tags":Ur,"many2many.checkboxes":No,reference:Zo,one2many:Ao,binary:To,image:Ro,html:Lo,json:Br,properties:Br};var Yu=`
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function cc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;cc(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var uc=new Set(["type","properties","required","additionalProperties"]),sc=["oneOf","anyOf"];function ac(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function jn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!uc.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??ac(u);l!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:jn(a)??{allOf:a};ge(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=ac(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function md(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of uc)if(o in e)return;let r=t.filter(o=>sc.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=jn(t);else{let o=r[0],i=sc.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>jn([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,Ct(e,n))}function Vt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){n(p);let f=e.seen.get(p),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Ct(u,h),Ct(u,l),a._zod.parent===p)for(let d in u)d==="$ref"||d==="allOf"||d in l||delete u[d];if(h.$ref&&f.def)for(let d in u)d==="$ref"||d==="allOf"||d in f.def&&JSON.stringify(u[d])===JSON.stringify(f.def[d])&&delete u[d]}let m=a._zod.parent;if(m&&m!==p){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())cc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);p?p.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])md(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Ct(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ge(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mt(t,"input",e.processors),output:Mt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return he(n.element,r);if(n.type==="set")return he(n.valueType,r);if(n.type==="lazy")return he(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return he(n.innerType,r);if(n.type==="intersection")return he(n.left,r)||he(n.right,r);if(n.type==="record"||n.type==="map")return he(n.keyType,r)||he(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:he(n.in,r)||he(n.out,r);if(n.type==="object"){for(let o in n.shape)if(he(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(he(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(he(o,r))return!0;return!!(n.rest&&he(n.rest,r))}return!1}var lc=(e,t={})=>r=>{let n=Dt({...r,processors:t});return q(e,n),jt(n,e),Vt(n,e)},Mt=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Dt({...o??{},target:i,io:t,processors:r});return q(e,s),jt(s,e),Vt(s,e)};var _t=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},wt=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},dc=(e,t)=>{_t(e,"minimum",t),wt(e,"maximum",t)},gc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},bc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},yc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},xc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},fc=(e,t)=>_t(e,"minimum",t.minimum),pc=(e,t)=>wt(e,"maximum",t.maximum),mc=e=>(t,r)=>{xc(t,r.format);let[n,o]=e[r.format];_t(t,"minimum",n),wt(t,"maximum",o)},hd={greater_than:(e,t)=>_t(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>wt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>gc(e,t.value),number_format:mc(Pt),bigint_format:mc(sr),min_length:fc,max_length:pc,length_equals:(e,t)=>dc(e,t.length),min_size:fc,max_size:pc,size_equals:(e,t)=>dc(e,t.size),string_format:(e,t)=>{xc(e,t.format),t.pattern&&bc(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>yc(e,t.mime)};function be(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)hd[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&_t(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&_t(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&wt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&wt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&gc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&yc(t,o.mime);for(let i of o.patterns??[])bc(t,i);return t}var gd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bd=new Map([[wn,Ni],[_r,Zi]]),vc=e=>bd.get(e)??e,Bn=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=be(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=gd[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let p=[...c].map(vc);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Jn=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=be(e);o.type=l?"integer":"number";let p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let h=new Set;for(let v of a)Number.isFinite(v)&&v!==0?h.add(Math.abs(v)):ce(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[x,...d]=h;x!==void 0&&(o.multipleOf=x),d.length&&(o.allOf=[...o.allOf??[],...d.map(v=>({multipleOf:v}))])}},Wn=(e,t,r,n)=>{r.type="boolean"},_c=(e,t,r,n)=>{ce(e,t,r,n,"BigInt cannot be represented in JSON Schema")},wc=(e,t,r,n)=>{ce(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Hn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},kc=(e,t,r,n)=>{ce(e,t,r,n,"Undefined cannot be represented in JSON Schema")},zc=(e,t,r,n)=>{ce(e,t,r,n,"Void cannot be represented in JSON Schema")},Kn=(e,t,r,n)=>{r.not={}},$c=(e,t,r,n)=>{},qn=(e,t,r,n)=>{},Sc=(e,t,r,n)=>{ce(e,t,r,n,"Date cannot be represented in JSON Schema")},Gn=(e,t,r,n)=>{let o=e._zod.def,i=mt(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},Yn=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(ce(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ce(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Ec=(e,t,r,n)=>{ce(e,t,r,n,"NaN cannot be represented in JSON Schema")},Pc=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Oc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=be(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Nc=(e,t,r,n)=>{r.type="boolean"},Xn=(e,t,r,n)=>{ce(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Zc=(e,t,r,n)=>{ce(e,t,r,n,"Function types cannot be represented in JSON Schema")},Qn=(e,t,r,n)=>{ce(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Tc=(e,t,r,n)=>{ce(e,t,r,n,"Map cannot be represented in JSON Schema")},Ac=(e,t,r,n)=>{ce(e,t,r,n,"Set cannot be represented in JSON Schema")},eo=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=be(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=q(i.element,t,{...n,path:[...n.path,"items"]})};function Ut(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ut(t.out):t.type==="catch"?Ut(t.innerType):e._zod.optin}var to=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ce(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ge(o.properties,u,q(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Ut(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=q(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ro=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>q(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},no=(e,t,r,n)=>{let o=e._zod.def,i=q(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=q(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},oo=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((x,d)=>q(x,t,{...n,path:[...n.path,s,d]})),u=i.rest?q(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let x=i.items[l-1];if(!(t.io==="input"?Ut(x)!==void 0:x._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),m&&(o.maxItems=p));let{minimum:f,maximum:h}=be(e);typeof f=="number"&&(o.minItems=f),typeof h=="number"&&(o.maxItems=h)};function Vn(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let x=Vn(e,h,r);return x===h?t:x}for(let h of["anyOf","oneOf"]){let x=t[h];if(!Array.isArray(x))continue;let d=x.map(v=>Vn(e,v,r));d.some((v,P)=>v!==x[P])&&(t={...t,[h]:d})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(h=>typeof h=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:m,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",i||(f.pattern=(n.includes("number")?Zt:gn).source)),f}var Un=new WeakMap;function yd(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Un.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Vn(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var io=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=be(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=q(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)ge(o.patternProperties,vc(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=q(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Un.get(t);l||(l=[],Un.set(t,l),t.deferred.push(()=>yd(t))),l.push(e)}o.additionalProperties=q(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&Ut(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l.map(String))}},so=(e,t,r,n)=>{let o=e._zod.def,i=q(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},ao=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},co=Symbol();function Rc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(ce(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),co):JSON.parse(s)}var uo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Rc(o.defaultValue,e,t,r,n);s!==co&&(r.default=s)},lo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Rc(o.defaultValue,e,t,r,n);s!==co&&(r._prefault=s)},fo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ce(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},po=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;q(s,t,n);let a=t.seen.get(e);a.ref=s},mo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Ic=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Zr=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},ho=(e,t,r,n)=>{let o=e._zod.innerType;q(o,t,n);let i=t.seen.get(e);i.ref=o},hc={string:Bn,number:Jn,boolean:Wn,bigint:_c,symbol:wc,null:Hn,undefined:kc,void:zc,never:Kn,any:$c,unknown:qn,date:Sc,enum:Gn,literal:Yn,nan:Ec,template_literal:Pc,file:Oc,success:Nc,custom:Xn,function:Zc,transform:Qn,map:Tc,set:Ac,array:eo,object:to,union:ro,intersection:no,tuple:oo,record:io,nullable:so,nonoptional:ao,default:uo,prefault:lo,catch:fo,pipe:po,readonly:mo,promise:Ic,optional:Zr,lazy:ho};function go(e,t){if("_idmap"in e){let n=e,o=Dt({...t,processors:hc}),i={};for(let c of n._idmap.entries()){let[u,l]=c;q(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;jt(o,l),ge(s,u,Vt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Dt({...t,processors:hc});return q(e,r),jt(r,e),Vt(r,e)}var Lc=new WeakSet([Object.prototype,Error.prototype]);function Ar(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Ed=(e,t)=>{ni.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Lc.has(r)||(Lc.add(r),Ar(r,"format",n=>o=>ii(n,o)),Ar(r,"flatten",n=>o=>oi(n,o)),Ar(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ht,2)}),Ar(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ht,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var _e=b("ZodError",Ed,void 0,{Parent:Error});var Fc=dr(_e),Cc=fr(_e),Mc=pr(_e),Dc=mr(_e),jc=ai(_e),Vc=ci(_e),Uc=ui(_e),Bc=li(_e),Jc=di(_e),Wc=fi(_e),Hc=pi(_e),Kc=mi(_e);function Od(){me.localeError||ve(va())}function Bt(){me.memoizer||ve({memoizer:xa()})}var Y=b("ZodType",(e,t)=>(Od(),W.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $e(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Of(e,t))},superRefine(e,t){return this.check(Nf(e,t))},overwrite(e){return this.check(Ke(e))},optional(){return Yc(this)},exactOptional(){return mf(this)},nullable(){return Xc(this)},nullish(){return Yc(Xc(this))},nonoptional(e){return vf(this,e)},array(){return ie(this)},or(e){return qe([this,e])},and(e){return uf(this,e)},transform(e){return Qc(this,pf(e))},default(e){return bf(this,e)},prefault(e){return xf(this,e)},catch(e){return wf(this,e)},pipe(e){return Qc(this,e)},readonly(){return $f(this)},describe(e){let t=this.clone();return at.add(t,{description:e}),t},meta(...e){if(e.length===0)return at.get(this);let t=this.clone();return at.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return A.hide(this,"~standard",{..._n(this),jsonSchema:{input:Mt(this,"input"),output:Mt(this,"output")}})},set"~standard"(e){A.own(this,"~standard",e)},parse:function e(t,r){return Fc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Cc(this,t,r,{callee:e})},safeParse(e,t){return Mc(this,e,t)},async safeParseAsync(e,t){return Dc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){A.own(this,"spa",e)},validate(e,t){return fn(this,e,t)},validateAsync(e,t){return pn(this,e,t)},encode:function e(t,r){return jc(this,t,r,{callee:e})},decode:function e(t,r){return Vc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Uc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Bc(this,t,r,{callee:e})},safeEncode(e,t){return Jc(this,e,t)},safeDecode(e,t){return Wc(this,e,t)},async safeEncodeAsync(e,t){return Hc(this,e,t)},async safeDecodeAsync(e,t){return Kc(this,e,t)},toJSONSchema(e){return lc(this,{})(e)},get description(){return at.get(this)?.description},get _def(){return this._zod.def}}),eu=b("_ZodString",(e,t)=>{vr.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bn(e,r,n,o)},A.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(Nn(...e))},includes(...e){return this.check(An(...e))},startsWith(...e){return this.check(Rn(...e))},endsWith(...e){return this.check(In(...e))},min(...e){return this.check(vt(...e))},max(...e){return this.check(Or(...e))},length(...e){return this.check(Nr(...e))},nonempty(...e){return this.check(vt(1,...e))},lowercase(e){return this.check(Zn(e))},uppercase(e){return this.check(Tn(e))},trim(){return this.check(Fn())},normalize(...e){return this.check(Ln(...e))},toLowerCase(){return this.check(Cn())},toUpperCase(){return this.check(Mn())},slugify(){return this.check(Dn())}})),Nd=b("ZodString",(e,t)=>{vr.init(e,t),eu.init(e,t)},{email(e){return this.check(za(Id,e))},url(e){return this.check(Na(Fd,e))},jwt(e){return this.check(Ja(Xd,e))},emoji(e){return this.check(Za(Cd,e))},guid(e){return this.check($a(Ld,e))},uuid(e){return this.check(Sa(Rr,e))},uuidv4(e){return this.check(Ea(Rr,e))},uuidv6(e){return this.check(Pa(Rr,e))},uuidv7(e){return this.check(Oa(Rr,e))},nanoid(e){return this.check(Ta(Md,e))},cuid(e){return this.check(Aa(Dd,e))},cuid2(e){return this.check(Ra(jd,e))},ulid(e){return this.check(Ia(Vd,e))},base64(e){return this.check(Va(qd,e))},base64url(e){return this.check(Ua(Gd,e))},xid(e){return this.check(La(Ud,e))},ksuid(e){return this.check(Fa(Bd,e))},ipv4(e){return this.check(Ca(Jd,e))},ipv6(e){return this.check(Ma(Wd,e))},cidrv4(e){return this.check(Da(Hd,e))},cidrv6(e){return this.check(ja(Kd,e))},e164(e){return this.check(Ba(Yd,e))},datetime(e){return this.check(Wa(Zd,e))},date(e){return this.check(Ha(Td,e))},time(e){return this.check(Ka(Ad,e))},duration(e){return this.check(qa(Rd,e))}});function Z(e){return ka(Nd,e)}var ee=b("ZodStringFormat",(e,t)=>{X.init(e,t),eu.init(e,t)}),Zd=b("ZodISODateTime",(e,t)=>{Ns.init(e,t),ee.init(e,t)}),Td=b("ZodISODate",(e,t)=>{Zs.init(e,t),ee.init(e,t)}),Ad=b("ZodISOTime",(e,t)=>{Ts.init(e,t),ee.init(e,t)}),Rd=b("ZodISODuration",(e,t)=>{As.init(e,t),ee.init(e,t)}),Id=b("ZodEmail",(e,t)=>{xs.init(e,t),ee.init(e,t)});var Ld=b("ZodGUID",(e,t)=>{bs.init(e,t),ee.init(e,t)});var Rr=b("ZodUUID",(e,t)=>{ys.init(e,t),ee.init(e,t)});var Fd=b("ZodURL",(e,t)=>{ws.init(e,t),ee.init(e,t)});var Cd=b("ZodEmoji",(e,t)=>{ks.init(e,t),ee.init(e,t)});var Md=b("ZodNanoID",(e,t)=>{zs.init(e,t),ee.init(e,t)});var Dd=b("ZodCUID",(e,t)=>{$s.init(e,t),ee.init(e,t)});var jd=b("ZodCUID2",(e,t)=>{Ss.init(e,t),ee.init(e,t)});var Vd=b("ZodULID",(e,t)=>{Es.init(e,t),ee.init(e,t)});var Ud=b("ZodXID",(e,t)=>{Ps.init(e,t),ee.init(e,t)});var Bd=b("ZodKSUID",(e,t)=>{Os.init(e,t),ee.init(e,t)});var Jd=b("ZodIPv4",(e,t)=>{Rs.init(e,t),ee.init(e,t)});var Wd=b("ZodIPv6",(e,t)=>{Ls.init(e,t),ee.init(e,t)});var Hd=b("ZodCIDRv4",(e,t)=>{Fs.init(e,t),ee.init(e,t)});var Kd=b("ZodCIDRv6",(e,t)=>{Cs.init(e,t),ee.init(e,t)});var qd=b("ZodBase64",(e,t)=>{Ds.init(e,t),ee.init(e,t)});var Gd=b("ZodBase64URL",(e,t)=>{js.init(e,t),ee.init(e,t)});var Yd=b("ZodE164",(e,t)=>{Vs.init(e,t),ee.init(e,t)});var Xd=b("ZodJWT",(e,t)=>{Us.init(e,t),ee.init(e,t)});var tu=b("ZodNumber",(e,t)=>{kn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jn(e,r,n,o),e.isFinite=!0},A.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=be(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=be(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=be(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>be(e).format??null},{gt(e,t){return this.check(Er(e,t))},gte(e,t){return this.check(Ft(e,t))},min(e,t){return this.check(Ft(e,t))},lt(e,t){return this.check(Sr(e,t))},lte(e,t){return this.check(Lt(e,t))},max(e,t){return this.check(Lt(e,t))},int(e){return this.check(Ae(e))},safe(e){return this.check(Ae(e))},positive(e){return this.check(Er(0,e))},nonnegative(e){return this.check(Ft(0,e))},negative(e){return this.check(Sr(0,e))},nonpositive(e){return this.check(Lt(0,e))},multipleOf(e,t){return this.check(Pr(e,t))},step(e,t){return this.check(Pr(e,t))},finite(){return this}}));function Oe(e){return Ga(tu,e)}var Qd=b("ZodNumberFormat",(e,t)=>{Bs.init(e,t),tu.init(e,t)});function Ae(e){return Ya(Qd,e)}var ef=b("ZodBoolean",(e,t)=>{Js.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wn(e,r,n,o)});function Re(e){return Xa(ef,e)}var tf=b("ZodNull",(e,t)=>{Ws.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o)});function rf(e){return Qa(tf,e)}var nf=b("ZodUnknown",(e,t)=>{Hs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qn(e,r,n,o)});function qc(){return ec(nf)}var of=b("ZodNever",(e,t)=>{Ks.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)});function ru(e){return tc(of,e)}var sf=b("ZodArray",(e,t)=>{Bt(),qs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n,o),e.element=t.element},{min(e,t){return this.check(vt(e,t))},nonempty(e){return this.check(vt(1,e))},max(e,t){return this.check(Or(e,t))},length(e,t){return this.check(Nr(e,t))},unwrap(){return this.element}});function ie(e,t){return rc(sf,e,t)}var nu=b("ZodObject",(e,t)=>{Bt(),Xs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o),A.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ct(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:qc()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:qc()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ru()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return A.extend(this,e)},safeExtend(e){return A.safeExtend(this,e)},merge(e){return A.merge(this,e)},pick(e){return A.pick(this,e)},omit(e){return A.omit(this,e)},partial(...e){return A.partial(yo,this,e[0])},exactPartial(...e){return A.partial(su,this,e[0],"exactPartial")},required(...e){return A.required(au,this,e[0])}});function re(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new nu(r)}function ne(e,t){return new nu({type:"object",shape:e,catchall:ru(),...A.normalizeParams(t)})}var ou=b("ZodUnion",(e,t)=>{zn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o),e.options=t.options});function qe(e,t){return new ou({type:"union",options:e,...A.normalizeParams(t)})}var af=b("ZodDiscriminatedUnion",(e,t)=>{ou.init(e,t),Qs.init(e,t)});function Ge(e,t,r){return new af({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var cf=b("ZodIntersection",(e,t)=>{ea.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o)});function uf(e,t){return new cf({type:"intersection",left:e,right:t})}var lf=b("ZodTuple",(e,t)=>{Bt(),ta.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new yo({type:"optional",innerType:t}))})}});function iu(e,t,r){let n=t instanceof W,o=n?r:t,i=n?t:null;return new lf({type:"tuple",items:e,rest:i,...A.normalizeParams(o)})}var Gc=b("ZodRecord",(e,t)=>{Bt(),ra.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function kt(e,t,r){return!t||!t._zod?new Gc({type:"record",keyType:Z(),valueType:e,...A.normalizeParams(t)}):new Gc({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var bo=b("ZodEnum",(e,t)=>{na.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Gn(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new bo({...t,checks:[],...A.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new bo({...t,checks:[],...A.normalizeParams(o),entries:i})}});function ct(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...A.normalizeParams(t)})}var df=b("ZodLiteral",(e,t)=>{oa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function F(e,t){return new df({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var ff=b("ZodTransform",(e,t)=>{Bt(),ia.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qn(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(A.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(A.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function pf(e){return new ff({type:"transform",transform:e})}var yo=b("ZodOptional",(e,t)=>{$n.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new yo({type:"optional",innerType:e})}var su=b("ZodExactOptional",(e,t)=>{sa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mf(e){return new su({type:"optional",innerType:e})}var hf=b("ZodNullable",(e,t)=>{aa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xc(e){return new hf({type:"nullable",innerType:e})}var gf=b("ZodDefault",(e,t)=>{ca.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bf(e,t){return new gf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var yf=b("ZodPrefault",(e,t)=>{ua.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new yf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var au=b("ZodNonOptional",(e,t)=>{la.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new au({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var _f=b("ZodCatch",(e,t)=>{da.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wf(e,t){return new _f({type:"catch",innerType:e,catchValue:typeof t=="function"?t:A.constantCatch(t)})}var kf=b("ZodPipe",(e,t)=>{fa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.in=t.in,e.out=t.out});function Qc(e,t){return new kf({type:"pipe",in:e,out:t})}var zf=b("ZodReadonly",(e,t)=>{pa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $f(e){return new zf({type:"readonly",innerType:e})}var Sf=b("ZodLazy",(e,t)=>{ma.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ef(e){return new Sf({type:"lazy",getter:e})}var Pf=b("ZodCustom",(e,t)=>{ha.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o)});function Of(e,t={}){return nc(Pf,e,t)}function Nf(e,t){return oc(e,t)}function cu(e){let t=Ef(()=>qe([Z(e),Oe(),Re(),rf(),ie(t),kt(Z(),t)]));return t}var Jt=cu().meta({id:"JsonValue"});var Ye=/^[A-Za-z_][A-Za-z0-9_]*$/,uu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Lr=re({value:qe([Z(),Oe()]),label:Z()}).strict().meta({id:"Option"}),xo=re({field:Z().min(1),op:ct(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Jt.optional(),valueFrom:Z().regex(Ye).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ue={label:Z(),help:Z().optional(),required:Re().optional(),readonly:Re().optional(),default:Jt.optional()},lu=Ae().positive().optional(),du=iu([Ae().positive(),Ae().nonnegative()]).optional(),vo=Z().min(1),fu=ie(xo).optional(),pu=re({type:F("char"),...ue,size:lu,pattern:Z().optional()}).strict(),mu=re({type:F("text"),...ue,size:lu}).strict(),hu=re({type:F("html"),...ue}).strict(),gu=re({type:F("integer"),...ue,min:Oe().optional(),max:Oe().optional()}).strict(),bu=re({type:F("float"),...ue,min:Oe().optional(),max:Oe().optional(),digits:du}).strict(),yu=re({type:F("monetary"),...ue,currencyField:Z().regex(Ye).optional(),currency:Z().regex(/^[A-Z]{3}$/).optional(),min:Oe().optional(),max:Oe().optional(),digits:du}).strict(),xu=re({type:F("boolean"),...ue}).strict(),vu=re({type:F("date"),...ue}).strict(),_u=re({type:F("datetime"),...ue}).strict(),wu=re({type:F("selection"),...ue,options:ie(Lr).min(1),multiple:Re().optional()}).strict(),ku=re({type:F("binary"),...ue,accept:ie(Z()).optional(),maxSize:Ae().positive().optional()}).strict(),zu=re({type:F("image"),...ue,maxSize:Ae().positive().optional()}).strict(),$u=re({type:F("many2one"),...ue,relation:vo,filter:fu}).strict(),Su=re({type:F("many2many"),...ue,relation:vo,filter:fu}).strict(),Eu=re({type:F("reference"),...ue,models:ie(Lr).min(1)}).strict(),Pu=re({type:F("properties"),...ue}).strict(),Ou=re({type:F("json"),...ue}).strict(),_o=Ge("type",[pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou]).meta({id:"LineField"}),Zf=re({type:F("one2many"),...ue,relation:vo,fields:kt(Z().regex(Ye),_o)}).strict(),wo=Ge("type",[pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Zf,Eu,Pu,Ou]).meta({id:"Field"}),Fr=kt(Z().regex(Ye),wo);var Wt=qe([Re(),Z().min(1)]).meta({id:"Modifier"}),ye=Z().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),ut=Z().regex(Ye),Nu=ct(["info","success","warning","danger","muted"]),Ne=Wt.optional(),Tf=ne({type:F("field"),id:ye,field:ut,label:Z().optional(),widget:Z().min(1).optional(),placeholder:Z().optional(),help:Z().optional(),colspan:Ae().min(1).max(4).optional(),columns:ie(ut).min(1).optional(),invisible:Ne,readonly:Wt.optional(),required:Wt.optional()}),Zu=ne({type:F("button"),id:ye,label:Z(),action:Z().min(1),params:kt(Z(),Jt).optional(),style:ct(["primary","secondary","danger","link"]).optional(),confirm:Z().optional(),icon:Z().optional(),invisible:Ne}),Af=ne({type:F("text"),id:ye,text:Z(),style:ct(["heading","paragraph","note"]).optional(),invisible:Ne}),Tu=ne({type:F("slot"),id:ye,name:Z().min(1),invisible:Ne}),Rf=ne({type:F("section"),id:ye,title:Z().optional(),description:Z().optional(),columns:qe([F(1),F(2),F(3),F(4)]).optional(),collapsible:Re().optional(),collapsed:Re().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"SectionNode"}),If=ne({type:F("tab"),id:ye,label:Z(),icon:Z().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"TabNode"}),Au=ne({type:F("tabs"),id:ye,invisible:Ne,children:ie(If).min(1)}).meta({id:"TabsNode"}),lt=Ge("type",[Tf,Zu,Af,Tu,Rf,Au]).meta({id:"LayoutNode"}),Lf=ne({type:F("step"),id:ye,label:Z(),description:Z().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"StepNode"}),Ff=ne({type:F("wizard"),id:ye,children:ie(Lf).min(1)}).meta({id:"WizardNode"}),Cf=ne({type:F("sections"),id:ye,get children(){return ie(lt)}}).meta({id:"SectionsNode"}),Mf=ne({id:ye,label:Z(),action:Z().min(1),field:ut.optional(),icon:Z().optional(),invisible:Ne}),Df=ne({id:ye,label:Z(),tone:Nu.optional(),invisible:Ne}),jf=ne({id:ye,message:Z(),tone:Nu.optional(),invisible:Ne}),Vf=ne({type:F("sheet"),id:ye,title:ne({field:ut,subtitleField:ut.optional(),avatarField:ut.optional(),placeholder:Z().optional()}).optional(),statusbar:ne({field:ut,visibleStates:ie(qe([Z(),Oe()])).optional(),clickable:Re().optional()}).optional(),buttons:ie(Zu).optional(),statButtons:ie(Mf).optional(),ribbon:Df.optional(),alerts:ie(jf).optional(),get children(){return ie(lt)},sidePanel:Tu.optional()}).meta({id:"SheetNode"}),Cr=Ge("type",[Vf,Cf,Au,Ff]).meta({id:"RootLayout"});var ko="0.1",Uf=Ge("kind",[ne({kind:F("record"),model:Z().min(1)}),ne({kind:F("responses")})]),zt=ne({fieldia:F(ko),id:Z().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:Z().optional(),description:Z().optional(),data:Uf,fields:Fr,layout:Cr}).meta({title:"Fieldia page",description:"A form, survey or record screen as data. This schema checks shape; validatePage() also checks that every reference resolves."});function dt(e,t){switch(e.type){case"BinaryOp":return Bf(e,t);case"UnaryOp":return Jf(e,t);case"Literal":return e.value;case"Identifier":return Wf(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Bf(e,t){let r=Ru(dt(e.left,t)),n=Ru(dt(e.right,t)),o=e.operator.toLowerCase(),i=r!==null&&n!==null;switch(o){case"==":return r===n;case"!=":case"<>":return r!==n;case"<":return i&&r<n;case">":return i&&r>n;case"<=":return i&&r<=n;case">=":return i&&r>=n;case"in":return Array.isArray(n)&&n.includes(r);case"not in":return Array.isArray(n)&&!n.includes(r);case"and":return De(r)&&De(n);case"or":return De(r)||De(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function Jf(e,t){let r=dt(e.operand,t);if(e.operator.toLowerCase()==="not")return!De(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Ru(e){return e===void 0?null:e}function De(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Wf(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var zo=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Ht(e){let t=[];if(!e)return t;let r=/(\(|\)|==|!=|<=|>=|<>|<|>|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|-?\d+\.?\d*|\w+(?:\.\w+)*)/iy,n=/\s*/y,o=0;for(;;){if(n.lastIndex=o,n.exec(e),o=n.lastIndex,o>=e.length)return t;r.lastIndex=o;let i=r.exec(e);if(!i)throw new Error(`Unexpected "${e[o]}" at character ${o+1} of: ${e}`);t.push({type:Hf(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function Hf(e){let t=e.toLowerCase().trim();return zo.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^-?\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var ft=class{constructor(t){ot(this,"tokens");ot(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let r=this.previous().value,n=this.parseAnd();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let r=this.previous().value,n=this.parseNot();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,r=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:r}}return this.parseComparison()}parseComparison(){let t=this.parseValue(),r=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...r)){let n=this.previous().value,o=this.parseValue();return{type:"BinaryOp",operator:n.toLowerCase(),left:t,right:o}}return t}parseValue(){if(this.match("PAREN","(")){let t=this.parseOr();return this.consume("PAREN",")","Expected closing parenthesis"),t}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:zo.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:Kf(t.value)}}if(this.check("IDENTIFIER"))return{type:"Identifier",name:this.advance().value};throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...r){if(this.check(t)){if(r.length===0)return this.advance(),!0;let n=this.peek();if(n&&r.includes(n.value))return this.advance(),!0}return!1}matchLogical(...t){let r=this.peek();if(r&&r.type==="LOGICAL"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}matchOperator(...t){let r=this.peek();if(r&&r.type==="OPERATOR"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,r,n){if(this.check(t)){let o=this.peek();if(o&&o.value===r)return this.advance()}throw new Error(n)}};function Kf(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let r=[],n="",o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];(a==="'"||a==='"')&&(s===0||t[s-1]!=="\\")&&(o?a===i&&(o=!1,i=""):(o=!0,i=a)),a===","&&!o?(r.push(Iu(n.trim())),n=""):n+=a}return n.trim()&&r.push(Iu(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Iu(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function Xe(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new ft(Ht(e)).parse();return{source:e,fields:qf(t),evaluate(r){try{return De(dt(t,r))}catch{return!1}}}}function qf(e){let t=[],r=n=>{switch(n.type){case"Identifier":{let o=n.name.split(".")[0];t.includes(o)||t.push(o);return}case"BinaryOp":r(n.left),r(n.right);return;case"UnaryOp":r(n.operand);return;default:return}};return r(e),t}function Mr(e){let t=zt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:Gf(o.path),message:Yf(o)}))};let r=t.data,n=new So(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function Gf(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Yf(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var $o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),So=class{constructor(t){ot(this,"page",t);ot(this,"issues",[]);ot(this,"ids",new Map)}run(){return this.checkFields(this.page.fields,"fields"),this.walkRoot(this.page.layout,"layout"),this.issues}report(t,r){this.issues.push({path:t,message:r})}claim(t,r){let n=this.ids.get(t);n!==void 0?this.report(r,`duplicate id "${t}", also used at ${n}`):this.ids.set(t,r)}need(t,r,n=this.page.fields){if($o(n,t))return n[t];this.report(r,`no field "${t}"`)}checkModifiers(t,r,n=["invisible"]){for(let o of n){let i=t[o];if(typeof i!="string")continue;let s;try{s=Xe(i).fields}catch(a){this.report(`${r}.${o}`,`cannot read "${i}": ${a.message}`);continue}for(let a of s)$o(this.page.fields,a)||this.report(`${r}.${o}`,`"${i}" reads "${a}", which is not a field of this page`)}}checkFields(t,r){for(let[n,o]of Object.entries(t)){let i=`${r}.${n}`;if(o.type==="monetary"&&o.currencyField!==void 0){let s=this.need(o.currencyField,`${i}.currencyField`,t);s&&!["many2one","selection","char"].includes(s.type)&&this.report(`${i}.currencyField`,`"${o.currencyField}" is a ${s.type}; a currency field must be a many2one, selection or char`)}(o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,a)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${a}].valueFrom`,t)}),o.type==="one2many"&&this.checkFields(o.fields,`${i}.fields`)}}walkRoot(t,r){if(t.type==="tabs")return this.walkNode(t,r);if(this.claim(t.id,r),t.type==="sheet")return this.walkSheet(t,r);if(t.type==="sections")return this.walkChildren(t.children,r);t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkChildren(t,r){t.forEach((n,o)=>this.walkNode(n,`${r}.children[${o}]`))}walkNode(t,r){switch(this.claim(t.id,r),this.checkModifiers(t,r,t.type==="field"?["invisible","readonly","required"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,r);case"section":return t.collapsible&&!t.title&&this.report(r,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(r,"collapsed needs collapsible: true"),this.walkChildren(t.children,r);case"tabs":return this.walkTabs(t,r);default:return}}walkTabs(t,r){t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkSheet(t,r){if(t.title&&(this.need(t.title.field,`${r}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${r}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${r}.title.avatarField`)),t.statusbar){let{field:n,visibleStates:o}=t.statusbar,i=this.need(n,`${r}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${r}.statusbar.field`,`"${n}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&o){let s=new Set(i.options.map(a=>a.value));o.forEach((a,c)=>{s.has(a)||this.report(`${r}.statusbar.visibleStates[${c}]`,`"${a}" is not an option of "${n}"`)})}}t.buttons?.forEach((n,o)=>{this.claim(n.id,`${r}.buttons[${o}]`),this.checkModifiers(n,`${r}.buttons[${o}]`)}),t.statButtons?.forEach((n,o)=>{this.claim(n.id,`${r}.statButtons[${o}]`),this.checkModifiers(n,`${r}.statButtons[${o}]`),n.field!==void 0&&this.need(n.field,`${r}.statButtons[${o}].field`)}),t.ribbon&&(this.claim(t.ribbon.id,`${r}.ribbon`),this.checkModifiers(t.ribbon,`${r}.ribbon`)),t.alerts?.forEach((n,o)=>{this.claim(n.id,`${r}.alerts[${o}]`),this.checkModifiers(n,`${r}.alerts[${o}]`)}),this.walkChildren(t.children,r),t.sidePanel&&(this.claim(t.sidePanel.id,`${r}.sidePanel`),this.checkModifiers(t.sidePanel,`${r}.sidePanel`))}checkFieldNode(t,r){let n=this.need(t.field,`${r}.field`);!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{$o(n.fields,o)||this.report(`${r}.columns[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}):n.type!=="many2many"&&this.report(`${r}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${n.type}`))}};function Lu(){return go(zt,{target:"draft-2020-12"})}function Fu(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let r=Ht(e);if(r.length===0)return!1;let o=new ft(r).parse(),i=dt(o,t);return De(i)}catch{return!1}}function Cu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Ht(e);return t.length===0||new ft(t).parse(),!0}catch{return!1}}function Eo(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function $t(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?G(n.default):Eo(n);return t}function Dr(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Kt(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?Xf(i,o):o}return r}function Xf(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(r=>r.id);case"one2many":return t.map(r=>r.key);case"reference":{let r=t;return`${r.model},${r.id}`}case"binary":case"image":return t.name;default:return t}}function G(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var Qe={en:{required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",or:"or"},ar:{required:"{label} \u0645\u0637\u0644\u0648\u0628",maxLength:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627",pattern:"\u0635\u064A\u063A\u0629 {label} \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629",text:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0635\u064B\u0627",number:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627",integer:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",min:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 {label} \u0639\u0646 {min}",max:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F {label} \u0639\u0646 {max}",decimals:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {digits} \u0645\u0646\u0627\u0632\u0644 \u0639\u0634\u0631\u064A\u0629",boolean:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627",dateFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DD)",dateInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D (\u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u0644\u0634\u0647\u0631 \u0648\u0627\u0644\u064A\u0648\u0645)",datetimeFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u064A\u0646",choice:"\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0642\u064A\u0645\u0629 \u0648\u0627\u062D\u062F\u0629 \u0645\u0646: {options}",choices:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A",record:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0633\u062C\u0644\u064B\u0627",records:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0633\u062C\u0644\u0627\u062A",reference:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0634\u064A\u0631 {label} \u0625\u0644\u0649 {models}",file:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641\u064B\u0627",fileSize:"\u062D\u062C\u0645 {label} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}",fileType:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641 {types}",or:"\u0623\u0648"},de:{required:"{label} ist erforderlich",maxLength:"Maximal {max} Zeichen erlaubt",pattern:"{label} hat nicht das erwartete Format",text:"{label} muss Text sein",number:"{label} muss eine Zahl sein",integer:"{label} muss eine ganze Zahl sein",min:"{label} muss mindestens {min} sein",max:"{label} darf h\xF6chstens {max} sein",decimals:"Maximal {digits} Nachkommastellen erlaubt",boolean:"{label} muss ja oder nein sein",dateFormat:"Ung\xFCltiges Datumsformat (erwartet JJJJ-MM-TT)",dateInvalid:"Ung\xFCltiges Datum (Monat und Tag pr\xFCfen)",datetimeFormat:"Ung\xFCltiges Datums- und Zeitformat (erwartet JJJJ-MM-TTTHH:MM:SS)",datetimeInvalid:"Ung\xFCltiges Datum oder ung\xFCltige Uhrzeit",choice:"Muss eines davon sein: {options}",choices:"{label} muss eine Liste von Optionen sein",record:"{label} muss ein Datensatz sein",records:"{label} muss eine Liste von Datens\xE4tzen sein",reference:"{label} muss auf {models} verweisen",file:"{label} muss eine Datei sein",fileSize:"{label} ist gr\xF6\xDFer als {size}",fileType:"{label} muss eine {types}-Datei sein",or:"oder"},fr:{required:"{label} est obligatoire",maxLength:"{max} caract\xE8res au maximum",pattern:"{label} n'a pas le format attendu",text:"{label} doit \xEAtre du texte",number:"{label} doit \xEAtre un nombre",integer:"{label} doit \xEAtre un nombre entier",min:"{label} doit \xEAtre au moins {min}",max:"{label} doit \xEAtre au plus {max}",decimals:"{digits} d\xE9cimales au maximum",boolean:"{label} doit \xEAtre oui ou non",dateFormat:"Format de date invalide (attendu AAAA-MM-JJ)",dateInvalid:"Date invalide (v\xE9rifiez le mois et le jour)",datetimeFormat:"Format de date et heure invalide (attendu AAAA-MM-JJTHH:MM:SS)",datetimeInvalid:"Date ou heure invalide",choice:"Doit \xEAtre parmi : {options}",choices:"{label} doit \xEAtre une liste de choix",record:"{label} doit \xEAtre un enregistrement",records:"{label} doit \xEAtre une liste d'enregistrements",reference:"{label} doit pointer vers {models}",file:"{label} doit \xEAtre un fichier",fileSize:"{label} d\xE9passe {size}",fileType:"{label} doit \xEAtre un fichier {types}",or:"ou"}};function jr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function qt(e,t,r,n=Qe.en){let o=e.label||"This field",i=(s,a={})=>jr(n[s],{label:o,...a});if(Dr(e,t))return r?i("required"):void 0;switch(e.type){case"char":case"text":case"html":return typeof t!="string"?i("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?i("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?i("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?i("number"):e.type==="integer"&&!Number.isInteger(t)?i("integer"):e.min!==void 0&&t<e.min?i("min",{min:e.min}):e.max!==void 0&&t>e.max?i("max",{max:e.max}):e.type!=="integer"&&e.digits&&Qf(t)>e.digits[1]?i("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:i("boolean");case"date":return ep(t,i);case"datetime":return rp(t,i);case"selection":{let s=new Set(e.options.map(c=>c.value)),a=i("choice",{options:e.options.map(c=>c.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(c=>s.has(c))?void 0:a:i("choices"):s.has(t)?void 0:a}case"many2one":return Po(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Po)?void 0:i("records");case"reference":{let s=t;if(!Po(t)||typeof s.model!="string")return i("record");if(!e.models.some(a=>a.value===s.model)){let a=Du(e.models.map(c=>c.label),n.or);return i("reference",{models:a,aModels:ju(a)})}return}case"binary":case"image":return np(e,t,i,n);default:return}}function Qf(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let r=t.indexOf(".");return r===-1?0:t.length-r-1}function Po(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function ep(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[r,n,o]=e.split("-").map(Number);return Mu(r,n,o)?void 0:t("dateInvalid")}var tp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function rp(e,t){let r=typeof e=="string"?tp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,a,c]=r.slice(1).map(u=>Number(u??0));return Mu(n,o,i)&&s<24&&a<60&&c<60?void 0:t("datetimeInvalid")}function Mu(e,t,r){if(t<1||t>12||r<1)return!1;let n=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return r<=n[t-1]}function np(e,t,r,n){let o=t;if(!op(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:Gt(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>ip(i,o.type))){let i=Du(e.accept.map(sp),n.or);return r("fileType",{types:i,aTypes:ju(i)})}}function op(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function ip(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function sp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Du(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function ju(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function Gt(e){let t=["bytes","KB","MB","GB"],r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${Number(r.toFixed(1))} ${t[n]}`}var Yt={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Vr(e,t=Yt){return new Promise(r=>{t.setTimeout(r,e)})}function Vu(e={}){let t=G(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?Vr(e.delayMs,e.scheduler):Promise.resolve(),s=f=>t[f]??(t[f]={}),a=(f,h)=>{let x=s(f)[String(h)]?.[e.labelField?.[f]??"name"];return typeof x=="string"?x:String(h)},c=f=>Math.max(0,...Object.keys(s(f)).map(Number).filter(Number.isFinite))+1,u=f=>Number.isFinite(Number(f))?Number(f):f;function l(f,h){let x=[...f];for(let d of h)d.op==="create"?x.push({key:d.key,id:++o,values:G(d.values)}):d.op==="update"?x=x.map(v=>v.id===d.id?{...v,values:{...v.values,...G(d.values)}}:v):x=x.filter(v=>v.id!==d.id);return x}function p(f,h,x){let d=[...f],v=P=>({id:P,label:a(x,P)});for(let P of h)P.op==="link"&&!d.some(j=>j.id===P.id)?d.push(v(P.id)):P.op==="unlink"?d=d.filter(j=>j.id!==P.id):P.op==="set"?d=P.ids.map(v):P.op==="clear"&&(d=[]);return d}function m(f,h){let x=f[h];return x&&"relation"in x?x.relation:h}return{records:t,responses:r,calls:n,async load(f){n.push({method:"load",request:f}),await i();let h=s(f.model)[String(f.id)];if(!h)throw new Error(`No ${f.model} record with id ${f.id}`);return G(h)},async save(f){n.push({method:"save",request:f}),await i();let h=f.id??c(f.model),x={...s(f.model)[String(h)]??{},...G(f.changes.values)};for(let[d,v]of Object.entries(f.changes.lines))x[d]=l(x[d]??[],v);for(let[d,v]of Object.entries(f.changes.links))x[d]=p(x[d]??[],v,m(f.fields,d));return s(f.model)[String(h)]=x,{id:h,values:G(x)}},async onchange(f){n.push({method:"onchange",request:f}),await i();let h=e.onchange?.[f.model]?.[f.changed],x=e.warnings?.[f.model]?.[f.changed],d=h?{values:h(G(f.values))}:{},v=x?.(G(f.values));return v?{...d,warning:v}:d},async search(f){n.push({method:"search",request:f}),await i();let h=f.query.trim().toLowerCase();return Object.entries(s(f.model)).filter(([,x])=>(f.filter??[]).every(d=>ap(x,d))).map(([x])=>({id:u(x),label:a(f.model,u(x))})).filter(x=>x.label.toLowerCase().includes(h)).slice(0,f.limit??8)},async submit(f){return n.push({method:"submit",request:f}),await i(),r.push(G(f)),{id:r.length}}}}function ap(e,t){let r=e[t.field],n=r!==null&&typeof r=="object"&&"id"in r?r.id:r,o=t.value;switch(t.op){case"=":return n===o;case"!=":return n!==o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;case"in":return Array.isArray(o)&&o.includes(n);case"not in":return Array.isArray(o)&&!o.includes(n);case"like":return String(n??"").includes(String(o));case"ilike":return String(n??"").toLowerCase().includes(String(o).toLowerCase())}}function Ur(e){let{page:t}=e,r=e.scheduler??Yt,n=e.messages??Qe.en,o=lp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(y=>y.id):[],s=()=>`fieldia:draft:${t.id}:${c.recordId??"new"}`,a={...$t(t.fields),...G(e.values??{})},c={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:G(a),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},u=0,l=0,p=null,m=null,f=new Set,h=new Set,x=null;function d(y){c={...c,...y};for(let _ of[...h])_(c)}function v(y){f.add(y);let _=()=>f.delete(y);return y.then(_,_),y}function P(){return x?.values!==c.values&&(x={values:c.values,context:Kt(c.values,t.fields)}),x.context}function j(y){let _=t.fields[y];if(!_)throw new Error(`The page has no field "${y}"`);return _}function S(y){return Object.keys(t.fields).filter(_=>JSON.stringify(y[_]??null)!==JSON.stringify(a[_]??null))}function w(y){let _=o.get(y);if(!_)throw new Error(`The page has no element "${y}"`);let k=P(),L=_.invisible.evaluate(k);for(let V=_.parent;!L&&V;V=o.get(V)?.parent??null)L=o.get(V)?.invisible.evaluate(k)??!1;let J=_.field?t.fields[_.field]:void 0;return{invisible:L,readonly:_.readonly.evaluate(k)||J?.readonly===!0,required:_.required.evaluate(k)||J?.required===!0}}function $(y){let _=k=>{if(!y)return!0;for(let L=k.id;L;L=o.get(L)?.parent??null)if(L===y)return!0;return!1};return[...o.values()].filter(k=>k.kind==="field"&&_(k)&&!w(k.id).invisible)}function H(y){let _={};for(let k of $(y)){let L=k.field;if(_[L])continue;let J=t.fields[L],V=qt(J,c.values[L],w(k.id).required,n);if(V&&(_[L]=V),J.type==="one2many")for(let ae of c.values[L]??[])for(let[ze,Ue]of Object.entries(J.fields)){let Le=qt(Ue,ae.values[ze],Ue.required===!0,n);Le&&(_[`${L}.${ae.key}.${ze}`]=Le)}}return _}function te(y,_={}){let k=Object.keys(c.errors).length?Q(y):c.errors;d({values:y,dirty:S(y),errors:k,..._})}function Q(y){let _=c;c={...c,values:y};let k=H(c.step??void 0);c=_;let L={};for(let J of Object.keys(c.errors))k[J]&&(L[J]=k[J]);return L}function oe(){let y=e.drafts;y&&(p!==null&&r.clearTimeout(p),p=r.setTimeout(()=>{p=null,y.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:c.values}))},y.delayMs??400))}function B(){p!==null&&r.clearTimeout(p),p=null,e.drafts?.store.removeItem(s())}function se(){let y=e.drafts;if(!y)return;let _=y.store.getItem(s());if(!_)return;let k;try{k=JSON.parse(_)}catch{y.store.removeItem(s());return}y.restore==="auto"?te({...c.values,...k.values},{draft:null}):d({draft:{savedAt:k.savedAt}})}function de(){let y=e.autosave;!y||t.data.kind!=="record"||(m!==null&&r.clearTimeout(m),m=r.setTimeout(()=>{m=null,c.dirty.length&&Object.keys(H()).length===0&&v(Te())},y.delayMs))}function et(y){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let k=++l,L={model:t.data.model,id:c.recordId,changed:y,values:G(c.values)};v(_.onchange(L).then(J=>{if(k!==l)return;let V={...c.values,...J.values??{}};te(V,{warning:J.warning??null,warningField:J.warning?y:null})},()=>{}))}function Ze(y){oe(),de(),et(y)}function Ve(){let y={values:{},lines:{},links:{}};for(let _ of c.dirty){let k=t.fields[_],L=c.values[_],J=a[_];k.type==="one2many"?y.lines[_]=cp(J??[],L??[]):k.type==="many2many"?y.links[_]=up(J??[],L??[]):y.values[_]=G(L)}return y}function Ie(){let y={};for(let _ of $()){let k=_.field;y[k]=G(c.values[k])}return y}async function Te(){let y=H();if(Object.keys(y).length)return d({errors:y}),!1;let _=e.dataSource;d({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!_?.submit)throw new Error("This page has no data source to send its answers to");return await _.submit({pageId:t.id,values:Ie()}),B(),d({status:"saved"}),!0}if(!_?.save)throw new Error("This page has no data source to save to");let k=await _.save({model:t.data.model,id:c.recordId,fields:t.fields,changes:Ve(),values:G(c.values)});B();let L=k.values?{...c.values,...k.values}:c.values;return a=G(L),d({status:"saved",recordId:k.id,values:L,dirty:[]}),!0}catch(k){return d({status:"error",error:k.message}),!1}}async function tt(y,_,k,L,J,V){if(y.type!=="many2one"&&y.type!=="many2many"&&y.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(y.type==="reference"&&!V)throw new Error(`Searching "${_}" needs a model`);let ae=e.dataSource;if(!ae?.search)return[];let ze=y.type==="reference"?void 0:y.filter?.map(({field:Le,op:Hr,value:g,valueFrom:z})=>({field:Le,op:Hr,value:z!==void 0?k[z]??null:g??null})),Ue=y.type==="reference"?V:y.relation;return v(ae.search({model:Ue,query:L,...ze?{filter:ze}:{},limit:J}))}function rt(y){let _=j(y);if(_.type!=="one2many")throw new Error(`"${y}" is a ${_.type}, not a one2many`);return _}function nt(){return c.step?i.indexOf(c.step):-1}async function tr(){let y=e.dataSource;if(!(c.recordId==null||t.data.kind!=="record")){if(!y?.load){d({status:"error",error:"This page has no data source to load from"});return}d({status:"loading",error:null});try{let _=await y.load({model:t.data.model,id:c.recordId,fields:t.fields});a={...$t(t.fields),..._},d({status:"ready",values:G(a),dirty:[],errors:{}}),se()}catch(_){d({status:"error",error:_.message})}}}let St={page:t,getState:()=>c,subscribe(y){return h.add(y),()=>h.delete(y)},load:()=>v(tr()),setValue(y,_){j(y),te({...c.values,[y]:G(_)}),Ze(y)},node:w,fieldReadonly:y=>j(y).readonly===!0,validate(){let y=H();return d({errors:y}),Object.keys(y).length===0},save:()=>v(Te()),reset(){B(),d({values:G(a),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:Ve,addLine(y,_={}){let k=rt(y),L=`new-${++u}`,J={key:L,values:{...$t(k.fields),...G(_)}},V=[...c.values[y]??[],J];return te({...c.values,[y]:V}),Ze(y),L},updateLine(y,_,k,L){if(!rt(y).fields[k])throw new Error(`The lines of "${y}" have no field "${k}"`);let V=(c.values[y]??[]).map(ae=>ae.key===_?{...ae,values:{...ae.values,[k]:G(L)}}:ae);te({...c.values,[y]:V}),Ze(y)},removeLine(y,_){rt(y);let k=(c.values[y]??[]).filter(L=>L.key!==_);te({...c.values,[y]:k}),Ze(y)},async search(y,_,k=8,L={}){return tt(j(y),y,P(),_,k,L.model)},async searchLine(y,_,k,L,J=8){let V=rt(y),ae=V.fields[k];if(!ae)throw new Error(`The lines of "${y}" have no field "${k}"`);let ze=(c.values[y]??[]).find(Ue=>Ue.key===_);if(!ze)throw new Error(`"${y}" has no line "${_}"`);return tt(ae,k,Kt(ze.values,V.fields),L,J)},steps:()=>i.filter(y=>!w(y).invisible),next(){if(!c.step)return!1;let y=H(c.step);if(Object.keys(y).length)return d({errors:y}),!1;let _=St.steps(),k=i.slice(nt()+1).find(L=>_.includes(L));return k?(d({step:k,errors:{}}),!0):!1},back(){if(!c.step)return!1;let y=St.steps(),_=i.slice(0,nt()).reverse().find(k=>y.includes(k));return _?(d({step:_,errors:{}}),!0):!1},async runAction(y){let _=o.get(y);if(!_||_.kind!=="button"&&_.kind!=="stat")throw new Error(`The page has no button "${y}"`);if(w(y).invisible)return;let k=_.source;await v(Promise.resolve(e.onAction?.({id:y,action:k.action,..."params"in k&&k.params?{params:k.params}:{},recordId:c.recordId,values:G(c.values)})))},restoreDraft(){let y=e.drafts?.store.getItem(s());if(!y)return;let _=JSON.parse(y);te({...c.values,..._.values},{draft:null})},discardDraft(){B(),d({draft:null})},async settled(){for(;f.size;)await Promise.allSettled([...f])},dispose(){p!==null&&r.clearTimeout(p),m!==null&&r.clearTimeout(m),h.clear()}};return c.recordId==null&&se(),St}function cp(e,t){let r=[],n=new Map(e.filter(i=>i.id!==void 0).map(i=>[i.key,i]));for(let i of t){let s=n.get(i.key);if(i.id===void 0||!s){r.push({op:"create",key:i.key,values:G(i.values)});continue}let a={};for(let[c,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[c])&&(a[c]=G(u));Object.keys(a).length&&r.push({op:"update",id:i.id,values:a})}let o=new Set(t.map(i=>i.key));for(let i of e)i.id!==void 0&&!o.has(i.key)&&r.push({op:"delete",id:i.id});return r}function up(e,t){let r=new Set(e.map(o=>o.id)),n=new Set(t.map(o=>o.id));return[...t.filter(o=>!r.has(o.id)).map(o=>({op:"link",id:o.id})),...e.filter(o=>!n.has(o.id)).map(o=>({op:"unlink",id:o.id}))]}function lp(e){let t=new Map,r=(o,i,s,a)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:a.field,invisible:Xe(a.invisible),readonly:Xe(a.readonly),required:Xe(a.required),source:o})},n=(o,i)=>{for(let s of o)if(s.type==="field")r(s,i,"field",{invisible:s.invisible,readonly:s.readonly,required:s.required,field:s.field});else if(s.type==="button")r(s,i,"button",{invisible:s.invisible});else if(s.type==="tabs"){r(s,i,"other",{invisible:s.invisible});for(let a of s.children)r(a,s.id,"other",{invisible:a.invisible}),n(a.children,a.id)}else r(s,i,"other",{invisible:s.invisible}),s.type==="section"&&n(s.children,s.id)};if(e.type==="tabs")return n([e],""),t.get(e.id).parent=null,t;if(r(e,null,"other",{}),e.type==="wizard")for(let o of e.children)r(o,e.id,"step",{invisible:o.invisible}),n(o.children,o.id);else if(e.type==="sections")n(e.children,e.id);else{let o=(i,s)=>{s&&r({id:i},e.id,"field",{field:s})};o("#title",e.title?.field),o("#subtitle",e.title?.subtitleField),o("#avatar",e.title?.avatarField),o("#statusbar",e.statusbar?.field);for(let i of e.buttons??[])r(i,e.id,"button",{invisible:i.invisible});for(let i of e.statButtons??[])r(i,e.id,"stat",{invisible:i.invisible});e.ribbon&&r(e.ribbon,e.id,"other",{invisible:e.ribbon.invisible});for(let i of e.alerts??[])r(i,e.id,"other",{invisible:i.invisible});n(e.children,e.id),e.sidePanel&&r(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible})}return t}var we={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",deleteLine:"Delete line",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",deleteLine:"Supprimer la ligne",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var dp=180;function Uu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function Oo(e){let{document:t,id:r,labels:n}=e,o=`${r}-list`,i=t.createElement("input");Object.assign(i,{id:r,className:"fd-input fd-combo-input",autocomplete:"off"}),i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",o),i.placeholder=n.search;let s=t.createElement("ul");s.id=o,s.className="fd-listbox",s.setAttribute("role","listbox"),s.hidden=!0;let a=t.createElement("div");a.className="fd-combo",a.append(i,s);let c="",u=!1,l=[],p=-1,m=0,f,h=!1;function x(){if(s.replaceChildren(),l.forEach((S,w)=>{let $=t.createElement("li");$.id=`${o}-${w}`,$.setAttribute("role","option"),$.setAttribute("aria-selected",String(w===p)),$.className=w===p?"fd-option fd-active":"fd-option",$.textContent=S.label,$.addEventListener("mousedown",H=>H.preventDefault()),$.addEventListener("click",()=>P(w)),s.append($)}),!l.length){let S=t.createElement("li");S.className="fd-empty",S.textContent=n.noResults,s.append(S)}p>=0?i.setAttribute("aria-activedescendant",`${o}-${p}`):i.removeAttribute("aria-activedescendant")}function d(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function v(){s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),p=-1}function P(S){let w=l[S];w&&(v(),u=!1,e.pick(w))}function j(S){clearTimeout(f);let w=++m;f=setTimeout(async()=>{let $=await e.search(S).catch(()=>[]);if(w!==m||t.activeElement!==i)return;let H=e.exclude?.()??new Set;l=$.filter(te=>!H.has(te.id)),p=-1,x(),d()},dp)}return i.addEventListener("input",()=>{u=!0,h||j(i.value)}),i.addEventListener("focus",()=>{h||j("")}),i.addEventListener("keydown",S=>{if(!h)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return j(i.value);if(!l.length)return;p=(p+(S.key==="ArrowDown"?1:-1)+l.length)%l.length,x(),s.children[p]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&p>=0&&(S.preventDefault(),P(p));return;case"Escape":s.hidden||S.preventDefault(),v(),u=!1,i.value=c;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{m++,clearTimeout(f),v();let S=u&&i.value.trim()===""&&c!=="";u=!1,S?e.onCommitEmpty?.():i.value=c}),{element:a,input:i,setText(S){c=S,u||(i.value=S)},setReadonly(S){h=S,i.readOnly=S,S&&v()},close:v}}var No=({form:e,name:t,field:r,id:n,document:o,labels:i=we.en})=>{let s=Oo({document:o,id:n,labels:i,search:c=>e.search(t,c),pick:c=>e.setValue(t,c),onCommitEmpty:()=>e.setValue(t,null)}),a=o.createElement("button");return a.type="button",a.className="fd-combo-clear",a.textContent="\xD7",a.setAttribute("aria-label",Uu(i.clear,{label:r.label})),a.addEventListener("click",()=>{e.setValue(t,null),s.input.focus()}),s.element.append(a),{element:s.element,focus:()=>s.input.focus(),update(c){let u=c.value;s.setText(u?.label??""),s.setReadonly(c.readonly),a.hidden=!u||c.readonly,s.input.setAttribute("aria-invalid",String(c.invalid)),s.input.setAttribute("aria-required",String(c.required)),c.describedBy&&s.input.setAttribute("aria-describedby",c.describedBy)}}},Br=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=()=>e.getState().values[t]??[],s=n.createElement("div");s.className="fd-tags",s.setAttribute("role","group");let a=n.createElement("ul");a.className="fd-chips";let c=Oo({document:n,id:r,labels:o,search:p=>e.search(t,p),pick:p=>{e.setValue(t,[...i(),p]),c.input.value=""},exclude:()=>new Set(i().map(p=>p.id)),onEmptyBackspace:()=>{let p=i();p.length&&e.setValue(t,p.slice(0,-1))}});s.append(a,c.element);let u=!1,l="";return{element:s,focus:()=>c.input.focus(),update(p){let m=p.value??[],f=JSON.stringify([p.readonly,m]);u=p.readonly,c.setReadonly(u),c.element.hidden=u,c.input.setAttribute("aria-invalid",String(p.invalid)),p.describedBy&&c.input.setAttribute("aria-describedby",p.describedBy),f!==l&&(l=f,a.replaceChildren(...m.map(h=>{let x=n.createElement("li");x.className="fd-chip";let d=n.createElement("span");if(d.className="fd-chip-label",d.textContent=h.label,x.append(d),!u){let v=n.createElement("button");v.type="button",v.className="fd-chip-remove",v.textContent="\xD7",v.setAttribute("aria-label",Uu(o.remove,{name:h.label})),v.addEventListener("click",()=>e.setValue(t,i().filter(P=>P.id!==h.id))),x.append(v)}return x})),c.setText(""))}}},Zo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-choices fd-choices-checkbox",o.setAttribute("role","group");let i=[],s={readonly:!1,value:[]},a=()=>{let c=new Set(s.value.map(u=>u.id));for(let{record:u,box:l}of i)l.checked=c.has(u.id),l.disabled=s.readonly};return e.search(t,"",50).then(c=>{i=c.map((u,l)=>{let p=n.createElement("input");p.type="checkbox",p.id=`${r}-${l}`,p.addEventListener("change",()=>{let h=e.getState().values[t]??[];e.setValue(t,p.checked?[...h,u]:h.filter(x=>x.id!==u.id))});let m=n.createElement("label");m.className="fd-choice",m.htmlFor=p.id;let f=n.createElement("span");return f.textContent=u.label,m.append(p,f),o.append(m),{record:u,box:p}}),a()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(c){s={readonly:c.readonly,value:c.value??[]},a()}}},To=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=we.en}=e,a=n.type==="reference"?n.models:[],c=i.createElement("div");c.className="fd-reference";let u=i.createElement("select");u.className="fd-input fd-select",u.setAttribute("aria-label",n.label),u.append(i.createElement("option"));for(let m of a){let f=i.createElement("option");f.value=String(m.value),f.textContent=m.label,u.append(f)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let p=Oo({document:i,id:o,labels:s,search:m=>l?t.search(r,m,8,{model:l}):Promise.resolve([]),pick:m=>t.setValue(r,{model:l,id:m.id,label:m.label}),onCommitEmpty:()=>t.setValue(r,null)});return c.append(u,p.element),{element:c,focus:()=>l?p.input.focus():u.focus(),update(m){let f=m.value;f&&(l=f.model),u.value=l,u.disabled=m.readonly,p.setText(f?.label??""),p.setReadonly(m.readonly||!l)}}};function fp(e,t,r){let n=()=>(e.getState().values[t]??[]).find(o=>o.key===r)?.values??{};return{...e,getState:()=>({...e.getState(),values:n()}),setValue:(o,i)=>e.updateLine(t,r,o,i),search:(o,i,s)=>e.searchLine(t,r,o,i,s)}}var Ao=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=we.en})=>{let a=r,c=(n.columns??Object.keys(a.fields)).filter(w=>a.fields[w]),u=i.createElement("div");u.className="fd-lines",u.id=o,u.setAttribute("role","group");let l=i.createElement("div");l.className="fd-lines-scroll";let p=i.createElement("table");p.className="fd-lines-table";let m=i.createElement("thead"),f=i.createElement("tr");for(let w of c){let $=i.createElement("th");$.scope="col",$.textContent=a.fields[w].label,f.append($)}let h=i.createElement("th");h.className="fd-lines-tools",f.append(h),m.append(f);let x=i.createElement("tbody");p.append(m,x),l.append(p);let d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link fd-lines-add",d.textContent=`+ ${s.addLine}`,u.append(l,d);let v=new Map,P=null,j=!1;d.addEventListener("click",()=>{P=e.addLine(t);let w=v.get(P);w&&(w.cells[0]?.widget.focus(),P=null)});function S(w){let $=i.createElement("tr");$.dataset.line=w.key;let H=fp(e,t,w.key),te=c.map(B=>{let se=a.fields[B],de=`${o}-${w.key}-${B}`,et={type:"field",id:`${n.id}.${w.key}.${B}`,field:B},Ze=Xt({form:H,name:B,field:se,node:et,id:de,document:i,labels:s}),Ve=i.createElement("td"),Ie=i.createElement("label");Ie.className="fd-sr-only",Ie.htmlFor=de,Ie.textContent=se.label;let Te=i.createElement("div");return Te.className="fd-cell-error",Te.hidden=!0,Ve.append(Ie,Ze.element,Te),$.append(Ve),{name:B,def:se,widget:Ze,error:Te}}),Q=i.createElement("td");Q.className="fd-lines-tools";let oe=i.createElement("button");return oe.type="button",oe.className="fd-line-delete",oe.textContent="\xD7",oe.setAttribute("aria-label",s.deleteLine),oe.addEventListener("click",()=>e.removeLine(t,w.key)),Q.append(oe),$.append(Q),{element:$,cells:te,remove:oe}}return{element:u,focus:()=>(x.querySelector("input, select, textarea")??d).focus(),update(w){j=w.readonly,d.hidden=j;let $=w.value??[],H=e.getState().errors,te=new Set($.map(Q=>Q.key));for(let[Q,oe]of v)te.has(Q)||(oe.element.remove(),v.delete(Q));$.forEach((Q,oe)=>{let B=v.get(Q.key);B||(B=S(Q),v.set(Q.key,B)),x.children[oe]!==B.element&&x.insertBefore(B.element,x.children[oe]??null),B.remove.hidden=j,j?B.remove.remove():B.remove.isConnected||B.element.lastElementChild?.append(B.remove);for(let se of B.cells){let de=H[`${t}.${Q.key}.${se.name}`];se.error.hidden=!de,se.error.textContent=de??"",se.widget.update({value:Q.values[se.name],values:Q.values,readonly:j||se.def.readonly===!0,required:se.def.required===!0,invalid:!!de})}}),P&&v.has(P)&&(v.get(P)?.cells[0]?.widget.focus(),P=null)}}};function pp(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{let o=String(n.result??"");t({name:e.name,type:e.type,size:e.size,data:o.slice(o.indexOf(",")+1)})},n.onerror=()=>r(n.error),n.readAsDataURL(e)})}function Bu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=we.en})=>{let a=i.createElement("div");a.className=`fd-file fd-file-${e}`;let c=i.createElement("input");c.type="file",c.id=o,c.className="fd-sr-only";let u=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;u&&(c.accept=u.join(","));let l=i.createElement("img");l.className="fd-image-preview",l.alt=n.label,l.hidden=!0;let p=i.createElement("label");p.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",p.htmlFor=o;let m=i.createElement("span");m.className="fd-button",m.textContent=e==="image"?s.uploadImage:s.upload;let f=i.createElement("span");f.className="fd-help",f.textContent=s.dropHere,p.append(m,f);let h=i.createElement("div");h.className="fd-file-chosen";let x=i.createElement("span");x.className="fd-file-name";let d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=s.replace,d.addEventListener("click",()=>c.click());let v=i.createElement("button");v.type="button",v.className="fd-button fd-button-link",v.textContent=s.removeFile,v.addEventListener("click",()=>t.setValue(r,null)),h.append(x,d,v),a.append(c,...e==="image"?[l]:[],p,h);let P=!1,j=async S=>{!S||P||t.setValue(r,await pp(S))};return c.addEventListener("change",()=>{j(c.files?.[0]),c.value=""}),a.addEventListener("dragover",S=>{P||(S.preventDefault(),a.classList.add("fd-dragging"))}),a.addEventListener("dragleave",()=>a.classList.remove("fd-dragging")),a.addEventListener("drop",S=>{S.preventDefault(),a.classList.remove("fd-dragging"),j(S.dataTransfer?.files?.[0])}),{element:a,focus:()=>(p.hidden?d:c).focus(),update(S){P=S.readonly;let w=S.value;if(p.hidden=!!w||P,h.hidden=!w,d.hidden=v.hidden=P,c.disabled=P,c.setAttribute("aria-invalid",String(S.invalid)),S.describedBy&&c.setAttribute("aria-describedby",S.describedBy),x.textContent=w?`${w.name} \xB7 ${Gt(w.size)}`:"",e==="image"){let $=w?w.data?`data:${w.type};base64,${w.data}`:w.url??"":"";l.hidden=!$,l.getAttribute("src")!==$&&($?l.src=$:l.removeAttribute("src"))}}}}}var Ro=Bu("binary"),Io=Bu("image");var mp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),hp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function Lo(e,t=globalThis.document){let r=t.createElement("template");r.innerHTML=e;let n=i=>{for(let s of[...i.childNodes]){if(s.nodeType===Node.TEXT_NODE)continue;if(s.nodeType!==Node.ELEMENT_NODE){s.remove();continue}let a=s;if(hp.has(a.tagName)){a.remove();continue}if(n(a),!mp.has(a.tagName)){a.replaceWith(...a.childNodes);continue}let c=a.tagName==="A"?a.getAttribute("href"):null;for(let u of[...a.attributes])a.removeAttribute(u.name);c&&/^(https?:|mailto:)/i.test(c.trim())&&a.setAttribute("href",c.trim())}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}var Fo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-input fd-richtext",o.setAttribute("role","textbox"),o.setAttribute("aria-multiline","true"),o.setAttribute("contenteditable","true");let i="";return o.addEventListener("input",()=>{let s=Lo(o.innerHTML,n);i=s,e.setValue(t,s.trim()===""?null:s)}),o.addEventListener("blur",()=>{o.innerHTML!==i&&(o.innerHTML=i)}),{element:o,focus:()=>o.focus(),update(s){let a=Lo(typeof s.value=="string"?s.value:"",n);(a!==i||n.activeElement!==o)&&(o.innerHTML!==a&&(o.innerHTML=a),i=a),o.setAttribute("contenteditable",String(!s.readonly)),o.setAttribute("aria-readonly",String(s.readonly)),o.setAttribute("aria-invalid",String(s.invalid)),s.describedBy&&o.setAttribute("aria-describedby",s.describedBy)}}},Jr=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=n.createElement("div");i.className="fd-json";let s=n.createElement("textarea");s.id=r,s.className="fd-input fd-textarea fd-code",s.spellcheck=!1;let a=n.createElement("div");return a.className="fd-cell-error",a.hidden=!0,i.append(s,a),s.addEventListener("input",()=>{if(s.value.trim()===""){a.hidden=!0,e.setValue(t,null);return}try{let c=JSON.parse(s.value);a.hidden=!0,e.setValue(t,c)}catch{a.hidden=!1,a.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(c){if(n.activeElement!==s){let u=c.value===null||c.value===void 0?"":JSON.stringify(c.value,null,2);s.value!==u&&(s.value=u)}s.readOnly=c.readonly,s.setAttribute("aria-invalid",String(c.invalid||!a.hidden))}}};function Xt(e,t={}){let{field:r,node:n}=e,o=[n.widget?`${r.type}.${n.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type].filter(i=>i!==null);for(let i of o){let s=t[i]??Gu[i];if(s)return s(e)}return wp(e)}function le(e,t,r={},...n){let o=e.createElement(t);for(let[i,s]of Object.entries(r))s!==void 0&&o.setAttribute(i,s);return o.append(...n),o}function je(e,t){e.setAttribute("aria-invalid",String(t.invalid)),e.setAttribute("aria-required",String(t.required)),t.describedBy?e.setAttribute("aria-describedby",t.describedBy):e.removeAttribute("aria-describedby")}var er=e=>e==null?"":String(e);function Qt(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let a=le(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(a.maxLength=n.size),o.placeholder&&(a.placeholder=o.placeholder),a.addEventListener("input",()=>t.setValue(r,a.value===""?null:a.value)),{element:a,focus:()=>a.focus(),update(c){let u=er(c.value);a.value!==u&&(a.value=u),a.readOnly=c.readonly,je(a,c)}}}}var gp=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=le(i,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});return r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),n.placeholder&&(s.placeholder=n.placeholder),s.addEventListener("input",()=>e.setValue(t,s.value===""?null:s.value)),{element:s,focus:()=>s.focus(),update(a){let c=er(a.value);s.value!==c&&(s.value=c),s.readOnly=a.readonly,je(s,a)}}},bp=/^-?(\d+\.?\d*|\.\d+)$/,yp=/^-?\.?$/,Co=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,a=n.type==="integer",c=le(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=a?"numeric":"decimal",o.placeholder&&(c.placeholder=o.placeholder);let u=m=>{let f=m.trim();if(f==="")return null;if(bp.test(f))return Number(f);if(!yp.test(f))return f};c.addEventListener("input",()=>{let m=u(c.value);m!==void 0&&t.setValue(r,m)}),c.addEventListener("blur",()=>{c.value=er(t.getState().values[r])});let l=n.type==="monetary"?le(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?le(s,"span",{class:"fd-number"},l,c):c,focus:()=>c.focus(),update(m){let f=s.activeElement===c,h=u(c.value),x=h===void 0||h===m.value;if(!(f&&x)){let d=er(m.value);c.value!==d&&(c.value=d)}if(c.readOnly=m.readonly,je(c,m),l&&n.type==="monetary"){let d=n.currencyField?m.values[n.currencyField]:null;l.textContent=d&&typeof d=="object"&&"label"in d?d.label:typeof d=="string"?d:n.currency??""}}}};function Ju(e){return({form:t,name:r,id:n,document:o})=>{let i=le(o,"input",{id:n,type:"checkbox",class:e?"fd-switch":"fd-checkbox",role:e});return i.addEventListener("change",()=>t.setValue(r,i.checked)),{element:i,focus:()=>i.focus(),update(s){i.checked=s.value===!0,i.disabled=s.readonly,je(i,s)}}}}function Ku(e){return e.type==="selection"?e.options:[]}var xp=({form:e,name:t,field:r,id:n,document:o})=>{let i=Ku(r),s=le(o,"select",{id:n,class:"fd-input fd-select"},le(o,"option",{value:""}));return i.forEach((a,c)=>s.append(le(o,"option",{value:String(c)},a.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(a){let c=i.findIndex(u=>u.value===a.value);s.value=c===-1?"":String(c),s.disabled=a.readonly,je(s,a)}}};function Wu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Ku(n),a=le(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),c=s.map((u,l)=>{let p=le(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return a.append(le(i,"label",{class:"fd-choice",for:`${o}-${l}`},p,le(i,"span",{},u.label))),p});return a.addEventListener("change",()=>{if(e==="radio"){let u=c.findIndex(l=>l.checked);t.setValue(r,u===-1?null:s[u].value)}else t.setValue(r,s.filter((u,l)=>c[l].checked).map(u=>u.value))}),{element:a,focus:()=>(c.find(u=>u.checked)??c[0])?.focus(),update(u){let l=Array.isArray(u.value)?u.value:[u.value];c.forEach((p,m)=>{p.checked=l.includes(s[m].value),p.disabled=u.readonly}),je(a,u)}}}}function Hu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s="min"in n&&n.min!==void 0?n.min:e==="rating"?1:0,a="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,c=le(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=a;l++){let p=le(i,"button",{type:"button",role:"radio","aria-label":`${l} of ${a}`,"data-value":String(l)},e==="rating"?"\u2605":String(l));e==="scale"&&p.removeAttribute("aria-label"),p.addEventListener("click",()=>t.setValue(r,l)),u.push(p),c.append(p)}return c.addEventListener("keydown",l=>{let p=t.getState().values[r],m=typeof p=="number"?p:s-1,f=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!f)return;l.preventDefault();let h=Math.min(a,Math.max(s,m+f));t.setValue(r,h),u[h-s]?.focus()}),{element:c,focus:()=>(u.find(l=>l.getAttribute("aria-checked")==="true")??u[0])?.focus(),update(l){let p=typeof l.value=="number"?l.value:null;u.forEach((m,f)=>{let h=s+f;m.setAttribute("aria-checked",String(h===p)),m.classList.toggle("fd-on",e==="rating"?p!==null&&h<=p:h===p),m.tabIndex=h===p||p===null&&f===0?0:-1,m.disabled=l.readonly}),je(c,l)}}}}var vp=({form:e,name:t,id:r,document:n})=>{let o=le(n,"input",{id:r,type:"date",class:"fd-input fd-date"});return o.addEventListener("input",()=>e.setValue(t,o.value||null)),{element:o,focus:()=>o.focus(),update(i){let s=er(i.value);o.value!==s&&(o.value=s),o.readOnly=i.readonly,je(o,i)}}},Wr=e=>String(e).padStart(2,"0"),_p=({form:e,name:t,id:r,document:n})=>{let o=le(n,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),i=s=>{if(typeof s!="string"||!s)return"";let a=new Date(s);return Number.isNaN(a.getTime())?"":`${a.getFullYear()}-${Wr(a.getMonth()+1)}-${Wr(a.getDate())}T${Wr(a.getHours())}:${Wr(a.getMinutes())}`};return o.addEventListener("input",()=>{if(!o.value)return e.setValue(t,null);let s=new Date(o.value);Number.isNaN(s.getTime())||e.setValue(t,s.toISOString())}),{element:o,focus:()=>o.focus(),update(s){let a=i(s.value);o.value!==a&&(o.value=a),o.readOnly=s.readonly,je(o,s)}}};function wp({field:e,id:t,document:r}){let n=le(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=qu(o.value,e)}}}function qu(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(r=>r.label).join(", ");case"one2many":{let r=e.length;return`${r} ${r===1?"line":"lines"}`}case"binary":case"image":return e.name;case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var Gu={char:Qt("text"),"char.email":Qt("email"),"char.phone":Qt("tel"),"char.url":Qt("url"),"char.password":Qt("password"),text:gp,integer:Co,float:Co,monetary:Co,"integer.rating":Hu("rating"),"integer.scale":Hu("scale"),boolean:Ju(),"boolean.toggle":Ju("switch"),selection:xp,"selection.radio":Wu("radio"),"selection.checkboxes":Wu("checkbox"),date:vp,datetime:_p,many2one:No,many2many:Br,"many2many.tags":Br,"many2many.checkboxes":Zo,reference:To,one2many:Ao,binary:Ro,image:Io,html:Fo,json:Jr,properties:Jr};var Xu=`
59
59
  .fd-form {
60
60
  --fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
61
61
  --fd-text: #212529;
@@ -135,6 +135,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
135
135
  .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::before { content: "* "; color: var(--fd-error); }
136
136
  .fd-help { color: var(--fd-muted); font-size: 12.5px; }
137
137
  .fd-error { color: var(--fd-error); font-size: 12.5px; }
138
+ .fd-warning {
139
+ color: var(--fd-warning); background: var(--fd-warning-soft); font-size: 12.5px;
140
+ padding: 3px 8px; border-radius: var(--fd-control-radius); justify-self: start;
141
+ }
138
142
 
139
143
  /* underline: label beside the value, the way a Flectra sheet reads */
140
144
  .fd-form[data-fd-skin="underline"] .fd-field {
@@ -246,13 +250,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
246
250
  .fd-reference { display: grid; grid-template-columns: minmax(7em, 34%) minmax(0, 1fr); gap: 8px; }
247
251
 
248
252
  /* ---- one2many lines ------------------------------------------------------- */
249
- .fd-lines { display: grid; gap: 6px; min-width: 0; }
250
- .fd-lines-scroll { overflow-x: auto; }
253
+ .fd-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
254
+ /* The table scrolls sideways inside its own box; the grid around it must not grow to the table's width. */
255
+ /* position: relative keeps the cells' hidden labels inside the scroll box; without it they widen the page. */
256
+ .fd-lines-scroll { overflow-x: auto; min-width: 0; position: relative; }
251
257
  .fd-lines-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
252
258
  .fd-lines-table th { text-align: start; font-weight: 600; color: var(--fd-muted); font-size: 12.5px; padding: 6px 8px; border-block-end: 1px solid var(--fd-border); white-space: nowrap; }
253
259
  .fd-lines-table td { padding: 4px 8px; border-block-end: 1px solid var(--fd-border); vertical-align: top; min-width: 7em; }
254
260
  .fd-lines-table td.fd-lines-tools, .fd-lines-table th.fd-lines-tools { width: 32px; min-width: 32px; padding-inline: 0; text-align: center; }
255
261
  .fd-lines-table .fd-input { min-height: 28px; }
262
+ /* A yes/no cell sits level with the inputs beside it. */
263
+ .fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }
256
264
  .fd-line-delete { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px; }
257
265
  .fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }
258
266
  .fd-lines-add { justify-self: start; }
@@ -288,6 +296,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
288
296
  border-block-end: 1px solid var(--fd-border); padding-block-end: 6px; width: 100%;
289
297
  }
290
298
  .fd-section-description { color: var(--fd-muted); margin: 0; }
299
+ .fd-section-toggle {
300
+ font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
301
+ display: inline-flex; align-items: center; gap: 8px; text-align: start;
302
+ }
303
+ .fd-section-toggle:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 2px; }
304
+ .fd-section-chevron {
305
+ width: 0.5em; height: 0.5em; border: solid currentColor; border-width: 0 2px 2px 0;
306
+ transform: rotate(45deg); margin-block-start: -0.2em; transition: transform 0.15s ease; flex: none;
307
+ }
308
+ .fd-section-folded .fd-section-chevron { transform: rotate(-45deg); margin-block-start: 0; }
309
+ [dir="rtl"] .fd-section-folded .fd-section-chevron { transform: rotate(135deg); }
291
310
  .fd-form[data-fd-skin="outlined"] .fd-sections > .fd-section {
292
311
  background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;
293
312
  }
@@ -420,7 +439,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
420
439
  }
421
440
  .fd-dialog p { margin: 0; }
422
441
  @media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
423
- `,Gu="fieldia-styles";function Co(e){if(e.getElementById(Gu))return;let t=e.createElement("style");t.id=Gu,t.textContent=Yu,(e.head??e.documentElement).append(t)}var Mo={en:{save:"Save",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",stepOf:"Step {n} of {total}",submitted:"Thank you. Your answers were sent.",submitAnother:"Submit another response",draftFound:"You have unsaved answers from {time}.",restore:"Restore",discardDraft:"Discard",ok:"OK",cancel:"Cancel",loading:"Loading\u2026"},ar:{save:"\u062D\u0641\u0638",discard:"\u062A\u062C\u0627\u0647\u0644",saving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",saved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",submit:"\u0625\u0631\u0633\u0627\u0644",next:"\u0627\u0644\u062A\u0627\u0644\u064A",back:"\u0631\u062C\u0648\u0639",stepOf:"\u0627\u0644\u062E\u0637\u0648\u0629 {n} \u0645\u0646 {total}",submitted:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643. \u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",submitAnother:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0629 \u0623\u062E\u0631\u0649",draftFound:"\u0644\u062F\u064A\u0643 \u0625\u062C\u0627\u0628\u0627\u062A \u063A\u064A\u0631 \u0645\u062D\u0641\u0648\u0638\u0629 \u0645\u0646 {time}.",restore:"\u0627\u0633\u062A\u0639\u0627\u062F\u0629",discardDraft:"\u062A\u062C\u0627\u0647\u0644",ok:"\u0645\u0648\u0627\u0641\u0642",cancel:"\u0625\u0644\u063A\u0627\u0621",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"},de:{save:"Speichern",discard:"Verwerfen",saving:"Wird gespeichert\u2026",saved:"Gespeichert",submit:"Absenden",next:"Weiter",back:"Zur\xFCck",stepOf:"Schritt {n} von {total}",submitted:"Vielen Dank. Ihre Antworten wurden gesendet.",submitAnother:"Weitere Antwort senden",draftFound:"Sie haben ungespeicherte Antworten vom {time}.",restore:"Wiederherstellen",discardDraft:"Verwerfen",ok:"OK",cancel:"Abbrechen",loading:"Wird geladen\u2026"},fr:{save:"Enregistrer",discard:"Annuler les modifications",saving:"Enregistrement\u2026",saved:"Enregistr\xE9",submit:"Envoyer",next:"Suivant",back:"Retour",stepOf:"\xC9tape {n} sur {total}",submitted:"Merci. Vos r\xE9ponses ont \xE9t\xE9 envoy\xE9es.",submitAnother:"Envoyer une autre r\xE9ponse",draftFound:"Vous avez des r\xE9ponses non enregistr\xE9es du {time}.",restore:"Restaurer",discardDraft:"Ignorer",ok:"OK",cancel:"Annuler",loading:"Chargement\u2026"}},wp=Mo.en,kp=0;function zp(e,t){let r=e.ownerDocument,n=Cr(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
442
+ `,Yu="fieldia-styles";function Mo(e){if(e.getElementById(Yu))return;let t=e.createElement("style");t.id=Yu,t.textContent=Xu,(e.head??e.documentElement).append(t)}var Do={en:{save:"Save",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",stepOf:"Step {n} of {total}",submitted:"Thank you. Your answers were sent.",submitAnother:"Submit another response",draftFound:"You have unsaved answers from {time}.",restore:"Restore",discardDraft:"Discard",ok:"OK",cancel:"Cancel",loading:"Loading\u2026"},ar:{save:"\u062D\u0641\u0638",discard:"\u062A\u062C\u0627\u0647\u0644",saving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",saved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",submit:"\u0625\u0631\u0633\u0627\u0644",next:"\u0627\u0644\u062A\u0627\u0644\u064A",back:"\u0631\u062C\u0648\u0639",stepOf:"\u0627\u0644\u062E\u0637\u0648\u0629 {n} \u0645\u0646 {total}",submitted:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643. \u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",submitAnother:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0629 \u0623\u062E\u0631\u0649",draftFound:"\u0644\u062F\u064A\u0643 \u0625\u062C\u0627\u0628\u0627\u062A \u063A\u064A\u0631 \u0645\u062D\u0641\u0648\u0638\u0629 \u0645\u0646 {time}.",restore:"\u0627\u0633\u062A\u0639\u0627\u062F\u0629",discardDraft:"\u062A\u062C\u0627\u0647\u0644",ok:"\u0645\u0648\u0627\u0641\u0642",cancel:"\u0625\u0644\u063A\u0627\u0621",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"},de:{save:"Speichern",discard:"Verwerfen",saving:"Wird gespeichert\u2026",saved:"Gespeichert",submit:"Absenden",next:"Weiter",back:"Zur\xFCck",stepOf:"Schritt {n} von {total}",submitted:"Vielen Dank. Ihre Antworten wurden gesendet.",submitAnother:"Weitere Antwort senden",draftFound:"Sie haben ungespeicherte Antworten vom {time}.",restore:"Wiederherstellen",discardDraft:"Verwerfen",ok:"OK",cancel:"Abbrechen",loading:"Wird geladen\u2026"},fr:{save:"Enregistrer",discard:"Annuler les modifications",saving:"Enregistrement\u2026",saved:"Enregistr\xE9",submit:"Envoyer",next:"Suivant",back:"Retour",stepOf:"\xC9tape {n} sur {total}",submitted:"Merci. Vos r\xE9ponses ont \xE9t\xE9 envoy\xE9es.",submitAnother:"Envoyer une autre r\xE9ponse",draftFound:"Vous avez des r\xE9ponses non enregistr\xE9es du {time}.",restore:"Restaurer",discardDraft:"Ignorer",ok:"OK",cancel:"Annuler",loading:"Chargement\u2026"}},kp=Do.en,zp=0;function $p(e,t){let r=e.ownerDocument,n=Mr(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
424
443
  ${n.issues.map(g=>` ${g.path}: ${g.message}`).join(`
425
- `)}`);let o=n.page,i=t.locale??"en",s=!t.form,a=t.form??Vr({...t,page:o,messages:t.messages??Ye[i]}),c={...Mo[i],...t.labels},u=we[i],l=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++kp}`,m=[],d=[],h=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,x=(g,$)=>g.replace(/\{(\w+)\}/g,(I,j)=>String($[j]??""));Co(r);function f(g,$={},...I){let j=r.createElement(g);for(let[J,C]of Object.entries($))C!==void 0&&j.setAttribute(J,C);return j.append(...I),j}let v=f("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:l,lang:t.locale}),P=t.confirm??Ae;function D(g){let $=o.fields[g.field],I=h(g.id),j=f("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":$.type});g.colspan&&j.style.setProperty("--fd-span",String(g.colspan));let J=f("label",{class:"fd-label",id:`${I}-label`,for:I},g.label??$.label),C=Xt({form:a,name:g.field,field:$,node:g,id:I,document:r,labels:u},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(C.element.tagName)||(C.element.getAttribute("role")&&C.element.setAttribute("aria-labelledby",J.id),J.addEventListener("click",()=>C.focus()));let R=g.help??$.help,Y=R?f("div",{class:"fd-help",id:`${I}-help`},R):null,E=f("div",{class:"fd-error",id:`${I}-error`,role:"alert",hidden:""});return j.append(J,C.element,...Y?[Y]:[],E),C.destroy&&d.push(()=>C.destroy?.()),m.push(A=>{let W=a.node(g.id);j.hidden=W.invisible,j.classList.toggle("fd-required",W.required);let fe=A.errors[g.field];E.hidden=!fe,E.textContent=fe??"",C.update({value:A.values[g.field],values:A.values,readonly:W.readonly,required:W.required,invalid:!!fe,describedBy:[Y?.id,fe?E.id:void 0].filter(Boolean).join(" ")||void 0})}),j}function S(g,$){m.push(()=>{g.hidden=a.node($).invisible})}function w(g){let $=f("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return $.addEventListener("click",async()=>{g.confirm&&!await P(g.confirm)||await a.runAction(g.id)}),S($,g.id),$}function z(g){let $=g.style??"paragraph",I=f($==="heading"?"h3":"p",{class:`fd-text-${$}`,"data-node":g.id},g.text);return S(I,g.id),I}function B(g){let $=f("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),I=t.slots?.[g.name]?.($,{form:a,name:g.name});return I&&d.push(I),S($,g.id),$}function te(g,$=1){let I=f("div",{class:"fd-grid"});return I.style.setProperty("--fd-columns",String($)),I.append(...g.map(V)),I}function re(g){let $=f("fieldset",{class:"fd-section","data-node":g.id});return g.title&&$.append(f("legend",{class:"fd-section-title"},g.title)),g.description&&$.append(f("p",{class:"fd-section-description"},g.description)),$.append(te(g.children,g.columns??1)),S($,g.id),$}function ie(g){let $=f("div",{class:"fd-tabs","data-node":g.id}),I=f("div",{class:"fd-tablist",role:"tablist"}),j=null,J=g.children[0].id,C=g.children.map(R=>{let Y=h(`${R.id}-tab`),E=h(`${R.id}-panel`),A=f("button",{type:"button",class:"fd-tab",role:"tab",id:Y,"aria-controls":E,"data-node":R.id},R.label),W=f("div",{class:"fd-tabpanel",role:"tabpanel",id:E,"aria-labelledby":Y},te(R.children));return A.addEventListener("click",()=>{j=J=R.id,ze(a.getState())}),I.append(A),{tab:R,button:A,panel:W}});return I.addEventListener("keydown",R=>{let Y=C.filter(Xe=>!Xe.button.hidden),E=Y.findIndex(Xe=>Xe.tab.id===J),A={ArrowRight:1,ArrowLeft:-1,Home:-E,End:Y.length-1-E}[R.key];if(A===void 0||E===-1)return;R.preventDefault();let W=v.getAttribute("dir")==="rtl"&&(R.key==="ArrowRight"||R.key==="ArrowLeft"),fe=Y[(E+(W?-A:A)+Y.length)%Y.length];j=J=fe.tab.id,ze(a.getState()),fe.button.focus()}),$.append(I,...C.map(R=>R.panel)),m.push(()=>{$.hidden=a.node(g.id).invisible;let R=C.filter(E=>!a.node(E.tab.id).invisible);j!==null&&R.some(E=>E.tab.id===j)?J=j:R.length&&(J=R[0].tab.id);for(let E of C){let A=E.tab.id===J;E.button.hidden=!R.includes(E),E.button.setAttribute("aria-selected",String(A)),E.button.tabIndex=A?0:-1,E.panel.hidden=!A}}),$}function V(g){switch(g.type){case"field":return D(g);case"button":return w(g);case"text":return z(g);case"slot":return B(g);case"section":return re(g);case"tabs":return ie(g)}}let Q=f("div",{class:"fd-status",role:"status","aria-live":"polite"});m.push(g=>{let $=g.status==="saving"?c.saving:g.status==="saved"?c.saved:g.status==="loading"?c.loading:g.status==="error"?g.error??"":"";Q.textContent=$,Q.classList.toggle("fd-status-error",g.status==="error"),Q.classList.toggle("fd-status-saved",g.status==="saved")});let he=f("div",{class:"fd-draft",hidden:""}),ct=f("span"),Ze=f("button",{type:"button",class:"fd-button fd-button-primary"},c.restore),Ve=f("button",{type:"button",class:"fd-button fd-button-link"},c.discardDraft);Ze.addEventListener("click",()=>a.restoreDraft()),Ve.addEventListener("click",()=>a.discardDraft()),he.append(ct,Ze,Ve),m.push(g=>{he.hidden=!g.draft,g.draft&&(ct.textContent=x(c.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function Re(){let g=v.querySelector('[aria-invalid="true"]');if(!g)return;(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let ke=f("div",{class:"fd-done",hidden:""},f("p",{class:"fd-done-title"},c.submitted)),zt=f("button",{type:"button",class:"fd-button"},c.submitAnother);ke.append(zt);let Ie=f("div",{class:"fd-content"});async function $t(){if(!await a.save()){Re();return}o.data.kind==="responses"&&(Ie.hidden=!0,ke.hidden=!1)}zt.addEventListener("click",()=>{a.reset(),Ie.hidden=!1,ke.hidden=!0});function Wr(){if(!o.title&&!o.description)return null;let g=f("header",{class:"fd-page-head"});return o.title&&g.append(f("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(f("p",{class:"fd-page-description"},o.description)),g}function ut(g){let $=f("div",{class:"fd-sections","data-node":g.id},...g.children.map(V)),I=f("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?c.submit:c.save),j=f("div",{class:"fd-actions fd-actions-end"},Q,I);return f("div",{},$,j)}function y(g){let $=f("div",{class:"fd-wizard","data-node":g.id}),I=f("div",{class:"fd-progress-text"}),j=f("span");$.append(f("div",{class:"fd-progress"},I,f("div",{class:"fd-progress-bar"},j)));let J=g.children.map(A=>{let W=f("section",{class:"fd-step","data-node":A.id,"aria-labelledby":h(`${A.id}-title`)});return W.append(f("h2",{class:"fd-step-title",id:h(`${A.id}-title`)},A.label)),A.description&&W.append(f("p",{class:"fd-section-description"},A.description)),W.append(te(A.children)),$.append(W),{step:A,panel:W}}),C=f("button",{type:"button",class:"fd-button"},c.back),R=f("button",{type:"submit",class:"fd-button fd-button-primary"});$.append(f("div",{class:"fd-wizard-nav"},C,f("span",{class:"fd-spacer"}),Q,R)),C.addEventListener("click",()=>{a.back()&&E()});let Y=()=>{let A=a.steps();return A.indexOf(a.getState().step??"")===A.length-1};T=async()=>{if(Y())return $t();a.next()?E():Re()};function E(){J.find(W=>W.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return m.push(A=>{let W=a.steps(),fe=Math.max(0,W.indexOf(A.step??""));I.textContent=x(c.stepOf,{n:fe+1,total:W.length}),j.style.width=`${(fe+1)/Math.max(1,W.length)*100}%`;for(let{step:Xe,panel:St}of J)St.hidden=Xe.id!==A.step;C.hidden=fe===0,R.textContent=fe===W.length-1?c.submit:c.next}),$}function _(g){let $=f("div",{class:"fd-sheet-page","data-node":g.id}),I=f("div",{class:"fd-actions"}),j=f("button",{type:"submit",class:"fd-button fd-button-primary"},c.save),J=f("button",{type:"button",class:"fd-button"},c.discard);J.addEventListener("click",()=>a.reset()),I.append(j,J,...(g.buttons??[]).map(w),Q),m.push(E=>{let A=E.dirty.length>0&&E.status!=="saving";j.hidden=!A,J.hidden=!A});let C=f("div",{class:"fd-header"},I);g.statusbar&&C.append(k(g.statusbar));let R=f("div",{class:"fd-card"});if(g.ribbon){let E=f("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);S(E,g.ribbon.id),R.append(E)}if(g.statButtons?.length){let E=f("div",{class:"fd-stats"});for(let A of g.statButtons){let W=f("span",{class:"fd-stat-value"}),fe=f("button",{type:"button",class:"fd-stat","data-node":A.id},W,f("span",{class:"fd-stat-label"},A.label));fe.addEventListener("click",()=>{a.runAction(A.id)}),m.push(Xe=>{fe.hidden=a.node(A.id).invisible;let St=A.field?Xe.values[A.field]:null;W.textContent=St==null?"":String(St)}),E.append(fe)}R.append(E)}for(let E of g.alerts??[]){let A=f("div",{class:`fd-alert fd-tone-${E.tone??"info"}`,role:"status","data-node":E.id},E.message);S(A,E.id),R.append(A)}if(g.title){let E=f("div",{class:"fd-title"});E.append(D({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&E.append(D({type:"field",id:"#subtitle",field:g.title.subtitleField}));let A=f("div",{class:"fd-title-row"},E);if(g.title.avatarField){let W=D({type:"field",id:"#avatar",field:g.title.avatarField});W.classList.add("fd-avatar"),A.append(W)}R.append(A)}R.append(te(g.children));let Y=f("div",{class:"fd-sheet-layout"},R);return g.sidePanel&&(Y.classList.add("fd-has-side"),Y.append(f("aside",{class:"fd-side"},B(g.sidePanel)))),$.append(C,Y),$}function k(g){let $=o.fields[g.field],I=f("ol",{class:"fd-statusbar","aria-label":$.label});if($.type==="selection"){let J=$.options.filter(C=>!g.visibleStates||g.visibleStates.includes(C.value)).map(C=>{let R=g.clickable?f("button",{type:"button"},f("span",{},C.label)):f("span",{},f("span",{},C.label));return R instanceof HTMLButtonElement&&R.addEventListener("click",()=>a.setValue(g.field,C.value)),I.append(f("li",{},R)),{option:C,inner:R}});m.push(C=>{let R=a.node("#statusbar").readonly;for(let{option:Y,inner:E}of J)Y.value===C.values[g.field]?E.setAttribute("aria-current","step"):E.removeAttribute("aria-current"),E instanceof HTMLButtonElement&&(E.disabled=R)})}else{let j=f("span",{"aria-current":"step"});I.append(f("li",{},j)),m.push(J=>{let C=J.values[g.field];j.textContent=C?.label??""})}return I}let T=null,M=o.layout,G;M.type==="sheet"?G=_(M):M.type==="wizard"?G=y(M):M.type==="tabs"?G=ut({id:`${M.id}-page`,children:[M]}):G=ut(M);let de=M.type==="sheet"?null:Wr();Ie.append(...de?[de]:[],he,G),v.append(Ie,ke),v.addEventListener("submit",g=>{g.preventDefault(),T?T():$t()});function Ae(g){return new Promise($=>{let I=f("p",{id:`${p}-confirm`},g),j=f("button",{type:"button",class:"fd-button"},c.cancel),J=f("button",{type:"button",class:"fd-button fd-button-primary"},c.ok),C=f("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":I.id},I,f("div",{class:"fd-actions fd-actions-end"},j,J)),R=f("div",{class:"fd-dialog-backdrop"},C),Y=E=>{R.remove(),$(E)};j.addEventListener("click",()=>Y(!1)),J.addEventListener("click",()=>Y(!0)),R.addEventListener("keydown",E=>{E.key==="Escape"&&Y(!1)}),v.append(R),J.focus()})}function ze(g){for(let $ of m)$(g)}e.append(v);let lt=a.subscribe(ze);return ze(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:v,setSkin(g){v.setAttribute("data-fd-skin",g)},destroy(){lt();for(let g of d)g();v.remove(),s&&a.dispose()}}}var $p="0.1.0";return nl(Sp);})();
444
+ `)}`);let o=n.page,i=t.locale??"en",s=!t.form,a=t.form??Ur({...t,page:o,messages:t.messages??Qe[i]}),c={...Do[i],...t.labels},u=we[i],l=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++zp}`,m=[],f=[],h=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,x=(g,z)=>g.replace(/\{(\w+)\}/g,(T,C)=>String(z[C]??""));Mo(r);function d(g,z={},...T){let C=r.createElement(g);for(let[D,R]of Object.entries(z))R!==void 0&&C.setAttribute(D,R);return C.append(...T),C}let v=d("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:l,lang:t.locale}),P=t.confirm??Ue;function j(g){let z=o.fields[g.field],T=h(g.id),C=d("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":z.type});g.colspan&&C.style.setProperty("--fd-span",String(g.colspan));let D=d("label",{class:"fd-label",id:`${T}-label`,for:T},g.label??z.label),R=Xt({form:a,name:g.field,field:z,node:g,id:T,document:r,labels:u},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(R.element.tagName)||(R.element.getAttribute("role")&&R.element.setAttribute("aria-labelledby",D.id),D.addEventListener("click",()=>R.focus()));let N=g.help??z.help,K=N?d("div",{class:"fd-help",id:`${T}-help`},N):null,E=d("div",{class:"fd-error",id:`${T}-error`,role:"alert",hidden:""}),I=d("div",{class:"fd-warning",role:"status",hidden:""});return C.append(D,R.element,...K?[K]:[],E,I),R.destroy&&f.push(()=>R.destroy?.()),m.push(U=>{let pe=a.node(g.id);C.hidden=pe.invisible,C.classList.toggle("fd-required",pe.required);let ke=U.errors[g.field];E.hidden=!ke,E.textContent=ke??"";let Be=U.warning&&U.warningField===g.field?U.warning:"";I.hidden=!Be,I.textContent=Be,R.update({value:U.values[g.field],values:U.values,readonly:pe.readonly,required:pe.required,invalid:!!ke,describedBy:[K?.id,ke?E.id:void 0].filter(Boolean).join(" ")||void 0})}),C}function S(g,z){m.push(()=>{g.hidden=a.node(z).invisible})}function w(g){let z=d("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return z.addEventListener("click",async()=>{g.confirm&&!await P(g.confirm)||await a.runAction(g.id)}),S(z,g.id),z}function $(g){let z=g.style??"paragraph",T=d(z==="heading"?"h3":"p",{class:`fd-text-${z}`,"data-node":g.id},g.text);return S(T,g.id),T}function H(g){let z=d("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),T=t.slots?.[g.name]?.(z,{form:a,name:g.name});return T&&f.push(T),S(z,g.id),z}function te(g,z=1){let T=d("div",{class:"fd-grid"});return T.style.setProperty("--fd-columns",String(z)),T.append(...g.map(se)),T}let Q=new Map;function oe(g){let z=d("fieldset",{class:"fd-section","data-node":g.id}),T=g.description?d("p",{class:"fd-section-description"},g.description):null,C=te(g.children,g.columns??1);if(g.title&&g.collapsible){C.id=h(`${g.id}-content`);let D=d("button",{type:"button",class:"fd-section-toggle","aria-controls":C.id},d("span",{class:"fd-section-chevron","aria-hidden":"true"}),g.title),R=g.collapsed!==!0,N=K=>{R=K,D.setAttribute("aria-expanded",String(R)),C.hidden=!R,T&&(T.hidden=!R),z.classList.toggle("fd-section-folded",!R)};D.addEventListener("click",()=>N(!R)),Q.set(z,()=>N(!0)),N(R),z.append(d("legend",{class:"fd-section-title"},D))}else g.title&&z.append(d("legend",{class:"fd-section-title"},g.title));return T&&z.append(T),z.append(C),S(z,g.id),z}function B(g){let z=d("div",{class:"fd-tabs","data-node":g.id}),T=d("div",{class:"fd-tablist",role:"tablist"}),C=null,D=g.children[0].id,R=g.children.map(N=>{let K=h(`${N.id}-tab`),E=h(`${N.id}-panel`),I=d("button",{type:"button",class:"fd-tab",role:"tab",id:K,"aria-controls":E,"data-node":N.id},N.label),U=d("div",{class:"fd-tabpanel",role:"tabpanel",id:E,"aria-labelledby":K},te(N.children));return I.addEventListener("click",()=>{C=D=N.id,Le(a.getState())}),T.append(I),{tab:N,button:I,panel:U}});return T.addEventListener("keydown",N=>{let K=R.filter(ke=>!ke.button.hidden),E=K.findIndex(ke=>ke.tab.id===D),I={ArrowRight:1,ArrowLeft:-1,Home:-E,End:K.length-1-E}[N.key];if(I===void 0||E===-1)return;N.preventDefault();let U=v.getAttribute("dir")==="rtl"&&(N.key==="ArrowRight"||N.key==="ArrowLeft"),pe=K[(E+(U?-I:I)+K.length)%K.length];C=D=pe.tab.id,Le(a.getState()),pe.button.focus()}),z.append(T,...R.map(N=>N.panel)),m.push(()=>{z.hidden=a.node(g.id).invisible;let N=R.filter(E=>!a.node(E.tab.id).invisible);C!==null&&N.some(E=>E.tab.id===C)?D=C:N.length&&(D=N[0].tab.id);for(let E of R){let I=E.tab.id===D;E.button.hidden=!N.includes(E),E.button.setAttribute("aria-selected",String(I)),E.button.tabIndex=I?0:-1,E.panel.hidden=!I}}),z}function se(g){switch(g.type){case"field":return j(g);case"button":return w(g);case"text":return $(g);case"slot":return H(g);case"section":return oe(g);case"tabs":return B(g)}}let de=d("div",{class:"fd-status",role:"status","aria-live":"polite"});m.push(g=>{let z=g.status==="saving"?c.saving:g.status==="saved"?c.saved:g.status==="loading"?c.loading:g.status==="error"?g.error??"":"";de.textContent=z,de.classList.toggle("fd-status-error",g.status==="error"),de.classList.toggle("fd-status-saved",g.status==="saved")});let et=d("div",{class:"fd-draft",hidden:""}),Ze=d("span"),Ve=d("button",{type:"button",class:"fd-button fd-button-primary"},c.restore),Ie=d("button",{type:"button",class:"fd-button fd-button-link"},c.discardDraft);Ve.addEventListener("click",()=>a.restoreDraft()),Ie.addEventListener("click",()=>a.discardDraft()),et.append(Ze,Ve,Ie),m.push(g=>{et.hidden=!g.draft,g.draft&&(Ze.textContent=x(c.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function Te(){let g=v.querySelector('[aria-invalid="true"]');if(!g)return;for(let T=g.closest(".fd-section-folded");T;T=T.parentElement?.closest(".fd-section-folded")??null)Q.get(T)?.();(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let tt=d("div",{class:"fd-done",hidden:""},d("p",{class:"fd-done-title"},c.submitted)),rt=d("button",{type:"button",class:"fd-button"},c.submitAnother);tt.append(rt);let nt=d("div",{class:"fd-content"});async function tr(){if(!await a.save()){Te();return}o.data.kind==="responses"&&(nt.hidden=!0,tt.hidden=!1)}rt.addEventListener("click",()=>{a.reset(),nt.hidden=!1,tt.hidden=!0});function St(){if(!o.title&&!o.description)return null;let g=d("header",{class:"fd-page-head"});return o.title&&g.append(d("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(d("p",{class:"fd-page-description"},o.description)),g}function y(g){let z=d("div",{class:"fd-sections","data-node":g.id},...g.children.map(se)),T=d("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?c.submit:c.save),C=d("div",{class:"fd-actions fd-actions-end"},de,T);if(o.data.kind==="record"){let D=d("button",{type:"button",class:"fd-button"},c.discard);D.addEventListener("click",()=>a.reset()),C.insertBefore(D,T),m.push(R=>{let N=R.dirty.length>0&&R.status!=="saving";T.hidden=!N,D.hidden=!N})}return d("div",{},z,C)}function _(g){let z=d("div",{class:"fd-wizard","data-node":g.id}),T=d("div",{class:"fd-progress-text"}),C=d("span");z.append(d("div",{class:"fd-progress"},T,d("div",{class:"fd-progress-bar"},C)));let D=g.children.map(I=>{let U=d("section",{class:"fd-step","data-node":I.id,"aria-labelledby":h(`${I.id}-title`)});return U.append(d("h2",{class:"fd-step-title",id:h(`${I.id}-title`)},I.label)),I.description&&U.append(d("p",{class:"fd-section-description"},I.description)),U.append(te(I.children)),z.append(U),{step:I,panel:U}}),R=d("button",{type:"button",class:"fd-button"},c.back),N=d("button",{type:"submit",class:"fd-button fd-button-primary"});z.append(d("div",{class:"fd-wizard-nav"},R,d("span",{class:"fd-spacer"}),de,N)),R.addEventListener("click",()=>{a.back()&&E()});let K=()=>{let I=a.steps();return I.indexOf(a.getState().step??"")===I.length-1};J=async()=>{if(K())return tr();a.next()?E():Te()};function E(){D.find(U=>U.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return m.push(I=>{let U=a.steps(),pe=Math.max(0,U.indexOf(I.step??""));T.textContent=x(c.stepOf,{n:pe+1,total:U.length}),C.style.width=`${(pe+1)/Math.max(1,U.length)*100}%`;for(let{step:ke,panel:Be}of D)Be.hidden=ke.id!==I.step;R.hidden=pe===0,N.textContent=pe===U.length-1?c.submit:c.next}),z}function k(g){let z=d("div",{class:"fd-sheet-page","data-node":g.id}),T=d("div",{class:"fd-actions"}),C=d("button",{type:"submit",class:"fd-button fd-button-primary"},c.save),D=d("button",{type:"button",class:"fd-button"},c.discard);D.addEventListener("click",()=>a.reset()),T.append(C,D,...(g.buttons??[]).map(w),de),m.push(E=>{let I=E.dirty.length>0&&E.status!=="saving";C.hidden=!I,D.hidden=!I});let R=d("div",{class:"fd-header"},T);g.statusbar&&R.append(L(g.statusbar));let N=d("div",{class:"fd-card"});if(g.ribbon){let E=d("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);S(E,g.ribbon.id),N.append(E)}if(g.statButtons?.length){let E=d("div",{class:"fd-stats"});for(let I of g.statButtons){let U=d("span",{class:"fd-stat-value"}),pe=d("button",{type:"button",class:"fd-stat","data-node":I.id},U,d("span",{class:"fd-stat-label"},I.label));pe.addEventListener("click",()=>{a.runAction(I.id)}),m.push(ke=>{pe.hidden=a.node(I.id).invisible;let Be=I.field?ke.values[I.field]:null;U.textContent=Be==null?"":String(Be)}),E.append(pe)}N.append(E)}for(let E of g.alerts??[]){let I=d("div",{class:`fd-alert fd-tone-${E.tone??"info"}`,role:"status","data-node":E.id},E.message);S(I,E.id),N.append(I)}if(g.title){let E=d("div",{class:"fd-title"});E.append(j({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&E.append(j({type:"field",id:"#subtitle",field:g.title.subtitleField}));let I=d("div",{class:"fd-title-row"},E);if(g.title.avatarField){let U=j({type:"field",id:"#avatar",field:g.title.avatarField});U.classList.add("fd-avatar"),I.append(U)}N.append(I)}N.append(te(g.children));let K=d("div",{class:"fd-sheet-layout"},N);return g.sidePanel&&(K.classList.add("fd-has-side"),K.append(d("aside",{class:"fd-side"},H(g.sidePanel)))),z.append(R,K),z}function L(g){let z=o.fields[g.field],T=d("ol",{class:"fd-statusbar","aria-label":z.label});if(z.type==="selection"){let D=z.options.filter(R=>!g.visibleStates||g.visibleStates.includes(R.value)).map(R=>{let N=g.clickable?d("button",{type:"button"},d("span",{},R.label)):d("span",{},d("span",{},R.label));return N instanceof HTMLButtonElement&&N.addEventListener("click",()=>a.setValue(g.field,R.value)),T.append(d("li",{},N)),{option:R,inner:N}});m.push(R=>{let N=a.node("#statusbar").readonly;for(let{option:K,inner:E}of D)K.value===R.values[g.field]?E.setAttribute("aria-current","step"):E.removeAttribute("aria-current"),E instanceof HTMLButtonElement&&(E.disabled=N)})}else{let C=d("span",{"aria-current":"step"});T.append(d("li",{},C)),m.push(D=>{let R=D.values[g.field];C.textContent=R?.label??""})}return T}let J=null,V=o.layout,ae;V.type==="sheet"?ae=k(V):V.type==="wizard"?ae=_(V):V.type==="tabs"?ae=y({id:`${V.id}-page`,children:[V]}):ae=y(V);let ze=V.type==="sheet"?null:St();nt.append(...ze?[ze]:[],et,ae),v.append(nt,tt),v.addEventListener("submit",g=>{g.preventDefault(),J?J():tr()});function Ue(g){return new Promise(z=>{let T=d("p",{id:`${p}-confirm`},g),C=d("button",{type:"button",class:"fd-button"},c.cancel),D=d("button",{type:"button",class:"fd-button fd-button-primary"},c.ok),R=d("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":T.id},T,d("div",{class:"fd-actions fd-actions-end"},C,D)),N=d("div",{class:"fd-dialog-backdrop"},R),K=E=>{N.remove(),z(E)};C.addEventListener("click",()=>K(!1)),D.addEventListener("click",()=>K(!0)),N.addEventListener("keydown",E=>{E.key==="Escape"&&K(!1)}),v.append(N),D.focus()})}function Le(g){for(let z of m)z(g)}e.append(v);let Hr=a.subscribe(Le);return Le(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:v,setSkin(g){v.setAttribute("data-fd-skin",g)},destroy(){Hr();for(let g of f)g();v.remove(),s&&a.dispose()}}}var Sp="0.2.0";return ol(Ep);})();
426
445
  //# sourceMappingURL=fieldia.js.map