monobill-mintui 0.6.722 → 0.6.724

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/choice.css +1 -1
  2. package/dist/components/choice/ChoiceOption.d.ts.map +1 -1
  3. package/dist/components/form/Form.d.ts +1 -0
  4. package/dist/components/form/Form.d.ts.map +1 -1
  5. package/dist/components/form/browser.js +34 -14
  6. package/dist/components/form/index.cjs +1 -1
  7. package/dist/components/form/index.js +34 -14
  8. package/dist/components/off-canvas/OffCanvas.d.ts +1 -8
  9. package/dist/components/off-canvas/OffCanvas.d.ts.map +1 -1
  10. package/dist/components/off-canvas/browser.js +7 -63
  11. package/dist/components/off-canvas/index.cjs +1 -1
  12. package/dist/components/off-canvas/index.js +7 -63
  13. package/dist/components/resource-table/ResourceTable.d.ts +7 -3
  14. package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
  15. package/dist/components/resource-table/browser.js +68 -38
  16. package/dist/components/resource-table/index.cjs +2 -2
  17. package/dist/components/resource-table/index.d.ts +1 -0
  18. package/dist/components/resource-table/index.d.ts.map +1 -1
  19. package/dist/components/resource-table/index.js +68 -38
  20. package/dist/components/resource-table/utility-aliases.d.ts +7 -10
  21. package/dist/components/resource-table/utility-aliases.d.ts.map +1 -1
  22. package/dist/components/side-navigation/SideNavigationLink.d.ts.map +1 -1
  23. package/dist/components/side-navigation/browser.js +2 -2
  24. package/dist/components/side-navigation/index.cjs +1 -1
  25. package/dist/components/side-navigation/index.js +2 -2
  26. package/dist/form.css +1 -1
  27. package/dist/index.cjs +2 -2
  28. package/dist/index.css +5 -5
  29. package/dist/index.js +112 -118
  30. package/dist/off-canvas.css +1 -1
  31. package/dist/resource-table.css +1 -1
  32. package/dist/side-navigation.css +1 -1
  33. package/package.json +1 -1
