@timeax/form-palette 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -587,1631 +587,650 @@ var FieldRegistry = class {
587
587
  }
588
588
  };
589
589
  _binding = new WeakMap();
590
- var CORE_PROP_KEYS = /* @__PURE__ */ new Set([
591
- "adapter",
592
- "schema",
593
- "exceptions",
594
- "persist",
595
- "name",
596
- "activateButtonOnChange",
597
- "onChange",
598
- "onUpdate",
599
- "changeBefore",
600
- "formRef",
601
- "valueBag",
602
- "valueFeed",
603
- "onFinish",
604
- "init",
605
- "onSubmit",
606
- "onSubmitted",
607
- "children"
608
- ]);
609
- function isPlainObject(value) {
610
- return typeof value === "object" && value !== null && !Array.isArray(value);
611
- }
612
- function deepEqual(a3, b2) {
613
- if (a3 === b2) return true;
614
- if (typeof a3 === "number" && typeof b2 === "number") {
615
- if (Number.isNaN(a3) && Number.isNaN(b2)) return true;
590
+
591
+ // src/lib/register-global.ts
592
+ function registerPaletteUtil(key, value) {
593
+ if (typeof window === "undefined") return;
594
+ if (!window["form-palette"]) {
595
+ window["form-palette"] = {};
616
596
  }
617
- if (Array.isArray(a3) && Array.isArray(b2)) {
618
- if (a3.length !== b2.length) return false;
619
- for (let i3 = 0; i3 < a3.length; i3++) {
620
- if (!deepEqual(a3[i3], b2[i3])) return false;
621
- }
622
- return true;
597
+ window["form-palette"][key] = value;
598
+ }
599
+ function getPaletteUtil(key, defaultValue) {
600
+ if (typeof window === "undefined") {
601
+ return defaultValue;
623
602
  }
624
- if (isPlainObject(a3) && isPlainObject(b2)) {
625
- const aKeys = Object.keys(a3);
626
- const bKeys = Object.keys(b2);
627
- if (aKeys.length !== bKeys.length) return false;
628
- for (const key of aKeys) {
629
- if (!Object.prototype.hasOwnProperty.call(b2, key)) return false;
630
- if (!deepEqual(a3[key], b2[key])) return false;
631
- }
632
- return true;
603
+ const registry3 = window["form-palette"];
604
+ if (registry3 && key in registry3) {
605
+ return registry3[key];
633
606
  }
634
- return false;
607
+ return defaultValue;
635
608
  }
636
- function CoreProvider(props) {
637
- var _a, _b;
638
- const registryRef = React68__namespace.useRef(new FieldRegistry());
639
- const bucketRef = React68__namespace.useRef({});
640
- const uncaughtRef = React68__namespace.useRef([]);
641
- const errorsRef = React68__namespace.useRef(null);
642
- const buttonRef = React68__namespace.useRef(null);
643
- const activeButtonNameRef = React68__namespace.useRef(null);
644
- const [hasUncaughtErrors, setHasUncaughtErrors] = React68__namespace.useState(0);
645
- const originalRef = React68__namespace.useRef(null);
646
- const propsRef = React68__namespace.useRef(props);
647
- React68__namespace.useEffect(() => {
648
- propsRef.current = props;
649
- }, [props]);
650
- const adapterKey = (_a = props.adapter) != null ? _a : "local";
651
- const schema = props.schema;
652
- const errorBagId = (_b = props.name) != null ? _b : void 0;
653
- let context;
654
- function fetchAllNamedFields() {
655
- return registryRef.current.getAllNamed();
656
- }
657
- function clearFieldErrors() {
658
- for (const field of fetchAllNamedFields()) {
659
- const anyField = field;
660
- if (typeof anyField.setError === "function") {
661
- anyField.setError(void 0);
662
- } else if ("error" in anyField) {
663
- anyField.error = void 0;
664
- }
665
- }
609
+
610
+ // ../../node_modules/clsx/dist/clsx.mjs
611
+ function r(e4) {
612
+ var t4, f2, n3 = "";
613
+ if ("string" == typeof e4 || "number" == typeof e4) n3 += e4;
614
+ else if ("object" == typeof e4) if (Array.isArray(e4)) {
615
+ var o3 = e4.length;
616
+ for (t4 = 0; t4 < o3; t4++) e4[t4] && (f2 = r(e4[t4])) && (n3 && (n3 += " "), n3 += f2);
617
+ } else for (f2 in e4) e4[f2] && (n3 && (n3 += " "), n3 += f2);
618
+ return n3;
619
+ }
620
+ function clsx() {
621
+ for (var e4, t4, f2 = 0, n3 = "", o3 = arguments.length; f2 < o3; f2++) (e4 = arguments[f2]) && (t4 = r(e4)) && (n3 && (n3 += " "), n3 += t4);
622
+ return n3;
623
+ }
624
+
625
+ // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
626
+ var concatArrays = (array1, array2) => {
627
+ const combinedArray = new Array(array1.length + array2.length);
628
+ for (let i3 = 0; i3 < array1.length; i3++) {
629
+ combinedArray[i3] = array1[i3];
666
630
  }
667
- function findFieldForErrorKey(key) {
668
- if (!key) return void 0;
669
- return fetchAllNamedFields().find((f2) => {
670
- const raw = f2.name;
671
- if (!raw) return false;
672
- const trimmed = raw.trim();
673
- if (!trimmed) return false;
674
- const base = trimmed.replace(/\[]$/, "");
675
- if (key === base || key === trimmed) return true;
676
- const sharedKey = f2.shared;
677
- if (!sharedKey) return false;
678
- const sharedBase = `${sharedKey}.${base}`;
679
- const sharedRaw = `${sharedKey}.${trimmed}`;
680
- return key === sharedBase || key === sharedRaw;
681
- });
631
+ for (let i3 = 0; i3 < array2.length; i3++) {
632
+ combinedArray[array1.length + i3] = array2[i3];
682
633
  }
683
- function setFieldError(name, message2) {
684
- const field = findFieldForErrorKey(name);
685
- if (field) {
686
- const anyField = field;
687
- if (typeof anyField.setError === "function") {
688
- anyField.setError(message2);
689
- } else {
690
- anyField.error = message2;
691
- }
692
- } else {
693
- uncaughtRef.current.push(message2);
634
+ return combinedArray;
635
+ };
636
+ var createClassValidatorObject = (classGroupId, validator) => ({
637
+ classGroupId,
638
+ validator
639
+ });
640
+ var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
641
+ nextPart,
642
+ validators,
643
+ classGroupId
644
+ });
645
+ var CLASS_PART_SEPARATOR = "-";
646
+ var EMPTY_CONFLICTS = [];
647
+ var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
648
+ var createClassGroupUtils = (config) => {
649
+ const classMap = createClassMap(config);
650
+ const {
651
+ conflictingClassGroups,
652
+ conflictingClassGroupModifiers
653
+ } = config;
654
+ const getClassGroupId = (className) => {
655
+ if (className.startsWith("[") && className.endsWith("]")) {
656
+ return getGroupIdForArbitraryProperty(className);
694
657
  }
695
- }
696
- function collectValues() {
697
- var _a2, _b2;
698
- const exceptions = (_a2 = propsRef.current.exceptions) != null ? _a2 : [];
699
- const list = {};
700
- const shared = {};
701
- for (const item of fetchAllNamedFields()) {
702
- const rawName = item.name;
703
- if (!rawName) continue;
704
- const trimmed = rawName.trim();
705
- if (!trimmed) continue;
706
- const isArray = trimmed.endsWith("[]");
707
- const base = trimmed.replace(/\[]$/, "");
708
- const sharedKey = item.shared;
709
- const target = sharedKey ? (_b2 = shared[sharedKey]) != null ? _b2 : shared[sharedKey] = {} : list;
710
- const fullPath = sharedKey ? `${sharedKey}.${base}` : base;
711
- if (exceptions.includes(trimmed) || exceptions.includes(base) || exceptions.includes(fullPath)) {
712
- continue;
713
- }
714
- const anyField = item;
715
- const val = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
716
- if (isArray) {
717
- const existing = target[base];
718
- if (Array.isArray(existing)) {
719
- target[base] = [...existing, val];
720
- } else if (typeof existing === "undefined") {
721
- target[base] = [val];
722
- } else {
723
- target[base] = [existing, val];
658
+ const classParts = className.split(CLASS_PART_SEPARATOR);
659
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
660
+ return getGroupRecursive(classParts, startIndex, classMap);
661
+ };
662
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
663
+ if (hasPostfixModifier) {
664
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
665
+ const baseConflicts = conflictingClassGroups[classGroupId];
666
+ if (modifierConflicts) {
667
+ if (baseConflicts) {
668
+ return concatArrays(baseConflicts, modifierConflicts);
724
669
  }
725
- } else {
726
- target[base] = val;
670
+ return modifierConflicts;
727
671
  }
672
+ return baseConflicts || EMPTY_CONFLICTS;
728
673
  }
729
- const fromFields = { ...list, ...shared };
730
- const merged = {
731
- ...bucketRef.current,
732
- ...fromFields
733
- };
734
- return merged;
674
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
675
+ };
676
+ return {
677
+ getClassGroupId,
678
+ getConflictingClassGroupIds
679
+ };
680
+ };
681
+ var getGroupRecursive = (classParts, startIndex, classPartObject) => {
682
+ const classPathsLength = classParts.length - startIndex;
683
+ if (classPathsLength === 0) {
684
+ return classPartObject.classGroupId;
735
685
  }
736
- function validateInternal(report = false) {
737
- let valid = true;
738
- if (report) {
739
- uncaughtRef.current = [];
740
- clearFieldErrors();
741
- }
742
- for (const field of fetchAllNamedFields()) {
743
- const anyField = field;
744
- if (typeof anyField.validate === "function") {
745
- const ok = anyField.validate(report);
746
- if (!ok) valid = false;
747
- }
748
- }
749
- if (schema) {
750
- try {
751
- schema.parse(collectValues());
752
- } catch (err) {
753
- valid = false;
754
- if (report && err && typeof err === "object") {
755
- const anyErr = err;
756
- if (anyErr.issues) {
757
- const { fieldErrors, uncaught } = mapZodError(anyErr);
758
- for (const [name, message2] of Object.entries(
759
- fieldErrors
760
- )) {
761
- setFieldError(name, message2);
762
- }
763
- if (uncaught.length) {
764
- uncaughtRef.current.push(...uncaught);
765
- }
766
- }
767
- }
768
- }
769
- }
770
- return valid;
686
+ const currentClassPart = classParts[startIndex];
687
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
688
+ if (nextClassPartObject) {
689
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
690
+ if (result) return result;
771
691
  }
772
- function getAdapterPropsFrom(current) {
773
- const result = {};
774
- for (const key in current) {
775
- if (!CORE_PROP_KEYS.has(key)) {
776
- result[key] = current[key];
777
- }
692
+ const validators = classPartObject.validators;
693
+ if (validators === null) {
694
+ return void 0;
695
+ }
696
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
697
+ const validatorsLength = validators.length;
698
+ for (let i3 = 0; i3 < validatorsLength; i3++) {
699
+ const validatorObj = validators[i3];
700
+ if (validatorObj.validator(classRest)) {
701
+ return validatorObj.classGroupId;
778
702
  }
779
- return result;
780
703
  }
781
- async function submitWithAdapter(adapterOverride, extra, ignoreForm, autoErr = true, autoRun = true) {
782
- var _a2, _b2;
783
- const currentProps = propsRef.current;
784
- const btn = buttonRef.current;
785
- const activeName = activeButtonNameRef.current;
786
- const isActiveButton = !!btn && typeof btn === "object" && btn.name === activeName;
787
- const setButtonLoading = (loading) => {
788
- if (!isActiveButton) return;
789
- if (typeof btn.setLoading === "function") {
790
- btn.setLoading(loading);
791
- } else if ("loading" in btn) {
792
- btn.loading = loading;
704
+ return void 0;
705
+ };
706
+ var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
707
+ const content = className.slice(1, -1);
708
+ const colonIndex = content.indexOf(":");
709
+ const property = content.slice(0, colonIndex);
710
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
711
+ })();
712
+ var createClassMap = (config) => {
713
+ const {
714
+ theme,
715
+ classGroups
716
+ } = config;
717
+ return processClassGroups(classGroups, theme);
718
+ };
719
+ var processClassGroups = (classGroups, theme) => {
720
+ const classMap = createClassPartObject();
721
+ for (const classGroupId in classGroups) {
722
+ const group = classGroups[classGroupId];
723
+ processClassesRecursively(group, classMap, classGroupId, theme);
724
+ }
725
+ return classMap;
726
+ };
727
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
728
+ const len = classGroup.length;
729
+ for (let i3 = 0; i3 < len; i3++) {
730
+ const classDefinition = classGroup[i3];
731
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
732
+ }
733
+ };
734
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
735
+ if (typeof classDefinition === "string") {
736
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
737
+ return;
738
+ }
739
+ if (typeof classDefinition === "function") {
740
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
741
+ return;
742
+ }
743
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
744
+ };
745
+ var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
746
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
747
+ classPartObjectToEdit.classGroupId = classGroupId;
748
+ };
749
+ var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
750
+ if (isThemeGetter(classDefinition)) {
751
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
752
+ return;
753
+ }
754
+ if (classPartObject.validators === null) {
755
+ classPartObject.validators = [];
756
+ }
757
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
758
+ };
759
+ var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
760
+ const entries = Object.entries(classDefinition);
761
+ const len = entries.length;
762
+ for (let i3 = 0; i3 < len; i3++) {
763
+ const [key, value] = entries[i3];
764
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
765
+ }
766
+ };
767
+ var getPart = (classPartObject, path) => {
768
+ let current = classPartObject;
769
+ const parts = path.split(CLASS_PART_SEPARATOR);
770
+ const len = parts.length;
771
+ for (let i3 = 0; i3 < len; i3++) {
772
+ const part = parts[i3];
773
+ let next = current.nextPart.get(part);
774
+ if (!next) {
775
+ next = createClassPartObject();
776
+ current.nextPart.set(part, next);
777
+ }
778
+ current = next;
779
+ }
780
+ return current;
781
+ };
782
+ var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
783
+ var createLruCache = (maxCacheSize) => {
784
+ if (maxCacheSize < 1) {
785
+ return {
786
+ get: () => void 0,
787
+ set: () => {
793
788
  }
794
789
  };
795
- setButtonLoading(true);
796
- let finished = false;
797
- const finish = () => {
798
- if (finished) return;
799
- finished = true;
800
- if (uncaughtRef.current.length)
801
- setHasUncaughtErrors(hasUncaughtErrors + 1);
802
- setButtonLoading(false);
803
- };
804
- if (!ignoreForm) {
805
- const ok = validateInternal(true);
806
- if (!ok) {
807
- finish();
808
- return void 0;
790
+ }
791
+ let cacheSize = 0;
792
+ let cache = /* @__PURE__ */ Object.create(null);
793
+ let previousCache = /* @__PURE__ */ Object.create(null);
794
+ const update = (key, value) => {
795
+ cache[key] = value;
796
+ cacheSize++;
797
+ if (cacheSize > maxCacheSize) {
798
+ cacheSize = 0;
799
+ previousCache = cache;
800
+ cache = /* @__PURE__ */ Object.create(null);
801
+ }
802
+ };
803
+ return {
804
+ get(key) {
805
+ let value = cache[key];
806
+ if (value !== void 0) {
807
+ return value;
808
+ }
809
+ if ((value = previousCache[key]) !== void 0) {
810
+ update(key, value);
811
+ return value;
812
+ }
813
+ },
814
+ set(key, value) {
815
+ if (key in cache) {
816
+ cache[key] = value;
817
+ } else {
818
+ update(key, value);
809
819
  }
810
820
  }
811
- let submissionValues = {
812
- ...collectValues(),
813
- ...extra != null ? extra : {}
814
- };
815
- let adapterConfig = {
816
- ...getAdapterPropsFrom(currentProps),
817
- ...adapterOverride
818
- };
819
- const event = {
820
- preventDefault() {
821
- this.continue = false;
822
- },
823
- editData(cb) {
824
- const result = cb(submissionValues);
825
- if (result) {
826
- submissionValues = result;
821
+ };
822
+ };
823
+ var IMPORTANT_MODIFIER = "!";
824
+ var MODIFIER_SEPARATOR = ":";
825
+ var EMPTY_MODIFIERS = [];
826
+ var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
827
+ modifiers,
828
+ hasImportantModifier,
829
+ baseClassName,
830
+ maybePostfixModifierPosition,
831
+ isExternal
832
+ });
833
+ var createParseClassName = (config) => {
834
+ const {
835
+ prefix,
836
+ experimentalParseClassName
837
+ } = config;
838
+ let parseClassName = (className) => {
839
+ const modifiers = [];
840
+ let bracketDepth = 0;
841
+ let parenDepth = 0;
842
+ let modifierStart = 0;
843
+ let postfixModifierPosition;
844
+ const len = className.length;
845
+ for (let index = 0; index < len; index++) {
846
+ const currentCharacter = className[index];
847
+ if (bracketDepth === 0 && parenDepth === 0) {
848
+ if (currentCharacter === MODIFIER_SEPARATOR) {
849
+ modifiers.push(className.slice(modifierStart, index));
850
+ modifierStart = index + 1;
851
+ continue;
827
852
  }
828
- },
829
- setConfig(arg1, arg2) {
830
- if (typeof arg1 === "string") {
831
- adapterConfig[arg1] = arg2;
832
- } else if (arg1 && typeof arg1 === "object") {
833
- adapterConfig = {
834
- ...adapterConfig,
835
- ...arg1
836
- };
853
+ if (currentCharacter === "/") {
854
+ postfixModifierPosition = index;
855
+ continue;
837
856
  }
838
- },
839
- button: (_a2 = buttonRef.current) != null ? _a2 : void 0,
840
- get formData() {
841
- return submissionValues;
842
- },
843
- form: context,
844
- continue: true
845
- };
846
- if (currentProps.onSubmit) {
847
- try {
848
- await currentProps.onSubmit(event);
849
- } catch (err) {
850
- finish();
851
- throw err;
852
857
  }
858
+ if (currentCharacter === "[") bracketDepth++;
859
+ else if (currentCharacter === "]") bracketDepth--;
860
+ else if (currentCharacter === "(") parenDepth++;
861
+ else if (currentCharacter === ")") parenDepth--;
853
862
  }
854
- if (!event.continue) {
855
- finish();
856
- return void 0;
863
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
864
+ let baseClassName = baseClassNameWithImportantModifier;
865
+ let hasImportantModifier = false;
866
+ if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
867
+ baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
868
+ hasImportantModifier = true;
869
+ } else if (
870
+ /**
871
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
872
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
873
+ */
874
+ baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
875
+ ) {
876
+ baseClassName = baseClassNameWithImportantModifier.slice(1);
877
+ hasImportantModifier = true;
857
878
  }
858
- const factory = (_b2 = getAdapter(adapterKey)) != null ? _b2 : localAdapter;
859
- const adapter = factory({
860
- // adapter-specific config (url, method, config, etc.)
861
- ...adapterConfig,
862
- // core config
863
- data: submissionValues,
864
- errorBag: errorBagId,
865
- callbacks: {
866
- onSuccess(ok) {
867
- const maybe = propsRef.current.onSubmitted;
868
- if (maybe) {
869
- void maybe(context, ok, () => {
870
- finish();
871
- });
872
- }
873
- },
874
- onError(err, updateRef) {
875
- var _a3;
876
- if (!autoErr || !err || typeof err !== "object") {
877
- return;
878
- }
879
- const anyErr = err;
880
- if (anyErr.errors && typeof anyErr.errors === "object") {
881
- const { fieldErrors, uncaught } = mapErrorBag(
882
- (_a3 = anyErr.errors) != null ? _a3 : {}
883
- );
884
- if (updateRef) {
885
- errorsRef.current = fieldErrors;
886
- } else
887
- for (const [name, message2] of Object.entries(
888
- fieldErrors
889
- )) {
890
- setFieldError(name, message2);
891
- }
892
- if (uncaught.length) {
893
- uncaughtRef.current.push(...uncaught);
894
- }
895
- }
896
- },
897
- onFinish() {
898
- const maybe = propsRef.current.onFinish;
899
- if (maybe) {
900
- maybe(context);
901
- }
902
- finish();
903
- }
904
- }
879
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
880
+ return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
881
+ };
882
+ if (prefix) {
883
+ const fullPrefix = prefix + MODIFIER_SEPARATOR;
884
+ const parseClassNameOriginal = parseClassName;
885
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
886
+ }
887
+ if (experimentalParseClassName) {
888
+ const parseClassNameOriginal = parseClassName;
889
+ parseClassName = (className) => experimentalParseClassName({
890
+ className,
891
+ parseClassName: parseClassNameOriginal
905
892
  });
906
- if (autoRun) {
907
- try {
908
- await adapter.send();
909
- } catch (e4) {
910
- console.log("Adapter failed to send.", e4);
911
- }
912
- }
913
- return adapter;
914
893
  }
915
- context = {
916
- values() {
917
- return collectValues();
918
- },
919
- submit() {
920
- const valid = validateInternal(true);
921
- const vals = collectValues();
922
- return { values: vals, valid };
923
- },
924
- getBind(id) {
925
- return registryRef.current.getByBind(id);
926
- },
927
- validate(report) {
928
- return validateInternal(report);
929
- },
930
- addField(field) {
931
- var _a2, _b2;
932
- const rawName = (_a2 = field.name) != null ? _a2 : "";
933
- field.name = rawName.trim();
934
- const { valueBag, valueFeed } = propsRef.current;
935
- const trimmed = ((_b2 = field.name) != null ? _b2 : "").trim();
936
- const hasName = !!trimmed;
937
- const isArray = hasName && trimmed.endsWith("[]");
938
- const base = hasName ? trimmed.replace(/\[]$/, "") : "";
939
- const sharedKey = field.shared;
940
- if (valueBag && !field.ignore && hasName) {
941
- const sourceRoot = sharedKey && valueBag[sharedKey] ? valueBag[sharedKey] : valueBag;
942
- let value = void 0;
943
- if (sourceRoot && typeof sourceRoot === "object") {
944
- if (isArray && Array.isArray(sourceRoot[base])) {
945
- const siblings = fetchAllNamedFields().filter((f2) => {
946
- var _a3;
947
- const rn = ((_a3 = f2.name) != null ? _a3 : "").trim();
948
- return rn === trimmed && f2.shared === sharedKey;
949
- });
950
- const idx = siblings.length;
951
- value = sourceRoot[base][idx];
952
- } else {
953
- value = sourceRoot[base];
954
- }
955
- }
956
- let hydrated = value;
957
- if (valueFeed) {
958
- const maybe = valueFeed(
959
- base,
960
- value,
961
- context
962
- );
963
- if (typeof maybe !== "undefined") {
964
- hydrated = maybe;
965
- }
966
- }
967
- if (typeof hydrated !== "undefined") {
968
- const anyField = field;
969
- if (typeof anyField.setValue === "function") {
970
- anyField.setValue(hydrated);
971
- } else {
972
- anyField.value = hydrated;
973
- }
894
+ return parseClassName;
895
+ };
896
+ var createSortModifiers = (config) => {
897
+ const modifierWeights = /* @__PURE__ */ new Map();
898
+ config.orderSensitiveModifiers.forEach((mod, index) => {
899
+ modifierWeights.set(mod, 1e6 + index);
900
+ });
901
+ return (modifiers) => {
902
+ const result = [];
903
+ let currentSegment = [];
904
+ for (let i3 = 0; i3 < modifiers.length; i3++) {
905
+ const modifier = modifiers[i3];
906
+ const isArbitrary = modifier[0] === "[";
907
+ const isOrderSensitive = modifierWeights.has(modifier);
908
+ if (isArbitrary || isOrderSensitive) {
909
+ if (currentSegment.length > 0) {
910
+ currentSegment.sort();
911
+ result.push(...currentSegment);
912
+ currentSegment = [];
974
913
  }
914
+ result.push(modifier);
915
+ } else {
916
+ currentSegment.push(modifier);
975
917
  }
976
- registryRef.current.add(field);
977
- },
978
- // Expose registry view as inputs (delegates to FieldRegistry instance)
979
- inputs: registryRef.current,
980
- // Also expose raw list of fields for compatibility is defined later as a getter
981
- bucket: bucketRef.current,
982
- error(nameOrBag, maybeMsg) {
983
- if (typeof nameOrBag === "string") {
984
- if (!maybeMsg) return;
985
- setFieldError(nameOrBag, maybeMsg);
986
- return;
987
- }
988
- const { fieldErrors, uncaught } = mapErrorBag(nameOrBag);
989
- for (const [name, message2] of Object.entries(fieldErrors)) {
990
- setFieldError(name, message2);
991
- }
992
- if (uncaught.length) {
993
- uncaughtRef.current.push(...uncaught);
918
+ }
919
+ if (currentSegment.length > 0) {
920
+ currentSegment.sort();
921
+ result.push(...currentSegment);
922
+ }
923
+ return result;
924
+ };
925
+ };
926
+ var createConfigUtils = (config) => ({
927
+ cache: createLruCache(config.cacheSize),
928
+ parseClassName: createParseClassName(config),
929
+ sortModifiers: createSortModifiers(config),
930
+ ...createClassGroupUtils(config)
931
+ });
932
+ var SPLIT_CLASSES_REGEX = /\s+/;
933
+ var mergeClassList = (classList, configUtils) => {
934
+ const {
935
+ parseClassName,
936
+ getClassGroupId,
937
+ getConflictingClassGroupIds,
938
+ sortModifiers
939
+ } = configUtils;
940
+ const classGroupsInConflict = [];
941
+ const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
942
+ let result = "";
943
+ for (let index = classNames.length - 1; index >= 0; index -= 1) {
944
+ const originalClassName = classNames[index];
945
+ const {
946
+ isExternal,
947
+ modifiers,
948
+ hasImportantModifier,
949
+ baseClassName,
950
+ maybePostfixModifierPosition
951
+ } = parseClassName(originalClassName);
952
+ if (isExternal) {
953
+ result = originalClassName + (result.length > 0 ? " " + result : result);
954
+ continue;
955
+ }
956
+ let hasPostfixModifier = !!maybePostfixModifierPosition;
957
+ let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
958
+ if (!classGroupId) {
959
+ if (!hasPostfixModifier) {
960
+ result = originalClassName + (result.length > 0 ? " " + result : result);
961
+ continue;
994
962
  }
995
- },
996
- controlButton() {
997
- const { activateButtonOnChange } = propsRef.current;
998
- if (!activateButtonOnChange) return;
999
- const btn = buttonRef.current;
1000
- const activeName = activeButtonNameRef.current;
1001
- if (!btn || btn.name !== activeName) {
1002
- return;
963
+ classGroupId = getClassGroupId(baseClassName);
964
+ if (!classGroupId) {
965
+ result = originalClassName + (result.length > 0 ? " " + result : result);
966
+ continue;
1003
967
  }
1004
- if (!originalRef.current) {
1005
- originalRef.current = collectValues();
968
+ hasPostfixModifier = false;
969
+ }
970
+ const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
971
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
972
+ const classId = modifierId + classGroupId;
973
+ if (classGroupsInConflict.indexOf(classId) > -1) {
974
+ continue;
975
+ }
976
+ classGroupsInConflict.push(classId);
977
+ const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
978
+ for (let i3 = 0; i3 < conflictGroups.length; ++i3) {
979
+ const group = conflictGroups[i3];
980
+ classGroupsInConflict.push(modifierId + group);
981
+ }
982
+ result = originalClassName + (result.length > 0 ? " " + result : result);
983
+ }
984
+ return result;
985
+ };
986
+ var twJoin = (...classLists) => {
987
+ let index = 0;
988
+ let argument;
989
+ let resolvedValue;
990
+ let string = "";
991
+ while (index < classLists.length) {
992
+ if (argument = classLists[index++]) {
993
+ if (resolvedValue = toValue(argument)) {
994
+ string && (string += " ");
995
+ string += resolvedValue;
1006
996
  }
1007
- const current = collectValues();
1008
- const original = originalRef.current;
1009
- const dirty = !deepEqual(original, current);
1010
- const setDisabled = (disabled) => {
1011
- if (typeof btn.setDisabled === "function") {
1012
- btn.setDisabled(disabled);
1013
- } else if ("disabled" in btn) {
1014
- btn.disabled = disabled;
1015
- }
1016
- };
1017
- setDisabled(!dirty);
1018
- },
1019
- isDirty() {
1020
- if (!originalRef.current) {
1021
- originalRef.current = collectValues();
1022
- }
1023
- const current = collectValues();
1024
- const original = originalRef.current;
1025
- return !deepEqual(original, current);
1026
- },
1027
- async prepare(type, route, extra, ignoreForm, autoErr) {
1028
- const override = {
1029
- method: type,
1030
- url: route
1031
- };
1032
- return submitWithAdapter(
1033
- override,
1034
- extra,
1035
- ignoreForm,
1036
- autoErr,
1037
- false
1038
- );
1039
- },
1040
- persist(data, feed) {
1041
- var _a2, _b2;
1042
- const seen = {};
1043
- const root = data;
1044
- const useFeed = feed || (propsRef.current.valueFeed ? (name, value, original) => {
1045
- const vf = propsRef.current.valueFeed;
1046
- const maybe = vf(
1047
- name,
1048
- value,
1049
- context
1050
- );
1051
- return typeof maybe === "undefined" ? original : maybe;
1052
- } : void 0);
1053
- for (const field of fetchAllNamedFields()) {
1054
- const rawName = field.name;
1055
- if (!rawName) continue;
1056
- if (field.ignore) continue;
1057
- const trimmed = rawName.trim();
1058
- if (!trimmed) continue;
1059
- const isArray = trimmed.endsWith("[]");
1060
- const base = trimmed.replace(/\[]$/, "");
1061
- const sharedKey = field.shared;
1062
- const key = sharedKey ? `${sharedKey}.${base}` : base;
1063
- let value = void 0;
1064
- if (sharedKey) {
1065
- const group = root[sharedKey];
1066
- if (group && typeof group === "object") {
1067
- if (isArray && Array.isArray(group[base])) {
1068
- const idx = (_a2 = seen[key]) != null ? _a2 : 0;
1069
- value = group[base][idx];
1070
- seen[key] = idx + 1;
1071
- } else {
1072
- value = group[base];
1073
- }
1074
- }
1075
- } else {
1076
- if (isArray && Array.isArray(root[base])) {
1077
- const idx = (_b2 = seen[key]) != null ? _b2 : 0;
1078
- value = root[base][idx];
1079
- seen[key] = idx + 1;
1080
- } else {
1081
- value = root[base];
1082
- }
1083
- }
1084
- const anyField = field;
1085
- const original = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
1086
- let next = value;
1087
- if (useFeed) {
1088
- const maybe = useFeed(base, value, original);
1089
- if (typeof maybe === "undefined") {
1090
- continue;
1091
- }
1092
- next = maybe;
1093
- }
1094
- if (typeof anyField.setValue === "function") {
1095
- anyField.setValue(next);
1096
- } else {
1097
- anyField.value = next;
1098
- }
1099
- }
1100
- if (propsRef.current.onUpdate) {
1101
- propsRef.current.onUpdate(collectValues());
1102
- }
1103
- },
1104
- setValue(name, value) {
1105
- if (!name) return;
1106
- let sharedKey;
1107
- let base = name;
1108
- if (name.includes(".")) {
1109
- const [group, field] = name.split(".", 2);
1110
- sharedKey = group;
1111
- base = field;
1112
- }
1113
- const targetField = fetchAllNamedFields().find((f2) => {
1114
- var _a2;
1115
- const raw = ((_a2 = f2.name) != null ? _a2 : "").trim();
1116
- if (!raw) return false;
1117
- const isArray = raw.endsWith("[]");
1118
- const rawBase = raw.replace(/\[]$/, "");
1119
- const fShared = f2.shared;
1120
- const sameGroup = fShared === sharedKey;
1121
- const sameName = raw === name || rawBase === base || `${fShared}.${rawBase}` === name;
1122
- return (!sharedKey || sameGroup) && sameName && !isArray;
1123
- });
1124
- if (targetField) {
1125
- const anyField = targetField;
1126
- if (typeof anyField.setValue === "function") {
1127
- anyField.setValue(value);
1128
- } else {
1129
- anyField.value = value;
1130
- }
1131
- } else {
1132
- bucketRef.current[name] = value;
1133
- }
1134
- if (propsRef.current.onUpdate) {
1135
- propsRef.current.onUpdate(collectValues());
1136
- }
1137
- },
1138
- go(data, ignoreForm) {
1139
- void submitWithAdapter(void 0, data, ignoreForm, true, true);
1140
- },
1141
- reset(inputs) {
1142
- if (!inputs.length) return;
1143
- for (const field of fetchAllNamedFields()) {
1144
- const raw = field.name;
1145
- if (!raw) continue;
1146
- if (!inputs.includes(raw)) continue;
1147
- const anyField = field;
1148
- if (typeof anyField.reset === "function") {
1149
- anyField.reset();
1150
- } else if (typeof anyField.setValue === "function") {
1151
- anyField.setValue(void 0);
1152
- } else {
1153
- anyField.value = void 0;
1154
- }
1155
- }
1156
- },
1157
- set button(btn) {
1158
- buttonRef.current = btn;
1159
- },
1160
- async forceSubmit() {
1161
- await submitWithAdapter(void 0, void 0, false, true, true);
1162
- },
1163
- get fields() {
1164
- return fetchAllNamedFields();
1165
- },
1166
- get props() {
1167
- const { formRef, valueBag, ...rest } = propsRef.current;
1168
- return rest;
1169
- },
1170
- setActiveButton(name) {
1171
- activeButtonNameRef.current = name;
1172
- },
1173
- hasUncaughtErrors,
1174
- getUncaught() {
1175
- return uncaughtRef.current;
1176
- }
1177
- };
1178
- React68__namespace.useEffect(() => {
1179
- if (!props.formRef) return;
1180
- props.formRef.current = context;
1181
- return () => {
1182
- if (props.formRef) {
1183
- props.formRef.current = null;
1184
- }
1185
- };
1186
- }, [context]);
1187
- React68__namespace.useEffect(() => {
1188
- if (props.init) {
1189
- props.init(context);
1190
997
  }
1191
- }, []);
1192
- return /* @__PURE__ */ jsxRuntime.jsx(CoreContextReact.Provider, { value: context, children: props.children });
1193
- }
1194
- function useCoreContext() {
1195
- const ctx = React68.useContext(CoreContextReact);
1196
- if (!ctx) {
1197
- throw new Error("useCoreContext must be used within a <CoreProvider>.");
1198
998
  }
1199
- return ctx;
1200
- }
1201
-
1202
- // src/core/hooks/use-core.ts
1203
- function useCore() {
1204
- return useCoreContext();
1205
- }
1206
-
1207
- // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
1208
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1209
- var toCamelCase = (string) => string.replace(
1210
- /^([A-Z])|[\s-_]+(\w)/g,
1211
- (match2, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
1212
- );
1213
- var toPascalCase = (string) => {
1214
- const camelCase = toCamelCase(string);
1215
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
999
+ return string;
1216
1000
  };
1217
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
1218
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
1219
- }).join(" ").trim();
1220
- var hasA11yProp = (props) => {
1221
- for (const prop in props) {
1222
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
1223
- return true;
1001
+ var toValue = (mix) => {
1002
+ if (typeof mix === "string") {
1003
+ return mix;
1004
+ }
1005
+ let resolvedValue;
1006
+ let string = "";
1007
+ for (let k2 = 0; k2 < mix.length; k2++) {
1008
+ if (mix[k2]) {
1009
+ if (resolvedValue = toValue(mix[k2])) {
1010
+ string && (string += " ");
1011
+ string += resolvedValue;
1012
+ }
1224
1013
  }
1225
1014
  }
1015
+ return string;
1226
1016
  };
1227
-
1228
- // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
1229
- var defaultAttributes = {
1230
- xmlns: "http://www.w3.org/2000/svg",
1231
- width: 24,
1232
- height: 24,
1233
- viewBox: "0 0 24 24",
1234
- fill: "none",
1235
- stroke: "currentColor",
1236
- strokeWidth: 2,
1237
- strokeLinecap: "round",
1238
- strokeLinejoin: "round"
1017
+ var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
1018
+ let configUtils;
1019
+ let cacheGet;
1020
+ let cacheSet;
1021
+ let functionToCall;
1022
+ const initTailwindMerge = (classList) => {
1023
+ const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
1024
+ configUtils = createConfigUtils(config);
1025
+ cacheGet = configUtils.cache.get;
1026
+ cacheSet = configUtils.cache.set;
1027
+ functionToCall = tailwindMerge;
1028
+ return tailwindMerge(classList);
1029
+ };
1030
+ const tailwindMerge = (classList) => {
1031
+ const cachedResult = cacheGet(classList);
1032
+ if (cachedResult) {
1033
+ return cachedResult;
1034
+ }
1035
+ const result = mergeClassList(classList, configUtils);
1036
+ cacheSet(classList, result);
1037
+ return result;
1038
+ };
1039
+ functionToCall = initTailwindMerge;
1040
+ return (...args) => functionToCall(twJoin(...args));
1239
1041
  };
1240
-
1241
- // ../../node_modules/lucide-react/dist/esm/Icon.js
1242
- var Icon = React68.forwardRef(
1243
- ({
1244
- color = "currentColor",
1245
- size = 24,
1246
- strokeWidth = 2,
1247
- absoluteStrokeWidth,
1248
- className = "",
1249
- children,
1250
- iconNode,
1251
- ...rest
1252
- }, ref) => React68.createElement(
1253
- "svg",
1254
- {
1255
- ref,
1256
- ...defaultAttributes,
1257
- width: size,
1258
- height: size,
1259
- stroke: color,
1260
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
1261
- className: mergeClasses("lucide", className),
1262
- ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
1263
- ...rest
1264
- },
1265
- [
1266
- ...iconNode.map(([tag, attrs]) => React68.createElement(tag, attrs)),
1267
- ...Array.isArray(children) ? children : [children]
1268
- ]
1269
- )
1270
- );
1271
-
1272
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
1273
- var createLucideIcon = (iconName, iconNode) => {
1274
- const Component = React68.forwardRef(
1275
- ({ className, ...props }, ref) => React68.createElement(Icon, {
1276
- ref,
1277
- iconNode,
1278
- className: mergeClasses(
1279
- `lucide-${toKebabCase(toPascalCase(iconName))}`,
1280
- `lucide-${iconName}`,
1281
- className
1282
- ),
1283
- ...props
1284
- })
1285
- );
1286
- Component.displayName = toPascalCase(iconName);
1287
- return Component;
1042
+ var fallbackThemeArr = [];
1043
+ var fromTheme = (key) => {
1044
+ const themeGetter = (theme) => theme[key] || fallbackThemeArr;
1045
+ themeGetter.isThemeGetter = true;
1046
+ return themeGetter;
1288
1047
  };
1289
-
1290
- // ../../node_modules/lucide-react/dist/esm/icons/calendar.js
1291
- var __iconNode = [
1292
- ["path", { d: "M8 2v4", key: "1cmpym" }],
1293
- ["path", { d: "M16 2v4", key: "4m81vk" }],
1294
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
1295
- ["path", { d: "M3 10h18", key: "8toen8" }]
1296
- ];
1297
- var Calendar = createLucideIcon("calendar", __iconNode);
1298
-
1299
- // ../../node_modules/lucide-react/dist/esm/icons/check.js
1300
- var __iconNode2 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
1301
- var Check = createLucideIcon("check", __iconNode2);
1302
-
1303
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
1304
- var __iconNode3 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
1305
- var ChevronDown = createLucideIcon("chevron-down", __iconNode3);
1306
-
1307
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
1308
- var __iconNode4 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
1309
- var ChevronLeft = createLucideIcon("chevron-left", __iconNode4);
1310
-
1311
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
1312
- var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
1313
- var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
1314
-
1315
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
1316
- var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
1317
- var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
1318
-
1319
- // ../../node_modules/lucide-react/dist/esm/icons/circle-alert.js
1320
- var __iconNode7 = [
1321
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1322
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
1323
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
1324
- ];
1325
- var CircleAlert = createLucideIcon("circle-alert", __iconNode7);
1326
-
1327
- // ../../node_modules/lucide-react/dist/esm/icons/circle-check.js
1328
- var __iconNode8 = [
1329
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1330
- ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
1331
- ];
1332
- var CircleCheck = createLucideIcon("circle-check", __iconNode8);
1333
-
1334
- // ../../node_modules/lucide-react/dist/esm/icons/circle.js
1335
- var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
1336
- var Circle = createLucideIcon("circle", __iconNode9);
1337
-
1338
- // ../../node_modules/lucide-react/dist/esm/icons/cloud-upload.js
1339
- var __iconNode10 = [
1340
- ["path", { d: "M12 13v8", key: "1l5pq0" }],
1341
- ["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
1342
- ["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
1343
- ];
1344
- var CloudUpload = createLucideIcon("cloud-upload", __iconNode10);
1345
-
1346
- // ../../node_modules/lucide-react/dist/esm/icons/code-xml.js
1347
- var __iconNode11 = [
1348
- ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
1349
- ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
1350
- ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
1351
- ];
1352
- var CodeXml = createLucideIcon("code-xml", __iconNode11);
1353
-
1354
- // ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
1355
- var __iconNode12 = [
1356
- ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
1357
- ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
1358
- ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
1359
- ];
1360
- var Ellipsis = createLucideIcon("ellipsis", __iconNode12);
1361
-
1362
- // ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
1363
- var __iconNode13 = [
1364
- [
1365
- "path",
1366
- {
1367
- d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
1368
- key: "ct8e1f"
1369
- }
1370
- ],
1371
- ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
1372
- [
1373
- "path",
1374
- {
1375
- d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
1376
- key: "13bj9a"
1377
- }
1378
- ],
1379
- ["path", { d: "m2 2 20 20", key: "1ooewy" }]
1380
- ];
1381
- var EyeOff = createLucideIcon("eye-off", __iconNode13);
1382
-
1383
- // ../../node_modules/lucide-react/dist/esm/icons/eye.js
1384
- var __iconNode14 = [
1385
- [
1386
- "path",
1387
- {
1388
- d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
1389
- key: "1nclc0"
1390
- }
1391
- ],
1392
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
1393
- ];
1394
- var Eye = createLucideIcon("eye", __iconNode14);
1395
-
1396
- // ../../node_modules/lucide-react/dist/esm/icons/file.js
1397
- var __iconNode15 = [
1398
- [
1399
- "path",
1400
- {
1401
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
1402
- key: "1oefj6"
1403
- }
1404
- ],
1405
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
1406
- ];
1407
- var File2 = createLucideIcon("file", __iconNode15);
1408
-
1409
- // ../../node_modules/lucide-react/dist/esm/icons/folder-open.js
1410
- var __iconNode16 = [
1411
- [
1412
- "path",
1413
- {
1414
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
1415
- key: "usdka0"
1048
+ var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
1049
+ var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
1050
+ var fractionRegex = /^\d+\/\d+$/;
1051
+ var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
1052
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
1053
+ var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
1054
+ var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
1055
+ var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
1056
+ var isFraction = (value) => fractionRegex.test(value);
1057
+ var isNumber = (value) => !!value && !Number.isNaN(Number(value));
1058
+ var isInteger = (value) => !!value && Number.isInteger(Number(value));
1059
+ var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
1060
+ var isTshirtSize = (value) => tshirtUnitRegex.test(value);
1061
+ var isAny = () => true;
1062
+ var isLengthOnly = (value) => (
1063
+ // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
1064
+ // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
1065
+ // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
1066
+ lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
1067
+ );
1068
+ var isNever = () => false;
1069
+ var isShadow = (value) => shadowRegex.test(value);
1070
+ var isImage = (value) => imageRegex.test(value);
1071
+ var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
1072
+ var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
1073
+ var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
1074
+ var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
1075
+ var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
1076
+ var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
1077
+ var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
1078
+ var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
1079
+ var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
1080
+ var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
1081
+ var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
1082
+ var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
1083
+ var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
1084
+ var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
1085
+ var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
1086
+ var getIsArbitraryValue = (value, testLabel, testValue) => {
1087
+ const result = arbitraryValueRegex.exec(value);
1088
+ if (result) {
1089
+ if (result[1]) {
1090
+ return testLabel(result[1]);
1416
1091
  }
1417
- ]
1418
- ];
1419
- var FolderOpen = createLucideIcon("folder-open", __iconNode16);
1420
-
1421
- // ../../node_modules/lucide-react/dist/esm/icons/folder-up.js
1422
- var __iconNode17 = [
1423
- [
1424
- "path",
1425
- {
1426
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
1427
- key: "1kt360"
1428
- }
1429
- ],
1430
- ["path", { d: "M12 10v6", key: "1bos4e" }],
1431
- ["path", { d: "m9 13 3-3 3 3", key: "1pxg3c" }]
1432
- ];
1433
- var FolderUp = createLucideIcon("folder-up", __iconNode17);
1434
-
1435
- // ../../node_modules/lucide-react/dist/esm/icons/folder.js
1436
- var __iconNode18 = [
1437
- [
1438
- "path",
1439
- {
1440
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
1441
- key: "1kt360"
1442
- }
1443
- ]
1444
- ];
1445
- var Folder = createLucideIcon("folder", __iconNode18);
1446
-
1447
- // ../../node_modules/lucide-react/dist/esm/icons/funnel.js
1448
- var __iconNode19 = [
1449
- [
1450
- "path",
1451
- {
1452
- d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
1453
- key: "sc7q7i"
1454
- }
1455
- ]
1456
- ];
1457
- var Funnel = createLucideIcon("funnel", __iconNode19);
1458
-
1459
- // ../../node_modules/lucide-react/dist/esm/icons/globe.js
1460
- var __iconNode20 = [
1461
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1462
- ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
1463
- ["path", { d: "M2 12h20", key: "9i4pu4" }]
1464
- ];
1465
- var Globe = createLucideIcon("globe", __iconNode20);
1466
-
1467
- // ../../node_modules/lucide-react/dist/esm/icons/loader-circle.js
1468
- var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1469
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
1470
-
1471
- // ../../node_modules/lucide-react/dist/esm/icons/map-pin.js
1472
- var __iconNode22 = [
1473
- [
1474
- "path",
1475
- {
1476
- d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
1477
- key: "1r0f0z"
1478
- }
1479
- ],
1480
- ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
1481
- ];
1482
- var MapPin = createLucideIcon("map-pin", __iconNode22);
1483
-
1484
- // ../../node_modules/lucide-react/dist/esm/icons/minus.js
1485
- var __iconNode23 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
1486
- var Minus = createLucideIcon("minus", __iconNode23);
1487
-
1488
- // ../../node_modules/lucide-react/dist/esm/icons/palette.js
1489
- var __iconNode24 = [
1490
- [
1491
- "path",
1492
- {
1493
- d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
1494
- key: "e79jfc"
1495
- }
1496
- ],
1497
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
1498
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
1499
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
1500
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
1501
- ];
1502
- var Palette = createLucideIcon("palette", __iconNode24);
1503
-
1504
- // ../../node_modules/lucide-react/dist/esm/icons/pen-line.js
1505
- var __iconNode25 = [
1506
- ["path", { d: "M13 21h8", key: "1jsn5i" }],
1507
- [
1508
- "path",
1509
- {
1510
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
1511
- key: "1a8usu"
1512
- }
1513
- ]
1514
- ];
1515
- var PenLine = createLucideIcon("pen-line", __iconNode25);
1516
-
1517
- // ../../node_modules/lucide-react/dist/esm/icons/plus.js
1518
- var __iconNode26 = [
1519
- ["path", { d: "M5 12h14", key: "1ays0h" }],
1520
- ["path", { d: "M12 5v14", key: "s699le" }]
1521
- ];
1522
- var Plus = createLucideIcon("plus", __iconNode26);
1523
-
1524
- // ../../node_modules/lucide-react/dist/esm/icons/search.js
1525
- var __iconNode27 = [
1526
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
1527
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
1528
- ];
1529
- var Search = createLucideIcon("search", __iconNode27);
1530
-
1531
- // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
1532
- var __iconNode28 = [
1533
- ["path", { d: "M10 5H3", key: "1qgfaw" }],
1534
- ["path", { d: "M12 19H3", key: "yhmn1j" }],
1535
- ["path", { d: "M14 3v4", key: "1sua03" }],
1536
- ["path", { d: "M16 17v4", key: "1q0r14" }],
1537
- ["path", { d: "M21 12h-9", key: "1o4lsq" }],
1538
- ["path", { d: "M21 19h-5", key: "1rlt1p" }],
1539
- ["path", { d: "M21 5h-7", key: "1oszz2" }],
1540
- ["path", { d: "M8 10v4", key: "tgpxqk" }],
1541
- ["path", { d: "M8 12H3", key: "a7s4jb" }]
1542
- ];
1543
- var SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode28);
1544
-
1545
- // ../../node_modules/lucide-react/dist/esm/icons/square-split-vertical.js
1546
- var __iconNode29 = [
1547
- ["path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3", key: "1pi83i" }],
1548
- ["path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3", key: "ido5k7" }],
1549
- ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
1550
- ];
1551
- var SquareSplitVertical = createLucideIcon("square-split-vertical", __iconNode29);
1552
-
1553
- // ../../node_modules/lucide-react/dist/esm/icons/tag.js
1554
- var __iconNode30 = [
1555
- [
1556
- "path",
1557
- {
1558
- d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
1559
- key: "vktsd0"
1560
- }
1561
- ],
1562
- ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
1563
- ];
1564
- var Tag = createLucideIcon("tag", __iconNode30);
1565
-
1566
- // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
1567
- var __iconNode31 = [
1568
- ["path", { d: "M10 11v6", key: "nco0om" }],
1569
- ["path", { d: "M14 11v6", key: "outv1u" }],
1570
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
1571
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
1572
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
1573
- ];
1574
- var Trash2 = createLucideIcon("trash-2", __iconNode31);
1575
-
1576
- // ../../node_modules/lucide-react/dist/esm/icons/upload.js
1577
- var __iconNode32 = [
1578
- ["path", { d: "M12 3v12", key: "1x0j5s" }],
1579
- ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
1580
- ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
1581
- ];
1582
- var Upload = createLucideIcon("upload", __iconNode32);
1583
-
1584
- // ../../node_modules/lucide-react/dist/esm/icons/x.js
1585
- var __iconNode33 = [
1586
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1587
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1588
- ];
1589
- var X = createLucideIcon("x", __iconNode33);
1590
-
1591
- // ../../node_modules/clsx/dist/clsx.mjs
1592
- function r(e4) {
1593
- var t4, f2, n3 = "";
1594
- if ("string" == typeof e4 || "number" == typeof e4) n3 += e4;
1595
- else if ("object" == typeof e4) if (Array.isArray(e4)) {
1596
- var o3 = e4.length;
1597
- for (t4 = 0; t4 < o3; t4++) e4[t4] && (f2 = r(e4[t4])) && (n3 && (n3 += " "), n3 += f2);
1598
- } else for (f2 in e4) e4[f2] && (n3 && (n3 += " "), n3 += f2);
1599
- return n3;
1600
- }
1601
- function clsx() {
1602
- for (var e4, t4, f2 = 0, n3 = "", o3 = arguments.length; f2 < o3; f2++) (e4 = arguments[f2]) && (t4 = r(e4)) && (n3 && (n3 += " "), n3 += t4);
1603
- return n3;
1604
- }
1605
-
1606
- // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
1607
- var concatArrays = (array1, array2) => {
1608
- const combinedArray = new Array(array1.length + array2.length);
1609
- for (let i3 = 0; i3 < array1.length; i3++) {
1610
- combinedArray[i3] = array1[i3];
1611
- }
1612
- for (let i3 = 0; i3 < array2.length; i3++) {
1613
- combinedArray[array1.length + i3] = array2[i3];
1614
- }
1615
- return combinedArray;
1616
- };
1617
- var createClassValidatorObject = (classGroupId, validator) => ({
1618
- classGroupId,
1619
- validator
1620
- });
1621
- var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
1622
- nextPart,
1623
- validators,
1624
- classGroupId
1625
- });
1626
- var CLASS_PART_SEPARATOR = "-";
1627
- var EMPTY_CONFLICTS = [];
1628
- var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
1629
- var createClassGroupUtils = (config) => {
1630
- const classMap = createClassMap(config);
1631
- const {
1632
- conflictingClassGroups,
1633
- conflictingClassGroupModifiers
1634
- } = config;
1635
- const getClassGroupId = (className) => {
1636
- if (className.startsWith("[") && className.endsWith("]")) {
1637
- return getGroupIdForArbitraryProperty(className);
1638
- }
1639
- const classParts = className.split(CLASS_PART_SEPARATOR);
1640
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
1641
- return getGroupRecursive(classParts, startIndex, classMap);
1642
- };
1643
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
1644
- if (hasPostfixModifier) {
1645
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
1646
- const baseConflicts = conflictingClassGroups[classGroupId];
1647
- if (modifierConflicts) {
1648
- if (baseConflicts) {
1649
- return concatArrays(baseConflicts, modifierConflicts);
1650
- }
1651
- return modifierConflicts;
1652
- }
1653
- return baseConflicts || EMPTY_CONFLICTS;
1654
- }
1655
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
1656
- };
1657
- return {
1658
- getClassGroupId,
1659
- getConflictingClassGroupIds
1660
- };
1661
- };
1662
- var getGroupRecursive = (classParts, startIndex, classPartObject) => {
1663
- const classPathsLength = classParts.length - startIndex;
1664
- if (classPathsLength === 0) {
1665
- return classPartObject.classGroupId;
1666
- }
1667
- const currentClassPart = classParts[startIndex];
1668
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1669
- if (nextClassPartObject) {
1670
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
1671
- if (result) return result;
1672
- }
1673
- const validators = classPartObject.validators;
1674
- if (validators === null) {
1675
- return void 0;
1676
- }
1677
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
1678
- const validatorsLength = validators.length;
1679
- for (let i3 = 0; i3 < validatorsLength; i3++) {
1680
- const validatorObj = validators[i3];
1681
- if (validatorObj.validator(classRest)) {
1682
- return validatorObj.classGroupId;
1092
+ return testValue(result[2]);
1093
+ }
1094
+ return false;
1095
+ };
1096
+ var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
1097
+ const result = arbitraryVariableRegex.exec(value);
1098
+ if (result) {
1099
+ if (result[1]) {
1100
+ return testLabel(result[1]);
1683
1101
  }
1102
+ return shouldMatchNoLabel;
1684
1103
  }
1685
- return void 0;
1104
+ return false;
1686
1105
  };
1687
- var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
1688
- const content = className.slice(1, -1);
1689
- const colonIndex = content.indexOf(":");
1690
- const property = content.slice(0, colonIndex);
1691
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
1692
- })();
1693
- var createClassMap = (config) => {
1694
- const {
1695
- theme,
1696
- classGroups
1697
- } = config;
1698
- return processClassGroups(classGroups, theme);
1699
- };
1700
- var processClassGroups = (classGroups, theme) => {
1701
- const classMap = createClassPartObject();
1702
- for (const classGroupId in classGroups) {
1703
- const group = classGroups[classGroupId];
1704
- processClassesRecursively(group, classMap, classGroupId, theme);
1705
- }
1706
- return classMap;
1707
- };
1708
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
1709
- const len = classGroup.length;
1710
- for (let i3 = 0; i3 < len; i3++) {
1711
- const classDefinition = classGroup[i3];
1712
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
1713
- }
1714
- };
1715
- var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1716
- if (typeof classDefinition === "string") {
1717
- processStringDefinition(classDefinition, classPartObject, classGroupId);
1718
- return;
1719
- }
1720
- if (typeof classDefinition === "function") {
1721
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
1722
- return;
1723
- }
1724
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
1725
- };
1726
- var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
1727
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
1728
- classPartObjectToEdit.classGroupId = classGroupId;
1729
- };
1730
- var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1731
- if (isThemeGetter(classDefinition)) {
1732
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
1733
- return;
1734
- }
1735
- if (classPartObject.validators === null) {
1736
- classPartObject.validators = [];
1737
- }
1738
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
1739
- };
1740
- var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1741
- const entries = Object.entries(classDefinition);
1742
- const len = entries.length;
1743
- for (let i3 = 0; i3 < len; i3++) {
1744
- const [key, value] = entries[i3];
1745
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
1746
- }
1747
- };
1748
- var getPart = (classPartObject, path) => {
1749
- let current = classPartObject;
1750
- const parts = path.split(CLASS_PART_SEPARATOR);
1751
- const len = parts.length;
1752
- for (let i3 = 0; i3 < len; i3++) {
1753
- const part = parts[i3];
1754
- let next = current.nextPart.get(part);
1755
- if (!next) {
1756
- next = createClassPartObject();
1757
- current.nextPart.set(part, next);
1758
- }
1759
- current = next;
1760
- }
1761
- return current;
1762
- };
1763
- var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
1764
- var createLruCache = (maxCacheSize) => {
1765
- if (maxCacheSize < 1) {
1766
- return {
1767
- get: () => void 0,
1768
- set: () => {
1769
- }
1770
- };
1771
- }
1772
- let cacheSize = 0;
1773
- let cache = /* @__PURE__ */ Object.create(null);
1774
- let previousCache = /* @__PURE__ */ Object.create(null);
1775
- const update = (key, value) => {
1776
- cache[key] = value;
1777
- cacheSize++;
1778
- if (cacheSize > maxCacheSize) {
1779
- cacheSize = 0;
1780
- previousCache = cache;
1781
- cache = /* @__PURE__ */ Object.create(null);
1782
- }
1783
- };
1106
+ var isLabelPosition = (label) => label === "position" || label === "percentage";
1107
+ var isLabelImage = (label) => label === "image" || label === "url";
1108
+ var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
1109
+ var isLabelLength = (label) => label === "length";
1110
+ var isLabelNumber = (label) => label === "number";
1111
+ var isLabelFamilyName = (label) => label === "family-name";
1112
+ var isLabelShadow = (label) => label === "shadow";
1113
+ var getDefaultConfig = () => {
1114
+ const themeColor = fromTheme("color");
1115
+ const themeFont = fromTheme("font");
1116
+ const themeText = fromTheme("text");
1117
+ const themeFontWeight = fromTheme("font-weight");
1118
+ const themeTracking = fromTheme("tracking");
1119
+ const themeLeading = fromTheme("leading");
1120
+ const themeBreakpoint = fromTheme("breakpoint");
1121
+ const themeContainer = fromTheme("container");
1122
+ const themeSpacing = fromTheme("spacing");
1123
+ const themeRadius = fromTheme("radius");
1124
+ const themeShadow = fromTheme("shadow");
1125
+ const themeInsetShadow = fromTheme("inset-shadow");
1126
+ const themeTextShadow = fromTheme("text-shadow");
1127
+ const themeDropShadow = fromTheme("drop-shadow");
1128
+ const themeBlur = fromTheme("blur");
1129
+ const themePerspective = fromTheme("perspective");
1130
+ const themeAspect = fromTheme("aspect");
1131
+ const themeEase = fromTheme("ease");
1132
+ const themeAnimate = fromTheme("animate");
1133
+ const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
1134
+ const scalePosition = () => [
1135
+ "center",
1136
+ "top",
1137
+ "bottom",
1138
+ "left",
1139
+ "right",
1140
+ "top-left",
1141
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1142
+ "left-top",
1143
+ "top-right",
1144
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1145
+ "right-top",
1146
+ "bottom-right",
1147
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1148
+ "right-bottom",
1149
+ "bottom-left",
1150
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1151
+ "left-bottom"
1152
+ ];
1153
+ const scalePositionWithArbitrary = () => [...scalePosition(), isArbitraryVariable, isArbitraryValue];
1154
+ const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
1155
+ const scaleOverscroll = () => ["auto", "contain", "none"];
1156
+ const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
1157
+ const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
1158
+ const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
1159
+ const scaleGridColRowStartAndEnd = () => ["auto", {
1160
+ span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
1161
+ }, isInteger, isArbitraryVariable, isArbitraryValue];
1162
+ const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
1163
+ const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
1164
+ const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"];
1165
+ const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
1166
+ const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
1167
+ const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
1168
+ const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
1169
+ const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
1170
+ position: [isArbitraryVariable, isArbitraryValue]
1171
+ }];
1172
+ const scaleBgRepeat = () => ["no-repeat", {
1173
+ repeat: ["", "x", "y", "space", "round"]
1174
+ }];
1175
+ const scaleBgSize = () => ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize, {
1176
+ size: [isArbitraryVariable, isArbitraryValue]
1177
+ }];
1178
+ const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
1179
+ const scaleRadius = () => [
1180
+ // Deprecated since Tailwind CSS v4.0.0
1181
+ "",
1182
+ "none",
1183
+ "full",
1184
+ themeRadius,
1185
+ isArbitraryVariable,
1186
+ isArbitraryValue
1187
+ ];
1188
+ const scaleBorderWidth = () => ["", isNumber, isArbitraryVariableLength, isArbitraryLength];
1189
+ const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
1190
+ const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
1191
+ const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
1192
+ const scaleBlur = () => [
1193
+ // Deprecated since Tailwind CSS v4.0.0
1194
+ "",
1195
+ "none",
1196
+ themeBlur,
1197
+ isArbitraryVariable,
1198
+ isArbitraryValue
1199
+ ];
1200
+ const scaleRotate = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
1201
+ const scaleScale = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
1202
+ const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
1203
+ const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
1784
1204
  return {
1785
- get(key) {
1786
- let value = cache[key];
1787
- if (value !== void 0) {
1788
- return value;
1789
- }
1790
- if ((value = previousCache[key]) !== void 0) {
1791
- update(key, value);
1792
- return value;
1793
- }
1205
+ cacheSize: 500,
1206
+ theme: {
1207
+ animate: ["spin", "ping", "pulse", "bounce"],
1208
+ aspect: ["video"],
1209
+ blur: [isTshirtSize],
1210
+ breakpoint: [isTshirtSize],
1211
+ color: [isAny],
1212
+ container: [isTshirtSize],
1213
+ "drop-shadow": [isTshirtSize],
1214
+ ease: ["in", "out", "in-out"],
1215
+ font: [isAnyNonArbitrary],
1216
+ "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
1217
+ "inset-shadow": [isTshirtSize],
1218
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
1219
+ perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
1220
+ radius: [isTshirtSize],
1221
+ shadow: [isTshirtSize],
1222
+ spacing: ["px", isNumber],
1223
+ text: [isTshirtSize],
1224
+ "text-shadow": [isTshirtSize],
1225
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
1794
1226
  },
1795
- set(key, value) {
1796
- if (key in cache) {
1797
- cache[key] = value;
1798
- } else {
1799
- update(key, value);
1800
- }
1801
- }
1802
- };
1803
- };
1804
- var IMPORTANT_MODIFIER = "!";
1805
- var MODIFIER_SEPARATOR = ":";
1806
- var EMPTY_MODIFIERS = [];
1807
- var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
1808
- modifiers,
1809
- hasImportantModifier,
1810
- baseClassName,
1811
- maybePostfixModifierPosition,
1812
- isExternal
1813
- });
1814
- var createParseClassName = (config) => {
1815
- const {
1816
- prefix,
1817
- experimentalParseClassName
1818
- } = config;
1819
- let parseClassName = (className) => {
1820
- const modifiers = [];
1821
- let bracketDepth = 0;
1822
- let parenDepth = 0;
1823
- let modifierStart = 0;
1824
- let postfixModifierPosition;
1825
- const len = className.length;
1826
- for (let index = 0; index < len; index++) {
1827
- const currentCharacter = className[index];
1828
- if (bracketDepth === 0 && parenDepth === 0) {
1829
- if (currentCharacter === MODIFIER_SEPARATOR) {
1830
- modifiers.push(className.slice(modifierStart, index));
1831
- modifierStart = index + 1;
1832
- continue;
1833
- }
1834
- if (currentCharacter === "/") {
1835
- postfixModifierPosition = index;
1836
- continue;
1837
- }
1838
- }
1839
- if (currentCharacter === "[") bracketDepth++;
1840
- else if (currentCharacter === "]") bracketDepth--;
1841
- else if (currentCharacter === "(") parenDepth++;
1842
- else if (currentCharacter === ")") parenDepth--;
1843
- }
1844
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
1845
- let baseClassName = baseClassNameWithImportantModifier;
1846
- let hasImportantModifier = false;
1847
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
1848
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
1849
- hasImportantModifier = true;
1850
- } else if (
1227
+ classGroups: {
1228
+ // --------------
1229
+ // --- Layout ---
1230
+ // --------------
1851
1231
  /**
1852
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
1853
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
1854
- */
1855
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
1856
- ) {
1857
- baseClassName = baseClassNameWithImportantModifier.slice(1);
1858
- hasImportantModifier = true;
1859
- }
1860
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
1861
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
1862
- };
1863
- if (prefix) {
1864
- const fullPrefix = prefix + MODIFIER_SEPARATOR;
1865
- const parseClassNameOriginal = parseClassName;
1866
- parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
1867
- }
1868
- if (experimentalParseClassName) {
1869
- const parseClassNameOriginal = parseClassName;
1870
- parseClassName = (className) => experimentalParseClassName({
1871
- className,
1872
- parseClassName: parseClassNameOriginal
1873
- });
1874
- }
1875
- return parseClassName;
1876
- };
1877
- var createSortModifiers = (config) => {
1878
- const modifierWeights = /* @__PURE__ */ new Map();
1879
- config.orderSensitiveModifiers.forEach((mod, index) => {
1880
- modifierWeights.set(mod, 1e6 + index);
1881
- });
1882
- return (modifiers) => {
1883
- const result = [];
1884
- let currentSegment = [];
1885
- for (let i3 = 0; i3 < modifiers.length; i3++) {
1886
- const modifier = modifiers[i3];
1887
- const isArbitrary = modifier[0] === "[";
1888
- const isOrderSensitive = modifierWeights.has(modifier);
1889
- if (isArbitrary || isOrderSensitive) {
1890
- if (currentSegment.length > 0) {
1891
- currentSegment.sort();
1892
- result.push(...currentSegment);
1893
- currentSegment = [];
1894
- }
1895
- result.push(modifier);
1896
- } else {
1897
- currentSegment.push(modifier);
1898
- }
1899
- }
1900
- if (currentSegment.length > 0) {
1901
- currentSegment.sort();
1902
- result.push(...currentSegment);
1903
- }
1904
- return result;
1905
- };
1906
- };
1907
- var createConfigUtils = (config) => ({
1908
- cache: createLruCache(config.cacheSize),
1909
- parseClassName: createParseClassName(config),
1910
- sortModifiers: createSortModifiers(config),
1911
- ...createClassGroupUtils(config)
1912
- });
1913
- var SPLIT_CLASSES_REGEX = /\s+/;
1914
- var mergeClassList = (classList, configUtils) => {
1915
- const {
1916
- parseClassName,
1917
- getClassGroupId,
1918
- getConflictingClassGroupIds,
1919
- sortModifiers
1920
- } = configUtils;
1921
- const classGroupsInConflict = [];
1922
- const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
1923
- let result = "";
1924
- for (let index = classNames.length - 1; index >= 0; index -= 1) {
1925
- const originalClassName = classNames[index];
1926
- const {
1927
- isExternal,
1928
- modifiers,
1929
- hasImportantModifier,
1930
- baseClassName,
1931
- maybePostfixModifierPosition
1932
- } = parseClassName(originalClassName);
1933
- if (isExternal) {
1934
- result = originalClassName + (result.length > 0 ? " " + result : result);
1935
- continue;
1936
- }
1937
- let hasPostfixModifier = !!maybePostfixModifierPosition;
1938
- let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
1939
- if (!classGroupId) {
1940
- if (!hasPostfixModifier) {
1941
- result = originalClassName + (result.length > 0 ? " " + result : result);
1942
- continue;
1943
- }
1944
- classGroupId = getClassGroupId(baseClassName);
1945
- if (!classGroupId) {
1946
- result = originalClassName + (result.length > 0 ? " " + result : result);
1947
- continue;
1948
- }
1949
- hasPostfixModifier = false;
1950
- }
1951
- const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
1952
- const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
1953
- const classId = modifierId + classGroupId;
1954
- if (classGroupsInConflict.indexOf(classId) > -1) {
1955
- continue;
1956
- }
1957
- classGroupsInConflict.push(classId);
1958
- const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
1959
- for (let i3 = 0; i3 < conflictGroups.length; ++i3) {
1960
- const group = conflictGroups[i3];
1961
- classGroupsInConflict.push(modifierId + group);
1962
- }
1963
- result = originalClassName + (result.length > 0 ? " " + result : result);
1964
- }
1965
- return result;
1966
- };
1967
- var twJoin = (...classLists) => {
1968
- let index = 0;
1969
- let argument;
1970
- let resolvedValue;
1971
- let string = "";
1972
- while (index < classLists.length) {
1973
- if (argument = classLists[index++]) {
1974
- if (resolvedValue = toValue(argument)) {
1975
- string && (string += " ");
1976
- string += resolvedValue;
1977
- }
1978
- }
1979
- }
1980
- return string;
1981
- };
1982
- var toValue = (mix) => {
1983
- if (typeof mix === "string") {
1984
- return mix;
1985
- }
1986
- let resolvedValue;
1987
- let string = "";
1988
- for (let k2 = 0; k2 < mix.length; k2++) {
1989
- if (mix[k2]) {
1990
- if (resolvedValue = toValue(mix[k2])) {
1991
- string && (string += " ");
1992
- string += resolvedValue;
1993
- }
1994
- }
1995
- }
1996
- return string;
1997
- };
1998
- var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
1999
- let configUtils;
2000
- let cacheGet;
2001
- let cacheSet;
2002
- let functionToCall;
2003
- const initTailwindMerge = (classList) => {
2004
- const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
2005
- configUtils = createConfigUtils(config);
2006
- cacheGet = configUtils.cache.get;
2007
- cacheSet = configUtils.cache.set;
2008
- functionToCall = tailwindMerge;
2009
- return tailwindMerge(classList);
2010
- };
2011
- const tailwindMerge = (classList) => {
2012
- const cachedResult = cacheGet(classList);
2013
- if (cachedResult) {
2014
- return cachedResult;
2015
- }
2016
- const result = mergeClassList(classList, configUtils);
2017
- cacheSet(classList, result);
2018
- return result;
2019
- };
2020
- functionToCall = initTailwindMerge;
2021
- return (...args) => functionToCall(twJoin(...args));
2022
- };
2023
- var fallbackThemeArr = [];
2024
- var fromTheme = (key) => {
2025
- const themeGetter = (theme) => theme[key] || fallbackThemeArr;
2026
- themeGetter.isThemeGetter = true;
2027
- return themeGetter;
2028
- };
2029
- var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
2030
- var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
2031
- var fractionRegex = /^\d+\/\d+$/;
2032
- var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
2033
- var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
2034
- var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
2035
- var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
2036
- var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
2037
- var isFraction = (value) => fractionRegex.test(value);
2038
- var isNumber = (value) => !!value && !Number.isNaN(Number(value));
2039
- var isInteger = (value) => !!value && Number.isInteger(Number(value));
2040
- var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
2041
- var isTshirtSize = (value) => tshirtUnitRegex.test(value);
2042
- var isAny = () => true;
2043
- var isLengthOnly = (value) => (
2044
- // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
2045
- // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
2046
- // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
2047
- lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
2048
- );
2049
- var isNever = () => false;
2050
- var isShadow = (value) => shadowRegex.test(value);
2051
- var isImage = (value) => imageRegex.test(value);
2052
- var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
2053
- var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
2054
- var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
2055
- var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
2056
- var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
2057
- var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
2058
- var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
2059
- var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
2060
- var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
2061
- var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
2062
- var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
2063
- var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
2064
- var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
2065
- var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
2066
- var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
2067
- var getIsArbitraryValue = (value, testLabel, testValue) => {
2068
- const result = arbitraryValueRegex.exec(value);
2069
- if (result) {
2070
- if (result[1]) {
2071
- return testLabel(result[1]);
2072
- }
2073
- return testValue(result[2]);
2074
- }
2075
- return false;
2076
- };
2077
- var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
2078
- const result = arbitraryVariableRegex.exec(value);
2079
- if (result) {
2080
- if (result[1]) {
2081
- return testLabel(result[1]);
2082
- }
2083
- return shouldMatchNoLabel;
2084
- }
2085
- return false;
2086
- };
2087
- var isLabelPosition = (label) => label === "position" || label === "percentage";
2088
- var isLabelImage = (label) => label === "image" || label === "url";
2089
- var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
2090
- var isLabelLength = (label) => label === "length";
2091
- var isLabelNumber = (label) => label === "number";
2092
- var isLabelFamilyName = (label) => label === "family-name";
2093
- var isLabelShadow = (label) => label === "shadow";
2094
- var getDefaultConfig = () => {
2095
- const themeColor = fromTheme("color");
2096
- const themeFont = fromTheme("font");
2097
- const themeText = fromTheme("text");
2098
- const themeFontWeight = fromTheme("font-weight");
2099
- const themeTracking = fromTheme("tracking");
2100
- const themeLeading = fromTheme("leading");
2101
- const themeBreakpoint = fromTheme("breakpoint");
2102
- const themeContainer = fromTheme("container");
2103
- const themeSpacing = fromTheme("spacing");
2104
- const themeRadius = fromTheme("radius");
2105
- const themeShadow = fromTheme("shadow");
2106
- const themeInsetShadow = fromTheme("inset-shadow");
2107
- const themeTextShadow = fromTheme("text-shadow");
2108
- const themeDropShadow = fromTheme("drop-shadow");
2109
- const themeBlur = fromTheme("blur");
2110
- const themePerspective = fromTheme("perspective");
2111
- const themeAspect = fromTheme("aspect");
2112
- const themeEase = fromTheme("ease");
2113
- const themeAnimate = fromTheme("animate");
2114
- const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
2115
- const scalePosition = () => [
2116
- "center",
2117
- "top",
2118
- "bottom",
2119
- "left",
2120
- "right",
2121
- "top-left",
2122
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2123
- "left-top",
2124
- "top-right",
2125
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2126
- "right-top",
2127
- "bottom-right",
2128
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2129
- "right-bottom",
2130
- "bottom-left",
2131
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2132
- "left-bottom"
2133
- ];
2134
- const scalePositionWithArbitrary = () => [...scalePosition(), isArbitraryVariable, isArbitraryValue];
2135
- const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
2136
- const scaleOverscroll = () => ["auto", "contain", "none"];
2137
- const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
2138
- const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
2139
- const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
2140
- const scaleGridColRowStartAndEnd = () => ["auto", {
2141
- span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
2142
- }, isInteger, isArbitraryVariable, isArbitraryValue];
2143
- const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
2144
- const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
2145
- const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"];
2146
- const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
2147
- const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
2148
- const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
2149
- const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
2150
- const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
2151
- position: [isArbitraryVariable, isArbitraryValue]
2152
- }];
2153
- const scaleBgRepeat = () => ["no-repeat", {
2154
- repeat: ["", "x", "y", "space", "round"]
2155
- }];
2156
- const scaleBgSize = () => ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize, {
2157
- size: [isArbitraryVariable, isArbitraryValue]
2158
- }];
2159
- const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
2160
- const scaleRadius = () => [
2161
- // Deprecated since Tailwind CSS v4.0.0
2162
- "",
2163
- "none",
2164
- "full",
2165
- themeRadius,
2166
- isArbitraryVariable,
2167
- isArbitraryValue
2168
- ];
2169
- const scaleBorderWidth = () => ["", isNumber, isArbitraryVariableLength, isArbitraryLength];
2170
- const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
2171
- const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
2172
- const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
2173
- const scaleBlur = () => [
2174
- // Deprecated since Tailwind CSS v4.0.0
2175
- "",
2176
- "none",
2177
- themeBlur,
2178
- isArbitraryVariable,
2179
- isArbitraryValue
2180
- ];
2181
- const scaleRotate = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
2182
- const scaleScale = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
2183
- const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
2184
- const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
2185
- return {
2186
- cacheSize: 500,
2187
- theme: {
2188
- animate: ["spin", "ping", "pulse", "bounce"],
2189
- aspect: ["video"],
2190
- blur: [isTshirtSize],
2191
- breakpoint: [isTshirtSize],
2192
- color: [isAny],
2193
- container: [isTshirtSize],
2194
- "drop-shadow": [isTshirtSize],
2195
- ease: ["in", "out", "in-out"],
2196
- font: [isAnyNonArbitrary],
2197
- "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
2198
- "inset-shadow": [isTshirtSize],
2199
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
2200
- perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
2201
- radius: [isTshirtSize],
2202
- shadow: [isTshirtSize],
2203
- spacing: ["px", isNumber],
2204
- text: [isTshirtSize],
2205
- "text-shadow": [isTshirtSize],
2206
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
2207
- },
2208
- classGroups: {
2209
- // --------------
2210
- // --- Layout ---
2211
- // --------------
2212
- /**
2213
- * Aspect Ratio
2214
- * @see https://tailwindcss.com/docs/aspect-ratio
1232
+ * Aspect Ratio
1233
+ * @see https://tailwindcss.com/docs/aspect-ratio
2215
1234
  */
2216
1235
  aspect: [{
2217
1236
  aspect: ["auto", "square", isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
@@ -4604,18 +3623,1032 @@ var getDefaultConfig = () => {
4604
3623
  "touch-y": ["touch"],
4605
3624
  "touch-pz": ["touch"]
4606
3625
  },
4607
- conflictingClassGroupModifiers: {
4608
- "font-size": ["leading"]
3626
+ conflictingClassGroupModifiers: {
3627
+ "font-size": ["leading"]
3628
+ },
3629
+ orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
3630
+ };
3631
+ };
3632
+ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3633
+
3634
+ // src/lib/utils.ts
3635
+ function cn(...inputs) {
3636
+ return twMerge(clsx(inputs));
3637
+ }
3638
+ function toArray(v2) {
3639
+ if (v2 == null) return [];
3640
+ return Array.isArray(v2) ? v2 : [v2];
3641
+ }
3642
+ var CORE_PROP_KEYS = /* @__PURE__ */ new Set([
3643
+ "adapter",
3644
+ "schema",
3645
+ "exceptions",
3646
+ "persist",
3647
+ "name",
3648
+ "activateButtonOnChange",
3649
+ "onChange",
3650
+ "onUpdate",
3651
+ "changeBefore",
3652
+ "formRef",
3653
+ "valueBag",
3654
+ "valueFeed",
3655
+ "onFinish",
3656
+ "init",
3657
+ "onSubmit",
3658
+ "onSubmitted",
3659
+ "children"
3660
+ ]);
3661
+ function isPlainObject(value) {
3662
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3663
+ }
3664
+ function deepEqual(a3, b2) {
3665
+ if (a3 === b2) return true;
3666
+ if (typeof a3 === "number" && typeof b2 === "number") {
3667
+ if (Number.isNaN(a3) && Number.isNaN(b2)) return true;
3668
+ }
3669
+ if (Array.isArray(a3) && Array.isArray(b2)) {
3670
+ if (a3.length !== b2.length) return false;
3671
+ for (let i3 = 0; i3 < a3.length; i3++) {
3672
+ if (!deepEqual(a3[i3], b2[i3])) return false;
3673
+ }
3674
+ return true;
3675
+ }
3676
+ if (isPlainObject(a3) && isPlainObject(b2)) {
3677
+ const aKeys = Object.keys(a3);
3678
+ const bKeys = Object.keys(b2);
3679
+ if (aKeys.length !== bKeys.length) return false;
3680
+ for (const key of aKeys) {
3681
+ if (!Object.prototype.hasOwnProperty.call(b2, key)) return false;
3682
+ if (!deepEqual(a3[key], b2[key])) return false;
3683
+ }
3684
+ return true;
3685
+ }
3686
+ return false;
3687
+ }
3688
+ function CoreProvider(props) {
3689
+ var _a, _b;
3690
+ const registryRef = React68__namespace.useRef(new FieldRegistry());
3691
+ const bucketRef = React68__namespace.useRef({});
3692
+ const uncaughtRef = React68__namespace.useRef([]);
3693
+ const errorsRef = React68__namespace.useRef(null);
3694
+ const buttonRef = React68__namespace.useRef(null);
3695
+ const activeButtonNameRef = React68__namespace.useRef(null);
3696
+ const [hasUncaughtErrors, setHasUncaughtErrors] = React68__namespace.useState(0);
3697
+ const originalRef = React68__namespace.useRef(null);
3698
+ const propsRef = React68__namespace.useRef(props);
3699
+ React68__namespace.useEffect(() => {
3700
+ propsRef.current = props;
3701
+ }, [props]);
3702
+ const adapterKey = (_a = props.adapter) != null ? _a : "local";
3703
+ const schema = props.schema;
3704
+ const errorBagId = (_b = props.name) != null ? _b : void 0;
3705
+ let context;
3706
+ function fetchAllNamedFields() {
3707
+ return registryRef.current.getAllNamed();
3708
+ }
3709
+ function clearFieldErrors() {
3710
+ for (const field of fetchAllNamedFields()) {
3711
+ const anyField = field;
3712
+ if (typeof anyField.setError === "function") {
3713
+ anyField.setError(void 0);
3714
+ } else if ("error" in anyField) {
3715
+ anyField.error = void 0;
3716
+ }
3717
+ }
3718
+ }
3719
+ function findFieldForErrorKey(key) {
3720
+ if (!key) return void 0;
3721
+ return fetchAllNamedFields().find((f2) => {
3722
+ const raw = f2.name;
3723
+ if (!raw) return false;
3724
+ const trimmed = raw.trim();
3725
+ if (!trimmed) return false;
3726
+ const base = trimmed.replace(/\[]$/, "");
3727
+ if (key === base || key === trimmed) return true;
3728
+ const sharedKey = f2.shared;
3729
+ if (!sharedKey) return false;
3730
+ const sharedBase = `${sharedKey}.${base}`;
3731
+ const sharedRaw = `${sharedKey}.${trimmed}`;
3732
+ return key === sharedBase || key === sharedRaw;
3733
+ });
3734
+ }
3735
+ function setFieldError(name, message2) {
3736
+ const field = findFieldForErrorKey(name);
3737
+ if (field) {
3738
+ const anyField = field;
3739
+ if (typeof anyField.setError === "function") {
3740
+ anyField.setError(message2);
3741
+ } else {
3742
+ anyField.error = message2;
3743
+ }
3744
+ } else {
3745
+ uncaughtRef.current.push(message2);
3746
+ }
3747
+ }
3748
+ function collectValues() {
3749
+ var _a2, _b2;
3750
+ const exceptions = (_a2 = propsRef.current.exceptions) != null ? _a2 : [];
3751
+ const list = {};
3752
+ const shared = {};
3753
+ const formatFileValue = getPaletteUtil("formatFileValue");
3754
+ for (const item of fetchAllNamedFields()) {
3755
+ const rawName = item.name;
3756
+ if (!rawName) continue;
3757
+ const trimmed = rawName.trim();
3758
+ if (!trimmed) continue;
3759
+ const isArray = trimmed.endsWith("[]");
3760
+ const base = trimmed.replace(/\[]$/, "");
3761
+ const sharedKey = item.shared;
3762
+ const target = sharedKey ? (_b2 = shared[sharedKey]) != null ? _b2 : shared[sharedKey] = {} : list;
3763
+ const fullPath = sharedKey ? `${sharedKey}.${base}` : base;
3764
+ if (exceptions.includes(trimmed) || exceptions.includes(base) || exceptions.includes(fullPath)) {
3765
+ continue;
3766
+ }
3767
+ const anyField = item;
3768
+ const val = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
3769
+ const onFormat = (value) => {
3770
+ if (anyField.onSubmit) {
3771
+ return anyField.onSubmit(value);
3772
+ }
3773
+ if (formatFileValue && item.variant == "file") {
3774
+ return toArray(value).map(formatFileValue);
3775
+ }
3776
+ return value;
3777
+ };
3778
+ if (isArray) {
3779
+ const existing = target[base];
3780
+ if (Array.isArray(existing)) {
3781
+ target[base] = onFormat([...existing, val]);
3782
+ } else if (typeof existing === "undefined") {
3783
+ target[base] = onFormat([val]);
3784
+ } else {
3785
+ target[base] = onFormat([existing, val]);
3786
+ }
3787
+ } else {
3788
+ target[base] = onFormat(val);
3789
+ }
3790
+ }
3791
+ const fromFields = { ...list, ...shared };
3792
+ const merged = {
3793
+ ...bucketRef.current,
3794
+ ...fromFields
3795
+ };
3796
+ return merged;
3797
+ }
3798
+ function validateInternal(report = false) {
3799
+ let valid = true;
3800
+ if (report) {
3801
+ uncaughtRef.current = [];
3802
+ clearFieldErrors();
3803
+ }
3804
+ for (const field of fetchAllNamedFields()) {
3805
+ const anyField = field;
3806
+ if (typeof anyField.validate === "function") {
3807
+ const ok = anyField.validate(report);
3808
+ if (!ok) valid = false;
3809
+ }
3810
+ }
3811
+ if (schema) {
3812
+ try {
3813
+ schema.parse(collectValues());
3814
+ } catch (err) {
3815
+ valid = false;
3816
+ if (report && err && typeof err === "object") {
3817
+ const anyErr = err;
3818
+ if (anyErr.issues) {
3819
+ const { fieldErrors, uncaught } = mapZodError(anyErr);
3820
+ for (const [name, message2] of Object.entries(
3821
+ fieldErrors
3822
+ )) {
3823
+ setFieldError(name, message2);
3824
+ }
3825
+ if (uncaught.length) {
3826
+ uncaughtRef.current.push(...uncaught);
3827
+ }
3828
+ }
3829
+ }
3830
+ }
3831
+ }
3832
+ return valid;
3833
+ }
3834
+ function getAdapterPropsFrom(current) {
3835
+ const result = {};
3836
+ for (const key in current) {
3837
+ if (!CORE_PROP_KEYS.has(key)) {
3838
+ result[key] = current[key];
3839
+ }
3840
+ }
3841
+ return result;
3842
+ }
3843
+ async function submitWithAdapter(adapterOverride, extra, ignoreForm, autoErr = true, autoRun = true) {
3844
+ var _a2, _b2;
3845
+ const currentProps = propsRef.current;
3846
+ const btn = buttonRef.current;
3847
+ const activeName = activeButtonNameRef.current;
3848
+ const isActiveButton = !!btn && typeof btn === "object" && btn.name === activeName;
3849
+ const setButtonLoading = (loading) => {
3850
+ if (!isActiveButton) return;
3851
+ if (typeof btn.setLoading === "function") {
3852
+ btn.setLoading(loading);
3853
+ } else if ("loading" in btn) {
3854
+ btn.loading = loading;
3855
+ }
3856
+ };
3857
+ setButtonLoading(true);
3858
+ let finished = false;
3859
+ const finish = () => {
3860
+ if (finished) return;
3861
+ finished = true;
3862
+ if (uncaughtRef.current.length)
3863
+ setHasUncaughtErrors(hasUncaughtErrors + 1);
3864
+ setButtonLoading(false);
3865
+ };
3866
+ if (!ignoreForm) {
3867
+ const ok = validateInternal(true);
3868
+ if (!ok) {
3869
+ finish();
3870
+ return void 0;
3871
+ }
3872
+ }
3873
+ let submissionValues = {
3874
+ ...collectValues(),
3875
+ ...extra != null ? extra : {}
3876
+ };
3877
+ let adapterConfig = {
3878
+ ...getAdapterPropsFrom(currentProps),
3879
+ ...adapterOverride
3880
+ };
3881
+ const event = {
3882
+ preventDefault() {
3883
+ this.continue = false;
3884
+ },
3885
+ editData(cb) {
3886
+ const result = cb(submissionValues);
3887
+ if (result) {
3888
+ submissionValues = result;
3889
+ }
3890
+ },
3891
+ setConfig(arg1, arg2) {
3892
+ if (typeof arg1 === "string") {
3893
+ adapterConfig[arg1] = arg2;
3894
+ } else if (arg1 && typeof arg1 === "object") {
3895
+ adapterConfig = {
3896
+ ...adapterConfig,
3897
+ ...arg1
3898
+ };
3899
+ }
3900
+ },
3901
+ button: (_a2 = buttonRef.current) != null ? _a2 : void 0,
3902
+ get formData() {
3903
+ return submissionValues;
3904
+ },
3905
+ form: context,
3906
+ continue: true
3907
+ };
3908
+ if (currentProps.onSubmit) {
3909
+ try {
3910
+ await currentProps.onSubmit(event);
3911
+ } catch (err) {
3912
+ finish();
3913
+ throw err;
3914
+ }
3915
+ }
3916
+ if (!event.continue) {
3917
+ finish();
3918
+ return void 0;
3919
+ }
3920
+ const factory = (_b2 = getAdapter(adapterKey)) != null ? _b2 : localAdapter;
3921
+ const adapter = factory({
3922
+ // adapter-specific config (url, method, config, etc.)
3923
+ ...adapterConfig,
3924
+ // core config
3925
+ data: submissionValues,
3926
+ errorBag: errorBagId,
3927
+ callbacks: {
3928
+ onSuccess(ok) {
3929
+ const maybe = propsRef.current.onSubmitted;
3930
+ if (maybe) {
3931
+ void maybe(context, ok, () => {
3932
+ finish();
3933
+ });
3934
+ }
3935
+ },
3936
+ onError(err, updateRef) {
3937
+ var _a3;
3938
+ if (!autoErr || !err || typeof err !== "object") {
3939
+ return;
3940
+ }
3941
+ const anyErr = err;
3942
+ if (anyErr.errors && typeof anyErr.errors === "object") {
3943
+ const { fieldErrors, uncaught } = mapErrorBag(
3944
+ (_a3 = anyErr.errors) != null ? _a3 : {}
3945
+ );
3946
+ if (updateRef) {
3947
+ errorsRef.current = fieldErrors;
3948
+ } else
3949
+ for (const [name, message2] of Object.entries(
3950
+ fieldErrors
3951
+ )) {
3952
+ setFieldError(name, message2);
3953
+ }
3954
+ if (uncaught.length) {
3955
+ uncaughtRef.current.push(...uncaught);
3956
+ }
3957
+ }
3958
+ },
3959
+ onFinish() {
3960
+ const maybe = propsRef.current.onFinish;
3961
+ if (maybe) {
3962
+ maybe(context);
3963
+ }
3964
+ finish();
3965
+ }
3966
+ }
3967
+ });
3968
+ if (autoRun) {
3969
+ try {
3970
+ await adapter.send();
3971
+ } catch (e4) {
3972
+ console.log("Adapter failed to send.", e4);
3973
+ }
3974
+ }
3975
+ return adapter;
3976
+ }
3977
+ context = {
3978
+ values() {
3979
+ return collectValues();
3980
+ },
3981
+ submit() {
3982
+ const valid = validateInternal(true);
3983
+ const vals = collectValues();
3984
+ return { values: vals, valid };
3985
+ },
3986
+ getBind(id) {
3987
+ return registryRef.current.getByBind(id);
3988
+ },
3989
+ validate(report) {
3990
+ return validateInternal(report);
3991
+ },
3992
+ addField(field) {
3993
+ var _a2, _b2;
3994
+ const rawName = (_a2 = field.name) != null ? _a2 : "";
3995
+ field.name = rawName.trim();
3996
+ const { valueBag, valueFeed } = propsRef.current;
3997
+ const trimmed = ((_b2 = field.name) != null ? _b2 : "").trim();
3998
+ const hasName = !!trimmed;
3999
+ const isArray = hasName && trimmed.endsWith("[]");
4000
+ const base = hasName ? trimmed.replace(/\[]$/, "") : "";
4001
+ const sharedKey = field.shared;
4002
+ if (valueBag && !field.ignore && hasName) {
4003
+ const sourceRoot = sharedKey && valueBag[sharedKey] ? valueBag[sharedKey] : valueBag;
4004
+ let value = void 0;
4005
+ if (sourceRoot && typeof sourceRoot === "object") {
4006
+ if (isArray && Array.isArray(sourceRoot[base])) {
4007
+ const siblings = fetchAllNamedFields().filter((f2) => {
4008
+ var _a3;
4009
+ const rn = ((_a3 = f2.name) != null ? _a3 : "").trim();
4010
+ return rn === trimmed && f2.shared === sharedKey;
4011
+ });
4012
+ const idx = siblings.length;
4013
+ value = sourceRoot[base][idx];
4014
+ } else {
4015
+ value = sourceRoot[base];
4016
+ }
4017
+ }
4018
+ let hydrated = value;
4019
+ if (valueFeed) {
4020
+ const maybe = valueFeed(
4021
+ base,
4022
+ value,
4023
+ context
4024
+ );
4025
+ if (typeof maybe !== "undefined") {
4026
+ hydrated = maybe;
4027
+ }
4028
+ }
4029
+ if (typeof hydrated !== "undefined") {
4030
+ const anyField = field;
4031
+ if (typeof anyField.setValue === "function") {
4032
+ anyField.setValue(hydrated);
4033
+ } else {
4034
+ anyField.value = hydrated;
4035
+ }
4036
+ }
4037
+ }
4038
+ registryRef.current.add(field);
4039
+ },
4040
+ // Expose registry view as inputs (delegates to FieldRegistry instance)
4041
+ inputs: registryRef.current,
4042
+ // Also expose raw list of fields for compatibility is defined later as a getter
4043
+ bucket: bucketRef.current,
4044
+ error(nameOrBag, maybeMsg) {
4045
+ if (typeof nameOrBag === "string") {
4046
+ if (!maybeMsg) return;
4047
+ setFieldError(nameOrBag, maybeMsg);
4048
+ return;
4049
+ }
4050
+ const { fieldErrors, uncaught } = mapErrorBag(nameOrBag);
4051
+ for (const [name, message2] of Object.entries(fieldErrors)) {
4052
+ setFieldError(name, message2);
4053
+ }
4054
+ if (uncaught.length) {
4055
+ uncaughtRef.current.push(...uncaught);
4056
+ }
4057
+ },
4058
+ controlButton() {
4059
+ const { activateButtonOnChange } = propsRef.current;
4060
+ if (!activateButtonOnChange) return;
4061
+ const btn = buttonRef.current;
4062
+ const activeName = activeButtonNameRef.current;
4063
+ if (!btn || btn.name !== activeName) {
4064
+ return;
4065
+ }
4066
+ if (!originalRef.current) {
4067
+ originalRef.current = collectValues();
4068
+ }
4069
+ const current = collectValues();
4070
+ const original = originalRef.current;
4071
+ const dirty = !deepEqual(original, current);
4072
+ const setDisabled = (disabled) => {
4073
+ if (typeof btn.setDisabled === "function") {
4074
+ btn.setDisabled(disabled);
4075
+ } else if ("disabled" in btn) {
4076
+ btn.disabled = disabled;
4077
+ }
4078
+ };
4079
+ setDisabled(!dirty);
4080
+ },
4081
+ isDirty() {
4082
+ if (!originalRef.current) {
4083
+ originalRef.current = collectValues();
4084
+ }
4085
+ const current = collectValues();
4086
+ const original = originalRef.current;
4087
+ return !deepEqual(original, current);
4088
+ },
4089
+ async prepare(type, route, extra, ignoreForm, autoErr) {
4090
+ const override = {
4091
+ method: type,
4092
+ url: route
4093
+ };
4094
+ return submitWithAdapter(
4095
+ override,
4096
+ extra,
4097
+ ignoreForm,
4098
+ autoErr,
4099
+ false
4100
+ );
4101
+ },
4102
+ persist(data, feed) {
4103
+ var _a2, _b2;
4104
+ const seen = {};
4105
+ const root = data;
4106
+ const useFeed = feed || (propsRef.current.valueFeed ? (name, value, original) => {
4107
+ const vf = propsRef.current.valueFeed;
4108
+ const maybe = vf(
4109
+ name,
4110
+ value,
4111
+ context
4112
+ );
4113
+ return typeof maybe === "undefined" ? original : maybe;
4114
+ } : void 0);
4115
+ for (const field of fetchAllNamedFields()) {
4116
+ const rawName = field.name;
4117
+ if (!rawName) continue;
4118
+ if (field.ignore) continue;
4119
+ const trimmed = rawName.trim();
4120
+ if (!trimmed) continue;
4121
+ const isArray = trimmed.endsWith("[]");
4122
+ const base = trimmed.replace(/\[]$/, "");
4123
+ const sharedKey = field.shared;
4124
+ const key = sharedKey ? `${sharedKey}.${base}` : base;
4125
+ let value = void 0;
4126
+ if (sharedKey) {
4127
+ const group = root[sharedKey];
4128
+ if (group && typeof group === "object") {
4129
+ if (isArray && Array.isArray(group[base])) {
4130
+ const idx = (_a2 = seen[key]) != null ? _a2 : 0;
4131
+ value = group[base][idx];
4132
+ seen[key] = idx + 1;
4133
+ } else {
4134
+ value = group[base];
4135
+ }
4136
+ }
4137
+ } else {
4138
+ if (isArray && Array.isArray(root[base])) {
4139
+ const idx = (_b2 = seen[key]) != null ? _b2 : 0;
4140
+ value = root[base][idx];
4141
+ seen[key] = idx + 1;
4142
+ } else {
4143
+ value = root[base];
4144
+ }
4145
+ }
4146
+ const anyField = field;
4147
+ const original = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
4148
+ let next = value;
4149
+ if (useFeed) {
4150
+ const maybe = useFeed(base, value, original);
4151
+ if (typeof maybe === "undefined") {
4152
+ continue;
4153
+ }
4154
+ next = maybe;
4155
+ }
4156
+ if (typeof anyField.setValue === "function") {
4157
+ anyField.setValue(next);
4158
+ } else {
4159
+ anyField.value = next;
4160
+ }
4161
+ }
4162
+ if (propsRef.current.onUpdate) {
4163
+ propsRef.current.onUpdate(collectValues());
4164
+ }
4165
+ },
4166
+ setValue(name, value) {
4167
+ if (!name) return;
4168
+ let sharedKey;
4169
+ let base = name;
4170
+ if (name.includes(".")) {
4171
+ const [group, field] = name.split(".", 2);
4172
+ sharedKey = group;
4173
+ base = field;
4174
+ }
4175
+ const targetField = fetchAllNamedFields().find((f2) => {
4176
+ var _a2;
4177
+ const raw = ((_a2 = f2.name) != null ? _a2 : "").trim();
4178
+ if (!raw) return false;
4179
+ const isArray = raw.endsWith("[]");
4180
+ const rawBase = raw.replace(/\[]$/, "");
4181
+ const fShared = f2.shared;
4182
+ const sameGroup = fShared === sharedKey;
4183
+ const sameName = raw === name || rawBase === base || `${fShared}.${rawBase}` === name;
4184
+ return (!sharedKey || sameGroup) && sameName && !isArray;
4185
+ });
4186
+ if (targetField) {
4187
+ const anyField = targetField;
4188
+ if (typeof anyField.setValue === "function") {
4189
+ anyField.setValue(value);
4190
+ } else {
4191
+ anyField.value = value;
4192
+ }
4193
+ } else {
4194
+ bucketRef.current[name] = value;
4195
+ }
4196
+ if (propsRef.current.onUpdate) {
4197
+ propsRef.current.onUpdate(collectValues());
4198
+ }
4199
+ },
4200
+ go(data, ignoreForm) {
4201
+ void submitWithAdapter(void 0, data, ignoreForm, true, true);
4609
4202
  },
4610
- orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
4203
+ reset(inputs) {
4204
+ if (!inputs.length) return;
4205
+ for (const field of fetchAllNamedFields()) {
4206
+ const raw = field.name;
4207
+ if (!raw) continue;
4208
+ if (!inputs.includes(raw)) continue;
4209
+ const anyField = field;
4210
+ if (typeof anyField.reset === "function") {
4211
+ anyField.reset();
4212
+ } else if (typeof anyField.setValue === "function") {
4213
+ anyField.setValue(void 0);
4214
+ } else {
4215
+ anyField.value = void 0;
4216
+ }
4217
+ }
4218
+ },
4219
+ set button(btn) {
4220
+ buttonRef.current = btn;
4221
+ },
4222
+ async forceSubmit() {
4223
+ await submitWithAdapter(void 0, void 0, false, true, true);
4224
+ },
4225
+ get fields() {
4226
+ return fetchAllNamedFields();
4227
+ },
4228
+ get props() {
4229
+ const { formRef, valueBag, ...rest } = propsRef.current;
4230
+ return rest;
4231
+ },
4232
+ setActiveButton(name) {
4233
+ activeButtonNameRef.current = name;
4234
+ },
4235
+ hasUncaughtErrors,
4236
+ getUncaught() {
4237
+ return uncaughtRef.current;
4238
+ }
4611
4239
  };
4240
+ React68__namespace.useEffect(() => {
4241
+ if (!props.formRef) return;
4242
+ props.formRef.current = context;
4243
+ return () => {
4244
+ if (props.formRef) {
4245
+ props.formRef.current = null;
4246
+ }
4247
+ };
4248
+ }, [context]);
4249
+ React68__namespace.useEffect(() => {
4250
+ if (props.init) {
4251
+ props.init(context);
4252
+ }
4253
+ }, []);
4254
+ return /* @__PURE__ */ jsxRuntime.jsx(CoreContextReact.Provider, { value: context, children: props.children });
4255
+ }
4256
+ function useCoreContext() {
4257
+ const ctx = React68.useContext(CoreContextReact);
4258
+ if (!ctx) {
4259
+ throw new Error("useCoreContext must be used within a <CoreProvider>.");
4260
+ }
4261
+ return ctx;
4262
+ }
4263
+
4264
+ // src/core/hooks/use-core.ts
4265
+ function useCore() {
4266
+ return useCoreContext();
4267
+ }
4268
+
4269
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
4270
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4271
+ var toCamelCase = (string) => string.replace(
4272
+ /^([A-Z])|[\s-_]+(\w)/g,
4273
+ (match2, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
4274
+ );
4275
+ var toPascalCase = (string) => {
4276
+ const camelCase = toCamelCase(string);
4277
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
4612
4278
  };
4613
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
4279
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
4280
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
4281
+ }).join(" ").trim();
4282
+ var hasA11yProp = (props) => {
4283
+ for (const prop in props) {
4284
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
4285
+ return true;
4286
+ }
4287
+ }
4288
+ };
4289
+
4290
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
4291
+ var defaultAttributes = {
4292
+ xmlns: "http://www.w3.org/2000/svg",
4293
+ width: 24,
4294
+ height: 24,
4295
+ viewBox: "0 0 24 24",
4296
+ fill: "none",
4297
+ stroke: "currentColor",
4298
+ strokeWidth: 2,
4299
+ strokeLinecap: "round",
4300
+ strokeLinejoin: "round"
4301
+ };
4302
+
4303
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
4304
+ var Icon = React68.forwardRef(
4305
+ ({
4306
+ color = "currentColor",
4307
+ size = 24,
4308
+ strokeWidth = 2,
4309
+ absoluteStrokeWidth,
4310
+ className = "",
4311
+ children,
4312
+ iconNode,
4313
+ ...rest
4314
+ }, ref) => React68.createElement(
4315
+ "svg",
4316
+ {
4317
+ ref,
4318
+ ...defaultAttributes,
4319
+ width: size,
4320
+ height: size,
4321
+ stroke: color,
4322
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
4323
+ className: mergeClasses("lucide", className),
4324
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
4325
+ ...rest
4326
+ },
4327
+ [
4328
+ ...iconNode.map(([tag, attrs]) => React68.createElement(tag, attrs)),
4329
+ ...Array.isArray(children) ? children : [children]
4330
+ ]
4331
+ )
4332
+ );
4333
+
4334
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
4335
+ var createLucideIcon = (iconName, iconNode) => {
4336
+ const Component = React68.forwardRef(
4337
+ ({ className, ...props }, ref) => React68.createElement(Icon, {
4338
+ ref,
4339
+ iconNode,
4340
+ className: mergeClasses(
4341
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
4342
+ `lucide-${iconName}`,
4343
+ className
4344
+ ),
4345
+ ...props
4346
+ })
4347
+ );
4348
+ Component.displayName = toPascalCase(iconName);
4349
+ return Component;
4350
+ };
4351
+
4352
+ // ../../node_modules/lucide-react/dist/esm/icons/calendar.js
4353
+ var __iconNode = [
4354
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
4355
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
4356
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
4357
+ ["path", { d: "M3 10h18", key: "8toen8" }]
4358
+ ];
4359
+ var Calendar = createLucideIcon("calendar", __iconNode);
4360
+
4361
+ // ../../node_modules/lucide-react/dist/esm/icons/check.js
4362
+ var __iconNode2 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
4363
+ var Check = createLucideIcon("check", __iconNode2);
4364
+
4365
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
4366
+ var __iconNode3 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
4367
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode3);
4368
+
4369
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
4370
+ var __iconNode4 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
4371
+ var ChevronLeft = createLucideIcon("chevron-left", __iconNode4);
4372
+
4373
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
4374
+ var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
4375
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
4376
+
4377
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
4378
+ var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
4379
+ var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
4380
+
4381
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-alert.js
4382
+ var __iconNode7 = [
4383
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4384
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
4385
+ ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
4386
+ ];
4387
+ var CircleAlert = createLucideIcon("circle-alert", __iconNode7);
4388
+
4389
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-check.js
4390
+ var __iconNode8 = [
4391
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4392
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
4393
+ ];
4394
+ var CircleCheck = createLucideIcon("circle-check", __iconNode8);
4395
+
4396
+ // ../../node_modules/lucide-react/dist/esm/icons/circle.js
4397
+ var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
4398
+ var Circle = createLucideIcon("circle", __iconNode9);
4399
+
4400
+ // ../../node_modules/lucide-react/dist/esm/icons/cloud-upload.js
4401
+ var __iconNode10 = [
4402
+ ["path", { d: "M12 13v8", key: "1l5pq0" }],
4403
+ ["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
4404
+ ["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
4405
+ ];
4406
+ var CloudUpload = createLucideIcon("cloud-upload", __iconNode10);
4407
+
4408
+ // ../../node_modules/lucide-react/dist/esm/icons/code-xml.js
4409
+ var __iconNode11 = [
4410
+ ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
4411
+ ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
4412
+ ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
4413
+ ];
4414
+ var CodeXml = createLucideIcon("code-xml", __iconNode11);
4415
+
4416
+ // ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
4417
+ var __iconNode12 = [
4418
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
4419
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
4420
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
4421
+ ];
4422
+ var Ellipsis = createLucideIcon("ellipsis", __iconNode12);
4423
+
4424
+ // ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
4425
+ var __iconNode13 = [
4426
+ [
4427
+ "path",
4428
+ {
4429
+ d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
4430
+ key: "ct8e1f"
4431
+ }
4432
+ ],
4433
+ ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
4434
+ [
4435
+ "path",
4436
+ {
4437
+ d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
4438
+ key: "13bj9a"
4439
+ }
4440
+ ],
4441
+ ["path", { d: "m2 2 20 20", key: "1ooewy" }]
4442
+ ];
4443
+ var EyeOff = createLucideIcon("eye-off", __iconNode13);
4614
4444
 
4615
- // src/lib/utils.ts
4616
- function cn(...inputs) {
4617
- return twMerge(clsx(inputs));
4618
- }
4445
+ // ../../node_modules/lucide-react/dist/esm/icons/eye.js
4446
+ var __iconNode14 = [
4447
+ [
4448
+ "path",
4449
+ {
4450
+ d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
4451
+ key: "1nclc0"
4452
+ }
4453
+ ],
4454
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
4455
+ ];
4456
+ var Eye = createLucideIcon("eye", __iconNode14);
4457
+
4458
+ // ../../node_modules/lucide-react/dist/esm/icons/file.js
4459
+ var __iconNode15 = [
4460
+ [
4461
+ "path",
4462
+ {
4463
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
4464
+ key: "1oefj6"
4465
+ }
4466
+ ],
4467
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
4468
+ ];
4469
+ var File2 = createLucideIcon("file", __iconNode15);
4470
+
4471
+ // ../../node_modules/lucide-react/dist/esm/icons/folder-open.js
4472
+ var __iconNode16 = [
4473
+ [
4474
+ "path",
4475
+ {
4476
+ d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
4477
+ key: "usdka0"
4478
+ }
4479
+ ]
4480
+ ];
4481
+ var FolderOpen = createLucideIcon("folder-open", __iconNode16);
4482
+
4483
+ // ../../node_modules/lucide-react/dist/esm/icons/folder-up.js
4484
+ var __iconNode17 = [
4485
+ [
4486
+ "path",
4487
+ {
4488
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
4489
+ key: "1kt360"
4490
+ }
4491
+ ],
4492
+ ["path", { d: "M12 10v6", key: "1bos4e" }],
4493
+ ["path", { d: "m9 13 3-3 3 3", key: "1pxg3c" }]
4494
+ ];
4495
+ var FolderUp = createLucideIcon("folder-up", __iconNode17);
4496
+
4497
+ // ../../node_modules/lucide-react/dist/esm/icons/folder.js
4498
+ var __iconNode18 = [
4499
+ [
4500
+ "path",
4501
+ {
4502
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
4503
+ key: "1kt360"
4504
+ }
4505
+ ]
4506
+ ];
4507
+ var Folder = createLucideIcon("folder", __iconNode18);
4508
+
4509
+ // ../../node_modules/lucide-react/dist/esm/icons/funnel.js
4510
+ var __iconNode19 = [
4511
+ [
4512
+ "path",
4513
+ {
4514
+ d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
4515
+ key: "sc7q7i"
4516
+ }
4517
+ ]
4518
+ ];
4519
+ var Funnel = createLucideIcon("funnel", __iconNode19);
4520
+
4521
+ // ../../node_modules/lucide-react/dist/esm/icons/globe.js
4522
+ var __iconNode20 = [
4523
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4524
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
4525
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
4526
+ ];
4527
+ var Globe = createLucideIcon("globe", __iconNode20);
4528
+
4529
+ // ../../node_modules/lucide-react/dist/esm/icons/loader-circle.js
4530
+ var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
4531
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
4532
+
4533
+ // ../../node_modules/lucide-react/dist/esm/icons/map-pin.js
4534
+ var __iconNode22 = [
4535
+ [
4536
+ "path",
4537
+ {
4538
+ d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
4539
+ key: "1r0f0z"
4540
+ }
4541
+ ],
4542
+ ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
4543
+ ];
4544
+ var MapPin = createLucideIcon("map-pin", __iconNode22);
4545
+
4546
+ // ../../node_modules/lucide-react/dist/esm/icons/minus.js
4547
+ var __iconNode23 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
4548
+ var Minus = createLucideIcon("minus", __iconNode23);
4549
+
4550
+ // ../../node_modules/lucide-react/dist/esm/icons/palette.js
4551
+ var __iconNode24 = [
4552
+ [
4553
+ "path",
4554
+ {
4555
+ d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
4556
+ key: "e79jfc"
4557
+ }
4558
+ ],
4559
+ ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
4560
+ ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
4561
+ ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
4562
+ ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
4563
+ ];
4564
+ var Palette = createLucideIcon("palette", __iconNode24);
4565
+
4566
+ // ../../node_modules/lucide-react/dist/esm/icons/pen-line.js
4567
+ var __iconNode25 = [
4568
+ ["path", { d: "M13 21h8", key: "1jsn5i" }],
4569
+ [
4570
+ "path",
4571
+ {
4572
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
4573
+ key: "1a8usu"
4574
+ }
4575
+ ]
4576
+ ];
4577
+ var PenLine = createLucideIcon("pen-line", __iconNode25);
4578
+
4579
+ // ../../node_modules/lucide-react/dist/esm/icons/plus.js
4580
+ var __iconNode26 = [
4581
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
4582
+ ["path", { d: "M12 5v14", key: "s699le" }]
4583
+ ];
4584
+ var Plus = createLucideIcon("plus", __iconNode26);
4585
+
4586
+ // ../../node_modules/lucide-react/dist/esm/icons/search.js
4587
+ var __iconNode27 = [
4588
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
4589
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
4590
+ ];
4591
+ var Search = createLucideIcon("search", __iconNode27);
4592
+
4593
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
4594
+ var __iconNode28 = [
4595
+ ["path", { d: "M10 5H3", key: "1qgfaw" }],
4596
+ ["path", { d: "M12 19H3", key: "yhmn1j" }],
4597
+ ["path", { d: "M14 3v4", key: "1sua03" }],
4598
+ ["path", { d: "M16 17v4", key: "1q0r14" }],
4599
+ ["path", { d: "M21 12h-9", key: "1o4lsq" }],
4600
+ ["path", { d: "M21 19h-5", key: "1rlt1p" }],
4601
+ ["path", { d: "M21 5h-7", key: "1oszz2" }],
4602
+ ["path", { d: "M8 10v4", key: "tgpxqk" }],
4603
+ ["path", { d: "M8 12H3", key: "a7s4jb" }]
4604
+ ];
4605
+ var SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode28);
4606
+
4607
+ // ../../node_modules/lucide-react/dist/esm/icons/square-split-vertical.js
4608
+ var __iconNode29 = [
4609
+ ["path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3", key: "1pi83i" }],
4610
+ ["path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3", key: "ido5k7" }],
4611
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
4612
+ ];
4613
+ var SquareSplitVertical = createLucideIcon("square-split-vertical", __iconNode29);
4614
+
4615
+ // ../../node_modules/lucide-react/dist/esm/icons/tag.js
4616
+ var __iconNode30 = [
4617
+ [
4618
+ "path",
4619
+ {
4620
+ d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
4621
+ key: "vktsd0"
4622
+ }
4623
+ ],
4624
+ ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
4625
+ ];
4626
+ var Tag = createLucideIcon("tag", __iconNode30);
4627
+
4628
+ // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
4629
+ var __iconNode31 = [
4630
+ ["path", { d: "M10 11v6", key: "nco0om" }],
4631
+ ["path", { d: "M14 11v6", key: "outv1u" }],
4632
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
4633
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
4634
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
4635
+ ];
4636
+ var Trash2 = createLucideIcon("trash-2", __iconNode31);
4637
+
4638
+ // ../../node_modules/lucide-react/dist/esm/icons/upload.js
4639
+ var __iconNode32 = [
4640
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
4641
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
4642
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
4643
+ ];
4644
+ var Upload = createLucideIcon("upload", __iconNode32);
4645
+
4646
+ // ../../node_modules/lucide-react/dist/esm/icons/x.js
4647
+ var __iconNode33 = [
4648
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
4649
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
4650
+ ];
4651
+ var X = createLucideIcon("x", __iconNode33);
4619
4652
  function ErrorStrip(props) {
4620
4653
  var _a, _b;
4621
4654
  const {
@@ -4852,7 +4885,8 @@ function useField(options) {
4852
4885
  readOnly: readOnlyProp = false,
4853
4886
  validate,
4854
4887
  getOriginalValue,
4855
- onValueChange
4888
+ onValueChange,
4889
+ onSubmit
4856
4890
  } = options;
4857
4891
  const ref = React68__namespace.useRef(null);
4858
4892
  const stateRef = React68__namespace.useRef({
@@ -4939,6 +4973,7 @@ function useField(options) {
4939
4973
  main,
4940
4974
  ignore,
4941
4975
  required,
4976
+ onSubmit,
4942
4977
  ref,
4943
4978
  get defaultValue() {
4944
4979
  return stateRef.current.original;
@@ -4972,7 +5007,8 @@ function useField(options) {
4972
5007
  if (onValueChange) {
4973
5008
  onValueChange(value2, old, variant);
4974
5009
  }
4975
- }
5010
+ },
5011
+ variant: options.variant
4976
5012
  // Flags not directly on the Field interface but used via `as any`
4977
5013
  // in core-provider (getValue/setValue/reset).
4978
5014
  };
@@ -8064,25 +8100,6 @@ function getGlobalCountryList() {
8064
8100
  cachedCountries = DEFAULT_COUNTRIES;
8065
8101
  return cachedCountries;
8066
8102
  }
8067
-
8068
- // src/lib/register-global.ts
8069
- function registerPaletteUtil(key, value) {
8070
- if (typeof window === "undefined") return;
8071
- if (!window["form-palette"]) {
8072
- window["form-palette"] = {};
8073
- }
8074
- window["form-palette"][key] = value;
8075
- }
8076
- function getPaletteUtil(key, defaultValue) {
8077
- if (typeof window === "undefined") {
8078
- return defaultValue;
8079
- }
8080
- const registry3 = window["form-palette"];
8081
- if (registry3 && key in registry3) {
8082
- return registry3[key];
8083
- }
8084
- return defaultValue;
8085
- }
8086
8103
  var TOKEN_CHARS = /* @__PURE__ */ new Set(["9", "a", "*"]);
8087
8104
  function compileMask(pattern, placeholderChar = "_") {
8088
8105
  return { pattern, placeholderChar };
@@ -19566,10 +19583,6 @@ function pickerBtnSize(size) {
19566
19583
  return "h-7 w-7";
19567
19584
  }
19568
19585
  }
19569
- function toArray(v2) {
19570
- if (v2 == null) return [];
19571
- return Array.isArray(v2) ? v2 : [v2];
19572
- }
19573
19586
  function normaliseFileLike(input) {
19574
19587
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
19575
19588
  const asAny = input;
@@ -19701,6 +19714,7 @@ var FileThumbnail = ({ item }) => {
19701
19714
  ) : /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-4 w-4 text-muted-foreground/50" }) });
19702
19715
  };
19703
19716
  var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant2(props, ref) {
19717
+ var _a;
19704
19718
  const {
19705
19719
  value,
19706
19720
  onValue,
@@ -19726,6 +19740,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19726
19740
  formatFileName,
19727
19741
  formatFileSize = formatSizeDefault,
19728
19742
  placeholder = "Select file...",
19743
+ asRaw,
19729
19744
  className,
19730
19745
  custom,
19731
19746
  dropAreaClassName,
@@ -19753,7 +19768,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19753
19768
  } = props;
19754
19769
  const joinControls = mode === "default" ? joinControlsProp != null ? joinControlsProp : true : false;
19755
19770
  const extendBoxToControls = mode === "default" ? extendBoxToControlsProp != null ? extendBoxToControlsProp : true : false;
19756
- const items = value != null ? value : [];
19771
+ const items = (_a = toArray(value)) != null ? _a : [];
19757
19772
  const isDisabled = Boolean(disabled || readOnly);
19758
19773
  const [dragOver, setDragOver] = React68__namespace.useState(false);
19759
19774
  const [selectedIds, setSelectedIds] = React68__namespace.useState(
@@ -19837,12 +19852,16 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19837
19852
  setSelectedIds(/* @__PURE__ */ new Set());
19838
19853
  }, [emitChange, items, selectedIds]);
19839
19854
  const openPicker = React68__namespace.useCallback(async () => {
19840
- var _a;
19855
+ var _a2;
19841
19856
  if (isDisabled) return;
19842
19857
  let resolvedLoader = customLoader != null ? customLoader : custom && getPaletteUtil("customLoader");
19843
19858
  if (resolvedLoader) {
19844
19859
  try {
19845
- const result = await resolvedLoader({ multiple, current: items, allowedTypes: toArray(accept) });
19860
+ const result = await resolvedLoader({
19861
+ multiple,
19862
+ current: items,
19863
+ allowedTypes: toArray(accept)
19864
+ });
19846
19865
  if (!result) return;
19847
19866
  const normalized = toArray(result).map(normaliseFileLike);
19848
19867
  if (mergeMode === "replace" || !multiple) {
@@ -19858,7 +19877,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19858
19877
  }
19859
19878
  return;
19860
19879
  }
19861
- (_a = fileInputRef.current) == null ? void 0 : _a.click();
19880
+ (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
19862
19881
  }, [
19863
19882
  customLoader,
19864
19883
  emitChange,
@@ -19877,18 +19896,18 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19877
19896
  );
19878
19897
  const onDrop = React68__namespace.useCallback(
19879
19898
  (e4) => {
19880
- var _a;
19899
+ var _a2;
19881
19900
  e4.preventDefault();
19882
19901
  setDragOver(false);
19883
- if (isDisabled || !((_a = e4.dataTransfer.files) == null ? void 0 : _a.length)) return;
19902
+ if (isDisabled || !((_a2 = e4.dataTransfer.files) == null ? void 0 : _a2.length)) return;
19884
19903
  const files = normaliseFromFiles(e4.dataTransfer.files);
19885
19904
  handleAddItems(files, "drop");
19886
19905
  },
19887
19906
  [handleAddItems, isDisabled]
19888
19907
  );
19889
19908
  const onNativeChange = (e4) => {
19890
- var _a;
19891
- if ((_a = e4.target.files) == null ? void 0 : _a.length) {
19909
+ var _a2;
19910
+ if ((_a2 = e4.target.files) == null ? void 0 : _a2.length) {
19892
19911
  handleAddItems(normaliseFromFiles(e4.target.files), "input");
19893
19912
  }
19894
19913
  e4.target.value = "";
@@ -19902,8 +19921,8 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
19902
19921
  const [preview2, setPreview] = React68__namespace.useState(null);
19903
19922
  const [isOpen, setIsOpen] = React68__namespace.useState(false);
19904
19923
  React68__namespace.useEffect(() => {
19905
- var _a;
19906
- const isImage2 = ((_a = item.type) == null ? void 0 : _a.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19924
+ var _a2;
19925
+ const isImage2 = ((_a2 = item.type) == null ? void 0 : _a2.startsWith("image/")) || item.name.match(/\.(jpg|jpeg|png|gif|webp)$/i);
19907
19926
  if (!isImage2) {
19908
19927
  setPreview(null);
19909
19928
  return;
@@ -20289,7 +20308,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
20289
20308
  ),
20290
20309
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
20291
20310
  items.map((item) => {
20292
- var _a;
20311
+ var _a2;
20293
20312
  const selected = selectedIds.has(item.id);
20294
20313
  const toggle = () => {
20295
20314
  const next = new Set(selectedIds);
@@ -20316,7 +20335,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
20316
20335
  ),
20317
20336
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
20318
20337
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
20319
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a : item.name }),
20338
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-medium", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }),
20320
20339
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
20321
20340
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(
20322
20341
  item.size
@@ -20434,7 +20453,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
20434
20453
  ] })
20435
20454
  ] }),
20436
20455
  /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: cn("mt-1 w-full", listClassName), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: items.map((item, index) => {
20437
- var _a;
20456
+ var _a2;
20438
20457
  const selected = selectedIds.has(item.id);
20439
20458
  const toggle = () => {
20440
20459
  const next = new Set(selectedIds);
@@ -20469,7 +20488,7 @@ var ShadcnFileVariant = React68__namespace.forwardRef(function ShadcnFileVariant
20469
20488
  ),
20470
20489
  /* @__PURE__ */ jsxRuntime.jsx(FileThumbnail, { item }),
20471
20490
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
20472
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-foreground", children: (_a = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a : item.name }) }),
20491
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-foreground", children: (_a2 = formatFileName == null ? void 0 : formatFileName(item)) != null ? _a2 : item.name }) }),
20473
20492
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
20474
20493
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatFileSize(item.size) }),
20475
20494
  item.status === "loading" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center gap-1 text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { className: "h-3 w-3 animate-spin" }) }),
@@ -27187,6 +27206,7 @@ function InputField(props) {
27187
27206
  var _a, _b, _c, _d, _e, _f, _g;
27188
27207
  const {
27189
27208
  variant,
27209
+ onSubmit,
27190
27210
  // Field identity / wiring
27191
27211
  name,
27192
27212
  bind,
@@ -27318,6 +27338,8 @@ function InputField(props) {
27318
27338
  alias,
27319
27339
  main,
27320
27340
  ignore,
27341
+ onSubmit,
27342
+ variant,
27321
27343
  required,
27322
27344
  defaultValue,
27323
27345
  validate