@tempots/beatui 0.69.0 → 0.72.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.
Files changed (94) hide show
  1. package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +106 -105
  4. package/dist/beatui.css +401 -0
  5. package/dist/beatui.tailwind.css +401 -0
  6. package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
  7. package/dist/deep-merge-CQQCMLwG.js +1636 -0
  8. package/dist/deep-merge-DZxfgKqX.cjs +1 -0
  9. package/dist/duration-input-D-SIoDoo.cjs +1 -0
  10. package/dist/duration-input-DKxZ6OCa.js +277 -0
  11. package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
  12. package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
  13. package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
  14. package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
  15. package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
  16. package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
  17. package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
  18. package/dist/index.cjs.js +4 -4
  19. package/dist/index.es.js +2852 -3104
  20. package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
  21. package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
  22. package/dist/json-schema/index.cjs.js +7 -7
  23. package/dist/json-schema/index.es.js +3814 -3609
  24. package/dist/json-structure/index.cjs.js +1 -0
  25. package/dist/json-structure/index.es.js +3157 -0
  26. package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
  27. package/dist/modal-5P9mU_a4.cjs +1 -0
  28. package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
  29. package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
  30. package/dist/notice-Cqq8g17n.js +209 -0
  31. package/dist/notice-DP209Ed8.cjs +1 -0
  32. package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
  33. package/dist/prosemirror/index.es.js +1 -1
  34. package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
  35. package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
  36. package/dist/tailwind/vite-plugin.es.js +1 -0
  37. package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
  38. package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
  39. package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
  40. package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
  41. package/dist/types/components/form/index.d.ts +1 -0
  42. package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
  43. package/dist/types/components/form/utils/index.d.ts +1 -0
  44. package/dist/types/components/json-schema/controls/null-control.d.ts +1 -1
  45. package/dist/types/components/json-schema/index.d.ts +1 -0
  46. package/dist/types/components/json-schema/json-schema-form.d.ts +22 -3
  47. package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
  48. package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
  49. package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
  50. package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
  51. package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
  52. package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
  53. package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
  54. package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
  55. package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
  56. package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
  57. package/dist/types/components/json-structure/controls/index.d.ts +21 -0
  58. package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
  59. package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
  60. package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
  61. package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
  62. package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
  63. package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
  64. package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
  65. package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
  66. package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
  67. package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
  68. package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
  69. package/dist/types/components/json-structure/index.d.ts +25 -0
  70. package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
  71. package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
  72. package/dist/types/components/json-structure/structure-context.d.ts +176 -0
  73. package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
  74. package/dist/types/components/json-structure/structure-types.d.ts +173 -0
  75. package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
  76. package/dist/types/components/json-structure/validation/index.d.ts +5 -0
  77. package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
  78. package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
  79. package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
  80. package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
  81. package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
  82. package/dist/types/json-structure/index.d.ts +9 -0
  83. package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
  84. package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
  85. package/dist/use-form-DVJXMMoN.cjs +2 -0
  86. package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
  87. package/dist/widget-customization-29Hl2gKT.js +1171 -0
  88. package/dist/widget-customization-BXiewbt-.cjs +1 -0
  89. package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
  90. package/package.json +10 -2
  91. package/dist/modal-D_paG9Sr.cjs +0 -1
  92. package/dist/notice-CgT9ma2m.cjs +0 -2
  93. package/dist/widget-customization-BcbRhAAR.cjs +0 -1
  94. package/dist/widget-customization-D6Y_Qm7o.js +0 -2788
@@ -0,0 +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;