@tempots/beatui 0.76.0 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +3 -3
- package/dist/beatui.css +11 -2
- package/dist/beatui.tailwind.css +11 -2
- package/dist/deep-merge-DBUbjJYt.cjs +1 -0
- package/dist/{deep-merge-CQQCMLwG.js → deep-merge-E6b9KE6l.js} +221 -223
- package/dist/{duration-input-D-SIoDoo.cjs → duration-input-CsygvJJ_.cjs} +1 -1
- package/dist/{duration-input-DKxZ6OCa.js → duration-input-j7bVks-S.js} +2 -2
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +238 -237
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +5 -5
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +3 -3
- package/dist/{modal-MofsfmAe.js → modal--5-j6x0s.js} +1 -1
- package/dist/{modal-5P9mU_a4.cjs → modal-rLbLQYhb.cjs} +1 -1
- package/dist/{notice-DP209Ed8.cjs → notice-BGaJ4k0O.cjs} +1 -1
- package/dist/{notice-Cqq8g17n.js → notice-BvS1_9Va.js} +1 -1
- package/dist/types/components/form/controller/controller-validation.d.ts +41 -0
- package/dist/types/components/json-schema/widgets/widget-customization.d.ts +7 -7
- package/dist/use-form-B4D58mxd.cjs +2 -0
- package/dist/{use-form-B7A865EM.js → use-form-DzA1RSrN.js} +115 -88
- package/dist/{widget-customization-GaZB6sLP.cjs → widget-customization-DKlfR6Qb.cjs} +1 -1
- package/dist/{widget-customization-CobH7Rj_.js → widget-customization-DfBf7gGp.js} +3 -3
- package/package.json +1 -1
- package/dist/deep-merge-DZxfgKqX.cjs +0 -1
- package/dist/use-form-DVJXMMoN.cjs +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../widget-customization-GaZB6sLP.cjs"),rr=require("../_commonjsHelpers-DwGv2jUC.cjs"),z=require("../use-form-DVJXMMoN.cjs"),G=require("../deep-merge-DZxfgKqX.cjs"),E=require("@tempots/dom"),Ne=require("../translations-hMQlZmD4.cjs"),xt=require("../notice-DP209Ed8.cjs"),ks=require("../colors-B9fcMxa_.cjs");var xe={exports:{}},pr={},we={},Re={},hr={},yr={},gr={},Br;function Xt(){return Br||(Br=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(o){if(super(),!e.IDENTIFIER.test(o))throw new Error("CodeGen: name must be a valid identifier");this.str=o}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(o){super(),this._items=typeof o=="string"?[o]:o}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const o=this._items[0];return o===""||o==='""'}get str(){var o;return(o=this._str)!==null&&o!==void 0?o:this._str=this._items.reduce((d,y)=>`${d}${y}`,"")}get names(){var o;return(o=this._names)!==null&&o!==void 0?o:this._names=this._items.reduce((d,y)=>(y instanceof r&&(d[y.str]=(d[y.str]||0)+1),d),{})}}e._Code=n,e.nil=new n("");function s(f,...o){const d=[f[0]];let y=0;for(;y<o.length;)c(d,o[y]),d.push(f[++y]);return new n(d)}e._=s;const a=new n("+");function i(f,...o){const d=[w(f[0])];let y=0;for(;y<o.length;)d.push(a),c(d,o[y]),d.push(a,w(f[++y]));return l(d),new n(d)}e.str=i;function c(f,o){o instanceof n?f.push(...o._items):o instanceof r?f.push(o):f.push(b(o))}e.addCodeArg=c;function l(f){let o=1;for(;o<f.length-1;){if(f[o]===a){const d=p(f[o-1],f[o+1]);if(d!==void 0){f.splice(o-1,3,d);continue}f[o++]="+"}o++}}function p(f,o){if(o==='""')return f;if(f==='""')return o;if(typeof f=="string")return o instanceof r||f[f.length-1]!=='"'?void 0:typeof o!="string"?`${f.slice(0,-1)}${o}"`:o[0]==='"'?f.slice(0,-1)+o.slice(1):void 0;if(typeof o=="string"&&o[0]==='"'&&!(f instanceof r))return`"${f}${o.slice(1)}`}function m(f,o){return o.emptyStr()?f:f.emptyStr()?o:i`${f}${o}`}e.strConcat=m;function b(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:w(Array.isArray(f)?f.join(","):f)}function g(f){return new n(w(f))}e.stringify=g;function w(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function S(f){return typeof f=="string"&&e.IDENTIFIER.test(f)?new n(`.${f}`):s`[${f}]`}e.getProperty=S;function h(f){if(typeof f=="string"&&e.IDENTIFIER.test(f))return new n(`${f}`);throw new Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}e.getEsmExportName=h;function u(f){return new n(f.toString())}e.regexpCode=u}(gr)),gr}var vr={},Hr;function Gr(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xt();class r extends Error{constructor(p){super(`CodeGen: "code" for ${p} not defined`),this.value=p.value}}var n;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:p,parent:m}={}){this._names={},this._prefixes=p,this._parent=m}toName(p){return p instanceof t.Name?p:this.name(p)}name(p){return new t.Name(this._newName(p))}_newName(p){const m=this._names[p]||this._nameGroup(p);return`${p}${m.index++}`}_nameGroup(p){var m,b;if(!((b=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||b===void 0)&&b.has(p)||this._prefixes&&!this._prefixes.has(p))throw new Error(`CodeGen: prefix "${p}" is not allowed in this scope`);return this._names[p]={prefix:p,index:0}}}e.Scope=s;class a extends t.Name{constructor(p,m){super(m),this.prefix=p}setValue(p,{property:m,itemIndex:b}){this.value=p,this.scopePath=(0,t._)`.${new t.Name(m)}[${b}]`}}e.ValueScopeName=a;const i=(0,t._)`\n`;class c extends s{constructor(p){super(p),this._values={},this._scope=p.scope,this.opts={...p,_n:p.lines?i:t.nil}}get(){return this._scope}name(p){return new a(p,this._newName(p))}value(p,m){var b;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(p),{prefix:w}=g,S=(b=m.key)!==null&&b!==void 0?b:m.ref;let h=this._values[w];if(h){const o=h.get(S);if(o)return o}else h=this._values[w]=new Map;h.set(S,g);const u=this._scope[w]||(this._scope[w]=[]),f=u.length;return u[f]=m.ref,g.setValue(m,{property:w,itemIndex:f}),g}getValue(p,m){const b=this._values[p];if(b)return b.get(m)}scopeRefs(p,m=this._values){return this._reduceValues(m,b=>{if(b.scopePath===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return(0,t._)`${p}${b.scopePath}`})}scopeCode(p=this._values,m,b){return this._reduceValues(p,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},m,b)}_reduceValues(p,m,b={},g){let w=t.nil;for(const S in p){const h=p[S];if(!h)continue;const u=b[S]=b[S]||new Map;h.forEach(f=>{if(u.has(f))return;u.set(f,n.Started);let o=m(f);if(o){const d=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,t._)`${w}${d} ${f} = ${o};${this.opts._n}`}else if(o=g?.(f))w=(0,t._)`${w}${o}${this.opts._n}`;else throw new r(f);u.set(f,n.Completed)})}return w}}e.ValueScope=c}(vr)),vr}var xr;function x(){return xr||(xr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Xt(),r=Gr();var n=Xt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Gr();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(v,P){return this}}class i extends a{constructor(v,P,k){super(),this.varKind=v,this.name=P,this.rhs=k}render({es5:v,_n:P}){const k=v?r.varKinds.var:this.varKind,U=this.rhs===void 0?"":` = ${this.rhs}`;return`${k} ${this.name}${U};`+P}optimizeNames(v,P){if(v[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,v,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(v,P,k){super(),this.lhs=v,this.rhs=P,this.sideEffects=k}render({_n:v}){return`${this.lhs} = ${this.rhs};`+v}optimizeNames(v,P){if(!(this.lhs instanceof t.Name&&!v[this.lhs.str]&&!this.sideEffects))return this.rhs=J(this.rhs,v,P),this}get names(){const v=this.lhs instanceof t.Name?{}:{...this.lhs.names};return W(v,this.rhs)}}class l extends c{constructor(v,P,k,U){super(v,k,U),this.op=P}render({_n:v}){return`${this.lhs} ${this.op}= ${this.rhs};`+v}}class p extends a{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`${this.label}:`+v}}class m extends a{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`break${this.label?` ${this.label}`:""};`+v}}class b extends a{constructor(v){super(),this.error=v}render({_n:v}){return`throw ${this.error};`+v}get names(){return this.error.names}}class g extends a{constructor(v){super(),this.code=v}render({_n:v}){return`${this.code};`+v}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(v,P){return this.code=J(this.code,v,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends a{constructor(v=[]){super(),this.nodes=v}render(v){return this.nodes.reduce((P,k)=>P+k.render(v),"")}optimizeNodes(){const{nodes:v}=this;let P=v.length;for(;P--;){const k=v[P].optimizeNodes();Array.isArray(k)?v.splice(P,1,...k):k?v[P]=k:v.splice(P,1)}return v.length>0?this:void 0}optimizeNames(v,P){const{nodes:k}=this;let U=k.length;for(;U--;){const D=k[U];D.optimizeNames(v,P)||(re(v,D.names),k.splice(U,1))}return k.length>0?this:void 0}get names(){return this.nodes.reduce((v,P)=>F(v,P.names),{})}}class S extends w{render(v){return"{"+v._n+super.render(v)+"}"+v._n}}class h extends w{}class u extends S{}u.kind="else";class f extends S{constructor(v,P){super(P),this.condition=v}render(v){let P=`if(${this.condition})`+super.render(v);return this.else&&(P+="else "+this.else.render(v)),P}optimizeNodes(){super.optimizeNodes();const v=this.condition;if(v===!0)return this.nodes;let P=this.else;if(P){const k=P.optimizeNodes();P=this.else=Array.isArray(k)?new u(k):k}if(P)return v===!1?P instanceof f?P:P.nodes:this.nodes.length?this:new f(oe(v),P instanceof f?[P]:P.nodes);if(!(v===!1||!this.nodes.length))return this}optimizeNames(v,P){var k;if(this.else=(k=this.else)===null||k===void 0?void 0:k.optimizeNames(v,P),!!(super.optimizeNames(v,P)||this.else))return this.condition=J(this.condition,v,P),this}get names(){const v=super.names;return W(v,this.condition),this.else&&F(v,this.else.names),v}}f.kind="if";class o extends S{}o.kind="for";class d extends o{constructor(v){super(),this.iteration=v}render(v){return`for(${this.iteration})`+super.render(v)}optimizeNames(v,P){if(super.optimizeNames(v,P))return this.iteration=J(this.iteration,v,P),this}get names(){return F(super.names,this.iteration.names)}}class y extends o{constructor(v,P,k,U){super(),this.varKind=v,this.name=P,this.from=k,this.to=U}render(v){const P=v.es5?r.varKinds.var:this.varKind,{name:k,from:U,to:D}=this;return`for(${P} ${k}=${U}; ${k}<${D}; ${k}++)`+super.render(v)}get names(){const v=W(super.names,this.from);return W(v,this.to)}}class $ extends o{constructor(v,P,k,U){super(),this.loop=v,this.varKind=P,this.name=k,this.iterable=U}render(v){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(v)}optimizeNames(v,P){if(super.optimizeNames(v,P))return this.iterable=J(this.iterable,v,P),this}get names(){return F(super.names,this.iterable.names)}}class _ extends S{constructor(v,P,k){super(),this.name=v,this.args=P,this.async=k}render(v){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(v)}}_.kind="func";class j extends w{render(v){return"return "+super.render(v)}}j.kind="return";class I extends S{render(v){let P="try"+super.render(v);return this.catch&&(P+=this.catch.render(v)),this.finally&&(P+=this.finally.render(v)),P}optimizeNodes(){var v,P;return super.optimizeNodes(),(v=this.catch)===null||v===void 0||v.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(v,P){var k,U;return super.optimizeNames(v,P),(k=this.catch)===null||k===void 0||k.optimizeNames(v,P),(U=this.finally)===null||U===void 0||U.optimizeNames(v,P),this}get names(){const v=super.names;return this.catch&&F(v,this.catch.names),this.finally&&F(v,this.finally.names),v}}class M extends S{constructor(v){super(),this.error=v}render(v){return`catch(${this.error})`+super.render(v)}}M.kind="catch";class K extends S{render(v){return"finally"+super.render(v)}}K.kind="finally";class C{constructor(v,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../widget-customization-DKlfR6Qb.cjs"),rr=require("../_commonjsHelpers-DwGv2jUC.cjs"),z=require("../use-form-B4D58mxd.cjs"),G=require("../deep-merge-DBUbjJYt.cjs"),E=require("@tempots/dom"),Ne=require("../translations-hMQlZmD4.cjs"),xt=require("../notice-BGaJ4k0O.cjs"),ks=require("../colors-B9fcMxa_.cjs");var xe={exports:{}},pr={},we={},Re={},hr={},yr={},gr={},Br;function Xt(){return Br||(Br=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(o){if(super(),!e.IDENTIFIER.test(o))throw new Error("CodeGen: name must be a valid identifier");this.str=o}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(o){super(),this._items=typeof o=="string"?[o]:o}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const o=this._items[0];return o===""||o==='""'}get str(){var o;return(o=this._str)!==null&&o!==void 0?o:this._str=this._items.reduce((d,y)=>`${d}${y}`,"")}get names(){var o;return(o=this._names)!==null&&o!==void 0?o:this._names=this._items.reduce((d,y)=>(y instanceof r&&(d[y.str]=(d[y.str]||0)+1),d),{})}}e._Code=n,e.nil=new n("");function s(f,...o){const d=[f[0]];let y=0;for(;y<o.length;)c(d,o[y]),d.push(f[++y]);return new n(d)}e._=s;const a=new n("+");function i(f,...o){const d=[w(f[0])];let y=0;for(;y<o.length;)d.push(a),c(d,o[y]),d.push(a,w(f[++y]));return l(d),new n(d)}e.str=i;function c(f,o){o instanceof n?f.push(...o._items):o instanceof r?f.push(o):f.push(b(o))}e.addCodeArg=c;function l(f){let o=1;for(;o<f.length-1;){if(f[o]===a){const d=p(f[o-1],f[o+1]);if(d!==void 0){f.splice(o-1,3,d);continue}f[o++]="+"}o++}}function p(f,o){if(o==='""')return f;if(f==='""')return o;if(typeof f=="string")return o instanceof r||f[f.length-1]!=='"'?void 0:typeof o!="string"?`${f.slice(0,-1)}${o}"`:o[0]==='"'?f.slice(0,-1)+o.slice(1):void 0;if(typeof o=="string"&&o[0]==='"'&&!(f instanceof r))return`"${f}${o.slice(1)}`}function m(f,o){return o.emptyStr()?f:f.emptyStr()?o:i`${f}${o}`}e.strConcat=m;function b(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:w(Array.isArray(f)?f.join(","):f)}function g(f){return new n(w(f))}e.stringify=g;function w(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function S(f){return typeof f=="string"&&e.IDENTIFIER.test(f)?new n(`.${f}`):s`[${f}]`}e.getProperty=S;function h(f){if(typeof f=="string"&&e.IDENTIFIER.test(f))return new n(`${f}`);throw new Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}e.getEsmExportName=h;function u(f){return new n(f.toString())}e.regexpCode=u}(gr)),gr}var vr={},Hr;function Gr(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xt();class r extends Error{constructor(p){super(`CodeGen: "code" for ${p} not defined`),this.value=p.value}}var n;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:p,parent:m}={}){this._names={},this._prefixes=p,this._parent=m}toName(p){return p instanceof t.Name?p:this.name(p)}name(p){return new t.Name(this._newName(p))}_newName(p){const m=this._names[p]||this._nameGroup(p);return`${p}${m.index++}`}_nameGroup(p){var m,b;if(!((b=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||b===void 0)&&b.has(p)||this._prefixes&&!this._prefixes.has(p))throw new Error(`CodeGen: prefix "${p}" is not allowed in this scope`);return this._names[p]={prefix:p,index:0}}}e.Scope=s;class a extends t.Name{constructor(p,m){super(m),this.prefix=p}setValue(p,{property:m,itemIndex:b}){this.value=p,this.scopePath=(0,t._)`.${new t.Name(m)}[${b}]`}}e.ValueScopeName=a;const i=(0,t._)`\n`;class c extends s{constructor(p){super(p),this._values={},this._scope=p.scope,this.opts={...p,_n:p.lines?i:t.nil}}get(){return this._scope}name(p){return new a(p,this._newName(p))}value(p,m){var b;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(p),{prefix:w}=g,S=(b=m.key)!==null&&b!==void 0?b:m.ref;let h=this._values[w];if(h){const o=h.get(S);if(o)return o}else h=this._values[w]=new Map;h.set(S,g);const u=this._scope[w]||(this._scope[w]=[]),f=u.length;return u[f]=m.ref,g.setValue(m,{property:w,itemIndex:f}),g}getValue(p,m){const b=this._values[p];if(b)return b.get(m)}scopeRefs(p,m=this._values){return this._reduceValues(m,b=>{if(b.scopePath===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return(0,t._)`${p}${b.scopePath}`})}scopeCode(p=this._values,m,b){return this._reduceValues(p,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},m,b)}_reduceValues(p,m,b={},g){let w=t.nil;for(const S in p){const h=p[S];if(!h)continue;const u=b[S]=b[S]||new Map;h.forEach(f=>{if(u.has(f))return;u.set(f,n.Started);let o=m(f);if(o){const d=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,t._)`${w}${d} ${f} = ${o};${this.opts._n}`}else if(o=g?.(f))w=(0,t._)`${w}${o}${this.opts._n}`;else throw new r(f);u.set(f,n.Completed)})}return w}}e.ValueScope=c}(vr)),vr}var xr;function x(){return xr||(xr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Xt(),r=Gr();var n=Xt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Gr();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(v,P){return this}}class i extends a{constructor(v,P,k){super(),this.varKind=v,this.name=P,this.rhs=k}render({es5:v,_n:P}){const k=v?r.varKinds.var:this.varKind,U=this.rhs===void 0?"":` = ${this.rhs}`;return`${k} ${this.name}${U};`+P}optimizeNames(v,P){if(v[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,v,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(v,P,k){super(),this.lhs=v,this.rhs=P,this.sideEffects=k}render({_n:v}){return`${this.lhs} = ${this.rhs};`+v}optimizeNames(v,P){if(!(this.lhs instanceof t.Name&&!v[this.lhs.str]&&!this.sideEffects))return this.rhs=J(this.rhs,v,P),this}get names(){const v=this.lhs instanceof t.Name?{}:{...this.lhs.names};return W(v,this.rhs)}}class l extends c{constructor(v,P,k,U){super(v,k,U),this.op=P}render({_n:v}){return`${this.lhs} ${this.op}= ${this.rhs};`+v}}class p extends a{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`${this.label}:`+v}}class m extends a{constructor(v){super(),this.label=v,this.names={}}render({_n:v}){return`break${this.label?` ${this.label}`:""};`+v}}class b extends a{constructor(v){super(),this.error=v}render({_n:v}){return`throw ${this.error};`+v}get names(){return this.error.names}}class g extends a{constructor(v){super(),this.code=v}render({_n:v}){return`${this.code};`+v}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(v,P){return this.code=J(this.code,v,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends a{constructor(v=[]){super(),this.nodes=v}render(v){return this.nodes.reduce((P,k)=>P+k.render(v),"")}optimizeNodes(){const{nodes:v}=this;let P=v.length;for(;P--;){const k=v[P].optimizeNodes();Array.isArray(k)?v.splice(P,1,...k):k?v[P]=k:v.splice(P,1)}return v.length>0?this:void 0}optimizeNames(v,P){const{nodes:k}=this;let U=k.length;for(;U--;){const D=k[U];D.optimizeNames(v,P)||(re(v,D.names),k.splice(U,1))}return k.length>0?this:void 0}get names(){return this.nodes.reduce((v,P)=>F(v,P.names),{})}}class S extends w{render(v){return"{"+v._n+super.render(v)+"}"+v._n}}class h extends w{}class u extends S{}u.kind="else";class f extends S{constructor(v,P){super(P),this.condition=v}render(v){let P=`if(${this.condition})`+super.render(v);return this.else&&(P+="else "+this.else.render(v)),P}optimizeNodes(){super.optimizeNodes();const v=this.condition;if(v===!0)return this.nodes;let P=this.else;if(P){const k=P.optimizeNodes();P=this.else=Array.isArray(k)?new u(k):k}if(P)return v===!1?P instanceof f?P:P.nodes:this.nodes.length?this:new f(oe(v),P instanceof f?[P]:P.nodes);if(!(v===!1||!this.nodes.length))return this}optimizeNames(v,P){var k;if(this.else=(k=this.else)===null||k===void 0?void 0:k.optimizeNames(v,P),!!(super.optimizeNames(v,P)||this.else))return this.condition=J(this.condition,v,P),this}get names(){const v=super.names;return W(v,this.condition),this.else&&F(v,this.else.names),v}}f.kind="if";class o extends S{}o.kind="for";class d extends o{constructor(v){super(),this.iteration=v}render(v){return`for(${this.iteration})`+super.render(v)}optimizeNames(v,P){if(super.optimizeNames(v,P))return this.iteration=J(this.iteration,v,P),this}get names(){return F(super.names,this.iteration.names)}}class y extends o{constructor(v,P,k,U){super(),this.varKind=v,this.name=P,this.from=k,this.to=U}render(v){const P=v.es5?r.varKinds.var:this.varKind,{name:k,from:U,to:D}=this;return`for(${P} ${k}=${U}; ${k}<${D}; ${k}++)`+super.render(v)}get names(){const v=W(super.names,this.from);return W(v,this.to)}}class $ extends o{constructor(v,P,k,U){super(),this.loop=v,this.varKind=P,this.name=k,this.iterable=U}render(v){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(v)}optimizeNames(v,P){if(super.optimizeNames(v,P))return this.iterable=J(this.iterable,v,P),this}get names(){return F(super.names,this.iterable.names)}}class _ extends S{constructor(v,P,k){super(),this.name=v,this.args=P,this.async=k}render(v){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(v)}}_.kind="func";class j extends w{render(v){return"return "+super.render(v)}}j.kind="return";class I extends S{render(v){let P="try"+super.render(v);return this.catch&&(P+=this.catch.render(v)),this.finally&&(P+=this.finally.render(v)),P}optimizeNodes(){var v,P;return super.optimizeNodes(),(v=this.catch)===null||v===void 0||v.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(v,P){var k,U;return super.optimizeNames(v,P),(k=this.catch)===null||k===void 0||k.optimizeNames(v,P),(U=this.finally)===null||U===void 0||U.optimizeNames(v,P),this}get names(){const v=super.names;return this.catch&&F(v,this.catch.names),this.finally&&F(v,this.finally.names),v}}class M extends S{constructor(v){super(),this.error=v}render(v){return`catch(${this.error})`+super.render(v)}}M.kind="catch";class K extends S{render(v){return"finally"+super.render(v)}}K.kind="finally";class C{constructor(v,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
|
|
2
2
|
`:""},this._extScope=v,this._scope=new r.Scope({parent:v}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(v){return this._scope.name(v)}scopeName(v){return this._extScope.name(v)}scopeValue(v,P){const k=this._extScope.value(v,P);return(this._values[k.prefix]||(this._values[k.prefix]=new Set)).add(k),k}getScopeValue(v,P){return this._extScope.getValue(v,P)}scopeRefs(v){return this._extScope.scopeRefs(v,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(v,P,k,U){const D=this._scope.toName(P);return k!==void 0&&U&&(this._constants[D.str]=k),this._leafNode(new i(v,D,k)),D}const(v,P,k){return this._def(r.varKinds.const,v,P,k)}let(v,P,k){return this._def(r.varKinds.let,v,P,k)}var(v,P,k){return this._def(r.varKinds.var,v,P,k)}assign(v,P,k){return this._leafNode(new c(v,P,k))}add(v,P){return this._leafNode(new l(v,e.operators.ADD,P))}code(v){return typeof v=="function"?v():v!==t.nil&&this._leafNode(new g(v)),this}object(...v){const P=["{"];for(const[k,U]of v)P.length>1&&P.push(","),P.push(k),(k!==U||this.opts.es5)&&(P.push(":"),(0,t.addCodeArg)(P,U));return P.push("}"),new t._Code(P)}if(v,P,k){if(this._blockNode(new f(v)),P&&k)this.code(P).else().code(k).endIf();else if(P)this.code(P).endIf();else if(k)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(v){return this._elseNode(new f(v))}else(){return this._elseNode(new u)}endIf(){return this._endBlockNode(f,u)}_for(v,P){return this._blockNode(v),P&&this.code(P).endFor(),this}for(v,P){return this._for(new d(v),P)}forRange(v,P,k,U,D=this.opts.es5?r.varKinds.var:r.varKinds.let){const Z=this._scope.toName(v);return this._for(new y(D,Z,P,k),()=>U(Z))}forOf(v,P,k,U=r.varKinds.const){const D=this._scope.toName(v);if(this.opts.es5){const Z=P instanceof t.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,t._)`${Z}.length`,X=>{this.var(D,(0,t._)`${Z}[${X}]`),k(D)})}return this._for(new $("of",U,D,P),()=>k(D))}forIn(v,P,k,U=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(v,(0,t._)`Object.keys(${P})`,k);const D=this._scope.toName(v);return this._for(new $("in",U,D,P),()=>k(D))}endFor(){return this._endBlockNode(o)}label(v){return this._leafNode(new p(v))}break(v){return this._leafNode(new m(v))}return(v){const P=new j;if(this._blockNode(P),this.code(v),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(j)}try(v,P,k){if(!P&&!k)throw new Error('CodeGen: "try" without "catch" and "finally"');const U=new I;if(this._blockNode(U),this.code(v),P){const D=this.name("e");this._currNode=U.catch=new M(D),P(D)}return k&&(this._currNode=U.finally=new K,this.code(k)),this._endBlockNode(M,K)}throw(v){return this._leafNode(new b(v))}block(v,P){return this._blockStarts.push(this._nodes.length),v&&this.code(v).endBlock(P),this}endBlock(v){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const k=this._nodes.length-P;if(k<0||v!==void 0&&k!==v)throw new Error(`CodeGen: wrong number of nodes: ${k} vs ${v} expected`);return this._nodes.length=P,this}func(v,P=t.nil,k,U){return this._blockNode(new _(v,P,k)),U&&this.code(U).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(v=1){for(;v-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(v){return this._currNode.nodes.push(v),this}_blockNode(v){this._currNode.nodes.push(v),this._nodes.push(v)}_endBlockNode(v,P){const k=this._currNode;if(k instanceof v||P&&k instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${v.kind}/${P.kind}`:v.kind}"`)}_elseNode(v){const P=this._currNode;if(!(P instanceof f))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=v,this}get _root(){return this._nodes[0]}get _currNode(){const v=this._nodes;return v[v.length-1]}set _currNode(v){const P=this._nodes;P[P.length-1]=v}}e.CodeGen=C;function F(N,v){for(const P in v)N[P]=(N[P]||0)+(v[P]||0);return N}function W(N,v){return v instanceof t._CodeOrName?F(N,v.names):N}function J(N,v,P){if(N instanceof t.Name)return k(N);if(!U(N))return N;return new t._Code(N._items.reduce((D,Z)=>(Z instanceof t.Name&&(Z=k(Z)),Z instanceof t._Code?D.push(...Z._items):D.push(Z),D),[]));function k(D){const Z=P[D.str];return Z===void 0||v[D.str]!==1?D:(delete v[D.str],Z)}function U(D){return D instanceof t._Code&&D._items.some(Z=>Z instanceof t.Name&&v[Z.str]===1&&P[Z.str]!==void 0)}}function re(N,v){for(const P in v)N[P]=(N[P]||0)-(v[P]||0)}function oe(N){return typeof N=="boolean"||typeof N=="number"||N===null?!N:(0,t._)`!${T(N)}`}e.not=oe;const ne=R(e.operators.AND);function Y(...N){return N.reduce(ne)}e.and=Y;const se=R(e.operators.OR);function V(...N){return N.reduce(se)}e.or=V;function R(N){return(v,P)=>v===t.nil?P:P===t.nil?v:(0,t._)`${T(v)} ${N} ${T(P)}`}function T(N){return N instanceof t.Name?N:(0,t._)`(${N})`}}(yr)),yr}var Q={},Xr;function te(){if(Xr)return Q;Xr=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;const e=x(),t=Xt();function r($){const _={};for(const j of $)_[j]=!0;return _}Q.toHash=r;function n($,_){return typeof _=="boolean"?_:Object.keys(_).length===0?!0:(s($,_),!a(_,$.self.RULES.all))}Q.alwaysValidSchema=n;function s($,_=$.schema){const{opts:j,self:I}=$;if(!j.strictSchema||typeof _=="boolean")return;const M=I.RULES.keywords;for(const K in _)M[K]||y($,`unknown keyword: "${K}"`)}Q.checkUnknownRules=s;function a($,_){if(typeof $=="boolean")return!$;for(const j in $)if(_[j])return!0;return!1}Q.schemaHasRules=a;function i($,_){if(typeof $=="boolean")return!$;for(const j in $)if(j!=="$ref"&&_.all[j])return!0;return!1}Q.schemaHasRulesButRef=i;function c({topSchemaRef:$,schemaPath:_},j,I,M){if(!M){if(typeof j=="number"||typeof j=="boolean")return j;if(typeof j=="string")return(0,e._)`${j}`}return(0,e._)`${$}${_}${(0,e.getProperty)(I)}`}Q.schemaRefOrVal=c;function l($){return b(decodeURIComponent($))}Q.unescapeFragment=l;function p($){return encodeURIComponent(m($))}Q.escapeFragment=p;function m($){return typeof $=="number"?`${$}`:$.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=m;function b($){return $.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=b;function g($,_){if(Array.isArray($))for(const j of $)_(j);else _($)}Q.eachItem=g;function w({mergeNames:$,mergeToName:_,mergeValues:j,resultToName:I}){return(M,K,C,F)=>{const W=C===void 0?K:C instanceof e.Name?(K instanceof e.Name?$(M,K,C):_(M,K,C),C):K instanceof e.Name?(_(M,C,K),K):j(K,C);return F===e.Name&&!(W instanceof e.Name)?I(M,W):W}}Q.mergeEvaluated={props:w({mergeNames:($,_,j)=>$.if((0,e._)`${j} !== true && ${_} !== undefined`,()=>{$.if((0,e._)`${_} === true`,()=>$.assign(j,!0),()=>$.assign(j,(0,e._)`${j} || {}`).code((0,e._)`Object.assign(${j}, ${_})`))}),mergeToName:($,_,j)=>$.if((0,e._)`${j} !== true`,()=>{_===!0?$.assign(j,!0):($.assign(j,(0,e._)`${j} || {}`),h($,j,_))}),mergeValues:($,_)=>$===!0?!0:{...$,..._},resultToName:S}),items:w({mergeNames:($,_,j)=>$.if((0,e._)`${j} !== true && ${_} !== undefined`,()=>$.assign(j,(0,e._)`${_} === true ? true : ${j} > ${_} ? ${j} : ${_}`)),mergeToName:($,_,j)=>$.if((0,e._)`${j} !== true`,()=>$.assign(j,_===!0?!0:(0,e._)`${j} > ${_} ? ${j} : ${_}`)),mergeValues:($,_)=>$===!0?!0:Math.max($,_),resultToName:($,_)=>$.var("items",_)})};function S($,_){if(_===!0)return $.var("props",!0);const j=$.var("props",(0,e._)`{}`);return _!==void 0&&h($,j,_),j}Q.evaluatedPropsToName=S;function h($,_,j){Object.keys(j).forEach(I=>$.assign((0,e._)`${_}${(0,e.getProperty)(I)}`,!0))}Q.setEvaluated=h;const u={};function f($,_){return $.scopeValue("func",{ref:_,code:u[_.code]||(u[_.code]=new t._Code(_.code))})}Q.useFunc=f;var o;(function($){$[$.Num=0]="Num",$[$.Str=1]="Str"})(o||(Q.Type=o={}));function d($,_,j){if($ instanceof e.Name){const I=_===o.Num;return j?I?(0,e._)`"[" + ${$} + "]"`:(0,e._)`"['" + ${$} + "']"`:I?(0,e._)`"/" + ${$}`:(0,e._)`"/" + ${$}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return j?(0,e.getProperty)($).toString():"/"+m($)}Q.getErrorPath=d;function y($,_,j=$.opts.strictSchema){if(j){if(_=`strict mode: ${_}`,j===!0)throw new Error(_);$.self.logger.warn(_)}}return Q.checkStrictMode=y,Q}var Xe={},Zr;function be(){if(Zr)return Xe;Zr=1,Object.defineProperty(Xe,"__esModule",{value:!0});const e=x(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Xe.default=t,Xe}var Yr;function nr(){return Yr||(Yr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=x(),r=te(),n=be();e.keywordError={message:({keyword:u})=>(0,t.str)`must pass "${u}" keyword validation`},e.keyword$DataError={message:({keyword:u,schemaType:f})=>f?(0,t.str)`"${u}" keyword must be ${f} ($data)`:(0,t.str)`"${u}" keyword is invalid ($data)`};function s(u,f=e.keywordError,o,d){const{it:y}=u,{gen:$,compositeRule:_,allErrors:j}=y,I=b(u,f,o);d??(_||j)?l($,I):p(y,(0,t._)`[${I}]`)}e.reportError=s;function a(u,f=e.keywordError,o){const{it:d}=u,{gen:y,compositeRule:$,allErrors:_}=d,j=b(u,f,o);l(y,j),$||_||p(d,n.default.vErrors)}e.reportExtraError=a;function i(u,f){u.assign(n.default.errors,f),u.if((0,t._)`${n.default.vErrors} !== null`,()=>u.if(f,()=>u.assign((0,t._)`${n.default.vErrors}.length`,f),()=>u.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:u,keyword:f,schemaValue:o,data:d,errsCount:y,it:$}){if(y===void 0)throw new Error("ajv implementation error");const _=u.name("err");u.forRange("i",y,n.default.errors,j=>{u.const(_,(0,t._)`${n.default.vErrors}[${j}]`),u.if((0,t._)`${_}.instancePath === undefined`,()=>u.assign((0,t._)`${_}.instancePath`,(0,t.strConcat)(n.default.instancePath,$.errorPath))),u.assign((0,t._)`${_}.schemaPath`,(0,t.str)`${$.errSchemaPath}/${f}`),$.opts.verbose&&(u.assign((0,t._)`${_}.schema`,o),u.assign((0,t._)`${_}.data`,d))})}e.extendErrors=c;function l(u,f){const o=u.const("err",f);u.if((0,t._)`${n.default.vErrors} === null`,()=>u.assign(n.default.vErrors,(0,t._)`[${o}]`),(0,t._)`${n.default.vErrors}.push(${o})`),u.code((0,t._)`${n.default.errors}++`)}function p(u,f){const{gen:o,validateName:d,schemaEnv:y}=u;y.$async?o.throw((0,t._)`new ${u.ValidationError}(${f})`):(o.assign((0,t._)`${d}.errors`,f),o.return(!1))}const m={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function b(u,f,o){const{createErrors:d}=u.it;return d===!1?(0,t._)`{}`:g(u,f,o)}function g(u,f,o={}){const{gen:d,it:y}=u,$=[w(y,o),S(u,o)];return h(u,f,$),d.object(...$)}function w({errorPath:u},{instancePath:f}){const o=f?(0,t.str)`${u}${(0,r.getErrorPath)(f,r.Type.Str)}`:u;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,o)]}function S({keyword:u,it:{errSchemaPath:f}},{schemaPath:o,parentSchema:d}){let y=d?f:(0,t.str)`${f}/${u}`;return o&&(y=(0,t.str)`${y}${(0,r.getErrorPath)(o,r.Type.Str)}`),[m.schemaPath,y]}function h(u,{params:f,message:o},d){const{keyword:y,data:$,schemaValue:_,it:j}=u,{opts:I,propertyName:M,topSchemaRef:K,schemaPath:C}=j;d.push([m.keyword,y],[m.params,typeof f=="function"?f(u):f||(0,t._)`{}`]),I.messages&&d.push([m.message,typeof o=="function"?o(u):o]),I.verbose&&d.push([m.schema,_],[m.parentSchema,(0,t._)`${K}${C}`],[n.default.data,$]),M&&d.push([m.propertyName,M])}}(hr)),hr}var Qr;function As(){if(Qr)return Re;Qr=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.boolOrEmptySchema=Re.topBoolOrEmptySchema=void 0;const e=nr(),t=x(),r=be(),n={message:"boolean schema is false"};function s(c){const{gen:l,schema:p,validateName:m}=c;p===!1?i(c,!1):typeof p=="object"&&p.$async===!0?l.return(r.default.data):(l.assign((0,t._)`${m}.errors`,null),l.return(!0))}Re.topBoolOrEmptySchema=s;function a(c,l){const{gen:p,schema:m}=c;m===!1?(p.var(l,!1),i(c)):p.var(l,!0)}Re.boolOrEmptySchema=a;function i(c,l){const{gen:p,data:m}=c,b={gen:p,keyword:"false schema",data:m,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(b,n,void 0,l)}return Re}var le={},ke={},en;function La(){if(en)return ke;en=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.getRules=ke.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function r(s){return typeof s=="string"&&t.has(s)}ke.isJSONType=r;function n(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return ke.getRules=n,ke}var Se={},tn;function Ua(){if(tn)return Se;tn=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.shouldUseRule=Se.shouldUseGroup=Se.schemaHasRulesForType=void 0;function e({schema:n,self:s},a){const i=s.RULES.types[a];return i&&i!==!0&&t(n,i)}Se.schemaHasRulesForType=e;function t(n,s){return s.rules.some(a=>r(n,a))}Se.shouldUseGroup=t;function r(n,s){var a;return n[s.keyword]!==void 0||((a=s.definition.implements)===null||a===void 0?void 0:a.some(i=>n[i]!==void 0))}return Se.shouldUseRule=r,Se}var rn;function Zt(){if(rn)return le;rn=1,Object.defineProperty(le,"__esModule",{value:!0}),le.reportTypeError=le.checkDataTypes=le.checkDataType=le.coerceAndCheckDataType=le.getJSONTypes=le.getSchemaTypes=le.DataType=void 0;const e=La(),t=Ua(),r=nr(),n=x(),s=te();var a;(function(o){o[o.Correct=0]="Correct",o[o.Wrong=1]="Wrong"})(a||(le.DataType=a={}));function i(o){const d=c(o.type);if(d.includes("null")){if(o.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!d.length&&o.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');o.nullable===!0&&d.push("null")}return d}le.getSchemaTypes=i;function c(o){const d=Array.isArray(o)?o:o?[o]:[];if(d.every(e.isJSONType))return d;throw new Error("type must be JSONType or JSONType[]: "+d.join(","))}le.getJSONTypes=c;function l(o,d){const{gen:y,data:$,opts:_}=o,j=m(d,_.coerceTypes),I=d.length>0&&!(j.length===0&&d.length===1&&(0,t.schemaHasRulesForType)(o,d[0]));if(I){const M=S(d,$,_.strictNumbers,a.Wrong);y.if(M,()=>{j.length?b(o,d,j):u(o)})}return I}le.coerceAndCheckDataType=l;const p=new Set(["string","number","integer","boolean","null"]);function m(o,d){return d?o.filter(y=>p.has(y)||d==="array"&&y==="array"):[]}function b(o,d,y){const{gen:$,data:_,opts:j}=o,I=$.let("dataType",(0,n._)`typeof ${_}`),M=$.let("coerced",(0,n._)`undefined`);j.coerceTypes==="array"&&$.if((0,n._)`${I} == 'object' && Array.isArray(${_}) && ${_}.length == 1`,()=>$.assign(_,(0,n._)`${_}[0]`).assign(I,(0,n._)`typeof ${_}`).if(S(d,_,j.strictNumbers),()=>$.assign(M,_))),$.if((0,n._)`${M} !== undefined`);for(const C of y)(p.has(C)||C==="array"&&j.coerceTypes==="array")&&K(C);$.else(),u(o),$.endIf(),$.if((0,n._)`${M} !== undefined`,()=>{$.assign(_,M),g(o,M)});function K(C){switch(C){case"string":$.elseIf((0,n._)`${I} == "number" || ${I} == "boolean"`).assign(M,(0,n._)`"" + ${_}`).elseIf((0,n._)`${_} === null`).assign(M,(0,n._)`""`);return;case"number":$.elseIf((0,n._)`${I} == "boolean" || ${_} === null
|
|
3
3
|
|| (${I} == "string" && ${_} && ${_} == +${_})`).assign(M,(0,n._)`+${_}`);return;case"integer":$.elseIf((0,n._)`${I} === "boolean" || ${_} === null
|
|
4
4
|
|| (${I} === "string" && ${_} && ${_} == +${_} && !(${_} % 1))`).assign(M,(0,n._)`+${_}`);return;case"boolean":$.elseIf((0,n._)`${_} === "false" || ${_} === 0 || ${_} === null`).assign(M,!1).elseIf((0,n._)`${_} === "true" || ${_} === 1`).assign(M,!0);return;case"null":$.elseIf((0,n._)`${_} === "" || ${_} === 0 || ${_} === false`),$.assign(M,null);return;case"array":$.elseIf((0,n._)`${I} === "string" || ${I} === "number"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { U as sn, V as ye, B as Gs, o as ze, m as br, p as Xs, C as Zs, t as Ys, l as xs, j as Qs, N as ei, k as ti, s as ri, r as ni, q as ai, R as si, S as ii, E as rs, W as oi, u as ci, X as ui } from "../widget-customization-
|
|
2
|
-
import { Y as gf, c as vf, d as $f, f as bf } from "../widget-customization-
|
|
1
|
+
import { U as sn, V as ye, B as Gs, o as ze, m as br, p as Xs, C as Zs, t as Ys, l as xs, j as Qs, N as ei, k as ti, s as ri, r as ni, q as ai, R as si, S as ii, E as rs, W as oi, u as ci, X as ui } from "../widget-customization-DfBf7gGp.js";
|
|
2
|
+
import { Y as gf, c as vf, d as $f, f as bf } from "../widget-customization-DfBf7gGp.js";
|
|
3
3
|
import { g as dr } from "../_commonjsHelpers-C6fGbg64.js";
|
|
4
|
-
import { a as Ee, S as me, I as nt, c as te, j as _r, b as on, L as We, M as li, C as ns, g as di, A as fi, h as mi } from "../use-form-
|
|
5
|
-
import { _ as Kr, g as pi, S as hi, f as yi, N as as, l as de, W as gi, e as vi, t as Xe, T as $i, U as bi, b as Mr, c as _i, M as st, h as wi, G as Si, L as Pi, i as ji, j as Ei } from "../deep-merge-
|
|
4
|
+
import { a as Ee, S as me, I as nt, c as te, j as _r, b as on, L as We, M as li, C as ns, g as di, A as fi, h as mi } from "../use-form-DzA1RSrN.js";
|
|
5
|
+
import { _ as Kr, g as pi, S as hi, f as yi, N as as, l as de, W as gi, e as vi, t as Xe, T as $i, U as bi, b as Mr, c as _i, M as st, h as wi, G as Si, L as Pi, i as ji, j as Ei } from "../deep-merge-E6b9KE6l.js";
|
|
6
6
|
import { attr as K, Value as ae, Fragment as ke, WithElement as ss, Empty as is, html as J, When as et, computedOf as ce, prop as Ne, Use as Wr, style as os, Ensure as cs, aria as Oi, on as tt, MapSignal as fr, Async as Ri, OnDispose as Ai } from "@tempots/dom";
|
|
7
7
|
import { T as ki, a as Br, c as us, B as Ni } from "../translations-DQxouiBG.js";
|
|
8
|
-
import { P as Ii, E as Ci, N as ls } from "../notice-
|
|
8
|
+
import { P as Ii, E as Ci, N as ls } from "../notice-BvS1_9Va.js";
|
|
9
9
|
import { f as Ti } from "../colors-pQZlNrwM.js";
|
|
10
10
|
var it = { exports: {} }, wr = {}, Oe = {}, Te = {}, Sr = {}, Pr = {}, jr = {}, cn;
|
|
11
11
|
function ir() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../deep-merge-DZxfgKqX.cjs"),l=require("@tempots/dom"),d=require("../use-form-DVJXMMoN.cjs"),P=require("../translations-hMQlZmD4.cjs"),C=require("../duration-input-D-SIoDoo.cjs"),Ke=require("../colors-B9fcMxa_.cjs");function le(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function q(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function U(e){return e==="float"||e==="double"||e==="decimal"}function ce(e){return q(e)||U(e)}function W(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function pe(e){return e==="string"||e==="boolean"||e==="null"||ce(e)||W(e)||e==="uuid"||e==="uri"||e==="binary"}function Ze(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function D(e){return typeof e=="object"&&e!==null&&"$ref"in e}function de(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function fe(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function M(e){return e.type==="object"&&"properties"in e}function Z(e){return e.type==="array"&&"items"in e}function H(e){return e.type==="set"&&"items"in e}function X(e){return e.type==="map"&&"values"in e}function Y(e){return e.type==="tuple"&&"tuple"in e}function Q(e){return e.type==="choice"&&"choices"in e}function me(e){return"enum"in e&&Array.isArray(e.enum)}function ye(e){return"const"in e}function J(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(D(e),null)}function ge(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function B(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function he(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function He(e,t){let r=e;for(const n of t){if(r==null||typeof r!="object")return;r=r[n]}return r}function R(e,t){const r=he(e),n=He(t,r);if(n==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(fe(n))return n;if(de(n)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Xe(e,t){return R(e.$ref,t)}class be{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const r=R(t,this.schema);if(r?.type&&D(r.type)){const n=this.resolve(r.type.$ref);if(n){const{type:s,...a}=r;return{...n,...a}}}return r}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&D(t.type)){const r=this.resolve(t.type.$ref);if(r){const{type:n,...s}=t;return{...r,...s}}}return t}reset(){this.visited.clear()}}function _(e){return new be(e)}class z{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??_(t.schema)}with(t){return new z({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(D(t)){const r=this.refResolver.resolve(t.$ref);return r?.type?J(r.type):null}return J(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:B(t)[0]??null:null}get isNullable(){return ge(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&pe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const r=`lang:${this.locale}`,n=this.definition.altnames[r];if(n)return n}if(this.definition.name)return this.definition.name;const t=this.name;return t?h._t(h.gt(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function ve(e,t){let r;const n=_(e);if(e.$root){const s=n.resolve(e.$root);s?r=s:(console.warn(`Failed to resolve $root: ${e.$root}`),r=e)}else e.type||e.properties?r=e:r={type:"any"};return new z({schema:e,definition:r,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:n})}function ee(e,t,r){const n=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:n,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],u=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const b=[];for(const m of p){if(u.has(m)){s.push({path:m,message:`Circular inheritance detected: ${m}`});continue}u.add(m),n.push(m);const g=R(m,t);if(!g){s.push({path:m,message:`Failed to resolve base type: ${m}`});continue}if(g.$extends){const f=Array.isArray(g.$extends)?g.$extends:[g.$extends],v=i(f,y+1);b.push(...v)}b.push(g),u.delete(m)}return b},o=i(a);return{merged:Ye(o,e),inheritanceChain:n,errors:s}}function Ye(e,t){if(e.length===0)return t;let r={...e[0]};for(let a=1;a<e.length;a++)r=ie(r,e[a]);r=ie(r,t);const{$extends:n,...s}=r;return s}function ie(e,t){return M(e)&&M(t)?Qe(e,t):{...e,...t}}function Qe(e,t){const r={...e.properties??{},...t.properties??{}},n=se(e.required),s=se(t.required),a=et([...n,...s]),u={...e,...t,type:"object",properties:r};return a.length>0&&(u.required=a),u}function se(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function et(e){return[...new Set(e)]}function tt(e){const t=_(e);return{resolve:r=>(t.reset(),ee(r,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function I(e,t){return!e||!t?e??"":l.html.span(e,rt())}function nt(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function xe({ctx:e,controller:t}){const r=nt(e);return d.Control(P.TextInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function it(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function $e({ctx:e,controller:t}){const r=it(e),n=d.Control(d.CheckboxInput,{...r,controller:t});return e.isNullable?d.Control(d.CheckboxInput,{...r,controller:t,after:h.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):n}function st(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="bigint"?Number(n):n,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function at(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="number"?BigInt(n):n,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Te(e,t){const r=e.definition;if(r.minimum!==void 0){const n=typeof r.minimum=="string"?BigInt(r.minimum):r.minimum;return typeof n=="bigint"?n>t?n:t:BigInt(n)>t?n:Number(t)}if(r.exclusiveMinimum!==void 0){const n=typeof r.exclusiveMinimum=="string"?BigInt(r.exclusiveMinimum):r.exclusiveMinimum,s=typeof n=="bigint"?n+1n:n+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ie(e,t){const r=e.definition;if(r.maximum!==void 0){const n=typeof r.maximum=="string"?BigInt(r.maximum):r.maximum;return typeof n=="bigint"?n<t?n:t:BigInt(n)<t?n:Number(t)}if(r.exclusiveMaximum!==void 0){const n=typeof r.exclusiveMaximum=="string"?BigInt(r.exclusiveMaximum):r.exclusiveMaximum,s=typeof n=="bigint"?n-1n:n-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ce({ctx:e,controller:t,intType:r}){if(le(r)){const s=at(e,r);return e.isNullable?d.Control(C.NullableBigintInput,{...s,controller:t}):d.Control(C.BigintInput,{...s,controller:t})}const n=st(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ut(e,t){const r=e.definition;let n;r.multipleOf!==void 0?n=r.multipleOf:t==="decimal"&&r.scale!==void 0?n=Math.pow(10,-r.scale):n=void 0;const s=r.minimum!==void 0?typeof r.minimum=="string"?parseFloat(r.minimum):r.minimum:void 0,a=r.maximum!==void 0?typeof r.maximum=="string"?parseFloat(r.maximum):r.maximum:void 0,u=r.exclusiveMinimum!==void 0?typeof r.exclusiveMinimum=="string"?parseFloat(r.exclusiveMinimum):r.exclusiveMinimum:void 0,i=r.exclusiveMaximum!==void 0?typeof r.exclusiveMaximum=="string"?parseFloat(r.exclusiveMaximum):r.exclusiveMaximum:void 0;let o=e.description;if(u!==void 0||i!==void 0){const p=[];u!==void 0&&p.push(`> ${u}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;o=o?`${o} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:o,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??u,max:a??i,step:n,placeholder:c}}function je({ctx:e,controller:t,floatType:r}){const n=ut(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ot(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function we({ctx:e,controller:t}){const r=ot(e);return d.Control(h.UUIDInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function lt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Se({ctx:e,controller:t,temporalType:r}){const n=lt(e);switch(r){case"date":return e.isNullable?d.Control(C.NullablePlainDateInput,{...n,controller:t}):d.Control(C.PlainDateInput,{...n,controller:t});case"datetime":return e.isNullable?d.Control(C.NullablePlainDateTimeInput,{...n,controller:t}):d.Control(C.PlainDateTimeInput,{...n,controller:t});case"time":return e.isNullable?d.Control(C.NullablePlainTimeInput,{...n,controller:t}):d.Control(C.PlainTimeInput,{...n,controller:t});case"duration":return e.isNullable?d.Control(h.NullableDurationInput,{...n,controller:t}):d.Control(C.DurationInput,{...n,controller:t});default:return console.warn(`Unknown temporal type: ${r}`),l.Fragment()}}function ct(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const r=ct(e);return d.Control(h.UrlInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function pt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t}){const r=pt(e);return d.Control(C.FileInput,{...r,controller:t})}function dt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function ft(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function K({ctx:e,controller:t}){const r=dt(e);return d.Control(h.TextArea,{...r,controller:ft(t)})}function mt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(r=>r.includes(e)):!1}function gt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ht(e,t="property"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ae({ctx:e,controller:t}){const r=e.definition;return r.type!=="object"||!("properties"in r)?(console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition")):l.MapSignal(t.signal,n=>{const s=r.properties,a=r.required,u=r.additionalProperties,i=u!==!1,o=typeof u=="object"&&u!==null?u:{type:"any"},c=r.minProperties??0,p=r.maxProperties??1/0,y=Ke.f(s),b=new Set(y.map(([x])=>x)),m=Object.keys(n??{}),g=m.filter(x=>!b.has(x)),f=i&&m.length<p&&!e.readOnly,v=m.length>c&&!e.readOnly,$=y.map(([x,A])=>{const S=x,G=t.field(S),Je=yt(S,a);return T({ctx:e.with({definition:A,isPropertyRequired:Je,suppressLabel:!1}).append(S),controller:G})}),j=g.map(x=>{const A=t.field(x);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${x}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const S={...l.Value.get(t.signal)??{}};delete S[x],t.change(S)},disabled:!v},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),T({ctx:e.with({definition:o,isPropertyRequired:!1,suppressLabel:!0}).append(x),controller:A})))}),N=f?P.Button({variant:"outline",size:"sm",onClick:()=>{const x=l.Value.get(t.signal)??{},A=new Set(Object.keys(x)),S=ht(A),G=gt(o);t.change({...x,[S]:G})}},"Add Property"):null,O=l.html.div(l.attr.class("bc-json-structure-object-fields"),...$,...j,N),k=l.html.div(l.attr.class("bc-json-structure-object"),O);return!e.suppressLabel&&e.name?d.InputWrapper({...mt(e),content:k}):k})}function bt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function vt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Me({ctx:e,controller:t}){const r=e.definition;if(r.type!=="array"||!("items"in r))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(o=>(o?.length??0)<a),i=l.computedOf(t.signal)(o=>(o?.length??0)>s);return h.ListControl({...bt(e),controller:t,createItem:()=>vt(n),showAdd:!0,addDisabled:l.computedOf(u)(o=>!o||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(o=>!o||e.readOnly),element:o=>{const c=o.position.index,p=o.item;return T({ctx:e.with({definition:n,suppressLabel:!0}).append(c),controller:p})}})}function xt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function $t(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Re({ctx:e,controller:t}){const r=e.definition;if(r.type!=="set"||!("items"in r))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),o=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let b=0;b<c.length;b++){const m=JSON.stringify(c[b]);p.has(m)?(y.add(p.get(m)),y.add(b)):p.set(m,b)}return y});return h.ListControl({...xt(e),controller:t,createItem:()=>$t(n),showAdd:!0,addDisabled:l.computedOf(u)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,b=o.map(g=>g.has(p)),m=T({ctx:e.with({definition:n,suppressLabel:!0}).append(p),controller:y});return b.map(g=>g?d.Stack(l.attr.class("bc-stack--gap-1"),m,d.Label(l.attr.class("bc-json-structure-set-error"),"⚠️ Duplicate value - sets must contain unique items")):m)}})}function Tt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function It(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Ct(e,t="key"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ne({ctx:e,controller:t}){const r=e.definition;if(r.type!=="map"||!("values"in r))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const n=r.values,s=r.minProperties??0,a=r.maxProperties??1/0;return l.MapSignal(t.signal,u=>{const i=Object.keys(u??{}),o=i.length,c=o<a&&!e.readOnly,p=o>s&&!e.readOnly,y=i.map(f=>{const v=t.field(f);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${f}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const $={...l.Value.get(t.signal)??{}};delete $[f],t.change($)},disabled:!p},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),T({ctx:e.with({definition:n,suppressLabel:!0}).append(f),controller:v})))}),b=c?P.Button({variant:"outline",size:"sm",onClick:()=>{const f=l.Value.get(t.signal)??{},v=new Set(Object.keys(f)),$=Ct(v),j=It(n);t.change({...f,[$]:j})}},"Add Entry"):null,m=l.html.div(l.attr.class("bc-json-structure-map-entries"),...y,b),g=l.html.div(l.attr.class("bc-json-structure-map"),m);return!e.suppressLabel&&e.name?d.InputWrapper({...Tt(e),content:g}):g})}function jt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function wt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ke({ctx:e,controller:t}){const r=e.definition;if(r.type!=="tuple"||!("tuple"in r)||!("properties"in r))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const n=r.tuple,s=r.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==n.length){const i=n.map(o=>{const c=s[o];return c?wt(c):void 0});t.change(i)}const u=jt(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),u.label&&l.html.label(l.attr.class("bc-json-structure-tuple-label"),u.label,u.required&&l.html.span(l.attr.class("bc-required-indicator"),"*")),u.description&&l.html.div(l.attr.class("bc-json-structure-tuple-description"),u.description),l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...n.map((i,o)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${o} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(o),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${o}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),T({ctx:e.with({definition:c,suppressLabel:!0}).append(o),controller:p})))})))}function St({options:e,selected:t,onChange:r,disabled:n}){return h.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:r,disabled:n})}function Dt({ctx:e,selector:t,inner:r}){const n=d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,r);return e.isRoot?n:d.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:n})}function Ot(e,t,r){if(!e||typeof e!="object")return null;const n=e;if(r&&r in n){const a=n[r];if(typeof a=="string"&&a in t)return a}const s=Object.keys(n);if(s.length===1){const a=s[0];if(a in t)return a}return null}function At(e,t,r){if(!e||typeof e!="object")return;const n=e;if(r&&r in n){const{[r]:s,...a}=n;return a}if(t in n)return n[t]}function ae(e,t,r){return r?e&&typeof e=="object"?{[r]:t,...e}:{[r]:t}:{[t]:e}}function Mt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(!t||typeof t=="object"))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};default:return}}function qe({ctx:e,controller:t}){const r=e.definition;if(!r.choices||typeof r.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const n=r.choices,s=r.selector,a=Object.keys(n);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const u=a.map(f=>{const $=n[f].name||f;return{value:f,label:$}}),i=l.computedOf(t.signal)(f=>Ot(f,n,s)),o=l.Value.get(i)||a[0],c=l.prop(o);t.onDispose(c.dispose);let p=!1;const y=i.on(f=>{!p&&f!==null&&c.set(f)});t.onDispose(y);const m=St({options:u,selected:c,onChange:f=>{p=!0,c.set(f);const v=n[f];if(v){const $=Mt(v),j=ae($,f,s);t.change(j)}},disabled:e.readOnly||e.isDeprecated}),g=l.MapSignal(c,f=>{const v=n[l.Value.get(f)];if(!v)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(f)}`);const $=l.computedOf(t.signal)(O=>At(O,l.Value.get(f),s)),j=O=>{const k=ae(O,l.Value.get(f),s);t.change(k)},N=new d.Controller([...t.path,l.Value.get(f)],j,$,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>N.dispose()),T({ctx:e.with({definition:v,suppressLabel:!0}).append(l.Value.get(f)),controller:N})});return Dt({ctx:e,selector:m,inner:g})}function Rt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Fe({ctx:e,controller:t}){const r=Rt(e);return h.NativeSelectControl({...r,options:(e.enumValues??[]).map(n=>({type:"value",value:n,label:String(n)})),controller:t})}function Pe({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),h.Group(d.MutedLabel(e.label,": "),d.Label(String(e.constValue))))}function Nt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function kt(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function qt(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const r=Number(e);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const r=e.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"?{ok:!0,value:!0}:r==="false"||r==="0"||r==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function Ft(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function Pt(e){return e.map(t=>({key:t,label:h._t(t),detect:r=>kt(r,[t])===t,convert:r=>qt(r,t),defaultValue:()=>Ft(t)}))}function Vt({options:e,selected:t,onChange:r}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(u=>[u.value,u.label]));return h.SegmentedInput({options:a,value:t,onChange:u=>r(u),size:"sm"})}return h.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:r})}function Lt({ctx:e,showSelector:t,selector:r,inner:n}){return e.isRoot?t?d.Stack(l.attr.class("bc-stack--gap-2"),r,n):n:d.InputWrapper({...Nt(e),content:t?d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),r,n):n})}function Et({ctx:e,controller:t}){const r=e.definition,n=r.type;let s=[];if(Array.isArray(n))s=n;else return console.warn("StructureUnionControl called with non-array type"),T({ctx:e,controller:t});const a=s.includes("null"),u=B(n),i=a&&u.length>0?u:s,o=Pt(i),c=new h.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},o);t.onDispose(()=>c.dispose());const p=m=>Vt({options:i.map(g=>({value:g,label:h._t(g)})),selected:c.activeBranch,onChange:m}),y=m=>{c.switchToBranch(m,!1)},b=l.MapSignal(c.activeBranch,m=>{const g=l.Value.get(m),f=c.getBranchController(g),v=e.with({definition:{...r,type:g},suppressLabel:!e.isRoot});return T({ctx:v,controller:f})});return Lt({ctx:e,showSelector:i.length>1,selector:p(y),inner:b})}function T({ctx:e,controller:t}){let r=e;const n=e.definition;if(n.type&&D(n.type)){const i=e.resolveRef(n.type.$ref);if(i){const{type:o,...c}=n,p={...i,...c};r=e.with({definition:p})}}if(r.definition.$extends){const{merged:i}=ee(r.definition,e.schema);r=r.with({definition:i})}const s=r.widgetRegistry;if(s){const i=s.findBestWidget(r);if(i)return i.registration.factory({controller:t,ctx:r})}if(me(r.definition))return Fe({ctx:r,controller:t});if(ye(r.definition))return Pe({ctx:r,controller:t});const a=r.resolvedType;if(Array.isArray(a)&&B(a).length>1)return Et({ctx:r,controller:t});const u=r.primaryType;if(!u)return K({ctx:r,controller:t});if(M(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ae({ctx:r,controller:i})}if(Z(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Me({ctx:r,controller:i})}if(H(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Re({ctx:r,controller:i})}if(X(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ne({ctx:r,controller:i})}if(Y(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return ke({ctx:r,controller:i})}if(Q(r.definition))return qe({ctx:r,controller:t});switch(u){case"string":return xe({ctx:r,controller:t});case"boolean":return $e({ctx:r,controller:t});case"uuid":return we({ctx:r,controller:t});case"uri":return De({ctx:r,controller:t});case"binary":return Oe({ctx:r,controller:t});case"null":return Ut(r);case"any":return K({ctx:r,controller:t});default:return q(u)?Ce({ctx:r,controller:t,intType:u}):U(u)?je({ctx:r,controller:t,floatType:u}):W(u)?Se({ctx:r,controller:t,temporalType:u}):(console.warn(`Unknown type: ${u}`),Wt(r,u))}}function Ve({schema:e,controller:t,widgetRegistry:r,readOnly:n,locale:s}){const a=ve(e,{widgetRegistry:r,readOnly:n,locale:s});return T({ctx:a,controller:t})}function Ut(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function Wt(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function te(e,t){return new Bt(e,t)}class Bt{schema;options;constructor(t,r){this.schema=t,this.options=r??{}}validate(t){const r=[];return this.validateValue(t,this.schema,"",r),{isValid:r.length===0,errors:r}}validateAt(t,r){return this.validate(t)}validateValue(t,r,n,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=r.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:n,type:"type",expected:c,actual:"null"});return}if("enum"in r&&Array.isArray(r.enum)){r.enum.includes(t)||s.push({path:n,type:"enum",expected:r.enum,actual:t});return}if("const"in r){t!==r.const&&s.push({path:n,type:"const",expected:r.const,actual:t});return}const a=r.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,r,n,s))&&i.length>0&&s.push({path:n,type:"type",expected:a,actual:typeof t})}checkType(t,r,n,s,a){switch(r){case"string":return this.validateString(t,n,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,n,s,a);case"array":return this.validateArray(t,n,s,a);case"set":return this.validateSet(t,n,s,a);case"map":return this.validateMap(t,n,s,a);case"tuple":return this.validateTuple(t,n,s,a);case"choice":return this.validateChoice(t,n,s,a);case"any":return!0;default:return q(r)?this.validateInteger(t,r,n,s,a):U(r)?this.validateFloat(t,n,s,a):W(r)?this.validateTemporal(t,r,s,a):r==="uuid"?this.validateUuid(t,s,a):r==="uri"?this.validateUri(t,s,a):r==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,r,n,s){if(typeof t!="string")return!1;const a=r;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:n,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:n,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:n,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,r,n,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:r,actual:"float"}),!1;if(q(r)){const u=V[r],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<u.min||i>u.max)&&a.push({path:s,type:"integer_bounds",expected:{min:u.min.toString(),max:u.max.toString()},actual:i.toString(),context:{type:r}})}return this.validateNumericConstraints(t,n,s,a),!0}validateFloat(t,r,n,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,r,n,s),!0)}validateNumericConstraints(t,r,n,s){const a=r,u=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;u<i&&s.push({path:n,type:"minimum",expected:i,actual:u})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;u>i&&s.push({path:n,type:"maximum",expected:i,actual:u})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;u<=i&&s.push({path:n,type:"exclusiveMinimum",expected:i,actual:u})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;u>=i&&s.push({path:n,type:"exclusiveMaximum",expected:i,actual:u})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:n,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,r,n,s){if(typeof t!="string")return!1;const u={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[r];return u&&!u.test(t)?(s.push({path:n,type:"format",expected:r,actual:t}),!1):!0}validateUuid(t,r,n){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(n.push({path:r,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,r,n){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return n.push({path:r,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,r,n){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(n.push({path:r,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!M(r))return!0;const a=t,u=r.required;if(u){const i=Array.isArray(u[0])?u.flat():u;for(const o of i)o in a||s.push({path:n?`${n}/${o}`:`/${o}`,type:"required",expected:o})}for(const[i,o]of Object.entries(a)){const c=r.properties?.[i];if(c){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,c,p,s)}else if(r.additionalProperties===!1)s.push({path:n?`${n}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof r.additionalProperties=="object"){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,r.additionalProperties,p,s)}}return!0}validateArray(t,r,n,s){if(!Array.isArray(t))return!1;if(!Z(r))return!0;const a=r;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:n,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:n,type:"maxItems",expected:a.maxItems,actual:t.length});for(let u=0;u<t.length;u++){const i=`${n}/${u}`;this.validateValue(t[u],r.items,i,s)}return!0}validateSet(t,r,n,s){if(!Array.isArray(t))return!1;if(!H(r))return!0;const a=new Set;for(let u=0;u<t.length;u++){const i=JSON.stringify(t[u]);a.has(i)&&s.push({path:`${n}/${u}`,type:"uniqueItems",actual:t[u]}),a.add(i)}return this.validateArray(t,r,n,s)}validateMap(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!X(r))return!0;const a=t;for(const[u,i]of Object.entries(a)){const o=`${n}/${u}`;this.validateValue(i,r.values,o,s)}return!0}validateTuple(t,r,n,s){if(!Array.isArray(t))return!1;if(!Y(r))return!0;const a=r.tuple.length;t.length!==a&&s.push({path:n,type:"tuple_length",expected:a,actual:t.length});for(let u=0;u<r.tuple.length;u++){const i=r.tuple[u],o=r.properties?.[i];o&&u<t.length&&this.validateValue(t[u],o,`${n}/${u}`,s)}return!0}validateChoice(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(r))return!0;const a=t,u=Object.keys(r.choices),i=Object.keys(a).find(c=>u.includes(c));if(!i)return s.push({path:n,type:"choice",expected:u,actual:Object.keys(a)}),!1;const o=r.choices[i];return o&&this.validateValue(a[i],o,`${n}/${i}`,s),!0}}function _t(e,t,r){return te(e,r).validate(t)}function Le(e,t){const r=zt(e,t);return{path:e.path,message:r,code:e.type}}function re(e,t){return e.map(r=>{const n=t?.get(r.path);return Le(r,n)})}function zt(e,t){switch(e.type){case"type":return`Expected ${ue(e.expected)}, got ${Gt(e.actual)}`;case"type_mismatch":return`Value must be of type ${ue(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Jt(e,t);case"format":return Kt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Zt(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Ht(e);case"enum":return Xt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function ue(e){return typeof e=="string"?oe(e):Array.isArray(e)?e.map(oe).join(" or "):String(e)}function Gt(e){return e===null?"null":e===void 0?"undefined":typeof e}function oe(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Jt(e,t){const r=t?.description;if(r&&e.type==="pattern")return`Does not match required format: ${r}`;const n=e.expected;if(n){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[n];if(a)return`Must be ${a}`}return"Does not match required format"}function Kt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Zt(e){const t=e.context?.type;if(t&&q(t)){const r=V[t];return`Must be between ${r.min} and ${r.max}`}return"Value is out of range for this integer type"}function Ht(e){const t=e.context?.dependent,r=e.context?.required;return t&&r?.length?`When "${t}" is present, "${r.join('", "')}" must also be provided`:"Missing required dependent fields"}function Xt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(n=>JSON.stringify(n)).join(", ")}`:"Invalid value"}function Yt(e){const t=new Map;for(const r of e){const n=t.get(r.path)??[];n.push(r),t.set(r.path,n)}return t}function Qt(e,t){return e.filter(r=>r.path===t)}function er(e,t){return e.some(r=>r.path===t)}function tr(e,t){const r=t===""?"/":`${t}/`;return e.filter(n=>n.path.startsWith(r))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,r){this.registrations.set(t,r)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],r=Array.from(this.registrations.keys());return[...new Set([...t,...r])]}getForType(t){const r=[];this.parent&&r.push(...this.parent.getForType(t));for(const n of this.registrations.values())n.supportedTypes?.includes(t)&&r.push(n);return r}getForFormat(t){const r=[];this.parent&&r.push(...this.parent.getForFormat(t));for(const n of this.registrations.values())n.supportedFormats?.includes(t)&&r.push(n);return r}findBestWidget(t){const r=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const u=this.scoreWidget(a,t);u>0&&r.push({name:s,registration:a,score:u})}if(r.length===0)return null;r.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const n=r[0];return{name:n.name,registration:n.registration}}scoreWidget(t,r){let n=0;if(t.matcher)if(t.matcher(r))n+=100;else return 0;const s=r.primaryType;s&&t.supportedTypes?.includes(s)&&(n+=50);const a=r.format;return a&&t.supportedFormats?.includes(a)&&(n+=30),n+=t.priority??0,n}createChild(){return new L(this)}}let E=null;function F(){return E||(E=new L),E}function rr(e){E=e}function nr(e){return new L(e)}function ir(e,t,r){return{name:`type:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedTypes:[e],priority:r?.priority??0,canFallback:r?.canFallback??!1}}}function sr(e,t,r){return{name:`format:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedFormats:[e],priority:r?.priority??10,canFallback:r?.canFallback??!1}}}function ar(e,t,r,n){return{name:`type:${e}:format:${t}`,registration:{factory:r,displayName:n?.displayName??`${e}/${t} widget`,description:n?.description,supportedTypes:[e],supportedFormats:[t],priority:n?.priority??20,canFallback:n?.canFallback??!1}}}function ur(e,t,r,n){return{name:e,registration:{factory:r,displayName:n?.displayName??e,description:n?.description,matcher:t,priority:n?.priority??50,canFallback:n?.canFallback??!1}}}function Ee(e,t){if(t){const n=t.findBestWidget(e);if(n)return n}return F().findBestWidget(e)}function or(e){const t=e.definition,r={};if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];n.widget&&typeof n.widget=="object"&&(r.options=n.widget),typeof n.priority=="number"&&(r.priority=n.priority)}if(typeof t=="object"&&"widget"in t){const n=t.widget;typeof n=="object"&&n!==null&&(r.options={...r.options??{},...n})}return Object.keys(r).length>0?r:void 0}function ne(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];if(typeof r.widget=="string")return r.widget}if(typeof t=="object"&&"widget"in t){const r=t.widget;if(r&&typeof r.type=="string")return r.type}}function lr(e){return ne(e)!==void 0}function cr(e,t){const r=ne(e);if(r){if(t){const a=t.get(r);if(a)return{name:r,registration:a}}const s=F().get(r);if(s)return{name:r,registration:s};console.warn(`Widget "${r}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ee(e,t)}function pr(e,t,r){return{...e,...t,...r}}function Ue(e=F()){e.register("string",{factory:({controller:i,ctx:o})=>xe({ctx:o,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:o})=>$e({ctx:o,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:o})=>we({ctx:o,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:o})=>De({ctx:o,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:o})=>Oe({ctx:o,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:o})=>K({ctx:o,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],r=({controller:i,ctx:o})=>Ce({ctx:o,controller:i,intType:o.primaryType});for(const i of t)e.register(i,{factory:r,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const n=["float","double","decimal"],s=({controller:i,ctx:o})=>je({ctx:o,controller:i,floatType:o.primaryType});for(const i of n)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],u=({controller:i,ctx:o})=>Se({ctx:o,controller:i,temporalType:o.primaryType});for(const i of a)e.register(i,{factory:u,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:o})=>Ae({ctx:o,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:o})=>Me({ctx:o,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:o})=>Re({ctx:o,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:o})=>Ne({ctx:o,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:o})=>ke({ctx:o,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:o})=>qe({ctx:o,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:o})=>Fe({ctx:o,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:o})=>Pe({ctx:o,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function We(e=F()){return e.has("string")&&e.has("object")&&e.has("array")}function dr(e=F()){We(e)||Ue(e)}function Be(e){let t=e;if(e.$root){const r=R(e.$root,e);r&&(t=r)}return w(t,e,new Set)}function w(e,t,r){if(e.type&&D(e.type)){const n=e.type.$ref;if(r.has(n))return;r.add(n);const s=R(n,t);if(s){const a={...s,...e,type:s.type},u=w(a,t,r);return r.delete(n),u}r.delete(n);return}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:Cr(e)?null:fr(e,t,r)}function fr(e,t,r){const n=_e(e);if(M(e))return yr(e,t,r);if(n==="choice"&&"choices"in e)return gr(e,t,r);if(n==="tuple"&&"tuple"in e&&"properties"in e)return hr(e,t,r);if(n==="array")return br(e,t,r);if(n==="set")return vr(e,t,r);if(n==="map")return{};if(n==="string")return xr(e);if(jr(n))return $r(e);if(wr(n))return Tr(e);if(n==="boolean")return!1;if(n==="null")return null;if(Sr(n))return Ir(n);if(n==="uuid"||n==="uri"||n==="uri-reference"||n==="binary"||n==="bytes")return""}function mr(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function yr(e,t,r){if(!M(e))return{};const n=mr(e.required),s={};for(const[a,u]of Object.entries(e.properties))if(n.has(a))if(u.type&&D(u.type)){const i=u.type.$ref;if(r.has(i))continue;r.add(i);const o=R(i,t);if(o){const c={...o,...u,type:o.type},p=w(c,t,r);p!==void 0&&(s[a]=p)}r.delete(i)}else{const i=w(u,t,r);i!==void 0&&(s[a]=i)}return s}function gr(e,t,r){if(!("choices"in e))return;const n=e.choices,s=Object.keys(n);if(s.length===0)return;const a=s[0],u=n[a];if("selector"in e&&e.selector){const o=e.selector,c=w(u,t,r);return typeof c=="object"&&c!==null?{[o]:a,...c}:{[o]:a}}const i=w(u,t,r);return{[a]:i}}function hr(e,t,r){if(!("tuple"in e)||!("properties"in e))return{};const n=e.tuple,s=e.properties,a=new Set(e.required??n),u={};for(const i of n){if(!a.has(i))continue;const o=s[i];if(o){const c=w(o,t,r);c!==void 0&&(u[i]=c)}}return u}function br(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function vr(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function xr(e){switch("format"in e?e.format:void 0){case"date":return ze();case"date-time":return Ge();case"time":return"00:00:00";case"email":case"uri":case"uri-reference":case"uuid":default:return""}}function $r(e){const t=_e(e),r=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let n="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,u="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(n=a+1),u!==void 0&&(s=u-1);let i;n!==void 0&&s!==void 0?i=Math.round((n+s)/2):n!==void 0?i=n:s!==void 0?i=0<=s?0:s:i=0;const o="multipleOf"in e?e.multipleOf:void 0;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),s!==void 0&&i>s&&(i=Math.floor(s/o)*o)),r?BigInt(Math.round(i)):Math.round(i)}function Tr(e){let t="minimum"in e?e.minimum:void 0,r="maximum"in e?e.maximum:void 0;const n="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;n!==void 0&&(t=n+a),s!==void 0&&(r=s-a);let u;t!==void 0&&r!==void 0?u=(t+r)/2:t!==void 0?u=t:r!==void 0?u=0<=r?0:r:u=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(u=Math.round(u/i)*i,t!==void 0&&u<t&&(u=Math.ceil(t/i)*i),r!==void 0&&u>r&&(u=Math.floor(r/i)*i)),u}function Ir(e){switch(e){case"date":return ze();case"time":return"00:00:00";case"datetime":return Ge();case"duration":return"PT0S";default:return""}}function Cr(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function _e(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t)if(typeof r=="string"&&r!=="null")return r}}function jr(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function wr(e){return e?["float","double","decimal"].includes(e):!1}function Sr(e){return e?["date","time","datetime","duration"].includes(e):!1}function ze(){return new Date().toISOString().split("T")[0]}function Ge(){return new Date().toISOString()}function Dr(e){if(e.isValid)return d.a.valid;const t=re(e.errors),r=new Map;for(const u of t){const i=r.get(u.path)||[];i.push(u),r.set(u.path,i)}const n=(u,i)=>{if(u.length===0)return{message:i.map(y=>y.message).join("; ")};const[o,...c]=u,p=n(c,i);return{dependencies:{[o]:p}}},s={},a={};for(const[u,i]of r.entries())if(u===""||u==="/")s.message=i.map(o=>o.message).join("; ");else{const o=u.split("/").filter(c=>c!=="");if(o.length===1)a[o[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=o;a[c]=n(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),d.a.invalid(s)}function Or({schema:e,initialValue:t,validationMode:r,validateDebounceMs:n,widgetRegistry:s,readOnly:a,locale:u,onChange:i,onValidate:o,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,b=Be(e);let m;t===void 0?m=b??{}:c?m=h.deepMergeDefaults(b,y):m=y;const g=te(e),f=r??"onTouched",v=k=>{const x=g.validate(k);if(o&&!x.isValid){const A=re(x.errors);o(A)}return Dr(x)},{controller:$,setStatus:j}=d.useController({initialValue:m,validationMode:f,validateDebounceMs:n,validate:f==="onSubmit"?void 0:v,onChange:i}),N=()=>{$.dispose()},O=l.Fragment(l.OnDispose(N),Ve({schema:e,controller:$,widgetRegistry:s,readOnly:a,locale:u}));return p({Form:O,controller:$,setStatus:j})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=Or;exports.RefResolver=be;exports.StructureContext=z;exports.StructureControl=Ve;exports.StructureGenericControl=T;exports.createExtendsResolver=tt;exports.createRefResolver=_;exports.createStructureContext=ve;exports.createValidator=te;exports.createWidgetRegistry=nr;exports.ensureDefaultWidgets=dr;exports.extractStructureDefaults=Be;exports.forFormat=sr;exports.forMatcher=ur;exports.forType=ir;exports.forTypeAndFormat=ar;exports.formatValidationError=Le;exports.formatValidationErrors=re;exports.getChildErrors=tr;exports.getErrorsForPath=Qt;exports.getExplicitWidgetName=ne;exports.getGlobalWidgetRegistry=F;exports.getNonNullTypes=B;exports.getResolvedType=J;exports.getWidgetOptions=or;exports.groupErrorsByPath=Yt;exports.hasConstValue=ye;exports.hasCustomWidget=lr;exports.hasDefaultWidgets=We;exports.hasEnumValue=me;exports.hasErrorsAtPath=er;exports.isArrayTypeDefinition=Z;exports.isBigIntType=le;exports.isChoiceTypeDefinition=Q;exports.isCompoundType=Ze;exports.isFloatType=U;exports.isIntegerType=q;exports.isMapTypeDefinition=X;exports.isNamespace=de;exports.isNullableType=ge;exports.isNumericType=ce;exports.isObjectTypeDefinition=M;exports.isPrimitiveType=pe;exports.isSetTypeDefinition=H;exports.isTemporalType=W;exports.isTupleTypeDefinition=Y;exports.isTypeDefinition=fe;exports.isTypeReference=D;exports.mergeWidgetOptions=pr;exports.parseRefPath=he;exports.registerDefaultWidgets=Ue;exports.resolveExtends=ee;exports.resolveRef=R;exports.resolveTypeReference=Xe;exports.resolveWidget=Ee;exports.resolveWidgetWithOverride=cr;exports.setGlobalWidgetRegistry=rr;exports.validate=_t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../deep-merge-DBUbjJYt.cjs"),l=require("@tempots/dom"),d=require("../use-form-B4D58mxd.cjs"),P=require("../translations-hMQlZmD4.cjs"),C=require("../duration-input-CsygvJJ_.cjs"),Ke=require("../colors-B9fcMxa_.cjs");function le(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function q(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function U(e){return e==="float"||e==="double"||e==="decimal"}function ce(e){return q(e)||U(e)}function W(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function pe(e){return e==="string"||e==="boolean"||e==="null"||ce(e)||W(e)||e==="uuid"||e==="uri"||e==="binary"}function Ze(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function D(e){return typeof e=="object"&&e!==null&&"$ref"in e}function de(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function fe(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function M(e){return e.type==="object"&&"properties"in e}function Z(e){return e.type==="array"&&"items"in e}function H(e){return e.type==="set"&&"items"in e}function X(e){return e.type==="map"&&"values"in e}function Y(e){return e.type==="tuple"&&"tuple"in e}function Q(e){return e.type==="choice"&&"choices"in e}function me(e){return"enum"in e&&Array.isArray(e.enum)}function ye(e){return"const"in e}function J(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(D(e),null)}function ge(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function B(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function he(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function He(e,t){let r=e;for(const n of t){if(r==null||typeof r!="object")return;r=r[n]}return r}function R(e,t){const r=he(e),n=He(t,r);if(n==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(fe(n))return n;if(de(n)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Xe(e,t){return R(e.$ref,t)}class be{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const r=R(t,this.schema);if(r?.type&&D(r.type)){const n=this.resolve(r.type.$ref);if(n){const{type:s,...a}=r;return{...n,...a}}}return r}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&D(t.type)){const r=this.resolve(t.type.$ref);if(r){const{type:n,...s}=t;return{...r,...s}}}return t}reset(){this.visited.clear()}}function _(e){return new be(e)}class z{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??_(t.schema)}with(t){return new z({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(D(t)){const r=this.refResolver.resolve(t.$ref);return r?.type?J(r.type):null}return J(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:B(t)[0]??null:null}get isNullable(){return ge(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&pe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const r=`lang:${this.locale}`,n=this.definition.altnames[r];if(n)return n}if(this.definition.name)return this.definition.name;const t=this.name;return t?h._t(h.gt(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function ve(e,t){let r;const n=_(e);if(e.$root){const s=n.resolve(e.$root);s?r=s:(console.warn(`Failed to resolve $root: ${e.$root}`),r=e)}else e.type||e.properties?r=e:r={type:"any"};return new z({schema:e,definition:r,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:n})}function ee(e,t,r){const n=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:n,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],u=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const b=[];for(const m of p){if(u.has(m)){s.push({path:m,message:`Circular inheritance detected: ${m}`});continue}u.add(m),n.push(m);const g=R(m,t);if(!g){s.push({path:m,message:`Failed to resolve base type: ${m}`});continue}if(g.$extends){const f=Array.isArray(g.$extends)?g.$extends:[g.$extends],v=i(f,y+1);b.push(...v)}b.push(g),u.delete(m)}return b},o=i(a);return{merged:Ye(o,e),inheritanceChain:n,errors:s}}function Ye(e,t){if(e.length===0)return t;let r={...e[0]};for(let a=1;a<e.length;a++)r=ie(r,e[a]);r=ie(r,t);const{$extends:n,...s}=r;return s}function ie(e,t){return M(e)&&M(t)?Qe(e,t):{...e,...t}}function Qe(e,t){const r={...e.properties??{},...t.properties??{}},n=se(e.required),s=se(t.required),a=et([...n,...s]),u={...e,...t,type:"object",properties:r};return a.length>0&&(u.required=a),u}function se(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function et(e){return[...new Set(e)]}function tt(e){const t=_(e);return{resolve:r=>(t.reset(),ee(r,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function I(e,t){return!e||!t?e??"":l.html.span(e,rt())}function nt(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function xe({ctx:e,controller:t}){const r=nt(e);return d.Control(P.TextInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function it(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function $e({ctx:e,controller:t}){const r=it(e),n=d.Control(d.CheckboxInput,{...r,controller:t});return e.isNullable?d.Control(d.CheckboxInput,{...r,controller:t,after:h.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):n}function st(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="bigint"?Number(n):n,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function at(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="number"?BigInt(n):n,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Te(e,t){const r=e.definition;if(r.minimum!==void 0){const n=typeof r.minimum=="string"?BigInt(r.minimum):r.minimum;return typeof n=="bigint"?n>t?n:t:BigInt(n)>t?n:Number(t)}if(r.exclusiveMinimum!==void 0){const n=typeof r.exclusiveMinimum=="string"?BigInt(r.exclusiveMinimum):r.exclusiveMinimum,s=typeof n=="bigint"?n+1n:n+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ie(e,t){const r=e.definition;if(r.maximum!==void 0){const n=typeof r.maximum=="string"?BigInt(r.maximum):r.maximum;return typeof n=="bigint"?n<t?n:t:BigInt(n)<t?n:Number(t)}if(r.exclusiveMaximum!==void 0){const n=typeof r.exclusiveMaximum=="string"?BigInt(r.exclusiveMaximum):r.exclusiveMaximum,s=typeof n=="bigint"?n-1n:n-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ce({ctx:e,controller:t,intType:r}){if(le(r)){const s=at(e,r);return e.isNullable?d.Control(C.NullableBigintInput,{...s,controller:t}):d.Control(C.BigintInput,{...s,controller:t})}const n=st(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ut(e,t){const r=e.definition;let n;r.multipleOf!==void 0?n=r.multipleOf:t==="decimal"&&r.scale!==void 0?n=Math.pow(10,-r.scale):n=void 0;const s=r.minimum!==void 0?typeof r.minimum=="string"?parseFloat(r.minimum):r.minimum:void 0,a=r.maximum!==void 0?typeof r.maximum=="string"?parseFloat(r.maximum):r.maximum:void 0,u=r.exclusiveMinimum!==void 0?typeof r.exclusiveMinimum=="string"?parseFloat(r.exclusiveMinimum):r.exclusiveMinimum:void 0,i=r.exclusiveMaximum!==void 0?typeof r.exclusiveMaximum=="string"?parseFloat(r.exclusiveMaximum):r.exclusiveMaximum:void 0;let o=e.description;if(u!==void 0||i!==void 0){const p=[];u!==void 0&&p.push(`> ${u}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;o=o?`${o} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:o,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??u,max:a??i,step:n,placeholder:c}}function je({ctx:e,controller:t,floatType:r}){const n=ut(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ot(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function we({ctx:e,controller:t}){const r=ot(e);return d.Control(h.UUIDInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function lt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Se({ctx:e,controller:t,temporalType:r}){const n=lt(e);switch(r){case"date":return e.isNullable?d.Control(C.NullablePlainDateInput,{...n,controller:t}):d.Control(C.PlainDateInput,{...n,controller:t});case"datetime":return e.isNullable?d.Control(C.NullablePlainDateTimeInput,{...n,controller:t}):d.Control(C.PlainDateTimeInput,{...n,controller:t});case"time":return e.isNullable?d.Control(C.NullablePlainTimeInput,{...n,controller:t}):d.Control(C.PlainTimeInput,{...n,controller:t});case"duration":return e.isNullable?d.Control(h.NullableDurationInput,{...n,controller:t}):d.Control(C.DurationInput,{...n,controller:t});default:return console.warn(`Unknown temporal type: ${r}`),l.Fragment()}}function ct(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const r=ct(e);return d.Control(h.UrlInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function pt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t}){const r=pt(e);return d.Control(C.FileInput,{...r,controller:t})}function dt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function ft(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function K({ctx:e,controller:t}){const r=dt(e);return d.Control(h.TextArea,{...r,controller:ft(t)})}function mt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(r=>r.includes(e)):!1}function gt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ht(e,t="property"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ae({ctx:e,controller:t}){const r=e.definition;return r.type!=="object"||!("properties"in r)?(console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition")):l.MapSignal(t.signal,n=>{const s=r.properties,a=r.required,u=r.additionalProperties,i=u!==!1,o=typeof u=="object"&&u!==null?u:{type:"any"},c=r.minProperties??0,p=r.maxProperties??1/0,y=Ke.f(s),b=new Set(y.map(([x])=>x)),m=Object.keys(n??{}),g=m.filter(x=>!b.has(x)),f=i&&m.length<p&&!e.readOnly,v=m.length>c&&!e.readOnly,$=y.map(([x,A])=>{const S=x,G=t.field(S),Je=yt(S,a);return T({ctx:e.with({definition:A,isPropertyRequired:Je,suppressLabel:!1}).append(S),controller:G})}),j=g.map(x=>{const A=t.field(x);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${x}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const S={...l.Value.get(t.signal)??{}};delete S[x],t.change(S)},disabled:!v},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),T({ctx:e.with({definition:o,isPropertyRequired:!1,suppressLabel:!0}).append(x),controller:A})))}),N=f?P.Button({variant:"outline",size:"sm",onClick:()=>{const x=l.Value.get(t.signal)??{},A=new Set(Object.keys(x)),S=ht(A),G=gt(o);t.change({...x,[S]:G})}},"Add Property"):null,O=l.html.div(l.attr.class("bc-json-structure-object-fields"),...$,...j,N),k=l.html.div(l.attr.class("bc-json-structure-object"),O);return!e.suppressLabel&&e.name?d.InputWrapper({...mt(e),content:k}):k})}function bt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function vt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Me({ctx:e,controller:t}){const r=e.definition;if(r.type!=="array"||!("items"in r))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(o=>(o?.length??0)<a),i=l.computedOf(t.signal)(o=>(o?.length??0)>s);return h.ListControl({...bt(e),controller:t,createItem:()=>vt(n),showAdd:!0,addDisabled:l.computedOf(u)(o=>!o||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(o=>!o||e.readOnly),element:o=>{const c=o.position.index,p=o.item;return T({ctx:e.with({definition:n,suppressLabel:!0}).append(c),controller:p})}})}function xt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function $t(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Re({ctx:e,controller:t}){const r=e.definition;if(r.type!=="set"||!("items"in r))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),o=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let b=0;b<c.length;b++){const m=JSON.stringify(c[b]);p.has(m)?(y.add(p.get(m)),y.add(b)):p.set(m,b)}return y});return h.ListControl({...xt(e),controller:t,createItem:()=>$t(n),showAdd:!0,addDisabled:l.computedOf(u)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,b=o.map(g=>g.has(p)),m=T({ctx:e.with({definition:n,suppressLabel:!0}).append(p),controller:y});return b.map(g=>g?d.Stack(l.attr.class("bc-stack--gap-1"),m,d.Label(l.attr.class("bc-json-structure-set-error"),"⚠️ Duplicate value - sets must contain unique items")):m)}})}function Tt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function It(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Ct(e,t="key"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ne({ctx:e,controller:t}){const r=e.definition;if(r.type!=="map"||!("values"in r))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const n=r.values,s=r.minProperties??0,a=r.maxProperties??1/0;return l.MapSignal(t.signal,u=>{const i=Object.keys(u??{}),o=i.length,c=o<a&&!e.readOnly,p=o>s&&!e.readOnly,y=i.map(f=>{const v=t.field(f);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${f}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const $={...l.Value.get(t.signal)??{}};delete $[f],t.change($)},disabled:!p},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),T({ctx:e.with({definition:n,suppressLabel:!0}).append(f),controller:v})))}),b=c?P.Button({variant:"outline",size:"sm",onClick:()=>{const f=l.Value.get(t.signal)??{},v=new Set(Object.keys(f)),$=Ct(v),j=It(n);t.change({...f,[$]:j})}},"Add Entry"):null,m=l.html.div(l.attr.class("bc-json-structure-map-entries"),...y,b),g=l.html.div(l.attr.class("bc-json-structure-map"),m);return!e.suppressLabel&&e.name?d.InputWrapper({...Tt(e),content:g}):g})}function jt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function wt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ke({ctx:e,controller:t}){const r=e.definition;if(r.type!=="tuple"||!("tuple"in r)||!("properties"in r))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const n=r.tuple,s=r.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==n.length){const i=n.map(o=>{const c=s[o];return c?wt(c):void 0});t.change(i)}const u=jt(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),u.label&&l.html.label(l.attr.class("bc-json-structure-tuple-label"),u.label,u.required&&l.html.span(l.attr.class("bc-required-indicator"),"*")),u.description&&l.html.div(l.attr.class("bc-json-structure-tuple-description"),u.description),l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...n.map((i,o)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${o} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(o),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${o}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),T({ctx:e.with({definition:c,suppressLabel:!0}).append(o),controller:p})))})))}function St({options:e,selected:t,onChange:r,disabled:n}){return h.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:r,disabled:n})}function Dt({ctx:e,selector:t,inner:r}){const n=d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,r);return e.isRoot?n:d.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:n})}function Ot(e,t,r){if(!e||typeof e!="object")return null;const n=e;if(r&&r in n){const a=n[r];if(typeof a=="string"&&a in t)return a}const s=Object.keys(n);if(s.length===1){const a=s[0];if(a in t)return a}return null}function At(e,t,r){if(!e||typeof e!="object")return;const n=e;if(r&&r in n){const{[r]:s,...a}=n;return a}if(t in n)return n[t]}function ae(e,t,r){return r?e&&typeof e=="object"?{[r]:t,...e}:{[r]:t}:{[t]:e}}function Mt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(!t||typeof t=="object"))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};default:return}}function qe({ctx:e,controller:t}){const r=e.definition;if(!r.choices||typeof r.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const n=r.choices,s=r.selector,a=Object.keys(n);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const u=a.map(f=>{const $=n[f].name||f;return{value:f,label:$}}),i=l.computedOf(t.signal)(f=>Ot(f,n,s)),o=l.Value.get(i)||a[0],c=l.prop(o);t.onDispose(c.dispose);let p=!1;const y=i.on(f=>{!p&&f!==null&&c.set(f)});t.onDispose(y);const m=St({options:u,selected:c,onChange:f=>{p=!0,c.set(f);const v=n[f];if(v){const $=Mt(v),j=ae($,f,s);t.change(j)}},disabled:e.readOnly||e.isDeprecated}),g=l.MapSignal(c,f=>{const v=n[l.Value.get(f)];if(!v)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(f)}`);const $=l.computedOf(t.signal)(O=>At(O,l.Value.get(f),s)),j=O=>{const k=ae(O,l.Value.get(f),s);t.change(k)},N=new d.Controller([...t.path,l.Value.get(f)],j,$,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>N.dispose()),T({ctx:e.with({definition:v,suppressLabel:!0}).append(l.Value.get(f)),controller:N})});return Dt({ctx:e,selector:m,inner:g})}function Rt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Fe({ctx:e,controller:t}){const r=Rt(e);return h.NativeSelectControl({...r,options:(e.enumValues??[]).map(n=>({type:"value",value:n,label:String(n)})),controller:t})}function Pe({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),h.Group(d.MutedLabel(e.label,": "),d.Label(String(e.constValue))))}function Nt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function kt(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function qt(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const r=Number(e);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const r=e.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"?{ok:!0,value:!0}:r==="false"||r==="0"||r==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function Ft(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function Pt(e){return e.map(t=>({key:t,label:h._t(t),detect:r=>kt(r,[t])===t,convert:r=>qt(r,t),defaultValue:()=>Ft(t)}))}function Vt({options:e,selected:t,onChange:r}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(u=>[u.value,u.label]));return h.SegmentedInput({options:a,value:t,onChange:u=>r(u),size:"sm"})}return h.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:r})}function Lt({ctx:e,showSelector:t,selector:r,inner:n}){return e.isRoot?t?d.Stack(l.attr.class("bc-stack--gap-2"),r,n):n:d.InputWrapper({...Nt(e),content:t?d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),r,n):n})}function Et({ctx:e,controller:t}){const r=e.definition,n=r.type;let s=[];if(Array.isArray(n))s=n;else return console.warn("StructureUnionControl called with non-array type"),T({ctx:e,controller:t});const a=s.includes("null"),u=B(n),i=a&&u.length>0?u:s,o=Pt(i),c=new h.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},o);t.onDispose(()=>c.dispose());const p=m=>Vt({options:i.map(g=>({value:g,label:h._t(g)})),selected:c.activeBranch,onChange:m}),y=m=>{c.switchToBranch(m,!1)},b=l.MapSignal(c.activeBranch,m=>{const g=l.Value.get(m),f=c.getBranchController(g),v=e.with({definition:{...r,type:g},suppressLabel:!e.isRoot});return T({ctx:v,controller:f})});return Lt({ctx:e,showSelector:i.length>1,selector:p(y),inner:b})}function T({ctx:e,controller:t}){let r=e;const n=e.definition;if(n.type&&D(n.type)){const i=e.resolveRef(n.type.$ref);if(i){const{type:o,...c}=n,p={...i,...c};r=e.with({definition:p})}}if(r.definition.$extends){const{merged:i}=ee(r.definition,e.schema);r=r.with({definition:i})}const s=r.widgetRegistry;if(s){const i=s.findBestWidget(r);if(i)return i.registration.factory({controller:t,ctx:r})}if(me(r.definition))return Fe({ctx:r,controller:t});if(ye(r.definition))return Pe({ctx:r,controller:t});const a=r.resolvedType;if(Array.isArray(a)&&B(a).length>1)return Et({ctx:r,controller:t});const u=r.primaryType;if(!u)return K({ctx:r,controller:t});if(M(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ae({ctx:r,controller:i})}if(Z(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Me({ctx:r,controller:i})}if(H(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Re({ctx:r,controller:i})}if(X(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ne({ctx:r,controller:i})}if(Y(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return ke({ctx:r,controller:i})}if(Q(r.definition))return qe({ctx:r,controller:t});switch(u){case"string":return xe({ctx:r,controller:t});case"boolean":return $e({ctx:r,controller:t});case"uuid":return we({ctx:r,controller:t});case"uri":return De({ctx:r,controller:t});case"binary":return Oe({ctx:r,controller:t});case"null":return Ut(r);case"any":return K({ctx:r,controller:t});default:return q(u)?Ce({ctx:r,controller:t,intType:u}):U(u)?je({ctx:r,controller:t,floatType:u}):W(u)?Se({ctx:r,controller:t,temporalType:u}):(console.warn(`Unknown type: ${u}`),Wt(r,u))}}function Ve({schema:e,controller:t,widgetRegistry:r,readOnly:n,locale:s}){const a=ve(e,{widgetRegistry:r,readOnly:n,locale:s});return T({ctx:a,controller:t})}function Ut(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function Wt(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function te(e,t){return new Bt(e,t)}class Bt{schema;options;constructor(t,r){this.schema=t,this.options=r??{}}validate(t){const r=[];return this.validateValue(t,this.schema,"",r),{isValid:r.length===0,errors:r}}validateAt(t,r){return this.validate(t)}validateValue(t,r,n,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=r.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:n,type:"type",expected:c,actual:"null"});return}if("enum"in r&&Array.isArray(r.enum)){r.enum.includes(t)||s.push({path:n,type:"enum",expected:r.enum,actual:t});return}if("const"in r){t!==r.const&&s.push({path:n,type:"const",expected:r.const,actual:t});return}const a=r.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,r,n,s))&&i.length>0&&s.push({path:n,type:"type",expected:a,actual:typeof t})}checkType(t,r,n,s,a){switch(r){case"string":return this.validateString(t,n,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,n,s,a);case"array":return this.validateArray(t,n,s,a);case"set":return this.validateSet(t,n,s,a);case"map":return this.validateMap(t,n,s,a);case"tuple":return this.validateTuple(t,n,s,a);case"choice":return this.validateChoice(t,n,s,a);case"any":return!0;default:return q(r)?this.validateInteger(t,r,n,s,a):U(r)?this.validateFloat(t,n,s,a):W(r)?this.validateTemporal(t,r,s,a):r==="uuid"?this.validateUuid(t,s,a):r==="uri"?this.validateUri(t,s,a):r==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,r,n,s){if(typeof t!="string")return!1;const a=r;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:n,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:n,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:n,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,r,n,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:r,actual:"float"}),!1;if(q(r)){const u=V[r],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<u.min||i>u.max)&&a.push({path:s,type:"integer_bounds",expected:{min:u.min.toString(),max:u.max.toString()},actual:i.toString(),context:{type:r}})}return this.validateNumericConstraints(t,n,s,a),!0}validateFloat(t,r,n,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,r,n,s),!0)}validateNumericConstraints(t,r,n,s){const a=r,u=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;u<i&&s.push({path:n,type:"minimum",expected:i,actual:u})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;u>i&&s.push({path:n,type:"maximum",expected:i,actual:u})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;u<=i&&s.push({path:n,type:"exclusiveMinimum",expected:i,actual:u})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;u>=i&&s.push({path:n,type:"exclusiveMaximum",expected:i,actual:u})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:n,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,r,n,s){if(typeof t!="string")return!1;const u={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[r];return u&&!u.test(t)?(s.push({path:n,type:"format",expected:r,actual:t}),!1):!0}validateUuid(t,r,n){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(n.push({path:r,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,r,n){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return n.push({path:r,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,r,n){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(n.push({path:r,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!M(r))return!0;const a=t,u=r.required;if(u){const i=Array.isArray(u[0])?u.flat():u;for(const o of i)o in a||s.push({path:n?`${n}/${o}`:`/${o}`,type:"required",expected:o})}for(const[i,o]of Object.entries(a)){const c=r.properties?.[i];if(c){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,c,p,s)}else if(r.additionalProperties===!1)s.push({path:n?`${n}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof r.additionalProperties=="object"){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,r.additionalProperties,p,s)}}return!0}validateArray(t,r,n,s){if(!Array.isArray(t))return!1;if(!Z(r))return!0;const a=r;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:n,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:n,type:"maxItems",expected:a.maxItems,actual:t.length});for(let u=0;u<t.length;u++){const i=`${n}/${u}`;this.validateValue(t[u],r.items,i,s)}return!0}validateSet(t,r,n,s){if(!Array.isArray(t))return!1;if(!H(r))return!0;const a=new Set;for(let u=0;u<t.length;u++){const i=JSON.stringify(t[u]);a.has(i)&&s.push({path:`${n}/${u}`,type:"uniqueItems",actual:t[u]}),a.add(i)}return this.validateArray(t,r,n,s)}validateMap(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!X(r))return!0;const a=t;for(const[u,i]of Object.entries(a)){const o=`${n}/${u}`;this.validateValue(i,r.values,o,s)}return!0}validateTuple(t,r,n,s){if(!Array.isArray(t))return!1;if(!Y(r))return!0;const a=r.tuple.length;t.length!==a&&s.push({path:n,type:"tuple_length",expected:a,actual:t.length});for(let u=0;u<r.tuple.length;u++){const i=r.tuple[u],o=r.properties?.[i];o&&u<t.length&&this.validateValue(t[u],o,`${n}/${u}`,s)}return!0}validateChoice(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(r))return!0;const a=t,u=Object.keys(r.choices),i=Object.keys(a).find(c=>u.includes(c));if(!i)return s.push({path:n,type:"choice",expected:u,actual:Object.keys(a)}),!1;const o=r.choices[i];return o&&this.validateValue(a[i],o,`${n}/${i}`,s),!0}}function _t(e,t,r){return te(e,r).validate(t)}function Le(e,t){const r=zt(e,t);return{path:e.path,message:r,code:e.type}}function re(e,t){return e.map(r=>{const n=t?.get(r.path);return Le(r,n)})}function zt(e,t){switch(e.type){case"type":return`Expected ${ue(e.expected)}, got ${Gt(e.actual)}`;case"type_mismatch":return`Value must be of type ${ue(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Jt(e,t);case"format":return Kt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Zt(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Ht(e);case"enum":return Xt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function ue(e){return typeof e=="string"?oe(e):Array.isArray(e)?e.map(oe).join(" or "):String(e)}function Gt(e){return e===null?"null":e===void 0?"undefined":typeof e}function oe(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Jt(e,t){const r=t?.description;if(r&&e.type==="pattern")return`Does not match required format: ${r}`;const n=e.expected;if(n){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[n];if(a)return`Must be ${a}`}return"Does not match required format"}function Kt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Zt(e){const t=e.context?.type;if(t&&q(t)){const r=V[t];return`Must be between ${r.min} and ${r.max}`}return"Value is out of range for this integer type"}function Ht(e){const t=e.context?.dependent,r=e.context?.required;return t&&r?.length?`When "${t}" is present, "${r.join('", "')}" must also be provided`:"Missing required dependent fields"}function Xt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(n=>JSON.stringify(n)).join(", ")}`:"Invalid value"}function Yt(e){const t=new Map;for(const r of e){const n=t.get(r.path)??[];n.push(r),t.set(r.path,n)}return t}function Qt(e,t){return e.filter(r=>r.path===t)}function er(e,t){return e.some(r=>r.path===t)}function tr(e,t){const r=t===""?"/":`${t}/`;return e.filter(n=>n.path.startsWith(r))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,r){this.registrations.set(t,r)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],r=Array.from(this.registrations.keys());return[...new Set([...t,...r])]}getForType(t){const r=[];this.parent&&r.push(...this.parent.getForType(t));for(const n of this.registrations.values())n.supportedTypes?.includes(t)&&r.push(n);return r}getForFormat(t){const r=[];this.parent&&r.push(...this.parent.getForFormat(t));for(const n of this.registrations.values())n.supportedFormats?.includes(t)&&r.push(n);return r}findBestWidget(t){const r=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const u=this.scoreWidget(a,t);u>0&&r.push({name:s,registration:a,score:u})}if(r.length===0)return null;r.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const n=r[0];return{name:n.name,registration:n.registration}}scoreWidget(t,r){let n=0;if(t.matcher)if(t.matcher(r))n+=100;else return 0;const s=r.primaryType;s&&t.supportedTypes?.includes(s)&&(n+=50);const a=r.format;return a&&t.supportedFormats?.includes(a)&&(n+=30),n+=t.priority??0,n}createChild(){return new L(this)}}let E=null;function F(){return E||(E=new L),E}function rr(e){E=e}function nr(e){return new L(e)}function ir(e,t,r){return{name:`type:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedTypes:[e],priority:r?.priority??0,canFallback:r?.canFallback??!1}}}function sr(e,t,r){return{name:`format:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedFormats:[e],priority:r?.priority??10,canFallback:r?.canFallback??!1}}}function ar(e,t,r,n){return{name:`type:${e}:format:${t}`,registration:{factory:r,displayName:n?.displayName??`${e}/${t} widget`,description:n?.description,supportedTypes:[e],supportedFormats:[t],priority:n?.priority??20,canFallback:n?.canFallback??!1}}}function ur(e,t,r,n){return{name:e,registration:{factory:r,displayName:n?.displayName??e,description:n?.description,matcher:t,priority:n?.priority??50,canFallback:n?.canFallback??!1}}}function Ee(e,t){if(t){const n=t.findBestWidget(e);if(n)return n}return F().findBestWidget(e)}function or(e){const t=e.definition,r={};if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];n.widget&&typeof n.widget=="object"&&(r.options=n.widget),typeof n.priority=="number"&&(r.priority=n.priority)}if(typeof t=="object"&&"widget"in t){const n=t.widget;typeof n=="object"&&n!==null&&(r.options={...r.options??{},...n})}return Object.keys(r).length>0?r:void 0}function ne(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];if(typeof r.widget=="string")return r.widget}if(typeof t=="object"&&"widget"in t){const r=t.widget;if(r&&typeof r.type=="string")return r.type}}function lr(e){return ne(e)!==void 0}function cr(e,t){const r=ne(e);if(r){if(t){const a=t.get(r);if(a)return{name:r,registration:a}}const s=F().get(r);if(s)return{name:r,registration:s};console.warn(`Widget "${r}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ee(e,t)}function pr(e,t,r){return{...e,...t,...r}}function Ue(e=F()){e.register("string",{factory:({controller:i,ctx:o})=>xe({ctx:o,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:o})=>$e({ctx:o,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:o})=>we({ctx:o,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:o})=>De({ctx:o,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:o})=>Oe({ctx:o,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:o})=>K({ctx:o,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],r=({controller:i,ctx:o})=>Ce({ctx:o,controller:i,intType:o.primaryType});for(const i of t)e.register(i,{factory:r,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const n=["float","double","decimal"],s=({controller:i,ctx:o})=>je({ctx:o,controller:i,floatType:o.primaryType});for(const i of n)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],u=({controller:i,ctx:o})=>Se({ctx:o,controller:i,temporalType:o.primaryType});for(const i of a)e.register(i,{factory:u,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:o})=>Ae({ctx:o,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:o})=>Me({ctx:o,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:o})=>Re({ctx:o,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:o})=>Ne({ctx:o,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:o})=>ke({ctx:o,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:o})=>qe({ctx:o,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:o})=>Fe({ctx:o,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:o})=>Pe({ctx:o,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function We(e=F()){return e.has("string")&&e.has("object")&&e.has("array")}function dr(e=F()){We(e)||Ue(e)}function Be(e){let t=e;if(e.$root){const r=R(e.$root,e);r&&(t=r)}return w(t,e,new Set)}function w(e,t,r){if(e.type&&D(e.type)){const n=e.type.$ref;if(r.has(n))return;r.add(n);const s=R(n,t);if(s){const a={...s,...e,type:s.type},u=w(a,t,r);return r.delete(n),u}r.delete(n);return}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:Cr(e)?null:fr(e,t,r)}function fr(e,t,r){const n=_e(e);if(M(e))return yr(e,t,r);if(n==="choice"&&"choices"in e)return gr(e,t,r);if(n==="tuple"&&"tuple"in e&&"properties"in e)return hr(e,t,r);if(n==="array")return br(e,t,r);if(n==="set")return vr(e,t,r);if(n==="map")return{};if(n==="string")return xr(e);if(jr(n))return $r(e);if(wr(n))return Tr(e);if(n==="boolean")return!1;if(n==="null")return null;if(Sr(n))return Ir(n);if(n==="uuid"||n==="uri"||n==="uri-reference"||n==="binary"||n==="bytes")return""}function mr(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function yr(e,t,r){if(!M(e))return{};const n=mr(e.required),s={};for(const[a,u]of Object.entries(e.properties))if(n.has(a))if(u.type&&D(u.type)){const i=u.type.$ref;if(r.has(i))continue;r.add(i);const o=R(i,t);if(o){const c={...o,...u,type:o.type},p=w(c,t,r);p!==void 0&&(s[a]=p)}r.delete(i)}else{const i=w(u,t,r);i!==void 0&&(s[a]=i)}return s}function gr(e,t,r){if(!("choices"in e))return;const n=e.choices,s=Object.keys(n);if(s.length===0)return;const a=s[0],u=n[a];if("selector"in e&&e.selector){const o=e.selector,c=w(u,t,r);return typeof c=="object"&&c!==null?{[o]:a,...c}:{[o]:a}}const i=w(u,t,r);return{[a]:i}}function hr(e,t,r){if(!("tuple"in e)||!("properties"in e))return{};const n=e.tuple,s=e.properties,a=new Set(e.required??n),u={};for(const i of n){if(!a.has(i))continue;const o=s[i];if(o){const c=w(o,t,r);c!==void 0&&(u[i]=c)}}return u}function br(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function vr(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function xr(e){switch("format"in e?e.format:void 0){case"date":return ze();case"date-time":return Ge();case"time":return"00:00:00";case"email":case"uri":case"uri-reference":case"uuid":default:return""}}function $r(e){const t=_e(e),r=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let n="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,u="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(n=a+1),u!==void 0&&(s=u-1);let i;n!==void 0&&s!==void 0?i=Math.round((n+s)/2):n!==void 0?i=n:s!==void 0?i=0<=s?0:s:i=0;const o="multipleOf"in e?e.multipleOf:void 0;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),s!==void 0&&i>s&&(i=Math.floor(s/o)*o)),r?BigInt(Math.round(i)):Math.round(i)}function Tr(e){let t="minimum"in e?e.minimum:void 0,r="maximum"in e?e.maximum:void 0;const n="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;n!==void 0&&(t=n+a),s!==void 0&&(r=s-a);let u;t!==void 0&&r!==void 0?u=(t+r)/2:t!==void 0?u=t:r!==void 0?u=0<=r?0:r:u=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(u=Math.round(u/i)*i,t!==void 0&&u<t&&(u=Math.ceil(t/i)*i),r!==void 0&&u>r&&(u=Math.floor(r/i)*i)),u}function Ir(e){switch(e){case"date":return ze();case"time":return"00:00:00";case"datetime":return Ge();case"duration":return"PT0S";default:return""}}function Cr(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function _e(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t)if(typeof r=="string"&&r!=="null")return r}}function jr(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function wr(e){return e?["float","double","decimal"].includes(e):!1}function Sr(e){return e?["date","time","datetime","duration"].includes(e):!1}function ze(){return new Date().toISOString().split("T")[0]}function Ge(){return new Date().toISOString()}function Dr(e){if(e.isValid)return d.a.valid;const t=re(e.errors),r=new Map;for(const u of t){const i=r.get(u.path)||[];i.push(u),r.set(u.path,i)}const n=(u,i)=>{if(u.length===0)return{message:i.map(y=>y.message).join("; ")};const[o,...c]=u,p=n(c,i);return{dependencies:{[o]:p}}},s={},a={};for(const[u,i]of r.entries())if(u===""||u==="/")s.message=i.map(o=>o.message).join("; ");else{const o=u.split("/").filter(c=>c!=="");if(o.length===1)a[o[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=o;a[c]=n(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),d.a.invalid(s)}function Or({schema:e,initialValue:t,validationMode:r,validateDebounceMs:n,widgetRegistry:s,readOnly:a,locale:u,onChange:i,onValidate:o,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,b=Be(e);let m;t===void 0?m=b??{}:c?m=h.deepMergeDefaults(b,y):m=y;const g=te(e),f=r??"onTouched",v=k=>{const x=g.validate(k);if(o&&!x.isValid){const A=re(x.errors);o(A)}return Dr(x)},{controller:$,setStatus:j}=d.useController({initialValue:m,validationMode:f,validateDebounceMs:n,validate:f==="onSubmit"?void 0:v,onChange:i}),N=()=>{$.dispose()},O=l.Fragment(l.OnDispose(N),Ve({schema:e,controller:$,widgetRegistry:s,readOnly:a,locale:u}));return p({Form:O,controller:$,setStatus:j})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=Or;exports.RefResolver=be;exports.StructureContext=z;exports.StructureControl=Ve;exports.StructureGenericControl=T;exports.createExtendsResolver=tt;exports.createRefResolver=_;exports.createStructureContext=ve;exports.createValidator=te;exports.createWidgetRegistry=nr;exports.ensureDefaultWidgets=dr;exports.extractStructureDefaults=Be;exports.forFormat=sr;exports.forMatcher=ur;exports.forType=ir;exports.forTypeAndFormat=ar;exports.formatValidationError=Le;exports.formatValidationErrors=re;exports.getChildErrors=tr;exports.getErrorsForPath=Qt;exports.getExplicitWidgetName=ne;exports.getGlobalWidgetRegistry=F;exports.getNonNullTypes=B;exports.getResolvedType=J;exports.getWidgetOptions=or;exports.groupErrorsByPath=Yt;exports.hasConstValue=ye;exports.hasCustomWidget=lr;exports.hasDefaultWidgets=We;exports.hasEnumValue=me;exports.hasErrorsAtPath=er;exports.isArrayTypeDefinition=Z;exports.isBigIntType=le;exports.isChoiceTypeDefinition=Q;exports.isCompoundType=Ze;exports.isFloatType=U;exports.isIntegerType=q;exports.isMapTypeDefinition=X;exports.isNamespace=de;exports.isNullableType=ge;exports.isNumericType=ce;exports.isObjectTypeDefinition=M;exports.isPrimitiveType=pe;exports.isSetTypeDefinition=H;exports.isTemporalType=W;exports.isTupleTypeDefinition=Y;exports.isTypeDefinition=fe;exports.isTypeReference=D;exports.mergeWidgetOptions=pr;exports.parseRefPath=he;exports.registerDefaultWidgets=Ue;exports.resolveExtends=ee;exports.resolveRef=R;exports.resolveTypeReference=Xe;exports.resolveWidget=Ee;exports.resolveWidgetWithOverride=cr;exports.setGlobalWidgetRegistry=rr;exports.validate=_t;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as J, g as Ke, t as Z, N as Je, b as pe, c as de, U as Ze, e as He, a as Xe, T as Ye, L as fe, f as me, h as Qe, G as et, i as tt, S as nt, j as rt } from "../deep-merge-
|
|
1
|
+
import { _ as J, g as Ke, t as Z, N as Je, b as pe, c as de, U as Ze, e as He, a as Xe, T as Ye, L as fe, f as me, h as Qe, G as et, i as tt, S as nt, j as rt } from "../deep-merge-E6b9KE6l.js";
|
|
2
2
|
import { html as p, attr as m, Fragment as H, MapSignal as U, Value as I, computedOf as w, prop as it, WithElement as st, OnDispose as at } from "@tempots/dom";
|
|
3
|
-
import { c as b, b as ne, I as B, S as V, L as ye, e as ut, M as ot, g as re, A as G, h as ct, a as ie } from "../use-form-
|
|
3
|
+
import { c as b, b as ne, I as B, S as V, L as ye, e as ut, M as ot, g as re, A as G, h as ct, a as ie } from "../use-form-DzA1RSrN.js";
|
|
4
4
|
import { T as lt, B as E } from "../translations-DQxouiBG.js";
|
|
5
|
-
import { N as pt, B as dt, D as ft, a as mt, P as yt, b as gt, c as ht, d as bt, e as vt, F as xt } from "../duration-input-
|
|
5
|
+
import { N as pt, B as dt, D as ft, a as mt, P as yt, b as gt, c as ht, d as bt, e as vt, F as xt } from "../duration-input-j7bVks-S.js";
|
|
6
6
|
import { f as $t } from "../colors-pQZlNrwM.js";
|
|
7
7
|
function It(e) {
|
|
8
8
|
return e === "int64" || e === "int128" || e === "uint64" || e === "uint128";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WithElement as S, OnDispose as z, prop as R, computedOf as w, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as B, aria as V, on as X, When as q, Use as H, coalesce as I } from "@tempots/dom";
|
|
2
2
|
import { g as $, T as _ } from "./timer-DzWb416P.js";
|
|
3
|
-
import { s as Y, C as Z } from "./use-form-
|
|
3
|
+
import { s as Y, C as Z } from "./use-form-DzA1RSrN.js";
|
|
4
4
|
import { a as K, B as P } from "./translations-DQxouiBG.js";
|
|
5
5
|
const ee = [
|
|
6
6
|
"a[href]",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./use-form-DVJXMMoN.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
|
|
1
|
+
"use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./use-form-B4D58mxd.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("./translations-hMQlZmD4.cjs"),t=require("@tempots/dom"),C=require("./use-form-
|
|
1
|
+
"use strict";const l=require("./translations-hMQlZmD4.cjs"),t=require("@tempots/dom"),C=require("./use-form-B4D58mxd.cjs"),E=n=>{const r={name:"email",autocomplete:"email",...n},{value:c,before:s,onBlur:a,onChange:p,onInput:i,placeholder:h}=r,d=s??l.InputIcon({icon:"line-md:email",size:n.size,color:"neutral"});return t.Use(l.BeatUII18n,b=>l.InputContainer({...n,before:d,input:t.input.email(l.CommonInputAttributes(r),t.attr.placeholder(t.coalesce(h,b.$.emailPlaceholderText)),t.attr.value(c),t.attr.class("bc-input"),a!=null?t.on.blur(t.emitValue(a)):t.Empty,p!=null?t.on.change(t.emitValue(p)):t.Empty,i!=null?t.on.input(t.emitValue(i)):t.Empty)}))},_=n=>{const{value:r,onBlur:c,onChange:s,onInput:a,before:p,after:i,hasError:h,disabled:d,autocomplete:b,placeholder:I,...f}=n,y={name:"password",disabled:d,...f},u=t.prop(!0),o=t.computedOf(u,b)((e,m)=>e?m??"current-password":"off");return t.Use(l.BeatUII18n,e=>{const m=t.computedOf(e.$.passwordPlaceholderText,u,I)((g,V,v)=>V?"•••••••••••••••":v??g),w=t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__password-toggle"),t.aria.label(e.$.togglePasswordVisibility),t.on.click(()=>u.update(g=>!g)),t.When(u,()=>l.Icon({icon:"line-md:watch"}),()=>l.Icon({icon:"line-md:watch-off"})));return l.InputContainer({before:p,disabled:d,hasError:h,input:t.html.input(l.CommonInputAttributes({...y,autocomplete:o,placeholder:m}),t.When(u,()=>t.Fragment(t.attr.type("password")),()=>t.Fragment(t.attr.type("text"))),t.attr.class("bc-input"),t.attr.value(r),c!=null?t.on.blur(t.emitValue(c)):t.Empty,s!=null?t.on.change(t.emitValue(s)):t.Empty,a!=null?t.on.input(t.emitValue(a)):t.Empty),after:i!=null?t.Fragment(w,i):w})})};function O(n){switch(n){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function B(n){switch(n){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function U(n,r,c,s){const a=["bc-notice",`bc-notice--${n}`,`bc-notice--tone-${r}`];return c&&a.push("bc-notice--dismissible"),s&&s.length>0&&a.push(s),a.join(" ")}function P({variant:n="info",tone:r="subtle",role:c,title:s,icon:a,closable:p=!1,onDismiss:i,class:h},...d){const b=t.prop(!0);return t.When(b,()=>{const I=t.Value.map(p,o=>!!o||i!=null),f=t.Value.map(n,o=>o??"info"),y=t.Value.map(r,o=>o??"subtle"),u=t.computedOf(c,f)((o,e)=>o??(e==="danger"?"alert":"status"));return t.Use(l.BeatUII18n,o=>t.html.div(t.attr.class(t.computedOf(f,y,I,h)((e,m,w,g)=>U(e,m,w,g))),t.attr.role(t.Value.map(u,e=>e)),t.Unless(t.Value.map(a,e=>e===!1),()=>t.html.div(t.attr.class("bc-notice__icon"),l.Icon({icon:t.computedOf(a,f)((e,m)=>e===void 0?O(m):String(e)),size:"md",color:t.Value.map(f,B)}))),t.html.div(t.attr.class("bc-notice__body"),t.Ensure(s,e=>t.html.div(t.attr.class("bc-notice__title"),e)),t.html.div(t.attr.class("bc-notice__content"),...d)),t.When(I,()=>C.CloseButton({size:"xs",label:o.$.closeModal,onClick:()=>{b.set(!1),i?.()}}))))})}exports.EmailInput=E;exports.Notice=P;exports.PasswordInput=_;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { I as j, a as V, b as z, C as O, c as E } from "./translations-DQxouiBG.js";
|
|
2
2
|
import { Use as x, input as A, attr as n, coalesce as F, on as m, Empty as w, emitValue as v, prop as k, computedOf as C, html as p, aria as M, When as T, Fragment as B, Value as g, Unless as R, Ensure as S } from "@tempots/dom";
|
|
3
|
-
import { C as W } from "./use-form-
|
|
3
|
+
import { C as W } from "./use-form-DzA1RSrN.js";
|
|
4
4
|
const L = (t) => {
|
|
5
5
|
const l = {
|
|
6
6
|
name: "email",
|