@uipath/apollo-wind 0.9.0 → 0.10.0-pr257.2a4b17b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/components/forms/field-renderer.cjs +120 -69
  2. package/dist/components/forms/field-renderer.js +120 -69
  3. package/dist/components/forms/form-designer.cjs +2352 -1488
  4. package/dist/components/forms/form-designer.js +2353 -1489
  5. package/dist/components/forms/form-examples.cjs +10 -10
  6. package/dist/components/forms/form-examples.js +10 -10
  7. package/dist/components/forms/form-state-viewer.cjs +988 -433
  8. package/dist/components/forms/form-state-viewer.js +988 -433
  9. package/dist/components/forms/metadata-form.cjs +446 -170
  10. package/dist/components/forms/metadata-form.js +446 -170
  11. package/dist/components/forms/schema-viewer.cjs +173 -80
  12. package/dist/components/forms/schema-viewer.js +173 -80
  13. package/dist/components/ui/accordion.cjs +131 -27
  14. package/dist/components/ui/accordion.js +131 -27
  15. package/dist/components/ui/alert-dialog.cjs +273 -45
  16. package/dist/components/ui/alert-dialog.js +273 -45
  17. package/dist/components/ui/alert.cjs +106 -17
  18. package/dist/components/ui/alert.js +106 -17
  19. package/dist/components/ui/avatar.cjs +100 -15
  20. package/dist/components/ui/avatar.js +100 -15
  21. package/dist/components/ui/badge.cjs +36 -6
  22. package/dist/components/ui/badge.js +36 -6
  23. package/dist/components/ui/breadcrumb.cjs +258 -52
  24. package/dist/components/ui/breadcrumb.js +258 -52
  25. package/dist/components/ui/button-group.cjs +119 -19
  26. package/dist/components/ui/button-group.js +119 -19
  27. package/dist/components/ui/button.cjs +48 -8
  28. package/dist/components/ui/button.js +48 -8
  29. package/dist/components/ui/calendar.cjs +88 -30
  30. package/dist/components/ui/calendar.js +88 -30
  31. package/dist/components/ui/card.cjs +199 -30
  32. package/dist/components/ui/card.js +199 -30
  33. package/dist/components/ui/checkbox.cjs +42 -8
  34. package/dist/components/ui/checkbox.js +42 -8
  35. package/dist/components/ui/combobox.cjs +150 -53
  36. package/dist/components/ui/combobox.js +150 -53
  37. package/dist/components/ui/command.cjs +291 -53
  38. package/dist/components/ui/command.js +291 -53
  39. package/dist/components/ui/context-menu.cjs +370 -72
  40. package/dist/components/ui/context-menu.js +370 -72
  41. package/dist/components/ui/data-table.cjs +76 -39
  42. package/dist/components/ui/data-table.js +76 -39
  43. package/dist/components/ui/date-picker.cjs +179 -68
  44. package/dist/components/ui/date-picker.js +179 -68
  45. package/dist/components/ui/datetime-picker.cjs +225 -104
  46. package/dist/components/ui/datetime-picker.js +225 -104
  47. package/dist/components/ui/dialog.cjs +290 -78
  48. package/dist/components/ui/dialog.js +290 -78
  49. package/dist/components/ui/drawer.cjs +220 -39
  50. package/dist/components/ui/drawer.js +220 -39
  51. package/dist/components/ui/dropdown-menu.cjs +376 -73
  52. package/dist/components/ui/dropdown-menu.js +376 -73
  53. package/dist/components/ui/editable-cell.cjs +106 -42
  54. package/dist/components/ui/editable-cell.js +106 -42
  55. package/dist/components/ui/empty-state.cjs +106 -33
  56. package/dist/components/ui/empty-state.js +106 -33
  57. package/dist/components/ui/file-upload.cjs +405 -187
  58. package/dist/components/ui/file-upload.d.ts +3 -1
  59. package/dist/components/ui/file-upload.js +405 -187
  60. package/dist/components/ui/hover-card.cjs +46 -7
  61. package/dist/components/ui/hover-card.js +46 -7
  62. package/dist/components/ui/index.cjs +4 -4
  63. package/dist/components/ui/input.cjs +39 -6
  64. package/dist/components/ui/input.js +39 -6
  65. package/dist/components/ui/label.cjs +34 -5
  66. package/dist/components/ui/label.js +34 -5
  67. package/dist/components/ui/layout/column.cjs +209 -41
  68. package/dist/components/ui/layout/column.js +209 -41
  69. package/dist/components/ui/layout/grid.cjs +275 -60
  70. package/dist/components/ui/layout/grid.js +275 -60
  71. package/dist/components/ui/layout/row.cjs +209 -41
  72. package/dist/components/ui/layout/row.js +209 -41
  73. package/dist/components/ui/menubar.cjs +540 -106
  74. package/dist/components/ui/menubar.js +540 -106
  75. package/dist/components/ui/multi-select.cjs +289 -135
  76. package/dist/components/ui/multi-select.js +289 -135
  77. package/dist/components/ui/navigation-menu.cjs +244 -47
  78. package/dist/components/ui/navigation-menu.js +244 -47
  79. package/dist/components/ui/pagination.cjs +301 -65
  80. package/dist/components/ui/pagination.js +301 -65
  81. package/dist/components/ui/popover.cjs +48 -9
  82. package/dist/components/ui/popover.js +48 -9
  83. package/dist/components/ui/progress.cjs +48 -8
  84. package/dist/components/ui/progress.js +48 -8
  85. package/dist/components/ui/radio-group.cjs +74 -12
  86. package/dist/components/ui/radio-group.js +74 -12
  87. package/dist/components/ui/resizable.cjs +75 -10
  88. package/dist/components/ui/resizable.js +75 -10
  89. package/dist/components/ui/scroll-area.cjs +113 -21
  90. package/dist/components/ui/scroll-area.js +113 -21
  91. package/dist/components/ui/search.cjs +280 -98
  92. package/dist/components/ui/search.js +280 -98
  93. package/dist/components/ui/select.cjs +334 -68
  94. package/dist/components/ui/select.js +334 -68
  95. package/dist/components/ui/separator.cjs +48 -7
  96. package/dist/components/ui/separator.js +48 -7
  97. package/dist/components/ui/sheet.cjs +236 -50
  98. package/dist/components/ui/sheet.js +236 -50
  99. package/dist/components/ui/skeleton.cjs +31 -5
  100. package/dist/components/ui/skeleton.js +31 -5
  101. package/dist/components/ui/slider.cjs +71 -21
  102. package/dist/components/ui/slider.js +71 -21
  103. package/dist/components/ui/sonner.cjs +43 -15
  104. package/dist/components/ui/sonner.js +43 -15
  105. package/dist/components/ui/spinner.cjs +83 -21
  106. package/dist/components/ui/spinner.js +83 -21
  107. package/dist/components/ui/stats-card.cjs +169 -60
  108. package/dist/components/ui/stats-card.js +169 -60
  109. package/dist/components/ui/stepper.cjs +126 -57
  110. package/dist/components/ui/stepper.js +126 -57
  111. package/dist/components/ui/switch.cjs +42 -8
  112. package/dist/components/ui/switch.js +42 -8
  113. package/dist/components/ui/table.cjs +267 -42
  114. package/dist/components/ui/table.js +267 -42
  115. package/dist/components/ui/tabs.cjs +100 -15
  116. package/dist/components/ui/tabs.js +100 -15
  117. package/dist/components/ui/textarea.cjs +34 -5
  118. package/dist/components/ui/textarea.js +34 -5
  119. package/dist/components/ui/toggle-group.cjs +112 -19
  120. package/dist/components/ui/toggle-group.js +112 -19
  121. package/dist/components/ui/toggle.cjs +43 -6
  122. package/dist/components/ui/toggle.js +43 -6
  123. package/dist/components/ui/tooltip.cjs +40 -6
  124. package/dist/components/ui/tooltip.js +40 -6
  125. package/dist/examples/admin-layout-example.cjs +879 -347
  126. package/dist/examples/admin-layout-example.js +879 -347
  127. package/dist/examples/app-shell-example.cjs +14 -14
  128. package/dist/examples/app-shell-example.js +14 -14
  129. package/dist/examples/dashboard-example.cjs +495 -334
  130. package/dist/examples/dashboard-example.js +495 -334
  131. package/dist/examples/data-management-example.cjs +501 -303
  132. package/dist/examples/data-management-example.js +502 -304
  133. package/dist/examples/flow-editor-layout-example.cjs +435 -231
  134. package/dist/examples/flow-editor-layout-example.js +436 -232
  135. package/dist/examples/flow-start-example.cjs +508 -251
  136. package/dist/examples/flow-start-example.js +509 -252
  137. package/dist/examples/form-builder-example.cjs +1006 -602
  138. package/dist/examples/form-builder-example.js +1007 -603
  139. package/dist/examples/new-project-example.cjs +806 -474
  140. package/dist/examples/new-project-example.js +807 -475
  141. package/dist/examples/settings-example.cjs +792 -704
  142. package/dist/examples/settings-example.js +792 -704
  143. package/dist/examples/vscode-example.cjs +731 -236
  144. package/dist/examples/vscode-example.js +731 -236
  145. package/package.json +4 -1
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  FormDesigner: ()=>FormDesigner
28
28
  });
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const compiler_runtime_namespaceObject = require("react/compiler-runtime");
30
31
  const external_react_namespaceObject = require("react");
31
32
  const external_schema_serializer_cjs_namespaceObject = require("./schema-serializer.cjs");
32
33
  const external_metadata_form_cjs_namespaceObject = require("./metadata-form.cjs");
@@ -500,20 +501,47 @@ const createFieldConfigSchema = (field)=>({
500
501
  },
501
502
  actions: []
502
503
  });
503
- function SectionConfigForm({ section, onUpdate, existingSectionIds }) {
504
+ function SectionConfigForm(t0) {
505
+ const $ = (0, compiler_runtime_namespaceObject.c)(28);
506
+ const { section, onUpdate, existingSectionIds } = t0;
504
507
  const [attemptedId, setAttemptedId] = (0, external_react_namespaceObject.useState)(null);
505
- (0, external_react_namespaceObject.useEffect)(()=>{
506
- setAttemptedId(null);
507
- }, [
508
- section.id
509
- ]);
510
- const isDuplicateId = null !== attemptedId && attemptedId !== section.id && existingSectionIds.has(attemptedId);
511
- const schema = (0, external_react_namespaceObject.useMemo)(()=>createSectionConfigSchema(section), [
512
- section
513
- ]);
514
- const plugins = (0, external_react_namespaceObject.useMemo)(()=>[
508
+ let t1;
509
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
510
+ t1 = ()=>{
511
+ setAttemptedId(null);
512
+ };
513
+ $[0] = t1;
514
+ } else t1 = $[0];
515
+ let t2;
516
+ if ($[1] !== section.id) {
517
+ t2 = [
518
+ section.id
519
+ ];
520
+ $[1] = section.id;
521
+ $[2] = t2;
522
+ } else t2 = $[2];
523
+ (0, external_react_namespaceObject.useEffect)(t1, t2);
524
+ let t3;
525
+ if ($[3] !== attemptedId || $[4] !== existingSectionIds || $[5] !== section.id) {
526
+ t3 = null !== attemptedId && attemptedId !== section.id && existingSectionIds.has(attemptedId);
527
+ $[3] = attemptedId;
528
+ $[4] = existingSectionIds;
529
+ $[5] = section.id;
530
+ $[6] = t3;
531
+ } else t3 = $[6];
532
+ const isDuplicateId = t3;
533
+ let t4;
534
+ if ($[7] !== section) {
535
+ t4 = createSectionConfigSchema(section);
536
+ $[7] = section;
537
+ $[8] = t4;
538
+ } else t4 = $[8];
539
+ const schema = t4;
540
+ let t5;
541
+ if ($[9] !== onUpdate) {
542
+ t5 = [
515
543
  {
516
- name: 'section-sync',
544
+ name: "section-sync",
517
545
  onValueChange: (_field, _value, context)=>{
518
546
  const values = context.values;
519
547
  const newId = values.id;
@@ -527,908 +555,1528 @@ function SectionConfigForm({ section, onUpdate, existingSectionIds }) {
527
555
  });
528
556
  }
529
557
  }
530
- ], [
531
- onUpdate
532
- ]);
533
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
534
- className: "space-y-4",
535
- children: [
536
- isDuplicateId && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
537
- className: "flex items-center gap-2 p-2 bg-destructive/10 border border-destructive/20 rounded-md text-destructive text-sm",
538
- children: [
539
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertTriangle, {
540
- className: "h-4 w-4 shrink-0"
541
- }),
542
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
543
- children: [
544
- 'Section ID "',
545
- attemptedId,
546
- '" already exists. Please use a unique ID.'
547
- ]
548
- })
549
- ]
550
- }),
551
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
552
- schema: schema,
553
- plugins: plugins,
554
- autoComplete: "off"
555
- }, section.id),
556
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {}),
557
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
558
- className: "text-sm text-muted-foreground",
559
- children: [
560
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("p", {
561
- children: [
562
- "This section contains ",
563
- section.fields.length,
564
- " field(s)."
565
- ]
566
- }),
567
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
568
- className: "mt-1",
569
- children: "Click on a field in the left panel to configure it."
570
- })
571
- ]
572
- })
573
- ]
574
- });
558
+ ];
559
+ $[9] = onUpdate;
560
+ $[10] = t5;
561
+ } else t5 = $[10];
562
+ const plugins = t5;
563
+ let t6;
564
+ if ($[11] !== attemptedId || $[12] !== isDuplicateId) {
565
+ t6 = isDuplicateId && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
566
+ className: "flex items-center gap-2 p-2 bg-destructive/10 border border-destructive/20 rounded-md text-destructive text-sm",
567
+ children: [
568
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertTriangle, {
569
+ className: "h-4 w-4 shrink-0"
570
+ }),
571
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
572
+ children: [
573
+ 'Section ID "',
574
+ attemptedId,
575
+ '" already exists. Please use a unique ID.'
576
+ ]
577
+ })
578
+ ]
579
+ });
580
+ $[11] = attemptedId;
581
+ $[12] = isDuplicateId;
582
+ $[13] = t6;
583
+ } else t6 = $[13];
584
+ let t7;
585
+ if ($[14] !== plugins || $[15] !== schema || $[16] !== section.id) {
586
+ t7 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
587
+ schema: schema,
588
+ plugins: plugins,
589
+ autoComplete: "off"
590
+ }, section.id);
591
+ $[14] = plugins;
592
+ $[15] = schema;
593
+ $[16] = section.id;
594
+ $[17] = t7;
595
+ } else t7 = $[17];
596
+ let t8;
597
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
598
+ t8 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {});
599
+ $[18] = t8;
600
+ } else t8 = $[18];
601
+ let t9;
602
+ if ($[19] !== section.fields.length) {
603
+ t9 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("p", {
604
+ children: [
605
+ "This section contains ",
606
+ section.fields.length,
607
+ " field(s)."
608
+ ]
609
+ });
610
+ $[19] = section.fields.length;
611
+ $[20] = t9;
612
+ } else t9 = $[20];
613
+ let t10;
614
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
615
+ t10 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
616
+ className: "mt-1",
617
+ children: "Click on a field in the left panel to configure it."
618
+ });
619
+ $[21] = t10;
620
+ } else t10 = $[21];
621
+ let t11;
622
+ if ($[22] !== t9) {
623
+ t11 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
624
+ className: "text-sm text-muted-foreground",
625
+ children: [
626
+ t9,
627
+ t10
628
+ ]
629
+ });
630
+ $[22] = t9;
631
+ $[23] = t11;
632
+ } else t11 = $[23];
633
+ let t12;
634
+ if ($[24] !== t11 || $[25] !== t6 || $[26] !== t7) {
635
+ t12 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
636
+ className: "space-y-4",
637
+ children: [
638
+ t6,
639
+ t7,
640
+ t8,
641
+ t11
642
+ ]
643
+ });
644
+ $[24] = t11;
645
+ $[25] = t6;
646
+ $[26] = t7;
647
+ $[27] = t12;
648
+ } else t12 = $[27];
649
+ return t12;
575
650
  }