package/dist/choice.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /* mint-ui component style: choice */
2
- @layer theme, base, components, utilities;/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing,.25rem) * 0)}.end{inset-inline-end:var(--spacing,.25rem)}.z-10{z-index:10}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing,.25rem) * 0)}.mt-0\.5{margin-top:calc(var(--spacing,.25rem) * .5)}.mt-1{margin-top:calc(var(--spacing,.25rem) * 1)}.mb-2{margin-bottom:calc(var(--spacing,.25rem) * 2)}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing,.25rem) * 2)}.h-4{height:calc(var(--spacing,.25rem) * 4)}.h-5{height:calc(var(--spacing,.25rem) * 5)}.h-\[1\.1rem\]{height:1.1rem}.h-\[1rem\]{height:1rem}.w-2{width:calc(var(--spacing,.25rem) * 2)}.w-5{width:calc(var(--spacing,.25rem) * 5)}.w-20{width:calc(var(--spacing,.25rem) * 20)}.w-24{width:calc(var(--spacing,.25rem) * 24)}.w-\[1\.1rem\]{width:1.1rem}.w-\[1rem\]{width:1rem}.w-full{width:100%}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse,pulse 2s cubic-bezier(.4, 0, .6, 1) infinite)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing,.25rem) * .5)}.gap-2{gap:calc(var(--spacing,.25rem) * 2)}.gap-3{gap:calc(var(--spacing,.25rem) * 3)}.gap-\[\.55rem\]{gap:.55rem}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-gray-300{border-color:var(--color-gray-300,oklch(87.2% .01 258.338))}.border-slate-800{border-color:var(--color-slate-800,oklch(27.9% .041 260.031))}.bg-gray-200{background-color:var(--color-gray-200,oklch(92.8% .006 264.531))}.bg-slate-800{background-color:var(--color-slate-800,oklch(27.9% .041 260.031))}.bg-white{background-color:var(--color-white,#fff)}.p-0{padding:calc(var(--spacing,.25rem) * 0)}.text-sm{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}.text-xs{font-size:var(--text-xs,.75rem);line-height:var(--tw-leading,var(--text-xs--line-height,calc(1 / .75)))}.font-medium{--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}.text-gray-500{color:var(--color-gray-500,oklch(55.1% .027 264.364))}.text-gray-900{color:var(--color-gray-900,oklch(21% .034 264.665))}.text-red-600{color:var(--color-red-600,oklch(57.7% .245 27.325))}.opacity-40{opacity:.4}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-gray-400{--tw-ring-color:var(--color-gray-400,oklch(70.7% .022 261.325))}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s))}.ease-in-out{--tw-ease:var(--ease-in-out,cubic-bezier(.4, 0, .2, 1));transition-timing-function:var(--ease-in-out,cubic-bezier(.4, 0, .2, 1))}.ease-out{--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1))}.select-none{-webkit-user-select:none;user-select:none}.dark\:border-gray-500:where(.dark,.dark *){border-color:var(--color-gray-500,oklch(55.1% .027 264.364))}.dark\:border-slate-600:where(.dark,.dark *){border-color:var(--color-slate-600,oklch(44.6% .043 257.281))}.dark\:bg-mint-elevated:where(.dark,.dark *){background-color:var(--mint-color-surface-raised)}.dark\:bg-mint-hover:where(.dark,.dark *){background-color:var(--mint-color-surface-hover)}.dark\:bg-slate-600:where(.dark,.dark *){background-color:var(--color-slate-600,oklch(44.6% .043 257.281))}.dark\:text-gray-100:where(.dark,.dark *){color:var(--color-gray-100,oklch(96.7% .003 264.542))}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400,oklch(70.7% .022 261.325))}.dark\:text-red-400:where(.dark,.dark *){color:var(--color-red-400,oklch(70.4% .191 22.216))}.dark\:ring-gray-500:where(.dark,.dark *){--tw-ring-color:var(--color-gray-500,oklch(55.1% .027 264.364))}}@layer components{mint-choice{align-items:flex-start;gap:.65rem;display:inline-flex}.mint-choice-wrapper{border:1.5px solid var(--mint-color-border-strong,#b9c5bc);background:var(--mint-color-surface,#fff);cursor:pointer;border-radius:50%;flex:none;justify-content:center;align-items:center;width:1.25rem;height:1.25rem;display:inline-flex;position:relative}.mint-choice-wrapper:has(input:checked){border-color:var(--mint-color-primary,#315943);background:var(--mint-color-primary,#315943)}.mint-choice-wrapper input{opacity:0;cursor:pointer;z-index:2;width:100%;height:100%;margin:0;position:absolute;inset:0}.mint-choice-label-container{flex-direction:column;flex:1;gap:.2rem;display:flex}.mint-choice-label{cursor:pointer;font-size:.875rem;font-weight:500;line-height:1.25rem}.mint-choice-info{color:var(--mint-color-text-secondary,#66736a);font-size:.75rem;line-height:1rem}.mint-input-overlay{opacity:0;cursor:pointer;z-index:2;width:100%;height:100%;margin:0;position:absolute;inset:0}.mint-choice-indicator{background:var(--mint-color-surface,#fff);pointer-events:none;border-radius:50%;width:.625rem;height:.625rem;margin:auto;position:absolute;inset:0}mint-choice.mint-choice-group{flex-direction:column;align-items:stretch;gap:.5rem;width:100%;display:flex}.mint-choice-group-label{color:var(--mint-color-text,#28372e);font-size:.875rem;font-weight:500;line-height:1.25rem}.mint-choice-options{flex-direction:column;gap:.75rem;display:flex}.mint-choice-options:not(:has(mint-choice-option[info])){gap:.55rem}.mint-choice-option{display:block}.mint-choice-option-control{cursor:pointer;color:var(--mint-color-text,#28372e);align-items:flex-start;gap:.55rem;display:inline-flex}.mint-choice-option-input{width:1.1rem;height:1.1rem;accent-color:var(--mint-color-primary,#315943);margin:0}.mint-choice-option:has(input:disabled) .mint-choice-option-control{cursor:not-allowed;opacity:.55}mint-choice:not(.mint-choice-group){align-items:flex-start;min-height:2.5rem}mint-choice:not(.mint-choice-group):not([info]){min-height:1.5rem}}@keyframes mint-choice-skeleton-pulse{50%{opacity:.45}}@layer components{@media (prefers-reduced-motion:reduce){.mint-choice-loading-skeleton span{animation:none!important}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}
2
+ @layer theme, base, components, utilities;/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-ease:initial}}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing,.25rem) * 0)}.end{inset-inline-end:var(--spacing,.25rem)}.z-10{z-index:10}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing,.25rem) * 0)}.mt-0\.5{margin-top:calc(var(--spacing,.25rem) * .5)}.mt-1{margin-top:calc(var(--spacing,.25rem) * 1)}.mb-2{margin-bottom:calc(var(--spacing,.25rem) * 2)}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing,.25rem) * 2)}.h-4{height:calc(var(--spacing,.25rem) * 4)}.h-5{height:calc(var(--spacing,.25rem) * 5)}.h-\[1\.1rem\]{height:1.1rem}.h-\[1rem\]{height:1rem}.w-2{width:calc(var(--spacing,.25rem) * 2)}.w-5{width:calc(var(--spacing,.25rem) * 5)}.w-20{width:calc(var(--spacing,.25rem) * 20)}.w-24{width:calc(var(--spacing,.25rem) * 24)}.w-\[1\.1rem\]{width:1.1rem}.w-\[1rem\]{width:1rem}.w-full{width:100%}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse,pulse 2s cubic-bezier(.4, 0, .6, 1) infinite)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing,.25rem) * .5)}.gap-2{gap:calc(var(--spacing,.25rem) * 2)}.gap-3{gap:calc(var(--spacing,.25rem) * 3)}.gap-\[\.55rem\]{gap:.55rem}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-gray-300{border-color:var(--color-gray-300,oklch(87.2% .01 258.338))}.border-slate-800{border-color:var(--color-slate-800,oklch(27.9% .041 260.031))}.bg-gray-200{background-color:var(--color-gray-200,oklch(92.8% .006 264.531))}.bg-slate-800{background-color:var(--color-slate-800,oklch(27.9% .041 260.031))}.bg-white{background-color:var(--color-white,#fff)}.p-0{padding:calc(var(--spacing,.25rem) * 0)}.text-sm{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}.text-xs{font-size:var(--text-xs,.75rem);line-height:var(--tw-leading,var(--text-xs--line-height,calc(1 / .75)))}.font-medium{--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}.text-gray-500{color:var(--color-gray-500,oklch(55.1% .027 264.364))}.text-gray-900{color:var(--color-gray-900,oklch(21% .034 264.665))}.text-red-600{color:var(--color-red-600,oklch(57.7% .245 27.325))}.opacity-40{opacity:.4}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-gray-400{--tw-ring-color:var(--color-gray-400,oklch(70.7% .022 261.325))}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s))}.ease-in-out{--tw-ease:var(--ease-in-out,cubic-bezier(.4, 0, .2, 1));transition-timing-function:var(--ease-in-out,cubic-bezier(.4, 0, .2, 1))}.ease-out{--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1))}.select-none{-webkit-user-select:none;user-select:none}.dark\:border-gray-500:where(.dark,.dark *){border-color:var(--color-gray-500,oklch(55.1% .027 264.364))}.dark\:border-slate-600:where(.dark,.dark *){border-color:var(--color-slate-600,oklch(44.6% .043 257.281))}.dark\:bg-mint-elevated:where(.dark,.dark *){background-color:var(--mint-color-surface-raised)}.dark\:bg-mint-hover:where(.dark,.dark *){background-color:var(--mint-color-surface-hover)}.dark\:bg-slate-600:where(.dark,.dark *){background-color:var(--color-slate-600,oklch(44.6% .043 257.281))}.dark\:text-gray-100:where(.dark,.dark *){color:var(--color-gray-100,oklch(96.7% .003 264.542))}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400,oklch(70.7% .022 261.325))}.dark\:text-red-400:where(.dark,.dark *){color:var(--color-red-400,oklch(70.4% .191 22.216))}.dark\:ring-gray-500:where(.dark,.dark *){--tw-ring-color:var(--color-gray-500,oklch(55.1% .027 264.364))}}@layer components{mint-choice{align-items:flex-start;gap:.65rem;display:inline-flex}.mint-choice-wrapper{border:1.5px solid var(--mint-color-border-strong,#b9c5bc);background:var(--mint-color-surface,#fff);cursor:pointer;border-radius:50%;flex:none;justify-content:center;align-items:center;width:1.25rem;height:1.25rem;display:inline-flex;position:relative}.mint-choice-wrapper:has(input:checked){border-color:var(--mint-color-primary,#315943);background:var(--mint-color-primary,#315943)}.mint-choice-wrapper input{opacity:0;cursor:pointer;z-index:2;width:100%;height:100%;margin:0;position:absolute;inset:0}.mint-choice-label-container{flex-direction:column;flex:1;gap:.2rem;display:flex}.mint-choice-label{cursor:pointer;font-size:.875rem;font-weight:500;line-height:1.25rem}.mint-choice-info{color:var(--mint-color-text-secondary,#66736a);font-size:.75rem;line-height:1rem}.mint-input-overlay{opacity:0;cursor:pointer;z-index:2;width:100%;height:100%;margin:0;position:absolute;inset:0}.mint-choice-indicator{background:var(--mint-color-surface,#fff);pointer-events:none;border-radius:50%;width:.625rem;height:.625rem;margin:auto;position:absolute;inset:0}mint-choice.mint-choice-group{flex-direction:column;align-items:stretch;gap:.5rem;width:100%;display:flex}.mint-choice-group-label{color:var(--mint-color-text,#28372e);font-size:.875rem;font-weight:500;line-height:1.25rem}.mint-choice-options{flex-direction:column;gap:.75rem;display:flex}.mint-choice-options:not(:has(mint-choice-option[info])){gap:.55rem}.mint-choice-option{display:block}.mint-choice-option-control{cursor:pointer;color:var(--mint-color-text,#28372e);align-items:flex-start;gap:.55rem;display:inline-flex}.mint-choice-option-input{width:1.1rem;height:1.1rem;accent-color:var(--mint-color-primary,#315943);margin:0}.mint-choice-option:has(input:disabled) .mint-choice-option-control{cursor:not-allowed;opacity:.55}mint-choice:not(.mint-choice-group){align-items:flex-start;min-height:2.5rem}mint-choice:not(.mint-choice-group):not([info]){min-height:1.5rem}.mint-choice-option-label{line-height:1.25rem}}@keyframes mint-choice-skeleton-pulse{50%{opacity:.45}}@layer components{@media (prefers-reduced-motion:reduce){.mint-choice-loading-skeleton span{animation:none!important}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceOption.d.ts","sourceRoot":"","sources":["../../../src/components/choice/ChoiceOption.ts"],"names":[],"mappings":"AAGA,cAAM,gBAAiB,SAAQ,WAAW;IACxC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,eAAe,CAA4C;;IAMnE,iBAAiB,IAAI,IAAI;IAUzB,oBAAoB,IAAI,IAAI;IAyB5B,SAAS,IAAI,OAAO;IAKpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAuB9F,IAAI,OAAO,IAAI,OAAO,CAMrB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAsBzB;IAED,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,MAAM;IAIjB,UAAU,IAAI,OAAO;IAUrB,OAAO,CAAC,kBAAkB;IA4C1B,MAAM,IAAI,IAAI;IAqVd,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,gBAAgB;IA2DxB,OAAO,CAAC,oBAAoB;CA0D7B;AAOD,eAAe,gBAAgB,CAAA"}
1
+ {"version":3,"file":"ChoiceOption.d.ts","sourceRoot":"","sources":["../../../src/components/choice/ChoiceOption.ts"],"names":[],"mappings":"AAGA,cAAM,gBAAiB,SAAQ,WAAW;IACxC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,eAAe,CAA4C;;IAMnE,iBAAiB,IAAI,IAAI;IAUzB,oBAAoB,IAAI,IAAI;IAyB5B,SAAS,IAAI,OAAO;IAKpB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAuB9F,IAAI,OAAO,IAAI,OAAO,CAMrB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAsBzB;IAED,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,MAAM;IAIjB,UAAU,IAAI,OAAO;IAUrB,OAAO,CAAC,kBAAkB;IA4C1B,MAAM,IAAI,IAAI;IA0Vd,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,gBAAgB;IA2DxB,OAAO,CAAC,oBAAoB;CA0D7B;AAOD,eAAe,gBAAgB,CAAA"}
@@ -76,6 +76,7 @@ declare class MintForm extends HTMLElement {
76
76
  */
77
77
  setFormErrors(errors: Record<string, string | string[]>): void;
78
78
  private _applyServerErrors;
79
+ private _scrollToFirstError;
79
80
  private _parseFormData;
80
81
  private _parseHeaders;
81
82
  private _applyFormData;
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.ts"],"names":[],"mappings":"AAOA,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,kBAAkB,CAAoC;IAC9D,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,oBAAoB,CAAkD;IAC9E,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,aAAa,CAAuE;IAC5F,uFAAuF;IACvF,OAAO,CAAC,yBAAyB,CAAkC;IACnE,OAAO,CAAC,2BAA2B,CAGhC;IACH,OAAO,CAAC,0BAA0B,CAAkE;IACpG,OAAO,CAAC,4BAA4B,CAAwC;IAC5E,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,wBAAwB,CAAmC;IACnE,4FAA4F;IAC5F,OAAO,CAAC,wBAAwB,CAAI;;IAMpC,iBAAiB,IAAI,IAAI;IAyCzB,oBAAoB,IAAI,IAAI;IAY5B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAeb;;;OAGG;IACH,KAAK,IAAI,IAAI;IAoBb;;;OAGG;IACH,MAAM,IAAI,IAAI;IAad,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAqC9F,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAErC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EA+CzC;IAGD,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAE3C;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAgB/C;IAED,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,oBAAoB;YAYd,aAAa;YA2Gb,WAAW;YAkJX,yBAAyB;YAiBzB,uBAAuB;IA2BrC,OAAO,CAAC,iBAAiB;IA+GzB,kGAAkG;IAClG,OAAO,CAAC,2BAA2B;IAkBnC;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAuEjC,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,SAAS;IAuBjB,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,cAAc;IA2EtB,OAAO,CAAC,iBAAiB;IAgDzB,OAAO,CAAC,kBAAkB;IAuJ1B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,YAAY;IAoBpB;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI;IAI9D,OAAO,CAAC,kBAAkB;IAuB1B,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,cAAc;IAiFtB,OAAO,CAAC,kBAAkB;IA4I1B,OAAO,CAAC,kBAAkB;IAmD1B,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,oBAAoB;IA0K5B,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,wBAAwB;IAsBhC,OAAO,CAAC,uBAAuB;IAyB/B,OAAO,CAAC,sBAAsB;IA6B9B,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,uBAAuB;IAK/B;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IA8EtC,OAAO,CAAC,gCAAgC;IAgCxC,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,qBAAqB;IAoD7B,OAAO,CAAC,oBAAoB;IAuD5B,wFAAwF;IACxF,OAAO,CAAC,iBAAiB;IAIzB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAIvB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAyDhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAUlC;AAsCD,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.ts"],"names":[],"mappings":"AAOA,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,kBAAkB,CAAoC;IAC9D,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,oBAAoB,CAAkD;IAC9E,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,aAAa,CAAuE;IAC5F,uFAAuF;IACvF,OAAO,CAAC,yBAAyB,CAAkC;IACnE,OAAO,CAAC,2BAA2B,CAGhC;IACH,OAAO,CAAC,0BAA0B,CAAkE;IACpG,OAAO,CAAC,4BAA4B,CAAwC;IAC5E,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,wBAAwB,CAAmC;IACnE,4FAA4F;IAC5F,OAAO,CAAC,wBAAwB,CAAI;;IAMpC,iBAAiB,IAAI,IAAI;IAyCzB,oBAAoB,IAAI,IAAI;IAY5B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAeb;;;OAGG;IACH,KAAK,IAAI,IAAI;IAoBb;;;OAGG;IACH,MAAM,IAAI,IAAI;IAad,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAqC9F,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAErC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EA+CzC;IAGD,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAE3C;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAgB/C;IAED,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,oBAAoB;YAYd,aAAa;YA2Gb,WAAW;YAkJX,yBAAyB;YAiBzB,uBAAuB;IA2BrC,OAAO,CAAC,iBAAiB;IA+GzB,kGAAkG;IAClG,OAAO,CAAC,2BAA2B;IAkBnC;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAuEjC,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,SAAS;IAyBjB,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,cAAc;IA2EtB,OAAO,CAAC,iBAAiB;IAwDzB,OAAO,CAAC,kBAAkB;IAuJ1B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,YAAY;IAoBpB;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI;IAI9D,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,cAAc;IAiFtB,OAAO,CAAC,kBAAkB;IA4I1B,OAAO,CAAC,kBAAkB;IAmD1B,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,oBAAoB;IA0K5B,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,wBAAwB;IAsBhC,OAAO,CAAC,uBAAuB;IAyB/B,OAAO,CAAC,sBAAsB;IA6B9B,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,uBAAuB;IAK/B;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IA8EtC,OAAO,CAAC,gCAAgC;IAgCxC,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,qBAAqB;IAoD7B,OAAO,CAAC,oBAAoB;IAuD5B,wFAAwF;IACxF,OAAO,CAAC,iBAAiB;IAIzB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAIvB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAyDhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAUlC;AAsCD,eAAe,QAAQ,CAAA"}
@@ -419,7 +419,7 @@ var t = class extends HTMLElement {
419
419
  return this._errors = {}, Object.entries(t || {}).forEach(([e, t]) => {
420
420
  let r = Array.isArray(t) ? t : [t], i = this._getFieldElements(e), a = this._extractFieldValue(i), o = this._validateRules(a, r);
421
421
  o ? (n = !1, this._errors[e] = o, this._flagFieldError(i, o)) : this._clearFieldError(i);
422
- }), n;
422
+ }), n || this._scrollToFirstError(), n;
423
423
  }
424
424
  _validateField(e) {
425
425
  let t = this._collectValidationRules();
@@ -487,24 +487,27 @@ var t = class extends HTMLElement {
487
487
  }
488
488
  _getFieldElements(e) {
489
489
  if (!this._form) return [];
490
- let t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), n = t.filter((e) => e.tagName === "MINT-SELECT");
491
- if (n.length > 0) {
492
- let r = [];
493
- return n.forEach((t) => {
494
- let n = t.querySelector("select[name=\"" + e + "\"]");
495
- n && r.push(n);
496
- }), t.filter((e) => e.tagName !== "MINT-SELECT").concat(r);
490
+ let t = (e) => e.replace(/\[(.*?)\]/g, ".$1").replace(/\.+/g, ".").replace(/^\.|\.$/g, ""), n = t(e), r = Array.from(this._form.querySelectorAll("[name]")).filter((r) => {
491
+ let i = r.getAttribute("name") || "";
492
+ return i === e || t(i) === n;
493
+ }), i = r.filter((e) => e.tagName === "MINT-SELECT");
494
+ if (i.length > 0) {
495
+ let t = [];
496
+ return i.forEach((n) => {
497
+ let r = n.querySelector("select[name=\"" + e + "\"]");
498
+ r && t.push(r);
499
+ }), r.filter((e) => e.tagName !== "MINT-SELECT").concat(t);
497
500
  }
498
- if (t.filter((e) => e.tagName === "MINT-TAGS").length > 0) return t.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags"));
499
- let r = t.filter((e) => e.tagName === "INPUT" && e.closest("mint-tags"));
500
- if (r.length > 0) {
501
+ if (r.filter((e) => e.tagName === "MINT-TAGS").length > 0) return r.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags"));
502
+ let a = r.filter((e) => e.tagName === "INPUT" && e.closest("mint-tags"));
503
+ if (a.length > 0) {
501
504
  let e = [];
502
- return r.forEach((t) => {
505
+ return a.forEach((t) => {
503
506
  let n = t.closest("mint-tags");
504
507
  n && !e.includes(n) && e.push(n);
505
- }), t.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags")).concat(e);
508
+ }), r.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags")).concat(e);
506
509
  }
507
- return t;
510
+ return r;
508
511
  }
509
512
  _extractFieldValue(e) {
510
513
  if (e.length === 0) return "";
@@ -593,6 +596,23 @@ var t = class extends HTMLElement {
593
596
  this._clearErrors(), Object.entries(e).forEach(([e, t]) => {
594
597
  let n = Array.isArray(t) ? t[0] || "Validation error" : t || "Validation error", r = this._getFieldElements(e);
595
598
  r.length > 0 && (this._errors[e] = n, this._flagFieldError(r, n));
599
+ }), this._scrollToFirstError();
600
+ }
601
+ _scrollToFirstError() {
602
+ let e = this.querySelector("[data-mint-form-error]");
603
+ e && requestAnimationFrame(() => {
604
+ let t = this._resolveHost(e) || e;
605
+ t.scrollIntoView({
606
+ behavior: "smooth",
607
+ block: "center",
608
+ inline: "nearest"
609
+ });
610
+ let n = t.matches("input,textarea,select,button,[tabindex]") ? t : t.querySelector("input,textarea,select,button,[tabindex]") || t;
611
+ try {
612
+ n.focus({ preventScroll: !0 });
613
+ } catch {
614
+ n.focus();
615
+ }
596
616
  });
597
617
  }
598
618
  _parseFormData(e) {
@@ -1 +1 @@
1
- const e=require(`../chunks/register-element-tCL_F1YI.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`action`,`method`,`enctype`,`data-form-data`,`loading`,`headers`,`submitting`]}constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null,this._formData=null,this._headers=null,this._buttonStates=new Map,this._attrSubmittingMintFields=new Map,this._attrSubmittingNativeFields=new Map,this._attrSubmittingMintButtons=new Map,this._attrSubmittingNativeButtons=new Map,this._reactiveDataProxy=null,this._reactiveDataObserver=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,this._formDataApplyGeneration=0}connectedCallback(){this._render(),this._ensureSubmitHandler(),this._setupBlurValidation();let e=this.getAttribute(`headers`);e&&this._parseHeaders(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this._formData)this._isReactiveObject(this._formData)?this._setupObjectDataObserver(this._formData):this._lastDataSnapshot||=this._createDataSnapshot(this._formData),this._applyFormData();else{let e=this.getAttribute(`data-form-data`);e&&(this._parseFormData(e),this._applyFormData())}this._propagateLoadingState(),this._applySubmittingAttributeState()})})}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener(`submit`,this._hostSubmitHandler),this._restoreSubmittingAttributeState(),this._cleanupBlurValidation(),this._stopReactiveDataObserver()}reset(){this._clearErrors(),this._formDataApplyGeneration+=1,this._formData?(this._lastAppliedDataSnapshot=null,this._applyFormData()):this.clear()}clear(){this._clearErrors(),this._formDataApplyGeneration+=1,this._form&&this._form.reset(),this._resetCustomFields();let e=this._formData?this._getObjectValue(this._formData):null;e&&typeof e==`object`&&!Array.isArray(e)&&(this._lastAppliedDataSnapshot=this._createDataSnapshot(this._extractReactiveData(e)))}submit(){if(this._form){if(typeof this._form.requestSubmit==`function`){this._form.requestSubmit();return}this._handleSubmit(new Event(`submit`,{bubbles:!0,cancelable:!0}))}}attributeChangedCallback(e,t,n){e===`form-data`?(this._parseFormData(n),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})):e===`headers`?this._parseHeaders(n):e===`loading`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._propagateLoadingState()}):this._propagateLoadingState():e===`submitting`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._applySubmittingAttributeState()}):this._applySubmittingAttributeState():this._applyFormAttributes()}get data(){return this._formData}set data(e){e!==this._formData&&(this._formDataApplyGeneration+=1,this._stopReactiveDataObserver(),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,e&&typeof e==`object`&&!Array.isArray(e)?(this._formData=e,this._isReactiveObject(e)?this._setupObjectDataObserver(e):this._lastDataSnapshot=this._createDataSnapshot(e)):e==null?this._formData=null:this._parseFormData(e),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})}))}get headers(){return this._headers}set headers(e){if(e&&typeof e==`object`&&!Array.isArray(e))this._headers=e;else if(e==null)this._headers=null;else if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_render(){if(this.classList.add(`mint-form-host`),!this._form){for(this._form=document.createElement(`form`),this._form.classList.add(`mint-form-content`),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form)}this._ensureSubmitHandler(),this._applyFormAttributes()}_ensureSubmitHandler(){this._form&&(this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._submitHandler=e=>{e.preventDefault(),e.stopImmediatePropagation(),this._handleSubmit(e)},this._form.addEventListener(`submit`,this._submitHandler,!0))}_applyFormAttributes(){if(!this._form)return;let e=this.getAttribute(`action`)||``,t=this.getAttribute(`method`)||``,n=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;e&&(this._form.action=e),t&&(this._form.method=t),this._form.enctype=n}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();let t=this._collectValidationRules(),n=new FormData(this._form),r=this._formDataToValues(n);if(this._formData){let e=this._getObjectValue(this._formData);e&&typeof e==`object`&&!Array.isArray(e)&&(r={...this._extractReactiveData(e),...r})}let i=this._collectLiveControlValues();if(r={...r,...i},!this._validate(r,t)){this.dispatchEvent(new CustomEvent(`invalid`,{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}let a=new CustomEvent(`submit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),a.form=this;let o=new CustomEvent(`mintFormSubmit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});if(o.form=this,this.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented)return;let s=this.getAttribute(`action`),c=this.getAttribute(`method`);if(!(!s||!c)){this._setButtonsSubmitting();try{let e=await this._submitData(n,r);this.dispatchEvent(new CustomEvent(`submitsuccess`,{detail:e,bubbles:!0,cancelable:!0}))}catch(e){e?.status===422&&e?.data?.errors&&this._applyServerErrors(e.data.errors),this.dispatchEvent(new CustomEvent(`submiterror`,{detail:{error:e},bubbles:!0,cancelable:!0}))}finally{this._restoreButtonsState()}}}async _submitData(e,t){let n=this.getAttribute(`action`),r=this.getAttribute(`method`),i=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;if(!n)return{status:0,ok:!0,data:{values:t}};let a=Array.from(e.values()).some(e=>e instanceof File),o=null,s={},c=n;if(typeof window<`u`&&window.mintForm?.defaults?.headers?.common&&Object.assign(s,window.mintForm.defaults.headers.common),this._headers&&Object.assign(s,this._headers),r===`GET`){let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),c+=(n.includes(`?`)?`&`:`?`)+t.toString()}else if(i===`multipart/form-data`||a)o=e;else if(i===`application/json`)o=JSON.stringify(t),s[`Content-Type`]=`application/json`;else{let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),o=t,s[`Content-Type`]=`application/x-www-form-urlencoded`}if(typeof fetch==`function`)try{let e=await fetch(c,{method:r||`POST`,body:r===`GET`?null:o,headers:s}),t=await e.text().catch(()=>``),n=t;try{n=JSON.parse(t)}catch{}if(!e.ok){let t={status:e.status,data:n,response:{status:e.status,data:n}};throw await this._applyErrorInterceptors(t)}let i={status:e.status,ok:e.ok,data:n};return await this._applySuccessInterceptors(i)}catch(e){if(e.response)throw e;let t={status:e.status||0,data:e.data||e.message||`Network error`,response:{status:e.status||0,data:e.data||e.message||`Network error`}};throw await this._applyErrorInterceptors(t)}let l=this;return await new Promise(async(e,t)=>{let n=new XMLHttpRequest;n.open(r||`POST`,c,!0),Object.entries(s).forEach(([e,t])=>n.setRequestHeader(e,t)),n.onload=async function(){let{status:r,responseText:i}=n;if(r>=200&&r<300){let n=i;try{n=JSON.parse(i)}catch{}try{let t={status:r,ok:!0,data:n};e(await l._applySuccessInterceptors(t))}catch(e){t(e)}}else{let e=i;try{e=JSON.parse(i)}catch{}try{let n={status:r,data:e,response:{status:r,data:e}};t(await l._applyErrorInterceptors(n))}catch(e){t(e)}}},n.onerror=async function(){try{let e={status:n.status||0,data:n.responseText||`Network error`,response:{status:n.status||0,data:n.responseText||`Network error`}};t(await l._applyErrorInterceptors(e))}catch(e){t(e)}},n.send(r===`GET`?null:o)})}async _applySuccessInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return e;let t=e,n=window.mintForm.interceptors.response.handlers;for(let e of n)e.fulfilled&&(t=await e.fulfilled(t));return t}async _applyErrorInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return Promise.reject(e);let t=e,n=window.mintForm.interceptors.response.handlers;for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.rejected)try{if(t=await r.rejected(t),t!==void 0)return t}catch(e){t=e}}return Promise.reject(t)}_formDataToValues(e){let t={};return e.forEach((e,n)=>{e instanceof File?(t[n]||(t[n]=[]),t[n].push(e)):n in t?Array.isArray(t[n])?(t[n].length>0&&t[n][0]instanceof File,t[n].push(e)):t[n]=[t[n],e]:t[n]=e}),this._form&&(Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n&&e.files!==void 0&&e.files){let r=e.files;if(r.length>0){let e=Array.from(r);t[n]&&Array.isArray(t[n])?e.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=e}}}),Array.from(this._form.querySelectorAll(`input[type="file"][name]`)).forEach(e=>{let n=e.name;if(n&&e.files&&e.files.length>0){let r=Array.from(e.files);t[n]&&Array.isArray(t[n])?r.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=r}}),Array.from(this._form.querySelectorAll(`mint-tags[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n){let r=[];e.tags===void 0?typeof e.getTags==`function`&&(r=e.getTags()):r=e.tags,Array.isArray(r)&&r.length>0?t[n]=r.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):t[n]=[]}})),t}_isControlDisabledForSubmit(e){let t=e;for(;t&&t!==this._form;){if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLButtonElement)&&t.disabled)return!0;let e=t.getAttribute(`disabled`);if(e!==null&&e!==`false`)return!0;t=t.parentElement}return!1}_collectLiveControlValues(){let e={};if(!this._form)return e;let t=new Set,n=Array.from(this._form.querySelectorAll([`input[name]`,`textarea[name]`,`select[name]`,`mint-input[name]`,`mint-select[name]`,`mint-date-picker[name]`,`mint-datetime-picker[name]`,`mint-time-picker[name]`,`mint-dropzone[name]`,`mint-checkbox[name]`,`mint-choice[name]`,`mint-switch[name]`,`mint-tags[name]`].join(`,`)));for(let e of n){let n=e.getAttribute(`name`);!n||this._isControlDisabledForSubmit(e)||t.add(n)}for(let n of t){let t=this._getFieldElements(n).filter(e=>!this._isControlDisabledForSubmit(e));if(t.length!==0)try{let r=this._extractFieldValue(t),i=r instanceof FileList?Array.from(r):r,a=e=>e instanceof HTMLInputElement?e.type===`checkbox`||e.type===`radio`:[`MINT-CHECKBOX`,`MINT-CHOICE`,`MINT-SWITCH`].includes(e.tagName),o=t.length===1&&[`MINT-CHECKBOX`,`MINT-SWITCH`].includes(t[0].tagName);if(t.every(a)&&!o&&(i===``||i==null||Array.isArray(i)&&i.length===0))continue;e[n]=i}catch{}}return e}_collectValidationRules(){let e={};return this._form&&Array.from(this._form.querySelectorAll(`[name][validation]`)).forEach(t=>{let n=t.getAttribute(`name`)||``,r=t.getAttribute(`validation`);if(!n||!r)return;let i=this._parseRules(r);i.length&&(e[n]=i)}),e}_parseRules(e){if(!e)return[];try{let t=e.replace(/'/g,`"`),n=JSON.parse(t);if(Array.isArray(n))return n.map(e=>String(e))}catch{}return e.split(`,`).map(e=>e.trim()).filter(Boolean)}_validate(e,t){let n=!0;return this._errors={},Object.entries(t||{}).forEach(([e,t])=>{let r=Array.isArray(t)?t:[t],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(n=!1,this._errors[e]=o,this._flagFieldError(i,o)):this._clearFieldError(i)}),n}_validateField(e){let t=this._collectValidationRules();if(!t[e])return;let n=t[e],r=Array.isArray(n)?n:[n],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(this._errors[e]=o,this._flagFieldError(i,o)):(this._clearFieldError(i),delete this._errors[e])}_validateRules(e,t){let n=t.some(e=>e.split(`:`)[0].trim()===`number`);for(let r of t){let[t,i]=r.split(`:`);switch(t){case`required`:if(e==null||e===!1||typeof e==`string`&&e.trim()===``||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return`This field is required.`;break;case`string`:if(typeof e!=`string`)return`Must be a string.`;break;case`email`:if(typeof e==`string`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return`Enter a valid email.`;break;case`number`:{let t=Number(e);if(Number.isNaN(t))return`Must be a number.`;break}case`min`:{let t=Number(i);if(Number.isNaN(t))break;if(typeof e==`string`&&!n){if(e.trim().length<t)return`Must be at least ${t} characters.`;break}if(typeof e==`string`&&n){let n=Number(e);if(!Number.isNaN(n)&&n<t)return`Must be at least ${t}.`;break}if(Array.isArray(e)&&e.length<t)return`Select at least ${t}.`;if(e instanceof FileList&&e.length<t)return`Upload at least ${t} files.`;if(typeof e==`number`&&e<t)return`Must be at least ${t}.`;break}case`max`:{let t=Number(i);if(Number.isNaN(t))break;if(typeof e==`string`&&!n){if(e.trim().length>t)return`Must be at most ${t} characters.`;break}if(typeof e==`string`&&n){let n=Number(e);if(!Number.isNaN(n)&&n>t)return`Must be at most ${t}.`;break}if(Array.isArray(e)&&e.length>t)return`Select no more than ${t}.`;if(e instanceof FileList&&e.length>t)return`Upload no more than ${t} files.`;if(typeof e==`number`&&e>t)return`Must be at most ${t}.`;break}default:break}}return null}_getFieldElements(e){if(!this._form)return[];let t=Array.from(this._form.querySelectorAll(`[name="${e}"]`)),n=t.filter(e=>e.tagName===`MINT-SELECT`);if(n.length>0){let r=[];return n.forEach(t=>{let n=t.querySelector(`select[name="`+e+`"]`);n&&r.push(n)}),t.filter(e=>e.tagName!==`MINT-SELECT`).concat(r)}if(t.filter(e=>e.tagName===`MINT-TAGS`).length>0)return t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`));let r=t.filter(e=>e.tagName===`INPUT`&&e.closest(`mint-tags`));if(r.length>0){let e=[];return r.forEach(t=>{let n=t.closest(`mint-tags`);n&&!e.includes(n)&&e.push(n)}),t.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`)).concat(e)}return t}_extractFieldValue(e){if(e.length===0)return``;let t=e.find(e=>e instanceof HTMLSelectElement);if(t)return t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value;if(e.length>1){let t=e.filter(e=>e instanceof HTMLInputElement);if(t.length>0&&t.length===e.length){let e=t.filter(e=>e.checked);if(t.every(e=>e.type===`radio`))return e.length>0?e[0].value||`on`:``;if(t.every(e=>e.type===`checkbox`))return e.map(e=>e.value||`on`)}let n=e.filter(e=>e.tagName===`MINT-CHOICE`);if(n.length>0&&n.length===e.length){let e=n.find(e=>typeof e.getValue==`function`?e.getValue()!==``:e.querySelector(`mint-choice-option[checked]`)!==null);if(e){if(typeof e.getValue==`function`)return e.getValue();let t=e.querySelector(`mint-choice-option[checked]`);if(t)return t.getAttribute(`value`)||``}return``}let r=e.filter(e=>e.tagName===`MINT-CHECKBOX`);if(r.length>0&&r.length===e.length)return r.filter(e=>e.checked===void 0?e.hasAttribute(`checked`):e.checked).map(e=>e.getAttribute(`value`)||`on`)}let n=e[0];if(n instanceof HTMLInputElement)return n.type===`file`?n.files:n.type===`checkbox`||n.type===`radio`?n.checked?n.value||`on`:``:this._normalizeInputValue(n.value,n.type);if(n instanceof HTMLTextAreaElement)return String(n.value);if(n.tagName===`MINT-SELECT`){let e=n.querySelector(`select`);if(e)return e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value;if(typeof n.getValue==`function`){let e=n.getValue();if(e!=null&&e!==``)return e}return n.getAttribute(`value`)||``}if(n.tagName===`MINT-DROPZONE`&&n.files!==void 0)return n.files;if(n.tagName===`MINT-TAGS`){let e=null;return n.tags===void 0?typeof n.getTags==`function`&&(e=n.getTags()):e=n.tags,Array.isArray(e)?e.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):[]}if(n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`)return!!(n.checked===void 0?n.hasAttribute(`checked`):n.checked);if(n.tagName===`MINT-CHOICE`)return(typeof n.getValue==`function`?n.getValue():``)||``;if(n.tagName===`MINT-INPUT`){let e=typeof n.getType==`function`?n.getType():n.getAttribute(`type`)||`text`,t=typeof n.getValue==`function`?n.getValue():n.value;return this._normalizeInputValue(t,e)}return n.value===void 0?n.getAttribute(`value`)||``:n.value}_normalizeInputValue(e,t){if(e==null)return``;if(t===`number`||t===`range`){if(e===``)return``;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:``}return String(e)}_flagFieldError(e,t){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.setAttribute(`aria-invalid`,`true`);let n=this._resolveHost(e);n&&(n.setAttribute(`error`,`true`),n.setAttribute(`error-message`,t),n.setAttribute(`data-mint-form-error`,`true`))})}_clearFieldError(e){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.removeAttribute(`aria-invalid`);let t=this._resolveHost(e);t&&(t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`))})}_clearErrors(){this.querySelectorAll(`[data-mint-form-error]`).forEach(e=>{let t=e;t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`)}),this._form&&this._form.querySelectorAll(`[aria-invalid="true"]`).forEach(e=>{e.removeAttribute(`aria-invalid`)}),this._errors={}}setFormErrors(e){this._applyServerErrors(e)}_applyServerErrors(e){this._clearErrors(),Object.entries(e).forEach(([e,t])=>{let n=Array.isArray(t)?t[0]||`Validation error`:t||`Validation error`,r=this._getFieldElements(e);r.length>0&&(this._errors[e]=n,this._flagFieldError(r,n))})}_parseFormData(e){if(!e){this._formData=null;return}if(typeof e==`object`&&!Array.isArray(e)){this._formData=e;return}if(typeof e==`string`)try{this._formData=JSON.parse(e)}catch{this._formData=null}else this._formData=null}_parseHeaders(e){if(!e){this._headers=null;return}if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_applyFormData(){if(!this._formData||!this._form)return;let e=this._getObjectValue(this._formData);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=(e,t)=>{let n=new Set;return t?(Object.keys(e).forEach(r=>{JSON.stringify(t[r])!==JSON.stringify(e[r])&&n.add(r)}),Object.keys(t).forEach(t=>{t in e||n.add(t)}),n):(Object.keys(e).forEach(e=>n.add(e)),n)};if(t(this._createDataSnapshot(this._extractReactiveData(e)),this._lastAppliedDataSnapshot).size===0)return;let n=this._formDataApplyGeneration,r=()=>{if(n!==this._formDataApplyGeneration)return;let e=this._formData?this._getObjectValue(this._formData):null;if(!e||typeof e!=`object`||Array.isArray(e))return;let r=this._createDataSnapshot(this._extractReactiveData(e)),i=t(r,this._lastAppliedDataSnapshot);i.size!==0&&(i.forEach(e=>{let t=r[e],i=this._getFieldElements(e);if(i.length===0){setTimeout(()=>{if(n!==this._formDataApplyGeneration)return;let t=this._getFieldElements(e);if(t.length===0)return;let r=this._formData?this._getObjectValue(this._formData):null;if(!r||typeof r!=`object`||Array.isArray(r))return;let i=this._extractReactiveData(r)[e];this._applyValueToField(t,e,i)},300);return}this._applyValueToField(i,e,t)}),this._lastAppliedDataSnapshot=r)};requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})}_applyValueToField(e,t,n){e.forEach(e=>{let r=e.tagName;try{if(r===`MINT-INPUT`)e.value!==void 0&&(e.value=n||``);else if(r===`MINT-DATE-PICKER`)typeof e.setValue==`function`&&e.setValue(n||``);else if(r===`MINT-TIME-PICKER`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.value!==void 0&&(e.value=n==null?``:String(n));else if(r===`MINT-SELECT`||r===`SELECT`)if(r===`SELECT`){let t=e,r=t.closest(`mint-select`);if(r&&typeof r.setValue==`function`)r.setValue(n);else if(t.multiple){let e=Array.isArray(n)?n.map(e=>String(e)):n==null||n===``?[]:[String(n)];Array.from(t.options).forEach(t=>{t.selected=e.includes(t.value)})}else t.value=n==null?``:String(n)}else typeof e.setValue==`function`&&e.setValue(n);else if(r===`MINT-CHOICE`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=e.getAttribute(`value`)===n});else if(r===`MINT-CHECKBOX`||r===`MINT-SWITCH`){let t=n===!0||n===`true`||n===`on`||n===1||n===`1`;e.checked===void 0?t?e.setAttribute(`checked`,`true`):e.removeAttribute(`checked`):e.checked=t}else if(r===`MINT-TAGS`)if(Array.isArray(n)){let t=new Map;try{let n=e.getAttribute(`predefined-tags`);if(n){let e=JSON.parse(n);Array.isArray(e)&&(t=new Map(e.map(e=>{if(typeof e==`string`){let t=e.trim();return t?[t.toLowerCase(),t]:null}if(!e||typeof e!=`object`)return null;let t=String(e.value??``).trim();if(!t)return null;let n=String(e.label??t);return[t.toLowerCase(),n]}).filter(e=>e!==null)))}}catch{}e.tags!==void 0&&(e.tags=n.map(e=>{if(typeof e==`string`||typeof e==`number`){let n=String(e).trim();return{value:n,label:t.get(n.toLowerCase())||n,dismissable:!0}}if(e&&typeof e==`object`){let n=String(e.value??``).trim(),r=t.get(n.toLowerCase())||String(e.label??n);return{...e,value:n,label:r,dismissable:e.dismissable!==!1}}return e}))}else e.tags!==void 0&&(e.tags=[]);else if(e instanceof HTMLInputElement){if(e.type===`file`)return;e.type===`checkbox`||e.type===`radio`?e.checked=n===!0||n===`true`||n===`on`||n===1||n===`1`:e.value=n||``}else (e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=n||``)}catch(e){console.warn(`Failed to set value for field ${t}:`,e)}})}_resetCustomFields(){this.querySelectorAll(`mint-input, mint-date-picker, mint-datetime-picker, mint-time-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{e.removeAttribute(`error`),e.removeAttribute(`error-message`);let t=e.tagName;if(t===`MINT-INPUT`)try{e.value=``}catch{}else if(t===`MINT-DATE-PICKER`)try{e.setValue?.(``)}catch{}else if(t===`MINT-SELECT`)try{e.setValue?.(``)}catch{}else if(t===`MINT-DROPZONE`){let t=e.querySelector(`input[type="file"]`);t&&(t.value=``)}else if(t===`MINT-CHECKBOX`||t===`MINT-SWITCH`)try{if(e.checked!==void 0)e.checked=!1;else{e.removeAttribute(`checked`);let t=e.querySelector(`input[type="checkbox"], input[type="radio"]`);t&&(t.checked=!1)}}catch{}else if(t===`MINT-CHOICE`)try{typeof e.setValue==`function`?e.setValue(``):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=!1})}catch{}else if(t===`MINT-TAGS`)try{e.tags=[]}catch{}})}_resolveHost(e){if(e.tagName===`MINT-CHOICE-OPTION`){let t=e.closest(`mint-choice`);if(t)return t}return e.closest(`mint-input, mint-date-picker, mint-datetime-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)||e}_setupBlurValidation(){if(!this._form)return;let e=e=>{let t=e.target;if(!t)return;let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);if(!r||!this._collectValidationRules()[r])return;let i=this._extractFieldValue([n]),a=i!=null&&(typeof i==`string`?i.trim()!==``:i instanceof FileList||Array.isArray(i)?i.length>0:!0),o=n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&(t.hasAttribute(`aria-invalid`)||t.closest(`[data-mint-form-error]`)),s=!!n.closest(`mint-tags`),c=n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`||n.tagName===`MINT-CHOICE`||t instanceof HTMLElement&&(t.closest(`mint-checkbox, mint-switch, mint-choice`)||t.closest(`mint-choice-option`)),l=n.tagName===`MINT-DATE-PICKER`||t instanceof HTMLElement&&t.closest(`mint-date-picker, mint-datetime-picker`);(a||o||s||c||l)&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`blur`,e,!0),this._fieldBlurHandlers.set(this._form,e);let t=e=>{let t=e.target;if(!t)return;if(!(t instanceof HTMLInputElement&&t.type===`file`)){let e=this._findFieldElement(t),n=e?this._getFieldName(e):null;e&&n&&this._syncFieldToReactiveData(e,n)}if(e.type===`tags-change`&&t.tagName===`MINT-TAGS`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLSelectElement||t.tagName===`MINT-SELECT`||t.closest(`mint-select`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(e.type===`choice-change`&&t.tagName===`MINT-CHOICE`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLInputElement&&t.type===`checkbox`||t.tagName===`MINT-CHECKBOX`||t.tagName===`MINT-SWITCH`||t.closest(`mint-checkbox, mint-switch`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);r&&this._collectValidationRules()[r]&&(n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&t.hasAttribute(`aria-invalid`))&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`change`,t,!0),this._form.addEventListener(`input`,t,!0),this._form.addEventListener(`tags-change`,t,!0),this._form.addEventListener(`choice-change`,t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){let t=e.closest(`mint-input, mint-date-picker, mint-datetime-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`);if(t&&t.hasAttribute(`name`))return t;if(e.hasAttribute(`name`)&&(e.tagName.startsWith(`MINT-`)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)||(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute(`name`))return e;let n=e;for(;n&&n!==this._form;){if(n.hasAttribute(`name`))return n;n=n.parentElement}return null}_getFieldName(e){return e.hasAttribute(`name`)||e.tagName.startsWith(`MINT-`)?e.getAttribute(`name`):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_syncFieldToReactiveData(e,t){if(!this._formData||!t)return;let n=this._getObjectValue(this._formData);if(!n||typeof n!=`object`||Array.isArray(n))return;let r=this._getFieldElements(t),i=this._extractFieldValue(r.length?r:[e]);n[t]=this._normalizeReactiveValue(r,i);let a=this._createDataSnapshot(n);this._lastDataSnapshot=a,this._lastAppliedDataSnapshot={...this._lastAppliedDataSnapshot||a,[t]:a[t]}}_normalizeReactiveValue(e,t){if(t instanceof FileList)return Array.from(t);if(Array.isArray(t))return t;let n=e[0];return e.length===1&&(n instanceof HTMLInputElement&&n.type===`checkbox`||n?.tagName===`MINT-CHECKBOX`||n?.tagName===`MINT-SWITCH`)?!!t:t??``}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){let e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener(`blur`,e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){let e=this._fieldChangeHandlers.get(this._form);e&&(this._form.removeEventListener(`change`,e,!0),this._form.removeEventListener(`input`,e,!0),this._form.removeEventListener(`tags-change`,e,!0),this._form.removeEventListener(`choice-change`,e,!0)),this._fieldChangeHandlers.delete(this._form)}this._observer&&=(this._observer.disconnect(),null)}_syncDropzoneFiles(){this._form&&Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{typeof e.syncFiles==`function`&&e.syncFiles()})}_isSubmittingAttrActive(){let e=this.getAttribute(`submitting`);return e!==null&&e!==`false`}_applySubmittingAttributeState(){if(this._form){if(!this._isSubmittingAttrActive()){this._restoreSubmittingAttributeState();return}this._attrSubmittingMintFields.size>0||this._attrSubmittingNativeFields.size>0||this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0||(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`;this._attrSubmittingMintFields.set(e,t),t||e.setAttribute(`disabled`,`true`),typeof e.render==`function`&&e.render()}),this._form.querySelectorAll(`input, textarea, select`).forEach(e=>{if(e.closest(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags, mint-button`)||e instanceof HTMLInputElement&&e.type===`hidden`)return;let t=e.disabled;this._attrSubmittingNativeFields.set(e,t),t||(e.disabled=!0)}),Array.from(this.querySelectorAll(`mint-button`)).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._attrSubmittingMintButtons.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&!n&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),Array.from(this.querySelectorAll(`button`)).forEach(e=>{if(e.closest(`mint-button, mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`))return;let t=e.disabled;this._attrSubmittingNativeButtons.set(e,t),t||(e.disabled=!0)}))}}_restoreSubmittingAttributeState(){this._attrSubmittingMintFields.forEach((e,t)=>{e?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintFields.clear(),this._attrSubmittingNativeFields.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeFields.clear(),this._attrSubmittingMintButtons.forEach((e,t)=>{e.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),e.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintButtons.clear(),this._attrSubmittingNativeButtons.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeButtons.clear()}_propagateLoadingState(){if(!this._form)return;let e=this.getAttribute(`loading`),t=e!==null&&e!==`false`;Array.from(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)).forEach(e=>{t?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render()})}_setButtonsSubmitting(){if(!this._form)return;this._buttonStates.clear();let e=Array.from(this.querySelectorAll(`mint-button`)),t=Array.from(this.querySelectorAll(`button`));e.forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._buttonStates.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),t.forEach(e=>{if(e.closest(`mint-button`))return;let t=e.disabled;this._buttonStates.set(e,{disabled:t,loading:!1}),t||(e.disabled=!0)})}_restoreButtonsState(){if(!this._form)return;let e=this._isSubmittingAttrActive()&&(this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0),t=Array.from(this.querySelectorAll(`mint-button`)),n=Array.from(this.querySelectorAll(`button`));t.forEach(t=>{if(e&&this._attrSubmittingMintButtons.has(t))return;let n=this._buttonStates.get(t);n&&(n.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),n.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render())}),n.forEach(t=>{if(t.closest(`mint-button`)||e&&this._attrSubmittingNativeButtons.has(t))return;let n=this._buttonStates.get(t);n&&(t.disabled=n.disabled)}),this._buttonStates.clear()}_isReactiveObject(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}_createDataSnapshot(e){try{let t=this._extractReactiveData(e);return JSON.parse(JSON.stringify(t))}catch{return{...this._extractReactiveData(e)}}}_extractReactiveData(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>this._extractReactiveData(e));let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this._extractReactiveData(t[n]));return e}return t}_hasDataChanged(e,t){try{return JSON.stringify(e)!==JSON.stringify(t)}catch{return!0}}_getObjectValue(e){return e}_setupObjectDataObserver(e){if(this._stopReactiveDataObserver(),!this.isConnected)return;let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t))this._lastDataSnapshot=this._createDataSnapshot(t);else{this._lastDataSnapshot=null;return}let n=()=>{if(!this._formData||!this._lastDataSnapshot){this._stopReactiveDataObserver();return}let e=this._getObjectValue(this._formData);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=this._createDataSnapshot(e);this._hasDataChanged(t,this._lastDataSnapshot)&&(this._lastDataSnapshot=t,requestAnimationFrame(()=>{this._applyFormData()}))}this.isConnected&&this._formData?this._reactiveDataObserver=requestAnimationFrame(n):this._stopReactiveDataObserver()};this._reactiveDataObserver=requestAnimationFrame(n)}_stopReactiveDataObserver(){this._reactiveDataObserver!==null&&(cancelAnimationFrame(this._reactiveDataObserver),this._reactiveDataObserver=null),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}};customElements.get(`mint-form`)||e.t(`mint-form`,t),typeof window<`u`&&(window.mintForm=window.mintForm||{defaults:{headers:{common:{}}},interceptors:{response:{handlers:[]}}},window.mintForm.interceptors.response.use||(window.mintForm.interceptors.response.use=function(e,t){return window.mintForm.interceptors.response.handlers.push({fulfilled:e,rejected:t}),window.mintForm.interceptors.response.handlers.length-1})),module.exports=t;
1
+ const e=require(`../chunks/register-element-tCL_F1YI.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`action`,`method`,`enctype`,`data-form-data`,`loading`,`headers`,`submitting`]}constructor(){super(),this._form=null,this._submitHandler=null,this._hostSubmitHandler=null,this._errors={},this._fieldBlurHandlers=new Map,this._fieldChangeHandlers=new Map,this._observer=null,this._formData=null,this._headers=null,this._buttonStates=new Map,this._attrSubmittingMintFields=new Map,this._attrSubmittingNativeFields=new Map,this._attrSubmittingMintButtons=new Map,this._attrSubmittingNativeButtons=new Map,this._reactiveDataProxy=null,this._reactiveDataObserver=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,this._formDataApplyGeneration=0}connectedCallback(){this._render(),this._ensureSubmitHandler(),this._setupBlurValidation();let e=this.getAttribute(`headers`);e&&this._parseHeaders(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this._formData)this._isReactiveObject(this._formData)?this._setupObjectDataObserver(this._formData):this._lastDataSnapshot||=this._createDataSnapshot(this._formData),this._applyFormData();else{let e=this.getAttribute(`data-form-data`);e&&(this._parseFormData(e),this._applyFormData())}this._propagateLoadingState(),this._applySubmittingAttributeState()})})}disconnectedCallback(){this._form&&this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._hostSubmitHandler&&this.removeEventListener(`submit`,this._hostSubmitHandler),this._restoreSubmittingAttributeState(),this._cleanupBlurValidation(),this._stopReactiveDataObserver()}reset(){this._clearErrors(),this._formDataApplyGeneration+=1,this._formData?(this._lastAppliedDataSnapshot=null,this._applyFormData()):this.clear()}clear(){this._clearErrors(),this._formDataApplyGeneration+=1,this._form&&this._form.reset(),this._resetCustomFields();let e=this._formData?this._getObjectValue(this._formData):null;e&&typeof e==`object`&&!Array.isArray(e)&&(this._lastAppliedDataSnapshot=this._createDataSnapshot(this._extractReactiveData(e)))}submit(){if(this._form){if(typeof this._form.requestSubmit==`function`){this._form.requestSubmit();return}this._handleSubmit(new Event(`submit`,{bubbles:!0,cancelable:!0}))}}attributeChangedCallback(e,t,n){e===`form-data`?(this._parseFormData(n),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})):e===`headers`?this._parseHeaders(n):e===`loading`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._propagateLoadingState()}):this._propagateLoadingState():e===`submitting`?this.isConnected&&this._form?requestAnimationFrame(()=>{this._applySubmittingAttributeState()}):this._applySubmittingAttributeState():this._applyFormAttributes()}get data(){return this._formData}set data(e){e!==this._formData&&(this._formDataApplyGeneration+=1,this._stopReactiveDataObserver(),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null,e&&typeof e==`object`&&!Array.isArray(e)?(this._formData=e,this._isReactiveObject(e)?this._setupObjectDataObserver(e):this._lastDataSnapshot=this._createDataSnapshot(e)):e==null?this._formData=null:this._parseFormData(e),this.isConnected&&this._form&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._applyFormData()})})}))}get headers(){return this._headers}set headers(e){if(e&&typeof e==`object`&&!Array.isArray(e))this._headers=e;else if(e==null)this._headers=null;else if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_render(){if(this.classList.add(`mint-form-host`),!this._form){for(this._form=document.createElement(`form`),this._form.classList.add(`mint-form-content`),this._form.noValidate=!0;this.firstChild;)this._form.appendChild(this.firstChild);this.appendChild(this._form)}this._ensureSubmitHandler(),this._applyFormAttributes()}_ensureSubmitHandler(){this._form&&(this._submitHandler&&this._form.removeEventListener(`submit`,this._submitHandler,!0),this._submitHandler=e=>{e.preventDefault(),e.stopImmediatePropagation(),this._handleSubmit(e)},this._form.addEventListener(`submit`,this._submitHandler,!0))}_applyFormAttributes(){if(!this._form)return;let e=this.getAttribute(`action`)||``,t=this.getAttribute(`method`)||``,n=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;e&&(this._form.action=e),t&&(this._form.method=t),this._form.enctype=n}async _handleSubmit(e){if(e.preventDefault(),!this._form)return;this._clearErrors(),this._syncDropzoneFiles();let t=this._collectValidationRules(),n=new FormData(this._form),r=this._formDataToValues(n);if(this._formData){let e=this._getObjectValue(this._formData);e&&typeof e==`object`&&!Array.isArray(e)&&(r={...this._extractReactiveData(e),...r})}let i=this._collectLiveControlValues();if(r={...r,...i},!this._validate(r,t)){this.dispatchEvent(new CustomEvent(`invalid`,{detail:{errors:this._errors},bubbles:!0,cancelable:!0,composed:!0}));return}let a=new CustomEvent(`submit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(a),a.form=this;let o=new CustomEvent(`mintFormSubmit`,{detail:{formData:n,values:r,form:this},bubbles:!0,cancelable:!0,composed:!0});if(o.form=this,this.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented)return;let s=this.getAttribute(`action`),c=this.getAttribute(`method`);if(!(!s||!c)){this._setButtonsSubmitting();try{let e=await this._submitData(n,r);this.dispatchEvent(new CustomEvent(`submitsuccess`,{detail:e,bubbles:!0,cancelable:!0}))}catch(e){e?.status===422&&e?.data?.errors&&this._applyServerErrors(e.data.errors),this.dispatchEvent(new CustomEvent(`submiterror`,{detail:{error:e},bubbles:!0,cancelable:!0}))}finally{this._restoreButtonsState()}}}async _submitData(e,t){let n=this.getAttribute(`action`),r=this.getAttribute(`method`),i=this.getAttribute(`enctype`)||`application/x-www-form-urlencoded`;if(!n)return{status:0,ok:!0,data:{values:t}};let a=Array.from(e.values()).some(e=>e instanceof File),o=null,s={},c=n;if(typeof window<`u`&&window.mintForm?.defaults?.headers?.common&&Object.assign(s,window.mintForm.defaults.headers.common),this._headers&&Object.assign(s,this._headers),r===`GET`){let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),c+=(n.includes(`?`)?`&`:`?`)+t.toString()}else if(i===`multipart/form-data`||a)o=e;else if(i===`application/json`)o=JSON.stringify(t),s[`Content-Type`]=`application/json`;else{let t=new URLSearchParams;e.forEach((e,n)=>{e instanceof File||t.append(n,String(e))}),o=t,s[`Content-Type`]=`application/x-www-form-urlencoded`}if(typeof fetch==`function`)try{let e=await fetch(c,{method:r||`POST`,body:r===`GET`?null:o,headers:s}),t=await e.text().catch(()=>``),n=t;try{n=JSON.parse(t)}catch{}if(!e.ok){let t={status:e.status,data:n,response:{status:e.status,data:n}};throw await this._applyErrorInterceptors(t)}let i={status:e.status,ok:e.ok,data:n};return await this._applySuccessInterceptors(i)}catch(e){if(e.response)throw e;let t={status:e.status||0,data:e.data||e.message||`Network error`,response:{status:e.status||0,data:e.data||e.message||`Network error`}};throw await this._applyErrorInterceptors(t)}let l=this;return await new Promise(async(e,t)=>{let n=new XMLHttpRequest;n.open(r||`POST`,c,!0),Object.entries(s).forEach(([e,t])=>n.setRequestHeader(e,t)),n.onload=async function(){let{status:r,responseText:i}=n;if(r>=200&&r<300){let n=i;try{n=JSON.parse(i)}catch{}try{let t={status:r,ok:!0,data:n};e(await l._applySuccessInterceptors(t))}catch(e){t(e)}}else{let e=i;try{e=JSON.parse(i)}catch{}try{let n={status:r,data:e,response:{status:r,data:e}};t(await l._applyErrorInterceptors(n))}catch(e){t(e)}}},n.onerror=async function(){try{let e={status:n.status||0,data:n.responseText||`Network error`,response:{status:n.status||0,data:n.responseText||`Network error`}};t(await l._applyErrorInterceptors(e))}catch(e){t(e)}},n.send(r===`GET`?null:o)})}async _applySuccessInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return e;let t=e,n=window.mintForm.interceptors.response.handlers;for(let e of n)e.fulfilled&&(t=await e.fulfilled(t));return t}async _applyErrorInterceptors(e){if(typeof window>`u`||!window.mintForm?.interceptors?.response?.handlers)return Promise.reject(e);let t=e,n=window.mintForm.interceptors.response.handlers;for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.rejected)try{if(t=await r.rejected(t),t!==void 0)return t}catch(e){t=e}}return Promise.reject(t)}_formDataToValues(e){let t={};return e.forEach((e,n)=>{e instanceof File?(t[n]||(t[n]=[]),t[n].push(e)):n in t?Array.isArray(t[n])?(t[n].length>0&&t[n][0]instanceof File,t[n].push(e)):t[n]=[t[n],e]:t[n]=e}),this._form&&(Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n&&e.files!==void 0&&e.files){let r=e.files;if(r.length>0){let e=Array.from(r);t[n]&&Array.isArray(t[n])?e.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=e}}}),Array.from(this._form.querySelectorAll(`input[type="file"][name]`)).forEach(e=>{let n=e.name;if(n&&e.files&&e.files.length>0){let r=Array.from(e.files);t[n]&&Array.isArray(t[n])?r.forEach(e=>{t[n].some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||t[n].push(e)}):t[n]=r}}),Array.from(this._form.querySelectorAll(`mint-tags[name]`)).forEach(e=>{let n=e.getAttribute(`name`);if(n){let r=[];e.tags===void 0?typeof e.getTags==`function`&&(r=e.getTags()):r=e.tags,Array.isArray(r)&&r.length>0?t[n]=r.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):t[n]=[]}})),t}_isControlDisabledForSubmit(e){let t=e;for(;t&&t!==this._form;){if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLButtonElement)&&t.disabled)return!0;let e=t.getAttribute(`disabled`);if(e!==null&&e!==`false`)return!0;t=t.parentElement}return!1}_collectLiveControlValues(){let e={};if(!this._form)return e;let t=new Set,n=Array.from(this._form.querySelectorAll([`input[name]`,`textarea[name]`,`select[name]`,`mint-input[name]`,`mint-select[name]`,`mint-date-picker[name]`,`mint-datetime-picker[name]`,`mint-time-picker[name]`,`mint-dropzone[name]`,`mint-checkbox[name]`,`mint-choice[name]`,`mint-switch[name]`,`mint-tags[name]`].join(`,`)));for(let e of n){let n=e.getAttribute(`name`);!n||this._isControlDisabledForSubmit(e)||t.add(n)}for(let n of t){let t=this._getFieldElements(n).filter(e=>!this._isControlDisabledForSubmit(e));if(t.length!==0)try{let r=this._extractFieldValue(t),i=r instanceof FileList?Array.from(r):r,a=e=>e instanceof HTMLInputElement?e.type===`checkbox`||e.type===`radio`:[`MINT-CHECKBOX`,`MINT-CHOICE`,`MINT-SWITCH`].includes(e.tagName),o=t.length===1&&[`MINT-CHECKBOX`,`MINT-SWITCH`].includes(t[0].tagName);if(t.every(a)&&!o&&(i===``||i==null||Array.isArray(i)&&i.length===0))continue;e[n]=i}catch{}}return e}_collectValidationRules(){let e={};return this._form&&Array.from(this._form.querySelectorAll(`[name][validation]`)).forEach(t=>{let n=t.getAttribute(`name`)||``,r=t.getAttribute(`validation`);if(!n||!r)return;let i=this._parseRules(r);i.length&&(e[n]=i)}),e}_parseRules(e){if(!e)return[];try{let t=e.replace(/'/g,`"`),n=JSON.parse(t);if(Array.isArray(n))return n.map(e=>String(e))}catch{}return e.split(`,`).map(e=>e.trim()).filter(Boolean)}_validate(e,t){let n=!0;return this._errors={},Object.entries(t||{}).forEach(([e,t])=>{let r=Array.isArray(t)?t:[t],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(n=!1,this._errors[e]=o,this._flagFieldError(i,o)):this._clearFieldError(i)}),n||this._scrollToFirstError(),n}_validateField(e){let t=this._collectValidationRules();if(!t[e])return;let n=t[e],r=Array.isArray(n)?n:[n],i=this._getFieldElements(e),a=this._extractFieldValue(i),o=this._validateRules(a,r);o?(this._errors[e]=o,this._flagFieldError(i,o)):(this._clearFieldError(i),delete this._errors[e])}_validateRules(e,t){let n=t.some(e=>e.split(`:`)[0].trim()===`number`);for(let r of t){let[t,i]=r.split(`:`);switch(t){case`required`:if(e==null||e===!1||typeof e==`string`&&e.trim()===``||e instanceof FileList&&e.length===0||Array.isArray(e)&&e.length===0)return`This field is required.`;break;case`string`:if(typeof e!=`string`)return`Must be a string.`;break;case`email`:if(typeof e==`string`&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()))return`Enter a valid email.`;break;case`number`:{let t=Number(e);if(Number.isNaN(t))return`Must be a number.`;break}case`min`:{let t=Number(i);if(Number.isNaN(t))break;if(typeof e==`string`&&!n){if(e.trim().length<t)return`Must be at least ${t} characters.`;break}if(typeof e==`string`&&n){let n=Number(e);if(!Number.isNaN(n)&&n<t)return`Must be at least ${t}.`;break}if(Array.isArray(e)&&e.length<t)return`Select at least ${t}.`;if(e instanceof FileList&&e.length<t)return`Upload at least ${t} files.`;if(typeof e==`number`&&e<t)return`Must be at least ${t}.`;break}case`max`:{let t=Number(i);if(Number.isNaN(t))break;if(typeof e==`string`&&!n){if(e.trim().length>t)return`Must be at most ${t} characters.`;break}if(typeof e==`string`&&n){let n=Number(e);if(!Number.isNaN(n)&&n>t)return`Must be at most ${t}.`;break}if(Array.isArray(e)&&e.length>t)return`Select no more than ${t}.`;if(e instanceof FileList&&e.length>t)return`Upload no more than ${t} files.`;if(typeof e==`number`&&e>t)return`Must be at most ${t}.`;break}default:break}}return null}_getFieldElements(e){if(!this._form)return[];let t=e=>e.replace(/\[(.*?)\]/g,`.$1`).replace(/\.+/g,`.`).replace(/^\.|\.$/g,``),n=t(e),r=Array.from(this._form.querySelectorAll(`[name]`)).filter(r=>{let i=r.getAttribute(`name`)||``;return i===e||t(i)===n}),i=r.filter(e=>e.tagName===`MINT-SELECT`);if(i.length>0){let t=[];return i.forEach(n=>{let r=n.querySelector(`select[name="`+e+`"]`);r&&t.push(r)}),r.filter(e=>e.tagName!==`MINT-SELECT`).concat(t)}if(r.filter(e=>e.tagName===`MINT-TAGS`).length>0)return r.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`));let a=r.filter(e=>e.tagName===`INPUT`&&e.closest(`mint-tags`));if(a.length>0){let e=[];return a.forEach(t=>{let n=t.closest(`mint-tags`);n&&!e.includes(n)&&e.push(n)}),r.filter(e=>e.tagName!==`INPUT`||!e.closest(`mint-tags`)).concat(e)}return r}_extractFieldValue(e){if(e.length===0)return``;let t=e.find(e=>e instanceof HTMLSelectElement);if(t)return t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value;if(e.length>1){let t=e.filter(e=>e instanceof HTMLInputElement);if(t.length>0&&t.length===e.length){let e=t.filter(e=>e.checked);if(t.every(e=>e.type===`radio`))return e.length>0?e[0].value||`on`:``;if(t.every(e=>e.type===`checkbox`))return e.map(e=>e.value||`on`)}let n=e.filter(e=>e.tagName===`MINT-CHOICE`);if(n.length>0&&n.length===e.length){let e=n.find(e=>typeof e.getValue==`function`?e.getValue()!==``:e.querySelector(`mint-choice-option[checked]`)!==null);if(e){if(typeof e.getValue==`function`)return e.getValue();let t=e.querySelector(`mint-choice-option[checked]`);if(t)return t.getAttribute(`value`)||``}return``}let r=e.filter(e=>e.tagName===`MINT-CHECKBOX`);if(r.length>0&&r.length===e.length)return r.filter(e=>e.checked===void 0?e.hasAttribute(`checked`):e.checked).map(e=>e.getAttribute(`value`)||`on`)}let n=e[0];if(n instanceof HTMLInputElement)return n.type===`file`?n.files:n.type===`checkbox`||n.type===`radio`?n.checked?n.value||`on`:``:this._normalizeInputValue(n.value,n.type);if(n instanceof HTMLTextAreaElement)return String(n.value);if(n.tagName===`MINT-SELECT`){let e=n.querySelector(`select`);if(e)return e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value;if(typeof n.getValue==`function`){let e=n.getValue();if(e!=null&&e!==``)return e}return n.getAttribute(`value`)||``}if(n.tagName===`MINT-DROPZONE`&&n.files!==void 0)return n.files;if(n.tagName===`MINT-TAGS`){let e=null;return n.tags===void 0?typeof n.getTags==`function`&&(e=n.getTags()):e=n.tags,Array.isArray(e)?e.map(e=>typeof e==`string`?e:e?.value||e?.label||``).filter(e=>e.trim()!==``):[]}if(n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`)return!!(n.checked===void 0?n.hasAttribute(`checked`):n.checked);if(n.tagName===`MINT-CHOICE`)return(typeof n.getValue==`function`?n.getValue():``)||``;if(n.tagName===`MINT-INPUT`){let e=typeof n.getType==`function`?n.getType():n.getAttribute(`type`)||`text`,t=typeof n.getValue==`function`?n.getValue():n.value;return this._normalizeInputValue(t,e)}return n.value===void 0?n.getAttribute(`value`)||``:n.value}_normalizeInputValue(e,t){if(e==null)return``;if(t===`number`||t===`range`){if(e===``)return``;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t:``}return String(e)}_flagFieldError(e,t){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.setAttribute(`aria-invalid`,`true`);let n=this._resolveHost(e);n&&(n.setAttribute(`error`,`true`),n.setAttribute(`error-message`,t),n.setAttribute(`data-mint-form-error`,`true`))})}_clearFieldError(e){e.length!==0&&e.forEach(e=>{(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.removeAttribute(`aria-invalid`);let t=this._resolveHost(e);t&&(t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`))})}_clearErrors(){this.querySelectorAll(`[data-mint-form-error]`).forEach(e=>{let t=e;t.removeAttribute(`error`),t.removeAttribute(`error-message`),t.removeAttribute(`data-mint-form-error`)}),this._form&&this._form.querySelectorAll(`[aria-invalid="true"]`).forEach(e=>{e.removeAttribute(`aria-invalid`)}),this._errors={}}setFormErrors(e){this._applyServerErrors(e)}_applyServerErrors(e){this._clearErrors(),Object.entries(e).forEach(([e,t])=>{let n=Array.isArray(t)?t[0]||`Validation error`:t||`Validation error`,r=this._getFieldElements(e);r.length>0&&(this._errors[e]=n,this._flagFieldError(r,n))}),this._scrollToFirstError()}_scrollToFirstError(){let e=this.querySelector(`[data-mint-form-error]`);e&&requestAnimationFrame(()=>{let t=this._resolveHost(e)||e;t.scrollIntoView({behavior:`smooth`,block:`center`,inline:`nearest`});let n=t.matches(`input,textarea,select,button,[tabindex]`)?t:t.querySelector(`input,textarea,select,button,[tabindex]`)||t;try{n.focus({preventScroll:!0})}catch{n.focus()}})}_parseFormData(e){if(!e){this._formData=null;return}if(typeof e==`object`&&!Array.isArray(e)){this._formData=e;return}if(typeof e==`string`)try{this._formData=JSON.parse(e)}catch{this._formData=null}else this._formData=null}_parseHeaders(e){if(!e){this._headers=null;return}if(typeof e==`string`)try{this._headers=JSON.parse(e)}catch{this._headers=null}else this._headers=null}_applyFormData(){if(!this._formData||!this._form)return;let e=this._getObjectValue(this._formData);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=(e,t)=>{let n=new Set;return t?(Object.keys(e).forEach(r=>{JSON.stringify(t[r])!==JSON.stringify(e[r])&&n.add(r)}),Object.keys(t).forEach(t=>{t in e||n.add(t)}),n):(Object.keys(e).forEach(e=>n.add(e)),n)};if(t(this._createDataSnapshot(this._extractReactiveData(e)),this._lastAppliedDataSnapshot).size===0)return;let n=this._formDataApplyGeneration,r=()=>{if(n!==this._formDataApplyGeneration)return;let e=this._formData?this._getObjectValue(this._formData):null;if(!e||typeof e!=`object`||Array.isArray(e))return;let r=this._createDataSnapshot(this._extractReactiveData(e)),i=t(r,this._lastAppliedDataSnapshot);i.size!==0&&(i.forEach(e=>{let t=r[e],i=this._getFieldElements(e);if(i.length===0){setTimeout(()=>{if(n!==this._formDataApplyGeneration)return;let t=this._getFieldElements(e);if(t.length===0)return;let r=this._formData?this._getObjectValue(this._formData):null;if(!r||typeof r!=`object`||Array.isArray(r))return;let i=this._extractReactiveData(r)[e];this._applyValueToField(t,e,i)},300);return}this._applyValueToField(i,e,t)}),this._lastAppliedDataSnapshot=r)};requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})}_applyValueToField(e,t,n){e.forEach(e=>{let r=e.tagName;try{if(r===`MINT-INPUT`)e.value!==void 0&&(e.value=n||``);else if(r===`MINT-DATE-PICKER`)typeof e.setValue==`function`&&e.setValue(n||``);else if(r===`MINT-TIME-PICKER`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.value!==void 0&&(e.value=n==null?``:String(n));else if(r===`MINT-SELECT`||r===`SELECT`)if(r===`SELECT`){let t=e,r=t.closest(`mint-select`);if(r&&typeof r.setValue==`function`)r.setValue(n);else if(t.multiple){let e=Array.isArray(n)?n.map(e=>String(e)):n==null||n===``?[]:[String(n)];Array.from(t.options).forEach(t=>{t.selected=e.includes(t.value)})}else t.value=n==null?``:String(n)}else typeof e.setValue==`function`&&e.setValue(n);else if(r===`MINT-CHOICE`)typeof e.setValue==`function`?e.setValue(n==null?``:String(n)):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=e.getAttribute(`value`)===n});else if(r===`MINT-CHECKBOX`||r===`MINT-SWITCH`){let t=n===!0||n===`true`||n===`on`||n===1||n===`1`;e.checked===void 0?t?e.setAttribute(`checked`,`true`):e.removeAttribute(`checked`):e.checked=t}else if(r===`MINT-TAGS`)if(Array.isArray(n)){let t=new Map;try{let n=e.getAttribute(`predefined-tags`);if(n){let e=JSON.parse(n);Array.isArray(e)&&(t=new Map(e.map(e=>{if(typeof e==`string`){let t=e.trim();return t?[t.toLowerCase(),t]:null}if(!e||typeof e!=`object`)return null;let t=String(e.value??``).trim();if(!t)return null;let n=String(e.label??t);return[t.toLowerCase(),n]}).filter(e=>e!==null)))}}catch{}e.tags!==void 0&&(e.tags=n.map(e=>{if(typeof e==`string`||typeof e==`number`){let n=String(e).trim();return{value:n,label:t.get(n.toLowerCase())||n,dismissable:!0}}if(e&&typeof e==`object`){let n=String(e.value??``).trim(),r=t.get(n.toLowerCase())||String(e.label??n);return{...e,value:n,label:r,dismissable:e.dismissable!==!1}}return e}))}else e.tags!==void 0&&(e.tags=[]);else if(e instanceof HTMLInputElement){if(e.type===`file`)return;e.type===`checkbox`||e.type===`radio`?e.checked=n===!0||n===`true`||n===`on`||n===1||n===`1`:e.value=n||``}else (e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&(e.value=n||``)}catch(e){console.warn(`Failed to set value for field ${t}:`,e)}})}_resetCustomFields(){this.querySelectorAll(`mint-input, mint-date-picker, mint-datetime-picker, mint-time-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{e.removeAttribute(`error`),e.removeAttribute(`error-message`);let t=e.tagName;if(t===`MINT-INPUT`)try{e.value=``}catch{}else if(t===`MINT-DATE-PICKER`)try{e.setValue?.(``)}catch{}else if(t===`MINT-SELECT`)try{e.setValue?.(``)}catch{}else if(t===`MINT-DROPZONE`){let t=e.querySelector(`input[type="file"]`);t&&(t.value=``)}else if(t===`MINT-CHECKBOX`||t===`MINT-SWITCH`)try{if(e.checked!==void 0)e.checked=!1;else{e.removeAttribute(`checked`);let t=e.querySelector(`input[type="checkbox"], input[type="radio"]`);t&&(t.checked=!1)}}catch{}else if(t===`MINT-CHOICE`)try{typeof e.setValue==`function`?e.setValue(``):e.querySelectorAll(`mint-choice-option`).forEach(e=>{e.checked=!1})}catch{}else if(t===`MINT-TAGS`)try{e.tags=[]}catch{}})}_resolveHost(e){if(e.tagName===`MINT-CHOICE-OPTION`){let t=e.closest(`mint-choice`);if(t)return t}return e.closest(`mint-input, mint-date-picker, mint-datetime-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)||e}_setupBlurValidation(){if(!this._form)return;let e=e=>{let t=e.target;if(!t)return;let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);if(!r||!this._collectValidationRules()[r])return;let i=this._extractFieldValue([n]),a=i!=null&&(typeof i==`string`?i.trim()!==``:i instanceof FileList||Array.isArray(i)?i.length>0:!0),o=n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&(t.hasAttribute(`aria-invalid`)||t.closest(`[data-mint-form-error]`)),s=!!n.closest(`mint-tags`),c=n.tagName===`MINT-CHECKBOX`||n.tagName===`MINT-SWITCH`||n.tagName===`MINT-CHOICE`||t instanceof HTMLElement&&(t.closest(`mint-checkbox, mint-switch, mint-choice`)||t.closest(`mint-choice-option`)),l=n.tagName===`MINT-DATE-PICKER`||t instanceof HTMLElement&&t.closest(`mint-date-picker, mint-datetime-picker`);(a||o||s||c||l)&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`blur`,e,!0),this._fieldBlurHandlers.set(this._form,e);let t=e=>{let t=e.target;if(!t)return;if(!(t instanceof HTMLInputElement&&t.type===`file`)){let e=this._findFieldElement(t),n=e?this._getFieldName(e):null;e&&n&&this._syncFieldToReactiveData(e,n)}if(e.type===`tags-change`&&t.tagName===`MINT-TAGS`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLSelectElement||t.tagName===`MINT-SELECT`||t.closest(`mint-select`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(e.type===`choice-change`&&t.tagName===`MINT-CHOICE`){let e=t,n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}if(t instanceof HTMLInputElement&&t.type===`checkbox`||t.tagName===`MINT-CHECKBOX`||t.tagName===`MINT-SWITCH`||t.closest(`mint-checkbox, mint-switch`)){let e=this._findFieldElement(t);if(!e)return;let n=this._getFieldName(e);if(!n||!this._collectValidationRules()[n])return;setTimeout(()=>{this._validateField(n)},0);return}let n=this._findFieldElement(t);if(!n)return;let r=this._getFieldName(n);r&&this._collectValidationRules()[r]&&(n.hasAttribute(`data-mint-form-error`)||t instanceof HTMLElement&&t.hasAttribute(`aria-invalid`))&&setTimeout(()=>{this._validateField(r)},0)};this._form.addEventListener(`change`,t,!0),this._form.addEventListener(`input`,t,!0),this._form.addEventListener(`tags-change`,t,!0),this._form.addEventListener(`choice-change`,t,!0),this._fieldChangeHandlers.set(this._form,t)}_findFieldElement(e){let t=e.closest(`mint-input, mint-date-picker, mint-datetime-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`);if(t&&t.hasAttribute(`name`))return t;if(e.hasAttribute(`name`)&&(e.tagName.startsWith(`MINT-`)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)||(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.hasAttribute(`name`))return e;let n=e;for(;n&&n!==this._form;){if(n.hasAttribute(`name`))return n;n=n.parentElement}return null}_getFieldName(e){return e.hasAttribute(`name`)||e.tagName.startsWith(`MINT-`)?e.getAttribute(`name`):(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)&&e.name||null}_syncFieldToReactiveData(e,t){if(!this._formData||!t)return;let n=this._getObjectValue(this._formData);if(!n||typeof n!=`object`||Array.isArray(n))return;let r=this._getFieldElements(t),i=this._extractFieldValue(r.length?r:[e]);n[t]=this._normalizeReactiveValue(r,i);let a=this._createDataSnapshot(n);this._lastDataSnapshot=a,this._lastAppliedDataSnapshot={...this._lastAppliedDataSnapshot||a,[t]:a[t]}}_normalizeReactiveValue(e,t){if(t instanceof FileList)return Array.from(t);if(Array.isArray(t))return t;let n=e[0];return e.length===1&&(n instanceof HTMLInputElement&&n.type===`checkbox`||n?.tagName===`MINT-CHECKBOX`||n?.tagName===`MINT-SWITCH`)?!!t:t??``}_cleanupBlurValidation(){if(this._form&&this._fieldBlurHandlers.has(this._form)){let e=this._fieldBlurHandlers.get(this._form);e&&this._form.removeEventListener(`blur`,e,!0),this._fieldBlurHandlers.delete(this._form)}if(this._form&&this._fieldChangeHandlers.has(this._form)){let e=this._fieldChangeHandlers.get(this._form);e&&(this._form.removeEventListener(`change`,e,!0),this._form.removeEventListener(`input`,e,!0),this._form.removeEventListener(`tags-change`,e,!0),this._form.removeEventListener(`choice-change`,e,!0)),this._fieldChangeHandlers.delete(this._form)}this._observer&&=(this._observer.disconnect(),null)}_syncDropzoneFiles(){this._form&&Array.from(this._form.querySelectorAll(`mint-dropzone[name]`)).forEach(e=>{typeof e.syncFiles==`function`&&e.syncFiles()})}_isSubmittingAttrActive(){let e=this.getAttribute(`submitting`);return e!==null&&e!==`false`}_applySubmittingAttributeState(){if(this._form){if(!this._isSubmittingAttrActive()){this._restoreSubmittingAttributeState();return}this._attrSubmittingMintFields.size>0||this._attrSubmittingNativeFields.size>0||this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0||(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`;this._attrSubmittingMintFields.set(e,t),t||e.setAttribute(`disabled`,`true`),typeof e.render==`function`&&e.render()}),this._form.querySelectorAll(`input, textarea, select`).forEach(e=>{if(e.closest(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags, mint-button`)||e instanceof HTMLInputElement&&e.type===`hidden`)return;let t=e.disabled;this._attrSubmittingNativeFields.set(e,t),t||(e.disabled=!0)}),Array.from(this.querySelectorAll(`mint-button`)).forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._attrSubmittingMintButtons.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&!n&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),Array.from(this.querySelectorAll(`button`)).forEach(e=>{if(e.closest(`mint-button, mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`))return;let t=e.disabled;this._attrSubmittingNativeButtons.set(e,t),t||(e.disabled=!0)}))}}_restoreSubmittingAttributeState(){this._attrSubmittingMintFields.forEach((e,t)=>{e?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintFields.clear(),this._attrSubmittingNativeFields.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeFields.clear(),this._attrSubmittingMintButtons.forEach((e,t)=>{e.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),e.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render()}),this._attrSubmittingMintButtons.clear(),this._attrSubmittingNativeButtons.forEach((e,t)=>{t.disabled=e}),this._attrSubmittingNativeButtons.clear()}_propagateLoadingState(){if(!this._form)return;let e=this.getAttribute(`loading`),t=e!==null&&e!==`false`;Array.from(this._form.querySelectorAll(`mint-input, mint-select, mint-date-picker, mint-datetime-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags`)).forEach(e=>{t?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`),typeof e.render==`function`&&e.render()})}_setButtonsSubmitting(){if(!this._form)return;this._buttonStates.clear();let e=Array.from(this.querySelectorAll(`mint-button`)),t=Array.from(this.querySelectorAll(`button`));e.forEach(e=>{let t=e.getAttribute(`disabled`)===`true`,n=e.getAttribute(`loading`)===`true`;this._buttonStates.set(e,{disabled:t,loading:n});let r=(e.getAttribute(`type`)||e.getAttribute(`button-type`)||`default`)===`submit`;t||e.setAttribute(`disabled`,`true`),r&&e.setAttribute(`loading`,`true`),typeof e.render==`function`&&e.render()}),t.forEach(e=>{if(e.closest(`mint-button`))return;let t=e.disabled;this._buttonStates.set(e,{disabled:t,loading:!1}),t||(e.disabled=!0)})}_restoreButtonsState(){if(!this._form)return;let e=this._isSubmittingAttrActive()&&(this._attrSubmittingMintButtons.size>0||this._attrSubmittingNativeButtons.size>0),t=Array.from(this.querySelectorAll(`mint-button`)),n=Array.from(this.querySelectorAll(`button`));t.forEach(t=>{if(e&&this._attrSubmittingMintButtons.has(t))return;let n=this._buttonStates.get(t);n&&(n.disabled?t.setAttribute(`disabled`,`true`):t.removeAttribute(`disabled`),n.loading?t.setAttribute(`loading`,`true`):t.removeAttribute(`loading`),typeof t.render==`function`&&t.render())}),n.forEach(t=>{if(t.closest(`mint-button`)||e&&this._attrSubmittingNativeButtons.has(t))return;let n=this._buttonStates.get(t);n&&(t.disabled=n.disabled)}),this._buttonStates.clear()}_isReactiveObject(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}_createDataSnapshot(e){try{let t=this._extractReactiveData(e);return JSON.parse(JSON.stringify(t))}catch{return{...this._extractReactiveData(e)}}}_extractReactiveData(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>this._extractReactiveData(e));let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=this._extractReactiveData(t[n]));return e}return t}_hasDataChanged(e,t){try{return JSON.stringify(e)!==JSON.stringify(t)}catch{return!0}}_getObjectValue(e){return e}_setupObjectDataObserver(e){if(this._stopReactiveDataObserver(),!this.isConnected)return;let t=this._getObjectValue(e);if(t&&typeof t==`object`&&!Array.isArray(t))this._lastDataSnapshot=this._createDataSnapshot(t);else{this._lastDataSnapshot=null;return}let n=()=>{if(!this._formData||!this._lastDataSnapshot){this._stopReactiveDataObserver();return}let e=this._getObjectValue(this._formData);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=this._createDataSnapshot(e);this._hasDataChanged(t,this._lastDataSnapshot)&&(this._lastDataSnapshot=t,requestAnimationFrame(()=>{this._applyFormData()}))}this.isConnected&&this._formData?this._reactiveDataObserver=requestAnimationFrame(n):this._stopReactiveDataObserver()};this._reactiveDataObserver=requestAnimationFrame(n)}_stopReactiveDataObserver(){this._reactiveDataObserver!==null&&(cancelAnimationFrame(this._reactiveDataObserver),this._reactiveDataObserver=null),this._reactiveDataProxy=null,this._lastDataSnapshot=null,this._lastAppliedDataSnapshot=null}};customElements.get(`mint-form`)||e.t(`mint-form`,t),typeof window<`u`&&(window.mintForm=window.mintForm||{defaults:{headers:{common:{}}},interceptors:{response:{handlers:[]}}},window.mintForm.interceptors.response.use||(window.mintForm.interceptors.response.use=function(e,t){return window.mintForm.interceptors.response.handlers.push({fulfilled:e,rejected:t}),window.mintForm.interceptors.response.handlers.length-1})),module.exports=t;
@@ -407,7 +407,7 @@ var t = class extends HTMLElement {
407
407
  return this._errors = {}, Object.entries(t || {}).forEach(([e, t]) => {
408
408
  let r = Array.isArray(t) ? t : [t], i = this._getFieldElements(e), a = this._extractFieldValue(i), o = this._validateRules(a, r);
409
409
  o ? (n = !1, this._errors[e] = o, this._flagFieldError(i, o)) : this._clearFieldError(i);
410
- }), n;
410
+ }), n || this._scrollToFirstError(), n;
411
411
  }
412
412
  _validateField(e) {
413
413
  let t = this._collectValidationRules();
@@ -475,24 +475,27 @@ var t = class extends HTMLElement {
475
475
  }
476
476
  _getFieldElements(e) {
477
477
  if (!this._form) return [];
478
- let t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), n = t.filter((e) => e.tagName === "MINT-SELECT");
479
- if (n.length > 0) {
480
- let r = [];
481
- return n.forEach((t) => {
482
- let n = t.querySelector("select[name=\"" + e + "\"]");
483
- n && r.push(n);
484
- }), t.filter((e) => e.tagName !== "MINT-SELECT").concat(r);
478
+ let t = (e) => e.replace(/\[(.*?)\]/g, ".$1").replace(/\.+/g, ".").replace(/^\.|\.$/g, ""), n = t(e), r = Array.from(this._form.querySelectorAll("[name]")).filter((r) => {
479
+ let i = r.getAttribute("name") || "";
480
+ return i === e || t(i) === n;
481
+ }), i = r.filter((e) => e.tagName === "MINT-SELECT");
482
+ if (i.length > 0) {
483
+ let t = [];
484
+ return i.forEach((n) => {
485
+ let r = n.querySelector("select[name=\"" + e + "\"]");
486
+ r && t.push(r);
487
+ }), r.filter((e) => e.tagName !== "MINT-SELECT").concat(t);
485
488
  }
486
- if (t.filter((e) => e.tagName === "MINT-TAGS").length > 0) return t.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags"));
487
- let r = t.filter((e) => e.tagName === "INPUT" && e.closest("mint-tags"));
488
- if (r.length > 0) {
489
+ if (r.filter((e) => e.tagName === "MINT-TAGS").length > 0) return r.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags"));
490
+ let a = r.filter((e) => e.tagName === "INPUT" && e.closest("mint-tags"));
491
+ if (a.length > 0) {
489
492
  let e = [];
490
- return r.forEach((t) => {
493
+ return a.forEach((t) => {
491
494
  let n = t.closest("mint-tags");
492
495
  n && !e.includes(n) && e.push(n);
493
- }), t.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags")).concat(e);
496
+ }), r.filter((e) => e.tagName !== "INPUT" || !e.closest("mint-tags")).concat(e);
494
497
  }
495
- return t;
498
+ return r;
496
499
  }
497
500
  _extractFieldValue(e) {
498
501
  if (e.length === 0) return "";
@@ -581,6 +584,23 @@ var t = class extends HTMLElement {
581
584
  this._clearErrors(), Object.entries(e).forEach(([e, t]) => {
582
585
  let n = Array.isArray(t) ? t[0] || "Validation error" : t || "Validation error", r = this._getFieldElements(e);
583
586
  r.length > 0 && (this._errors[e] = n, this._flagFieldError(r, n));
587
+ }), this._scrollToFirstError();
588
+ }
589
+ _scrollToFirstError() {
590
+ let e = this.querySelector("[data-mint-form-error]");
591
+ e && requestAnimationFrame(() => {
592
+ let t = this._resolveHost(e) || e;
593
+ t.scrollIntoView({
594
+ behavior: "smooth",
595
+ block: "center",
596
+ inline: "nearest"
597
+ });
598
+ let n = t.matches("input,textarea,select,button,[tabindex]") ? t : t.querySelector("input,textarea,select,button,[tabindex]") || t;
599
+ try {
600
+ n.focus({ preventScroll: !0 });
601
+ } catch {
602
+ n.focus();
603
+ }
584
604
  });
585
605
  }
586
606
  _parseFormData(e) {
@@ -15,10 +15,6 @@ declare class MintOffCanvas extends HTMLElement {
15
15
  private _closeButton;
16
16
  private _contentObserver;
17
17
  private _renderFrame;
18
- private _enterFrame;
19
- private _exitTimer;
20
- private _previousFocus;
21
- private _dialogWasOpen;
22
18
  private _dialogKeydownHandler;
23
19
  constructor();
24
20
  connectedCallback(): void;
@@ -37,10 +33,7 @@ declare class MintOffCanvas extends HTMLElement {
37
33
  close(): void;
38
34
  render(): void;
39
35
  private _observeContentMutations;
40
- private _getDialogFocusableElements;
41
- private _animateEnter;
42
- private _animateExit;
43
- private _finishExit;
36
+ private _syncOpenClasses;
44
37
  }
45
38
  export default MintOffCanvas;
46
39
  //# sourceMappingURL=OffCanvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OffCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/off-canvas/OffCanvas.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,eAAe,CAAA;AACtB,OAAO,gBAAgB,CAAA;AAEvB,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,cAAM,aAAc,SAAQ,WAAW;IACrC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,qBAAqB,CAAgD;;IAO7E,iBAAiB,IAAI,IAAI;IAsCzB,oBAAoB,IAAI,IAAI;IAyB5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,eAAe;IAQvB,KAAK,IAAI,MAAM;IAIf,UAAU,IAAI,MAAM;IAIpB,WAAW,IAAI,iBAAiB;IAQhC,UAAU,IAAI,OAAO;IAKrB,QAAQ,IAAI,MAAM;IAMlB,SAAS,IAAI,MAAM;IAMnB,OAAO,CAAC,kBAAkB;IAS1B,MAAM,IAAI,OAAO;IAKjB,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IA0Md,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,aAAa;IAsCrB,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC,WAAW;CAcpB;AAOD,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"OffCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/off-canvas/OffCanvas.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AACxB,OAAO,eAAe,CAAA;AACtB,OAAO,qBAAqB,CAAA;AAC5B,OAAO,eAAe,CAAA;AACtB,OAAO,gBAAgB,CAAA;AAEvB,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,cAAM,aAAc,SAAQ,WAAW;IACrC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,qBAAqB,CAAgD;;IAO7E,iBAAiB,IAAI,IAAI;IAkBzB,oBAAoB,IAAI,IAAI;IAiB5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,eAAe;IAQvB,KAAK,IAAI,MAAM;IAIf,UAAU,IAAI,MAAM;IAIpB,WAAW,IAAI,iBAAiB;IAQhC,UAAU,IAAI,OAAO;IAKrB,QAAQ,IAAI,MAAM;IAMlB,SAAS,IAAI,MAAM;IAMnB,OAAO,CAAC,kBAAkB;IAS1B,MAAM,IAAI,OAAO;IAKjB,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IAyMd,OAAO,CAAC,wBAAwB;IAehC,OAAO,CAAC,gBAAgB;CAQzB;AAOD,eAAe,aAAa,CAAA"}
@@ -36,29 +36,15 @@ var t = class extends HTMLElement {
36
36
  ];
37
37
  }
38
38
  constructor() {
39
- super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._enterFrame = null, this._exitTimer = null, this._previousFocus = null, this._dialogWasOpen = !1, this._dialogKeydownHandler = null;
39
+ super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._contentObserver = null, this._renderFrame = null, this._dialogKeydownHandler = null;
40
40
  }
41
41
  connectedCallback() {
42
42
  this.classList.add("mint-off-canvas-host"), this.style.display = "none", this.render(), this._observeContentMutations(), this._dialogKeydownHandler = (e) => {
43
- if (!this.isOpen()) return;
44
- if (e.key === "Escape") {
45
- e.preventDefault(), e.stopPropagation(), this.close();
46
- return;
47
- }
48
- if (e.key !== "Tab") return;
49
- let t = this._offCanvas?.querySelector(".mint-off-canvas-panel");
50
- if (!t) return;
51
- let n = this._getDialogFocusableElements(t);
52
- if (!n.length) {
53
- e.preventDefault(), t.focus();
54
- return;
55
- }
56
- let r = n[0], i = n[n.length - 1], a = document.activeElement;
57
- e.shiftKey && (a === r || !t.contains(a)) ? (e.preventDefault(), i.focus()) : !e.shiftKey && (a === i || !t.contains(a)) && (e.preventDefault(), r.focus());
43
+ this.isOpen() && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
58
44
  }, document.addEventListener("keydown", this._dialogKeydownHandler, !0);
59
45
  }
60
46
  disconnectedCallback() {
61
- this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._enterFrame !== null && (cancelAnimationFrame(this._enterFrame), this._enterFrame = null), this._overlay?.remove(), this._offCanvas?.remove();
47
+ this._dialogKeydownHandler &&= (document.removeEventListener("keydown", this._dialogKeydownHandler, !0), null), this._contentObserver &&= (this._contentObserver.disconnect(), null), this._renderFrame !== null && (cancelAnimationFrame(this._renderFrame), this._renderFrame = null), this._overlay?.remove(), this._offCanvas?.remove();
62
48
  }
63
49
  attributeChangedCallback(e, t, n) {
64
50
  t !== n && this.isConnected && this.render();
@@ -101,7 +87,7 @@ var t = class extends HTMLElement {
101
87
  }
102
88
  render() {
103
89
  let e = this.getId(), t = this.getHeading(), n = this.isOpen(), r = this.getPosition(), i = this.isFullPage(), a = this.getHeight();
104
- e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay mint-off-canvas-hidden", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close())), this._offCanvas || (this._offCanvas = document.createElement("div"), this._offCanvas.className = "mint-off-canvas-shell mint-off-canvas-hidden");
90
+ e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "mint-off-canvas-overlay mint-off-canvas-hidden", this._overlay.setAttribute("aria-hidden", "true"), this._overlay.addEventListener("click", () => this.close())), this._offCanvas || (this._offCanvas = document.createElement("div"), this._offCanvas.className = "mint-off-canvas-shell");
105
91
  let o = document.body ?? document.documentElement;
106
92
  this._overlay.parentElement !== o && o.appendChild(this._overlay), this._offCanvas.parentElement !== o && o.appendChild(this._offCanvas), this._offCanvas.classList.add("mint-off-canvas-shell"), this._offCanvas.dataset.position = r, this._offCanvas.dataset.fullPage = String(i);
107
93
  let s = this._offCanvas.querySelector(".mint-off-canvas-panel");
@@ -123,7 +109,7 @@ var t = class extends HTMLElement {
123
109
  }), e.parentElement && e.remove();
124
110
  }), Array.from(this.children).forEach((e) => {
125
111
  e !== this._overlay && e !== this._offCanvas && e.getAttribute("slot") !== "heading" && e.getAttribute("slot") !== "body" && e.getAttribute("slot") !== "actions" && e !== this._headingSlot && e !== this._bodySlot && e !== this._actionsSlot && e.parentElement !== this._bodySlot && this._bodySlot.appendChild(e);
126
- }), n ? this._animateEnter() : this._animateExit();
112
+ }), this._syncOpenClasses(n);
127
113
  }
