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