576
- function FieldConfigForm({ field, onUpdate, allFields, existingFieldNames }) {
651
+ function FieldConfigForm(t0) {
652
+ const $ = (0, compiler_runtime_namespaceObject.c)(53);
653
+ const { field, onUpdate, allFields, existingFieldNames } = t0;
577
654
  const [attemptedName, setAttemptedName] = (0, external_react_namespaceObject.useState)(null);
578
- (0, external_react_namespaceObject.useEffect)(()=>{
579
- setAttemptedName(null);
580
- }, [
581
- field.id
582
- ]);
583
- const isDuplicateName = null !== attemptedName && attemptedName !== field.name && existingFieldNames.has(attemptedName);
584
- const schema = (0, external_react_namespaceObject.useMemo)(()=>createFieldConfigSchema(field), [
585
- field
586
- ]);
587
- const currentTypeRef = (0, external_react_namespaceObject.useMemo)(()=>({
588
- type: field.type
589
- }), [
590
- field.type
591
- ]);
592
- const plugins = (0, external_react_namespaceObject.useMemo)(()=>[
593
- {
594
- name: 'field-sync',
595
- onValueChange: (_fieldName, _value, context)=>{
596
- const values = context.values;
597
- const newType = values.type;
598
- const newName = values.name;
599
- const validationValues = values.validation;
600
- setAttemptedName(newName);
601
- const updates = {
602
- name: newName,
603
- label: values.label,
604
- type: newType,
605
- placeholder: values.placeholder || void 0,
606
- description: values.description || void 0
607
- };
608
- const requiredMessage = validationValues?.requiredMessage || void 0;
609
- if ('number' === newType || 'slider' === newType) {
610
- updates.min = values.min;
611
- updates.max = values.max;
612
- updates.step = values.step;
613
- updates.validation = {
614
- integer: validationValues?.integer,
615
- requiredMessage
616
- };
617
- } else if ('file' === newType) {
618
- updates.accept = values.accept || void 0;
619
- updates.multiple = values.multiple;
620
- const maxFileSizeMB = validationValues?.maxFileSize;
621
- updates.validation = {
622
- maxFileSize: maxFileSizeMB ? 1024 * maxFileSizeMB * 1024 : void 0,
623
- maxFiles: validationValues?.maxFiles,
624
- requiredMessage
655
+ let t1;
656
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
657
+ t1 = ()=>{
658
+ setAttemptedName(null);
659
+ };
660
+ $[0] = t1;
661
+ } else t1 = $[0];
662
+ let t2;
663
+ if ($[1] !== field.id) {
664
+ t2 = [
665
+ field.id
666
+ ];
667
+ $[1] = field.id;
668
+ $[2] = t2;
669
+ } else t2 = $[2];
670
+ (0, external_react_namespaceObject.useEffect)(t1, t2);
671
+ let t3;
672
+ if ($[3] !== attemptedName || $[4] !== existingFieldNames || $[5] !== field.name) {
673
+ t3 = null !== attemptedName && attemptedName !== field.name && existingFieldNames.has(attemptedName);
674
+ $[3] = attemptedName;
675
+ $[4] = existingFieldNames;
676
+ $[5] = field.name;
677
+ $[6] = t3;
678
+ } else t3 = $[6];
679
+ const isDuplicateName = t3;
680
+ let t4;
681
+ if ($[7] !== field) {
682
+ t4 = createFieldConfigSchema(field);
683
+ $[7] = field;
684
+ $[8] = t4;
685
+ } else t4 = $[8];
686
+ const schema = t4;
687
+ const currentTypeRef = (0, external_react_namespaceObject.useRef)(field.type);
688
+ let t5;
689
+ let t6;
690
+ if ($[9] !== field.type) {
691
+ t5 = ()=>{
692
+ currentTypeRef.current = field.type;
693
+ };
694
+ t6 = [
695
+ field.type
696
+ ];
697
+ $[9] = field.type;
698
+ $[10] = t5;
699
+ $[11] = t6;
700
+ } else {
701
+ t5 = $[10];
702
+ t6 = $[11];
703
+ }
704
+ (0, external_react_namespaceObject.useEffect)(t5, t6);
705
+ let t7;
706
+ if ($[12] !== field.validation?.requiredMessage || $[13] !== onUpdate) {
707
+ field.validation?.requiredMessage;
708
+ t7 = (()=>[
709
+ {
710
+ name: "field-sync",
711
+ onValueChange: (_fieldName, _value, context)=>{
712
+ const values = context.values;
713
+ const newType = values.type;
714
+ const newName = values.name;
715
+ const validationValues = values.validation;
716
+ setAttemptedName(newName);
717
+ const updates = {
718
+ name: newName,
719
+ label: values.label,
720
+ type: newType,
721
+ placeholder: values.placeholder || void 0,
722
+ description: values.description || void 0
625
723
  };
626
- } else if ('text' === newType || 'textarea' === newType || 'email' === newType) updates.validation = {
627
- minLength: validationValues?.minLength,
628
- maxLength: validationValues?.maxLength,
629
- pattern: validationValues?.pattern || void 0,
630
- patternMessage: validationValues?.patternMessage || void 0,
631
- requiredMessage
632
- };
633
- else if (requiredMessage) updates.validation = {
634
- requiredMessage
635
- };
636
- if (newType !== currentTypeRef.type) {
637
- const preservedRequiredMessage = field.validation?.requiredMessage;
638
- updates.options = void 0;
639
- updates.min = void 0;
640
- updates.max = void 0;
641
- updates.step = void 0;
642
- updates.accept = void 0;
643
- updates.multiple = void 0;
644
- updates.validation = void 0;
645
- if ('number' === newType || 'slider' === newType) {
724
+ const requiredMessage = validationValues?.requiredMessage || void 0;
725
+ if ("number" === newType || "slider" === newType) {
646
726
  updates.min = values.min;
647
727
  updates.max = values.max;
648
728
  updates.step = values.step;
649
729
  updates.validation = {
650
730
  integer: validationValues?.integer,
651
- requiredMessage: preservedRequiredMessage
731
+ requiredMessage
652
732
  };
653
- } else if ('file' === newType) {
733
+ } else if ("file" === newType) {
654
734
  updates.accept = values.accept || void 0;
655
735
  updates.multiple = values.multiple;
656
736
  const maxFileSizeMB = validationValues?.maxFileSize;
657
737
  updates.validation = {
658
738
  maxFileSize: maxFileSizeMB ? 1024 * maxFileSizeMB * 1024 : void 0,
659
739
  maxFiles: validationValues?.maxFiles,
660
- requiredMessage: preservedRequiredMessage
740
+ requiredMessage
661
741
  };
662
- } else if ('text' === newType || 'textarea' === newType || 'email' === newType) updates.validation = {
742
+ } else if ("text" === newType || "textarea" === newType || "email" === newType) updates.validation = {
663
743
  minLength: validationValues?.minLength,
664
744
  maxLength: validationValues?.maxLength,
665
745
  pattern: validationValues?.pattern || void 0,
666
746
  patternMessage: validationValues?.patternMessage || void 0,
667
- requiredMessage: preservedRequiredMessage
747
+ requiredMessage
668
748
  };
669
- else if (preservedRequiredMessage) updates.validation = {
670
- requiredMessage: preservedRequiredMessage
749
+ else if (requiredMessage) updates.validation = {
750
+ requiredMessage
671
751
  };
672
- currentTypeRef.type = newType;
752
+ if (newType !== currentTypeRef.current) {
753
+ const preservedRequiredMessage = field.validation?.requiredMessage;
754
+ updates.options = void 0;
755
+ updates.min = void 0;
756
+ updates.max = void 0;
757
+ updates.step = void 0;
758
+ updates.accept = void 0;
759
+ updates.multiple = void 0;
760
+ updates.validation = void 0;
761
+ if ("number" === newType || "slider" === newType) {
762
+ updates.min = values.min;
763
+ updates.max = values.max;
764
+ updates.step = values.step;
765
+ updates.validation = {
766
+ integer: validationValues?.integer,
767
+ requiredMessage: preservedRequiredMessage
768
+ };
769
+ } else if ("file" === newType) {
770
+ updates.accept = values.accept || void 0;
771
+ updates.multiple = values.multiple;
772
+ const maxFileSizeMB_0 = validationValues?.maxFileSize;
773
+ updates.validation = {
774
+ maxFileSize: maxFileSizeMB_0 ? 1024 * maxFileSizeMB_0 * 1024 : void 0,
775
+ maxFiles: validationValues?.maxFiles,
776
+ requiredMessage: preservedRequiredMessage
777
+ };
778
+ } else if ("text" === newType || "textarea" === newType || "email" === newType) updates.validation = {
779
+ minLength: validationValues?.minLength,
780
+ maxLength: validationValues?.maxLength,
781
+ pattern: validationValues?.pattern || void 0,
782
+ patternMessage: validationValues?.patternMessage || void 0,
783
+ requiredMessage: preservedRequiredMessage
784
+ };
785
+ else if (preservedRequiredMessage) updates.validation = {
786
+ requiredMessage: preservedRequiredMessage
787
+ };
788
+ currentTypeRef.current = newType;
789
+ }
790
+ onUpdate(updates);
673
791
  }
674
- onUpdate(updates);
675
792
  }
676
- }
677
- ], [
678
- onUpdate,
679
- currentTypeRef,
680
- field.validation?.requiredMessage
681
- ]);
682
- const needsOptions = [
683
- 'select',
684
- 'multiselect',
685
- 'radio'
686
- ].includes(field.type);
687
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
688
- className: "space-y-2",
689
- children: [
690
- isDuplicateName && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
691
- className: "flex items-center gap-2 p-2 bg-destructive/10 border border-destructive/20 rounded-md text-destructive text-sm",
692
- children: [
693
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertTriangle, {
694
- className: "h-4 w-4 shrink-0"
695
- }),
696
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
697
- children: [
698
- 'Field name "',
699
- attemptedName,
700
- '" already exists. Please use a unique name.'
701
- ]
702
- })
703
- ]
704
- }),
705
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
706
- schema: schema,
707
- plugins: plugins,
708
- autoComplete: "off"
709
- }, field.id),
710
- needsOptions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
711
- type: "multiple",
712
- defaultValue: [
713
- 'options'
714
- ],
715
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
716
- value: "options",
717
- className: "border rounded-lg px-3",
718
- children: [
719
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
720
- className: "text-sm font-medium",
721
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
722
- className: "flex items-center gap-2",
723
- children: [
724
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Database, {
725
- className: "h-4 w-4"
726
- }),
727
- "Options"
728
- ]
729
- })
730
- }),
731
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
732
- className: "pt-2",
733
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FieldOptionsEditor, {
734
- options: field.options || [],
735
- onChange: (options)=>onUpdate({
736
- options
737
- })
738
- })
739
- })
740
- ]
741
- })
742
- }),
743
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
744
- type: "multiple",
745
- defaultValue: [
746
- 'data-source'
747
- ],
748
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
749
- value: "data-source",
750
- className: "border rounded-lg px-3",
751
- children: [
752
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
753
- className: "text-sm font-medium",
754
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
755
- className: "flex items-center gap-2",
756
- children: [
757
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Database, {
758
- className: "h-4 w-4"
759
- }),
760
- "Data source"
761
- ]
762
- })
763
- }),
764
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
765
- className: "pt-2",
766
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DataSourceEditor, {
767
- dataSource: field.dataSource,
768
- onChange: (dataSource)=>onUpdate({
769
- dataSource
770
- })
771
- })
772
- })
773
- ]
774
- })
775
- }),
776
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
777
- type: "multiple",
778
- defaultValue: [
779
- 'rules'
780
- ],
781
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
782
- value: "rules",
783
- className: "border rounded-lg px-3",
793
+ ])();
794
+ $[12] = field.validation?.requiredMessage;
795
+ $[13] = onUpdate;
796
+ $[14] = t7;
797
+ } else t7 = $[14];
798
+ const plugins = t7;
799
+ let t8;
800
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
801
+ t8 = [
802
+ "select",
803
+ "multiselect",
804
+ "radio"
805
+ ];
806
+ $[15] = t8;
807
+ } else t8 = $[15];
808
+ const needsOptions = t8.includes(field.type);
809
+ let t9;
810
+ if ($[16] !== attemptedName || $[17] !== isDuplicateName) {
811
+ t9 = isDuplicateName && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
812
+ className: "flex items-center gap-2 p-2 bg-destructive/10 border border-destructive/20 rounded-md text-destructive text-sm",
813
+ children: [
814
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertTriangle, {
815
+ className: "h-4 w-4 shrink-0"
816
+ }),
817
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
784
818
  children: [
785
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
786
- className: "text-sm font-medium",
787
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
788
- className: "flex items-center gap-2",
789
- children: [
790
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.GitBranch, {
791
- className: "h-4 w-4"
792
- }),
793
- "Rules & conditions"
794
- ]
795
- })
796
- }),
797
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
798
- className: "pt-2",
799
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RulesEditor, {
800
- rules: field.rules,
801
- onChange: (rules)=>onUpdate({
802
- rules
803
- }),
804
- allFields: allFields,
805
- requiredMessage: field.validation?.requiredMessage,
806
- onRequiredMessageChange: (message)=>onUpdate({
807
- validation: {
808
- ...field.validation,
809
- requiredMessage: message
810
- }
811
- })
812
- })
813
- })
819
+ 'Field name "',
820
+ attemptedName,
821
+ '" already exists. Please use a unique name.'
814
822
  ]
815
823
  })
816
- })
817
- ]
818
- });
819
- }
820
- function FormDesigner() {
821
- const [formTitle, setFormTitle] = (0, external_react_namespaceObject.useState)('My Custom Form');
822
- const [formDescription, setFormDescription] = (0, external_react_namespaceObject.useState)('');
823
- const [sections, setSections] = (0, external_react_namespaceObject.useState)([
824
- {
825
- id: 'section-1',
826
- title: 'General Information',
827
- collapsible: false,
828
- defaultExpanded: true,
829
- fields: [
830
- {
831
- id: '1',
832
- name: 'fullName',
833
- type: 'text',
834
- label: 'Full Name',
835
- placeholder: 'Enter your name'
836
- }
837
824
  ]
838
- }
839
- ]);
840
- const [selectedSectionId, setSelectedSectionId] = (0, external_react_namespaceObject.useState)('section-1');
841
- const [selectedFieldId, setSelectedFieldId] = (0, external_react_namespaceObject.useState)('1');
842
- const [expandedSections, setExpandedSections] = (0, external_react_namespaceObject.useState)([
843
- 'section-1'
844
- ]);
845
- const [previewDisabled, setPreviewDisabled] = (0, external_react_namespaceObject.useState)(false);
846
- const allFields = sections.flatMap((s)=>s.fields);
847
- const selectedSection = sections.find((s)=>s.id === selectedSectionId);
848
- const selectedField = allFields.find((f)=>f.id === selectedFieldId);
849
- const generatedSchema = {
850
- id: 'custom-form',
851
- title: formTitle,
852
- description: formDescription || void 0,
853
- mode: 'onChange',
854
- reValidateMode: 'onChange',
855
- sections: sections.map((section)=>({
856
- id: section.id,
857
- title: section.title,
858
- description: section.description,
859
- collapsible: section.collapsible,
860
- defaultExpanded: section.defaultExpanded,
861
- fields: section.fields.map((field)=>{
862
- const { id: _id, validation: _validationConfig, ...fieldMeta } = field;
863
- const validationConfig = buildValidationConfig(field);
864
- return {
865
- ...fieldMeta,
866
- validation: validationConfig
867
- };
868
- })
869
- }))
870
- };
871
- const addSection = ()=>{
872
- const newSection = {
873
- id: `section-${Date.now()}`,
874
- title: `Section ${sections.length + 1}`,
875
- collapsible: true,
876
- defaultExpanded: true,
877
- fields: []
878
- };
879
- setSections([
880
- ...sections,
881
- newSection
882
- ]);
883
- setSelectedSectionId(newSection.id);
884
- setSelectedFieldId(null);
885
- setExpandedSections([
886
- ...expandedSections,
887
- newSection.id
888
- ]);
889
- };
890
- const removeSection = (id)=>{
891
- if (sections.length <= 1) return;
892
- setSections(sections.filter((s)=>s.id !== id));
893
- setExpandedSections(expandedSections.filter((sId)=>sId !== id));
894
- if (selectedSectionId === id) {
895
- setSelectedSectionId(sections[0]?.id || null);
896
- setSelectedFieldId(null);
897
- }
898
- };
899
- const updateSection = (id, updates)=>{
900
- let finalUpdates = updates;
901
- if (updates.id && updates.id !== id) {
902
- const idExists = sections.some((s)=>s.id === updates.id);
903
- if (idExists) {
904
- const { id: _id, ...rest } = updates;
905
- finalUpdates = rest;
906
- }
907
- }
908
- setSections(sections.map((s)=>s.id === id ? {
909
- ...s,
910
- ...finalUpdates
911
- } : s));
912
- if (finalUpdates.id && finalUpdates.id !== id) {
913
- if (selectedSectionId === id) setSelectedSectionId(finalUpdates.id);
914
- setExpandedSections(expandedSections.map((sId)=>sId === id ? finalUpdates.id : sId));
915
- }
916
- };
917
- const moveSection = (id, direction)=>{
918
- const index = sections.findIndex((s)=>s.id === id);
919
- if (-1 === index) return;
920
- const newSections = [
921
- ...sections
922
- ];
923
- if ('up' === direction && index > 0) [newSections[index - 1], newSections[index]] = [
924
- newSections[index],
925
- newSections[index - 1]
926
- ];
927
- else if ('down' === direction && index < sections.length - 1) [newSections[index], newSections[index + 1]] = [
928
- newSections[index + 1],
929
- newSections[index]
930
- ];
931
- setSections(newSections);
932
- };
933
- const addField = (sectionId)=>{
934
- const section = sections.find((s)=>s.id === sectionId);
935
- if (!section) return;
936
- const newField = {
937
- id: Date.now().toString(),
938
- name: `field_${allFields.length + 1}`,
939
- type: 'text',
940
- label: `Field ${allFields.length + 1}`
941
- };
942
- setSections(sections.map((s)=>s.id === sectionId ? {
943
- ...s,
944
- fields: [
945
- ...s.fields,
946
- newField
947
- ]
948
- } : s));
949
- setSelectedSectionId(sectionId);
950
- setSelectedFieldId(newField.id);
951
- };
952
- const removeField = (sectionId, fieldId)=>{
953
- setSections(sections.map((s)=>s.id === sectionId ? {
954
- ...s,
955
- fields: s.fields.filter((f)=>f.id !== fieldId)
956
- } : s));
957
- if (selectedFieldId === fieldId) {
958
- const section = sections.find((s)=>s.id === sectionId);
959
- setSelectedFieldId(section?.fields[0]?.id || null);
960
- }
961
- };
962
- const updateField = (fieldId, updates)=>{
963
- setSections((prevSections)=>{
964
- const prevAllFields = prevSections.flatMap((s)=>s.fields);
965
- let finalUpdates = updates;
966
- if (updates.name) {
967
- const currentField = prevAllFields.find((f)=>f.id === fieldId);
968
- if (currentField && updates.name !== currentField.name) {
969
- const nameExists = prevAllFields.some((f)=>f.id !== fieldId && f.name === updates.name);
970
- if (nameExists) {
971
- const { name: _name, ...rest } = updates;
972
- finalUpdates = rest;
973
- }
974
- }
975
- }
976
- return prevSections.map((s)=>({
977
- ...s,
978
- fields: s.fields.map((f)=>f.id === fieldId ? {
979
- ...f,
980
- ...finalUpdates
981
- } : f)
982
- }));
983
825
  });
984
- };
985
- const moveField = (sectionId, fieldId, direction)=>{
986
- const section = sections.find((s)=>s.id === sectionId);
987
- if (!section) return;
988
- const index = section.fields.findIndex((f)=>f.id === fieldId);
989
- if (-1 === index) return;
990
- const newFields = [
991
- ...section.fields
992
- ];
993
- if ('up' === direction && index > 0) [newFields[index - 1], newFields[index]] = [
994
- newFields[index],
995
- newFields[index - 1]
996
- ];
997
- else if ('down' === direction && index < newFields.length - 1) [newFields[index], newFields[index + 1]] = [
998
- newFields[index + 1],
999
- newFields[index]
1000
- ];
1001
- setSections(sections.map((s)=>s.id === sectionId ? {
1002
- ...s,
1003
- fields: newFields
1004
- } : s));
1005
- };
1006
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(grid_cjs_namespaceObject.Grid, {
1007
- gap: 3,
1008
- h: "screen",
1009
- p: 3,
1010
- className: "lg:grid-cols-[2fr_3fr_3fr]",
1011
- children: [
1012
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.Card, {
1013
- className: "overflow-hidden flex flex-col",
826
+ $[16] = attemptedName;
827
+ $[17] = isDuplicateName;
828
+ $[18] = t9;
829
+ } else t9 = $[18];
830
+ let t10;
831
+ if ($[19] !== field.id || $[20] !== plugins || $[21] !== schema) {
832
+ t10 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
833
+ schema: schema,
834
+ plugins: plugins,
835
+ autoComplete: "off"
836
+ }, field.id);
837
+ $[19] = field.id;
838
+ $[20] = plugins;
839
+ $[21] = schema;
840
+ $[22] = t10;
841
+ } else t10 = $[22];
842
+ let t11;
843
+ if ($[23] !== field.options || $[24] !== needsOptions || $[25] !== onUpdate) {
844
+ t11 = needsOptions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
845
+ type: "multiple",
846
+ defaultValue: [
847
+ "options"
848
+ ],
849
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
850
+ value: "options",
851
+ className: "border rounded-lg px-3",
1014
852
  children: [
1015
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardHeader, {
853
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
854
+ className: "text-sm font-medium",
1016
855
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1017
- className: "flex items-center justify-between",
856
+ className: "flex items-center gap-2",
1018
857
  children: [
1019
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1020
- children: [
1021
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1022
- className: "flex items-center gap-2",
1023
- children: [
1024
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Layers, {
1025
- className: "h-4 w-4"
1026
- }),
1027
- "Sections"
1028
- ]
1029
- }),
1030
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1031
- children: "Organize fields into sections"
1032
- })
1033
- ]
858
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Database, {
859
+ className: "h-4 w-4"
1034
860
  }),
