@fieldia/viewer 0.3.0 → 0.4.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.3.0 · MIT · https://fieldia.dev */
2
- "use strict";var Fieldia=(()=>{var ir=Object.defineProperty;var ul=Object.getOwnPropertyDescriptor;var ll=Object.getOwnPropertyNames;var dl=Object.prototype.hasOwnProperty;var fl=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ko=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},pl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ll(t))!dl.call(e,o)&&o!==r&&ir(e,o,{get:()=>t[o],enumerable:!(n=ul(t,o))||n.enumerable});return e};var ml=e=>pl(ir({},"__esModule",{value:!0}),e);var at=(e,t,r)=>fl(e,typeof t!="symbol"?t+"":t,r);var Fp={};Ko(Fp,{DEFAULT_LABELS:()=>Ap,FIELDIA_CSS:()=>al,FIELD_NAME:()=>Ce,FIELD_TYPES:()=>hu,FORMAT_VERSION:()=>Eo,FieldSchema:()=>So,FieldsSchema:()=>Dr,FilterConditionSchema:()=>wo,LayoutNodeSchema:()=>ft,LineFieldSchema:()=>zo,LineKindsSchema:()=>$o,MESSAGES:()=>st,ModifierSchema:()=>Gt,OptionSchema:()=>Mr,PageSchema:()=>Pt,RootLayoutSchema:()=>jr,VERSION:()=>Ip,VIEWER_LABELS:()=>Wo,WIDGET_LABELS:()=>Ne,binaryWidget:()=>Mo,browserPreferences:()=>Jo,builtInWidgets:()=>il,checkValue:()=>Qt,compileModifier:()=>ot,createForm:()=>Kr,createMemoryDataSource:()=>Hu,createWidget:()=>rr,displayValue:()=>Fo,emptyValue:()=>No,evaluateModifier:()=>Uu,expressionContext:()=>Xt,fill:()=>Jr,formatBytes:()=>er,hostScheduler:()=>tr,htmlWidget:()=>Vo,imageWidget:()=>Do,initialValues:()=>Ot,installStyles:()=>Bo,isEmpty:()=>Br,isModifierValid:()=>Bu,jsonWidget:()=>qr,kindTextField:()=>Yu,lineForm:()=>Xu,lineKind:()=>it,linesWidget:()=>Co,linkCheckboxesWidget:()=>Lo,many2oneWidget:()=>Ao,memoryPreferences:()=>Tp,mountViewer:()=>Rp,pageJsonSchema:()=>Vu,referenceWidget:()=>Ro,sanitizeHtml:()=>jo,summary:()=>ol,tagsWidget:()=>Hr,validatePage:()=>Ur,wait:()=>Wr});var A={};Ko(A,{BIGINT_FORMAT_RANGES:()=>ur,CONSTANT_CATCH:()=>ni,Class:()=>Qr,NUMBER_FORMAT_RANGES:()=>Tt,aborted:()=>Ee,allowsEval:()=>sn,assert:()=>vl,assertEqual:()=>hl,assertIs:()=>yl,assertNever:()=>xl,assertNotEqual:()=>gl,assignProp:()=>ke,attachSchema:()=>dr,base64ToUint8Array:()=>ti,base64urlToUint8Array:()=>Ml,cached:()=>_t,captureStackTrace:()=>ar,cleanEnum:()=>Cl,cleanRegex:()=>Zt,clone:()=>Ae,cloneDef:()=>kl,codePointLength:()=>At,constantCatch:()=>oi,createTransparentProxy:()=>Ol,defineLazy:()=>rn,defineLazyInternal:()=>j,derived:()=>Ul,esc:()=>nn,escapeRegex:()=>We,explicitlyAborted:()=>un,extend:()=>Tl,finalizeIssue:()=>Re,floatSafeRemainder:()=>tn,getElementAtPath:()=>zl,getEnumValues:()=>xt,getLengthableOrigin:()=>Lt,getParsedType:()=>Pl,getSizableOrigin:()=>ei,hexToUint8Array:()=>jl,hide:()=>fr,installLazyProp:()=>Kl,isObject:()=>ut,isPlainObject:()=>et,issue:()=>kt,joinValues:()=>sr,jsonStringifyReplacer:()=>vt,members:()=>dn,merge:()=>Ll,mergeDefs:()=>Je,normalizeParams:()=>Z,nullish:()=>en,numKeys:()=>El,objectClone:()=>_l,omit:()=>Zl,optionalKeys:()=>cn,own:()=>Qe,parsedType:()=>ln,partial:()=>Rl,pick:()=>Nl,prefixIssues:()=>Le,primitiveTypes:()=>Xo,promiseAllObject:()=>$l,propertyKeyTypes:()=>an,randomString:()=>Sl,rawShape:()=>wt,required:()=>Il,safeExtend:()=>Al,shallowClone:()=>Yo,slugify:()=>on,stringifyPrimitive:()=>cr,toZod:()=>bl,uint8ArrayToBase64:()=>ri,uint8ArrayToBase64url:()=>Dl,uint8ArrayToHex:()=>Vl,unwrapMessage:()=>yt});function hl(e){return e}function gl(e){return e}function bl(){return e=>e}function yl(e){}function xl(e){throw new Error("Unexpected value in exhaustive check")}function vl(e){}function xt(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 sr(e,t="|"){return e.map(r=>cr(r)).join(t)}function vt(e,t){return typeof t=="bigint"?t.toString():t}var Xr=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 _t(e){return new Xr(e)}function en(e){return e==null}function Zt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function tn(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 Ho=Symbol("evaluating");function rn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ho)return n===void 0&&(n=Ho,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _l(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ke(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function wt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Be(e){return wt(e._zod.def)??e._zod.def.shape}function qo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ke(this,t,n),n},enumerable:!0,configurable:!0})}function Go(e,t,r){t in e?ke(e,t,r):e[t]=r}function ct(e,t,r,n){let o=Be(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?qo(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Go(e,i,n?n(s.value,i):s.value))}}function wl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?qo(e,r,()=>t[r]):Go(e,r,n.value))}}function Je(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function kl(e){return Je(e._zod.def)}function zl(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function $l(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 Sl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function nn(e){return JSON.stringify(e)}function on(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ar="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sn=_t(()=>{if(_e.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function et(e){if(ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ut(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Yo(e){return et(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function El(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Pl=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}`)}},an=new Set(["string","number","symbol"]),Xo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Z(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 Ol(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 cr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Tt={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]},ur={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Nl(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 ct(i,e,lr(e,t)),Ae(e,Je(r,{shape:i,checks:[]}))}function lr(e,t){let r=Be(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 Zl(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(lr(e,t)),s={};return ct(s,e,Reflect.ownKeys(Be(e)).filter(c=>!i.has(c))),Ae(e,Je(r,{shape:s,checks:[]}))}function Tl(e,t){if(!et(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=Be(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 Ae(e,Je(e._zod.def,{shape:Qo(e,t)}))}function Qo(e,t){let r={};return ct(r,e,Reflect.ownKeys(Be(e))),wl(r,t),r}function Al(e,t){if(!et(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ae(e,Je(e._zod.def,{shape:Qo(e,t)}))}function Ll(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={};ct(r,e,Reflect.ownKeys(Be(e))),ct(r,t,Reflect.ownKeys(Be(t)));let n=Je(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ae(e,n)}function Rl(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 c=r?new Set(lr(t,r)):void 0,a={};return ct(a,t,Reflect.ownKeys(Be(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),Ae(t,Je(t._zod.def,{shape:a,checks:[]}))}function Il(e,t,r){let n=r?new Set(lr(t,r)):void 0,o={};return ct(o,t,Reflect.ownKeys(Be(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Ae(t,Je(t._zod.def,{shape:o}))}function Ee(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 un(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 Le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function yt(e){return typeof e=="string"?e:e?.message}function dr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Re(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:yt(e.inst?._zod.def?.error?.(e))??yt(i?.(e))??yt(t?.error?.(e))??yt(r.customError?.(e))??yt(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function ei(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Fl=/[\uD800-\uDBFF]/;function At(e){let t=e.length;if(!Fl.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 Lt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ln(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 kt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Cl(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ti(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 ri(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ml(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return ti(t+r)}function Dl(e){return ri(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jl(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 Vl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Qr=class{constructor(...t){}};function dn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Bl(e,r,n.value)}}function Qe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function fr(e,t,r){return Qe(e,t,r,!1)}function Ul(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Qe(this,r,n(this))},set(o){Qe(this,r,o)}})}return t}function Bl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Qe(this,t,r.bind(this))},set(n){Qe(this,t,n)}})}function Jl(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Yr,Xe=!1,Wl={configurable:!0,get(){Xe=!0}};function j(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Yr!==e._zod){Yr=void 0;return}Yr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Wl);let o=Xe;Xe=!1;try{let i=r(this);return Xe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Xe=Xe||o,i}catch(i){throw delete this[t],Xe=Xe||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Kl(e,t,r,n){let o=Jl(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 ni="~constantCatch";function oi(e){let t=()=>e;return t[ni]=!0,t}var ii;var fn={value:void 0,enumerable:!1},si="captureStackTrace"in Error?Error:null;function Hl(e){let t=si;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return si=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function i(p){this.def=p,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{fn.value=new i(d);try{Object.defineProperty(p,"_zod",fn)}finally{fn.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){let v=Object.getPrototypeOf(p),y=p._zod.constr.prototype,h=v;for(;h&&h!==y;)h=Object.getPrototypeOf(h);let O=h??v;c.has(O)||(c.add(O),dn(O,s))}let m=f.prototype;for(let v in m)Object.prototype.hasOwnProperty.call(m,v)&&(v in p||(p[v]=m[v].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(p){let d=n?.Parent?Hl(l):this;a(d,p);let m=d._zod.deferred;if(m){for(let y of m)y();d._zod.deferred=void 0}let v=globalThis.__zod_globalConfig?.postProcessor;return v&&v(d),d}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var Ie=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},zt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ii=globalThis).__zod_globalConfig??(ii.__zod_globalConfig={});var _e=globalThis.__zod_globalConfig;function Pe(e){return e&&Object.assign(_e,e),_e}function ql(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,vt,2)),e.message}function Gl(e){this._zod.message=e}var Yl={get:ql,set:Gl,enumerable:!0,configurable:!0},mn={value:void 0,enumerable:!1},ai=new WeakSet([Object.prototype,Error.prototype]),ci=(e,t)=>{e.name="$ZodError",mn.value=t,Object.defineProperty(e,"issues",mn),mn.value=void 0,Object.defineProperty(e,"message",Yl);let r=Object.getPrototypeOf(e);ai.has(r)||(ai.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})}}))},ui=b("$ZodError",ci),Vp=b("$ZodError",ci,void 0,{Parent:Error});function Xl(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 li(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Xl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function di(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(c=>n({issues:c},[...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 c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;for(;u<c.length;){let l=c[u],f=u===c.length-1;if(l==="_errors"){f&&a._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(a,l)||Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=a[l];f&&p._errors.push(t(s)),a=p,u++}}}};return n(e),r}function pr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var mr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Ie;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Re(u,s,Pe())));throw ar(a,i?.callee??t),a}return c.value};return t};var hr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Re(u,s,Pe())));throw ar(a,i?.callee??t),a}return c.value};return t};var gr=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 Ie;return i.issues.length?fi(e,i.issues,o):{success:!0,data:i.value}};function fi(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Re(o,r,Pe()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var br=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?fi(e,i.issues,o):{success:!0,data:i.value}};var Ql=Symbol.for("zod.compile.invalid"),ed=Symbol.for("zod.compile.fallback"),hn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ql)return!0;if(n.definite===!0&&r===void 0)return!1}return td(e,t,r)});function td(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ed]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Ie;return i.issues.length===0}var gn=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},pi=e=>{let t=mr(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,pr(r,s))};return r};var mi=e=>{let t=mr(e),r=(n,o,i,s)=>t(n,o,i,pr(r,s));return r};var hi=e=>{let t=hr(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,pr(r,s))};return r};var gi=e=>{let t=hr(e),r=async(n,o,i,s)=>await t(n,o,i,pr(r,s));return r};var bi=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return gr(e)(t,r,o)};var yi=e=>(t,r,n)=>gr(e)(t,r,n);var xi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return br(e)(t,r,o)};var vi=e=>async(t,r,n)=>br(e)(t,r,n);var _i=/^[cC][0-9a-z]{6,}$/,wi=/^[0-9a-z]+$/,ki=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,zi=/^[0-9a-vA-V]{20}$/,$i=/^[A-Za-z0-9]{27}$/,Si=/^[a-zA-Z0-9_-]{21}$/;function Ei(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Pi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Oi=/^([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})$/,yn=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 Ni=/^(?:[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 rd="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Zi(){return new RegExp(rd,"u")}var Ti=/^(?:(?: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])$/,Ai=/^(([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 Li=/^((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])$/,Ri=/^(([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])$/,Ii=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ci=/^https?$/,Mi=/^\+[1-9]\d{6,14}$/;var Di="(?:(?:\\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 nd(e){return new RegExp(`^${e}$`)}var ji=nd(Di);function bn(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 Vi(e){return new RegExp(`^${bn(e)}$`)}function Ui(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${bn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${bn({precision:e.precision})}`:r;return new RegExp(`^${Di}T(?:${n})$`)}var Bi=/^[\s\S]{0,}$/;var xn=/^-?\d+$/,Rt=/^-?\d+(?:\.\d+)?$/,Ji=/^(?:true|false)$/i,Wi=/^null$/i;var Ki=/^[^A-Z]*$/,Hi=/^[^a-z]*$/;var be=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var vn=e=>{let t=e.value;return!en(t)&&t.length!==void 0},yr={number:"number",bigint:"bigint",object:"date"},_n=b("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let r=yr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:yr[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})}}),wn=b("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let r=yr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:yr[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})}}),qi=b("$ZodCheckMultipleOf",(e,t)=>{be.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):tn(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})}}),Gi=b("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Tt[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,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:c,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}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Yi=b("$ZodCheckMaxLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?At(o):i)<=t.maximum)return;let c=Lt(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xi=b("$ZodCheckMinLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?At(o):i)>=t.minimum)return;let c=Lt(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qi=b("$ZodCheckLengthEquals",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?At(o):i;if(s===t.length)return;let c=Lt(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ft=b("$ZodCheckStringFormat",(e,t)=>{var r,n;be.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=()=>{})}),es=b("$ZodCheckRegex",(e,t)=>{Ft.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})}}),ts=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ki),Ft.init(e,t)}),rs=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hi),Ft.init(e,t)}),ns=b("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let r=We(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})}}),os=b("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`^${We(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})}}),is=b("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`.*${We(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 ss=b("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var xr=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.4.0 · MIT · https://fieldia.dev */
2
+ "use strict";var Fieldia=(()=>{var lr=Object.defineProperty;var Ou=Object.getOwnPropertyDescriptor;var Tu=Object.getOwnPropertyNames;var Ru=Object.prototype.hasOwnProperty;var Zu=(e,t,r)=>t in e?lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ai=(e,t)=>{for(var r in t)lr(e,r,{get:t[r],enumerable:!0})},Iu=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Tu(t))!Ru.call(e,o)&&o!==r&&lr(e,o,{get:()=>t[o],enumerable:!(n=Ou(t,o))||n.enumerable});return e};var Fu=e=>Iu(lr({},"__esModule",{value:!0}),e);var mt=(e,t,r)=>Zu(e,typeof t!="symbol"?t+"":t,r);var fm={};ai(fm,{DEFAULT_LABELS:()=>cm,FIELDIA_CSS:()=>Lu,FIELD_NAME:()=>Ze,FIELD_TYPES:()=>Pl,FORMAT_VERSION:()=>Io,FieldSchema:()=>Zo,FieldsSchema:()=>Br,FilterConditionSchema:()=>Lo,LayoutNodeSchema:()=>yt,LineFieldSchema:()=>To,LineKindsSchema:()=>Ro,MESSAGES:()=>pt,ModifierSchema:()=>er,OptionSchema:()=>Qt,PageSchema:()=>Tt,PropertyDefinitionSchema:()=>Oo,RootLayoutSchema:()=>Ur,VERSION:()=>dm,VIEWER_LABELS:()=>si,WIDGET_LABELS:()=>ke,binaryWidget:()=>qo,browserPreferences:()=>ii,builtInWidgets:()=>Nu,charTagsWidget:()=>Uo,checkValue:()=>nr,compileModifier:()=>dt,createForm:()=>Gr,createMemoryDataSource:()=>cu,createWidget:()=>Ve,displayValue:()=>Ko,emptyValue:()=>Mo,evaluateModifier:()=>nu,expressionContext:()=>rr,fill:()=>Hr,formatBytes:()=>or,formatNumber:()=>wt,hostScheduler:()=>ir,htmlWidget:()=>ti,imageWidget:()=>Go,initialValues:()=>Rt,installStyles:()=>oi,isEmpty:()=>Kr,isModifierValid:()=>ou,isoWeek:()=>wu,jsonWidget:()=>ri,kindTextField:()=>mu,labelWidget:()=>ar,lineForm:()=>hu,lineKind:()=>ft,linesWidget:()=>Ho,linkAddress:()=>_u,linkCheckboxesWidget:()=>Wo,many2oneWidget:()=>Bo,memoryPreferences:()=>am,mountViewer:()=>um,normalizeNumber:()=>jo,pageJsonSchema:()=>ru,progressbarWidget:()=>sr,propertiesWidget:()=>Qo,referenceWidget:()=>Jo,sanitizeHtml:()=>ei,statusbarWidget:()=>en,summary:()=>Qr,tagsWidget:()=>Xr,validatePage:()=>Jr,wait:()=>qr,withCalendar:()=>rn});var I={};ai(I,{BIGINT_FORMAT_RANGES:()=>pr,CONSTANT_CATCH:()=>bi,Class:()=>cn,NUMBER_FORMAT_RANGES:()=>It,aborted:()=>Ae,allowsEval:()=>mn,assert:()=>Bu,assertEqual:()=>Cu,assertIs:()=>ju,assertNever:()=>Vu,assertNotEqual:()=>Mu,assignProp:()=>Ne,attachSchema:()=>hr,base64ToUint8Array:()=>hi,base64urlToUint8Array:()=>cd,cached:()=>St,captureStackTrace:()=>dr,cleanEnum:()=>ad,cleanRegex:()=>Zt,clone:()=>Ie,cloneDef:()=>Ju,codePointLength:()=>Ft,constantCatch:()=>yi,createTransparentProxy:()=>Xu,defineLazy:()=>dn,defineLazyInternal:()=>q,derived:()=>fd,esc:()=>fn,escapeRegex:()=>Xe,explicitlyAborted:()=>bn,extend:()=>td,finalizeIssue:()=>Ce,floatSafeRemainder:()=>un,getElementAtPath:()=>Ku,getEnumValues:()=>_t,getLengthableOrigin:()=>Ct,getParsedType:()=>Yu,getSizableOrigin:()=>mi,hexToUint8Array:()=>ud,hide:()=>gr,installLazyProp:()=>gd,isObject:()=>gt,isPlainObject:()=>st,issue:()=>Et,joinValues:()=>ur,jsonStringifyReplacer:()=>zt,members:()=>xn,merge:()=>nd,mergeDefs:()=>Ye,normalizeParams:()=>R,nullish:()=>ln,numKeys:()=>Gu,objectClone:()=>Uu,omit:()=>ed,optionalKeys:()=>gn,own:()=>it,parsedType:()=>yn,partial:()=>od,pick:()=>Qu,prefixIssues:()=>Fe,primitiveTypes:()=>fi,promiseAllObject:()=>Hu,propertyKeyTypes:()=>hn,randomString:()=>qu,rawShape:()=>$t,required:()=>id,safeExtend:()=>rd,shallowClone:()=>di,slugify:()=>pn,stringifyPrimitive:()=>fr,toZod:()=>Du,uint8ArrayToBase64:()=>gi,uint8ArrayToBase64url:()=>ld,uint8ArrayToHex:()=>dd,unwrapMessage:()=>kt});function Cu(e){return e}function Mu(e){return e}function Du(){return e=>e}function ju(e){}function Vu(e){throw new Error("Unexpected value in exhaustive check")}function Bu(e){}function _t(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 ur(e,t="|"){return e.map(r=>fr(r)).join(t)}function zt(e,t){return typeof t=="bigint"?t.toString():t}var an=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 St(e){return new an(e)}function ln(e){return e==null}function Zt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function un(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 ci=Symbol("evaluating");function dn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ci)return n===void 0&&(n=ci,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Uu(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ne(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $t(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ge(e){return $t(e._zod.def)??e._zod.def.shape}function li(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Ne(this,t,n),n},enumerable:!0,configurable:!0})}function ui(e,t,r){t in e?Ne(e,t,r):e[t]=r}function ht(e,t,r,n){let o=Ge(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?li(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):ui(e,i,n?n(s.value,i):s.value))}}function Wu(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?li(e,r,()=>t[r]):ui(e,r,n.value))}}function Ye(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ju(e){return Ye(e._zod.def)}function Ku(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Hu(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 qu(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function fn(e){return JSON.stringify(e)}function pn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var dr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var mn=St(()=>{if($e.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function st(e){if(gt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function di(e){return st(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Gu(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Yu=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}`)}},hn=new Set(["string","number","symbol"]),fi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function R(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 Xu(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 fr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var It={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]},pr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qu(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 ht(i,e,mr(e,t)),Ie(e,Ye(r,{shape:i,checks:[]}))}function mr(e,t){let r=Ge(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 ed(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(mr(e,t)),s={};return ht(s,e,Reflect.ownKeys(Ge(e)).filter(c=>!i.has(c))),Ie(e,Ye(r,{shape:s,checks:[]}))}function td(e,t){if(!st(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=Ge(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 Ie(e,Ye(e._zod.def,{shape:pi(e,t)}))}function pi(e,t){let r={};return ht(r,e,Reflect.ownKeys(Ge(e))),Wu(r,t),r}function rd(e,t){if(!st(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ie(e,Ye(e._zod.def,{shape:pi(e,t)}))}function nd(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={};ht(r,e,Reflect.ownKeys(Ge(e))),ht(r,t,Reflect.ownKeys(Ge(t)));let n=Ye(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ie(e,n)}function od(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 c=r?new Set(mr(t,r)):void 0,a={};return ht(a,t,Reflect.ownKeys(Ge(t)),e&&((l,u)=>c&&!c.has(u)?l:new e({type:"optional",innerType:l}))),Ie(t,Ye(t._zod.def,{shape:a,checks:[]}))}function id(e,t,r){let n=r?new Set(mr(t,r)):void 0,o={};return ht(o,t,Reflect.ownKeys(Ge(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Ie(t,Ye(t._zod.def,{shape:o}))}function Ae(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 bn(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 Fe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function kt(e){return typeof e=="string"?e:e?.message}function hr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Ce(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:kt(e.inst?._zod.def?.error?.(e))??kt(i?.(e))??kt(t?.error?.(e))??kt(r.customError?.(e))??kt(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function mi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var sd=/[\uD800-\uDBFF]/;function Ft(e){let t=e.length;if(!sd.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 Ct(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yn(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 Et(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ad(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function hi(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 gi(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function cd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return hi(t+r)}function ld(e){return gi(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ud(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 dd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var cn=class{constructor(...t){}};function xn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):pd(e,r,n.value)}}function it(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function gr(e,t,r){return it(e,t,r,!1)}function fd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return it(this,r,n(this))},set(o){it(this,r,o)}})}return t}function pd(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:it(this,t,r.bind(this))},set(n){it(this,t,n)}})}function md(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var sn,ot=!1,hd={configurable:!0,get(){ot=!0}};function q(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&sn!==e._zod){sn=void 0;return}sn=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,hd);let o=ot;ot=!1;try{let i=r(this);return ot?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),ot=ot||o,i}catch(i){throw delete this[t],ot=ot||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function gd(e,t,r,n){let o=md(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 bi="~constantCatch";function yi(e){let t=()=>e;return t[bi]=!0,t}var xi;var vn={value:void 0,enumerable:!1},vi="captureStackTrace"in Error?Error:null;function bd(e){let t=vi;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return vi=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function v(e,t,r,n){let o={};function i(g){this.def=g,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(g,d){if(g._zod){if(g._zod.traits.has(e))return}else{vn.value=new i(d);try{Object.defineProperty(g,"_zod",vn)}finally{vn.value=void 0}}if(g._zod.traits.add(e),t(g,d),c){let m=Object.getPrototypeOf(g),b=g._zod.constr.prototype,p=m;for(;p&&p!==b;)p=Object.getPrototypeOf(p);let w=p??m;c.has(w)||(c.add(w),xn(w,s))}let h=f.prototype;for(let m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in g||(g[m]=h[m].bind(g)))}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function f(g){let d=n?.Parent?bd(u):this;a(d,g);let h=d._zod.deferred;if(h){for(let b of h)b();d._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(d),d}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:g=>n?.Parent&&g instanceof n.Parent?!0:g?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var Me=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Nt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(xi=globalThis).__zod_globalConfig??(xi.__zod_globalConfig={});var $e=globalThis.__zod_globalConfig;function Oe(e){return e&&Object.assign($e,e),$e}function yd(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,zt,2)),e.message}function xd(e){this._zod.message=e}var vd={get:yd,set:xd,enumerable:!0,configurable:!0},kn={value:void 0,enumerable:!1},wi=new WeakSet([Object.prototype,Error.prototype]),ki=(e,t)=>{e.name="$ZodError",kn.value=t,Object.defineProperty(e,"issues",kn),kn.value=void 0,Object.defineProperty(e,"message",vd);let r=Object.getPrototypeOf(e);wi.has(r)||(wi.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})}}))},_i=v("$ZodError",ki),bm=v("$ZodError",ki,void 0,{Parent:Error});function wd(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 zi(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?wd(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Si(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(c=>n({issues:c},[...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 c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,l=0;for(;l<c.length;){let u=c[l],f=l===c.length-1;if(u==="_errors"){f&&a._errors.push(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(a,u)||Object.defineProperty(a,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=a[u];f&&g._errors.push(t(s)),a=g,l++}}}};return n(e),r}function br(e,t){return{callee:t?.callee??e,Err:t?.Err}}var yr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Me;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>Ce(l,s,Oe())));throw dr(a,i?.callee??t),a}return c.value};return t};var xr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>Ce(l,s,Oe())));throw dr(a,i?.callee??t),a}return c.value};return t};var vr=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 Me;return i.issues.length?$i(e,i.issues,o):{success:!0,data:i.value}};function $i(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Ce(o,r,Oe()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var wr=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?$i(e,i.issues,o):{success:!0,data:i.value}};var kd=Symbol.for("zod.compile.invalid"),_d=Symbol.for("zod.compile.fallback"),_n=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==kd)return!0;if(n.definite===!0&&r===void 0)return!1}return zd(e,t,r)});function zd(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[_d]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Me;return i.issues.length===0}var zn=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},Ei=e=>{let t=yr(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,br(r,s))};return r};var Ni=e=>{let t=yr(e),r=(n,o,i,s)=>t(n,o,i,br(r,s));return r};var Pi=e=>{let t=xr(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,br(r,s))};return r};var Li=e=>{let t=xr(e),r=async(n,o,i,s)=>await t(n,o,i,br(r,s));return r};var Ai=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return vr(e)(t,r,o)};var Oi=e=>(t,r,n)=>vr(e)(t,r,n);var Ti=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return wr(e)(t,r,o)};var Ri=e=>async(t,r,n)=>wr(e)(t,r,n);var Zi=/^[cC][0-9a-z]{6,}$/,Ii=/^[0-9a-z]+$/,Fi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ci=/^[0-9a-vA-V]{20}$/,Mi=/^[A-Za-z0-9]{27}$/,Di=/^[a-zA-Z0-9_-]{21}$/;function ji(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Bi=/^([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})$/,$n=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 Ui=/^(?:[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 Sd="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Wi(){return new RegExp(Sd,"u")}var Ji=/^(?:(?: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])$/,Ki=/^(([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 Hi=/^((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])$/,qi=/^(([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])$/,Gi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Xi=/^https?$/,Qi=/^\+[1-9]\d{6,14}$/;var es="(?:(?:\\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 $d(e){return new RegExp(`^${e}$`)}var ts=$d(es);function Sn(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 rs(e){return new RegExp(`^${Sn(e)}$`)}function ns(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Sn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Sn({precision:e.precision})}`:r;return new RegExp(`^${es}T(?:${n})$`)}var os=/^[\s\S]{0,}$/;var En=/^-?\d+$/,Mt=/^-?\d+(?:\.\d+)?$/,is=/^(?:true|false)$/i,ss=/^null$/i;var as=/^[^A-Z]*$/,cs=/^[^a-z]*$/;var we=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Nn=e=>{let t=e.value;return!ln(t)&&t.length!==void 0},kr={number:"number",bigint:"bigint",object:"date"},Pn=v("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=kr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:kr[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})}}),Ln=v("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=kr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:kr[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})}}),ls=v("$ZodCheckMultipleOf",(e,t)=>{we.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):un(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})}}),us=v("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=It[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,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:c,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}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var ds=v("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=Nn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ft(o):i)<=t.maximum)return;let c=Ct(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fs=v("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=Nn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ft(o):i)>=t.minimum)return;let c=Ct(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ps=v("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=Nn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ft(o):i;if(s===t.length)return;let c=Ct(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jt=v("$ZodCheckStringFormat",(e,t)=>{var r,n;we.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=()=>{})}),ms=v("$ZodCheckRegex",(e,t)=>{jt.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})}}),hs=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=as),jt.init(e,t)}),gs=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cs),jt.init(e,t)}),bs=v("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=Xe(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})}}),ys=v("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${Xe(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})}}),xs=v("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${Xe(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 vs=v("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var _r=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 cs={major:4,minor:6,patch:5};var Y=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cs;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=(c,a,u)=>{if(c.memo)return c;let l=Ee(c),f;for(let p of a){if(p._zod.def.when){if(un(c)||!p._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new Ie;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(dr(c.issues,d,e),l||(l=Ee(c,d)))});else{if(c.issues.length===d)continue;dr(c.issues,d,e),l||(l=Ee(c,d))}}return f?f.then(()=>c):c},s=(c,a,u)=>{if(Ee(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new Ie;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,c,a)):s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new Ie;return u.then(l=>i(l,o,a))}return i(u,o,a)}}},{get"~standard"(){return fr(this,"~standard",zn(this))},set"~standard"(e){Qe(this,"~standard",e)}}),ws=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Re(r,t,Pe()))}:{value:e.value};async function od(e,t){let r={async:!0};return ws(await e._zod.run({value:t,issues:[]},r),r)}function zn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return ws(n,r)}catch{}return od(e,t)},vendor:"zod",version:1}}var kr=b("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=t.pattern??Bi,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}}),oe=b("$ZodStringFormat",(e,t)=>{Ft.init(e,t),kr.init(e,t)}),ks=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Oi),oe.init(e,t)}),zs=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=yn(n))}else t.pattern??(t.pattern=yn());oe.init(e,t)}),$s=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ni),oe.init(e,t)}),Ss=1,_r=2;function Es(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function id(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Es(e)||_r:sd(e,t)}function sd(e,t){if(!t.normalize&&t.protocol?.source===Ci.source&&!/^https?:\/\//i.test(e))return Ss;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??_r}return new URL(e)}catch{return _r}}var ad=/[\t\n\r]/g;function us(e){return e.replace(ad,"")}function cd(e,t){return t.lastIndex=0,t.test(e.hostname)}function ud(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Ps=b("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=id(n,t);if(o===Ss){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===_r){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=us(n);return}t.hostname&&!cd(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&&!ud(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:us(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Os=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Zi()),oe.init(e,t)}),Ns=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?Si:Ei(t.length)),oe.init(e,t)}),Zs=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_i),oe.init(e,t)}),Ts=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wi),oe.init(e,t)}),As=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ki),oe.init(e,t)}),Ls=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=zi),oe.init(e,t)}),Rs=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$i),oe.init(e,t)}),Is=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ui(t)),oe.init(e,t)}),Fs=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ji),oe.init(e,t)}),Cs=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vi(t)),oe.init(e,t)}),Ms=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pi),oe.init(e,t)}),Ds=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ti),oe.init(e,t)}),ld=/^[0-9a-fA-F:.]+$/;function js(e){return ld.test(e)?Es(`http://[${e}]`):!1}var Vs=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ai),oe.init(e,t),e._zod.check=r=>{js(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Us=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Li),oe.init(e,t)});function dd(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:js(r)}var Bs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ri),oe.init(e,t),e._zod.check=r=>{dd(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Js(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}$/,Ws=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$n),oe.init(e,t),e._zod.check=r=>{Js(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),zr=/^[A-Za-z0-9_-]*$/;function fd(e){if(!zr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Js(r)}var Ks=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zr),oe.init(e,t),e._zod.check=r=>{fd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Hs=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Mi),oe.init(e,t)});function pd(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 qs=b("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{pd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Sn=b("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=Rt,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}}),Gs=b("$ZodNumberFormat",(e,t)=>{Gi.init(e,t),Sn.init(e,t)}),Ys=b("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=Ji,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 Xs=b("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=Wi,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 Qs=b("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),ea=b("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ls(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}var ta=b("$ZodArray",(e,t)=>{Y.init(e,t);let r=_e.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=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>ls(f,n,a)));else if(ls(l,n,a),c&&l.issues.length!==0&&Ee(l))break}return s.length?Promise.all(s).then(()=>n):n}});function wr(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Le(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"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var md=[];function ra(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:md,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=cn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function na(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,p=u.optout,d=0;for(let m in t){if(s&&r.issues.length!==d){if(Ee(r,d))break;d=r.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}let v=u.run({value:t[m],issues:[]},n);v instanceof Promise?e.push(v.then(y=>wr(y,r,m,t,f,p))):wr(v,r,m,t,f,p)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var hd=b("$ZodObject",(e,t)=>{Y.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=_t(()=>ra(t));j(e,"propValues",u=>{let l=u.def.shape,f={};for(let p in l){let d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(f,p)||ke(f,p,new Set);for(let m of d.values)f[p].add(m);d.optin!==void 0&&f[p].add(void 0)}}return f});let i=ut,s=t.catchall,c,a=_e.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let p=[],d=c.shape,m=l?.abortEarly,v=u.issues.length;for(let y of c.allKeys){if(m&&u.issues.length!==v){if(Ee(u,v))break;v=u.issues.length}if(y==="__proto__")continue;let h=d[y],O=h._zod.optin,K=h._zod.optout,S=h._zod.run({value:f[y],issues:[]},l);S instanceof Promise?p.push(S.then(z=>wr(z,u,y,f,O,K))):wr(S,u,y,f,O,K)}return s?na(p,f,u,l,o.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),oa=b("$ZodObjectJIT",(e,t)=>{hd.init(e,t);let r=e._zod.parse,n=_t(()=>ra(t)),o=_e.memoizer,i=d=>{let m=n.value,v=m.symbolKeys,y=new xr(["payload","ctx"],{shape:d,inst:e,memo:o,syms:v}),h=z=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,O=(z,E)=>`
6
+ };`)(...Object.values(this.closed))}};var ks={major:4,minor:6,patch:5};var te=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ks;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=(c,a,l)=>{if(c.memo)return c;let u=Ae(c),f;for(let g of a){if(g._zod.def.when){if(bn(c)||!g._zod.def.when(c))continue}else if(u)continue;let d=c.issues.length,h=g._zod.check(c);if(h instanceof Promise&&l?.async===!1)throw new Me;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,c.issues.length!==d&&(hr(c.issues,d,e),u||(u=Ae(c,d)))});else{if(c.issues.length===d)continue;hr(c.issues,d,e),u||(u=Ae(c,d))}}return f?f.then(()=>c):c},s=(c,a,l)=>{if(Ae(c))return c.aborted=!0,c;let u=i(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new Me;return u.then(f=>e._zod.parse(f,l))}return e._zod.parse(u,l)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let u=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(f=>s(f,c,a)):s(u,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new Me;return l.then(u=>i(u,o,a))}return i(l,o,a)}}},{get"~standard"(){return gr(this,"~standard",On(this))},set"~standard"(e){it(this,"~standard",e)}}),Is=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ce(r,t,Oe()))}:{value:e.value};async function Ed(e,t){let r={async:!0};return Is(await e._zod.run({value:t,issues:[]},r),r)}function On(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Is(n,r)}catch{}return Ed(e,t)},vendor:"zod",version:1}}var Er=v("$ZodString",(e,t)=>{te.init(e,t),e._zod.pattern=t.pattern??os,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}}),ue=v("$ZodStringFormat",(e,t)=>{jt.init(e,t),Er.init(e,t)}),Fs=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Bi),ue.init(e,t)}),Cs=v("$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=$n(n))}else t.pattern??(t.pattern=$n());ue.init(e,t)}),Ms=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ui),ue.init(e,t)}),Ds=1,Sr=2;function js(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Nd(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?js(e)||Sr:Pd(e,t)}function Pd(e,t){if(!t.normalize&&t.protocol?.source===Xi.source&&!/^https?:\/\//i.test(e))return Ds;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Sr}return new URL(e)}catch{return Sr}}var Ld=/[\t\n\r]/g;function _s(e){return e.replace(Ld,"")}function Ad(e,t){return t.lastIndex=0,t.test(e.hostname)}function Od(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Vs=v("$ZodURL",(e,t)=>{ue.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Nd(n,t);if(o===Ds){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Sr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=_s(n);return}t.hostname&&!Ad(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&&!Od(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:_s(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Bs=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Wi()),ue.init(e,t)}),Us=v("$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?Di:ji(t.length)),ue.init(e,t)}),Ws=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Zi),ue.init(e,t)}),Js=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ii),ue.init(e,t)}),Ks=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Fi),ue.init(e,t)}),Hs=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ci),ue.init(e,t)}),qs=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mi),ue.init(e,t)}),Gs=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ns(t)),ue.init(e,t)}),Ys=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ts),ue.init(e,t)}),Xs=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rs(t)),ue.init(e,t)}),Qs=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vi),ue.init(e,t)}),ea=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ji),ue.init(e,t)}),Td=/^[0-9a-fA-F:.]+$/;function ta(e){return Td.test(e)?js(`http://[${e}]`):!1}var ra=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ki),ue.init(e,t),e._zod.check=r=>{ta(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var na=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hi),ue.init(e,t)});function Rd(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:ta(r)}var oa=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qi),ue.init(e,t),e._zod.check=r=>{Rd(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function ia(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Tn=/^[0-9a-zA-Z+/]*={0,2}$/,sa=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Tn),ue.init(e,t),e._zod.check=r=>{ia(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Nr=/^[A-Za-z0-9_-]*$/;function Zd(e){if(!Nr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ia(r)}var aa=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Nr),ue.init(e,t),e._zod.check=r=>{Zd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ca=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Qi),ue.init(e,t)});function Id(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 la=v("$ZodJWT",(e,t)=>{ue.init(e,t),e._zod.check=r=>{Id(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Rn=v("$ZodNumber",(e,t)=>{te.init(e,t),e._zod.pattern=Mt,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}}),ua=v("$ZodNumberFormat",(e,t)=>{us.init(e,t),Rn.init(e,t)}),da=v("$ZodBoolean",(e,t)=>{te.init(e,t),e._zod.pattern=is,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 fa=v("$ZodNull",(e,t)=>{te.init(e,t),e._zod.pattern=ss,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 pa=v("$ZodUnknown",(e,t)=>{te.init(e,t),e._zod.parse=r=>r}),ma=v("$ZodNever",(e,t)=>{te.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function zs(e,t,r){e.issues.length&&t.issues.push(...Fe(r,e.issues)),t.value[r]=e.value}var ha=v("$ZodArray",(e,t)=>{te.init(e,t);let r=$e.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=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then(f=>zs(f,n,a)));else if(zs(u,n,a),c&&u.issues.length!==0&&Ae(u))break}return s.length?Promise.all(s).then(()=>n):n}});function $r(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Fe(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"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Fd=[];function ga(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Fd,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=gn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ba(e,t,r,n,o,i,s){let c=[],a=o.keySet,l=o.catchall._zod,u=l.def.type,f=l.optin,g=l.optout,d=0;for(let h in t){if(s&&r.issues.length!==d){if(Ae(r,d))break;d=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){u==="never"&&c.push(h);continue}if(u==="never"){c.push(h);continue}let m=l.run({value:t[h],issues:[]},n);m instanceof Promise?e.push(m.then(b=>$r(b,r,h,t,f,g))):$r(m,r,h,t,f,g)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Cd=v("$ZodObject",(e,t)=>{te.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=St(()=>ga(t));q(e,"propValues",l=>{let u=l.def.shape,f={};for(let g in u){let d=u[g]._zod;if(d.values){Object.prototype.hasOwnProperty.call(f,g)||Ne(f,g,new Set);for(let h of d.values)f[g].add(h);d.optin!==void 0&&f[g].add(void 0)}}return f});let i=gt,s=t.catchall,c,a=$e.memoizer;a?.attach(e),e._zod.parse=(l,u)=>{c??(c=o.value);let f=l.value;if(!i(f))return l.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),l;l.value=a?a.alloc(e,l,{},u):{};let g=[],d=c.shape,h=u?.abortEarly,m=l.issues.length;for(let b of c.allKeys){if(h&&l.issues.length!==m){if(Ae(l,m))break;m=l.issues.length}if(b==="__proto__")continue;let p=d[b],w=p._zod.optin,$=p._zod.optout,E=p._zod.run({value:f[b],issues:[]},u);E instanceof Promise?g.push(E.then(z=>$r(z,l,b,f,w,$))):$r(E,l,b,f,w,$)}return s?ba(g,f,l,u,o.value,e,h===!0):g.length?Promise.all(g).then(()=>l):l}}),ya=v("$ZodObjectJIT",(e,t)=>{Cd.init(e,t);let r=e._zod.parse,n=St(()=>ga(t)),o=$e.memoizer,i=d=>{let h=n.value,m=h.symbolKeys,b=new _r(["payload","ctx"],{shape:d,inst:e,memo:o,syms:m}),p=z=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,w=(z,_)=>`
7
7
  let ${z}_ab = false;
8
8
  for (let i = 0; i < ${z}.issues.length; i++) {
9
9
  const iss = ${z}.issues[i];
10
- iss.path = iss.path ? [${E}, ...iss.path] : [${E}];
10
+ iss.path = iss.path ? [${_}, ...iss.path] : [${_}];
11
11
  payload.issues.push(iss);
12
12
  if (iss.continue !== true) ${z}_ab = true;
13
13
  }
14
14
  if (${z}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;y.write("const input = payload.value;");let K=Object.create(null),S=0;for(let z of m.allKeys)K[z]=`key_${S++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of m.allKeys){if(z==="__proto__")continue;let E=K[z],q=typeof z=="symbol"?`syms[${v.indexOf(z)}]`:nn(z),de=`${q} in input`,Te=d[z],B=Te?._zod?.optin,V=B!==void 0,ne=Te?._zod?.optout==="optional";if(y.write(`const ${E} = ${h(q)};`),V&&ne){let ie=B==="optional"?`${E}_present`:`${E}.value !== undefined || ${E}_present`;y.write(`
18
- const ${E}_present = ${de};
19
- if (!${E}.issues.length || ${E}_present) {
20
- if (${E}.issues.length) {${O(E,q)}
17
+ }`;b.write("const input = payload.value;");let $=Object.create(null),E=0;for(let z of h.allKeys)$[z]=`key_${E++}`;b.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of h.allKeys){if(z==="__proto__")continue;let _=$[z],V=typeof z=="symbol"?`syms[${m.indexOf(z)}]`:fn(z),T=`${V} in input`,Y=d[z],ge=Y?._zod?.optin,B=ge!==void 0,G=Y?._zod?.optout==="optional";if(b.write(`const ${_} = ${p(V)};`),B&&G){let re=ge==="optional"?`${_}_present`:`${_}.value !== undefined || ${_}_present`;b.write(`
18
+ const ${_}_present = ${T};
19
+ if (!${_}.issues.length || ${_}_present) {
20
+ if (${_}.issues.length) {${w(_,V)}
21
21
  }
22
22
 
23
- if (${ie}) {
24
- newResult[${q}] = ${E}.value;
23
+ if (${re}) {
24
+ newResult[${V}] = ${_}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else V?(y.write(`
29
- if (${E}.issues.length) {${O(E,q)}
28
+ `)}else B?(b.write(`
29
+ if (${_}.issues.length) {${w(_,V)}
30
30
  }
31
- `),B==="defaulted"?y.write(`newResult[${q}] = ${E}.value;`):y.write(`
32
- if (${E}.value !== undefined || ${de}) {
33
- newResult[${q}] = ${E}.value;
31
+ `),ge==="defaulted"?b.write(`newResult[${V}] = ${_}.value;`):b.write(`
32
+ if (${_}.value !== undefined || ${T}) {
33
+ newResult[${V}] = ${_}.value;
34
34
  }
35
- `)):y.write(`
36
- const ${E}_present = ${de};
37
- if (${E}.issues.length) {${O(E,q)}
35
+ `)):b.write(`
36
+ const ${_}_present = ${T};
37
+ if (${_}.issues.length) {${w(_,V)}
38
38
  }
39
- if (!${E}_present && !${E}.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: [${q}]
44
+ path: [${V}]
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 (${E}_present) {
53
- newResult[${q}] = ${E}.value;
52
+ if (${_}_present) {
53
+ newResult[${V}] = ${_}.value;
54
54
  }
55
55
 
56
- `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=ut,a=!_e.jitless,l=a&&sn.value,f=t.catchall,p;e._zod.parse=(d,m)=>{p??(p=n.value);let v=d.value;return c(v)?a&&l&&m?.async===!1&&m.jitless!==!0?(s||(s=i(t.shape)),d=s(d,m),f?na([],v,d,m,p,e,m?.abortEarly===!0):d):r(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),d)}});function ds(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=>!Ee(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=>Re(s,n,Pe())))}),t)}var En=b("$ZodUnion",(e,t)=>{Y.init(e,t),j(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),j(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),j(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)))}),j(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=>Zt(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 c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(c=>ds(c,n,e,o)):ds(s,n,e,o)}});function gd(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 ia=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,En.init(e,t);let r=e._zod.parse;j(e,"propValues",o=>{let i={},s=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,u)||ke(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=wt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=_t(()=>gd(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ut(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],a=n.value.get(c);return a&&(c!==void 0||i.direction!=="backward")?a._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)}}),sa=b("$ZodIntersection",(e,t)=>{Y.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(([a,u])=>fs(r,a,u)):fs(r,i,s)}});function kn(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(et(e)&&et(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=kn(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=kn(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 fs(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);i.has(p)||i.set(p,u),f=[p]}else return!1;for(let p of f)n.has(p)||n.set(p,{}),n.get(p)[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 c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of c)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let a=kn(t.value,r.value);if(!a.valid){if(Ee(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var aa=b("$ZodTuple",(e,t)=>{Y.init(e,t);let r=t.items,n=_e.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 c=[],a=ps(r,"optin"),u=ps(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,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),f=t.rest?i?.abortEarly:void 0,p=!1;for(let d=0;d<r.length;d++){let m=r[d]._zod.run({value:s[d],issues:[]},i);m instanceof Promise?c.push(m.then(v=>{l[d]=v})):(l[d]=m,f&&!p&&m.issues.length&&(p=Ee(m)))}if(t.rest&&!p){let d=r.length-1,m=s.slice(r.length),v=o.issues.length;for(let y of m){if(f&&o.issues.length!==v){if(Ee(o,v))break;v=o.issues.length}d++;let h=t.rest._zod.run({value:y,issues:[]},i);h instanceof Promise?c.push(h.then(O=>ms(O,o,d))):ms(h,o,d)}}return c.length?Promise.all(c).then(()=>hs(l,o,r,s,u)):hs(l,o,r,s,u)}});function ps(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 ms(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}function hs(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...Le(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 ca=b("$ZodRecord",(e,t)=>{Y.init(e,t);let r=_e.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!et(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(m=>Re(m,o,Pe())),input:l,path:[l],inst:e});continue}let p=f.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Le(l,m.issues)),n.value[p]=m.value})):(d.issues.length&&n.issues.push(...Le(l,d.issues)),n.value[p]=d.value)}let u;for(let l in i)if(!a.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 a;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"&&Rt.test(u)&&l.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:c?(a=a??[],a.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Re(m,o,Pe())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Le(u,m.issues)),n.value[p]=m.value})):(d.issues.length&&n.issues.push(...Le(u,d.issues)),n.value[p]=d.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var ua=b("$ZodEnum",(e,t)=>{Y.init(e,t);let r=xt(t.entries),n=new Set(r);e._zod.values=n,j(e,"pattern",o=>{let i=xt(o.def.entries).filter(s=>an.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>We(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}}),la=b("$ZodLiteral",(e,t)=>{Y.init(e,t);let r=new Set(t.values);e._zod.values=r,j(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?We(i):i?We(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 da=b("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.optin="optional",_e.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new zt(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 Ie;return r.value=o,r}});function gs(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pn=b("$ZodOptional",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",j(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),j(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(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=>gs(r,i)):gs(r,o)}return t.innerType._zod.run(r,n)}}),fa=b("$ZodExactOptional",(e,t)=>{Pn.init(e,t),j(e,"values",r=>r.def.innerType._zod.values),j(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),pa=b("$ZodNullable",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin),j(e,"optout",r=>r.def.innerType._zod.optout),j(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(n.source)}|null)$`):void 0}),j(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)}),ma=b("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="defaulted",j(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=>bs(i,t)):bs(o,t)}});function bs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ha=b("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="defaulted",j(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))}),ga=b("$ZodNonOptional",(e,t)=>{Y.init(e,t),j(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=>ys(i,e)):ys(o,e)}});function ys(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 xs(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Re(o,n,Pe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ba=b("$ZodCatch",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),j(e,"optout",r=>r.def.innerType._zod.optout),j(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=>xs(r,i,t,n)):xs(r,o,t,n)}});var ya=b("$ZodPipe",(e,t)=>{Y.init(e,t),j(e,"values",r=>r.def.in._zod.values),j(e,"optin",r=>r.def.in._zod.optin),j(e,"optout",r=>r.def.out._zod.optout),j(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=>vr(s,t.in,n)):vr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>vr(i,t.out,n)):vr(o,t.out,n)}});function vr(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 xa=b("$ZodReadonly",(e,t)=>{Y.init(e,t),j(e,"propValues",r=>r.def.innerType._zod.propValues),j(e,"values",r=>r.def.innerType._zod.values),j(e,"optin",r=>r.def.innerType?._zod?.optin),j(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(vs):vs(o)}});function vs(e){return e.memo||(e.value=Object.freeze(e.value)),e}var va=b("$ZodLazy",(e,t)=>{Y.init(e,t),rn(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),j(e,"pattern",r=>r.innerType?._zod?.pattern),j(e,"propValues",r=>r.innerType?._zod?.propValues),j(e,"optin",r=>r.innerType?._zod?.optin??void 0),j(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),_a=b("$ZodCustom",(e,t)=>{be.init(e,t),Y.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=>_s(i,r,n,e));_s(o,r,n,e)}});function _s(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(kt(o))}}var Nn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Zn="~memo",wa=[];function ka(e){return e!==null&&typeof e=="object"}function On(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var za=new WeakMap,Ct=0,Er=1,Mt=2;function Pr(e,t,r){let n=za.get(e);if(n!==void 0)return n?Mt:Ct;if(t.has(e))return Mt;t.add(e);let o=Ct,i=l=>{if(o!==Mt&&l?._zod){let f=Pr(l,t,r);f>o&&(o=f)}},s=(l,f)=>{let p=Ct;for(let d of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,d);if(f&&!m.enumerable)continue;let v=m.get?Er:m.value?._zod?Pr(m.value,t,r):Ct;v>p&&(p=v)}return p},c=l=>{l>o&&(o=l)},a=e._zod.def,u=a.type;switch(u){case"object":{let l=wt(a);c(l?s(l,!0):Er),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?Pr(l,t,!1):Er);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 a){let f=Object.getOwnPropertyDescriptor(a,l);if(!f||f.get)continue;let p=f.value;if(!(!p||typeof p!="object")){if(p._zod)i(p);else if(Array.isArray(p))for(let d of p)i(d)}}}return t.delete(e),bd(e,o)}function bd(e,t){return t!==Er&&za.set(e,t===Mt),t}function yd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var $r,Sr=[],xd={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),Sr.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"&&vd(i,o.value))throw new Nn;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,c=(a,u)=>{if(r===void 0){let h=Pr(e,new Set,!1);if(h===Ct)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,u);h===Mt||n?r=!0:n=!0}let l=a.value;if(!ka(l))return s(a,u);let f=u[Zn];f||(f={buckets:new WeakMap,backEdges:void 0},u[Zn]=f);let p;o===u?p=i:(p=yd(f,e),o=u,i=p);let d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...On(d.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value)),a;$r=p;let m=Sr.length,v=s(a,u);$r=void 0;let y=Sr.length>m?Sr.pop():void 0;return v instanceof Promise?v.then(h=>(y&&(y.issues=h.issues.length?On(h.issues):wa),h)):(y&&(y.issues=v.issues.length?On(v.issues):wa),v)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function $a(){return xd}function vd(e,t){let r=e[Zn]?.backEdges;return r!==void 0&&ka(t)&&r.has(t)}var _d=()=>{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),c=ln(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${cr(i.values[0])}`:`Invalid option: expected one of ${sr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.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":""}: ${sr(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(c=>`'${c}'`).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 Sa(){return{localeError:_d()}}var Ea;var Tn=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 wd(){return new Tn}(Ea=globalThis).__zod_globalRegistry??(Ea.__zod_globalRegistry=wd());var lt=globalThis.__zod_globalRegistry;function Pa(e){return e.checks&&(e.checks=[...e.checks]),e}function Oa(e,t){return new e(Pa({type:"string",...Z(t)}))}function Na(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(t)})}function Za(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(t)})}function La(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(t)})}function Ia(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(t)})}function Fa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(t)})}function Ca(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(t)})}function Ma(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(t)})}function Da(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(t)})}function ja(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(t)})}function Va(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(t)})}function Ua(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(t)})}function Ba(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(t)})}function Ja(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(t)})}function Wa(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(t)})}function Ka(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(t)})}function Ha(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(t)})}function qa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(t)})}function Ga(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(t)})}function Ya(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(t)})}function Xa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(t)})}function Qa(e,t){return new e({type:"string",format:"date",check:"string_format",...Z(t)})}function ec(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(t)})}function tc(e,t){return new e({type:"string",format:"duration",check:"string_format",...Z(t)})}function rc(e,t){return new e(Pa({type:"number",checks:[],...Z(t)}))}function nc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(t)})}function oc(e,t){return new e({type:"boolean",...Z(t)})}function ic(e,t){return new e({type:"null",...Z(t)})}function sc(e){return new e({type:"unknown"})}function ac(e,t){return new e({type:"never",...Z(t)})}function Or(e,t){return new _n({check:"less_than",...Z(t),value:e,inclusive:!1})}function Dt(e,t){return new _n({check:"less_than",...Z(t),value:e,inclusive:!0})}function Nr(e,t){return new wn({check:"greater_than",...Z(t),value:e,inclusive:!1})}function jt(e,t){return new wn({check:"greater_than",...Z(t),value:e,inclusive:!0})}function Zr(e,t){return new qi({check:"multiple_of",...Z(t),value:e})}function Tr(e,t){return new Yi({check:"max_length",...Z(t),maximum:e})}function $t(e,t){return new Xi({check:"min_length",...Z(t),minimum:e})}function Ar(e,t){return new Qi({check:"length_equals",...Z(t),length:e})}function An(e,t){return new es({check:"string_format",format:"regex",...Z(t),pattern:e})}function Ln(e){return new ts({check:"string_format",format:"lowercase",...Z(e)})}function Rn(e){return new rs({check:"string_format",format:"uppercase",...Z(e)})}function In(e,t){return new ns({check:"string_format",format:"includes",...Z(t),includes:e})}function Fn(e,t){return new os({check:"string_format",format:"starts_with",...Z(t),prefix:e})}function Cn(e,t){return new is({check:"string_format",format:"ends_with",...Z(t),suffix:e})}function tt(e){return new ss({check:"overwrite",tx:e})}function Mn(e){return tt(t=>t.normalize(e))}function Dn(){return tt(e=>e.trim())}function jn(){return tt(e=>e.toLowerCase())}function Vn(){return tt(e=>e.toUpperCase())}function Un(){return tt(e=>on(e))}function cc(e,t,r){return new e({type:"array",element:t,...Z(r)})}function uc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Z(r)})}function lc(e,t){let r=kd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(kt(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(kt(i))}},e(n.value,n)),t);return r}function kd(e,t){let r=new be({check:"custom",...Z(t)});return r._zod.check=e,r}function Vt(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ke(e,n,r[n]);return e}function Bt(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??lt,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 me(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 ee(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 c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let p=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,p,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),ee(f,t,l),t.seen.get(f).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Vt(s.schema,a),t.io==="input"&&we(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 dc(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 c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,p=e.external.uri??(m=>m);if(f)return{ref:p(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${dc(d)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+dc(l)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
56
+ `)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},s,c=gt,a=!$e.jitless,u=a&&mn.value,f=t.catchall,g;e._zod.parse=(d,h)=>{g??(g=n.value);let m=d.value;return c(m)?a&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),d=s(d,h),f?ba([],m,d,h,g,e,h?.abortEarly===!0):d):r(d,h):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d)}});function Ss(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=>!Ae(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=>Ce(s,n,Oe())))}),t)}var Zn=v("$ZodUnion",(e,t)=>{te.init(e,t),q(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),q(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),q(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)))}),q(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=>Zt(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 c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(c=>Ss(c,n,e,o)):Ss(s,n,e,o)}});function Md(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 xa=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Zn.init(e,t);let r=e._zod.parse;q(e,"propValues",o=>{let i={},s=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&s++;for(let[l,u]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,l)||Ne(i,l,new Set);for(let f of u)i[l].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=$t(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=St(()=>Md(t));e._zod.parse=(o,i)=>{let s=o.value;if(!gt(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],a=n.value.get(c);return a&&(c!==void 0||i.direction!=="backward")?a._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(l=>n.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),va=v("$ZodIntersection",(e,t)=>{te.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(([a,l])=>$s(r,a,l)):$s(r,i,s)}});function An(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(st(e)&&st(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=An(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=An(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 $s(e,t,r){let n=new Map,o,i=new Map,s=(l,u)=>{let f;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),f=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let g=String(l.path[0]);i.has(g)||i.set(g,l),f=[g]}else return!1;for(let g of f)n.has(g)||n.set(g,{}),n.get(g)[u]=!0;return!0};for(let l of t.issues)s(l,"l")||e.issues.push(l);for(let l of r.issues)s(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(u=>o.keys.includes(u)):[];l.length&&e.issues.push({...o,keys:l});for(let u of c)!l.includes(u)&&i.has(u)&&e.issues.push(i.get(u))}let a=An(t.value,r.value);if(!a.valid){if(Ae(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var wa=v("$ZodTuple",(e,t)=>{te.init(e,t);let r=t.items,n=$e.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 c=[],a=Es(r,"optin"),l=Es(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,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 u=new Array(r.length),f=t.rest?i?.abortEarly:void 0,g=!1;for(let d=0;d<r.length;d++){let h=r[d]._zod.run({value:s[d],issues:[]},i);h instanceof Promise?c.push(h.then(m=>{u[d]=m})):(u[d]=h,f&&!g&&h.issues.length&&(g=Ae(h)))}if(t.rest&&!g){let d=r.length-1,h=s.slice(r.length),m=o.issues.length;for(let b of h){if(f&&o.issues.length!==m){if(Ae(o,m))break;m=o.issues.length}d++;let p=t.rest._zod.run({value:b,issues:[]},i);p instanceof Promise?c.push(p.then(w=>Ns(w,o,d))):Ns(p,o,d)}}return c.length?Promise.all(c).then(()=>Ps(u,o,r,s,l)):Ps(u,o,r,s,l)}});function Es(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 Ns(e,t,r){e.issues.length&&t.issues.push(...Fe(r,e.issues)),t.value[r]=e.value}function Ps(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...Fe(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 ka=v("$ZodRecord",(e,t)=>{te.init(e,t);let r=$e.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!st(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let u of c)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(a.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;let f=t.keyType._zod.run({value:u,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(h=>Ce(h,o,Oe())),input:u,path:[u],inst:e});continue}let g=f.value;if(g==="__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(...Fe(u,h.issues)),n.value[g]=h.value})):(d.issues.length&&n.issues.push(...Fe(u,d.issues)),n.value[g]=d.value)}let l;for(let u in i)if(!a.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;n.value[u]=i[u]}else l=l??[],l.push(u);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Mt.test(l)&&u.issues.length){let h=t.keyType._zod.run({value:Number(l),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(u=h)}if(u.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(h=>Ce(h,o,Oe())),input:l,path:[l],inst:e});continue}let g=u.value;if(g==="__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(...Fe(l,h.issues)),n.value[g]=h.value})):(d.issues.length&&n.issues.push(...Fe(l,d.issues)),n.value[g]=d.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var _a=v("$ZodEnum",(e,t)=>{te.init(e,t);let r=_t(t.entries),n=new Set(r);e._zod.values=n,q(e,"pattern",o=>{let i=_t(o.def.entries).filter(s=>hn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Xe(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}}),za=v("$ZodLiteral",(e,t)=>{te.init(e,t);let r=new Set(t.values);e._zod.values=r,q(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Xe(i):i?Xe(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 Sa=v("$ZodTransform",(e,t)=>{te.init(e,t),e._zod.optin="optional",$e.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Nt(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 Me;return r.value=o,r}});function Ls(e,t){return e.value=t.issues.length?void 0:t.value,e}var In=v("$ZodOptional",(e,t)=>{te.init(e,t),q(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",q(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),q(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(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)}}),$a=v("$ZodExactOptional",(e,t)=>{In.init(e,t),q(e,"values",r=>r.def.innerType._zod.values),q(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ea=v("$ZodNullable",(e,t)=>{te.init(e,t),q(e,"optin",r=>r.def.innerType._zod.optin),q(e,"optout",r=>r.def.innerType._zod.optout),q(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(n.source)}|null)$`):void 0}),q(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)}),Na=v("$ZodDefault",(e,t)=>{te.init(e,t),e._zod.optin="defaulted",q(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=>As(i,t)):As(o,t)}});function As(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Pa=v("$ZodPrefault",(e,t)=>{te.init(e,t),e._zod.optin="defaulted",q(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=v("$ZodNonOptional",(e,t)=>{te.init(e,t),q(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=>Os(i,e)):Os(o,e)}});function Os(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 Ts(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ce(o,n,Oe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Aa=v("$ZodCatch",(e,t)=>{te.init(e,t),q(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),q(e,"optout",r=>r.def.innerType._zod.optout),q(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=>Ts(r,i,t,n)):Ts(r,o,t,n)}});var Oa=v("$ZodPipe",(e,t)=>{te.init(e,t),q(e,"values",r=>r.def.in._zod.values),q(e,"optin",r=>r.def.in._zod.optin),q(e,"optout",r=>r.def.out._zod.optout),q(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=>zr(s,t.in,n)):zr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>zr(i,t.out,n)):zr(o,t.out,n)}});function zr(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 Ta=v("$ZodReadonly",(e,t)=>{te.init(e,t),q(e,"propValues",r=>r.def.innerType._zod.propValues),q(e,"values",r=>r.def.innerType._zod.values),q(e,"optin",r=>r.def.innerType?._zod?.optin),q(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(Rs):Rs(o)}});function Rs(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Ra=v("$ZodLazy",(e,t)=>{te.init(e,t),dn(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),q(e,"pattern",r=>r.innerType?._zod?.pattern),q(e,"propValues",r=>r.innerType?._zod?.propValues),q(e,"optin",r=>r.innerType?._zod?.optin??void 0),q(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Za=v("$ZodCustom",(e,t)=>{we.init(e,t),te.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=>Zs(i,r,n,e));Zs(o,r,n,e)}});function Zs(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(Et(o))}}var Cn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Mn="~memo",Ia=[];function Fa(e){return e!==null&&typeof e=="object"}function Fn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Ca=new WeakMap,Vt=0,Ar=1,Bt=2;function Or(e,t,r){let n=Ca.get(e);if(n!==void 0)return n?Bt:Vt;if(t.has(e))return Bt;t.add(e);let o=Vt,i=u=>{if(o!==Bt&&u?._zod){let f=Or(u,t,r);f>o&&(o=f)}},s=(u,f)=>{let g=Vt;for(let d of Reflect.ownKeys(u)){let h=Object.getOwnPropertyDescriptor(u,d);if(f&&!h.enumerable)continue;let m=h.get?Ar:h.value?._zod?Or(h.value,t,r):Vt;m>g&&(g=m)}return g},c=u=>{u>o&&(o=u)},a=e._zod.def,l=a.type;switch(l){case"object":{let u=$t(a);c(u?s(u,!0):Ar),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let u of a.items)i(u);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let u of a.options)i(u);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let u=a._cachedInner??(r?e._zod.innerType:void 0);c(u?Or(u,t,!1):Ar);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 u in a){let f=Object.getOwnPropertyDescriptor(a,u);if(!f||f.get)continue;let g=f.value;if(!(!g||typeof g!="object")){if(g._zod)i(g);else if(Array.isArray(g))for(let d of g)i(d)}}}return t.delete(e),Dd(e,o)}function Dd(e,t){return t!==Ar&&Ca.set(e,t===Bt),t}function jd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Pr,Lr=[],Vd={alloc(e,t,r){let n=Pr;if(!n)return r;Pr=void 0;let o={value:r,issues:null};return n.set(t.value,o),Lr.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"&&Bd(i,o.value))throw new Cn;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,c=(a,l)=>{if(r===void 0){let p=Or(e,new Set,!1);if(p===Vt)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,l);p===Bt||n?r=!0:n=!0}let u=a.value;if(!Fa(u))return s(a,l);let f=l[Mn];f||(f={buckets:new WeakMap,backEdges:void 0},l[Mn]=f);let g;o===l?g=i:(g=jd(f,e),o=l,i=g);let d=g.get(u);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...Fn(d.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value)),a;Pr=g;let h=Lr.length,m=s(a,l);Pr=void 0;let b=Lr.length>h?Lr.pop():void 0;return m instanceof Promise?m.then(p=>(b&&(b.issues=p.issues.length?Fn(p.issues):Ia),p)):(b&&(b.issues=m.issues.length?Fn(m.issues):Ia),m)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function Ma(){return Vd}function Bd(e,t){let r=e[Mn]?.backEdges;return r!==void 0&&Fa(t)&&r.has(t)}var Ud=()=>{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),c=yn(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${fr(i.values[0])}`:`Invalid option: expected one of ${ur(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.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":""}: ${ur(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(c=>`'${c}'`).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 Da(){return{localeError:Ud()}}var ja;var Dn=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 Wd(){return new Dn}(ja=globalThis).__zod_globalRegistry??(ja.__zod_globalRegistry=Wd());var bt=globalThis.__zod_globalRegistry;function Va(e){return e.checks&&(e.checks=[...e.checks]),e}function Ba(e,t){return new e(Va({type:"string",...R(t)}))}function Ua(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Wa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function Ja(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function Ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function qa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Ga(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Ya(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function Xa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Qa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function ec(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function tc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function rc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function nc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function oc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function ic(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function sc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function ac(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function cc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function lc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function uc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function dc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function fc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function pc(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function mc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function hc(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function gc(e,t){return new e(Va({type:"number",checks:[],...R(t)}))}function bc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function yc(e,t){return new e({type:"boolean",...R(t)})}function xc(e,t){return new e({type:"null",...R(t)})}function vc(e){return new e({type:"unknown"})}function wc(e,t){return new e({type:"never",...R(t)})}function Tr(e,t){return new Pn({check:"less_than",...R(t),value:e,inclusive:!1})}function Ut(e,t){return new Pn({check:"less_than",...R(t),value:e,inclusive:!0})}function Rr(e,t){return new Ln({check:"greater_than",...R(t),value:e,inclusive:!1})}function Wt(e,t){return new Ln({check:"greater_than",...R(t),value:e,inclusive:!0})}function Zr(e,t){return new ls({check:"multiple_of",...R(t),value:e})}function Ir(e,t){return new ds({check:"max_length",...R(t),maximum:e})}function Pt(e,t){return new fs({check:"min_length",...R(t),minimum:e})}function Fr(e,t){return new ps({check:"length_equals",...R(t),length:e})}function jn(e,t){return new ms({check:"string_format",format:"regex",...R(t),pattern:e})}function Vn(e){return new hs({check:"string_format",format:"lowercase",...R(e)})}function Bn(e){return new gs({check:"string_format",format:"uppercase",...R(e)})}function Un(e,t){return new bs({check:"string_format",format:"includes",...R(t),includes:e})}function Wn(e,t){return new ys({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Jn(e,t){return new xs({check:"string_format",format:"ends_with",...R(t),suffix:e})}function at(e){return new vs({check:"overwrite",tx:e})}function Kn(e){return at(t=>t.normalize(e))}function Hn(){return at(e=>e.trim())}function qn(){return at(e=>e.toLowerCase())}function Gn(){return at(e=>e.toUpperCase())}function Yn(){return at(e=>pn(e))}function kc(e,t,r){return new e({type:"array",element:t,...R(r)})}function _c(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function zc(e,t){let r=Jd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Et(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(Et(i))}},e(n.value,n)),t);return r}function Jd(e,t){let r=new we({check:"custom",...R(t)});return r._zod.check=e,r}function Jt(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Ne(e,n,r[n]);return e}function Ht(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??bt,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 be(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 oe(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 c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let g=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,g,u)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),oe(f,t,u),t.seen.get(f).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Jt(s.schema,a),t.io==="input"&&Ee(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 Sc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function qt(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 c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,g=e.external.uri??(h=>h);if(f)return{ref:g(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${g("__shared")}#/${c}/${Sc(d)}`}}let a="#",l=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Sc(u)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:l}=o(s);c.def={...c.schema},l&&(c.defId=l);let u=c.schema;for(let f in u)delete u[f];u.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.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 c=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(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function mc(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;mc(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 hc=new Set(["type","properties","required","additionalProperties"]),fc=["oneOf","anyOf"];function pc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Bn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!hc.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 c=[];for(let u of t){let l=u.properties?.[s]??pc(u);l!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:Bn(c)??{allOf:c};ke(r,s,a)}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 c=pc(s);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function zd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of hc)if(o in e)return;let r=t.filter(o=>fc.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Bn(t);else{let o=r[0],i=fc.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter(a=>a!==o),c=o[i].map(a=>Bn([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Vt(e,n))}function Wt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Vt(u,m),Vt(u,l),c._zod.parent===f)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&d.def)for(let y in u)y==="$ref"||y==="allOf"||y in d.def&&JSON.stringify(u[y])===JSON.stringify(d.def[y])&&delete u[y]}let p=c._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())mc(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);f?f.push(u):c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])zd(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 c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Vt(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 c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,ke(s,a.defId,a.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 c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ut(t,"input",e.processors),output:Ut(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function we(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 we(n.element,r);if(n.type==="set")return we(n.valueType,r);if(n.type==="lazy")return we(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 we(n.innerType,r);if(n.type==="intersection")return we(n.left,r)||we(n.right,r);if(n.type==="record"||n.type==="map")return we(n.keyType,r)||we(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:we(n.in,r)||we(n.out,r);if(n.type==="object"){for(let o in n.shape)if(we(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(we(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(we(o,r))return!0;return!!(n.rest&&we(n.rest,r))}return!1}var gc=(e,t={})=>r=>{let n=Bt({...r,processors:t});return ee(e,n),Jt(n,e),Wt(n,e)},Ut=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Bt({...o??{},target:i,io:t,processors:r});return ee(e,s),Jt(s,e),Wt(s,e)};var St=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Et=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},bc=(e,t)=>{St(e,"minimum",t),Et(e,"maximum",t)},wc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},kc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},$c=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},yc=(e,t)=>St(e,"minimum",t.minimum),xc=(e,t)=>Et(e,"maximum",t.maximum),vc=e=>(t,r)=>{$c(t,r.format);let[n,o]=e[r.format];St(t,"minimum",n),Et(t,"maximum",o)},$d={greater_than:(e,t)=>St(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Et(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wc(e,t.value),number_format:vc(Tt),bigint_format:vc(ur),min_length:yc,max_length:xc,length_equals:(e,t)=>bc(e,t.length),min_size:yc,max_size:xc,size_equals:(e,t)=>bc(e,t.size),string_format:(e,t)=>{$c(e,t.format),t.pattern&&kc(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)=>zc(e,t.mime)};function ze(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)$d[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&St(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&St(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Et(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Et(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&wc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zc(t,o.mime);for(let i of o.patterns??[])kc(t,i);return t}var Sd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ed=new Map([[$n,Ii],[zr,Fi]]),Sc=e=>Ed.get(e)??e,Kn=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=ze(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Sd[c]??c,o.format===""&&delete o.format,(c==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),a&&a.size>0){let f=[...a].map(Sc);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Hn=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=ze(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),p=typeof a=="number"&&a<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),p?d?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof s=="number"&&(o.maximum=s),c){let m=new Set;for(let h of c)Number.isFinite(h)&&h!==0?m.add(Math.abs(h)):me(e,t,o,n,`A multipleOf divisor of ${h} cannot be represented in JSON Schema`);let[v,...y]=m;v!==void 0&&(o.multipleOf=v),y.length&&(o.allOf=[...o.allOf??[],...y.map(h=>({multipleOf:h}))])}},qn=(e,t,r,n)=>{r.type="boolean"},Ec=(e,t,r,n)=>{me(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Pc=(e,t,r,n)=>{me(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Gn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Oc=(e,t,r,n)=>{me(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Nc=(e,t,r,n)=>{me(e,t,r,n,"Void cannot be represented in JSON Schema")},Yn=(e,t,r,n)=>{r.not={}},Zc=(e,t,r,n)=>{},Xn=(e,t,r,n)=>{},Tc=(e,t,r,n)=>{me(e,t,r,n,"Date cannot be represented in JSON Schema")},Qn=(e,t,r,n)=>{let o=e._zod.def,i=xt(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},eo=(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(me(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(me(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},Ac=(e,t,r,n)=>{me(e,t,r,n,"NaN cannot be represented in JSON Schema")},Lc=(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},Rc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=ze(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},Ic=(e,t,r,n)=>{r.type="boolean"},to=(e,t,r,n)=>{me(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Fc=(e,t,r,n)=>{me(e,t,r,n,"Function types cannot be represented in JSON Schema")},ro=(e,t,r,n)=>{me(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Cc=(e,t,r,n)=>{me(e,t,r,n,"Map cannot be represented in JSON Schema")},Mc=(e,t,r,n)=>{me(e,t,r,n,"Set cannot be represented in JSON Schema")},no=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=ze(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=ee(i.element,t,{...n,path:[...n.path,"items"]})};function Kt(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Kt(t.out):t.type==="catch"?Kt(t.innerType):e._zod.optin}var oo=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&me(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ke(o.properties,u,ee(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Kt(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=ee(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},io=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>ee(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=s:r.anyOf=s},so=(e,t,r,n)=>{let o=e._zod.def,i=ee(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=ee(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},ao=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((v,y)=>ee(v,t,{...n,path:[...n.path,s,y]})),u=i.rest?ee(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let v=i.items[l-1];if(!(t.io==="input"?Kt(v)!==void 0:v._zod.optout==="optional"))break;l--}let f=i.items.length,p=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,p?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),p&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:a},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),p&&(o.maxItems=f)):(o.items=a,p?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),p&&(o.maxItems=f));let{minimum:d,maximum:m}=ze(e);typeof d=="number"&&(o.minItems=d),typeof m=="number"&&(o.maxItems=m)};function Jn(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let v=Jn(e,m,r);return v===m?t:v}for(let m of["anyOf","oneOf"]){let v=t[m];if(!Array.isArray(v))continue;let y=v.map(h=>Jn(e,h,r));y.some((h,O)=>h!==v[O])&&(t={...t,[m]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(m=>m==="number"||m==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:f,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(n.includes("number")?Rt:xn).source)),d}var Wn=new WeakMap;function Pd(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 Wn.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 co=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=ze(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=ee(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)ke(o.patternProperties,Sc(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ee(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Wn.get(t);l||(l=[],Wn.set(t,l),t.deferred.push(()=>Pd(t))),l.push(e)}o.additionalProperties=ee(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&Kt(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},uo=(e,t,r,n)=>{let o=e._zod.def,i=ee(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"}]},lo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},fo=Symbol();function Dc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(me(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),fo):JSON.parse(s)}var po=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Dc(o.defaultValue,e,t,r,n);s!==fo&&(r.default=s)},mo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Dc(o.defaultValue,e,t,r,n);s!==fo&&(r._prefault=s)},ho=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{me(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},go=(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;ee(s,t,n);let c=t.seen.get(e);c.ref=s},bo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},jc=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Lr=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yo=(e,t,r,n)=>{let o=e._zod.innerType;ee(o,t,n);let i=t.seen.get(e);i.ref=o},_c={string:Kn,number:Hn,boolean:qn,bigint:Ec,symbol:Pc,null:Gn,undefined:Oc,void:Nc,never:Yn,any:Zc,unknown:Xn,date:Tc,enum:Qn,literal:eo,nan:Ac,template_literal:Lc,file:Rc,success:Ic,custom:to,function:Fc,transform:ro,map:Cc,set:Mc,array:no,object:oo,union:io,intersection:so,tuple:ao,record:co,nullable:uo,nonoptional:lo,default:po,prefault:mo,catch:ho,pipe:go,readonly:bo,promise:jc,optional:Lr,lazy:yo};function xo(e,t){if("_idmap"in e){let n=e,o=Bt({...t,processors:_c}),i={};for(let a of n._idmap.entries()){let[u,l]=a;ee(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[u,l]=a;Jt(o,l),ke(s,u,Wt(o,l))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=Bt({...t,processors:_c});return ee(e,r),Jt(r,e),Wt(r,e)}var Vc=new WeakSet([Object.prototype,Error.prototype]);function Ir(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 Fd=(e,t)=>{ui.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Vc.has(r)||(Vc.add(r),Ir(r,"format",n=>o=>di(n,o)),Ir(r,"flatten",n=>o=>li(n,o)),Ir(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,vt,2)}),Ir(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,vt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Oe=b("ZodError",Fd,void 0,{Parent:Error});var Uc=mr(Oe),Bc=hr(Oe),Jc=gr(Oe),Wc=br(Oe),Kc=pi(Oe),Hc=mi(Oe),qc=hi(Oe),Gc=gi(Oe),Yc=bi(Oe),Xc=yi(Oe),Qc=xi(Oe),eu=vi(Oe);function Md(){_e.localeError||Pe(Sa())}function Ht(){_e.memoizer||Pe({memoizer:$a()})}var re=b("ZodType",(e,t)=>(Md(),Y.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 Ae(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Mf(e,t))},superRefine(e,t){return this.check(Df(e,t))},overwrite(e){return this.check(tt(e))},optional(){return nu(this)},exactOptional(){return zf(this)},nullable(){return ou(this)},nullish(){return nu(ou(this))},nonoptional(e){return Nf(this,e)},array(){return ue(this)},or(e){return rt([this,e])},and(e){return xf(this,e)},transform(e){return iu(this,kf(e))},default(e){return Ef(this,e)},prefault(e){return Of(this,e)},catch(e){return Tf(this,e)},pipe(e){return iu(this,e)},readonly(){return Rf(this)},describe(e){let t=this.clone();return lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return lt.get(this);let t=this.clone();return lt.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",{...zn(this),jsonSchema:{input:Ut(this,"input"),output:Ut(this,"output")}})},set"~standard"(e){A.own(this,"~standard",e)},parse:function e(t,r){return Uc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Bc(this,t,r,{callee:e})},safeParse(e,t){return Jc(this,e,t)},async safeParseAsync(e,t){return Wc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){A.own(this,"spa",e)},validate(e,t){return hn(this,e,t)},validateAsync(e,t){return gn(this,e,t)},encode:function e(t,r){return Kc(this,t,r,{callee:e})},decode:function e(t,r){return Hc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await qc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Gc(this,t,r,{callee:e})},safeEncode(e,t){return Yc(this,e,t)},safeDecode(e,t){return Xc(this,e,t)},async safeEncodeAsync(e,t){return Qc(this,e,t)},async safeDecodeAsync(e,t){return eu(this,e,t)},toJSONSchema(e){return gc(this,{})(e)},get description(){return lt.get(this)?.description},get _def(){return this._zod.def}}),su=b("_ZodString",(e,t)=>{kr.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)},A.derived({format:e=>ze(e).format??null,minLength:e=>ze(e).minimum??null,maxLength:e=>ze(e).maximum??null},{regex(...e){return this.check(An(...e))},includes(...e){return this.check(In(...e))},startsWith(...e){return this.check(Fn(...e))},endsWith(...e){return this.check(Cn(...e))},min(...e){return this.check($t(...e))},max(...e){return this.check(Tr(...e))},length(...e){return this.check(Ar(...e))},nonempty(...e){return this.check($t(1,...e))},lowercase(e){return this.check(Ln(e))},uppercase(e){return this.check(Rn(e))},trim(){return this.check(Dn())},normalize(...e){return this.check(Mn(...e))},toLowerCase(){return this.check(jn())},toUpperCase(){return this.check(Vn())},slugify(){return this.check(Un())}})),Dd=b("ZodString",(e,t)=>{kr.init(e,t),su.init(e,t)},{email(e){return this.check(Na(Jd,e))},url(e){return this.check(Ia(Kd,e))},jwt(e){return this.check(Ya(uf,e))},emoji(e){return this.check(Fa(Hd,e))},guid(e){return this.check(Za(Wd,e))},uuid(e){return this.check(Ta(Fr,e))},uuidv4(e){return this.check(Aa(Fr,e))},uuidv6(e){return this.check(La(Fr,e))},uuidv7(e){return this.check(Ra(Fr,e))},nanoid(e){return this.check(Ca(qd,e))},cuid(e){return this.check(Ma(Gd,e))},cuid2(e){return this.check(Da(Yd,e))},ulid(e){return this.check(ja(Xd,e))},base64(e){return this.check(Ha(sf,e))},base64url(e){return this.check(qa(af,e))},xid(e){return this.check(Va(Qd,e))},ksuid(e){return this.check(Ua(ef,e))},ipv4(e){return this.check(Ba(tf,e))},ipv6(e){return this.check(Ja(rf,e))},cidrv4(e){return this.check(Wa(nf,e))},cidrv6(e){return this.check(Ka(of,e))},e164(e){return this.check(Ga(cf,e))},datetime(e){return this.check(Xa(jd,e))},date(e){return this.check(Qa(Vd,e))},time(e){return this.check(ec(Ud,e))},duration(e){return this.check(tc(Bd,e))}});function P(e){return Oa(Dd,e)}var se=b("ZodStringFormat",(e,t)=>{oe.init(e,t),su.init(e,t)}),jd=b("ZodISODateTime",(e,t)=>{Is.init(e,t),se.init(e,t)}),Vd=b("ZodISODate",(e,t)=>{Fs.init(e,t),se.init(e,t)}),Ud=b("ZodISOTime",(e,t)=>{Cs.init(e,t),se.init(e,t)}),Bd=b("ZodISODuration",(e,t)=>{Ms.init(e,t),se.init(e,t)}),Jd=b("ZodEmail",(e,t)=>{$s.init(e,t),se.init(e,t)});var Wd=b("ZodGUID",(e,t)=>{ks.init(e,t),se.init(e,t)});var Fr=b("ZodUUID",(e,t)=>{zs.init(e,t),se.init(e,t)});var Kd=b("ZodURL",(e,t)=>{Ps.init(e,t),se.init(e,t)});var Hd=b("ZodEmoji",(e,t)=>{Os.init(e,t),se.init(e,t)});var qd=b("ZodNanoID",(e,t)=>{Ns.init(e,t),se.init(e,t)});var Gd=b("ZodCUID",(e,t)=>{Zs.init(e,t),se.init(e,t)});var Yd=b("ZodCUID2",(e,t)=>{Ts.init(e,t),se.init(e,t)});var Xd=b("ZodULID",(e,t)=>{As.init(e,t),se.init(e,t)});var Qd=b("ZodXID",(e,t)=>{Ls.init(e,t),se.init(e,t)});var ef=b("ZodKSUID",(e,t)=>{Rs.init(e,t),se.init(e,t)});var tf=b("ZodIPv4",(e,t)=>{Ds.init(e,t),se.init(e,t)});var rf=b("ZodIPv6",(e,t)=>{Vs.init(e,t),se.init(e,t)});var nf=b("ZodCIDRv4",(e,t)=>{Us.init(e,t),se.init(e,t)});var of=b("ZodCIDRv6",(e,t)=>{Bs.init(e,t),se.init(e,t)});var sf=b("ZodBase64",(e,t)=>{Ws.init(e,t),se.init(e,t)});var af=b("ZodBase64URL",(e,t)=>{Ks.init(e,t),se.init(e,t)});var cf=b("ZodE164",(e,t)=>{Hs.init(e,t),se.init(e,t)});var uf=b("ZodJWT",(e,t)=>{qs.init(e,t),se.init(e,t)});var au=b("ZodNumber",(e,t)=>{Sn.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o),e.isFinite=!0},A.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=ze(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=ze(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=ze(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>ze(e).format??null},{gt(e,t){return this.check(Nr(e,t))},gte(e,t){return this.check(jt(e,t))},min(e,t){return this.check(jt(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Dt(e,t))},max(e,t){return this.check(Dt(e,t))},int(e){return this.check(je(e))},safe(e){return this.check(je(e))},positive(e){return this.check(Nr(0,e))},nonnegative(e){return this.check(jt(0,e))},negative(e){return this.check(Or(0,e))},nonpositive(e){return this.check(Dt(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}}));function Fe(e){return rc(au,e)}var lf=b("ZodNumberFormat",(e,t)=>{Gs.init(e,t),au.init(e,t)});function je(e){return nc(lf,e)}var df=b("ZodBoolean",(e,t)=>{Ys.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qn(e,r,n,o)});function Ve(e){return oc(df,e)}var ff=b("ZodNull",(e,t)=>{Xs.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gn(e,r,n,o)});function pf(e){return ic(ff,e)}var mf=b("ZodUnknown",(e,t)=>{Qs.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o)});function tu(){return sc(mf)}var hf=b("ZodNever",(e,t)=>{ea.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o)});function cu(e){return ac(hf,e)}var gf=b("ZodArray",(e,t)=>{Ht(),ta.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o),e.element=t.element},{min(e,t){return this.check($t(e,t))},nonempty(e){return this.check($t(1,e))},max(e,t){return this.check(Tr(e,t))},length(e,t){return this.check(Ar(e,t))},unwrap(){return this.element}});function ue(e,t){return cc(gf,e,t)}var uu=b("ZodObject",(e,t)=>{Ht(),oa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o),A.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ke(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:tu()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:tu()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:cu()}))},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(_o,this,e[0])},exactPartial(...e){return A.partial(fu,this,e[0],"exactPartial")},required(...e){return A.required(pu,this,e[0])}});function ae(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new uu(r)}function le(e,t){return new uu({type:"object",shape:e,catchall:cu(),...A.normalizeParams(t)})}var lu=b("ZodUnion",(e,t)=>{En.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.options=t.options});function rt(e,t){return new lu({type:"union",options:e,...A.normalizeParams(t)})}var bf=b("ZodDiscriminatedUnion",(e,t)=>{lu.init(e,t),ia.init(e,t)});function nt(e,t,r){return new bf({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var yf=b("ZodIntersection",(e,t)=>{sa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o)});function xf(e,t){return new yf({type:"intersection",left:e,right:t})}var vf=b("ZodTuple",(e,t)=>{Ht(),aa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(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 _o({type:"optional",innerType:t}))})}});function du(e,t,r){let n=t instanceof Y,o=n?r:t,i=n?t:null;return new vf({type:"tuple",items:e,rest:i,...A.normalizeParams(o)})}var ru=b("ZodRecord",(e,t)=>{Ht(),ca.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function dt(e,t,r){return!t||!t._zod?new ru({type:"record",keyType:P(),valueType:e,...A.normalizeParams(t)}):new ru({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var vo=b("ZodEnum",(e,t)=>{ua.init(e,t),re.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 vo({...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 vo({...t,checks:[],...A.normalizeParams(o),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new vo({type:"enum",entries:r,...A.normalizeParams(t)})}var _f=b("ZodLiteral",(e,t)=>{la.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(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 C(e,t){return new _f({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var wf=b("ZodTransform",(e,t)=>{Ht(),da.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new zt(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 kf(e){return new wf({type:"transform",transform:e})}var _o=b("ZodOptional",(e,t)=>{Pn.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nu(e){return new _o({type:"optional",innerType:e})}var fu=b("ZodExactOptional",(e,t)=>{fa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new fu({type:"optional",innerType:e})}var $f=b("ZodNullable",(e,t)=>{pa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new $f({type:"nullable",innerType:e})}var Sf=b("ZodDefault",(e,t)=>{ma.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ef(e,t){return new Sf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var Pf=b("ZodPrefault",(e,t)=>{ha.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Of(e,t){return new Pf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var pu=b("ZodNonOptional",(e,t)=>{ga.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new pu({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var Zf=b("ZodCatch",(e,t)=>{ba.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tf(e,t){return new Zf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:A.constantCatch(t)})}var Af=b("ZodPipe",(e,t)=>{ya.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>go(e,r,n,o),e.in=t.in,e.out=t.out});function iu(e,t){return new Af({type:"pipe",in:e,out:t})}var Lf=b("ZodReadonly",(e,t)=>{xa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rf(e){return new Lf({type:"readonly",innerType:e})}var If=b("ZodLazy",(e,t)=>{va.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ff(e){return new If({type:"lazy",getter:e})}var Cf=b("ZodCustom",(e,t)=>{_a.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o)});function Mf(e,t={}){return uc(Cf,e,t)}function Df(e,t){return lc(e,t)}function mu(e){let t=Ff(()=>rt([P(e),Fe(),Ve(),pf(),ue(t),dt(P(),t)]));return t}var qt=mu().meta({id:"JsonValue"});var Ce=/^[A-Za-z_][A-Za-z0-9_]*$/,hu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Mr=ae({value:rt([P(),Fe()]),label:P()}).strict().meta({id:"Option"}),wo=ae({field:P().min(1),op:Ke(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:qt.optional(),valueFrom:P().regex(Ce).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),he={label:P(),help:P().optional(),required:Ve().optional(),readonly:Ve().optional(),default:qt.optional()},gu=je().positive().optional(),bu=du([je().positive(),je().nonnegative()]).optional(),ko=P().min(1),yu=ue(wo).optional(),xu=ae({type:C("char"),...he,size:gu,pattern:P().optional()}).strict(),vu=ae({type:C("text"),...he,size:gu}).strict(),_u=ae({type:C("html"),...he}).strict(),wu=ae({type:C("integer"),...he,min:Fe().optional(),max:Fe().optional()}).strict(),ku=ae({type:C("float"),...he,min:Fe().optional(),max:Fe().optional(),digits:bu}).strict(),zu=ae({type:C("monetary"),...he,currencyField:P().regex(Ce).optional(),currency:P().regex(/^[A-Z]{3}$/).optional(),min:Fe().optional(),max:Fe().optional(),digits:bu}).strict(),$u=ae({type:C("boolean"),...he}).strict(),Su=ae({type:C("date"),...he}).strict(),Eu=ae({type:C("datetime"),...he}).strict(),Pu=ae({type:C("selection"),...he,options:ue(Mr).min(1),multiple:Ve().optional()}).strict(),Ou=ae({type:C("binary"),...he,accept:ue(P()).optional(),maxSize:je().positive().optional()}).strict(),Nu=ae({type:C("image"),...he,maxSize:je().positive().optional()}).strict(),Zu=ae({type:C("many2one"),...he,relation:ko,filter:yu}).strict(),Tu=ae({type:C("many2many"),...he,relation:ko,filter:yu}).strict(),Au=ae({type:C("reference"),...he,models:ue(Mr).min(1)}).strict(),Lu=ae({type:C("properties"),...he}).strict(),Ru=ae({type:C("json"),...he}).strict(),zo=nt("type",[xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou,Nu,Zu,Tu,Au,Lu,Ru]).meta({id:"LineField"}),$o=ae({field:P().regex(Ce),text:P().regex(Ce),section:P().min(1).optional(),note:P().min(1).optional()}).strict().meta({id:"LineKinds"}),jf=ae({type:C("one2many"),...he,relation:ko,fields:dt(P().regex(Ce),zo),lineKinds:$o.optional(),sequenceField:P().regex(Ce).optional()}).strict(),So=nt("type",[xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou,Nu,Zu,Tu,jf,Au,Lu,Ru]).meta({id:"Field"}),Dr=dt(P().regex(Ce),So);var Gt=rt([Ve(),P().min(1)]).meta({id:"Modifier"}),$e=P().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),He=P().regex(Ce),Iu=Ke(["info","success","warning","danger","muted"]),Me=Gt.optional(),Vf=le({type:C("field"),id:$e,field:He,label:P().optional(),widget:P().min(1).optional(),placeholder:P().optional(),help:P().optional(),colspan:je().min(1).max(4).optional(),columns:ue(He).min(1).optional(),totals:ue(He).min(1).optional(),optionalColumns:dt(He,Ke(["show","hide"])).optional(),editMode:Ke(["cell","row"]).optional(),invisible:Me,readonly:Gt.optional(),required:Gt.optional()}),Fu=le({type:C("button"),id:$e,label:P(),action:P().min(1),params:dt(P(),qt).optional(),style:Ke(["primary","secondary","danger","link"]).optional(),confirm:P().optional(),icon:P().optional(),invisible:Me}),Uf=le({type:C("text"),id:$e,text:P(),style:Ke(["heading","paragraph","note"]).optional(),invisible:Me}),Cu=le({type:C("slot"),id:$e,name:P().min(1),invisible:Me}),Bf=le({type:C("section"),id:$e,title:P().optional(),description:P().optional(),columns:rt([C(1),C(2),C(3),C(4)]).optional(),collapsible:Ve().optional(),collapsed:Ve().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"SectionNode"}),Jf=le({type:C("tab"),id:$e,label:P(),icon:P().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"TabNode"}),Mu=le({type:C("tabs"),id:$e,invisible:Me,children:ue(Jf).min(1)}).meta({id:"TabsNode"}),ft=nt("type",[Vf,Fu,Uf,Cu,Bf,Mu]).meta({id:"LayoutNode"}),Wf=le({type:C("step"),id:$e,label:P(),description:P().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"StepNode"}),Kf=le({type:C("wizard"),id:$e,children:ue(Wf).min(1)}).meta({id:"WizardNode"}),Hf=le({type:C("sections"),id:$e,get children(){return ue(ft)}}).meta({id:"SectionsNode"}),qf=le({id:$e,label:P(),action:P().min(1),field:He.optional(),icon:P().optional(),invisible:Me}),Gf=le({id:$e,label:P(),tone:Iu.optional(),invisible:Me}),Yf=le({id:$e,message:P(),tone:Iu.optional(),invisible:Me}),Xf=le({type:C("sheet"),id:$e,title:le({field:He,subtitleField:He.optional(),avatarField:He.optional(),placeholder:P().optional()}).optional(),statusbar:le({field:He,visibleStates:ue(rt([P(),Fe()])).optional(),clickable:Ve().optional()}).optional(),buttons:ue(Fu).optional(),statButtons:ue(qf).optional(),ribbon:Gf.optional(),alerts:ue(Yf).optional(),get children(){return ue(ft)},sidePanel:Cu.optional()}).meta({id:"SheetNode"}),jr=nt("type",[Xf,Hf,Mu,Kf]).meta({id:"RootLayout"});var Eo="0.1",Qf=nt("kind",[le({kind:C("record"),model:P().min(1)}),le({kind:C("responses")})]),Pt=le({fieldia:C(Eo),id:P().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:P().optional(),description:P().optional(),data:Qf,fields:Dr,layout:jr}).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 pt(e,t){switch(e.type){case"BinaryOp":return ep(e,t);case"UnaryOp":return tp(e,t);case"Literal":return e.value;case"Identifier":return rp(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function ep(e,t){let r=Du(pt(e.left,t)),n=Du(pt(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 qe(r)&&qe(n);case"or":return qe(r)||qe(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function tp(e,t){let r=pt(e.operand,t);if(e.operator.toLowerCase()==="not")return!qe(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Du(e){return e===void 0?null:e}function qe(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function rp(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var Po=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Yt(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:np(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function np(e){let t=e.toLowerCase().trim();return Po.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 mt=class{constructor(t){at(this,"tokens");at(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:Po.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:op(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 op(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 c=t[s];(c==="'"||c==='"')&&(s===0||t[s-1]!=="\\")&&(o?c===i&&(o=!1,i=""):(o=!0,i=c)),c===","&&!o?(r.push(ju(n.trim())),n=""):n+=c}return n.trim()&&r.push(ju(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function ju(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 ot(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new mt(Yt(e)).parse();return{source:e,fields:ip(t),evaluate(r){try{return qe(pt(t,r))}catch{return!1}}}}function ip(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 Ur(e){let t=Pt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:sp(o.path),message:ap(o)}))};let r=t.data,n=new Oo(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function sp(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function ap(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var Vr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Oo=class{constructor(t){at(this,"page",t);at(this,"issues",[]);at(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(Vr(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=ot(i).fields}catch(c){this.report(`${r}.${o}`,`cannot read "${i}": ${c.message}`);continue}for(let c of s)Vr(this.page.fields,c)||this.report(`${r}.${o}`,`"${i}" reads "${c}", 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`)}if((o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,c)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${c}].valueFrom`,t)}),o.type==="one2many"&&(this.checkFields(o.fields,`${i}.fields`),o.lineKinds&&this.checkLineKinds(n,o.lineKinds,o.fields,`${i}.lineKinds`),o.sequenceField!==void 0)){let s=o.fields[o.sequenceField];s?s.type!=="integer"&&this.report(`${i}.sequenceField`,`"${o.sequenceField}" is a ${s.type}; the field that keeps the order of lines must be an integer`):this.report(`${i}.sequenceField`,`"${o.sequenceField}" is not a field of the lines of "${n}"`)}}}checkLineKinds(t,r,n,o){let i=n[r.field];if(!i)this.report(`${o}.field`,`"${r.field}" is not a field of the lines of "${t}"`);else if(i.type!=="selection"&&i.type!=="char")this.report(`${o}.field`,`"${r.field}" is a ${i.type}; the field that says what a line is must be a selection or char`);else if(i.type==="selection")for(let c of["section","note"]){let a=r[c]??c;i.options.some(u=>u.value===a)||this.report(`${o}.${c}`,`"${r.field}" has no option "${a}"`)}let s=n[r.text];s?s.type!=="char"&&s.type!=="text"&&this.report(`${o}.text`,`"${r.text}" is a ${s.type}; a section's or note's text must be a char or text field`):this.report(`${o}.text`,`"${r.text}" is not a field of the lines of "${t}"`)}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(c=>c.value));o.forEach((c,a)=>{s.has(c)||this.report(`${r}.statusbar.visibleStates[${a}]`,`"${c}" 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`);if(n&&t.totals&&(n.type!=="one2many"?this.report(`${r}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${n.type}`):t.totals.forEach((o,i)=>{let s=Vr(n.fields,o)?n.fields[o]:void 0;s?["integer","float","monetary"].includes(s.type)||this.report(`${r}.totals[${i}]`,`"${o}" is a ${s.type}; only integer, float and monetary columns add up`):this.report(`${r}.totals[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)})),n&&t.editMode&&n.type!=="one2many"&&this.report(`${r}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${n.type}`),n&&t.optionalColumns)if(n.type!=="one2many")this.report(`${r}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${n.type}`);else{let o=t.columns??Object.keys(n.fields).filter(i=>i!==n.lineKinds?.field&&i!==n.sequenceField);for(let i of Object.keys(t.optionalColumns))o.includes(i)||this.report(`${r}.optionalColumns.${i}`,`"${i}" is not a column of "${t.field}"`)}!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{Vr(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 Vu(){return xo(Pt,{target:"draft-2020-12"})}function Uu(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=Yt(e);if(r.length===0)return!1;let o=new mt(r).parse(),i=pt(o,t);return qe(i)}catch{return!1}}function Bu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Yt(e);return t.length===0||new mt(t).parse(),!0}catch{return!1}}function No(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function Ot(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?te(n.default):No(n);return t}function Br(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Xt(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?cp(i,o):o}return r}function cp(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 it(e,t){let r=e.lineKinds;if(!r)return null;let n=t[r.field];return n===(r.section??"section")?"section":n===(r.note??"note")?"note":null}function te(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var st={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=st.en){let o=e.label||"This field",i=(s,c={})=>Jr(n[s],{label:o,...c});if(Br(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&&up(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 lp(t,i);case"datetime":return fp(t,i);case"selection":{let s=new Set(e.options.map(a=>a.value)),c=i("choice",{options:e.options.map(a=>a.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(a=>s.has(a))?void 0:c:i("choices"):s.has(t)?void 0:c}case"many2one":return Zo(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Zo)?void 0:i("records");case"reference":{let s=t;if(!Zo(t)||typeof s.model!="string")return i("record");if(!e.models.some(c=>c.value===s.model)){let c=Wu(e.models.map(a=>a.label),n.or);return i("reference",{models:c,aModels:Ku(c)})}return}case"binary":case"image":return pp(e,t,i,n);default:return}}function up(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 Zo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function lp(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 Ju(r,n,o)?void 0:t("dateInvalid")}var dp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function fp(e,t){let r=typeof e=="string"?dp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,c,a]=r.slice(1).map(u=>Number(u??0));return Ju(n,o,i)&&s<24&&c<60&&a<60?void 0:t("datetimeInvalid")}function Ju(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 pp(e,t,r,n){let o=t;if(!mp(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:er(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>hp(i,o.type))){let i=Wu(e.accept.map(gp),n.or);return r("fileType",{types:i,aTypes:Ku(i)})}}function mp(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function hp(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function gp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Wu(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function Ku(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function er(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 tr={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Wr(e,t=tr){return new Promise(r=>{t.setTimeout(r,e)})}function Hu(e={}){let t=te(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?Wr(e.delayMs,e.scheduler):Promise.resolve(),s=d=>t[d]??(t[d]={}),c=(d,m)=>{let v=s(d)[String(m)]?.[e.labelField?.[d]??"name"];return typeof v=="string"?v:String(m)},a=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,m){let v=[...d];for(let y of m)y.op==="create"?v.push({key:y.key,id:++o,values:te(y.values)}):y.op==="update"?v=v.map(h=>h.id===y.id?{...h,values:{...h.values,...te(y.values)}}:h):v=v.filter(h=>h.id!==y.id);return v}function f(d,m,v){let y=[...d],h=O=>({id:O,label:c(v,O)});for(let O of m)O.op==="link"&&!y.some(K=>K.id===O.id)?y.push(h(O.id)):O.op==="unlink"?y=y.filter(K=>K.id!==O.id):O.op==="set"?y=O.ids.map(h):O.op==="clear"&&(y=[]);return y}function p(d,m){let v=d[m];return v&&"relation"in v?v.relation:m}return{records:t,responses:r,calls:n,async load(d){n.push({method:"load",request:d}),await i();let m=s(d.model)[String(d.id)];if(!m)throw new Error(`No ${d.model} record with id ${d.id}`);return te(m)},async save(d){n.push({method:"save",request:d}),await i();let m=d.id??a(d.model),v={...s(d.model)[String(m)]??{},...te(d.changes.values)};for(let[y,h]of Object.entries(d.changes.lines))v[y]=l(v[y]??[],h);for(let[y,h]of Object.entries(d.changes.links))v[y]=f(v[y]??[],h,p(d.fields,y));return s(d.model)[String(m)]=v,{id:m,values:te(v)}},async onchange(d){n.push({method:"onchange",request:d}),await i();let m=e.onchange?.[d.model]?.[d.changed],v=e.warnings?.[d.model]?.[d.changed],y=m?{values:m(te(d.values))}:{},h=v?.(te(d.values));return h?{...y,warning:h}:y},async search(d){n.push({method:"search",request:d}),await i();let m=d.query.trim().toLowerCase();return Object.entries(s(d.model)).filter(([,v])=>(d.filter??[]).every(y=>bp(v,y))).map(([v])=>({id:u(v),label:c(d.model,u(v))})).filter(v=>v.label.toLowerCase().includes(m)).slice(0,d.limit??8)},async submit(d){return n.push({method:"submit",request:d}),await i(),r.push(te(d)),{id:r.length}}}}function bp(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 Kr(e){let{page:t}=e,r=e.scheduler??tr,n=e.messages??st.en,o=vp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(x=>x.id):[],s=()=>`fieldia:draft:${t.id}:${a.recordId??"new"}`,c={...Ot(t.fields),...te(e.values??{})},a={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:te(c),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},u=0,l=0,f=null,p=null,d=new Set,m=new Set,v=null;function y(x){a={...a,...x};for(let _ of[...m])_(a)}function h(x){d.add(x);let _=()=>d.delete(x);return x.then(_,_),x}function O(){return v?.values!==a.values&&(v={values:a.values,context:Xt(a.values,t.fields)}),v.context}function K(x){let _=t.fields[x];if(!_)throw new Error(`The page has no field "${x}"`);return _}function S(x){return Object.keys(t.fields).filter(_=>JSON.stringify(x[_]??null)!==JSON.stringify(c[_]??null))}function z(x){let _=o.get(x);if(!_)throw new Error(`The page has no element "${x}"`);let w=O(),F=_.invisible.evaluate(w);for(let J=_.parent;!F&&J;J=o.get(J)?.parent??null)F=o.get(J)?.invisible.evaluate(w)??!1;let U=_.field?t.fields[_.field]:void 0;return{invisible:F,readonly:_.readonly.evaluate(w)||U?.readonly===!0,required:_.required.evaluate(w)||U?.required===!0}}function E(x){let _=w=>{if(!x)return!0;for(let F=w.id;F;F=o.get(F)?.parent??null)if(F===x)return!0;return!1};return[...o.values()].filter(w=>w.kind==="field"&&_(w)&&!z(w.id).invisible)}function q(x){let _={};for(let w of E(x)){let F=w.field;if(_[F])continue;let U=t.fields[F],J=Qt(U,a.values[F],z(w.id).required,n);if(J&&(_[F]=J),U.type==="one2many")for(let W of a.values[F]??[]){let ce=it(U,W.values);for(let[pe,Ue]of Object.entries(U.fields)){if(ce&&pe!==U.lineKinds?.text)continue;let Se=Qt(Ue,W.values[pe],Ue.required===!0,n);Se&&(_[`${F}.${W.key}.${pe}`]=Se)}}}return _}function de(x,_={}){let w=Object.keys(a.errors).length?Te(x):a.errors;y({values:x,dirty:S(x),errors:w,..._})}function Te(x){let _=a;a={...a,values:x};let w=q(a.step??void 0);a=_;let F={};for(let U of Object.keys(a.errors))w[U]&&(F[U]=w[U]);return F}function B(){let x=e.drafts;x&&(f!==null&&r.clearTimeout(f),f=r.setTimeout(()=>{f=null,x.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:a.values}))},x.delayMs??400))}function V(){f!==null&&r.clearTimeout(f),f=null,e.drafts?.store.removeItem(s())}function ne(){let x=e.drafts;if(!x)return;let _=x.store.getItem(s());if(!_)return;let w;try{w=JSON.parse(_)}catch{x.store.removeItem(s());return}x.restore==="auto"?de({...a.values,...w.values},{draft:null}):y({draft:{savedAt:w.savedAt}})}function ie(){let x=e.autosave;!x||t.data.kind!=="record"||(p!==null&&r.clearTimeout(p),p=r.setTimeout(()=>{p=null,a.dirty.length&&Object.keys(q()).length===0&&h(xe())},x.delayMs))}function D(x){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let w=++l,F={model:t.data.model,id:a.recordId,changed:x,values:te(a.values)};h(_.onchange(F).then(U=>{if(w!==l)return;let J={...a.values,...U.values??{}};de(J,{warning:U.warning??null,warningField:U.warning?x:null})},()=>{}))}function X(x){B(),ie(),D(x)}function G(){let x={values:{},lines:{},links:{}};for(let _ of a.dirty){let w=t.fields[_],F=a.values[_],U=c[_];w.type==="one2many"?x.lines[_]=yp(U??[],F??[]):w.type==="many2many"?x.links[_]=xp(U??[],F??[]):x.values[_]=te(F)}return x}function fe(){let x={};for(let _ of E()){let w=_.field;x[w]=te(a.values[w])}return x}async function xe(){let x=q();if(Object.keys(x).length)return y({errors:x}),!1;let _=e.dataSource;y({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:fe()}),V(),y({status:"saved"}),!0}if(!_?.save)throw new Error("This page has no data source to save to");let w=await _.save({model:t.data.model,id:a.recordId,fields:t.fields,changes:G(),values:te(a.values)});V();let F=w.values?{...a.values,...w.values}:a.values;return c=te(F),y({status:"saved",recordId:w.id,values:F,dirty:[]}),!0}catch(w){return y({status:"error",error:w.message}),!1}}async function De(x,_,w,F,U,J){if(x.type!=="many2one"&&x.type!=="many2many"&&x.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(x.type==="reference"&&!J)throw new Error(`Searching "${_}" needs a model`);let W=e.dataSource;if(!W?.search)return[];let ce=x.type==="reference"?void 0:x.filter?.map(({field:Ue,op:Se,value:bt,valueFrom:g})=>({field:Ue,op:Se,value:g!==void 0?w[g]??null:bt??null})),pe=x.type==="reference"?J:x.relation;return h(W.search({model:pe,query:F,...ce?{filter:ce}:{},limit:U}))}function ve(x){let _=K(x);if(_.type!=="one2many")throw new Error(`"${x}" is a ${_.type}, not a one2many`);return _}function Nt(){return a.step?i.indexOf(a.step):-1}async function ht(){let x=e.dataSource;if(!(a.recordId==null||t.data.kind!=="record")){if(!x?.load){y({status:"error",error:"This page has no data source to load from"});return}y({status:"loading",error:null});try{let _=await x.load({model:t.data.model,id:a.recordId,fields:t.fields});c={...Ot(t.fields),..._},y({status:"ready",values:te(c),dirty:[],errors:{}}),ne()}catch(_){y({status:"error",error:_.message})}}}let gt={page:t,getState:()=>a,subscribe(x){return m.add(x),()=>m.delete(x)},load:()=>h(ht()),setValue(x,_){K(x),de({...a.values,[x]:te(_)}),X(x)},node:z,fieldReadonly:x=>K(x).readonly===!0,validate(){let x=q();return y({errors:x}),Object.keys(x).length===0},save:()=>h(xe()),reset(){V(),y({values:te(c),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:G,addLine(x,_={}){let w=ve(x),F=`new-${++u}`,U=a.values[x]??[],J={key:F,values:{...Ot(w.fields),...te(_)}};if(w.sequenceField&&J.values[w.sequenceField]==null){let ce=U.map(pe=>pe.values[w.sequenceField]).filter(pe=>typeof pe=="number");J.values[w.sequenceField]=ce.length?Math.max(...ce)+1:1}let W=[...U,J];return de({...a.values,[x]:W}),X(x),F},updateLine(x,_,w,F){if(!ve(x).fields[w])throw new Error(`The lines of "${x}" have no field "${w}"`);let J=(a.values[x]??[]).map(W=>W.key===_?{...W,values:{...W.values,[w]:te(F)}}:W);de({...a.values,[x]:J}),X(x)},moveLine(x,_,w){let U=ve(x).sequenceField;if(!U)throw new Error(`The lines of "${x}" keep no order: give the field a sequenceField`);let J=[...a.values[x]??[]],W=J.findIndex(k=>k.key===_);if(W<0)throw new Error(`"${x}" has no line "${_}"`);let ce=Math.max(0,Math.min(w,J.length-1));if(ce===W)return;let pe=J.map(k=>k.values[U]),Ue=pe.every((k,I)=>typeof k=="number"&&(I===0||k>pe[I-1]));J.splice(ce,0,...J.splice(W,1));let Se=Math.min(W,ce),bt=Math.max(W,ce),g=Ue?pe.slice(Se,bt+1):[],$=J.map((k,I)=>{let M=Ue?I>=Se&&I<=bt?g[I-Se]:k.values[U]:I+1;return M===k.values[U]?k:{...k,values:{...k.values,[U]:M}}});de({...a.values,[x]:$}),X(x)},removeLine(x,_){ve(x);let w=(a.values[x]??[]).filter(F=>F.key!==_);de({...a.values,[x]:w}),X(x)},async search(x,_,w=8,F={}){return De(K(x),x,O(),_,w,F.model)},async searchLine(x,_,w,F,U=8){let J=ve(x),W=J.fields[w];if(!W)throw new Error(`The lines of "${x}" have no field "${w}"`);let ce=(a.values[x]??[]).find(pe=>pe.key===_);if(!ce)throw new Error(`"${x}" has no line "${_}"`);return De(W,w,Xt(ce.values,J.fields),F,U)},steps:()=>i.filter(x=>!z(x).invisible),next(){if(!a.step)return!1;let x=q(a.step);if(Object.keys(x).length)return y({errors:x}),!1;let _=gt.steps(),w=i.slice(Nt()+1).find(F=>_.includes(F));return w?(y({step:w,errors:{}}),!0):!1},back(){if(!a.step)return!1;let x=gt.steps(),_=i.slice(0,Nt()).reverse().find(w=>x.includes(w));return _?(y({step:_,errors:{}}),!0):!1},async runAction(x){let _=o.get(x);if(!_||_.kind!=="button"&&_.kind!=="stat")throw new Error(`The page has no button "${x}"`);if(z(x).invisible)return;let w=_.source;await h(Promise.resolve(e.onAction?.({id:x,action:w.action,..."params"in w&&w.params?{params:w.params}:{},recordId:a.recordId,values:te(a.values)})))},restoreDraft(){let x=e.drafts?.store.getItem(s());if(!x)return;let _=JSON.parse(x);de({...a.values,..._.values},{draft:null})},discardDraft(){V(),y({draft:null})},async settled(){for(;d.size;)await Promise.allSettled([...d])},dispose(){f!==null&&r.clearTimeout(f),p!==null&&r.clearTimeout(p),m.clear()}};return a.recordId==null&&ne(),gt}function yp(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:te(i.values)});continue}let c={};for(let[a,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[a])&&(c[a]=te(u));Object.keys(c).length&&r.push({op:"update",id:i.id,values:c})}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 xp(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 vp(e){let t=new Map,r=(o,i,s,c)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:c.field,invisible:ot(c.invisible),readonly:ot(c.readonly),required:ot(c.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 c of s.children)r(c,s.id,"other",{invisible:c.invisible}),n(c.children,c.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 Ne={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",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",addSection:"\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",addNote:"\u0625\u0636\u0627\u0641\u0629 \u0645\u0644\u0627\u062D\u0638\u0629",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",total:"\u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A",lineProblem:"\u0627\u0644\u0633\u0637\u0631 {n}: {message}",moreProblems:"\u0648{n} \u0623\u062E\u0631\u0649",chooseColumns:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",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",addSection:"Abschnitt hinzuf\xFCgen",addNote:"Notiz hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",total:"Summe",lineProblem:"Zeile {n}: {message}",moreProblems:"und {n} weitere",chooseColumns:"Spalten ausw\xE4hlen",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",addSection:"Ajouter une section",addNote:"Ajouter une note",deleteLine:"Supprimer la ligne",total:"Total",lineProblem:"Ligne {n} : {message}",moreProblems:"et {n} de plus",chooseColumns:"Choisir les colonnes",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var _p=180;function qu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function To(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 c=t.createElement("div");c.className="fd-combo",c.append(i,s);let a="",u=!1,l=[],f=-1,p=0,d,m=!1;function v(){if(s.replaceChildren(),l.forEach((S,z)=>{let E=t.createElement("li");E.id=`${o}-${z}`,E.setAttribute("role","option"),E.setAttribute("aria-selected",String(z===f)),E.className=z===f?"fd-option fd-active":"fd-option",E.textContent=S.label,E.addEventListener("mousedown",q=>q.preventDefault()),E.addEventListener("click",()=>O(z)),s.append(E)}),!l.length){let S=t.createElement("li");S.className="fd-empty",S.textContent=n.noResults,s.append(S)}f>=0?i.setAttribute("aria-activedescendant",`${o}-${f}`):i.removeAttribute("aria-activedescendant")}function y(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function h(){clearTimeout(d),p++,s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),f=-1}function O(S){let z=l[S];z&&(h(),u=!1,e.pick(z))}function K(S){clearTimeout(d);let z=++p;d=setTimeout(async()=>{let E=await e.search(S).catch(()=>[]);if(z!==p||t.activeElement!==i)return;let q=e.exclude?.()??new Set;l=E.filter(de=>!q.has(de.id)),f=-1,v(),y()},_p)}return i.addEventListener("input",()=>{u=!0,m||K(i.value)}),i.addEventListener("focus",()=>{m||K("")}),i.addEventListener("keydown",S=>{if(!m)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return K(i.value);if(!l.length)return;f=(f+(S.key==="ArrowDown"?1:-1)+l.length)%l.length,v(),s.children[f]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&f>=0&&(S.preventDefault(),O(f));return;case"Escape":s.hidden||S.preventDefault(),h(),u=!1,i.value=a;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{p++,clearTimeout(d),h();let S=u&&i.value.trim()===""&&a!=="";u=!1,S?e.onCommitEmpty?.():i.value=a}),{element:c,input:i,setText(S){a=S,u||(i.value=S)},setReadonly(S){m=S,i.readOnly=S,S&&h()},close:h}}var Ao=({form:e,name:t,field:r,id:n,document:o,labels:i=Ne.en})=>{let s=To({document:o,id:n,labels:i,search:a=>e.search(t,a),pick:a=>e.setValue(t,a),onCommitEmpty:()=>e.setValue(t,null)}),c=o.createElement("button");return c.type="button",c.className="fd-combo-clear",c.textContent="\xD7",c.setAttribute("aria-label",qu(i.clear,{label:r.label})),c.addEventListener("click",()=>{e.setValue(t,null),s.input.focus()}),s.element.append(c),{element:s.element,focus:()=>s.input.focus(),update(a){let u=a.value;s.setText(u?.label??""),s.setReadonly(a.readonly),c.hidden=!u||a.readonly,s.input.setAttribute("aria-invalid",String(a.invalid)),s.input.setAttribute("aria-required",String(a.required)),a.describedBy&&s.input.setAttribute("aria-describedby",a.describedBy)}}},Hr=({form:e,name:t,id:r,document:n,labels:o=Ne.en})=>{let i=()=>e.getState().values[t]??[],s=n.createElement("div");s.className="fd-tags",s.setAttribute("role","group");let c=n.createElement("ul");c.className="fd-chips";let a=To({document:n,id:r,labels:o,search:f=>e.search(t,f),pick:f=>{e.setValue(t,[...i(),f]),a.input.value=""},exclude:()=>new Set(i().map(f=>f.id)),onEmptyBackspace:()=>{let f=i();f.length&&e.setValue(t,f.slice(0,-1))}});s.append(c,a.element);let u=!1,l="";return{element:s,focus:()=>a.input.focus(),update(f){let p=f.value??[],d=JSON.stringify([f.readonly,p]);u=f.readonly,a.setReadonly(u),a.element.hidden=u,a.input.setAttribute("aria-invalid",String(f.invalid)),f.describedBy&&a.input.setAttribute("aria-describedby",f.describedBy),d!==l&&(l=d,c.replaceChildren(...p.map(m=>{let v=n.createElement("li");v.className="fd-chip";let y=n.createElement("span");if(y.className="fd-chip-label",y.textContent=m.label,v.append(y),!u){let h=n.createElement("button");h.type="button",h.className="fd-chip-remove",h.textContent="\xD7",h.setAttribute("aria-label",qu(o.remove,{name:m.label})),h.addEventListener("click",()=>e.setValue(t,i().filter(O=>O.id!==m.id))),v.append(h)}return v})),a.setText(""))}}},Lo=({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:[]},c=()=>{let a=new Set(s.value.map(u=>u.id));for(let{record:u,box:l}of i)l.checked=a.has(u.id),l.disabled=s.readonly};return e.search(t,"",50).then(a=>{i=a.map((u,l)=>{let f=n.createElement("input");f.type="checkbox",f.id=`${r}-${l}`,f.addEventListener("change",()=>{let m=e.getState().values[t]??[];e.setValue(t,f.checked?[...m,u]:m.filter(v=>v.id!==u.id))});let p=n.createElement("label");p.className="fd-choice",p.htmlFor=f.id;let d=n.createElement("span");return d.textContent=u.label,p.append(f,d),o.append(p),{record:u,box:f}}),c()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(a){s={readonly:a.readonly,value:a.value??[]},c()}}},Ro=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=Ne.en}=e,c=n.type==="reference"?n.models:[],a=i.createElement("div");a.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 p of c){let d=i.createElement("option");d.value=String(p.value),d.textContent=p.label,u.append(d)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let f=To({document:i,id:o,labels:s,search:p=>l?t.search(r,p,8,{model:l}):Promise.resolve([]),pick:p=>t.setValue(r,{model:l,id:p.id,label:p.label}),onCommitEmpty:()=>t.setValue(r,null)});return a.append(u,f.element),{element:a,focus:()=>l?f.input.focus():u.focus(),update(p){let d=p.value;d&&(l=d.model),u.value=l,u.disabled=p.readonly,f.setText(d?.label??""),f.setReadonly(p.readonly||!l)}}};var Io=(e,t)=>new Intl.NumberFormat("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e);function Gu(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,r,n,o,i,s]=t;return new Date(Number(r),Number(n)-1,Number(o),Number(i??0),Number(s??0))}function Fo(e,t,r={}){if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(n=>n.label).join(", ");case"selection":{let n=o=>e.options.find(i=>i.value===o)?.label??String(o);return Array.isArray(t)?t.map(n).join(", "):n(t)}case"integer":return Io(Number(t),0);case"float":return Io(Number(t),e.digits?.[1]??2);case"monetary":{let n=e.currency??(e.currencyField?r[e.currencyField]?.label:void 0),o=Io(Number(t),e.digits?.[1]??2);return n?`${n} ${o}`:o}case"date":{let n=Gu(String(t));return n?new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"short",year:"numeric"}).format(n):String(t)}case"datetime":{let n=Gu(String(t));return n?new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(n):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return t.name??"";case"boolean":return t?"\u2713":"";default:return String(t)}}function Yu(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function Xu(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 Co=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=Ne.en})=>{let c=r,a=c.lineKinds,u=(n.columns??Object.keys(c.fields)).filter(B=>c.fields[B]&&B!==a?.field&&B!==c.sequenceField&&n.optionalColumns?.[B]!=="hide"),l=i.createElement("div");l.className="fd-lines",l.id=o,l.setAttribute("role","group");let f=i.createElement("div");f.className="fd-lines-scroll";let p=i.createElement("table");p.className="fd-lines-table";let d=i.createElement("thead"),m=i.createElement("tr");for(let B of u){let V=i.createElement("th");V.scope="col",V.textContent=c.fields[B].label,m.append(V)}let v=i.createElement("th");v.className="fd-lines-tools",m.append(v),d.append(m);let y=i.createElement("tbody");p.append(d,y);let h=(n.totals??[]).filter(B=>u.includes(B)),O=new Map;if(h.length){let B=i.createElement("tfoot"),V=i.createElement("tr");V.className="fd-lines-totals",u.forEach((ne,ie)=>{let D=i.createElement("td");h.includes(ne)?O.set(ne,D):ie===0&&(D.textContent=s.total),V.append(D)}),V.append(i.createElement("td")),B.append(V),p.append(B)}f.append(p);let K=i.createElement("div");K.className="fd-lines-adds";let S=(B,V,ne)=>{let ie=i.createElement("button");ie.type="button",ie.className="fd-button fd-button-link fd-lines-add",ie.dataset.add=ne,ie.textContent=`+ ${B}`,ie.addEventListener("click",()=>{E=e.addLine(t,V);let D=z.get(E);D&&(D.cells[0]?.widget.focus(),E=null)}),K.append(ie)};S(s.addLine,{},"line"),a&&(S(s.addSection,{[a.field]:a.section??"section"},"section"),S(s.addNote,{[a.field]:a.note??"note"},"note")),l.append(f,K);let z=new Map,E=null,q=!1;function de(B,V,ne,ie,D=1){let X=`${o}-${V.key}-${ne}`,G={type:"field",id:`${n.id}.${V.key}.${ne}`,field:ne},fe=rr({form:Xu(e,t,V.key),name:ne,field:ie,node:G,id:X,document:i,labels:s}),xe=i.createElement("td");xe.colSpan=D;let De=i.createElement("label");De.className="fd-sr-only",De.htmlFor=X,De.textContent=ie.label;let ve=i.createElement("div");return ve.className="fd-cell-error",ve.hidden=!0,xe.append(De,fe.element,ve),B.append(xe),{name:ne,def:ie,widget:fe,error:ve}}function Te(B){let V=i.createElement("tr");V.dataset.line=B.key;let ne=it(c,B.values);ne&&(V.className=`fd-line-${ne}`);let ie=ne&&a?[de(V,B,a.text,Yu(c.fields[a.text],ne),u.length)]:u.map(G=>de(V,B,G,c.fields[G])),D=i.createElement("td");D.className="fd-lines-tools";let X=i.createElement("button");return X.type="button",X.className="fd-line-delete",X.textContent="\xD7",X.setAttribute("aria-label",s.deleteLine),X.addEventListener("click",()=>e.removeLine(t,B.key)),D.append(X),V.append(D),{element:V,kind:ne,cells:ie,remove:X}}return{element:l,focus:()=>(y.querySelector("input, select, textarea")??K.querySelector("button"))?.focus(),update(B){q=B.readonly,K.hidden=q;let V=B.value??[],ne=e.getState().errors,ie=new Set(V.map(D=>D.key));for(let[D,X]of z)ie.has(D)||(X.element.remove(),z.delete(D));V.forEach((D,X)=>{let G=z.get(D.key);G&&G.kind!==it(c,D.values)&&(G.element.remove(),G=void 0),G||(G=Te(D),z.set(D.key,G)),y.children[X]!==G.element&&y.insertBefore(G.element,y.children[X]??null),G.remove.hidden=q,q?G.remove.remove():G.remove.isConnected||G.element.lastElementChild?.append(G.remove);for(let fe of G.cells){let xe=ne[`${t}.${D.key}.${fe.name}`];fe.error.hidden=!xe,fe.error.textContent=xe??"",fe.widget.update({value:D.values[fe.name],values:D.values,readonly:q||fe.def.readonly===!0,required:fe.def.required===!0,invalid:!!xe})}});for(let[D,X]of O){let G=V.filter(fe=>!it(c,fe.values)).reduce((fe,xe)=>fe+Number(xe.values[D]??0),0);X.textContent=Fo(c.fields[D],G,V[0]?.values??{})}E&&z.has(E)&&(z.get(E)?.cells[0]?.widget.focus(),E=null)}}};function wp(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 Qu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=Ne.en})=>{let c=i.createElement("div");c.className=`fd-file fd-file-${e}`;let a=i.createElement("input");a.type="file",a.id=o,a.className="fd-sr-only";let u=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;u&&(a.accept=u.join(","));let l=i.createElement("img");l.className="fd-image-preview",l.alt=n.label,l.hidden=!0;let f=i.createElement("label");f.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",f.htmlFor=o;let p=i.createElement("span");p.className="fd-button",p.textContent=e==="image"?s.uploadImage:s.upload;let d=i.createElement("span");d.className="fd-help",d.textContent=s.dropHere,f.append(p,d);let m=i.createElement("div");m.className="fd-file-chosen";let v=i.createElement("span");v.className="fd-file-name";let y=i.createElement("button");y.type="button",y.className="fd-button fd-button-link",y.textContent=s.replace,y.addEventListener("click",()=>a.click());let h=i.createElement("button");h.type="button",h.className="fd-button fd-button-link",h.textContent=s.removeFile,h.addEventListener("click",()=>t.setValue(r,null)),m.append(v,y,h),c.append(a,...e==="image"?[l]:[],f,m);let O=!1,K=async S=>{!S||O||t.setValue(r,await wp(S))};return a.addEventListener("change",()=>{K(a.files?.[0]),a.value=""}),c.addEventListener("dragover",S=>{O||(S.preventDefault(),c.classList.add("fd-dragging"))}),c.addEventListener("dragleave",()=>c.classList.remove("fd-dragging")),c.addEventListener("drop",S=>{S.preventDefault(),c.classList.remove("fd-dragging"),K(S.dataTransfer?.files?.[0])}),{element:c,focus:()=>(f.hidden?y:a).focus(),update(S){O=S.readonly;let z=S.value;if(f.hidden=!!z||O,m.hidden=!z,y.hidden=h.hidden=O,a.disabled=O,a.setAttribute("aria-invalid",String(S.invalid)),S.describedBy&&a.setAttribute("aria-describedby",S.describedBy),v.textContent=z?`${z.name} \xB7 ${er(z.size)}`:"",e==="image"){let E=z?z.data?`data:${z.type};base64,${z.data}`:z.url??"":"";l.hidden=!E,l.getAttribute("src")!==E&&(E?l.src=E:l.removeAttribute("src"))}}}}}var Mo=Qu("binary"),Do=Qu("image");var kp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),zp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function jo(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 c=s;if(zp.has(c.tagName)){c.remove();continue}if(n(c),!kp.has(c.tagName)){c.replaceWith(...c.childNodes);continue}let a=c.tagName==="A"?c.getAttribute("href"):null;for(let u of[...c.attributes])c.removeAttribute(u.name);a&&/^(https?:|mailto:)/i.test(a.trim())&&c.setAttribute("href",a.trim())}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}var Vo=({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=jo(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 c=jo(typeof s.value=="string"?s.value:"",n);(c!==i||n.activeElement!==o)&&(o.innerHTML!==c&&(o.innerHTML=c),i=c),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)}}},qr=({form:e,name:t,id:r,document:n,labels:o=Ne.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 c=n.createElement("div");return c.className="fd-cell-error",c.hidden=!0,i.append(s,c),s.addEventListener("input",()=>{if(s.value.trim()===""){c.hidden=!0,e.setValue(t,null);return}try{let a=JSON.parse(s.value);c.hidden=!0,e.setValue(t,a)}catch{c.hidden=!1,c.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(a){if(n.activeElement!==s){let u=a.value===null||a.value===void 0?"":JSON.stringify(a.value,null,2);s.value!==u&&(s.value=u)}s.readOnly=a.readonly,s.setAttribute("aria-invalid",String(a.invalid||!c.hidden))}}};function rr(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]??il[i];if(s)return s(e)}return Zp(e)}function ge(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 Ge(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 or=e=>e==null?"":String(e);function nr(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let c=ge(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(c.maxLength=n.size),o.placeholder&&(c.placeholder=o.placeholder),c.addEventListener("input",()=>t.setValue(r,c.value===""?null:c.value)),{element:c,focus:()=>c.focus(),update(a){let u=or(a.value);c.value!==u&&(c.value=u),c.readOnly=a.readonly,Ge(c,a)}}}}var $p=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=ge(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(c){let a=or(c.value);s.value!==a&&(s.value=a),s.readOnly=c.readonly,Ge(s,c)}}},Sp=/^-?(\d+\.?\d*|\.\d+)$/,Ep=/^-?\.?$/,Uo=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,c=n.type==="integer",a=ge(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});a.inputMode=c?"numeric":"decimal",o.placeholder&&(a.placeholder=o.placeholder);let u=p=>{let d=p.trim();if(d==="")return null;if(Sp.test(d))return Number(d);if(!Ep.test(d))return d};a.addEventListener("input",()=>{let p=u(a.value);p!==void 0&&t.setValue(r,p)}),a.addEventListener("blur",()=>{a.value=or(t.getState().values[r])});let l=n.type==="monetary"?ge(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?ge(s,"span",{class:"fd-number"},l,a):a,focus:()=>a.focus(),update(p){let d=s.activeElement===a,m=u(a.value),v=m===void 0||m===p.value;if(!(d&&v)){let y=or(p.value);a.value!==y&&(a.value=y)}if(a.readOnly=p.readonly,Ge(a,p),l&&n.type==="monetary"){let y=n.currencyField?p.values[n.currencyField]:null;l.textContent=y&&typeof y=="object"&&"label"in y?y.label:typeof y=="string"?y:n.currency??""}}}};function el(e){return({form:t,name:r,id:n,document:o})=>{let i=ge(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,Ge(i,s)}}}}function nl(e){return e.type==="selection"?e.options:[]}var Pp=({form:e,name:t,field:r,id:n,document:o})=>{let i=nl(r),s=ge(o,"select",{id:n,class:"fd-input fd-select"},ge(o,"option",{value:""}));return i.forEach((c,a)=>s.append(ge(o,"option",{value:String(a)},c.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(c){let a=i.findIndex(u=>u.value===c.value);s.value=a===-1?"":String(a),s.disabled=c.readonly,Ge(s,c)}}};function tl(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=nl(n),c=ge(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),a=s.map((u,l)=>{let f=ge(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return c.append(ge(i,"label",{class:"fd-choice",for:`${o}-${l}`},f,ge(i,"span",{},u.label))),f});return c.addEventListener("change",()=>{if(e==="radio"){let u=a.findIndex(l=>l.checked);t.setValue(r,u===-1?null:s[u].value)}else t.setValue(r,s.filter((u,l)=>a[l].checked).map(u=>u.value))}),{element:c,focus:()=>(a.find(u=>u.checked)??a[0])?.focus(),update(u){let l=Array.isArray(u.value)?u.value:[u.value];a.forEach((f,p)=>{f.checked=l.includes(s[p].value),f.disabled=u.readonly}),Ge(c,u)}}}}function rl(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,c="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,a=ge(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=c;l++){let f=ge(i,"button",{type:"button",role:"radio","aria-label":`${l} of ${c}`,"data-value":String(l)},e==="rating"?"\u2605":String(l));e==="scale"&&f.removeAttribute("aria-label"),f.addEventListener("click",()=>t.setValue(r,l)),u.push(f),a.append(f)}return a.addEventListener("keydown",l=>{let f=t.getState().values[r],p=typeof f=="number"?f:s-1,d=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!d)return;l.preventDefault();let m=Math.min(c,Math.max(s,p+d));t.setValue(r,m),u[m-s]?.focus()}),{element:a,focus:()=>(u.find(l=>l.getAttribute("aria-checked")==="true")??u[0])?.focus(),update(l){let f=typeof l.value=="number"?l.value:null;u.forEach((p,d)=>{let m=s+d;p.setAttribute("aria-checked",String(m===f)),p.classList.toggle("fd-on",e==="rating"?f!==null&&m<=f:m===f),p.tabIndex=m===f||f===null&&d===0?0:-1,p.disabled=l.readonly}),Ge(a,l)}}}}var Op=({form:e,name:t,id:r,document:n})=>{let o=ge(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=or(i.value);o.value!==s&&(o.value=s),o.readOnly=i.readonly,Ge(o,i)}}},Gr=e=>String(e).padStart(2,"0"),Np=({form:e,name:t,id:r,document:n})=>{let o=ge(n,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),i=s=>{if(typeof s!="string"||!s)return"";let c=new Date(s);return Number.isNaN(c.getTime())?"":`${c.getFullYear()}-${Gr(c.getMonth()+1)}-${Gr(c.getDate())}T${Gr(c.getHours())}:${Gr(c.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 c=i(s.value);o.value!==c&&(o.value=c),o.readOnly=s.readonly,Ge(o,s)}}};function Zp({field:e,id:t,document:r}){let n=ge(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=ol(o.value,e)}}}function ol(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 il={char:nr("text"),"char.email":nr("email"),"char.phone":nr("tel"),"char.url":nr("url"),"char.password":nr("password"),text:$p,integer:Uo,float:Uo,monetary:Uo,"integer.rating":rl("rating"),"integer.scale":rl("scale"),boolean:el(),"boolean.toggle":el("switch"),selection:Pp,"selection.radio":tl("radio"),"selection.checkboxes":tl("checkbox"),date:Op,datetime:Np,many2one:Ao,many2many:Hr,"many2many.tags":Hr,"many2many.checkboxes":Lo,reference:Ro,one2many:Co,binary:Mo,image:Do,html:Vo,json:qr,properties:qr};var al=`
58
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Nc(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;Nc(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 Pc=new Set(["type","properties","required","additionalProperties"]),$c=["oneOf","anyOf"];function Ec(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Xn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Pc.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 c=[];for(let l of t){let u=l.properties?.[s]??Ec(l);u!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(u))||c.push(u))}let a=c.length===1?c[0]:Xn(c)??{allOf:c};Ne(r,s,a)}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 c=Ec(s);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Kd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Pc)if(o in e)return;let r=t.filter(o=>$c.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Xn(t);else{let o=r[0],i=$c.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter(a=>a!==o),c=o[i].map(a=>Xn([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Jt(e,n))}function Gt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,u={...l},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),h=d.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(h)):Jt(l,h),Jt(l,u),c._zod.parent===f)for(let b in l)b==="$ref"||b==="allOf"||b in u||delete l[b];if(h.$ref&&d.def)for(let b in l)b==="$ref"||b==="allOf"||b in d.def&&JSON.stringify(l[b])===JSON.stringify(d.def[b])&&delete l[b]}let g=c._zod.parent;if(g&&g!==f){n(g);let d=e.seen.get(g);if(d?.schema.$ref&&(l.$ref=d.schema.$ref,d.def))for(let h in l)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(l[h])===JSON.stringify(d.def[h])&&delete l[h]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Nc(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let f=c.get(u);f?f.push(l):c.set(u,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])Kd(l)}}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 c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Jt(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 c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,Ne(s,a.defId,a.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 c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Kt(t,"input",e.processors),output:Kt(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ee(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 Ee(n.element,r);if(n.type==="set")return Ee(n.valueType,r);if(n.type==="lazy")return Ee(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 Ee(n.innerType,r);if(n.type==="intersection")return Ee(n.left,r)||Ee(n.right,r);if(n.type==="record"||n.type==="map")return Ee(n.keyType,r)||Ee(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ee(n.in,r)||Ee(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ee(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ee(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ee(o,r))return!0;return!!(n.rest&&Ee(n.rest,r))}return!1}var Lc=(e,t={})=>r=>{let n=Ht({...r,processors:t});return oe(e,n),qt(n,e),Gt(n,e)},Kt=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Ht({...o??{},target:i,io:t,processors:r});return oe(e,s),qt(s,e),Gt(s,e)};var Lt=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},At=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Ac=(e,t)=>{Lt(e,"minimum",t),At(e,"maximum",t)},Ic=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Fc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Cc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Mc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Oc=(e,t)=>Lt(e,"minimum",t.minimum),Tc=(e,t)=>At(e,"maximum",t.maximum),Rc=e=>(t,r)=>{Mc(t,r.format);let[n,o]=e[r.format];Lt(t,"minimum",n),At(t,"maximum",o)},Hd={greater_than:(e,t)=>Lt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>At(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ic(e,t.value),number_format:Rc(It),bigint_format:Rc(pr),min_length:Oc,max_length:Tc,length_equals:(e,t)=>Ac(e,t.length),min_size:Oc,max_size:Tc,size_equals:(e,t)=>Ac(e,t.size),string_format:(e,t)=>{Mc(e,t.format),t.pattern&&Fc(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)=>Cc(e,t.mime)};function Pe(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&&Lt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Lt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&At(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&At(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Ic(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Cc(t,o.mime);for(let i of o.patterns??[])Fc(t,i);return t}var qd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gd=new Map([[Tn,Gi],[Nr,Yi]]),Dc=e=>Gd.get(e)??e,to=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:l,laxFormat:u}=Pe(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=qd[c]??c,o.format===""&&delete o.format,(c==="time"||u)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let f=[...a].map(Dc);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},ro=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:u}=Pe(e);o.type=u?"integer":"number";let f=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),g=typeof a=="number"&&a<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f?d?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),g?d?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof s=="number"&&(o.maximum=s),c){let h=new Set;for(let p of c)Number.isFinite(p)&&p!==0?h.add(Math.abs(p)):be(e,t,o,n,`A multipleOf divisor of ${p} cannot be represented in JSON Schema`);let[m,...b]=h;m!==void 0&&(o.multipleOf=m),b.length&&(o.allOf=[...o.allOf??[],...b.map(p=>({multipleOf:p}))])}},no=(e,t,r,n)=>{r.type="boolean"},jc=(e,t,r,n)=>{be(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Vc=(e,t,r,n)=>{be(e,t,r,n,"Symbols cannot be represented in JSON Schema")},oo=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Bc=(e,t,r,n)=>{be(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Uc=(e,t,r,n)=>{be(e,t,r,n,"Void cannot be represented in JSON Schema")},io=(e,t,r,n)=>{r.not={}},Wc=(e,t,r,n)=>{},so=(e,t,r,n)=>{},Jc=(e,t,r,n)=>{be(e,t,r,n,"Date cannot be represented in JSON Schema")},ao=(e,t,r,n)=>{let o=e._zod.def,i=_t(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},co=(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(be(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(be(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},Kc=(e,t,r,n)=>{be(e,t,r,n,"NaN cannot be represented in JSON Schema")},Hc=(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},qc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=Pe(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},Gc=(e,t,r,n)=>{r.type="boolean"},lo=(e,t,r,n)=>{be(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Yc=(e,t,r,n)=>{be(e,t,r,n,"Function types cannot be represented in JSON Schema")},uo=(e,t,r,n)=>{be(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Xc=(e,t,r,n)=>{be(e,t,r,n,"Map cannot be represented in JSON Schema")},Qc=(e,t,r,n)=>{be(e,t,r,n,"Set cannot be represented in JSON Schema")},fo=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=Pe(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=oe(i.element,t,{...n,path:[...n.path,"items"]})};function Yt(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Yt(t.out):t.type==="catch"?Yt(t.innerType):e._zod.optin}var po=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&be(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Ne(o.properties,l,oe(s[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(s)){let u=i.shape[l];(t.io==="input"?Yt(u)===void 0:u._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=oe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},mo=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>oe(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=s:r.anyOf=s},ho=(e,t,r,n)=>{let o=e._zod.def,i=oe(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=oe(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},go=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((m,b)=>oe(m,t,{...n,path:[...n.path,s,b]})),l=i.rest?oe(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let m=i.items[u-1];if(!(t.io==="input"?Yt(m)!==void 0:m._zod.optout==="optional"))break;u--}let f=i.items.length,g=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,g?o.items=!1:l&&(o.items=l),u>0&&(o.minItems=u),g&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:a},l&&o.items.anyOf.push(l),u>0&&(o.minItems=u),g&&(o.maxItems=f)):(o.items=a,g?o.additionalItems=!1:l&&(o.additionalItems=l),u>0&&(o.minItems=u),g&&(o.maxItems=f));let{minimum:d,maximum:h}=Pe(e);typeof d=="number"&&(o.minItems=d),typeof h=="number"&&(o.maxItems=h)};function Qn(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 m=Qn(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let b=m.map(p=>Qn(e,p,r));b.some((p,w)=>p!==m[w])&&(t={...t,[h]:b})}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:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:u,format:f,id:g,...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")?Mt:En).source)),d}var eo=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 eo.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Qn(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 bo=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=Pe(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let u=oe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)Ne(o.patternProperties,Dc(f).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=oe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let u=eo.get(t);u||(u=[],eo.set(t,u),t.deferred.push(()=>Yd(t))),u.push(e)}o.additionalProperties=oe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,l=t.io==="input"&&Yt(i.valueType)!==void 0;if(a&&!i.partial&&!l){let u=[...a].filter(f=>typeof f=="string"||typeof f=="number");u.length>0&&(o.required=u.map(String))}},yo=(e,t,r,n)=>{let o=e._zod.def,i=oe(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"}]},xo=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},vo=Symbol();function el(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(be(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),vo):JSON.parse(s)}var wo=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=el(o.defaultValue,e,t,r,n);s!==vo&&(r.default=s)},ko=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=el(o.defaultValue,e,t,r,n);s!==vo&&(r._prefault=s)},_o=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{be(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},zo=(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;oe(s,t,n);let c=t.seen.get(e);c.ref=s},So=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},tl=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Cr=(e,t,r,n)=>{let o=e._zod.def;oe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},$o=(e,t,r,n)=>{let o=e._zod.innerType;oe(o,t,n);let i=t.seen.get(e);i.ref=o},Zc={string:to,number:ro,boolean:no,bigint:jc,symbol:Vc,null:oo,undefined:Bc,void:Uc,never:io,any:Wc,unknown:so,date:Jc,enum:ao,literal:co,nan:Kc,template_literal:Hc,file:qc,success:Gc,custom:lo,function:Yc,transform:uo,map:Xc,set:Qc,array:fo,object:po,union:mo,intersection:ho,tuple:go,record:bo,nullable:yo,nonoptional:xo,default:wo,prefault:ko,catch:_o,pipe:zo,readonly:So,promise:tl,optional:Cr,lazy:$o};function Eo(e,t){if("_idmap"in e){let n=e,o=Ht({...t,processors:Zc}),i={};for(let a of n._idmap.entries()){let[l,u]=a;oe(u,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,u]=a;qt(o,u),Ne(s,l,Gt(o,u))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=Ht({...t,processors:Zc});return oe(e,r),qt(r,e),Gt(r,e)}var rl=new WeakSet([Object.prototype,Error.prototype]);function Dr(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 af=(e,t)=>{_i.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);rl.has(r)||(rl.add(r),Dr(r,"format",n=>o=>Si(n,o)),Dr(r,"flatten",n=>o=>zi(n,o)),Dr(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,zt,2)}),Dr(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,zt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Te=v("ZodError",af,void 0,{Parent:Error});var nl=yr(Te),ol=xr(Te),il=vr(Te),sl=wr(Te),al=Ei(Te),cl=Ni(Te),ll=Pi(Te),ul=Li(Te),dl=Ai(Te),fl=Oi(Te),pl=Ti(Te),ml=Ri(Te);function lf(){$e.localeError||Oe(Da())}function Xt(){$e.memoizer||Oe({memoizer:Ma()})}var ce=v("ZodType",(e,t)=>(lf(),te.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(I.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 Ie(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cp(e,t))},superRefine(e,t){return this.check(lp(e,t))},overwrite(e){return this.check(at(e))},optional(){return bl(this)},exactOptional(){return Kf(this)},nullable(){return yl(this)},nullish(){return bl(yl(this))},nonoptional(e){return Qf(this,e)},array(){return fe(this)},or(e){return ct([this,e])},and(e){return Vf(this,e)},transform(e){return xl(this,Jf(e))},default(e){return Gf(this,e)},prefault(e){return Xf(this,e)},catch(e){return tp(this,e)},pipe(e){return xl(this,e)},readonly(){return op(this)},describe(e){let t=this.clone();return bt.add(t,{description:e}),t},meta(...e){if(e.length===0)return bt.get(this);let t=this.clone();return bt.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 I.hide(this,"~standard",{...On(this),jsonSchema:{input:Kt(this,"input"),output:Kt(this,"output")}})},set"~standard"(e){I.own(this,"~standard",e)},parse:function e(t,r){return nl(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ol(this,t,r,{callee:e})},safeParse(e,t){return il(this,e,t)},async safeParseAsync(e,t){return sl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){I.own(this,"spa",e)},validate(e,t){return _n(this,e,t)},validateAsync(e,t){return zn(this,e,t)},encode:function e(t,r){return al(this,t,r,{callee:e})},decode:function e(t,r){return cl(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ll(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ul(this,t,r,{callee:e})},safeEncode(e,t){return dl(this,e,t)},safeDecode(e,t){return fl(this,e,t)},async safeEncodeAsync(e,t){return pl(this,e,t)},async safeDecodeAsync(e,t){return ml(this,e,t)},toJSONSchema(e){return Lc(this,{})(e)},get description(){return bt.get(this)?.description},get _def(){return this._zod.def}}),vl=v("_ZodString",(e,t)=>{Er.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o)},I.derived({format:e=>Pe(e).format??null,minLength:e=>Pe(e).minimum??null,maxLength:e=>Pe(e).maximum??null},{regex(...e){return this.check(jn(...e))},includes(...e){return this.check(Un(...e))},startsWith(...e){return this.check(Wn(...e))},endsWith(...e){return this.check(Jn(...e))},min(...e){return this.check(Pt(...e))},max(...e){return this.check(Ir(...e))},length(...e){return this.check(Fr(...e))},nonempty(...e){return this.check(Pt(1,...e))},lowercase(e){return this.check(Vn(e))},uppercase(e){return this.check(Bn(e))},trim(){return this.check(Hn())},normalize(...e){return this.check(Kn(...e))},toLowerCase(){return this.check(qn())},toUpperCase(){return this.check(Gn())},slugify(){return this.check(Yn())}})),uf=v("ZodString",(e,t)=>{Er.init(e,t),vl.init(e,t)},{email(e){return this.check(Ua(hf,e))},url(e){return this.check(Ga(bf,e))},jwt(e){return this.check(dc(Of,e))},emoji(e){return this.check(Ya(yf,e))},guid(e){return this.check(Wa(gf,e))},uuid(e){return this.check(Ja(jr,e))},uuidv4(e){return this.check(Ka(jr,e))},uuidv6(e){return this.check(Ha(jr,e))},uuidv7(e){return this.check(qa(jr,e))},nanoid(e){return this.check(Xa(xf,e))},cuid(e){return this.check(Qa(vf,e))},cuid2(e){return this.check(ec(wf,e))},ulid(e){return this.check(tc(kf,e))},base64(e){return this.check(cc(Pf,e))},base64url(e){return this.check(lc(Lf,e))},xid(e){return this.check(rc(_f,e))},ksuid(e){return this.check(nc(zf,e))},ipv4(e){return this.check(oc(Sf,e))},ipv6(e){return this.check(ic($f,e))},cidrv4(e){return this.check(sc(Ef,e))},cidrv6(e){return this.check(ac(Nf,e))},e164(e){return this.check(uc(Af,e))},datetime(e){return this.check(fc(df,e))},date(e){return this.check(pc(ff,e))},time(e){return this.check(mc(pf,e))},duration(e){return this.check(hc(mf,e))}});function A(e){return Ba(uf,e)}var de=v("ZodStringFormat",(e,t)=>{ue.init(e,t),vl.init(e,t)}),df=v("ZodISODateTime",(e,t)=>{Gs.init(e,t),de.init(e,t)}),ff=v("ZodISODate",(e,t)=>{Ys.init(e,t),de.init(e,t)}),pf=v("ZodISOTime",(e,t)=>{Xs.init(e,t),de.init(e,t)}),mf=v("ZodISODuration",(e,t)=>{Qs.init(e,t),de.init(e,t)}),hf=v("ZodEmail",(e,t)=>{Ms.init(e,t),de.init(e,t)});var gf=v("ZodGUID",(e,t)=>{Fs.init(e,t),de.init(e,t)});var jr=v("ZodUUID",(e,t)=>{Cs.init(e,t),de.init(e,t)});var bf=v("ZodURL",(e,t)=>{Vs.init(e,t),de.init(e,t)});var yf=v("ZodEmoji",(e,t)=>{Bs.init(e,t),de.init(e,t)});var xf=v("ZodNanoID",(e,t)=>{Us.init(e,t),de.init(e,t)});var vf=v("ZodCUID",(e,t)=>{Ws.init(e,t),de.init(e,t)});var wf=v("ZodCUID2",(e,t)=>{Js.init(e,t),de.init(e,t)});var kf=v("ZodULID",(e,t)=>{Ks.init(e,t),de.init(e,t)});var _f=v("ZodXID",(e,t)=>{Hs.init(e,t),de.init(e,t)});var zf=v("ZodKSUID",(e,t)=>{qs.init(e,t),de.init(e,t)});var Sf=v("ZodIPv4",(e,t)=>{ea.init(e,t),de.init(e,t)});var $f=v("ZodIPv6",(e,t)=>{ra.init(e,t),de.init(e,t)});var Ef=v("ZodCIDRv4",(e,t)=>{na.init(e,t),de.init(e,t)});var Nf=v("ZodCIDRv6",(e,t)=>{oa.init(e,t),de.init(e,t)});var Pf=v("ZodBase64",(e,t)=>{sa.init(e,t),de.init(e,t)});var Lf=v("ZodBase64URL",(e,t)=>{aa.init(e,t),de.init(e,t)});var Af=v("ZodE164",(e,t)=>{ca.init(e,t),de.init(e,t)});var Of=v("ZodJWT",(e,t)=>{la.init(e,t),de.init(e,t)});var wl=v("ZodNumber",(e,t)=>{Rn.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o),e.isFinite=!0},I.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Pe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Pe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Pe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Pe(e).format??null},{gt(e,t){return this.check(Rr(e,t))},gte(e,t){return this.check(Wt(e,t))},min(e,t){return this.check(Wt(e,t))},lt(e,t){return this.check(Tr(e,t))},lte(e,t){return this.check(Ut(e,t))},max(e,t){return this.check(Ut(e,t))},int(e){return this.check(Be(e))},safe(e){return this.check(Be(e))},positive(e){return this.check(Rr(0,e))},nonnegative(e){return this.check(Wt(0,e))},negative(e){return this.check(Tr(0,e))},nonpositive(e){return this.check(Ut(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}}));function De(e){return gc(wl,e)}var Tf=v("ZodNumberFormat",(e,t)=>{ua.init(e,t),wl.init(e,t)});function Be(e){return bc(Tf,e)}var Rf=v("ZodBoolean",(e,t)=>{da.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o)});function Ue(e){return yc(Rf,e)}var Zf=v("ZodNull",(e,t)=>{fa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o)});function If(e){return xc(Zf,e)}var Ff=v("ZodUnknown",(e,t)=>{pa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o)});function hl(){return vc(Ff)}var Cf=v("ZodNever",(e,t)=>{ma.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o)});function kl(e){return wc(Cf,e)}var Mf=v("ZodArray",(e,t)=>{Xt(),ha.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Pt(e,t))},nonempty(e){return this.check(Pt(1,e))},max(e,t){return this.check(Ir(e,t))},length(e,t){return this.check(Fr(e,t))},unwrap(){return this.element}});function fe(e,t){return kc(Mf,e,t)}var _l=v("ZodObject",(e,t)=>{Xt(),ya.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),I.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return We(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(I.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(I.mergeDefs(this._zod.def,{catchall:hl()}))},loose(){return this.clone(I.mergeDefs(this._zod.def,{catchall:hl()}))},strict(){return this.clone(I.mergeDefs(this._zod.def,{catchall:kl()}))},strip(){return this.clone(I.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return I.extend(this,e)},safeExtend(e){return I.safeExtend(this,e)},merge(e){return I.merge(this,e)},pick(e){return I.pick(this,e)},omit(e){return I.omit(this,e)},partial(...e){return I.partial(Po,this,e[0])},exactPartial(...e){return I.partial($l,this,e[0],"exactPartial")},required(...e){return I.required(El,this,e[0])}});function pe(e,t){let r={type:"object",shape:e??{},...I.normalizeParams(t)};return new _l(r)}function he(e,t){return new _l({type:"object",shape:e,catchall:kl(),...I.normalizeParams(t)})}var zl=v("ZodUnion",(e,t)=>{Zn.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.options=t.options});function ct(e,t){return new zl({type:"union",options:e,...I.normalizeParams(t)})}var Df=v("ZodDiscriminatedUnion",(e,t)=>{zl.init(e,t),xa.init(e,t)});function lt(e,t,r){return new Df({type:"union",options:t,discriminator:e,...I.normalizeParams(r)})}var jf=v("ZodIntersection",(e,t)=>{va.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o)});function Vf(e,t){return new jf({type:"intersection",left:e,right:t})}var Bf=v("ZodTuple",(e,t)=>{Xt(),wa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>go(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 Po({type:"optional",innerType:t}))})}});function Sl(e,t,r){let n=t instanceof te,o=n?r:t,i=n?t:null;return new Bf({type:"tuple",items:e,rest:i,...I.normalizeParams(o)})}var gl=v("ZodRecord",(e,t)=>{Xt(),ka.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bo(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ut(e,t,r){return!t||!t._zod?new gl({type:"record",keyType:A(),valueType:e,...I.normalizeParams(t)}):new gl({type:"record",keyType:e,valueType:t,...I.normalizeParams(r)})}var No=v("ZodEnum",(e,t)=>{_a.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ao(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 No({...t,checks:[],...I.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 No({...t,checks:[],...I.normalizeParams(o),entries:i})}});function We(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new No({type:"enum",entries:r,...I.normalizeParams(t)})}var Uf=v("ZodLiteral",(e,t)=>{za.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(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 K(e,t){return new Uf({type:"literal",values:Array.isArray(e)?e:[e],...I.normalizeParams(t)})}var Wf=v("ZodTransform",(e,t)=>{Xt(),Sa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(I.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(I.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 Jf(e){return new Wf({type:"transform",transform:e})}var Po=v("ZodOptional",(e,t)=>{In.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new Po({type:"optional",innerType:e})}var $l=v("ZodExactOptional",(e,t)=>{$a.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Kf(e){return new $l({type:"optional",innerType:e})}var Hf=v("ZodNullable",(e,t)=>{Ea.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yl(e){return new Hf({type:"nullable",innerType:e})}var qf=v("ZodDefault",(e,t)=>{Na.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gf(e,t){return new qf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():I.shallowClone(t)}})}var Yf=v("ZodPrefault",(e,t)=>{Pa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(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():I.shallowClone(t)}})}var El=v("ZodNonOptional",(e,t)=>{La.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qf(e,t){return new El({type:"nonoptional",innerType:e,...I.normalizeParams(t)})}var ep=v("ZodCatch",(e,t)=>{Aa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_o(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function tp(e,t){return new ep({type:"catch",innerType:e,catchValue:typeof t=="function"?t:I.constantCatch(t)})}var rp=v("ZodPipe",(e,t)=>{Oa.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zo(e,r,n,o),e.in=t.in,e.out=t.out});function xl(e,t){return new rp({type:"pipe",in:e,out:t})}var np=v("ZodReadonly",(e,t)=>{Ta.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>So(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function op(e){return new np({type:"readonly",innerType:e})}var ip=v("ZodLazy",(e,t)=>{Ra.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$o(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function sp(e){return new ip({type:"lazy",getter:e})}var ap=v("ZodCustom",(e,t)=>{Za.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o)});function cp(e,t={}){return _c(ap,e,t)}function lp(e,t){return zc(e,t)}function Nl(e){let t=sp(()=>ct([A(e),De(),Ue(),If(),fe(t),ut(A(),t)]));return t}var Ot=Nl().meta({id:"JsonValue"});var Ze=/^[A-Za-z_][A-Za-z0-9_]*$/,Pl=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Qt=pe({value:ct([A(),De()]),label:A()}).strict().meta({id:"Option"}),Lo=pe({field:A().min(1),op:We(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Ot.optional(),valueFrom:A().regex(Ze).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ye={label:A(),help:A().optional(),required:Ue().optional(),readonly:Ue().optional(),default:Ot.optional()},Ll=Be().positive().optional(),Al=Sl([Be().positive(),Be().nonnegative()]).optional(),Ao=A().min(1),Ol=fe(Lo).optional(),Tl=pe({type:K("char"),...ye,size:Ll,pattern:A().optional()}).strict(),Rl=pe({type:K("text"),...ye,size:Ll}).strict(),Zl=pe({type:K("html"),...ye}).strict(),Il=pe({type:K("integer"),...ye,min:De().optional(),max:De().optional()}).strict(),Fl=pe({type:K("float"),...ye,min:De().optional(),max:De().optional(),digits:Al}).strict(),Cl=pe({type:K("monetary"),...ye,currencyField:A().regex(Ze).optional(),currency:A().regex(/^[A-Z]{3}$/).optional(),min:De().optional(),max:De().optional(),digits:Al}).strict(),Ml=pe({type:K("boolean"),...ye}).strict(),Dl=pe({type:K("date"),...ye}).strict(),jl=pe({type:K("datetime"),...ye}).strict(),Vl=pe({type:K("selection"),...ye,options:fe(Qt).min(1),multiple:Ue().optional()}).strict(),Bl=pe({type:K("binary"),...ye,accept:fe(A()).optional(),maxSize:Be().positive().optional()}).strict(),Ul=pe({type:K("image"),...ye,maxSize:Be().positive().optional()}).strict(),Wl=pe({type:K("many2one"),...ye,relation:Ao,filter:Ol}).strict(),Jl=pe({type:K("many2many"),...ye,relation:Ao,filter:Ol}).strict(),Kl=pe({type:K("reference"),...ye,models:fe(Qt).min(1)}).strict(),Oo=pe({name:A().regex(Ze),label:A(),type:We(["char","text","integer","float","boolean","selection","date"]),options:fe(Qt).min(1).optional()}).strict().meta({id:"PropertyDefinition"}),Hl=pe({type:K("properties"),...ye,definitions:fe(Oo).optional()}).strict(),ql=pe({type:K("json"),...ye}).strict(),To=lt("type",[Tl,Rl,Zl,Il,Fl,Cl,Ml,Dl,jl,Vl,Bl,Ul,Wl,Jl,Kl,Hl,ql]).meta({id:"LineField"}),Ro=pe({field:A().regex(Ze),text:A().regex(Ze),section:A().min(1).optional(),note:A().min(1).optional()}).strict().meta({id:"LineKinds"}),up=pe({type:K("one2many"),...ye,relation:Ao,fields:ut(A().regex(Ze),To),lineKinds:Ro.optional(),sequenceField:A().regex(Ze).optional()}).strict(),Zo=lt("type",[Tl,Rl,Zl,Il,Fl,Cl,Ml,Dl,jl,Vl,Bl,Ul,Wl,Jl,up,Kl,Hl,ql]).meta({id:"Field"}),Br=ut(A().regex(Ze),Zo);var er=ct([Ue(),A().min(1)]).meta({id:"Modifier"}),Le=A().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),Qe=A().regex(Ze),Gl=We(["info","success","warning","danger","muted"]),je=er.optional(),dp=he({type:K("field"),id:Le,field:Qe,label:A().optional(),widget:A().min(1).optional(),options:ut(A(),Ot).optional(),placeholder:A().optional(),help:A().optional(),colspan:Be().min(1).max(4).optional(),columns:fe(Qe).min(1).optional(),totals:fe(Qe).min(1).optional(),optionalColumns:ut(Qe,We(["show","hide"])).optional(),editMode:We(["cell","row"]).optional(),invisible:je,readonly:er.optional(),required:er.optional()}),Yl=he({type:K("button"),id:Le,label:A(),action:A().min(1),params:ut(A(),Ot).optional(),style:We(["primary","secondary","danger","link"]).optional(),confirm:A().optional(),icon:A().optional(),invisible:je}),fp=he({type:K("text"),id:Le,text:A(),style:We(["heading","paragraph","note"]).optional(),invisible:je}),Xl=he({type:K("slot"),id:Le,name:A().min(1),invisible:je}),pp=he({type:K("section"),id:Le,title:A().optional(),description:A().optional(),columns:ct([K(1),K(2),K(3),K(4)]).optional(),collapsible:Ue().optional(),collapsed:Ue().optional(),invisible:je,get children(){return fe(yt)}}).meta({id:"SectionNode"}),mp=he({type:K("tab"),id:Le,label:A(),icon:A().optional(),invisible:je,get children(){return fe(yt)}}).meta({id:"TabNode"}),Ql=he({type:K("tabs"),id:Le,invisible:je,children:fe(mp).min(1)}).meta({id:"TabsNode"}),yt=lt("type",[dp,Yl,fp,Xl,pp,Ql]).meta({id:"LayoutNode"}),hp=he({type:K("step"),id:Le,label:A(),description:A().optional(),invisible:je,get children(){return fe(yt)}}).meta({id:"StepNode"}),gp=he({type:K("wizard"),id:Le,children:fe(hp).min(1)}).meta({id:"WizardNode"}),bp=he({type:K("sections"),id:Le,get children(){return fe(yt)}}).meta({id:"SectionsNode"}),yp=he({id:Le,label:A(),action:A().min(1),field:Qe.optional(),icon:A().optional(),invisible:je}),xp=he({id:Le,label:A(),tone:Gl.optional(),invisible:je}),vp=he({id:Le,message:A(),tone:Gl.optional(),invisible:je}),wp=he({type:K("sheet"),id:Le,title:he({field:Qe,subtitleField:Qe.optional(),avatarField:Qe.optional(),placeholder:A().optional()}).optional(),statusbar:he({field:Qe,visibleStates:fe(ct([A(),De()])).optional(),clickable:Ue().optional()}).optional(),buttons:fe(Yl).optional(),statButtons:fe(yp).optional(),ribbon:xp.optional(),alerts:fe(vp).optional(),get children(){return fe(yt)},sidePanel:Xl.optional()}).meta({id:"SheetNode"}),Ur=lt("type",[wp,bp,Ql,gp]).meta({id:"RootLayout"});var Io="0.1",kp=lt("kind",[he({kind:K("record"),model:A().min(1)}),he({kind:K("responses")})]),Tt=he({fieldia:K(Io),id:A().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:A().optional(),description:A().optional(),data:kp,fields:Br,layout:Ur}).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 xt(e,t){switch(e.type){case"BinaryOp":return _p(e,t);case"UnaryOp":return zp(e,t);case"Literal":return e.value;case"Identifier":return Sp(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function _p(e,t){let r=eu(xt(e.left,t)),n=eu(xt(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 et(r)&&et(n);case"or":return et(r)||et(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function zp(e,t){let r=xt(e.operand,t);if(e.operator.toLowerCase()==="not")return!et(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function eu(e){return e===void 0?null:e}function et(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Sp(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var Fo=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function tr(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:$p(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function $p(e){let t=e.toLowerCase().trim();return Fo.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 vt=class{constructor(t){mt(this,"tokens");mt(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:Fo.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:Ep(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 Ep(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 c=t[s];(c==="'"||c==='"')&&(s===0||t[s-1]!=="\\")&&(o?c===i&&(o=!1,i=""):(o=!0,i=c)),c===","&&!o?(r.push(tu(n.trim())),n=""):n+=c}return n.trim()&&r.push(tu(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function tu(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 dt(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new vt(tr(e)).parse();return{source:e,fields:Np(t),evaluate(r){try{return et(xt(t,r))}catch{return!1}}}}function Np(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 Jr(e){let t=Tt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:Pp(o.path),message:Lp(o)}))};let r=t.data,n=new Co(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function Pp(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Lp(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var Wr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Co=class{constructor(t){mt(this,"page",t);mt(this,"issues",[]);mt(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(Wr(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=dt(i).fields}catch(c){this.report(`${r}.${o}`,`cannot read "${i}": ${c.message}`);continue}for(let c of s)Wr(this.page.fields,c)||this.report(`${r}.${o}`,`"${i}" reads "${c}", 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`)}if((o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,c)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${c}].valueFrom`,t)}),o.type==="properties"&&o.definitions){let s=new Set;o.definitions.forEach((c,a)=>{c.type==="selection"&&!c.options&&this.report(`${i}.definitions[${a}].options`,"a choice property needs its choices"),s.has(c.name)&&this.report(`${i}.definitions[${a}].name`,`"${c.name}" is named twice`),s.add(c.name)})}if(o.type==="one2many"&&(this.checkFields(o.fields,`${i}.fields`),o.lineKinds&&this.checkLineKinds(n,o.lineKinds,o.fields,`${i}.lineKinds`),o.sequenceField!==void 0)){let s=o.fields[o.sequenceField];s?s.type!=="integer"&&this.report(`${i}.sequenceField`,`"${o.sequenceField}" is a ${s.type}; the field that keeps the order of lines must be an integer`):this.report(`${i}.sequenceField`,`"${o.sequenceField}" is not a field of the lines of "${n}"`)}}}checkLineKinds(t,r,n,o){let i=n[r.field];if(!i)this.report(`${o}.field`,`"${r.field}" is not a field of the lines of "${t}"`);else if(i.type!=="selection"&&i.type!=="char")this.report(`${o}.field`,`"${r.field}" is a ${i.type}; the field that says what a line is must be a selection or char`);else if(i.type==="selection")for(let c of["section","note"]){let a=r[c]??c;i.options.some(l=>l.value===a)||this.report(`${o}.${c}`,`"${r.field}" has no option "${a}"`)}let s=n[r.text];s?s.type!=="char"&&s.type!=="text"&&this.report(`${o}.text`,`"${r.text}" is a ${s.type}; a section's or note's text must be a char or text field`):this.report(`${o}.text`,`"${r.text}" is not a field of the lines of "${t}"`)}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(c=>c.value));o.forEach((c,a)=>{s.has(c)||this.report(`${r}.statusbar.visibleStates[${a}]`,`"${c}" 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.totals&&(n.type!=="one2many"?this.report(`${r}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${n.type}`):t.totals.forEach((o,i)=>{let s=Wr(n.fields,o)?n.fields[o]:void 0;s?["integer","float","monetary"].includes(s.type)||this.report(`${r}.totals[${i}]`,`"${o}" is a ${s.type}; only integer, float and monetary columns add up`):this.report(`${r}.totals[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}));for(let[o,i]of Object.entries(t.options??{}))o.endsWith("Field")&&typeof i=="string"&&this.need(i,`${r}.options.${o}`);if(n&&t.editMode&&n.type!=="one2many"&&this.report(`${r}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${n.type}`),n&&t.optionalColumns)if(n.type!=="one2many")this.report(`${r}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${n.type}`);else{let o=t.columns??Object.keys(n.fields).filter(i=>i!==n.lineKinds?.field&&i!==n.sequenceField);for(let i of Object.keys(t.optionalColumns))o.includes(i)||this.report(`${r}.optionalColumns.${i}`,`"${i}" is not a column of "${t.field}"`)}!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{Wr(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 ru(){return Eo(Tt,{target:"draft-2020-12"})}function nu(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=tr(e);if(r.length===0)return!1;let o=new vt(r).parse(),i=xt(o,t);return et(i)}catch{return!1}}function ou(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=tr(e);return t.length===0||new vt(t).parse(),!0}catch{return!1}}function Mo(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function Rt(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?ie(n.default):Mo(n);return t}function Kr(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function rr(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?Ap(i,o):o}return r}function Ap(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 ft(e,t){let r=e.lineKinds;if(!r)return null;let n=t[r.field];return n===(r.section??"section")?"section":n===(r.note??"note")?"note":null}function ie(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var pt={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 Hr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function nr(e,t,r,n=pt.en){let o=e.label||"This field",i=(s,c={})=>Hr(n[s],{label:o,...c});if(Kr(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&&Op(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 Tp(t,i);case"datetime":return Zp(t,i);case"selection":{let s=new Set(e.options.map(a=>a.value)),c=i("choice",{options:e.options.map(a=>a.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(a=>s.has(a))?void 0:c:i("choices"):s.has(t)?void 0:c}case"many2one":return Do(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Do)?void 0:i("records");case"reference":{let s=t;if(!Do(t)||typeof s.model!="string")return i("record");if(!e.models.some(c=>c.value===s.model)){let c=su(e.models.map(a=>a.label),n.or);return i("reference",{models:c,aModels:au(c)})}return}case"binary":case"image":return Ip(e,t,i,n);default:return}}function Op(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 Do(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function Tp(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 iu(r,n,o)?void 0:t("dateInvalid")}var Rp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function Zp(e,t){let r=typeof e=="string"?Rp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,c,a]=r.slice(1).map(l=>Number(l??0));return iu(n,o,i)&&s<24&&c<60&&a<60?void 0:t("datetimeInvalid")}function iu(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 Ip(e,t,r,n){let o=t;if(!Fp(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:or(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>Cp(i,o.type))){let i=su(e.accept.map(Mp),n.or);return r("fileType",{types:i,aTypes:au(i)})}}function Fp(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function Cp(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function Mp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function su(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function au(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function or(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 ir={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function qr(e,t=ir){return new Promise(r=>{t.setTimeout(r,e)})}function cu(e={}){let t=ie(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?qr(e.delayMs,e.scheduler):Promise.resolve(),s=d=>t[d]??(t[d]={}),c=(d,h)=>{let m=s(d)[String(h)]?.[e.labelField?.[d]??"name"];return typeof m=="string"?m:String(h)},a=d=>Math.max(0,...Object.keys(s(d)).map(Number).filter(Number.isFinite))+1,l=d=>Number.isFinite(Number(d))?Number(d):d;function u(d,h){let m=[...d];for(let b of h)b.op==="create"?m.push({key:b.key,id:++o,values:ie(b.values)}):b.op==="update"?m=m.map(p=>p.id===b.id?{...p,values:{...p.values,...ie(b.values)}}:p):m=m.filter(p=>p.id!==b.id);return m}function f(d,h,m){let b=[...d],p=w=>({id:w,label:c(m,w)});for(let w of h)w.op==="link"&&!b.some($=>$.id===w.id)?b.push(p(w.id)):w.op==="unlink"?b=b.filter($=>$.id!==w.id):w.op==="set"?b=w.ids.map(p):w.op==="clear"&&(b=[]);return b}function g(d,h){let m=d[h];return m&&"relation"in m?m.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 ie(h)},async save(d){n.push({method:"save",request:d}),await i();let h=d.id??a(d.model),m={...s(d.model)[String(h)]??{},...ie(d.changes.values)};for(let[b,p]of Object.entries(d.changes.lines))m[b]=u(m[b]??[],p);for(let[b,p]of Object.entries(d.changes.links))m[b]=f(m[b]??[],p,g(d.fields,b));return s(d.model)[String(h)]=m,{id:h,values:ie(m)}},async onchange(d){n.push({method:"onchange",request:d}),await i();let h=e.onchange?.[d.model]?.[d.changed],m=e.warnings?.[d.model]?.[d.changed],b=h?{values:h(ie(d.values))}:{},p=m?.(ie(d.values));return p?{...b,warning:p}:b},async search(d){n.push({method:"search",request:d}),await i();let h=d.query.trim().toLowerCase();return Object.entries(s(d.model)).filter(([,m])=>(d.filter??[]).every(b=>Dp(m,b))).map(([m])=>({id:l(m),label:c(d.model,l(m))})).filter(m=>m.label.toLowerCase().includes(h)).slice(0,d.limit??8)},async create(d){n.push({method:"create",request:d}),await i();let h=s(d.model),m=Object.keys(h).reduce((b,p)=>Math.max(b,Number(p)||0),0)+1;return h[String(m)]={name:d.name},{id:m,label:d.name}},async submit(d){return n.push({method:"submit",request:d}),await i(),r.push(ie(d)),{id:r.length}}}}function Dp(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 Gr(e){let{page:t}=e,r=e.scheduler??ir,n=e.messages??pt.en,o=Bp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(x=>x.id):[],s=()=>`fieldia:draft:${t.id}:${a.recordId??"new"}`,c={...Rt(t.fields),...ie(e.values??{})},a={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:ie(c),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},l=0,u=0,f=null,g=null,d=new Set,h=new Set,m=null;function b(x){a={...a,...x};for(let k of[...h])k(a)}function p(x){d.add(x);let k=()=>d.delete(x);return x.then(k,k),x}function w(){return m?.values!==a.values&&(m={values:a.values,context:rr(a.values,t.fields)}),m.context}function $(x){let k=t.fields[x];if(!k)throw new Error(`The page has no field "${x}"`);return k}function E(x){return Object.keys(t.fields).filter(k=>JSON.stringify(x[k]??null)!==JSON.stringify(c[k]??null))}function z(x){let k=o.get(x);if(!k)throw new Error(`The page has no element "${x}"`);let S=w(),N=k.invisible.evaluate(S);for(let U=k.parent;!N&&U;U=o.get(U)?.parent??null)N=o.get(U)?.invisible.evaluate(S)??!1;let Z=k.field?t.fields[k.field]:void 0;return{invisible:N,readonly:k.readonly.evaluate(S)||Z?.readonly===!0,required:k.required.evaluate(S)||Z?.required===!0}}function _(x){let k=S=>{if(!x)return!0;for(let N=S.id;N;N=o.get(N)?.parent??null)if(N===x)return!0;return!1};return[...o.values()].filter(S=>S.kind==="field"&&k(S)&&!z(S.id).invisible)}function V(x){let k={};for(let S of _(x)){let N=S.field;if(k[N])continue;let Z=t.fields[N],U=nr(Z,a.values[N],z(S.id).required,n);if(U&&(k[N]=U),Z.type==="one2many")for(let ee of a.values[N]??[]){let X=ft(Z,ee.values);for(let[me,qe]of Object.entries(Z.fields)){if(X&&me!==Z.lineKinds?.text)continue;let y=nr(qe,ee.values[me],qe.required===!0,n);y&&(k[`${N}.${ee.key}.${me}`]=y)}}}return k}function T(x,k={}){let S=Object.keys(a.errors).length?Y(x):a.errors;b({values:x,dirty:E(x),errors:S,...k})}function Y(x){let k=a;a={...a,values:x};let S=V(a.step??void 0);a=k;let N={};for(let Z of Object.keys(a.errors))S[Z]&&(N[Z]=S[Z]);return N}function ge(){let x=e.drafts;x&&(f!==null&&r.clearTimeout(f),f=r.setTimeout(()=>{f=null,x.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:a.values}))},x.delayMs??400))}function B(){f!==null&&r.clearTimeout(f),f=null,e.drafts?.store.removeItem(s())}function G(){let x=e.drafts;if(!x)return;let k=x.store.getItem(s());if(!k)return;let S;try{S=JSON.parse(k)}catch{x.store.removeItem(s());return}x.restore==="auto"?T({...a.values,...S.values},{draft:null}):b({draft:{savedAt:S.savedAt}})}function re(){let x=e.autosave;!x||t.data.kind!=="record"||(g!==null&&r.clearTimeout(g),g=r.setTimeout(()=>{g=null,a.dirty.length&&Object.keys(V()).length===0&&p(J())},x.delayMs))}function ne(x){let k=e.dataSource;if(!k?.onchange||t.data.kind!=="record")return;let S=++u,N={model:t.data.model,id:a.recordId,changed:x,values:ie(a.values)};p(k.onchange(N).then(Z=>{if(S!==u)return;let U={...a.values,...Z.values??{}};T(U,{warning:Z.warning??null,warningField:Z.warning?x:null})},()=>{}))}function W(x){ge(),re(),ne(x)}function se(){let x={values:{},lines:{},links:{}};for(let k of a.dirty){let S=t.fields[k],N=a.values[k],Z=c[k];S.type==="one2many"?x.lines[k]=jp(Z??[],N??[]):S.type==="many2many"?x.links[k]=Vp(Z??[],N??[]):x.values[k]=ie(N)}return x}function L(){let x={};for(let k of _()){let S=k.field;x[S]=ie(a.values[S])}return x}async function J(){let x=V();if(Object.keys(x).length)return b({errors:x}),!1;let k=e.dataSource;b({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!k?.submit)throw new Error("This page has no data source to send its answers to");return await k.submit({pageId:t.id,values:L()}),B(),b({status:"saved"}),!0}if(!k?.save)throw new Error("This page has no data source to save to");let S=await k.save({model:t.data.model,id:a.recordId,fields:t.fields,changes:se(),values:ie(a.values)});B();let N=S.values?{...a.values,...S.values}:a.values;return c=ie(N),b({status:"saved",recordId:S.id,values:N,dirty:[]}),!0}catch(S){return b({status:"error",error:S.message}),!1}}function ae(x){return!e.dataSource?.create||!x||x.readonly?null:x.type==="many2one"||x.type==="many2many"?x.relation:null}async function ve(x,k,S){let N=ae(x),Z=e.dataSource;if(!N||!Z?.create)throw new Error(`"${k}" cannot make records: its data source has no create, or it is not a link`);return p(Z.create({model:N,name:S.trim()}))}async function ze(x,k,S,N,Z,U){if(x.type!=="many2one"&&x.type!=="many2many"&&x.type!=="reference")throw new Error(`"${k}" is not a many2one, many2many or reference`);if(x.type==="reference"&&!U)throw new Error(`Searching "${k}" needs a model`);let ee=e.dataSource;if(!ee?.search)return[];let X=x.type==="reference"?void 0:x.filter?.map(({field:qe,op:y,value:P,valueFrom:O})=>({field:qe,op:y,value:O!==void 0?S[O]??null:P??null})),me=x.type==="reference"?U:x.relation;return p(ee.search({model:me,query:N,...X?{filter:X}:{},limit:Z}))}function Se(x){let k=$(x);if(k.type!=="one2many")throw new Error(`"${x}" is a ${k.type}, not a one2many`);return k}function Ke(){return a.step?i.indexOf(a.step):-1}async function rt(){let x=e.dataSource;if(!(a.recordId==null||t.data.kind!=="record")){if(!x?.load){b({status:"error",error:"This page has no data source to load from"});return}b({status:"loading",error:null});try{let k=await x.load({model:t.data.model,id:a.recordId,fields:t.fields});c={...Rt(t.fields),...k},b({status:"ready",values:ie(c),dirty:[],errors:{}}),G()}catch(k){b({status:"error",error:k.message})}}}let He={page:t,getState:()=>a,subscribe(x){return h.add(x),()=>h.delete(x)},load:()=>p(rt()),setValue(x,k){$(x),T({...a.values,[x]:ie(k)}),W(x)},node:z,fieldReadonly:x=>$(x).readonly===!0,validate(){let x=V();return b({errors:x}),Object.keys(x).length===0},save:()=>p(J()),reset(){B(),b({values:ie(c),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:se,addLine(x,k={}){let S=Se(x),N=`new-${++l}`,Z=a.values[x]??[],U={key:N,values:{...Rt(S.fields),...ie(k)}};if(S.sequenceField&&U.values[S.sequenceField]==null){let X=Z.map(me=>me.values[S.sequenceField]).filter(me=>typeof me=="number");U.values[S.sequenceField]=X.length?Math.max(...X)+1:1}let ee=[...Z,U];return T({...a.values,[x]:ee}),W(x),N},updateLine(x,k,S,N){if(!Se(x).fields[S])throw new Error(`The lines of "${x}" have no field "${S}"`);let U=(a.values[x]??[]).map(ee=>ee.key===k?{...ee,values:{...ee.values,[S]:ie(N)}}:ee);T({...a.values,[x]:U}),W(x)},moveLine(x,k,S){let Z=Se(x).sequenceField;if(!Z)throw new Error(`The lines of "${x}" keep no order: give the field a sequenceField`);let U=[...a.values[x]??[]],ee=U.findIndex(C=>C.key===k);if(ee<0)throw new Error(`"${x}" has no line "${k}"`);let X=Math.max(0,Math.min(S,U.length-1));if(X===ee)return;let me=U.map(C=>C.values[Z]),qe=me.every((C,M)=>typeof C=="number"&&(M===0||C>me[M-1]));U.splice(X,0,...U.splice(ee,1));let y=Math.min(ee,X),P=Math.max(ee,X),O=qe?me.slice(y,P+1):[],H=U.map((C,M)=>{let j=qe?M>=y&&M<=P?O[M-y]:C.values[Z]:M+1;return j===C.values[Z]?C:{...C,values:{...C.values,[Z]:j}}});T({...a.values,[x]:H}),W(x)},removeLine(x,k){Se(x);let S=(a.values[x]??[]).filter(N=>N.key!==k);T({...a.values,[x]:S}),W(x)},async search(x,k,S=8,N={}){return ze($(x),x,w(),k,S,N.model)},async searchLine(x,k,S,N,Z=8){let U=Se(x),ee=U.fields[S];if(!ee)throw new Error(`The lines of "${x}" have no field "${S}"`);let X=(a.values[x]??[]).find(me=>me.key===k);if(!X)throw new Error(`"${x}" has no line "${k}"`);return ze(ee,S,rr(X.values,U.fields),N,Z)},canCreate:x=>ae(t.fields[x])!==null,quickCreate:(x,k)=>ve(t.fields[x],x,k),canCreateLine:(x,k)=>ae(Se(x).fields[k])!==null,quickCreateLine:(x,k,S)=>ve(Se(x).fields[k],k,S),steps:()=>i.filter(x=>!z(x).invisible),next(){if(!a.step)return!1;let x=V(a.step);if(Object.keys(x).length)return b({errors:x}),!1;let k=He.steps(),S=i.slice(Ke()+1).find(N=>k.includes(N));return S?(b({step:S,errors:{}}),!0):!1},back(){if(!a.step)return!1;let x=He.steps(),k=i.slice(0,Ke()).reverse().find(S=>x.includes(S));return k?(b({step:k,errors:{}}),!0):!1},async runAction(x){let k=o.get(x);if(!k||k.kind!=="button"&&k.kind!=="stat")throw new Error(`The page has no button "${x}"`);if(z(x).invisible)return;let S=k.source;await p(Promise.resolve(e.onAction?.({id:x,action:S.action,..."params"in S&&S.params?{params:S.params}:{},recordId:a.recordId,values:ie(a.values)})))},restoreDraft(){let x=e.drafts?.store.getItem(s());if(!x)return;let k=JSON.parse(x);T({...a.values,...k.values},{draft:null})},discardDraft(){B(),b({draft:null})},async settled(){for(;d.size;)await Promise.allSettled([...d])},dispose(){f!==null&&r.clearTimeout(f),g!==null&&r.clearTimeout(g),h.clear()}};return a.recordId==null&&G(),He}function jp(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:ie(i.values)});continue}let c={};for(let[a,l]of Object.entries(i.values))JSON.stringify(l)!==JSON.stringify(s.values[a])&&(c[a]=ie(l));Object.keys(c).length&&r.push({op:"update",id:i.id,values:c})}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 Vp(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 Bp(e){let t=new Map,r=(o,i,s,c)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:c.field,invisible:dt(c.invisible),readonly:dt(c.readonly),required:dt(c.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 c of s.children)r(c,s.id,"other",{invisible:c.invisible}),n(c.children,c.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 lu=new Map;function uu(e,t){let r=`${e}:${t}`,n=lu.get(r);return n||(n=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),lu.set(r,n)),n}function Up(e){let t=uu(e,1).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}function wt(e,t,r="en"){return uu(r,t).format(e)}function jo(e,t="en"){let{group:r,decimal:n}=Up(t),o=e.replace(/[٠-٩]/g,i=>String(i.charCodeAt(0)-1632)).replace(/[۰-۹]/g,i=>String(i.charCodeAt(0)-1776)).replace(/٫/g,n).replace(/٬/g,r);return o=o.replace(/[\s\u00a0\u202f]/g,""),r.trim()&&(o=o.split(r).join("")),n==="."?o:o.split(n).join(".")}var ke={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",createNamed:"Create \u201C{name}\u201D",chooseDate:"Choose a date",previousMonth:"Previous month",nextMonth:"Next month",weekShort:"Wk",week:"Week",formatting:"Formatting",bold:"Bold",italic:"Italic",underline:"Underline",textStyle:"Text style",paragraph:"Paragraph",heading:"Heading",subheading:"Subheading",bulletList:"Bulleted list",numberList:"Numbered list",alignLeft:"Align left",alignCenter:"Align centre",alignRight:"Align right",link:"Link",linkAddress:"Link address",applyLink:"Apply",removeLink:"Remove link",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",addSection:"\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",addNote:"\u0625\u0636\u0627\u0641\u0629 \u0645\u0644\u0627\u062D\u0638\u0629",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",total:"\u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A",lineProblem:"\u0627\u0644\u0633\u0637\u0631 {n}: {message}",moreProblems:"\u0648{n} \u0623\u062E\u0631\u0649",chooseColumns:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",createNamed:"\u0625\u0646\u0634\u0627\u0621 \xAB{name}\xBB",chooseDate:"\u0627\u062E\u062A\u064A\u0627\u0631 \u062A\u0627\u0631\u064A\u062E",previousMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0633\u0627\u0628\u0642",nextMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u062A\u0627\u0644\u064A",weekShort:"\u0623\u0633\u0628\u0648\u0639",week:"\u0627\u0644\u0623\u0633\u0628\u0648\u0639",formatting:"\u0627\u0644\u062A\u0646\u0633\u064A\u0642",bold:"\u063A\u0627\u0645\u0642",italic:"\u0645\u0627\u0626\u0644",underline:"\u062A\u0633\u0637\u064A\u0631",textStyle:"\u0646\u0645\u0637 \u0627\u0644\u0646\u0635",paragraph:"\u0641\u0642\u0631\u0629",heading:"\u0639\u0646\u0648\u0627\u0646",subheading:"\u0639\u0646\u0648\u0627\u0646 \u0641\u0631\u0639\u064A",bulletList:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",numberList:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629",alignLeft:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0633\u0627\u0631",alignCenter:"\u062A\u0648\u0633\u064A\u0637",alignRight:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0645\u064A\u0646",link:"\u0631\u0627\u0628\u0637",linkAddress:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0627\u0628\u0637",applyLink:"\u062A\u0637\u0628\u064A\u0642",removeLink:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0627\u0628\u0637",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",addSection:"Abschnitt hinzuf\xFCgen",addNote:"Notiz hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",total:"Summe",lineProblem:"Zeile {n}: {message}",moreProblems:"und {n} weitere",chooseColumns:"Spalten ausw\xE4hlen",createNamed:"\u201E{name}\u201C anlegen",chooseDate:"Datum ausw\xE4hlen",previousMonth:"Vorheriger Monat",nextMonth:"N\xE4chster Monat",weekShort:"KW",week:"Kalenderwoche",formatting:"Formatierung",bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",textStyle:"Textstil",paragraph:"Absatz",heading:"\xDCberschrift",subheading:"Unter\xFCberschrift",bulletList:"Aufz\xE4hlung",numberList:"Nummerierte Liste",alignLeft:"Linksb\xFCndig",alignCenter:"Zentriert",alignRight:"Rechtsb\xFCndig",link:"Link",linkAddress:"Linkadresse",applyLink:"\xDCbernehmen",removeLink:"Link entfernen",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",addSection:"Ajouter une section",addNote:"Ajouter une note",deleteLine:"Supprimer la ligne",total:"Total",lineProblem:"Ligne {n} : {message}",moreProblems:"et {n} de plus",chooseColumns:"Choisir les colonnes",createNamed:"Cr\xE9er \xAB {name} \xBB",chooseDate:"Choisir une date",previousMonth:"Mois pr\xE9c\xE9dent",nextMonth:"Mois suivant",weekShort:"Sem.",week:"Semaine",formatting:"Mise en forme",bold:"Gras",italic:"Italique",underline:"Soulign\xE9",textStyle:"Style du texte",paragraph:"Paragraphe",heading:"Titre",subheading:"Sous-titre",bulletList:"Liste \xE0 puces",numberList:"Liste num\xE9rot\xE9e",alignLeft:"Aligner \xE0 gauche",alignCenter:"Centrer",alignRight:"Aligner \xE0 droite",link:"Lien",linkAddress:"Adresse du lien",applyLink:"Appliquer",removeLink:"Supprimer le lien",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var Wp=180;function Vo(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function Yr(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 c=t.createElement("div");c.className="fd-combo",c.append(i,s);let a="",l=null,u="",f=!1,g=[],d=-1,h=0,m,b=!1;function p(){if(s.replaceChildren(),g.forEach((_,V)=>{let T=t.createElement("li");T.id=`${o}-${V}`,T.setAttribute("role","option"),T.setAttribute("aria-selected",String(V===d)),T.className=`fd-option${V===d?" fd-active":""}${_===l?" fd-option-create":""}`,T.textContent=_.label,T.addEventListener("mousedown",Y=>Y.preventDefault()),T.addEventListener("click",()=>E(V)),s.append(T)}),!g.length){let _=t.createElement("li");_.className="fd-empty",_.textContent=n.noResults,s.append(_)}d>=0?i.setAttribute("aria-activedescendant",`${o}-${d}`):i.removeAttribute("aria-activedescendant")}function w(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function $(){clearTimeout(m),h++,s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),d=-1}function E(_){let V=g[_];if(!V)return;let T=u;if($(),f=!1,V===l&&e.create){e.create(T).then(e.pick,()=>{});return}e.pick(V)}function z(_){clearTimeout(m);let V=++h;m=setTimeout(async()=>{let T=await e.search(_).catch(()=>[]);if(V!==h||t.activeElement!==i)return;let Y=e.exclude?.()??new Set;g=T.filter(B=>!Y.has(B.id));let ge=_.trim();l=null,e.create&&ge&&!T.some(B=>B.label.trim().toLowerCase()===ge.toLowerCase())&&(u=ge,l={id:"__create__",label:Vo(n.createNamed,{name:ge})},g=[...g,l]),d=-1,p(),w()},Wp)}return i.addEventListener("input",()=>{f=!0,b||z(i.value)}),i.addEventListener("focus",()=>{b||z("")}),i.addEventListener("keydown",_=>{if(!b)switch(_.key){case"ArrowDown":case"ArrowUp":{if(_.preventDefault(),s.hidden)return z(i.value);if(!g.length)return;d=(d+(_.key==="ArrowDown"?1:-1)+g.length)%g.length,p(),s.children[d]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&d>=0&&(_.preventDefault(),E(d));return;case"Escape":s.hidden||_.preventDefault(),$(),f=!1,i.value=a;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{h++,clearTimeout(m),$();let _=f&&i.value.trim()===""&&a!=="";f=!1,_?e.onCommitEmpty?.():i.value=a}),{element:c,input:i,setText(_){a=_,f||(i.value=_)},setReadonly(_){b=_,i.readOnly=_,_&&$()},close:$}}function du(e,t,r){return r.options?.create!==!1&&e.canCreate(t)?n=>e.quickCreate(t,n):void 0}var Bo=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=ke.en})=>{let c=Yr({document:i,id:o,labels:s,search:l=>e.search(t,l),pick:l=>e.setValue(t,l),onCommitEmpty:()=>e.setValue(t,null),create:du(e,t,n)}),a=i.createElement("button");return a.type="button",a.className="fd-combo-clear",a.textContent="\xD7",a.setAttribute("aria-label",Vo(s.clear,{label:r.label})),a.addEventListener("click",()=>{e.setValue(t,null),c.input.focus()}),c.element.append(a),{element:c.element,focus:()=>c.input.focus(),update(l){let u=l.value;c.setText(u?.label??""),c.setReadonly(l.readonly),a.hidden=!u||l.readonly,c.input.setAttribute("aria-invalid",String(l.invalid)),c.input.setAttribute("aria-required",String(l.required)),l.describedBy&&c.input.setAttribute("aria-describedby",l.describedBy)}}},Xr=({form:e,name:t,node:r,id:n,document:o,labels:i=ke.en})=>{let s=()=>e.getState().values[t]??[],c=o.createElement("div");c.className="fd-tags",c.setAttribute("role","group");let a=o.createElement("ul");a.className="fd-chips";let l=Yr({document:o,id:n,labels:i,search:g=>e.search(t,g),pick:g=>{e.setValue(t,[...s(),g]),l.input.value=""},exclude:()=>new Set(s().map(g=>g.id)),onEmptyBackspace:()=>{let g=s();g.length&&e.setValue(t,g.slice(0,-1))},create:du(e,t,r)});c.append(a,l.element);let u=!1,f="";return{element:c,focus:()=>l.input.focus(),update(g){let d=g.value??[],h=JSON.stringify([g.readonly,d]);u=g.readonly,l.setReadonly(u),l.element.hidden=u,l.input.setAttribute("aria-invalid",String(g.invalid)),g.describedBy&&l.input.setAttribute("aria-describedby",g.describedBy),h!==f&&(f=h,fu(a,d,u,i,m=>e.setValue(t,s().filter(b=>b.id!==m.id))),l.setText(""))}}};function fu(e,t,r,n,o){let i=e.ownerDocument;e.replaceChildren(...t.map(s=>{let c=i.createElement("li");c.className="fd-chip";let a=i.createElement("span");if(a.className="fd-chip-label",a.textContent=s.label,c.append(a),!r){let l=i.createElement("button");l.type="button",l.className="fd-chip-remove",l.textContent="\xD7",l.setAttribute("aria-label",Vo(n.remove,{name:s.label})),l.addEventListener("click",()=>o(s)),c.append(l)}return c}))}var Uo=({form:e,name:t,node:r,id:n,document:o,labels:i=ke.en})=>{let s=r.options??{},c=typeof s.separator=="string"&&s.separator?s.separator:",",a=Array.isArray(s.suggestions)?s.suggestions.filter(p=>typeof p=="string"):[],l=p=>typeof p=="string"?p.split(c).map(w=>w.trim()).filter(w=>w!==""):[],u=()=>l(e.getState().values[t]),f=p=>e.setValue(t,p.length?p.join(`${c} `):null),g=p=>{let w=p.trim(),$=u();w&&!$.some(E=>E.toLowerCase()===w.toLowerCase())&&f([...$,w])},d=o.createElement("div");d.className="fd-tags",d.setAttribute("role","group");let h=o.createElement("ul");h.className="fd-chips";let m=Yr({document:o,id:n,labels:i,search:async p=>{let w=new Set(u().map(E=>E.toLowerCase())),$=p.trim().toLowerCase();return a.filter(E=>!w.has(E.toLowerCase())&&E.toLowerCase().includes($)).map(E=>({id:E,label:E}))},pick:p=>{g(p.label),m.input.value=""},onEmptyBackspace:()=>{let p=u();p.length&&f(p.slice(0,-1))}});m.input.addEventListener("keydown",p=>{p.key!=="Enter"||p.defaultPrevented||m.input.value.trim()===""||(p.preventDefault(),g(m.input.value),m.input.value="",m.close())}),m.input.addEventListener("input",()=>{let p=m.input.value.split(c);if(!(p.length<2)){for(let w of p.slice(0,-1))g(w);m.input.value=p[p.length-1].trimStart()}}),m.input.addEventListener("change",()=>{m.input.value.trim()&&g(m.input.value)}),d.append(h,m.element);let b="";return{element:d,focus:()=>m.input.focus(),update(p){let w=l(p.value);m.setReadonly(p.readonly),m.element.hidden=p.readonly,m.input.setAttribute("aria-invalid",String(p.invalid)),p.describedBy&&m.input.setAttribute("aria-describedby",p.describedBy);let $=JSON.stringify([p.readonly,w]);$!==b&&(b=$,fu(h,w.map(E=>({id:E,label:E})),p.readonly,i,E=>f(u().filter(z=>z!==E.label))),m.setText(""))}}},Wo=({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:[]},c=()=>{let a=new Set(s.value.map(l=>l.id));for(let{record:l,box:u}of i)u.checked=a.has(l.id),u.disabled=s.readonly};return e.search(t,"",50).then(a=>{i=a.map((l,u)=>{let f=n.createElement("input");f.type="checkbox",f.id=`${r}-${u}`,f.addEventListener("change",()=>{let h=e.getState().values[t]??[];e.setValue(t,f.checked?[...h,l]:h.filter(m=>m.id!==l.id))});let g=n.createElement("label");g.className="fd-choice",g.htmlFor=f.id;let d=n.createElement("span");return d.textContent=l.label,g.append(f,d),o.append(g),{record:l,box:f}}),c()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(a){s={readonly:a.readonly,value:a.value??[]},c()}}},Jo=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=ke.en}=e,c=n.type==="reference"?n.models:[],a=i.createElement("div");a.className="fd-reference";let l=i.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",n.label),l.append(i.createElement("option"));for(let g of c){let d=i.createElement("option");d.value=String(g.value),d.textContent=g.label,l.append(d)}let u="";l.addEventListener("change",()=>{u=l.value,t.setValue(r,null)});let f=Yr({document:i,id:o,labels:s,search:g=>u?t.search(r,g,8,{model:u}):Promise.resolve([]),pick:g=>t.setValue(r,{model:u,id:g.id,label:g.label}),onCommitEmpty:()=>t.setValue(r,null)});return a.append(l,f.element),{element:a,focus:()=>u?f.input.focus():l.focus(),update(g){let d=g.value;d&&(u=d.model),l.value=u,l.disabled=g.readonly,f.setText(d?.label??""),f.setReadonly(g.readonly||!u)}}};function pu(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,r,n,o,i,s]=t;return new Date(Number(r),Number(n)-1,Number(o),Number(i??0),Number(s??0))}function Ko(e,t,r={},n="en"){let o=(i,s)=>wt(i,s,n);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(i=>i.label).join(", ");case"selection":{let i=s=>e.options.find(c=>c.value===s)?.label??String(s);return Array.isArray(t)?t.map(i).join(", "):i(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let i=e.currency??(e.currencyField?r[e.currencyField]?.label:void 0),s=o(Number(t),e.digits?.[1]??2);return i?`${i} ${s}`:s}case"date":{let i=pu(String(t));return i?new Intl.DateTimeFormat(n==="en"?"en-GB":n,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(i):String(t)}case"datetime":{let i=pu(String(t));return i?new Intl.DateTimeFormat(n==="en"?"en-GB":n,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(i):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return t.name??"";case"boolean":return t?"\u2713":"";default:return String(t)}}function mu(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function hu(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),canCreate:o=>e.canCreateLine(t,o),quickCreate:(o,i)=>e.quickCreateLine(t,o,i)}}var Ho=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=ke.en,locale:c})=>{let a=r,l=a.lineKinds,u=(n.columns??Object.keys(a.fields)).filter(B=>a.fields[B]&&B!==l?.field&&B!==a.sequenceField&&n.optionalColumns?.[B]!=="hide"),f=i.createElement("div");f.className="fd-lines",f.id=o,f.setAttribute("role","group");let g=i.createElement("div");g.className="fd-lines-scroll";let d=i.createElement("table");d.className="fd-lines-table";let h=i.createElement("thead"),m=i.createElement("tr");for(let B of u){let G=i.createElement("th");G.scope="col",G.textContent=a.fields[B].label,m.append(G)}let b=i.createElement("th");b.className="fd-lines-tools",m.append(b),h.append(m);let p=i.createElement("tbody");d.append(h,p);let w=(n.totals??[]).filter(B=>u.includes(B)),$=new Map;if(w.length){let B=i.createElement("tfoot"),G=i.createElement("tr");G.className="fd-lines-totals",u.forEach((re,ne)=>{let W=i.createElement("td");w.includes(re)?$.set(re,W):ne===0&&(W.textContent=s.total),G.append(W)}),G.append(i.createElement("td")),B.append(G),d.append(B)}g.append(d);let E=i.createElement("div");E.className="fd-lines-adds";let z=(B,G,re)=>{let ne=i.createElement("button");ne.type="button",ne.className="fd-button fd-button-link fd-lines-add",ne.dataset.add=re,ne.textContent=`+ ${B}`,ne.addEventListener("click",()=>{V=e.addLine(t,G);let W=_.get(V);W&&(W.cells[0]?.widget.focus(),V=null)}),E.append(ne)};z(s.addLine,{},"line"),l&&(z(s.addSection,{[l.field]:l.section??"section"},"section"),z(s.addNote,{[l.field]:l.note??"note"},"note")),f.append(g,E);let _=new Map,V=null,T=!1;function Y(B,G,re,ne,W=1){let se=`${o}-${G.key}-${re}`,L={type:"field",id:`${n.id}.${G.key}.${re}`,field:re},J=Ve({form:hu(e,t,G.key),name:re,field:ne,node:L,id:se,document:i,labels:s,locale:c}),ae=i.createElement("td");ae.colSpan=W;let ve=i.createElement("label");ve.className="fd-sr-only",ve.htmlFor=se,ve.textContent=ne.label;let ze=i.createElement("div");return ze.className="fd-cell-error",ze.hidden=!0,ae.append(ve,J.element,ze),B.append(ae),{name:re,def:ne,widget:J,error:ze}}function ge(B){let G=i.createElement("tr");G.dataset.line=B.key;let re=ft(a,B.values);re&&(G.className=`fd-line-${re}`);let ne=re&&l?[Y(G,B,l.text,mu(a.fields[l.text],re),u.length)]:u.map(L=>Y(G,B,L,a.fields[L])),W=i.createElement("td");W.className="fd-lines-tools";let se=i.createElement("button");return se.type="button",se.className="fd-line-delete",se.textContent="\xD7",se.setAttribute("aria-label",s.deleteLine),se.addEventListener("click",()=>e.removeLine(t,B.key)),W.append(se),G.append(W),{element:G,kind:re,cells:ne,remove:se}}return{element:f,focus:()=>(p.querySelector("input, select, textarea")??E.querySelector("button"))?.focus(),update(B){T=B.readonly,E.hidden=T;let G=B.value??[],re=e.getState().errors,ne=new Set(G.map(W=>W.key));for(let[W,se]of _)ne.has(W)||(se.element.remove(),_.delete(W));G.forEach((W,se)=>{let L=_.get(W.key);L&&L.kind!==ft(a,W.values)&&(L.element.remove(),L=void 0),L||(L=ge(W),_.set(W.key,L)),p.children[se]!==L.element&&p.insertBefore(L.element,p.children[se]??null),L.remove.hidden=T,T?L.remove.remove():L.remove.isConnected||L.element.lastElementChild?.append(L.remove);for(let J of L.cells){let ae=re[`${t}.${W.key}.${J.name}`];J.error.hidden=!ae,J.error.textContent=ae??"",J.widget.update({value:W.values[J.name],values:W.values,readonly:T||J.def.readonly===!0,required:J.def.required===!0,invalid:!!ae})}});for(let[W,se]of $){let L=G.filter(J=>!ft(a,J.values)).reduce((J,ae)=>J+Number(ae.values[W]??0),0);se.textContent=Ko(a.fields[W],L,G[0]?.values??{},c)}V&&_.has(V)&&(_.get(V)?.cells[0]?.widget.focus(),V=null)}}};function Jp(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 gu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=ke.en})=>{let c=i.createElement("div");c.className=`fd-file fd-file-${e}`;let a=i.createElement("input");a.type="file",a.id=o,a.className="fd-sr-only";let l=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;l&&(a.accept=l.join(","));let u=i.createElement("img");u.className="fd-image-preview",u.alt=n.label,u.hidden=!0;let f=i.createElement("label");f.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",f.htmlFor=o;let g=i.createElement("span");g.className="fd-button",g.textContent=e==="image"?s.uploadImage:s.upload;let d=i.createElement("span");d.className="fd-help",d.textContent=s.dropHere,f.append(g,d);let h=i.createElement("div");h.className="fd-file-chosen";let m=i.createElement("span");m.className="fd-file-name";let b=i.createElement("button");b.type="button",b.className="fd-button fd-button-link",b.textContent=s.replace,b.addEventListener("click",()=>a.click());let p=i.createElement("button");p.type="button",p.className="fd-button fd-button-link",p.textContent=s.removeFile,p.addEventListener("click",()=>t.setValue(r,null)),h.append(m,b,p),c.append(a,...e==="image"?[u]:[],f,h);let w=!1,$=async E=>{!E||w||t.setValue(r,await Jp(E))};return a.addEventListener("change",()=>{$(a.files?.[0]),a.value=""}),c.addEventListener("dragover",E=>{w||(E.preventDefault(),c.classList.add("fd-dragging"))}),c.addEventListener("dragleave",()=>c.classList.remove("fd-dragging")),c.addEventListener("drop",E=>{E.preventDefault(),c.classList.remove("fd-dragging"),$(E.dataTransfer?.files?.[0])}),{element:c,focus:()=>(f.hidden?b:a).focus(),update(E){w=E.readonly;let z=E.value;if(f.hidden=!!z||w,h.hidden=!z,b.hidden=p.hidden=w,a.disabled=w,a.setAttribute("aria-invalid",String(E.invalid)),E.describedBy&&a.setAttribute("aria-describedby",E.describedBy),m.textContent=z?`${z.name} \xB7 ${or(z.size)}`:"",e==="image"){let _=z?z.data?`data:${z.type};base64,${z.data}`:z.url??"":"";u.hidden=!_,u.getAttribute("src")!==_&&(_?u.src=_:u.removeAttribute("src"))}}}}}var qo=gu("binary"),Go=gu("image");var bu=new Map;function yu(e,t){let r=bu.get(t);return r||(r=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),bu.set(t,r)),r.format(e/100)}var sr=e=>{let{node:t,id:r,document:n,locale:o="en"}=e,i=t.options??{},s=typeof i.min=="number"?i.min:0,c=typeof i.max=="number"?i.max:100,a=typeof i.maxField=="string"?i.maxField:null,l=typeof i.color=="string"?i.color:"auto",u=i.showPercent!==!1,f=n.createElement("div");f.className="fd-progressbar",f.setAttribute("role","progressbar");let g=n.createElement("div");g.className="fd-progressbar-fill";let d=n.createElement("span");d.className="fd-progressbar-text",f.append(g,d);let h=null,m=f;return i.editable===!0?(h=Ve({...e,node:{...t,widget:void 0}}),f.setAttribute("aria-hidden","true"),m=n.createElement("div"),m.className="fd-progressbar-edit",m.append(f,h.element)):f.id=r,{element:m,focus:()=>h?.focus(),update(b){let p=typeof b.value=="number"?b.value:0,w=a?Number(b.values[a]??0):c,$=w>s?Math.min(100,Math.max(0,(p-s)/(w-s)*100)):0,E=Math.round($*10)/10;g.style.width=`${E}%`,f.setAttribute("aria-valuenow",String(p)),f.setAttribute("aria-valuemin",String(s)),f.setAttribute("aria-valuemax",String(w)),f.setAttribute("aria-valuetext",yu($,o)),d.textContent=u?yu($,o):"",f.dataset.tone=l!=="auto"?l:$<30?"danger":$<70?"warning":"success",h?.update(b)}}};function xu(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var ar=({field:e,node:t,id:r,document:n,locale:o="en"})=>{let i=t.options??{},s=u=>typeof i[u]=="string"?i[u]:"",c=u=>typeof i[u]=="string"?i[u]:null,a=e.type==="integer"?0:e.type==="float"||e.type==="monetary"?e.digits?.[1]??2:null,l=n.createElement("output");return l.id=r,l.className="fd-value-text",{element:l,focus:()=>{},update({value:u,values:f}){if(u==null||u===""){l.textContent="";return}let g=a!==null&&typeof u=="number"?wt(u,a,o):Qr(u,e),d=c("prefixField"),h=c("suffixField"),m=d?xu(f[d]):s("prefix"),b=h?xu(f[h]):s("suffix");l.textContent=[m,g,b].filter(p=>p!=="").join(" ")}}};var en=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=n.options??{},c=s.clickable===!0,a=Array.isArray(s.visibleStates)?s.visibleStates:null,l=i.createElement("ol");l.className="fd-statusbar",l.id=o,l.setAttribute("aria-label",r.label);let u=m=>m&&typeof m=="object"&&"id"in m?`id:${String(m.id)}`:`v:${String(m)}`,f=r.type==="selection"?r.options.map(m=>({key:u(m.value),label:m.label,value:m.value})):[],g=r.type==="selection",d={value:void 0,readonly:!1};function h(){let{value:m,readonly:b}=d,p=m==null?null:u(m),w=f.filter($=>!a||a.some(E=>u(E)===$.key)||$.key===p);p&&!w.some($=>$.key===p)&&m&&typeof m=="object"&&(w=[...w,{key:p,label:m.label,value:m}]),l.replaceChildren(...w.map($=>{let E=i.createElement("span");E.textContent=$.label;let z=i.createElement(c?"button":"span");z instanceof HTMLButtonElement&&(z.type="button",z.disabled=b,z.addEventListener("click",()=>e.setValue(t,$.value))),z.append(E),$.key===p&&z.setAttribute("aria-current","step");let _=i.createElement("li");return _.append(z),_}))}return{element:l,focus:()=>l.querySelector("button:not([disabled])")?.focus(),update(m){d={value:m.value,readonly:m.readonly},h(),g||(g=!0,e.search(t,"",20).then(b=>{f=b.map(p=>({key:u(p),label:p.label,value:p})),h()}).catch(()=>{}))}}};function wu(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let r=Date.UTC(t.getUTCFullYear(),0,1);return Math.ceil(((t.getTime()-r)/864e5+1)/7)}var vu=e=>String(e).padStart(2,"0"),Yo=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Je=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function tn(e,t){let r=new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate();return new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),r))}function Xo(e,t){if(typeof t!="string"||!t)return null;if(e==="date"){let n=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return n?new Date(Number(n[1]),Number(n[2])-1,Number(n[3])):null}let r=new Date(t);return Number.isNaN(r.getTime())?null:r}function rn(e,t,r){let{form:n,name:o,id:i,document:s,locale:c="en"}=t,a=t.labels??ke.en,l=c==="en"?"en-GB":c,u=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),f=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),g=new Intl.DateTimeFormat(l,{weekday:"short"}),d=new Intl.DateTimeFormat(l,{weekday:"long"}),h=s.createElement("button");h.type="button",h.className="fd-calendar-button";let m="http://www.w3.org/2000/svg",b=s.createElementNS(m,"svg");b.setAttribute("viewBox","0 0 16 16"),b.setAttribute("aria-hidden","true");for(let[L,J]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let ae=s.createElementNS(m,L);for(let[ve,ze]of Object.entries(J))ae.setAttribute(ve,ze);b.append(ae)}h.append(b),h.setAttribute("aria-label",a.chooseDate),h.setAttribute("aria-haspopup","dialog"),h.setAttribute("aria-expanded","false"),h.setAttribute("aria-controls",`${i}-calendar`);let p=s.createElement("div");p.className="fd-calendar",p.id=`${i}-calendar`,p.setAttribute("role","dialog"),p.hidden=!0;let w=s.createElement("div");w.className="fd-calendar-head";let $=s.createElement("button");$.type="button",$.textContent="\u2039",$.setAttribute("aria-label",a.previousMonth);let E=s.createElement("span");E.className="fd-calendar-title",E.setAttribute("aria-live","polite");let z=s.createElement("button");z.type="button",z.textContent="\u203A",z.setAttribute("aria-label",a.nextMonth),w.append($,E,z);let _=s.createElement("table");_.className="fd-calendar-grid",_.setAttribute("role","grid"),p.append(w,_);let V=s.createElement("span");V.className="fd-date-pick",V.append(e.element,h,p);let T=new Date,Y=!1;function ge(L){if(r==="date")n.setValue(o,`${L.getFullYear()}-${vu(L.getMonth()+1)}-${vu(L.getDate())}`);else{let J=Xo("datetime",n.getState().values[o]),ae=new Date(L.getFullYear(),L.getMonth(),L.getDate(),J?.getHours()??0,J?.getMinutes()??0);n.setValue(o,ae.toISOString())}W()}function B(L){let J=Xo(r,n.getState().values[o]),ae=new Date,ve=u.format(T);E.textContent=ve,p.setAttribute("aria-label",ve);let ze=new Date(T.getFullYear(),T.getMonth(),1),Se=Je(ze,-((ze.getDay()+6)%7)),Ke=s.createElement("tr"),rt=s.createElement("th");rt.scope="col",rt.textContent=a.weekShort,rt.setAttribute("abbr",a.week),Ke.append(rt);for(let k=0;k<7;k++){let S=Je(Se,k),N=s.createElement("th");N.scope="col",N.textContent=g.format(S).replace(/\.$/,""),N.setAttribute("abbr",d.format(S)),Ke.append(N)}let He=s.createElement("thead");He.append(Ke);let x=s.createElement("tbody");for(let k=Se;k<=new Date(T.getFullYear(),T.getMonth()+1,0);k=Je(k,7)){let S=s.createElement("tr"),N=s.createElement("th");N.scope="row",N.className="fd-week",N.textContent=String(wu(k)),S.append(N);for(let Z=0;Z<7;Z++){let U=Je(k,Z),ee=s.createElement("td"),X=s.createElement("button");X.type="button",X.textContent=String(U.getDate()),X.setAttribute("aria-label",f.format(U)),X.tabIndex=Yo(U,T)?0:-1,U.getMonth()!==T.getMonth()&&X.classList.add("fd-outside"),J&&Yo(U,J)&&X.setAttribute("aria-selected","true"),Yo(U,ae)&&X.setAttribute("aria-current","date"),X.disabled=Y,X.addEventListener("click",()=>ge(U)),X.addEventListener("keydown",me=>re(me,U)),ee.append(X),S.append(ee)}x.append(S)}_.replaceChildren(He,x),L&&_.querySelector('button[tabindex="0"]')?.focus()}function G(L){T=L,B(!0)}function re(L,J){let ae={ArrowLeft:()=>Je(J,-1),ArrowRight:()=>Je(J,1),ArrowUp:()=>Je(J,-7),ArrowDown:()=>Je(J,7),PageUp:()=>tn(J,-1),PageDown:()=>tn(J,1),Home:()=>Je(J,-((J.getDay()+6)%7)),End:()=>Je(J,6-(J.getDay()+6)%7)};ae[L.key]?(L.preventDefault(),G(ae[L.key]())):(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),ge(J))}function ne(){T=Xo(r,n.getState().values[o])??new Date,p.hidden=!1,h.setAttribute("aria-expanded","true"),B(!0)}function W(){p.hidden||(p.hidden=!0,h.setAttribute("aria-expanded","false"),h.focus())}h.addEventListener("click",()=>p.hidden?ne():W()),$.addEventListener("click",()=>{T=tn(T,-1),B(!1)}),z.addEventListener("click",()=>{T=tn(T,1),B(!1)}),p.addEventListener("keydown",L=>{L.key==="Escape"&&(L.preventDefault(),L.stopPropagation(),W())});let se=L=>{!p.hidden&&!V.contains(L.target)&&(p.hidden=!0,h.setAttribute("aria-expanded","false"))};return s.addEventListener("mousedown",se),{element:V,focus:()=>e.focus(),update(L){Y=L.readonly,h.hidden=L.readonly,L.readonly&&(p.hidden=!0),e.update(L)},destroy(){s.removeEventListener("mousedown",se),e.destroy?.()}}}var Kp=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)};function Hp(e,t){let r=Kp(e);return typeof t=="boolean"?{name:e,label:r,type:"boolean"}:typeof t=="number"?{name:e,label:r,type:Number.isInteger(t)?"integer":"float"}:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?{name:e,label:r,type:"date"}:{name:e,label:r,type:"char"}}var Qo=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,c=n.type==="properties"?n.definitions:void 0,a=()=>{let h=t.getState().values[r];return h&&typeof h=="object"&&!Array.isArray(h)?h:{}},l={...t,getState:()=>({...t.getState(),values:a()}),setValue:(h,m)=>t.setValue(r,{...a(),[h]:m})},u=s.createElement("div");u.className="fd-properties",u.setAttribute("role","group");let f=[],g="";function d(h){for(let m of f)m.widget.destroy?.();f=h.map(m=>{let b=`${i}-${m.name}`,p={type:m.type,label:m.label,...m.options?{options:m.options}:{}},w={type:"field",id:`${o.id}.${m.name}`,field:m.name},$=Ve({...e,form:l,name:m.name,field:p,node:w,id:b});return{definition:m,widget:$}}),u.replaceChildren(...f.map(({definition:m,widget:b})=>{let p=s.createElement("div");p.className="fd-property",p.dataset.type=m.type;let w=s.createElement("label");return w.htmlFor=`${i}-${m.name}`,w.textContent=m.label,p.append(w,b.element),p}))}return{element:u,focus:()=>f[0]?.widget.focus(),destroy:()=>f.forEach(h=>h.widget.destroy?.()),update(h){let m=a(),b=c??Object.keys(m).map(w=>Hp(w,m[w])),p=JSON.stringify(b);p!==g&&(g=p,d(b));for(let{definition:w,widget:$}of f)$.update({value:m[w.name]??null,values:m,readonly:h.readonly,required:!1,invalid:!1})}}};var qp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),Gp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),Yp=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),Xp=new Set(["left","center","right","justify","start","end"]);function ei(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 c=s;if(Gp.has(c.tagName)){c.remove();continue}if(n(c),!qp.has(c.tagName)){c.replaceWith(...c.childNodes);continue}let a=c.tagName==="A"?c.getAttribute("href"):null,l=Yp.has(c.tagName)?c.style?.textAlign?.trim().toLowerCase():"";for(let u of[...c.attributes])c.removeAttribute(u.name);a&&/^(https?:|mailto:)/i.test(a.trim())&&c.setAttribute("href",a.trim()),l&&Xp.has(l)&&c.setAttribute("style",`text-align: ${l};`)}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}function _u(e){let t=e.trim();return/^(https?:\/\/|mailto:)\S+$/i.test(t)?t:/^[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+$/.test(t)?`mailto:${t}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(t)?`https://${t}`:null}var ku=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["bulletList","insertUnorderedList",'<svg viewBox="0 0 16 16"><circle cx="3" cy="4" r="1.2"/><circle cx="3" cy="8" r="1.2"/><circle cx="3" cy="12" r="1.2"/><path d="M6 4h8M6 8h8M6 12h8"/></svg>'],["numberList","insertOrderedList",'<svg viewBox="0 0 16 16"><path d="M2.5 3h1v3M2 10.5c.5-.8 2-.8 2 .2 0 .8-2 1.3-2 2.3h2M6 4h8M6 8h8M6 12h8"/></svg>'],["alignLeft","justifyLeft",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M2 6.5h8M2 9.5h12M2 12.5h8"/></svg>'],["alignCenter","justifyCenter",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M4 6.5h8M2 9.5h12M4 12.5h8"/></svg>'],["alignRight","justifyRight",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M6 6.5h8M2 9.5h12M6 12.5h8"/></svg>'],["link","createLink",'<svg viewBox="0 0 16 16"><path d="M7 9a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2L8.2 3.6M9 7a3 3 0 0 0-4.2 0L2.5 9.3a3 3 0 0 0 4.2 4.2l1.1-1.1"/></svg>']],ti=({form:e,name:t,node:r,id:n,document:o,labels:i=ke.en})=>{let s=o.createElement("div");s.id=n,s.className="fd-input fd-richtext",s.setAttribute("role","textbox"),s.setAttribute("aria-multiline","true"),s.setAttribute("contenteditable","true");let c=r.options?.toolbar!==!1,a="";s.addEventListener("input",()=>{let f=ei(s.innerHTML,o);a=f,e.setValue(t,f.trim()===""?null:f)}),s.addEventListener("blur",()=>{s.innerHTML!==a&&(s.innerHTML=a)});let l=c?Qp(s,o,i):null,u=s;return l&&(u=o.createElement("div"),u.className="fd-richtext-box",u.setAttribute("role","group"),s.setAttribute("aria-labelledby",`${n}-label`),u.append(l.bar,l.linkRow,s)),{element:u,focus:()=>s.focus(),destroy:()=>l?.destroy(),update(f){l&&(l.bar.hidden=f.readonly,f.readonly&&(l.linkRow.hidden=!0));let g=ei(typeof f.value=="string"?f.value:"",o);(g!==a||o.activeElement!==s)&&(s.innerHTML!==g&&(s.innerHTML=g),a=g),s.setAttribute("contenteditable",String(!f.readonly)),s.setAttribute("aria-readonly",String(f.readonly)),s.setAttribute("aria-invalid",String(f.invalid)),f.describedBy&&s.setAttribute("aria-describedby",f.describedBy)}}};function Qp(e,t,r){let n=t.createElement("div");n.className="fd-richtext-bar",n.setAttribute("role","toolbar"),n.setAttribute("aria-label",r.formatting);let o=null,i=()=>{e.focus();let m=t.getSelection();o&&m&&(m.removeAllRanges(),m.addRange(o))},s=(m,b)=>{i(),t.execCommand?.(m,!1,b)},c=t.createElement("select");c.className="fd-richtext-style",c.setAttribute("aria-label",r.textStyle);for(let[m,b]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let p=t.createElement("option");p.value=m,p.textContent=r[b],c.append(p)}c.addEventListener("change",()=>s("formatBlock",`<${c.value}>`));let a=t.createElement("div");a.className="fd-link-row",a.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",r.linkAddress);let u=t.createElement("button");u.type="button",u.className="fd-button fd-link-apply",u.textContent=r.applyLink;let f=t.createElement("button");f.type="button",f.className="fd-button fd-button-link fd-link-remove",f.textContent=r.removeLink,a.append(l,u,f),u.addEventListener("click",()=>{let m=_u(l.value);if(!m){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),i(),t.execCommand?.("createLink",!1,m),a.hidden=!0}),f.addEventListener("click",()=>{i(),t.execCommand?.("unlink",!1),a.hidden=!0}),l.addEventListener("keydown",m=>{m.key==="Enter"?(m.preventDefault(),u.click()):m.key==="Escape"&&(m.preventDefault(),a.hidden=!0,i())});let g=ku.map(([m,b,p])=>{let w=t.createElement("button");return w.type="button",w.className="fd-richtext-tool",w.setAttribute("aria-label",r[m]),w.title=r[m],w.innerHTML=p,w.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline"].includes(b)&&w.setAttribute("aria-pressed","false"),w.addEventListener("mousedown",$=>$.preventDefault()),w.addEventListener("click",()=>{if(b!=="createLink")return s(b);a.hidden=!1,l.value="",l.focus()}),w});n.append(c,...g);let d=[c,...g];d.forEach((m,b)=>m.tabIndex=b===0?0:-1),n.addEventListener("keydown",m=>{if(m.key!=="ArrowRight"&&m.key!=="ArrowLeft")return;let b=d.indexOf(t.activeElement);if(b<0)return;let p=getComputedStyle(n).direction==="rtl",w=m.key==="ArrowRight"!==p?1:-1,$=d[(b+w+d.length)%d.length];m.preventDefault(),d.forEach(E=>E.tabIndex=E===$?0:-1),$.focus()});let h=()=>{let m=t.getSelection();if(!m||!m.rangeCount||!e.contains(m.anchorNode))return;o=m.getRangeAt(0).cloneRange();for(let p of g){let w=ku[g.indexOf(p)][1];p.hasAttribute("aria-pressed")&&p.setAttribute("aria-pressed",String(t.queryCommandState?.(w)??!1))}let b=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");c.value=b==="h2"||b==="h3"?b:"p"};return t.addEventListener("selectionchange",h),{bar:n,linkRow:a,destroy:()=>t.removeEventListener("selectionchange",h)}}var ri=({form:e,name:t,id:r,document:n,labels:o=ke.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 c=n.createElement("div");return c.className="fd-cell-error",c.hidden=!0,i.append(s,c),s.addEventListener("input",()=>{if(s.value.trim()===""){c.hidden=!0,e.setValue(t,null);return}try{let a=JSON.parse(s.value);c.hidden=!0,e.setValue(t,a)}catch{c.hidden=!1,c.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(a){if(n.activeElement!==s){let l=a.value===null||a.value===void 0?"":JSON.stringify(a.value,null,2);s.value!==l&&(s.value=l)}s.readOnly=a.readonly,s.setAttribute("aria-invalid",String(a.invalid||!c.hidden))}}};function Ve(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]??Nu[i];if(s)return s(e)}return sm(e)}function xe(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 tt(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 on=e=>e==null?"":String(e);function cr(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let c=xe(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(c.maxLength=n.size),o.placeholder&&(c.placeholder=o.placeholder),c.addEventListener("input",()=>t.setValue(r,c.value===""?null:c.value)),{element:c,focus:()=>c.focus(),update(a){let l=on(a.value);c.value!==l&&(c.value=l),c.readOnly=a.readonly,tt(c,a)}}}}var em=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=xe(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(c){let a=on(c.value);s.value!==a&&(s.value=a),s.readOnly=c.readonly,tt(s,c)}}},tm=/^-?(\d+\.?\d*|\.\d+)$/,rm=/^-?\.?$/,ni=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s,locale:c="en"}=e,a=n.type==="integer",l=a?0:(n.type==="float"||n.type==="monetary"?n.digits?.[1]:void 0)??2,u=z=>typeof z=="number"?wt(z,l,c):on(z),f=xe(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});f.inputMode=a?"numeric":"decimal",o.placeholder&&(f.placeholder=o.placeholder);let g=z=>{let _=jo(z.trim(),c);if(_==="")return null;if(tm.test(_))return Number(_);if(!rm.test(_))return _};f.addEventListener("input",()=>{let z=g(f.value);z!==void 0&&t.setValue(r,z)}),f.addEventListener("blur",()=>{f.value=u(t.getState().values[r])});let d=o.options??{},h=n.type==="monetary"?n.currencyField:void 0,m=h?t.page.fields[h]:void 0,b=h&&m&&d.pickCurrency===!0?Ve({...e,name:h,field:m,node:{type:"field",id:`${o.id}.currency`,field:h},id:`${i}-currency`}):null;b&&m&&b.element.querySelector("input, select")?.setAttribute("aria-label",m.label),b?.element.matches("input, select")&&m&&b.element.setAttribute("aria-label",m.label);let p=n.type==="monetary"&&!b?xe(s,"span",{class:"fd-currency","aria-hidden":"true"}):null,w=b?.element??p,$=d.symbol==="after";return{element:w?xe(s,"span",{class:`fd-number${$?" fd-currency-after":""}${b?" fd-currency-picked":""}`},...$?[f,w]:[w,f]):f,focus:()=>f.focus(),update(z){let _=s.activeElement===f,V=g(f.value),T=V===void 0||V===z.value;if(!(_&&T)){let Y=u(z.value);f.value!==Y&&(f.value=Y)}if(f.readOnly=z.readonly,tt(f,z),b&&h&&b.update({value:z.values[h],values:z.values,readonly:z.readonly,required:!1,invalid:!1}),p&&n.type==="monetary"){let Y=n.currencyField?z.values[n.currencyField]:null;p.textContent=Y&&typeof Y=="object"&&"label"in Y?Y.label:typeof Y=="string"?Y:n.currency??""}}}};function zu(e){return({form:t,name:r,id:n,document:o})=>{let i=xe(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,tt(i,s)}}}}function Eu(e){return e.type==="selection"?e.options:[]}var nm=({form:e,name:t,field:r,id:n,document:o})=>{let i=Eu(r),s=xe(o,"select",{id:n,class:"fd-input fd-select"},xe(o,"option",{value:""}));return i.forEach((c,a)=>s.append(xe(o,"option",{value:String(a)},c.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(c){let a=i.findIndex(l=>l.value===c.value);s.value=a===-1?"":String(a),s.disabled=c.readonly,tt(s,c)}}};function Su(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Eu(n),c=xe(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),a=s.map((l,u)=>{let f=xe(i,"input",{type:e,name:o,value:String(u),id:`${o}-${u}`});return c.append(xe(i,"label",{class:"fd-choice",for:`${o}-${u}`},f,xe(i,"span",{},l.label))),f});return c.addEventListener("change",()=>{if(e==="radio"){let l=a.findIndex(u=>u.checked);t.setValue(r,l===-1?null:s[l].value)}else t.setValue(r,s.filter((l,u)=>a[u].checked).map(l=>l.value))}),{element:c,focus:()=>(a.find(l=>l.checked)??a[0])?.focus(),update(l){let u=Array.isArray(l.value)?l.value:[l.value];a.forEach((f,g)=>{f.checked=u.includes(s[g].value),f.disabled=l.readonly}),tt(c,l)}}}}function $u(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,c="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,a=xe(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),l=[];for(let u=s;u<=c;u++){let f=xe(i,"button",{type:"button",role:"radio","aria-label":`${u} of ${c}`,"data-value":String(u)},e==="rating"?"\u2605":String(u));e==="scale"&&f.removeAttribute("aria-label"),f.addEventListener("click",()=>t.setValue(r,u)),l.push(f),a.append(f)}return a.addEventListener("keydown",u=>{let f=t.getState().values[r],g=typeof f=="number"?f:s-1,d=u.key==="ArrowRight"||u.key==="ArrowUp"?1:u.key==="ArrowLeft"||u.key==="ArrowDown"?-1:0;if(!d)return;u.preventDefault();let h=Math.min(c,Math.max(s,g+d));t.setValue(r,h),l[h-s]?.focus()}),{element:a,focus:()=>(l.find(u=>u.getAttribute("aria-checked")==="true")??l[0])?.focus(),update(u){let f=typeof u.value=="number"?u.value:null;l.forEach((g,d)=>{let h=s+d;g.setAttribute("aria-checked",String(h===f)),g.classList.toggle("fd-on",e==="rating"?f!==null&&h<=f:h===f),g.tabIndex=h===f||f===null&&d===0?0:-1,g.disabled=u.readonly}),tt(a,u)}}}}var om=e=>{let{form:t,name:r,id:n,document:o,node:i}=e,s=xe(o,"input",{id:n,type:"date",class:"fd-input fd-date"});s.addEventListener("input",()=>t.setValue(r,s.value||null));let c={element:s,focus:()=>s.focus(),update(a){let l=on(a.value);s.value!==l&&(s.value=l),s.readOnly=a.readonly,tt(s,a)}};return i.options?.weekNumbers===!0?rn(c,e,"date"):c},nn=e=>String(e).padStart(2,"0"),im=e=>{let{form:t,name:r,id:n,document:o,node:i}=e,s=xe(o,"input",{id:n,type:"datetime-local",class:"fd-input fd-datetime"}),c=l=>{if(typeof l!="string"||!l)return"";let u=new Date(l);return Number.isNaN(u.getTime())?"":`${u.getFullYear()}-${nn(u.getMonth()+1)}-${nn(u.getDate())}T${nn(u.getHours())}:${nn(u.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(r,null);let l=new Date(s.value);Number.isNaN(l.getTime())||t.setValue(r,l.toISOString())});let a={element:s,focus:()=>s.focus(),update(l){let u=c(l.value);s.value!==u&&(s.value=u),s.readOnly=l.readonly,tt(s,l)}};return i.options?.weekNumbers===!0?rn(a,e,"datetime"):a};function sm({field:e,id:t,document:r}){let n=xe(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=Qr(o.value,e)}}}function Qr(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 Nu={char:cr("text"),"char.email":cr("email"),"char.phone":cr("tel"),"char.url":cr("url"),"char.password":cr("password"),"char.tags":Uo,text:em,integer:ni,float:ni,monetary:ni,"integer.rating":$u("rating"),"integer.scale":$u("scale"),"integer.progressbar":sr,"integer.label":ar,"float.label":ar,"monetary.label":ar,"float.progressbar":sr,"monetary.progressbar":sr,boolean:zu(),"boolean.toggle":zu("switch"),selection:nm,"selection.radio":Su("radio"),"selection.checkboxes":Su("checkbox"),"selection.statusbar":en,date:om,datetime:im,many2one:Bo,"many2one.statusbar":en,many2many:Xr,"many2many.tags":Xr,"many2many.checkboxes":Wo,reference:Jo,one2many:Ho,binary:qo,image:Go,html:ti,json:ri,properties:Qo};var Lu=`
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;
@@ -193,6 +193,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
193
193
  .fd-number { display: flex; align-items: baseline; gap: 6px; }
194
194
  .fd-number-input { font-variant-numeric: tabular-nums; }
195
195
  .fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }
196
+ /* With the currency after it, the amount ends right beside it. */
197
+ .fd-currency-after > .fd-number-input { text-align: end; }
198
+ /* A picked currency is a small box of its own beside the amount. */
199
+ .fd-currency-picked { align-items: center; }
200
+ .fd-currency-picked > :not(.fd-number-input) { flex: 0 0 104px; min-width: 0; }
201
+ .fd-currency-picked > .fd-number-input { flex: 1 1 auto; min-width: 0; }
196
202
  .fd-pending { color: var(--fd-muted); font-style: italic; }
197
203
  .fd-pending:empty::before { content: "\u2014"; }
198
204
 
@@ -237,6 +243,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
237
243
  }
238
244
  .fd-option { padding: 6px 12px; cursor: pointer; }
239
245
  .fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }
246
+ .fd-option-create { color: var(--fd-accent); border-block-start: 1px solid var(--fd-border); }
240
247
  .fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }
241
248
  .fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
242
249
  .fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }
@@ -287,6 +294,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
287
294
  .fd-avatar .fd-image-pick { width: 88px; height: 88px; }
288
295
  .fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }
289
296
  .fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }
297
+ .fd-richtext-box { display: grid; gap: 0; min-width: 0; }
298
+ .fd-richtext-box > .fd-richtext { border-start-start-radius: 0; border-start-end-radius: 0; }
299
+ .fd-richtext-bar {
300
+ display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; min-width: 0;
301
+ border: 1px solid var(--fd-border); border-block-end: none; border-start-start-radius: var(--fd-control-radius); border-start-end-radius: var(--fd-control-radius);
302
+ background: var(--fd-page);
303
+ }
304
+ .fd-richtext-style { font: inherit; font-size: 12.5px; padding: 3px 6px; margin-inline-end: 4px; border: 1px solid var(--fd-border); border-radius: 4px; background: var(--fd-surface); color: var(--fd-text); }
305
+ .fd-richtext-tool {
306
+ display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 4px;
307
+ background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 14px;
308
+ }
309
+ .fd-richtext-tool:hover { background: var(--fd-surface); }
310
+ .fd-richtext-tool[aria-pressed="true"] { background: var(--fd-accent-soft); color: var(--fd-accent); }
311
+ .fd-richtext-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
312
+ .fd-richtext-tool svg circle { fill: currentColor; stroke: none; }
313
+ .fd-link-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--fd-border); border-block-end: none; background: var(--fd-surface); }
314
+ .fd-link-row > .fd-input { flex: 1 1 200px; min-width: 0; }
290
315
  .fd-richtext[contenteditable="false"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }
291
316
  .fd-richtext p { margin: 0 0 6px; }
292
317
  .fd-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }
@@ -420,6 +445,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
420
445
  .fd-wizard { display: grid; gap: 20px; }
421
446
  .fd-progress { display: grid; gap: 8px; }
422
447
  .fd-progress-text { color: var(--fd-muted); font-size: 13px; }
448
+ .fd-value-text { display: block; padding-block: 6px; font-variant-numeric: tabular-nums; }
449
+ .fd-date-pick { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
450
+ .fd-date-pick > .fd-input { flex: 1 1 auto; min-width: 0; }
451
+ .fd-calendar-button {
452
+ flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
453
+ border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-surface); color: var(--fd-muted);
454
+ }
455
+ .fd-calendar-button:hover, .fd-calendar-button[aria-expanded="true"] { color: var(--fd-text); background: var(--fd-page); }
456
+ .fd-calendar-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
457
+ .fd-calendar {
458
+ position: absolute; inset-block-start: calc(100% + 4px); inset-inline-end: 0; z-index: 30; padding: 8px;
459
+ background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 6px);
460
+ box-shadow: 0 8px 24px rgba(15, 20, 25, 0.14);
461
+ }
462
+ .fd-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 6px; }
463
+ .fd-calendar-head button { border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 4px; color: var(--fd-text); }
464
+ .fd-calendar-head button:hover { background: var(--fd-page); }
465
+ .fd-calendar-title { font-weight: 600; }
466
+ .fd-calendar-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }
467
+ .fd-calendar-grid th { font-size: 11.5px; font-weight: 600; color: var(--fd-muted); padding: 4px 0; width: 34px; text-align: center; }
468
+ .fd-calendar-grid .fd-week { color: var(--fd-accent); font-weight: 600; border-inline-end: 1px solid var(--fd-border); }
469
+ .fd-calendar-grid td { padding: 1px; }
470
+ .fd-calendar-grid td button {
471
+ width: 32px; height: 30px; border: none; border-radius: 4px; background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 13px;
472
+ }
473
+ .fd-calendar-grid td button:hover { background: var(--fd-accent-soft); }
474
+ .fd-calendar-grid td button.fd-outside { color: var(--fd-muted); opacity: 0.6; }
475
+ .fd-calendar-grid td button[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--fd-accent); }
476
+ .fd-calendar-grid td button[aria-selected="true"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
477
+ .fd-calendar-grid td button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
478
+ .fd-properties { display: grid; gap: 8px; min-width: 0; }
479
+ .fd-property { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
480
+ .fd-property > label { color: var(--fd-muted); font-size: 13px; }
481
+ .fd-property[data-type="boolean"] > :last-child { justify-self: start; }
482
+ @container (max-width: 520px) { .fd-property { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
483
+ .fd-progressbar {
484
+ position: relative; height: 22px; min-width: 120px; border-radius: 999px; overflow: hidden;
485
+ background: var(--fd-page); border: 1px solid var(--fd-border); font-variant-numeric: tabular-nums;
486
+ }
487
+ .fd-progressbar-fill { height: 100%; background: var(--fd-success); transition: width 0.2s ease; }
488
+ .fd-progressbar[data-tone="warning"] .fd-progressbar-fill { background: #d97706; }
489
+ .fd-progressbar[data-tone="danger"] .fd-progressbar-fill { background: var(--fd-error); }
490
+ .fd-progressbar[data-tone="info"] .fd-progressbar-fill { background: var(--fd-info); }
491
+ .fd-progressbar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fd-text); }
492
+ .fd-progressbar-edit { display: flex; align-items: center; gap: 12px; min-width: 0; }
493
+ .fd-progressbar-edit > .fd-progressbar { flex: 1 1 auto; }
494
+ .fd-progressbar-edit > .fd-input { flex: 0 0 96px; }
423
495
  .fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }
424
496
  .fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }
425
497
  .fd-step { display: grid; gap: 18px; }
@@ -445,7 +517,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
445
517
  }
446
518
  .fd-dialog p { margin: 0; }
447
519
  @media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
448
- `,sl="fieldia-styles";function Bo(e){if(e.getElementById(sl))return;let t=e.createElement("style");t.id=sl,t.textContent=al,(e.head??e.documentElement).append(t)}function Jo(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(r){try{let n=t()?.getItem(`fieldia:${r}`);return n==null?null:JSON.parse(n)}catch{return null}},set(r,n){try{t()?.setItem(`fieldia:${r}`,JSON.stringify(n))}catch{}}}}function Tp(){let e=new Map;return{get:t=>e.has(t)?cl(e.get(t)):null,set:(t,r)=>{e.set(t,cl(r))}}}var cl=e=>JSON.parse(JSON.stringify(e));var Wo={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"}},Ap=Wo.en,Lp=0;function Rp(e,t){let r=e.ownerDocument,n=Ur(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
449
- ${n.issues.map(g=>` ${g.path}: ${g.message}`).join(`
450
- `)}`);let o=n.page,i=t.locale??"en",s=t.preferences??Jo(),c=!t.form,a=t.form??Kr({...t,page:o,messages:t.messages??st[i]}),u={...Wo[i],...t.labels},l=Ne[i],f=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++Lp}`,d=[],m=[],v=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,y=(g,$)=>g.replace(/\{(\w+)\}/g,(k,I)=>String($[I]??""));Bo(r);function h(g,$={},...k){let I=r.createElement(g);for(let[M,L]of Object.entries($))L!==void 0&&I.setAttribute(M,L);return I.append(...k),I}let O=h("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:f,lang:t.locale}),K=t.confirm??Ue;function S(g){let $=o.fields[g.field],k=v(g.id),I=h("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":$.type});g.colspan&&I.style.setProperty("--fd-span",String(g.colspan));let M=h("label",{class:"fd-label",id:`${k}-label`,for:k},g.label??$.label),L=rr({form:a,name:g.field,field:$,node:g,id:k,document:r,labels:l,preferences:s},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(L.element.tagName)||(L.element.getAttribute("role")&&L.element.setAttribute("aria-labelledby",M.id),M.addEventListener("click",()=>L.focus()));let T=g.help??$.help,Q=T?h("div",{class:"fd-help",id:`${k}-help`},T):null,N=h("div",{class:"fd-error",id:`${k}-error`,role:"alert",hidden:""}),R=h("div",{class:"fd-warning",role:"status",hidden:""});return I.append(M,L.element,...Q?[Q]:[],N,R),L.destroy&&m.push(()=>L.destroy?.()),d.push(H=>{let ye=a.node(g.id);I.hidden=ye.invisible,I.classList.toggle("fd-required",ye.required);let Ze=H.errors[g.field];N.hidden=!Ze,N.textContent=Ze??"";let Ye=H.warning&&H.warningField===g.field?H.warning:"";R.hidden=!Ye,R.textContent=Ye,L.update({value:H.values[g.field],values:H.values,readonly:ye.readonly,required:ye.required,invalid:!!Ze,describedBy:[Q?.id,Ze?N.id:void 0].filter(Boolean).join(" ")||void 0})}),I}function z(g,$){d.push(()=>{g.hidden=a.node($).invisible})}function E(g){let $=h("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return $.addEventListener("click",async()=>{g.confirm&&!await K(g.confirm)||await a.runAction(g.id)}),z($,g.id),$}function q(g){let $=g.style??"paragraph",k=h($==="heading"?"h3":"p",{class:`fd-text-${$}`,"data-node":g.id},g.text);return z(k,g.id),k}function de(g){let $=h("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),k=t.slots?.[g.name]?.($,{form:a,name:g.name});return k&&m.push(k),z($,g.id),$}function Te(g,$=1){let k=h("div",{class:"fd-grid"});return k.style.setProperty("--fd-columns",String($)),k.append(...g.map(ie)),k}let B=new Map;function V(g){let $=h("fieldset",{class:"fd-section","data-node":g.id}),k=g.description?h("p",{class:"fd-section-description"},g.description):null,I=Te(g.children,g.columns??1);if(g.title&&g.collapsible){I.id=v(`${g.id}-content`);let M=h("button",{type:"button",class:"fd-section-toggle","aria-controls":I.id},h("span",{class:"fd-section-chevron","aria-hidden":"true"}),g.title),L=g.collapsed!==!0,T=Q=>{L=Q,M.setAttribute("aria-expanded",String(L)),I.hidden=!L,k&&(k.hidden=!L),$.classList.toggle("fd-section-folded",!L)};M.addEventListener("click",()=>T(!L)),B.set($,()=>T(!0)),T(L),$.append(h("legend",{class:"fd-section-title"},M))}else g.title&&$.append(h("legend",{class:"fd-section-title"},g.title));return k&&$.append(k),$.append(I),z($,g.id),$}function ne(g){let $=h("div",{class:"fd-tabs","data-node":g.id}),k=h("div",{class:"fd-tablist",role:"tablist"}),I=null,M=g.children[0].id,L=g.children.map(T=>{let Q=v(`${T.id}-tab`),N=v(`${T.id}-panel`),R=h("button",{type:"button",class:"fd-tab",role:"tab",id:Q,"aria-controls":N,"data-node":T.id},T.label),H=h("div",{class:"fd-tabpanel",role:"tabpanel",id:N,"aria-labelledby":Q},Te(T.children));return R.addEventListener("click",()=>{I=M=T.id,Se(a.getState())}),k.append(R),{tab:T,button:R,panel:H}});return k.addEventListener("keydown",T=>{let Q=L.filter(Ze=>!Ze.button.hidden),N=Q.findIndex(Ze=>Ze.tab.id===M),R={ArrowRight:1,ArrowLeft:-1,Home:-N,End:Q.length-1-N}[T.key];if(R===void 0||N===-1)return;T.preventDefault();let H=O.getAttribute("dir")==="rtl"&&(T.key==="ArrowRight"||T.key==="ArrowLeft"),ye=Q[(N+(H?-R:R)+Q.length)%Q.length];I=M=ye.tab.id,Se(a.getState()),ye.button.focus()}),$.append(k,...L.map(T=>T.panel)),d.push(()=>{$.hidden=a.node(g.id).invisible;let T=L.filter(N=>!a.node(N.tab.id).invisible);I!==null&&T.some(N=>N.tab.id===I)?M=I:T.length&&(M=T[0].tab.id);for(let N of L){let R=N.tab.id===M;N.button.hidden=!T.includes(N),N.button.setAttribute("aria-selected",String(R)),N.button.tabIndex=R?0:-1,N.panel.hidden=!R}}),$}function ie(g){switch(g.type){case"field":return S(g);case"button":return E(g);case"text":return q(g);case"slot":return de(g);case"section":return V(g);case"tabs":return ne(g)}}let D=h("div",{class:"fd-status",role:"status","aria-live":"polite"});d.push(g=>{let $=g.status==="saving"?u.saving:g.status==="saved"?u.saved:g.status==="loading"?u.loading:g.status==="error"?g.error??"":"";D.textContent=$,D.classList.toggle("fd-status-error",g.status==="error"),D.classList.toggle("fd-status-saved",g.status==="saved")});let X=h("div",{class:"fd-draft",hidden:""}),G=h("span"),fe=h("button",{type:"button",class:"fd-button fd-button-primary"},u.restore),xe=h("button",{type:"button",class:"fd-button fd-button-link"},u.discardDraft);fe.addEventListener("click",()=>a.restoreDraft()),xe.addEventListener("click",()=>a.discardDraft()),X.append(G,fe,xe),d.push(g=>{X.hidden=!g.draft,g.draft&&(G.textContent=y(u.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function De(){let g=O.querySelector('[aria-invalid="true"]');if(!g)return;for(let k=g.closest(".fd-section-folded");k;k=k.parentElement?.closest(".fd-section-folded")??null)B.get(k)?.();if(!g.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let ve=h("div",{class:"fd-done",hidden:""},h("p",{class:"fd-done-title"},u.submitted)),Nt=h("button",{type:"button",class:"fd-button"},u.submitAnother);ve.append(Nt);let ht=h("div",{class:"fd-content"});async function gt(){if(!await a.save()){De();return}o.data.kind==="responses"&&(ht.hidden=!0,ve.hidden=!1)}Nt.addEventListener("click",()=>{a.reset(),ht.hidden=!1,ve.hidden=!0});function x(){if(!o.title&&!o.description)return null;let g=h("header",{class:"fd-page-head"});return o.title&&g.append(h("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(h("p",{class:"fd-page-description"},o.description)),g}function _(g){let $=h("div",{class:"fd-sections","data-node":g.id},...g.children.map(ie)),k=h("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?u.submit:u.save),I=h("div",{class:"fd-actions fd-actions-end"},D,k);if(o.data.kind==="record"){let M=h("button",{type:"button",class:"fd-button"},u.discard);M.addEventListener("click",()=>a.reset()),I.insertBefore(M,k),d.push(L=>{let T=L.dirty.length>0&&L.status!=="saving";k.hidden=!T,M.hidden=!T})}return h("div",{},$,I)}function w(g){let $=h("div",{class:"fd-wizard","data-node":g.id}),k=h("div",{class:"fd-progress-text"}),I=h("span");$.append(h("div",{class:"fd-progress"},k,h("div",{class:"fd-progress-bar"},I)));let M=g.children.map(R=>{let H=h("section",{class:"fd-step","data-node":R.id,"aria-labelledby":v(`${R.id}-title`)});return H.append(h("h2",{class:"fd-step-title",id:v(`${R.id}-title`)},R.label)),R.description&&H.append(h("p",{class:"fd-section-description"},R.description)),H.append(Te(R.children)),$.append(H),{step:R,panel:H}}),L=h("button",{type:"button",class:"fd-button"},u.back),T=h("button",{type:"submit",class:"fd-button fd-button-primary"});$.append(h("div",{class:"fd-wizard-nav"},L,h("span",{class:"fd-spacer"}),D,T)),L.addEventListener("click",()=>{a.back()&&N()});let Q=()=>{let R=a.steps();return R.indexOf(a.getState().step??"")===R.length-1};J=async()=>{if(Q())return gt();a.next()?N():De()};function N(){M.find(H=>H.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return d.push(R=>{let H=a.steps(),ye=Math.max(0,H.indexOf(R.step??""));k.textContent=y(u.stepOf,{n:ye+1,total:H.length}),I.style.width=`${(ye+1)/Math.max(1,H.length)*100}%`;for(let{step:Ze,panel:Ye}of M)Ye.hidden=Ze.id!==R.step;L.hidden=ye===0,T.textContent=ye===H.length-1?u.submit:u.next}),$}function F(g){let $=h("div",{class:"fd-sheet-page","data-node":g.id}),k=h("div",{class:"fd-actions"}),I=h("button",{type:"submit",class:"fd-button fd-button-primary"},u.save),M=h("button",{type:"button",class:"fd-button"},u.discard);M.addEventListener("click",()=>a.reset()),k.append(I,M,...(g.buttons??[]).map(E),D),d.push(N=>{let R=N.dirty.length>0&&N.status!=="saving";I.hidden=!R,M.hidden=!R});let L=h("div",{class:"fd-header"},k);g.statusbar&&L.append(U(g.statusbar));let T=h("div",{class:"fd-card"});if(g.ribbon){let N=h("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);z(N,g.ribbon.id),T.append(h("div",{class:"fd-ribbon-frame"},N))}if(g.statButtons?.length){let N=h("div",{class:"fd-stats"});for(let R of g.statButtons){let H=h("span",{class:"fd-stat-value"}),ye=h("button",{type:"button",class:"fd-stat","data-node":R.id},H,h("span",{class:"fd-stat-label"},R.label));ye.addEventListener("click",()=>{a.runAction(R.id)}),d.push(Ze=>{ye.hidden=a.node(R.id).invisible;let Ye=R.field?Ze.values[R.field]:null;H.textContent=Ye==null?"":String(Ye)}),N.append(ye)}T.append(N)}for(let N of g.alerts??[]){let R=h("div",{class:`fd-alert fd-tone-${N.tone??"info"}`,role:"status","data-node":N.id},N.message);z(R,N.id),T.append(R)}if(g.title){let N=h("div",{class:"fd-title"});N.append(S({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&N.append(S({type:"field",id:"#subtitle",field:g.title.subtitleField}));let R=h("div",{class:"fd-title-row"},N);if(g.title.avatarField){let H=S({type:"field",id:"#avatar",field:g.title.avatarField});H.classList.add("fd-avatar"),R.append(H)}T.append(R)}T.append(Te(g.children));let Q=h("div",{class:"fd-sheet-layout"},T);return g.sidePanel&&(Q.classList.add("fd-has-side"),Q.append(h("aside",{class:"fd-side"},de(g.sidePanel)))),$.append(L,Q),$}function U(g){let $=o.fields[g.field],k=h("ol",{class:"fd-statusbar","aria-label":$.label});if($.type==="selection"){let M=$.options.filter(L=>!g.visibleStates||g.visibleStates.includes(L.value)).map(L=>{let T=g.clickable?h("button",{type:"button"},h("span",{},L.label)):h("span",{},h("span",{},L.label));return T instanceof HTMLButtonElement&&T.addEventListener("click",()=>a.setValue(g.field,L.value)),k.append(h("li",{},T)),{option:L,inner:T}});d.push(L=>{let T=a.node("#statusbar").readonly;for(let{option:Q,inner:N}of M)Q.value===L.values[g.field]?N.setAttribute("aria-current","step"):N.removeAttribute("aria-current"),N instanceof HTMLButtonElement&&(N.disabled=T)})}else{let I=h("span",{"aria-current":"step"});k.append(h("li",{},I)),d.push(M=>{let L=M.values[g.field];I.textContent=L?.label??""})}return k}let J=null,W=o.layout,ce;W.type==="sheet"?ce=F(W):W.type==="wizard"?ce=w(W):W.type==="tabs"?ce=_({id:`${W.id}-page`,children:[W]}):ce=_(W);let pe=W.type==="sheet"?null:x();ht.append(...pe?[pe]:[],X,ce),O.append(ht,ve),O.addEventListener("submit",g=>{g.preventDefault(),J?J():gt()});function Ue(g){return new Promise($=>{let k=h("p",{id:`${p}-confirm`},g),I=h("button",{type:"button",class:"fd-button"},u.cancel),M=h("button",{type:"button",class:"fd-button fd-button-primary"},u.ok),L=h("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":k.id},k,h("div",{class:"fd-actions fd-actions-end"},I,M)),T=h("div",{class:"fd-dialog-backdrop"},L),Q=N=>{T.remove(),$(N)};I.addEventListener("click",()=>Q(!1)),M.addEventListener("click",()=>Q(!0)),T.addEventListener("keydown",N=>{N.key==="Escape"&&Q(!1)}),O.append(T),M.focus()})}function Se(g){for(let $ of d)$(g)}e.append(O);let bt=a.subscribe(Se);return Se(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:O,setSkin(g){O.setAttribute("data-fd-skin",g)},destroy(){bt();for(let g of m)g();O.remove(),c&&a.dispose()}}}var Ip="0.3.0";return ml(Fp);})();
520
+ `,Pu="fieldia-styles";function oi(e){if(e.getElementById(Pu))return;let t=e.createElement("style");t.id=Pu,t.textContent=Lu,(e.head??e.documentElement).append(t)}function ii(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(r){try{let n=t()?.getItem(`fieldia:${r}`);return n==null?null:JSON.parse(n)}catch{return null}},set(r,n){try{t()?.setItem(`fieldia:${r}`,JSON.stringify(n))}catch{}}}}function am(){let e=new Map;return{get:t=>e.has(t)?Au(e.get(t)):null,set:(t,r)=>{e.set(t,Au(r))}}}var Au=e=>JSON.parse(JSON.stringify(e));var si={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"}},cm=si.en,lm=0;function um(e,t){let r=e.ownerDocument,n=Jr(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
521
+ ${n.issues.map(y=>` ${y.path}: ${y.message}`).join(`
522
+ `)}`);let o=n.page,i=t.locale??"en",s=t.preferences??ii(),c=!t.form,a=t.form??Gr({...t,page:o,messages:t.messages??pt[i]}),l={...si[i],...t.labels},u=ke[i],f=t.dir??(i==="ar"?"rtl":void 0),g=`fd${++lm}`,d=[],h=[],m=y=>`${g}-${y.replace(/[^A-Za-z0-9_-]/g,"_")}`,b=(y,P)=>y.replace(/\{(\w+)\}/g,(O,H)=>String(P[H]??""));oi(r);function p(y,P={},...O){let H=r.createElement(y);for(let[C,M]of Object.entries(P))M!==void 0&&H.setAttribute(C,M);return H.append(...O),H}let w=p("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:f,lang:t.locale}),$=t.confirm??X;function E(y){let P=o.fields[y.field],O=m(y.id),H=p("div",{class:"fd-field","data-node":y.id,"data-field":y.field,"data-type":P.type});y.colspan&&H.style.setProperty("--fd-span",String(y.colspan));let C=p("label",{class:"fd-label",id:`${O}-label`,for:O},y.label??P.label),M=Ve({form:a,name:y.field,field:P,node:y,id:O,document:r,labels:u,preferences:s,locale:i},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(M.element.tagName)||(M.element.getAttribute("role")&&M.element.setAttribute("aria-labelledby",C.id),C.addEventListener("click",()=>M.focus()));let j=y.help??P.help,le=j?p("div",{class:"fd-help",id:`${O}-help`},j):null,F=p("div",{class:"fd-error",id:`${O}-error`,role:"alert",hidden:""}),D=p("div",{class:"fd-warning",role:"status",hidden:""});return H.append(C,M.element,...le?[le]:[],F,D),M.destroy&&h.push(()=>M.destroy?.()),d.push(Q=>{let _e=a.node(y.id);H.hidden=_e.invisible,H.classList.toggle("fd-required",_e.required);let Re=Q.errors[y.field];F.hidden=!Re,F.textContent=Re??"";let nt=Q.warning&&Q.warningField===y.field?Q.warning:"";D.hidden=!nt,D.textContent=nt,M.update({value:Q.values[y.field],values:Q.values,readonly:_e.readonly,required:_e.required,invalid:!!Re,describedBy:[le?.id,Re?F.id:void 0].filter(Boolean).join(" ")||void 0})}),H}function z(y,P){d.push(()=>{y.hidden=a.node(P).invisible})}function _(y){let P=p("button",{type:"button",class:`fd-button fd-button-${y.style??"secondary"}`,"data-node":y.id},y.label);return P.addEventListener("click",async()=>{y.confirm&&!await $(y.confirm)||await a.runAction(y.id)}),z(P,y.id),P}function V(y){let P=y.style??"paragraph",O=p(P==="heading"?"h3":"p",{class:`fd-text-${P}`,"data-node":y.id},y.text);return z(O,y.id),O}function T(y){let P=p("div",{class:"fd-slot","data-slot":y.name,"data-node":y.id}),O=t.slots?.[y.name]?.(P,{form:a,name:y.name});return O&&h.push(O),z(P,y.id),P}function Y(y,P=1){let O=p("div",{class:"fd-grid"});return O.style.setProperty("--fd-columns",String(P)),O.append(...y.map(re)),O}let ge=new Map;function B(y){let P=p("fieldset",{class:"fd-section","data-node":y.id}),O=y.description?p("p",{class:"fd-section-description"},y.description):null,H=Y(y.children,y.columns??1);if(y.title&&y.collapsible){H.id=m(`${y.id}-content`);let C=p("button",{type:"button",class:"fd-section-toggle","aria-controls":H.id},p("span",{class:"fd-section-chevron","aria-hidden":"true"}),y.title),M=y.collapsed!==!0,j=le=>{M=le,C.setAttribute("aria-expanded",String(M)),H.hidden=!M,O&&(O.hidden=!M),P.classList.toggle("fd-section-folded",!M)};C.addEventListener("click",()=>j(!M)),ge.set(P,()=>j(!0)),j(M),P.append(p("legend",{class:"fd-section-title"},C))}else y.title&&P.append(p("legend",{class:"fd-section-title"},y.title));return O&&P.append(O),P.append(H),z(P,y.id),P}function G(y){let P=p("div",{class:"fd-tabs","data-node":y.id}),O=p("div",{class:"fd-tablist",role:"tablist"}),H=null,C=y.children[0].id,M=y.children.map(j=>{let le=m(`${j.id}-tab`),F=m(`${j.id}-panel`),D=p("button",{type:"button",class:"fd-tab",role:"tab",id:le,"aria-controls":F,"data-node":j.id},j.label),Q=p("div",{class:"fd-tabpanel",role:"tabpanel",id:F,"aria-labelledby":le},Y(j.children));return D.addEventListener("click",()=>{H=C=j.id,me(a.getState())}),O.append(D),{tab:j,button:D,panel:Q}});return O.addEventListener("keydown",j=>{let le=M.filter(Re=>!Re.button.hidden),F=le.findIndex(Re=>Re.tab.id===C),D={ArrowRight:1,ArrowLeft:-1,Home:-F,End:le.length-1-F}[j.key];if(D===void 0||F===-1)return;j.preventDefault();let Q=w.getAttribute("dir")==="rtl"&&(j.key==="ArrowRight"||j.key==="ArrowLeft"),_e=le[(F+(Q?-D:D)+le.length)%le.length];H=C=_e.tab.id,me(a.getState()),_e.button.focus()}),P.append(O,...M.map(j=>j.panel)),d.push(()=>{P.hidden=a.node(y.id).invisible;let j=M.filter(F=>!a.node(F.tab.id).invisible);H!==null&&j.some(F=>F.tab.id===H)?C=H:j.length&&(C=j[0].tab.id);for(let F of M){let D=F.tab.id===C;F.button.hidden=!j.includes(F),F.button.setAttribute("aria-selected",String(D)),F.button.tabIndex=D?0:-1,F.panel.hidden=!D}}),P}function re(y){switch(y.type){case"field":return E(y);case"button":return _(y);case"text":return V(y);case"slot":return T(y);case"section":return B(y);case"tabs":return G(y)}}let ne=p("div",{class:"fd-status",role:"status","aria-live":"polite"});d.push(y=>{let P=y.status==="saving"?l.saving:y.status==="saved"?l.saved:y.status==="loading"?l.loading:y.status==="error"?y.error??"":"";ne.textContent=P,ne.classList.toggle("fd-status-error",y.status==="error"),ne.classList.toggle("fd-status-saved",y.status==="saved")});let W=p("div",{class:"fd-draft",hidden:""}),se=p("span"),L=p("button",{type:"button",class:"fd-button fd-button-primary"},l.restore),J=p("button",{type:"button",class:"fd-button fd-button-link"},l.discardDraft);L.addEventListener("click",()=>a.restoreDraft()),J.addEventListener("click",()=>a.discardDraft()),W.append(se,L,J),d.push(y=>{W.hidden=!y.draft,y.draft&&(se.textContent=b(l.draftFound,{time:new Date(y.draft.savedAt).toLocaleString()}))});function ae(){let y=w.querySelector('[aria-invalid="true"]');if(!y)return;for(let O=y.closest(".fd-section-folded");O;O=O.parentElement?.closest(".fd-section-folded")??null)ge.get(O)?.();if(!y.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(y.matches("input, select, textarea, button")?y:y.querySelector("input, select, textarea, button"))?.focus()}let ve=p("div",{class:"fd-done",hidden:""},p("p",{class:"fd-done-title"},l.submitted)),ze=p("button",{type:"button",class:"fd-button"},l.submitAnother);ve.append(ze);let Se=p("div",{class:"fd-content"});async function Ke(){if(!await a.save()){ae();return}o.data.kind==="responses"&&(Se.hidden=!0,ve.hidden=!1)}ze.addEventListener("click",()=>{a.reset(),Se.hidden=!1,ve.hidden=!0});function rt(){if(!o.title&&!o.description)return null;let y=p("header",{class:"fd-page-head"});return o.title&&y.append(p("h1",{class:"fd-page-title"},o.title)),o.description&&y.append(p("p",{class:"fd-page-description"},o.description)),y}function He(y){let P=p("div",{class:"fd-sections","data-node":y.id},...y.children.map(re)),O=p("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?l.submit:l.save),H=p("div",{class:"fd-actions fd-actions-end"},ne,O);if(o.data.kind==="record"){let C=p("button",{type:"button",class:"fd-button"},l.discard);C.addEventListener("click",()=>a.reset()),H.insertBefore(C,O),d.push(M=>{let j=M.dirty.length>0&&M.status!=="saving";O.hidden=!j,C.hidden=!j})}return p("div",{},P,H)}function x(y){let P=p("div",{class:"fd-wizard","data-node":y.id}),O=p("div",{class:"fd-progress-text"}),H=p("span");P.append(p("div",{class:"fd-progress"},O,p("div",{class:"fd-progress-bar"},H)));let C=y.children.map(D=>{let Q=p("section",{class:"fd-step","data-node":D.id,"aria-labelledby":m(`${D.id}-title`)});return Q.append(p("h2",{class:"fd-step-title",id:m(`${D.id}-title`)},D.label)),D.description&&Q.append(p("p",{class:"fd-section-description"},D.description)),Q.append(Y(D.children)),P.append(Q),{step:D,panel:Q}}),M=p("button",{type:"button",class:"fd-button"},l.back),j=p("button",{type:"submit",class:"fd-button fd-button-primary"});P.append(p("div",{class:"fd-wizard-nav"},M,p("span",{class:"fd-spacer"}),ne,j)),M.addEventListener("click",()=>{a.back()&&F()});let le=()=>{let D=a.steps();return D.indexOf(a.getState().step??"")===D.length-1};N=async()=>{if(le())return Ke();a.next()?F():ae()};function F(){C.find(Q=>Q.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return d.push(D=>{let Q=a.steps(),_e=Math.max(0,Q.indexOf(D.step??""));O.textContent=b(l.stepOf,{n:_e+1,total:Q.length}),H.style.width=`${(_e+1)/Math.max(1,Q.length)*100}%`;for(let{step:Re,panel:nt}of C)nt.hidden=Re.id!==D.step;M.hidden=_e===0,j.textContent=_e===Q.length-1?l.submit:l.next}),P}function k(y){let P=p("div",{class:"fd-sheet-page","data-node":y.id}),O=p("div",{class:"fd-actions"}),H=p("button",{type:"submit",class:"fd-button fd-button-primary"},l.save),C=p("button",{type:"button",class:"fd-button"},l.discard);C.addEventListener("click",()=>a.reset()),O.append(H,C,...(y.buttons??[]).map(_),ne),d.push(F=>{let D=F.dirty.length>0&&F.status!=="saving";H.hidden=!D,C.hidden=!D});let M=p("div",{class:"fd-header"},O);y.statusbar&&M.append(S(y.statusbar));let j=p("div",{class:"fd-card"});if(y.ribbon){let F=p("div",{class:`fd-ribbon fd-tone-${y.ribbon.tone??"muted"}`,"data-node":y.ribbon.id},y.ribbon.label);z(F,y.ribbon.id),j.append(p("div",{class:"fd-ribbon-frame"},F))}if(y.statButtons?.length){let F=p("div",{class:"fd-stats"});for(let D of y.statButtons){let Q=p("span",{class:"fd-stat-value"}),_e=p("button",{type:"button",class:"fd-stat","data-node":D.id},Q,p("span",{class:"fd-stat-label"},D.label));_e.addEventListener("click",()=>{a.runAction(D.id)}),d.push(Re=>{_e.hidden=a.node(D.id).invisible;let nt=D.field?Re.values[D.field]:null;Q.textContent=nt==null?"":String(nt)}),F.append(_e)}j.append(F)}for(let F of y.alerts??[]){let D=p("div",{class:`fd-alert fd-tone-${F.tone??"info"}`,role:"status","data-node":F.id},F.message);z(D,F.id),j.append(D)}if(y.title){let F=p("div",{class:"fd-title"});F.append(E({type:"field",id:"#title",field:y.title.field,placeholder:y.title.placeholder})),y.title.subtitleField&&F.append(E({type:"field",id:"#subtitle",field:y.title.subtitleField}));let D=p("div",{class:"fd-title-row"},F);if(y.title.avatarField){let Q=E({type:"field",id:"#avatar",field:y.title.avatarField});Q.classList.add("fd-avatar"),D.append(Q)}j.append(D)}j.append(Y(y.children));let le=p("div",{class:"fd-sheet-layout"},j);return y.sidePanel&&(le.classList.add("fd-has-side"),le.append(p("aside",{class:"fd-side"},T(y.sidePanel)))),P.append(M,le),P}function S(y){let P=o.fields[y.field],O={clickable:y.clickable===!0};y.visibleStates&&(O.visibleStates=y.visibleStates);let H={type:"field",id:"#statusbar",field:y.field,widget:"statusbar",options:O},C=Ve({form:a,name:y.field,field:P,node:H,id:m("statusbar"),document:r,labels:u,preferences:s,locale:i},t.widgets);return d.push(M=>C.update({value:M.values[y.field],values:M.values,readonly:a.node("#statusbar").readonly,required:!1,invalid:!1})),C.element}let N=null,Z=o.layout,U;Z.type==="sheet"?U=k(Z):Z.type==="wizard"?U=x(Z):Z.type==="tabs"?U=He({id:`${Z.id}-page`,children:[Z]}):U=He(Z);let ee=Z.type==="sheet"?null:rt();Se.append(...ee?[ee]:[],W,U),w.append(Se,ve),w.addEventListener("submit",y=>{y.preventDefault(),N?N():Ke()});function X(y){return new Promise(P=>{let O=p("p",{id:`${g}-confirm`},y),H=p("button",{type:"button",class:"fd-button"},l.cancel),C=p("button",{type:"button",class:"fd-button fd-button-primary"},l.ok),M=p("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":O.id},O,p("div",{class:"fd-actions fd-actions-end"},H,C)),j=p("div",{class:"fd-dialog-backdrop"},M),le=F=>{j.remove(),P(F)};H.addEventListener("click",()=>le(!1)),C.addEventListener("click",()=>le(!0)),j.addEventListener("keydown",F=>{F.key==="Escape"&&le(!1)}),w.append(j),C.focus()})}function me(y){for(let P of d)P(y)}e.append(w);let qe=a.subscribe(me);return me(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:w,setSkin(y){w.setAttribute("data-fd-skin",y)},destroy(){qe();for(let y of h)y();w.remove(),c&&a.dispose()}}}var dm="0.4.0";return Fu(fm);})();
451
523
  //# sourceMappingURL=fieldia.js.map