@opennsw/jsonforms-renderers 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +1250 -647
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ export declare const SelectControl: ({ data, handleChange, path, label, required
|
|
|
103
103
|
|
|
104
104
|
export declare const SelectControlTester: RankedTester;
|
|
105
105
|
|
|
106
|
+
export declare const SpreadsheetControl: ComponentType<OwnPropsOfControl>;
|
|
107
|
+
|
|
108
|
+
export declare const SpreadsheetControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
109
|
+
|
|
106
110
|
export declare const TextControl: ({ data, handleChange, path, label, required, errors, uischema, schema, enabled, visible, }: ControlProps) => JSX.Element | null;
|
|
107
111
|
|
|
108
112
|
export declare const TextControlTester: RankedTester;
|
|
@@ -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}.relative{position:relative}.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}.flex{display:flex}.hidden{display:none}.inline{display:inline}.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)}.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,)}.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{.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}.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,)}.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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`).map(
|
|
3
|
-
`):"",fe=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,uischema:c,schema:y,enabled:d,visible:h=!0})=>{var T;if(_(h,o,t),h===!1)return null;const l=p.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{value:n||"",onChange:f=>t(o,f.target.value),disabled:!d,placeholder:(T=c.options)==null?void 0:T.placeholder,color:l?void 0:"red",id:o}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),y.description&&e.jsx(r.Text,{size:"1",color:"gray",children:y.description})]})})},pe=x.rankWith(1,x.isStringControl),He=k.withJsonFormsControlProps(fe),he=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,uischema:c,schema:y,enabled:d,visible:h=!0})=>{var f;if(_(h,o,t),h===!1)return null;const l=p.length===0,T=s=>{if(s===""){t(o,void 0);return}const u=Number(s);isNaN(u)||t(o,u)};return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.TextField.Root,{type:"number",value:n??"",onChange:s=>T(s.target.value),disabled:!d,placeholder:(f=c.options)==null?void 0:f.placeholder,color:l?void 0:"red",id:o}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),y.description&&e.jsx(r.Text,{size:"1",color:"gray",children:y.description})]})})},ge=x.rankWith(2,x.or(x.isNumberControl,x.isIntegerControl)),qe=k.withJsonFormsControlProps(he),je=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(_(d,o,t),d===!1)return null;const h=p.length===0;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.Checkbox,{checked:!!n,onCheckedChange:l=>t(o,l===!0),disabled:!y,id:o}),e.jsxs(r.Text,{as:"label",size:"2",htmlFor:o,children:[a," ",j&&"*"]})]}),!h&&e.jsx(r.Text,{color:"red",size:"1",className:"block mt-1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",className:"block mt-1",children:c.description})]})},me=x.rankWith(2,x.isBooleanControl),Ge=k.withJsonFormsControlProps(je),ye=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(_(d,o,t),d===!1)return null;const h=p.length===0;let l=[];c.enum?l=c.enum.map(f=>({value:f,label:String(f)})):c.oneOf&&(l=c.oneOf.map(f=>({value:f.const,label:f.title||String(f.const)})));const T=n;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"div",size:"2",weight:"bold",children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsx(r.RadioGroup.Root,{value:T!==void 0?String(T):"",onValueChange:f=>{const s=l.find(u=>String(u.value)===f);s&&t(o,s.value)},disabled:!y,children:e.jsx(r.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:l.map(f=>e.jsxs(r.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[e.jsx(r.RadioGroup.Item,{value:String(f.value)}),e.jsx(r.Text,{size:"2",color:y?void 0:"gray",children:f.label})]},String(f.value)))})}),!h&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},ve=(n,t,o)=>{var j;return x.or(x.isEnumControl,x.isOneOfControl)(n,t,o)&&((j=n==null?void 0:n.options)==null?void 0:j.format)==="radio"?3:-1},Ke=k.withJsonFormsControlProps(ye),be=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,uischema:y,enabled:d,visible:h=!0})=>{var s;if(_(h,o,t),h===!1)return null;const l=p.length===0;let T=[];c.enum?T=c.enum.map(u=>({value:String(u),label:String(u)})):c.oneOf&&(T=c.oneOf.map(u=>({value:String(u.const),label:u.title||String(u.const)})));const f=n!==void 0?String(n):"";return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs(r.Select.Root,{value:f,onValueChange:u=>t(o,u),disabled:!d,children:[e.jsx(r.Select.Trigger,{placeholder:((s=y.options)==null?void 0:s.placeholder)||"Select an option",color:l?void 0:"red",id:o}),e.jsx(r.Select.Content,{children:T.map(u=>e.jsx(r.Select.Item,{value:u.value,children:u.label},u.value))})]}),!l&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),c.description&&e.jsx(r.Text,{size:"1",color:"gray",children:c.description})]})})},Te=x.rankWith(2,x.or(x.isEnumControl,x.isOneOfControl)),_e=k.withJsonFormsControlProps(be),Ze={"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}},Qe=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,enabled:c,visible:y=!0,schema:d,uischema:h})=>{var le;const l=(d==null?void 0:d["x-search"])??{service:""},T=l.service??"",f=l.mode??"large-paginated-list",s=Ze[f],u=(s==null?void 0:s.fetchOnOpen)??!1,C=xe(T),z=T?C?s?null:`Invalid x-search.mode "${f}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${T}" is not registered.`:"Search not configured.",b=c!==!1,w=!p||p.length===0,[F,I]=m.useState(!1),[$,E]=m.useState(""),[Q,A]=m.useState([]),[Z,L]=m.useState(!1),[B,P]=m.useState(!1),[X,W]=m.useState(!1),[Y,V]=m.useState(null),[ee,G]=m.useState(void 0),N=m.useRef(void 0),K=m.useRef(null),i=m.useRef(null),S=m.useRef(null),R=m.useRef(void 0);m.useEffect(()=>{if(!n){G(void 0),R.current=void 0;return}if(R.current===n||(R.current=n,G({id:n,name:n}),!(C!=null&&C.resolve)))return;let g=!1;return C.resolve(n).then(O=>{!g&&O&&G(O)}).catch(()=>{}),()=>{g=!0}},[n,C]);const v=m.useCallback(async(g,O=!1)=>{var ie;if(!C){V("Search service not configured.");return}(ie=i.current)==null||ie.abort();const re=new AbortController;i.current=re,O?W(!0):(P(!0),W(!1),V(null));try{const te=await C.search({query:g,cursor:O?N.current:void 0,signal:re.signal}),ce=te.options??[];A(O?Ve=>[...Ve,...ce]:ce),N.current=te.nextCursor,L(((s==null?void 0:s.paginated)??!1)&&te.nextCursor!=null)}catch{if(re.signal.aborted)return;V("Failed to load results. Please try again.")}finally{re.signal.aborted||(O?W(!1):P(!1))}},[C,s==null?void 0:s.paginated]);if(m.useEffect(()=>{if(!F)return;const g=O=>{S.current&&!S.current.contains(O.target)&&I(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[F]),m.useEffect(()=>{var g;F||((g=i.current)==null||g.abort(),E(""),A([]),L(!1),V(null),P(!1),W(!1),N.current=void 0)},[F]),m.useEffect(()=>{if(!F)return;if(!$&&!u){A([]),L(!1),V(null),N.current=void 0;return}K.current&&clearTimeout(K.current);const g=$?300:0;return K.current=setTimeout(()=>{A([]),L(!1),N.current=void 0,v($)},g),()=>{K.current&&clearTimeout(K.current)}},[$,F,u,v]),_(y,o,t,null),y===!1)return null;const D=()=>{E(""),A([]),L(!1),V(null),N.current=void 0,I(!0)},U=g=>{t(o,g.id),G(g),R.current=g.id,I(!1)},J=g=>{g.stopPropagation(),t(o,null),G(void 0)},M=g=>{(g.key==="Enter"||g.key===" ")&&J(g)},We=((le=h==null?void 0:h.options)==null?void 0:le.placeholder)??"Select an option";return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:o,children:[a," ",j&&e.jsx(r.Text,{color:"red",children:"*"})]}),e.jsxs("div",{ref:S,style:{position:"relative"},children:[e.jsx(r.TextField.Root,{id:o,value:F?$:(ee==null?void 0:ee.name)??"",placeholder:F&&(s!=null&&s.searchable)?"Search...":We,disabled:!b,readOnly:F&&!(s!=null&&s.searchable),style:w?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:g=>{s!=null&&s.searchable&&(E(g.target.value),F||D())},onFocus:()=>{b&&!F&&D()},onKeyDown:g=>{g.key==="Escape"&&I(!1)},children:e.jsx(r.TextField.Slot,{side:"right",children:e.jsxs(r.Flex,{align:"center",gap:"1",children:[n&&b&&e.jsx("span",{role:"button",tabIndex:0,onMouseDown:g=>g.preventDefault(),onClick:J,onKeyDown:M,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),e.jsx(H.ChevronDownIcon,{style:{transform:F?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),F&&e.jsx(r.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:z?e.jsx(r.Box,{p:"3",children:e.jsx(r.Text,{size:"2",color:"gray",children:z})}):e.jsx(r.ScrollArea,{style:{maxHeight:240},children:e.jsxs(r.Box,{p:"1",children:[B&&e.jsx(r.Flex,{justify:"center",p:"4",children:e.jsx(r.Spinner,{})}),!B&&Y&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Text,{size:"2",color:"red",children:Y})}),!B&&!Y&&Q.length===0&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Text,{size:"2",color:"gray",children:$||u?"No results found.":"Type to search…"})}),Q.map(g=>e.jsx(r.Box,{px:"3",py:"2",onMouseDown:O=>O.preventDefault(),onClick:()=>U(g),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:g.id===n?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:e.jsx(r.Text,{size:"2",children:g.name})},g.id)),(s==null?void 0:s.paginated)&&Z&&!X&&e.jsx(r.Box,{px:"3",py:"2",children:e.jsx(r.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:g=>g.preventDefault(),onClick:()=>void v($,!0),children:"Load more"})}),X&&e.jsx(r.Flex,{justify:"center",p:"2",children:e.jsx(r.Spinner,{})})]})})})]}),!w&&e.jsx(r.Text,{color:"red",size:"1",children:q(p,a)}),d.description&&e.jsx(r.Text,{size:"1",color:"gray",children:d.description})]})})},Ce=k.withJsonFormsControlProps(Qe),Se=x.rankWith(3,x.schemaMatches(n=>{const t=n["x-search"];return n.type==="string"&&typeof(t==null?void 0:t.service)=="string"&&t.service!==""})),Xe=(n,t)=>Ne(`${n}T${t}`).format(),Ye=({path:n,label:t,required:o,errors:a,description:j,children:p})=>{const c=a.length===0;return e.jsx(r.Box,{mb:"4",children:e.jsxs(r.Flex,{direction:"column",gap:"1",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",htmlFor:n,children:[t," ",o&&e.jsx(r.Text,{color:"red",children:"*"})]}),p,!c&&e.jsx(r.Text,{color:"red",size:"1",children:q(a,t)}),j&&e.jsx(r.Text,{size:"1",color:"gray",children:j})]})})},we=({data:n,handleChange:t,path:o,label:a,required:j,errors:p,schema:c,enabled:y,visible:d=!0})=>{if(m.useEffect(()=>{d===!1&&t(o,void 0)},[d,o,t]),d===!1)return null;const h=p.length===0,l=typeof n=="string"?n:"",T=b=>e.jsx(Ye,{path:o,label:a,required:j,errors:p,description:c.description,children:b});if(c.format==="time")return T(e.jsx(r.TextField.Root,{type:"time",value:l,onChange:b=>t(o,b.target.value),disabled:!y,color:h?void 0:"red",id:o}));const f=c.format==="date-time",[s="",u=""]=l.split("T"),C=u.slice(0,5),z=(b,w)=>{if(!b){t(o,void 0);return}t(o,f?Xe(b,w||"00:00"):b)};return T(e.jsxs(r.Flex,{gap:"2",align:"center",children:[e.jsx(r.TextField.Root,{type:"date",value:s,disabled:!y,color:h?void 0:"red",onChange:b=>z(b.target.value,C),id:o,style:{flex:1}}),f&&e.jsx(r.TextField.Root,{type:"time",value:C,disabled:!y||!s,color:h?void 0:"red",onChange:b=>z(s,b.target.value),style:{flex:1}})]}))},Fe=x.rankWith(2,x.or(x.isDateControl,x.isDateTimeControl,x.isTimeControl)),er=k.withJsonFormsControlProps(we),ze=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const d=n.elements;return c===!1?null:e.jsx(r.Flex,{direction:"column",gap:"4",children:d.map((h,l)=>e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${l}`))})},Re=x.rankWith(1,x.uiTypeIs("VerticalLayout")),ke=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const d=n.elements;return c===!1?null:e.jsx(r.Flex,{direction:"row",gap:"4",children:d.map((h,l)=>e.jsx(r.Box,{style:{flex:1},children:e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p})},`${o}-${l}`))})},$e=x.rankWith(1,x.uiTypeIs("HorizontalLayout")),Be=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{const y=n,d=y.elements;return c===!1?null:e.jsxs(r.Box,{mb:"6",children:[y.label&&e.jsx(r.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:y.label}),e.jsx(r.Flex,{direction:"column",gap:"4",children:d.map((h,l)=>e.jsx(k.JsonFormsDispatch,{uischema:h,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${l}`))})]})},De=x.rankWith(1,x.uiTypeIs("Group")),Le=({uischema:n,schema:t,path:o,renderers:a,cells:j,enabled:p,visible:c=!0})=>{var f;const d=n.elements.filter(s=>s.type==="Category"),[h,l]=m.useState(((f=d[0])==null?void 0:f.label)||"");if(c===!1||!d.length)return null;const T=d.find(s=>s.label===h)?h:d[0].label;return e.jsxs(r.Tabs.Root,{value:T,onValueChange:l,children:[e.jsx(r.Tabs.List,{children:d.map((s,u)=>e.jsx(r.Tabs.Trigger,{value:s.label,children:s.label},`${o}-${u}`))}),e.jsx(r.Box,{pt:"3",children:d.map((s,u)=>e.jsx(r.Tabs.Content,{value:s.label,children:e.jsx(r.Flex,{direction:"column",gap:"4",children:s.elements.map((C,z)=>e.jsx(k.JsonFormsDispatch,{uischema:C,schema:t,path:o,renderers:a,cells:j,enabled:p},`${o}-${u}-${z}`))})},`${o}-${u}`))})]})},Oe=x.rankWith(1,x.uiTypeIs("Categorization"));function rr(n){return n?Array.isArray(n)?n:[n]:[]}function ne(n){return n>=1024*1024?`${(n/(1024*1024)).toFixed(0)} MB`:n>=1024?`${(n/1024).toFixed(0)} KB`:`${n} B`}function oe(n){return n.split(",").map(t=>{if(t=t.trim(),t.endsWith("/*"))return t.split("/")[0].toUpperCase()+"S";if(t.startsWith("."))return t.slice(1).toUpperCase();const o=t.split("/")[1];return o?o.toUpperCase():t}).join(", ")}const tr=({data:n,handleChange:t,path:o,label:a,required:j,uischema:p,schema:c,enabled:y,errors:d,visible:h=!0})=>{const l=de();_(h,o,t,null);const T=!d||d.length===0,f=(c==null?void 0:c["x-file"])??{},s=(p==null?void 0:p.options)??{},u=f.maxFiles??s.maxFiles??1,C=f.maxSize??s.maxSize??5*1024*1024,z=f.accept??s.accept??"image/*,application/pdf",b=u>1,w=y!==!1,[F,I]=m.useState(!1),[$,E]=m.useState(null),[Q,A]=m.useState({}),Z=m.useRef(new Set),L=m.useRef(null),B=rr(n),P=B.length>=u;m.useEffect(()=>()=>{Z.current.forEach(i=>URL.revokeObjectURL(i)),Z.current.clear()},[]);const X=m.useCallback(async i=>{if(E(null),B.length>=u){E(`Maximum ${u} file${u>1?"s":""} allowed.`);return}if(i.size>C){E(`File exceeds the ${ne(C)} limit.`);return}if(!z.split(",").map(v=>v.trim()).some(v=>v==="*"||v==="*/*"?!0:v.endsWith("/*")?i.type.startsWith(v.slice(0,-1)):v.startsWith(".")?i.name.toLowerCase().endsWith(v.toLowerCase()):i.type===v)){E(`Invalid type. Accepted: ${oe(z)}`);return}if(!(l!=null&&l.onUpload)){E("Upload service not configured.");return}try{const v=await l.onUpload(i),D=URL.createObjectURL(i);Z.current.add(D);const U={key:v.key,name:v.name??i.name,blobUrl:D};A(M=>({...M,[v.key]:U}));const J=[...B,v.key];t(o,b?J:J[0])}catch{E("Upload failed. Please try again."),L.current&&(L.current.value="")}},[B,u,C,z,l,o,t,b]);if(h===!1)return null;const W=i=>{i.preventDefault(),i.stopPropagation(),!(!w||P)&&I(i.type==="dragenter"||i.type==="dragover")},Y=i=>{var S;i.preventDefault(),i.stopPropagation(),I(!1),!(!w||P)&&(S=i.dataTransfer.files)!=null&&S[0]&&X(i.dataTransfer.files[0])},V=i=>{var S;(S=i.target.files)!=null&&S[0]&&(X(i.target.files[0]),i.target.value="")},ee=i=>{if(!w)return;A(R=>{var U;const v={...R},D=(U=v[i])==null?void 0:U.blobUrl;return D&&(URL.revokeObjectURL(D),Z.current.delete(D)),delete v[i],v});const S=B.filter(R=>R!==i);t(o,b?S.length>0?S:null:S[0]??null)},G=async(i,S)=>{var D,U,J;i.preventDefault();const R=(D=Q[S])==null?void 0:D.blobUrl;if(R){(U=window.open(R,"_blank","noopener,noreferrer"))==null||U.focus();return}const v=window.open("","_blank");if(v)try{const M=await((J=l==null?void 0:l.getDownloadUrl)==null?void 0:J.call(l,S));M!=null&&M.url?v.location.href=M.url:v.close()}catch{v.close()}};if(!w&&B.length===0)return null;const N=u-B.length,K=w&&!P;return e.jsxs(r.Box,{mb:"4",children:[e.jsxs(r.Flex,{align:"center",justify:"between",mb:"2",children:[e.jsxs(r.Text,{as:"label",size:"2",weight:"bold",children:[a,j&&e.jsx(r.Text,{color:"red",children:" *"})]}),e.jsx(r.Text,{size:"1",color:"gray",children:b?`Up to ${u} files · ${ne(C)} each · ${oe(z)}`:`${ne(C)} · ${oe(z)}`})]}),B.map(i=>{var S;return e.jsx(r.Card,{size:"2",variant:"surface",mb:"2",children:e.jsxs(r.Flex,{align:"center",gap:"3",children:[e.jsx(r.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:e.jsx(H.FileTextIcon,{width:"20",height:"20"})}),e.jsx(r.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(r.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((S=Q[i])==null?void 0:S.name)??"Uploaded File"})}),e.jsxs(r.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[e.jsx(r.Button,{variant:"soft",color:"blue",size:"1",onClick:R=>G(R,i),children:"View"}),e.jsx(H.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),w&&e.jsx(r.IconButton,{variant:"ghost",color:"gray",onClick:()=>ee(i),children:e.jsx(H.Cross2Icon,{})})]})]})},i)}),K&&e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var i;return(i=L.current)==null?void 0:i.click()},onKeyDown:i=>{var S;(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),(S=L.current)==null||S.click())},onDragEnter:W,onDragLeave:W,onDragOver:W,onDrop:Y,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",F?"border-blue-500 bg-blue-50":$?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[e.jsx("input",{ref:L,type:"file",style:{display:"none"},accept:z,onChange:V}),e.jsx(r.Flex,{direction:"column",align:"center",gap:"2",children:$?e.jsxs(e.Fragment,{children:[e.jsx(H.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),e.jsx(r.Text,{size:"2",color:"red",weight:"medium",children:$}),e.jsx(r.Text,{size:"1",color:"gray",children:"Click to try again"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),e.jsx(r.Text,{size:"2",weight:"medium",children:B.length>0?`Add another file (${N} remaining)`:"Click to upload or drag and drop"}),e.jsxs(r.Text,{size:"1",color:"gray",children:[ne(C)," max · ",oe(z)]})]})})]}),w&&P&&b&&e.jsxs(r.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",u," files uploaded. Remove one to replace it."]}),!T&&e.jsx(r.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:q(d,a)})]})},Ie=k.withJsonFormsControlProps(tr),Ee=x.rankWith(10,x.and(x.schemaMatches(n=>{if(n.type==="string"&&n.format==="file")return!0;if(n.type==="array"){const t=n.items;return(t==null?void 0:t.type)==="string"&&(t==null?void 0:t.format)==="file"}return!1}))),nr=({data:n,path:t,schema:o,uischema:a,enabled:j,visible:p,addItem:c,removeItems:y,rootSchema:d,arraySchema:h})=>{const l=h?o:o.items,T=h||o;if(p===!1||!l||typeof l!="object"||Array.isArray(l))return null;const f=l,s=Array.isArray(n)?n:[],u=T.title||"Array Items",C=()=>{const b=x.createDefaultValue(f,d);c&&c(t,b)()},z=b=>{if(y){const w=y(t,[b]);w&&w()}};return e.jsx(r.Box,{mb:"6",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsx(r.Text,{as:"div",size:"4",weight:"bold",children:u}),s.length===0&&e.jsx(r.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:e.jsx(r.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),s.map((b,w)=>{var I;const F=`${t}.${w}`;return e.jsx(r.Card,{size:"3",variant:"surface",children:e.jsxs(r.Flex,{direction:"column",gap:"4",children:[e.jsxs(r.Flex,{justify:"between",align:"center",children:[e.jsxs(r.Text,{size:"3",weight:"bold",children:["Item ",w+1]}),j&&e.jsxs(r.Button,{type:"button",color:"red",variant:"soft",onClick:()=>z(w),title:"Remove item",children:[e.jsx(H.TrashIcon,{}),"Remove"]})]}),e.jsx(r.Box,{children:e.jsx(k.JsonFormsDispatch,{schema:f,uischema:((I=a.options)==null?void 0:I.detail)||(f.type==="object"||f.properties?{type:"VerticalLayout",elements:Object.keys(f.properties||{}).map($=>({type:"Control",scope:`#/properties/${$}`}))}:{type:"Control",scope:"#"}),path:F,enabled:j,renderers:void 0,cells:void 0})})]})},F)}),j&&e.jsx(r.Box,{mt:"2",children:e.jsxs(r.Button,{type:"button",variant:"surface",onClick:C,children:[e.jsx(H.PlusIcon,{}),"Add Item"]})})]})})},se=k.withJsonFormsArrayControlProps(nr),Ae=x.rankWith(3,x.isObjectArrayControl),Ue=({uischema:n,visible:t})=>{const o=n;return t===!1?null:e.jsx(r.Box,{mb:"4",children:e.jsx(r.Heading,{size:"4",children:o.text})})},Pe=x.rankWith(1,x.uiTypeIs("Label")),or=x.rankWith(3,x.isPrimitiveArrayControl),sr=[{tester:pe,renderer:He},{tester:ge,renderer:qe},{tester:me,renderer:Ge},{tester:ve,renderer:Ke},{tester:Se,renderer:Ce},{tester:Te,renderer:_e},{tester:Fe,renderer:er},{tester:Re,renderer:ze},{tester:$e,renderer:ke},{tester:De,renderer:Be},{tester:Oe,renderer:Le},{tester:Ee,renderer:Ie},{tester:Ae,renderer:se},{tester:or,renderer:se},{tester:Pe,renderer:Ue}];exports.ArrayControl=se;exports.ArrayControlTester=Ae;exports.BooleanControl=je;exports.BooleanControlTester=me;exports.CategorizationLayoutRenderer=Le;exports.CategorizationLayoutTester=Oe;exports.DateControl=we;exports.DateControlTester=Fe;exports.FileControl=Ie;exports.FileControlTester=Ee;exports.GroupLayoutRenderer=Be;exports.GroupLayoutTester=De;exports.HorizontalLayoutRenderer=ke;exports.HorizontalLayoutTester=$e;exports.LabelRenderer=Ue;exports.LabelTester=Pe;exports.NumberControl=he;exports.NumberControlTester=ge;exports.RadioControl=ye;exports.RadioControlTester=ve;exports.SearchSelectControl=Ce;exports.SearchSelectControlTester=Se;exports.SearchServiceProvider=Me;exports.SelectControl=be;exports.SelectControlTester=Te;exports.TextControl=fe;exports.TextControlTester=pe;exports.UploadProvider=Je;exports.VerticalLayoutRenderer=ze;exports.VerticalLayoutTester=Re;exports.radixRenderers=sr;exports.useSearchService=xe;exports.useUpload=de;
|
|
1
|
+
"use strict";var ct=Object.create;var ge=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty;var ft=(e,n,r)=>n in e?ge(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ht=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of ut(n))!xt.call(e,h)&&h!==r&&ge(e,h,{get:()=>n[h],enumerable:!(a=at(n,h))||a.enumerable});return e};var ve=(e,n,r)=>(r=e!=null?ct(dt(e)):{},ht(n||!e||!e.__esModule?ge(r,"default",{value:e,enumerable:!0}):r,e));var be=(e,n,r)=>ft(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),v=require("react"),y=require("@jsonforms/core"),W=require("@jsonforms/react"),o=require("@radix-ui/themes"),_=require("@radix-ui/react-icons"),pt=require("dayjs"),je=require("@e965/xlsx"),Se=v.createContext(null);function gt({children:e,onUpload:n,getDownloadUrl:r}){const a={onUpload:n,getDownloadUrl:r};return t.jsx(Se.Provider,{value:a,children:e})}function Ae(){return v.useContext(Se)}const Fe=v.createContext(null);function mt({children:e,services:n}){const r=v.useMemo(()=>n,[n]);return t.jsx(Fe.Provider,{value:r,children:e})}function Ne(e){const n=v.useContext(Fe);return!n||!e?null:n[e]??null}const ce=(e,n,r,a=void 0)=>{v.useEffect(()=>{e===!1&&r(n,a)},[e,n,r,a])},ne=(e,n)=>e?e.split(`
|
|
2
|
+
`).map(r=>r.trim()==="is a required property"?`${n||"This field"} is required`:r).join(`
|
|
3
|
+
`):"",Ie=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,uischema:u,schema:c,enabled:s,visible:i=!0})=>{var g;if(ce(i,r,n),i===!1)return null;const l=d.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:[a," ",h&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{value:e||"",onChange:p=>n(r,p.target.value),disabled:!s,placeholder:(g=u.options)==null?void 0:g.placeholder,color:l?void 0:"red",id:r}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:ne(d,a)}),c.description&&t.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},Oe=y.rankWith(1,y.isStringControl),Tt=W.withJsonFormsControlProps(Ie),Le=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,uischema:u,schema:c,enabled:s,visible:i=!0})=>{var p;if(ce(i,r,n),i===!1)return null;const l=d.length===0,g=f=>{if(f===""){n(r,void 0);return}const m=Number(f);isNaN(m)||n(r,m)};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:[a," ",h&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:f=>g(f.target.value),disabled:!s,placeholder:(p=u.options)==null?void 0:p.placeholder,color:l?void 0:"red",id:r}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:ne(d,a)}),c.description&&t.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},ke=y.rankWith(2,y.or(y.isNumberControl,y.isIntegerControl)),yt=W.withJsonFormsControlProps(Le),De=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(ce(s,r,n),s===!1)return null;const i=d.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:l=>n(r,l===!0),disabled:!c,id:r}),t.jsxs(o.Text,{as:"label",size:"2",htmlFor:r,children:[a," ",h&&"*"]})]}),!i&&t.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:ne(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:u.description})]})},Me=y.rankWith(2,y.isBooleanControl),vt=W.withJsonFormsControlProps(De),ze=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(ce(s,r,n),s===!1)return null;const i=d.length===0;let l=[];u.enum?l=u.enum.map(p=>({value:p,label:String(p)})):u.oneOf&&(l=u.oneOf.map(p=>({value:p.const,label:p.title||String(p.const)})));const g=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:[a," ",h&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.RadioGroup.Root,{value:g!==void 0?String(g):"",onValueChange:p=>{const f=l.find(m=>String(m.value)===p);f&&n(r,f.value)},disabled:!c,children:t.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:l.map(p=>t.jsxs(o.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[t.jsx(o.RadioGroup.Item,{value:String(p.value)}),t.jsx(o.Text,{size:"2",color:c?void 0:"gray",children:p.label})]},String(p.value)))})}),!i&&t.jsx(o.Text,{color:"red",size:"1",children:ne(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},Ue=(e,n,r)=>{var h;return y.or(y.isEnumControl,y.isOneOfControl)(e,n,r)&&((h=e==null?void 0:e.options)==null?void 0:h.format)==="radio"?3:-1},bt=W.withJsonFormsControlProps(ze),Be=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,schema:u,uischema:c,enabled:s,visible:i=!0})=>{var f;if(ce(i,r,n),i===!1)return null;const l=d.length===0;let g=[];u.enum?g=u.enum.map(m=>({value:String(m),label:String(m)})):u.oneOf&&(g=u.oneOf.map(m=>({value:String(m.const),label:m.title||String(m.const)})));const p=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:[a," ",h&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs(o.Select.Root,{value:p,onValueChange:m=>n(r,m),disabled:!s,children:[t.jsx(o.Select.Trigger,{placeholder:((f=c.options)==null?void 0:f.placeholder)||"Select an option",color:l?void 0:"red",id:r}),t.jsx(o.Select.Content,{children:g.map(m=>t.jsx(o.Select.Item,{value:m.value,children:m.label},m.value))})]}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:ne(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},Pe=y.rankWith(2,y.or(y.isEnumControl,y.isOneOfControl)),jt=W.withJsonFormsControlProps(Be),Ct={"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}},Et=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,enabled:u,visible:c=!0,schema:s,uischema:i})=>{var xe;const l=(s==null?void 0:s["x-search"])??{service:""},g=l.service??"",p=l.mode??"large-paginated-list",f=Ct[p],m=(f==null?void 0:f.fetchOnOpen)??!1,R=Ne(g),F=g?R?f?null:`Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${g}" is not registered.`:"Search not configured.",C=u!==!1,A=!d||d.length===0,[N,S]=v.useState(!1),[D,M]=v.useState(""),[ee,z]=v.useState([]),[oe,$]=v.useState(!1),[U,G]=v.useState(!1),[te,I]=v.useState(!1),[se,H]=v.useState(null),[le,J]=v.useState(void 0),q=v.useRef(void 0),re=v.useRef(null),T=v.useRef(null),w=v.useRef(null),L=v.useRef(void 0);v.useEffect(()=>{if(!e){J(void 0),L.current=void 0;return}if(L.current===e||(L.current=e,J({id:e,name:e}),!(R!=null&&R.resolve)))return;let x=!1;return R.resolve(e).then(j=>{!x&&j&&J(j)}).catch(()=>{}),()=>{x=!0}},[e,R]);const b=v.useCallback(async(x,j=!1)=>{var Z;if(!R){H("Search service not configured.");return}(Z=T.current)==null||Z.abort();const ie=new AbortController;T.current=ie,j?I(!0):(G(!0),I(!1),H(null));try{const Q=await R.search({query:x,cursor:j?q.current:void 0,signal:ie.signal}),k=Q.options??[];z(j?it=>[...it,...k]:k),q.current=Q.nextCursor,$(((f==null?void 0:f.paginated)??!1)&&Q.nextCursor!=null)}catch{if(ie.signal.aborted)return;H("Failed to load results. Please try again.")}finally{ie.signal.aborted||(j?I(!1):G(!1))}},[R,f==null?void 0:f.paginated]);if(v.useEffect(()=>{if(!N)return;const x=j=>{w.current&&!w.current.contains(j.target)&&S(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[N]),v.useEffect(()=>{var x;N||((x=T.current)==null||x.abort(),M(""),z([]),$(!1),H(null),G(!1),I(!1),q.current=void 0)},[N]),v.useEffect(()=>{if(!N)return;if(!D&&!m){z([]),$(!1),H(null),q.current=void 0;return}re.current&&clearTimeout(re.current);const x=D?300:0;return re.current=setTimeout(()=>{z([]),$(!1),q.current=void 0,b(D)},x),()=>{re.current&&clearTimeout(re.current)}},[D,N,m,b]),ce(c,r,n,null),c===!1)return null;const B=()=>{M(""),z([]),$(!1),H(null),q.current=void 0,S(!0)},K=x=>{n(r,x.id),J(x),L.current=x.id,S(!1)},X=x=>{x.stopPropagation(),n(r,null),J(void 0)},Y=x=>{(x.key==="Enter"||x.key===" ")&&X(x)},pe=((xe=i==null?void 0:i.options)==null?void 0:xe.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:[a," ",h&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs("div",{ref:w,style:{position:"relative"},children:[t.jsx(o.TextField.Root,{id:r,value:N?D:(le==null?void 0:le.name)??"",placeholder:N&&(f!=null&&f.searchable)?"Search...":pe,disabled:!C,readOnly:N&&!(f!=null&&f.searchable),style:A?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:x=>{f!=null&&f.searchable&&(M(x.target.value),N||B())},onFocus:()=>{C&&!N&&B()},onKeyDown:x=>{x.key==="Escape"&&S(!1)},children:t.jsx(o.TextField.Slot,{side:"right",children:t.jsxs(o.Flex,{align:"center",gap:"1",children:[e&&C&&t.jsx("span",{role:"button",tabIndex:0,onMouseDown:x=>x.preventDefault(),onClick:X,onKeyDown:Y,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),t.jsx(_.ChevronDownIcon,{style:{transform:N?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),N&&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:F?t.jsx(o.Box,{p:"3",children:t.jsx(o.Text,{size:"2",color:"gray",children:F})}):t.jsx(o.ScrollArea,{style:{maxHeight:240},children:t.jsxs(o.Box,{p:"1",children:[U&&t.jsx(o.Flex,{justify:"center",p:"4",children:t.jsx(o.Spinner,{})}),!U&&se&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"red",children:se})}),!U&&!se&&ee.length===0&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"gray",children:D||m?"No results found.":"Type to search…"})}),ee.map(x=>t.jsx(o.Box,{px:"3",py:"2",onMouseDown:j=>j.preventDefault(),onClick:()=>K(x),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:x.id===e?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:t.jsx(o.Text,{size:"2",children:x.name})},x.id)),(f==null?void 0:f.paginated)&&oe&&!te&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:x=>x.preventDefault(),onClick:()=>void b(D,!0),children:"Load more"})}),te&&t.jsx(o.Flex,{justify:"center",p:"2",children:t.jsx(o.Spinner,{})})]})})})]}),!A&&t.jsx(o.Text,{color:"red",size:"1",children:ne(d,a)}),s.description&&t.jsx(o.Text,{size:"1",color:"gray",children:s.description})]})})},We=W.withJsonFormsControlProps(Et),$e=y.rankWith(3,y.schemaMatches(e=>{const n=e["x-search"];return e.type==="string"&&typeof(n==null?void 0:n.service)=="string"&&n.service!==""})),Rt=(e,n)=>pt(`${e}T${n}`).format(),wt=({path:e,label:n,required:r,errors:a,description:h,children:d})=>{const u=a.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:"*"})]}),d,!u&&t.jsx(o.Text,{color:"red",size:"1",children:ne(a,n)}),h&&t.jsx(o.Text,{size:"1",color:"gray",children:h})]})})},_e=({data:e,handleChange:n,path:r,label:a,required:h,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(v.useEffect(()=>{s===!1&&n(r,void 0)},[s,r,n]),s===!1)return null;const i=d.length===0,l=typeof e=="string"?e:"",g=C=>t.jsx(wt,{path:r,label:a,required:h,errors:d,description:u.description,children:C});if(u.format==="time")return g(t.jsx(o.TextField.Root,{type:"time",value:l,onChange:C=>n(r,C.target.value),disabled:!c,color:i?void 0:"red",id:r}));const p=u.format==="date-time",[f="",m=""]=l.split("T"),R=m.slice(0,5),F=(C,A)=>{if(!C){n(r,void 0);return}n(r,p?Rt(C,A||"00:00"):C)};return g(t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.TextField.Root,{type:"date",value:f,disabled:!c,color:i?void 0:"red",onChange:C=>F(C.target.value,R),id:r,style:{flex:1}}),p&&t.jsx(o.TextField.Root,{type:"time",value:R,disabled:!c||!f,color:i?void 0:"red",onChange:C=>F(f,C.target.value),style:{flex:1}})]}))},Ve=y.rankWith(2,y.or(y.isDateControl,y.isDateTimeControl,y.isTimeControl)),St=W.withJsonFormsControlProps(_e),He=({uischema:e,schema:n,path:r,renderers:a,cells:h,enabled:d,visible:u=!0})=>{const s=e.elements;return u===!1?null:t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((i,l)=>t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:h,enabled:d},`${r}-${l}`))})},Ge=y.rankWith(1,y.uiTypeIs("VerticalLayout")),Je=({uischema:e,schema:n,path:r,renderers:a,cells:h,enabled:d,visible:u=!0})=>{const s=e.elements;return u===!1?null:t.jsx(o.Flex,{direction:"row",gap:"4",children:s.map((i,l)=>t.jsx(o.Box,{style:{flex:1},children:t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:h,enabled:d})},`${r}-${l}`))})},Ke=y.rankWith(1,y.uiTypeIs("HorizontalLayout")),Xe=({uischema:e,schema:n,path:r,renderers:a,cells:h,enabled:d,visible:u=!0})=>{const c=e,s=c.elements;return u===!1?null:t.jsxs(o.Box,{mb:"6",children:[c.label&&t.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:c.label}),t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((i,l)=>t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:h,enabled:d},`${r}-${l}`))})]})},qe=y.rankWith(1,y.uiTypeIs("Group")),Ye=({uischema:e,schema:n,path:r,renderers:a,cells:h,enabled:d,visible:u=!0})=>{var p;const s=e.elements.filter(f=>f.type==="Category"),[i,l]=v.useState(((p=s[0])==null?void 0:p.label)||"");if(u===!1||!s.length)return null;const g=s.find(f=>f.label===i)?i:s[0].label;return t.jsxs(o.Tabs.Root,{value:g,onValueChange:l,children:[t.jsx(o.Tabs.List,{children:s.map((f,m)=>t.jsx(o.Tabs.Trigger,{value:f.label,children:f.label},`${r}-${m}`))}),t.jsx(o.Box,{pt:"3",children:s.map((f,m)=>t.jsx(o.Tabs.Content,{value:f.label,children:t.jsx(o.Flex,{direction:"column",gap:"4",children:f.elements.map((R,F)=>t.jsx(W.JsonFormsDispatch,{uischema:R,schema:n,path:r,renderers:a,cells:h,enabled:d},`${r}-${m}-${F}`))})},`${r}-${m}`))})]})},Ze=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 At(e){return e?Array.isArray(e)?e:[e]:[]}const Ft=({data:e,handleChange:n,path:r,label:a,required:h,uischema:d,schema:u,enabled:c,errors:s,visible:i=!0})=>{const l=Ae();ce(i,r,n,null);const g=!s||s.length===0,p=(u==null?void 0:u["x-file"])??{},f=(d==null?void 0:d.options)??{},m=p.maxFiles??f.maxFiles??1,R=p.maxSize??f.maxSize??5*1024*1024,F=p.accept??f.accept??"image/*,application/pdf",C=m>1,A=c!==!1,[N,S]=v.useState(!1),[D,M]=v.useState(null),[ee,z]=v.useState({}),oe=v.useRef(new Set),$=v.useRef(null),U=At(e),G=U.length>=m;v.useEffect(()=>()=>{oe.current.forEach(T=>URL.revokeObjectURL(T)),oe.current.clear()},[]);const te=v.useCallback(async T=>{if(M(null),U.length>=m){M(`Maximum ${m} file${m>1?"s":""} allowed.`);return}if(T.size>R){M(`File exceeds the ${ue(R)} limit.`);return}if(!F.split(",").map(b=>b.trim()).some(b=>b==="*"||b==="*/*"?!0:b.endsWith("/*")?T.type.startsWith(b.slice(0,-1)):b.startsWith(".")?T.name.toLowerCase().endsWith(b.toLowerCase()):T.type===b)){M(`Invalid type. Accepted: ${de(F)}`);return}if(!(l!=null&&l.onUpload)){M("Upload service not configured.");return}try{const b=await l.onUpload(T),B=URL.createObjectURL(T);oe.current.add(B);const K={key:b.key,name:b.name??T.name,blobUrl:B};z(Y=>({...Y,[b.key]:K}));const X=[...U,b.key];n(r,C?X:X[0])}catch{M("Upload failed. Please try again."),$.current&&($.current.value="")}},[U,m,R,F,l,r,n,C]);if(i===!1)return null;const I=T=>{T.preventDefault(),T.stopPropagation(),!(!A||G)&&S(T.type==="dragenter"||T.type==="dragover")},se=T=>{var w;T.preventDefault(),T.stopPropagation(),S(!1),!(!A||G)&&(w=T.dataTransfer.files)!=null&&w[0]&&te(T.dataTransfer.files[0])},H=T=>{var w;(w=T.target.files)!=null&&w[0]&&(te(T.target.files[0]),T.target.value="")},le=T=>{if(!A)return;z(L=>{var K;const b={...L},B=(K=b[T])==null?void 0:K.blobUrl;return B&&(URL.revokeObjectURL(B),oe.current.delete(B)),delete b[T],b});const w=U.filter(L=>L!==T);n(r,C?w.length>0?w:null:w[0]??null)},J=async(T,w)=>{var B,K,X;T.preventDefault();const L=(B=ee[w])==null?void 0:B.blobUrl;if(L){(K=window.open(L,"_blank","noopener,noreferrer"))==null||K.focus();return}const b=window.open("","_blank");if(b)try{const Y=await((X=l==null?void 0:l.getDownloadUrl)==null?void 0:X.call(l,w));Y!=null&&Y.url?b.location.href=Y.url:b.close()}catch{b.close()}};if(!A&&U.length===0)return null;const q=m-U.length,re=A&&!G;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:[a,h&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsx(o.Text,{size:"1",color:"gray",children:C?`Up to ${m} files · ${ue(R)} each · ${de(F)}`:`${ue(R)} · ${de(F)}`})]}),U.map(T=>{var w;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(_.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:((w=ee[T])==null?void 0:w.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:L=>J(L,T),children:"View"}),t.jsx(_.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),A&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>le(T),children:t.jsx(_.Cross2Icon,{})})]})]})},T)}),re&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var T;return(T=$.current)==null?void 0:T.click()},onKeyDown:T=>{var w;(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),(w=$.current)==null||w.click())},onDragEnter:I,onDragLeave:I,onDragOver:I,onDrop:se,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":D?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[t.jsx("input",{ref:$,type:"file",style:{display:"none"},accept:F,onChange:H}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:D?t.jsxs(t.Fragment,{children:[t.jsx(_.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:D}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(_.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:U.length>0?`Add another file (${q} remaining)`:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(R)," max · ",de(F)]})]})})]}),A&&G&&C&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",m," files uploaded. Remove one to replace it."]}),!g&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:ne(s,a)})]})},Qe=W.withJsonFormsControlProps(Ft),et=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})));class Te extends Error{}function Nt(e,n){const r=je.read(e,{type:"array",cellDates:!0});if(r.SheetNames.length===0)throw new Te("This file has no sheets.");const a=n??r.SheetNames[0],h=r.Sheets[a];if(!h)throw new Te(`This file doesn't have a sheet named "${a}".`);const d=je.utils.sheet_to_json(h,{header:1,raw:!0,defval:null});return{sheetName:a,matrix:d,rowCount:d.length,colCount:Math.max(0,...d.map(u=>u.length))}}function It(e){let n=e+1,r="";for(;n>0;){const a=(n-1)%26;r=String.fromCharCode(65+a)+r,n=Math.floor((n-1)/26)}return r}class V extends Error{constructor(r,a){super(a??r);be(this,"code");this.code=r,this.name="FormulaError"}}const Ot=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],Lt=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],kt=["YEAR","MONTH","DAY","WEEKDAY"],Dt=["IF"],Mt=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],zt=new Set([...Ot,...Lt,...kt,...Mt,...Dt]),Ut=/"(?:[^"]|"")*"/g,Ce=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function Bt(e){const n=e.replace(Ut,a=>" ".repeat(a.length));Ce.lastIndex=0;let r;for(;(r=Ce.exec(n))!==null;){const a=r[1].toUpperCase();if(!zt.has(a))throw new V("NAME",`Function ${a} is not allowed.`)}}function Pt(e,n,r){let a=e;if(a==null)throw r.NA;if(typeof a=="object"&&!(a instanceof r)&&(a=n.retrieveRef(a)),a instanceof r)throw a;if(typeof a=="boolean")return a;if(typeof a=="number")return a!==0;throw r.VALUE}function tt(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function ae(e){const n=tt(e);return Array.isArray(n)?n.flat(1/0):[n]}function E(e){const n=tt(e);return Array.isArray(n)?n.flat(1/0)[0]:n}function he(e){return e===void 0?void 0:E(e)}function P(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function Wt(e,n){return e instanceof n?e:new n(e.message||"#ERROR!")}function O(e){return e.find(n=>n instanceof Error)}function $t(e,n){const r=d=>{throw Wt(d,n)},a=(d,{checkArgsForErrors:u=!0}={})=>(...c)=>{const s=c.flatMap(ae);if(u){const l=O(s);l&&r(l)}const i=d(...s);return i instanceof Error?r(i):i},h=(d,{toText:u=!1}={})=>c=>{const s=E(c),i=O([s]);i&&r(i);const l=d(u?P(s):s);return l instanceof Error?r(l):l};return{IF:(d,u,c,s)=>{const i=Pt(u,d,n);if(c==null)throw n.NA;return i?c:s??!1},MAX:a(e.MAX),MIN:a(e.MIN),MAXA:a(e.MAXA),MINA:a(e.MINA),MEDIAN:a(e.MEDIAN),COUNTA:a(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(d,u)=>{const c=ae(d),s=E(u),i=O([...c,s]);i&&r(i);const l=e.LARGE(c,s);return l instanceof Error?r(l):l},SMALL:(d,u)=>{const c=ae(d),s=E(u),i=O([...c,s]);i&&r(i);const l=e.SMALL(c,s);return l instanceof Error?r(l):l},PERMUT:(d,u)=>{const c=[E(d),E(u)],s=O(c);s&&r(s);const i=e.PERMUT(c[0],c[1]);return i instanceof Error?r(i):i},PERMUTATIONA:(d,u)=>{const c=[E(d),E(u)],s=O(c);s&&r(s);const i=e.PERMUTATIONA(c[0],c[1]);return i instanceof Error?r(i):i},MATCH:(d,u)=>{const c=E(d),s=ae(u),i=O([c,...s]);i&&r(i);const l=e.MATCH(c,s,0);return l instanceof Error?r(l):l},SWITCH:(...d)=>{const u=d.map(E),c=O(u);c&&r(c);const s=e.SWITCH(...u);return s instanceof Error?r(s):s},SUBSTITUTE:(d,u,c,s)=>{const i=[P(E(d)),P(E(u)),P(E(c))];s!==void 0&&i.push(E(s));const l=O(i);l&&r(l);const g=e.SUBSTITUTE(...i);return g instanceof Error?r(g):g},TEXTJOIN:(d,u,...c)=>{const s=P(E(d)),i=E(u),l=c.flatMap(ae).map(P),g=O([s,i]);g&&r(g);const p=e.TEXTJOIN(s,i,l);return p instanceof Error?r(p):p},UPPER:h(e.UPPER),YEAR:h(e.YEAR),MONTH:h(e.MONTH),DAY:h(e.DAY),WEEKDAY:(d,u)=>{const c=E(d),s=E(u),i=O([c]);i&&r(i);const l=e.WEEKDAY(c,s);return l instanceof Error?r(l):l},CONCATENATE:(...d)=>{const u=d.flatMap(ae),c=O(u);c&&r(c);const s=e.CONCATENATE(...u.map(P));return s instanceof Error?r(s):s},CONCAT:(...d)=>{const u=d.flatMap(ae),c=O(u);c&&r(c);const s=e.CONCAT(...u.map(P));return s instanceof Error?r(s):s},LEN:h(e.LEN,{toText:!0}),TRIM:h(e.TRIM,{toText:!0}),LOWER:h(e.LOWER,{toText:!0}),LEFT:(d,u)=>{const c=E(d),s=he(u),i=O([c]);i&&r(i);const l=e.LEFT(P(c),s);return l instanceof Error?r(l):l},RIGHT:(d,u)=>{const c=E(d),s=he(u),i=O([c]);i&&r(i);const l=e.RIGHT(P(c),s);return l instanceof Error?r(l):l},MID:(d,u,c)=>{const s=E(d),i=E(u),l=E(c),g=O([s,i,l]);g&&r(g);const p=e.MID(P(s),i,l);return p instanceof Error?r(p):p},FIND:(d,u,c)=>{const s=E(d),i=E(u),l=he(c),g=O([s,i]);g&&r(g);const p=e.FIND(P(s),P(i),l);return p instanceof Error?r(p):p},SEARCH:(d,u,c)=>{const s=E(d),i=E(u),l=he(c),g=O([s,i]);g&&r(g);const p=e.SEARCH(P(s),P(i),l);return p instanceof Error?r(p):p}}}const _t={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Ee(e){return _t[e.error]??"ERROR"}function Re(e,n){if(e instanceof V)return e;if(e instanceof n){const r=e.details;return r instanceof V?r:r instanceof n?new V(Ee(r),r.message):new V(Ee(e),e.message)}return new V("ERROR",e instanceof Error?e.message:void 0)}function Vt(e){return Math.max(0,...e.map(n=>(n==null?void 0:n.length)??0))}function Ht(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 V("REF");const a=r[n.col-1];return a==null||a===""?null:a}}function Gt(e){return n=>{const r=Math.min(n.from.row,n.to.row),a=Math.min(n.from.col,n.to.col),h=Math.max(n.from.row,n.to.row),d=Math.max(n.from.col,n.to.col),u=Vt(e);if(r>e.length||a>u)throw new V("REF");const c=Math.min(h,e.length),s=[];for(let i=r;i<=c;i++){const l=e[i-1],g=[];if(l!=null){const p=Math.min(d,l.length);for(let f=a;f<=p;f++){const m=l[f-1];g.push(m==null||m===""?null:m)}}s.push(g)}return s}}function Jt(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new V("VALUE")}async function Kt(e,n){if(typeof n!="string")throw new V("ERROR");const r=n.trim();if(r==="")throw new V("ERROR");const a=r.startsWith("=")?r.slice(1):r;Bt(a);const[h,d]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),u=h.default??h,c=u.FormulaError,s=new u({onCell:Ht(e),onRange:Gt(e),functions:$t(d,c)});let i;try{i=s.parse(a,{row:1,col:1,sheet:"Sheet1"})}catch(l){throw Re(l,c)}if(i instanceof c)throw Re(i,c);return Jt(i)}const we={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};async function Xt(e,n){return e.length===0?n.map(r=>({label:(r==null?void 0:r.label)??"(unknown)",value:null,error:we.ERROR})):Promise.all(n.map(async r=>{try{if(!r||typeof r.label!="string"||typeof r.expression!="string")throw new V("ERROR");return{label:r.label,value:await Kt(e,r.expression)}}catch(a){const h=a instanceof V?a.code:"ERROR";return{label:(r==null?void 0:r.label)??"(unknown)",value:null,error:we[h]}}}))}const qt=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",Yt=10*1024*1024,me=200,Zt=50,Qt=[];function fe(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const er=({data:e,handleChange:n,path:r,label:a,required:h,schema:d,enabled:u,errors:c,visible:s=!0})=>{var xe;ce(s,r,n,null);const i=!c||c.length===0,l=u!==!1,g=(d==null?void 0:d["x-spreadsheet"])??{},p=(d==null?void 0:d["x-evaluate"])??Qt,f=g.accept??qt,m=g.maxSize??Yt,R=g.persistSheet!==!1,F=g.columnHeader===!0,C=g.rowHeader===!0,A=g.showSheet!==!1,N=g.sheetName,S=e??null,[D,M]=v.useState(()=>{var x;return S!=null&&S.sheet||(((x=S==null?void 0:S.derivations)==null?void 0:x.length)??0)>0?"ready":"empty"}),[ee,z]=v.useState(null),[oe,$]=v.useState(!1),[U,G]=v.useState(null),te=v.useRef(null),I=U??(S==null?void 0:S.sheet)??null,se=(S==null?void 0:S.derivations)??[],H=I!=null||S!=null,le=v.useCallback(async x=>{if(z(null),x.size>m){z(`File exceeds the ${ue(m)} limit.`);return}if(!f.split(",").map(k=>k.trim()).some(k=>k==="*"||k==="*/*"?!0:k.endsWith("/*")?x.type.startsWith(k.slice(0,-1)):k.startsWith(".")?x.name.toLowerCase().endsWith(k.toLowerCase()):x.type===k)){z(`Invalid type. Accepted: ${de(f)}`);return}M("parsing");let Z;try{const k=await x.arrayBuffer();Z=Nt(k,N).matrix}catch(k){M("error"),z(k instanceof Te?k.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}G(Z);const Q=await Xt(Z,p);n(r,R?{sheet:Z,derivations:Q}:{derivations:Q}),M("ready")},[f,m,R,N,p,r,n]);if(s===!1||!l&&!H)return null;const J=x=>{x.preventDefault(),x.stopPropagation(),l&&$(x.type==="dragenter"||x.type==="dragover")},q=x=>{var j;x.preventDefault(),x.stopPropagation(),$(!1),l&&(j=x.dataTransfer.files)!=null&&j[0]&&le(x.dataTransfer.files[0])},re=x=>{var j;(j=x.target.files)!=null&&j[0]&&(le(x.target.files[0]),x.target.value="")},T=()=>{l&&(G(null),z(null),M("empty"),n(r,null))},w=F?1:0,L=C?1:0,b=I?I.slice(w):[],B=b.slice(0,me),K=Math.min(Zt,Math.max(0,...B.map(x=>Math.max(0,x.length-L)))),X=Array.from({length:K},(x,j)=>j+L),Y=A&&I==null&&S!=null,pe=F&&C?fe((xe=I==null?void 0:I[0])==null?void 0:xe[0]):"";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:[a,h&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(m)," max · ",de(f)]})]}),H&&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(_.FileTextIcon,{width:"20",height:"20"})}),t.jsx(o.Box,{style:{flex:1},children:t.jsx(o.Text,{size:"2",weight:"bold",children:"Spreadsheet uploaded"})}),t.jsx(_.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),l&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:T,"aria-label":"Remove spreadsheet",children:t.jsx(_.Cross2Icon,{})})]})}),l&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var x;return(x=te.current)==null?void 0:x.click()},onKeyDown:x=>{var j;(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),(j=te.current)==null||j.click())},onDragEnter:J,onDragLeave:J,onDragOver:J,onDrop:q,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",oe?"border-blue-500 bg-blue-50":ee?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[t.jsx("input",{ref:te,type:"file",style:{display:"none"},accept:f,onChange:re}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:D==="parsing"?t.jsxs(t.Fragment,{children:[t.jsx(o.Spinner,{size:"3"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):ee?t.jsxs(t.Fragment,{children:[t.jsx(_.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:ee}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(_.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:H?"Click to upload a replacement":"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(m)," max · ",de(f)]})]})})]}),I&&A&&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,{children:pe}),X.map(x=>{var j;return t.jsx(o.Table.ColumnHeaderCell,{children:F?fe((j=I[0])==null?void 0:j[x]):It(x)},x)})]})}),t.jsx(o.Table.Body,{children:B.map((x,j)=>{var Z;const ie=w+j;return t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{children:C?fe((Z=I[ie])==null?void 0:Z[0]):ie+1}),X.map(Q=>t.jsx(o.Table.Cell,{children:fe(x[Q])},Q))]},j)})})]})}),b.length>me&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",me," of ",b.length," rows"]})]}),Y&&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."}),se.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:se.map((x,j)=>t.jsxs(o.Flex,{justify:"between",children:[t.jsx(o.Text,{size:"2",children:x.label}),x.error?t.jsx(o.Text,{size:"2",color:"red",children:x.error}):t.jsx(o.Text,{size:"2",children:fe(x.value)})]},j))})]}),!i&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:ne(c,a)})]})},rt=W.withJsonFormsControlProps(er),nt=y.rankWith(10,y.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object")),tr=({data:e,path:n,schema:r,uischema:a,enabled:h,visible:d,addItem:u,removeItems:c,rootSchema:s,arraySchema:i})=>{const l=i?r:r.items,g=i||r;if(d===!1||!l||typeof l!="object"||Array.isArray(l))return null;const p=l,f=Array.isArray(e)?e:[],m=g.title||"Array Items",R=()=>{const C=y.createDefaultValue(p,s);u&&u(n,C)()},F=C=>{if(c){const A=c(n,[C]);A&&A()}};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:m}),f.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."})}),f.map((C,A)=>{var S;const N=`${n}.${A}`;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 ",A+1]}),h&&t.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>F(A),title:"Remove item",children:[t.jsx(_.TrashIcon,{}),"Remove"]})]}),t.jsx(o.Box,{children:t.jsx(W.JsonFormsDispatch,{schema:p,uischema:((S=a.options)==null?void 0:S.detail)||(p.type==="object"||p.properties?{type:"VerticalLayout",elements:Object.keys(p.properties||{}).map(D=>({type:"Control",scope:`#/properties/${D}`}))}:{type:"Control",scope:"#"}),path:N,enabled:h,renderers:void 0,cells:void 0})})]})},N)}),h&&t.jsx(o.Box,{mt:"2",children:t.jsxs(o.Button,{type:"button",variant:"surface",onClick:R,children:[t.jsx(_.PlusIcon,{}),"Add Item"]})})]})})},ye=W.withJsonFormsArrayControlProps(tr),ot=y.rankWith(3,y.isObjectArrayControl),st=({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})})},lt=y.rankWith(1,y.uiTypeIs("Label")),rr=y.rankWith(3,y.isPrimitiveArrayControl),nr=[{tester:Oe,renderer:Tt},{tester:ke,renderer:yt},{tester:Me,renderer:vt},{tester:Ue,renderer:bt},{tester:$e,renderer:We},{tester:Pe,renderer:jt},{tester:Ve,renderer:St},{tester:Ge,renderer:He},{tester:Ke,renderer:Je},{tester:qe,renderer:Xe},{tester:Ze,renderer:Ye},{tester:et,renderer:Qe},{tester:nt,renderer:rt},{tester:ot,renderer:ye},{tester:rr,renderer:ye},{tester:lt,renderer:st}];exports.ArrayControl=ye;exports.ArrayControlTester=ot;exports.BooleanControl=De;exports.BooleanControlTester=Me;exports.CategorizationLayoutRenderer=Ye;exports.CategorizationLayoutTester=Ze;exports.DateControl=_e;exports.DateControlTester=Ve;exports.FileControl=Qe;exports.FileControlTester=et;exports.GroupLayoutRenderer=Xe;exports.GroupLayoutTester=qe;exports.HorizontalLayoutRenderer=Je;exports.HorizontalLayoutTester=Ke;exports.LabelRenderer=st;exports.LabelTester=lt;exports.NumberControl=Le;exports.NumberControlTester=ke;exports.RadioControl=ze;exports.RadioControlTester=Ue;exports.SearchSelectControl=We;exports.SearchSelectControlTester=$e;exports.SearchServiceProvider=mt;exports.SelectControl=Be;exports.SelectControlTester=Pe;exports.SpreadsheetControl=rt;exports.SpreadsheetControlTester=nt;exports.TextControl=Ie;exports.TextControlTester=Oe;exports.UploadProvider=gt;exports.VerticalLayoutRenderer=He;exports.VerticalLayoutTester=Ge;exports.radixRenderers=nr;exports.useSearchService=Ne;exports.useUpload=Ae;
|