1035
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
1036
- onClick: addSection,
1037
- variant: "outline",
1038
- size: "sm",
1039
- children: [
1040
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
1041
- className: "h-3 w-3 mr-1"
1042
- }),
1043
- "Section"
1044
- ]
1045
- })
861
+ "Options"
1046
862
  ]
1047
863
  })
1048
864
  }),
1049
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardContent, {
1050
- className: "flex-1 overflow-auto px-2 pb-2",
1051
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
1052
- type: "multiple",
1053
- value: expandedSections,
1054
- onValueChange: setExpandedSections,
1055
- className: "space-y-1",
1056
- children: sections.map((section, sectionIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
1057
- value: section.id,
1058
- className: `group/section border rounded-lg ${selectedSectionId === section.id && !selectedFieldId ? 'ring-2 ring-primary' : ''}`,
1059
- children: [
1060
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1061
- className: "flex items-center gap-1 px-2 py-1.5",
1062
- children: [
1063
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
1064
- className: "h-5 w-5 p-0 hover:no-underline hover:bg-accent rounded [&>svg]:hidden flex items-center justify-center shrink-0",
1065
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1066
- className: "flex items-center justify-center",
1067
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
1068
- className: "h-3 w-3 shrink-0 transition-transform duration-200 group-data-[state=open]/section:rotate-90"
1069
- })
1070
- })
1071
- }),
1072
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1073
- className: "flex-1 min-w-0 cursor-pointer flex items-center gap-1",
1074
- onClick: ()=>{
1075
- setSelectedSectionId(section.id);
1076
- setSelectedFieldId(null);
1077
- },
1078
- children: [
1079
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1080
- className: "text-sm font-medium truncate",
1081
- children: section.title
1082
- }),
1083
- section.collapsible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1084
- className: "text-[10px] text-muted-foreground",
1085
- children: "(collapsible)"
1086
- })
1087
- ]
1088
- }),
1089
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1090
- className: "flex gap-0.5 opacity-0 group-hover/section:opacity-100 transition-opacity",
1091
- children: [
1092
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1093
- variant: "ghost",
1094
- size: "sm",
1095
- className: "h-5 w-5 p-0",
1096
- onClick: (e)=>{
1097
- e.stopPropagation();
1098
- moveSection(section.id, 'up');
1099
- },
1100
- disabled: 0 === sectionIndex,
1101
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveUp, {
1102
- className: "h-2.5 w-2.5"
1103
- })
1104
- }),
1105
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1106
- variant: "ghost",
1107
- size: "sm",
1108
- className: "h-5 w-5 p-0",
1109
- onClick: (e)=>{
1110
- e.stopPropagation();
1111
- moveSection(section.id, 'down');
1112
- },
1113
- disabled: sectionIndex === sections.length - 1,
1114
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveDown, {
1115
- className: "h-2.5 w-2.5"
1116
- })
1117
- }),
1118
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1119
- variant: "ghost",
1120
- size: "sm",
1121
- className: "h-5 w-5 p-0",
1122
- onClick: (e)=>{
1123
- e.stopPropagation();
1124
- removeSection(section.id);
1125
- },
1126
- disabled: sections.length <= 1,
1127
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
1128
- className: "h-2.5 w-2.5 text-destructive"
1129
- })
1130
- })
1131
- ]
1132
- })
1133
- ]
1134
- }),
1135
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
1136
- className: "px-2 pb-2 pt-0",
1137
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1138
- className: "space-y-0.5 ml-3 border-l pl-2",
1139
- children: [
1140
- section.fields.map((field, fieldIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1141
- className: `group/field flex items-center gap-1 px-2 py-1 rounded cursor-pointer hover:bg-accent transition-colors ${selectedFieldId === field.id ? 'bg-accent' : ''}`,
1142
- onClick: ()=>{
1143
- setSelectedSectionId(section.id);
1144
- setSelectedFieldId(field.id);
1145
- },
1146
- children: [
1147
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.GripVertical, {
1148
- className: "h-3 w-3 text-muted-foreground opacity-0 group-hover/field:opacity-50"
1149
- }),
1150
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1151
- className: "flex-1 min-w-0",
1152
- children: [
1153
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1154
- className: "flex items-center gap-1",
1155
- children: [
1156
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1157
- className: "text-xs font-medium truncate",
1158
- children: field.label
1159
- }),
1160
- field.rules?.some((r)=>r.effects.required) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1161
- className: "text-[10px] text-destructive",
1162
- children: "*"
1163
- })
1164
- ]
1165
- }),
1166
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
1167
- className: "text-[9px] text-muted-foreground",
1168
- children: field.type
1169
- })
1170
- ]
1171
- }),
1172
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1173
- className: "flex gap-0.5 opacity-0 group-hover/field:opacity-100 transition-opacity",
1174
- children: [
1175
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1176
- variant: "ghost",
1177
- size: "sm",
1178
- className: "h-5 w-5 p-0",
1179
- onClick: (e)=>{
1180
- e.stopPropagation();
1181
- moveField(section.id, field.id, 'up');
1182
- },
1183
- disabled: 0 === fieldIndex,
1184
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveUp, {
1185
- className: "h-2.5 w-2.5"
1186
- })
1187
- }),
1188
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1189
- variant: "ghost",
1190
- size: "sm",
1191
- className: "h-5 w-5 p-0",
1192
- onClick: (e)=>{
1193
- e.stopPropagation();
1194
- moveField(section.id, field.id, 'down');
1195
- },
1196
- disabled: fieldIndex === section.fields.length - 1,
1197
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveDown, {
1198
- className: "h-2.5 w-2.5"
1199
- })
1200
- }),
1201
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1202
- variant: "ghost",
1203
- size: "sm",
1204
- className: "h-5 w-5 p-0",
1205
- onClick: (e)=>{
1206
- e.stopPropagation();
1207
- removeField(section.id, field.id);
1208
- },
1209
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
1210
- className: "h-2.5 w-2.5 text-destructive"
1211
- })
1212
- })
1213
- ]
1214
- })
1215
- ]
1216
- }, field.id)),
1217
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
1218
- onClick: ()=>addField(section.id),
1219
- variant: "outline",
1220
- size: "sm",
1221
- children: [
1222
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
1223
- className: "h-3 w-3 mr-1"
1224
- }),
1225
- "Field"
1226
- ]
1227
- })
1228
- ]
1229
- })
1230
- })
1231
- ]
1232
- }, section.id))
865
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
866
+ className: "pt-2",
867
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FieldOptionsEditor, {
868
+ options: field.options || [],
869
+ onChange: (options)=>onUpdate({
870
+ options
871
+ })
1233
872
  })
1234
873
  })
1235
874
  ]
1236
- }),
1237
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.Card, {
1238
- className: "overflow-hidden flex flex-col",
875
+ })
876
+ });
877
+ $[23] = field.options;
878
+ $[24] = needsOptions;
879
+ $[25] = onUpdate;
880
+ $[26] = t11;
881
+ } else t11 = $[26];
882
+ let t12;
883
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
884
+ t12 = [
885
+ "data-source"
886
+ ];
887
+ $[27] = t12;
888
+ } else t12 = $[27];
889
+ let t13;
890
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
891
+ t13 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
892
+ className: "text-sm font-medium",
893
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
894
+ className: "flex items-center gap-2",
1239
895
  children: [
1240
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardHeader, {
1241
- children: [
1242
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1243
- className: "flex items-center gap-2",
1244
- children: [
1245
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Settings, {
1246
- className: "h-4 w-4"
1247
- }),
1248
- selectedFieldId ? 'Field configuration' : selectedSectionId ? 'Section configuration' : 'Configuration'
1249
- ]
1250
- }),
1251
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1252
- children: selectedField ? `Configure "${selectedField.label}"` : selectedSection ? `Configure "${selectedSection.title}" section` : 'Select a section or field to configure'
1253
- })
1254
- ]
896
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Database, {
897
+ className: "h-4 w-4"
1255
898
  }),
1256
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardContent, {
1257
- className: "flex-1 overflow-auto",
1258
- children: selectedField ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FieldConfigForm, {
1259
- field: selectedField,
1260
- onUpdate: (updates)=>updateField(selectedField.id, updates),
1261
- allFields: allFields,
1262
- existingFieldNames: new Set(allFields.map((f)=>f.name))
1263
- }) : selectedSection ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SectionConfigForm, {
1264
- section: selectedSection,
1265
- onUpdate: (updates)=>updateSection(selectedSection.id, updates),
1266
- existingSectionIds: new Set(sections.map((s)=>s.id))
1267
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
1268
- className: "flex items-center justify-center h-full text-muted-foreground",
1269
- children: "Select a section or field to configure"
899
+ "Data source"
900
+ ]
901
+ })
902
+ });
903
+ $[28] = t13;
904
+ } else t13 = $[28];
905
+ let t14;
906
+ if ($[29] !== onUpdate) {
907
+ t14 = (dataSource)=>onUpdate({
908
+ dataSource
909
+ });
910
+ $[29] = onUpdate;
911
+ $[30] = t14;
912
+ } else t14 = $[30];
913
+ let t15;
914
+ if ($[31] !== field.dataSource || $[32] !== t14) {
915
+ t15 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
916
+ type: "multiple",
917
+ defaultValue: t12,
918
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
919
+ value: "data-source",
920
+ className: "border rounded-lg px-3",
921
+ children: [
922
+ t13,
923
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
924
+ className: "pt-2",
925
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DataSourceEditor, {
926
+ dataSource: field.dataSource,
927
+ onChange: t14
1270
928
  })
1271
929
  })
1272
930
  ]
1273
- }),
1274
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.Card, {
1275
- className: "overflow-hidden flex flex-col",
931
+ })
932
+ });
933
+ $[31] = field.dataSource;
934
+ $[32] = t14;
935
+ $[33] = t15;
936
+ } else t15 = $[33];
937
+ let t16;
938
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
939
+ t16 = [
940
+ "rules"
941
+ ];
942
+ $[34] = t16;
943
+ } else t16 = $[34];
944
+ let t17;
945
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
946
+ t17 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
947
+ className: "text-sm font-medium",
948
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
949
+ className: "flex items-center gap-2",
1276
950
  children: [
1277
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardHeader, {
1278
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1279
- className: "space-y-4",
1280
- children: [
1281
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1282
- children: [
1283
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1284
- className: "flex items-center gap-2",
1285
- children: [
1286
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.View, {
1287
- className: "h-4 w-4"
1288
- }),
1289
- "Preview & export"
1290
- ]
1291
- }),
1292
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1293
- children: "See how your form looks"
1294
- })
1295
- ]
1296
- }),
1297
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1298
- className: "space-y-2",
1299
- children: [
1300
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1301
- htmlFor: "form-title",
1302
- children: "Form title"
1303
- }),
1304
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1305
- id: "form-title",
1306
- value: formTitle,
1307
- onChange: (e)=>setFormTitle(e.target.value)
1308
- })
1309
- ]
1310
- }),
1311
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1312
- className: "space-y-2",
1313
- children: [
1314
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1315
- htmlFor: "form-description",
1316
- children: "Form description"
1317
- }),
1318
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
1319
- id: "form-description",
1320
- value: formDescription,
1321
- onChange: (e)=>setFormDescription(e.target.value),
1322
- placeholder: "Optional description",
1323
- rows: 2
1324
- })
1325
- ]
1326
- })
1327
- ]
1328
- })
951
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.GitBranch, {
952
+ className: "h-4 w-4"
1329
953
  }),
1330
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardContent, {
1331
- className: "flex-1 overflow-auto",
1332
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.Tabs, {
1333
- defaultValue: "preview",
1334
- className: "h-full flex flex-col",
1335
- children: [
1336
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsList, {
1337
- className: "grid w-full grid-cols-2",
1338
- children: [
1339
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsTrigger, {
1340
- value: "preview",
1341
- children: [
1342
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Eye, {
1343
- className: "h-4 w-4 mr-2"
1344
- }),
1345
- "Preview"
1346
- ]
1347
- }),
1348
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsTrigger, {
1349
- value: "code",
1350
- children: [
1351
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Code, {
1352
- className: "h-4 w-4 mr-2"
1353
- }),
1354
- "Schema"
1355
- ]
1356
- })
1357
- ]
1358
- }),
1359
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsContent, {
1360
- value: "preview",
1361
- className: "flex-1 overflow-auto",
1362
- children: [
1363
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1364
- className: "flex items-center justify-end gap-2 mb-4 pb-2 border-b",
1365
- children: [
1366
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1367
- htmlFor: "preview-readonly",
1368
- className: "text-sm text-muted-foreground",
1369
- children: "Readonly"
1370
- }),
1371
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(switch_cjs_namespaceObject.Switch, {
1372
- id: "preview-readonly",
1373
- checked: previewDisabled,
1374
- onCheckedChange: setPreviewDisabled
1375
- })
1376
- ]
1377
- }),
1378
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
1379
- schema: generatedSchema,
1380
- onSubmit: (data)=>{
1381
- console.log('Form submitted:', data);
1382
- alert('Form submitted! Check console for data.');
1383
- },
1384
- disabled: previewDisabled,
1385
- autoComplete: "off"
1386
- }, sections.map((s)=>`${s.id}:${s.collapsible}:${s.defaultExpanded}:${s.fields.map((f)=>`${f.id}:${f.type}:${f.name}:${JSON.stringify(f.rules || [])}:${JSON.stringify(f.validation || {})}`).join('-')}`).join(','))
1387
- ]
1388
- }),
1389
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tabs_cjs_namespaceObject.TabsContent, {
1390
- value: "code",
1391
- className: "flex-1 overflow-auto",
1392
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
1393
- className: "text-xs bg-muted p-4 rounded-lg overflow-auto max-h-full",
1394
- children: (0, external_schema_serializer_cjs_namespaceObject.schemaToJson)(generatedSchema)
1395
- })
1396
- })
1397
- ]
954
+ "Rules & conditions"
955
+ ]
956
+ })
957
+ });
958
+ $[35] = t17;
959
+ } else t17 = $[35];
960
+ let t18;
961
+ if ($[36] !== onUpdate) {
962
+ t18 = (rules)=>onUpdate({
963
+ rules
964
+ });
965
+ $[36] = onUpdate;
966
+ $[37] = t18;
967
+ } else t18 = $[37];
968
+ const t19 = field.validation?.requiredMessage;
969
+ let t20;
970
+ if ($[38] !== field.validation || $[39] !== onUpdate) {
971
+ t20 = (message)=>onUpdate({
972
+ validation: {
973
+ ...field.validation,
974
+ requiredMessage: message
975
+ }
976
+ });
977
+ $[38] = field.validation;
978
+ $[39] = onUpdate;
979
+ $[40] = t20;
980
+ } else t20 = $[40];
981
+ let t21;
982
+ if ($[41] !== allFields || $[42] !== field.rules || $[43] !== t18 || $[44] !== t19 || $[45] !== t20) {
983
+ t21 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
984
+ type: "multiple",
985
+ defaultValue: t16,
986
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
987
+ value: "rules",
988
+ className: "border rounded-lg px-3",
989
+ children: [
990
+ t17,
991
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
992
+ className: "pt-2",
993
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RulesEditor, {
994
+ rules: field.rules,
995
+ onChange: t18,
996
+ allFields: allFields,
997
+ requiredMessage: t19,
998
+ onRequiredMessageChange: t20
1398
999
  })
1399
1000
  })
1400
1001
  ]
1401
1002
  })
1402
- ]
1403
- });
1003
+ });
1004
+ $[41] = allFields;
1005
+ $[42] = field.rules;
1006
+ $[43] = t18;
1007
+ $[44] = t19;
1008
+ $[45] = t20;
1009
+ $[46] = t21;
1010
+ } else t21 = $[46];
1011
+ let t22;
1012
+ if ($[47] !== t10 || $[48] !== t11 || $[49] !== t15 || $[50] !== t21 || $[51] !== t9) {
1013
+ t22 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1014
+ className: "space-y-2",
1015
+ children: [
1016
+ t9,
1017
+ t10,
1018
+ t11,
1019
+ t15,
1020
+ t21
1021
+ ]
1022
+ });
1023
+ $[47] = t10;
1024
+ $[48] = t11;
1025
+ $[49] = t15;
1026
+ $[50] = t21;
1027
+ $[51] = t9;
1028
+ $[52] = t22;
1029
+ } else t22 = $[52];
1030
+ return t22;
1404
1031
  }