128
114
  _observeContentMutations() {
129
115
  this._contentObserver ||= new MutationObserver(() => {
@@ -134,50 +120,8 @@ var t = class extends HTMLElement {
134
120
  attributeFilter: ["slot"]
135
121
  });
136
122
  }
137
- _getDialogFocusableElements(e) {
138
- return Array.from(e.querySelectorAll("button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")).filter((e) => {
139
- if (e.closest("[hidden], [aria-hidden=\"true\"]")) return !1;
140
- let t = window.getComputedStyle(e);
141
- return t.display !== "none" && t.visibility !== "hidden";
142
- });
143
- }
144
- _animateEnter() {
145
- let e = this._offCanvas?.querySelector(".mint-off-canvas-panel"), t = this._offCanvas, n = this._overlay;
146
- if (!e || !t || !n || this._enterFrame !== null || t.classList.contains("mint-off-canvas-open")) return;
147
- this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null);
148
- let r = !this._dialogWasOpen;
149
- if (r) {
150
- this._dialogWasOpen = !0;
151
- let e = document.activeElement;
152
- this._previousFocus = e instanceof HTMLElement && e !== document.body ? e : null;
153
- }
154
- n.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), t.classList.remove("mint-off-canvas-hidden", "mint-off-canvas-open"), e.getBoundingClientRect(), this._enterFrame = requestAnimationFrame(() => {
155
- this._enterFrame = null, this.isOpen() && (n.classList.add("mint-off-canvas-open"), t.classList.add("mint-off-canvas-open"), r && (this._getDialogFocusableElements(e)[0] ?? e).focus());
156
- });
157
- }
158
- _animateExit() {
159
- let e = this._offCanvas, t = this._overlay;
160
- if (!(!e || !t || e.classList.contains("mint-off-canvas-hidden"))) {
161
- if (!this._offCanvas?.querySelector(".mint-off-canvas-panel")) {
162
- t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
163
- return;
164
- }
165
- if (this._enterFrame !== null) {
166
- cancelAnimationFrame(this._enterFrame), this._enterFrame = null, t.classList.add("mint-off-canvas-hidden"), e.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
167
- let n = this._previousFocus;
168
- this._previousFocus = null, n?.isConnected && n.focus();
169
- return;
170
- }
171
- e.classList.contains("mint-off-canvas-open") && (t.classList.remove("mint-off-canvas-open"), e.classList.remove("mint-off-canvas-open"), this._exitTimer !== null && clearTimeout(this._exitTimer), this._exitTimer = window.setTimeout(() => {
172
- this._finishExit();
173
- }, 220));
174
- }
175
- }
176
- _finishExit() {
177
- if (this.isOpen()) return;
178
- this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._overlay?.classList.add("mint-off-canvas-hidden"), this._offCanvas?.classList.add("mint-off-canvas-hidden"), this._dialogWasOpen = !1;
179
- let e = this._previousFocus;
180
- this._previousFocus = null, e?.isConnected && e.focus();
123
+ _syncOpenClasses(e) {
124
+ !this._offCanvas || !this._overlay || (this._offCanvas.classList.toggle("mint-off-canvas-open", e), this._overlay.classList.toggle("mint-off-canvas-open", e), this._overlay.classList.toggle("mint-off-canvas-hidden", !e));
181
125
  }
182
126
  };
