@golemui/core 1.0.0-rc.2 → 1.0.0-rc.4

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/index.umd.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("rxjs");require("@standard-schema/spec");function ht(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function pt(e){return e.issues===void 0}var Yt=class{constructor(e){this.value=e}map(e){return F(e(this.value))}isOk(){return!0}},Zt=class{constructor(e){this.error=e}map(e){return w(this.error)}isOk(){return!1}};function F(e){return new Yt(e)}function w(e){return new Zt(e)}var T=class Fe{constructor(t){this.decodeFn=t,this["~standard"]={version:1,vendor:"ts.data.json",validate:r=>{let n=this.decode(r);return n.isOk()?{value:n.value}:{issues:[{message:n.error}]}}},this.decodeToPromise=this.decodePromise,this.chain=this.flatMap}parse(t){let r=this.decode(t);if(r.isOk())return r.value;throw r.error}decode(t){return this.decodeFn(t)}decodePromise(t){return new Promise((r,n)=>{let i=this.decode(t);return i.isOk()?r(i.value):n(i.error)})}map(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?F(t(n.value)):w(n.error)})}flatMap(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?t(n.value).decode(r):w(n.error)})}},xt=(e,t,r)=>`<${e}> decoder failed at index "${t}" with error: ${r}`,q=(e,t)=>`${JSON.stringify(e)} is not a valid ${t}`;function Ne(e,t){return new T(r=>{if(r instanceof Array){let n=[];for(let i=0;i<r.length;i++){let o=e.decode(r[i]);if(o.isOk())n.push(o.value);else return w(xt(t,i,o.error))}return F(n)}else return w(q(r,"array"))})}function er(){return new T(e=>typeof e=="boolean"?F(e):w(q(e,"boolean")))}function gt(e){return new T(t=>e().decode(t))}var tr=(e,t)=>`${JSON.stringify(e)} is not exactly ${JSON.stringify(t)}`;function J(e){return new T(t=>t===e?F(e):w(tr(t,e)))}function $e(){return new T(e=>typeof e=="number"?F(e):w(q(e,"number")))}var rr=(e,t,r)=>`<${e}> decoder failed at key "${t}" with error: ${r}`;function re(e,t){return new T(r=>{if(r!==null&&typeof r=="object"){let n={};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let o,s=e[i];if(s instanceof T?o=s.decode(r[i]):o=s.decoder.decode(r[s.fromKey]),o.isOk())n[i]=o.value;else return w(rr(t,i,o.error))}return F(n)}else return w(q(r,t))})}var nr=(e,t)=>`<${e}> decoder failed because ${JSON.stringify(t)} can't be decoded with any of the provided oneOf decoders`;function K(e,t){return new T(r=>{for(let n=0;n<e.length;n++){let i=e[n].decode(r);if(i.isOk())return i}return w(nr(t,r))})}function y(e){return new T(t=>t===void 0?F(void 0):e.decode(t))}var ir=(e,t,r)=>`<${e}> record decoder failed at key "${t}" with error: ${r}`;function or(e,t){return new T(r=>{if(r!==null&&typeof r=="object"){let n={};for(let i in r)if(Object.prototype.hasOwnProperty.call(r,i)){let o=e.decode(r[i]);if(o.isOk())n[i]=o.value;else return w(ir(t,i,o.error))}return F(n)}else return w(q(r,t))})}function C(){return new T(e=>typeof e=="string"?F(e):w(q(e,"string")))}function G(){return new T(e=>F(e))}function ne(e,t){return new T(r=>{if(typeof r!="object"||r===null)return w(`<${t}> failed. Expected object literal, got "${typeof r}"`);const n={};for(const[i,o]of Object.entries(e)){const s=o.decoder.decode(r[i]);if(!s.isOk())return w(`<${t}> failed at "${i}" with ${s.error}`);if(n[i]=s.value,o.suffixed){for(const[u,c]of Object.entries(r))if(u.startsWith(i+".")){const a=o.decoder.decode(c);if(!a.isOk())return w(`<${t}> failed at "${u}" with ${a.error}`);n[u]=a.value}}}return F(n)})}const Ve=()=>crypto.randomUUID().slice(0,8),sr=e=>typeof e!="function"&&e.kind==="display",x=e=>typeof e!="function"&&e.kind==="action",O=e=>typeof e!="function"&&e.kind==="input",We=e=>typeof e!="function"&&e.kind==="layout",ie=e=>typeof e=="function",dr=re({in:Ne(C(),"In[]")},"In"),Le=re({when:C()},"When"),Ae=K([dr,Le],"In | When"),ur=re({from:Ne(C(),"From[]")},"From"),Se=K([ur,Le],"Exclude"),ke=K([er(),Le],"Bool | When"),cr=new T(e=>{const t=typeof e;return t==="function"?F(e):w(`Expected a function, got '${t}'`)}),V=e=>K([e,cr],""),Re=ne({load:{suffixed:!0,decoder:V(y(C()))},click:{suffixed:!0,decoder:V(y(C()))},change:{suffixed:!0,decoder:V(y(C()))},filter:{suffixed:!0,decoder:V(y(C()))},blur:{suffixed:!0,decoder:V(y(C()))}},"On"),lr=re({key:C(),default:y(C()),params:y(G())},"TranslationConfig"),mt=K([C(),lr],"Localizable"),Me=y(C()).map(e=>e||Ve()),ar=ne({kind:{decoder:J("display")},uid:{decoder:Me},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},props:{decoder:y(G())}},"DisplayWidget"),fr=ne({kind:{decoder:J("action")},uid:{decoder:Me},type:{decoder:C()},actionType:{decoder:y(K([J("button"),J("submit")],"button | submit "))},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},label:{suffixed:!0,decoder:V(y(mt))},disabled:{suffixed:!0,decoder:y(ke)},on:{decoder:y(Re)},props:{decoder:y(G())}},"ActionWidget"),hr=new T(e=>{const t=typeof e;if(t==="function"){const r=e,n=r(void 0);return r.uid=n.uid||Ve(),r.type=n.type,r.path=n.path,F(r)}else return w(`Expected a function, got '${t}'`)}),pr=ne({kind:{decoder:J("input")},uid:{decoder:y(C())},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},disabled:{suffixed:!0,decoder:y(ke)},readonly:{suffixed:!0,decoder:y(ke)},on:{decoder:y(Re)},props:{decoder:y(G())},label:{suffixed:!0,decoder:V(y(mt))},path:{decoder:C()},defaultValue:{decoder:y(G())},validator:{suffixed:!0,decoder:V(y(G()))}},"InputWidget").map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;r.template=Be.parse(r.template)}return t}),gr=gt(()=>K([hr,pr,Be,ar,fr],"FormWidget")),Be=ne({kind:{decoder:J("layout")},uid:{decoder:Me},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},props:{decoder:y(G())},on:{decoder:y(Re)},children:{decoder:Ne(gr,"FormWidget[]")}},"LayoutWidget"),B=class B{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!B.sharedCache.has(r)){const n=r().catch(i=>(B.sharedCache.delete(r),Promise.reject(i)));B.sharedCache.set(r,n)}return B.sharedCache.get(r)}};B.sharedCache=new Map;let Pe=B;function mr(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const yt=re({states:y(or(C(),"states")),form:gt(()=>Be)},"FormDef"),$t=e=>({formName:"",formDef:yt.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,lang:e}),yr=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function $r(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const At=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(i=>i(e))}}},Ar=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function P(e,...t){return t.reduce((r,n)=>n(r),e)}function Sr(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");const n=t.payload.widget,i=e.touched&&O(n)?{...e.touchedControls,[n.path]:!0}:e.touchedControls;return{...e,touchedControls:i,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:n,current:{}}}}}const Q={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},oe=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},He=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let i=e;for(let s=0;s<n.length-1;s++){const u=n[s],c=n[s+1];(i[u]==null||typeof i[u]!="object")&&(i[u]=Er(c)?[]:{}),i=i[u]}const o=n[n.length-1];return i[o]=r,e},vr=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let s=0;s<r.length-1;s++){const u=n[s];if(u==null||typeof u!="object")return e;const c=r[s],a=Array.isArray(u)?u[parseInt(c,10)]:u[c];if(a==null||typeof a!="object")return e;n.push(a)}const i=n[n.length-1],o=r[r.length-1];Array.isArray(i)?i.splice(parseInt(o,10),1):delete i[o];for(let s=n.length-1;s>=1;s--){const u=n[s];if(Array.isArray(u)||!Cr(u))break;const c=n[s-1],a=r[s-1];if(Array.isArray(c))break;delete c[a]}return e};function Er(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Cr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const ve=(e,t)=>(delete e[t],e);function ae(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>ae(r));const t={};for(const r of Object.keys(e))t[r]=ae(e[r]);return t}function Ge(e){return e.flatMap(t=>[t,...We(t)?Ge(t.children):[]])}function Ke(e){return Object.entries(e.validations).reduce((r,[n,i])=>(i!==null&&(r.$formIsInvalid=!0,He(r.$errors,n,[...i])),r),{$formIsInvalid:!1,$errors:{}})}function we(e){const t=ae(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const i=e.flatForm[r];i&&O(i)&&vr(t,i.path)}return t}const Xe=32;let je,p,g,$=e=>(p=0,g=e,$.newline=!1,e=v(),g[p]?X():e||""),X=(e="Unexpected token",t=p,r=g.slice(0,t).split(`
2
- `),n=r.pop(),i=g.slice(Math.max(0,t-40),t),o="̭",s=(g[t]||" ")+o,u=g.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
- ${g[t-41]!==`
4
- `,""+i}${s}${u}`)},St=(e,t=p)=>(Array.isArray(e)&&(e.loc=t),e),b=(e,t=p,r)=>{for(;r=e(g.charCodeAt(p));)p+=r;return g.slice(t,p)},I=(e=1)=>g[p+=e],_e=e=>p=e,v=(e=0,t)=>{let r,n,i,o,s;for(t&&$.asi&&($.newline=!1);(r=$.space())&&(s=$.newline,1)&&r!==t&&(i=(n&&r===91&&je&&$.asi?.(n,e,v)||null)??((o=k[r])&&o(n,e))??(n&&s&&$.asi?.(n,e,v))??(!n&&b($.id)));)n=i;return t&&(r==t?(p++,t===125&&$.asi&&($.newline=!0)):X("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},R=(e,t=p)=>{for(je=!1;(e=g.charCodeAt(p))<=Xe;)$.asi&&e===10&&($.newline=je=!0),p++;return e},wr=(e=p)=>{for(;g.charCodeAt(e)<=Xe;)e++;return g.charCodeAt(e)};$.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Ir=(e,t=e.length)=>g.substr(p,t)===e&&!$.id(g.charCodeAt(p+t)),k=[],st={},W=(e,t=Xe,r,n=e.charCodeAt(0),i=e.length,o=k[n],s=e.toUpperCase()!==e,u,c)=>(t=st[e]=!o&&st[e]||t,k[n]=(a,S,m,h=p)=>(u=m,(m?e==m:(i<2||e.charCodeAt(1)===g.charCodeAt(p+1)&&(i<3||g.substr(p,i)==e))&&(!s||!$.id(g.charCodeAt(p+i)))&&(u=m=e))&&S<t&&(p+=i,(c=r(a))?St(c,h):(p=h,u=0,!s&&!o&&!a&&X()),c)||o?.(a,S,u))),A=(e,t,r=!1)=>W(e,t,n=>n&&(i=>i&&[e,n,i])(v(t-(r?.5:0)))),M=(e,t,r)=>W(e,t,n=>!n&&(n=v(t-.5))&&[e,n]),se=(e,t)=>W(e,200,r=>!r&&[,t]),vt=(e,t,r)=>W(e,t,(n,i)=>(i=v(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),i?.[0]===e?n.push(...i.slice(1)):n.push(i||null),n)),ze=(e,t)=>W(e[0],t,r=>!r&&[e,v(0,e.charCodeAt(1))||null]),Et=(e,t)=>W(e[0],t,r=>r&&[e,r,v(0,e.charCodeAt(1))||null]),de=(e,t,r,n=e.charCodeAt(0),i=e.length,o=k[n],s)=>k[n]=(u,c,a,S=p)=>!u&&(a?e==a:(i<2||g.substr(p,i)==e)&&(a=e))&&c<t&&!$.id(g.charCodeAt(p+i))&&(!$.prop||$.prop(p+i))&&(_e(p+i),(s=r())?St(s,S):_e(S),s)||o?.(u,c,a);Object.defineProperty($,"space",{configurable:!0,enumerable:!0,get:()=>R,set:e=>R=e});const Ue={},l=(e,t,r=Ue[e])=>Ue[e]=(...n)=>t(...n)||r?.(...n),d=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):Ue[e[0]]?.(...e.slice(1))??X(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],fe=46,ee=48,he=57,Or=69,Dr=101,Tr=43,Fr=45,le=95,Ct=110,Wr=97,kr=102,Pr=65,jr=70,wt=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),Je=e=>{let t=wt(b(r=>r===fe&&g.charCodeAt(p+1)!==fe||r>=ee&&r<=he||r===le||((r===Or||r===Dr)&&((r=g.charCodeAt(p+1))>=ee&&r<=he||r===Tr||r===Fr)?2:0)));return g.charCodeAt(p)===Ct?(I(),[,BigInt(t)]):(e=+t)!=e?X():[,e]},_r={2:e=>e===48||e===49||e===le,8:e=>e>=48&&e<=55||e===le,16:e=>e>=ee&&e<=he||e>=Wr&&e<=kr||e>=Pr&&e<=jr||e===le};$.number=null;k[fe]=e=>!e&&g.charCodeAt(p+1)!==fe&&Je();for(let e=ee;e<=he;e++)k[e]=t=>t?void 0:Je();k[ee]=e=>{if(e)return;const t=$.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&g[p+1]?.toLowerCase()===r[1]){I(2);const i=wt(b(_r[n]));return g.charCodeAt(p)===Ct?(I(),[,BigInt("0"+r[1]+i)]):[,parseInt(i,n)]}}return Je()};const Ur=92,dt=34,ut=39,Nr={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},It=e=>(t,r,n="")=>{if(!(t||!$.string?.[String.fromCharCode(e)]))return I(),b(i=>i-e&&(i===Ur?(n+=Nr[g[p+1]]||g[p+1],2):(n+=g[p],1))),g[p]===String.fromCharCode(e)?I():X("Bad string"),[,n]};k[dt]=It(dt);k[ut]=It(ut);$.string={'"':!0};const Vr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>A(e,Vr,!0));const Ot=(e,t,r,n)=>typeof e=="string"?i=>t(i,e,i):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n,i)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i),i)):e[0]==="()"&&e.length===2?Ot(e[1],t):(()=>{throw Error("Invalid assignment target")})(),ct={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in ct)l(e,(t,r)=>(r=d(r),Ot(t,(n,i,o)=>ct[e](n,i,r(o)))));const Lr=30,Rr=40,Mr=140;M("!",Mr);A("||",Lr);A("&&",Rr);l("!",e=>(e=d(e),t=>!e(t)));l("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));l("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Br=50,Hr=60,Gr=70,Dt=100,Kr=140;A("|",Br);A("&",Gr);A("^",Hr);A(">>",Dt);A("<<",Dt);M("~",Kr);l("~",e=>(e=d(e),t=>~e(t)));l("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));l("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));l("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));l(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));l("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const Ee=90;A("<",Ee);A(">",Ee);A("<=",Ee);A(">=",Ee);l(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));l("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));l(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));l("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Tt=80;A("==",Tt);A("!=",Tt);l("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));l("!=",(e,t)=>(e=d(e),t=d(t),r=>e(r)!=t(r)));const Ft=110,Qe=120,Wt=140;A("+",Ft);A("-",Ft);A("*",Qe);A("/",Qe);A("%",Qe);M("+",Wt);M("-",Wt);l("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));l("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));l("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));l("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));l("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const pe=150;W("++",pe,e=>e?["++",e,null]:["++",v(pe-1)]);W("--",pe,e=>e?["--",e,null]:["--",v(pe-1)]);const qe=(e,t,r,n)=>typeof e=="string"?i=>t(i,e):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i))):e[0]==="()"&&e.length===2?qe(e[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(e,t)=>qe(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));l("--",(e,t)=>qe(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Xr=5,zr=10;vt(",",zr);vt(";",Xr,!0);const kt=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});l(",",kt);l(";",kt);const Jr=170;ze("()",Jr);const L=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",be=170;Et("[]",be);A(".",be);Et("()",be);const ge=e=>{throw Error(e)};l("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=d(r[1]),n=>r(n)):(r=d(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&ge("Missing index"),e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)[n]}));l(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],L(t)?()=>{}:r=>e(r)[t]));l("()",(e,t)=>{if(t===void 0)return e==null?ge("Empty ()"):d(e);const r=i=>i?.[0]===","&&i.slice(1).some(o=>o==null||r(o));r(t)&&ge("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),i=>t.map(o=>o(i))):(t=d(t),i=>[t(i)]):()=>[];return Ye(e,(i,o,s)=>i[o](...n(s)))});const z=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&z(e[1])||e[0]==="{}"),Ye=(e,t,r,n)=>e==null?ge("Empty ()"):e[0]==="()"&&e.length==2?Ye(e[1],t):typeof e=="string"?i=>t(i,e,i):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n,i)):e[0]==="?."?(r=d(e[1]),n=e[2],i=>{const o=r(i);return o==null?void 0:t(o,n,i)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i),i)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),i=>{const o=r(i);return o==null?void 0:t(o,n(i),i)}):(e=d(e),i=>t([e(i)],0,i)),Y=Ye,Qr=32,qr=$.space;$.comment??={"//":`
6
- `,"/*":"*/"};let Ie;$.space=()=>{Ie||(Ie=Object.entries($.comment).map(([i,o])=>[i,o,i.charCodeAt(0)]));for(var e;e=qr();){for(var t=0,r;r=Ie[t++];)if(e===r[2]&&g.substr(p,r[0].length)===r[0]){var n=p+r[0].length;if(r[1]===`
7
- `)for(;g.charCodeAt(n)>=Qr;)n++;else{for(;g[n]&&g.substr(n,r[1].length)!==r[1];)n++;g[n]&&(n+=r[1].length)}_e(n),e=0;break}if(e)return e}return e};const Pt=80;A("===",Pt);A("!==",Pt);l("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));l("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const br=30;A("??",br);l("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const Yr=130,Zr=20;A("**",Yr,!0);A("**=",Zr,!0);l("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const xr=e=>{throw Error(e)};l("**=",(e,t)=>(z(e)||xr("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]**=t(i))));const jt=90;A("in",jt);A("of",jt);l("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const en=20,tn=100,rn=e=>{throw Error(e)};A(">>>",tn);A(">>>=",en,!0);l(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));l(">>>=",(e,t)=>(z(e)||rn("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]>>>=t(i))));const Ze=5,nn=10,on=20,sn=e=>e[0]?.[0]===","?e[0].slice(1):e,me=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...i]=e,o=sn(i);if(n==="{}"){const s=[];for(const u of o){if(Array.isArray(u)&&u[0]==="..."){const h={};for(const D in t)s.includes(D)||(h[D]=t[D]);r[u[1]]=h;break}let c,a,S;typeof u=="string"?c=a=u:u[0]==="="?(typeof u[1]=="string"?c=a=u[1]:[,c,a]=u[1],S=u[2]):[,c,a]=u,s.push(c);let m=t[c];m===void 0&&S&&(m=d(S)(r)),me(a,m,r)}}else if(n==="[]"){let s=0;for(const u of o){if(u===null){s++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(s);break}let c=u,a;Array.isArray(u)&&u[0]==="="&&([,c,a]=u);let S=t[s++];S===void 0&&a&&(S=d(a)(r)),me(c,S,r)}}},_t=e=>{let t=v(nn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};de("let",Ze+1,()=>_t("let"));de("const",Ze+1,()=>_t("const"));de("var",Ze,()=>(R(),["var",v(on)]));const Ut=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,i=d(n);return typeof r=="string"?o=>{o[r]=i(o)}:o=>me(r,i(o),o)}return d(t)}),t=>{for(const r of e)r(t)});l("let",Ut);l("const",Ut);l("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const xe=20,Ce=e=>{throw Error(e)};A("||=",xe,!0);A("&&=",xe,!0);A("??=",xe,!0);l("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=d(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>me(r,t(n),n)}return z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]=t(i))});l("||=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]||=t(i))));l("&&=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]&&=t(i))));l("??=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]??=t(i))));se("true",!0);se("false",!1);se("null",null);de("undefined",200,()=>[]);se("NaN",NaN);se("Infinity",1/0);const Oe=20;W("?",Oe,(e,t,r)=>e&&(t=v(Oe-1))&&b(n=>n===58)&&(r=v(Oe-1),["?",e,t,r]));l("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const dn=[],un=20;A("=>",un,!0);l("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,i=null;const o=r[r.length-1];Array.isArray(o)&&o[0]==="..."&&(n=r.length-1,i=o[1],r.length--);const s=t?.[0]==="{}";return t=d(s?["{",t[1]]:t),u=>(...c)=>{const a={};r.forEach((m,h)=>a[m]=c[h]),i&&(a[i]=c.slice(n));const S=new Proxy(a,{get:(m,h)=>h in m?m[h]:u?.[h],set:(m,h,D)=>((h in m?m:u)[h]=D,!0),has:(m,h)=>h in m||(u?h in u:!1)});try{const m=t(S);return s?void 0:m}catch(m){if(m===dn)return m[0];throw m}}});const cn=140;M("...",cn);l("...",e=>(e=d(e),t=>Object.entries(e(t))));const lt=170;W("?.",lt,(e,t)=>{if(!e)return;const r=R();return r===40?(I(),["?.()",e,v(0,41)||null]):r===91?(I(),["?.[]",e,v(0,93)]):(t=v(lt),t?["?.",e,t]:void 0)});l("?.",(e,t)=>(e=d(e),L(t)?()=>{}:r=>e(r)?.[t]));l("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)?.[n]}));l("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),i=>t.map(o=>o(i))):(t=d(t),i=>[t(i)]):()=>[];if(e[0]==="?."){const i=d(e[1]),o=e[2];return L(o)?()=>{}:s=>i(s)?.[o]?.(...r(s))}if(e[0]==="?.[]"){const i=d(e[1]),o=d(e[2]);return s=>{const u=i(s),c=o(s);return L(c)?void 0:u?.[c]?.(...r(s))}}if(e[0]==="."){const i=d(e[1]),o=e[2];return L(o)?()=>{}:s=>i(s)?.[o]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const i=d(e[1]),o=d(e[2]);return s=>{const u=i(s),c=o(s);return L(c)?void 0:u?.[c]?.(...r(s))}}const n=d(e);return i=>n(i)?.(...r(i))});const te=140;M("typeof",te);M("void",te);M("delete",te);de("new",te,()=>Ir(".target")?(I(7),["new.target"]):["new",v(te)]);l("typeof",e=>(e=d(e),t=>typeof e(t)));l("void",e=>(e=d(e),t=>(e(t),void 0)));l("delete",e=>{if(e[0]==="."){const t=d(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=d(e[1]),r=d(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});l("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(i=>o=>i.map(s=>s(o)))(r.slice(1).map(d)):(i=>o=>[i(o)])(d(r)):()=>[];return i=>new(t(i))(...n(i))});const et=Symbol("accessor"),tt=20,ln=40,Nt=41,Vt=123,Lt=125,Rt=e=>t=>{if(t)return;R();const r=b($.id);if(!r||(R(),g.charCodeAt(p)!==ln))return!1;I();const n=v(0,Nt);return R(),g.charCodeAt(p)!==Vt?!1:(I(),[e,r,n,v(0,Lt)])};W("get",tt-1,Rt("get"));W("set",tt-1,Rt("set"));W("(",tt-1,e=>{if(!e||typeof e!="string")return;const t=v(0,Nt)||null;if(R(),g.charCodeAt(p)===Vt)return I(),[":",e,["=>",["()",t],v(0,Lt)||null]]});l("get",(e,t)=>(t=t?d(t):()=>{},r=>[[et,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));l("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[et,e,{set:function(i){const o=Object.create(n||{});o.this=this,o[t]=i,r(o)}}]]));const an=20,Mt=200;$.prop=e=>wr(e)!==58;const fn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);ze("[]",Mt);ze("{}",Mt);A(":",an-1,!0);l("{}",(e,t)=>{if(t!==void 0)return;if(!fn(e))return d(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>d(typeof n=="string"?[":",n,n]:n));return n=>{const i={},o={};for(const s of r.flatMap(u=>u(n)))if(s[0]===et){const[,u,c]=s;o[u]={...o[u],...c,configurable:!0,enumerable:!0}}else i[s[0]]=s[1];for(const s in o)Object.defineProperty(i,s,o[s]);return i}});l("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));l(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const hn=170,ye=96,pn=36,gn=123,mn=92,yn={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},at=()=>{const e=[];for(let t="",r;(r=g.charCodeAt(p))!==ye;)r?r===mn?(I(),t+=yn[g[p]]||g[p],I()):r===pn&&g.charCodeAt(p+1)===gn?(t&&e.push([,t]),t="",I(2),e.push(v(0,125))):(t+=g[p],I(),r=g.charCodeAt(p),r===ye&&t&&e.push([,t])):X("Unterminated template");return I(),e},$n=k[ye];k[ye]=(e,t)=>e&&t<hn?$.asi&&$.newline?void 0:(I(),["``",e,...at()]):e?$n?.(e,t):(I(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(at()));l("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));l("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const o of t)Array.isArray(o)&&o[0]===void 0?r.push(o[1]):n.push(d(o));const i=Object.assign([...r],{raw:r});return o=>e(o)(i,...n.map(s=>s(o)))});$.string["'"]=!0;$.number={"0x":16,"0b":2,"0o":8};const An={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function _(e,t,r,n,i){const o=$(rt(e));return d(o)({$form:t,$meta:r,$errors:n,$formIsInvalid:i,$log:An.log})===!0}function rt(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const U=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Ke(e);t=Sn(t);let i=[],o={status:"ok"};try{i=Object.keys(t).map(s=>{const u=t[s];let c;try{c=_(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?s:void 0}).filter(s=>s!==void 0)}catch(s){const u=s,c=Q.calculateCurrentStateError;o={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:i,formHealth:o}};function Sn(e){const t={};function r(n){const i=n.split(":"),o=[];for(let s=0;s<i.length;s++)o.push(i.slice(0,s+1).join(":"));return o}for(const[n,i]of Object.entries(e)){const o=r(n),s=[];for(const u of o)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const nt=Symbol("filterMap.skip");function Bt(e,t){const r=[];for(let n=0;n<e.length;n++){const i=t(e[n],n,e);i!==nt&&r.push(i)}return r}function vn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function En(e,t,r,n){let i=n;for(let o=0;o<e.length;o++)t(e[o],o,e)&&(i=r(i,e[o],o,e));return i}function Cn(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function Ht(e,t){const r=Gt(e.uid,t);return O(e)?{...e,uid:r,path:wn(e.path,t)}:{...e,uid:r}}function Gt(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,i)=>`${n}[${i}]`,"");return`${e}${r}`}function wn(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),i=n.length-1;if(i!==t.length)throw new Error(`Path contains ${i} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((o,s,u)=>u===0?s:`${o}.${t[u-1]}${s}`)}function ue(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,i)=>{const o=t[r++];return o===void 0?n:`.${o}${i}.`})}const ce=(e,t)=>r=>e(r)?t(r):r,H=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,N=e=>{const{$formIsInvalid:t,$errors:r}=Ke(e);return{...e,widgetFlags:{...In(e,r,t),...On(e,r,t)}}};function In(e,t,r){return Bt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return nt;if(ie(n)){const i=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return i.uid=n.uid,i}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(O(n)||x(n))&&H(n.disabled)||O(n)&&H(n.readonly))).reduce((n,i)=>(n[i.uid]=n[i.uid]||{},i.include&&"in"in i.include?n[i.uid].hidden=!i.include.in.some(o=>e.currentStates.includes(o)):i.include&&"when"in i.include&&(n[i.uid].hidden=!_(i.include.when,e.data,e.meta,t,r)),i.exclude&&"from"in i.exclude?n[i.uid].hidden=i.exclude.from.some(o=>e.currentStates.includes(o)):i.exclude&&"when"in i.exclude&&(n[i.uid].hidden=_(i.exclude.when,e.data,e.meta,t,r)),(O(i)||x(i))&&H(i.disabled)&&(n[i.uid].disabled=_(i.disabled.when,e.data,e.meta,t,r)),O(i)&&H(i.readonly)&&(n[i.uid].readonly=_(i.readonly.when,e.data,e.meta,t,r)),n),{})}function On(e,t,r){return En(Object.values(e.flatForm),n=>!ie(n)&&n.type==="repeater",(n,i)=>({...n,...Kt(e,i,[],t,r)}),{})}function Kt(e,t,r,n,i){const o=t.props.template,s=oe(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,a)=>{const S=[...r,a];Ge([o]).forEach(m=>{let h;if(ie(m)?(h=m({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),h.uid=m.uid):h=m,h.type==="repeater"){const Z=Ht(h,S);Object.assign(u,Kt(e,Z,S,n,i));return}const D=Gt(h.uid,S);u[D]=u[D]||{},h.include&&"in"in h.include?u[D].hidden=!h.include.in.some(Z=>e.currentStates.includes(Z)):h.include&&"when"in h.include&&(u[D].hidden=!_(ue(h.include.when,S),e.data,e.meta,n,i)),h.exclude&&"from"in h.exclude?u[D].hidden=h.exclude.from.some(Z=>e.currentStates.includes(Z)):h.exclude&&"when"in h.exclude&&(u[D].hidden=_(ue(h.exclude.when,S),e.data,e.meta,n,i)),(O(h)||x(h))&&H(h.disabled)&&(u[D].disabled=_(ue(h.disabled.when,S),e.data,e.meta,n,i)),O(h)&&H(h.readonly)&&(u[D].readonly=_(ue(h.readonly.when,S),e.data,e.meta,n,i))})}),u}const j=e=>t=>{try{return{...t,calculatedWidgets:Dn(t,e)}}catch(r){const n=r;return{...t,formHealth:{status:"errored",message:`[${n.code}] ${n.message}`,code:n.code}}}};function Dn(e,t){const{$formIsInvalid:r,$errors:n}=Ke(e),i=zn(e,t,r,n),o={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(ie(c)){o[s]=Tn(s,c,e,t);continue}o[s]=Fn(u,c,e,i)}return o}function Tn(e,t,r,n){const i=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return i.uid=e,{source:t,current:i}}function Fn(e,t,r,n){const i=new Xn(t,e.current);return i.write("uid",t.uid),i.write("type",t.type),i.write("kind",t.kind),sr(t)?Wn(i,n):x(t)?kn(i,n):O(t)?Pn(i,n):We(t)&&jn(i,n),_n(t,i,n,r),(x(t)||O(t))&&Un(t,i,n),We(t)&&Nn(t,i,r),i.changed?{source:e.source,current:i.current}:e}function Wn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function kn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Pn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function jn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function _n(e,t,r,n){const i=n.widgetPropOverrides[e.uid]??{},o={...e.props??{},...i};for(const s of Jt(Object.keys(o)))Vn(t,r,s)}function Un(e,t,r){const n=e.on??{};for(const i of Jt(Object.keys(n)))Ln(t,r,i)}function Nn(e,t,r){const n=qn(e.uid),i=Qn(e.children,n,r.widgetFlags);t.current.children=i;const o=t.previous.children??[];o.length===i.length&&i.every((u,c)=>o[c]&&o[c].uid===i[c].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!Jn(n,r))return;const i=ot(n,r,t.sortedStates);let o;switch(r){case"disabled":case"readonly":o=Bn(i,t,e.source.uid,r);break;case"defaultValue":o=i;break;default:o=zt(i,t)}e.write(r,o)}function Vn(e,t,r){const n=e.source.props,i=ot(n,r,t.sortedStates);let o=zt(i,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(o=s),e.write(`props.${r}`,o)}function Ln(e,t,r){const n=e.source.on,i=ot(n,r,t.sortedStates);e.write(`on.${r}`,Hn(i,t))}function it(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Rn(e,t){return t.localization.translate(e.key,Kn(e.params,t),e.default)}const Mn=/\{\{([^}]+)\}\}/g;function Xt(e,t){return e.includes("{{")?e.replace(Mn,(r,n)=>{const i=rt(n.trim());try{const o=d($(i))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});return o==null?"":String(o)}catch(o){const s=o instanceof Error?o.message:String(o);throw new Qt(`Failed to evaluate '{{${n.trim()}}}': ${s}`)}}):e}function zt(e,t){return typeof e=="function"?it(e,t):yr(e)?Rn(e,t):typeof e=="string"?Xt(e,t):e}function Bn(e,t,r,n){return typeof e=="function"?it(e,t):H(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Xt(e,t):e}function Hn(e,t){return typeof e=="function"?it(e,t):e}function ot(e,t,r){if(e){for(const n of r){const i=e[`${t}.${n}`];if(i!==void 0)return i}return e[t]}}function Gn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e==="$formIsInvalid"}function Kn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const i=String(e[n]);if(Gn(i))try{const o=d($(rt(i)))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});r[n]=o??i}catch(o){const s=o instanceof Error?o.message:String(o);throw new Qt(`Failed to evaluate i18n param '${i}': ${s}`)}else r[n]=i;return r},{})}class Xn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){He(this.current,t,r),oe(this.previous,t)!==r&&(this._changed=!0)}}function zn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((i,o)=>o.length-i.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function Jn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function Jt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function Qn(e,t,r){const n=t.map(i=>`[${i}]`).join("");return e.filter(i=>{const o=i.uid+n,s=r[o];return!s||s.hidden!==!0})}const qn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10));class Qt extends Error{constructor(){super(...arguments),this.code=Q.resolveStringInterpolationError,this.name="StringInterpolationError"}}const bn=({lang:e},t)=>{const r={...$t(e),formName:t.payload.formName};let n=t.payload.formDef,i={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(u){const c=u,a=Q.initializeParseError;i={status:"errored",message:`[${a}] ${c.message}`,code:a}}if(i.status==="errored")return{...r,formHealth:i}}if(Array.isArray(n.form)){const u=n,c=u.form;u.form={uid:"",type:"flex",kind:"layout",children:c}}const o=yt.decode(n);if(o.isOk()){i={status:"ok"};let u={};try{u=Ge([o.value.form]).reduce((c,a)=>{const S=a.uid;if(c[S])throw{existingWidget:c[S],newWidget:a};return c[S]=a,c},{})}catch(c){const a=Q.initializeUidCollisionError;i={status:"errored",message:`[${a}] ${Yn(c.existingWidget,c.newWidget)}`,code:a},u={}}return{...r,formDef:o.value,flatForm:u,formHealth:i}}const s=Q.initializeUnknownError;return{...r,formHealth:{status:"errored",message:`[${s}] ${o.error}`,code:s}}};function Yn(e,t){const r=n=>O(n)?` at "${n.path}"`:"";return`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`}function Zn(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const xn=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:o})=>O(o)&&o.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=r.source.uid,i=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...i,[t.prop]:t.value}}}};function ei(e,t){return P(e,ti(t),ri(t),ni(t),ii(t))}const ti=e=>t=>({...t,widgetFlags:{...ve(t.widgetFlags,e.payload.uid)}}),ri=e=>t=>({...t,calculatedWidgets:{...ve(t.calculatedWidgets,e.payload.uid)}}),ni=e=>t=>({...t,widgetPropOverrides:{...ve(t.widgetPropOverrides,e.payload.uid)}}),ii=e=>t=>({...t,touchedControls:P(t.touchedControls,r=>{const n=t.flatForm[e.payload.uid];return n&&O(n)?ve(r,n.path):r})}),oi=(e,t)=>({...e,data:{...t.payload.data}}),si=(e,t)=>({...e,formHealth:t.payload.formHealth}),di=(e,t)=>({...e,lang:t.payload.lang}),ui=(e,t)=>({...e,meta:{...t.payload.meta}}),ci=(e,t)=>{const r=oe(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...He(e.data,t.payload.path,t.payload.data)}}:e},De=(e,t)=>r=>{const n=Bt(Object.values(r.calculatedWidgets),({current:o})=>O(o)?o:nt),i=r.validations;return{...r,validations:n.reduce((o,s)=>{if(o[s.path]=null,s.validator){const u=e(s.validator,t),c=oe(r.data,s.path),a=ht(u,c);o[s.path]=pt(a)?null:a.issues.map(S=>S.message)}return Array.isArray(o[s.path])&&Array.isArray(i[s.path])&&Cn(o[s.path],i[s.path],(u,c)=>u===c)&&(o[s.path]=i[s.path]),o},{})}},li=({validators:e,validateOn:t,localization:r})=>(n,i)=>{switch(i.type){case"INITIALIZE":return bn(n,i);case"SET_DATA":return P(oi(n,i),U,N,j(r));case"SET_META":return P(ui(n,i),U,N,j(r));case"SET_LANGUAGE":return P(di(n,i),j(r));case"ADD_WIDGET":return P(Sr(n,i),ce(Te,U),ce(Te,N),ce(Te,j(r)));case"REMOVE_WIDGET":return P(ei(n,i),U,N,j(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return P(ci(n,i),U,N,j(r));case"OVERRIDE_WIDGET_PROP":return P(xn(n,i),U,N,j(r),ce(o=>{let s=!1,u="";"path"in i.payload?(s=!0,u=i.payload.path):O(o.calculatedWidgets[i.payload.uid].current)&&(s=!0,u=o.calculatedWidgets[i.payload.uid].current.path);const c=s&&o.touchedControls[u];return o.touched&&c},De(e,r)));case"SET_FORM_HEALTH":return si(n,i);case"VALIDATE_ALL":return P({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((o,s)=>{const u=n.calculatedWidgets[s].source;return O(u)&&(o[u.path]=!0),o},{})},De(e,r),U,N,j(r),ft);case"ATTEMPT_VALIDATION":{const o=i.payload.reason,s=i.payload.path;return t==="eager"||o===t||t.includes(o)?P({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},De(e,r),U,N,j(r),c=>{const a=i.payload.uid,S=c.calculatedWidgets[a],m=S.source;if(ie(m)){const h=m({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[a]:{source:S.source,current:h}}}}return c},ft):n}case"INJECT_VALIDATION_ISSUES":return Zn(n,i);default:return Ar(i)}},Te=e=>e.formHealth.status==="ok";function ft(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(i=>e.injectedValidations[i]!==null&&Array.isArray(e.injectedValidations[i]));return n!==void 0?{...e,isFormValid:!1}:(n=r.find(i=>e.validations[i]!==null&&Array.isArray(e.validations[i])),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function ai(e=[],t,r,n){const i=new f.BehaviorSubject($t(n.lang)),o=i.asObservable().pipe(f.distinctUntilChanged()),s=li({validators:t,validateOn:r,localization:n});function u(m){const h=i.getValue(),D=s(h,m);i.next(D)}let c=u;const a={getState:()=>i.getValue(),dispatch:m=>c(m)};return c=e.map(m=>m(a)).reduceRight((m,h)=>h(m),u),{state$:o,dispatch:c,getState:()=>i.getValue()}}class fi{constructor(){this.widgetRegistry=new Pe,this.store={},this.events$=new f.Subject,this.submit$=new f.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,i,o,s=At(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=o,this.store=ai(r,n,i,s)}emitEvent(t,r,n){const o=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(o.length>0)o.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,r),u&&this.events$.next({name:u,data:we(this.store.getState()),detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const s=r.on?.[t];this.attemptValidation(t,r),s&&this.events$.next({name:s,data:we(this.store.getState()),detail:n,callback:u=>{this.store.dispatch(u)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:we(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function hi(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),i=>o=>{i(o),n&&n.send(o,t.getState())}}}const pi=f.pipe(f.map(e=>e.data),f.distinctUntilChanged()),gi=e=>f.pipe(pi,f.map(t=>oe(t,e)),f.distinctUntilChanged()),mi=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.validations),f.distinctUntilChanged()),yi=e=>f.pipe(mi,f.map(t=>t[e]),f.distinctUntilChanged()),$i=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.injectedValidations),f.distinctUntilChanged()),Ai=e=>f.pipe($i,f.map(t=>t[e]),f.distinctUntilChanged(),f.startWith(null)),Si=f.pipe(f.map(e=>e.lang),f.distinctUntilChanged()),qt=f.pipe(f.map(e=>e.calculatedWidgets),f.distinctUntilChanged()),vi=e=>t=>f.combineLatest([t.pipe(Si),t.pipe(qt)]).pipe(f.map(([r,n])=>({lang:r,widget:n[e]})),f.filter(r=>r.widget!==void 0),f.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),f.map(r=>r.widget.current)),Ei=e=>f.pipe(qt,f.map(t=>t[e]),f.filter(t=>t!==void 0),f.map(t=>t.current.children),f.distinctUntilChanged());f.pipe(f.map(e=>e.widgetFlags),f.distinctUntilChanged());const Ci=f.pipe(f.map(e=>e.touchedControls),f.distinctUntilChanged()),wi=e=>f.pipe(Ci,f.map(t=>t[e]),f.distinctUntilChanged()),Ii=f.pipe(f.map(e=>e.formHealth),f.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),Oi=e=>e.pipe(Ii);let bt=!1;function Di(){bt=!0}function Ti(){return bt}function Fi(e,t,r){if(!Ti())return;const n=Object.keys(t??{}).filter(i=>i in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.FormContext=fi;exports.assertNoPropCollisions=Fi;exports.calculatedLayoutChildrenByUid$=Ei;exports.calculatedWidgetsByUid$=vi;exports.cloneObject=ae;exports.dataByPath$=gi;exports.defineForm=mr;exports.devToolsMiddleware=hi;exports.enableDevMode=Di;exports.errorCodes=Q;exports.filterTap=vn;exports.formHealth=Oi;exports.getDirectionFromLanguage=$r;exports.identityTranslator=At;exports.injectedValidationByPath$=Ai;exports.isStandardValidateSuccess=pt;exports.makeRepeaterItemConfig=Ht;exports.shortUUID=Ve;exports.standardValidate=ht;exports.touchedControlsByPath$=wi;exports.validationByPath$=yi;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("rxjs");require("@standard-schema/spec");function mt(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function gt(e){return e.issues===void 0}var rr=class{value;constructor(e){this.value=e}map(e){return k(e(this.value))}isOk(){return!0}},nr=class yt{issues;constructor(t){this.issues=t}map(t){return new yt(this.issues)}isOk(){return!1}};function k(e){return new rr(e)}function C(e){return new nr(e)}function At(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t.length===0?String(r):`${t}.${r}`,"")}function dt(e){return e.map(t=>t.path.length===0?t.message:`${At(t.path)}: ${t.message}`).join("; ")}var D=class Fe{decodeFn;constructor(t){this.decodeFn=t}parse(t){let r=this.decode(t);if(r.isOk())return r.value;{let n=r;throw Error(dt(n.issues),{cause:n.issues})}}decode(t){return this.decodeFn(t)}"~standard"={version:1,vendor:"ts.data.json",validate:t=>{let r=this.decode(t);return r.isOk()?{value:r.value}:{issues:r.issues.map(n=>({message:n.message,path:n.path.length>0?n.path.map(o=>({key:o})):void 0}))}}};decodePromise(t){return new Promise((r,n)=>{let o=this.decode(t);if(o.isOk())return r(o.value);{let i=o;return n(Error(dt(i.issues),{cause:i.issues}))}})}map(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?k(t(n.value)):C(n.issues)})}flatMap(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?t(n.value).decode(r):C(n.issues)})}},K=(e,t)=>[{message:`${JSON.stringify(e)} is not a valid ${t}`,path:[]}],_e=(e,t)=>e.map(r=>({...r,path:[t,...r.path]}));function Ve(e){return new D(t=>{if(t instanceof Array){let r=[],n=[];for(let o=0;o<t.length;o++){let i=e.decode(t[o]);i.isOk()?r.push(i.value):n.push(..._e(i.issues,o))}return n.length>0?C(n):k(r)}else return C(K(t,"array"))})}function or(){return new D(e=>typeof e=="boolean"?k(e):C(K(e,"boolean")))}function ir(e,t){return new D(r=>{if(typeof r!="object"||!r)return C(K(r,"object"));let n=r[e];return Object.prototype.hasOwnProperty.call(t,n)?t[n].decode(r):C([{message:`"${e}" must be one of ${Object.keys(t).map(o=>JSON.stringify(o)).join(", ")}, but got ${JSON.stringify(n)}`,path:[e]}])})}function $t(e){return new D(t=>e().decode(t))}function J(e){return new D(t=>t===e?k(e):C([{message:`${JSON.stringify(t)} is not exactly ${JSON.stringify(e)}`,path:[]}]))}function $e(){return new D(e=>typeof e=="number"?k(e):C(K(e,"number")))}function re(e){return new D(t=>{if(typeof t=="object"&&t){let r={},n=[];for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i,s=e[o];i=s instanceof D?s.decode(t[o]):s.decoder.decode(t[s.fromKey]),i.isOk()?r[o]=i.value:n.push(..._e(i.issues,o))}return n.length>0?C(n):k(r)}else return C(K(t,"object"))})}function Q(e){return new D(t=>{let r=[];for(let n=0;n<e.length;n++){let o=e[n].decode(t);if(o.isOk())return o;r.push(o.issues)}return C([{message:`no alternative matched (tried ${e.length})`,path:[]},...sr(r)])})}function sr(e){let t=new Map;for(let r of e)for(let n of r){let o=JSON.stringify(n.path),i=t.get(o);i?i.messages.includes(n.message)||i.messages.push(n.message):t.set(o,{path:n.path,messages:[n.message]})}return Array.from(t.values()).map(({path:r,messages:n})=>({message:n.join(" or "),path:r}))}function A(e){return new D(t=>t===void 0?k(void 0):e.decode(t))}function dr(e){return new D(t=>{if(typeof t=="object"&&t){let r={},n=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=e.decode(t[o]);i.isOk()?r[o]=i.value:n.push(..._e(i.issues,o))}return n.length>0?C(n):k(r)}else return C(K(t,"object"))})}function w(){return new D(e=>typeof e=="string"?k(e):C(K(e,"string")))}function G(){return new D(e=>k(e))}function ne(e){return new D(t=>{if(typeof t!="object"||t===null)return C([{message:`Expected object literal, got "${typeof t}"`,path:[]}]);const r={};for(const[n,o]of Object.entries(e)){const i=o.decoder.decode(t[n]);if(!i.isOk())return C(i.issues.map(s=>({message:s.message,path:[n,...s.path]})));if(r[n]=i.value,o.suffixed){for(const[s,u]of Object.entries(t))if(s.startsWith(n+".")){const c=o.decoder.decode(u);if(!c.isOk())return C(c.issues.map(l=>({message:l.message,path:[s,...l.path]})));r[s]=c.value}}}return k(r)})}const Le=()=>crypto.randomUUID().slice(0,8),ur=e=>typeof e!="function"&&e.kind==="display",Y=e=>typeof e!="function"&&e.kind==="action",I=e=>typeof e!="function"&&e.kind==="input",ae=e=>typeof e!="function"&&e.kind==="layout",oe=e=>typeof e=="function",cr=re({in:Ve(w())}),Re=re({when:w()}),Se=Q([cr,Re]),lr=re({from:Ve(w())}),ve=Q([lr,Re]),je=Q([or(),Re]),ar=new D(e=>{const t=typeof e;return t==="function"?k(e):C([{message:`Expected a function, got '${t}'`,path:[]}])}),V=e=>Q([e,ar]),Me=ne({load:{suffixed:!0,decoder:V(A(w()))},click:{suffixed:!0,decoder:V(A(w()))},change:{suffixed:!0,decoder:V(A(w()))},filter:{suffixed:!0,decoder:V(A(w()))},blur:{suffixed:!0,decoder:V(A(w()))}}),fr=re({key:w(),default:A(w()),params:A(G())}),St=Q([w(),fr]),Be=A(w()).map(e=>e||Le()),pr=ne({kind:{decoder:J("display")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},props:{decoder:A(G())}}),hr=ne({kind:{decoder:J("action")},uid:{decoder:Be},type:{decoder:w()},actionType:{decoder:A(Q([J("button"),J("submit")]))},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},label:{suffixed:!0,decoder:V(A(St))},disabled:{suffixed:!0,decoder:A(je)},on:{decoder:A(Me)},props:{decoder:A(G())}}),mr=new D(e=>{const t=typeof e;if(t==="function"){const r=e,n=r(void 0);return r.uid=n.uid||Le(),r.type=n.type,r.path=n.path,k(r)}else return C([{message:`Expected a function, got '${t}'`,path:[]}])}),gr=ne({kind:{decoder:J("input")},uid:{decoder:A(w())},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},disabled:{suffixed:!0,decoder:A(je)},readonly:{suffixed:!0,decoder:A(je)},on:{decoder:A(Me)},props:{decoder:A(G())},label:{suffixed:!0,decoder:V(A(St))},path:{decoder:w()},defaultValue:{decoder:A(G())},validator:{suffixed:!0,decoder:V(A(G()))}}).map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;r.template=He.parse(r.template)}return t}),yr=$t(()=>{const e=ir("kind",{input:gr,layout:He,display:pr,action:hr});return new D(t=>typeof t=="function"?mr.decode(t):e.decode(t))}),He=ne({kind:{decoder:J("layout")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},props:{decoder:A(G())},on:{decoder:A(Me)},children:{decoder:Ve(yr)}}),B=class B{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!B.sharedCache.has(r)){const n=r().catch(o=>(B.sharedCache.delete(r),Promise.reject(o)));B.sharedCache.set(r,n)}return B.sharedCache.get(r)}};B.sharedCache=new Map;let We=B;function Ar(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const vt=re({states:A(dr(w())),form:$t(()=>He)}),Et=e=>({formName:"",formDef:vt.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,lang:e}),$r=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function Sr(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const Ct=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(o=>o(e))}}},vr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function W(e,...t){return t.reduce((r,n)=>n(r),e)}function Er(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");const n=t.payload.widget,o=e.touched&&I(n)?{...e.touchedControls,[n.path]:!0}:e.touchedControls;return{...e,touchedControls:o,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:n,current:{}}}}}const b={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,initializeMalformedFormShapeError:23,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},ie=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},Ge=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let o=e;for(let s=0;s<n.length-1;s++){const u=n[s],c=n[s+1];(o[u]==null||typeof o[u]!="object")&&(o[u]=wr(c)?[]:{}),o=o[u]}const i=n[n.length-1];return o[i]=r,e},Cr=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let s=0;s<r.length-1;s++){const u=n[s];if(u==null||typeof u!="object")return e;const c=r[s],l=Array.isArray(u)?u[parseInt(c,10)]:u[c];if(l==null||typeof l!="object")return e;n.push(l)}const o=n[n.length-1],i=r[r.length-1];Array.isArray(o)?o.splice(parseInt(i,10),1):delete o[i];for(let s=n.length-1;s>=1;s--){const u=n[s];if(Array.isArray(u)||!Or(u))break;const c=n[s-1],l=r[s-1];if(Array.isArray(c))break;delete c[l]}return e};function wr(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Or(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const Ee=(e,t)=>(delete e[t],e);function fe(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>fe(r));const t={};for(const r of Object.keys(e))t[r]=fe(e[r]);return t}function be(e){return e.flatMap(t=>[t,...ae(t)?be(t.children):[]])}function Ke(e){return Object.entries(e.validations).reduce((r,[n,o])=>(o!==null&&(r.$formIsInvalid=!0,Ge(r.$errors,n,[...o])),r),{$formIsInvalid:!1,$errors:{}})}function Oe(e){const t=fe(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const o=e.flatForm[r];o&&I(o)&&Cr(t,o.path)}return t}const ze=32;let Pe,h,y,$=e=>(h=0,y=e,$.newline=!1,e=v(),y[h]?z():e||""),z=(e="Unexpected token",t=h,r=y.slice(0,t).split(`
2
+ `),n=r.pop(),o=y.slice(Math.max(0,t-40),t),i="̭",s=(y[t]||" ")+i,u=y.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
+ ${y[t-41]!==`
4
+ `,""+o}${s}${u}`)},wt=(e,t=h)=>(Array.isArray(e)&&(e.loc=t),e),q=(e,t=h,r)=>{for(;r=e(y.charCodeAt(h));)h+=r;return y.slice(t,h)},O=(e=1)=>y[h+=e],Ne=e=>h=e,v=(e=0,t)=>{let r,n,o,i,s;for(t&&$.asi&&($.newline=!1);(r=$.space())&&(s=$.newline,1)&&r!==t&&(o=(n&&r===91&&Pe&&$.asi?.(n,e,v)||null)??((i=j[r])&&i(n,e))??(n&&s&&$.asi?.(n,e,v))??(!n&&q($.id)));)n=o;return t&&(r==t?(h++,t===125&&$.asi&&($.newline=!0)):z("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},R=(e,t=h)=>{for(Pe=!1;(e=y.charCodeAt(h))<=ze;)$.asi&&e===10&&($.newline=Pe=!0),h++;return e},Ir=(e=h)=>{for(;y.charCodeAt(e)<=ze;)e++;return y.charCodeAt(e)};$.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Dr=(e,t=e.length)=>y.substr(h,t)===e&&!$.id(y.charCodeAt(h+t)),j=[],ut={},F=(e,t=ze,r,n=e.charCodeAt(0),o=e.length,i=j[n],s=e.toUpperCase()!==e,u,c)=>(t=ut[e]=!i&&ut[e]||t,j[n]=(l,g,m,f=h)=>(u=m,(m?e==m:(o<2||e.charCodeAt(1)===y.charCodeAt(h+1)&&(o<3||y.substr(h,o)==e))&&(!s||!$.id(y.charCodeAt(h+o)))&&(u=m=e))&&g<t&&(h+=o,(c=r(l))?wt(c,f):(h=f,u=0,!s&&!i&&!l&&z()),c)||i?.(l,g,u))),S=(e,t,r=!1)=>F(e,t,n=>n&&(o=>o&&[e,n,o])(v(t-(r?.5:0)))),M=(e,t,r)=>F(e,t,n=>!n&&(n=v(t-.5))&&[e,n]),se=(e,t)=>F(e,200,r=>!r&&[,t]),Ot=(e,t,r)=>F(e,t,(n,o)=>(o=v(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),o?.[0]===e?n.push(...o.slice(1)):n.push(o||null),n)),Xe=(e,t)=>F(e[0],t,r=>!r&&[e,v(0,e.charCodeAt(1))||null]),It=(e,t)=>F(e[0],t,r=>r&&[e,r,v(0,e.charCodeAt(1))||null]),de=(e,t,r,n=e.charCodeAt(0),o=e.length,i=j[n],s)=>j[n]=(u,c,l,g=h)=>!u&&(l?e==l:(o<2||y.substr(h,o)==e)&&(l=e))&&c<t&&!$.id(y.charCodeAt(h+o))&&(!$.prop||$.prop(h+o))&&(Ne(h+o),(s=r())?wt(s,g):Ne(g),s)||i?.(u,c,l);Object.defineProperty($,"space",{configurable:!0,enumerable:!0,get:()=>R,set:e=>R=e});const Ue={},a=(e,t,r=Ue[e])=>Ue[e]=(...n)=>t(...n)||r?.(...n),d=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):Ue[e[0]]?.(...e.slice(1))??z(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],pe=46,ee=48,he=57,Tr=69,kr=101,Fr=43,jr=45,le=95,Dt=110,Wr=97,Pr=102,Nr=65,Ur=70,Tt=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),Je=e=>{let t=Tt(q(r=>r===pe&&y.charCodeAt(h+1)!==pe||r>=ee&&r<=he||r===le||((r===Tr||r===kr)&&((r=y.charCodeAt(h+1))>=ee&&r<=he||r===Fr||r===jr)?2:0)));return y.charCodeAt(h)===Dt?(O(),[,BigInt(t)]):(e=+t)!=e?z():[,e]},_r={2:e=>e===48||e===49||e===le,8:e=>e>=48&&e<=55||e===le,16:e=>e>=ee&&e<=he||e>=Wr&&e<=Pr||e>=Nr&&e<=Ur||e===le};$.number=null;j[pe]=e=>!e&&y.charCodeAt(h+1)!==pe&&Je();for(let e=ee;e<=he;e++)j[e]=t=>t?void 0:Je();j[ee]=e=>{if(e)return;const t=$.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&y[h+1]?.toLowerCase()===r[1]){O(2);const o=Tt(q(_r[n]));return y.charCodeAt(h)===Dt?(O(),[,BigInt("0"+r[1]+o)]):[,parseInt(o,n)]}}return Je()};const Vr=92,ct=34,lt=39,Lr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},kt=e=>(t,r,n="")=>{if(!(t||!$.string?.[String.fromCharCode(e)]))return O(),q(o=>o-e&&(o===Vr?(n+=Lr[y[h+1]]||y[h+1],2):(n+=y[h],1))),y[h]===String.fromCharCode(e)?O():z("Bad string"),[,n]};j[ct]=kt(ct);j[lt]=kt(lt);$.string={'"':!0};const Rr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>S(e,Rr,!0));const Ft=(e,t,r,n)=>typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):e[0]==="()"&&e.length===2?Ft(e[1],t):(()=>{throw Error("Invalid assignment target")})(),at={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in at)a(e,(t,r)=>(r=d(r),Ft(t,(n,o,i)=>at[e](n,o,r(i)))));const Mr=30,Br=40,Hr=140;M("!",Hr);S("||",Mr);S("&&",Br);a("!",e=>(e=d(e),t=>!e(t)));a("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));a("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Gr=50,br=60,Kr=70,jt=100,zr=140;S("|",Gr);S("&",Kr);S("^",br);S(">>",jt);S("<<",jt);M("~",zr);a("~",e=>(e=d(e),t=>~e(t)));a("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));a("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));a("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));a(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));a("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const Ce=90;S("<",Ce);S(">",Ce);S("<=",Ce);S(">=",Ce);a(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));a("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));a(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));a("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Wt=80;S("==",Wt);S("!=",Wt);a("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));a("!=",(e,t)=>(e=d(e),t=d(t),r=>e(r)!=t(r)));const Pt=110,Qe=120,Nt=140;S("+",Pt);S("-",Pt);S("*",Qe);S("/",Qe);S("%",Qe);M("+",Nt);M("-",Nt);a("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));a("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));a("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));a("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));a("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const me=150;F("++",me,e=>e?["++",e,null]:["++",v(me-1)]);F("--",me,e=>e?["--",e,null]:["--",v(me-1)]);const qe=(e,t,r,n)=>typeof e=="string"?o=>t(o,e):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o))):e[0]==="()"&&e.length===2?qe(e[1],t):(()=>{throw Error("Invalid increment target")})();a("++",(e,t)=>qe(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));a("--",(e,t)=>qe(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Xr=5,Jr=10;Ot(",",Jr);Ot(";",Xr,!0);const Ut=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});a(",",Ut);a(";",Ut);const Qr=170;Xe("()",Qr);const L=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",xe=170;It("[]",xe);S(".",xe);It("()",xe);const ge=e=>{throw Error(e)};a("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=d(r[1]),n=>r(n)):(r=d(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&ge("Missing index"),e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)[n]}));a(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],L(t)?()=>{}:r=>e(r)[t]));a("()",(e,t)=>{if(t===void 0)return e==null?ge("Empty ()"):d(e);const r=o=>o?.[0]===","&&o.slice(1).some(i=>i==null||r(i));r(t)&&ge("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];return Ze(e,(o,i,s)=>o[i](...n(s)))});const X=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&X(e[1])||e[0]==="{}"),Ze=(e,t,r,n)=>e==null?ge("Empty ()"):e[0]==="()"&&e.length==2?Ze(e[1],t):typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="?."?(r=d(e[1]),n=e[2],o=>{const i=r(o);return i==null?void 0:t(i,n,o)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),o=>{const i=r(o);return i==null?void 0:t(i,n(o),o)}):(e=d(e),o=>t([e(o)],0,o)),x=Ze,qr=32,xr=$.space;$.comment??={"//":`
6
+ `,"/*":"*/"};let Ie;$.space=()=>{Ie||(Ie=Object.entries($.comment).map(([o,i])=>[o,i,o.charCodeAt(0)]));for(var e;e=xr();){for(var t=0,r;r=Ie[t++];)if(e===r[2]&&y.substr(h,r[0].length)===r[0]){var n=h+r[0].length;if(r[1]===`
7
+ `)for(;y.charCodeAt(n)>=qr;)n++;else{for(;y[n]&&y.substr(n,r[1].length)!==r[1];)n++;y[n]&&(n+=r[1].length)}Ne(n),e=0;break}if(e)return e}return e};const _t=80;S("===",_t);S("!==",_t);a("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));a("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const Zr=30;S("??",Zr);a("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const Yr=130,en=20;S("**",Yr,!0);S("**=",en,!0);a("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const tn=e=>{throw Error(e)};a("**=",(e,t)=>(X(e)||tn("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]**=t(o))));const Vt=90;S("in",Vt);S("of",Vt);a("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const rn=20,nn=100,on=e=>{throw Error(e)};S(">>>",nn);S(">>>=",rn,!0);a(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));a(">>>=",(e,t)=>(X(e)||on("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]>>>=t(o))));const Ye=5,sn=10,dn=20,un=e=>e[0]?.[0]===","?e[0].slice(1):e,ye=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...o]=e,i=un(o);if(n==="{}"){const s=[];for(const u of i){if(Array.isArray(u)&&u[0]==="..."){const f={};for(const T in t)s.includes(T)||(f[T]=t[T]);r[u[1]]=f;break}let c,l,g;typeof u=="string"?c=l=u:u[0]==="="?(typeof u[1]=="string"?c=l=u[1]:[,c,l]=u[1],g=u[2]):[,c,l]=u,s.push(c);let m=t[c];m===void 0&&g&&(m=d(g)(r)),ye(l,m,r)}}else if(n==="[]"){let s=0;for(const u of i){if(u===null){s++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(s);break}let c=u,l;Array.isArray(u)&&u[0]==="="&&([,c,l]=u);let g=t[s++];g===void 0&&l&&(g=d(l)(r)),ye(c,g,r)}}},Lt=e=>{let t=v(sn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};de("let",Ye+1,()=>Lt("let"));de("const",Ye+1,()=>Lt("const"));de("var",Ye,()=>(R(),["var",v(dn)]));const Rt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,o=d(n);return typeof r=="string"?i=>{i[r]=o(i)}:i=>ye(r,o(i),i)}return d(t)}),t=>{for(const r of e)r(t)});a("let",Rt);a("const",Rt);a("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const et=20,we=e=>{throw Error(e)};S("||=",et,!0);S("&&=",et,!0);S("??=",et,!0);a("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=d(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>ye(r,t(n),n)}return X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]=t(o))});a("||=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]||=t(o))));a("&&=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]&&=t(o))));a("??=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]??=t(o))));se("true",!0);se("false",!1);se("null",null);de("undefined",200,()=>[]);se("NaN",NaN);se("Infinity",1/0);const De=20;F("?",De,(e,t,r)=>e&&(t=v(De-1))&&q(n=>n===58)&&(r=v(De-1),["?",e,t,r]));a("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const cn=[],ln=20;S("=>",ln,!0);a("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,o=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,o=i[1],r.length--);const s=t?.[0]==="{}";return t=d(s?["{",t[1]]:t),u=>(...c)=>{const l={};r.forEach((m,f)=>l[m]=c[f]),o&&(l[o]=c.slice(n));const g=new Proxy(l,{get:(m,f)=>f in m?m[f]:u?.[f],set:(m,f,T)=>((f in m?m:u)[f]=T,!0),has:(m,f)=>f in m||(u?f in u:!1)});try{const m=t(g);return s?void 0:m}catch(m){if(m===cn)return m[0];throw m}}});const an=140;M("...",an);a("...",e=>(e=d(e),t=>Object.entries(e(t))));const ft=170;F("?.",ft,(e,t)=>{if(!e)return;const r=R();return r===40?(O(),["?.()",e,v(0,41)||null]):r===91?(O(),["?.[]",e,v(0,93)]):(t=v(ft),t?["?.",e,t]:void 0)});a("?.",(e,t)=>(e=d(e),L(t)?()=>{}:r=>e(r)?.[t]));a("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)?.[n]}));a("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];if(e[0]==="?."){const o=d(e[1]),i=e[2];return L(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="?.[]"){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return L(c)?void 0:u?.[c]?.(...r(s))}}if(e[0]==="."){const o=d(e[1]),i=e[2];return L(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return L(c)?void 0:u?.[c]?.(...r(s))}}const n=d(e);return o=>n(o)?.(...r(o))});const te=140;M("typeof",te);M("void",te);M("delete",te);de("new",te,()=>Dr(".target")?(O(7),["new.target"]):["new",v(te)]);a("typeof",e=>(e=d(e),t=>typeof e(t)));a("void",e=>(e=d(e),t=>(e(t),void 0)));a("delete",e=>{if(e[0]==="."){const t=d(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=d(e[1]),r=d(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});a("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(o=>i=>o.map(s=>s(i)))(r.slice(1).map(d)):(o=>i=>[o(i)])(d(r)):()=>[];return o=>new(t(o))(...n(o))});const tt=Symbol("accessor"),rt=20,fn=40,Mt=41,Bt=123,Ht=125,Gt=e=>t=>{if(t)return;R();const r=q($.id);if(!r||(R(),y.charCodeAt(h)!==fn))return!1;O();const n=v(0,Mt);return R(),y.charCodeAt(h)!==Bt?!1:(O(),[e,r,n,v(0,Ht)])};F("get",rt-1,Gt("get"));F("set",rt-1,Gt("set"));F("(",rt-1,e=>{if(!e||typeof e!="string")return;const t=v(0,Mt)||null;if(R(),y.charCodeAt(h)===Bt)return O(),[":",e,["=>",["()",t],v(0,Ht)||null]]});a("get",(e,t)=>(t=t?d(t):()=>{},r=>[[tt,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));a("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[tt,e,{set:function(o){const i=Object.create(n||{});i.this=this,i[t]=o,r(i)}}]]));const pn=20,bt=200;$.prop=e=>Ir(e)!==58;const hn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);Xe("[]",bt);Xe("{}",bt);S(":",pn-1,!0);a("{}",(e,t)=>{if(t!==void 0)return;if(!hn(e))return d(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>d(typeof n=="string"?[":",n,n]:n));return n=>{const o={},i={};for(const s of r.flatMap(u=>u(n)))if(s[0]===tt){const[,u,c]=s;i[u]={...i[u],...c,configurable:!0,enumerable:!0}}else o[s[0]]=s[1];for(const s in i)Object.defineProperty(o,s,i[s]);return o}});a("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));a(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const mn=170,Ae=96,gn=36,yn=123,An=92,$n={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},pt=()=>{const e=[];for(let t="",r;(r=y.charCodeAt(h))!==Ae;)r?r===An?(O(),t+=$n[y[h]]||y[h],O()):r===gn&&y.charCodeAt(h+1)===yn?(t&&e.push([,t]),t="",O(2),e.push(v(0,125))):(t+=y[h],O(),r=y.charCodeAt(h),r===Ae&&t&&e.push([,t])):z("Unterminated template");return O(),e},Sn=j[Ae];j[Ae]=(e,t)=>e&&t<mn?$.asi&&$.newline?void 0:(O(),["``",e,...pt()]):e?Sn?.(e,t):(O(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(pt()));a("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));a("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const i of t)Array.isArray(i)&&i[0]===void 0?r.push(i[1]):n.push(d(i));const o=Object.assign([...r],{raw:r});return i=>e(i)(o,...n.map(s=>s(i)))});$.string["'"]=!0;$.number={"0x":16,"0b":2,"0o":8};const vn={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function N(e,t,r,n,o){const i=$(nt(e));return d(i)({$form:t,$meta:r,$errors:n,$formIsInvalid:o,$log:vn.log})===!0}function nt(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const U=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Ke(e);t=En(t);let o=[],i={status:"ok"};try{o=Object.keys(t).map(s=>{const u=t[s];let c;try{c=N(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?s:void 0}).filter(s=>s!==void 0)}catch(s){const u=s,c=b.calculateCurrentStateError;i={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:o,formHealth:i}};function En(e){const t={};function r(n){const o=n.split(":"),i=[];for(let s=0;s<o.length;s++)i.push(o.slice(0,s+1).join(":"));return i}for(const[n,o]of Object.entries(e)){const i=r(n),s=[];for(const u of i)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const ot=Symbol("filterMap.skip");function Kt(e,t){const r=[];for(let n=0;n<e.length;n++){const o=t(e[n],n,e);o!==ot&&r.push(o)}return r}function Cn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function wn(e,t,r,n){let o=n;for(let i=0;i<e.length;i++)t(e[i],i,e)&&(o=r(o,e[i],i,e));return o}function On(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function zt(e,t){const r=Xt(e.uid,t);return I(e)?{...e,uid:r,path:In(e.path,t)}:{...e,uid:r}}function Xt(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,o)=>`${n}[${o}]`,"");return`${e}${r}`}function In(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),o=n.length-1;if(o!==t.length)throw new Error(`Path contains ${o} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((i,s,u)=>u===0?s:`${i}.${t[u-1]}${s}`)}function ue(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,o)=>{const i=t[r++];return i===void 0?n:`.${i}${o}.`})}const ce=(e,t)=>r=>e(r)?t(r):r,H=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,_=e=>{const{$formIsInvalid:t,$errors:r}=Ke(e);return{...e,widgetFlags:{...Dn(e,r,t),...Tn(e,r,t)}}};function Dn(e,t,r){return Kt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return ot;if(oe(n)){const o=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return o.uid=n.uid,o}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(I(n)||Y(n))&&H(n.disabled)||I(n)&&H(n.readonly))).reduce((n,o)=>(n[o.uid]=n[o.uid]||{},o.include&&"in"in o.include?n[o.uid].hidden=!o.include.in.some(i=>e.currentStates.includes(i)):o.include&&"when"in o.include&&(n[o.uid].hidden=!N(o.include.when,e.data,e.meta,t,r)),o.exclude&&"from"in o.exclude?n[o.uid].hidden=o.exclude.from.some(i=>e.currentStates.includes(i)):o.exclude&&"when"in o.exclude&&(n[o.uid].hidden=N(o.exclude.when,e.data,e.meta,t,r)),(I(o)||Y(o))&&H(o.disabled)&&(n[o.uid].disabled=N(o.disabled.when,e.data,e.meta,t,r)),I(o)&&H(o.readonly)&&(n[o.uid].readonly=N(o.readonly.when,e.data,e.meta,t,r)),n),{})}function Tn(e,t,r){return wn(Object.values(e.flatForm),n=>!oe(n)&&n.type==="repeater",(n,o)=>({...n,...Jt(e,o,[],t,r)}),{})}function Jt(e,t,r,n,o){const i=t.props.template,s=ie(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,l)=>{const g=[...r,l];be([i]).forEach(m=>{let f;if(oe(m)?(f=m({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),f.uid=m.uid):f=m,f.type==="repeater"){const Z=zt(f,g);Object.assign(u,Jt(e,Z,g,n,o));return}const T=Xt(f.uid,g);u[T]=u[T]||{},f.include&&"in"in f.include?u[T].hidden=!f.include.in.some(Z=>e.currentStates.includes(Z)):f.include&&"when"in f.include&&(u[T].hidden=!N(ue(f.include.when,g),e.data,e.meta,n,o)),f.exclude&&"from"in f.exclude?u[T].hidden=f.exclude.from.some(Z=>e.currentStates.includes(Z)):f.exclude&&"when"in f.exclude&&(u[T].hidden=N(ue(f.exclude.when,g),e.data,e.meta,n,o)),(I(f)||Y(f))&&H(f.disabled)&&(u[T].disabled=N(ue(f.disabled.when,g),e.data,e.meta,n,o)),I(f)&&H(f.readonly)&&(u[T].readonly=N(ue(f.readonly.when,g),e.data,e.meta,n,o))})}),u}const P=e=>t=>{try{return{...t,calculatedWidgets:kn(t,e)}}catch(r){const n=r;return{...t,formHealth:{status:"errored",message:`[${n.code}] ${n.message}`,code:n.code}}}};function kn(e,t){const{$formIsInvalid:r,$errors:n}=Ke(e),o=Jn(e,t,r,n),i={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(oe(c)){i[s]=Fn(s,c,e,t);continue}i[s]=jn(u,c,e,o)}return i}function Fn(e,t,r,n){const o=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return o.uid=e,{source:t,current:o}}function jn(e,t,r,n){const o=new Xn(t,e.current);return o.write("uid",t.uid),o.write("type",t.type),o.write("kind",t.kind),ur(t)?Wn(o,n):Y(t)?Pn(o,n):I(t)?Nn(o,n):ae(t)&&Un(o,n),_n(t,o,n,r),(Y(t)||I(t))&&Vn(t,o,n),ae(t)&&Ln(t,o,r),o.changed?{source:e.source,current:o.current}:e}function Wn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function Pn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Nn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function Un(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function _n(e,t,r,n){const o=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...o};for(const s of xt(Object.keys(i)))Rn(t,r,s)}function Vn(e,t,r){const n=e.on??{};for(const o of xt(Object.keys(n)))Mn(t,r,o)}function Ln(e,t,r){const n=xn(e.uid),o=qn(e.children,n,r.widgetFlags);t.current.children=o;const i=t.previous.children??[];i.length===o.length&&o.every((u,c)=>i[c]&&i[c].uid===o[c].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!Qn(n,r))return;const o=st(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Gn(o,t,e.source.uid,r);break;case"defaultValue":i=o;break;default:i=qt(o,t)}e.write(r,i)}function Rn(e,t,r){const n=e.source.props,o=st(n,r,t.sortedStates);let i=qt(o,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(i=s),e.write(`props.${r}`,i)}function Mn(e,t,r){const n=e.source.on,o=st(n,r,t.sortedStates);e.write(`on.${r}`,bn(o,t))}function it(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Bn(e,t){return t.localization.translate(e.key,zn(e.params,t),e.default)}const Hn=/\{\{([^}]+)\}\}/g;function Qt(e,t){return e.includes("{{")?e.replace(Hn,(r,n)=>{const o=nt(n.trim());try{const i=d($(o))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});return i==null?"":String(i)}catch(i){const s=i instanceof Error?i.message:String(i);throw new Zt(`Failed to evaluate '{{${n.trim()}}}': ${s}`)}}):e}function qt(e,t){return typeof e=="function"?it(e,t):$r(e)?Bn(e,t):typeof e=="string"?Qt(e,t):e}function Gn(e,t,r,n){return typeof e=="function"?it(e,t):H(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Qt(e,t):e}function bn(e,t){return typeof e=="function"?it(e,t):e}function st(e,t,r){if(e){for(const n of r){const o=e[`${t}.${n}`];if(o!==void 0)return o}return e[t]}}function Kn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e==="$formIsInvalid"}function zn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const o=String(e[n]);if(Kn(o))try{const i=d($(nt(o)))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});r[n]=i??o}catch(i){const s=i instanceof Error?i.message:String(i);throw new Zt(`Failed to evaluate i18n param '${o}': ${s}`)}else r[n]=o;return r},{})}class Xn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){Ge(this.current,t,r),ie(this.previous,t)!==r&&(this._changed=!0)}}function Jn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((o,i)=>i.length-o.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function Qn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function xt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function qn(e,t,r){const n=t.map(o=>`[${o}]`).join("");return e.filter(o=>{const i=o.uid+n,s=r[i];return!s||s.hidden!==!0})}const xn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10));class Zt extends Error{constructor(){super(...arguments),this.code=b.resolveStringInterpolationError,this.name="StringInterpolationError"}}const Zn=({lang:e},t)=>{const r={...Et(e),formName:t.payload.formName};let n=t.payload.formDef,o={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(l){const g=l,m=b.initializeParseError;o={status:"errored",message:`[${m}] ${g.message}`,code:m}}if(o.status==="errored")return{...r,formHealth:o}}if(Array.isArray(n.form)){const l=n,g=l.form;l.form={uid:"",type:"flex",kind:"layout",children:g}}const i=vt.decode(n);if(i.isOk()){o={status:"ok"};let l={};try{l=be([i.value.form]).reduce((g,m)=>{const f=m.uid;if(g[f])throw{existingWidget:g[f],newWidget:m};return g[f]=m,g},{})}catch(g){o=to(g.existingWidget,g.newWidget),l={}}return ro(l,i.value.states),{...r,formDef:i.value,flatForm:l,formHealth:o}}const s=eo(n);if(s)return{...r,formHealth:s};const u=b.initializeUnknownError,c=i.issues.map(l=>`${l.path.length>0?At(l.path):"root"}: ${l.message}`).join("; ");return{...r,formHealth:{status:"errored",message:`[${u}] ${c}`,code:u}}};function Yt(e,t){return{status:"errored",code:e,message:`[${e}] ${t}`}}function Yn(){return"Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`."}function eo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.form;return t&&typeof t=="object"&&!Array.isArray(t)&&!ae(t)?Yt(b.initializeMalformedFormShapeError,Yn()):null}function to(e,t){const r=o=>I(o)?` at "${o.path}"`:"",n=`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;return Yt(b.initializeUidCollisionError,n)}function ro(e,t){const r=new Set(Object.keys(t??{})),n=new Map;for(const i of Object.values(e)){const s=[],u=i.include;u&&Array.isArray(u.in)&&s.push(...u.in);const c=i.exclude;c&&Array.isArray(c.from)&&s.push(...c.from);for(const l of s){if(r.has(l))continue;const g=n.get(l)??[];g.push(i.uid||"(unknown)"),n.set(l,g)}}if(n.size===0)return;const o=r.size?[...r].join(", "):"(none declared)";for(const[i,s]of n)console.error(`[GolemUI] include/exclude references undefined state "${i}" (on ${s.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${i}" in formConfig.states, or correct the name.`)}function no(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const oo=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:i})=>I(i)&&i.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=r.source.uid,o=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...o,[t.prop]:t.value}}}};function io(e,t){return W(e,so(t),uo(t),co(t),lo(t))}const so=e=>t=>({...t,widgetFlags:{...Ee(t.widgetFlags,e.payload.uid)}}),uo=e=>t=>({...t,calculatedWidgets:{...Ee(t.calculatedWidgets,e.payload.uid)}}),co=e=>t=>({...t,widgetPropOverrides:{...Ee(t.widgetPropOverrides,e.payload.uid)}}),lo=e=>t=>({...t,touchedControls:W(t.touchedControls,r=>{const n=t.flatForm[e.payload.uid];return n&&I(n)?Ee(r,n.path):r})}),ao=(e,t)=>({...e,data:{...t.payload.data}}),fo=(e,t)=>({...e,formHealth:t.payload.formHealth}),po=(e,t)=>({...e,lang:t.payload.lang}),ho=(e,t)=>({...e,meta:{...t.payload.meta}}),mo=(e,t)=>{const r=ie(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...Ge(e.data,t.payload.path,t.payload.data)}}:e},Te=(e,t)=>r=>{const n=Kt(Object.values(r.calculatedWidgets),({current:i})=>I(i)?i:ot),o=r.validations;return{...r,validations:n.reduce((i,s)=>{if(i[s.path]=null,s.validator){const u=e(s.validator,t),c=ie(r.data,s.path),l=mt(u,c);i[s.path]=gt(l)?null:l.issues.map(g=>g.message)}return Array.isArray(i[s.path])&&Array.isArray(o[s.path])&&On(i[s.path],o[s.path],(u,c)=>u===c)&&(i[s.path]=o[s.path]),i},{})}},go=({validators:e,validateOn:t,localization:r})=>(n,o)=>{switch(o.type){case"INITIALIZE":return Zn(n,o);case"SET_DATA":return W(ao(n,o),U,_,P(r));case"SET_META":return W(ho(n,o),U,_,P(r));case"SET_LANGUAGE":return W(po(n,o),P(r));case"ADD_WIDGET":return W(Er(n,o),ce(ke,U),ce(ke,_),ce(ke,P(r)));case"REMOVE_WIDGET":return W(io(n,o),U,_,P(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return W(mo(n,o),U,_,P(r));case"OVERRIDE_WIDGET_PROP":return W(oo(n,o),U,_,P(r),ce(i=>{let s=!1,u="";"path"in o.payload?(s=!0,u=o.payload.path):I(i.calculatedWidgets[o.payload.uid].current)&&(s=!0,u=i.calculatedWidgets[o.payload.uid].current.path);const c=s&&i.touchedControls[u];return i.touched&&c},Te(e,r)));case"SET_FORM_HEALTH":return fo(n,o);case"VALIDATE_ALL":return W({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((i,s)=>{const u=n.calculatedWidgets[s].source;return I(u)&&(i[u.path]=!0),i},{})},Te(e,r),U,_,P(r),ht);case"ATTEMPT_VALIDATION":{const i=o.payload.reason,s=o.payload.path;return t==="eager"||i===t||t.includes(i)?W({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},Te(e,r),U,_,P(r),c=>{const l=o.payload.uid,g=c.calculatedWidgets[l],m=g.source;if(oe(m)){const f=m({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[l]:{source:g.source,current:f}}}}return c},ht):n}case"INJECT_VALIDATION_ISSUES":return no(n,o);default:return vr(o)}},ke=e=>e.formHealth.status==="ok";function ht(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(o=>e.injectedValidations[o]!==null&&Array.isArray(e.injectedValidations[o]));return n!==void 0?{...e,isFormValid:!1}:(n=r.find(o=>e.validations[o]!==null&&Array.isArray(e.validations[o])),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function yo(e=[],t,r,n){const o=new p.BehaviorSubject(Et(n.lang)),i=o.asObservable().pipe(p.distinctUntilChanged()),s=go({validators:t,validateOn:r,localization:n});function u(m){const f=o.getValue(),T=s(f,m);o.next(T)}let c=u;const l={getState:()=>o.getValue(),dispatch:m=>c(m)};return c=e.map(m=>m(l)).reduceRight((m,f)=>f(m),u),{state$:i,dispatch:c,getState:()=>o.getValue()}}class Ao{constructor(){this.widgetRegistry=new We,this.store={},this.events$=new p.Subject,this.submit$=new p.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,o,i,s=Ct(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=yo(r,n,o,s)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(i.length>0)i.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,r),u&&this.events$.next({name:u,data:Oe(this.store.getState()),detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const s=r.on?.[t];this.attemptValidation(t,r),s&&this.events$.next({name:s,data:Oe(this.store.getState()),detail:n,callback:u=>{this.store.dispatch(u)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:Oe(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function $o(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),o=>i=>{o(i),n&&n.send(i,t.getState())}}}const So=p.pipe(p.map(e=>e.data),p.distinctUntilChanged()),vo=e=>p.pipe(So,p.map(t=>ie(t,e)),p.distinctUntilChanged()),Eo=p.pipe(p.filter(e=>e.touched===!0),p.map(e=>e.validations),p.distinctUntilChanged()),Co=e=>p.pipe(Eo,p.map(t=>t[e]),p.distinctUntilChanged()),wo=p.pipe(p.filter(e=>e.touched===!0),p.map(e=>e.injectedValidations),p.distinctUntilChanged()),Oo=e=>p.pipe(wo,p.map(t=>t[e]),p.distinctUntilChanged(),p.startWith(null)),Io=p.pipe(p.map(e=>e.lang),p.distinctUntilChanged()),er=p.pipe(p.map(e=>e.calculatedWidgets),p.distinctUntilChanged()),Do=e=>t=>p.combineLatest([t.pipe(Io),t.pipe(er)]).pipe(p.map(([r,n])=>({lang:r,widget:n[e]})),p.filter(r=>r.widget!==void 0),p.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),p.map(r=>r.widget.current)),To=e=>p.pipe(er,p.map(t=>t[e]),p.filter(t=>t!==void 0),p.map(t=>t.current.children),p.distinctUntilChanged());p.pipe(p.map(e=>e.widgetFlags),p.distinctUntilChanged());const ko=p.pipe(p.map(e=>e.touchedControls),p.distinctUntilChanged()),Fo=e=>p.pipe(ko,p.map(t=>t[e]),p.distinctUntilChanged()),jo=p.pipe(p.map(e=>e.formHealth),p.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),Wo=e=>e.pipe(jo);let tr=!1;function Po(){tr=!0}function No(){return tr}function Uo(e,t,r){if(!No())return;const n=Object.keys(t??{}).filter(o=>o in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.FormContext=Ao;exports.assertNoPropCollisions=Uo;exports.calculatedLayoutChildrenByUid$=To;exports.calculatedWidgetsByUid$=Do;exports.cloneObject=fe;exports.dataByPath$=vo;exports.defineForm=Ar;exports.devToolsMiddleware=$o;exports.enableDevMode=Po;exports.errorCodes=b;exports.filterTap=Cn;exports.formHealth=Wo;exports.getDirectionFromLanguage=Sr;exports.identityTranslator=Ct;exports.injectedValidationByPath$=Oo;exports.isStandardValidateSuccess=gt;exports.makeRepeaterItemConfig=zt;exports.shortUUID=Le;exports.standardValidate=mt;exports.touchedControlsByPath$=Fo;exports.validationByPath$=Co;
package/lib/errors.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const errorCodes: {
6
6
  initializeParseError: number;
7
7
  initializeUidCollisionError: number;
8
8
  initializeUnknownError: number;
9
+ initializeMalformedFormShapeError: number;
9
10
  widgetCouldNotBeLoaded: number;
10
11
  resolveStringInterpolationError: number;
11
12
  };
@@ -26,20 +26,16 @@ export type KeySpec<A> = Record<string, {
26
26
  * @typeParam T - The resulting object shape after successful decoding.
27
27
  *
28
28
  * @param specs - A map of base keys to their decoding specification.
29
- * @param decoderName - Human-readable name used in error messages.
30
29
  *
31
30
  * @returns A `jd.Decoder` that validates and decodes objects according to the
32
31
  * provided key specifications.
33
32
  *
34
33
  * @example
35
34
  * ```ts
36
- * const decoder = objectWithSuffix<Record<string, string>>(
37
- * {
38
- * label: { suffixed: true, decoder: jd.string() },
39
- * title: { suffixed: false, decoder: jd.string() },
40
- * },
41
- * 'MyObj',
42
- * );
35
+ * const decoder = objectWithSuffix<Record<string, string>>({
36
+ * label: { suffixed: true, decoder: jd.string() },
37
+ * title: { suffixed: false, decoder: jd.string() },
38
+ * });
43
39
  *
44
40
  * decoder.decode({
45
41
  * label: 'Submit',
@@ -48,4 +44,4 @@ export type KeySpec<A> = Record<string, {
48
44
  * });
49
45
  * ```
50
46
  */
51
- export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>, decoderName: string): Decoder<T>;
47
+ export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>): Decoder<T>;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@golemui/core",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.4",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "main": "./index.umd.cjs",
6
7
  "module": "./index.js",
@@ -28,7 +29,7 @@
28
29
  "*.md"
29
30
  ],
30
31
  "dependencies": {
31
- "ts.data.json": "^3.3.0"
32
+ "ts.data.json": "^4.1.0"
32
33
  },
33
34
  "peerDependencies": {
34
35
  "subscript": "^10.1.8",