1405
- function FieldOptionsEditor({ options, onChange }) {
1406
- const addOption = ()=>{
1407
- onChange([
1408
- ...options,
1032
+ function FormDesigner() {
1033
+ const $ = (0, compiler_runtime_namespaceObject.c)(143);
1034
+ const [formTitle, setFormTitle] = (0, external_react_namespaceObject.useState)("My Custom Form");
1035
+ const [formDescription, setFormDescription] = (0, external_react_namespaceObject.useState)("");
1036
+ let t0;
1037
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1038
+ t0 = [
1409
1039
  {
1410
- label: `Option ${options.length + 1}`,
1411
- value: `option${options.length + 1}`
1040
+ id: "section-1",
1041
+ title: "General Information",
1042
+ collapsible: false,
1043
+ defaultExpanded: true,
1044
+ fields: [
1045
+ {
1046
+ id: "1",
1047
+ name: "fullName",
1048
+ type: "text",
1049
+ label: "Full Name",
1050
+ placeholder: "Enter your name"
1051
+ }
1052
+ ]
1412
1053
  }
1413
- ]);
1414
- };
1415
- const updateOption = (index, updates)=>{
1416
- const newOptions = [
1417
- ...options
1418
1054
  ];
1419
- newOptions[index] = {
1420
- ...newOptions[index],
1421
- ...updates
1055
+ $[0] = t0;
1056
+ } else t0 = $[0];
1057
+ const [sections, setSections] = (0, external_react_namespaceObject.useState)(t0);
1058
+ const [selectedSectionId, setSelectedSectionId] = (0, external_react_namespaceObject.useState)("section-1");
1059
+ const [selectedFieldId, setSelectedFieldId] = (0, external_react_namespaceObject.useState)("1");
1060
+ let t1;
1061
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1062
+ t1 = [
1063
+ "section-1"
1064
+ ];
1065
+ $[1] = t1;
1066
+ } else t1 = $[1];
1067
+ const [expandedSections, setExpandedSections] = (0, external_react_namespaceObject.useState)(t1);
1068
+ const [previewDisabled, setPreviewDisabled] = (0, external_react_namespaceObject.useState)(false);
1069
+ let T0;
1070
+ let T1;
1071
+ let T2;
1072
+ let generatedSchema;
1073
+ let t10;
1074
+ let t2;
1075
+ let t3;
1076
+ let t4;
1077
+ let t5;
1078
+ let t6;
1079
+ let t7;
1080
+ let t8;
1081
+ let t9;
1082
+ if ($[2] !== expandedSections || $[3] !== formDescription || $[4] !== formTitle || $[5] !== sections || $[6] !== selectedFieldId || $[7] !== selectedSectionId) {
1083
+ const allFields = sections.flatMap(_temp);
1084
+ let t11;
1085
+ if ($[21] !== sections || $[22] !== selectedSectionId) {
1086
+ let t12;
1087
+ if ($[24] !== selectedSectionId) {
1088
+ t12 = (s_0)=>s_0.id === selectedSectionId;
1089
+ $[24] = selectedSectionId;
1090
+ $[25] = t12;
1091
+ } else t12 = $[25];
1092
+ t11 = sections.find(t12);
1093
+ $[21] = sections;
1094
+ $[22] = selectedSectionId;
1095
+ $[23] = t11;
1096
+ } else t11 = $[23];
1097
+ const selectedSection = t11;
1098
+ let t12;
1099
+ if ($[26] !== selectedFieldId) {
1100
+ t12 = (f)=>f.id === selectedFieldId;
1101
+ $[26] = selectedFieldId;
1102
+ $[27] = t12;
1103
+ } else t12 = $[27];
1104
+ const selectedField = allFields.find(t12);
1105
+ const t13 = formDescription || void 0;
1106
+ let t14;
1107
+ if ($[28] !== sections) {
1108
+ t14 = sections.map(_temp3);
1109
+ $[28] = sections;
1110
+ $[29] = t14;
1111
+ } else t14 = $[29];
1112
+ let t15;
1113
+ if ($[30] !== formTitle || $[31] !== t13 || $[32] !== t14) {
1114
+ t15 = {
1115
+ id: "custom-form",
1116
+ title: formTitle,
1117
+ description: t13,
1118
+ mode: "onChange",
1119
+ reValidateMode: "onChange",
1120
+ sections: t14
1121
+ };
1122
+ $[30] = formTitle;
1123
+ $[31] = t13;
1124
+ $[32] = t14;
1125
+ $[33] = t15;
1126
+ } else t15 = $[33];
1127
+ generatedSchema = t15;
1128
+ let t16;
1129
+ if ($[34] !== expandedSections || $[35] !== sections) {
1130
+ t16 = ()=>{
1131
+ const newSection = {
1132
+ id: `section-${Date.now()}`,
1133
+ title: `Section ${sections.length + 1}`,
1134
+ collapsible: true,
1135
+ defaultExpanded: true,
1136
+ fields: []
1137
+ };
1138
+ setSections([
1139
+ ...sections,
1140
+ newSection
1141
+ ]);
1142
+ setSelectedSectionId(newSection.id);
1143
+ setSelectedFieldId(null);
1144
+ setExpandedSections([
1145
+ ...expandedSections,
1146
+ newSection.id
1147
+ ]);
1148
+ };
1149
+ $[34] = expandedSections;
1150
+ $[35] = sections;
1151
+ $[36] = t16;
1152
+ } else t16 = $[36];
1153
+ const addSection = t16;
1154
+ let t17;
1155
+ if ($[37] !== expandedSections || $[38] !== sections || $[39] !== selectedSectionId) {
1156
+ t17 = (id)=>{
1157
+ if (sections.length <= 1) return;
1158
+ setSections(sections.filter((s_1)=>s_1.id !== id));
1159
+ setExpandedSections(expandedSections.filter((sId)=>sId !== id));
1160
+ if (selectedSectionId === id) {
1161
+ setSelectedSectionId(sections[0]?.id || null);
1162
+ setSelectedFieldId(null);
1163
+ }
1164
+ };
1165
+ $[37] = expandedSections;
1166
+ $[38] = sections;
1167
+ $[39] = selectedSectionId;
1168
+ $[40] = t17;
1169
+ } else t17 = $[40];
1170
+ const removeSection = t17;
1171
+ let t18;
1172
+ if ($[41] !== expandedSections || $[42] !== sections || $[43] !== selectedSectionId) {
1173
+ t18 = (id_0, updates)=>{
1174
+ let finalUpdates = updates;
1175
+ if (updates.id && updates.id !== id_0) {
1176
+ const idExists = sections.some((s_2)=>s_2.id === updates.id);
1177
+ if (idExists) {
1178
+ const { id: _id_0, ...rest } = updates;
1179
+ finalUpdates = rest;
1180
+ }
1181
+ }
1182
+ setSections(sections.map((s_3)=>s_3.id === id_0 ? {
1183
+ ...s_3,
1184
+ ...finalUpdates
1185
+ } : s_3));
1186
+ if (finalUpdates.id && finalUpdates.id !== id_0) {
1187
+ if (selectedSectionId === id_0) setSelectedSectionId(finalUpdates.id);
1188
+ setExpandedSections(expandedSections.map((sId_0)=>sId_0 === id_0 ? finalUpdates.id : sId_0));
1189
+ }
1190
+ };
1191
+ $[41] = expandedSections;
1192
+ $[42] = sections;
1193
+ $[43] = selectedSectionId;
1194
+ $[44] = t18;
1195
+ } else t18 = $[44];
1196
+ const updateSection = t18;
1197
+ let t19;
1198
+ if ($[45] !== sections) {
1199
+ t19 = (id_1, direction)=>{
1200
+ const index = sections.findIndex((s_4)=>s_4.id === id_1);
1201
+ if (-1 === index) return;
1202
+ const newSections = [
1203
+ ...sections
1204
+ ];
1205
+ if ("up" === direction && index > 0) {
1206
+ const [t20, t21] = [
1207
+ newSections[index],
1208
+ newSections[index - 1]
1209
+ ];
1210
+ newSections[index - 1] = t20;
1211
+ newSections[index] = t21;
1212
+ } else if ("down" === direction && index < sections.length - 1) {
1213
+ const [t22, t23] = [
1214
+ newSections[index + 1],
1215
+ newSections[index]
1216
+ ];
1217
+ newSections[index] = t22;
1218
+ newSections[index + 1] = t23;
1219
+ }
1220
+ setSections(newSections);
1221
+ };
1222
+ $[45] = sections;
1223
+ $[46] = t19;
1224
+ } else t19 = $[46];
1225
+ const moveSection = t19;
1226
+ const addField = (sectionId)=>{
1227
+ const section_0 = sections.find((s_5)=>s_5.id === sectionId);
1228
+ if (!section_0) return;
1229
+ const newField = {
1230
+ id: Date.now().toString(),
1231
+ name: `field_${allFields.length + 1}`,
1232
+ type: "text",
1233
+ label: `Field ${allFields.length + 1}`
1234
+ };
1235
+ setSections(sections.map((s_6)=>s_6.id === sectionId ? {
1236
+ ...s_6,
1237
+ fields: [
1238
+ ...s_6.fields,
1239
+ newField
1240
+ ]
1241
+ } : s_6));
1242
+ setSelectedSectionId(sectionId);
1243
+ setSelectedFieldId(newField.id);
1422
1244
  };
1423
- onChange(newOptions);
1245
+ let t20;
1246
+ if ($[47] !== sections || $[48] !== selectedFieldId) {
1247
+ t20 = (sectionId_0, fieldId)=>{
1248
+ setSections(sections.map((s_7)=>s_7.id === sectionId_0 ? {
1249
+ ...s_7,
1250
+ fields: s_7.fields.filter((f_0)=>f_0.id !== fieldId)
1251
+ } : s_7));
1252
+ if (selectedFieldId === fieldId) {
1253
+ const section_1 = sections.find((s_8)=>s_8.id === sectionId_0);
1254
+ setSelectedFieldId(section_1?.fields[0]?.id || null);
1255
+ }
1256
+ };
1257
+ $[47] = sections;
1258
+ $[48] = selectedFieldId;
1259
+ $[49] = t20;
1260
+ } else t20 = $[49];
1261
+ const removeField = t20;
1262
+ let t21;
1263
+ if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
1264
+ t21 = (fieldId_0, updates_0)=>{
1265
+ setSections((prevSections)=>{
1266
+ const prevAllFields = prevSections.flatMap(_temp4);
1267
+ let finalUpdates_0 = updates_0;
1268
+ if (updates_0.name) {
1269
+ const currentField = prevAllFields.find((f_1)=>f_1.id === fieldId_0);
1270
+ if (currentField && updates_0.name !== currentField.name) {
1271
+ const nameExists = prevAllFields.some((f_2)=>f_2.id !== fieldId_0 && f_2.name === updates_0.name);
1272
+ if (nameExists) {
1273
+ const { name: _name, ...rest_0 } = updates_0;
1274
+ finalUpdates_0 = rest_0;
1275
+ }
1276
+ }
1277
+ }
1278
+ return prevSections.map((s_10)=>({
1279
+ ...s_10,
1280
+ fields: s_10.fields.map((f_3)=>f_3.id === fieldId_0 ? {
1281
+ ...f_3,
1282
+ ...finalUpdates_0
1283
+ } : f_3)
1284
+ }));
1285
+ });
1286
+ };
1287
+ $[50] = t21;
1288
+ } else t21 = $[50];
1289
+ const updateField = t21;
1290
+ let t22;
1291
+ if ($[51] !== sections) {
1292
+ t22 = (sectionId_1, fieldId_1, direction_0)=>{
1293
+ const section_2 = sections.find((s_11)=>s_11.id === sectionId_1);
1294
+ if (!section_2) return;
1295
+ const index_0 = section_2.fields.findIndex((f_4)=>f_4.id === fieldId_1);
1296
+ if (-1 === index_0) return;
1297
+ const newFields = [
1298
+ ...section_2.fields
1299
+ ];
1300
+ if ("up" === direction_0 && index_0 > 0) {
1301
+ const [t23, t24] = [
1302
+ newFields[index_0],
1303
+ newFields[index_0 - 1]
1304
+ ];
1305
+ newFields[index_0 - 1] = t23;
1306
+ newFields[index_0] = t24;
1307
+ } else if ("down" === direction_0 && index_0 < newFields.length - 1) {
1308
+ const [t25, t26] = [
1309
+ newFields[index_0 + 1],
1310
+ newFields[index_0]
1311
+ ];
1312
+ newFields[index_0] = t25;
1313
+ newFields[index_0 + 1] = t26;
1314
+ }
1315
+ setSections(sections.map((s_12)=>s_12.id === sectionId_1 ? {
1316
+ ...s_12,
1317
+ fields: newFields
1318
+ } : s_12));
1319
+ };
1320
+ $[51] = sections;
1321
+ $[52] = t22;
1322
+ } else t22 = $[52];
1323
+ const moveField = t22;
1324
+ T2 = grid_cjs_namespaceObject.Grid;
1325
+ t6 = 3;
1326
+ t7 = "screen";
1327
+ t8 = 3;
1328
+ t9 = "lg:grid-cols-[2fr_3fr_3fr]";
1329
+ let t23;
1330
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
1331
+ t23 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1332
+ children: [
1333
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1334
+ className: "flex items-center gap-2",
1335
+ children: [
1336
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Layers, {
1337
+ className: "h-4 w-4"
1338
+ }),
1339
+ "Sections"
1340
+ ]
1341
+ }),
1342
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1343
+ children: "Organize fields into sections"
1344
+ })
1345
+ ]
1346
+ });
1347
+ $[53] = t23;
1348
+ } else t23 = $[53];
1349
+ let t24;
1350
+ if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
1351
+ t24 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
1352
+ className: "h-3 w-3 mr-1"
1353
+ });
1354
+ $[54] = t24;
1355
+ } else t24 = $[54];
1356
+ let t25;
1357
+ if ($[55] !== addSection) {
1358
+ t25 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardHeader, {
1359
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1360
+ className: "flex items-center justify-between",
1361
+ children: [
1362
+ t23,
1363
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
1364
+ onClick: addSection,
1365
+ variant: "outline",
1366
+ size: "sm",
1367
+ children: [
1368
+ t24,
1369
+ "Section"
1370
+ ]
1371
+ })
1372
+ ]
1373
+ })
1374
+ });
1375
+ $[55] = addSection;
1376
+ $[56] = t25;
1377
+ } else t25 = $[56];
1378
+ let t26;
1379
+ if ($[57] !== addField || $[58] !== moveField || $[59] !== moveSection || $[60] !== removeField || $[61] !== removeSection || $[62] !== sections || $[63] !== selectedFieldId || $[64] !== selectedSectionId) {
1380
+ let t27;
1381
+ if ($[66] !== addField || $[67] !== moveField || $[68] !== moveSection || $[69] !== removeField || $[70] !== removeSection || $[71] !== sections.length || $[72] !== selectedFieldId || $[73] !== selectedSectionId) {
1382
+ t27 = (section_3, sectionIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(accordion_cjs_namespaceObject.AccordionItem, {
1383
+ value: section_3.id,
1384
+ className: `group/section border rounded-lg ${selectedSectionId === section_3.id && !selectedFieldId ? "ring-2 ring-primary" : ""}`,
1385
+ children: [
1386
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1387
+ className: "flex items-center gap-1 px-2 py-1.5",
1388
+ children: [
1389
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionTrigger, {
1390
+ className: "h-5 w-5 p-0 hover:no-underline hover:bg-accent rounded [&>svg]:hidden flex items-center justify-center shrink-0",
1391
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1392
+ className: "flex items-center justify-center",
1393
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
1394
+ className: "h-3 w-3 shrink-0 transition-transform duration-200 group-data-[state=open]/section:rotate-90"
1395
+ })
1396
+ })
1397
+ }),
1398
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1399
+ className: "flex-1 min-w-0 cursor-pointer flex items-center gap-1",
1400
+ onClick: ()=>{
1401
+ setSelectedSectionId(section_3.id);
1402
+ setSelectedFieldId(null);
1403
+ },
1404
+ children: [
1405
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1406
+ className: "text-sm font-medium truncate",
1407
+ children: section_3.title
1408
+ }),
1409
+ section_3.collapsible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1410
+ className: "text-[10px] text-muted-foreground",
1411
+ children: "(collapsible)"
1412
+ })
1413
+ ]
1414
+ }),
1415
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1416
+ className: "flex gap-0.5 opacity-0 group-hover/section:opacity-100 transition-opacity",
1417
+ children: [
1418
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1419
+ variant: "ghost",
1420
+ size: "sm",
1421
+ className: "h-5 w-5 p-0",
1422
+ onClick: (e)=>{
1423
+ e.stopPropagation();
1424
+ moveSection(section_3.id, "up");
1425
+ },
1426
+ disabled: 0 === sectionIndex,
1427
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveUp, {
1428
+ className: "h-2.5 w-2.5"
1429
+ })
1430
+ }),
1431
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1432
+ variant: "ghost",
1433
+ size: "sm",
1434
+ className: "h-5 w-5 p-0",
1435
+ onClick: (e_0)=>{
1436
+ e_0.stopPropagation();
1437
+ moveSection(section_3.id, "down");
1438
+ },
1439
+ disabled: sectionIndex === sections.length - 1,
1440
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveDown, {
1441
+ className: "h-2.5 w-2.5"
1442
+ })
1443
+ }),
1444
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1445
+ variant: "ghost",
1446
+ size: "sm",
1447
+ className: "h-5 w-5 p-0",
1448
+ onClick: (e_1)=>{
1449
+ e_1.stopPropagation();
1450
+ removeSection(section_3.id);
1451
+ },
1452
+ disabled: sections.length <= 1,
1453
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
1454
+ className: "h-2.5 w-2.5 text-destructive"
1455
+ })
1456
+ })
1457
+ ]
1458
+ })
1459
+ ]
1460
+ }),
1461
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.AccordionContent, {
1462
+ className: "px-2 pb-2 pt-0",
1463
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1464
+ className: "space-y-0.5 ml-3 border-l pl-2",
1465
+ children: [
1466
+ section_3.fields.map((field_0, fieldIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1467
+ className: `group/field flex items-center gap-1 px-2 py-1 rounded cursor-pointer hover:bg-accent transition-colors ${selectedFieldId === field_0.id ? "bg-accent" : ""}`,
1468
+ onClick: ()=>{
1469
+ setSelectedSectionId(section_3.id);
1470
+ setSelectedFieldId(field_0.id);
1471
+ },
1472
+ children: [
1473
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.GripVertical, {
1474
+ className: "h-3 w-3 text-muted-foreground opacity-0 group-hover/field:opacity-50"
1475
+ }),
1476
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1477
+ className: "flex-1 min-w-0",
1478
+ children: [
1479
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1480
+ className: "flex items-center gap-1",
1481
+ children: [
1482
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1483
+ className: "text-xs font-medium truncate",
1484
+ children: field_0.label
1485
+ }),
1486
+ field_0.rules?.some(_temp5) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
1487
+ className: "text-[10px] text-destructive",
1488
+ children: "*"
1489
+ })
1490
+ ]
1491
+ }),
1492
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
1493
+ className: "text-[9px] text-muted-foreground",
1494
+ children: field_0.type
1495
+ })
1496
+ ]
1497
+ }),
1498
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1499
+ className: "flex gap-0.5 opacity-0 group-hover/field:opacity-100 transition-opacity",
1500
+ children: [
1501
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1502
+ variant: "ghost",
1503
+ size: "sm",
1504
+ className: "h-5 w-5 p-0",
1505
+ onClick: (e_2)=>{
1506
+ e_2.stopPropagation();
1507
+ moveField(section_3.id, field_0.id, "up");
1508
+ },
1509
+ disabled: 0 === fieldIndex,
1510
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveUp, {
1511
+ className: "h-2.5 w-2.5"
1512
+ })
1513
+ }),
1514
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1515
+ variant: "ghost",
1516
+ size: "sm",
1517
+ className: "h-5 w-5 p-0",
1518
+ onClick: (e_3)=>{
1519
+ e_3.stopPropagation();
1520
+ moveField(section_3.id, field_0.id, "down");
1521
+ },
1522
+ disabled: fieldIndex === section_3.fields.length - 1,
1523
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.MoveDown, {
1524
+ className: "h-2.5 w-2.5"
1525
+ })
1526
+ }),
1527
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
1528
+ variant: "ghost",
1529
+ size: "sm",
1530
+ className: "h-5 w-5 p-0",
1531
+ onClick: (e_4)=>{
1532
+ e_4.stopPropagation();
1533
+ removeField(section_3.id, field_0.id);
1534
+ },
1535
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
1536
+ className: "h-2.5 w-2.5 text-destructive"
1537
+ })
1538
+ })
1539
+ ]
1540
+ })
1541
+ ]
1542
+ }, field_0.id)),
1543
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
1544
+ onClick: ()=>addField(section_3.id),
1545
+ variant: "outline",
1546
+ size: "sm",
1547
+ children: [
1548
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
1549
+ className: "h-3 w-3 mr-1"
1550
+ }),
1551
+ "Field"
1552
+ ]
1553
+ })
1554
+ ]
1555
+ })
1556
+ })
1557
+ ]
1558
+ }, section_3.id);
1559
+ $[66] = addField;
1560
+ $[67] = moveField;
1561
+ $[68] = moveSection;
1562
+ $[69] = removeField;
1563
+ $[70] = removeSection;
1564
+ $[71] = sections.length;
1565
+ $[72] = selectedFieldId;
1566
+ $[73] = selectedSectionId;
1567
+ $[74] = t27;
1568
+ } else t27 = $[74];
1569
+ t26 = sections.map(t27);
1570
+ $[57] = addField;
1571
+ $[58] = moveField;
1572
+ $[59] = moveSection;
1573
+ $[60] = removeField;
1574
+ $[61] = removeSection;
1575
+ $[62] = sections;
1576
+ $[63] = selectedFieldId;
1577
+ $[64] = selectedSectionId;
1578
+ $[65] = t26;
1579
+ } else t26 = $[65];
1580
+ let t27;
1581
+ if ($[75] !== expandedSections || $[76] !== t26) {
1582
+ t27 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardContent, {
1583
+ className: "flex-1 overflow-auto px-2 pb-2",
1584
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(accordion_cjs_namespaceObject.Accordion, {
1585
+ type: "multiple",
1586
+ value: expandedSections,
1587
+ onValueChange: setExpandedSections,
1588
+ className: "space-y-1",
1589
+ children: t26
1590
+ })
1591
+ });
1592
+ $[75] = expandedSections;
1593
+ $[76] = t26;
1594
+ $[77] = t27;
1595
+ } else t27 = $[77];
1596
+ if ($[78] !== t25 || $[79] !== t27) {
1597
+ t10 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.Card, {
1598
+ className: "overflow-hidden flex flex-col",
1599
+ children: [
1600
+ t25,
1601
+ t27
1602
+ ]
1603
+ });
1604
+ $[78] = t25;
1605
+ $[79] = t27;
1606
+ $[80] = t10;
1607
+ } else t10 = $[80];
1608
+ T1 = card_cjs_namespaceObject.Card;
1609
+ t4 = "overflow-hidden flex flex-col";
1610
+ let t28;
1611
+ if ($[81] === Symbol.for("react.memo_cache_sentinel")) {
1612
+ t28 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Settings, {
1613
+ className: "h-4 w-4"
1614
+ });
1615
+ $[81] = t28;
1616
+ } else t28 = $[81];
1617
+ const t29 = selectedFieldId ? "Field configuration" : selectedSectionId ? "Section configuration" : "Configuration";
1618
+ let t30;
1619
+ if ($[82] !== t29) {
1620
+ t30 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1621
+ className: "flex items-center gap-2",
1622
+ children: [
1623
+ t28,
1624
+ t29
1625
+ ]
1626
+ });
1627
+ $[82] = t29;
1628
+ $[83] = t30;
1629
+ } else t30 = $[83];
1630
+ const t31 = selectedField ? `Configure "${selectedField.label}"` : selectedSection ? `Configure "${selectedSection.title}" section` : "Select a section or field to configure";
1631
+ let t32;
1632
+ if ($[84] !== t31) {
1633
+ t32 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1634
+ children: t31
1635
+ });
1636
+ $[84] = t31;
1637
+ $[85] = t32;
1638
+ } else t32 = $[85];
1639
+ if ($[86] !== t30 || $[87] !== t32) {
1640
+ t5 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardHeader, {
1641
+ children: [
1642
+ t30,
1643
+ t32
1644
+ ]
1645
+ });
1646
+ $[86] = t30;
1647
+ $[87] = t32;
1648
+ $[88] = t5;
1649
+ } else t5 = $[88];
1650
+ T0 = card_cjs_namespaceObject.CardContent;
1651
+ t2 = "flex-1 overflow-auto";
1652
+ t3 = selectedField ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FieldConfigForm, {
1653
+ field: selectedField,
1654
+ onUpdate: (updates_1)=>updateField(selectedField.id, updates_1),
1655
+ allFields: allFields,
1656
+ existingFieldNames: new Set(allFields.map(_temp6))
1657
+ }) : selectedSection ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SectionConfigForm, {
1658
+ section: selectedSection,
1659
+ onUpdate: (updates_2)=>updateSection(selectedSection.id, updates_2),
1660
+ existingSectionIds: new Set(sections.map(_temp7))
1661
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
1662
+ className: "flex items-center justify-center h-full text-muted-foreground",
1663
+ children: "Select a section or field to configure"
1664
+ });
1665
+ $[2] = expandedSections;
1666
+ $[3] = formDescription;
1667
+ $[4] = formTitle;
1668
+ $[5] = sections;
1669
+ $[6] = selectedFieldId;
1670
+ $[7] = selectedSectionId;
1671
+ $[8] = T0;
1672
+ $[9] = T1;
1673
+ $[10] = T2;
1674
+ $[11] = generatedSchema;
1675
+ $[12] = t10;
1676
+ $[13] = t2;
1677
+ $[14] = t3;
1678
+ $[15] = t4;
1679
+ $[16] = t5;
1680
+ $[17] = t6;
1681
+ $[18] = t7;
1682
+ $[19] = t8;
1683
+ $[20] = t9;
1684
+ } else {
1685
+ T0 = $[8];
1686
+ T1 = $[9];
1687
+ T2 = $[10];
1688
+ generatedSchema = $[11];
1689
+ t10 = $[12];
1690
+ t2 = $[13];
1691
+ t3 = $[14];
1692
+ t4 = $[15];
1693
+ t5 = $[16];
1694
+ t6 = $[17];
1695
+ t7 = $[18];
1696
+ t8 = $[19];
1697
+ t9 = $[20];
1698
+ }
1699
+ let t11;
1700
+ if ($[89] !== T0 || $[90] !== t2 || $[91] !== t3) {
1701
+ t11 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(T0, {
1702
+ className: t2,
1703
+ children: t3
1704
+ });
1705
+ $[89] = T0;
1706
+ $[90] = t2;
1707
+ $[91] = t3;
1708
+ $[92] = t11;
1709
+ } else t11 = $[92];
1710
+ let t12;
1711
+ if ($[93] !== T1 || $[94] !== t11 || $[95] !== t4 || $[96] !== t5) {
1712
+ t12 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(T1, {
1713
+ className: t4,
1714
+ children: [
1715
+ t5,
1716
+ t11
1717
+ ]
1718
+ });
1719
+ $[93] = T1;
1720
+ $[94] = t11;
1721
+ $[95] = t4;
1722
+ $[96] = t5;
1723
+ $[97] = t12;
1724
+ } else t12 = $[97];
1725
+ let t13;
1726
+ if ($[98] === Symbol.for("react.memo_cache_sentinel")) {
1727
+ t13 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1728
+ children: [
1729
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.CardTitle, {
1730
+ className: "flex items-center gap-2",
1731
+ children: [
1732
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.View, {
1733
+ className: "h-4 w-4"
1734
+ }),
1735
+ "Preview & export"
1736
+ ]
1737
+ }),
1738
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardDescription, {
1739
+ children: "See how your form looks"
1740
+ })
1741
+ ]
1742
+ });
1743
+ $[98] = t13;
1744
+ } else t13 = $[98];
1745
+ let t14;
1746
+ if ($[99] === Symbol.for("react.memo_cache_sentinel")) {
1747
+ t14 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1748
+ htmlFor: "form-title",
1749
+ children: "Form title"
1750
+ });
1751
+ $[99] = t14;
1752
+ } else t14 = $[99];
1753
+ let t15;
1754
+ if ($[100] === Symbol.for("react.memo_cache_sentinel")) {
1755
+ t15 = (e_5)=>setFormTitle(e_5.target.value);
1756
+ $[100] = t15;
1757
+ } else t15 = $[100];
1758
+ let t16;
1759
+ if ($[101] !== formTitle) {
1760
+ t16 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1761
+ className: "space-y-2",
1762
+ children: [
1763
+ t14,
1764
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1765
+ id: "form-title",
1766
+ value: formTitle,
1767
+ onChange: t15
1768
+ })
1769
+ ]
1770
+ });
1771
+ $[101] = formTitle;
1772
+ $[102] = t16;
1773
+ } else t16 = $[102];
1774
+ let t17;
1775
+ if ($[103] === Symbol.for("react.memo_cache_sentinel")) {
1776
+ t17 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1777
+ htmlFor: "form-description",
1778
+ children: "Form description"
1779
+ });
1780
+ $[103] = t17;
1781
+ } else t17 = $[103];
1782
+ let t18;
1783
+ if ($[104] === Symbol.for("react.memo_cache_sentinel")) {
1784
+ t18 = (e_6)=>setFormDescription(e_6.target.value);
1785
+ $[104] = t18;
1786
+ } else t18 = $[104];
1787
+ let t19;
1788
+ if ($[105] !== formDescription) {
1789
+ t19 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1790
+ className: "space-y-2",
1791
+ children: [
1792
+ t17,
1793
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
1794
+ id: "form-description",
1795
+ value: formDescription,
1796
+ onChange: t18,
1797
+ placeholder: "Optional description",
1798
+ rows: 2
1799
+ })
1800
+ ]
1801
+ });
1802
+ $[105] = formDescription;
1803
+ $[106] = t19;
1804
+ } else t19 = $[106];
1805
+ let t20;
1806
+ if ($[107] !== t16 || $[108] !== t19) {
1807
+ t20 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardHeader, {
1808
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1809
+ className: "space-y-4",
1810
+ children: [
1811
+ t13,
1812
+ t16,
1813
+ t19
1814
+ ]
1815
+ })
1816
+ });
1817
+ $[107] = t16;
1818
+ $[108] = t19;
1819
+ $[109] = t20;
1820
+ } else t20 = $[109];
1821
+ let t21;
1822
+ if ($[110] === Symbol.for("react.memo_cache_sentinel")) {
1823
+ t21 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsTrigger, {
1824
+ value: "preview",
1825
+ children: [
1826
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Eye, {
1827
+ className: "h-4 w-4 mr-2"
1828
+ }),
1829
+ "Preview"
1830
+ ]
1831
+ });
1832
+ $[110] = t21;
1833
+ } else t21 = $[110];
1834
+ let t22;
1835
+ if ($[111] === Symbol.for("react.memo_cache_sentinel")) {
1836
+ t22 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsList, {
1837
+ className: "grid w-full grid-cols-2",
1838
+ children: [
1839
+ t21,
1840
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsTrigger, {
1841
+ value: "code",
1842
+ children: [
1843
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Code, {
1844
+ className: "h-4 w-4 mr-2"
1845
+ }),
1846
+ "Schema"
1847
+ ]
1848
+ })
1849
+ ]
1850
+ });
1851
+ $[111] = t22;
1852
+ } else t22 = $[111];
1853
+ let t23;
1854
+ if ($[112] === Symbol.for("react.memo_cache_sentinel")) {
1855
+ t23 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1856
+ htmlFor: "preview-readonly",
1857
+ className: "text-sm text-muted-foreground",
1858
+ children: "Readonly"
1859
+ });
1860
+ $[112] = t23;
1861
+ } else t23 = $[112];
1862
+ let t24;
1863
+ if ($[113] !== previewDisabled) {
1864
+ t24 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1865
+ className: "flex items-center justify-end gap-2 mb-4 pb-2 border-b",
1866
+ children: [
1867
+ t23,
1868
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(switch_cjs_namespaceObject.Switch, {
1869
+ id: "preview-readonly",
1870
+ checked: previewDisabled,
1871
+ onCheckedChange: setPreviewDisabled
1872
+ })
1873
+ ]
1874
+ });
1875
+ $[113] = previewDisabled;
1876
+ $[114] = t24;
1877
+ } else t24 = $[114];
1878
+ let t25;
1879
+ if ($[115] !== sections) {
1880
+ t25 = sections.map(_temp9).join(",");
1881
+ $[115] = sections;
1882
+ $[116] = t25;
1883
+ } else t25 = $[116];
1884
+ let t26;
1885
+ if ($[117] !== generatedSchema || $[118] !== previewDisabled || $[119] !== t25) {
1886
+ t26 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_metadata_form_cjs_namespaceObject.MetadataForm, {
1887
+ schema: generatedSchema,
1888
+ onSubmit: _temp0,
1889
+ disabled: previewDisabled,
1890
+ autoComplete: "off"
1891
+ }, t25);
1892
+ $[117] = generatedSchema;
1893
+ $[118] = previewDisabled;
1894
+ $[119] = t25;
1895
+ $[120] = t26;
1896
+ } else t26 = $[120];
1897
+ let t27;
1898
+ if ($[121] !== t24 || $[122] !== t26) {
1899
+ t27 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.TabsContent, {
1900
+ value: "preview",
1901
+ className: "flex-1 overflow-auto",
1902
+ children: [
1903
+ t24,
1904
+ t26
1905
+ ]
1906
+ });
1907
+ $[121] = t24;
1908
+ $[122] = t26;
1909
+ $[123] = t27;
1910
+ } else t27 = $[123];
1911
+ let t28;
1912
+ if ($[124] !== generatedSchema) {
1913
+ t28 = (0, external_schema_serializer_cjs_namespaceObject.schemaToJson)(generatedSchema);
1914
+ $[124] = generatedSchema;
1915
+ $[125] = t28;
1916
+ } else t28 = $[125];
1917
+ let t29;
1918
+ if ($[126] !== t28) {
1919
+ t29 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tabs_cjs_namespaceObject.TabsContent, {
1920
+ value: "code",
1921
+ className: "flex-1 overflow-auto",
1922
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
1923
+ className: "text-xs bg-muted p-4 rounded-lg overflow-auto max-h-full",
1924
+ children: t28
1925
+ })
1926
+ });
1927
+ $[126] = t28;
1928
+ $[127] = t29;
1929
+ } else t29 = $[127];
1930
+ let t30;
1931
+ if ($[128] !== t27 || $[129] !== t29) {
1932
+ t30 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(card_cjs_namespaceObject.CardContent, {
1933
+ className: "flex-1 overflow-auto",
1934
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tabs_cjs_namespaceObject.Tabs, {
1935
+ defaultValue: "preview",
1936
+ className: "h-full flex flex-col",
1937
+ children: [
1938
+ t22,
1939
+ t27,
1940
+ t29
1941
+ ]
1942
+ })
1943
+ });
1944
+ $[128] = t27;
1945
+ $[129] = t29;
1946
+ $[130] = t30;
1947
+ } else t30 = $[130];
1948
+ let t31;
1949
+ if ($[131] !== t20 || $[132] !== t30) {
1950
+ t31 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(card_cjs_namespaceObject.Card, {
1951
+ className: "overflow-hidden flex flex-col",
1952
+ children: [
1953
+ t20,
1954
+ t30
1955
+ ]
1956
+ });
1957
+ $[131] = t20;
1958
+ $[132] = t30;
1959
+ $[133] = t31;
1960
+ } else t31 = $[133];
1961
+ let t32;
1962
+ if ($[134] !== T2 || $[135] !== t10 || $[136] !== t12 || $[137] !== t31 || $[138] !== t6 || $[139] !== t7 || $[140] !== t8 || $[141] !== t9) {
1963
+ t32 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(T2, {
1964
+ gap: t6,
1965
+ h: t7,
1966
+ p: t8,
1967
+ className: t9,
1968
+ children: [
1969
+ t10,
1970
+ t12,
1971
+ t31
1972
+ ]
1973
+ });
1974
+ $[134] = T2;
1975
+ $[135] = t10;
1976
+ $[136] = t12;
1977
+ $[137] = t31;
1978
+ $[138] = t6;
1979
+ $[139] = t7;
1980
+ $[140] = t8;
1981
+ $[141] = t9;
1982
+ $[142] = t32;
1983
+ } else t32 = $[142];
1984
+ return t32;
1985
+ }
1986
+ function _temp0(data) {
1987
+ console.log("Form submitted:", data);
1988
+ alert("Form submitted! Check console for data.");
1989
+ }
1990
+ function _temp9(s_14) {
1991
+ return `${s_14.id}:${s_14.collapsible}:${s_14.defaultExpanded}:${s_14.fields.map(_temp8).join("-")}`;
1992
+ }
1993
+ function _temp8(f_6) {
1994
+ return `${f_6.id}:${f_6.type}:${f_6.name}:${JSON.stringify(f_6.rules || [])}:${JSON.stringify(f_6.validation || {})}`;
1995
+ }
1996
+ function _temp7(s_13) {
1997
+ return s_13.id;
1998
+ }
1999
+ function _temp6(f_5) {
2000
+ return f_5.name;
2001
+ }
2002
+ function _temp5(r) {
2003
+ return r.effects.required;
2004
+ }
2005
+ function _temp4(s_9) {
2006
+ return s_9.fields;
2007
+ }
2008
+ function _temp3(section) {
2009
+ return {
2010
+ id: section.id,
2011
+ title: section.title,
2012
+ description: section.description,
2013
+ collapsible: section.collapsible,
2014
+ defaultExpanded: section.defaultExpanded,
2015
+ fields: section.fields.map(_temp2)
1424
2016
  };
1425
- const removeOption = (index)=>{
1426
- onChange(options.filter((_, i)=>i !== index));
2017
+ }
2018
+ function _temp2(field) {
2019
+ const { id: _id, validation: _validationConfig, ...fieldMeta } = field;
2020
+ const validationConfig = buildValidationConfig(field);
2021
+ return {
2022
+ ...fieldMeta,
2023
+ validation: validationConfig
1427
2024
  };
1428
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1429
- className: "space-y-3",
1430
- children: [
1431
- options.map((option, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2025
+ }
2026
+ function _temp(s) {
2027
+ return s.fields;
2028
+ }
2029
+ function FieldOptionsEditor(t0) {
2030
+ const $ = (0, compiler_runtime_namespaceObject.c)(22);
2031
+ const { options, onChange } = t0;
2032
+ let t1;
2033
+ if ($[0] !== onChange || $[1] !== options) {
2034
+ t1 = ()=>{
2035
+ onChange([
2036
+ ...options,
2037
+ {
2038
+ label: `Option ${options.length + 1}`,
2039
+ value: `option${options.length + 1}`
2040
+ }
2041
+ ]);
2042
+ };
2043
+ $[0] = onChange;
2044
+ $[1] = options;
2045
+ $[2] = t1;
2046
+ } else t1 = $[2];
2047
+ const addOption = t1;
2048
+ let t2;
2049
+ if ($[3] !== onChange || $[4] !== options) {
2050
+ t2 = (index, updates)=>{
2051
+ const newOptions = [
2052
+ ...options
2053
+ ];
2054
+ newOptions[index] = {
2055
+ ...newOptions[index],
2056
+ ...updates
2057
+ };
2058
+ onChange(newOptions);
2059
+ };
2060
+ $[3] = onChange;
2061
+ $[4] = options;
2062
+ $[5] = t2;
2063
+ } else t2 = $[5];
2064
+ const updateOption = t2;
2065
+ let t3;
2066
+ if ($[6] !== onChange || $[7] !== options) {
2067
+ t3 = (index_0)=>{
2068
+ onChange(options.filter((_, i)=>i !== index_0));
2069
+ };
2070
+ $[6] = onChange;
2071
+ $[7] = options;
2072
+ $[8] = t3;
2073
+ } else t3 = $[8];
2074
+ const removeOption = t3;
2075
+ let t4;
2076
+ if ($[9] !== options || $[10] !== removeOption || $[11] !== updateOption) {
2077
+ let t5;
2078
+ if ($[13] !== removeOption || $[14] !== updateOption) {
2079
+ t5 = (option, index_1)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1432
2080
  className: "flex gap-2 items-center",
1433
2081
  children: [
1434
2082
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
@@ -1437,15 +2085,15 @@ function FieldOptionsEditor({ options, onChange }) {
1437
2085
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1438
2086
  placeholder: "Label",
1439
2087
  value: option.label,
1440
- onChange: (e)=>updateOption(index, {
2088
+ onChange: (e)=>updateOption(index_1, {
1441
2089
  label: e.target.value
1442
2090
  })
1443
2091
  }),
1444
2092
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1445
2093
  placeholder: "Value",
1446
2094
  value: option.value,
1447
- onChange: (e)=>updateOption(index, {
1448
- value: e.target.value
2095
+ onChange: (e_0)=>updateOption(index_1, {
2096
+ value: e_0.target.value
1449
2097
  })
1450
2098
  })
1451
2099
  ]
@@ -1454,213 +2102,311 @@ function FieldOptionsEditor({ options, onChange }) {
1454
2102
  variant: "ghost",
1455
2103
  size: "icon",
1456
2104
  className: "h-8 w-8 text-muted-foreground hover:text-destructive",
1457
- onClick: ()=>removeOption(index),
2105
+ onClick: ()=>removeOption(index_1),
1458
2106
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
1459
2107
  className: "h-4 w-4"
1460
2108
  })
1461
2109
  })
1462
2110
  ]
1463
- }, index)),
1464
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
1465
- onClick: addOption,
1466
- variant: "outline",
1467
- size: "sm",
1468
- className: "w-full",
1469
- children: [
1470
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
1471
- className: "h-3 w-3 mr-2"
1472
- }),
1473
- "Add option"
1474
- ]
1475
- })
1476
- ]
1477
- });
2111
+ }, index_1);
2112
+ $[13] = removeOption;
2113
+ $[14] = updateOption;
2114
+ $[15] = t5;
2115
+ } else t5 = $[15];
2116
+ t4 = options.map(t5);
2117
+ $[9] = options;
2118
+ $[10] = removeOption;
2119
+ $[11] = updateOption;
2120
+ $[12] = t4;
2121
+ } else t4 = $[12];
2122
+ let t5;
2123
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
2124
+ t5 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
2125
+ className: "h-3 w-3 mr-2"
2126
+ });
2127
+ $[16] = t5;
2128
+ } else t5 = $[16];
2129
+ let t6;
2130
+ if ($[17] !== addOption) {
2131
+ t6 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
2132
+ onClick: addOption,
2133
+ variant: "outline",
2134
+ size: "sm",
2135
+ className: "w-full",
2136
+ children: [
2137
+ t5,
2138
+ "Add option"
2139
+ ]
2140
+ });
2141
+ $[17] = addOption;
2142
+ $[18] = t6;
2143
+ } else t6 = $[18];
2144
+ let t7;
2145
+ if ($[19] !== t4 || $[20] !== t6) {
2146
+ t7 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2147
+ className: "space-y-3",
2148
+ children: [
2149
+ t4,
2150
+ t6
2151
+ ]
2152
+ });
2153
+ $[19] = t4;
2154
+ $[20] = t6;
2155
+ $[21] = t7;
2156
+ } else t7 = $[21];
2157
+ return t7;
1478
2158
  }