183
127
  customElements.get("mint-off-canvas") || e("mint-off-canvas", t);
@@ -1 +1 @@
1
- require(`../chunks/icon-B9P0jyS2.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/button-B4BMYTk1.js`),require(`../chunks/stack-CK2o4-As.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._contentObserver=null,this._renderFrame=null,this._enterFrame=null,this._exitTimer=null,this._previousFocus=null,this._dialogWasOpen=!1,this._dialogKeydownHandler=null}connectedCallback(){this.classList.add(`mint-off-canvas-host`),this.style.display=`none`,this.render(),this._observeContentMutations(),this._dialogKeydownHandler=e=>{if(!this.isOpen())return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this.close();return}if(e.key!==`Tab`)return;let t=this._offCanvas?.querySelector(`.mint-off-canvas-panel`);if(!t)return;let n=this._getDialogFocusableElements(t);if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())},document.addEventListener(`keydown`,this._dialogKeydownHandler,!0)}disconnectedCallback(){this._dialogKeydownHandler&&=(document.removeEventListener(`keydown`,this._dialogKeydownHandler,!0),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._enterFrame!==null&&(cancelAnimationFrame(this._enterFrame),this._enterFrame=null),this._overlay?.remove(),this._offCanvas?.remove()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-off-canvas-overlay mint-off-canvas-hidden`,this._overlay.setAttribute(`aria-hidden`,`true`),this._overlay.addEventListener(`click`,()=>this.close())),this._offCanvas||(this._offCanvas=document.createElement(`div`),this._offCanvas.className=`mint-off-canvas-shell mint-off-canvas-hidden`);let o=document.body??document.documentElement;this._overlay.parentElement!==o&&o.appendChild(this._overlay),this._offCanvas.parentElement!==o&&o.appendChild(this._offCanvas),this._offCanvas.classList.add(`mint-off-canvas-shell`),this._offCanvas.dataset.position=r,this._offCanvas.dataset.fullPage=String(i);let s=this._offCanvas.querySelector(`.mint-off-canvas-panel`);s||(s=document.createElement(`div`),s.className=`mint-off-canvas-panel`,this._offCanvas.appendChild(s)),s.setAttribute(`role`,`dialog`),s.setAttribute(`aria-modal`,`true`),s.hasAttribute(`tabindex`)||(s.tabIndex=-1),s.style.removeProperty(`--off-canvas-width`),s.style.removeProperty(`--off-canvas-height`),r===`top`||r===`bottom`?a&&s.style.setProperty(`--off-canvas-height`,this._normalizeCssValue(a)):s.style.setProperty(`--off-canvas-width`,this._normalizeCssValue(this.getWidth())),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-off-canvas-header`,s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-off-canvas-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let c=this._headingSlot.querySelector(`mint-text`);if(t?(c||(c=document.createElement(`mint-text`),c.setAttribute(`size`,`sub-heading`),c.setAttribute(`bold`,`true`),this._headingSlot.appendChild(c)),c.textContent=t,c.id=`${e||`mint-off-canvas`}-heading`,s.setAttribute(`aria-labelledby`,c.id),s.removeAttribute(`aria-label`)):c&&c.remove(),!t){let e=this.getAttribute(`aria-label`)?.trim();e?s.setAttribute(`aria-label`,e):s.hasAttribute(`aria-label`)||s.setAttribute(`aria-label`,`Dialog`)}Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.setAttribute(`aria-label`,`Close panel`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-off-canvas-body`,this._bodySlot.setAttribute(`slot`,`body`),s.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-off-canvas-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),s.appendChild(this._actionsSlot));let l=this._actionsSlot.querySelector(`mint-stack`);l||(l=document.createElement(`mint-stack`),l.setAttribute(`direction`,`horizontal`),l.className=`mint-off-canvas-actions-stack`,this._actionsSlot.appendChild(l)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==l&&l.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),n?this._animateEnter():this._animateExit()}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_getDialogFocusableElements(e){return Array.from(e.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>{if(e.closest(`[hidden], [aria-hidden="true"]`))return!1;let t=window.getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}_animateEnter(){let e=this._offCanvas?.querySelector(`.mint-off-canvas-panel`),t=this._offCanvas,n=this._overlay;if(!e||!t||!n||this._enterFrame!==null||t.classList.contains(`mint-off-canvas-open`))return;this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null);let r=!this._dialogWasOpen;if(r){this._dialogWasOpen=!0;let e=document.activeElement;this._previousFocus=e instanceof HTMLElement&&e!==document.body?e:null}n.classList.remove(`mint-off-canvas-hidden`,`mint-off-canvas-open`),t.classList.remove(`mint-off-canvas-hidden`,`mint-off-canvas-open`),e.getBoundingClientRect(),this._enterFrame=requestAnimationFrame(()=>{this._enterFrame=null,this.isOpen()&&(n.classList.add(`mint-off-canvas-open`),t.classList.add(`mint-off-canvas-open`),r&&(this._getDialogFocusableElements(e)[0]??e).focus())})}_animateExit(){let e=this._offCanvas,t=this._overlay;if(!(!e||!t||e.classList.contains(`mint-off-canvas-hidden`))){if(!this._offCanvas?.querySelector(`.mint-off-canvas-panel`)){t.classList.add(`mint-off-canvas-hidden`),e.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;return}if(this._enterFrame!==null){cancelAnimationFrame(this._enterFrame),this._enterFrame=null,t.classList.add(`mint-off-canvas-hidden`),e.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;let n=this._previousFocus;this._previousFocus=null,n?.isConnected&&n.focus();return}e.classList.contains(`mint-off-canvas-open`)&&(t.classList.remove(`mint-off-canvas-open`),e.classList.remove(`mint-off-canvas-open`),this._exitTimer!==null&&clearTimeout(this._exitTimer),this._exitTimer=window.setTimeout(()=>{this._finishExit()},220))}}_finishExit(){if(this.isOpen())return;this._exitTimer!==null&&(clearTimeout(this._exitTimer),this._exitTimer=null),this._overlay?.classList.add(`mint-off-canvas-hidden`),this._offCanvas?.classList.add(`mint-off-canvas-hidden`),this._dialogWasOpen=!1;let e=this._previousFocus;this._previousFocus=null,e?.isConnected&&e.focus()}};customElements.get(`mint-off-canvas`)||e.t(`mint-off-canvas`,t),module.exports=t;
1
+ require(`../chunks/icon-B9P0jyS2.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/button-B4BMYTk1.js`),require(`../chunks/stack-CK2o4-As.js`);var t=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`,`position`,`full-page`,`width`,`height`]}constructor(){super(),this._overlay=null,this._offCanvas=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._contentObserver=null,this._renderFrame=null,this._dialogKeydownHandler=null}connectedCallback(){this.classList.add(`mint-off-canvas-host`),this.style.display=`none`,this.render(),this._observeContentMutations(),this._dialogKeydownHandler=e=>{this.isOpen()&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.close())},document.addEventListener(`keydown`,this._dialogKeydownHandler,!0)}disconnectedCallback(){this._dialogKeydownHandler&&=(document.removeEventListener(`keydown`,this._dialogKeydownHandler,!0),null),this._contentObserver&&=(this._contentObserver.disconnect(),null),this._renderFrame!==null&&(cancelAnimationFrame(this._renderFrame),this._renderFrame=null),this._overlay?.remove(),this._offCanvas?.remove()}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&this.render()}_scheduleRender(){this._renderFrame===null&&(this._renderFrame=requestAnimationFrame(()=>{this._renderFrame=null,this.render()}))}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}getPosition(){let e=this.getAttribute(`position`)?.toLowerCase();return e===`top`||e===`bottom`||e===`left`||e===`right`?e:`right`}isFullPage(){return this.getAttribute(`full-page`)===`true`}getWidth(){return this.getAttribute(`width`)||`320px`}getHeight(){return this.getAttribute(`height`)||``}_normalizeCssValue(e){return/^\d+(\.\d+)?$/.test(e.trim())?`${e.trim()}px`:e.trim()}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}render(){let e=this.getId(),t=this.getHeading(),n=this.isOpen(),r=this.getPosition(),i=this.isFullPage(),a=this.getHeight();e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`mint-off-canvas-overlay mint-off-canvas-hidden`,this._overlay.setAttribute(`aria-hidden`,`true`),this._overlay.addEventListener(`click`,()=>this.close())),this._offCanvas||(this._offCanvas=document.createElement(`div`),this._offCanvas.className=`mint-off-canvas-shell`);let o=document.body??document.documentElement;this._overlay.parentElement!==o&&o.appendChild(this._overlay),this._offCanvas.parentElement!==o&&o.appendChild(this._offCanvas),this._offCanvas.classList.add(`mint-off-canvas-shell`),this._offCanvas.dataset.position=r,this._offCanvas.dataset.fullPage=String(i);let s=this._offCanvas.querySelector(`.mint-off-canvas-panel`);s||(s=document.createElement(`div`),s.className=`mint-off-canvas-panel`,this._offCanvas.appendChild(s)),s.setAttribute(`role`,`dialog`),s.setAttribute(`aria-modal`,`true`),s.hasAttribute(`tabindex`)||(s.tabIndex=-1),s.style.removeProperty(`--off-canvas-width`),s.style.removeProperty(`--off-canvas-height`),r===`top`||r===`bottom`?a&&s.style.setProperty(`--off-canvas-height`,this._normalizeCssValue(a)):s.style.setProperty(`--off-canvas-width`,this._normalizeCssValue(this.getWidth())),this._header||(this._header=document.createElement(`div`),this._header.className=`mint-off-canvas-header`,s.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`mint-off-canvas-heading`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let c=this._headingSlot.querySelector(`mint-text`);if(t?(c||(c=document.createElement(`mint-text`),c.setAttribute(`size`,`sub-heading`),c.setAttribute(`bold`,`true`),this._headingSlot.appendChild(c)),c.textContent=t,c.id=`${e||`mint-off-canvas`}-heading`,s.setAttribute(`aria-labelledby`,c.id),s.removeAttribute(`aria-label`)):c&&c.remove(),!t){let e=this.getAttribute(`aria-label`)?.trim();e?s.setAttribute(`aria-label`,e):s.hasAttribute(`aria-label`)||s.setAttribute(`aria-label`,`Dialog`)}Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._headingSlot&&e.getAttribute(`slot`)===`heading`).forEach(e=>{this._headingSlot&&e.parentElement!==this._headingSlot&&this._headingSlot.appendChild(e)}),this._closeButton||(this._closeButton=document.createElement(`mint-button`),this._closeButton.setAttribute(`variant`,`ghost`),this._closeButton.setAttribute(`icon`,`close`),this._closeButton.setAttribute(`aria-label`,`Close panel`),this._closeButton.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`mint-off-canvas-body`,this._bodySlot.setAttribute(`slot`,`body`),s.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._bodySlot&&e.getAttribute(`slot`)===`body`).forEach(e=>{this._bodySlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._actionsSlot||(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`mint-off-canvas-actions`,this._actionsSlot.setAttribute(`slot`,`actions`),s.appendChild(this._actionsSlot));let l=this._actionsSlot.querySelector(`mint-stack`);l||(l=document.createElement(`mint-stack`),l.setAttribute(`direction`,`horizontal`),l.className=`mint-off-canvas-actions-stack`,this._actionsSlot.appendChild(l)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._offCanvas&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==l&&l.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._offCanvas&&e.getAttribute(`slot`)!==`heading`&&e.getAttribute(`slot`)!==`body`&&e.getAttribute(`slot`)!==`actions`&&e!==this._headingSlot&&e!==this._bodySlot&&e!==this._actionsSlot&&e.parentElement!==this._bodySlot&&this._bodySlot.appendChild(e)}),this._syncOpenClasses(n)}_observeContentMutations(){this._contentObserver||=new MutationObserver(()=>{this._scheduleRender()}),this._contentObserver.disconnect(),this._contentObserver.observe(this,{childList:!0,attributes:!0,attributeFilter:[`slot`]})}_syncOpenClasses(e){!this._offCanvas||!this._overlay||(this._offCanvas.classList.toggle(`mint-off-canvas-open`,e),this._overlay.classList.toggle(`mint-off-canvas-open`,e),this._overlay.classList.toggle(`mint-off-canvas-hidden`,!e))}};customElements.get(`mint-off-canvas`)||e.t(`mint-off-canvas`,t),module.exports=t;