@opennsw/jsonforms-renderers 0.7.0 → 0.9.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function at(s,Z){for(var P=0;P<Z.length;P++){const c=Z[P];if(typeof c!="string"&&!Array.isArray(c)){for(const M in c)if(M!=="default"&&!(M in s)){const h=Object.getOwnPropertyDescriptor(c,M);h&&Object.defineProperty(s,M,h.get?h:{enumerable:!0,get:()=>c[M]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}function st(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var k={exports:{}},it=k.exports,I;function ut(){return I||(I=1,(function(s,Z){(function(P,c){s.exports=c()})(it,(function(){var P={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},c=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,M=/\d/,h=/\d\d/,i=/\d\d?/,O=/\d*[^-_:/,()\s\d]+/,v={},N=function(t){return(t=+t)+(t>68?1900:2e3)},o=function(t){return function(e){this[t]=+e}},R=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=(function(e){if(!e||e==="Z")return 0;var r=e.match(/([+-]|\d\d)/g),n=60*r[1]+(+r[2]||0);return n===0?0:r[0]==="+"?-n:n})(t)}],j=function(t){var e=v[t];return e&&(e.indexOf?e:e.s.concat(e.f))},V=function(t,e){var r,n=v.meridiem;if(n){for(var d=1;d<=24;d+=1)if(t.indexOf(n(d,0,e))>-1){r=d>12;break}}else r=t===(e?"pm":"PM");return r},K={A:[O,function(t){this.afternoon=V(t,!1)}],a:[O,function(t){this.afternoon=V(t,!0)}],Q:[M,function(t){this.month=3*(t-1)+1}],S:[M,function(t){this.milliseconds=100*+t}],SS:[h,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[i,o("seconds")],ss:[i,o("seconds")],m:[i,o("minutes")],mm:[i,o("minutes")],H:[i,o("hours")],h:[i,o("hours")],HH:[i,o("hours")],hh:[i,o("hours")],D:[i,o("day")],DD:[h,o("day")],Do:[O,function(t){var e=v.ordinal,r=t.match(/\d+/);if(this.day=r[0],e)for(var n=1;n<=31;n+=1)e(n).replace(/\[|\]/g,"")===t&&(this.day=n)}],w:[i,o("week")],ww:[h,o("week")],M:[i,o("month")],MM:[h,o("month")],MMM:[O,function(t){var e=j("months"),r=(j("monthsShort")||e.map((function(n){return n.slice(0,3)}))).indexOf(t)+1;if(r<1)throw new Error;this.month=r%12||r}],MMMM:[O,function(t){var e=j("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,o("year")],YY:[h,function(t){this.year=N(t)}],YYYY:[/\d{4}/,o("year")],Z:R,ZZ:R};function W(t){var e,r;e=t,r=v&&v.formats;for(var n=(t=e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(y,Y,f){var u=f&&f.toUpperCase();return Y||r[f]||P[f]||r[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(D,g,L){return g||L.slice(1)}))}))).match(c),d=n.length,m=0;m<d;m+=1){var S=n[m],w=K[S],l=w&&w[0],p=w&&w[1];n[m]=p?{regex:l,parser:p}:S.replace(/^\[|\]$/g,"")}return function(y){for(var Y={},f=0,u=0;f<d;f+=1){var D=n[f];if(typeof D=="string")u+=D.length;else{var g=D.regex,L=D.parser,F=y.slice(u),x=g.exec(F)[0];L.call(Y,x),y=y.replace(x,"")}}return(function($){var b=$.afternoon;if(b!==void 0){var a=$.hours;b?a<12&&($.hours+=12):a===12&&($.hours=0),delete $.afternoon}})(Y),Y}}return function(t,e,r){r.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(N=t.parseTwoDigitYear);var n=e.prototype,d=n.parse;n.parse=function(m){var S=m.date,w=m.utc,l=m.args;this.$u=w;var p=l[1];if(typeof p=="string"){var y=l[2]===!0,Y=l[3]===!0,f=y||Y,u=l[2];Y&&(u=l[2]),v=this.$locale(),!y&&u&&(v=r.Ls[u]),this.$d=(function(F,x,$,b){try{if(["x","X"].indexOf(x)>-1)return new Date((x==="X"?1e3:1)*F);var a=W(x)(F),C=a.year,A=a.month,tt=a.day,et=a.hours,rt=a.minutes,nt=a.seconds,ot=a.milliseconds,B=a.zone,G=a.week,z=new Date,H=tt||(C||A?1:z.getDate()),E=C||z.getFullYear(),_=0;C&&!A||(_=A>0?A-1:z.getMonth());var T,U=et||0,q=rt||0,Q=nt||0,X=ot||0;return B?new Date(Date.UTC(E,_,H,U,q,Q,X+60*B.offset*1e3)):$?new Date(Date.UTC(E,_,H,U,q,Q,X)):(T=new Date(E,_,H,U,q,Q,X),G&&(T=b(T).week(G).toDate()),T)}catch{return new Date("")}})(S,p,w,r),this.init(),u&&u!==!0&&(this.$L=this.locale(u).$L),f&&S!=this.format(p)&&(this.$d=new Date("")),v={}}else if(p instanceof Array)for(var D=p.length,g=1;g<=D;g+=1){l[1]=p[g-1];var L=r.apply(this,l);if(L.isValid()){this.$d=L.$d,this.$L=L.$L,this.init();break}g===D&&(this.$d=new Date(""))}else d.call(this,m)}}}))})(k)),k.exports}var J=ut();const ft=st(J),ct=at({__proto__:null,default:ft},[J]);exports.customParseFormat=ct;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
function at(s, Z) {
|
|
2
|
+
for (var x = 0; x < Z.length; x++) {
|
|
3
|
+
const c = Z[x];
|
|
4
|
+
if (typeof c != "string" && !Array.isArray(c)) {
|
|
5
|
+
for (const M in c)
|
|
6
|
+
if (M !== "default" && !(M in s)) {
|
|
7
|
+
const h = Object.getOwnPropertyDescriptor(c, M);
|
|
8
|
+
h && Object.defineProperty(s, M, h.get ? h : {
|
|
9
|
+
enumerable: !0,
|
|
10
|
+
get: () => c[M]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
|
|
16
|
+
}
|
|
17
|
+
function st(s) {
|
|
18
|
+
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
19
|
+
}
|
|
20
|
+
var k = { exports: {} }, it = k.exports, I;
|
|
21
|
+
function ut() {
|
|
22
|
+
return I || (I = 1, (function(s, Z) {
|
|
23
|
+
(function(x, c) {
|
|
24
|
+
s.exports = c();
|
|
25
|
+
})(it, (function() {
|
|
26
|
+
var x = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, c = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, M = /\d/, h = /\d\d/, i = /\d\d?/, O = /\d*[^-_:/,()\s\d]+/, v = {}, N = function(t) {
|
|
27
|
+
return (t = +t) + (t > 68 ? 1900 : 2e3);
|
|
28
|
+
}, o = function(t) {
|
|
29
|
+
return function(e) {
|
|
30
|
+
this[t] = +e;
|
|
31
|
+
};
|
|
32
|
+
}, R = [/[+-]\d\d:?(\d\d)?|Z/, function(t) {
|
|
33
|
+
(this.zone || (this.zone = {})).offset = (function(e) {
|
|
34
|
+
if (!e || e === "Z") return 0;
|
|
35
|
+
var r = e.match(/([+-]|\d\d)/g), n = 60 * r[1] + (+r[2] || 0);
|
|
36
|
+
return n === 0 ? 0 : r[0] === "+" ? -n : n;
|
|
37
|
+
})(t);
|
|
38
|
+
}], j = function(t) {
|
|
39
|
+
var e = v[t];
|
|
40
|
+
return e && (e.indexOf ? e : e.s.concat(e.f));
|
|
41
|
+
}, V = function(t, e) {
|
|
42
|
+
var r, n = v.meridiem;
|
|
43
|
+
if (n) {
|
|
44
|
+
for (var d = 1; d <= 24; d += 1) if (t.indexOf(n(d, 0, e)) > -1) {
|
|
45
|
+
r = d > 12;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
} else r = t === (e ? "pm" : "PM");
|
|
49
|
+
return r;
|
|
50
|
+
}, K = { A: [O, function(t) {
|
|
51
|
+
this.afternoon = V(t, !1);
|
|
52
|
+
}], a: [O, function(t) {
|
|
53
|
+
this.afternoon = V(t, !0);
|
|
54
|
+
}], Q: [M, function(t) {
|
|
55
|
+
this.month = 3 * (t - 1) + 1;
|
|
56
|
+
}], S: [M, function(t) {
|
|
57
|
+
this.milliseconds = 100 * +t;
|
|
58
|
+
}], SS: [h, function(t) {
|
|
59
|
+
this.milliseconds = 10 * +t;
|
|
60
|
+
}], SSS: [/\d{3}/, function(t) {
|
|
61
|
+
this.milliseconds = +t;
|
|
62
|
+
}], s: [i, o("seconds")], ss: [i, o("seconds")], m: [i, o("minutes")], mm: [i, o("minutes")], H: [i, o("hours")], h: [i, o("hours")], HH: [i, o("hours")], hh: [i, o("hours")], D: [i, o("day")], DD: [h, o("day")], Do: [O, function(t) {
|
|
63
|
+
var e = v.ordinal, r = t.match(/\d+/);
|
|
64
|
+
if (this.day = r[0], e) for (var n = 1; n <= 31; n += 1) e(n).replace(/\[|\]/g, "") === t && (this.day = n);
|
|
65
|
+
}], w: [i, o("week")], ww: [h, o("week")], M: [i, o("month")], MM: [h, o("month")], MMM: [O, function(t) {
|
|
66
|
+
var e = j("months"), r = (j("monthsShort") || e.map((function(n) {
|
|
67
|
+
return n.slice(0, 3);
|
|
68
|
+
}))).indexOf(t) + 1;
|
|
69
|
+
if (r < 1) throw new Error();
|
|
70
|
+
this.month = r % 12 || r;
|
|
71
|
+
}], MMMM: [O, function(t) {
|
|
72
|
+
var e = j("months").indexOf(t) + 1;
|
|
73
|
+
if (e < 1) throw new Error();
|
|
74
|
+
this.month = e % 12 || e;
|
|
75
|
+
}], Y: [/[+-]?\d+/, o("year")], YY: [h, function(t) {
|
|
76
|
+
this.year = N(t);
|
|
77
|
+
}], YYYY: [/\d{4}/, o("year")], Z: R, ZZ: R };
|
|
78
|
+
function W(t) {
|
|
79
|
+
var e, r;
|
|
80
|
+
e = t, r = v && v.formats;
|
|
81
|
+
for (var n = (t = e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(y, Y, f) {
|
|
82
|
+
var u = f && f.toUpperCase();
|
|
83
|
+
return Y || r[f] || x[f] || r[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(D, g, L) {
|
|
84
|
+
return g || L.slice(1);
|
|
85
|
+
}));
|
|
86
|
+
}))).match(c), d = n.length, l = 0; l < d; l += 1) {
|
|
87
|
+
var S = n[l], w = K[S], m = w && w[0], p = w && w[1];
|
|
88
|
+
n[l] = p ? { regex: m, parser: p } : S.replace(/^\[|\]$/g, "");
|
|
89
|
+
}
|
|
90
|
+
return function(y) {
|
|
91
|
+
for (var Y = {}, f = 0, u = 0; f < d; f += 1) {
|
|
92
|
+
var D = n[f];
|
|
93
|
+
if (typeof D == "string") u += D.length;
|
|
94
|
+
else {
|
|
95
|
+
var g = D.regex, L = D.parser, F = y.slice(u), P = g.exec(F)[0];
|
|
96
|
+
L.call(Y, P), y = y.replace(P, "");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return (function($) {
|
|
100
|
+
var b = $.afternoon;
|
|
101
|
+
if (b !== void 0) {
|
|
102
|
+
var a = $.hours;
|
|
103
|
+
b ? a < 12 && ($.hours += 12) : a === 12 && ($.hours = 0), delete $.afternoon;
|
|
104
|
+
}
|
|
105
|
+
})(Y), Y;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return function(t, e, r) {
|
|
109
|
+
r.p.customParseFormat = !0, t && t.parseTwoDigitYear && (N = t.parseTwoDigitYear);
|
|
110
|
+
var n = e.prototype, d = n.parse;
|
|
111
|
+
n.parse = function(l) {
|
|
112
|
+
var S = l.date, w = l.utc, m = l.args;
|
|
113
|
+
this.$u = w;
|
|
114
|
+
var p = m[1];
|
|
115
|
+
if (typeof p == "string") {
|
|
116
|
+
var y = m[2] === !0, Y = m[3] === !0, f = y || Y, u = m[2];
|
|
117
|
+
Y && (u = m[2]), v = this.$locale(), !y && u && (v = r.Ls[u]), this.$d = (function(F, P, $, b) {
|
|
118
|
+
try {
|
|
119
|
+
if (["x", "X"].indexOf(P) > -1) return new Date((P === "X" ? 1e3 : 1) * F);
|
|
120
|
+
var a = W(P)(F), C = a.year, A = a.month, tt = a.day, et = a.hours, rt = a.minutes, nt = a.seconds, ot = a.milliseconds, B = a.zone, G = a.week, z = /* @__PURE__ */ new Date(), H = tt || (C || A ? 1 : z.getDate()), E = C || z.getFullYear(), _ = 0;
|
|
121
|
+
C && !A || (_ = A > 0 ? A - 1 : z.getMonth());
|
|
122
|
+
var T, U = et || 0, q = rt || 0, Q = nt || 0, X = ot || 0;
|
|
123
|
+
return B ? new Date(Date.UTC(E, _, H, U, q, Q, X + 60 * B.offset * 1e3)) : $ ? new Date(Date.UTC(E, _, H, U, q, Q, X)) : (T = new Date(E, _, H, U, q, Q, X), G && (T = b(T).week(G).toDate()), T);
|
|
124
|
+
} catch {
|
|
125
|
+
return /* @__PURE__ */ new Date("");
|
|
126
|
+
}
|
|
127
|
+
})(S, p, w, r), this.init(), u && u !== !0 && (this.$L = this.locale(u).$L), f && S != this.format(p) && (this.$d = /* @__PURE__ */ new Date("")), v = {};
|
|
128
|
+
} else if (p instanceof Array) for (var D = p.length, g = 1; g <= D; g += 1) {
|
|
129
|
+
m[1] = p[g - 1];
|
|
130
|
+
var L = r.apply(this, m);
|
|
131
|
+
if (L.isValid()) {
|
|
132
|
+
this.$d = L.$d, this.$L = L.$L, this.init();
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
g === D && (this.$d = /* @__PURE__ */ new Date(""));
|
|
136
|
+
}
|
|
137
|
+
else d.call(this, l);
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}));
|
|
141
|
+
})(k)), k.exports;
|
|
142
|
+
}
|
|
143
|
+
var J = ut();
|
|
144
|
+
const ft = /* @__PURE__ */ st(J), ht = /* @__PURE__ */ at({
|
|
145
|
+
__proto__: null,
|
|
146
|
+
default: ft
|
|
147
|
+
}, [J]);
|
|
148
|
+
export {
|
|
149
|
+
ht as c
|
|
150
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -146,4 +146,8 @@ export declare const VerticalLayoutRenderer: ({ uischema, schema, path, renderer
|
|
|
146
146
|
|
|
147
147
|
export declare const VerticalLayoutTester: RankedTester;
|
|
148
148
|
|
|
149
|
+
export declare const XmlControl: ComponentType<OwnPropsOfControl>;
|
|
150
|
+
|
|
151
|
+
export declare const XmlControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
152
|
+
|
|
149
153
|
export { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-red-50{background-color:var(--color-red-50)}.p-6{padding:calc(var(--spacing) * 6)}.text-center{text-align:center}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-gray-500{color:var(--color-gray-500)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-\(--gray-3\):hover{background-color:var(--gray-3)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
|
1
|
+
/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.grow{flex-grow:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-red-50{background-color:var(--color-red-50)}.p-6{padding:calc(var(--spacing) * 6)}.text-center{text-align:center}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-gray-500{color:var(--color-gray-500)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-\(--gray-3\):hover{background-color:var(--gray-3)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
|
package/dist/renderers.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).map(
|
|
3
|
-
`):"",Be=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,uischema:l,schema:u,enabled:s,visible:a=!0})=>{var m;if(se(a,r,n),a===!1)return null;const d=c.length===0;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[i," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{value:e||"",onChange:h=>n(r,h.target.value),disabled:!s,placeholder:(m=l.options)==null?void 0:m.placeholder,color:d?void 0:"red",id:r}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,i)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},Pe=y.rankWith(1,y.isStringControl),kt=B.withJsonFormsControlProps(Be),He=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,uischema:l,schema:u,enabled:s,visible:a=!0})=>{var h;if(se(a,r,n),a===!1)return null;const d=c.length===0,m=p=>{if(p===""){n(r,void 0);return}const g=Number(p);isNaN(g)||n(r,g)};return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[i," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:p=>m(p.target.value),disabled:!s,placeholder:(h=l.options)==null?void 0:h.placeholder,color:d?void 0:"red",id:r}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,i)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},We=y.rankWith(2,y.or(y.isNumberControl,y.isIntegerControl)),Lt=B.withJsonFormsControlProps(He),$e=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,schema:l,enabled:u,visible:s=!0})=>{if(se(s,r,n),s===!1)return null;const a=c.length===0;return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.Checkbox,{checked:!!e,onCheckedChange:d=>n(r,d===!0),disabled:!u,id:r}),t.jsxs(o.Text,{as:"label",size:"2",htmlFor:r,children:[i," ",x&&"*"]})]}),!a&&t.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:le(c,i)}),l.description&&t.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:l.description})]})},_e=y.rankWith(2,y.isBooleanControl),Mt=B.withJsonFormsControlProps($e),Ve=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,schema:l,enabled:u,visible:s=!0})=>{if(se(s,r,n),s===!1)return null;const a=c.length===0;let d=[];l.enum?d=l.enum.map(h=>({value:h,label:String(h)})):l.oneOf&&(d=l.oneOf.map(h=>({value:h.const,label:h.title||String(h.const)})));const m=e;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"div",size:"2",weight:"bold",children:[i," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.RadioGroup.Root,{value:m!==void 0?String(m):"",onValueChange:h=>{const p=d.find(g=>String(g.value)===h);p&&n(r,p.value)},disabled:!u,children:t.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:d.map(h=>t.jsxs(o.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[t.jsx(o.RadioGroup.Item,{value:String(h.value)}),t.jsx(o.Text,{size:"2",color:u?void 0:"gray",children:h.label})]},String(h.value)))})}),!a&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,i)}),l.description&&t.jsx(o.Text,{size:"1",color:"gray",children:l.description})]})})},Je=(e,n,r)=>{var x;return y.or(y.isEnumControl,y.isOneOfControl)(e,n,r)&&((x=e==null?void 0:e.options)==null?void 0:x.format)==="radio"?3:-1},zt=B.withJsonFormsControlProps(Ve),Ke=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,schema:l,uischema:u,enabled:s,visible:a=!0})=>{var p;if(se(a,r,n),a===!1)return null;const d=c.length===0;let m=[];l.enum?m=l.enum.map(g=>({value:String(g),label:String(g)})):l.oneOf&&(m=l.oneOf.map(g=>({value:String(g.const),label:g.title||String(g.const)})));const h=e!==void 0?String(e):"";return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[i," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs(o.Select.Root,{value:h,onValueChange:g=>n(r,g),disabled:!s,children:[t.jsx(o.Select.Trigger,{placeholder:((p=u.options)==null?void 0:p.placeholder)||"Select an option",color:d?void 0:"red",id:r}),t.jsx(o.Select.Content,{children:m.map(g=>t.jsx(o.Select.Item,{value:g.value,children:g.label},g.value))})]}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,i)}),l.description&&t.jsx(o.Text,{size:"1",color:"gray",children:l.description})]})})},Ge=y.rankWith(2,y.or(y.isEnumControl,y.isOneOfControl)),Dt=B.withJsonFormsControlProps(Ke),Ut={"small-list":{fetchOnOpen:!0,searchable:!1,paginated:!1},"large-searchable-list":{fetchOnOpen:!0,searchable:!0,paginated:!1},"large-paginated-list":{fetchOnOpen:!1,searchable:!0,paginated:!0}},Bt=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,enabled:l,visible:u=!0,schema:s,uischema:a})=>{var pe;const d=(s==null?void 0:s["x-search"])??{service:""},m=d.service??"",h=d.mode??"large-paginated-list",p=Ut[h],g=(p==null?void 0:p.fetchOnOpen)??!1,S=d.params,R=Ue(m),b=s.type==="object",w=b?typeof e=="string"?{value:e}:e??void 0:void 0,N=b?w==null?void 0:w.value:e,U=w==null?void 0:w.label,A=m?R?p?null:`Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${m}" is not registered.`:"Search not configured.",H=l!==!1,V=!c||c.length===0,[O,E]=v.useState(!1),[L,P]=v.useState(""),[re,Y]=v.useState([]),[ne,J]=v.useState(!1),[X,Z]=v.useState(!1),[ce,te]=v.useState(!1),[ie,T]=v.useState(null),[I,M]=v.useState(void 0),C=v.useRef(void 0),z=v.useRef(null),K=v.useRef(null),q=v.useRef(null),W=v.useRef(void 0);v.useEffect(()=>{var j,G;if(!N){M(void 0),W.current=void 0;return}if(((j=W.current)==null?void 0:j.value)===N&&((G=W.current)==null?void 0:G.label)===U)return;if(W.current={value:N,label:U},b&&U){M({id:N,name:U});return}if(M({id:N,name:U??N}),!(R!=null&&R.resolve))return;let f=!1;return R.resolve(N,S).then(Q=>{!f&&Q&&M(Q)}).catch(()=>{}),()=>{f=!0}},[N,U,b,R,S]);const xe=v.useCallback(async(f,j=!1)=>{var Q;if(!R){T("Search service not configured.");return}(Q=K.current)==null||Q.abort();const G=new AbortController;K.current=G,j?te(!0):(Z(!0),te(!1),T(null));try{const oe=await R.search({query:f,cursor:j?C.current:void 0,signal:G.signal,params:S}),k=oe.options??[];Y(j?jt=>[...jt,...k]:k),C.current=oe.nextCursor,J(((p==null?void 0:p.paginated)??!1)&&oe.nextCursor!=null)}catch{if(G.signal.aborted)return;T("Failed to load results. Please try again.")}finally{G.signal.aborted||(j?te(!1):Z(!1))}},[R,p==null?void 0:p.paginated,S]);if(v.useEffect(()=>{if(!O)return;const f=j=>{q.current&&!q.current.contains(j.target)&&E(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[O]),v.useEffect(()=>{var f;O||((f=K.current)==null||f.abort(),P(""),Y([]),J(!1),T(null),Z(!1),te(!1),C.current=void 0)},[O]),v.useEffect(()=>{if(!O)return;if(!L&&!g){Y([]),J(!1),T(null),C.current=void 0;return}z.current&&clearTimeout(z.current);const f=L?300:0;return z.current=setTimeout(()=>{Y([]),J(!1),C.current=void 0,xe(L)},f),()=>{z.current&&clearTimeout(z.current)}},[L,O,g,xe]),se(u,r,n,b?void 0:null),u===!1)return null;const he=()=>{P(""),Y([]),J(!1),T(null),C.current=void 0,E(!0)},be=f=>{n(r,b?{value:f.id,label:f.name}:f.id),M(f),W.current={value:f.id,label:b?f.name:void 0},E(!1)},ge=f=>{f.stopPropagation(),n(r,b?void 0:null),M(void 0)},ve=f=>{(f.key==="Enter"||f.key===" ")&&ge(f)},Te=((pe=a==null?void 0:a.options)==null?void 0:pe.placeholder)??"Select an option";return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[i," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs("div",{ref:q,style:{position:"relative"},children:[t.jsx(o.TextField.Root,{id:r,value:O?L:(I==null?void 0:I.name)??"",placeholder:O&&(p!=null&&p.searchable)?"Search...":Te,disabled:!H,readOnly:O&&!(p!=null&&p.searchable),style:V?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:f=>{p!=null&&p.searchable&&(P(f.target.value),O||he())},onFocus:()=>{H&&!O&&he()},onKeyDown:f=>{f.key==="Escape"&&E(!1)},children:t.jsx(o.TextField.Slot,{side:"right",children:t.jsxs(o.Flex,{align:"center",gap:"1",children:[N&&H&&t.jsx("span",{role:"button",tabIndex:0,onMouseDown:f=>f.preventDefault(),onClick:ge,onKeyDown:ve,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),t.jsx(ee.ChevronDownIcon,{style:{transform:O?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),O&&t.jsx(o.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:A?t.jsx(o.Box,{p:"3",children:t.jsx(o.Text,{size:"2",color:"gray",children:A})}):t.jsx(o.ScrollArea,{style:{maxHeight:240},children:t.jsxs(o.Box,{p:"1",children:[X&&t.jsx(o.Flex,{justify:"center",p:"4",children:t.jsx(o.Spinner,{})}),!X&&ie&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"red",children:ie})}),!X&&!ie&&re.length===0&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"gray",children:L||g?"No results found.":"Type to search…"})}),re.map(f=>t.jsx(o.Box,{px:"3",py:"2",onMouseDown:j=>j.preventDefault(),onClick:()=>be(f),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:f.id===N?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:t.jsx(o.Text,{size:"2",children:f.name})},f.id)),(p==null?void 0:p.paginated)&&ne&&!ce&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:f=>f.preventDefault(),onClick:()=>void xe(L,!0),children:"Load more"})}),ce&&t.jsx(o.Flex,{justify:"center",p:"2",children:t.jsx(o.Spinner,{})})]})})})]}),!V&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,i)}),s.description&&t.jsx(o.Text,{size:"1",color:"gray",children:s.description})]})})},Xe=B.withJsonFormsControlProps(Bt),qe=y.rankWith(3,y.schemaMatches(e=>{const n=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(n==null?void 0:n.service)=="string"&&n.service!==""})),Pt=(e,n)=>Ot(`${e}T${n}`).format(),Ht=({path:e,label:n,required:r,errors:i,description:x,children:c})=>{const l=i.length===0;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[n," ",r&&t.jsx(o.Text,{color:"red",children:"*"})]}),c,!l&&t.jsx(o.Text,{color:"red",size:"1",children:le(i,n)}),x&&t.jsx(o.Text,{size:"1",color:"gray",children:x})]})})},Ye=({data:e,handleChange:n,path:r,label:i,required:x,errors:c,schema:l,enabled:u,visible:s=!0})=>{if(v.useEffect(()=>{s===!1&&n(r,void 0)},[s,r,n]),s===!1)return null;const a=c.length===0,d=typeof e=="string"?e:"",m=b=>t.jsx(Ht,{path:r,label:i,required:x,errors:c,description:l.description,children:b});if(l.format==="time")return m(t.jsx(o.TextField.Root,{type:"time",value:d,onChange:b=>n(r,b.target.value),disabled:!u,color:a?void 0:"red",id:r}));const h=l.format==="date-time",[p="",g=""]=d.split("T"),S=g.slice(0,5),R=(b,w)=>{if(!b){n(r,void 0);return}n(r,h?Pt(b,w||"00:00"):b)};return m(t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.TextField.Root,{type:"date",value:p,disabled:!u,color:a?void 0:"red",onChange:b=>R(b.target.value,S),id:r,style:{flex:1}}),h&&t.jsx(o.TextField.Root,{type:"time",value:S,disabled:!u||!p,color:a?void 0:"red",onChange:b=>R(p,b.target.value),style:{flex:1}})]}))},Ze=y.rankWith(2,y.or(y.isDateControl,y.isDateTimeControl,y.isTimeControl)),Wt=B.withJsonFormsControlProps(Ye),Qe=({uischema:e,schema:n,path:r,renderers:i,cells:x,enabled:c,visible:l=!0})=>{const s=e.elements;return l===!1?null:t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((a,d)=>t.jsx(B.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:i,cells:x,enabled:c},`${r}-${d}`))})},et=y.rankWith(1,y.uiTypeIs("VerticalLayout")),tt=({uischema:e,schema:n,path:r,renderers:i,cells:x,enabled:c,visible:l=!0})=>{const s=e.elements;return l===!1?null:t.jsx(o.Flex,{direction:"row",gap:"4",children:s.map((a,d)=>t.jsx(o.Box,{style:{flex:1},children:t.jsx(B.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:i,cells:x,enabled:c})},`${r}-${d}`))})},rt=y.rankWith(1,y.uiTypeIs("HorizontalLayout")),nt=({uischema:e,schema:n,path:r,renderers:i,cells:x,enabled:c,visible:l=!0})=>{const u=e,s=u.elements;return l===!1?null:t.jsxs(o.Box,{mb:"6",children:[u.label&&t.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:u.label}),t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((a,d)=>t.jsx(B.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:i,cells:x,enabled:c},`${r}-${d}`))})]})},ot=y.rankWith(1,y.uiTypeIs("Group")),st=({uischema:e,schema:n,path:r,renderers:i,cells:x,enabled:c,visible:l=!0})=>{var h;const s=e.elements.filter(p=>p.type==="Category"),[a,d]=v.useState(((h=s[0])==null?void 0:h.label)||"");if(l===!1||!s.length)return null;const m=s.find(p=>p.label===a)?a:s[0].label;return t.jsxs(o.Tabs.Root,{value:m,onValueChange:d,children:[t.jsx(o.Tabs.List,{children:s.map((p,g)=>t.jsx(o.Tabs.Trigger,{value:p.label,children:p.label},`${r}-${g}`))}),t.jsx(o.Box,{pt:"3",children:s.map((p,g)=>t.jsx(o.Tabs.Content,{value:p.label,children:t.jsx(o.Flex,{direction:"column",gap:"4",children:p.elements.map((S,R)=>t.jsx(B.JsonFormsDispatch,{uischema:S,schema:n,path:r,renderers:i,cells:x,enabled:c},`${r}-${g}-${R}`))})},`${r}-${g}`))})]})},lt=y.rankWith(1,y.uiTypeIs("Categorization"));function ue(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function de(e){return e.split(",").map(n=>{if(n=n.trim(),n.endsWith("/*"))return n.split("/")[0].toUpperCase()+"S";if(n.startsWith("."))return n.slice(1).toUpperCase();const r=n.split("/")[1];return r?r.toUpperCase():n}).join(", ")}function $t(e){return e?Array.isArray(e)?e:[e]:[]}const _t=({data:e,handleChange:n,path:r,label:i,required:x,uischema:c,schema:l,enabled:u,errors:s,visible:a=!0})=>{const d=ze();se(a,r,n,null);const m=!s||s.length===0,h=(l==null?void 0:l["x-file"])??{},p=(c==null?void 0:c.options)??{},g=h.maxFiles??p.maxFiles??1,S=h.maxSize??p.maxSize??5*1024*1024,R=h.accept??p.accept??"image/*,application/pdf",b=g>1,w=u!==!1,[N,U]=v.useState(!1),[A,H]=v.useState(null),[V,O]=v.useState({}),E=v.useRef(new Set),L=v.useRef(null),P=$t(e),re=P.length>=g;v.useEffect(()=>()=>{E.current.forEach(T=>URL.revokeObjectURL(T)),E.current.clear()},[]);const Y=v.useCallback(async T=>{if(H(null),P.length>=g){H(`Maximum ${g} file${g>1?"s":""} allowed.`);return}if(T.size>S){H(`File exceeds the ${ue(S)} limit.`);return}if(!R.split(",").map(C=>C.trim()).some(C=>C==="*"||C==="*/*"?!0:C.endsWith("/*")?T.type.startsWith(C.slice(0,-1)):C.startsWith(".")?T.name.toLowerCase().endsWith(C.toLowerCase()):T.type===C)){H(`Invalid type. Accepted: ${de(R)}`);return}if(!(d!=null&&d.onUpload)){H("Upload service not configured.");return}try{const C=await d.onUpload(T),z=URL.createObjectURL(T);E.current.add(z);const K={key:C.key,name:C.name??T.name,blobUrl:z};O(W=>({...W,[C.key]:K}));const q=[...P,C.key];n(r,b?q:q[0])}catch{H("Upload failed. Please try again."),L.current&&(L.current.value="")}},[P,g,S,R,d,r,n,b]);if(a===!1)return null;const ne=T=>{T.preventDefault(),T.stopPropagation(),!(!w||re)&&U(T.type==="dragenter"||T.type==="dragover")},J=T=>{var I;T.preventDefault(),T.stopPropagation(),U(!1),!(!w||re)&&(I=T.dataTransfer.files)!=null&&I[0]&&Y(T.dataTransfer.files[0])},X=T=>{var I;(I=T.target.files)!=null&&I[0]&&(Y(T.target.files[0]),T.target.value="")},Z=T=>{if(!w)return;O(M=>{var K;const C={...M},z=(K=C[T])==null?void 0:K.blobUrl;return z&&(URL.revokeObjectURL(z),E.current.delete(z)),delete C[T],C});const I=P.filter(M=>M!==T);n(r,b?I.length>0?I:null:I[0]??null)},ce=async(T,I)=>{var z,K,q;T.preventDefault();const M=(z=V[I])==null?void 0:z.blobUrl;if(M){(K=window.open(M,"_blank","noopener,noreferrer"))==null||K.focus();return}const C=window.open("","_blank");if(C)try{const W=await((q=d==null?void 0:d.getDownloadUrl)==null?void 0:q.call(d,I));W!=null&&W.url?C.location.href=W.url:C.close()}catch{C.close()}};if(!w&&P.length===0)return null;const te=g-P.length,ie=w&&!re;return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[i,x&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsx(o.Text,{size:"1",color:"gray",children:b?`Up to ${g} files · ${ue(S)} each · ${de(R)}`:`${ue(S)} · ${de(R)}`})]}),P.map(T=>{var I;return t.jsx(o.Card,{size:"2",variant:"surface",mb:"2",children:t.jsxs(o.Flex,{align:"center",gap:"3",children:[t.jsx(o.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:t.jsx(ee.FileTextIcon,{width:"20",height:"20"})}),t.jsx(o.Box,{style:{flex:1,overflow:"hidden"},children:t.jsx(o.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((I=V[T])==null?void 0:I.name)??"Uploaded File"})}),t.jsxs(o.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[t.jsx(o.Button,{variant:"soft",color:"blue",size:"1",onClick:M=>ce(M,T),children:"View"}),t.jsx(ee.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),w&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>Z(T),children:t.jsx(ee.Cross2Icon,{})})]})]})},T)}),ie&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var T;return(T=L.current)==null?void 0:T.click()},onKeyDown:T=>{var I;(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),(I=L.current)==null||I.click())},onDragEnter:ne,onDragLeave:ne,onDragOver:ne,onDrop:J,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",N?"border-blue-500 bg-blue-50":A?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[t.jsx("input",{ref:L,type:"file",style:{display:"none"},accept:R,onChange:X}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:A?t.jsxs(t.Fragment,{children:[t.jsx(ee.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:A}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ee.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:P.length>0?`Add another file (${te} remaining)`:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(R)]})]})})]}),w&&re&&b&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",g," files uploaded. Remove one to replace it."]}),!m&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(s,i)})]})},it=B.withJsonFormsControlProps(_t),ct=y.rankWith(10,y.and(y.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const n=e.items;return(n==null?void 0:n.type)==="string"&&(n==null?void 0:n.format)==="file"}return!1})));function Vt(e,n){return e!==!1&&n!==!0}class we extends Error{}function Jt(e,n){const r=Se.read(e,{type:"array",cellDates:!0});if(r.SheetNames.length===0)throw new we("This file has no sheets.");const i=n??r.SheetNames[0],x=r.Sheets[i];if(!x)throw new we(`This file doesn't have a sheet named "${i}".`);const c=Se.utils.sheet_to_json(x,{header:1,raw:!0,defval:null});return{sheetName:i,matrix:c,rowCount:c.length,colCount:Math.max(0,...c.map(l=>l.length))}}function Kt(e){let n=e+1,r="";for(;n>0;){const i=(n-1)%26;r=String.fromCharCode(65+i)+r,n=Math.floor((n-1)/26)}return r}class _ extends Error{constructor(r,i){super(i??r);Ee(this,"code");this.code=r,this.name="FormulaError"}}const Gt=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],Xt=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],qt=["YEAR","MONTH","DAY","WEEKDAY"],Yt=["IF"],Zt=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],Qt=new Set([...Gt,...Xt,...qt,...Zt,...Yt]),er=/"(?:[^"]|"")*"/g,Ae=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function tr(e){const n=e.replace(er,i=>" ".repeat(i.length));Ae.lastIndex=0;let r;for(;(r=Ae.exec(n))!==null;){const i=r[1].toUpperCase();if(!Qt.has(i))throw new _("NAME",`Function ${i} is not allowed.`)}}function rr(e,n,r){let i=e;if(i==null)throw r.NA;if(typeof i=="object"&&!(i instanceof r)&&(i=n.retrieveRef(i)),i instanceof r)throw i;if(typeof i=="boolean")return i;if(typeof i=="number")return i!==0;throw r.VALUE}function at(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function ae(e){const n=at(e);return Array.isArray(n)?n.flat(1/0):[n]}function F(e){const n=at(e);return Array.isArray(n)?n.flat(1/0)[0]:n}function ye(e){return e===void 0?void 0:F(e)}function $(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function nr(e,n){return e instanceof n?e:new n(e.message||"#ERROR!")}function D(e){return e.find(n=>n instanceof Error)}function or(e,n){const r=c=>{throw nr(c,n)},i=(c,{checkArgsForErrors:l=!0}={})=>(...u)=>{const s=u.flatMap(ae);if(l){const d=D(s);d&&r(d)}const a=c(...s);return a instanceof Error?r(a):a},x=(c,{toText:l=!1}={})=>u=>{const s=F(u),a=D([s]);a&&r(a);const d=c(l?$(s):s);return d instanceof Error?r(d):d};return{IF:(c,l,u,s)=>{const a=rr(l,c,n);if(u==null)throw n.NA;return a?u:s??!1},MAX:i(e.MAX),MIN:i(e.MIN),MAXA:i(e.MAXA),MINA:i(e.MINA),MEDIAN:i(e.MEDIAN),COUNTA:i(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(c,l)=>{const u=ae(c),s=F(l),a=D([...u,s]);a&&r(a);const d=e.LARGE(u,s);return d instanceof Error?r(d):d},SMALL:(c,l)=>{const u=ae(c),s=F(l),a=D([...u,s]);a&&r(a);const d=e.SMALL(u,s);return d instanceof Error?r(d):d},PERMUT:(c,l)=>{const u=[F(c),F(l)],s=D(u);s&&r(s);const a=e.PERMUT(u[0],u[1]);return a instanceof Error?r(a):a},PERMUTATIONA:(c,l)=>{const u=[F(c),F(l)],s=D(u);s&&r(s);const a=e.PERMUTATIONA(u[0],u[1]);return a instanceof Error?r(a):a},MATCH:(c,l)=>{const u=F(c),s=ae(l),a=D([u,...s]);a&&r(a);const d=e.MATCH(u,s,0);return d instanceof Error?r(d):d},SWITCH:(...c)=>{const l=c.map(F),u=D(l);u&&r(u);const s=e.SWITCH(...l);return s instanceof Error?r(s):s},SUBSTITUTE:(c,l,u,s)=>{const a=[$(F(c)),$(F(l)),$(F(u))];s!==void 0&&a.push(F(s));const d=D(a);d&&r(d);const m=e.SUBSTITUTE(...a);return m instanceof Error?r(m):m},TEXTJOIN:(c,l,...u)=>{const s=$(F(c)),a=F(l),d=u.flatMap(ae).map($),m=D([s,a]);m&&r(m);const h=e.TEXTJOIN(s,a,d);return h instanceof Error?r(h):h},UPPER:x(e.UPPER),YEAR:x(e.YEAR),MONTH:x(e.MONTH),DAY:x(e.DAY),WEEKDAY:(c,l)=>{const u=F(c),s=F(l),a=D([u]);a&&r(a);const d=e.WEEKDAY(u,s);return d instanceof Error?r(d):d},CONCATENATE:(...c)=>{const l=c.flatMap(ae),u=D(l);u&&r(u);const s=e.CONCATENATE(...l.map($));return s instanceof Error?r(s):s},CONCAT:(...c)=>{const l=c.flatMap(ae),u=D(l);u&&r(u);const s=e.CONCAT(...l.map($));return s instanceof Error?r(s):s},LEN:x(e.LEN,{toText:!0}),TRIM:x(e.TRIM,{toText:!0}),LOWER:x(e.LOWER,{toText:!0}),LEFT:(c,l)=>{const u=F(c),s=ye(l),a=D([u]);a&&r(a);const d=e.LEFT($(u),s);return d instanceof Error?r(d):d},RIGHT:(c,l)=>{const u=F(c),s=ye(l),a=D([u]);a&&r(a);const d=e.RIGHT($(u),s);return d instanceof Error?r(d):d},MID:(c,l,u)=>{const s=F(c),a=F(l),d=F(u),m=D([s,a,d]);m&&r(m);const h=e.MID($(s),a,d);return h instanceof Error?r(h):h},FIND:(c,l,u)=>{const s=F(c),a=F(l),d=ye(u),m=D([s,a]);m&&r(m);const h=e.FIND($(s),$(a),d);return h instanceof Error?r(h):h},SEARCH:(c,l,u)=>{const s=F(c),a=F(l),d=ye(u),m=D([s,a]);m&&r(m);const h=e.SEARCH($(s),$(a),d);return h instanceof Error?r(h):h}}}const sr={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Fe(e){return sr[e.error]??"ERROR"}function Oe(e,n){if(e instanceof _)return e;if(e instanceof n){const r=e.details;return r instanceof _?r:r instanceof n?new _(Fe(r),r.message):new _(Fe(e),e.message)}return new _("ERROR",e instanceof Error?e.message:void 0)}function lr(e){return Math.max(0,...e.map(n=>(n==null?void 0:n.length)??0))}function ir(e){return n=>{const r=e[n.row-1];if(n.row<1||n.col<1||r==null||n.col-1>=r.length)throw new _("REF");const i=r[n.col-1];return i==null||i===""?null:i}}function cr(e){return n=>{const r=Math.min(n.from.row,n.to.row),i=Math.min(n.from.col,n.to.col),x=Math.max(n.from.row,n.to.row),c=Math.max(n.from.col,n.to.col),l=lr(e);if(r>e.length||i>l)throw new _("REF");const u=Math.min(x,e.length),s=[];for(let a=r;a<=u;a++){const d=e[a-1],m=[];if(d!=null){const h=Math.min(c,d.length);for(let p=i;p<=h;p++){const g=d[p-1];m.push(g==null||g===""?null:g)}}s.push(m)}return s}}function ar(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new _("VALUE")}async function ut(e,n){if(typeof e!="string")throw new _("ERROR");const r=e.trim();if(r==="")throw new _("ERROR");const i=r.startsWith("=")?r.slice(1):r;tr(i);const[x,c]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),l=x.default??x,u=l.FormulaError,s=new l({...n,functions:or(c,u)});let a;try{a=s.parse(i,{row:1,col:1,sheet:"Sheet1"})}catch(d){throw Oe(d,u)}if(a instanceof u)throw Oe(a,u);return ar(a)}async function ur(e,n){return ut(n,{onCell:ir(e),onRange:cr(e)})}const Ie=-1;async function dr(e,n){const r=Object.keys(e);return ut(n,{onVariable:i=>{const x=r.indexOf(i);return x===-1?null:{row:Ie,col:x+1}},onCell:i=>{if(i.row===Ie)return e[r[i.col-1]]??null;throw new _("REF")},onRange:()=>{throw new _("REF")}})}const dt={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function ft(e){const n=e instanceof _?e.code:"ERROR";return dt[n]}async function fr(e,n){return e.length===0?n.map(r=>({id:typeof(r==null?void 0:r.id)=="string"?r.id:"(unknown)",label:(r==null?void 0:r.label)??"(unknown)",value:null,error:dt.ERROR})):Promise.all(n.map(async r=>{try{if(!r||typeof r.label!="string"||typeof r.expression!="string"||typeof r.id!="string")throw new _("ERROR");return{id:r.id,label:r.label,value:await ur(e,r.expression)}}catch(i){return{id:typeof(r==null?void 0:r.id)=="string"?r.id:"(unknown)",label:(r==null?void 0:r.label)??"(unknown)",value:null,error:ft(i)}}}))}function xr(e,n={}){if(n.columnHeader&&n.rowHeader)throw new Error("x-spreadsheet: columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.");return n.columnHeader?hr(e):n.rowHeader?pr(e):e}function xt(e){return e==null||e===""?null:e instanceof Date?e.toISOString():String(e)}function ht(e,n){const r=new Set;for(const i of e)if(i!=null){if(r.has(i))throw new Error(`x-spreadsheet: duplicate ${n} value "${i}" — every ${n==="columnHeader"?"column header":"column-A value"} must be unique to shape as records.`);r.add(i)}}function hr(e){const[n,...r]=e;if(!n)return[];const i=n.map(xt);return ht(i,"columnHeader"),r.map(x=>{const c=Object.create(null);return i.forEach((l,u)=>{l!=null&&(c[l]=x[u]??null)}),c})}function pr(e){const n=e.map(x=>xt(x[0]));ht(n,"rowHeader");const r=Math.max(0,...e.map(x=>x.length)),i=Math.max(0,r-1);return Array.from({length:i},(x,c)=>{const l=c+1,u=Object.create(null);return n.forEach((s,a)=>{s!=null&&(u[s]=e[a][l]??null)}),u})}function Ne(e){return!Array.isArray(e[0])}async function mr(e,n,r={}){const i=await fr(e,n),x=Object.create(null);for(const{id:c,label:l,value:u,error:s}of i)x[c]=s===void 0?{label:l,value:u}:{label:l,value:u,error:s};return r.persistSheet===!1?{derivations:x}:{sheet:xr(e,r),derivations:x}}const gr=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",Tr=10*1024*1024,fe=200,ke=50,yr=[];function me(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const br=({data:e,handleChange:n,path:r,label:i,required:x,schema:c,enabled:l,readonly:u,errors:s,visible:a=!0})=>{se(a,r,n,null);const d=!s||s.length===0,m=Vt(l,u),h=(c==null?void 0:c["x-spreadsheet"])??{},p=(c==null?void 0:c["x-evaluate"])??yr,g=h.accept??gr,S=h.maxSize??Tr,R=h.persistSheet!==!1,b=h.columnHeader===!0,w=h.rowHeader===!0,N=h.showSheet!==!1,U=h.sheetName,A=e??null,[H,V]=v.useState(()=>A!=null&&A.sheet||Object.keys((A==null?void 0:A.derivations)??{}).length>0?"ready":"empty"),[O,E]=v.useState(null),[L,P]=v.useState(!1),[re,Y]=v.useState(null),ne=v.useRef(null),J=(A==null?void 0:A.sheet)??null,X=re??(J&&!Ne(J)?J:null),Z=re==null&&J&&Ne(J)?J:null,ce=(A==null?void 0:A.derivations)??{},te=X!=null||A!=null,ie=v.useCallback(async f=>{if(E(null),f.size>S){E(`File exceeds the ${ue(S)} limit.`);return}if(!g.split(",").map(k=>k.trim()).some(k=>k==="*"||k==="*/*"?!0:k.endsWith("/*")?f.type.startsWith(k.slice(0,-1)):k.startsWith(".")?f.name.toLowerCase().endsWith(k.toLowerCase()):f.type===k)){E(`Invalid type. Accepted: ${de(g)}`);return}V("parsing");let Q;try{const k=await f.arrayBuffer();Q=Jt(k,U).matrix}catch(k){V("error"),E(k instanceof we?k.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}Y(Q);let oe;try{oe=await mr(Q,p,{persistSheet:R,columnHeader:b,rowHeader:w})}catch(k){V("error"),E(k instanceof Error?k.message:"Failed to process the uploaded spreadsheet.");return}n(r,oe),V("ready")},[g,S,R,b,w,U,p,r,n]);if(a===!1)return null;if(b&&w)return t.jsxs(o.Box,{mb:"4",children:[t.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:i}),t.jsx(o.Text,{size:"2",color:"red",style:{display:"block"},children:"Invalid x-spreadsheet config: columnHeader and rowHeader cannot both be true — pick one orientation."})]});if(!m&&!te)return null;const T=f=>{f.preventDefault(),f.stopPropagation(),m&&P(f.type==="dragenter"||f.type==="dragover")},I=f=>{var j;f.preventDefault(),f.stopPropagation(),P(!1),m&&(j=f.dataTransfer.files)!=null&&j[0]&&ie(f.dataTransfer.files[0])},M=f=>{var j;(j=f.target.files)!=null&&j[0]&&(ie(f.target.files[0]),f.target.value="")},C=()=>{m&&(Y(null),E(null),V("empty"),n(r,null))},z=b?1:0,K=w?1:0,q=X?X.slice(z):[],W=q.slice(0,fe),xe=Math.min(ke,Math.max(0,...W.map(f=>Math.max(0,f.length-K)))),he=Array.from({length:xe},(f,j)=>j+K),be=N&&X==null&&Z==null&&A!=null,ge="",ve=w&&!b,Te=Z?Z.slice(0,fe):[],pe=Array.from(new Set(Te.flatMap(f=>Object.keys(f)))).slice(0,ke);return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[t.jsxs(o.Flex,{align:"center",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[i,x&&t.jsx(o.Text,{color:"red",children:" *"})]}),te&&m&&t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{content:"Replace spreadsheet",children:t.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var f;return(f=ne.current)==null?void 0:f.click()},"aria-label":"Replace spreadsheet",children:t.jsx(ee.UploadIcon,{})})}),t.jsx(o.Tooltip,{content:"Remove spreadsheet",children:t.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:C,"aria-label":"Remove spreadsheet",children:t.jsx(ee.Cross2Icon,{})})})]})]}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(g)]})]}),te&&O&&t.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:O}),t.jsx("input",{ref:ne,type:"file",style:{display:"none"},accept:g,onChange:M}),m&&!te&&t.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var f;return(f=ne.current)==null?void 0:f.click()},onKeyDown:f=>{var j;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(j=ne.current)==null||j.click())},onDragEnter:T,onDragLeave:T,onDragOver:T,onDrop:I,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",L?"border-blue-500 bg-blue-50":O?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:H==="parsing"?t.jsxs(t.Fragment,{children:[t.jsx(o.Spinner,{size:"3"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):O?t.jsxs(t.Fragment,{children:[t.jsx(ee.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:O}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ee.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(g)]})]})})}),X&&N&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:t.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[!ve&&t.jsx(o.Table.Header,{children:t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.ColumnHeaderCell,{children:ge}),he.map(f=>{var j;return t.jsx(o.Table.ColumnHeaderCell,{children:b?me((j=X[0])==null?void 0:j[f]):Kt(f)},f)})]})}),t.jsx(o.Table.Body,{children:W.map((f,j)=>{var Q;const G=z+j;return t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{style:w?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:w?me((Q=X[G])==null?void 0:Q[0]):b?"":G+1}),he.map(oe=>t.jsx(o.Table.Cell,{children:me(f[oe])},oe))]},j)})})]})}),q.length>fe&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",fe," of ",q.length," rows"]})]}),Z&&N&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:t.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[t.jsx(o.Table.Header,{children:t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.ColumnHeaderCell,{}),pe.map(f=>t.jsx(o.Table.ColumnHeaderCell,{children:f},f))]})}),t.jsx(o.Table.Body,{children:Te.map((f,j)=>t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{children:j+1}),pe.map(G=>t.jsx(o.Table.Cell,{children:me(f[G])},G))]},j))})]})}),Z.length>fe&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",fe," of ",Z.length," rows"]})]}),be&&t.jsx(o.Text,{size:"2",color:"gray",mt:"3",style:{display:"block"},children:"Sheet preview not stored for this field — re-upload to view contents."}),Object.keys(ce).length>0&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),t.jsx(o.Flex,{direction:"column",gap:"1",children:Object.entries(ce).map(([f,j])=>t.jsxs(o.Flex,{justify:"between",children:[t.jsx(o.Text,{size:"2",children:j.label}),j.error?t.jsx(o.Text,{size:"2",color:"red",children:j.error}):t.jsx(o.Text,{size:"2",children:me(j.value)})]},f))})]}),!d&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(s,i)})]})},pt=B.withJsonFormsControlProps(br),mt=y.rankWith(10,y.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object"));function vr(e,n,r){const i={};for(const[x,c]of Object.entries(r)){const{path:l,default:u}=typeof c=="string"?{path:c,default:void 0}:c,s=n?`${n}.${l}`:l,a=y.Resolve.data(e,s);if(a==null){if(u===void 0)return;i[x]=u}else i[x]=a}return i}async function jr(e,n){try{return{status:"ok",value:await dr(e,n)}}catch(r){return{status:"error",error:ft(r)}}}function wr(e,n){return e==null?"":typeof e=="number"?e.toFixed(Cr(n)):e instanceof Date?e.toLocaleDateString():String(e)}function Cr(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Le="{value}",Rr=2,Er={},Sr=({data:e,handleChange:n,path:r,label:i,schema:x,visible:c=!0})=>{var H;se(c,r,n,null);const l=x==null?void 0:x["x-computed"],u=(l==null?void 0:l.inputs)??Er,s=(l==null?void 0:l.formula)??"",a=(l==null?void 0:l.format)??Le,d=(l==null?void 0:l.decimals)??Rr,m=B.useJsonForms(),h=r.split(".").slice(0,-1).join("."),p=vr((H=m.core)==null?void 0:H.data,h,u),g=p?JSON.stringify(p):null,S=m.readonly===!0,[R,b]=v.useState(()=>typeof e=="number"?"ok":"unavailable"),[w,N]=v.useState(()=>typeof e=="number"?e:null),[U,A]=v.useState(null);return v.useEffect(()=>{if(!c)return;let V=!1;const O=E=>{S||E!==(e??null)&&n(r,E)};if(p===void 0){b("unavailable"),A(null),N(null),O(null);return}return b(E=>E==="ok"?E:"loading"),jr(p,s).then(E=>{if(V)return;const L=E.status==="ok"&&typeof E.value=="number"&&Number.isFinite(E.value)?E.value:null;if(L===null){b("error"),A(E.status==="error"?E.error??"Unable to compute value.":"Computed value must be a number."),N(null),O(null);return}b("ok"),A(null),N(L),O(L)}),()=>{V=!0}},[g,s,c,S]),c===!1?null:t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:i}),R==="unavailable"?t.jsx(o.Text,{size:"2",color:"gray",children:"Not yet available."}):R==="loading"?t.jsxs(o.Flex,{align:"center",gap:"2",children:[t.jsx(o.Spinner,{size:"1"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Computing…"})]}):R==="error"?t.jsx(o.Text,{size:"2",color:"red",children:U}):t.jsx(o.Text,{size:"2",children:a.split(Le).join(wr(w,d))}),x.description&&t.jsx(o.Text,{size:"1",color:"gray",children:x.description})]})})},gt=B.withJsonFormsControlProps(Sr),Tt=y.rankWith(5,y.schemaMatches(e=>{const n=e["x-computed"];return e.type==="number"&&typeof n=="object"&&n!==null})),Ar=({data:e,path:n,schema:r,uischema:i,enabled:x,visible:c,addItem:l,removeItems:u,rootSchema:s,arraySchema:a})=>{const d=a?r:r.items,m=a||r;if(c===!1||!d||typeof d!="object"||Array.isArray(d))return null;const h=d,p=Array.isArray(e)?e:[],g=m.title||"Array Items",S=()=>{const b=y.createDefaultValue(h,s);l&&l(n,b)()},R=b=>{if(u){const w=u(n,[b]);w&&w()}};return t.jsx(o.Box,{mb:"6",children:t.jsxs(o.Flex,{direction:"column",gap:"4",children:[t.jsx(o.Text,{as:"div",size:"4",weight:"bold",children:g}),p.length===0&&t.jsx(o.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:t.jsx(o.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),p.map((b,w)=>{var U;const N=`${n}.${w}`;return t.jsx(o.Card,{size:"3",variant:"surface",children:t.jsxs(o.Flex,{direction:"column",gap:"4",children:[t.jsxs(o.Flex,{justify:"between",align:"center",children:[t.jsxs(o.Text,{size:"3",weight:"bold",children:["Item ",w+1]}),x&&t.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>R(w),title:"Remove item",children:[t.jsx(ee.TrashIcon,{}),"Remove"]})]}),t.jsx(o.Box,{children:t.jsx(B.JsonFormsDispatch,{schema:h,uischema:((U=i.options)==null?void 0:U.detail)||(h.type==="object"||h.properties?{type:"VerticalLayout",elements:Object.keys(h.properties||{}).map(A=>({type:"Control",scope:`#/properties/${A}`}))}:{type:"Control",scope:"#"}),path:N,enabled:x,renderers:void 0,cells:void 0})})]})},N)}),x&&t.jsx(o.Box,{mt:"2",children:t.jsxs(o.Button,{type:"button",variant:"surface",onClick:S,children:[t.jsx(ee.PlusIcon,{}),"Add Item"]})})]})})},Ce=B.withJsonFormsArrayControlProps(Ar),yt=y.rankWith(3,y.isObjectArrayControl),bt=({uischema:e,visible:n})=>{const r=e;return n===!1?null:t.jsx(o.Box,{mb:"4",children:t.jsx(o.Heading,{size:"4",children:r.text})})},vt=y.rankWith(1,y.uiTypeIs("Label")),Fr=y.rankWith(3,y.isPrimitiveArrayControl),Or=[{tester:Pe,renderer:kt},{tester:We,renderer:Lt},{tester:_e,renderer:Mt},{tester:Je,renderer:zt},{tester:qe,renderer:Xe},{tester:Ge,renderer:Dt},{tester:Ze,renderer:Wt},{tester:et,renderer:Qe},{tester:rt,renderer:tt},{tester:ot,renderer:nt},{tester:lt,renderer:st},{tester:ct,renderer:it},{tester:mt,renderer:pt},{tester:Tt,renderer:gt},{tester:yt,renderer:Ce},{tester:Fr,renderer:Ce},{tester:vt,renderer:bt}];exports.ArrayControl=Ce;exports.ArrayControlTester=yt;exports.BooleanControl=$e;exports.BooleanControlTester=_e;exports.CategorizationLayoutRenderer=st;exports.CategorizationLayoutTester=lt;exports.ComputedControl=gt;exports.ComputedControlTester=Tt;exports.DateControl=Ye;exports.DateControlTester=Ze;exports.FileControl=it;exports.FileControlTester=ct;exports.GroupLayoutRenderer=nt;exports.GroupLayoutTester=ot;exports.HorizontalLayoutRenderer=tt;exports.HorizontalLayoutTester=rt;exports.LabelRenderer=bt;exports.LabelTester=vt;exports.NumberControl=He;exports.NumberControlTester=We;exports.RadioControl=Ve;exports.RadioControlTester=Je;exports.SearchSelectControl=Xe;exports.SearchSelectControlTester=qe;exports.SearchServiceProvider=Nt;exports.SelectControl=Ke;exports.SelectControlTester=Ge;exports.SpreadsheetControl=pt;exports.SpreadsheetControlTester=mt;exports.TextControl=Be;exports.TextControlTester=Pe;exports.UploadProvider=It;exports.VerticalLayoutRenderer=Qe;exports.VerticalLayoutTester=et;exports.radixRenderers=Or;exports.useSearchService=Ue;exports.useUpload=ze;
|
|
1
|
+
"use strict";var kt=Object.create;var Re=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Mt=(e,r,t)=>r in e?Re(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var zt=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of Nt(r))!Lt.call(e,c)&&c!==t&&Re(e,c,{get:()=>r[c],enumerable:!(s=It(r,c))||s.enumerable});return e};var we=(e,r,t)=>(t=e!=null?kt(Dt(e)):{},zt(r||!e||!e.__esModule?Re(t,"default",{value:e,enumerable:!0}):t,e));var Ie=(e,r,t)=>Mt(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("react"),b=require("@jsonforms/core"),J=require("@jsonforms/react"),o=require("@radix-ui/themes"),Y=require("@radix-ui/react-icons"),Ut=require("dayjs"),Ne=require("@e965/xlsx"),$e=y.createContext(null);function Pt({children:e,onUpload:r,getDownloadUrl:t}){const s={onUpload:r,getDownloadUrl:t};return n.jsx($e.Provider,{value:s,children:e})}function _e(){return y.useContext($e)}const We=y.createContext(null);function Bt({children:e,services:r}){const t=y.useMemo(()=>r,[r]);return n.jsx(We.Provider,{value:t,children:e})}function Ve(e){const r=y.useContext(We);return!r||!e?null:r[e]??null}const pe=(e,r,t,s=void 0)=>{y.useEffect(()=>{e===!1&&t(r,s)},[e,r,t,s])},xe=(e,r)=>e?e.split(`
|
|
2
|
+
`).map(t=>t.trim()==="is a required property"?`${r||"This field"} is required`:t).join(`
|
|
3
|
+
`):"",He=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,uischema:i,schema:d,enabled:a,visible:u=!0})=>{var m;if(pe(u,t,r),u===!1)return null;const f=l.length===0;return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&n.jsx(o.Text,{color:"red",children:"*"})]}),n.jsx(o.TextField.Root,{value:e||"",onChange:p=>r(t,p.target.value),disabled:!a,placeholder:(m=i.options)==null?void 0:m.placeholder,color:f?void 0:"red",id:t}),!f&&n.jsx(o.Text,{color:"red",size:"1",children:xe(l,s)}),d.description&&n.jsx(o.Text,{size:"1",color:"gray",children:d.description})]})})},Xe=b.rankWith(1,b.isStringControl),$t=J.withJsonFormsControlProps(He),Je=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,uischema:i,schema:d,enabled:a,visible:u=!0})=>{var p;if(pe(u,t,r),u===!1)return null;const f=l.length===0,m=x=>{if(x===""){r(t,void 0);return}const g=Number(x);isNaN(g)||r(t,g)};return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&n.jsx(o.Text,{color:"red",children:"*"})]}),n.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:x=>m(x.target.value),disabled:!a,placeholder:(p=i.options)==null?void 0:p.placeholder,color:f?void 0:"red",id:t}),!f&&n.jsx(o.Text,{color:"red",size:"1",children:xe(l,s)}),d.description&&n.jsx(o.Text,{size:"1",color:"gray",children:d.description})]})})},Ke=b.rankWith(2,b.or(b.isNumberControl,b.isIntegerControl)),_t=J.withJsonFormsControlProps(Je),Ge=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,schema:i,enabled:d,visible:a=!0})=>{if(pe(a,t,r),a===!1)return null;const u=l.length===0;return n.jsxs(o.Box,{mb:"4",children:[n.jsxs(o.Flex,{gap:"2",align:"center",children:[n.jsx(o.Checkbox,{checked:!!e,onCheckedChange:f=>r(t,f===!0),disabled:!d,id:t}),n.jsxs(o.Text,{as:"label",size:"2",htmlFor:t,children:[s," ",c&&"*"]})]}),!u&&n.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:xe(l,s)}),i.description&&n.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:i.description})]})},Ye=b.rankWith(2,b.isBooleanControl),Wt=J.withJsonFormsControlProps(Ge),qe=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,schema:i,enabled:d,visible:a=!0})=>{if(pe(a,t,r),a===!1)return null;const u=l.length===0;let f=[];i.enum?f=i.enum.map(p=>({value:p,label:String(p)})):i.oneOf&&(f=i.oneOf.map(p=>({value:p.const,label:p.title||String(p.const)})));const m=e;return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"div",size:"2",weight:"bold",children:[s," ",c&&n.jsx(o.Text,{color:"red",children:"*"})]}),n.jsx(o.RadioGroup.Root,{value:m!==void 0?String(m):"",onValueChange:p=>{const x=f.find(g=>String(g.value)===p);x&&r(t,x.value)},disabled:!d,children:n.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:f.map(p=>n.jsxs(o.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[n.jsx(o.RadioGroup.Item,{value:String(p.value)}),n.jsx(o.Text,{size:"2",color:d?void 0:"gray",children:p.label})]},String(p.value)))})}),!u&&n.jsx(o.Text,{color:"red",size:"1",children:xe(l,s)}),i.description&&n.jsx(o.Text,{size:"1",color:"gray",children:i.description})]})})},Ze=(e,r,t)=>{var c;return b.or(b.isEnumControl,b.isOneOfControl)(e,r,t)&&((c=e==null?void 0:e.options)==null?void 0:c.format)==="radio"?3:-1},Vt=J.withJsonFormsControlProps(qe),Qe=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,schema:i,uischema:d,enabled:a,visible:u=!0})=>{var x;if(pe(u,t,r),u===!1)return null;const f=l.length===0;let m=[];i.enum?m=i.enum.map(g=>({value:String(g),label:String(g)})):i.oneOf&&(m=i.oneOf.map(g=>({value:String(g.const),label:g.title||String(g.const)})));const p=e!==void 0?String(e):"";return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&n.jsx(o.Text,{color:"red",children:"*"})]}),n.jsxs(o.Select.Root,{value:p,onValueChange:g=>r(t,g),disabled:!a,children:[n.jsx(o.Select.Trigger,{placeholder:((x=d.options)==null?void 0:x.placeholder)||"Select an option",color:f?void 0:"red",id:t}),n.jsx(o.Select.Content,{children:m.map(g=>n.jsx(o.Select.Item,{value:g.value,children:g.label},g.value))})]}),!f&&n.jsx(o.Text,{color:"red",size:"1",children:xe(l,s)}),i.description&&n.jsx(o.Text,{size:"1",color:"gray",children:i.description})]})})},et=b.rankWith(2,b.or(b.isEnumControl,b.isOneOfControl)),Ht=J.withJsonFormsControlProps(Qe),Xt={"small-list":{fetchOnOpen:!0,searchable:!1,paginated:!1},"large-searchable-list":{fetchOnOpen:!0,searchable:!0,paginated:!1},"large-paginated-list":{fetchOnOpen:!1,searchable:!0,paginated:!0}},Jt=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,enabled:i,visible:d=!0,schema:a,uischema:u})=>{var me;const f=(a==null?void 0:a["x-search"])??{service:""},m=f.service??"",p=f.mode??"large-paginated-list",x=Xt[p],g=(x==null?void 0:x.fetchOnOpen)??!1,F=f.params,E=Ve(m),T=a.type==="object",O=T?typeof e=="string"?{value:e}:e??void 0:void 0,L=T?O==null?void 0:O.value:e,N=O==null?void 0:O.label,v=m?E?x?null:`Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${m}" is not registered.`:"Search not configured.",U=i!==!1,P=!l||l.length===0,[S,R]=y.useState(!1),[B,W]=y.useState(""),[$,V]=y.useState([]),[Q,ee]=y.useState(!1),[se,ne]=y.useState(!1),[le,ue]=y.useState(!1),[H,h]=y.useState(null),[C,X]=y.useState(void 0),A=y.useRef(void 0),M=y.useRef(null),q=y.useRef(null),oe=y.useRef(null),G=y.useRef(void 0);y.useEffect(()=>{var ie,Z;if(!L){X(void 0),G.current=void 0;return}if(((ie=G.current)==null?void 0:ie.value)===L&&((Z=G.current)==null?void 0:Z.label)===N)return;if(G.current={value:L,label:N},T&&N){X({id:L,name:N});return}if(X({id:L,name:N??L}),!(E!=null&&E.resolve))return;let w=!1;return E.resolve(L,F).then(ae=>{!w&&ae&&X(ae)}).catch(()=>{}),()=>{w=!0}},[L,N,T,E,F]);const k=y.useCallback(async(w,ie=!1)=>{var ae;if(!E){h("Search service not configured.");return}(ae=q.current)==null||ae.abort();const Z=new AbortController;q.current=Z,ie?ue(!0):(ne(!0),ue(!1),h(null));try{const ye=await E.search({query:w,cursor:ie?A.current:void 0,signal:Z.signal,params:F}),ve=ye.options??[];V(ie?je=>[...je,...ve]:ve),A.current=ye.nextCursor,ee(((x==null?void 0:x.paginated)??!1)&&ye.nextCursor!=null)}catch{if(Z.signal.aborted)return;h("Failed to load results. Please try again.")}finally{Z.signal.aborted||(ie?ue(!1):ne(!1))}},[E,x==null?void 0:x.paginated,F]);if(y.useEffect(()=>{if(!S)return;const w=ie=>{oe.current&&!oe.current.contains(ie.target)&&R(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[S]),y.useEffect(()=>{var w;S||((w=q.current)==null||w.abort(),W(""),V([]),ee(!1),h(null),ne(!1),ue(!1),A.current=void 0)},[S]),y.useEffect(()=>{if(!S)return;if(!B&&!g){V([]),ee(!1),h(null),A.current=void 0;return}M.current&&clearTimeout(M.current);const w=B?300:0;return M.current=setTimeout(()=>{V([]),ee(!1),A.current=void 0,k(B)},w),()=>{M.current&&clearTimeout(M.current)}},[B,S,g,k]),pe(d,t,r,T?void 0:null),d===!1)return null;const j=()=>{W(""),V([]),ee(!1),h(null),A.current=void 0,R(!0)},D=w=>{r(t,T?{value:w.id,label:w.name}:w.id),X(w),G.current={value:w.id,label:T?w.name:void 0},R(!1)},ce=w=>{w.stopPropagation(),r(t,T?void 0:null),X(void 0)},_=w=>{(w.key==="Enter"||w.key===" ")&&ce(w)},z=((me=u==null?void 0:u.options)==null?void 0:me.placeholder)??"Select an option";return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&n.jsx(o.Text,{color:"red",children:"*"})]}),n.jsxs("div",{ref:oe,style:{position:"relative"},children:[n.jsx(o.TextField.Root,{id:t,value:S?B:(C==null?void 0:C.name)??"",placeholder:S&&(x!=null&&x.searchable)?"Search...":z,disabled:!U,readOnly:S&&!(x!=null&&x.searchable),style:P?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:w=>{x!=null&&x.searchable&&(W(w.target.value),S||j())},onFocus:()=>{U&&!S&&j()},onKeyDown:w=>{w.key==="Escape"&&R(!1)},children:n.jsx(o.TextField.Slot,{side:"right",children:n.jsxs(o.Flex,{align:"center",gap:"1",children:[L&&U&&n.jsx("span",{role:"button",tabIndex:0,onMouseDown:w=>w.preventDefault(),onClick:ce,onKeyDown:_,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),n.jsx(Y.ChevronDownIcon,{style:{transform:S?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),S&&n.jsx(o.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:v?n.jsx(o.Box,{p:"3",children:n.jsx(o.Text,{size:"2",color:"gray",children:v})}):n.jsx(o.ScrollArea,{style:{maxHeight:240},children:n.jsxs(o.Box,{p:"1",children:[se&&n.jsx(o.Flex,{justify:"center",p:"4",children:n.jsx(o.Spinner,{})}),!se&&H&&n.jsx(o.Box,{px:"3",py:"2",children:n.jsx(o.Text,{size:"2",color:"red",children:H})}),!se&&!H&&$.length===0&&n.jsx(o.Box,{px:"3",py:"2",children:n.jsx(o.Text,{size:"2",color:"gray",children:B||g?"No results found.":"Type to search…"})}),$.map(w=>n.jsx(o.Box,{px:"3",py:"2",onMouseDown:ie=>ie.preventDefault(),onClick:()=>D(w),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:w.id===L?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:n.jsx(o.Text,{size:"2",children:w.name})},w.id)),(x==null?void 0:x.paginated)&&Q&&!le&&n.jsx(o.Box,{px:"3",py:"2",children:n.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:w=>w.preventDefault(),onClick:()=>void k(B,!0),children:"Load more"})}),le&&n.jsx(o.Flex,{justify:"center",p:"2",children:n.jsx(o.Spinner,{})})]})})})]}),!P&&n.jsx(o.Text,{color:"red",size:"1",children:xe(l,s)}),a.description&&n.jsx(o.Text,{size:"1",color:"gray",children:a.description})]})})},tt=J.withJsonFormsControlProps(Jt),rt=b.rankWith(3,b.schemaMatches(e=>{const r=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(r==null?void 0:r.service)=="string"&&r.service!==""})),Kt=(e,r)=>Ut(`${e}T${r}`).format(),Gt=({path:e,label:r,required:t,errors:s,description:c,children:l})=>{const i=s.length===0;return n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[r," ",t&&n.jsx(o.Text,{color:"red",children:"*"})]}),l,!i&&n.jsx(o.Text,{color:"red",size:"1",children:xe(s,r)}),c&&n.jsx(o.Text,{size:"1",color:"gray",children:c})]})})},nt=({data:e,handleChange:r,path:t,label:s,required:c,errors:l,schema:i,enabled:d,visible:a=!0})=>{if(y.useEffect(()=>{a===!1&&r(t,void 0)},[a,t,r]),a===!1)return null;const u=l.length===0,f=typeof e=="string"?e:"",m=T=>n.jsx(Gt,{path:t,label:s,required:c,errors:l,description:i.description,children:T});if(i.format==="time")return m(n.jsx(o.TextField.Root,{type:"time",value:f,onChange:T=>r(t,T.target.value),disabled:!d,color:u?void 0:"red",id:t}));const p=i.format==="date-time",[x="",g=""]=f.split("T"),F=g.slice(0,5),E=(T,O)=>{if(!T){r(t,void 0);return}r(t,p?Kt(T,O||"00:00"):T)};return m(n.jsxs(o.Flex,{gap:"2",align:"center",children:[n.jsx(o.TextField.Root,{type:"date",value:x,disabled:!d,color:u?void 0:"red",onChange:T=>E(T.target.value,F),id:t,style:{flex:1}}),p&&n.jsx(o.TextField.Root,{type:"time",value:F,disabled:!d||!x,color:u?void 0:"red",onChange:T=>E(x,T.target.value),style:{flex:1}})]}))},ot=b.rankWith(2,b.or(b.isDateControl,b.isDateTimeControl,b.isTimeControl)),Yt=J.withJsonFormsControlProps(nt),st=({uischema:e,schema:r,path:t,renderers:s,cells:c,enabled:l,visible:i=!0})=>{const a=e.elements;return i===!1?null:n.jsx(o.Flex,{direction:"column",gap:"4",children:a.map((u,f)=>n.jsx(J.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:s,cells:c,enabled:l},`${t}-${f}`))})},lt=b.rankWith(1,b.uiTypeIs("VerticalLayout")),it=({uischema:e,schema:r,path:t,renderers:s,cells:c,enabled:l,visible:i=!0})=>{const a=e.elements;return i===!1?null:n.jsx(o.Flex,{direction:"row",gap:"4",children:a.map((u,f)=>n.jsx(o.Box,{style:{flex:1},children:n.jsx(J.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:s,cells:c,enabled:l})},`${t}-${f}`))})},at=b.rankWith(1,b.uiTypeIs("HorizontalLayout")),ct=({uischema:e,schema:r,path:t,renderers:s,cells:c,enabled:l,visible:i=!0})=>{const d=e,a=d.elements;return i===!1?null:n.jsxs(o.Box,{mb:"6",children:[d.label&&n.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:d.label}),n.jsx(o.Flex,{direction:"column",gap:"4",children:a.map((u,f)=>n.jsx(J.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:s,cells:c,enabled:l},`${t}-${f}`))})]})},ut=b.rankWith(1,b.uiTypeIs("Group")),dt=({uischema:e,schema:r,path:t,renderers:s,cells:c,enabled:l,visible:i=!0})=>{var p;const a=e.elements.filter(x=>x.type==="Category"),[u,f]=y.useState(((p=a[0])==null?void 0:p.label)||"");if(i===!1||!a.length)return null;const m=a.find(x=>x.label===u)?u:a[0].label;return n.jsxs(o.Tabs.Root,{value:m,onValueChange:f,children:[n.jsx(o.Tabs.List,{children:a.map((x,g)=>n.jsx(o.Tabs.Trigger,{value:x.label,children:x.label},`${t}-${g}`))}),n.jsx(o.Box,{pt:"3",children:a.map((x,g)=>n.jsx(o.Tabs.Content,{value:x.label,children:n.jsx(o.Flex,{direction:"column",gap:"4",children:x.elements.map((F,E)=>n.jsx(J.JsonFormsDispatch,{uischema:F,schema:r,path:t,renderers:s,cells:c,enabled:l},`${t}-${g}-${E}`))})},`${t}-${g}`))})]})},ft=b.rankWith(1,b.uiTypeIs("Categorization"));function fe(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function he(e){return e.split(",").map(r=>{if(r=r.trim(),r.endsWith("/*"))return r.split("/")[0].toUpperCase()+"S";if(r.startsWith("."))return r.slice(1).toUpperCase();const t=r.split("/")[1];return t?t.toUpperCase():r}).join(", ")}function qt(e){return e?Array.isArray(e)?e:[e]:[]}const Zt=({data:e,handleChange:r,path:t,label:s,required:c,uischema:l,schema:i,enabled:d,errors:a,visible:u=!0})=>{const f=_e();pe(u,t,r,null);const m=!a||a.length===0,p=(i==null?void 0:i["x-file"])??{},x=(l==null?void 0:l.options)??{},g=p.maxFiles??x.maxFiles??1,F=p.maxSize??x.maxSize??5*1024*1024,E=p.accept??x.accept??"image/*,application/pdf",T=g>1,O=d!==!1,[L,N]=y.useState(!1),[v,U]=y.useState(null),[P,S]=y.useState({}),R=y.useRef(new Set),B=y.useRef(null),W=qt(e),$=W.length>=g;y.useEffect(()=>()=>{R.current.forEach(h=>URL.revokeObjectURL(h)),R.current.clear()},[]);const V=y.useCallback(async h=>{if(U(null),W.length>=g){U(`Maximum ${g} file${g>1?"s":""} allowed.`);return}if(h.size>F){U(`File exceeds the ${fe(F)} limit.`);return}if(!E.split(",").map(A=>A.trim()).some(A=>A==="*"||A==="*/*"?!0:A.endsWith("/*")?h.type.startsWith(A.slice(0,-1)):A.startsWith(".")?h.name.toLowerCase().endsWith(A.toLowerCase()):h.type===A)){U(`Invalid type. Accepted: ${he(E)}`);return}if(!(f!=null&&f.onUpload)){U("Upload service not configured.");return}try{const A=await f.onUpload(h),M=URL.createObjectURL(h);R.current.add(M);const q={key:A.key,name:A.name??h.name,blobUrl:M};S(G=>({...G,[A.key]:q}));const oe=[...W,A.key];r(t,T?oe:oe[0])}catch{U("Upload failed. Please try again."),B.current&&(B.current.value="")}},[W,g,F,E,f,t,r,T]);if(u===!1)return null;const Q=h=>{h.preventDefault(),h.stopPropagation(),!(!O||$)&&N(h.type==="dragenter"||h.type==="dragover")},ee=h=>{var C;h.preventDefault(),h.stopPropagation(),N(!1),!(!O||$)&&(C=h.dataTransfer.files)!=null&&C[0]&&V(h.dataTransfer.files[0])},se=h=>{var C;(C=h.target.files)!=null&&C[0]&&(V(h.target.files[0]),h.target.value="")},ne=h=>{if(!O)return;S(X=>{var q;const A={...X},M=(q=A[h])==null?void 0:q.blobUrl;return M&&(URL.revokeObjectURL(M),R.current.delete(M)),delete A[h],A});const C=W.filter(X=>X!==h);r(t,T?C.length>0?C:null:C[0]??null)},le=async(h,C)=>{var M,q,oe;h.preventDefault();const X=(M=P[C])==null?void 0:M.blobUrl;if(X){(q=window.open(X,"_blank","noopener,noreferrer"))==null||q.focus();return}const A=window.open("","_blank");if(A)try{const G=await((oe=f==null?void 0:f.getDownloadUrl)==null?void 0:oe.call(f,C));G!=null&&G.url?A.location.href=G.url:A.close()}catch{A.close()}};if(!O&&W.length===0)return null;const ue=g-W.length,H=O&&!$;return n.jsxs(o.Box,{mb:"4",children:[n.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&n.jsx(o.Text,{color:"red",children:" *"})]}),n.jsx(o.Text,{size:"1",color:"gray",children:T?`Up to ${g} files · ${fe(F)} each · ${he(E)}`:`${fe(F)} · ${he(E)}`})]}),W.map(h=>{var C;return n.jsx(o.Card,{size:"2",variant:"surface",mb:"2",children:n.jsxs(o.Flex,{align:"center",gap:"3",children:[n.jsx(o.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:n.jsx(Y.FileTextIcon,{width:"20",height:"20"})}),n.jsx(o.Box,{style:{flex:1,overflow:"hidden"},children:n.jsx(o.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((C=P[h])==null?void 0:C.name)??"Uploaded File"})}),n.jsxs(o.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[n.jsx(o.Button,{variant:"soft",color:"blue",size:"1",onClick:X=>le(X,h),children:"View"}),n.jsx(Y.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),O&&n.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>ne(h),children:n.jsx(Y.Cross2Icon,{})})]})]})},h)}),H&&n.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var h;return(h=B.current)==null?void 0:h.click()},onKeyDown:h=>{var C;(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),(C=B.current)==null||C.click())},onDragEnter:Q,onDragLeave:Q,onDragOver:Q,onDrop:ee,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",L?"border-blue-500 bg-blue-50":v?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[n.jsx("input",{ref:B,type:"file",style:{display:"none"},accept:E,onChange:se}),n.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:v?n.jsxs(n.Fragment,{children:[n.jsx(Y.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:v}),n.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Y.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(o.Text,{size:"2",weight:"medium",children:W.length>0?`Add another file (${ue} remaining)`:"Click to upload or drag and drop"}),n.jsxs(o.Text,{size:"1",color:"gray",children:[fe(F)," max · ",he(E)]})]})})]}),O&&$&&T&&n.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",g," files uploaded. Remove one to replace it."]}),!m&&n.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(a,s)})]})},ht=J.withJsonFormsControlProps(Zt),pt=b.rankWith(10,b.and(b.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const r=e.items;return(r==null?void 0:r.type)==="string"&&(r==null?void 0:r.format)==="file"}return!1})));function xt(e,r){return e!==!1&&r!==!0}class Ae extends Error{}function Qt(e,r){const t=Ne.read(e,{type:"array",cellDates:!0});if(t.SheetNames.length===0)throw new Ae("This file has no sheets.");const s=r??t.SheetNames[0],c=t.Sheets[s];if(!c)throw new Ae(`This file doesn't have a sheet named "${s}".`);const l=Ne.utils.sheet_to_json(c,{header:1,raw:!0,defval:null});return{sheetName:s,matrix:l,rowCount:l.length,colCount:Math.max(0,...l.map(i=>i.length))}}function er(e){let r=e+1,t="";for(;r>0;){const s=(r-1)%26;t=String.fromCharCode(65+s)+t,r=Math.floor((r-1)/26)}return t}class re extends Error{constructor(t,s){super(s??t);Ie(this,"code");this.code=t,this.name="FormulaError"}}const tr=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],rr=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],nr=["YEAR","MONTH","DAY","WEEKDAY"],or=["IF"],sr=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],lr=new Set([...tr,...rr,...nr,...sr,...or]),ir=/"(?:[^"]|"")*"/g,De=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function ar(e){const r=e.replace(ir,s=>" ".repeat(s.length));De.lastIndex=0;let t;for(;(t=De.exec(r))!==null;){const s=t[1].toUpperCase();if(!lr.has(s))throw new re("NAME",`Function ${s} is not allowed.`)}}function cr(e,r,t){let s=e;if(s==null)throw t.NA;if(typeof s=="object"&&!(s instanceof t)&&(s=r.retrieveRef(s)),s instanceof t)throw s;if(typeof s=="boolean")return s;if(typeof s=="number")return s!==0;throw t.VALUE}function mt(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function Te(e){const r=mt(e);return Array.isArray(r)?r.flat(1/0):[r]}function I(e){const r=mt(e);return Array.isArray(r)?r.flat(1/0)[0]:r}function Ce(e){return e===void 0?void 0:I(e)}function te(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function ur(e,r){return e instanceof r?e:new r(e.message||"#ERROR!")}function K(e){return e.find(r=>r instanceof Error)}function dr(e,r){const t=l=>{throw ur(l,r)},s=(l,{checkArgsForErrors:i=!0}={})=>(...d)=>{const a=d.flatMap(Te);if(i){const f=K(a);f&&t(f)}const u=l(...a);return u instanceof Error?t(u):u},c=(l,{toText:i=!1}={})=>d=>{const a=I(d),u=K([a]);u&&t(u);const f=l(i?te(a):a);return f instanceof Error?t(f):f};return{IF:(l,i,d,a)=>{const u=cr(i,l,r);if(d==null)throw r.NA;return u?d:a??!1},MAX:s(e.MAX),MIN:s(e.MIN),MAXA:s(e.MAXA),MINA:s(e.MINA),MEDIAN:s(e.MEDIAN),COUNTA:s(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(l,i)=>{const d=Te(l),a=I(i),u=K([...d,a]);u&&t(u);const f=e.LARGE(d,a);return f instanceof Error?t(f):f},SMALL:(l,i)=>{const d=Te(l),a=I(i),u=K([...d,a]);u&&t(u);const f=e.SMALL(d,a);return f instanceof Error?t(f):f},PERMUT:(l,i)=>{const d=[I(l),I(i)],a=K(d);a&&t(a);const u=e.PERMUT(d[0],d[1]);return u instanceof Error?t(u):u},PERMUTATIONA:(l,i)=>{const d=[I(l),I(i)],a=K(d);a&&t(a);const u=e.PERMUTATIONA(d[0],d[1]);return u instanceof Error?t(u):u},MATCH:(l,i)=>{const d=I(l),a=Te(i),u=K([d,...a]);u&&t(u);const f=e.MATCH(d,a,0);return f instanceof Error?t(f):f},SWITCH:(...l)=>{const i=l.map(I),d=K(i);d&&t(d);const a=e.SWITCH(...i);return a instanceof Error?t(a):a},SUBSTITUTE:(l,i,d,a)=>{const u=[te(I(l)),te(I(i)),te(I(d))];a!==void 0&&u.push(I(a));const f=K(u);f&&t(f);const m=e.SUBSTITUTE(...u);return m instanceof Error?t(m):m},TEXTJOIN:(l,i,...d)=>{const a=te(I(l)),u=I(i),f=d.flatMap(Te).map(te),m=K([a,u]);m&&t(m);const p=e.TEXTJOIN(a,u,f);return p instanceof Error?t(p):p},UPPER:c(e.UPPER),YEAR:c(e.YEAR),MONTH:c(e.MONTH),DAY:c(e.DAY),WEEKDAY:(l,i)=>{const d=I(l),a=I(i),u=K([d]);u&&t(u);const f=e.WEEKDAY(d,a);return f instanceof Error?t(f):f},CONCATENATE:(...l)=>{const i=l.flatMap(Te),d=K(i);d&&t(d);const a=e.CONCATENATE(...i.map(te));return a instanceof Error?t(a):a},CONCAT:(...l)=>{const i=l.flatMap(Te),d=K(i);d&&t(d);const a=e.CONCAT(...i.map(te));return a instanceof Error?t(a):a},LEN:c(e.LEN,{toText:!0}),TRIM:c(e.TRIM,{toText:!0}),LOWER:c(e.LOWER,{toText:!0}),LEFT:(l,i)=>{const d=I(l),a=Ce(i),u=K([d]);u&&t(u);const f=e.LEFT(te(d),a);return f instanceof Error?t(f):f},RIGHT:(l,i)=>{const d=I(l),a=Ce(i),u=K([d]);u&&t(u);const f=e.RIGHT(te(d),a);return f instanceof Error?t(f):f},MID:(l,i,d)=>{const a=I(l),u=I(i),f=I(d),m=K([a,u,f]);m&&t(m);const p=e.MID(te(a),u,f);return p instanceof Error?t(p):p},FIND:(l,i,d)=>{const a=I(l),u=I(i),f=Ce(d),m=K([a,u]);m&&t(m);const p=e.FIND(te(a),te(u),f);return p instanceof Error?t(p):p},SEARCH:(l,i,d)=>{const a=I(l),u=I(i),f=Ce(d),m=K([a,u]);m&&t(m);const p=e.SEARCH(te(a),te(u),f);return p instanceof Error?t(p):p}}}const fr={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Le(e){return fr[e.error]??"ERROR"}function Me(e,r){if(e instanceof re)return e;if(e instanceof r){const t=e.details;return t instanceof re?t:t instanceof r?new re(Le(t),t.message):new re(Le(e),e.message)}return new re("ERROR",e instanceof Error?e.message:void 0)}function hr(e){return Math.max(0,...e.map(r=>(r==null?void 0:r.length)??0))}function pr(e){return r=>{const t=e[r.row-1];if(r.row<1||r.col<1||t==null||r.col-1>=t.length)throw new re("REF");const s=t[r.col-1];return s==null||s===""?null:s}}function xr(e){return r=>{const t=Math.min(r.from.row,r.to.row),s=Math.min(r.from.col,r.to.col),c=Math.max(r.from.row,r.to.row),l=Math.max(r.from.col,r.to.col),i=hr(e);if(t>e.length||s>i)throw new re("REF");const d=Math.min(c,e.length),a=[];for(let u=t;u<=d;u++){const f=e[u-1],m=[];if(f!=null){const p=Math.min(l,f.length);for(let x=s;x<=p;x++){const g=f[x-1];m.push(g==null||g===""?null:g)}}a.push(m)}return a}}function mr(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new re("VALUE")}async function gt(e,r){if(typeof e!="string")throw new re("ERROR");const t=e.trim();if(t==="")throw new re("ERROR");const s=t.startsWith("=")?t.slice(1):t;ar(s);const[c,l]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),i=c.default??c,d=i.FormulaError,a=new i({...r,functions:dr(l,d)});let u;try{u=a.parse(s,{row:1,col:1,sheet:"Sheet1"})}catch(f){throw Me(f,d)}if(u instanceof d)throw Me(u,d);return mr(u)}async function gr(e,r){return gt(r,{onCell:pr(e),onRange:xr(e)})}const ze=-1;async function yt(e,r){const t=Object.keys(e);return gt(r,{onVariable:s=>{const c=t.indexOf(s);return c===-1?null:{row:ze,col:c+1}},onCell:s=>{if(s.row===ze)return e[t[s.col-1]]??null;throw new re("REF")},onRange:()=>{throw new re("REF")}})}const Tt={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function ke(e){const r=e instanceof re?e.code:"ERROR";return Tt[r]}async function yr(e,r){return e.length===0?r.map(t=>({id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:Tt.ERROR})):Promise.all(r.map(async t=>{try{if(!t||typeof t.label!="string"||typeof t.expression!="string"||typeof t.id!="string")throw new re("ERROR");return{id:t.id,label:t.label,value:await gr(e,t.expression)}}catch(s){return{id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:ke(s)}}}))}function Tr(e,r={}){if(r.columnHeader&&r.rowHeader)throw new Error("x-spreadsheet: columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.");return r.columnHeader?br(e):r.rowHeader?vr(e):e}function bt(e){return e==null||e===""?null:e instanceof Date?e.toISOString():String(e)}function vt(e,r){const t=new Set;for(const s of e)if(s!=null){if(t.has(s))throw new Error(`x-spreadsheet: duplicate ${r} value "${s}" — every ${r==="columnHeader"?"column header":"column-A value"} must be unique to shape as records.`);t.add(s)}}function br(e){const[r,...t]=e;if(!r)return[];const s=r.map(bt);return vt(s,"columnHeader"),t.map(c=>{const l=Object.create(null);return s.forEach((i,d)=>{i!=null&&(l[i]=c[d]??null)}),l})}function vr(e){const r=e.map(c=>bt(c[0]));vt(r,"rowHeader");const t=Math.max(0,...e.map(c=>c.length)),s=Math.max(0,t-1);return Array.from({length:s},(c,l)=>{const i=l+1,d=Object.create(null);return r.forEach((a,u)=>{a!=null&&(d[a]=e[u][i]??null)}),d})}function jr(e){return!Array.isArray(e[0])}function wr(e){const r=Object.create(null);for(const{id:t,label:s,value:c,error:l}of e)r[t]=l===void 0?{label:s,value:c}:{label:s,value:c,error:l};return r}function Fe(e,r){const t=s=>s instanceof Date?s.toISOString():s??null;return t(e)===t(r)}function Cr(e,r){const t=e??{},s=r??{},c=Object.keys(t);return c.length!==Object.keys(s).length?!1:c.every(l=>{if(!Object.prototype.hasOwnProperty.call(s,l))return!1;const i=t[l],d=s[l];return i.label===d.label&&i.error===d.error&&Fe(i.value,d.value)})}function Er(e,r){if(e==null||r==null)return e===r;const t=Array.isArray(e);if(t!==Array.isArray(r))return!1;if(t){const i=e,d=r;return i.length===d.length&&i.every((a,u)=>Fe(a,d[u]))}const s=e,c=r,l=Object.keys(s);return l.length!==Object.keys(c).length?!1:l.every(i=>Object.prototype.hasOwnProperty.call(c,i)&&Fe(s[i],c[i]))}function Rr(e,r){if(e===r)return!0;if(e==null||r==null)return!1;const t=e,s=r;return t.length!==s.length?!1:t.every((c,l)=>Er(c,s[l]))}function Sr(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Date}function Ar(e){if(e.length===0)return[];const r=[],t=new Set;for(const c of e)for(const l of Object.keys(c))t.has(l)||(t.add(l),r.push(l));if(r.length===0)return[];const s=e.map(c=>r.map(l=>{if(!Object.prototype.hasOwnProperty.call(c,l))return null;const i=c[l];return Sr(i)?i:null}));return[r,...s]}function Fr(e){const r=Math.max(0,...e.map(t=>t.length));return Array.from({length:r},(t,s)=>e.map(c=>c[s]??null))}const Or=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",kr=10*1024*1024,Se=200,Ir=50,Nr=[];function Ee(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const Dr=({data:e,handleChange:r,path:t,label:s,required:c,schema:l,enabled:i,readonly:d,errors:a,visible:u=!0})=>{pe(u,t,r,null);const f=!a||a.length===0,m=xt(i,d),p=(l==null?void 0:l["x-spreadsheet"])??{},x=(l==null?void 0:l["x-evaluate"])??Nr,g=p.accept??Or,F=p.maxSize??kr,E=p.columnHeader===!0,T=p.rowHeader===!0,O=p.showSheet!==!1,L=p.sheetName,N=p.persistSheet!==!1,v=e??null,[U,P]=y.useState(()=>v!=null&&v.sheet||Object.keys((v==null?void 0:v.derivations)??{}).length>0?"ready":"empty"),[S,R]=y.useState(null),[B,W]=y.useState(!1),[$,V]=y.useState(null),[Q,ee]=y.useState(null),se=y.useRef(null),ne=y.useRef(null),le=(v==null?void 0:v.sheet)??null,ue=y.useCallback(j=>{if(!jr(j))return j;const D=Ar(j);return T?Fr(D):D},[T]),H=y.useMemo(()=>$??(le?ue(le):null),[$,le,ue]),h=((Q==null?void 0:Q.matrix)===H?Q.derivations:null)??(v==null?void 0:v.derivations)??{},C=H!=null||v!=null,X=y.useMemo(()=>{const j=E?1:0,D=T?1:0,ce=H?H.slice(j):[],_=ce.slice(0,Se),z=Math.min(Ir,Math.max(0,..._.map(Z=>Math.max(0,Z.length-D)))),me=Array.from({length:z},(Z,ae)=>ae+D),w="",ie=T&&!E;return n.jsx(n.Fragment,{children:H&&O&&n.jsxs(o.Box,{mt:"3",children:[n.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:n.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[!ie&&n.jsx(o.Table.Header,{children:n.jsxs(o.Table.Row,{children:[n.jsx(o.Table.ColumnHeaderCell,{children:w}),me.map(Z=>{var ae;return n.jsx(o.Table.ColumnHeaderCell,{children:E?Ee((ae=H[0])==null?void 0:ae[Z]):er(Z)},Z)})]})}),n.jsx(o.Table.Body,{children:_.map((Z,ae)=>{var ve;const ye=j+ae;return n.jsxs(o.Table.Row,{children:[n.jsx(o.Table.RowHeaderCell,{style:T?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:T?Ee((ve=H[ye])==null?void 0:ve[0]):E?"":ye+1}),me.map(je=>n.jsx(o.Table.Cell,{children:Ee(Z[je])},je))]},ae)})})]})}),ce.length>Se&&n.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",Se," of ",ce.length," rows"]})]})})},[H,O,E,T]),A=y.useCallback(async j=>{if(R(null),j.size>F){R(`File exceeds the ${fe(F)} limit.`);return}if(!g.split(",").map(z=>z.trim()).some(z=>z==="*"||z==="*/*"?!0:z.endsWith("/*")?j.type.startsWith(z.slice(0,-1)):z.startsWith(".")?j.name.toLowerCase().endsWith(z.toLowerCase()):j.type===z)){R(`Invalid type. Accepted: ${he(g)}`);return}P("parsing");let _;try{const z=await j.arrayBuffer();_=Qt(z,L).matrix}catch(z){P("error"),R(z instanceof Ae?z.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}ne.current=(e==null?void 0:e.sheet)??null,V(_),P("ready")},[g,F,L,e]);if(y.useEffect(()=>{$!=null&&le!=null&&le!==ne.current&&V(null)},[$,le]),y.useEffect(()=>{if(x.length===0&&!N)return;let j=!1;const D=_=>{m&&(Cr(v==null?void 0:v.derivations,_==null?void 0:_.derivations)&&Rr(v==null?void 0:v.sheet,_==null?void 0:_.sheet)||(ne.current=(_==null?void 0:_.sheet)??null,r(t,_)))},ce=H??[];if(ce.length===0){v!=null&&D(void 0);return}return yr(ce,x).then(_=>{if(j)return;let z;if($!=null){if(N)try{z=Tr(ce,{columnHeader:E,rowHeader:T})}catch(w){R(w instanceof Error?w.message:"Failed to process this sheet.");return}}else z=v==null?void 0:v.sheet;R(null);const me=wr(_);ee({matrix:ce,derivations:me}),D(z===void 0?{derivations:me}:{sheet:z,derivations:me})}),()=>{j=!0}},[H,$,x,m,N,E,T]),u===!1)return null;if(E&&T)return n.jsxs(o.Box,{mb:"4",children:[n.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:s}),n.jsx(o.Text,{size:"2",color:"red",style:{display:"block"},children:"Invalid x-spreadsheet config: columnHeader and rowHeader cannot both be true — pick one orientation."})]});if(!m&&!C)return null;const M=j=>{j.preventDefault(),j.stopPropagation(),m&&W(j.type==="dragenter"||j.type==="dragover")},q=j=>{var D;j.preventDefault(),j.stopPropagation(),W(!1),m&&(D=j.dataTransfer.files)!=null&&D[0]&&A(j.dataTransfer.files[0])},oe=j=>{var D;(D=j.target.files)!=null&&D[0]&&(A(j.target.files[0]),j.target.value="")},G=()=>{m&&(V(null),ee(null),ne.current=null,R(null),P("empty"),r(t,null))},k=O&&H==null&&v!=null;return n.jsxs(o.Box,{mb:"4",children:[n.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(o.Flex,{align:"center",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&n.jsx(o.Text,{color:"red",children:" *"})]}),C&&m&&n.jsxs(n.Fragment,{children:[n.jsx(o.Tooltip,{content:"Replace spreadsheet",children:n.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var j;return(j=se.current)==null?void 0:j.click()},"aria-label":"Replace spreadsheet",children:n.jsx(Y.UploadIcon,{})})}),n.jsx(o.Tooltip,{content:"Remove spreadsheet",children:n.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:G,"aria-label":"Remove spreadsheet",children:n.jsx(Y.Cross2Icon,{})})})]})]}),n.jsxs(o.Text,{size:"1",color:"gray",children:[fe(F)," max · ",he(g)]})]}),C&&S&&n.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:S}),n.jsx("input",{ref:se,type:"file",style:{display:"none"},accept:g,onChange:oe}),m&&!C&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var j;return(j=se.current)==null?void 0:j.click()},onKeyDown:j=>{var D;(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),(D=se.current)==null||D.click())},onDragEnter:M,onDragLeave:M,onDragOver:M,onDrop:q,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",B?"border-blue-500 bg-blue-50":S?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:U==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(o.Spinner,{size:"3"}),n.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):S?n.jsxs(n.Fragment,{children:[n.jsx(Y.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:S}),n.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Y.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(o.Text,{size:"1",color:"gray",children:[fe(F)," max · ",he(g)]})]})})}),X,k&&n.jsx(o.Text,{size:"2",color:"gray",mt:"3",style:{display:"block"},children:"Sheet preview not stored for this field — re-upload to view contents."}),Object.keys(h).length>0&&n.jsxs(o.Box,{mt:"3",children:[n.jsx(o.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),n.jsx(o.Flex,{direction:"column",gap:"1",children:Object.entries(h).map(([j,D])=>n.jsxs(o.Flex,{justify:"between",children:[n.jsx(o.Text,{size:"2",children:D.label}),D.error?n.jsx(o.Text,{size:"2",color:"red",children:D.error}):n.jsx(o.Text,{size:"2",children:Ee(D.value)})]},j))})]}),!f&&n.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(a,s)})]})},jt=J.withJsonFormsControlProps(Dr),wt=b.rankWith(10,b.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object"));class ge extends Error{}const Ue=5e6,Lr=1024,Mr=/^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i,zr={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!0,parseAttributeValue:!0,numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!0},trimValues:!0,cdataPropName:!1,commentPropName:!1,processEntities:!0,htmlEntities:!0,ignoreDeclaration:!0,ignorePiTags:!0,alwaysCreateTextNode:!1,preserveOrder:!1,removeNSPrefix:!1,maxNestedTags:100,strictReservedNames:!0};function Ur(e){const r=new Set(e);return r.size===0?()=>!1:(t,s)=>r.has(typeof s=="string"?s:s.toString())||r.has(t)}function Pr(e){const r=e instanceof Error?e.message:"";return r.startsWith("[SECURITY] Invalid name:")?"This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely.":r==="External entities are not supported"||r==="Parameter entities are not supported"?`${r}. Please remove the DOCTYPE entity declarations and try again.`:r.startsWith("Maximum nested tags exceeded")?"This document is nested too deeply to parse.":r.startsWith("Entity count")||r.includes("exceeds maximum allowed")?"This document declares too many or too large entity definitions to expand safely.":"This doesn't look like a valid XML document. Please check the file and try again."}async function Br(e,r={}){var u;if(typeof e!="string")throw new ge("This file could not be read as text.");const t=e.charCodeAt(0)===65279?e.slice(1):e;if(t.trim()==="")throw new ge("This file is empty.");if(t.length>Ue)throw new ge(`This document is too large to parse (over ${Ue/1e6} million characters).`);const s=(u=Mr.exec(t.slice(0,Lr)))==null?void 0:u[1];if(s&&!/^utf-?8$/i.test(s))throw new ge(`This document declares the unsupported encoding "${s}". Only UTF-8 is supported.`);const{XMLParser:c,XMLValidator:l}=await import("fast-xml-parser"),i=l.validate(t,{allowBooleanAttributes:!1});if(i!==!0){const{msg:f,line:m,col:p}=i.err;throw new ge(`Invalid XML at line ${m}, column ${p}: ${f}`)}const d=new c({...zr,removeNSPrefix:r.removeNamespaces===!0,isArray:Ur(r.arrayPaths??[])});let a;try{a=d.parse(t)}catch(f){throw new ge(Pr(f))}if(a==null||typeof a!="object"||Array.isArray(a))throw new ge("This document has no root element.");return a}const be={found:!1},de=e=>({found:!0,value:e});function Pe(e){return e==null||e===""?be:Array.isArray(e)||e instanceof Date?de(e):typeof e=="object"?be:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?de(e):be}const $r=new Set(["true","1","yes","y"]),_r=new Set(["false","0","no","n"]);async function Wr(e,r){switch(r.as){case void 0:return de(e);case"string":return de(e instanceof Date?e.toISOString():String(e));case"number":{const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?de(t):be}case"boolean":{const t=String(e).trim().toLowerCase();return $r.has(t)?de(!0):_r.has(t)?de(!1):be}case"date":{const{default:t}=await import("dayjs"),{default:s}=await Promise.resolve().then(()=>require("./customParseFormat-CLvZwox5.cjs")).then(i=>i.customParseFormat);t.extend(s);const c=e instanceof Date?e.toISOString():String(e),l=r.format?t(c,r.format,!0):t(c);return l.isValid()?de(l.format("YYYY-MM-DD")):be}}}async function Vr(e,r){if(r.formula!==void 0){const t={};for(const[s,c]of Object.entries(r.inputs??{})){const l=Pe(b.Resolve.data(e,c));if(!l.found||Array.isArray(l.value))return be;t[s]=l.value}try{return de(await yt(t,r.formula))}catch(s){throw new Error(`x-xml.writeTo "${r.to}": ${ke(s)}`)}}if(r.from===void 0)throw new Error(`x-xml.writeTo "${r.to}" needs either "from" or "formula".`);return Pe(b.Resolve.data(e,r.from))}async function Hr(e,r){const t=[];for(const s of r){let c=await Vr(e,s);const l=c.found&&Array.isArray(c.value);if(c.found&&!l&&s.map){const i=c.value instanceof Date?c.value.toISOString():String(c.value);Object.prototype.hasOwnProperty.call(s.map,i)&&(c=de(s.map[i]))}if(c.found&&!l&&(c=await Wr(c.value,s)),!c.found){if(s.default===void 0)continue;t.push({to:s.to,value:s.default});continue}t.push({to:s.to,value:c.value})}return t}const Xr=".xml,text/xml,application/xml",Jr=5*1024*1024,Kr=({data:e,handleChange:r,path:t,label:s,required:c,schema:l,enabled:i,readonly:d,errors:a,visible:u=!0})=>{pe(u,t,r);const f=!a||a.length===0,m=xt(i,d),p=(l==null?void 0:l["x-xml"])??{},x=p.accept??Xr,g=p.maxSize??Jr,F=p.arrayPaths,E=p.removeNamespaces===!0,T=p.writeTo,O=p.writeBase??"root",L=p.persistDocument!==!1,N=J.useJsonForms(),v=e??null,[U,P]=y.useState(()=>v?"ready":"empty"),[S,R]=y.useState(null),[B,W]=y.useState(!1),$=y.useRef(null),V=y.useRef(0),Q=v!=null,ee=T!==void 0&&T.length>0,se=y.useCallback(async h=>{var G;const C=++V.current;if(R(null),h.size>g){R(`File exceeds the ${fe(g)} limit.`);return}if(!x.split(",").map(k=>k.trim()).some(k=>k==="*"||k==="*/*"?!0:k.endsWith("/*")?h.type.startsWith(k.slice(0,-1)):k.startsWith(".")?h.name.toLowerCase().endsWith(k.toLowerCase()):h.type===k)){R(`Invalid type. Accepted: ${he(x)}`);return}P("parsing");let M;try{const k=await h.text();M=await Br(k,{arrayPaths:F,removeNamespaces:E})}catch(k){if(C!==V.current)return;P("error"),R(k instanceof ge?k.message:"This doesn't look like a valid XML document. Please check the file and try again.");return}let q=[];if(T&&T.length>0)try{q=await Hr(M,T)}catch(k){if(C!==V.current)return;P("error"),R(k instanceof Error?k.message:"This document could not be mapped onto the form.");return}if(C!==V.current)return;L&&r(t,M);const oe=O==="parent"?t.split(".").slice(0,-1).join("."):"";for(const k of q)(G=N.dispatch)==null||G.call(N,b.update(oe?`${oe}.${k.to}`:k.to,()=>k.value));P("ready")},[x,g,F,E,T,O,L,t,r,N]);if(u===!1||!m&&!Q)return null;const ne=h=>{h.preventDefault(),h.stopPropagation(),m&&W(h.type==="dragenter"||h.type==="dragover")},le=h=>{var C;h.preventDefault(),h.stopPropagation(),W(!1),m&&(C=h.dataTransfer.files)!=null&&C[0]&&se(h.dataTransfer.files[0])},ue=h=>{var C;(C=h.target.files)!=null&&C[0]&&(se(h.target.files[0]),h.target.value="")},H=()=>{m&&(++V.current,R(null),P("empty"),r(t,void 0))};return n.jsxs(o.Box,{mb:"4",children:[n.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(o.Flex,{align:"center",gap:"1",children:[n.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&n.jsx(o.Text,{color:"red",children:" *"})]}),!ee&&Q&&m&&n.jsxs(n.Fragment,{children:[n.jsx(o.Tooltip,{content:"Replace document",children:n.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var h;return(h=$.current)==null?void 0:h.click()},"aria-label":"Replace document",children:n.jsx(Y.UploadIcon,{})})}),n.jsx(o.Tooltip,{content:"Remove document",children:n.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:H,"aria-label":"Remove document",children:n.jsx(Y.Cross2Icon,{})})})]})]}),n.jsxs(o.Flex,{align:"center",gap:"2",children:[n.jsxs(o.Text,{size:"1",color:"gray",children:[fe(g)," max · ",he(x)]}),ee&&m&&n.jsxs(o.Button,{size:"1",variant:"soft",onClick:()=>{var h;return(h=$.current)==null?void 0:h.click()},disabled:U==="parsing",children:[U==="parsing"?n.jsx(o.Spinner,{size:"1"}):n.jsx(Y.UploadIcon,{}),"Upload"]})]})]}),(ee||Q)&&S&&n.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:S}),n.jsx("input",{ref:$,type:"file",style:{display:"none"},accept:x,onChange:ue}),!ee&&m&&!Q&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var h;return(h=$.current)==null?void 0:h.click()},onKeyDown:h=>{var C;(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),(C=$.current)==null||C.click())},onDragEnter:ne,onDragLeave:ne,onDragOver:ne,onDrop:le,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",B?"border-blue-500 bg-blue-50":S?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:U==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(o.Spinner,{size:"3"}),n.jsx(o.Text,{size:"2",color:"gray",children:"Parsing document…"})]}):S?n.jsxs(n.Fragment,{children:[n.jsx(Y.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:S}),n.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Y.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(o.Text,{size:"1",color:"gray",children:[fe(g)," max · ",he(x)]})]})})}),!f&&n.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(a,s)})]})},Ct=J.withJsonFormsControlProps(Kr),Et=b.rankWith(10,b.schemaMatches(e=>{const r=e["x-xml"];return e.type==="object"&&typeof r=="object"&&r!==null}));function Gr(e,r,t){const s={};for(const[c,l]of Object.entries(t)){const{path:i,default:d}=typeof l=="string"?{path:l,default:void 0}:l,a=r?`${r}.${i}`:i,u=b.Resolve.data(e,a);if(u==null){if(d===void 0)return;s[c]=d}else s[c]=u}return s}async function Yr(e,r){try{return{status:"ok",value:await yt(e,r)}}catch(t){return{status:"error",error:ke(t)}}}function qr(e,r){return e==null?"":typeof e=="number"?e.toFixed(Zr(r)):e instanceof Date?e.toLocaleDateString():String(e)}function Zr(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Be="{value}",Qr=2,en={},tn=({data:e,handleChange:r,path:t,label:s,schema:c,visible:l=!0})=>{var U;pe(l,t,r,null);const i=c==null?void 0:c["x-computed"],d=(i==null?void 0:i.inputs)??en,a=(i==null?void 0:i.formula)??"",u=(i==null?void 0:i.format)??Be,f=(i==null?void 0:i.decimals)??Qr,m=J.useJsonForms(),p=t.split(".").slice(0,-1).join("."),x=Gr((U=m.core)==null?void 0:U.data,p,d),g=x?JSON.stringify(x):null,F=m.readonly===!0,[E,T]=y.useState(()=>typeof e=="number"?"ok":"unavailable"),[O,L]=y.useState(()=>typeof e=="number"?e:null),[N,v]=y.useState(null);return y.useEffect(()=>{if(!l)return;let P=!1;const S=R=>{F||R!==(e??null)&&r(t,R)};if(x===void 0){T("unavailable"),v(null),L(null),S(null);return}return T(R=>R==="ok"?R:"loading"),Yr(x,a).then(R=>{if(P)return;const B=R.status==="ok"&&typeof R.value=="number"&&Number.isFinite(R.value)?R.value:null;if(B===null){T("error"),v(R.status==="error"?R.error??"Unable to compute value.":"Computed value must be a number."),L(null),S(null);return}T("ok"),v(null),L(B),S(B)}),()=>{P=!0}},[g,a,l,F]),l===!1?null:n.jsx(o.Box,{mb:"4",children:n.jsxs(o.Flex,{direction:"column",gap:"1",children:[n.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:s}),E==="unavailable"?n.jsx(o.Text,{size:"2",color:"gray",children:"Not yet available."}):E==="loading"?n.jsxs(o.Flex,{align:"center",gap:"2",children:[n.jsx(o.Spinner,{size:"1"}),n.jsx(o.Text,{size:"2",color:"gray",children:"Computing…"})]}):E==="error"?n.jsx(o.Text,{size:"2",color:"red",children:N}):n.jsx(o.Text,{size:"2",children:u.split(Be).join(qr(O,f))}),c.description&&n.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},Rt=J.withJsonFormsControlProps(tn),St=b.rankWith(5,b.schemaMatches(e=>{const r=e["x-computed"];return e.type==="number"&&typeof r=="object"&&r!==null})),rn=({data:e,path:r,schema:t,uischema:s,enabled:c,visible:l,addItem:i,removeItems:d,rootSchema:a,arraySchema:u})=>{const f=u?t:t.items,m=u||t;if(l===!1||!f||typeof f!="object"||Array.isArray(f))return null;const p=f,x=Array.isArray(e)?e:[],g=m.title||"Array Items",F=s.options??{},E=c&&F.addable!==!1,T=c&&F.removable!==!1,O=()=>{const N=b.createDefaultValue(p,a);i&&i(r,N)()},L=N=>{if(d){const v=d(r,[N]);v&&v()}};return n.jsx(o.Box,{mb:"6",children:n.jsxs(o.Flex,{direction:"column",gap:"4",children:[n.jsx(o.Text,{as:"div",size:"4",weight:"bold",children:g}),x.length===0&&n.jsx(o.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:n.jsx(o.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),x.map((N,v)=>{var P;const U=`${r}.${v}`;return n.jsx(o.Card,{size:"3",variant:"surface",children:n.jsxs(o.Flex,{direction:"column",gap:"4",children:[n.jsxs(o.Flex,{justify:"between",align:"center",children:[n.jsxs(o.Text,{size:"3",weight:"bold",children:["Item ",v+1]}),T&&n.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>L(v),title:"Remove item",children:[n.jsx(Y.TrashIcon,{}),"Remove"]})]}),n.jsx(o.Box,{children:n.jsx(J.JsonFormsDispatch,{schema:p,uischema:((P=s.options)==null?void 0:P.detail)||(p.type==="object"||p.properties?{type:"VerticalLayout",elements:Object.keys(p.properties||{}).map(S=>({type:"Control",scope:`#/properties/${S}`}))}:{type:"Control",scope:"#"}),path:U,enabled:c,renderers:void 0,cells:void 0})})]})},U)}),E&&n.jsx(o.Box,{mt:"2",children:n.jsxs(o.Button,{type:"button",variant:"surface",onClick:O,children:[n.jsx(Y.PlusIcon,{}),"Add Item"]})})]})})},Oe=J.withJsonFormsArrayControlProps(rn),At=b.rankWith(3,b.isObjectArrayControl),Ft=({uischema:e,visible:r})=>{const t=e;return r===!1?null:n.jsx(o.Box,{mb:"4",children:n.jsx(o.Heading,{size:"4",children:t.text})})},Ot=b.rankWith(1,b.uiTypeIs("Label")),nn=b.rankWith(3,b.isPrimitiveArrayControl),on=[{tester:Xe,renderer:$t},{tester:Ke,renderer:_t},{tester:Ye,renderer:Wt},{tester:Ze,renderer:Vt},{tester:rt,renderer:tt},{tester:et,renderer:Ht},{tester:ot,renderer:Yt},{tester:lt,renderer:st},{tester:at,renderer:it},{tester:ut,renderer:ct},{tester:ft,renderer:dt},{tester:pt,renderer:ht},{tester:wt,renderer:jt},{tester:Et,renderer:Ct},{tester:St,renderer:Rt},{tester:At,renderer:Oe},{tester:nn,renderer:Oe},{tester:Ot,renderer:Ft}];exports.ArrayControl=Oe;exports.ArrayControlTester=At;exports.BooleanControl=Ge;exports.BooleanControlTester=Ye;exports.CategorizationLayoutRenderer=dt;exports.CategorizationLayoutTester=ft;exports.ComputedControl=Rt;exports.ComputedControlTester=St;exports.DateControl=nt;exports.DateControlTester=ot;exports.FileControl=ht;exports.FileControlTester=pt;exports.GroupLayoutRenderer=ct;exports.GroupLayoutTester=ut;exports.HorizontalLayoutRenderer=it;exports.HorizontalLayoutTester=at;exports.LabelRenderer=Ft;exports.LabelTester=Ot;exports.NumberControl=Je;exports.NumberControlTester=Ke;exports.RadioControl=qe;exports.RadioControlTester=Ze;exports.SearchSelectControl=tt;exports.SearchSelectControlTester=rt;exports.SearchServiceProvider=Bt;exports.SelectControl=Qe;exports.SelectControlTester=et;exports.SpreadsheetControl=jt;exports.SpreadsheetControlTester=wt;exports.TextControl=He;exports.TextControlTester=Xe;exports.UploadProvider=Pt;exports.VerticalLayoutRenderer=st;exports.VerticalLayoutTester=lt;exports.XmlControl=Ct;exports.XmlControlTester=Et;exports.radixRenderers=on;exports.useSearchService=Ve;exports.useUpload=_e;
|