1479
- function DataSourceEditor({ dataSource, onChange }) {
1480
- const [sourceType, setSourceType] = (0, external_react_namespaceObject.useState)(dataSource?.type || 'none');
1481
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1482
- className: "space-y-4",
1483
- children: [
1484
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1485
- className: "space-y-2",
1486
- children: [
1487
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1488
- children: "Data source type"
1489
- }),
1490
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
1491
- value: sourceType,
1492
- onValueChange: (value)=>{
1493
- setSourceType(value);
1494
- if ('none' === value) onChange(void 0);
1495
- else if ('static' === value) onChange({
1496
- type: 'static',
1497
- options: []
1498
- });
1499
- else if ('fetch' === value) onChange({
1500
- type: 'fetch',
1501
- url: '',
1502
- method: 'GET'
1503
- });
1504
- else if ('remote' === value) onChange({
1505
- type: 'remote',
1506
- endpoint: '',
1507
- params: {}
1508
- });
1509
- else if ('computed' === value) onChange({
1510
- type: 'computed',
1511
- dependency: [],
1512
- compute: ''
1513
- });
1514
- },
1515
- children: [
1516
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
1517
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
1518
- }),
1519
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.SelectContent, {
1520
- children: [
1521
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
1522
- value: "none",
1523
- children: "None"
1524
- }),
1525
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
1526
- value: "fetch",
1527
- children: "Fetch (single request)"
1528
- }),
1529
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
1530
- value: "remote",
1531
- children: "Remote (dependent)"
1532
- }),
1533
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
1534
- value: "computed",
1535
- children: "Computed"
1536
- })
1537
- ]
1538
- })
1539
- ]
1540
- })
1541
- ]
1542
- }),
1543
- 'fetch' === sourceType && dataSource?.type === 'fetch' && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1544
- className: "space-y-3",
1545
- children: [
1546
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1547
- className: "space-y-2",
1548
- children: [
1549
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1550
- children: "API URL"
1551
- }),
1552
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1553
- placeholder: "/api/data",
1554
- value: dataSource.url,
1555
- onChange: (e)=>onChange({
1556
- ...dataSource,
1557
- url: e.target.value
1558
- })
1559
- })
1560
- ]
1561
- }),
1562
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1563
- className: "space-y-2",
1564
- children: [
1565
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1566
- children: "Transform"
1567
- }),
1568
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
1569
- placeholder: "data.map(item => ({ label: item.name, value: item.id }))",
1570
- value: dataSource.transform || '',
1571
- onChange: (e)=>onChange({
1572
- ...dataSource,
1573
- transform: e.target.value
1574
- }),
1575
- rows: 2
1576
- })
1577
- ]
1578
- })
1579
- ]
1580
- }),
1581
- 'remote' === sourceType && dataSource?.type === 'remote' && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1582
- className: "space-y-3",
1583
- children: [
1584
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1585
- className: "space-y-2",
1586
- children: [
1587
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1588
- children: "Endpoint"
1589
- }),
1590
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1591
- placeholder: "/api/data",
1592
- value: dataSource.endpoint,
1593
- onChange: (e)=>onChange({
1594
- ...dataSource,
1595
- endpoint: e.target.value
1596
- })
1597
- })
1598
- ]
1599
- }),
1600
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1601
- className: "space-y-2",
1602
- children: [
1603
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1604
- children: "Parameters (JSON)"
1605
- }),
1606
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
1607
- placeholder: '{ "fieldName": "$otherField" }',
1608
- value: JSON.stringify(dataSource.params || {}, null, 2),
1609
- onChange: (e)=>{
1610
- try {
1611
- const params = JSON.parse(e.target.value);
1612
- onChange({
1613
- ...dataSource,
1614
- params
1615
- });
1616
- } catch {}
1617
- },
1618
- rows: 3
1619
- })
1620
- ]
1621
- })
1622
- ]
1623
- }),
1624
- 'computed' === sourceType && dataSource?.type === 'computed' && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1625
- className: "space-y-3",
1626
- children: [
1627
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1628
- className: "space-y-2",
1629
- children: [
1630
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1631
- children: "Dependencies (comma-separated)"
1632
- }),
1633
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
1634
- placeholder: "field1, field2",
1635
- value: dataSource.dependency.join(', '),
1636
- onChange: (e)=>onChange({
1637
- ...dataSource,
1638
- dependency: e.target.value.split(',').map((s)=>s.trim())
1639
- })
1640
- })
1641
- ]
1642
- }),
1643
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1644
- className: "space-y-2",
1645
- children: [
1646
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1647
- children: "Compute expression"
1648
- }),
1649
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
1650
- placeholder: "(field1 || 0) * (field2 || 0)",
1651
- value: dataSource.compute,
1652
- onChange: (e)=>onChange({
2159
+ function DataSourceEditor(t0) {
2160
+ const $ = (0, compiler_runtime_namespaceObject.c)(25);
2161
+ const { dataSource, onChange } = t0;
2162
+ const [sourceType, setSourceType] = (0, external_react_namespaceObject.useState)(dataSource?.type || "none");
2163
+ let t1;
2164
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2165
+ t1 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2166
+ children: "Data source type"
2167
+ });
2168
+ $[0] = t1;
2169
+ } else t1 = $[0];
2170
+ let t2;
2171
+ if ($[1] !== onChange) {
2172
+ t2 = (value)=>{
2173
+ setSourceType(value);
2174
+ if ("none" === value) onChange(void 0);
2175
+ else if ("static" === value) onChange({
2176
+ type: "static",
2177
+ options: []
2178
+ });
2179
+ else if ("fetch" === value) onChange({
2180
+ type: "fetch",
2181
+ url: "",
2182
+ method: "GET"
2183
+ });
2184
+ else if ("remote" === value) onChange({
2185
+ type: "remote",
2186
+ endpoint: "",
2187
+ params: {}
2188
+ });
2189
+ else if ("computed" === value) onChange({
2190
+ type: "computed",
2191
+ dependency: [],
2192
+ compute: ""
2193
+ });
2194
+ };
2195
+ $[1] = onChange;
2196
+ $[2] = t2;
2197
+ } else t2 = $[2];
2198
+ let t3;
2199
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2200
+ t3 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2201
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
2202
+ });
2203
+ $[3] = t3;
2204
+ } else t3 = $[3];
2205
+ let t4;
2206
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2207
+ t4 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.SelectContent, {
2208
+ children: [
2209
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2210
+ value: "none",
2211
+ children: "None"
2212
+ }),
2213
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2214
+ value: "fetch",
2215
+ children: "Fetch (single request)"
2216
+ }),
2217
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2218
+ value: "remote",
2219
+ children: "Remote (dependent)"
2220
+ }),
2221
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2222
+ value: "computed",
2223
+ children: "Computed"
2224
+ })
2225
+ ]
2226
+ });
2227
+ $[4] = t4;
2228
+ } else t4 = $[4];
2229
+ let t5;
2230
+ if ($[5] !== sourceType || $[6] !== t2) {
2231
+ t5 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2232
+ className: "space-y-2",
2233
+ children: [
2234
+ t1,
2235
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2236
+ value: sourceType,
2237
+ onValueChange: t2,
2238
+ children: [
2239
+ t3,
2240
+ t4
2241
+ ]
2242
+ })
2243
+ ]
2244
+ });
2245
+ $[5] = sourceType;
2246
+ $[6] = t2;
2247
+ $[7] = t5;
2248
+ } else t5 = $[7];
2249
+ let t6;
2250
+ if ($[8] !== dataSource || $[9] !== onChange || $[10] !== sourceType) {
2251
+ t6 = "fetch" === sourceType && dataSource?.type === "fetch" && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2252
+ className: "space-y-3",
2253
+ children: [
2254
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2255
+ className: "space-y-2",
2256
+ children: [
2257
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2258
+ children: "API URL"
2259
+ }),
2260
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2261
+ placeholder: "/api/data",
2262
+ value: dataSource.url,
2263
+ onChange: (e)=>onChange({
2264
+ ...dataSource,
2265
+ url: e.target.value
2266
+ })
2267
+ })
2268
+ ]
2269
+ }),
2270
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2271
+ className: "space-y-2",
2272
+ children: [
2273
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2274
+ children: "Transform"
2275
+ }),
2276
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
2277
+ placeholder: "data.map(item => ({ label: item.name, value: item.id }))",
2278
+ value: dataSource.transform || "",
2279
+ onChange: (e_0)=>onChange({
2280
+ ...dataSource,
2281
+ transform: e_0.target.value
2282
+ }),
2283
+ rows: 2
2284
+ })
2285
+ ]
2286
+ })
2287
+ ]
2288
+ });
2289
+ $[8] = dataSource;
2290
+ $[9] = onChange;
2291
+ $[10] = sourceType;
2292
+ $[11] = t6;
2293
+ } else t6 = $[11];
2294
+ let t7;
2295
+ if ($[12] !== dataSource || $[13] !== onChange || $[14] !== sourceType) {
2296
+ t7 = "remote" === sourceType && dataSource?.type === "remote" && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2297
+ className: "space-y-3",
2298
+ children: [
2299
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2300
+ className: "space-y-2",
2301
+ children: [
2302
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2303
+ children: "Endpoint"
2304
+ }),
2305
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2306
+ placeholder: "/api/data",
2307
+ value: dataSource.endpoint,
2308
+ onChange: (e_1)=>onChange({
2309
+ ...dataSource,
2310
+ endpoint: e_1.target.value
2311
+ })
2312
+ })
2313
+ ]
2314
+ }),
2315
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2316
+ className: "space-y-2",
2317
+ children: [
2318
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2319
+ children: "Parameters (JSON)"
2320
+ }),
2321
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
2322
+ placeholder: "{ \"fieldName\": \"$otherField\" }",
2323
+ value: JSON.stringify(dataSource.params || {}, null, 2),
2324
+ onChange: (e_2)=>{
2325
+ try {
2326
+ const params = JSON.parse(e_2.target.value);
2327
+ onChange({
1653
2328
  ...dataSource,
1654
- compute: e.target.value
1655
- }),
1656
- rows: 2
1657
- })
1658
- ]
1659
- })
1660
- ]
1661
- })
1662
- ]
1663
- });
2329
+ params
2330
+ });
2331
+ } catch {}
2332
+ },
2333
+ rows: 3
2334
+ })
2335
+ ]
2336
+ })
2337
+ ]
2338
+ });
2339
+ $[12] = dataSource;
2340
+ $[13] = onChange;
2341
+ $[14] = sourceType;
2342
+ $[15] = t7;
2343
+ } else t7 = $[15];
2344
+ let t8;
2345
+ if ($[16] !== dataSource || $[17] !== onChange || $[18] !== sourceType) {
2346
+ t8 = "computed" === sourceType && dataSource?.type === "computed" && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2347
+ className: "space-y-3",
2348
+ children: [
2349
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2350
+ className: "space-y-2",
2351
+ children: [
2352
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2353
+ children: "Dependencies (comma-separated)"
2354
+ }),
2355
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2356
+ placeholder: "field1, field2",
2357
+ value: dataSource.dependency.join(", "),
2358
+ onChange: (e_3)=>onChange({
2359
+ ...dataSource,
2360
+ dependency: e_3.target.value.split(",").map(_temp1)
2361
+ })
2362
+ })
2363
+ ]
2364
+ }),
2365
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2366
+ className: "space-y-2",
2367
+ children: [
2368
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2369
+ children: "Compute expression"
2370
+ }),
2371
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(textarea_cjs_namespaceObject.Textarea, {
2372
+ placeholder: "(field1 || 0) * (field2 || 0)",
2373
+ value: dataSource.compute,
2374
+ onChange: (e_4)=>onChange({
2375
+ ...dataSource,
2376
+ compute: e_4.target.value
2377
+ }),
2378
+ rows: 2
2379
+ })
2380
+ ]
2381
+ })
2382
+ ]
2383
+ });
2384
+ $[16] = dataSource;
2385
+ $[17] = onChange;
2386
+ $[18] = sourceType;
2387
+ $[19] = t8;
2388
+ } else t8 = $[19];
2389
+ let t9;
2390
+ if ($[20] !== t5 || $[21] !== t6 || $[22] !== t7 || $[23] !== t8) {
2391
+ t9 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2392
+ className: "space-y-4",
2393
+ children: [
2394
+ t5,
2395
+ t6,
2396
+ t7,
2397
+ t8
2398
+ ]
2399
+ });
2400
+ $[20] = t5;
2401
+ $[21] = t6;
2402
+ $[22] = t7;
2403
+ $[23] = t8;
2404
+ $[24] = t9;
2405
+ } else t9 = $[24];
2406
+ return t9;
2407
+ }
2408
+ function _temp1(s) {
2409
+ return s.trim();
1664
2410
  }
