@mieweb/forms-renderer 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blaze.js +31 -91
- package/dist/blaze.js.map +1 -1
- package/dist/blaze.umd.cjs +31 -89
- package/dist/blaze.umd.cjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/standalone.js +31 -91
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.umd.cjs +31 -89
- package/dist/standalone.umd.cjs.map +1 -1
- package/package.json +2 -2
package/dist/blaze.umd.cjs
CHANGED
|
@@ -238,7 +238,7 @@ Check the top-level render call using <`+G+">.")}return O}}function ii(m,O){{if(
|
|
|
238
238
|
<%s {...props} />
|
|
239
239
|
React keys must be passed directly to JSX without using spread:
|
|
240
240
|
let props = %s;
|
|
241
|
-
<%s key={someKey} {...props} />`,ct,Zn,Sa,Zn),ur[Zn+ct]=!0}}return m===k?yr(st):Wi(st),st}}function Ua(m,O,G){return In(m,O,G,!0)}function xa(m,O,G){return In(m,O,G,!1)}var Fa=xa,Ha=Ua;ld.Fragment=k,ld.jsx=Fa,ld.jsxs=Ha})()),ld}var Kw;function iE(){return Kw||(Kw=1,process.env.NODE_ENV==="production"?mv.exports=rE():mv.exports=aE()),mv.exports}var Ku=iE();const Xw=v=>{let E;const b=new Set,k=($,re)=>{const K=typeof $=="function"?$(E):$;if(!Object.is(K,E)){const V=E;E=re??(typeof K!="object"||K===null)?K:Object.assign({},E,K),b.forEach(I=>I(E,V))}},R=()=>E,A={setState:k,getState:R,getInitialState:()=>U,subscribe:$=>(b.add($),()=>b.delete($))},U=E=v(k,R,A);return A},lE=(v=>v?Xw(v):Xw),oE=v=>v;function uE(v,E=oE){const b=tt.useSyncExternalStore(v.subscribe,tt.useCallback(()=>E(v.getState()),[v,E]),tt.useCallback(()=>E(v.getInitialState()),[v,E]));return tt.useDebugValue(b),b}const Jw=v=>{const E=lE(v),b=k=>uE(E,k);return Object.assign(b,E),b},Zw=(v=>v?Jw(v):Jw);(function(){if(!(typeof document>"u")&&!window.__QUESTIONNAIRE_ENGINE_CSS_INJECTED){if(!document.querySelector("#questionnaire-engine-styles")){const v=document.createElement("style");v.id="questionnaire-engine-styles",v.textContent=`/*! tailwindcss v4.1.
|
|
241
|
+
<%s key={someKey} {...props} />`,ct,Zn,Sa,Zn),ur[Zn+ct]=!0}}return m===k?yr(st):Wi(st),st}}function Ua(m,O,G){return In(m,O,G,!0)}function xa(m,O,G){return In(m,O,G,!1)}var Fa=xa,Ha=Ua;ld.Fragment=k,ld.jsx=Fa,ld.jsxs=Ha})()),ld}var Kw;function iE(){return Kw||(Kw=1,process.env.NODE_ENV==="production"?mv.exports=rE():mv.exports=aE()),mv.exports}var Ku=iE();const Xw=v=>{let E;const b=new Set,k=($,re)=>{const K=typeof $=="function"?$(E):$;if(!Object.is(K,E)){const V=E;E=re??(typeof K!="object"||K===null)?K:Object.assign({},E,K),b.forEach(I=>I(E,V))}},R=()=>E,A={setState:k,getState:R,getInitialState:()=>U,subscribe:$=>(b.add($),()=>b.delete($))},U=E=v(k,R,A);return A},lE=(v=>v?Xw(v):Xw),oE=v=>v;function uE(v,E=oE){const b=tt.useSyncExternalStore(v.subscribe,tt.useCallback(()=>E(v.getState()),[v,E]),tt.useCallback(()=>E(v.getInitialState()),[v,E]));return tt.useDebugValue(b),b}const Jw=v=>{const E=lE(v),b=k=>uE(E,k);return Object.assign(b,E),b},Zw=(v=>v?Jw(v):Jw);(function(){if(!(typeof document>"u")&&!window.__QUESTIONNAIRE_ENGINE_CSS_INJECTED){if(!document.querySelector("#questionnaire-engine-styles")){const v=document.createElement("style");v.id="questionnaire-engine-styles",v.textContent=`/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */
|
|
242
242
|
@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap');
|
|
243
243
|
@layer properties;
|
|
244
244
|
@layer theme, base, components, utilities;
|
|
@@ -446,9 +446,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
446
446
|
::placeholder {
|
|
447
447
|
color: currentcolor;
|
|
448
448
|
@supports (color: color-mix(in lab, red, red)) {
|
|
449
|
-
|
|
450
|
-
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
451
|
-
}
|
|
449
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
452
450
|
}
|
|
453
451
|
}
|
|
454
452
|
}
|
|
@@ -982,33 +980,25 @@ React keys must be passed directly to JSX without using spread:
|
|
|
982
980
|
.border-black\\/10 {
|
|
983
981
|
border-color: color-mix(in srgb, #000 10%, transparent);
|
|
984
982
|
@supports (color: color-mix(in lab, red, red)) {
|
|
985
|
-
|
|
986
|
-
border-color: color-mix(in oklab, var(--color-black) 10%, transparent);
|
|
987
|
-
}
|
|
983
|
+
border-color: color-mix(in oklab, var(--color-black) 10%, transparent);
|
|
988
984
|
}
|
|
989
985
|
}
|
|
990
986
|
.border-black\\/15 {
|
|
991
987
|
border-color: color-mix(in srgb, #000 15%, transparent);
|
|
992
988
|
@supports (color: color-mix(in lab, red, red)) {
|
|
993
|
-
|
|
994
|
-
border-color: color-mix(in oklab, var(--color-black) 15%, transparent);
|
|
995
|
-
}
|
|
989
|
+
border-color: color-mix(in oklab, var(--color-black) 15%, transparent);
|
|
996
990
|
}
|
|
997
991
|
}
|
|
998
992
|
.border-black\\/20 {
|
|
999
993
|
border-color: color-mix(in srgb, #000 20%, transparent);
|
|
1000
994
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1001
|
-
|
|
1002
|
-
border-color: color-mix(in oklab, var(--color-black) 20%, transparent);
|
|
1003
|
-
}
|
|
995
|
+
border-color: color-mix(in oklab, var(--color-black) 20%, transparent);
|
|
1004
996
|
}
|
|
1005
997
|
}
|
|
1006
998
|
.border-black\\/40 {
|
|
1007
999
|
border-color: color-mix(in srgb, #000 40%, transparent);
|
|
1008
1000
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1009
|
-
|
|
1010
|
-
border-color: color-mix(in oklab, var(--color-black) 40%, transparent);
|
|
1011
|
-
}
|
|
1001
|
+
border-color: color-mix(in oklab, var(--color-black) 40%, transparent);
|
|
1012
1002
|
}
|
|
1013
1003
|
}
|
|
1014
1004
|
.border-blue-200 {
|
|
@@ -1017,9 +1007,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1017
1007
|
.border-blue-200\\/60 {
|
|
1018
1008
|
border-color: color-mix(in srgb, oklch(88.2% 0.059 254.128) 60%, transparent);
|
|
1019
1009
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1020
|
-
|
|
1021
|
-
border-color: color-mix(in oklab, var(--color-blue-200) 60%, transparent);
|
|
1022
|
-
}
|
|
1010
|
+
border-color: color-mix(in oklab, var(--color-blue-200) 60%, transparent);
|
|
1023
1011
|
}
|
|
1024
1012
|
}
|
|
1025
1013
|
.border-blue-300 {
|
|
@@ -1040,9 +1028,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1040
1028
|
.border-slate-100\\/80 {
|
|
1041
1029
|
border-color: color-mix(in srgb, oklch(96.8% 0.007 247.896) 80%, transparent);
|
|
1042
1030
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1043
|
-
|
|
1044
|
-
border-color: color-mix(in oklab, var(--color-slate-100) 80%, transparent);
|
|
1045
|
-
}
|
|
1031
|
+
border-color: color-mix(in oklab, var(--color-slate-100) 80%, transparent);
|
|
1046
1032
|
}
|
|
1047
1033
|
}
|
|
1048
1034
|
.border-slate-200 {
|
|
@@ -1051,9 +1037,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1051
1037
|
.border-slate-200\\/60 {
|
|
1052
1038
|
border-color: color-mix(in srgb, oklch(92.9% 0.013 255.508) 60%, transparent);
|
|
1053
1039
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1054
|
-
|
|
1055
|
-
border-color: color-mix(in oklab, var(--color-slate-200) 60%, transparent);
|
|
1056
|
-
}
|
|
1040
|
+
border-color: color-mix(in oklab, var(--color-slate-200) 60%, transparent);
|
|
1057
1041
|
}
|
|
1058
1042
|
}
|
|
1059
1043
|
.border-slate-300 {
|
|
@@ -1065,17 +1049,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1065
1049
|
.border-white\\/30 {
|
|
1066
1050
|
border-color: color-mix(in srgb, #fff 30%, transparent);
|
|
1067
1051
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1068
|
-
|
|
1069
|
-
border-color: color-mix(in oklab, var(--color-white) 30%, transparent);
|
|
1070
|
-
}
|
|
1052
|
+
border-color: color-mix(in oklab, var(--color-white) 30%, transparent);
|
|
1071
1053
|
}
|
|
1072
1054
|
}
|
|
1073
1055
|
.border-white\\/40 {
|
|
1074
1056
|
border-color: color-mix(in srgb, #fff 40%, transparent);
|
|
1075
1057
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1076
|
-
|
|
1077
|
-
border-color: color-mix(in oklab, var(--color-white) 40%, transparent);
|
|
1078
|
-
}
|
|
1058
|
+
border-color: color-mix(in oklab, var(--color-white) 40%, transparent);
|
|
1079
1059
|
}
|
|
1080
1060
|
}
|
|
1081
1061
|
.bg-\\[\\#0076a8\\] {
|
|
@@ -1084,41 +1064,31 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1084
1064
|
.bg-black\\/5 {
|
|
1085
1065
|
background-color: color-mix(in srgb, #000 5%, transparent);
|
|
1086
1066
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1087
|
-
|
|
1088
|
-
background-color: color-mix(in oklab, var(--color-black) 5%, transparent);
|
|
1089
|
-
}
|
|
1067
|
+
background-color: color-mix(in oklab, var(--color-black) 5%, transparent);
|
|
1090
1068
|
}
|
|
1091
1069
|
}
|
|
1092
1070
|
.bg-black\\/6 {
|
|
1093
1071
|
background-color: color-mix(in srgb, #000 6%, transparent);
|
|
1094
1072
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1095
|
-
|
|
1096
|
-
background-color: color-mix(in oklab, var(--color-black) 6%, transparent);
|
|
1097
|
-
}
|
|
1073
|
+
background-color: color-mix(in oklab, var(--color-black) 6%, transparent);
|
|
1098
1074
|
}
|
|
1099
1075
|
}
|
|
1100
1076
|
.bg-black\\/10 {
|
|
1101
1077
|
background-color: color-mix(in srgb, #000 10%, transparent);
|
|
1102
1078
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1103
|
-
|
|
1104
|
-
background-color: color-mix(in oklab, var(--color-black) 10%, transparent);
|
|
1105
|
-
}
|
|
1079
|
+
background-color: color-mix(in oklab, var(--color-black) 10%, transparent);
|
|
1106
1080
|
}
|
|
1107
1081
|
}
|
|
1108
1082
|
.bg-black\\/50 {
|
|
1109
1083
|
background-color: color-mix(in srgb, #000 50%, transparent);
|
|
1110
1084
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1111
|
-
|
|
1112
|
-
background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
|
|
1113
|
-
}
|
|
1085
|
+
background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
|
|
1114
1086
|
}
|
|
1115
1087
|
}
|
|
1116
1088
|
.bg-blue-100\\/70 {
|
|
1117
1089
|
background-color: color-mix(in srgb, oklch(93.2% 0.032 255.585) 70%, transparent);
|
|
1118
1090
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1119
|
-
|
|
1120
|
-
background-color: color-mix(in oklab, var(--color-blue-100) 70%, transparent);
|
|
1121
|
-
}
|
|
1091
|
+
background-color: color-mix(in oklab, var(--color-blue-100) 70%, transparent);
|
|
1122
1092
|
}
|
|
1123
1093
|
}
|
|
1124
1094
|
.bg-blue-500 {
|
|
@@ -1148,9 +1118,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1148
1118
|
.bg-slate-50\\/60 {
|
|
1149
1119
|
background-color: color-mix(in srgb, oklch(98.4% 0.003 247.858) 60%, transparent);
|
|
1150
1120
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1151
|
-
|
|
1152
|
-
background-color: color-mix(in oklab, var(--color-slate-50) 60%, transparent);
|
|
1153
|
-
}
|
|
1121
|
+
background-color: color-mix(in oklab, var(--color-slate-50) 60%, transparent);
|
|
1154
1122
|
}
|
|
1155
1123
|
}
|
|
1156
1124
|
.bg-slate-100 {
|
|
@@ -1159,25 +1127,19 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1159
1127
|
.bg-slate-100\\/60 {
|
|
1160
1128
|
background-color: color-mix(in srgb, oklch(96.8% 0.007 247.896) 60%, transparent);
|
|
1161
1129
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1162
|
-
|
|
1163
|
-
background-color: color-mix(in oklab, var(--color-slate-100) 60%, transparent);
|
|
1164
|
-
}
|
|
1130
|
+
background-color: color-mix(in oklab, var(--color-slate-100) 60%, transparent);
|
|
1165
1131
|
}
|
|
1166
1132
|
}
|
|
1167
1133
|
.bg-slate-100\\/80 {
|
|
1168
1134
|
background-color: color-mix(in srgb, oklch(96.8% 0.007 247.896) 80%, transparent);
|
|
1169
1135
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1170
|
-
|
|
1171
|
-
background-color: color-mix(in oklab, var(--color-slate-100) 80%, transparent);
|
|
1172
|
-
}
|
|
1136
|
+
background-color: color-mix(in oklab, var(--color-slate-100) 80%, transparent);
|
|
1173
1137
|
}
|
|
1174
1138
|
}
|
|
1175
1139
|
.bg-slate-300\\/50 {
|
|
1176
1140
|
background-color: color-mix(in srgb, oklch(86.9% 0.022 252.894) 50%, transparent);
|
|
1177
1141
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1178
|
-
|
|
1179
|
-
background-color: color-mix(in oklab, var(--color-slate-300) 50%, transparent);
|
|
1180
|
-
}
|
|
1142
|
+
background-color: color-mix(in oklab, var(--color-slate-300) 50%, transparent);
|
|
1181
1143
|
}
|
|
1182
1144
|
}
|
|
1183
1145
|
.bg-transparent {
|
|
@@ -1192,17 +1154,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1192
1154
|
.bg-white\\/70 {
|
|
1193
1155
|
background-color: color-mix(in srgb, #fff 70%, transparent);
|
|
1194
1156
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1195
|
-
|
|
1196
|
-
background-color: color-mix(in oklab, var(--color-white) 70%, transparent);
|
|
1197
|
-
}
|
|
1157
|
+
background-color: color-mix(in oklab, var(--color-white) 70%, transparent);
|
|
1198
1158
|
}
|
|
1199
1159
|
}
|
|
1200
1160
|
.bg-white\\/75 {
|
|
1201
1161
|
background-color: color-mix(in srgb, #fff 75%, transparent);
|
|
1202
1162
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1203
|
-
|
|
1204
|
-
background-color: color-mix(in oklab, var(--color-white) 75%, transparent);
|
|
1205
|
-
}
|
|
1163
|
+
background-color: color-mix(in oklab, var(--color-white) 75%, transparent);
|
|
1206
1164
|
}
|
|
1207
1165
|
}
|
|
1208
1166
|
.bg-gradient-to-b {
|
|
@@ -1419,9 +1377,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1419
1377
|
.text-black\\/60 {
|
|
1420
1378
|
color: color-mix(in srgb, #000 60%, transparent);
|
|
1421
1379
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1422
|
-
|
|
1423
|
-
color: color-mix(in oklab, var(--color-black) 60%, transparent);
|
|
1424
|
-
}
|
|
1380
|
+
color: color-mix(in oklab, var(--color-black) 60%, transparent);
|
|
1425
1381
|
}
|
|
1426
1382
|
}
|
|
1427
1383
|
.text-blue-500 {
|
|
@@ -1617,9 +1573,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1617
1573
|
@media (hover: hover) {
|
|
1618
1574
|
border-color: color-mix(in srgb, oklch(86.9% 0.022 252.894) 60%, transparent);
|
|
1619
1575
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1620
|
-
|
|
1621
|
-
border-color: color-mix(in oklab, var(--color-slate-300) 60%, transparent);
|
|
1622
|
-
}
|
|
1576
|
+
border-color: color-mix(in oklab, var(--color-slate-300) 60%, transparent);
|
|
1623
1577
|
}
|
|
1624
1578
|
}
|
|
1625
1579
|
}
|
|
@@ -1629,9 +1583,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1629
1583
|
@media (hover: hover) {
|
|
1630
1584
|
border-color: color-mix(in srgb, #fff 50%, transparent);
|
|
1631
1585
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1632
|
-
|
|
1633
|
-
border-color: color-mix(in oklab, var(--color-white) 50%, transparent);
|
|
1634
|
-
}
|
|
1586
|
+
border-color: color-mix(in oklab, var(--color-white) 50%, transparent);
|
|
1635
1587
|
}
|
|
1636
1588
|
}
|
|
1637
1589
|
}
|
|
@@ -1641,9 +1593,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1641
1593
|
@media (hover: hover) {
|
|
1642
1594
|
border-color: color-mix(in srgb, #fff 60%, transparent);
|
|
1643
1595
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1644
|
-
|
|
1645
|
-
border-color: color-mix(in oklab, var(--color-white) 60%, transparent);
|
|
1646
|
-
}
|
|
1596
|
+
border-color: color-mix(in oklab, var(--color-white) 60%, transparent);
|
|
1647
1597
|
}
|
|
1648
1598
|
}
|
|
1649
1599
|
}
|
|
@@ -1653,9 +1603,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1653
1603
|
@media (hover: hover) {
|
|
1654
1604
|
background-color: color-mix(in srgb, #000 5%, transparent);
|
|
1655
1605
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1656
|
-
|
|
1657
|
-
background-color: color-mix(in oklab, var(--color-black) 5%, transparent);
|
|
1658
|
-
}
|
|
1606
|
+
background-color: color-mix(in oklab, var(--color-black) 5%, transparent);
|
|
1659
1607
|
}
|
|
1660
1608
|
}
|
|
1661
1609
|
}
|
|
@@ -1707,9 +1655,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1707
1655
|
@media (hover: hover) {
|
|
1708
1656
|
background-color: color-mix(in srgb, #fff 80%, transparent);
|
|
1709
1657
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1710
|
-
|
|
1711
|
-
background-color: color-mix(in oklab, var(--color-white) 80%, transparent);
|
|
1712
|
-
}
|
|
1658
|
+
background-color: color-mix(in oklab, var(--color-white) 80%, transparent);
|
|
1713
1659
|
}
|
|
1714
1660
|
}
|
|
1715
1661
|
}
|
|
@@ -1719,9 +1665,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1719
1665
|
@media (hover: hover) {
|
|
1720
1666
|
background-color: color-mix(in srgb, #fff 85%, transparent);
|
|
1721
1667
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1722
|
-
|
|
1723
|
-
background-color: color-mix(in oklab, var(--color-white) 85%, transparent);
|
|
1724
|
-
}
|
|
1668
|
+
background-color: color-mix(in oklab, var(--color-white) 85%, transparent);
|
|
1725
1669
|
}
|
|
1726
1670
|
}
|
|
1727
1671
|
}
|
|
@@ -1731,9 +1675,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1731
1675
|
@media (hover: hover) {
|
|
1732
1676
|
background-color: color-mix(in srgb, #fff 90%, transparent);
|
|
1733
1677
|
@supports (color: color-mix(in lab, red, red)) {
|
|
1734
|
-
|
|
1735
|
-
background-color: color-mix(in oklab, var(--color-white) 90%, transparent);
|
|
1736
|
-
}
|
|
1678
|
+
background-color: color-mix(in oklab, var(--color-white) 90%, transparent);
|
|
1737
1679
|
}
|
|
1738
1680
|
}
|
|
1739
1681
|
}
|
|
@@ -2223,5 +2165,5 @@ Check the top-level render call using <`+G+">.")}return O}}function ii(m,O){{if(
|
|
|
2223
2165
|
<%s {...props} />
|
|
2224
2166
|
React keys must be passed directly to JSX without using spread:
|
|
2225
2167
|
let props = %s;
|
|
2226
|
-
<%s key={someKey} {...props} />`,ct,Zn,Sa,Zn),ur[Zn+ct]=!0}}return m===k?yr(st):Wi(st),st}}function Ua(m,O,G){return In(m,O,G,!0)}function xa(m,O,G){return In(m,O,G,!1)}var Fa=xa,Ha=Ua;yv.Fragment=k,yv.jsx=Fa,yv.jsxs=Ha})()),yv}var nb;function fE(){return nb||(nb=1,process.env.NODE_ENV==="production"?hy.exports=sE():hy.exports=cE()),hy.exports}var _=fE();const mc=(v,E)=>v.className===E.className,dE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",children:_.jsx("path",{d:"M4 7h16M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3m-5 5l4 4m0-4l-4 4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})),gv=tt.memo(({className:v=""})=>_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",className:v,children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})}));tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2m-8 0V9M9 9h6"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8.56 3.69a9 9 0 0 0-2.92 1.95M3.69 8.56A9 9 0 0 0 3 12m.69 3.44a9 9 0 0 0 1.95 2.92m2.92 1.95A9 9 0 0 0 12 21m3.44-.69a9 9 0 0 0 2.92-1.95m1.95-2.92A9 9 0 0 0 21 12m-.69-3.44a9 9 0 0 0-1.95-2.92m-2.92-1.95A9 9 0 0 0 12 3"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8.56 3.69a9 9 0 0 0-2.92 1.95M3.69 8.56A9 9 0 0 0 3 12m.69 3.44a9 9 0 0 0 1.95 2.92m2.92 1.95A9 9 0 0 0 12 21m3.44-.69a9 9 0 0 0 2.92-1.95m1.95-2.92A9 9 0 0 0 21 12m-.69-3.44a9 9 0 0 0-1.95-2.92m-2.92-1.95A9 9 0 0 0 12 3m-3 9l2 2l4-4"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),_.jsx("path",{d:"m9 11l3 3l3-3"})]})}));const pE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"currentColor",d:"m12 2l.324.001l.318.004l.616.017l.299.013l.579.034l.553.046c4.785.464 6.732 2.411 7.196 7.196l.046.553l.034.579q.008.147.013.299l.017.616L22 12l-.005.642l-.017.616l-.013.299l-.034.579l-.046.553c-.464 4.785-2.411 6.732-7.196 7.196l-.553.046l-.579.034q-.147.008-.299.013l-.616.017L12 22l-.642-.005l-.616-.017l-.299-.013l-.579-.034l-.553-.046c-4.785-.464-6.732-2.411-7.196-7.196l-.046-.553l-.034-.579l-.013-.299l-.017-.616Q2 12.327 2 12l.001-.324l.004-.318l.017-.616l.013-.299l.034-.579l.046-.553c.464-4.785 2.411-6.732 7.196-7.196l.553-.046l.579-.034q.147-.008.299-.013l.616-.017Q11.673 2 12 2m0 6a1 1 0 0 0-1 1v2H9l-.117.007A1 1 0 0 0 9 13h2v2l.007.117A1 1 0 0 0 13 15v-2h2l.117-.007A1 1 0 0 0 15 11h-2V9l-.007-.117A1 1 0 0 0 12 8"})})),wv=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16H6a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1m-4 7h6m-3-3v6"})}));tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 8V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-2"}),_.jsx("path",{d:"M15 12H3l3-3m0 6l-3-3"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0"}),_.jsx("path",{d:"M13.048 17.942A9 9 0 0 1 12 18q-5.4 0-9-6q3.6-6 9-6t9 6a18 18 0 0 1-1.362 1.975M22 22l-5-5m0 5l5-5"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0"}),_.jsx("path",{d:"M11.192 17.966Q6.33 17.546 3 12q3.6-6 9-6q4.989 0 8.442 5.122M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97L18 22h-3v-3z"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M18 6L6 18M6 6l12 12"})}));const vE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),_.jsx("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})]})}),mc);tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M6 9l6 6l6 -6"})]}),mc),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),_.jsx("path",{d:"M7 11l5 5l5 -5"}),_.jsx("path",{d:"M12 4l0 12"})]})),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),_.jsx("path",{d:"M7 9l5 -5l5 5"}),_.jsx("path",{d:"M12 4l0 12"})]}),mc),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M7 8l-4 4l4 4"}),_.jsx("path",{d:"M17 8l4 4l-4 4"}),_.jsx("path",{d:"M14 4l-4 16"})]}),mc);const hE=tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M12 10v-7l3 3"}),_.jsx("path",{d:"M9 6l3 -3"}),_.jsx("path",{d:"M12 14v7l3 -3"}),_.jsx("path",{d:"M9 18l3 3"}),_.jsx("path",{d:"M18 3h1a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-1"}),_.jsx("path",{d:"M6 3h-1a2 2 0 0 0 -2 2v14a2 2 0 0 0 2 2h1"})]}),mc),mE=tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M12 3v7l3 -3"}),_.jsx("path",{d:"M9 7l3 3"}),_.jsx("path",{d:"M12 21v-7l3 3"}),_.jsx("path",{d:"M9 17l3 -3"}),_.jsx("path",{d:"M18 9h1a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-1"}),_.jsx("path",{d:"M6 9h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1"})]}),mc);function Ko({ctrl:v,children:E}){var b,k,R,j;const[g,A]=Gu.useState(!0),U=K=>{var V;K.stopPropagation(),v.selected||(V=v.onRowClick)==null||V.call(v,K),v.toggleEdit()},$=K=>{K.stopPropagation(),v.remove()},re=K=>{var V;v.insideSection||(V=v.onRowClick)==null||V.call(v,K)};return v.isPreview||v.insideSection?_.jsxs("div",{className:v.wrapperClass,onClick:v.insideSection?void 0:v.onRowClick,"data-field-id":(b=v.field)==null?void 0:b.id,"data-inside-section":v.insideSection?"true":"false","data-selected":v.selected?"true":"false","aria-selected":v.selected||void 0,tabIndex:-1,children:[v.isPreview?null:_.jsx("div",{children:v.insideSection?`${v.label}`:`(${v.label}) ${v.field.title}`}),typeof E=="function"?E({api:v.api,isPreview:v.isPreview,field:v.field,insideSection:v.insideSection,sectionId:v.sectionId,selected:v.selected}):E]}):_.jsxs("div",{className:v.wrapperClass+" group",onClick:re,"data-field-id":(k=v.field)==null?void 0:k.id,"data-inside-section":v.insideSection?"true":"false","data-selected":v.selected?"true":"false","aria-selected":v.selected||void 0,tabIndex:-1,children:[_.jsxs("div",{className:`flex justify-between items-center ${g?"pb-2.5":""}`,children:[_.jsx("div",{className:"text-left w-full select-none",children:v.insideSection?`${v.label}`:v.field.fieldType==="section"?`(${v.label}) ${v.field.title}`:`${v.label} ${v.field.question}`}),_.jsxs("div",{className:`flex items-center gap-2 ml-2 ${v.insideSection?"hidden":""}`,children:[_.jsx("button",{onClick:U,className:"block lg:hidden",title:"Edit","aria-label":"Edit field",children:_.jsx(vE,{className:"h-6 w-6"})}),_.jsx("button",{type:"button",onClick:K=>{K.stopPropagation(),A(V=>!V)},"aria-expanded":g,"aria-controls":`fw-body-${(R=v.field)==null?void 0:R.id}`,title:g?"Collapse":"Expand","aria-label":g?"Collapse field":"Expand field",className:"p-1",children:g?_.jsx(mE,{className:"h-5 w-5"}):_.jsx(hE,{className:"h-5 w-5"})}),_.jsx("button",{onClick:$,title:"Delete","aria-label":"Delete field",children:_.jsx(dE,{className:"h-6 w-6"})})]})]}),g&&_.jsx("div",{id:`fw-body-${(j=v.field)==null?void 0:j.id}`,children:typeof E=="function"?E({api:v.api,isPreview:v.isPreview,field:v.field,insideSection:v.insideSection,sectionId:v.sectionId,selected:v.selected}):E})]})}function my(v="",E="",b=new Set){const k=E||"field";if(!b.has(k))return k;let R=1,j=`${k}-${R}`;for(;b.has(j);)R++,j=`${k}-${R}`;return j}function yy(v="",E=new Set,b=""){const k=b?`${b}-option`:"option";if(!E.has(k))return k;let R=1,j=`${k}-${R}`;for(;E.has(j);)R++,j=`${k}-${R}`;return j}const yE=(v,E="")=>{if(!Array.isArray(v))return[];const b=new Set;return v.map(k=>{if(typeof k=="string"){const R=yy(k,b,E);return b.add(R),{id:R,value:k}}else{const R=k.id||yy(k.value,b,E);return b.add(R),{id:R,...k}}})},gy=v=>{const{fieldType:E,id:b,question:k,title:R,...j}=v;return{fieldType:E,id:b,...v.fieldType==="section"?{title:R}:{question:k},...j,...!["text","longtext"].includes(E)&&{options:yE(j.options||[],b)}}};function gE(v){switch(v==null?void 0:v.fieldType){case"text":case"longtext":return v.answer??"";case"radio":case"dropdown":return v.selected??null;case"check":return Array.isArray(v.selected)?v.selected:Array.isArray(v.options)?v.options.filter(E=>E==null?void 0:E.selected).map(E=>E.id??E.value):[];default:return null}}function rb(v){return v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wE(v,E){const b=E==null?void 0:E[v==null?void 0:v.targetId];if(!b)return!1;const k=gE(b),R=v==null?void 0:v.value;switch(v==null?void 0:v.operator){case"equals":return Array.isArray(k)?!1:String(k??"")===String(R??"");case"contains":{const j=$=>String($??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),g=j(k).replace(/[^a-z0-9]+/g," ").trim(),A=j(R).trim();if(!A)return!1;const U=A.split(/\s+/);return(U.length===1?new RegExp(`(?:^|\\s)${rb(U[0])}(?:\\s|$)`):new RegExp(`(?:^|\\s)${U.map($=>rb($)).join("\\s+")}(?:\\s|$)`)).test(g)}case"includes":return Array.isArray(k)?k.map(String).includes(String(R)):!1;default:return!1}}function ab(v,E){const b=v==null?void 0:v.enableWhen;if(!b||!Array.isArray(b.conditions)||b.conditions.length===0)return!0;const k=Array.isArray(E)?E.reduce((j,g)=>(g!=null&&g.id&&(j[g.id]=g),j),{}):E,R=b.conditions.map(j=>wE(j,k));return(b.logic||"AND").toUpperCase()==="AND"?R.every(Boolean):R.some(Boolean)}const ib=(v,E)=>{if(v===E)return!0;if(!v||!E)return!1;const b=Object.keys(v),k=Object.keys(E);if(b.length!==k.length)return!1;for(const R of b)if(v[R]!==E[R])return!1;return!0},lb=(v,E,b)=>typeof b!="number"||b<0||b>v.length?[...v,E]:[...v.slice(0,b),E,...v.slice(b)],bE=v=>{const E={},b=[],k=new Set;return(v||[]).forEach(R=>{let j=R.id;if(!j){const A=R.question||R.title||"",U=R.fieldType||"field";j=my(A,U,k)}k.add(j);const g=gy({...R,id:j});g.fieldType==="section"&&Array.isArray(g.fields)&&(g.fields=g.fields.map(A=>{let U=A.id;if(!U){const $=A.question||A.title||"",re=A.fieldType||"field";U=my($,re,k),k.add(U)}return gy({...A,id:U})})),E[j]=g,b.push(j)}),{byId:E,order:b}};function Xu(v,E,b,k,R={}){const{onIdChange:j,forbidCollision:g=!0}=R;if(!b){const V=v.byId[E];if(!V)return null;const I=k(V,null);if(!I||ib(V,I))return null;if(I.id&&I.id!==E){const ce=I.id;if(g&&v.byId[ce])return null;const{[E]:ze,...Oe}=v.byId,ht={...Oe,[ce]:I},we=v.order.map($e=>$e===E?ce:$e);return j==null||j(ce,E),{byId:ht,order:we}}return{byId:{...v.byId,[E]:I}}}const A=v.byId[b];if(!A||!Array.isArray(A.fields))return null;let U=!1,$=null;const re=A.fields.map(V=>{if(V.id!==E)return V;const I=k(V,A);if(!I||ib(V,I))return V;if(I.id&&I.id!==E){if(g&&A.fields.some(ce=>ce.id===I.id&&ce!==V))return V;$=I.id}return U=!0,I});if(!U)return null;const K={...v.byId,[b]:{...A,fields:re}};return $&&(j==null||j($,E)),{byId:K}}const ma=Zw((v,E)=>({byId:{},order:[],setEnableWhen:(b,k)=>v(R=>{const j=R.byId[b];if(!j)return R;const g=k&&Array.isArray(k.conditions)?{logic:k.logic||"AND",conditions:k.conditions}:void 0;return{byId:{...R.byId,[b]:{...j,...g?{enableWhen:g}:{enableWhen:void 0}}}}}),replaceAll:b=>v(()=>bE(b)),addField:(b,k={})=>v(R=>{var j,g;const{sectionId:A,initialPatch:U={},index:$}=k,re=(j=xv[b])==null?void 0:j.defaultProps;if(!re)return R;const K=new Set(Object.keys(R.byId));A&&(g=R.byId[A])!=null&&g.fields&&R.byId[A].fields.forEach(we=>K.add(we.id));const V=(U==null?void 0:U.question)||re.question||"",I=(U==null?void 0:U.title)||re.title||"",ce=my(b==="section"?I:V,b,K),ze=gy({...re,...U,id:ce});if(!A)return{byId:{...R.byId,[ce]:ze},order:lb(R.order,ce,$)};const Oe=R.byId[A];if(!Oe||!Array.isArray(Oe.fields))return R;const ht=lb(Oe.fields,ze,$);return{byId:{...R.byId,[A]:{...Oe,fields:ht}}}}),updateField:(b,k,R={})=>v(j=>{const{sectionId:g,onIdChange:A}=R;return Xu(j,b,g,$=>{const re=typeof k=="function"?k($):k;if(!re)return null;const{fieldType:K,id:V,question:I,title:ce,...ze}={...$,...re};return{fieldType:K,id:V,...K==="section"?{title:ce}:{question:I},...ze}},{onIdChange:A,forbidCollision:!0})||j}),deleteField:(b,k={})=>v(R=>{const{sectionId:j}=k;if(!j){if(!R.byId[b])return R;const{[b]:U,...$}=R.byId;return{byId:$,order:R.order.filter(re=>re!==b)}}const g=R.byId[j];if(!g||!Array.isArray(g.fields))return R;const A=g.fields.filter(U=>U.id!==b);return A.length===g.fields.length?R:{byId:{...R.byId,[j]:{...g,fields:A}}}}),addOption:(b,k="",R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.options)?U.options:[],re=new Set($.map(I=>I.id)),K=yy(k,re,b),V=[...$,{id:K,value:k}];return{...U,options:V}})||j}),updateOption:(b,k,R,j={})=>v(g=>{const{sectionId:A}=j;return Xu(g,b,A,$=>{const re=Array.isArray($.options)?$.options:[];let K=!1;const V=re.map(I=>I.id!==k||I.value===R?I:(K=!0,{id:I.id,value:R}));return K?{...$,options:V}:null})||g}),updateOptionAnswer:(b,k,R,j={})=>v(g=>{const{sectionId:A}=j;return Xu(g,b,A,$=>{const re=Array.isArray($.options)?$.options:[];let K=!1;const V=re.map(I=>I.id!==k||I.answer===R?I:(K=!0,{...I,answer:R}));return K?{...$,options:V}:null})||g}),deleteOption:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.options)?U.options:[],re=$.filter(V=>V.id!==k);if(re.length===$.length)return null;const K={...U,options:re};if(Array.isArray(U.selected)){const V=U.selected.filter(I=>I!==k);V.length!==U.selected.length&&(K.selected=V)}else U.selected===k&&(K.selected="");return K})||j}),selectSingle:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=k??"";return U.selected===$?null:{...U,selected:$}})||j}),toggleMulti:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.selected)?U.selected:[],re=$.includes(k),K=re?$.filter(V=>V!==k):[...$,k];return K.length===$.length&&re?null:{...U,selected:K}})||j})})),xE=v=>{const E=ma(k=>k.order),b=ma(k=>k.byId);return tt.useMemo(()=>{const k=E.map(j=>b[j]),R=[];return k.forEach(j=>{R.push(j),(j==null?void 0:j.fieldType)==="section"&&Array.isArray(j.fields)&&R.push(...j.fields)}),v?{fields:k.filter(j=>ab(j,R)),allFlat:R}:{fields:k,allFlat:R}},[E,b,v])},Un=Zw((v,E)=>({isPreview:!1,setPreview:b=>v({isPreview:!!b}),togglePreview:()=>v(b=>({isPreview:!b.isPreview})),isEditModalOpen:!1,setEditModalOpen:b=>v(k=>({isEditModalOpen:typeof b=="function"?!!b(k.isEditModalOpen):!!b})),panelResetKey:0,selectedFieldId:null,setSelectField:b=>v(k=>{const R=b??null;return k.selectedFieldId===R?{}:{selectedFieldId:R,panelResetKey:k.panelResetKey+1}}),clearSelectedField:()=>v({selectedFieldId:null}),renameSelectedFieldId:b=>v({selectedFieldId:b}),selectedChildId:{parentId:null,childId:null},setSelectedChildId:(b,k)=>v(R=>{const j=b??null,g=k??null;return R.selectedChildId.parentId===j&&R.selectedChildId.childId===g?{}:{selectedChildId:{parentId:j,childId:g}}}),clearSelectedChildId:()=>v(b=>b.selectedChildId.parentId===null&&b.selectedChildId.childId===null?{}:{selectedChildId:{parentId:null,childId:null}}),renameSelectedChildParentId:b=>v(k=>({selectedChildId:{...k.selectedChildId,parentId:b??null}})),renameSelectedChildId:b=>v(k=>({selectedChildId:{...k.selectedChildId,childId:b??null}})),conversionReport:null,setConversionReport:b=>v({conversionReport:b}),clearConversionReport:()=>v({conversionReport:null}),hideUnsupportedFields:!1,setHideUnsupportedFields:b=>v({hideUnsupportedFields:!!b})})),SE=(v,E)=>{const b=ma(V=>V.addField),k=ma(V=>V.updateField),R=ma(V=>V.deleteField),j=ma(V=>V.addOption),g=ma(V=>V.updateOption),A=ma(V=>V.updateOptionAnswer),U=ma(V=>V.deleteOption),$=ma(V=>V.selectSingle),re=ma(V=>V.toggleMulti),K=tt.useCallback((V,I)=>{var ce,ze;const Oe=Un.getState();Oe.selectedFieldId===I&&((ce=Oe.renameSelectedFieldId)==null||ce.call(Oe,V)),(ze=Oe.renameSectionIdInHighlight)==null||ze.call(Oe,I,V)},[]);return tt.useMemo(()=>({field:{add:(V,I,ce)=>b(V,{sectionId:E,initialPatch:I,index:ce}),update:(V,I)=>k(v,{[V]:I},{sectionId:E,onIdChange:K}),patch:V=>k(v,V,{sectionId:E,onIdChange:K}),renameId:V=>k(v,{id:V},{sectionId:E,onIdChange:K}),remove:()=>R(v,{sectionId:E})},option:{add:(V="")=>j(v,V,{sectionId:E}),update:(V,I)=>g(v,V,I,{sectionId:E}),updateAnswer:(V,I)=>A(v,V,I,{sectionId:E}),remove:V=>U(v,V,{sectionId:E})},selection:{single:V=>$(v,V,{sectionId:E}),multiToggle:V=>re(v,V,{sectionId:E})},section:{addChild:(V,I,ce)=>b(V,{sectionId:v,initialPatch:I,index:ce})}}),[v,E,b,k,R,j,g,A,U,$,re,K])},bv=()=>{const v=Un(ve=>ve.isPreview),E=Un(ve=>ve.panelResetKey),b=Un(ve=>ve.selectedFieldId),k=Un(ve=>ve.isEditModalOpen),R=Un(ve=>ve.conversionReport),j=Un(ve=>ve.setPreview),g=Un(ve=>ve.togglePreview),A=Un(ve=>ve.setSelectField),U=Un(ve=>ve.clearSelectedField),$=Un(ve=>ve.renameSelectedFieldId),re=Un(ve=>ve.setEditModalOpen),K=Un(ve=>ve.setConversionReport),V=Un(ve=>ve.clearConversionReport),I=Un(ve=>ve.setHideUnsupportedFields),ce=Un(ve=>ve.selectedChildId),ze=Un(ve=>ve.setSelectedChildId),Oe=Un(ve=>ve.clearSelectedChildId),ht=Un(ve=>ve.renameSelectedChildParentId),we=Un(ve=>ve.renameSelectedChildId),$e=tt.useCallback(()=>re(!0),[re]),dt=tt.useCallback(()=>re(!1),[re]),Ne=tt.useCallback(()=>re(ve=>!ve),[re]);return tt.useMemo(()=>({state:{isPreview:v,isEditModalOpen:k,panelResetKey:E},isPreview:v,preview:{set:j,toggle:g},modal:{set:re,open:$e,close:dt,toggle:Ne},selectedFieldId:{value:b,set:A,clear:U,rename:$},selectedChildId:{ChildId:(ce==null?void 0:ce.childId)??null,ParentId:(ce==null?void 0:ce.parentId)??null,BothId:ce||{parentId:null,childId:null},set:ze,clear:Oe,renameParentId:ht,renameChildId:we},conversionReport:R,setConversionReport:K,clearConversionReport:V,setHideUnsupportedFields:I}),[v,k,E,j,g,b,A,U,$,re,$e,dt,Ne,ce,ze,Oe,ht,we,R,K,V,I])};function Xo(v,E){var b;const k=bv(),R=SE(v.id,E),j=((b=xv[v.fieldType])==null?void 0:b.label)??"Field",g=!!E,A=k.selectedFieldId.value===v.id,U=tt.useCallback(K=>{var V;k.state.isPreview||((V=K==null?void 0:K.stopPropagation)==null||V.call(K),k.selectedFieldId.value!==v.id&&k.selectedFieldId.set(v.id))},[k,v.id]),$=tt.useCallback(()=>{R.field.remove(),A&&k.selectedFieldId.clear()},[R,A,k]),re=["rounded-lg bg-white",k.state.isPreview?"":"border",!g&&k.state.isPreview?"border":"",v.fieldType==="section"&&k.state.isPreview?"p-0 border":"p-4",A?"border-blue-300 border-2 border-dashed":"border-gray-200"].join(" ");return{field:v,sectionId:E,label:j,insideSection:g,isPreview:k.state.isPreview,selected:A,isEditModalOpen:k.state.isEditModalOpen,onRowClick:U,toggleEdit:k.modal.toggle,remove:$,api:R,wrapperClass:re}}const EE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("input",{type:"text",value:g.answer||"",onChange:A=>k.field.update("answer",A.target.value),placeholder:"Type your answer",className:"px-4 py-2 w-full border border-black/10 shadow-2xs rounded"})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),_.jsx("input",{type:"text",value:g.answer||"",placeholder:"Type your answer",className:"px-4 py-2 my-1.5 w-full border border-black/10 shadow-2xs rounded",disabled:!0})]})})}),CE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("textarea",{value:g.answer||"",onChange:A=>k.field.update("answer",A.target.value),placeholder:"Type your answer",className:"px-3 py-2 w-full border border-black/10 shadow-2xs rounded min-h-24 max-h-60 resize-y",rows:4})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),ange:!0,name:!0,placeholder:"Enter question"}),_.jsx("textarea",{value:g.answer||"",placeholder:"Type your answer",className:"px-3 py-2 my-1.5 w-full border border-black/10 shadow-2xs rounded min-h-24 max-h-56 resize-y",rows:4,disabled:!0})]})})}),kE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{className:"space-y-2",children:(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center border border-black/10 shadow-2xs rounded overflow-hidden",children:[_.jsx("label",{className:"px-4 py-2 text-sm text-gray-500 bg-gray-50 whitespace-nowrap border-r border-black/10",children:A.value}),_.jsx("input",{type:"text",value:A.answer||"",onChange:U=>k.option.updateAnswer(A.id,U.target.value),placeholder:"",className:"flex-1 px-4 py-2 border-0 outline-none focus:ring-0"})]},A.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Field label",className:"w-full py-2"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Field"]})]})})}),RE=tt.memo(function({id:v,name:E,value:b,checked:k,onSelect:R,onUnselect:j,className:g="",...A}){const U=tt.useRef(k);return tt.useEffect(()=>{U.current=k},[k]),_.jsx("input",{id:v,type:"radio",name:E,value:b,className:g,checked:k,onClick:()=>{U.current?j==null||j(b):R==null||R(b)},onChange:()=>{},...A})}),TE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:(g.options||[]).map(A=>{const U=`${g.id}-${A.id}`,$=g.selected===A.id;return _.jsxs("label",{htmlFor:U,className:"flex items-center px-3 py-1 my-2 cursor-pointer",children:[_.jsx(RE,{id:U,name:`question-${g.id}`,value:A.id,checked:$,onSelect:()=>k.selection.single(A.id),onUnselect:()=>k.field.update("selected",null),className:"mr-2 h-9 w-9 flex-shrink-0 cursor-pointer"}),A.value]},A.id)})})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"radio",disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full py-2"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),_E=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:(g.options||[]).map(A=>_.jsxs("label",{className:"flex items-center px-3 py-1 my-2",children:[_.jsx("input",{type:"checkbox",className:"mr-2 w-9 h-9",checked:Array.isArray(g.selected)&&g.selected.includes(A.id),onChange:()=>k.selection.multiToggle(A.id)}),A.value]},A.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-3 shadow my-1.5 border border-black/10 rounded-lg h-10",children:[_.jsx("input",{type:"checkbox",disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),DE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:_.jsxs("select",{className:"w-full px-4 shadow border border-black/10 rounded-lg h-10",value:g.selected||"",onChange:A=>k.selection.single(A.target.value),children:[_.jsx("option",{value:"",children:"Select an option"}),(g.options||[]).map(A=>_.jsx("option",{value:A.id,children:A.value},A.id))]})})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),_.jsx("div",{className:"mt-2",children:_.jsxs("select",{className:"w-full px-4 shadow border border-black/10 rounded-lg h-10",disabled:!0,children:[_.jsx("option",{value:"",children:"Select an option"}),(g.options||[]).map(A=>_.jsx("option",{value:A.id,children:A.value},A.id))]})}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-3 shadow my-1.5 border border-black/10 rounded-lg h-10",children:[_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),OE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>{var A;const U=((A=g.options)==null?void 0:A.length)===2?g.options:[{id:"yes",value:"Yes"},{id:"no",value:"No"}];return R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{className:"flex gap-2",children:U.map($=>_.jsxs("label",{className:`flex-1 flex items-center justify-center px-4 py-2 border rounded-lg cursor-pointer ${g.selected===$.id?"bg-[#0076a8] text-white border-[#0076a8]":"border-black/10 hover:bg-gray-50"}`,onClick:re=>{re.preventDefault(),g.selected===$.id?k.field.update("selected",null):k.selection.single($.id)},children:[_.jsx("input",{type:"radio",name:g.fieldId,checked:g.selected===$.id,onChange:()=>{},className:"sr-only"}),_.jsx("span",{children:$.value})]},$.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:$=>k.field.update("question",$.target.value),placeholder:"Enter question"}),U.map(($,re)=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"radio",name:`${g.fieldId}-edit`,disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:$.value,onChange:K=>k.option.update(re,"value",K.target.value),placeholder:`Option ${re+1}`,className:"w-full py-2"})]},$.id))]})}})});function NE({field:v}){const[E,b]=Gu.useState(!1),k=v.unsupportedType||"unknown",R=v.unsupportedData||v._sourceData||{};return _.jsxs("div",{className:"border-2 border-dashed border-orange-500 rounded-lg p-4 bg-orange-50 mb-4",children:[_.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[_.jsx("span",{className:"text-xl",children:"⚠️"}),_.jsxs("div",{className:"flex-1",children:[_.jsxs("strong",{className:"text-orange-700",children:["Unsupported Field Type: ",k]}),_.jsx("div",{className:"text-sm text-gray-600 mt-1",children:v.question||R.title||R.name||"No title"})]})]}),_.jsxs("div",{className:"mt-3 p-3 bg-white border border-gray-300 rounded text-sm",children:[_.jsx("div",{className:"text-xs text-gray-500 mb-2 font-semibold",children:"Original Data Preview:"}),_.jsxs("div",{className:"space-y-1 text-gray-700",children:[Object.entries(R).slice(0,5).map(([j,g])=>typeof g=="object"&&g!==null?_.jsxs("div",{className:"truncate",children:[_.jsxs("span",{className:"font-mono text-xs text-blue-600",children:[j,":"]})," ",_.jsx("span",{className:"text-gray-500 italic",children:Array.isArray(g)?"[Array]":"{Object}"})]},j):_.jsxs("div",{className:"truncate",children:[_.jsxs("span",{className:"font-mono text-xs text-blue-600",children:[j,":"]})," ",_.jsx("span",{className:"text-gray-800",children:String(g)})]},j)),Object.keys(R).length>5&&_.jsxs("div",{className:"text-xs text-gray-400 italic",children:["... and ",Object.keys(R).length-5," more properties"]})]})]}),_.jsxs("button",{type:"button",onClick:()=>b(!E),className:"mt-3 px-3 py-1.5 bg-orange-500 text-white rounded hover:bg-orange-600 text-sm transition-colors",children:[E?"▼ Hide":"▶ Show"," Full Data"]}),E&&_.jsxs("div",{className:"mt-3",children:[_.jsx("div",{className:"text-xs text-gray-600 mb-2 font-semibold",children:"Full SurveyJS data for manual conversion:"}),_.jsx("pre",{className:"bg-gray-100 p-3 rounded text-xs overflow-auto max-h-[300px] border border-gray-300",children:JSON.stringify(R,null,2)})]}),_.jsx("div",{className:"mt-3 text-xs text-gray-600 italic",children:"💡 This field type is not yet supported. Manual implementation required."})]})}const xv={section:{label:"Section Field",componentKey:"section",defaultProps:{fieldType:"section",title:"New section",fields:[]}},text:{label:"Text Field",componentKey:"text",defaultProps:{fieldType:"text",question:"",answer:""}},longtext:{label:"Long Text Field",componentKey:"longtext",defaultProps:{fieldType:"longtext",question:"",answer:""}},multitext:{label:"Multi Text Field",componentKey:"multitext",defaultProps:{fieldType:"multitext",question:"",options:[{value:"Field 1"},{value:"Field 2"},{value:"Field 3"}]}},radio:{label:"Radio Field",componentKey:"radio",defaultProps:{fieldType:"radio",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:null}},check:{label:"Check Field",componentKey:"check",defaultProps:{fieldType:"check",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:[]}},boolean:{label:"Boolean Field",componentKey:"boolean",defaultProps:{fieldType:"boolean",question:"",options:[{id:"yes",value:"Yes"},{id:"no",value:"No"}],selected:null}},dropdown:{label:"Dropdown Field",componentKey:"dropdown",defaultProps:{fieldType:"dropdown",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:null}},unsupported:{label:"Unsupported Field",componentKey:"unsupported",defaultProps:{fieldType:"unsupported",question:"Unsupported field type",unsupportedType:"unknown",unsupportedData:{}}}},wy={text:EE,longtext:CE,multitext:kE,radio:TE,check:_E,boolean:OE,dropdown:DE,unsupported:NE};function ME(v,E){wy[v]||(wy[v]=E)}function by(v){return wy[v]||null}const LE=tt.memo(function({field:v}){const E=Xo(v),b=bv(),k=Un(I=>I.hideUnsupportedFields),R=b.selectedChildId.ParentId,j=b.selectedChildId.ChildId,g=R===v.id?j:null,A=Gu.useRef({}),U=ma(I=>I.byId),$=Gu.useMemo(()=>{const I=Object.values(U),ce=[];return I.forEach(ze=>{ze&&(ce.push(ze),ze.fieldType==="section"&&Array.isArray(ze.fields)&&ce.push(...ze.fields))}),ce},[U]);Gu.useEffect(()=>{var I;if(E.isPreview||!g)return;const ce=A.current[g];(I=ce==null?void 0:ce.scrollIntoView)==null||I.call(ce,{behavior:"smooth",block:"nearest"})},[g,E.isPreview]);const re=I=>k&&I.fieldType==="unsupported",K=(I,ce)=>{const ze=by(I.fieldType);return!ze||re(I)||!ab(I,$)?null:_.jsx("div",{ref:Oe=>Oe&&(A.current[I.id]=Oe),children:_.jsx(ze,{field:I,sectionId:ce})},I.id)},V=(I,ce)=>{const ze=by(I.fieldType);if(!ze||re(I))return null;const Oe=g===I.id;return _.jsx("div",{ref:ht=>ht&&(A.current[I.id]=ht),className:["rounded-lg mb-3",Oe?"border-2 border-blue-400 border-dashed":"border border-transparent"].join(" "),children:_.jsx(ze,{field:I,sectionId:ce})},I.id)};return _.jsx(Ko,{ctrl:E,children:({api:I,isPreview:ce,insideSection:ze,field:Oe})=>{const ht=Array.isArray(Oe.fields)?Oe.fields:[];return ce?_.jsxs("section",{className:ze?"border-b border-gray-200":"border-0",children:[_.jsx("div",{className:"bg-[#0076a8] text-white text-xl px-4 py-2 rounded-t-lg",children:Oe.title||"Section"}),ht.map(we=>K(we,Oe.id))]}):_.jsxs("div",{children:[_.jsx("div",{className:"flex justify-between items-center mb-3 gap-2",children:_.jsx("div",{className:"flex-1",children:_.jsx("input",{type:"text",className:"w-full px-3 py-2 border border-gray-200 rounded-md",value:Oe.title||"",onChange:we=>I.field.update("title",we.target.value),placeholder:"Section title (e.g., Data Consent)"})})}),_.jsx("div",{children:ht.map(we=>V(we,Oe.id))}),_.jsxs("div",{className:"mb-3",children:[_.jsx("div",{className:"text-sm font-medium text-gray-700 mb-2",children:"Add a field"}),_.jsx("div",{className:"flex flex-wrap gap-2",children:Object.keys(xv).filter(we=>we!=="section").map(we=>_.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-2 text-sm border border-gray-300 rounded-md hover:bg-gray-50",onClick:()=>{var $e,dt,Ne;return($e=I.section)!=null&&$e.addChild?I.section.addChild(we):(Ne=(dt=I.field).add)==null?void 0:Ne.call(dt,we,void 0,void 0)},children:[_.jsx(pE,{className:"h-4 w-4"}),"Add ",xv[we].label]},we))})]})]})}})});ME("section",LE);function jE(v,E="inhouse"){if(!v)return{fields:[],conversionReport:null};switch(E){case"surveyjs":return AE(v);case"inhouse":return{fields:Array.isArray(v)?v:v.fields&&Array.isArray(v.fields)?v.fields:[],conversionReport:null};default:throw new Error(`Unsupported schema type: ${E}`)}}function AE(v){if(!v)return{fields:[],conversionReport:null};const E={sourceType:"surveyjs",timestamp:new Date().toISOString(),surveyMetadata:UE(v),totalElements:0,convertedFields:0,droppedFields:[],warnings:[]};let b=[];Array.isArray(v.elements)?b=v.elements:Array.isArray(v.pages)&&(b=v.pages.flatMap(g=>g.elements||[]),v.pages.length>1&&E.warnings.push({type:"page_structure_lost",message:`Multi-page survey with ${v.pages.length} pages flattened into single form`,impact:"high"})),E.totalElements=b.length;const k=new Set,R=g=>{g.forEach(A=>{A.name&&k.add(A.name),A.elements&&Array.isArray(A.elements)&&R(A.elements)})};R(b);const j=b.map(g=>{const A=ob(g,k);return A?(E.convertedFields++,A._conversionWarnings&&A._conversionWarnings.length>0&&E.warnings.push(...A._conversionWarnings.map(U=>({...U,fieldId:A.id,fieldName:g.name})))):E.droppedFields.push({name:g.name||"unnamed",type:g.type||"unknown",title:g.title||""}),A}).filter(Boolean);return VE(j),{fields:j,conversionReport:E}}function ob(v,E=new Set){if(!v||!v.type)return null;const b=zE(v.type),k=[],R={id:v.name||`field-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,fieldType:b||"unsupported",question:v.title||v.name||""};if(!b){R.fieldType="unsupported",R.unsupportedType=v.type;const j={...v};return j.elements&&Array.isArray(j.elements)&&(j.elements=j.elements.map(g=>g.name).filter(Boolean)),R.unsupportedData=j,k.push({type:"unsupported_field_type",property:"type",value:v.type,message:`Field type "${v.type}" is not supported. Displayed as placeholder.`,impact:"high"}),R._sourceData=v,R._conversionWarnings=k,R}switch(b){case"input":R.answer=v.defaultValue||"",FE(v,k);break;case"radio":case"dropdown":R.options=sb(v.choices),R.selected=v.defaultValue||null,cb(v,k);break;case"check":R.options=sb(v.choices),R.selected=Array.isArray(v.defaultValue)?v.defaultValue:[],cb(v,k);break;case"section":R.title=v.title||v.name||"Section",R.fields=Array.isArray(v.elements)?v.elements.map(j=>ob(j,E)).filter(Boolean):[];break}if(v.type==="boolean"&&R.fieldType==="radio"&&(R.options=[{id:"yes",value:v.labelTrue||"Yes"},{id:"no",value:v.labelFalse||"No"}],v.defaultValue===!0?R.selected="yes":v.defaultValue===!1?R.selected="no":R.selected=null),v.isRequired&&(R.required=!0),v.visibleIf){const j=fb(v.visibleIf,E);j&&(R.enableWhen=j,ub(k,"conditional_logic_lost","visibleIf"))}if(v.enableIf&&!R.enableWhen){const j=fb(v.enableIf,E);j&&(R.enableWhen=j,ub(k,"conditional_logic_lost","enableIf"))}return HE(v,k),R.fieldType==="section"&&v.elements&&Array.isArray(v.elements)?R._sourceData={...v,elements:v.elements.map(j=>j.name).filter(Boolean)}:R._sourceData=v,R._conversionWarnings=k,R}function ub(v,E,b){const k=v.findIndex(R=>R.type===E&&R.property===b);k!==-1&&v.splice(k,1)}function zE(v){return{text:"text",comment:"text",multipletext:"text",radiogroup:"radio",dropdown:"dropdown",boolean:"radio",checkbox:"check",panel:"section",paneldynamic:"section"}[v]||null}function sb(v){return Array.isArray(v)?v.map((E,b)=>typeof E=="string"?{id:`opt-${b}`,value:E}:{id:E.value||`opt-${b}`,value:E.text||E.value||""}):[]}function UE(v){const E={};return["title","description","logo","logoPosition","showProgressBar","progressBarType","showQuestionNumbers","completedHtml","loadingHtml","locale","questionsOnPageMode","calculatedValues","triggers"].forEach(b=>{v[b]!==void 0&&(E[b]=v[b])}),E}function FE(v,E){v.inputType&&v.inputType!=="text"&&E.push({type:"input_type_lost",property:"inputType",value:v.inputType,message:`Input type "${v.inputType}" not supported (date, tel, email, number will render as text)`,impact:"medium"}),v.placeHolder&&E.push({type:"placeholder_lost",property:"placeHolder",value:v.placeHolder,message:"Placeholder text not supported",impact:"low"}),v.maxLength&&E.push({type:"validation_lost",property:"maxLength",value:v.maxLength,message:"Max length validation not supported",impact:"medium"}),(v.min!==void 0||v.max!==void 0)&&E.push({type:"validation_lost",property:"min/max",value:`${v.min||""} - ${v.max||""}`,message:"Numeric min/max constraints not supported",impact:"high"})}function cb(v,E){v.hasOther&&E.push({type:"other_option_lost",property:"hasOther",value:v.otherText||"Other",message:'"Other" option with text input not supported',impact:"medium"}),(v.labelTrue||v.labelFalse)&&E.push({type:"boolean_labels_lost",property:"labelTrue/labelFalse",value:`${v.labelTrue||"Yes"} / ${v.labelFalse||"No"}`,message:"Custom boolean labels not supported (using Yes/No)",impact:"low"}),v.choicesOrder&&v.choicesOrder!=="none"&&E.push({type:"choice_order_lost",property:"choicesOrder",value:v.choicesOrder,message:"Choice ordering not supported",impact:"low"})}function HE(v,E){v.visibleIf&&E.push({type:"conditional_logic_lost",property:"visibleIf",value:v.visibleIf,message:"Conditional visibility logic not supported (field always visible)",impact:"high"}),v.enableIf&&E.push({type:"conditional_logic_lost",property:"enableIf",value:v.enableIf,message:"Conditional enable/disable logic not supported",impact:"high"}),v.requiredIf&&E.push({type:"conditional_logic_lost",property:"requiredIf",value:v.requiredIf,message:"Conditional required logic not supported",impact:"high"}),v.validators&&v.validators.length>0&&E.push({type:"validation_lost",property:"validators",value:v.validators.map(b=>b.type).join(", "),message:`Validators not supported: ${v.validators.map(b=>b.type).join(", ")}`,impact:"high"}),v.readOnly&&E.push({type:"readonly_lost",property:"readOnly",value:!0,message:"Read-only field not supported",impact:"medium"})}function fb(v,E=new Set){if(!v||typeof v!="string")return null;try{let b=v.trim(),k="AND";const R=/ or /i.test(b),j=/ and /i.test(b);if(R&&j)return console.warn(`[schemaAdapter] Mixed AND/OR logic not supported in: ${v}`),null;R&&(k="OR");const g=b.split(R?/ or /i:/ and /i),A=[];for(const U of g){const $=PE(U.trim());if($){if(E.size>0&&!E.has($.targetId)){console.warn(`[schemaAdapter] Skipping condition - field "${$.targetId}" not found (may be calculated value or metadata): ${U}`);continue}A.push($)}else console.warn(`[schemaAdapter] Unable to parse condition: ${U}`)}return A.length===0?null:{logic:A.length===1?"AND":k,conditions:A}}catch(b){return console.warn(`[schemaAdapter] Error converting visibleIf: ${v}`,b),null}}function PE(v){const E=k=>v.match(k);let b=E(/\{(\w+)\}\s*=\s*'([^']+)'/)||E(/\{(\w+)\}\s*=\s*"([^"]+)"/)||E(/\{(\w+)\}\s*=\s*([\w.-]+)/);if(b){const k=b[2],R=k==="true"?"yes":k==="false"?"no":k;return{targetId:b[1],operator:"equals",value:R}}return b=E(/\{(\w+)\}\s*(?:<>|!=)\s*'([^']+)'/)||E(/\{(\w+)\}\s*(?:<>|!=)\s*"([^"]+)"/)||E(/\{(\w+)\}\s*(?:<>|!=)\s*([\w.-]+)/),b?(console.warn(`[schemaAdapter] "not equal" operator not yet supported: ${v}`),null):(b=E(/\{(\w+)\}\s+contains\s+'([^']+)'/)||E(/\{(\w+)\}\s+contains\s+"([^"]+)"/)||E(/\{(\w+)\}\s+contains\s+([\w.-]+)/),b?{targetId:b[1],operator:"contains",value:b[2]}:(b=E(/\{(\w+)\}\s+empty/i),b?{targetId:b[1],operator:"equals",value:""}:(b=E(/\{(\w+)\}\s+notempty/i),b&&console.warn(`[schemaAdapter] "notempty" operator not yet supported: ${v}`),null)))}function IE(v){const E=new Map,b=k=>{k.forEach(R=>{E.set(R.id,R),R.fields&&Array.isArray(R.fields)&&b(R.fields)})};return b(v),E}function VE(v){const E=IE(v),b=k=>{k.enableWhen&&k.enableWhen.conditions&&k.enableWhen.conditions.forEach(R=>{const j=E.get(R.targetId);if(j&&j.options&&Array.isArray(j.options)){const g=j.options.find(A=>A.value===R.value);g?R.value=g.id:console.warn(`[schemaAdapter] No matching option found for value "${R.value}" in field "${R.targetId}"`)}}),k.fields&&Array.isArray(k.fields)&&k.fields.forEach(b)};v.forEach(b)}function BE(v,E="inhouse",b=!1){const k=tt.useRef(!1),R=bv();tt.useEffect(()=>{if(k.current||!v)return;const j=jE(v,E),g=j.fields||j;j.conversionReport&&R.setConversionReport(j.conversionReport),ma.getState().replaceAll(g),R.preview.set(!0),k.current=!0},[v,E,R]),tt.useEffect(()=>{R.setHideUnsupportedFields(b)},[b,R])}const $E=tt.memo(function({id:E}){const b=ma(tt.useCallback(R=>R.byId[E],[E]));if(!b)return null;const k=by(b.fieldType);return k?Ku.jsx("div",{className:"mb-1.5","data-field-type":b.fieldType,"data-field-id":b.id,children:Ku.jsx(k,{field:b})}):null});function YE(){const v=bv(),{fields:E}=xE(v.state.isPreview),b=Un(R=>R.hideUnsupportedFields),k=Gu.useMemo(()=>(b?E.filter(j=>j.fieldType!=="unsupported"):E).map(j=>j.id),[E,b]);return Ku.jsx("div",{children:k.map(R=>Ku.jsx($E,{id:R},R))})}function WE({fields:v,schemaType:E="inhouse",onChange:b,className:k="",fullHeight:R=!1,hideUnsupportedFields:j=!1}){BE(v,E,j),tt.useEffect(()=>b?ma.subscribe(U=>{const $=U.order.map(re=>U.byId[re]);b($)}):void 0,[b]);const g=["qb-render-root","bg-gray-100","font-titillium",R?"min-h-screen":"",k].filter(Boolean).join(" ");return Ku.jsx("div",{className:g,children:Ku.jsx("div",{className:"max-w-4xl mx-auto px-2 pb-8 pt-4",children:Ku.jsx(YE,{})})})}function db(){if(typeof Template>"u"){console.error("Blaze Template not found. Make sure this runs in a Meteor environment.");return}Template.questionnaireRenderer=new Blaze.Template("Template.questionnaireRenderer",function(){return HTML.DIV({class:"questionnaire-renderer-mount"})}),Template.questionnaireRenderer.onRendered(function(){const v=this,E=v.find(".questionnaire-renderer-mount");if(!E){console.error("Mount node not found");return}const b=nE.createRoot(E),k=()=>{const R={fields:v.data.fields||[],schemaType:v.data.schemaType||"inhouse",hideUnsupportedFields:v.data.hideUnsupportedFields||!1,onChange:v.data.onChange,onSubmit:v.data.onSubmit,fullHeight:v.data.fullHeight,className:v.data.className};b.render(tt.createElement(WE,R))};typeof Tracker<"u"?v.autorun(()=>{k()}):k(),v.view.onViewDestroyed(()=>{b.unmount()})})}typeof Meteor<"u"&&db(),pc.registerBlazeTemplate=db,Object.defineProperty(pc,Symbol.toStringTag,{value:"Module"})}));
|
|
2168
|
+
<%s key={someKey} {...props} />`,ct,Zn,Sa,Zn),ur[Zn+ct]=!0}}return m===k?yr(st):Wi(st),st}}function Ua(m,O,G){return In(m,O,G,!0)}function xa(m,O,G){return In(m,O,G,!1)}var Fa=xa,Ha=Ua;yv.Fragment=k,yv.jsx=Fa,yv.jsxs=Ha})()),yv}var nb;function fE(){return nb||(nb=1,process.env.NODE_ENV==="production"?hy.exports=sE():hy.exports=cE()),hy.exports}var _=fE();const mc=(v,E)=>v.className===E.className,dE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",children:_.jsx("path",{d:"M4 7h16M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3m-5 5l4 4m0-4l-4 4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})),gv=tt.memo(({className:v=""})=>_.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",className:v,children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})}));tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2m8-16h2a2 2 0 0 1 2 2v2m-4 12h2a2 2 0 0 0 2-2v-2m-8 0V9M9 9h6"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8.56 3.69a9 9 0 0 0-2.92 1.95M3.69 8.56A9 9 0 0 0 3 12m.69 3.44a9 9 0 0 0 1.95 2.92m2.92 1.95A9 9 0 0 0 12 21m3.44-.69a9 9 0 0 0 2.92-1.95m1.95-2.92A9 9 0 0 0 21 12m-.69-3.44a9 9 0 0 0-1.95-2.92m-2.92-1.95A9 9 0 0 0 12 3"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8.56 3.69a9 9 0 0 0-2.92 1.95M3.69 8.56A9 9 0 0 0 3 12m.69 3.44a9 9 0 0 0 1.95 2.92m2.92 1.95A9 9 0 0 0 12 21m3.44-.69a9 9 0 0 0 2.92-1.95m1.95-2.92A9 9 0 0 0 21 12m-.69-3.44a9 9 0 0 0-1.95-2.92m-2.92-1.95A9 9 0 0 0 12 3m-3 9l2 2l4-4"})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),_.jsx("path",{d:"m9 11l3 3l3-3"})]})}));const pE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"currentColor",d:"m12 2l.324.001l.318.004l.616.017l.299.013l.579.034l.553.046c4.785.464 6.732 2.411 7.196 7.196l.046.553l.034.579q.008.147.013.299l.017.616L22 12l-.005.642l-.017.616l-.013.299l-.034.579l-.046.553c-.464 4.785-2.411 6.732-7.196 7.196l-.553.046l-.579.034q-.147.008-.299.013l-.616.017L12 22l-.642-.005l-.616-.017l-.299-.013l-.579-.034l-.553-.046c-4.785-.464-6.732-2.411-7.196-7.196l-.046-.553l-.034-.579l-.013-.299l-.017-.616Q2 12.327 2 12l.001-.324l.004-.318l.017-.616l.013-.299l.034-.579l.046-.553c.464-4.785 2.411-6.732 7.196-7.196l.553-.046l.579-.034q.147-.008.299-.013l.616-.017Q11.673 2 12 2m0 6a1 1 0 0 0-1 1v2H9l-.117.007A1 1 0 0 0 9 13h2v2l.007.117A1 1 0 0 0 13 15v-2h2l.117-.007A1 1 0 0 0 15 11h-2V9l-.007-.117A1 1 0 0 0 12 8"})})),wv=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16H6a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1m-4 7h6m-3-3v6"})}));tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 8V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-2"}),_.jsx("path",{d:"M15 12H3l3-3m0 6l-3-3"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0"}),_.jsx("path",{d:"M13.048 17.942A9 9 0 0 1 12 18q-5.4 0-9-6q3.6-6 9-6t9 6a18 18 0 0 1-1.362 1.975M22 22l-5-5m0 5l5-5"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0"}),_.jsx("path",{d:"M11.192 17.966Q6.33 17.546 3 12q3.6-6 9-6q4.989 0 8.442 5.122M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97L18 22h-3v-3z"})]})})),tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M18 6L6 18M6 6l12 12"})}));const vE=tt.memo(({className:v=""})=>_.jsx("svg",{className:v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:_.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[_.jsx("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),_.jsx("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})]})}),mc);tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M6 9l6 6l6 -6"})]}),mc),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),_.jsx("path",{d:"M7 11l5 5l5 -5"}),_.jsx("path",{d:"M12 4l0 12"})]})),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),_.jsx("path",{d:"M7 9l5 -5l5 5"}),_.jsx("path",{d:"M12 4l0 12"})]}),mc),tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M7 8l-4 4l4 4"}),_.jsx("path",{d:"M17 8l4 4l-4 4"}),_.jsx("path",{d:"M14 4l-4 16"})]}),mc);const hE=tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M12 10v-7l3 3"}),_.jsx("path",{d:"M9 6l3 -3"}),_.jsx("path",{d:"M12 14v7l3 -3"}),_.jsx("path",{d:"M9 18l3 3"}),_.jsx("path",{d:"M18 3h1a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-1"}),_.jsx("path",{d:"M6 3h-1a2 2 0 0 0 -2 2v14a2 2 0 0 0 2 2h1"})]}),mc),mE=tt.memo(({className:v=""})=>_.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:v,children:[_.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_.jsx("path",{d:"M12 3v7l3 -3"}),_.jsx("path",{d:"M9 7l3 3"}),_.jsx("path",{d:"M12 21v-7l3 3"}),_.jsx("path",{d:"M9 17l3 -3"}),_.jsx("path",{d:"M18 9h1a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-1"}),_.jsx("path",{d:"M6 9h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1"})]}),mc);function Ko({ctrl:v,children:E}){var b,k,R,j;const[g,A]=Gu.useState(!0),U=K=>{var V;K.stopPropagation(),v.selected||(V=v.onRowClick)==null||V.call(v,K),v.toggleEdit()},$=K=>{K.stopPropagation(),v.remove()},re=K=>{var V;v.insideSection||(V=v.onRowClick)==null||V.call(v,K)};return v.isPreview||v.insideSection?_.jsxs("div",{className:v.wrapperClass,onClick:v.insideSection?void 0:v.onRowClick,"data-field-id":(b=v.field)==null?void 0:b.id,"data-inside-section":v.insideSection?"true":"false","data-selected":v.selected?"true":"false","aria-selected":v.selected||void 0,tabIndex:-1,children:[v.isPreview?null:_.jsx("div",{children:v.insideSection?`${v.label}`:`(${v.label}) ${v.field.title}`}),typeof E=="function"?E({api:v.api,isPreview:v.isPreview,field:v.field,insideSection:v.insideSection,sectionId:v.sectionId,selected:v.selected}):E]}):_.jsxs("div",{className:v.wrapperClass+" group",onClick:re,"data-field-id":(k=v.field)==null?void 0:k.id,"data-inside-section":v.insideSection?"true":"false","data-selected":v.selected?"true":"false","aria-selected":v.selected||void 0,tabIndex:-1,children:[_.jsxs("div",{className:`flex justify-between items-center ${g?"pb-2.5":""}`,children:[_.jsx("div",{className:"text-left w-full select-none",children:v.insideSection?`${v.label}`:v.field.fieldType==="section"?`(${v.label}) ${v.field.title}`:`${v.label} ${v.field.question}`}),_.jsxs("div",{className:`flex items-center gap-2 ml-2 ${v.insideSection?"hidden":""}`,children:[_.jsx("button",{onClick:U,className:"block lg:hidden",title:"Edit","aria-label":"Edit field",children:_.jsx(vE,{className:"h-6 w-6"})}),_.jsx("button",{type:"button",onClick:K=>{K.stopPropagation(),A(V=>!V)},"aria-expanded":g,"aria-controls":`fw-body-${(R=v.field)==null?void 0:R.id}`,title:g?"Collapse":"Expand","aria-label":g?"Collapse field":"Expand field",className:"p-1",children:g?_.jsx(mE,{className:"h-5 w-5"}):_.jsx(hE,{className:"h-5 w-5"})}),_.jsx("button",{onClick:$,title:"Delete","aria-label":"Delete field",children:_.jsx(dE,{className:"h-6 w-6"})})]})]}),g&&_.jsx("div",{id:`fw-body-${(j=v.field)==null?void 0:j.id}`,children:typeof E=="function"?E({api:v.api,isPreview:v.isPreview,field:v.field,insideSection:v.insideSection,sectionId:v.sectionId,selected:v.selected}):E})]})}function my(v="",E="",b=new Set){const k=E||"field";if(!b.has(k))return k;let R=1,j=`${k}-${R}`;for(;b.has(j);)R++,j=`${k}-${R}`;return j}function yy(v="",E=new Set,b=""){const k=b?`${b}-option`:"option";if(!E.has(k))return k;let R=1,j=`${k}-${R}`;for(;E.has(j);)R++,j=`${k}-${R}`;return j}const yE=(v,E="")=>{if(!Array.isArray(v))return[];const b=new Set;return v.map(k=>{if(typeof k=="string"){const R=yy(k,b,E);return b.add(R),{id:R,value:k}}else{const R=k.id||yy(k.value,b,E);return b.add(R),{id:R,...k}}})},gy=v=>{const{fieldType:E,id:b,question:k,title:R,...j}=v;return{fieldType:E,id:b,...v.fieldType==="section"?{title:R}:{question:k},...j,...!["text","longtext"].includes(E)&&{options:yE(j.options||[],b)}}};function gE(v){switch(v==null?void 0:v.fieldType){case"text":case"longtext":return v.answer??"";case"radio":case"dropdown":return v.selected??null;case"check":return Array.isArray(v.selected)?v.selected:Array.isArray(v.options)?v.options.filter(E=>E==null?void 0:E.selected).map(E=>E.id??E.value):[];default:return null}}function rb(v){return v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wE(v,E){const b=E==null?void 0:E[v==null?void 0:v.targetId];if(!b)return!1;const k=gE(b),R=v==null?void 0:v.value;switch(v==null?void 0:v.operator){case"equals":return Array.isArray(k)?!1:String(k??"")===String(R??"");case"contains":{const j=$=>String($??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),g=j(k).replace(/[^a-z0-9]+/g," ").trim(),A=j(R).trim();if(!A)return!1;const U=A.split(/\s+/);return(U.length===1?new RegExp(`(?:^|\\s)${rb(U[0])}(?:\\s|$)`):new RegExp(`(?:^|\\s)${U.map($=>rb($)).join("\\s+")}(?:\\s|$)`)).test(g)}case"includes":return Array.isArray(k)?k.map(String).includes(String(R)):!1;default:return!1}}function ab(v,E){const b=v==null?void 0:v.enableWhen;if(!b||!Array.isArray(b.conditions)||b.conditions.length===0)return!0;const k=Array.isArray(E)?E.reduce((j,g)=>(g!=null&&g.id&&(j[g.id]=g),j),{}):E,R=b.conditions.map(j=>wE(j,k));return(b.logic||"AND").toUpperCase()==="AND"?R.every(Boolean):R.some(Boolean)}const ib=(v,E)=>{if(v===E)return!0;if(!v||!E)return!1;const b=Object.keys(v),k=Object.keys(E);if(b.length!==k.length)return!1;for(const R of b)if(v[R]!==E[R])return!1;return!0},lb=(v,E,b)=>typeof b!="number"||b<0||b>v.length?[...v,E]:[...v.slice(0,b),E,...v.slice(b)],bE=v=>{const E={},b=[],k=new Set;return(v||[]).forEach(R=>{let j=R.id;if(!j){const A=R.question||R.title||"",U=R.fieldType||"field";j=my(A,U,k)}k.add(j);const g=gy({...R,id:j});g.fieldType==="section"&&Array.isArray(g.fields)&&(g.fields=g.fields.map(A=>{let U=A.id;if(!U){const $=A.question||A.title||"",re=A.fieldType||"field";U=my($,re,k),k.add(U)}return gy({...A,id:U})})),E[j]=g,b.push(j)}),{byId:E,order:b}};function Xu(v,E,b,k,R={}){const{onIdChange:j,forbidCollision:g=!0}=R;if(!b){const V=v.byId[E];if(!V)return null;const I=k(V,null);if(!I||ib(V,I))return null;if(I.id&&I.id!==E){const ce=I.id;if(g&&v.byId[ce])return null;const{[E]:ze,...Oe}=v.byId,ht={...Oe,[ce]:I},we=v.order.map($e=>$e===E?ce:$e);return j==null||j(ce,E),{byId:ht,order:we}}return{byId:{...v.byId,[E]:I}}}const A=v.byId[b];if(!A||!Array.isArray(A.fields))return null;let U=!1,$=null;const re=A.fields.map(V=>{if(V.id!==E)return V;const I=k(V,A);if(!I||ib(V,I))return V;if(I.id&&I.id!==E){if(g&&A.fields.some(ce=>ce.id===I.id&&ce!==V))return V;$=I.id}return U=!0,I});if(!U)return null;const K={...v.byId,[b]:{...A,fields:re}};return $&&(j==null||j($,E)),{byId:K}}const ma=Zw((v,E)=>({byId:{},order:[],setEnableWhen:(b,k)=>v(R=>{const j=R.byId[b];if(!j)return R;const g=k&&Array.isArray(k.conditions)?{logic:k.logic||"AND",conditions:k.conditions}:void 0;return{byId:{...R.byId,[b]:{...j,...g?{enableWhen:g}:{enableWhen:void 0}}}}}),replaceAll:b=>v(()=>bE(b)),addField:(b,k={})=>v(R=>{var j,g;const{sectionId:A,initialPatch:U={},index:$}=k,re=(j=xv[b])==null?void 0:j.defaultProps;if(!re)return R;const K=new Set(Object.keys(R.byId));A&&(g=R.byId[A])!=null&&g.fields&&R.byId[A].fields.forEach(we=>K.add(we.id));const V=(U==null?void 0:U.question)||re.question||"",I=(U==null?void 0:U.title)||re.title||"",ce=my(b==="section"?I:V,b,K),ze=gy({...re,...U,id:ce});if(!A)return{byId:{...R.byId,[ce]:ze},order:lb(R.order,ce,$)};const Oe=R.byId[A];if(!Oe||!Array.isArray(Oe.fields))return R;const ht=lb(Oe.fields,ze,$);return{byId:{...R.byId,[A]:{...Oe,fields:ht}}}}),updateField:(b,k,R={})=>v(j=>{const{sectionId:g,onIdChange:A}=R;return Xu(j,b,g,$=>{const re=typeof k=="function"?k($):k;if(!re)return null;const{fieldType:K,id:V,question:I,title:ce,...ze}={...$,...re};return{fieldType:K,id:V,...K==="section"?{title:ce}:{question:I},...ze}},{onIdChange:A,forbidCollision:!0})||j}),deleteField:(b,k={})=>v(R=>{const{sectionId:j}=k;if(!j){if(!R.byId[b])return R;const{[b]:U,...$}=R.byId;return{byId:$,order:R.order.filter(re=>re!==b)}}const g=R.byId[j];if(!g||!Array.isArray(g.fields))return R;const A=g.fields.filter(U=>U.id!==b);return A.length===g.fields.length?R:{byId:{...R.byId,[j]:{...g,fields:A}}}}),addOption:(b,k="",R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.options)?U.options:[],re=new Set($.map(I=>I.id)),K=yy(k,re,b),V=[...$,{id:K,value:k}];return{...U,options:V}})||j}),updateOption:(b,k,R,j={})=>v(g=>{const{sectionId:A}=j;return Xu(g,b,A,$=>{const re=Array.isArray($.options)?$.options:[];let K=!1;const V=re.map(I=>I.id!==k||I.value===R?I:(K=!0,{id:I.id,value:R}));return K?{...$,options:V}:null})||g}),updateOptionAnswer:(b,k,R,j={})=>v(g=>{const{sectionId:A}=j;return Xu(g,b,A,$=>{const re=Array.isArray($.options)?$.options:[];let K=!1;const V=re.map(I=>I.id!==k||I.answer===R?I:(K=!0,{...I,answer:R}));return K?{...$,options:V}:null})||g}),deleteOption:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.options)?U.options:[],re=$.filter(V=>V.id!==k);if(re.length===$.length)return null;const K={...U,options:re};if(Array.isArray(U.selected)){const V=U.selected.filter(I=>I!==k);V.length!==U.selected.length&&(K.selected=V)}else U.selected===k&&(K.selected="");return K})||j}),selectSingle:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=k??"";return U.selected===$?null:{...U,selected:$}})||j}),toggleMulti:(b,k,R={})=>v(j=>{const{sectionId:g}=R;return Xu(j,b,g,U=>{const $=Array.isArray(U.selected)?U.selected:[],re=$.includes(k),K=re?$.filter(V=>V!==k):[...$,k];return K.length===$.length&&re?null:{...U,selected:K}})||j})})),xE=v=>{const E=ma(k=>k.order),b=ma(k=>k.byId);return tt.useMemo(()=>{const k=E.map(j=>b[j]),R=[];return k.forEach(j=>{R.push(j),(j==null?void 0:j.fieldType)==="section"&&Array.isArray(j.fields)&&R.push(...j.fields)}),v?{fields:k.filter(j=>ab(j,R)),allFlat:R}:{fields:k,allFlat:R}},[E,b,v])},Un=Zw((v,E)=>({isPreview:!1,setPreview:b=>v({isPreview:!!b}),togglePreview:()=>v(b=>({isPreview:!b.isPreview})),isEditModalOpen:!1,setEditModalOpen:b=>v(k=>({isEditModalOpen:typeof b=="function"?!!b(k.isEditModalOpen):!!b})),panelResetKey:0,selectedFieldId:null,setSelectField:b=>v(k=>{const R=b??null;return k.selectedFieldId===R?{}:{selectedFieldId:R,panelResetKey:k.panelResetKey+1}}),clearSelectedField:()=>v({selectedFieldId:null}),renameSelectedFieldId:b=>v({selectedFieldId:b}),selectedChildId:{parentId:null,childId:null},setSelectedChildId:(b,k)=>v(R=>{const j=b??null,g=k??null;return R.selectedChildId.parentId===j&&R.selectedChildId.childId===g?{}:{selectedChildId:{parentId:j,childId:g}}}),clearSelectedChildId:()=>v(b=>b.selectedChildId.parentId===null&&b.selectedChildId.childId===null?{}:{selectedChildId:{parentId:null,childId:null}}),renameSelectedChildParentId:b=>v(k=>({selectedChildId:{...k.selectedChildId,parentId:b??null}})),renameSelectedChildId:b=>v(k=>({selectedChildId:{...k.selectedChildId,childId:b??null}})),conversionReport:null,setConversionReport:b=>v({conversionReport:b}),clearConversionReport:()=>v({conversionReport:null}),hideUnsupportedFields:!1,setHideUnsupportedFields:b=>v({hideUnsupportedFields:!!b})})),SE=(v,E)=>{const b=ma(V=>V.addField),k=ma(V=>V.updateField),R=ma(V=>V.deleteField),j=ma(V=>V.addOption),g=ma(V=>V.updateOption),A=ma(V=>V.updateOptionAnswer),U=ma(V=>V.deleteOption),$=ma(V=>V.selectSingle),re=ma(V=>V.toggleMulti),K=tt.useCallback((V,I)=>{var ce,ze;const Oe=Un.getState();Oe.selectedFieldId===I&&((ce=Oe.renameSelectedFieldId)==null||ce.call(Oe,V)),(ze=Oe.renameSectionIdInHighlight)==null||ze.call(Oe,I,V)},[]);return tt.useMemo(()=>({field:{add:(V,I,ce)=>b(V,{sectionId:E,initialPatch:I,index:ce}),update:(V,I)=>k(v,{[V]:I},{sectionId:E,onIdChange:K}),patch:V=>k(v,V,{sectionId:E,onIdChange:K}),renameId:V=>k(v,{id:V},{sectionId:E,onIdChange:K}),remove:()=>R(v,{sectionId:E})},option:{add:(V="")=>j(v,V,{sectionId:E}),update:(V,I)=>g(v,V,I,{sectionId:E}),updateAnswer:(V,I)=>A(v,V,I,{sectionId:E}),remove:V=>U(v,V,{sectionId:E})},selection:{single:V=>$(v,V,{sectionId:E}),multiToggle:V=>re(v,V,{sectionId:E})},section:{addChild:(V,I,ce)=>b(V,{sectionId:v,initialPatch:I,index:ce})}}),[v,E,b,k,R,j,g,A,U,$,re,K])},bv=()=>{const v=Un(ve=>ve.isPreview),E=Un(ve=>ve.panelResetKey),b=Un(ve=>ve.selectedFieldId),k=Un(ve=>ve.isEditModalOpen),R=Un(ve=>ve.conversionReport),j=Un(ve=>ve.setPreview),g=Un(ve=>ve.togglePreview),A=Un(ve=>ve.setSelectField),U=Un(ve=>ve.clearSelectedField),$=Un(ve=>ve.renameSelectedFieldId),re=Un(ve=>ve.setEditModalOpen),K=Un(ve=>ve.setConversionReport),V=Un(ve=>ve.clearConversionReport),I=Un(ve=>ve.setHideUnsupportedFields),ce=Un(ve=>ve.selectedChildId),ze=Un(ve=>ve.setSelectedChildId),Oe=Un(ve=>ve.clearSelectedChildId),ht=Un(ve=>ve.renameSelectedChildParentId),we=Un(ve=>ve.renameSelectedChildId),$e=tt.useCallback(()=>re(!0),[re]),dt=tt.useCallback(()=>re(!1),[re]),Ne=tt.useCallback(()=>re(ve=>!ve),[re]);return tt.useMemo(()=>({state:{isPreview:v,isEditModalOpen:k,panelResetKey:E},isPreview:v,preview:{set:j,toggle:g},modal:{set:re,open:$e,close:dt,toggle:Ne},selectedFieldId:{value:b,set:A,clear:U,rename:$},selectedChildId:{ChildId:(ce==null?void 0:ce.childId)??null,ParentId:(ce==null?void 0:ce.parentId)??null,BothId:ce||{parentId:null,childId:null},set:ze,clear:Oe,renameParentId:ht,renameChildId:we},conversionReport:R,setConversionReport:K,clearConversionReport:V,setHideUnsupportedFields:I}),[v,k,E,j,g,b,A,U,$,re,$e,dt,Ne,ce,ze,Oe,ht,we,R,K,V,I])};function Xo(v,E){var b;const k=bv(),R=SE(v.id,E),j=((b=xv[v.fieldType])==null?void 0:b.label)??"Field",g=!!E,A=k.selectedFieldId.value===v.id,U=tt.useCallback(K=>{var V;k.state.isPreview||((V=K==null?void 0:K.stopPropagation)==null||V.call(K),k.selectedFieldId.value!==v.id&&k.selectedFieldId.set(v.id))},[k,v.id]),$=tt.useCallback(()=>{R.field.remove(),A&&k.selectedFieldId.clear()},[R,A,k]),re=["rounded-lg bg-white",k.state.isPreview?"":"border",!g&&k.state.isPreview?"border":"",v.fieldType==="section"&&k.state.isPreview?"p-0 border":"p-4",A?"border-blue-300 border-2 border-dashed":"border-gray-200"].join(" ");return{field:v,sectionId:E,label:j,insideSection:g,isPreview:k.state.isPreview,selected:A,isEditModalOpen:k.state.isEditModalOpen,onRowClick:U,toggleEdit:k.modal.toggle,remove:$,api:R,wrapperClass:re}}const EE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("input",{type:"text",value:g.answer||"",onChange:A=>k.field.update("answer",A.target.value),placeholder:"Type your answer",className:"px-4 py-2 w-full border border-black/10 shadow-2xs rounded"})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),_.jsx("input",{type:"text",value:g.answer||"",placeholder:"Type your answer",className:"px-4 py-2 my-1.5 w-full border border-black/10 shadow-2xs rounded",disabled:!0})]})})}),CE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("textarea",{value:g.answer||"",onChange:A=>k.field.update("answer",A.target.value),placeholder:"Type your answer",className:"px-3 py-2 w-full border border-black/10 shadow-2xs rounded min-h-24 max-h-60 resize-y",rows:4})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),_.jsx("textarea",{value:g.answer||"",placeholder:"Type your answer",className:"px-3 py-2 my-1.5 w-full border border-black/10 shadow-2xs rounded min-h-24 max-h-56 resize-y",rows:4,disabled:!0})]})})}),kE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{className:"space-y-2",children:(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center border border-black/10 shadow-2xs rounded overflow-hidden",children:[_.jsx("label",{className:"px-4 py-2 text-sm text-gray-500 bg-gray-50 whitespace-nowrap border-r border-black/10",children:A.value}),_.jsx("input",{type:"text",value:A.answer||"",onChange:U=>k.option.updateAnswer(A.id,U.target.value),placeholder:"",className:"flex-1 px-4 py-2 border-0 outline-none focus:ring-0"})]},A.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Field label",className:"w-full py-2"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Field"]})]})})}),RE=tt.memo(function({id:v,name:E,value:b,checked:k,onSelect:R,onUnselect:j,className:g="",...A}){const U=tt.useRef(k);return tt.useEffect(()=>{U.current=k},[k]),_.jsx("input",{id:v,type:"radio",name:E,value:b,className:g,checked:k,onClick:()=>{U.current?j==null||j(b):R==null||R(b)},onChange:()=>{},...A})}),TE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:(g.options||[]).map(A=>{const U=`${g.id}-${A.id}`,$=g.selected===A.id;return _.jsxs("label",{htmlFor:U,className:"flex items-center px-3 py-1 my-2 cursor-pointer",children:[_.jsx(RE,{id:U,name:`question-${g.id}`,value:A.id,checked:$,onSelect:()=>k.selection.single(A.id),onUnselect:()=>k.field.update("selected",null),className:"mr-2 h-9 w-9 flex-shrink-0 cursor-pointer"}),A.value]},A.id)})})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"radio",disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full py-2"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),_E=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:(g.options||[]).map(A=>_.jsxs("label",{className:"flex items-center px-3 py-1 my-2",children:[_.jsx("input",{type:"checkbox",className:"mr-2 w-9 h-9",checked:Array.isArray(g.selected)&&g.selected.includes(A.id),onChange:()=>k.selection.multiToggle(A.id)}),A.value]},A.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-3 shadow my-1.5 border border-black/10 rounded-lg h-10",children:[_.jsx("input",{type:"checkbox",disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),DE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{children:_.jsxs("select",{className:"w-full px-4 shadow border border-black/10 rounded-lg h-10",value:g.selected||"",onChange:A=>k.selection.single(A.target.value),children:[_.jsx("option",{value:"",children:"Select an option"}),(g.options||[]).map(A=>_.jsx("option",{value:A.id,children:A.value},A.id))]})})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:A=>k.field.update("question",A.target.value),placeholder:"Enter question"}),_.jsx("div",{className:"mt-2",children:_.jsxs("select",{className:"w-full px-4 shadow border border-black/10 rounded-lg h-10",disabled:!0,children:[_.jsx("option",{value:"",children:"Select an option"}),(g.options||[]).map(A=>_.jsx("option",{value:A.id,children:A.value},A.id))]})}),(g.options||[]).map(A=>_.jsxs("div",{className:"flex items-center px-3 shadow my-1.5 border border-black/10 rounded-lg h-10",children:[_.jsx("input",{type:"text",value:A.value,onChange:U=>k.option.update(A.id,U.target.value),placeholder:"Option text",className:"w-full"}),_.jsx("button",{onClick:()=>k.option.remove(A.id),children:_.jsx(gv,{className:"h-5 w-5"})})]},A.id)),_.jsxs("button",{onClick:()=>k.option.add(),className:"mt-2 ml-2 flex gap-3 justify-center",children:[_.jsx(wv,{className:"h-6 w-6"})," Add Option"]})]})})}),OE=tt.memo(function({field:v,sectionId:E}){const b=Xo(v,E);return _.jsx(Ko,{ctrl:b,children:({api:k,isPreview:R,insideSection:j,field:g})=>{var A;const U=((A=g.options)==null?void 0:A.length)===2?g.options:[{id:"yes",value:"Yes"},{id:"no",value:"No"}];return R?_.jsx("div",{className:j?"border-b border-gray-200":"border-0",children:_.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 pb-4",children:[_.jsx("div",{className:"font-light",children:g.question||"Question"}),_.jsx("div",{className:"flex gap-2",children:U.map($=>_.jsxs("label",{className:`flex-1 flex items-center justify-center px-4 py-2 border rounded-lg cursor-pointer ${g.selected===$.id?"bg-[#0076a8] text-white border-[#0076a8]":"border-black/10 hover:bg-gray-50"}`,onClick:re=>{re.preventDefault(),g.selected===$.id?k.field.update("selected",null):k.selection.single($.id)},children:[_.jsx("input",{type:"radio",name:g.fieldId,checked:g.selected===$.id,onChange:()=>{},className:"sr-only"}),_.jsx("span",{children:$.value})]},$.id))})]})}):_.jsxs("div",{children:[_.jsx("input",{className:"px-3 py-2 w-full border border-black/40 rounded",type:"text",value:g.question||"",onChange:$=>k.field.update("question",$.target.value),placeholder:"Enter question"}),U.map(($,re)=>_.jsxs("div",{className:"flex items-center px-4 my-1.5 shadow border border-black/10 rounded-lg",children:[_.jsx("input",{type:"radio",name:`${g.fieldId}-edit`,disabled:!0,className:"mr-2"}),_.jsx("input",{type:"text",value:$.value,onChange:K=>k.option.update(re,"value",K.target.value),placeholder:`Option ${re+1}`,className:"w-full py-2"})]},$.id))]})}})});function NE({field:v}){const[E,b]=Gu.useState(!1),k=v.unsupportedType||"unknown",R=v.unsupportedData||v._sourceData||{};return _.jsxs("div",{className:"border-2 border-dashed border-orange-500 rounded-lg p-4 bg-orange-50 mb-4",children:[_.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[_.jsx("span",{className:"text-xl",children:"⚠️"}),_.jsxs("div",{className:"flex-1",children:[_.jsxs("strong",{className:"text-orange-700",children:["Unsupported Field Type: ",k]}),_.jsx("div",{className:"text-sm text-gray-600 mt-1",children:v.question||R.title||R.name||"No title"})]})]}),_.jsxs("div",{className:"mt-3 p-3 bg-white border border-gray-300 rounded text-sm",children:[_.jsx("div",{className:"text-xs text-gray-500 mb-2 font-semibold",children:"Original Data Preview:"}),_.jsxs("div",{className:"space-y-1 text-gray-700",children:[Object.entries(R).slice(0,5).map(([j,g])=>typeof g=="object"&&g!==null?_.jsxs("div",{className:"truncate",children:[_.jsxs("span",{className:"font-mono text-xs text-blue-600",children:[j,":"]})," ",_.jsx("span",{className:"text-gray-500 italic",children:Array.isArray(g)?"[Array]":"{Object}"})]},j):_.jsxs("div",{className:"truncate",children:[_.jsxs("span",{className:"font-mono text-xs text-blue-600",children:[j,":"]})," ",_.jsx("span",{className:"text-gray-800",children:String(g)})]},j)),Object.keys(R).length>5&&_.jsxs("div",{className:"text-xs text-gray-400 italic",children:["... and ",Object.keys(R).length-5," more properties"]})]})]}),_.jsxs("button",{type:"button",onClick:()=>b(!E),className:"mt-3 px-3 py-1.5 bg-orange-500 text-white rounded hover:bg-orange-600 text-sm transition-colors",children:[E?"▼ Hide":"▶ Show"," Full Data"]}),E&&_.jsxs("div",{className:"mt-3",children:[_.jsx("div",{className:"text-xs text-gray-600 mb-2 font-semibold",children:"Full SurveyJS data for manual conversion:"}),_.jsx("pre",{className:"bg-gray-100 p-3 rounded text-xs overflow-auto max-h-[300px] border border-gray-300",children:JSON.stringify(R,null,2)})]}),_.jsx("div",{className:"mt-3 text-xs text-gray-600 italic",children:"💡 This field type is not yet supported. Manual implementation required."})]})}const xv={section:{label:"Section Field",componentKey:"section",defaultProps:{fieldType:"section",title:"New section",fields:[]}},text:{label:"Text Field",componentKey:"text",defaultProps:{fieldType:"text",question:"",answer:""}},longtext:{label:"Long Text Field",componentKey:"longtext",defaultProps:{fieldType:"longtext",question:"",answer:""}},multitext:{label:"Multi Text Field",componentKey:"multitext",defaultProps:{fieldType:"multitext",question:"",options:[{value:"Field 1"},{value:"Field 2"},{value:"Field 3"}]}},radio:{label:"Radio Field",componentKey:"radio",defaultProps:{fieldType:"radio",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:null}},check:{label:"Check Field",componentKey:"check",defaultProps:{fieldType:"check",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:[]}},boolean:{label:"Boolean Field",componentKey:"boolean",defaultProps:{fieldType:"boolean",question:"",options:[{id:"yes",value:"Yes"},{id:"no",value:"No"}],selected:null}},dropdown:{label:"Dropdown Field",componentKey:"dropdown",defaultProps:{fieldType:"dropdown",question:"",options:[{value:"Option 1"},{value:"Option 2"},{value:"Option 3"}],selected:null}},unsupported:{label:"Unsupported Field",componentKey:"unsupported",defaultProps:{fieldType:"unsupported",question:"Unsupported field type",unsupportedType:"unknown",unsupportedData:{}}}},wy={text:EE,longtext:CE,multitext:kE,radio:TE,check:_E,boolean:OE,dropdown:DE,unsupported:NE};function ME(v,E){wy[v]||(wy[v]=E)}function by(v){return wy[v]||null}const LE=tt.memo(function({field:v}){const E=Xo(v),b=bv(),k=Un(I=>I.hideUnsupportedFields),R=b.selectedChildId.ParentId,j=b.selectedChildId.ChildId,g=R===v.id?j:null,A=Gu.useRef({}),U=ma(I=>I.byId),$=Gu.useMemo(()=>{const I=Object.values(U),ce=[];return I.forEach(ze=>{ze&&(ce.push(ze),ze.fieldType==="section"&&Array.isArray(ze.fields)&&ce.push(...ze.fields))}),ce},[U]);Gu.useEffect(()=>{var I;if(E.isPreview||!g)return;const ce=A.current[g];(I=ce==null?void 0:ce.scrollIntoView)==null||I.call(ce,{behavior:"smooth",block:"nearest"})},[g,E.isPreview]);const re=I=>k&&I.fieldType==="unsupported",K=(I,ce)=>{const ze=by(I.fieldType);return!ze||re(I)||!ab(I,$)?null:_.jsx("div",{ref:Oe=>Oe&&(A.current[I.id]=Oe),children:_.jsx(ze,{field:I,sectionId:ce})},I.id)},V=(I,ce)=>{const ze=by(I.fieldType);if(!ze||re(I))return null;const Oe=g===I.id;return _.jsx("div",{ref:ht=>ht&&(A.current[I.id]=ht),className:["rounded-lg mb-3",Oe?"border-2 border-blue-400 border-dashed":"border border-transparent"].join(" "),children:_.jsx(ze,{field:I,sectionId:ce})},I.id)};return _.jsx(Ko,{ctrl:E,children:({api:I,isPreview:ce,insideSection:ze,field:Oe})=>{const ht=Array.isArray(Oe.fields)?Oe.fields:[];return ce?_.jsxs("section",{className:ze?"border-b border-gray-200":"border-0",children:[_.jsx("div",{className:"bg-[#0076a8] text-white text-xl px-4 py-2 rounded-t-lg",children:Oe.title||"Section"}),ht.map(we=>K(we,Oe.id))]}):_.jsxs("div",{children:[_.jsx("div",{className:"flex justify-between items-center mb-3 gap-2",children:_.jsx("div",{className:"flex-1",children:_.jsx("input",{type:"text",className:"w-full px-3 py-2 border border-gray-200 rounded-md",value:Oe.title||"",onChange:we=>I.field.update("title",we.target.value),placeholder:"Section title (e.g., Data Consent)"})})}),_.jsx("div",{children:ht.map(we=>V(we,Oe.id))}),_.jsxs("div",{className:"mb-3",children:[_.jsx("div",{className:"text-sm font-medium text-gray-700 mb-2",children:"Add a field"}),_.jsx("div",{className:"flex flex-wrap gap-2",children:Object.keys(xv).filter(we=>we!=="section").map(we=>_.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-2 text-sm border border-gray-300 rounded-md hover:bg-gray-50",onClick:()=>{var $e,dt,Ne;return($e=I.section)!=null&&$e.addChild?I.section.addChild(we):(Ne=(dt=I.field).add)==null?void 0:Ne.call(dt,we,void 0,void 0)},children:[_.jsx(pE,{className:"h-4 w-4"}),"Add ",xv[we].label]},we))})]})]})}})});ME("section",LE);function jE(v,E="inhouse"){if(!v)return{fields:[],conversionReport:null};switch(E){case"surveyjs":return AE(v);case"inhouse":return{fields:Array.isArray(v)?v:v.fields&&Array.isArray(v.fields)?v.fields:[],conversionReport:null};default:throw new Error(`Unsupported schema type: ${E}`)}}function AE(v){if(!v)return{fields:[],conversionReport:null};const E={sourceType:"surveyjs",timestamp:new Date().toISOString(),surveyMetadata:UE(v),totalElements:0,convertedFields:0,droppedFields:[],warnings:[]};let b=[];Array.isArray(v.elements)?b=v.elements:Array.isArray(v.pages)&&(b=v.pages.flatMap(g=>g.elements||[]),v.pages.length>1&&E.warnings.push({type:"page_structure_lost",message:`Multi-page survey with ${v.pages.length} pages flattened into single form`,impact:"high"})),E.totalElements=b.length;const k=new Set,R=g=>{g.forEach(A=>{A.name&&k.add(A.name),A.elements&&Array.isArray(A.elements)&&R(A.elements)})};R(b);const j=b.map(g=>{const A=ob(g,k);return A?(E.convertedFields++,A._conversionWarnings&&A._conversionWarnings.length>0&&E.warnings.push(...A._conversionWarnings.map(U=>({...U,fieldId:A.id,fieldName:g.name})))):E.droppedFields.push({name:g.name||"unnamed",type:g.type||"unknown",title:g.title||""}),A}).filter(Boolean);return VE(j),{fields:j,conversionReport:E}}function ob(v,E=new Set){if(!v||!v.type)return null;const b=zE(v.type),k=[],R={id:v.name||`field-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,fieldType:b||"unsupported",question:v.title||v.name||""};if(!b){R.fieldType="unsupported",R.unsupportedType=v.type;const j={...v};return j.elements&&Array.isArray(j.elements)&&(j.elements=j.elements.map(g=>g.name).filter(Boolean)),R.unsupportedData=j,k.push({type:"unsupported_field_type",property:"type",value:v.type,message:`Field type "${v.type}" is not supported. Displayed as placeholder.`,impact:"high"}),R._sourceData=v,R._conversionWarnings=k,R}switch(b){case"input":R.answer=v.defaultValue||"",FE(v,k);break;case"radio":case"dropdown":R.options=sb(v.choices),R.selected=v.defaultValue||null,cb(v,k);break;case"check":R.options=sb(v.choices),R.selected=Array.isArray(v.defaultValue)?v.defaultValue:[],cb(v,k);break;case"section":R.title=v.title||v.name||"Section",R.fields=Array.isArray(v.elements)?v.elements.map(j=>ob(j,E)).filter(Boolean):[];break}if(v.type==="boolean"&&R.fieldType==="radio"&&(R.options=[{id:"yes",value:v.labelTrue||"Yes"},{id:"no",value:v.labelFalse||"No"}],v.defaultValue===!0?R.selected="yes":v.defaultValue===!1?R.selected="no":R.selected=null),v.isRequired&&(R.required=!0),v.visibleIf){const j=fb(v.visibleIf,E);j&&(R.enableWhen=j,ub(k,"conditional_logic_lost","visibleIf"))}if(v.enableIf&&!R.enableWhen){const j=fb(v.enableIf,E);j&&(R.enableWhen=j,ub(k,"conditional_logic_lost","enableIf"))}return HE(v,k),R.fieldType==="section"&&v.elements&&Array.isArray(v.elements)?R._sourceData={...v,elements:v.elements.map(j=>j.name).filter(Boolean)}:R._sourceData=v,R._conversionWarnings=k,R}function ub(v,E,b){const k=v.findIndex(R=>R.type===E&&R.property===b);k!==-1&&v.splice(k,1)}function zE(v){return{text:"text",comment:"text",multipletext:"text",radiogroup:"radio",dropdown:"dropdown",boolean:"radio",checkbox:"check",panel:"section",paneldynamic:"section"}[v]||null}function sb(v){return Array.isArray(v)?v.map((E,b)=>typeof E=="string"?{id:`opt-${b}`,value:E}:{id:E.value||`opt-${b}`,value:E.text||E.value||""}):[]}function UE(v){const E={};return["title","description","logo","logoPosition","showProgressBar","progressBarType","showQuestionNumbers","completedHtml","loadingHtml","locale","questionsOnPageMode","calculatedValues","triggers"].forEach(b=>{v[b]!==void 0&&(E[b]=v[b])}),E}function FE(v,E){v.inputType&&v.inputType!=="text"&&E.push({type:"input_type_lost",property:"inputType",value:v.inputType,message:`Input type "${v.inputType}" not supported (date, tel, email, number will render as text)`,impact:"medium"}),v.placeHolder&&E.push({type:"placeholder_lost",property:"placeHolder",value:v.placeHolder,message:"Placeholder text not supported",impact:"low"}),v.maxLength&&E.push({type:"validation_lost",property:"maxLength",value:v.maxLength,message:"Max length validation not supported",impact:"medium"}),(v.min!==void 0||v.max!==void 0)&&E.push({type:"validation_lost",property:"min/max",value:`${v.min||""} - ${v.max||""}`,message:"Numeric min/max constraints not supported",impact:"high"})}function cb(v,E){v.hasOther&&E.push({type:"other_option_lost",property:"hasOther",value:v.otherText||"Other",message:'"Other" option with text input not supported',impact:"medium"}),(v.labelTrue||v.labelFalse)&&E.push({type:"boolean_labels_lost",property:"labelTrue/labelFalse",value:`${v.labelTrue||"Yes"} / ${v.labelFalse||"No"}`,message:"Custom boolean labels not supported (using Yes/No)",impact:"low"}),v.choicesOrder&&v.choicesOrder!=="none"&&E.push({type:"choice_order_lost",property:"choicesOrder",value:v.choicesOrder,message:"Choice ordering not supported",impact:"low"})}function HE(v,E){v.visibleIf&&E.push({type:"conditional_logic_lost",property:"visibleIf",value:v.visibleIf,message:"Conditional visibility logic not supported (field always visible)",impact:"high"}),v.enableIf&&E.push({type:"conditional_logic_lost",property:"enableIf",value:v.enableIf,message:"Conditional enable/disable logic not supported",impact:"high"}),v.requiredIf&&E.push({type:"conditional_logic_lost",property:"requiredIf",value:v.requiredIf,message:"Conditional required logic not supported",impact:"high"}),v.validators&&v.validators.length>0&&E.push({type:"validation_lost",property:"validators",value:v.validators.map(b=>b.type).join(", "),message:`Validators not supported: ${v.validators.map(b=>b.type).join(", ")}`,impact:"high"}),v.readOnly&&E.push({type:"readonly_lost",property:"readOnly",value:!0,message:"Read-only field not supported",impact:"medium"})}function fb(v,E=new Set){if(!v||typeof v!="string")return null;try{let b=v.trim(),k="AND";const R=/ or /i.test(b),j=/ and /i.test(b);if(R&&j)return console.warn(`[schemaAdapter] Mixed AND/OR logic not supported in: ${v}`),null;R&&(k="OR");const g=b.split(R?/ or /i:/ and /i),A=[];for(const U of g){const $=PE(U.trim());if($){if(E.size>0&&!E.has($.targetId)){console.warn(`[schemaAdapter] Skipping condition - field "${$.targetId}" not found (may be calculated value or metadata): ${U}`);continue}A.push($)}else console.warn(`[schemaAdapter] Unable to parse condition: ${U}`)}return A.length===0?null:{logic:A.length===1?"AND":k,conditions:A}}catch(b){return console.warn(`[schemaAdapter] Error converting visibleIf: ${v}`,b),null}}function PE(v){const E=k=>v.match(k);let b=E(/\{(\w+)\}\s*=\s*'([^']+)'/)||E(/\{(\w+)\}\s*=\s*"([^"]+)"/)||E(/\{(\w+)\}\s*=\s*([\w.-]+)/);if(b){const k=b[2],R=k==="true"?"yes":k==="false"?"no":k;return{targetId:b[1],operator:"equals",value:R}}return b=E(/\{(\w+)\}\s*(?:<>|!=)\s*'([^']+)'/)||E(/\{(\w+)\}\s*(?:<>|!=)\s*"([^"]+)"/)||E(/\{(\w+)\}\s*(?:<>|!=)\s*([\w.-]+)/),b?(console.warn(`[schemaAdapter] "not equal" operator not yet supported: ${v}`),null):(b=E(/\{(\w+)\}\s+contains\s+'([^']+)'/)||E(/\{(\w+)\}\s+contains\s+"([^"]+)"/)||E(/\{(\w+)\}\s+contains\s+([\w.-]+)/),b?{targetId:b[1],operator:"contains",value:b[2]}:(b=E(/\{(\w+)\}\s+empty/i),b?{targetId:b[1],operator:"equals",value:""}:(b=E(/\{(\w+)\}\s+notempty/i),b&&console.warn(`[schemaAdapter] "notempty" operator not yet supported: ${v}`),null)))}function IE(v){const E=new Map,b=k=>{k.forEach(R=>{E.set(R.id,R),R.fields&&Array.isArray(R.fields)&&b(R.fields)})};return b(v),E}function VE(v){const E=IE(v),b=k=>{k.enableWhen&&k.enableWhen.conditions&&k.enableWhen.conditions.forEach(R=>{const j=E.get(R.targetId);if(j&&j.options&&Array.isArray(j.options)){const g=j.options.find(A=>A.value===R.value);g?R.value=g.id:console.warn(`[schemaAdapter] No matching option found for value "${R.value}" in field "${R.targetId}"`)}}),k.fields&&Array.isArray(k.fields)&&k.fields.forEach(b)};v.forEach(b)}function BE(v,E="inhouse",b=!1){const k=tt.useRef(!1),R=bv();tt.useEffect(()=>{if(k.current||!v)return;const j=jE(v,E),g=j.fields||j;j.conversionReport&&R.setConversionReport(j.conversionReport),ma.getState().replaceAll(g),R.preview.set(!0),k.current=!0},[v,E,R]),tt.useEffect(()=>{R.setHideUnsupportedFields(b)},[b,R])}const $E=tt.memo(function({id:E}){const b=ma(tt.useCallback(R=>R.byId[E],[E]));if(!b)return null;const k=by(b.fieldType);return k?Ku.jsx("div",{className:"mb-1.5","data-field-type":b.fieldType,"data-field-id":b.id,children:Ku.jsx(k,{field:b})}):null});function YE(){const v=bv(),{fields:E}=xE(v.state.isPreview),b=Un(R=>R.hideUnsupportedFields),k=Gu.useMemo(()=>(b?E.filter(j=>j.fieldType!=="unsupported"):E).map(j=>j.id),[E,b]);return Ku.jsx("div",{children:k.map(R=>Ku.jsx($E,{id:R},R))})}function WE({fields:v,schemaType:E="inhouse",onChange:b,className:k="",fullHeight:R=!1,hideUnsupportedFields:j=!1}){BE(v,E,j),tt.useEffect(()=>b?ma.subscribe(U=>{const $=U.order.map(re=>U.byId[re]);b($)}):void 0,[b]);const g=["qb-render-root","bg-gray-100","font-titillium",R?"min-h-screen":"",k].filter(Boolean).join(" ");return Ku.jsx("div",{className:g,children:Ku.jsx("div",{className:"max-w-4xl mx-auto px-2 pb-8 pt-4",children:Ku.jsx(YE,{})})})}function db(){if(typeof Template>"u"){console.error("Blaze Template not found. Make sure this runs in a Meteor environment.");return}Template.questionnaireRenderer=new Blaze.Template("Template.questionnaireRenderer",function(){return HTML.DIV({class:"questionnaire-renderer-mount"})}),Template.questionnaireRenderer.onRendered(function(){const v=this,E=v.find(".questionnaire-renderer-mount");if(!E){console.error("Mount node not found");return}const b=nE.createRoot(E),k=()=>{const R={fields:v.data.fields||[],schemaType:v.data.schemaType||"inhouse",hideUnsupportedFields:v.data.hideUnsupportedFields||!1,onChange:v.data.onChange,onSubmit:v.data.onSubmit,fullHeight:v.data.fullHeight,className:v.data.className};b.render(tt.createElement(WE,R))};typeof Tracker<"u"?v.autorun(()=>{k()}):k(),v.view.onViewDestroyed(()=>{b.unmount()})})}typeof Meteor<"u"&&db(),pc.registerBlazeTemplate=db,Object.defineProperty(pc,Symbol.toStringTag,{value:"Module"})}));
|
|
2227
2169
|
//# sourceMappingURL=blaze.umd.cjs.map
|