1665
2411
  const CONDITION_OPERATORS = [
1666
2412
  {
@@ -1719,96 +2465,135 @@ const RULE_EFFECTS = [
1719
2465
  color: 'text-gray-600 bg-gray-50 border-gray-200'
1720
2466
  }
1721
2467
  ];
1722
- function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequiredMessageChange }) {
2468
+ function RulesEditor(t0) {
2469
+ const $ = (0, compiler_runtime_namespaceObject.c)(34);
2470
+ const { rules: t1, onChange, allFields, requiredMessage, onRequiredMessageChange } = t0;
2471
+ const rules = void 0 === t1 ? [] : t1;
1723
2472
  const [isAddingRule, setIsAddingRule] = (0, external_react_namespaceObject.useState)(false);
1724
2473
  const [editingRuleIndex, setEditingRuleIndex] = (0, external_react_namespaceObject.useState)(null);
1725
- const [selectedEffect, setSelectedEffect] = (0, external_react_namespaceObject.useState)('show');
1726
- const [conditions, setConditions] = (0, external_react_namespaceObject.useState)([
1727
- {
1728
- field: '',
1729
- operator: 'is',
1730
- value: ''
1731
- }
1732
- ]);
1733
- const [conditionOperator, setConditionOperator] = (0, external_react_namespaceObject.useState)('AND');
1734
- const isAlwaysRequired = rules.some((r)=>true === r.effects.required && 0 === r.conditions.length);
1735
- const resetBuilder = ()=>{
1736
- setSelectedEffect('show');
1737
- setConditions([
1738
- {
1739
- field: '',
1740
- operator: 'is',
1741
- value: ''
1742
- }
1743
- ]);
1744
- setConditionOperator('AND');
1745
- setIsAddingRule(false);
1746
- setEditingRuleIndex(null);
1747
- };
1748
- const addCondition = ()=>{
1749
- setConditions([
1750
- ...conditions,
2474
+ const [selectedEffect, setSelectedEffect] = (0, external_react_namespaceObject.useState)("show");
2475
+ let t2;
2476
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2477
+ t2 = [
1751
2478
  {
1752
- field: '',
1753
- operator: 'is',
1754
- value: ''
2479
+ field: "",
2480
+ operator: "is",
2481
+ value: ""
1755
2482
  }
1756
- ]);
1757
- };
1758
- const updateCondition = (index, updates)=>{
1759
- const newConditions = [
1760
- ...conditions
1761
2483
  ];
1762
- newConditions[index] = {
1763
- ...newConditions[index],
1764
- ...updates
2484
+ $[0] = t2;
2485
+ } else t2 = $[0];
2486
+ const [conditions, setConditions] = (0, external_react_namespaceObject.useState)(t2);
2487
+ const [conditionOperator, setConditionOperator] = (0, external_react_namespaceObject.useState)("AND");
2488
+ const isAlwaysRequired = rules.some(_temp10);
2489
+ let t3;
2490
+ if ($[1] !== setConditionOperator || $[2] !== setIsAddingRule || $[3] !== setSelectedEffect) {
2491
+ t3 = ()=>{
2492
+ setSelectedEffect("show");
2493
+ setConditions([
2494
+ {
2495
+ field: "",
2496
+ operator: "is",
2497
+ value: ""
2498
+ }
2499
+ ]);
2500
+ setConditionOperator("AND");
2501
+ setIsAddingRule(false);
2502
+ setEditingRuleIndex(null);
1765
2503
  };
1766
- setConditions(newConditions);
1767
- };
1768
- const removeCondition = (index)=>{
1769
- if (conditions.length > 1) setConditions(conditions.filter((_, i)=>i !== index));
1770
- };
1771
- const buildCondition = (cond)=>{
1772
- const condition = {
1773
- when: cond.field
2504
+ $[1] = setConditionOperator;
2505
+ $[2] = setIsAddingRule;
2506
+ $[3] = setSelectedEffect;
2507
+ $[4] = t3;
2508
+ } else t3 = $[4];
2509
+ const resetBuilder = t3;
2510
+ let t4;
2511
+ if ($[5] !== conditions) {
2512
+ t4 = ()=>{
2513
+ setConditions([
2514
+ ...conditions,
2515
+ {
2516
+ field: "",
2517
+ operator: "is",
2518
+ value: ""
2519
+ }
2520
+ ]);
1774
2521
  };
1775
- const targetField = allFields.find((f)=>f.name === cond.field);
1776
- const isNumericField = targetField?.type === 'number' || targetField?.type === 'slider';
1777
- const isBooleanField = targetField?.type === 'checkbox' || targetField?.type === 'switch';
1778
- const parseValue = (val)=>{
1779
- if (isBooleanField) {
1780
- if ('true' === val.toLowerCase()) return true;
1781
- if ('false' === val.toLowerCase()) return false;
1782
- }
1783
- if (isNumericField) {
1784
- const num = Number(val);
1785
- if (!isNaN(num)) return num;
2522
+ $[5] = conditions;
2523
+ $[6] = t4;
2524
+ } else t4 = $[6];
2525
+ const addCondition = t4;
2526
+ let t5;
2527
+ if ($[7] !== conditions) {
2528
+ t5 = (index, updates)=>{
2529
+ const newConditions = [
2530
+ ...conditions
2531
+ ];
2532
+ newConditions[index] = {
2533
+ ...newConditions[index],
2534
+ ...updates
2535
+ };
2536
+ setConditions(newConditions);
2537
+ };
2538
+ $[7] = conditions;
2539
+ $[8] = t5;
2540
+ } else t5 = $[8];
2541
+ const updateCondition = t5;
2542
+ let t6;
2543
+ if ($[9] !== conditions) {
2544
+ t6 = (index_0)=>{
2545
+ if (conditions.length > 1) setConditions(conditions.filter((_, i)=>i !== index_0));
2546
+ };
2547
+ $[9] = conditions;
2548
+ $[10] = t6;
2549
+ } else t6 = $[10];
2550
+ const removeCondition = t6;
2551
+ let t7;
2552
+ if ($[11] !== allFields) {
2553
+ t7 = (cond)=>{
2554
+ const condition = {
2555
+ when: cond.field
2556
+ };
2557
+ const targetField = allFields.find((f)=>f.name === cond.field);
2558
+ const isNumericField = targetField?.type === "number" || targetField?.type === "slider";
2559
+ const isBooleanField = targetField?.type === "checkbox" || targetField?.type === "switch";
2560
+ const parseValue = (val)=>{
2561
+ if (isBooleanField) {
2562
+ if ("true" === val.toLowerCase()) return true;
2563
+ if ("false" === val.toLowerCase()) return false;
2564
+ }
2565
+ if (isNumericField) {
2566
+ const num = Number(val);
2567
+ if (!isNaN(num)) return num;
2568
+ }
2569
+ if ("true" === val.toLowerCase()) return true;
2570
+ if ("false" === val.toLowerCase()) return false;
2571
+ return val;
2572
+ };
2573
+ switch(cond.operator){
2574
+ case "is":
2575
+ condition.is = parseValue(cond.value);
2576
+ break;
2577
+ case "isNot":
2578
+ condition.isNot = parseValue(cond.value);
2579
+ break;
2580
+ case "in":
2581
+ condition.in = cond.value.split(",").map((v_0)=>parseValue(v_0.trim()));
2582
+ break;
2583
+ case "notIn":
2584
+ condition.notIn = cond.value.split(",").map((v)=>parseValue(v.trim()));
2585
+ break;
2586
+ case "matches":
2587
+ condition.matches = cond.value;
1786
2588
  }
1787
- if ('true' === val.toLowerCase()) return true;
1788
- if ('false' === val.toLowerCase()) return false;
1789
- return val;
2589
+ return condition;
1790
2590
  };
1791
- switch(cond.operator){
1792
- case 'is':
1793
- condition.is = parseValue(cond.value);
1794
- break;
1795
- case 'isNot':
1796
- condition.isNot = parseValue(cond.value);
1797
- break;
1798
- case 'in':
1799
- condition.in = cond.value.split(',').map((v)=>parseValue(v.trim()));
1800
- break;
1801
- case 'notIn':
1802
- condition.notIn = cond.value.split(',').map((v)=>parseValue(v.trim()));
1803
- break;
1804
- case 'matches':
1805
- condition.matches = cond.value;
1806
- break;
1807
- }
1808
- return condition;
1809
- };
2591
+ $[11] = allFields;
2592
+ $[12] = t7;
2593
+ } else t7 = $[12];
2594
+ const buildCondition = t7;
1810
2595
  const saveRule = ()=>{
1811
- const validConditions = conditions.filter((c)=>c.field);
2596
+ const validConditions = conditions.filter(_temp11);
1812
2597
  if (0 === validConditions.length) return;
1813
2598
  const newRule = {
1814
2599
  id: `rule-${Date.now()}`,
@@ -1817,18 +2602,17 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
1817
2602
  effects: {}
1818
2603
  };
1819
2604
  switch(selectedEffect){
1820
- case 'show':
2605
+ case "show":
1821
2606
  newRule.effects.visible = true;
1822
2607
  break;
1823
- case 'hide':
2608
+ case "hide":
1824
2609
  newRule.effects.visible = false;
1825
2610
  break;
1826
- case 'require':
2611
+ case "require":
1827
2612
  newRule.effects.required = true;
1828
2613
  break;
1829
- case 'disable':
2614
+ case "disable":
1830
2615
  newRule.effects.disabled = true;
1831
- break;
1832
2616
  }
1833
2617
  if (null !== editingRuleIndex) {
1834
2618
  const newRules = [
@@ -1842,148 +2626,351 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
1842
2626
  ]);
1843
2627
  resetBuilder();
1844
2628
  };
1845
- const editRule = (index)=>{
1846
- const rule = rules[index];
2629
+ const editRule = (index_1)=>{
2630
+ const rule = rules[index_1];
1847
2631
  if (!rule) return;
1848
- let effect = 'show';
1849
- if (true === rule.effects.visible) effect = 'show';
1850
- else if (false === rule.effects.visible) effect = 'hide';
1851
- else if (true === rule.effects.required) effect = 'require';
1852
- else if (true === rule.effects.disabled) effect = 'disable';
2632
+ let effect = "show";
2633
+ if (true === rule.effects.visible) effect = "show";
2634
+ else if (false === rule.effects.visible) effect = "hide";
2635
+ else if (true === rule.effects.required) effect = "require";
2636
+ else if (true === rule.effects.disabled) effect = "disable";
1853
2637
  setSelectedEffect(effect);
1854
- setConditionOperator(rule.operator || 'AND');
1855
- const editableConditions = rule.conditions.map((cond)=>{
1856
- let operator = 'is';
1857
- let value = '';
1858
- if (void 0 !== cond.is) {
1859
- operator = 'is';
1860
- value = String(cond.is);
1861
- } else if (void 0 !== cond.isNot) {
1862
- operator = 'isNot';
1863
- value = String(cond.isNot);
1864
- } else if (void 0 !== cond.in) {
1865
- operator = 'in';
1866
- value = cond.in.map(String).join(', ');
1867
- } else if (void 0 !== cond.notIn) {
1868
- operator = 'notIn';
1869
- value = cond.notIn.map(String).join(', ');
1870
- } else if (void 0 !== cond.matches) {
1871
- operator = 'matches';
1872
- value = cond.matches;
1873
- }
1874
- return {
1875
- field: cond.when,
1876
- operator,
1877
- value
1878
- };
1879
- });
2638
+ setConditionOperator(rule.operator || "AND");
2639
+ const editableConditions = rule.conditions.map(_temp12);
1880
2640
  setConditions(editableConditions.length > 0 ? editableConditions : [
1881
2641
  {
1882
- field: '',
1883
- operator: 'is',
1884
- value: ''
2642
+ field: "",
2643
+ operator: "is",
2644
+ value: ""
1885
2645
  }
1886
2646
  ]);
1887
- setEditingRuleIndex(index);
2647
+ setEditingRuleIndex(index_1);
1888
2648
  setIsAddingRule(true);
1889
2649
  };
1890
- const deleteRule = (index)=>{
1891
- onChange(rules.filter((_, i)=>i !== index));
1892
- };
1893
- const getFieldLabel = (fieldName)=>{
1894
- const field = allFields.find((f)=>f.name === fieldName);
1895
- return field?.label || fieldName;
1896
- };
1897
- const describeRule = (rule)=>{
1898
- if (0 === rule.conditions.length) {
1899
- if (rule.effects.required) return 'Always required';
1900
- return 'Always applies';
1901
- }
1902
- const conditionDescriptions = rule.conditions.map((cond)=>{
1903
- const fieldLabel = getFieldLabel(cond.when);
1904
- if (void 0 !== cond.is) return `"${fieldLabel}" = ${JSON.stringify(cond.is)}`;
1905
- if (void 0 !== cond.isNot) return `"${fieldLabel}" ≠ ${JSON.stringify(cond.isNot)}`;
1906
- if (void 0 !== cond.in) return `"${fieldLabel}" in [${cond.in.map((v)=>JSON.stringify(v)).join(', ')}]`;
1907
- if (void 0 !== cond.notIn) return `"${fieldLabel}" not in [${cond.notIn.map((v)=>JSON.stringify(v)).join(', ')}]`;
1908
- if (void 0 !== cond.matches) return `"${fieldLabel}" matches /${cond.matches}/`;
1909
- return `"${fieldLabel}"`;
1910
- });
1911
- const operator = 'OR' === rule.operator ? ' OR ' : ' AND ';
1912
- return conditionDescriptions.join(operator);
2650
+ const deleteRule = (index_2)=>{
2651
+ onChange(rules.filter((__0, i_0)=>i_0 !== index_2));
1913
2652
  };
1914
- const getEffectDescription = (rule)=>{
1915
- if (true === rule.effects.visible) return {
1916
- label: 'Show',
1917
- color: 'text-green-600 bg-green-50'
1918
- };
1919
- if (false === rule.effects.visible) return {
1920
- label: 'Hide',
1921
- color: 'text-orange-600 bg-orange-50'
2653
+ let t8;
2654
+ if ($[13] !== allFields) {
2655
+ const getFieldLabel = (fieldName)=>{
2656
+ const field = allFields.find((f_0)=>f_0.name === fieldName);
2657
+ return field?.label || fieldName;
1922
2658
  };
1923
- if (true === rule.effects.required) return {
1924
- label: 'Required',
1925
- color: 'text-red-600 bg-red-50'
1926
- };
1927
- if (true === rule.effects.disabled) return {
1928
- label: 'Disabled',
1929
- color: 'text-gray-600 bg-gray-50'
2659
+ t8 = (rule_0)=>{
2660
+ if (0 === rule_0.conditions.length) {
2661
+ if (rule_0.effects.required) return "Always required";
2662
+ return "Always applies";
2663
+ }
2664
+ const conditionDescriptions = rule_0.conditions.map((cond_1)=>{
2665
+ const fieldLabel = getFieldLabel(cond_1.when);
2666
+ if (void 0 !== cond_1.is) return `"${fieldLabel}" = ${JSON.stringify(cond_1.is)}`;
2667
+ if (void 0 !== cond_1.isNot) return `"${fieldLabel}" ≠ ${JSON.stringify(cond_1.isNot)}`;
2668
+ if (void 0 !== cond_1.in) return `"${fieldLabel}" in [${cond_1.in.map(_temp13).join(", ")}]`;
2669
+ if (void 0 !== cond_1.notIn) return `"${fieldLabel}" not in [${cond_1.notIn.map(_temp14).join(", ")}]`;
2670
+ if (void 0 !== cond_1.matches) return `"${fieldLabel}" matches /${cond_1.matches}/`;
2671
+ return `"${fieldLabel}"`;
2672
+ });
2673
+ const operator_0 = "OR" === rule_0.operator ? " OR " : " AND ";
2674
+ return conditionDescriptions.join(operator_0);
1930
2675
  };
1931
- return {
1932
- label: 'Unknown',
1933
- color: 'text-muted-foreground bg-muted'
2676
+ $[13] = allFields;
2677
+ $[14] = t8;
2678
+ } else t8 = $[14];
2679
+ const describeRule = t8;
2680
+ const getEffectDescription = _temp15;
2681
+ let t9;
2682
+ if ($[15] !== allFields) {
2683
+ t9 = (fieldName_0)=>{
2684
+ const field_0 = allFields.find((f_1)=>f_1.name === fieldName_0);
2685
+ return field_0?.options || [];
1934
2686
  };
1935
- };
1936
- const getFieldOptions = (fieldName)=>{
1937
- const field = allFields.find((f)=>f.name === fieldName);
1938
- return field?.options || [];
1939
- };
1940
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1941
- className: "space-y-4",
1942
- children: [
1943
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1944
- className: "space-y-3 p-3 border rounded-lg bg-muted/30",
1945
- children: [
1946
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1947
- className: "flex items-center justify-between",
1948
- children: [
1949
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
1950
- className: "flex items-center gap-3",
2687
+ $[15] = allFields;
2688
+ $[16] = t9;
2689
+ } else t9 = $[16];
2690
+ const getFieldOptions = t9;
2691
+ let t10;
2692
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
2693
+ t10 = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2694
+ className: "flex items-center gap-3",
2695
+ children: [
2696
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Asterisk, {
2697
+ className: "h-5 w-5 text-red-500"
2698
+ }),
2699
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2700
+ children: [
2701
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2702
+ className: "cursor-pointer font-medium",
2703
+ children: "Always required"
2704
+ }),
2705
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
2706
+ className: "text-xs text-muted-foreground",
2707
+ children: "Field must always have a value"
2708
+ })
2709
+ ]
2710
+ })
2711
+ ]
2712
+ });
2713
+ $[17] = t10;
2714
+ } else t10 = $[17];
2715
+ let t12;
2716
+ if ($[18] !== addCondition || $[19] !== allFields || $[20] !== conditionOperator || $[21] !== conditions || $[22] !== editingRuleIndex || $[23] !== getFieldOptions || $[24] !== isAddingRule || $[25] !== removeCondition || $[26] !== resetBuilder || $[27] !== saveRule || $[28] !== selectedEffect || $[29] !== setConditionOperator || $[30] !== setIsAddingRule || $[31] !== setSelectedEffect || $[32] !== updateCondition) {
2717
+ t12 = isAddingRule ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2718
+ className: "border rounded-lg p-4 space-y-4 bg-muted/20",
2719
+ children: [
2720
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2721
+ className: "flex items-center justify-between",
2722
+ children: [
2723
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2724
+ className: "font-medium",
2725
+ children: null !== editingRuleIndex ? "Edit rule" : "New rule"
2726
+ }),
2727
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2728
+ variant: "ghost",
2729
+ size: "sm",
2730
+ onClick: resetBuilder,
2731
+ children: "Cancel"
2732
+ })
2733
+ ]
2734
+ }),
2735
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2736
+ className: "space-y-2",
2737
+ children: [
2738
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2739
+ className: "text-xs text-muted-foreground",
2740
+ children: "When conditions are met:"
2741
+ }),
2742
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
2743
+ className: "grid grid-cols-2 gap-2",
2744
+ children: RULE_EFFECTS.map((effect_1)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
2745
+ type: "button",
2746
+ className: `flex items-center gap-2 p-2 rounded-lg border text-left text-sm transition-all ${selectedEffect === effect_1.value ? effect_1.color + " border-current" : "hover:bg-muted"}`,
2747
+ onClick: ()=>setSelectedEffect(effect_1.value),
2748
+ children: [
2749
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(effect_1.Icon, {
2750
+ className: "h-4 w-4"
2751
+ }),
2752
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
2753
+ className: "font-medium",
2754
+ children: effect_1.label
2755
+ })
2756
+ ]
2757
+ }, effect_1.value))
2758
+ })
2759
+ ]
2760
+ }),
2761
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2762
+ className: "space-y-3",
2763
+ children: [
2764
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2765
+ className: "flex items-center justify-between",
2766
+ children: [
2767
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2768
+ className: "text-xs text-muted-foreground",
2769
+ children: "Conditions:"
2770
+ }),
2771
+ conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2772
+ value: conditionOperator,
2773
+ onValueChange: (v_3)=>setConditionOperator(v_3),
2774
+ children: [
2775
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2776
+ className: "w-24 h-7 text-xs",
2777
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
2778
+ }),
2779
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.SelectContent, {
2780
+ children: [
2781
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2782
+ value: "AND",
2783
+ children: "Match ALL"
2784
+ }),
2785
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2786
+ value: "OR",
2787
+ children: "Match ANY"
2788
+ })
2789
+ ]
2790
+ })
2791
+ ]
2792
+ })
2793
+ ]
2794
+ }),
2795
+ conditions.map((cond_2, index_5)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2796
+ className: "space-y-2",
1951
2797
  children: [
1952
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Asterisk, {
1953
- className: "h-5 w-5 text-red-500"
2798
+ index_5 > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2799
+ className: "flex items-center gap-2 text-xs text-muted-foreground",
2800
+ children: [
2801
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
2802
+ className: "flex-1"
2803
+ }),
2804
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
2805
+ children: conditionOperator
2806
+ }),
2807
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
2808
+ className: "flex-1"
2809
+ })
2810
+ ]
1954
2811
  }),
1955
2812
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2813
+ className: "flex gap-2 items-start",
1956
2814
  children: [
1957
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
1958
- className: "cursor-pointer font-medium",
1959
- children: "Always required"
2815
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2816
+ className: "flex-1 space-y-2",
2817
+ children: [
2818
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2819
+ value: cond_2.field,
2820
+ onValueChange: (v_4)=>updateCondition(index_5, {
2821
+ field: v_4
2822
+ }),
2823
+ children: [
2824
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2825
+ className: "h-8 text-sm",
2826
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
2827
+ placeholder: "Select field..."
2828
+ })
2829
+ }),
2830
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2831
+ children: allFields.map(_temp21)
2832
+ })
2833
+ ]
2834
+ }),
2835
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2836
+ className: "flex gap-2",
2837
+ children: [
2838
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2839
+ value: cond_2.operator,
2840
+ onValueChange: (v_5)=>updateCondition(index_5, {
2841
+ operator: v_5
2842
+ }),
2843
+ children: [
2844
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2845
+ className: "w-32 h-8 text-sm",
2846
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
2847
+ }),
2848
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2849
+ children: CONDITION_OPERATORS.map(_temp22)
2850
+ })
2851
+ ]
2852
+ }),
2853
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
2854
+ className: "flex-1",
2855
+ children: cond_2.field && getFieldOptions(cond_2.field).length > 0 && ("is" === cond_2.operator || "isNot" === cond_2.operator) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2856
+ value: cond_2.value,
2857
+ onValueChange: (v_6)=>updateCondition(index_5, {
2858
+ value: v_6
2859
+ }),
2860
+ children: [
2861
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2862
+ className: "h-8 text-sm",
2863
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
2864
+ placeholder: "Select value..."
2865
+ })
2866
+ }),
2867
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2868
+ children: getFieldOptions(cond_2.field).map(_temp23)
2869
+ })
2870
+ ]
2871
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2872
+ className: "h-8 text-sm",
2873
+ placeholder: "in" === cond_2.operator || "notIn" === cond_2.operator ? "value1, value2, ..." : "matches" === cond_2.operator ? "regex pattern" : "value",
2874
+ value: cond_2.value,
2875
+ onChange: (e_0)=>updateCondition(index_5, {
2876
+ value: e_0.target.value
2877
+ })
2878
+ })
2879
+ })
2880
+ ]
2881
+ })
2882
+ ]
1960
2883
  }),
1961
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
1962
- className: "text-xs text-muted-foreground",
1963
- children: "Field must always have a value"
2884
+ conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2885
+ variant: "ghost",
2886
+ size: "sm",
2887
+ className: "h-8 w-8 p-0 text-muted-foreground",
2888
+ onClick: ()=>removeCondition(index_5),
2889
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
2890
+ className: "h-3.5 w-3.5"
2891
+ })
1964
2892
  })
1965
2893
  ]
1966
2894
  })
1967
2895
  ]
1968
- }),
2896
+ }, index_5)),
2897
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
2898
+ variant: "outline",
2899
+ size: "sm",
2900
+ className: "w-full",
2901
+ onClick: addCondition,
2902
+ children: [
2903
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
2904
+ className: "h-3 w-3 mr-2"
2905
+ }),
2906
+ "Add condition"
2907
+ ]
2908
+ })
2909
+ ]
2910
+ }),
2911
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2912
+ className: "w-full",
2913
+ onClick: saveRule,
2914
+ disabled: !conditions.some(_temp24),
2915
+ children: null !== editingRuleIndex ? "Update rule" : "Add rule"
2916
+ })
2917
+ ]
2918
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
2919
+ variant: "outline",
2920
+ className: "w-full",
2921
+ onClick: ()=>setIsAddingRule(true),
2922
+ children: [
2923
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
2924
+ className: "h-4 w-4 mr-2"
2925
+ }),
2926
+ "Add conditional rule"
2927
+ ]
2928
+ });
2929
+ $[18] = addCondition;
2930
+ $[19] = allFields;
2931
+ $[20] = conditionOperator;
2932
+ $[21] = conditions;
2933
+ $[22] = editingRuleIndex;
2934
+ $[23] = getFieldOptions;
2935
+ $[24] = isAddingRule;
2936
+ $[25] = removeCondition;
2937
+ $[26] = resetBuilder;
2938
+ $[27] = saveRule;
2939
+ $[28] = selectedEffect;
2940
+ $[29] = setConditionOperator;
2941
+ $[30] = setIsAddingRule;
2942
+ $[31] = setSelectedEffect;
2943
+ $[32] = updateCondition;
2944
+ $[33] = t12;
2945
+ } else t12 = $[33];
2946
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2947
+ className: "space-y-4",
2948
+ children: [
2949
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2950
+ className: "space-y-3 p-3 border rounded-lg bg-muted/30",
2951
+ children: [
2952
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2953
+ className: "flex items-center justify-between",
2954
+ children: [
2955
+ t10,
1969
2956
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_cjs_namespaceObject.Checkbox, {
1970
2957
  checked: isAlwaysRequired,
1971
2958
  onCheckedChange: (checked)=>{
1972
2959
  if (checked) {
1973
2960
  const requiredRule = {
1974
- id: 'always-required',
2961
+ id: "always-required",
1975
2962
  conditions: [],
1976
- operator: 'AND',
2963
+ operator: "AND",
1977
2964
  effects: {
1978
2965
  required: true
1979
2966
  }
1980
2967
  };
1981
2968
  onChange([
1982
- ...rules.filter((r)=>!(r.effects.required && 0 === r.conditions.length)),
2969
+ ...rules.filter(_temp16),
1983
2970
  requiredRule
1984
2971
  ]);
1985
2972
  } else {
1986
- onChange(rules.filter((r)=>!(r.effects.required && 0 === r.conditions.length)));
2973
+ onChange(rules.filter(_temp17));
1987
2974
  onRequiredMessageChange(void 0);
1988
2975
  }
1989
2976
  }
@@ -2001,7 +2988,7 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2001
2988
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2002
2989
  id: "required-message",
2003
2990
  placeholder: "This field is required",
2004
- value: requiredMessage || '',
2991
+ value: requiredMessage || "",
2005
2992
  onChange: (e)=>onRequiredMessageChange(e.target.value || void 0),
2006
2993
  className: "h-8 text-sm"
2007
2994
  })
@@ -2009,18 +2996,16 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2009
2996
  })
2010
2997
  ]
2011
2998
  }),
2012
- rules.filter((r)=>r.conditions.length > 0 || !r.effects.required).length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2999
+ rules.filter(_temp18).length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2013
3000
  className: "space-y-2",
2014
3001
  children: [
2015
3002
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2016
3003
  className: "text-xs text-muted-foreground uppercase tracking-wide",
2017
3004
  children: "Conditional rules"
2018
3005
  }),
2019
- rules.map((rule, index)=>({
2020
- rule,
2021
- index
2022
- })).filter(({ rule })=>rule.conditions.length > 0 || !rule.effects.required).map(({ rule, index })=>{
2023
- const effect = getEffectDescription(rule);
3006
+ rules.map(_temp19).filter(_temp20).map((t11)=>{
3007
+ const { rule: rule_4, index: index_4 } = t11;
3008
+ const effect_0 = getEffectDescription(rule_4);
2024
3009
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
2025
3010
  className: "group border rounded-lg p-3 hover:border-primary/50 transition-colors",
2026
3011
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
@@ -2033,14 +3018,14 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2033
3018
  className: "flex items-center gap-2 mb-1",
2034
3019
  children: [
2035
3020
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
2036
- className: `text-xs font-medium px-2 py-0.5 rounded ${effect.color}`,
2037
- children: effect.label
3021
+ className: `text-xs font-medium px-2 py-0.5 rounded ${effect_0.color}`,
3022
+ children: effect_0.label
2038
3023
  }),
2039
- rule.conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
3024
+ rule_4.conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
2040
3025
  className: "text-xs text-muted-foreground",
2041
3026
  children: [
2042
3027
  "(",
2043
- rule.operator,
3028
+ rule_4.operator,
2044
3029
  ")"
2045
3030
  ]
2046
3031
  })
@@ -2048,7 +3033,7 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2048
3033
  }),
2049
3034
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
2050
3035
  className: "text-sm text-muted-foreground truncate",
2051
- children: describeRule(rule)
3036
+ children: describeRule(rule_4)
2052
3037
  })
2053
3038
  ]
2054
3039
  }),
@@ -2059,7 +3044,7 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2059
3044
  variant: "ghost",
2060
3045
  size: "sm",
2061
3046
  className: "h-7 w-7 p-0",
2062
- onClick: ()=>editRule(index),
3047
+ onClick: ()=>editRule(index_4),
2063
3048
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Settings, {
2064
3049
  className: "h-3.5 w-3.5"
2065
3050
  })
@@ -2068,7 +3053,7 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2068
3053
  variant: "ghost",
2069
3054
  size: "sm",
2070
3055
  className: "h-7 w-7 p-0 text-destructive hover:text-destructive",
2071
- onClick: ()=>deleteRule(index),
3056
+ onClick: ()=>deleteRule(index_4),
2072
3057
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
2073
3058
  className: "h-3.5 w-3.5"
2074
3059
  })
@@ -2077,234 +3062,113 @@ function RulesEditor({ rules = [], onChange, allFields, requiredMessage, onRequi
2077
3062
  })
2078
3063
  ]
2079
3064
  })
2080
- }, index);
3065
+ }, index_4);
2081
3066
  })
2082
3067
  ]
2083
3068
  }),
2084
- isAddingRule ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2085
- className: "border rounded-lg p-4 space-y-4 bg-muted/20",
2086
- children: [
2087
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2088
- className: "flex items-center justify-between",
2089
- children: [
2090
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2091
- className: "font-medium",
2092
- children: null !== editingRuleIndex ? 'Edit rule' : 'New rule'
2093
- }),
2094
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2095
- variant: "ghost",
2096
- size: "sm",
2097
- onClick: resetBuilder,
2098
- children: "Cancel"
2099
- })
2100
- ]
2101
- }),
2102
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2103
- className: "space-y-2",
2104
- children: [
2105
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2106
- className: "text-xs text-muted-foreground",
2107
- children: "When conditions are met:"
2108
- }),
2109
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
2110
- className: "grid grid-cols-2 gap-2",
2111
- children: RULE_EFFECTS.map((effect)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
2112
- type: "button",
2113
- className: `flex items-center gap-2 p-2 rounded-lg border text-left text-sm transition-all ${selectedEffect === effect.value ? effect.color + ' border-current' : 'hover:bg-muted'}`,
2114
- onClick: ()=>setSelectedEffect(effect.value),
2115
- children: [
2116
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(effect.Icon, {
2117
- className: "h-4 w-4"
2118
- }),
2119
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
2120
- className: "font-medium",
2121
- children: effect.label
2122
- })
2123
- ]
2124
- }, effect.value))
2125
- })
2126
- ]
2127
- }),
2128
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2129
- className: "space-y-3",
2130
- children: [
2131
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2132
- className: "flex items-center justify-between",
2133
- children: [
2134
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(label_cjs_namespaceObject.Label, {
2135
- className: "text-xs text-muted-foreground",
2136
- children: "Conditions:"
2137
- }),
2138
- conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2139
- value: conditionOperator,
2140
- onValueChange: (v)=>setConditionOperator(v),
2141
- children: [
2142
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2143
- className: "w-24 h-7 text-xs",
2144
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
2145
- }),
2146
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.SelectContent, {
2147
- children: [
2148
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2149
- value: "AND",
2150
- children: "Match ALL"
2151
- }),
2152
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2153
- value: "OR",
2154
- children: "Match ANY"
2155
- })
2156
- ]
2157
- })
2158
- ]
2159
- })
2160
- ]
2161
- }),
2162
- conditions.map((cond, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2163
- className: "space-y-2",
2164
- children: [
2165
- index > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2166
- className: "flex items-center gap-2 text-xs text-muted-foreground",
2167
- children: [
2168
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
2169
- className: "flex-1"
2170
- }),
2171
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
2172
- children: conditionOperator
2173
- }),
2174
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(separator_cjs_namespaceObject.Separator, {
2175
- className: "flex-1"
2176
- })
2177
- ]
2178
- }),
2179
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2180
- className: "flex gap-2 items-start",
2181
- children: [
2182
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2183
- className: "flex-1 space-y-2",
2184
- children: [
2185
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2186
- value: cond.field,
2187
- onValueChange: (v)=>updateCondition(index, {
2188
- field: v
2189
- }),
2190
- children: [
2191
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2192
- className: "h-8 text-sm",
2193
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
2194
- placeholder: "Select field..."
2195
- })
2196
- }),
2197
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2198
- children: allFields.map((field)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2199
- value: field.name,
2200
- children: field.label
2201
- }, field.id))
2202
- })
2203
- ]
2204
- }),
2205
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
2206
- className: "flex gap-2",
2207
- children: [
2208
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2209
- value: cond.operator,
2210
- onValueChange: (v)=>updateCondition(index, {
2211
- operator: v
2212
- }),
2213
- children: [
2214
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2215
- className: "w-32 h-8 text-sm",
2216
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {})
2217
- }),
2218
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2219
- children: CONDITION_OPERATORS.map((op)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2220
- value: op.value,
2221
- children: op.label
2222
- }, op.value))
2223
- })
2224
- ]
2225
- }),
2226
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
2227
- className: "flex-1",
2228
- children: cond.field && getFieldOptions(cond.field).length > 0 && ('is' === cond.operator || 'isNot' === cond.operator) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(select_cjs_namespaceObject.Select, {
2229
- value: cond.value,
2230
- onValueChange: (v)=>updateCondition(index, {
2231
- value: v
2232
- }),
2233
- children: [
2234
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectTrigger, {
2235
- className: "h-8 text-sm",
2236
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectValue, {
2237
- placeholder: "Select value..."
2238
- })
2239
- }),
2240
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectContent, {
2241
- children: getFieldOptions(cond.field).map((opt)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
2242
- value: String(opt.value),
2243
- children: opt.label
2244
- }, String(opt.value)))
2245
- })
2246
- ]
2247
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(input_cjs_namespaceObject.Input, {
2248
- className: "h-8 text-sm",
2249
- placeholder: 'in' === cond.operator || 'notIn' === cond.operator ? 'value1, value2, ...' : 'matches' === cond.operator ? 'regex pattern' : 'value',
2250
- value: cond.value,
2251
- onChange: (e)=>updateCondition(index, {
2252
- value: e.target.value
2253
- })
2254
- })
2255
- })
2256
- ]
2257
- })
2258
- ]
2259
- }),
2260
- conditions.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2261
- variant: "ghost",
2262
- size: "sm",
2263
- className: "h-8 w-8 p-0 text-muted-foreground",
2264
- onClick: ()=>removeCondition(index),
2265
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {
2266
- className: "h-3.5 w-3.5"
2267
- })
2268
- })
2269
- ]
2270
- })
2271
- ]
2272
- }, index)),
2273
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
2274
- variant: "outline",
2275
- size: "sm",
2276
- className: "w-full",
2277
- onClick: addCondition,
2278
- children: [
2279
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
2280
- className: "h-3 w-3 mr-2"
2281
- }),
2282
- "Add condition"
2283
- ]
2284
- })
2285
- ]
2286
- }),
2287
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_cjs_namespaceObject.Button, {
2288
- className: "w-full",
2289
- onClick: saveRule,
2290
- disabled: !conditions.some((c)=>c.field),
2291
- children: null !== editingRuleIndex ? 'Update rule' : 'Add rule'
2292
- })
2293
- ]
2294
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(button_cjs_namespaceObject.Button, {
2295
- variant: "outline",
2296
- className: "w-full",
2297
- onClick: ()=>setIsAddingRule(true),
2298
- children: [
2299
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
2300
- className: "h-4 w-4 mr-2"
2301
- }),
2302
- "Add conditional rule"
2303
- ]
2304
- })
3069
+ t12
2305
3070
  ]
2306
3071
  });
2307
3072
  }
3073
+ function _temp24(c_0) {
3074
+ return c_0.field;
3075
+ }
3076
+ function _temp23(opt) {
3077
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
3078
+ value: String(opt.value),
3079
+ children: opt.label
3080
+ }, String(opt.value));
3081
+ }
3082
+ function _temp22(op) {
3083
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
3084
+ value: op.value,
3085
+ children: op.label
3086
+ }, op.value);
3087
+ }
3088
+ function _temp21(field_1) {
3089
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(select_cjs_namespaceObject.SelectItem, {
3090
+ value: field_1.name,
3091
+ children: field_1.label
3092
+ }, field_1.id);
3093
+ }
3094
+ function _temp20(t0) {
3095
+ const { rule: rule_3 } = t0;
3096
+ return rule_3.conditions.length > 0 || !rule_3.effects.required;
3097
+ }
3098
+ function _temp19(rule_2, index_3) {
3099
+ return {
3100
+ rule: rule_2,
3101
+ index: index_3
3102
+ };
3103
+ }
3104
+ function _temp18(r_2) {
3105
+ return r_2.conditions.length > 0 || !r_2.effects.required;
3106
+ }
3107
+ function _temp17(r_1) {
3108
+ return !(r_1.effects.required && 0 === r_1.conditions.length);
3109
+ }
3110
+ function _temp16(r_0) {
3111
+ return !(r_0.effects.required && 0 === r_0.conditions.length);
3112
+ }
3113
+ function _temp15(rule_1) {
3114
+ if (true === rule_1.effects.visible) return {
3115
+ label: "Show",
3116
+ color: "text-green-600 bg-green-50"
3117
+ };
3118
+ if (false === rule_1.effects.visible) return {
3119
+ label: "Hide",
3120
+ color: "text-orange-600 bg-orange-50"
3121
+ };
3122
+ if (true === rule_1.effects.required) return {
3123
+ label: "Required",
3124
+ color: "text-red-600 bg-red-50"
3125
+ };
3126
+ if (true === rule_1.effects.disabled) return {
3127
+ label: "Disabled",
3128
+ color: "text-gray-600 bg-gray-50"
3129
+ };
3130
+ return {
3131
+ label: "Unknown",
3132
+ color: "text-muted-foreground bg-muted"
3133
+ };
3134
+ }
3135
+ function _temp14(v_2) {
3136
+ return JSON.stringify(v_2);
3137
+ }
3138
+ function _temp13(v_1) {
3139
+ return JSON.stringify(v_1);
3140
+ }
3141
+ function _temp12(cond_0) {
3142
+ let operator = "is";
3143
+ let value = "";
3144
+ if (void 0 !== cond_0.is) {
3145
+ operator = "is";
3146
+ value = String(cond_0.is);
3147
+ } else if (void 0 !== cond_0.isNot) {
3148
+ operator = "isNot";
3149
+ value = String(cond_0.isNot);
3150
+ } else if (void 0 !== cond_0.in) {
3151
+ operator = "in";
3152
+ value = cond_0.in.map(String).join(", ");
3153
+ } else if (void 0 !== cond_0.notIn) {
3154
+ operator = "notIn";
3155
+ value = cond_0.notIn.map(String).join(", ");
3156
+ } else if (void 0 !== cond_0.matches) {
3157
+ operator = "matches";
3158
+ value = cond_0.matches;
3159
+ }
3160
+ return {
3161
+ field: cond_0.when,
3162
+ operator,
3163
+ value
3164
+ };
3165
+ }
3166
+ function _temp11(c) {
3167
+ return c.field;
3168
+ }
3169
+ function _temp10(r) {
3170
+ return true === r.effects.required && 0 === r.conditions.length;
3171
+ }
2308
3172
  exports.FormDesigner = __webpack_exports__.FormDesigner;
2309
3173
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
2310
3174
  "FormDesigner"