monobill-mintui 0.4.91 → 0.4.93
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.ts"],"names":[],"mappings":"AAGA,OAAO,eAAe,CAAA;AAEtB,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;;IAOlD,iBAAiB,IAAI,IAAI;IAMzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAQvB,MAAM,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.ts"],"names":[],"mappings":"AAGA,OAAO,eAAe,CAAA;AAEtB,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;;IAOlD,iBAAiB,IAAI,IAAI;IAMzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM9F,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAQvB,MAAM,IAAI,IAAI;CAyCf;AAOD,eAAe,QAAQ,CAAA"}
|
|
@@ -129,6 +129,8 @@ declare class MintChart extends HTMLElement {
|
|
|
129
129
|
* Format an x-axis value using formatXAxis from ChartData
|
|
130
130
|
*/
|
|
131
131
|
private _formatXAxisValue;
|
|
132
|
+
/** X label for tooltips: same as axis formatting, escaped for innerHTML. */
|
|
133
|
+
private _formatXAxisForTooltip;
|
|
132
134
|
/**
|
|
133
135
|
* Format a y-axis value using formatYAxis from ChartData or first dataset's formatValue
|
|
134
136
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/chart/Chart.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEhD,UAAU,cAAc;IACtB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;CAC5D;AAED,cAAM,SAAU,SAAQ,WAAW;IACjC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAKf;IACD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,sBAAsB,CAAsB;IACpD,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,iBAAiB,CAA0C;IACnE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,4BAA4B,CAAyC;IAC7E,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,0BAA0B,CAAoC;IACtE,OAAO,CAAC,aAAa,CAA+H;IACpJ,OAAO,CAAC,aAAa,CAAkG;IACvH,OAAO,CAAC,cAAc,CAA2F;IACjH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAM;IAC5C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,cAAc,CASrB;;IAMD,iBAAiB,IAAI,IAAI;IA0BzB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,sBAAsB;IAc9B,oBAAoB,IAAI,IAAI;IAkH5B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,oBAAoB;IAsC5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA2B9F,IAAI,IAAI,IAAI,SAAS,CAGpB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAExB;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EAiBxC;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,MAAM,CAU3B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAE/B;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,CAU5B;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAEhC;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,MAAM;IA8Jd,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAkEtB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,mBAAmB,CAAY;IAEvC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAoCpC,OAAO,CAAC,eAAe;IAwFvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,WAAW;IA8DnB,OAAO,CAAC,UAAU;IAoClB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAYpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA2ClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsgB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA4DpC,OAAO,CAAC,WAAW;IAyUnB,OAAO,CAAC,gBAAgB;IA8ExB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IA0HvB,OAAO,CAAC,gBAAgB;IAsGxB,OAAO,CAAC,eAAe;IAgTvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,aAAa;IAkMrB;;;;OAIG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;;OAIG;IACU,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3F;;;OAGG;IACU,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D;;;OAGG;IACU,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/D;;;;;OAKG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB5G;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBtI;;;;OAIG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgB/D;;;;OAIG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI/D;;;OAGG;IACU,aAAa,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqH1E;AAMD,eAAe,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/chart/Chart.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAA;AAEhD,UAAU,cAAc;IACtB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,cAAc,EAAE,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;IAClD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,GAAG,MAAM,CAAA;CAC5D;AAED,cAAM,SAAU,SAAQ,WAAW;IACjC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAKf;IACD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,sBAAsB,CAAsB;IACpD,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,iBAAiB,CAA0C;IACnE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,4BAA4B,CAAyC;IAC7E,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,0BAA0B,CAAoC;IACtE,OAAO,CAAC,aAAa,CAA+H;IACpJ,OAAO,CAAC,aAAa,CAAkG;IACvH,OAAO,CAAC,cAAc,CAA2F;IACjH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAM;IAC5C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,cAAc,CASrB;;IAMD,iBAAiB,IAAI,IAAI;IA0BzB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,sBAAsB;IAc9B,oBAAoB,IAAI,IAAI;IAkH5B,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,oBAAoB;IAsC5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA2B9F,IAAI,IAAI,IAAI,SAAS,CAGpB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,EAExB;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,IAAI,CAE3B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EAiBxC;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,MAAM,CAU3B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAE/B;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,CAU5B;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAEhC;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,MAAM;IA8Jd,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAkEtB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,mBAAmB,CAAY;IAEvC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAoCpC,OAAO,CAAC,eAAe;IAwFvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,WAAW;IA8DnB,OAAO,CAAC,UAAU;IAoClB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,4EAA4E;IAC5E,OAAO,CAAC,sBAAsB;IAS9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAYpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA2ClC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsgB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA4DpC,OAAO,CAAC,WAAW;IAyUnB,OAAO,CAAC,gBAAgB;IA8ExB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IA0HvB,OAAO,CAAC,gBAAgB;IAsGxB,OAAO,CAAC,eAAe;IAgTvB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsD9B,OAAO,CAAC,aAAa;IAkMrB;;;;OAIG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;;OAIG;IACU,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3F;;;OAGG;IACU,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7D;;;OAGG;IACU,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/D;;;;;OAKG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB5G;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBtI;;;;OAIG;IACU,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/G;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgB/D;;;;OAIG;IACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI/D;;;OAGG;IACU,aAAa,CAAC,QAAQ,GAAE,MAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqH1E;AAMD,eAAe,SAAS,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -55,7 +55,7 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
55
55
|
mint-button[data-variant="link"] .mint-button-active {
|
|
56
56
|
box-shadow: none !important;
|
|
57
57
|
}
|
|
58
|
-
`,document.head.appendChild(t),e._activeShadowStyleInjected=!0}this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add(`w-full`)}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-slate-900`,`dark:!bg-slate-700`,`hover:!bg-slate-900`,`dark:hover:!bg-slate-700`,`!border-t-slate-900`,`!border-l-slate-900`,`!border-r-slate-600`,`!border-b-slate-600`,`dark:!border-t-slate-700`,`dark:!border-l-slate-700`,`dark:!border-r-slate-500`,`dark:!border-b-slate-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-gray-700`,`dark:!border-b-gray-700`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"link-action":[`!text-slate-900`,`dark:!text-slate-300`,`hover:!text-slate-900`,`dark:hover:!text-slate-300`],"link-neutral":[`!text-gray-950`,`dark:!text-gray-200`,`hover:!text-gray-950`,`dark:hover:!text-gray-200`],"link-info":[`!text-blue-900`,`dark:!text-blue-200`,`hover:!text-blue-900`,`dark:hover:!text-blue-200`],"link-warning":[`!text-amber-900`,`dark:!text-amber-200`,`hover:!text-amber-900`,`dark:hover:!text-amber-200`],"link-danger":[`!text-red-900`,`dark:!text-red-200`,`hover:!text-red-900`,`dark:hover:!text-red-200`]}[e]||[]}getButtonClasses(){let e=this.isIconOnly(),t=this.getVariant(),n=this.getAlignment(),r=`justify-center`;n===`left`?r=`justify-start`:n===`right`&&(r=`justify-end`);let i=[`inline-flex`,`items-center`,r,`cursor-pointer`,`font-medium`,`rounded-lg`,`box-border`,...e?[`p-1.5`,`aspect-square`,`w-[2.25rem]`,`h-[2.25rem]`]:[`px-3.5`,`py-1.5`,`min-h-[2.25rem]`],`text-sm`,`transition-all`,`duration-100`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`[&.mint-button-active:not(:disabled):not([data-loading="true"]):not([data-variant="ghost"]):not([data-variant="link"])>*]:translate-y-[1px]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],a=this.getTone(),o={"solid-action":`bg-slate-800.dark:bg-slate-600.text-white.hover:bg-slate-950.dark:hover:bg-slate-700.active:bg-slate-900.dark:active:bg-slate-700.disabled:active:bg-slate-800.dark:disabled:active:bg-slate-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-slate-600.border-l-slate-600.border-r-slate-900.border-b-slate-900.dark:border-t-slate-500.dark:border-l-slate-500.dark:border-r-slate-700.dark:border-b-slate-700.active:border-t-slate-900.active:border-l-slate-900.active:border-r-slate-600.active:border-b-slate-600.dark:active:border-t-slate-700.dark:active:border-l-slate-700.dark:active:border-r-slate-500.dark:active:border-b-slate-500.disabled:active:border-t-slate-600.disabled:active:border-l-slate-600.disabled:active:border-r-slate-900.disabled:active:border-b-slate-900.dark:disabled:active:border-t-slate-500.dark:disabled:active:border-l-slate-500.dark:disabled:active:border-r-slate-700.dark:disabled:active:border-b-slate-700.[&[data-loading="true"]:active]:border-t-slate-600.[&[data-loading="true"]:active]:border-l-slate-600.[&[data-loading="true"]:active]:border-r-slate-900.[&[data-loading="true"]:active]:border-b-slate-900.[&[data-loading="true"]:active]:dark:border-t-slate-500.[&[data-loading="true"]:active]:dark:border-l-slate-500.[&[data-loading="true"]:active]:dark:border-r-slate-700.[&[data-loading="true"]:active]:dark:border-b-slate-700`.split(`.`),"solid-neutral":`bg-white.dark:bg-gray-900.text-gray-900.dark:text-white.hover:bg-gray-50.dark:hover:bg-gray-800.active:bg-gray-100.dark:active:bg-gray-800.disabled:active:bg-white.dark:disabled:active:bg-gray-900.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-gray-200.border-l-gray-200.border-r-gray-300.border-b-gray-300.dark:border-t-gray-600.dark:border-l-gray-600.dark:border-r-gray-700.dark:border-b-gray-700.active:border-t-gray-400.active:border-l-gray-400.active:border-r-gray-200.active:border-b-gray-200.dark:active:border-t-gray-950.dark:active:border-l-gray-950.dark:active:border-r-gray-700.dark:active:border-b-gray-700.disabled:active:border-t-gray-200.disabled:active:border-l-gray-200.disabled:active:border-r-gray-400.disabled:active:border-b-gray-400.dark:disabled:active:border-t-gray-700.dark:disabled:active:border-l-gray-700.dark:disabled:active:border-r-gray-950.dark:disabled:active:border-b-gray-950.[&[data-loading="true"]:active]:border-t-gray-200.[&[data-loading="true"]:active]:border-l-gray-200.[&[data-loading="true"]:active]:border-r-gray-400.[&[data-loading="true"]:active]:border-b-gray-400.[&[data-loading="true"]:active]:dark:border-t-gray-700.[&[data-loading="true"]:active]:dark:border-l-gray-700.[&[data-loading="true"]:active]:dark:border-r-gray-950.[&[data-loading="true"]:active]:dark:border-b-gray-950`.split(`.`),"solid-info":`bg-blue-800.dark:bg-blue-600.text-white.hover:bg-blue-950.dark:hover:bg-blue-700.active:bg-blue-900.dark:active:bg-blue-700.disabled:active:bg-blue-800.dark:disabled:active:bg-blue-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-blue-600.border-l-blue-600.border-r-blue-900.border-b-blue-900.dark:border-t-blue-500.dark:border-l-blue-500.dark:border-r-blue-700.dark:border-b-blue-700.active:border-t-blue-900.active:border-l-blue-900.active:border-r-blue-600.active:border-b-blue-600.dark:active:border-t-blue-700.dark:active:border-l-blue-700.dark:active:border-r-blue-500.dark:active:border-b-blue-500.disabled:active:border-t-blue-600.disabled:active:border-l-blue-600.disabled:active:border-r-blue-900.disabled:active:border-b-blue-900.dark:disabled:active:border-t-blue-500.dark:disabled:active:border-l-blue-500.dark:disabled:active:border-r-blue-700.dark:disabled:active:border-b-blue-700.[&[data-loading="true"]:active]:border-t-blue-600.[&[data-loading="true"]:active]:border-l-blue-600.[&[data-loading="true"]:active]:border-r-blue-900.[&[data-loading="true"]:active]:border-b-blue-900.[&[data-loading="true"]:active]:dark:border-t-blue-500.[&[data-loading="true"]:active]:dark:border-l-blue-500.[&[data-loading="true"]:active]:dark:border-r-blue-700.[&[data-loading="true"]:active]:dark:border-b-blue-700`.split(`.`),"solid-warning":`bg-amber-800.dark:bg-amber-600.text-white.hover:bg-amber-950.dark:hover:bg-amber-700.active:bg-amber-900.dark:active:bg-amber-700.disabled:active:bg-amber-800.dark:disabled:active:bg-amber-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-amber-600.border-l-amber-600.border-r-amber-900.border-b-amber-900.dark:border-t-amber-500.dark:border-l-amber-500.dark:border-r-amber-700.dark:border-b-amber-700.active:border-t-amber-900.active:border-l-amber-900.active:border-r-amber-600.active:border-b-amber-600.dark:active:border-t-amber-700.dark:active:border-l-amber-700.dark:active:border-r-amber-500.dark:active:border-b-amber-500.disabled:active:border-t-amber-600.disabled:active:border-l-amber-600.disabled:active:border-r-amber-900.disabled:active:border-b-amber-900.dark:disabled:active:border-t-amber-500.dark:disabled:active:border-l-amber-500.dark:disabled:active:border-r-amber-700.dark:disabled:active:border-b-amber-700.[&[data-loading="true"]:active]:border-t-amber-600.[&[data-loading="true"]:active]:border-l-amber-600.[&[data-loading="true"]:active]:border-r-amber-900.[&[data-loading="true"]:active]:border-b-amber-900.[&[data-loading="true"]:active]:dark:border-t-amber-500.[&[data-loading="true"]:active]:dark:border-l-amber-500.[&[data-loading="true"]:active]:dark:border-r-amber-700.[&[data-loading="true"]:active]:dark:border-b-amber-700`.split(`.`),"solid-danger":`bg-red-800.dark:bg-red-600.text-white.hover:bg-red-950.dark:hover:bg-red-700.active:bg-red-900.dark:active:bg-red-700.disabled:active:bg-red-800.dark:disabled:active:bg-red-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-red-600.border-l-red-600.border-r-red-900.border-b-red-900.dark:border-t-red-500.dark:border-l-red-500.dark:border-r-red-700.dark:border-b-red-700.active:border-t-red-900.active:border-l-red-900.active:border-r-red-600.active:border-b-red-600.dark:active:border-t-red-700.dark:active:border-l-red-700.dark:active:border-r-red-500.dark:active:border-b-red-500.disabled:active:border-t-red-600.disabled:active:border-l-red-600.disabled:active:border-r-red-900.disabled:active:border-b-red-900.dark:disabled:active:border-t-red-500.dark:disabled:active:border-l-red-500.dark:disabled:active:border-r-red-700.dark:disabled:active:border-b-red-700.[&[data-loading="true"]:active]:border-t-red-600.[&[data-loading="true"]:active]:border-l-red-600.[&[data-loading="true"]:active]:border-r-red-900.[&[data-loading="true"]:active]:border-b-red-900.[&[data-loading="true"]:active]:dark:border-t-red-500.[&[data-loading="true"]:active]:dark:border-l-red-500.[&[data-loading="true"]:active]:dark:border-r-red-700.[&[data-loading="true"]:active]:dark:border-b-red-700`.split(`.`),"ghost-action":[`bg-transparent`,`text-slate-800`,`dark:text-slate-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-200`,`active:bg-gray-50`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`active:text-gray-900`,`dark:active:text-white`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-action":[`bg-transparent`,`text-slate-800`,`dark:text-slate-400`,`hover:text-slate-950`,`dark:hover:text-slate-200`,`active:text-slate-900`,`dark:active:text-slate-300`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-300`,`hover:text-gray-900`,`dark:hover:text-gray-100`,`active:text-gray-950`,`dark:active:text-gray-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`hover:text-blue-950`,`dark:hover:text-blue-300`,`active:text-blue-900`,`dark:active:text-blue-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`hover:text-amber-950`,`dark:hover:text-amber-300`,`active:text-amber-900`,`dark:active:text-amber-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`hover:text-red-950`,`dark:hover:text-red-300`,`active:text-red-900`,`dark:active:text-red-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`]},s=o[`${t}-${a}`]||o[`solid-neutral`],c=[...i,...s];if(this.isActive()){let e=this.getActiveStateClasses();c.push(...e)}return this.isFullWidth()&&c.push(`w-full`),c.join(` `)}render(){let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`),r=this.isLoading();if(r)if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),`render`in n&&typeof n.render==`function`&&n.render();else{let e=document.createElement(`span`);e.className=`mr-2 inline-flex items-center`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.className===`mr-2`&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),r?a.style.display=`none`:a.style.display=``,a.classList.remove(`mr-1.5`,`ml-1.5`),c?a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)):o===`left`?a.classList.add(`mr-1.5`):a.classList.add(`ml-1.5`)),r){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?(e.classList.remove(`mr-2`),e.classList.add(`mr-0`)):e.classList.contains(`mr-2`)||(e.classList.remove(`mr-0`),e.classList.add(`mr-2`)))}let l=this.getButtonClasses();this._button.className=l,this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),r?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||customElements.define(`mint-button`,r);var i=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._button=null,this._checked=!1}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container flex items-center gap-2`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`cursor-pointer`,`rounded-full`,`h-5`,`w-10`,`border`,`transition-colors`,`duration-200`,`ease-in-out`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-slate-950`,`dark:bg-slate-600`,e?`border-red-300 dark:border-red-300`:`border-slate-700 dark:border-slate-500`]:[`bg-slate-200`,`dark:bg-slate-400`,e?`border-red-300 dark:border-red-300`:`border-slate-300 dark:border-slate-500`];return[...t,...n].join(` `)}getThumbClasses(){let e=[`relative`,`inline-block`,`rounded-full`,`bg-white`,`dark:bg-gray-50`,`h-4`,`w-4`,`shadow-lg`,`transform`,`transition-transform`,`duration-200`,`ease-in-out`,`pointer-events-none`,`overflow-hidden`],t=this._checked?`translate-x-5`:`translate-x-0.5`;return[...e,t].join(` `)}getIconClasses(){return[`absolute`,`inset-0`,`flex`,`items-center`,`justify-center`,`pointer-events-none`].join(` `)}render(){let e=this.isLoading(),t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,o),this.isDisabled()?(c.classList.add(`opacity-40`,`cursor-not-allowed`),c.classList.remove(`cursor-pointer`)):(c.classList.remove(`opacity-40`,`cursor-not-allowed`),c.classList.add(`cursor-pointer`))):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=o,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`opacity-40`):d.classList.remove(`opacity-40`)):d&&d.remove(),this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.contains(`relative`)||t.classList.add(`relative`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses())}};customElements.get(`mint-switch`)||customElements.define(`mint-switch`,i);var a=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.getAttribute(`bold`)===`true`}isUnderline(){return this.getAttribute(`underline`)===`true`}isStrike(){return this.getAttribute(`strike`)===`true`}isItalic(){return this.getAttribute(`italic`)===`true`}getDisplay(){return this.getAttribute(`display`)||(this.getAttribute(`inline`)===`true`?`inline-block`:`block`)}getTextClasses(){let e=this.getSize(),t=this.getVariant(),n=document.documentElement.classList.contains(`dark`),r={heading:[`font-semibold`],"sub-heading":[`font-medium`],regular:[]},i={default:n?[`text-gray-100`]:[`text-gray-900`],muted:[`text-gray-400`],danger:n?[`text-red-400`]:[`text-red-600`],success:n?[`text-green-400`]:[`text-green-600`]},a=[];this.isBold()&&a.push(`font-bold`),this.isUnderline()&&a.push(`underline`),this.isStrike()&&a.push(`line-through`),this.isItalic()&&a.push(`italic`);let o=this.getDisplay();return[o===`block`?`block`:o===`inline`?`inline`:`inline-block`,...r[e]||r.regular,...i[t]||i.default,...a].join(` `)}render(){let e=this.getSize(),t=[`text-gray-100`,`text-gray-900`,`text-gray-400`,`text-red-400`,`text-red-600`,`text-green-400`,`text-green-600`],n=[`text-2xl`,`text-lg`,`text-sm`];n.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)}),t.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)});let r=this.getTextClasses().split(` `).filter(e=>e.trim());Array.from(this.classList).forEach(e=>{!t.includes(e)&&!n.includes(e)&&this._userClasses.add(e)}),this.className=[...new Set([...r,...Array.from(this._userClasses)])].join(` `);let i={heading:`clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)`,"sub-heading":`clamp(1rem, 1.5vw + 0.5rem, 1.125rem)`,regular:`clamp(0.875rem, 1vw + 0.5rem, 0.875rem)`},a=i[e]||i.regular;this.style.setProperty(`font-size`,a)}};customElements.get(`mint-text`)||customElements.define(`mint-text`,a);var o=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`]}constructor(){super(),this._childObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`text-align`&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{let e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&=(this._childObserver.disconnect(),null)}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`;return parseFloat(e)}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getStackClasses(){let e=this.getDirection(),t=this.getTextAlign(),n=this.getGap(),r=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${n}`];return t&&(r.push(`text-${t}`),r.push(`[&>*]:text-${t}`),r.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?(r.push(`[&>mint-button]:!justify-start`),r.push(`[&>mint-button>button]:!justify-start`)):t===`right`?(r.push(`[&>mint-button]:!justify-end`),r.push(`[&>mint-button>button]:!justify-end`)):t===`center`&&(r.push(`[&>mint-button]:!justify-center`),r.push(`[&>mint-button>button]:!justify-center`))),r.join(` `)}render(){let e=this.getStackClasses(),t=this.getTextAlign();[`flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`gap-3`,`text-left`,`text-center`,`text-right`,`text-justify`,`[&>*]:text-left`,`[&>*]:text-center`,`[&>*]:text-right`,`[&>*]:text-justify`,`[&>*_.mint-button-content]:text-left`,`[&>*_.mint-button-content]:text-center`,`[&>*_.mint-button-content]:text-right`,`[&>*_.mint-button-content]:text-justify`,`[&>mint-button]:!justify-start`,`[&>mint-button]:!justify-center`,`[&>mint-button]:!justify-end`,`[&>mint-button>button]:!justify-start`,`[&>mint-button>button]:!justify-center`,`[&>mint-button>button]:!justify-end`].forEach(e=>this.classList.remove(e)),e.split(` `).forEach(e=>{e&&this.classList.add(e)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(t=>{if(t.tagName===`MINT-BUTTON`){let n=t.querySelector(`button`);if(n){n.classList.remove(`justify-start`,`justify-center`,`justify-end`),e===`left`?n.classList.add(`justify-start`):e===`right`?n.classList.add(`justify-end`):e===`center`&&n.classList.add(`justify-center`);let t=n.querySelector(`.mint-button-content`);t&&(t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`))}}else t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName===`MINT-BUTTON`){let t=e.querySelector(`button`);if(t){t.classList.remove(`justify-start`,`justify-end`),t.classList.add(`justify-center`);let e=t.querySelector(`.mint-button-content`);e&&e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)}}else e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)})}};customElements.get(`mint-stack`)||customElements.define(`mint-stack`,o);var s=class extends HTMLElement{static get observedAttributes(){return[`heading`]}constructor(){super(),this._headingElement=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add(`rounded-lg`,`shadow`,`bg-white`,`dark:bg-gray-900`,`border`,`border-gray-200`,`dark:border-gray-700`,`overflow-hidden`,`transition-colors`,`duration-200`,`mb-6`),this.hasPaddingClass()||this.classList.add(`p-4`);let e=this.getHeading();e?(this._headingElement||(this._headingElement=document.createElement(`mint-text`),this._headingElement.setAttribute(`size`,`sub-heading`),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=e):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}};customElements.get(`mint-card`)||customElements.define(`mint-card`,s);var c=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null,this._contentObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!(this.querySelector(`mint-icon`)||this._link?.querySelector(`mint-icon`))}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=this.hasIcon(),r=[`text-slate-800`,`dark:text-slate-200`,`underline`,`hover:text-slate-950`,`dark:hover:text-slate-100`,`transition-colors`,`duration-200`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`];n&&r.push(`inline-flex`,`items-center`,`gap-2`),this._link.className=r.join(` `),this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)})}};customElements.get(`mint-link`)||customElements.define(`mint-link`,c);var l=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._button=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`flex`,`items-center`,`justify-center`),this.render()}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this.render()}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}_getTargetUrl(){let e=document.referrer,t=window.location.origin;if(e)try{let n=new URL(e);if(n.origin===t)return n.pathname+n.search}catch{}return this.getFallbackHref()}handleClick(e){e.preventDefault(),e.stopPropagation();let t=this._getTargetUrl(),n=document.referrer,r=n&&(()=>{try{return new URL(n).origin===window.location.origin}catch{return!1}})(),i=new CustomEvent(`back`,{detail:{url:t,isFromReferrer:r,referrer:n||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};customElements.get(`mint-back-button`)||customElements.define(`mint-back-button`,l);var u=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null,this._backButton=null,this._backButtonHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this._observeDarkMode(),this._setupBackButtonListener()}attributeChangedCallback(e,t,n){t!==n&&(e===`containered`&&this._applyContainerClasses(),this.render())}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._removeBackButtonListener()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}render(){let e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement(`div`),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement(`div`),this._header.className=`flex justify-between mb-8`,this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement(`div`),this._titleElement.className=`flex gap-4 min-w-0 flex-1`,this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector(`mint-back-button`);if(this.shouldShowBackButton()){t||(t=document.createElement(`mint-back-button`),this._titleElement.insertBefore(t,this._titleElement.firstChild));let e=this.getFallbackHref();t.setAttribute(`fallback-href`,e),this._backButton=t}else t&&(t.remove(),t=null,this._backButton=null);e?(this._headingText?(this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement(`mint-text`),this._headingText.setAttribute(`size`,`heading`),this._headingText.setAttribute(`bold`,`true`),this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&=(this._headingText.remove(),null),this._actionsSlot?this._actionsSlot.classList.contains(`ml-4`)||this._actionsSlot.classList.add(`ml-4`):(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`flex gap-2 items-center ml-4`,this._actionsSlot.setAttribute(`slot`,`actions`),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(e=>e!==this._pageContainer&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{this._actionsSlot&&e.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(e)}),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(e=>{e!==this._pageContainer&&e.getAttribute(`slot`)!==`actions`&&e!==this._actionsSlot&&e!==this._header&&e!==this._bodySlot&&e!==this._headingText&&e.parentElement!==this._bodySlot&&e.parentElement!==this._pageContainer&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add(`min-h-screen`,`p-8`,`transition-colors`,`duration-200`),this.getAttribute(`containered`)===`true`?this._pageContainer.classList.add(`max-w-6xl`,`mx-auto`,`w-full`):this._pageContainer.classList.remove(`max-w-6xl`,`mx-auto`,`w-full`))}_updateBackgroundColor(){this._pageContainer&&(document.documentElement.classList.contains(`dark`)?(this._pageContainer.classList.remove(`bg-gray-20`),this._pageContainer.classList.add(`bg-gray-900`)):(this._pageContainer.classList.remove(`bg-gray-900`),this._pageContainer.classList.add(`bg-gray-20`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_setupBackButtonListener(){this._backButtonHandler||=e=>{let t=e.target;if(t&&t.tagName===`MINT-BACK-BUTTON`){e.stopPropagation();let t=new CustomEvent(`back`,{detail:e.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t)}},this.addEventListener(`back`,this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&=(this.removeEventListener(`back`,this._backButtonHandler,!0),null)}};customElements.get(`mint-page`)||customElements.define(`mint-page`,u);var d=class extends HTMLElement{static get observedAttributes(){return[`columns`,`sm`,`md`,`lg`,`xl`,`gap`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getColumns(){return this.getAttribute(`columns`)||`1`}getSm(){return this.getAttribute(`sm`)}getMd(){return this.getAttribute(`md`)}getLg(){return this.getAttribute(`lg`)}getXl(){return this.getAttribute(`xl`)}getGap(){return`3`}getGridClasses(){let e=[`grid`],t=this.getColumns();e.push(`grid-cols-${t}`);let n=this.getSm();n&&e.push(`sm:grid-cols-${n}`);let r=this.getMd();r&&e.push(`md:grid-cols-${r}`);let i=this.getLg();i&&e.push(`lg:grid-cols-${i}`);let a=this.getXl();a&&e.push(`xl:grid-cols-${a}`);let o=this.getGap();return e.push(`gap-${o}`),e}render(){Array.from(this.classList).filter(e=>e.startsWith(`grid-cols-`)||e.startsWith(`sm:grid-cols-`)||e.startsWith(`md:grid-cols-`)||e.startsWith(`lg:grid-cols-`)||e.startsWith(`xl:grid-cols-`)||e.startsWith(`gap-`)).forEach(e=>this.classList.remove(e)),this.classList.contains(`grid`)||this.classList.add(`grid`),this.getGridClasses().forEach(e=>{e&&e!==`grid`&&this.classList.add(e)})}};customElements.get(`mint-grid`)||customElements.define(`mint-grid`,d);var f=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-50`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}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();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-40`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform`,this._modal.appendChild(e)),this._animateEnter()}else this._animateExit();let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,`true`),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&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.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&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=`p-4 border-t border-gray-200 dark:border-gray-700`,this._actionsSlot.setAttribute(`slot`,`actions`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`justify-end`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&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._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;let e=document.documentElement.classList.contains(`dark`),t=this._modal.querySelector(`.modal-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-gray-900`,`border`,`border-gray-700`)):(t.classList.remove(`bg-gray-900`,`border`,`border-gray-700`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`all 200ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})}))}_animateExit(){let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`hidden`);return}e.style.transition=`all 200ms ease-in`,e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.opacity=``,e.style.transition=``},200)}};customElements.get(`mint-modal`)||customElements.define(`mint-modal`,f);var p=class extends HTMLElement{static get observedAttributes(){return[`id`,`direction`,`open`,`trigger-id`,`padding`,`hover`]}constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}connectedCallback(){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`top-0`,`left-0`,e,`pointer-events-none`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._setupTrigger(),this._observeDarkMode()}_ownsNode(e){return e?!!(this.contains(e)||this._triggerElement?.contains(e)):!1}_isInsideModal(){let e=this;for(;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}if(this._triggerElement)for(e=this._triggerElement;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}return!1}disconnectedCallback(){this._removeHoverListeners(),this._overlay?.remove(),this._popover?.remove(),this._overlay=null,this._popover=null,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&this._triggerElement.removeAttribute(`active`),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}attributeChangedCallback(e,t,n){if(t!==n){if(this.isConnected){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.remove(`z-50`,`z-[60]`),this.classList.add(e)}this.render(),(e===`trigger-id`||e===`hover`)&&this._setupTrigger(),e===`open`&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute(`id`)||``}getPadding(){let e=this.getAttribute(`padding`)||`4`;return{0:`p-0`,"0.5":`p-0.5`,1:`p-1`,"1.5":`p-1.5`,2:`p-2`,"2.5":`p-2.5`,3:`p-3`,"3.5":`p-3.5`,4:`p-4`,5:`p-5`,6:`p-6`,8:`p-8`,10:`p-10`,12:`p-12`,16:`p-16`,20:`p-20`,24:`p-24`}[e]||`p-4`}getDirection(){return this.getAttribute(`direction`)||`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}isHoverEnabled(){return this.getAttribute(`hover`)===`true`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_setupTrigger(){let e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){let e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.getAttribute(`open`)===`true`?e.removeAttribute(`open`):e.setAttribute(`open`,`true`)},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();let e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._triggerElement.addEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement.addEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._popover.addEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover.addEventListener(`mouseleave`,this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener(`mouseleave`,this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){let e=this._triggerElement?this._triggerElement.matches(`:hover`):!1,t=this._popover?this._popover.matches(`:hover`):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:`down`};let e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(`.popover-content`);if(!t)return{top:0,left:0,direction:`down`};this.classList.contains(`hidden`)&&(this.classList.remove(`hidden`),this._popover.style.visibility=`hidden`);let n=t.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=this.getDirection(),o=0,s=0;switch(a){case`down`:if(o=e.bottom+8,s=e.left+e.width/2-n.width/2,o+n.height>i){let t=e.top-n.height-8;t>=0?(a=`up`,o=t):(o=Math.max(0,i-n.height-8),o+n.height>i&&(o=0))}s<0&&(s=8),s+n.width>r&&(s=Math.max(8,r-n.width-8),s+n.width>r&&(s=r-n.width));break;case`up`:if(o=e.top-n.height-8,s=e.left+e.width/2-n.width/2,o<0){let t=e.bottom+8;t+n.height<=i?(a=`down`,o=t):(o=Math.min(i-n.height-8,i-n.height),o<0&&(o=i-n.height))}s<0&&(s=8),s+n.width>r&&(s=Math.max(8,r-n.width-8),s+n.width>r&&(s=r-n.width));break;case`right`:if(o=e.top+e.height/2-n.height/2,s=e.right+8,s+n.width>r){let t=e.left-n.width-8;t>=0?(a=`left`,s=t):(s=Math.max(0,r-n.width-8),s+n.width>r&&(s=r-n.width))}o<0&&(o=8),o+n.height>i&&(o=Math.max(8,i-n.height-8),o+n.height>i&&(o=i-n.height));break;case`left`:if(o=e.top+e.height/2-n.height/2,s=e.left-n.width-8,s<0){let t=e.right+8;t+n.width<=r?(a=`right`,s=t):(s=Math.min(r-n.width-8,r-n.width),s<0&&(s=0))}o<0&&(o=8),o+n.height>i&&(o=Math.max(8,i-n.height-8),o+n.height>i&&(o=i-n.height));break}return{top:o,left:s,direction:a}}render(){let e=this.getId(),t=this.isOpen(),n=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove(`hidden`),this.style.pointerEvents=`auto`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.setAttribute(`active`,`true`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),!this._clickOutsideHandler){let e=this;this._clickOutsideHandler=function(t){let n=t.composedPath(),r=n.some(t=>t===e?!0:t instanceof Node?e._ownsNode(t):!1);if(!(e._triggerElement&&n.includes(e._triggerElement))&&!r){e.close();return}},setTimeout(()=>{document.addEventListener(`click`,this._clickOutsideHandler,!1)},100)}}else this.classList.add(`hidden`),this.style.pointerEvents=`none`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute(`active`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null);if(this._overlay){let e=this._isInsideModal()?`z-[55]`:`z-40`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this._overlay.parentElement!==this&&this.appendChild(this._overlay)}else{this._overlay=document.createElement(`div`);let e=this._isInsideModal()?`z-[55]`:`z-40`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this.appendChild(this._overlay)}if(this._popover){let e=this._isInsideModal()?`z-[60]`:`z-50`;this._popover.className=`fixed ${e} pointer-events-auto`,this._popover.parentElement!==this&&this.appendChild(this._popover)}else{this._popover=document.createElement(`div`);let e=this._isInsideModal()?`z-[60]`:`z-50`;this._popover.className=`fixed ${e} pointer-events-auto`,this.appendChild(this._popover)}this.isHoverEnabled()&&this._attachHoverListeners();let r=this._popover.querySelector(`.popover-content`);if(!r)r=document.createElement(`div`),r.className=`popover-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl ${n} transition-all duration-200 ease-out transform`,this._popover.appendChild(r);else{let e=r.className.split(` `),t=[`p-0`,`p-0.5`,`p-1`,`p-1.5`,`p-2`,`p-2.5`,`p-3`,`p-3.5`,`p-4`,`p-5`,`p-6`,`p-8`,`p-10`,`p-12`,`p-16`,`p-20`,`p-24`],i=e.filter(e=>!t.includes(e));r.className=[...i,n].join(` `)}Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._popover&&e.parentElement===this&&r.appendChild(e)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(r):(this._popover.style.top=`50%`,this._popover.style.left=`50%`,this._popover.style.transform=`translate(-50%, -50%)`,this._popover.style.visibility=`visible`,this._popover.style.display=`block`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,r.style.transition=`all 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.transform=`scale(1) translateY(0)`,r.style.opacity=`1`})}))):!t&&r&&(this._removePositionListeners(),r.style.opacity!==`0`&&r.style.opacity!==``&&(r.style.transition=`all 200ms ease-in`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,setTimeout(()=>{r.style.transform=``,r.style.opacity=``,r.style.transition=``,this._popover.style.visibility=``,this._popover.style.display=``},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;let e=document.documentElement.classList.contains(`dark`),t=this._popover.querySelector(`.popover-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-gray-900`,`border`,`border-gray-700`)):(t.classList.remove(`bg-gray-900`,`border`,`border-gray-700`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;let t=this._popover.style.visibility!==`hidden`;t||(this._popover.style.visibility=`hidden`,this._popover.style.display=`block`,this._popover.style.top=`0`,this._popover.style.left=`0`),this._popover.offsetHeight;let n=this._calculatePosition();this._popover.style.top=`${n.top}px`,this._popover.style.left=`${n.left}px`,t||(this._popover.style.visibility=`visible`,e&&(!e.style.opacity||e.style.opacity===``)&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`all 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){let e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`scroll`,this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){let e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`resize`,this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_closeOtherPopovers(){Array.from(document.querySelectorAll(`mint-popover[open]`)).forEach(e=>{if(e!==this){let t=e;typeof t.close==`function`?t.close():e.removeAttribute(`open`)}})}};customElements.get(`mint-popover`)||customElements.define(`mint-popover`,p);var m=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`error`,`error-message`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-flex`,`items-start`,`gap-2`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render(),e===`checked`&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getCheckboxClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`justify-center`,`flex-shrink-0`,`w-5`,`h-5`,`rounded`,`border-2`,`transition-all`,`duration-200`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`cursor-pointer`,`disabled:opacity-40`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-slate-800`,`dark:bg-slate-600`,e?`border-red-300 dark:border-red-300`:`border-slate-800 dark:border-slate-600`]:[`bg-white`,`dark:bg-gray-700`,e?`border-red-300 dark:border-red-300`:`border-gray-300 dark:border-gray-500`];return[...t,...n].join(` `)}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-container`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-container relative inline-flex items-start gap-2`,this.insertBefore(i,this.firstChild));let a=this.querySelector(`.mint-checkbox-wrapper`);a?a.parentElement!==i&&i.appendChild(a):(a=document.createElement(`div`),a.className=`mint-checkbox-wrapper`,i.appendChild(a)),this._checkbox?this._checkbox.parentElement!==a&&a.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,a.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let o=this.getId();o?this._checkbox.id=o:this._checkbox.removeAttribute(`id`);let s=this.getName();s?this._checkbox.name=s:this._checkbox.removeAttribute(`name`);let c=this.getValue();c?this._checkbox.value=c:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),a.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,a.style.cursor=`pointer`,a.style.pointerEvents=`auto`,this._checkbox.style.pointerEvents=`auto`;let l=a;l._wrapperClickHandler||(l._wrapperClickHandler=e=>{e.target===a&&!r&&(e.preventDefault(),e.stopPropagation(),this.toggle())},a.addEventListener(`click`,l._wrapperClickHandler));let u=a.querySelector(`mint-icon`);u||(u=document.createElement(`mint-icon`),u.setAttribute(`name`,`check`),u.className=`w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto`,u.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,u.style.zIndex=`1`,a.appendChild(u)),this.updateVisualState();let d=this.querySelector(`.mint-checkbox-label-container`),f=this.querySelector(`.mint-checkbox-container`);if(t||n){d?f&&d.parentElement!==f&&f.appendChild(d):(d=document.createElement(`div`),d.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,f?f.appendChild(d):this.appendChild(d));let e=d.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none`,d.insertBefore(e,d.firstChild)),e.textContent=t,r?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let i=d.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none`,d.appendChild(i)),i.textContent=n,r?i.classList.add(`opacity-40`):i.classList.remove(`opacity-40`)):i&&i.remove(),r)d.style.cursor=`default`,d._clickHandler&&(d.removeEventListener(`click`,d._clickHandler),d._clickHandler=null);else{d.style.cursor=`pointer`;let e=d._clickHandler;e&&d.removeEventListener(`click`,e),d._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},d.addEventListener(`click`,d._clickHandler)}}else d&&d.remove();this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState();let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));let n=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(n)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(15 23 42)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(51 65 85)`:t.style.backgroundColor=`rgb(31 41 55)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._focusHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(`:focus-visible`)&&t?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{let e=this.querySelector(`.mint-checkbox-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._checkbox.addEventListener(`focus`,this._focusHandler),this._checkbox.addEventListener(`blur`,this._blurHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(15 23 42)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(51 65 85)`:t.style.backgroundColor=`rgb(31 41 55)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null),this._focusHandler&&=(this._checkbox.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._checkbox.removeEventListener(`blur`,this._blurHandler),null));let e=this.querySelector(`.mint-checkbox-wrapper`);if(e){let t=e;t._wrapperClickHandler&&=(e.removeEventListener(`click`,t._wrapperClickHandler),null)}}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState(),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}_renderSkeleton(e){let t=this.querySelector(`.mint-checkbox-skeleton-container`),n=this.querySelector(`.mint-checkbox-container`),r=this.querySelector(`.mint-checkbox-wrapper`),i=this.querySelector(`.mint-checkbox-label-container`);if(e){t||(t=document.createElement(`div`),t.className=`mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-checkbox-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e)),i){let e=t.querySelector(`.mint-checkbox-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e))}t.style.display=`flex`,r&&(r.style.visibility=`hidden`,r.style.pointerEvents=`none`),i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.visibility=`visible`,r.style.pointerEvents=`auto`),i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-checkbox-label-container`);!n&&e&&t&&(n=document.createElement(`div`),n.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,this.appendChild(n));let r=this.querySelector(`.mint-checkbox-error`);e&&t?(r?(r.classList.add(`block`,`w-full`),r.style.display=`block`,(n&&r.parentElement!==n||n&&r.parentElement===n)&&n.appendChild(r)):(r=document.createElement(`div`),r.className=`mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full`,r.style.display=`block`,n?n.appendChild(r):this.appendChild(r)),r.textContent=t):r&&r.remove();let i=this.querySelector(`.mint-checkbox-wrapper`);i&&(i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}};customElements.get(`mint-checkbox`)||customElements.define(`mint-checkbox`,m);var h=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`,`info`]}constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}connectedCallback(){this.classList.add(`inline-flex`,`items-start`,`gap-2`,`cursor-pointer`,`select-none`);let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._focusHandler&&=(this._radio.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._radio.removeEventListener(`blur`,this._blurHandler),null),this._keydownHandler&&=(this._radio.removeEventListener(`keydown`,this._keydownHandler),null))}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),t!==n){if(e===`loading`){this.render();return}if(e===`info`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{this._checked=!!e,e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute(`value`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){let e=this.getAttribute(`disabled`)===`true`,t=this.closest(`mint-choice`)?.getAttribute(`disabled`)===`true`;return e||t}_setupClickHandler(){this._clickHandler||(this._clickHandler=e=>{e.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let e=this.closest(`mint-choice`);e&&e.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener(`click`,this._clickHandler))}render(){let e=this.isLoading(),t=this.isDisabled(),n=this.getValue(),r=this.closest(`mint-choice`)?.getAttribute(`name`)||``,i=``,a=this.querySelector(`.mint-choice-option-label`);if(a)i=a.textContent?.trim()||``;else{let e=this.querySelector(`.mint-choice-option-label-container`);Array.from(this.childNodes).forEach(t=>{if(t!==e&&t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&(i+=e)}})}let o=this.querySelectorAll(`.mint-choice-option-wrapper`),s=null;o.length>0&&(this._radio&&(s=Array.from(o).find(e=>e.contains(this._radio))),s||=o[0],o.forEach((e,t)=>{e!==s&&e.remove()})),s||(s=document.createElement(`div`),s.className=`mint-choice-option-wrapper`,s.style.position=`relative`,this.insertBefore(s,this.firstChild)),s.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,s.style.position=`relative`,this.querySelectorAll(`input[type="radio"]`).forEach(e=>{e!==this._radio&&e.remove()}),this._radio?(this._radio.parentElement!==s&&s.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener(`change`,this._changeHandler),this._radio.addEventListener(`change`,this._changeHandler)),this._radio&&(this._focusHandler||=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._blurHandler||=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._keydownHandler||=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.removeEventListener(`focus`,this._focusHandler),this._radio.removeEventListener(`blur`,this._blurHandler),this._radio.removeEventListener(`keydown`,this._keydownHandler),this._radio.addEventListener(`focus`,this._focusHandler),this._radio.addEventListener(`blur`,this._blurHandler),this._radio.addEventListener(`keydown`,this._keydownHandler))):(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`sr-only`,this._radio.style.position=`absolute`,this._radio.style.width=`1px`,this._radio.style.height=`1px`,this._radio.style.padding=`0`,this._radio.style.margin=`-1px`,this._radio.style.overflow=`hidden`,this._radio.style.clip=`rect(0, 0, 0, 0)`,this._radio.style.whiteSpace=`nowrap`,this._radio.style.border=`0`,s.appendChild(this._radio),this._changeHandler=e=>{let t=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let n=this.closest(`mint-choice`);t!==this._checked&&n&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener(`change`,this._changeHandler),this._radio.addEventListener(`click`,()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState())}),this._focusHandler=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`focus`,this._focusHandler),this._blurHandler=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`blur`,this._blurHandler),this._keydownHandler=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener(`keydown`,this._keydownHandler)),this._radio.name=r,this._radio.value=n,this._radio.checked===this._checked?this._radio.checked=this._checked:(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`)),this._radio.disabled=t,t?this._radio.setAttribute(`tabindex`,`-1`):this._radio.removeAttribute(`tabindex`),i?this._radio.setAttribute(`aria-label`,i):this._radio.removeAttribute(`aria-label`),s.querySelectorAll(`.mint-choice-option-indicator`).forEach((e,t)=>{t>0&&e.remove()});let c=s.querySelector(`.mint-choice-option-indicator`);c||(c=document.createElement(`div`),c.className=`mint-choice-option-indicator`,s.appendChild(c)),c.className=`mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none`,c.style.position=`absolute`,c.style.top=`50%`,c.style.left=`50%`,c.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`,c.style.opacity=this._checked?`1`:`0`,this._updateVisualState(),this._renderSkeleton(e);let l=this.getInfo(),u=this.querySelector(`.mint-choice-option-label-container`);if(i||l){u||(u=document.createElement(`div`),u.className=`mint-choice-option-label-container flex flex-col gap-0.5`,this.appendChild(u),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()&&e!==u&&(e.textContent=``)}));let e=u.querySelector(`.mint-choice-option-label`);i?(e||(e=document.createElement(`span`),e.className=`mint-choice-option-label`,u.appendChild(e)),e.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t?`opacity-40`:``}`,e.textContent=i):e&&e.remove();let n=u.querySelector(`.mint-choice-option-info`);l?(n||(n=document.createElement(`span`),n.className=`mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none`,u.appendChild(n)),n.textContent=l,t?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else u&&u.remove();t?(this.classList.add(`cursor-not-allowed`),this.classList.remove(`cursor-pointer`)):(this.classList.add(`cursor-pointer`),this.classList.remove(`cursor-not-allowed`)),this._updateVisualState()}_getWrapperClasses(){let e=this.isDisabled(),t=[`inline-flex`,`items-center`,`justify-center`,`w-[1rem]`,`h-[1rem]`,`rounded-full`,`border-2`,`transition-all`,`duration-200`,`flex-shrink-0`,`mt-0.5`];return e&&t.push(`opacity-40`,`cursor-not-allowed`),this._checked?t.push(`bg-slate-800`,`dark:bg-slate-600`,`border-slate-800`,`dark:border-slate-600`):t.push(`bg-white`,`dark:bg-gray-900`,`border-gray-300`,`dark:border-gray-500`),t.join(` `)}_updateVisualState(){let e=this.querySelector(`.mint-choice-option-wrapper`);e&&(e.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);let t=this.querySelector(`.mint-choice-option-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-option-skeleton-container`),n=this.querySelector(`.mint-choice-option-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-choice-option-skeleton-radio`);if(e||(e=document.createElement(`div`),e.className=`mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`hidden`),t&&(t.style.visibility=`hidden`),n.style.pointerEvents=`none`}}else{if(t&&(t.style.display=`none`),n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`visible`),t&&(t.style.visibility=`visible`),n.style.pointerEvents=`auto`}let e=this.querySelector(`.mint-choice-option-label`);e&&!n?.contains(e)&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`)}}_updateGroupState(){this._radio?.name&&document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(e=>{if(e===this._radio)return;let t=e.closest(`mint-choice-option`);t&&t!==this&&(t._checked=e.checked,e.checked?t.setAttribute(`checked`,`true`):t.removeAttribute(`checked`),t._updateVisualState())})}_focusNextOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>=0&&t<e.length-1?n=e[t+1]:e.length>0&&(n=e[0]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}_focusPreviousOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>0?n=e[t-1]:e.length>0&&(n=e[e.length-1]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}};customElements.get(`mint-choice-option`)||customElements.define(`mint-choice-option`,h);var g=class extends HTMLElement{static get observedAttributes(){return[`label`,`name`,`info`,`error`,`error-message`,`id`,`disabled`,`required`,`loading`]}constructor(){super(),this._optionsContainer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.addEventListener(`choice-change`,e=>{let t=e.detail?.value||this.getValue();(this.getAttribute(`value`)||``)!==t&&(t?this.setAttribute(`value`,t):this.removeAttribute(`value`));let n=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute(`loading`)}attributeChangedCallback(e,t,n){t!==n&&(e===`error`||e===`error-message`?this._renderErrorState():e===`loading`?(this.render(),this.querySelectorAll(`mint-choice-option`).forEach(e=>{this.isLoading()?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`)})):(this.render(),e===`name`&&this.querySelectorAll(`mint-choice-option`).forEach(e=>{typeof e.render==`function`&&e.render()})))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}getValue(){return this.querySelector(`input[type="radio"]:checked`)?.value||``}setValue(e){let t=this.querySelectorAll(`mint-choice-option`);t.forEach(t=>{if((t.getAttribute(`value`)||``)===e){let e=t;e.checked=!0;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!0,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=t;e.checked=!1;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!1)}}),requestAnimationFrame(()=>{t.forEach(e=>{typeof e._updateVisualState==`function`&&e._updateVisualState();let t=e.querySelector(`input[type="radio"]`);if(t){let n=e;t.checked!==n.checked&&(t.checked=n.checked)}})})}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,r);let i=this.isDisabled(),a=this.querySelector(`.mint-choice-label-container`);if(t||n){a||(a=document.createElement(`div`),a.className=`mint-choice-label-container flex flex-col gap-0.5 mb-2`,this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-choice-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.insertBefore(e,a.firstChild)),e.textContent=t,e.setAttribute(`for`,r),i?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let o=a.querySelector(`.mint-choice-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none`,a.appendChild(o)),o.textContent=n,i?o.classList.add(`opacity-40`):o.classList.remove(`opacity-40`)):o&&o.remove()}else a&&a.remove();let o=this.querySelector(`.mint-choice-options-wrapper`);if(!o){o=document.createElement(`div`),o.className=`mint-choice-options-wrapper relative`;let e=this.querySelector(`.mint-choice-label-container`);e&&e.parentElement===this?this.insertBefore(o,e.nextSibling):this.insertBefore(o,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==o&&o.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement(`div`),this._optionsContainer.className=`mint-choice-options-container flex flex-col gap-3`,o.appendChild(this._optionsContainer)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==this._optionsContainer).forEach(e=>{this._optionsContainer.appendChild(e)}),this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-skeleton-container`),n=this.querySelector(`.mint-choice-options-wrapper`),r=this.querySelector(`.mint-choice-options-container`);if(e){if(t||(t=document.createElement(`div`),t.className=`mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t))),t.querySelectorAll(`.mint-choice-option-skeleton`).length===0)for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`mint-choice-option-skeleton flex items-center gap-3`;let n=document.createElement(`div`);n.className=`flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,e.appendChild(n);let r=document.createElement(`div`);r.className=`h-4 w-20 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,e.appendChild(r),t.appendChild(e)}t.style.display=`flex`,r&&(r.style.opacity=`0`,r.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.opacity=`1`,r.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-choice-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-choice`)||customElements.define(`mint-choice`,g);var _=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorPicker?.value||this._colorTextInput?.value||this.getAttribute(`value`)||`#000000`:this._element?.value||this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this._isColor(),r=this._isNumber(),i=this.hasError(),a=[`w-full`,t||n?`pl-10`:`px-3.5`,t||n?`pr-3.5`:r?`pr-10`:``,e?`py-2`:`py-1.5`,e?`min-h-[6rem]`:`min-h-[2rem]`,`text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-gray-900`,`text-gray-900`,`dark:text-white`,e?`transition-colors transition-opacity`:`transition-all`,`duration-200`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`readonly:cursor-default`,e?`resize-y`:``,r?`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`:``],o=[`border-2`,i?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-gray-700`],s=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,i?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...a,...o,...s].filter(Boolean).join(` `)}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,this._colorPickerWrapper.style.backgroundColor=u||`#000000`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._colorPicker.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?(this._colorPickerWrapper.classList.add(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.remove(`cursor-pointer`)):(this._colorPickerWrapper.classList.remove(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.add(`cursor-pointer`))),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`w-[1rem] h-[1rem]`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`w-[1rem] h-[1rem]`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`opacity-40`):t.classList.remove(`opacity-40`)):t&&t.remove()}else g&&g.remove();this._renderErrorState(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.relative.w-full`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);if(!e){e=document.createElement(`div`),e.className=`mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse`;let n=this._isTextarea(),r=this.getRows();if(n){let t=r*24+12;e.style.height=`${t}px`}else e.style.height=`2.2rem`;t.appendChild(e)}t.style.display=`block`,this._element&&(this._element.style.opacity=`0`,this._element.style.pointerEvents=`none`),this._colorTextInput&&(this._colorTextInput.style.opacity=`0`,this._colorTextInput.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._element&&(this._element.style.opacity=`1`,this._element.style.pointerEvents=`auto`),this._colorTextInput&&(this._colorTextInput.style.opacity=`1`,this._colorTextInput.style.pointerEvents=`auto`)}};customElements.get(`mint-input`)||customElements.define(`mint-input`,_);var v=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.className+=` w-[40px]`:e===2&&(a.className+=` w-[30px]`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId(),c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`relative w-full`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`);let h=a?`select-text`:`select-none`;this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${a?`cursor-default`:`cursor-text`} ${h} focus:outline-none`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`flex items-center gap-1 w-full`;let g=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let _=e=>{let t=document.createDocumentFragment();return g.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`text-gray-400 dark:text-gray-500 select-none`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o);e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`flex items-center gap-1 flex-shrink-0`,e.appendChild(_(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`text-gray-400 dark:text-gray-500 select-none flex-shrink-0`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`flex items-center gap-1 flex-shrink-0`,n.appendChild(_(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(_(`start`));let v=document.createElement(`div`);if(v.className=`flex flex-col w-full`,this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`,v.appendChild(this._displayEl),v.appendChild(this._inputsWrapperEl),m.appendChild(v),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,g,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,g,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm`;let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`w-4 h-4 pointer-events-none`,this._iconButton.appendChild(t),this._iconButton.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`)}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return[`mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-900 dark:border dark:border-gray-700 text-gray-900 dark:text-white`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-gray-700`,`transition-all duration-200 outline-none focus-within:ring-2 focus-within:ring-offset-1`,e?`focus-within:ring-red-400 dark:focus-within:ring-red-500`:`focus-within:ring-gray-400 dark:focus-within:ring-gray-500`,`flex items-center gap-1`].join(` `)+(t?` opacity-40 cursor-not-allowed`:``)}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView();let t=this._popover.querySelector(`.popover-content`);if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=s?`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]`:`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:min-w-[18rem]`;let c=document.createElement(`div`);c.className=`flex flex-col md:flex-row md:gap-6 md:items-start`;let l=document.createElement(`div`);l.className=`flex-1 min-w-0`;let u=document.createElement(`div`);u.className=`flex items-center justify-between mb-4`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`w-4 h-4`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`flex items-center gap-2`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth];let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`w-4 h-4`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`grid grid-cols-7 mb-2`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`grid grid-cols-7`;let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`rounded-md`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`rounded-md`:t?s=`rounded-l-md`:n?s=`rounded-r-md`:a&&(s=`rounded-none`)}else c&&(d||f)&&m?d&&f?s=`rounded-md`:d?s=`rounded-l-md`:f&&(s=`rounded-r-md`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`rounded-md`:a&&c&&m&&(s=`rounded-none`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=`w-full h-8 ${s} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_=i||c&&p&&m;return n?g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:r?` text-gray-900 dark:text-gray-100 font-semibold`:` text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700`:g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:` text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700`,g+=o?` opacity-40 cursor-not-allowed`:``,h.className=g,h.textContent=t.toString(),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`active`,`bg-gray-200`,`dark:bg-gray-600`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col`;let t=document.createElement(`div`);t.className=`relative md:relative md:flex-1 md:min-h-0`;let n=document.createElement(`div`);n.className=`flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2`,n.style.scrollbarWidth=`none`,n.style.msOverflowStyle=`none`,n.style.setProperty(`-webkit-overflow-scrolling`,`touch`);let r=document.createElement(`style`);r.textContent=`
|
|
58
|
+
`,document.head.appendChild(t),e._activeShadowStyleInjected=!0}this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._button&&this.setupEventListeners(),this.isFullWidth()&&this.classList.add(`w-full`)}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getVariant(){return this.getAttribute(`variant`)||`solid`}getTone(){return this.getAttribute(`tone`)||`neutral`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}getType(){let e=this.getAttribute(`type`),t=this.getAttribute(`button-type`);return(e||t||`default`)===`submit`?`submit`:`button`}isFullWidth(){return this.getAttribute(`full-width`)===`true`}isActive(){return this.getAttribute(`active`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.removeAttribute(`active`)}getIconPosition(){return this.getAttribute(`icon-position`)||`left`}getIcon(){return this.getAttribute(`icon`)||``}getAlignment(){let e=this.getAttribute(`align`);return e===`left`||e===`center`||e===`right`?e:`center`}isIconOnly(){if(!(this.getIcon()||this._getGeneratedIcon()||this._button?.querySelector(`mint-icon`)))return!1;let e=this._button?.querySelector(`.mint-button-content`);if(e&&e.textContent?.trim())return!1;if(this._button)for(let e=this._button.firstChild;e;e=e.nextSibling){if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return!1;if(e.nodeType===Node.ELEMENT_NODE){let t=e;if(t.tagName!==`MINT-ICON`&&t.tagName!==`MINT-SPINNER`&&!t.querySelector(`mint-spinner`)&&!t.hasAttribute(`slot`)&&t.className!==`mint-button-icon`&&!(t.className===`mr-2`&&t.querySelector(`mint-spinner`))&&t.textContent?.trim())return!1}}return!0}getActiveStateClasses(){let e=`${this.getVariant()}-${this.getTone()}`;return{"solid-action":[`!bg-slate-900`,`dark:!bg-slate-700`,`hover:!bg-slate-900`,`dark:hover:!bg-slate-700`,`!border-t-slate-900`,`!border-l-slate-900`,`!border-r-slate-600`,`!border-b-slate-600`,`dark:!border-t-slate-700`,`dark:!border-l-slate-700`,`dark:!border-r-slate-500`,`dark:!border-b-slate-500`],"solid-neutral":[`!bg-gray-100`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`!border-t-gray-400`,`!border-l-gray-400`,`!border-r-gray-200`,`!border-b-gray-200`,`dark:!border-t-gray-950`,`dark:!border-l-gray-950`,`dark:!border-r-gray-700`,`dark:!border-b-gray-700`],"solid-info":[`!bg-blue-900`,`dark:!bg-blue-700`,`hover:!bg-blue-900`,`dark:hover:!bg-blue-700`,`!border-t-blue-900`,`!border-l-blue-900`,`!border-r-blue-600`,`!border-b-blue-600`,`dark:!border-t-blue-700`,`dark:!border-l-blue-700`,`dark:!border-r-blue-500`,`dark:!border-b-blue-500`],"solid-warning":[`!bg-amber-900`,`dark:!bg-amber-700`,`hover:!bg-amber-900`,`dark:hover:!bg-amber-700`,`!border-t-amber-900`,`!border-l-amber-900`,`!border-r-amber-600`,`!border-b-amber-600`,`dark:!border-t-amber-700`,`dark:!border-l-amber-700`,`dark:!border-r-amber-500`,`dark:!border-b-amber-500`],"solid-danger":[`!bg-red-900`,`dark:!bg-red-700`,`hover:!bg-red-900`,`dark:hover:!bg-red-700`,`!border-t-red-900`,`!border-l-red-900`,`!border-r-red-600`,`!border-b-red-600`,`dark:!border-t-red-700`,`dark:!border-l-red-700`,`dark:!border-r-red-500`,`dark:!border-b-red-500`],"ghost-action":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-neutral":[`!bg-gray-50`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`!text-gray-900`,`dark:!text-white`,`hover:!bg-gray-50`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`hover:!text-gray-900`,`dark:hover:!text-white`],"ghost-info":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-warning":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"ghost-danger":[`!bg-gray-100`,`!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:!bg-gray-800`,`hover:!bg-gray-100`,`dark:hover:!bg-gray-800`,`hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`],"link-action":[`!text-slate-900`,`dark:!text-slate-300`,`hover:!text-slate-900`,`dark:hover:!text-slate-300`],"link-neutral":[`!text-gray-950`,`dark:!text-gray-200`,`hover:!text-gray-950`,`dark:hover:!text-gray-200`],"link-info":[`!text-blue-900`,`dark:!text-blue-200`,`hover:!text-blue-900`,`dark:hover:!text-blue-200`],"link-warning":[`!text-amber-900`,`dark:!text-amber-200`,`hover:!text-amber-900`,`dark:hover:!text-amber-200`],"link-danger":[`!text-red-900`,`dark:!text-red-200`,`hover:!text-red-900`,`dark:hover:!text-red-200`]}[e]||[]}getButtonClasses(){let e=this.isIconOnly(),t=this.getVariant(),n=this.getAlignment(),r=`justify-center`;n===`left`?r=`justify-start`:n===`right`&&(r=`justify-end`);let i=[`inline-flex`,`items-center`,r,`cursor-pointer`,`font-medium`,`rounded-lg`,`box-border`,...e?[`p-1.5`,`aspect-square`,`w-[2.25rem]`,`h-[2.25rem]`]:[`px-3.5`,`py-1.5`,`min-h-[2.25rem]`],`text-sm`,`transition-all`,`duration-100`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`[&.mint-button-active:not(:disabled):not([data-loading="true"]):not([data-variant="ghost"]):not([data-variant="link"])>*]:translate-y-[1px]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],a=this.getTone(),o={"solid-action":`bg-slate-800.dark:bg-slate-600.text-white.hover:bg-slate-950.dark:hover:bg-slate-700.active:bg-slate-900.dark:active:bg-slate-700.disabled:active:bg-slate-800.dark:disabled:active:bg-slate-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-slate-600.border-l-slate-600.border-r-slate-900.border-b-slate-900.dark:border-t-slate-500.dark:border-l-slate-500.dark:border-r-slate-700.dark:border-b-slate-700.active:border-t-slate-900.active:border-l-slate-900.active:border-r-slate-600.active:border-b-slate-600.dark:active:border-t-slate-700.dark:active:border-l-slate-700.dark:active:border-r-slate-500.dark:active:border-b-slate-500.disabled:active:border-t-slate-600.disabled:active:border-l-slate-600.disabled:active:border-r-slate-900.disabled:active:border-b-slate-900.dark:disabled:active:border-t-slate-500.dark:disabled:active:border-l-slate-500.dark:disabled:active:border-r-slate-700.dark:disabled:active:border-b-slate-700.[&[data-loading="true"]:active]:border-t-slate-600.[&[data-loading="true"]:active]:border-l-slate-600.[&[data-loading="true"]:active]:border-r-slate-900.[&[data-loading="true"]:active]:border-b-slate-900.[&[data-loading="true"]:active]:dark:border-t-slate-500.[&[data-loading="true"]:active]:dark:border-l-slate-500.[&[data-loading="true"]:active]:dark:border-r-slate-700.[&[data-loading="true"]:active]:dark:border-b-slate-700`.split(`.`),"solid-neutral":`bg-white.dark:bg-gray-900.text-gray-900.dark:text-white.hover:bg-gray-50.dark:hover:bg-gray-800.active:bg-gray-100.dark:active:bg-gray-800.disabled:active:bg-white.dark:disabled:active:bg-gray-900.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-gray-200.border-l-gray-200.border-r-gray-300.border-b-gray-300.dark:border-t-gray-600.dark:border-l-gray-600.dark:border-r-gray-700.dark:border-b-gray-700.active:border-t-gray-400.active:border-l-gray-400.active:border-r-gray-200.active:border-b-gray-200.dark:active:border-t-gray-950.dark:active:border-l-gray-950.dark:active:border-r-gray-700.dark:active:border-b-gray-700.disabled:active:border-t-gray-200.disabled:active:border-l-gray-200.disabled:active:border-r-gray-400.disabled:active:border-b-gray-400.dark:disabled:active:border-t-gray-700.dark:disabled:active:border-l-gray-700.dark:disabled:active:border-r-gray-950.dark:disabled:active:border-b-gray-950.[&[data-loading="true"]:active]:border-t-gray-200.[&[data-loading="true"]:active]:border-l-gray-200.[&[data-loading="true"]:active]:border-r-gray-400.[&[data-loading="true"]:active]:border-b-gray-400.[&[data-loading="true"]:active]:dark:border-t-gray-700.[&[data-loading="true"]:active]:dark:border-l-gray-700.[&[data-loading="true"]:active]:dark:border-r-gray-950.[&[data-loading="true"]:active]:dark:border-b-gray-950`.split(`.`),"solid-info":`bg-blue-800.dark:bg-blue-600.text-white.hover:bg-blue-950.dark:hover:bg-blue-700.active:bg-blue-900.dark:active:bg-blue-700.disabled:active:bg-blue-800.dark:disabled:active:bg-blue-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-blue-600.border-l-blue-600.border-r-blue-900.border-b-blue-900.dark:border-t-blue-500.dark:border-l-blue-500.dark:border-r-blue-700.dark:border-b-blue-700.active:border-t-blue-900.active:border-l-blue-900.active:border-r-blue-600.active:border-b-blue-600.dark:active:border-t-blue-700.dark:active:border-l-blue-700.dark:active:border-r-blue-500.dark:active:border-b-blue-500.disabled:active:border-t-blue-600.disabled:active:border-l-blue-600.disabled:active:border-r-blue-900.disabled:active:border-b-blue-900.dark:disabled:active:border-t-blue-500.dark:disabled:active:border-l-blue-500.dark:disabled:active:border-r-blue-700.dark:disabled:active:border-b-blue-700.[&[data-loading="true"]:active]:border-t-blue-600.[&[data-loading="true"]:active]:border-l-blue-600.[&[data-loading="true"]:active]:border-r-blue-900.[&[data-loading="true"]:active]:border-b-blue-900.[&[data-loading="true"]:active]:dark:border-t-blue-500.[&[data-loading="true"]:active]:dark:border-l-blue-500.[&[data-loading="true"]:active]:dark:border-r-blue-700.[&[data-loading="true"]:active]:dark:border-b-blue-700`.split(`.`),"solid-warning":`bg-amber-800.dark:bg-amber-600.text-white.hover:bg-amber-950.dark:hover:bg-amber-700.active:bg-amber-900.dark:active:bg-amber-700.disabled:active:bg-amber-800.dark:disabled:active:bg-amber-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-amber-600.border-l-amber-600.border-r-amber-900.border-b-amber-900.dark:border-t-amber-500.dark:border-l-amber-500.dark:border-r-amber-700.dark:border-b-amber-700.active:border-t-amber-900.active:border-l-amber-900.active:border-r-amber-600.active:border-b-amber-600.dark:active:border-t-amber-700.dark:active:border-l-amber-700.dark:active:border-r-amber-500.dark:active:border-b-amber-500.disabled:active:border-t-amber-600.disabled:active:border-l-amber-600.disabled:active:border-r-amber-900.disabled:active:border-b-amber-900.dark:disabled:active:border-t-amber-500.dark:disabled:active:border-l-amber-500.dark:disabled:active:border-r-amber-700.dark:disabled:active:border-b-amber-700.[&[data-loading="true"]:active]:border-t-amber-600.[&[data-loading="true"]:active]:border-l-amber-600.[&[data-loading="true"]:active]:border-r-amber-900.[&[data-loading="true"]:active]:border-b-amber-900.[&[data-loading="true"]:active]:dark:border-t-amber-500.[&[data-loading="true"]:active]:dark:border-l-amber-500.[&[data-loading="true"]:active]:dark:border-r-amber-700.[&[data-loading="true"]:active]:dark:border-b-amber-700`.split(`.`),"solid-danger":`bg-red-800.dark:bg-red-600.text-white.hover:bg-red-950.dark:hover:bg-red-700.active:bg-red-900.dark:active:bg-red-700.disabled:active:bg-red-800.dark:disabled:active:bg-red-600.focus-visible:ring-gray-400.dark:focus-visible:ring-gray-500.border-2.border-t-red-600.border-l-red-600.border-r-red-900.border-b-red-900.dark:border-t-red-500.dark:border-l-red-500.dark:border-r-red-700.dark:border-b-red-700.active:border-t-red-900.active:border-l-red-900.active:border-r-red-600.active:border-b-red-600.dark:active:border-t-red-700.dark:active:border-l-red-700.dark:active:border-r-red-500.dark:active:border-b-red-500.disabled:active:border-t-red-600.disabled:active:border-l-red-600.disabled:active:border-r-red-900.disabled:active:border-b-red-900.dark:disabled:active:border-t-red-500.dark:disabled:active:border-l-red-500.dark:disabled:active:border-r-red-700.dark:disabled:active:border-b-red-700.[&[data-loading="true"]:active]:border-t-red-600.[&[data-loading="true"]:active]:border-l-red-600.[&[data-loading="true"]:active]:border-r-red-900.[&[data-loading="true"]:active]:border-b-red-900.[&[data-loading="true"]:active]:dark:border-t-red-500.[&[data-loading="true"]:active]:dark:border-l-red-500.[&[data-loading="true"]:active]:dark:border-r-red-700.[&[data-loading="true"]:active]:dark:border-b-red-700`.split(`.`),"ghost-action":[`bg-transparent`,`text-slate-800`,`dark:text-slate-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-200`,`active:bg-gray-50`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`active:text-gray-900`,`dark:active:text-white`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"ghost-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`active:bg-gray-100`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]`,`dark:active:bg-gray-800`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-action":[`bg-transparent`,`text-slate-800`,`dark:text-slate-400`,`hover:text-slate-950`,`dark:hover:text-slate-200`,`active:text-slate-900`,`dark:active:text-slate-300`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-neutral":[`bg-transparent`,`text-gray-700`,`dark:text-gray-300`,`hover:text-gray-900`,`dark:hover:text-gray-100`,`active:text-gray-950`,`dark:active:text-gray-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-info":[`bg-transparent`,`text-blue-800`,`dark:text-blue-400`,`hover:text-blue-950`,`dark:hover:text-blue-300`,`active:text-blue-900`,`dark:active:text-blue-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-warning":[`bg-transparent`,`text-amber-800`,`dark:text-amber-400`,`hover:text-amber-950`,`dark:hover:text-amber-300`,`active:text-amber-900`,`dark:active:text-amber-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`],"link-danger":[`bg-transparent`,`text-red-800`,`dark:text-red-400`,`hover:text-red-950`,`dark:hover:text-red-300`,`active:text-red-900`,`dark:active:text-red-200`,`disabled:active:bg-transparent`,`dark:disabled:active:bg-transparent`,`disabled:active:shadow-none`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`shadow-none`,`hover:shadow-none`,`border-2`,`border-transparent`]},s=o[`${t}-${a}`]||o[`solid-neutral`],c=[...i,...s];if(this.isActive()){let e=this.getActiveStateClasses();c.push(...e)}return this.isFullWidth()&&c.push(`w-full`),c.join(` `)}render(){let e=this.isDisabled()||this.isLoading(),t=this.getType();if(!this._button){let e=this.firstElementChild;if(e instanceof HTMLButtonElement)this._button=e;else{for(this._button=document.createElement(`button`);this.firstChild;)this._button.appendChild(this.firstChild);this.appendChild(this._button)}this.setupEventListeners()}this._button.type=t,this._button.disabled=e;let n=this._button.querySelector(`mint-spinner`),r=this.isLoading();if(r)if(n)n.setAttribute(`data-button-variant`,this.getVariant()),n.setAttribute(`data-button-tone`,this.getTone()),`render`in n&&typeof n.render==`function`&&n.render();else{let e=document.createElement(`span`);e.className=`mr-2 inline-flex items-center`;let t=document.createElement(`mint-spinner`);t.setAttribute(`size`,`default`),t.setAttribute(`data-button-variant`,this.getVariant()),t.setAttribute(`data-button-tone`,this.getTone()),t.style.width=`0.875rem`,t.style.height=`0.875rem`,e.appendChild(t),this._button.insertBefore(e,this._button.firstChild)}else n&&n.parentElement?.remove();for(;this.firstChild&&this.firstChild!==this._button;)this._button.appendChild(this.firstChild);let i=this.getIcon(),a=this._getGeneratedIcon();i?(a||(a=document.createElement(`mint-icon`),a.setAttribute(`data-generated-icon`,`true`),a.className=`mint-button-icon`),a.setAttribute(`name`,i)):a&&a.tagName===`MINT-ICON`&&(a.remove(),a=null);let o=this.getIconPosition(),s=this._button.querySelector(`.mint-button-content`);if(s){s.className=this._getContentWrapperClass(s);let e=a&&a.tagName===`MINT-ICON`;if(a&&!a.parentElement){let t=this._button.querySelector(`mint-spinner`)?.parentElement;e||o===`left`?t?t.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s):s.insertAdjacentElement(`afterend`,a)}else if(a&&(e||o===`left`)&&a.nextSibling!==s){a.remove();let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,s)}else a&&!e&&o===`right`&&a.previousSibling!==s&&(a.remove(),s.insertAdjacentElement(`afterend`,a))}else{let e=[];for(let t=this._button.firstChild;t;t=t.nextSibling){if(t.nodeType!==Node.ELEMENT_NODE){e.push(t);continue}let n=t;n.tagName!==`MINT-SPINNER`&&!n.querySelector(`mint-spinner`)&&t!==a&&!n.hasAttribute(`slot`)&&!(n.className===`mr-2`&&n.querySelector(`mint-spinner`))&&e.push(t)}if(e.length>0){s=document.createElement(`span`),s.className=this._getContentWrapperClass(s),e.forEach(e=>{s.appendChild(e)}),s.className=this._getContentWrapperClass(s);let t=this._button.querySelector(`mint-spinner`)?.parentElement;a&&o===`left`?t?(t.insertAdjacentElement(`afterend`,a),a.insertAdjacentElement(`afterend`,s)):(this._button.insertBefore(a,this._button.firstChild),a.insertAdjacentElement(`afterend`,s)):a&&o===`right`?t?(t.insertAdjacentElement(`afterend`,s),s.insertAdjacentElement(`afterend`,a)):(this._button.insertBefore(s,this._button.firstChild),s.insertAdjacentElement(`afterend`,a)):t?t.insertAdjacentElement(`afterend`,s):this._button.insertBefore(s,this._button.firstChild)}else if(a&&a.tagName===`MINT-ICON`&&!a.parentElement){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e?e.insertAdjacentElement(`afterend`,a):this._button.insertBefore(a,this._button.firstChild)}}let c=this.isIconOnly();if(a&&(a.classList.contains(`mint-button-icon`)||a.classList.add(`mint-button-icon`),r?a.style.display=`none`:a.style.display=``,a.classList.remove(`mr-1.5`,`ml-1.5`),c?a.tagName===`MINT-ICON`?(a.style.width=`1em`,a.style.height=`1em`,a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`):(a.style.maxWidth=`1em`,a.style.maxHeight=`1em`,a.style.flexShrink=`0`,a.tagName===`svg`&&(a.style.width=`1em`,a.style.height=`1em`)):o===`left`?a.classList.add(`mr-1.5`):a.classList.add(`ml-1.5`)),r){let e=this._button.querySelector(`mint-spinner`)?.parentElement;e&&(c?(e.classList.remove(`mr-2`),e.classList.add(`mr-0`)):e.classList.contains(`mr-2`)||(e.classList.remove(`mr-0`),e.classList.add(`mr-2`)))}let l=this.getButtonClasses();this._button.className=l,this.setAttribute(`data-variant`,this.getVariant()),this.setAttribute(`data-tone`,this.getTone()),this._button.setAttribute(`data-variant`,this.getVariant()),r?this._button.setAttribute(`data-loading`,`true`):this._button.removeAttribute(`data-loading`),this.isActive()?this._button.classList.add(`mint-button-active`):this._button.classList.remove(`mint-button-active`)}setupEventListeners(){this._button&&!this._clickHandler&&(this._clickHandler=this.handleClick.bind(this),this._clickHandler&&this._button.addEventListener(`click`,this._clickHandler,!0),this._button.addEventListener(`mousedown`,this._handleMouseDown),this._button.addEventListener(`mouseup`,this._handleMouseUp),this._button.addEventListener(`mouseleave`,this._handleMouseLeave),this._button.addEventListener(`touchstart`,this._handleTouchStart),this._button.addEventListener(`touchend`,this._handleTouchEnd),this._button.addEventListener(`touchcancel`,this._handleTouchCancel))}removeEventListeners(){this._button&&(this._clickHandler&&=(this._button.removeEventListener(`click`,this._clickHandler,!0),null),this._button.removeEventListener(`mousedown`,this._handleMouseDown),this._button.removeEventListener(`mouseup`,this._handleMouseUp),this._button.removeEventListener(`mouseleave`,this._handleMouseLeave),this._button.removeEventListener(`touchstart`,this._handleTouchStart),this._button.removeEventListener(`touchend`,this._handleTouchEnd),this._button.removeEventListener(`touchcancel`,this._handleTouchCancel))}handleClick(e){if(this.isDisabled()||this.isLoading()){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();return}if(this.getType()===`submit`){this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0}));return}if(e.stopPropagation(),e.stopImmediatePropagation(),this._isHandlingClick){e.preventDefault();return}this._isHandlingClick=!0,e.preventDefault(),this.dispatchEvent(new CustomEvent(`click`,{detail:{originalEvent:e},bubbles:!0,cancelable:!0,composed:!0})),requestAnimationFrame(()=>{this._isHandlingClick=!1})}};customElements.get(`mint-button`)||customElements.define(`mint-button`,r);var i=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`icon`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._button=null,this._checked=!1}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}_getSwitchContainer(){let e=this.querySelector(`.mint-switch-container`);return e||(e=document.createElement(`div`),e.className=`mint-switch-container flex items-center gap-2`,this.insertBefore(e,this.firstChild)),e}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this.render()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getIcon(){return this.getAttribute(`icon`)||``}hasIcon(){return!!this.getIcon()}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getSwitchClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`cursor-pointer`,`rounded-full`,`h-5`,`w-10`,`border`,`transition-colors`,`duration-200`,`ease-in-out`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]`,`disabled:opacity-50`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-slate-950`,`dark:bg-slate-600`,e?`border-red-300 dark:border-red-300`:`border-slate-700 dark:border-slate-500`]:[`bg-slate-200`,`dark:bg-slate-400`,e?`border-red-300 dark:border-red-300`:`border-slate-300 dark:border-slate-500`];return[...t,...n].join(` `)}getThumbClasses(){let e=[`relative`,`inline-block`,`rounded-full`,`bg-white`,`dark:bg-gray-50`,`h-4`,`w-4`,`shadow-lg`,`transform`,`transition-transform`,`duration-200`,`ease-in-out`,`pointer-events-none`,`overflow-hidden`],t=this._checked?`translate-x-5`:`translate-x-0.5`;return[...e,t].join(` `)}getIconClasses(){return[`absolute`,`inset-0`,`flex`,`items-center`,`justify-center`,`pointer-events-none`].join(` `)}render(){let e=this.isLoading(),t=this.getSwitchClasses(),n=this.getThumbClasses(),r=this.getLabel(),i=this.getInfo(),a=this.getIcon(),o=this.getAttribute(`id`)||`mint-switch-${Math.random().toString(36).substr(2,9)}`;this.getAttribute(`id`)||this.setAttribute(`id`,o);let s=this._getSwitchContainer();this._button?this._button.parentElement!==s&&s.appendChild(this._button):(this._button=document.createElement(`button`),s.appendChild(this._button),this.setupEventListeners());let c=s.querySelector(`.mint-switch-label`);r?(c||(c=document.createElement(`label`),c.className=`mint-switch-label cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,this._button&&this._button.parentElement===s?s.insertBefore(c,this._button.nextSibling):s.appendChild(c)),c.textContent=r,c.setAttribute(`for`,o),this.isDisabled()?(c.classList.add(`opacity-40`,`cursor-not-allowed`),c.classList.remove(`cursor-pointer`)):(c.classList.remove(`opacity-40`,`cursor-not-allowed`),c.classList.add(`cursor-pointer`))):c&&c.remove(),this._button.className=t,this._button.disabled=this.isDisabled(),this._button.id=o,this._button.setAttribute(`aria-checked`,String(this._checked)),this._button.setAttribute(`aria-label`,r||`Toggle switch`),this._button.setAttribute(`role`,`switch`),this._button.type=`button`;let l=this._button.querySelector(`span`);l||(l=document.createElement(`span`),this._button.appendChild(l)),l.className=n;let u=l.querySelector(`span`);if(a){let e=u;e||(e=document.createElement(`span`),e.className=this.getIconClasses(),l.appendChild(e));let t=e.querySelector(`mint-icon`);t||(t=document.createElement(`mint-icon`),e.appendChild(t)),t.setAttribute(`name`,a)}else u&&u.remove();let d=this.querySelector(`.mint-switch-info`);i?(d||(d=document.createElement(`span`),d.className=`mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block`,s&&s.parentElement===this?this.insertBefore(d,s.nextSibling):this.appendChild(d)),d.textContent=i,this.isDisabled()?d.classList.add(`opacity-40`):d.classList.remove(`opacity-40`)):d&&d.remove(),this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this._button&&this._button.addEventListener(`click`,this.handleToggle.bind(this))}removeEventListeners(){this._button&&this._button.removeEventListener(`click`,this.handleToggle.bind(this))}handleToggle(e){if(!this.isDisabled()){this.checked=!this._checked;let e=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent(`toggle`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0}))}}_renderSkeleton(e){let t=this._getSwitchContainer(),n=this.getLabel(),r=this.getInfo(),i=t.querySelector(`.mint-switch-skeleton-container`),a=this.querySelector(`.mint-switch-info-skeleton`);if(e){t.classList.contains(`relative`)||t.classList.add(`relative`),i||(i=document.createElement(`div`),i.className=`mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,t.appendChild(i));let e=i.querySelector(`.mint-switch-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,i.appendChild(e)),n){let e=i.querySelector(`.mint-switch-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,i.appendChild(e))}else{let e=i.querySelector(`.mint-switch-skeleton-label`);e&&e.remove()}i.style.display=`flex`,this._button&&(this._button.style.visibility=`hidden`,this._button.style.pointerEvents=`none`);let o=t.querySelector(`.mint-switch-label`);if(o&&(o.style.visibility=`hidden`,o.style.pointerEvents=`none`),r){a||(a=document.createElement(`div`),a.className=`mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2`,t&&t.parentElement===this?this.insertBefore(a,t.nextSibling):this.appendChild(a)),a.style.display=`block`;let e=this.querySelector(`.mint-switch-info`);e&&(e.style.display=`none`)}else a&&(a.style.display=`none`)}else{i&&(i.style.display=`none`),a&&(a.style.display=`none`),this._button&&(this._button.style.visibility=`visible`,this._button.style.pointerEvents=`auto`);let e=t.querySelector(`.mint-switch-label`);e&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`);let n=this.querySelector(`.mint-switch-info`);n&&(n.style.display=``)}}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-switch-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._button&&(this._button.className=this.getSwitchClasses())}};customElements.get(`mint-switch`)||customElements.define(`mint-switch`,i);var a=class extends HTMLElement{static get observedAttributes(){return[`variant`,`size`,`bold`,`underline`,`strike`,`italic`,`display`,`inline`]}constructor(){super(),this._darkModeObserver=null,this._userClasses=new Set}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`),this._captureUserClasses(),this.render(),this._observeDarkMode()}_captureUserClasses(){Array.from(this.classList).forEach(e=>this._userClasses.add(e))}attributeChangedCallback(e,t,n){t!==n&&this.render()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}getVariant(){return this.getAttribute(`variant`)||`default`}getSize(){return this.getAttribute(`size`)||`regular`}isBold(){return this.getAttribute(`bold`)===`true`}isUnderline(){return this.getAttribute(`underline`)===`true`}isStrike(){return this.getAttribute(`strike`)===`true`}isItalic(){return this.getAttribute(`italic`)===`true`}getDisplay(){return this.getAttribute(`display`)||(this.getAttribute(`inline`)===`true`?`inline-block`:`block`)}getTextClasses(){let e=this.getSize(),t=this.getVariant(),n=document.documentElement.classList.contains(`dark`),r={heading:[`font-semibold`],"sub-heading":[`font-medium`],regular:[]},i={default:n?[`text-gray-100`]:[`text-gray-900`],muted:[`text-gray-400`],danger:n?[`text-red-400`]:[`text-red-600`],success:n?[`text-green-400`]:[`text-green-600`]},a=[];this.isBold()&&a.push(`font-bold`),this.isUnderline()&&a.push(`underline`),this.isStrike()&&a.push(`line-through`),this.isItalic()&&a.push(`italic`);let o=this.getDisplay();return[o===`block`?`block`:o===`inline`?`inline`:`inline-block`,...r[e]||r.regular,...i[t]||i.default,...a].join(` `)}render(){let e=this.getSize(),t=[`text-gray-100`,`text-gray-900`,`text-gray-400`,`text-red-400`,`text-red-600`,`text-green-400`,`text-green-600`],n=[`text-2xl`,`text-lg`,`text-sm`];n.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)}),t.forEach(e=>{this.classList.remove(e),this._userClasses.delete(e)});let r=this.getTextClasses().split(` `).filter(e=>e.trim());Array.from(this.classList).forEach(e=>{!t.includes(e)&&!n.includes(e)&&this._userClasses.add(e)}),this.className=[...new Set([...r,...Array.from(this._userClasses)])].join(` `);let i={heading:`clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)`,"sub-heading":`clamp(1rem, 1.5vw + 0.5rem, 1.125rem)`,regular:`clamp(0.875rem, 1vw + 0.5rem, 0.875rem)`},a=i[e]||i.regular;this.style.setProperty(`font-size`,a)}};customElements.get(`mint-text`)||customElements.define(`mint-text`,a);var o=class extends HTMLElement{static get observedAttributes(){return[`direction`,`text-align`,`gap`]}constructor(){super(),this._childObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this.getTextAlign()&&this._observeChildren()}attributeChangedCallback(e,t,n){t!==n&&(this.render(),e===`text-align`&&this._observeChildren())}_observeChildren(){this._childObserver||(this._childObserver=new MutationObserver(()=>{let e=this.getTextAlign();e&&this._applyTextAlignToChildren(e)}),this._childObserver.observe(this,{childList:!0,subtree:!1}))}disconnectedCallback(){this._childObserver&&=(this._childObserver.disconnect(),null)}getDirection(){return(this.getAttribute(`direction`)||`vertical`)===`horizontal`?`horizontal`:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`;return parseFloat(e)}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getStackClasses(){let e=this.getDirection(),t=this.getTextAlign(),n=this.getGap(),r=[`flex`,e===`horizontal`?`flex-row`:`flex-col`,`gap-${n}`];return t&&(r.push(`text-${t}`),r.push(`[&>*]:text-${t}`),r.push(`[&>*_.mint-button-content]:text-${t}`),t===`left`?(r.push(`[&>mint-button]:!justify-start`),r.push(`[&>mint-button>button]:!justify-start`)):t===`right`?(r.push(`[&>mint-button]:!justify-end`),r.push(`[&>mint-button>button]:!justify-end`)):t===`center`&&(r.push(`[&>mint-button]:!justify-center`),r.push(`[&>mint-button>button]:!justify-center`))),r.join(` `)}render(){let e=this.getStackClasses(),t=this.getTextAlign();[`flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`gap-3`,`text-left`,`text-center`,`text-right`,`text-justify`,`[&>*]:text-left`,`[&>*]:text-center`,`[&>*]:text-right`,`[&>*]:text-justify`,`[&>*_.mint-button-content]:text-left`,`[&>*_.mint-button-content]:text-center`,`[&>*_.mint-button-content]:text-right`,`[&>*_.mint-button-content]:text-justify`,`[&>mint-button]:!justify-start`,`[&>mint-button]:!justify-center`,`[&>mint-button]:!justify-end`,`[&>mint-button>button]:!justify-start`,`[&>mint-button>button]:!justify-center`,`[&>mint-button>button]:!justify-end`].forEach(e=>this.classList.remove(e)),e.split(` `).forEach(e=>{e&&this.classList.add(e)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)}),t?this._applyTextAlignToChildren(t):this._removeTextAlignFromChildren()}_applyTextAlignToChildren(e){Array.from(this.children).forEach(t=>{if(t.tagName===`MINT-BUTTON`){let n=t.querySelector(`button`);if(n){n.classList.remove(`justify-start`,`justify-center`,`justify-end`),e===`left`?n.classList.add(`justify-start`):e===`right`?n.classList.add(`justify-end`):e===`center`&&n.classList.add(`justify-center`);let t=n.querySelector(`.mint-button-content`);t&&(t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`))}}else t.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`),t.classList.add(`text-${e}`)})}_removeTextAlignFromChildren(){Array.from(this.children).forEach(e=>{if(e.tagName===`MINT-BUTTON`){let t=e.querySelector(`button`);if(t){t.classList.remove(`justify-start`,`justify-end`),t.classList.add(`justify-center`);let e=t.querySelector(`.mint-button-content`);e&&e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)}}else e.classList.remove(`text-left`,`text-center`,`text-right`,`text-justify`)})}};customElements.get(`mint-stack`)||customElements.define(`mint-stack`,o);var s=class extends HTMLElement{static get observedAttributes(){return[`heading`]}constructor(){super(),this._headingElement=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}hasPaddingClass(){return Array.from(this.classList).some(e=>/^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e))}render(){this.classList.add(`rounded-lg`,`shadow`,`bg-white`,`dark:bg-gray-900`,`border`,`border-gray-200`,`dark:border-gray-700`,`overflow-hidden`,`transition-colors`,`duration-200`),this.hasPaddingClass()||this.classList.add(`p-4`);let e=this.getHeading();e?(this._headingElement||(this._headingElement=document.createElement(`mint-text`),this._headingElement.setAttribute(`size`,`sub-heading`),this.insertBefore(this._headingElement,this.firstChild)),this._headingElement.textContent=e):this._headingElement&&this._headingElement.parentNode&&(this._headingElement.remove(),this._headingElement=null)}};customElements.get(`mint-card`)||customElements.define(`mint-card`,s);var c=class extends HTMLElement{static get observedAttributes(){return[`href`,`target`]}constructor(){super(),this._link=null,this._contentObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._observeContent()}disconnectedCallback(){this._contentObserver&&=(this._contentObserver.disconnect(),null)}_observeContent(){this._contentObserver||(this._contentObserver=new MutationObserver(()=>{this._link&&this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)})}),this._contentObserver.observe(this,{childList:!0,subtree:!0}))}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHref(){return this.getAttribute(`href`)||`#`}getTarget(){return this.getAttribute(`target`)||``}hasIcon(){return!!(this.querySelector(`mint-icon`)||this._link?.querySelector(`mint-icon`))}render(){let e=this.getHref(),t=this.getTarget();if(!this._link){for(this._link=document.createElement(`a`);this.firstChild;)this._link.appendChild(this.firstChild);this.appendChild(this._link)}this._link.href=e,t?(this._link.target=t,t===`_blank`&&(this._link.rel=`noopener noreferrer`)):(this._link.removeAttribute(`target`),this._link.removeAttribute(`rel`));let n=this.hasIcon(),r=[`text-slate-800`,`dark:text-slate-200`,`underline`,`hover:text-slate-950`,`dark:hover:text-slate-100`,`transition-colors`,`duration-200`,`focus-visible:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,`focus-visible:ring-gray-400`,`dark:focus-visible:ring-gray-500`,`rounded`];n&&r.push(`inline-flex`,`items-center`,`gap-2`),this._link.className=r.join(` `),this._link.querySelectorAll(`mint-text`).forEach(e=>{e.classList.contains(`underline`)||e.classList.add(`underline`)}),[`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`].forEach(e=>{this.classList.contains(e)||this.classList.add(e)})}};customElements.get(`mint-link`)||customElements.define(`mint-link`,c);var l=class extends HTMLElement{static get observedAttributes(){return[`href`,`fallback-href`]}constructor(){super(),this._button=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`,`flex`,`items-center`,`justify-center`),this.render()}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this.render()}getFallbackHref(){return this.getAttribute(`fallback-href`)||this.getAttribute(`href`)||`/`}_getTargetUrl(){let e=document.referrer,t=window.location.origin;if(e)try{let n=new URL(e);if(n.origin===t)return n.pathname+n.search}catch{}return this.getFallbackHref()}handleClick(e){e.preventDefault(),e.stopPropagation();let t=this._getTargetUrl(),n=document.referrer,r=n&&(()=>{try{return new URL(n).origin===window.location.origin}catch{return!1}})(),i=new CustomEvent(`back`,{detail:{url:t,isFromReferrer:r,referrer:n||null,fallbackHref:this.getFallbackHref()},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i)}render(){this._button||(this._button=document.createElement(`mint-button`),this._button.setAttribute(`variant`,`neutral`),this._button.setAttribute(`icon`,`arrow-left`),this._button.addEventListener(`click`,e=>this.handleClick(e)),this.appendChild(this._button))}};customElements.get(`mint-back-button`)||customElements.define(`mint-back-button`,l);var u=class extends HTMLElement{static get observedAttributes(){return[`heading`,`fallback-href`,`show-back-button`,`containered`]}constructor(){super(),this._pageContainer=null,this._header=null,this._titleElement=null,this._headingText=null,this._actionsSlot=null,this._bodySlot=null,this._darkModeObserver=null,this._backButton=null,this._backButtonHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render(),this._observeDarkMode(),this._setupBackButtonListener()}attributeChangedCallback(e,t,n){t!==n&&(e===`containered`&&this._applyContainerClasses(),this.render())}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._removeBackButtonListener()}getHeading(){return this.getAttribute(`heading`)||``}getFallbackHref(){return this.getAttribute(`fallback-href`)||`/`}shouldShowBackButton(){return this.getAttribute(`show-back-button`)===`true`}render(){let e=this.getHeading();this._pageContainer||(this._pageContainer=document.createElement(`div`),this.appendChild(this._pageContainer)),this._applyContainerClasses(),this._header||(this._header=document.createElement(`div`),this._header.className=`flex justify-between mb-8`,this._pageContainer.appendChild(this._header)),this._titleElement||(this._titleElement=document.createElement(`div`),this._titleElement.className=`flex gap-4 min-w-0 flex-1`,this._header.appendChild(this._titleElement));let t=this._titleElement.querySelector(`mint-back-button`);if(this.shouldShowBackButton()){t||(t=document.createElement(`mint-back-button`),this._titleElement.insertBefore(t,this._titleElement.firstChild));let e=this.getFallbackHref();t.setAttribute(`fallback-href`,e),this._backButton=t}else t&&(t.remove(),t=null,this._backButton=null);e?(this._headingText?(this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._headingText.previousSibling!==t&&this._titleElement.insertBefore(this._headingText,t.nextSibling):this._headingText.previousSibling&&this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)):(this._headingText=document.createElement(`mint-text`),this._headingText.setAttribute(`size`,`heading`),this._headingText.setAttribute(`bold`,`true`),this._headingText.classList.add(`truncate`,`min-w-0`),t&&t.parentElement===this._titleElement?this._titleElement.insertBefore(this._headingText,t.nextSibling):this._titleElement.insertBefore(this._headingText,this._titleElement.firstChild)),this._headingText.textContent=e):this._headingText&&=(this._headingText.remove(),null),this._actionsSlot?this._actionsSlot.classList.contains(`ml-4`)||this._actionsSlot.classList.add(`ml-4`):(this._actionsSlot=document.createElement(`div`),this._actionsSlot.className=`flex gap-2 items-center ml-4`,this._actionsSlot.setAttribute(`slot`,`actions`),this._header.appendChild(this._actionsSlot)),Array.from(this.children).filter(e=>e!==this._pageContainer&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{this._actionsSlot&&e.parentElement!==this._actionsSlot&&this._actionsSlot.appendChild(e)}),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._pageContainer.appendChild(this._bodySlot)),Array.from(this.children).forEach(e=>{e!==this._pageContainer&&e.getAttribute(`slot`)!==`actions`&&e!==this._actionsSlot&&e!==this._header&&e!==this._bodySlot&&e!==this._headingText&&e.parentElement!==this._bodySlot&&e.parentElement!==this._pageContainer&&this._bodySlot.appendChild(e)}),this._updateBackgroundColor()}_applyContainerClasses(){this._pageContainer&&(this._pageContainer.classList.add(`min-h-screen`,`p-8`,`transition-colors`,`duration-200`),this.getAttribute(`containered`)===`true`?this._pageContainer.classList.add(`max-w-6xl`,`mx-auto`,`w-full`):this._pageContainer.classList.remove(`max-w-6xl`,`mx-auto`,`w-full`))}_updateBackgroundColor(){this._pageContainer&&(document.documentElement.classList.contains(`dark`)?(this._pageContainer.classList.remove(`bg-gray-20`),this._pageContainer.classList.add(`bg-gray-900`)):(this._pageContainer.classList.remove(`bg-gray-900`),this._pageContainer.classList.add(`bg-gray-20`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_setupBackButtonListener(){this._backButtonHandler||=e=>{let t=e.target;if(t&&t.tagName===`MINT-BACK-BUTTON`){e.stopPropagation();let t=new CustomEvent(`back`,{detail:e.detail,bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t)}},this.addEventListener(`back`,this._backButtonHandler,!0)}_removeBackButtonListener(){this._backButtonHandler&&=(this.removeEventListener(`back`,this._backButtonHandler,!0),null)}};customElements.get(`mint-page`)||customElements.define(`mint-page`,u);var d=class extends HTMLElement{static get observedAttributes(){return[`columns`,`sm`,`md`,`lg`,`xl`,`gap`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`),this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getColumns(){return this.getAttribute(`columns`)||`1`}getSm(){return this.getAttribute(`sm`)}getMd(){return this.getAttribute(`md`)}getLg(){return this.getAttribute(`lg`)}getXl(){return this.getAttribute(`xl`)}getGap(){return`3`}getGridClasses(){let e=[`grid`],t=this.getColumns();e.push(`grid-cols-${t}`);let n=this.getSm();n&&e.push(`sm:grid-cols-${n}`);let r=this.getMd();r&&e.push(`md:grid-cols-${r}`);let i=this.getLg();i&&e.push(`lg:grid-cols-${i}`);let a=this.getXl();a&&e.push(`xl:grid-cols-${a}`);let o=this.getGap();return e.push(`gap-${o}`),e}render(){Array.from(this.classList).filter(e=>e.startsWith(`grid-cols-`)||e.startsWith(`sm:grid-cols-`)||e.startsWith(`md:grid-cols-`)||e.startsWith(`lg:grid-cols-`)||e.startsWith(`xl:grid-cols-`)||e.startsWith(`gap-`)).forEach(e=>this.classList.remove(e)),this.classList.contains(`grid`)||this.classList.add(`grid`),this.getGridClasses().forEach(e=>{e&&e!==`grid`&&this.classList.add(e)})}};customElements.get(`mint-grid`)||customElements.define(`mint-grid`,d);var f=class extends HTMLElement{static get observedAttributes(){return[`id`,`heading`,`open`]}constructor(){super(),this._overlay=null,this._modal=null,this._header=null,this._headingSlot=null,this._bodySlot=null,this._actionsSlot=null,this._closeButton=null,this._darkModeObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`inset-0`,`z-50`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._observeDarkMode()}disconnectedCallback(){this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null)}attributeChangedCallback(e,t,n){t!==n&&this.render()}getId(){return this.getAttribute(`id`)||``}getHeading(){return this.getAttribute(`heading`)||``}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();if(e&&(this.id=e),this._overlay||(this._overlay=document.createElement(`div`),this._overlay.className=`fixed inset-0 bg-black/50 transition-opacity duration-200 z-40`,this._overlay.addEventListener(`click`,()=>this.close()),this.appendChild(this._overlay)),this._modal||(this._modal=document.createElement(`div`),this._modal.className=`fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50`,this.appendChild(this._modal)),n){let e=this._modal.querySelector(`.modal-content`);e||(e=document.createElement(`div`),e.className=`modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform`,this._modal.appendChild(e)),this._animateEnter()}else this._animateExit();let r=this._modal.querySelector(`.modal-content`);r||(r=document.createElement(`div`),r.className=`modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform`,this._modal.appendChild(r)),this._header||(this._header=document.createElement(`div`),this._header.className=`flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700`,r.appendChild(this._header)),this._headingSlot||(this._headingSlot=document.createElement(`div`),this._headingSlot.className=`flex-1`,this._headingSlot.setAttribute(`slot`,`heading`),this._header.appendChild(this._headingSlot));let i=this._headingSlot.querySelector(`mint-text`);t?(i||(i=document.createElement(`mint-text`),i.setAttribute(`size`,`sub-heading`),i.setAttribute(`bold`,`true`),this._headingSlot.appendChild(i)),i.textContent=t):i&&i.remove(),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&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.addEventListener(`click`,()=>this.close()),this._header.appendChild(this._closeButton)),this._bodySlot||(this._bodySlot=document.createElement(`div`),this._bodySlot.className=`flex-1 overflow-y-auto p-4`,this._bodySlot.setAttribute(`slot`,`body`),r.appendChild(this._bodySlot)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&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=`p-4 border-t border-gray-200 dark:border-gray-700`,this._actionsSlot.setAttribute(`slot`,`actions`),r.appendChild(this._actionsSlot));let a=this._actionsSlot.querySelector(`mint-stack`);a||(a=document.createElement(`mint-stack`),a.setAttribute(`direction`,`horizontal`),a.className=`justify-end`,this._actionsSlot.appendChild(a)),Array.from(this.children).filter(e=>e!==this._overlay&&e!==this._modal&&e!==this._actionsSlot&&e.getAttribute(`slot`)===`actions`).forEach(e=>{Array.from(e.children).forEach(e=>{e.parentElement!==a&&a.appendChild(e)}),e.parentElement&&e.remove()}),Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._modal&&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._updateBackgroundColor()}_updateBackgroundColor(){if(!this._modal)return;let e=document.documentElement.classList.contains(`dark`),t=this._modal.querySelector(`.modal-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-gray-900`,`border`,`border-gray-700`)):(t.classList.remove(`bg-gray-900`,`border`,`border-gray-700`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_animateEnter(){let e=this._modal?.querySelector(`.modal-content`);e&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`all 200ms ease-out`,this.classList.remove(`hidden`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})}))}_animateExit(){let e=this._modal?.querySelector(`.modal-content`);if(!e){this.classList.add(`hidden`);return}e.style.transition=`all 200ms ease-in`,e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,setTimeout(()=>{this.classList.add(`hidden`),e.style.transform=``,e.style.opacity=``,e.style.transition=``},200)}};customElements.get(`mint-modal`)||customElements.define(`mint-modal`,f);var p=class extends HTMLElement{static get observedAttributes(){return[`id`,`direction`,`open`,`trigger-id`,`padding`,`hover`]}constructor(){super(),this._overlay=null,this._popover=null,this._triggerElement=null,this._darkModeObserver=null,this._clickOutsideHandler=null,this._triggerClickHandler=null,this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._hoverCloseTimeout=null,this._scrollHandler=null,this._resizeHandler=null}connectedCallback(){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`fixed`,`top-0`,`left-0`,e,`pointer-events-none`),this.isOpen()||this.classList.add(`hidden`),this.render(),this._setupTrigger(),this._observeDarkMode()}_ownsNode(e){return e?!!(this.contains(e)||this._triggerElement?.contains(e)):!1}_isInsideModal(){let e=this;for(;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}if(this._triggerElement)for(e=this._triggerElement;e;){if(e.tagName===`MINT-MODAL`)return!0;e=e.parentElement}return!1}disconnectedCallback(){this._removeHoverListeners(),this._overlay?.remove(),this._popover?.remove(),this._overlay=null,this._popover=null,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&this._triggerElement.removeAttribute(`active`),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null),this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}attributeChangedCallback(e,t,n){if(t!==n){if(this.isConnected){let e=this._isInsideModal()?`z-[60]`:`z-50`;this.classList.remove(`z-50`,`z-[60]`),this.classList.add(e)}this.render(),(e===`trigger-id`||e===`hover`)&&this._setupTrigger(),e===`open`&&this.isOpen()&&this._closeOtherPopovers()}}getId(){return this.getAttribute(`id`)||``}getPadding(){let e=this.getAttribute(`padding`)||`4`;return{0:`p-0`,"0.5":`p-0.5`,1:`p-1`,"1.5":`p-1.5`,2:`p-2`,"2.5":`p-2.5`,3:`p-3`,"3.5":`p-3.5`,4:`p-4`,5:`p-5`,6:`p-6`,8:`p-8`,10:`p-10`,12:`p-12`,16:`p-16`,20:`p-20`,24:`p-24`}[e]||`p-4`}getDirection(){return this.getAttribute(`direction`)||`down`}getTriggerId(){return this.getAttribute(`trigger-id`)||``}isHoverEnabled(){return this.getAttribute(`hover`)===`true`}isOpen(){return this.getAttribute(`open`)===`true`}open(){this.setAttribute(`open`,`true`)}close(){this.removeAttribute(`open`)}_setupTrigger(){let e=this.getTriggerId();this._triggerClickHandler&&this._triggerElement&&(this._triggerElement.removeEventListener(`click`,this._triggerClickHandler,!0),this._triggerClickHandler=null),this._removeHoverListeners(),e&&(this._triggerElement=document.getElementById(e),this._triggerElement?(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners()):setTimeout(()=>{this._triggerElement=document.getElementById(e),this._triggerElement&&(this._attachTriggerListener(),this.isHoverEnabled()&&this._attachHoverListeners())},10))}_attachTriggerListener(){if(this._triggerElement&&!this._triggerClickHandler){let e=this;this._triggerClickHandler=function(t){t.stopImmediatePropagation(),t.preventDefault(),e.getAttribute(`open`)===`true`?e.removeAttribute(`open`):e.setAttribute(`open`,`true`)},this._triggerElement.addEventListener(`click`,this._triggerClickHandler,!0)}}_attachHoverListeners(){if(!this.isHoverEnabled()||!this._triggerElement)return;this._removeHoverListeners();let e=this;this._triggerHoverEnterHandler=function(){e._cancelHoverClose(),e.open()},this._triggerHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._triggerElement.addEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement.addEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&(this._popoverHoverEnterHandler=function(){e._cancelHoverClose()},this._popoverHoverLeaveHandler=function(t){let n=t.relatedTarget;n&&e._ownsNode(n)||e._scheduleHoverClose()},this._popover.addEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover.addEventListener(`mouseleave`,this._popoverHoverLeaveHandler))}_removeHoverListeners(){this._triggerElement&&this._triggerHoverEnterHandler&&this._triggerElement.removeEventListener(`mouseenter`,this._triggerHoverEnterHandler),this._triggerElement&&this._triggerHoverLeaveHandler&&this._triggerElement.removeEventListener(`mouseleave`,this._triggerHoverLeaveHandler),this._popover&&this._popoverHoverEnterHandler&&this._popover.removeEventListener(`mouseenter`,this._popoverHoverEnterHandler),this._popover&&this._popoverHoverLeaveHandler&&this._popover.removeEventListener(`mouseleave`,this._popoverHoverLeaveHandler),this._triggerHoverEnterHandler=null,this._triggerHoverLeaveHandler=null,this._popoverHoverEnterHandler=null,this._popoverHoverLeaveHandler=null,this._cancelHoverClose()}_scheduleHoverClose(){this._cancelHoverClose(),this._hoverCloseTimeout=window.setTimeout(()=>{this._isHovering()||this.close()},120)}_cancelHoverClose(){this._hoverCloseTimeout!==null&&(clearTimeout(this._hoverCloseTimeout),this._hoverCloseTimeout=null)}_isHovering(){let e=this._triggerElement?this._triggerElement.matches(`:hover`):!1,t=this._popover?this._popover.matches(`:hover`):!1;return e||t}_calculatePosition(){if(!this._triggerElement||!this._popover)return{top:0,left:0,direction:`down`};let e=this._triggerElement.getBoundingClientRect(),t=this._popover.querySelector(`.popover-content`);if(!t)return{top:0,left:0,direction:`down`};this.classList.contains(`hidden`)&&(this.classList.remove(`hidden`),this._popover.style.visibility=`hidden`);let n=t.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=this.getDirection(),o=0,s=0;switch(a){case`down`:if(o=e.bottom+8,s=e.left+e.width/2-n.width/2,o+n.height>i){let t=e.top-n.height-8;t>=0?(a=`up`,o=t):(o=Math.max(0,i-n.height-8),o+n.height>i&&(o=0))}s<0&&(s=8),s+n.width>r&&(s=Math.max(8,r-n.width-8),s+n.width>r&&(s=r-n.width));break;case`up`:if(o=e.top-n.height-8,s=e.left+e.width/2-n.width/2,o<0){let t=e.bottom+8;t+n.height<=i?(a=`down`,o=t):(o=Math.min(i-n.height-8,i-n.height),o<0&&(o=i-n.height))}s<0&&(s=8),s+n.width>r&&(s=Math.max(8,r-n.width-8),s+n.width>r&&(s=r-n.width));break;case`right`:if(o=e.top+e.height/2-n.height/2,s=e.right+8,s+n.width>r){let t=e.left-n.width-8;t>=0?(a=`left`,s=t):(s=Math.max(0,r-n.width-8),s+n.width>r&&(s=r-n.width))}o<0&&(o=8),o+n.height>i&&(o=Math.max(8,i-n.height-8),o+n.height>i&&(o=i-n.height));break;case`left`:if(o=e.top+e.height/2-n.height/2,s=e.left-n.width-8,s<0){let t=e.right+8;t+n.width<=r?(a=`right`,s=t):(s=Math.min(r-n.width-8,r-n.width),s<0&&(s=0))}o<0&&(o=8),o+n.height>i&&(o=Math.max(8,i-n.height-8),o+n.height>i&&(o=i-n.height));break}return{top:o,left:s,direction:a}}render(){let e=this.getId(),t=this.isOpen(),n=this.getPadding();if(e&&(this.id=e),t){if(this.classList.remove(`hidden`),this.style.pointerEvents=`auto`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.setAttribute(`active`,`true`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),!this._clickOutsideHandler){let e=this;this._clickOutsideHandler=function(t){let n=t.composedPath(),r=n.some(t=>t===e?!0:t instanceof Node?e._ownsNode(t):!1);if(!(e._triggerElement&&n.includes(e._triggerElement))&&!r){e.close();return}},setTimeout(()=>{document.addEventListener(`click`,this._clickOutsideHandler,!1)},100)}}else this.classList.add(`hidden`),this.style.pointerEvents=`none`,this._triggerElement&&this._triggerElement.tagName===`MINT-BUTTON`&&requestAnimationFrame(()=>{this._triggerElement.removeAttribute(`active`);let e=this._triggerElement;typeof e.render==`function`&&requestAnimationFrame(()=>{e.render()})}),this._clickOutsideHandler&&=(document.removeEventListener(`click`,this._clickOutsideHandler,!1),null);if(this._overlay){let e=this._isInsideModal()?`z-[55]`:`z-40`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this._overlay.parentElement!==this&&this.appendChild(this._overlay)}else{this._overlay=document.createElement(`div`);let e=this._isInsideModal()?`z-[55]`:`z-40`;this._overlay.className=`fixed inset-0 pointer-events-none ${e}`,this.appendChild(this._overlay)}if(this._popover){let e=this._isInsideModal()?`z-[60]`:`z-50`;this._popover.className=`fixed ${e} pointer-events-auto`,this._popover.parentElement!==this&&this.appendChild(this._popover)}else{this._popover=document.createElement(`div`);let e=this._isInsideModal()?`z-[60]`:`z-50`;this._popover.className=`fixed ${e} pointer-events-auto`,this.appendChild(this._popover)}this.isHoverEnabled()&&this._attachHoverListeners();let r=this._popover.querySelector(`.popover-content`);if(!r)r=document.createElement(`div`),r.className=`popover-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl ${n} transition-all duration-200 ease-out transform`,this._popover.appendChild(r);else{let e=r.className.split(` `),t=[`p-0`,`p-0.5`,`p-1`,`p-1.5`,`p-2`,`p-2.5`,`p-3`,`p-3.5`,`p-4`,`p-5`,`p-6`,`p-8`,`p-10`,`p-12`,`p-16`,`p-20`,`p-24`],i=e.filter(e=>!t.includes(e));r.className=[...i,n].join(` `)}Array.from(this.children).forEach(e=>{e!==this._overlay&&e!==this._popover&&e.parentElement===this&&r.appendChild(e)}),t?(this._triggerElement||this._setupTrigger(),this._setupPositionListeners(),this.offsetHeight,this._triggerElement?this._updatePosition(r):(this._popover.style.top=`50%`,this._popover.style.left=`50%`,this._popover.style.transform=`translate(-50%, -50%)`,this._popover.style.visibility=`visible`,this._popover.style.display=`block`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,r.style.transition=`all 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.transform=`scale(1) translateY(0)`,r.style.opacity=`1`})}))):!t&&r&&(this._removePositionListeners(),r.style.opacity!==`0`&&r.style.opacity!==``&&(r.style.transition=`all 200ms ease-in`,r.style.transform=`scale(0.97) translateY(10px)`,r.style.opacity=`0`,setTimeout(()=>{r.style.transform=``,r.style.opacity=``,r.style.transition=``,this._popover.style.visibility=``,this._popover.style.display=``},200))),this._updateBackgroundColor()}_updateBackgroundColor(){if(!this._popover)return;let e=document.documentElement.classList.contains(`dark`),t=this._popover.querySelector(`.popover-content`);t&&(e?(t.classList.remove(`bg-white`),t.classList.add(`bg-gray-900`,`border`,`border-gray-700`)):(t.classList.remove(`bg-gray-900`,`border`,`border-gray-700`),t.classList.add(`bg-white`)))}_observeDarkMode(){this._darkModeObserver||(this._darkModeObserver=new MutationObserver(()=>{this._updateBackgroundColor()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}))}_updatePosition(e){if(!this._triggerElement||!this._popover)return;let t=this._popover.style.visibility!==`hidden`;t||(this._popover.style.visibility=`hidden`,this._popover.style.display=`block`,this._popover.style.top=`0`,this._popover.style.left=`0`),this._popover.offsetHeight;let n=this._calculatePosition();this._popover.style.top=`${n.top}px`,this._popover.style.left=`${n.left}px`,t||(this._popover.style.visibility=`visible`,e&&(!e.style.opacity||e.style.opacity===``)&&(e.style.transform=`scale(0.97) translateY(10px)`,e.style.opacity=`0`,e.style.transition=`all 200ms ease-out`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transform=`scale(1) translateY(0)`,e.style.opacity=`1`})})))}_setupPositionListeners(){if(!this._scrollHandler&&this.isOpen()){let e=this;this._scrollHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`scroll`,this._scrollHandler,!0)}if(!this._resizeHandler&&this.isOpen()){let e=this;this._resizeHandler=function(){if(e.isOpen()&&e._popover){let t=e._popover.querySelector(`.popover-content`);t&&e._updatePosition(t)}},window.addEventListener(`resize`,this._resizeHandler)}}_removePositionListeners(){this._scrollHandler&&=(window.removeEventListener(`scroll`,this._scrollHandler,!0),null),this._resizeHandler&&=(window.removeEventListener(`resize`,this._resizeHandler),null)}_closeOtherPopovers(){Array.from(document.querySelectorAll(`mint-popover[open]`)).forEach(e=>{if(e!==this){let t=e;typeof t.close==`function`?t.close():e.removeAttribute(`open`)}})}};customElements.get(`mint-popover`)||customElements.define(`mint-popover`,p);var m=class extends HTMLElement{static get observedAttributes(){return[`checked`,`disabled`,`label`,`info`,`id`,`name`,`value`,`error`,`error-message`,`loading`]}constructor(){super(),this._checkbox=null,this._checked=!1,this._clickHandler=null,this._changeHandler=null,this._mousedownHandler=null,this._mouseupHandler=null,this._mouseleaveHandler=null,this._touchstartHandler=null,this._touchendHandler=null,this._focusHandler=null,this._blurHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-flex`,`items-start`,`gap-2`),this._checked=this.getAttribute(`checked`)===`true`,this.render()}disconnectedCallback(){this.removeEventListeners()}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._checkbox&&(this._checkbox.checked=this._checked)),t!==n){if(e===`error`||e===`error-message`){this._renderErrorState();return}if(e===`loading`){this.render();return}this.render(),e===`checked`&&this._checkbox&&this.updateVisualState()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._checked=!!e,this._checkbox&&(this._checkbox.checked=this._checked),this.updateVisualState()}catch{}}isDisabled(){return this.getAttribute(`disabled`)===`true`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getValue(){return this.getAttribute(`value`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getCheckboxClasses(){let e=this.hasError(),t=[`relative`,`inline-flex`,`items-center`,`justify-center`,`flex-shrink-0`,`w-5`,`h-5`,`rounded`,`border-2`,`transition-all`,`duration-200`,`outline-none`,`focus:outline-none`,`focus-visible:ring-2`,`focus-visible:ring-offset-1`,e?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,`cursor-pointer`,`disabled:opacity-40`,`disabled:cursor-not-allowed`],n=this._checked?[`bg-slate-800`,`dark:bg-slate-600`,e?`border-red-300 dark:border-red-300`:`border-slate-800 dark:border-slate-600`]:[`bg-white`,`dark:bg-gray-700`,e?`border-red-300 dark:border-red-300`:`border-gray-300 dark:border-gray-500`];return[...t,...n].join(` `)}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.isDisabled(),i=this.querySelector(`.mint-checkbox-container`);i||(i=document.createElement(`div`),i.className=`mint-checkbox-container relative inline-flex items-start gap-2`,this.insertBefore(i,this.firstChild));let a=this.querySelector(`.mint-checkbox-wrapper`);a?a.parentElement!==i&&i.appendChild(a):(a=document.createElement(`div`),a.className=`mint-checkbox-wrapper`,i.appendChild(a)),this._checkbox?this._checkbox.parentElement!==a&&a.appendChild(this._checkbox):(this._checkbox=document.createElement(`input`),this._checkbox.type=`checkbox`,a.appendChild(this._checkbox),this.setupEventListeners()),this._checkbox.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._checkbox.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;`,this._checkbox.checked=this._checked,this._checkbox.disabled=r,this._changeHandler||this.setupEventListeners();let o=this.getId();o?this._checkbox.id=o:this._checkbox.removeAttribute(`id`);let s=this.getName();s?this._checkbox.name=s:this._checkbox.removeAttribute(`name`);let c=this.getValue();c?this._checkbox.value=c:this._checkbox.removeAttribute(`value`),t?this._checkbox.setAttribute(`aria-label`,t):this._checkbox.removeAttribute(`aria-label`),a.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,a.style.cursor=`pointer`,a.style.pointerEvents=`auto`,this._checkbox.style.pointerEvents=`auto`;let l=a;l._wrapperClickHandler||(l._wrapperClickHandler=e=>{e.target===a&&!r&&(e.preventDefault(),e.stopPropagation(),this.toggle())},a.addEventListener(`click`,l._wrapperClickHandler));let u=a.querySelector(`mint-icon`);u||(u=document.createElement(`mint-icon`),u.setAttribute(`name`,`check`),u.className=`w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto`,u.style.transition=`opacity 200ms ease-out, transform 200ms ease-out`,u.style.zIndex=`1`,a.appendChild(u)),this.updateVisualState();let d=this.querySelector(`.mint-checkbox-label-container`),f=this.querySelector(`.mint-checkbox-container`);if(t||n){d?f&&d.parentElement!==f&&f.appendChild(d):(d=document.createElement(`div`),d.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,f?f.appendChild(d):this.appendChild(d));let e=d.querySelector(`.mint-checkbox-label`);t?(e||(e=document.createElement(`span`),e.className=`mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none`,d.insertBefore(e,d.firstChild)),e.textContent=t,r?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let i=d.querySelector(`.mint-checkbox-info`);if(n?(i||(i=document.createElement(`span`),i.className=`mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none`,d.appendChild(i)),i.textContent=n,r?i.classList.add(`opacity-40`):i.classList.remove(`opacity-40`)):i&&i.remove(),r)d.style.cursor=`default`,d._clickHandler&&(d.removeEventListener(`click`,d._clickHandler),d._clickHandler=null);else{d.style.cursor=`pointer`;let e=d._clickHandler;e&&d.removeEventListener(`click`,e),d._clickHandler=e=>{this._checkbox&&(e.target===this._checkbox||this._checkbox.contains(e.target)||e.composedPath().includes(this._checkbox))||this.toggle()},d.addEventListener(`click`,d._clickHandler)}}else d&&d.remove();this._renderErrorState(),this._renderSkeleton(e)}setupEventListeners(){this.removeEventListeners(),this._checkbox&&(this._changeHandler=e=>{e.stopPropagation(),this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState();let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0,composed:!0}));let n=new CustomEvent(`change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0});this.dispatchEvent(n)},this._checkbox.addEventListener(`change`,this._changeHandler),this._mousedownHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(15 23 42)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(51 65 85)`:t.style.backgroundColor=`rgb(31 41 55)`))},this._mouseupHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._mouseleaveHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`mousedown`,this._mousedownHandler),this._checkbox.addEventListener(`mouseup`,this._mouseupHandler),this._checkbox.addEventListener(`mouseleave`,this._mouseleaveHandler),this._focusHandler=e=>{let t=this.querySelector(`.mint-checkbox-wrapper`);t&&this._checkbox&&requestAnimationFrame(()=>{this._checkbox&&this._checkbox.matches(`:focus-visible`)&&t?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{let e=this.querySelector(`.mint-checkbox-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._checkbox.addEventListener(`focus`,this._focusHandler),this._checkbox.addEventListener(`blur`,this._blurHandler),this._touchstartHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&!this.isDisabled()&&(t.classList.add(`mint-checkbox-active`),this._checked?(t.style.backgroundColor=`rgb(15 23 42)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.3)`):(t.style.backgroundColor=`rgb(243 244 246)`,t.style.boxShadow=`inset 0 2px 4px rgba(0, 0, 0, 0.1)`),document.documentElement.classList.contains(`dark`)&&(this._checked?t.style.backgroundColor=`rgb(51 65 85)`:t.style.backgroundColor=`rgb(31 41 55)`))},this._touchendHandler=e=>{e.stopPropagation();let t=this.querySelector(`.mint-checkbox-wrapper`);t&&(t.classList.remove(`mint-checkbox-active`),t.style.backgroundColor=``,t.style.boxShadow=``)},this._checkbox.addEventListener(`touchstart`,this._touchstartHandler),this._checkbox.addEventListener(`touchend`,this._touchendHandler))}removeEventListeners(){this._checkbox&&(this._changeHandler&&=(this._checkbox.removeEventListener(`change`,this._changeHandler),null),this._mousedownHandler&&=(this._checkbox.removeEventListener(`mousedown`,this._mousedownHandler),null),this._mouseupHandler&&=(this._checkbox.removeEventListener(`mouseup`,this._mouseupHandler),null),this._mouseleaveHandler&&=(this._checkbox.removeEventListener(`mouseleave`,this._mouseleaveHandler),null),this._touchstartHandler&&=(this._checkbox.removeEventListener(`touchstart`,this._touchstartHandler),null),this._touchendHandler&&=(this._checkbox.removeEventListener(`touchend`,this._touchendHandler),null),this._focusHandler&&=(this._checkbox.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._checkbox.removeEventListener(`blur`,this._blurHandler),null));let e=this.querySelector(`.mint-checkbox-wrapper`);if(e){let t=e;t._wrapperClickHandler&&=(e.removeEventListener(`click`,t._wrapperClickHandler),null)}}updateVisualState(){let e=this.querySelector(`.mint-checkbox-wrapper`),t=e?.querySelector(`mint-icon`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`scale(1)`:`scale(0.8)`),e&&(e.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`,e.classList.contains(`mint-checkbox-active`)||(e.style.backgroundColor=``,e.style.boxShadow=``))}toggle(){if(this._checkbox&&!this.isDisabled()){this._checkbox.checked=!this._checked,this._checked=this._checkbox.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this.updateVisualState(),this.dispatchEvent(new CustomEvent(`input`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0,composed:!0}));let e=new CustomEvent(`change`,{detail:{checked:this._checked},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}}_renderSkeleton(e){let t=this.querySelector(`.mint-checkbox-skeleton-container`),n=this.querySelector(`.mint-checkbox-container`),r=this.querySelector(`.mint-checkbox-wrapper`),i=this.querySelector(`.mint-checkbox-label-container`);if(e){t||(t=document.createElement(`div`),t.className=`mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-checkbox-skeleton-box`);if(e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e)),i){let e=t.querySelector(`.mint-checkbox-skeleton-label`);e||(e=document.createElement(`div`),e.className=`mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e))}t.style.display=`flex`,r&&(r.style.visibility=`hidden`,r.style.pointerEvents=`none`),i&&(i.style.visibility=`hidden`,i.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.visibility=`visible`,r.style.pointerEvents=`auto`),i&&(i.style.visibility=`visible`,i.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-checkbox-label-container`);!n&&e&&t&&(n=document.createElement(`div`),n.className=`mint-checkbox-label-container flex flex-col gap-0.5 flex-1`,this.appendChild(n));let r=this.querySelector(`.mint-checkbox-error`);e&&t?(r?(r.classList.add(`block`,`w-full`),r.style.display=`block`,(n&&r.parentElement!==n||n&&r.parentElement===n)&&n.appendChild(r)):(r=document.createElement(`div`),r.className=`mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full`,r.style.display=`block`,n?n.appendChild(r):this.appendChild(r)),r.textContent=t):r&&r.remove();let i=this.querySelector(`.mint-checkbox-wrapper`);i&&(i.className=`mint-checkbox-wrapper ${this.getCheckboxClasses()}`)}};customElements.get(`mint-checkbox`)||customElements.define(`mint-checkbox`,m);var h=class extends HTMLElement{static get observedAttributes(){return[`value`,`checked`,`disabled`,`loading`,`info`]}constructor(){super(),this._radio=null,this._checked=!1,this._changeHandler=null,this._clickHandler=null,this._focusHandler=null,this._blurHandler=null,this._keydownHandler=null}connectedCallback(){this.classList.add(`inline-flex`,`items-start`,`gap-2`,`cursor-pointer`,`select-none`);let e=this.getAttribute(`checked`);this._checked=e!==null&&e!==`false`,this.render(),this._setupClickHandler()}disconnectedCallback(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null),this._radio&&(this._changeHandler&&=(this._radio.removeEventListener(`change`,this._changeHandler),null),this._focusHandler&&=(this._radio.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._radio.removeEventListener(`blur`,this._blurHandler),null),this._keydownHandler&&=(this._radio.removeEventListener(`keydown`,this._keydownHandler),null))}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(e===`checked`&&(this._checked=n===`true`,this._radio&&(this._radio.checked=this._checked),this._updateVisualState()),t!==n){if(e===`loading`){this.render();return}if(e===`info`){this.render();return}this.render()}}get checked(){try{return this._checked||!1}catch{return!1}}set checked(e){try{this._checked=!!e,e?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`),this._radio&&(this._radio.checked=this._checked),this.isConnected?requestAnimationFrame(()=>{this._updateVisualState()}):this._updateVisualState()}catch{}}getValue(){return this.getAttribute(`value`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){let e=this.getAttribute(`disabled`)===`true`,t=this.closest(`mint-choice`)?.getAttribute(`disabled`)===`true`;return e||t}_setupClickHandler(){this._clickHandler||(this._clickHandler=e=>{e.target!==this._radio&&(this.isDisabled()||this._radio&&(this._radio.click(),requestAnimationFrame(()=>{if(this._radio&&this._radio.checked!==this._checked){this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let e=this.closest(`mint-choice`);e&&e.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))}})))},this.addEventListener(`click`,this._clickHandler))}render(){let e=this.isLoading(),t=this.isDisabled(),n=this.getValue(),r=this.closest(`mint-choice`)?.getAttribute(`name`)||``,i=``,a=this.querySelector(`.mint-choice-option-label`);if(a)i=a.textContent?.trim()||``;else{let e=this.querySelector(`.mint-choice-option-label-container`);Array.from(this.childNodes).forEach(t=>{if(t!==e&&t.nodeType===Node.TEXT_NODE){let e=t.textContent?.trim();e&&(i+=e)}})}let o=this.querySelectorAll(`.mint-choice-option-wrapper`),s=null;o.length>0&&(this._radio&&(s=Array.from(o).find(e=>e.contains(this._radio))),s||=o[0],o.forEach((e,t)=>{e!==s&&e.remove()})),s||(s=document.createElement(`div`),s.className=`mint-choice-option-wrapper`,s.style.position=`relative`,this.insertBefore(s,this.firstChild)),s.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`,s.style.position=`relative`,this.querySelectorAll(`input[type="radio"]`).forEach(e=>{e!==this._radio&&e.remove()}),this._radio?(this._radio.parentElement!==s&&s.appendChild(this._radio),this._radio&&this._changeHandler&&(this._radio.removeEventListener(`change`,this._changeHandler),this._radio.addEventListener(`change`,this._changeHandler)),this._radio&&(this._focusHandler||=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._blurHandler||=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._keydownHandler||=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.removeEventListener(`focus`,this._focusHandler),this._radio.removeEventListener(`blur`,this._blurHandler),this._radio.removeEventListener(`keydown`,this._keydownHandler),this._radio.addEventListener(`focus`,this._focusHandler),this._radio.addEventListener(`blur`,this._blurHandler),this._radio.addEventListener(`keydown`,this._keydownHandler))):(this._radio=document.createElement(`input`),this._radio.type=`radio`,this._radio.className=`sr-only`,this._radio.style.position=`absolute`,this._radio.style.width=`1px`,this._radio.style.height=`1px`,this._radio.style.padding=`0`,this._radio.style.margin=`-1px`,this._radio.style.overflow=`hidden`,this._radio.style.clip=`rect(0, 0, 0, 0)`,this._radio.style.whiteSpace=`nowrap`,this._radio.style.border=`0`,s.appendChild(this._radio),this._changeHandler=e=>{let t=this._checked;this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState();let n=this.closest(`mint-choice`);t!==this._checked&&n&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:this._checked,value:this.getValue()},bubbles:!0,cancelable:!0}))},0)},this._radio.addEventListener(`change`,this._changeHandler),this._radio.addEventListener(`click`,()=>{this._radio&&this._radio.checked!==this._checked&&(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.removeAttribute(`checked`),this._updateVisualState(),this._updateGroupState())}),this._focusHandler=e=>{let t=this.querySelector(`.mint-choice-option-wrapper`);t&&!this.isDisabled()&&t.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`focus`,this._focusHandler),this._blurHandler=()=>{let e=this.querySelector(`.mint-choice-option-wrapper`);e&&e.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._radio.addEventListener(`blur`,this._blurHandler),this._keydownHandler=e=>{this.isDisabled()||(e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),this._focusNextOption()):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),this._focusPreviousOption()))},this._radio.addEventListener(`keydown`,this._keydownHandler)),this._radio.name=r,this._radio.value=n,this._radio.checked===this._checked?this._radio.checked=this._checked:(this._checked=this._radio.checked,this._checked?this.setAttribute(`checked`,`true`):this.setAttribute(`checked`,`false`)),this._radio.disabled=t,t?this._radio.setAttribute(`tabindex`,`-1`):this._radio.removeAttribute(`tabindex`),i?this._radio.setAttribute(`aria-label`,i):this._radio.removeAttribute(`aria-label`),s.querySelectorAll(`.mint-choice-option-indicator`).forEach((e,t)=>{t>0&&e.remove()});let c=s.querySelector(`.mint-choice-option-indicator`);c||(c=document.createElement(`div`),c.className=`mint-choice-option-indicator`,s.appendChild(c)),c.className=`mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none`,c.style.position=`absolute`,c.style.top=`50%`,c.style.left=`50%`,c.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`,c.style.opacity=this._checked?`1`:`0`,this._updateVisualState(),this._renderSkeleton(e);let l=this.getInfo(),u=this.querySelector(`.mint-choice-option-label-container`);if(i||l){u||(u=document.createElement(`div`),u.className=`mint-choice-option-label-container flex flex-col gap-0.5`,this.appendChild(u),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()&&e!==u&&(e.textContent=``)}));let e=u.querySelector(`.mint-choice-option-label`);i?(e||(e=document.createElement(`span`),e.className=`mint-choice-option-label`,u.appendChild(e)),e.className=`mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t?`opacity-40`:``}`,e.textContent=i):e&&e.remove();let n=u.querySelector(`.mint-choice-option-info`);l?(n||(n=document.createElement(`span`),n.className=`mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none`,u.appendChild(n)),n.textContent=l,t?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else u&&u.remove();t?(this.classList.add(`cursor-not-allowed`),this.classList.remove(`cursor-pointer`)):(this.classList.add(`cursor-pointer`),this.classList.remove(`cursor-not-allowed`)),this._updateVisualState()}_getWrapperClasses(){let e=this.isDisabled(),t=[`inline-flex`,`items-center`,`justify-center`,`w-[1rem]`,`h-[1rem]`,`rounded-full`,`border-2`,`transition-all`,`duration-200`,`flex-shrink-0`,`mt-0.5`];return e&&t.push(`opacity-40`,`cursor-not-allowed`),this._checked?t.push(`bg-slate-800`,`dark:bg-slate-600`,`border-slate-800`,`dark:border-slate-600`):t.push(`bg-white`,`dark:bg-gray-900`,`border-gray-300`,`dark:border-gray-500`),t.join(` `)}_updateVisualState(){let e=this.querySelector(`.mint-choice-option-wrapper`);e&&(e.className=`mint-choice-option-wrapper ${this._getWrapperClasses()}`);let t=this.querySelector(`.mint-choice-option-indicator`);t&&(t.style.opacity=this._checked?`1`:`0`,t.style.transform=this._checked?`translate(-50%, -50%) scale(1)`:`translate(-50%, -50%) scale(0)`)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-option-skeleton-container`),n=this.querySelector(`.mint-choice-option-wrapper`);if(e){t||(t=document.createElement(`div`),t.className=`mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-choice-option-skeleton-radio`);if(e||(e=document.createElement(`div`),e.className=`mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,t.appendChild(e)),t.style.display=`flex`,n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`hidden`),t&&(t.style.visibility=`hidden`),n.style.pointerEvents=`none`}}else{if(t&&(t.style.display=`none`),n){let e=n.querySelector(`input[type="radio"]`),t=n.querySelector(`.mint-choice-option-indicator`);e&&(e.style.visibility=`visible`),t&&(t.style.visibility=`visible`),n.style.pointerEvents=`auto`}let e=this.querySelector(`.mint-choice-option-label`);e&&!n?.contains(e)&&(e.style.visibility=`visible`,e.style.pointerEvents=`auto`)}}_updateGroupState(){this._radio?.name&&document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`).forEach(e=>{if(e===this._radio)return;let t=e.closest(`mint-choice-option`);t&&t!==this&&(t._checked=e.checked,e.checked?t.setAttribute(`checked`,`true`):t.removeAttribute(`checked`),t._updateVisualState())})}_focusNextOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>=0&&t<e.length-1?n=e[t+1]:e.length>0&&(n=e[0]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}_focusPreviousOption(){if(!this._radio?.name)return;let e=Array.from(document.querySelectorAll(`input[type="radio"][name="${this._radio.name}"]`)).filter(e=>!e.disabled),t=e.indexOf(this._radio),n=null;if(t>0?n=e[t-1]:e.length>0&&(n=e[e.length-1]),n){let e=n.closest(`mint-choice-option`);if(n.checked=!0,e){let t=e._checked;if(e._checked=!0,e.setAttribute(`checked`,`true`),e._changeHandler){let t=new Event(`change`,{bubbles:!0});e._changeHandler.call(e,t)}else e._updateVisualState(),e._updateGroupState();let n=e.closest(`mint-choice`);n&&!t&&setTimeout(()=>{n.dispatchEvent(new CustomEvent(`choice-change`,{detail:{checked:!0,value:e.getValue()},bubbles:!0,cancelable:!0}))},0)}n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}};customElements.get(`mint-choice-option`)||customElements.define(`mint-choice-option`,h);var g=class extends HTMLElement{static get observedAttributes(){return[`label`,`name`,`info`,`error`,`error-message`,`id`,`disabled`,`required`,`loading`]}constructor(){super(),this._optionsContainer=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.addEventListener(`choice-change`,e=>{let t=e.detail?.value||this.getValue();(this.getAttribute(`value`)||``)!==t&&(t?this.setAttribute(`value`,t):this.removeAttribute(`value`));let n=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:t},bubbles:!0,cancelable:!0,composed:!0}))})}disconnectedCallback(){}isLoading(){return this.hasAttribute(`loading`)}attributeChangedCallback(e,t,n){t!==n&&(e===`error`||e===`error-message`?this._renderErrorState():e===`loading`?(this.render(),this.querySelectorAll(`mint-choice-option`).forEach(e=>{this.isLoading()?e.setAttribute(`loading`,`true`):e.removeAttribute(`loading`)})):(this.render(),e===`name`&&this.querySelectorAll(`mint-choice-option`).forEach(e=>{typeof e.render==`function`&&e.render()})))}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}getValue(){return this.querySelector(`input[type="radio"]:checked`)?.value||``}setValue(e){let t=this.querySelectorAll(`mint-choice-option`);t.forEach(t=>{if((t.getAttribute(`value`)||``)===e){let e=t;e.checked=!0;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!0,n.dispatchEvent(new Event(`change`,{bubbles:!0})))}else{let e=t;e.checked=!1;let n=t.querySelector(`input[type="radio"]`);n&&(n.checked=!1)}}),requestAnimationFrame(()=>{t.forEach(e=>{typeof e._updateVisualState==`function`&&e._updateVisualState();let t=e.querySelector(`input[type="radio"]`);if(t){let n=e;t.checked!==n.checked&&(t.checked=n.checked)}})})}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getId()||`mint-choice-${Math.random().toString(36).substr(2,9)}`;this.getId()||this.setAttribute(`id`,r);let i=this.isDisabled(),a=this.querySelector(`.mint-choice-label-container`);if(t||n){a||(a=document.createElement(`div`),a.className=`mint-choice-label-container flex flex-col gap-0.5 mb-2`,this.insertBefore(a,this.firstChild));let e=a.querySelector(`.mint-choice-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,a.insertBefore(e,a.firstChild)),e.textContent=t,e.setAttribute(`for`,r),i?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)):e&&e.remove();let o=a.querySelector(`.mint-choice-info`);n?(o||(o=document.createElement(`span`),o.className=`mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none`,a.appendChild(o)),o.textContent=n,i?o.classList.add(`opacity-40`):o.classList.remove(`opacity-40`)):o&&o.remove()}else a&&a.remove();let o=this.querySelector(`.mint-choice-options-wrapper`);if(!o){o=document.createElement(`div`),o.className=`mint-choice-options-wrapper relative`;let e=this.querySelector(`.mint-choice-label-container`);e&&e.parentElement===this?this.insertBefore(o,e.nextSibling):this.insertBefore(o,this.firstChild)}this._optionsContainer?this._optionsContainer.parentElement!==o&&o.appendChild(this._optionsContainer):(this._optionsContainer=document.createElement(`div`),this._optionsContainer.className=`mint-choice-options-container flex flex-col gap-3`,o.appendChild(this._optionsContainer)),Array.from(this.children).filter(e=>e.tagName===`MINT-CHOICE-OPTION`&&e.parentElement!==this._optionsContainer).forEach(e=>{this._optionsContainer.appendChild(e)}),this._renderErrorState(),this._renderSkeleton(e)}_renderSkeleton(e){let t=this.querySelector(`.mint-choice-skeleton-container`),n=this.querySelector(`.mint-choice-options-wrapper`),r=this.querySelector(`.mint-choice-options-container`);if(e){if(t||(t=document.createElement(`div`),t.className=`mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3`,n?n.appendChild(t):(this.style.position=`relative`,this.appendChild(t))),t.querySelectorAll(`.mint-choice-option-skeleton`).length===0)for(let e=0;e<3;e++){let e=document.createElement(`div`);e.className=`mint-choice-option-skeleton flex items-center gap-3`;let n=document.createElement(`div`);n.className=`flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse`,e.appendChild(n);let r=document.createElement(`div`);r.className=`h-4 w-20 rounded bg-gray-200 dark:bg-gray-700 animate-pulse`,e.appendChild(r),t.appendChild(e)}t.style.display=`flex`,r&&(r.style.opacity=`0`,r.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),r&&(r.style.opacity=`1`,r.style.pointerEvents=`auto`)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-choice-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}};customElements.get(`mint-choice`)||customElements.define(`mint-choice`,g);var _=class extends HTMLElement{static get observedAttributes(){return[`type`,`placeholder`,`value`,`disabled`,`id`,`name`,`required`,`readonly`,`rows`,`icon`,`label`,`info`,`error`,`error-message`,`loading`]}constructor(){super(),this._input=null,this._textarea=null,this._element=null,this._wrapper=null,this._icon=null,this._colorPicker=null,this._colorTextInput=null,this._colorContainer=null,this._colorPickerWrapper=null,this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null,this._focusHandler=null,this._blurHandler=null,this._clickHandler=null,this._clickOutsideHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._renderErrorState(),this._element&&(this._element.className=this.getInputClasses()),this._colorTextInput&&(this._colorTextInput.className=this.getInputClasses());return}if(e===`loading`){this.render();return}this.render()}}getType(){return this.getAttribute(`type`)||`text`}getRows(){let e=this.getAttribute(`rows`);return e?parseInt(e,10):3}_getNormalizedType(){let e=this.getType();return e===`datetime`?`datetime-local`:e===`money`?`text`:e===`textarea`?`textarea`:e}_isTextarea(){return this.getType()===`textarea`}_isMoney(){return this.getType()===`money`}_isColor(){return this.getType()===`color`}_isNumber(){return this.getType()===`number`}getPlaceholder(){return this.getAttribute(`placeholder`)||``}getValue(){return this._isColor()?this._colorPicker?.value||this._colorTextInput?.value||this.getAttribute(`value`)||`#000000`:this._element?.value||this.getAttribute(`value`)||``}set value(e){try{this._isColor()?(this._colorPicker&&(this._colorPicker.value=e||`#000000`),this._colorTextInput&&(this._colorTextInput.value=e||`#000000`)):this._element&&(this._element.value=e),e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}catch{}}get value(){try{return this.getValue()||``}catch{return``}}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getIcon(){return this.getAttribute(`icon`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getInputClasses(){let e=this._isTextarea(),t=!!this.getIcon(),n=this._isColor(),r=this._isNumber(),i=this.hasError(),a=[`w-full`,t||n?`pl-10`:`px-3.5`,t||n?`pr-3.5`:r?`pr-10`:``,e?`py-2`:`py-1.5`,e?`min-h-[6rem]`:`min-h-[2rem]`,`text-sm`,`font-medium`,`rounded-lg`,`box-border`,`bg-white`,`dark:bg-gray-900`,`text-gray-900`,`dark:text-white`,e?`transition-colors transition-opacity`:`transition-all`,`duration-200`,`outline-none`,`focus:outline-none`,`disabled:opacity-40`,`disabled:cursor-not-allowed`,`readonly:cursor-default`,e?`resize-y`:``,r?`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`:``],o=[`border-2`,i?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-gray-700`],s=[`focus-visible:ring-2`,`focus-visible:ring-offset-1`,i?`focus-visible:ring-red-400 dark:focus-visible:ring-red-500`:`focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`];return[...a,...o,...s].filter(Boolean).join(` `)}isLoading(){return this.getAttribute(`loading`)===`true`}render(){this.getType();let e=this._getNormalizedType(),t=this._isTextarea(),n=this._isMoney(),r=this._isColor(),i=this.getPlaceholder(),a=this.isDisabled(),o=this.isReadonly(),s=this.isRequired(),c=this.getId(),l=this.getName(),u=this.getAttribute(`value`)||(r?`#000000`:``),d=this.getRows(),f=this.getIcon(),p=this.getLabel(),m=this.getInfo(),h=this.isLoading();if(this._renderSkeleton(h),r){this._input&&=(this._input.remove(),null),this._textarea&&=(this._textarea.remove(),null),this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&=(this._colorContainer.remove(),null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null),this._colorPickerWrapper||(this._colorPickerWrapper=document.createElement(`div`),this._colorPickerWrapper.className=`mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,this._colorPickerWrapper.style.backgroundColor=u||`#000000`,this._wrapper.appendChild(this._colorPickerWrapper),this._colorPicker=document.createElement(`input`),this._colorPicker.type=`color`,this._colorPicker.className=`absolute inset-0 w-full h-full opacity-0 cursor-pointer`,this._colorPicker.style.cssText=`position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;`,this._colorPickerWrapper.appendChild(this._colorPicker),this._focusHandler=e=>{this._colorPickerWrapper&&this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&requestAnimationFrame(()=>{this._colorPicker&&this._colorPicker.matches(`:focus-visible`)&&this._colorPickerWrapper?.classList.add(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)})},this._blurHandler=()=>{this._colorPickerWrapper&&this._colorPickerWrapper.classList.remove(`ring-2`,`ring-offset-1`,`ring-gray-400`,`dark:ring-gray-500`)},this._colorPicker.addEventListener(`focus`,this._focusHandler),this._colorPicker.addEventListener(`blur`,this._blurHandler),this._colorPicker.addEventListener(`input`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&(this._colorTextInput.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0}))}),this._colorPicker.addEventListener(`change`,()=>{let e=this._colorPicker?.value||`#000000`;this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))})),this._colorTextInput||(this._colorTextInput=document.createElement(`input`),this._colorTextInput.type=`text`,this._colorTextInput.className=this.getInputClasses(),this._colorTextInput.placeholder=i||`#000000`,this._colorTextInput.pattern=`^#[0-9A-Fa-f]{6}$`,this._wrapper.appendChild(this._colorTextInput),this._colorTextInput.addEventListener(`input`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)&&(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0})))}),this._colorTextInput.addEventListener(`blur`,()=>{let e=this._colorTextInput?.value||``;/^#[0-9A-Fa-f]{6}$/.test(e)?(this._colorPicker&&(this._colorPicker.value=e),this.setAttribute(`value`,e)):this._colorPicker&&this._colorTextInput&&(this._colorTextInput.value=this._colorPicker.value),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this._colorPicker?.value||`#000000`},bubbles:!0,cancelable:!0}))}));let e=u||`#000000`;if(this._colorPicker&&this._colorPicker.value!==e&&(this._colorPicker.value=e),this._colorPickerWrapper&&(this._colorPickerWrapper.style.backgroundColor=e),this._colorTextInput&&this._colorTextInput.value!==e&&(this._colorTextInput.value=e),this._colorPicker&&(this._colorPicker.disabled=a),this._colorPickerWrapper&&(a?(this._colorPickerWrapper.classList.add(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.remove(`cursor-pointer`)):(this._colorPickerWrapper.classList.remove(`opacity-40`,`cursor-not-allowed`),this._colorPickerWrapper.classList.add(`cursor-pointer`))),this._colorTextInput&&(this._colorTextInput.disabled=a,this._colorTextInput.readOnly=o,this._colorTextInput.required=s),this._colorTextInput){let e=this._colorTextInput;c?e.id=c:e.removeAttribute(`id`),l?e.name=l:e.removeAttribute(`name`),e.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),this._element=e}this._renderErrorState();let t=this.querySelector(`.mint-input-label-container`);if(p||m){t||(t=document.createElement(`div`),t.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(t,this._wrapper):this.insertBefore(t,this.firstChild));let e=t.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,t.insertBefore(e,t.firstChild)),e.textContent=p;let n=c||this._colorTextInput?.id;if(n)e.setAttribute(`for`,n);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._colorTextInput&&(this._colorTextInput.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let n=t.querySelector(`.mint-input-info`);m?(n||(n=document.createElement(`span`),n.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,t.appendChild(n)),n.textContent=m,a?n.classList.add(`opacity-40`):n.classList.remove(`opacity-40`)):n&&n.remove()}else t&&t.remove();return}if(this._wrapper||(this._wrapper=document.createElement(`div`),this._wrapper.className=`relative w-full`,this.appendChild(this._wrapper)),this._colorContainer&&(this._colorContainer.remove(),this._colorContainer=null,this._colorPicker=null,this._colorTextInput=null),this._colorPickerWrapper&&!r&&(this._colorPickerWrapper.remove(),this._colorPickerWrapper=null,this._colorPicker=null,this._colorTextInput=null),f&&!t?this._icon?this._icon.setAttribute(`name`,f):(this._icon=document.createElement(`mint-icon`),this._icon.setAttribute(`name`,f),this._icon.className=`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none`,this._wrapper.appendChild(this._icon)):this._icon&&=(this._icon.remove(),null),this._isNumber()&&!t){if(!this._numberSpinnerContainer){this._numberSpinnerContainer=document.createElement(`div`),this._numberSpinnerContainer.className=`absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none`,this._wrapper.appendChild(this._numberSpinnerContainer),this._numberIncrementButton=document.createElement(`button`),this._numberIncrementButton.type=`button`,this._numberIncrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`caret-up`),e.className=`w-[1rem] h-[1rem]`,this._numberIncrementButton.appendChild(e),this._numberSpinnerContainer.appendChild(this._numberIncrementButton),this._numberDecrementButton=document.createElement(`button`),this._numberDecrementButton.type=`button`,this._numberDecrementButton.className=`flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded`;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`caret-down`),t.className=`w-[1rem] h-[1rem]`,this._numberDecrementButton.appendChild(t),this._numberSpinnerContainer.appendChild(this._numberDecrementButton),this._numberIncrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e+t;r!==void 0&&i>r&&(i=r),n!==void 0&&i<n&&(i=n),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}}),this._numberDecrementButton.addEventListener(`click`,e=>{if(e.preventDefault(),e.stopPropagation(),this._input&&!this._input.disabled&&!this._input.readOnly){let e=parseFloat(this._input.value)||0,t=parseFloat(this._input.step)||1,n=this._input.min?parseFloat(this._input.min):void 0,r=this._input.max?parseFloat(this._input.max):void 0,i=e-t;n!==void 0&&i<n&&(i=n),r!==void 0&&i>r&&(i=r),this._input.value=i.toString(),this.setAttribute(`value`,i.toString()),this._input.dispatchEvent(new Event(`input`,{bubbles:!0})),this._input.dispatchEvent(new Event(`change`,{bubbles:!0}))}})}this._numberIncrementButton&&(this._numberIncrementButton.disabled=a||o),this._numberDecrementButton&&(this._numberDecrementButton.disabled=a||o)}else this._numberSpinnerContainer&&(this._numberSpinnerContainer.remove(),this._numberSpinnerContainer=null,this._numberIncrementButton=null,this._numberDecrementButton=null);if(t){if(this._input&&=(this._input.remove(),null),this._textarea||(this._textarea=document.createElement(`textarea`),this._wrapper.appendChild(this._textarea),this.setupEventListeners()),this._element=this._textarea,this._textarea.placeholder=i,this._textarea.disabled=a,this._textarea.readOnly=o,this._textarea.required=s,this._textarea.rows=d,this._textarea.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),u!==this._textarea.value&&(this._textarea.value=u),c?this._textarea.id=c:this._textarea.removeAttribute(`id`),l?this._textarea.name=l:this._textarea.removeAttribute(`name`),this._textarea.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._textarea.value&&(this._textarea.value=e.trim()),this.removeChild(this.firstChild)}}else if(this._textarea&&=(this._textarea.remove(),null),this._input||(this._input=document.createElement(`input`),this._wrapper.appendChild(this._input),this.setupEventListeners()),this._element=this._input,this._input.type=e,this._input.placeholder=i,this._input.disabled=a,this._input.readOnly=o,this._input.required=s,this._input.setAttribute(`aria-invalid`,this.hasError()?`true`:`false`),n?(this._input.inputMode=`decimal`,this._input.pattern=`[0-9]*\\.?[0-9]*`):(this._input.removeAttribute(`inputmode`),this._input.removeAttribute(`pattern`)),u!==this._input.value&&(this._input.value=u),c?this._input.id=c:this._input.removeAttribute(`id`),l?this._input.name=l:this._input.removeAttribute(`name`),this._input.className=this.getInputClasses(),this.firstChild&&this.firstChild!==this._wrapper&&this.firstChild.nodeType===Node.TEXT_NODE){let e=this.firstChild.textContent;e&&!this._input.value&&(this._input.value=e.trim()),this.removeChild(this.firstChild)}let g=this.querySelector(`.mint-input-label-container`);if(p||m){g||(g=document.createElement(`div`),g.className=`mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]`,this._wrapper&&this._wrapper.parentElement===this?this.insertBefore(g,this._wrapper):this.insertBefore(g,this.firstChild));let e=g.querySelector(`.mint-input-label`);if(p){e||(e=document.createElement(`label`),e.className=`mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,g.insertBefore(e,g.firstChild)),e.textContent=p;let t=c||this._element?.id||this._colorTextInput?.id||this._input?.id||this._textarea?.id;if(t)e.setAttribute(`for`,t);else{let t=`mint-input-${Math.random().toString(36).substr(2,9)}`;this._element?this._element.id=t:this._colorTextInput?this._colorTextInput.id=t:this._input?this._input.id=t:this._textarea&&(this._textarea.id=t),e.setAttribute(`for`,t)}a?e.classList.add(`opacity-40`):e.classList.remove(`opacity-40`)}else e&&e.remove();let t=g.querySelector(`.mint-input-info`);m?(t||(t=document.createElement(`span`),t.className=`mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none`,g.appendChild(t)),t.textContent=m,a?t.classList.add(`opacity-40`):t.classList.remove(`opacity-40`)):t&&t.remove()}else g&&g.remove();this._renderErrorState(),this._renderSkeleton(h)}_renderErrorState(){let e=this.hasError(),t=this.getErrorMessage(),n=this.querySelector(`.mint-input-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-input-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}setupEventListeners(){this._element&&(this._element.addEventListener(`input`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`);let t=new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(t),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,cancelable:!0,composed:!0}))}),this._element.addEventListener(`blur`,()=>{let e=this._element?.value||``;e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:e},bubbles:!0,cancelable:!0}))}))}removeEventListeners(){this._colorPicker&&(this._focusHandler&&=(this._colorPicker.removeEventListener(`focus`,this._focusHandler),null),this._blurHandler&&=(this._colorPicker.removeEventListener(`blur`,this._blurHandler),null))}focus(){this._isColor()&&this._colorTextInput?this._colorTextInput.focus():this._element?.focus()}blur(){this._isColor()&&this._colorTextInput?this._colorTextInput.blur():this._element?.blur()}_renderSkeleton(e){let t=this.querySelector(`.mint-input-skeleton-container`),n=this._wrapper||this.querySelector(`.relative.w-full`);if(e){t||(t=document.createElement(`div`),t.className=`mint-input-skeleton-container absolute inset-0 z-10 pointer-events-none`,n?(n.classList.contains(`relative`)||n.classList.add(`relative`),n.appendChild(t)):(this.style.position=`relative`,this.appendChild(t)));let e=t.querySelector(`.mint-input-skeleton`);if(!e){e=document.createElement(`div`),e.className=`mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse`;let n=this._isTextarea(),r=this.getRows();if(n){let t=r*24+12;e.style.height=`${t}px`}else e.style.height=`2.2rem`;t.appendChild(e)}t.style.display=`block`,this._element&&(this._element.style.opacity=`0`,this._element.style.pointerEvents=`none`),this._colorTextInput&&(this._colorTextInput.style.opacity=`0`,this._colorTextInput.style.pointerEvents=`none`)}else t&&(t.style.display=`none`),this._element&&(this._element.style.opacity=`1`,this._element.style.pointerEvents=`auto`),this._colorTextInput&&(this._colorTextInput.style.opacity=`1`,this._colorTextInput.style.pointerEvents=`auto`)}};customElements.get(`mint-input`)||customElements.define(`mint-input`,_);var v=class extends HTMLElement{static get observedAttributes(){return[`value`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`format`,`min`,`max`,`range`,`shortcuts`,`display-format`,`error`,`error-message`,`loading`,`selection-mode`,`week-start-day`,`mode`,`disabled-dates`]}constructor(){super(),this._input=null,this._textInput=null,this._popover=null,this._calendarContainer=null,this._iconButton=null,this._hiddenInput=null,this._startPartInputs=[],this._endPartInputs=[],this._displayEl=null,this._inputsWrapperEl=null,this._fieldsContainer=null,this._resetHandler=null,this._isInputMode=!1,this._currentMonth=new Date().getMonth(),this._currentYear=new Date().getFullYear(),this._viewMode=`calendar`,this._selectedStartDate=null,this._selectedEndDate=null,this._isRange=!1,this._hoveredDate=null,this._isHandlingClick=!1,this._touchStartDate=null,this._touchStartElement=null,this._isTouchActive=!1,this._resizeObserver=null,this._popoverObserver=null,this._focusTrapHandler=null,this._escapeHandler=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`inline-block`),this.render(),this._setupPopoverWithRetry(),this._attachFormResetListener()}disconnectedCallback(){if(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._removeFocusTrap(),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}isLoading(){return this.getAttribute(`loading`)===`true`}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){let e=this.hasError(),t=this.getErrorMessage();this._applyErrorVisuals(e,t,this.isDisabled());return}if(e===`loading`){this.render();return}if(e===`mode`||e===`format`){let e=this.getMode();e===`month`?this._viewMode=`month`:e===`year`?this._viewMode=`year`:this._viewMode=`calendar`,this._popover&&this._calendarContainer&&this._buildCalendar()}this.render(),this._input&&this._setupPopoverWithRetry()}}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?(this.setAttribute(`value`,e),this._textInput&&(this._textInput.value=e),this._parseValue(e)):(this.removeAttribute(`value`),this._textInput&&(this._textInput.value=``),this._selectedStartDate=null,this._selectedEndDate=null),this._buildCalendar(),this._updateDisplayText()}get value(){try{return this.getValue()||``}catch{return``}}set value(e){try{this.setValue(e||``)}catch{}}getFormat(){return this.getAttribute(`format`)||`mm/dd/yyyy`}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isRange(){return this.getAttribute(`range`)===`true`}getId(){return this.getAttribute(`id`)||``}getName(){return this.getAttribute(`name`)||``}getMin(){return this.getAttribute(`min`)||``}getMax(){return this.getAttribute(`max`)||``}getDisabledDates(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{let t=JSON.parse(e),n=this.getFormat();return t.map(e=>this._parseDateString(e,n)).filter(e=>e!==null)}catch{return[]}}getDisabledDateStrings(){let e=this.getAttribute(`disabled-dates`);if(!e)return[];try{return JSON.parse(e)}catch{return[]}}disableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let r=this._parseDateString(e,t);if(r){let e=this._formatDate(r,t);n.includes(e)||i.push(e)}}if(i.length>0){let e=[...n,...i];this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}enableDate(e){let t=this.getFormat(),n=this.getDisabledDateStrings(),r=Array.isArray(e)?e:[e],i=[];for(let e of r){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);i.push(e)}}if(i.length>0){let e=n.filter(e=>!i.includes(e));e.length===0?this.removeAttribute(`disabled-dates`):this.setAttribute(`disabled-dates`,JSON.stringify(e)),this._buildCalendar()}}getSelectionMode(){let e=this.getAttribute(`selection-mode`);return e===`week`||e===`month`?e:`day`}getMode(){let e=this.getAttribute(`mode`);if(e===`month`||e===`year`)return e;let t=this.getFormat().toLowerCase(),n=t.includes(`d`),r=t.includes(`m`);return!n&&!r?`year`:!n&&r?`month`:`default`}getWeekStartDay(){return{sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6}[this.getAttribute(`week-start-day`)?.toLowerCase()||`sunday`]??0}getDisplayFormat(){return this.getAttribute(`display-format`)||`F j, Y`}getShortcuts(){let e=this.getAttribute(`shortcuts`);if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>({label:e.label,action:this._createShortcutAction(e.action)}))}catch{let t=e.trim();if(t&&typeof window[t]==`function`){let e=window[t]();if(Array.isArray(e))return e.map(e=>({label:e.label,action:typeof e.action==`function`?e.action:this._createShortcutAction(e.action)}))}}return[]}_createShortcutAction(e){return typeof e==`function`?e:typeof e==`string`&&typeof window[e]==`function`?window[e]:()=>null}_getDefaultShortcuts(){let e=[{label:`Today`,action:()=>new Date}];return this._isRange&&e.push({label:`This Week`,action:()=>{let e=new Date,t=e.getDay(),n=new Date(e);n.setDate(e.getDate()-t),n.setHours(0,0,0,0);let r=new Date(n);return r.setDate(n.getDate()+6),r.setHours(23,59,59,999),{start:n,end:r}}},{label:`This Month`,action:()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return n.setHours(23,59,59,999),{start:t,end:n}}}),e}_getFormatTokens(e){let t=[],n=0,r=e.toLowerCase();for(;n<r.length;){let i=r[n];if(i===`d`||i===`m`||i===`y`){let e=1,a=n+1;for(;a<r.length&&r[a]===i;)e++,a++;t.push({type:`part`,part:i,len:e}),n=a}else t.push({type:`sep`,value:e[n]}),n++}return t}_createPartInput(e,t,n,r,i){let a=document.createElement(`input`);return a.type=`text`,a.inputMode=`numeric`,a.pattern=`\\d*`,a.maxLength=e,a.placeholder=t,a.className=`bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed`,a.disabled=n||r,a.readOnly=r,a.required=i,e===4?a.className+=` w-[40px]`:e===2&&(a.className+=` w-[30px]`),a}_buildValueFromParts(e,t){let n=0;return t.map(t=>{if(t.type===`sep`)return t.value;let r=e[n]?.value||``;return n++,r}).join(``)}_applyDateToParts(e,t,n,r){if(!t.length)return;if(!e){t.forEach(e=>e.value=``);return}let i=this._formatDate(e,r),a=0,o=0;n.forEach(e=>{if(e.type===`sep`)a+=e.value.length;else{let n=i.substr(a,e.len);t[o]&&(t[o].value=n),o++,a+=e.len}})}_syncHiddenInput(){if(!this._hiddenInput)return;let e=this.getFormat(),t=this._getFormatTokens(e),n=this._buildValueFromParts(this._startPartInputs,t);if(this._isRange){let e=this._buildValueFromParts(this._endPartInputs,t);this._hiddenInput.value=e?`${n} - ${e}`:n}else this._hiddenInput.value=n}_focusNext(e,t){if(t+1<e.length){let n=e[t+1];n.focus(),n.setSelectionRange(0,n.value.length)}}_focusPrev(e,t){if(t-1>=0){let n=e[t-1];n.focus(),n.setSelectionRange(n.value.length,n.value.length)}}_attachPartInputHandlers(e,t,n){e.forEach((t,n)=>{let r=t.maxLength||2;t.addEventListener(`input`,()=>{t.value=t.value.replace(/\D/g,``).slice(0,r),t.value.length>=r&&this._focusNext(e,n),this._syncHiddenInput()}),t.addEventListener(`keydown`,r=>{r.key===`Backspace`&&t.selectionStart===0&&t.selectionEnd===0&&this._focusPrev(e,n),r.key===`ArrowLeft`&&t.selectionStart===0&&t.selectionEnd===0&&(this._focusPrev(e,n),r.preventDefault()),r.key===`ArrowRight`&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length&&(this._focusNext(e,n),r.preventDefault())}),t.addEventListener(`blur`,e=>{this._syncHiddenInput();let t=e.relatedTarget,n=t&&(this._startPartInputs.includes(t)||this._endPartInputs.includes(t));setTimeout(()=>{if(!(this._startPartInputs.some(e=>e===document.activeElement)||this._endPartInputs.some(e=>e===document.activeElement))&&(n||this._handleBlur(this._hiddenInput?.value||``),this._exitInputMode(),!n&&this._hiddenInput)){let t=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:e.relatedTarget});this._hiddenInput.dispatchEvent(t)}},0)})})}_splitRangeInput(e,t){let n=e.split(/\s*-\s*/);return n.length>=2?[n[0],n.slice(1).join(`-`)]:[e]}_parseValue(e){let t=this.getFormat(),n=this._getFormatTokens(t),r=this.getSelectionMode();if(this._isRange||r===`week`||r===`month`){let[r,i]=this._splitRangeInput(e,t),a=r?this._parseDateString(r,t):null,o=i?this._parseDateString(i,t):null;if(a&&o){let[e,t]=a<=o?[a,o]:[o,a];this._selectedStartDate=e,this._selectedEndDate=t,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else a&&(this._selectedStartDate=a,this._selectedEndDate=null,this._currentMonth=a.getMonth(),this._currentYear=a.getFullYear());this._applyDateToParts(this._selectedStartDate,this._startPartInputs,n,t),this._applyDateToParts(this._selectedEndDate,this._endPartInputs,n,t)}else{let r=this._parseDateString(e,t);r&&!isNaN(r.getTime())?(this._selectedStartDate=r,this._selectedEndDate=null,this._currentMonth=r.getMonth(),this._currentYear=r.getFullYear(),this._applyDateToParts(r,this._startPartInputs,n,t)):this._applyDateToParts(null,this._startPartInputs,n,t)}this._syncHiddenInput(),this._updateDisplayText()}_parseDateString(e,t){let n=/[\/\-\.\s]+/;if(n.test(e)){let r=e.split(n).filter(e=>e.length>0),i=t.split(/[\/\-\.\s]+/).filter(e=>e.length>0);if(r.length===i.length){let e=0,t=0,n=0;for(let a=0;a<i.length;a++){let o=i[a].toLowerCase(),s=r[a];if(o.includes(`d`))e=parseInt(s,10);else if(o.includes(`m`))t=parseInt(s,10)-1;else if(o.includes(`y`)){let e=parseInt(s,10),t=o.length,r=s.length;(r===2&&t===4||r===2&&t===2)&&(e=Math.floor(new Date().getFullYear()/100)*100+e),n=e}}let a=i.some(e=>e.toLowerCase().includes(`d`)),o=i.some(e=>e.toLowerCase().includes(`m`));if(a||(e=1),o||(t=0),t>=0&&t<=11&&n){let r=new Date(n,t,e);if(!isNaN(r.getTime()))return a&&r.getDate()!==e||r.getMonth()!==t||r.getFullYear()!==n?null:r}}}let r=e.replace(/[\/\-\.]/g,``),i=t.replace(/[\/\-\.]/g,``).toLowerCase(),a=i.indexOf(`d`),o=i.indexOf(`m`),s=i.indexOf(`y`),c=[{char:`d`,index:a},{char:`m`,index:o},{char:`y`,index:s}].sort((e,t)=>e.index-t.index),l=0,u=0,d=0,f=0;i.length,r.length;for(let e of c)if(e.char===`d`){let e=i.lastIndexOf(`d`)-i.indexOf(`d`)+1,t=r.substr(f,e);if(t.length===0)return null;l=parseInt(t,10),f+=t.length}else if(e.char===`m`){let e=i.lastIndexOf(`m`)-i.indexOf(`m`)+1,t=r.substr(f,e);if(t.length===0)return null;u=parseInt(t,10)-1,f+=t.length}else if(e.char===`y`){let e=i.lastIndexOf(`y`)-i.indexOf(`y`)+1,t=r.substr(f),n=Math.min(e,t.length),a=t.substr(0,n);if(a.length===0)return null;let o=parseInt(a,10);(n===2&&e===4||n===2&&e===2)&&(o=Math.floor(new Date().getFullYear()/100)*100+o),d=o,f+=n}let p=t.toLowerCase(),m=p.includes(`d`),h=p.includes(`m`);if(m||(l=1),h||(u=0),u<0||u>11||!d)return null;let g=new Date(d,u,l);return isNaN(g.getTime())||m&&g.getDate()!==l||g.getMonth()!==u||g.getFullYear()!==d?null:g}_formatDate(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=t.toLowerCase(),o=t;return a.includes(`dd`)?o=o.replace(/dd/gi,String(n).padStart(2,`0`)):a.includes(`d`)&&(o=o.replace(/d/gi,String(n))),a.includes(`mm`)?o=o.replace(/mm/gi,String(r).padStart(2,`0`)):a.includes(`m`)&&(o=o.replace(/m/gi,String(r))),a.includes(`yyyy`)?o=o.replace(/yyyy/gi,String(i)):a.includes(`yy`)&&(o=o.replace(/yy/gi,String(i).substr(2))),o}_formatDatePhp(e,t){let n=e.getDate(),r=e.getMonth()+1,i=e.getFullYear(),a=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],l=(e,t=2)=>e.toString().padStart(t,`0`),u=e=>{let t=e%10,n=e%100;return t===1&&n!==11?`st`:t===2&&n!==12?`nd`:t===3&&n!==13?`rd`:`th`},d=``;for(let f=0;f<t.length;f++){let p=t[f];if(p===`\\`&&f+1<t.length){d+=t[f+1],f++;continue}switch(p){case`Y`:d+=i.toString();break;case`y`:d+=i.toString().slice(-2);break;case`m`:d+=l(r);break;case`n`:d+=r.toString();break;case`M`:d+=c[r-1];break;case`F`:d+=s[r-1];break;case`d`:d+=l(n);break;case`j`:d+=n.toString();break;case`D`:d+=o[e.getDay()];break;case`l`:d+=a[e.getDay()];break;case`S`:d+=u(n);break;default:d+=p;break}}return d}_validateDateString(e,t){let n=this._parseDateString(e,t);return n!==null&&!isNaN(n.getTime())}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getInfo(),r=this.getValue(),i=this.isDisabled(),a=this.isReadonly(),o=this.isRequired(),s=this.getId(),c=this.getName(),l=this.getFormat(),u=this.hasError(),d=this.getErrorMessage(),f=this.getSelectionMode();this._isRange=this.isRange()||f===`week`||f===`month`,this._input||(this._input=document.createElement(`div`),this._input.className=`relative w-full`,this.appendChild(this._input));let p=this.querySelector(`.mint-date-picker-label-container`);if(t||n){p||(p=document.createElement(`div`),p.className=`mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]`,this.contains(this._input)?this.insertBefore(p,this._input):this.appendChild(p));let e=p.querySelector(`.mint-date-picker-label`);t?(e||(e=document.createElement(`label`),e.className=`mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none`,p.insertBefore(e,p.firstChild)),e.textContent=t,s&&this._textInput&&e.setAttribute(`for`,s)):e&&e.remove();let r=p.querySelector(`.mint-date-picker-info`);n?(r||(r=document.createElement(`span`),r.className=`mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none`,p.appendChild(r)),r.textContent=n):r&&r.remove()}else p&&p.remove();this._hiddenInput||(this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.value=r||``,this._textInput=this._hiddenInput,this._input.appendChild(this._hiddenInput)),s&&(this._hiddenInput.id=s),c&&(this._hiddenInput.name=c),this._hiddenInput.value=r||``,this._hiddenInput.setAttribute(`aria-invalid`,u?`true`:`false`);let m=this._input.querySelector(`.mint-date-fields`);m||(m=document.createElement(`div`),this._input.appendChild(m)),this._fieldsContainer=m,this._applyErrorVisuals(u,d,i),m.innerHTML=``,this._displayEl=document.createElement(`div`);let h=a?`select-text`:`select-none`;this._displayEl.className=`flex-1 text-gray-900 dark:text-white ${a?`cursor-default`:`cursor-text`} ${h} focus:outline-none`,this._displayEl.tabIndex=i||a?-1:0,this._displayEl.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._displayEl.addEventListener(`keydown`,e=>{i||a||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this._enterInputMode())}),this._inputsWrapperEl=document.createElement(`div`),this._isRange,this._inputsWrapperEl.className=`flex items-center gap-1 w-full`;let g=this._getFormatTokens(l);this._startPartInputs=[],this._endPartInputs=[];let _=e=>{let t=document.createDocumentFragment();return g.forEach(n=>{if(n.type===`sep`){let e=document.createElement(`span`);e.textContent=n.value,e.className=`text-gray-400 dark:text-gray-500 select-none`,t.appendChild(e)}else{let r=n.part===`d`?`dd`:n.part===`m`?`mm`:n.len===2?`yy`:`yyyy`,s=this._createPartInput(n.len,r,i,a,o);e===`start`?this._startPartInputs.push(s):this._endPartInputs.push(s),t.appendChild(s)}}),t};if(this._isRange){let e=document.createElement(`div`);e.className=`flex items-center gap-1 flex-shrink-0`,e.appendChild(_(`start`)),this._inputsWrapperEl.appendChild(e);let t=document.createElement(`span`);t.textContent=` - `,t.className=`text-gray-400 dark:text-gray-500 select-none flex-shrink-0`,this._inputsWrapperEl.appendChild(t);let n=document.createElement(`div`);n.className=`flex items-center gap-1 flex-shrink-0`,n.appendChild(_(`end`)),this._inputsWrapperEl.appendChild(n)}else this._inputsWrapperEl.appendChild(_(`start`));let v=document.createElement(`div`);if(v.className=`flex flex-col w-full`,this._displayEl.style.display=this._isInputMode?`none`:`flex`,this._inputsWrapperEl.style.display=this._isInputMode?`flex`:`none`,v.appendChild(this._displayEl),v.appendChild(this._inputsWrapperEl),m.appendChild(v),this._isRange&&this._inputsWrapperEl&&this._setupContainerObserver(),m.addEventListener(`click`,()=>{this._isInputMode||i||a||this._enterInputMode()}),this._attachPartInputHandlers(this._startPartInputs,g,m),this._isRange&&this._attachPartInputHandlers(this._endPartInputs,g,m),this._parseValue(r),this._syncHiddenInput(),this._updateDisplayText(),this._iconButton)this._iconButton.disabled=i||a,!i&&!a?this._iconButton.tabIndex=0:this._iconButton.tabIndex=-1;else{this._iconButton=document.createElement(`button`),this._iconButton.type=`button`,this._iconButton.tabIndex=0,this._iconButton.className=`absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm`;let e=`date-icon-${Math.random().toString(36).substr(2,9)}`;this._iconButton.id=e;let t=document.createElement(`mint-icon`);t.setAttribute(`name`,`calendar`),t.className=`w-4 h-4 pointer-events-none`,this._iconButton.appendChild(t),this._iconButton.addEventListener(`click`,()=>{i||a||this._enterInputMode()}),this._input.prepend(this._iconButton),this._iconButton.disabled=i||a}this._renderErrorState(u,d),this._renderSkeleton(e)}_renderErrorState(e,t){let n=this.querySelector(`.mint-date-picker-error`);e&&t?(n||(n=document.createElement(`div`),n.className=`mint-date-picker-error mt-1 text-xs text-red-600 dark:text-red-400`,this.appendChild(n)),n.textContent=t):n&&n.remove()}_applyErrorVisuals(e,t,n){if(this._renderErrorState(e,t),this._fieldsContainer){let t=this._getFieldContainerClass(e,n);this._fieldsContainer.className=t}this._hiddenInput&&this._hiddenInput.setAttribute(`aria-invalid`,e?`true`:`false`)}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this.setValue(``),this._clearPartInputs(this._startPartInputs),this._clearPartInputs(this._endPartInputs),this._isInputMode=!1,this._updateDisplayText(),this._applyErrorVisuals(!1,``,this.isDisabled())},e.addEventListener(`reset`,this._resetHandler))}_clearPartInputs(e){e.forEach(e=>{e.value=``})}_getFieldContainerClass(e,t){return[`mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-900 dark:border dark:border-gray-700 text-gray-900 dark:text-white`,`border-2`,e?`border-red-300 dark:border-red-300`:`border-gray-200 dark:border-gray-700`,`transition-all duration-200 outline-none focus-within:ring-2 focus-within:ring-offset-1`,e?`focus-within:ring-red-400 dark:focus-within:ring-red-500`:`focus-within:ring-gray-400 dark:focus-within:ring-gray-500`,`flex items-center gap-1`].join(` `)+(t?` opacity-40 cursor-not-allowed`:``)}_handleInputChange(e){}_cleanInputValue(e,t){return e}_handleBlur(e){let t=this.getFormat(),n=this.getSelectionMode(),r=this._isRange||n===`week`||n===`month`;if(!e){this.setValue(``),this._updateDisplayText();return}if(r){let[n,r]=this._splitRangeInput(e,t),i=n?this._parseDateString(n,t):null,a=r?this._parseDateString(r,t):null;if(i&&a){let[e,n]=i<=a?[i,a]:[a,i],r=`${this._formatDate(e,t)} - ${this._formatDate(n,t)}`;this.setValue(r),this._applyDateToParts(e,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(n,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=e,this._selectedEndDate=n,this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}else if(i){let e=this._formatDate(i,t);this.setValue(e),this._applyDateToParts(i,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=i,this._selectedEndDate=null,this._currentMonth=i.getMonth(),this._currentYear=i.getFullYear()}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._applyDateToParts(null,this._endPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}else if(this._validateDateString(e,t)){let n=this._parseDateString(e,t);if(n){let e=this._formatDate(n,t);this.setValue(e),this._applyDateToParts(n,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=n,this._selectedEndDate=null,this._currentMonth=n.getMonth(),this._currentYear=n.getFullYear()}}else this.setValue(``),this._applyDateToParts(null,this._startPartInputs,this._getFormatTokens(t),t),this._selectedStartDate=null,this._selectedEndDate=null}_setupPopoverWithRetry(e=0){if(!this._iconButton){e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)});return}let t=this._iconButton.id;t&&this._iconButton.isConnected&&document.getElementById(t)?this._createPopover(t):e<10&&requestAnimationFrame(()=>{this._setupPopoverWithRetry(e+1)})}_createPopover(e){if(e){if(!document.getElementById(e)){setTimeout(()=>{this._createPopover(e)},50);return}if(this._popover){if(this._popover.getAttribute(`trigger-id`)!==e){this._popover.setAttribute(`trigger-id`,e);let t=this._popover;typeof t._setupTrigger==`function`&&t._setupTrigger()}this._buildCalendar()}else{this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`);let t=this.closest(`mint-modal`),n=this.closest(`mint-off-canvas`);t||n?document.body.appendChild(this._popover):this.parentNode?this.parentNode.insertBefore(this._popover,this.nextSibling):document.body.appendChild(this._popover),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover&&this._popover.isConnected&&(this._popover.setAttribute(`trigger-id`,e),this._popoverObserver||(this._popoverObserver=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`open`)if(this._popover?.hasAttribute(`open`))requestAnimationFrame(()=>{this._buildCalendar();let e=this._popover;typeof e.render==`function`&&e.render(),this._setupFocusTrap()});else{if(this._removeFocusTrap(),this._iconButton&&!this._iconButton.disabled&&requestAnimationFrame(()=>{this._iconButton?.focus()}),this._viewMode=`calendar`,this._selectedStartDate)this._currentMonth=this._selectedStartDate.getMonth(),this._currentYear=this._selectedStartDate.getFullYear();else{let e=new Date;this._currentMonth=e.getMonth(),this._currentYear=e.getFullYear()}requestAnimationFrame(()=>{this._buildCalendar()}),this._hiddenInput&&(this._syncHiddenInput(),setTimeout(()=>{let e=new FocusEvent(`blur`,{bubbles:!0,cancelable:!0,relatedTarget:null});this._hiddenInput?.dispatchEvent(e)},0))}})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]})),requestAnimationFrame(()=>{this._buildCalendar()}))})})}}}_buildCalendar(){if(!this._popover)return;this._calendarContainer&&this._calendarContainer.parentNode&&this._calendarContainer.remove(),this._calendarContainer=document.createElement(`div`),this._calendarContainer.className=`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]`;let e=this.getMode();e===`month`&&this._viewMode===`calendar`?this._viewMode=`month`:e===`year`&&this._viewMode===`calendar`?this._viewMode=`year`:e===`default`&&this._viewMode!==`month`&&this._viewMode!==`year`&&(this._viewMode=`calendar`),this._viewMode===`calendar`?this._buildCalendarView():this._viewMode===`month`?this._buildMonthView():this._viewMode===`year`&&this._buildYearView();let t=this._popover.querySelector(`.popover-content`);if(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(this._calendarContainer)}else this._popover.appendChild(this._calendarContainer)}_buildCalendarView(){if(!this._calendarContainer)return;let e=this._getDaysInMonth(this._currentMonth,this._currentYear),t=this._getFirstDayOfMonth(this._currentMonth,this._currentYear),n=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],r=this.getWeekStartDay(),i=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],a=[...i.slice(r),...i.slice(0,r)],o=this.getShortcuts(),s=o.length>0;this._calendarContainer.className=s?`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]`:`mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:min-w-[18rem]`;let c=document.createElement(`div`);c.className=`flex flex-col md:flex-row md:gap-6 md:items-start`;let l=document.createElement(`div`);l.className=`flex-1 min-w-0`;let u=document.createElement(`div`);u.className=`flex items-center justify-between mb-4`;let d=document.createElement(`button`);d.type=`button`,d.tabIndex=0,d.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,d.setAttribute(`data-keep-popover-open`,`true`);let f=document.createElement(`mint-icon`);f.setAttribute(`name`,`caret-left`),f.className=`w-4 h-4`,d.appendChild(f),d.addEventListener(`click`,()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===0?(this._currentMonth=11,this._currentYear--):this._currentMonth--,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)}),u.appendChild(d);let p=document.createElement(`div`);p.className=`flex items-center gap-2`;let m=document.createElement(`button`);m.type=`button`,m.tabIndex=0,m.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,m.setAttribute(`data-keep-popover-open`,`true`),m.textContent=n[this._currentMonth];let h=()=>{let e=this.getMode();e!==`month`&&e!==`year`&&(this._viewMode=`month`,this._buildCalendar())};m.addEventListener(`click`,h),m.addEventListener(`touchend`,e=>{e.preventDefault(),h()},{passive:!1}),p.appendChild(m);let g=document.createElement(`button`);g.type=`button`,g.tabIndex=0,g.className=`text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,g.setAttribute(`data-keep-popover-open`,`true`),g.textContent=String(this._currentYear),g.addEventListener(`click`,()=>{this.getMode()!==`year`&&(this._viewMode=`year`,this._buildCalendar())}),p.appendChild(g),u.appendChild(p);let _=document.createElement(`button`);_.type=`button`,_.tabIndex=0,_.className=`p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_.setAttribute(`data-keep-popover-open`,`true`);let v=document.createElement(`mint-icon`);v.setAttribute(`name`,`caret-right`),v.className=`w-4 h-4`,_.appendChild(v);let y=()=>{let e=this._currentMonth,t=this._currentYear;this._currentMonth===11?(this._currentMonth=0,this._currentYear++):this._currentMonth++,this._buildCalendar(),this._dispatchMonthChangeEvent(e,t,this._currentMonth,this._currentYear)};_.addEventListener(`click`,y),_.addEventListener(`touchend`,e=>{e.preventDefault(),y()},{passive:!1}),u.appendChild(_);let b=document.createElement(`div`);b.className=`grid grid-cols-7 mb-2`,a.forEach(e=>{let t=document.createElement(`div`);t.className=`text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1`,t.textContent=e,b.appendChild(t)});let x=document.createElement(`div`);x.className=`grid grid-cols-7`;let S=this.getMin()?this._parseDateString(this.getMin(),this.getFormat()):null,C=this.getMax()?this._parseDateString(this.getMax(),this.getFormat()):null;this.getDisabledDates();let w=this._currentMonth===0?11:this._currentMonth-1,T=this._currentMonth===0?this._currentYear-1:this._currentYear,E=this._getDaysInMonth(w,T),D=this._currentMonth===11?0:this._currentMonth+1,O=this._currentMonth===11?this._currentYear+1:this._currentYear,k=t+e,A=Math.ceil(k/7)*7-k,j=(e,t,n)=>{let r=this._isToday(e),i=this._isDateSelected(e),a=this._isDateInRange(e),o=S&&e<S||C&&e>C||this._isDateDisabled(e),s=`rounded-md`,c=this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&this._hoveredDate,l=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._selectedStartDate:c&&this._hoveredDate?this._hoveredDate:null,u=c&&this._selectedStartDate&&this._hoveredDate&&this._selectedStartDate<this._hoveredDate?this._hoveredDate:c&&this._selectedStartDate?this._selectedStartDate:null,d=l!==null&&this._isSameDate(e,l),f=u!==null&&this._isSameDate(e,u),p=this._hoveredDate!==null&&this._isSameDate(e,this._hoveredDate),m=c&&this._hoveredDate&&this._selectedStartDate?!this._rangeIncludesDisabledDates(this._selectedStartDate<this._hoveredDate?this._selectedStartDate:this._hoveredDate,this._selectedStartDate<this._hoveredDate?this._hoveredDate:this._selectedStartDate):!1;if(this._isRange&&this._selectedStartDate&&this._selectedEndDate){let t=this._isSameDate(e,this._selectedStartDate),n=this._isSameDate(e,this._selectedEndDate);t&&n?s=`rounded-md`:t?s=`rounded-l-md`:n?s=`rounded-r-md`:a&&(s=`rounded-none`)}else c&&(d||f)&&m?d&&f?s=`rounded-md`:d?s=`rounded-l-md`:f&&(s=`rounded-r-md`):i&&!this._isRange||i&&this._isRange&&!this._selectedEndDate?s=`rounded-md`:a&&c&&m&&(s=`rounded-none`);let h=document.createElement(`button`);h.type=`button`,h.disabled=!!o,h.tabIndex=o?-1:0;let g=`w-full h-8 ${s} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`,_=i||c&&p&&m;return n?g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:r?` text-gray-900 dark:text-gray-100 font-semibold`:` text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700`:g+=_?` bg-slate-800 dark:bg-slate-600 text-white`:a?` bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200`:` text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700`,g+=o?` opacity-40 cursor-not-allowed`:``,h.className=g,h.textContent=t.toString(),o||(h.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),this._handleDateClick(e)}),h.addEventListener(`touchstart`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive=!0,this._touchStartDate=e,this._touchStartElement=h,h.classList.add(`active`,`bg-gray-200`,`dark:bg-gray-600`)},{passive:!1}),h.addEventListener(`touchend`,t=>{t.preventDefault(),t.stopPropagation(),this._isTouchActive&&this._touchStartDate&&this._isSameDate(this._touchStartDate,e)&&this._handleDateClick(e),this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null},{passive:!1}),h.addEventListener(`touchcancel`,()=>{this._touchStartElement&&this._touchStartElement.classList.remove(`active`,`bg-gray-200`,`dark:bg-gray-600`),this._isTouchActive=!1,this._touchStartDate=null,this._touchStartElement=null}),this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&!o&&(h.addEventListener(`mouseenter`,()=>{this._isHandlingClick||this._isTouchActive||this._isDateDisabled(e)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,e))&&(this._hoveredDate=e,this._buildCalendar())}),h.addEventListener(`touchmove`,e=>{if(!this._isTouchActive||!this._touchStartDate)return;let t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);for(;n&&!n.classList.contains(`mint-date-picker-day`);)n=n.parentElement;if(n&&n!==h){let e=n.getAttribute(`data-date`);if(e){let t=new Date(e);this._isDateDisabled(t)||(!this._hoveredDate||!this._isSameDate(this._hoveredDate,t))&&(this._hoveredDate=t,this._buildCalendar())}}},{passive:!0}))),h};for(let e=t-1;e>=0;e--){let t=E-e,n=j(new Date(T,w,t),t,!1);x.appendChild(n)}for(let t=1;t<=e;t++){let e=j(new Date(this._currentYear,this._currentMonth,t),t,!0);x.appendChild(e)}for(let e=1;e<=A;e++){let t=j(new Date(O,D,e),e,!1);x.appendChild(t)}if(this._isRange&&this._selectedStartDate&&!this._selectedEndDate&&(x.addEventListener(`mouseleave`,()=>{this._isTouchActive||(this._hoveredDate=null,this._buildCalendar())}),x.addEventListener(`touchend`,e=>{let t=e.changedTouches[0],n=document.elementFromPoint(t.clientX,t.clientY);n&&!x.contains(n)&&(this._hoveredDate=null,this._buildCalendar())},{passive:!0})),s){let e=document.createElement(`div`);e.className=`mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col`;let t=document.createElement(`div`);t.className=`relative md:relative md:flex-1 md:min-h-0`;let n=document.createElement(`div`);n.className=`flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2`,n.style.scrollbarWidth=`none`,n.style.msOverflowStyle=`none`,n.style.setProperty(`-webkit-overflow-scrolling`,`touch`);let r=document.createElement(`style`);r.textContent=`
|
|
59
59
|
.mint-date-shortcuts-row::-webkit-scrollbar {
|
|
60
60
|
display: none;
|
|
61
61
|
}
|
|
@@ -157,31 +157,31 @@ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{val
|
|
|
157
157
|
max-height: 100% !important;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
`,document.head.appendChild(e)}}};customElements.get(`mint-off-canvas`)||customElements.define(`mint-off-canvas`,O);var k=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.isActive(),t=this.isDisabled();this.className=``,this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-block`,`cursor-pointer`,`px-4`,`py-1.5`,`text-sm`,`font-medium`,`transition-all`,`duration-200`,`rounded-lg`,`border`,`text-gray-700`,`dark:text-gray-300`);let n=this.closest(`mint-tab-list`)?.getAttribute(`position`)||`top`,r=n===`left`||n===`right`;t?(this.classList.add(`opacity-60`,`cursor-not-allowed`,`pointer-events-none`,`bg-gray-50`,`dark:bg-gray-900`,`border-gray-300`,`dark:border-gray-700`,`text-gray-400`,`dark:text-gray-500`),this.classList.remove(`cursor-pointer`)):e?(this.classList.add(`bg-white`,`dark:bg-gray-900`,`border-gray-200`,`dark:border-gray-700`,`text-gray-900`,`dark:text-gray-100`,`shadow-sm`,`relative`,`z-10`),r?n===`left`?this.classList.add(`mr-[-1px]`):this.classList.add(`ml-[-1px]`):this.classList.add(`mb-[-1px]`)):this.classList.add(`bg-gray-100`,`dark:bg-gray-900`,`border-gray-200`,`dark:border-gray-700`,`text-gray-600`,`dark:text-gray-400`,`hover:bg-gray-50`,`dark:hover:bg-gray-600`)}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||customElements.define(`mint-tab`,k);var A=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){let e=this.getPosition();this.classList.remove(`flex`,`inline-flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`pb-0`,`pr-0`,`pl-0`,`mb-0`,`mr-0`,`ml-0`,`self-start`),this.classList.add(`box-border`,`m-0`,`p-1`,`border`,`bg-gray-100`,`dark:bg-gray-900`,`dark:border-gray-700`,`border-gray-200`,`w-auto`,`rounded-lg`,`gap-2`),e===`top`?this.classList.add(`inline-flex`,`flex-row`,`mb-0`,`self-start`):e===`left`?this.classList.add(`flex`,`flex-col`,`mr-0`):e===`right`&&this.classList.add(`flex`,`flex-col`,`ml-0`)}};customElements.get(`mint-tab-list`)||customElements.define(`mint-tab-list`,A);var j=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.style.display=`block`}hide(){this.style.display=`none`}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.style.display=`none`;return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.style.display=`block`:this.style.display=`none`}render(){}};customElements.get(`mint-tab-content`)||customElements.define(`mint-tab-content`,j);var M=class extends HTMLElement{constructor(){super(),this._tabClickHandler=null,this._mutationObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`),this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}let t=e.getAttribute(`position`)||`top`;this.classList.remove(`flex`,`flex-row`,`flex-col`,`gap-4`,`gap-6`),t===`left`||t===`right`?(this.classList.add(`flex`,`flex-row`,`items-start`),t===`left`?(e.classList.add(`mr-4`,`flex-shrink-0`),e.classList.remove(`ml-4`)):(e.classList.add(`ml-4`,`flex-shrink-0`,`order-2`),e.classList.remove(`mr-4`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.add(`order-1`)}))):(this.classList.add(`flex`,`flex-col`),e.classList.remove(`mr-4`,`ml-4`,`flex-shrink-0`,`order-2`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.remove(`order-1`)}))}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab,n=e.detail?.target;if(!t)return;let r=t.closest(`mint-tab-list`);r&&(r.querySelectorAll(`mint-tab`).forEach(e=>{let n=e;e===t?n.active=!0:n.active=!1}),n&&this.showContent(n))}};customElements.get(`mint-tabs`)||customElements.define(`mint-tabs`,M);var N=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.3,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#3b82f6`,`#ef4444`,`#10b981`,`#f59e0b`,`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f97316`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this._getReactiveValue(this.data);e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupDataObserver(){let e=null,t=0,n=()=>{if(!this.isConnected)return;let t=this._getReactiveValue(this.data),n=null;t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(n=t),n!==e&&n&&(e=n,this._chartData=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n()})});let r=setInterval(()=>{if(!this.isConnected){clearInterval(r);return}if(n(),t++,t>50){clearInterval(r);let e=setInterval(()=>{if(!this.isConnected){clearInterval(e);return}n()},1e3);this._dataCheckInterval=e}},100);this._dataCheckInterval=r}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){t!==n&&(e===`data`&&this.data&&typeof this.data==`object`&&(this._chartData=this.data),(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()}))}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let e=this._getReactiveValue(this.data);if(e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let t=this.getBoundingClientRect(),n=t.width||this.parentElement?.clientWidth||800,r=t.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,n,n),this._height=this._calculateDimension(this._heightValue,r,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let i=this.getAttribute(`curve-tension`);if(i!==null){let e=parseFloat(i);this._curveTension=isNaN(e)?.3:Math.max(0,Math.min(1,e))}else this._curveTension=.3;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}switch(this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._chartContainer&&this._svg&&this._chartContainer.appendChild(this._svg),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine()}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-gray-800 text-white text-xs rounded px-2 py-1 shadow-lg opacity-0 transition-opacity`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=`<strong>${e}</strong><br/>`,i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
160
|
+
`,document.head.appendChild(e)}}};customElements.get(`mint-off-canvas`)||customElements.define(`mint-off-canvas`,O);var k=class extends HTMLElement{static get observedAttributes(){return[`active`,`disabled`,`target`]}constructor(){super(),this._clickHandler=null}connectedCallback(){this.render(),this.setupEventListeners()}disconnectedCallback(){this.removeEventListeners()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getTarget(){return this.getAttribute(`target`)||``}isActive(){let e=this.getAttribute(`active`);return e!==null&&e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}get active(){return this.isActive()}set active(e){e?this.setAttribute(`active`,`true`):this.setAttribute(`active`,`false`)}render(){let e=this.isActive(),t=this.isDisabled();this.className=``,this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`inline-block`,`cursor-pointer`,`px-4`,`py-1.5`,`text-sm`,`font-medium`,`transition-all`,`duration-200`,`rounded-lg`,`border`,`text-gray-700`,`dark:text-gray-300`);let n=this.closest(`mint-tab-list`)?.getAttribute(`position`)||`top`,r=n===`left`||n===`right`;t?(this.classList.add(`opacity-60`,`cursor-not-allowed`,`pointer-events-none`,`bg-gray-50`,`dark:bg-gray-900`,`border-gray-300`,`dark:border-gray-700`,`text-gray-400`,`dark:text-gray-500`),this.classList.remove(`cursor-pointer`)):e?(this.classList.add(`bg-white`,`dark:bg-gray-900`,`border-gray-200`,`dark:border-gray-700`,`text-gray-900`,`dark:text-gray-100`,`shadow-sm`,`relative`,`z-10`),r?n===`left`?this.classList.add(`mr-[-1px]`):this.classList.add(`ml-[-1px]`):this.classList.add(`mb-[-1px]`)):this.classList.add(`bg-gray-100`,`dark:bg-gray-900`,`border-gray-200`,`dark:border-gray-700`,`text-gray-600`,`dark:text-gray-400`,`hover:bg-gray-50`,`dark:hover:bg-gray-600`)}setupEventListeners(){this.isDisabled()||this._clickHandler||(this._clickHandler=this.handleClick.bind(this),this.addEventListener(`click`,this._clickHandler))}removeEventListeners(){this._clickHandler&&=(this.removeEventListener(`click`,this._clickHandler),null)}handleClick(e){if(this.isDisabled()){e.preventDefault(),e.stopPropagation();return}e.__mintTabsSynthetic||(e.stopPropagation(),this.dispatchEvent(new CustomEvent(`tab-click`,{detail:{tab:this,target:this.getTarget()},bubbles:!0,cancelable:!0,composed:!0})))}};customElements.get(`mint-tab`)||customElements.define(`mint-tab`,k);var A=class extends HTMLElement{static get observedAttributes(){return[`position`]}constructor(){super()}connectedCallback(){this.render()}attributeChangedCallback(e,t,n){t!==n&&this.render()}getPosition(){return this.getAttribute(`position`)||`top`}render(){let e=this.getPosition();this.classList.remove(`flex`,`inline-flex`,`flex-row`,`flex-col`,`gap-1`,`gap-2`,`pb-0`,`pr-0`,`pl-0`,`mb-0`,`mr-0`,`ml-0`,`self-start`),this.classList.add(`box-border`,`m-0`,`p-1`,`border`,`bg-gray-100`,`dark:bg-gray-900`,`dark:border-gray-700`,`border-gray-200`,`w-auto`,`rounded-lg`,`gap-2`),e===`top`?this.classList.add(`inline-flex`,`flex-row`,`mb-0`,`self-start`):e===`left`?this.classList.add(`flex`,`flex-col`,`mr-0`):e===`right`&&this.classList.add(`flex`,`flex-col`,`ml-0`)}};customElements.get(`mint-tab-list`)||customElements.define(`mint-tab-list`,A);var j=class extends HTMLElement{static get observedAttributes(){return[`id`]}constructor(){super()}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`,`w-full`),this.render(),this.checkInitialVisibility()}attributeChangedCallback(e,t,n){t!==n&&e===`id`&&(this.render(),this.checkInitialVisibility())}getId(){return this.getAttribute(`id`)||``}show(){this.style.display=`block`}hide(){this.style.display=`none`}checkInitialVisibility(){let e=this.closest(`mint-tabs`);if(!e){this.style.display=`none`;return}let t=e.querySelectorAll(`mint-tab`),n=!1;t.forEach(e=>{let t=e.getAttribute(`active`),r=e.getAttribute(`target`),i=this.getId();t===`true`&&r===i&&(n=!0)}),!n&&t.length>0&&t[0].getAttribute(`target`)===this.getId()&&!e.querySelector(`mint-tab[active="true"]`)&&(n=!0),n?this.style.display=`block`:this.style.display=`none`}render(){}};customElements.get(`mint-tab-content`)||customElements.define(`mint-tab-content`,j);var M=class extends HTMLElement{constructor(){super(),this._tabClickHandler=null,this._mutationObserver=null}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`block`),this.render(),this.setupEventListeners(),this.setupMutationObserver(),this.initializeActiveTab()}disconnectedCallback(){this.removeEventListeners(),this._mutationObserver&&=(this._mutationObserver.disconnect(),null)}render(){let e=this.querySelector(`mint-tab-list`);if(this.querySelectorAll(`mint-tab-content`),!e){console.warn(`mint-tabs: mint-tab-list is required`);return}let t=e.getAttribute(`position`)||`top`;this.classList.remove(`flex`,`flex-row`,`flex-col`,`gap-4`,`gap-6`),t===`left`||t===`right`?(this.classList.add(`flex`,`flex-row`,`items-start`),t===`left`?(e.classList.add(`mr-4`,`flex-shrink-0`),e.classList.remove(`ml-4`)):(e.classList.add(`ml-4`,`flex-shrink-0`,`order-2`),e.classList.remove(`mr-4`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.add(`order-1`)}))):(this.classList.add(`flex`,`flex-col`),e.classList.remove(`mr-4`,`ml-4`,`flex-shrink-0`,`order-2`),this.querySelectorAll(`mint-tab-content`).forEach(e=>{e.classList.remove(`order-1`)}))}initializeActiveTab(){requestAnimationFrame(()=>{let e=this.querySelectorAll(`mint-tab`),t=null;if(e.forEach(e=>{e.getAttribute(`active`)===`true`&&(t=e)}),!t&&e.length>0&&(t=e[0],t.setAttribute(`active`,`true`)),t){let e=t.getAttribute(`target`);e?this.showContent(e):this.hideAllContent()}else this.hideAllContent();this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.checkInitialVisibility&&t.checkInitialVisibility()})})}hideAllContent(){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`})}showContent(e){this.querySelectorAll(`mint-tab-content`).forEach(e=>{let t=e;t.hide?t.hide():e.style.display=`none`});let t=this.querySelector(`mint-tab-content[id="${e}"]`);t&&(t.show?t.show():t.style.display=`block`)}setupEventListeners(){this._tabClickHandler||(this._tabClickHandler=this.handleTabClick.bind(this),this.addEventListener(`tab-click`,this._tabClickHandler))}removeEventListeners(){this._tabClickHandler&&=(this.removeEventListener(`tab-click`,this._tabClickHandler),null)}setupMutationObserver(){this._mutationObserver=new MutationObserver(()=>{this.render()});let e=this.querySelector(`mint-tab-list`);e&&this._mutationObserver.observe(e,{attributes:!0,attributeFilter:[`position`]})}handleTabClick(e){let t=e.detail?.tab,n=e.detail?.target;if(!t)return;let r=t.closest(`mint-tab-list`);r&&(r.querySelectorAll(`mint-tab`).forEach(e=>{let n=e;e===t?n.active=!0:n.active=!1}),n&&this.showContent(n))}};customElements.get(`mint-tabs`)||customElements.define(`mint-tabs`,M);var N=class e extends HTMLElement{static get observedAttributes(){return[`type`,`data`,`width`,`height`,`show-legend`,`show-grid`,`show-tooltip`,`curve-tension`]}static{this.MAX_CACHE_SIZE=100}constructor(){super(),this._chartContainer=null,this._svg=null,this._tooltip=null,this._chartType=`line`,this._chartData=null,this._width=800,this._height=400,this._padding={top:20,right:20,bottom:60,left:60},this._showLegend=!0,this._showGrid=!0,this._showTooltip=!0,this._curveTension=.3,this._dataObserver=null,this._darkModeObserver=null,this._tooltipHideTimeout=null,this._lastTooltipContent=``,this._activeXValue=null,this._pinnedXValue=null,this._tooltipAnimationFrame=null,this._cachedTooltipContent=new Map,this._cachedXPositions=new Map,this._verticalLine=null,this._plotPoints=new Map,this._resizeObserver=null,this._windowResizeHandler=null,this._pieChartTimeouts=new Set,this._pieChartTooltipShown=!1,this._pieChartClickOutsideHandler=null,this._pieChartGroup=null,this._chartClickOutsideHandler=null,this._chartTooltipScrollHandler=null,this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``},this._renderScheduled=!1,this._datasetVisibility=new Map,this._widthValue=`100%`,this._heightValue=400,this._defaultColors=[`#3b82f6`,`#ef4444`,`#10b981`,`#f59e0b`,`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f97316`],this._legendHeight=0,this._rotatedLabelHeight=0}connectedCallback(){this.classList.add(`box-border`,`m-0`,`p-0`,`border-0`,`align-baseline`,`block`,`w-full`);let e=this._getReactiveValue(this.data);e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),this._setupDataObserver(),this._setupDarkModeObserver(),this._setupResizeObserver(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.render()})})}_getReactiveValue(e){if(!e||typeof e!=`object`)return e;if(`_value`in e||`__v_isRef`in e){if(e.value!==void 0)return e.value;if(`_value`in e)return e._value}return`__v_raw`in e||`__v_isReactive`in e||`__ob__`in e,e}_setupDataObserver(){let e=null,t=0,n=()=>{if(!this.isConnected)return;let t=this._getReactiveValue(this.data),n=null;t&&typeof t==`object`&&!Array.isArray(t)&&`datasets`in t&&(n=t),n!==e&&n&&(e=n,this._chartData=n,this._cachedBounds.dataHash=``,this._cachedYRange.dataHash=``,this._cachedXValues.dataHash=``,this.render())};requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n()})});let r=setInterval(()=>{if(!this.isConnected){clearInterval(r);return}if(n(),t++,t>50){clearInterval(r);let e=setInterval(()=>{if(!this.isConnected){clearInterval(e);return}n()},1e3);this._dataCheckInterval=e}},100);this._dataCheckInterval=r}_setupDarkModeObserver(){this._darkModeObserver=new MutationObserver(()=>{this.isConnected&&this.render()}),this._darkModeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]})}disconnectedCallback(){if(this._tooltip&&this._tooltip.parentNode&&(this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=null),this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._pieChartTimeouts.forEach(e=>clearTimeout(e)),this._pieChartTimeouts.clear(),this._pieChartClickOutsideHandler&&=(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),null),this._chartClickOutsideHandler&&=(document.removeEventListener(`click`,this._chartClickOutsideHandler,!0),null),this._pieChartTooltipShown=!1,this._pieChartGroup=null,this._pinnedXValue=null,this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._dataObserver&&=(this._dataObserver.disconnect(),null),this._darkModeObserver&&=(this._darkModeObserver.disconnect(),null),this._dataCheckInterval&&=(clearInterval(this._dataCheckInterval),null),this._svg&&(this._chartTooltipMouseMove&&=(this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),null),this._chartTooltipMouseLeave&&=(this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),null),this._chartTooltipTouchStart&&=(this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),null),this._chartTooltipTouchMove&&=(this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),null),this._chartTooltipTouchEnd&&=(this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),null)),this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement;this._chartTooltipScrollHandler=null}this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null),this._cachedTooltipContent.clear(),this._cachedXPositions.clear(),this._plotPoints.clear(),this._cachedBounds={bounds:null,dataHash:``},this._cachedYRange={range:null,dataHash:``},this._cachedXValues={values:null,dataHash:``}}_handleResize(){if(!this.isConnected)return;let e=this.getBoundingClientRect(),t=e.width||this.parentElement?.clientWidth||800,n=e.height||this.parentElement?.clientHeight||400,r=this._calculateDimension(this._widthValue,t,t),i=this._calculateDimension(this._heightValue,n,400);(r!==this._width||i!==this._height)&&(this._width=r,this._height=i,this.render())}_setupResizeObserver(){this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._windowResizeHandler&&=(window.removeEventListener(`resize`,this._windowResizeHandler),null);let e=null,t=()=>{e&&clearTimeout(e),e=window.setTimeout(()=>{this._handleResize()},100)};this._windowResizeHandler=t,this._resizeObserver=new ResizeObserver(()=>{t()}),this._resizeObserver.observe(this),window.addEventListener(`resize`,t)}attributeChangedCallback(e,t,n){t!==n&&(e===`data`&&this.data&&typeof this.data==`object`&&(this._chartData=this.data),(e===`width`||e===`height`)&&this.isConnected&&(t&&t.endsWith(`%`))!==(n&&n.endsWith(`%`))&&this._setupResizeObserver(),this.isConnected&&requestAnimationFrame(()=>{this.render()}))}get type(){let e=this.getAttribute(`type`)||`line`;return e===`line`||e===`bar`||e===`area`||e===`pie`?e:`line`}set type(e){this.setAttribute(`type`,e)}get data(){return this._chartData}set data(e){if(typeof e==`string`)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}else this._chartData=e;this.isConnected&&requestAnimationFrame(()=>{this.render()})}get width(){let e=this.getAttribute(`width`);if(!e)return this._widthValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._widthValue:t}set width(e){this.setAttribute(`width`,e.toString())}get height(){let e=this.getAttribute(`height`);if(!e)return this._heightValue;if(e.endsWith(`%`))return e;let t=parseInt(e,10);return isNaN(t)?this._heightValue:t}set height(e){this.setAttribute(`height`,e.toString())}_calculateDimension(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!isNaN(n))return t*n/100}return n}_scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,requestAnimationFrame(()=>{this._renderScheduled=!1,this.render()}))}_isDatasetVisible(e,t){if(e.id){let t=this._datasetVisibility.get(e.id);if(t!==void 0)return t}return e.visible!==!1}_initializeDatasetVisibility(){this._chartData&&this._chartData.datasets.forEach((e,t)=>{e.id&&(this._datasetVisibility.has(e.id)||this._datasetVisibility.set(e.id,e.visible!==!1))})}render(){if(!this.isConnected)return;this._plotPoints.clear(),this._activeXValue=null,this._cachedTooltipContent?.clear(),this._cachedXPositions?.clear(),this._chartType=this.type;let e=this._getReactiveValue(this.data);if(e&&typeof e==`object`&&!Array.isArray(e)&&`datasets`in e&&(this._chartData=e),!this._chartData){let e=this.getAttribute(`data`);if(e)try{this._chartData=JSON.parse(e)}catch(e){console.error(`mint-chart: Invalid data JSON`,e),this._chartData=null}}this._widthValue=this.width,this._heightValue=this.height;let t=this.getBoundingClientRect(),n=t.width||this.parentElement?.clientWidth||800,r=t.height||this.parentElement?.clientHeight||400;this._width=this._calculateDimension(this._widthValue,n,n),this._height=this._calculateDimension(this._heightValue,r,400),this._showLegend=this.getAttribute(`show-legend`)!==`false`,this._showGrid=this.getAttribute(`show-grid`)!==`false`,this._showTooltip=this.getAttribute(`show-tooltip`)!==`false`;let i=this.getAttribute(`curve-tension`);if(i!==null){let e=parseFloat(i);this._curveTension=isNaN(e)?.3:Math.max(0,Math.min(1,e))}else this._curveTension=.3;if(!this._chartData||!this._chartData.datasets||this._chartData.datasets.length===0){this.innerHTML=`<div class="p-4 text-gray-500">No chart data provided</div>`;return}switch(this.innerHTML=``,this._chartContainer=document.createElement(`div`),this._chartContainer.className=`relative w-full`,typeof this._widthValue==`string`&&this._widthValue.endsWith(`%`)?this._chartContainer.style.width=this._widthValue:this._chartContainer.style.width=`${this._width}px`,typeof this._heightValue==`string`&&this._heightValue.endsWith(`%`)?this._chartContainer.style.height=this._heightValue:this._chartContainer.style.height=`${this._height}px`,this.appendChild(this._chartContainer),this._svg=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),this._svg.setAttribute(`width`,this._width.toString()),this._svg.setAttribute(`height`,this._height.toString()),this._svg.setAttribute(`viewBox`,`0 0 ${this._width} ${this._height}`),this._svg.setAttribute(`class`,`w-full h-full`),this._chartContainer&&this._svg&&this._chartContainer.appendChild(this._svg),this._showTooltip&&this._createTooltip(),this._initializeDatasetVisibility(),this._calculateRotatedLabelHeight(),this._showLegend?this._legendHeight=this._calculateLegendHeight():this._legendHeight=0,this._showLegend&&this._renderLegend(),this._chartType!==`pie`&&this._pieChartClickOutsideHandler&&(document.removeEventListener(`click`,this._pieChartClickOutsideHandler,!0),this._pieChartClickOutsideHandler=null,this._pieChartTooltipShown=!1,this._pieChartGroup=null),this._pinnedXValue=null,this._chartType){case`line`:this._renderLineChart();break;case`bar`:this._renderBarChart();break;case`area`:this._renderAreaChart();break;case`pie`:this._renderPieChart();break}this._showTooltip&&this._chartType!==`pie`&&(this._setupChartTooltip(),this._setupTooltipScrollHandler()),this._createVerticalLine()}_createTooltip(){this._tooltip&&this._tooltip.parentNode&&this._tooltip.parentNode.removeChild(this._tooltip),this._tooltip=document.createElement(`div`),this._tooltip.className=`fixed pointer-events-none z-50 bg-gray-900 dark:bg-gray-800 text-white text-xs rounded px-2 py-1 shadow-lg opacity-0 transition-opacity`,this._tooltip.style.display=`none`,document.body.appendChild(this._tooltip)}_showTooltipAt(e,t,n){if(!this._tooltip)return;this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._lastTooltipContent!==n&&(this._tooltip.innerHTML=n,this._lastTooltipContent=n),(this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)&&(this._tooltip.style.display=`block`,this._tooltip.style.opacity=`1`,this._tooltip.style.padding=`8px 12px`);let r=this._tooltip.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=e+10,s=t-r.height-8;o+r.width>i&&(o=e-r.width-10),o<0&&(o=10),s<0&&(s=t+20),s+r.height>a&&(s=t-r.height-8,s<0&&(s=10));let c=`${o}px`,l=`${s}px`;this._tooltip.style.left!==c&&(this._tooltip.style.left=c),this._tooltip.style.top!==l&&(this._tooltip.style.top=l)}_hideTooltip(){this._tooltip&&(this._tooltipHideTimeout!==null&&(clearTimeout(this._tooltipHideTimeout),this._tooltipHideTimeout=null),this._tooltip.style.opacity=`0`,this._tooltipHideTimeout=window.setTimeout(()=>{this._tooltip&&(this._tooltip.style.display=`none`),this._tooltipHideTimeout=null},200))}_createVerticalLine(){if(!this._svg)return;this._verticalLine&&this._verticalLine.parentNode&&this._verticalLine.parentNode.removeChild(this._verticalLine),this._verticalLine=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);let e=document.documentElement.classList.contains(`dark`);this._verticalLine.setAttribute(`stroke`,e?`#9ca3af`:`#6b7280`),this._verticalLine.setAttribute(`stroke-width`,`1`),this._verticalLine.setAttribute(`stroke-dasharray`,`4,2`),this._verticalLine.style.opacity=`0`,this._verticalLine.style.pointerEvents=`none`;let t=this._svg.querySelector(`.chart-legend`);t&&t.parentNode?t.parentNode.insertBefore(this._verticalLine,t):this._svg.appendChild(this._verticalLine)}_showVerticalLineAtX(e,t){if(!this._verticalLine)return;let n=this._chartType===`bar`?this._scaleXForBarChart(e,t):this._scaleX(e,t);this._verticalLine.setAttribute(`x1`,n.toString()),this._verticalLine.setAttribute(`y1`,t.y.toString()),this._verticalLine.setAttribute(`x2`,n.toString()),this._verticalLine.setAttribute(`y2`,(t.y+t.height).toString()),this._verticalLine.style.opacity=`1`}_hideVerticalLine(){this._verticalLine&&(this._verticalLine.style.opacity=`0`)}_showPlotPointsForX(e){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})});let t=String(e),n=this._plotPoints.get(t);n&&n.forEach(e=>{e.style.opacity=`1`})}_hidePlotPoints(){this._plotPoints.forEach(e=>{e.forEach(e=>{e.style.opacity=`0`})})}_calculateMaxYAxisLabelWidth(){if(!this._showGrid||!this._chartData)return 0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e)return 60;e.font=`12px system-ui, -apple-system, sans-serif`;let t=this._showLegend?Math.max(this._legendHeight,60):0,n=this._height-t,r=Math.floor(n/35),i=Math.min(5,r),a=0;for(let t=0;t<=i;t++){let n=this._getYRange(),r=n.max-(n.max-n.min)/i*t,o=this._formatYAxisValue(r),s=e.measureText(o);a=Math.max(a,s.width)}return Math.ceil(a)+20}_getChartBounds(){let e=this._calculateMaxYAxisLabelWidth(),t=`${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;if(this._cachedBounds.bounds&&this._cachedBounds.dataHash===t)return this._cachedBounds.bounds;let n=0,r=0;this._showGrid&&(n=e+10);let i=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,a=i;this._showLegend&&(a=i+20+Math.max(this._legendHeight,60));let o=this._height-0-n-0,s=o-a,c=1;if(s<100&&a>0){let e=o-100;e>0?(c=Math.min(1,e/a),c=Math.max(.5,c)):c=.5}r=a*c;let l=this._width*.3,u=n,d=1;n>l&&(d=l/n,u=l);let f={width:(this._width-u-0)*d,height:this._height-0-r,x:u,y:0};return this._cachedBounds={bounds:f,dataHash:t},f}_getAllDataPoints(){if(!this._chartData)return[];let e=[];return this._chartData.datasets.forEach((t,n)=>{this._isDatasetVisible(t,n)&&e.push(...t.data)}),e}_getXValues(){if(!this._chartData)return[];let e=JSON.stringify(this._chartData.labels)+JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.x)));if(this._cachedXValues.values&&this._cachedXValues.dataHash===e)return this._cachedXValues.values;if(this._chartData.labels&&this._chartData.labels.length>0)return this._cachedXValues={values:this._chartData.labels,dataHash:e},this._chartData.labels;let t=new Set;this._chartData.datasets.forEach((e,n)=>{this._isDatasetVisible(e,n)&&e.data.forEach(e=>{t.add(e.x)})});let n=Array.from(t).sort((e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t),i=/^([A-Za-z]{3})\s+(\d{4})$/,a=n.match(i),o=r.match(i);if(a&&o){let e=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],t=e.indexOf(a[1]),n=e.indexOf(o[1]),r=parseInt(a[2]),i=parseInt(o[2]);return r===i?t-n:r-i}return n.localeCompare(r)});return this._cachedXValues={values:n,dataHash:e},n}_getYRange(){if(!this._chartData)return{min:0,max:100};let e=JSON.stringify(this._chartData.datasets.map(e=>e.data.map(e=>e.y)));if(this._cachedYRange.range&&this._cachedYRange.dataHash===e)return this._cachedYRange.range;let t=this._getAllDataPoints();if(t.length===0){let t={min:0,max:100};return this._cachedYRange={range:t,dataHash:e},t}let n=t.map(e=>e.y),r=Math.min(...n),i=Math.max(...n),a=(i-r)*.1,o={min:Math.max(0,r-a),max:i+a};return this._cachedYRange={range:o,dataHash:e},o}_hasDecimalValues(){return this._getAllDataPoints().some(e=>e.y%1!=0)}_formatValueByString(e,t){switch(t.toLowerCase()){case`currency`:case`currency-usd`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e);case`currency-eur`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`EUR`}).format(e);case`currency-gbp`:return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`GBP`}).format(e);case`number`:case`number-with-commas`:return new Intl.NumberFormat(`en-US`).format(e);case`percent`:return new Intl.NumberFormat(`en-US`,{style:`percent`,minimumFractionDigits:1}).format(e/100);default:return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}}_formatXAxisValue(e){if(this._chartData?.formatXAxis){if(typeof this._chartData.formatXAxis==`function`)return this._chartData.formatXAxis(e);if(typeof this._chartData.formatXAxis==`string`)return String(e)}return String(e)}_formatXAxisForTooltip(e){return this._formatXAxisValue(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}_formatYAxisValue(e){if(this._chartData?.formatYAxis){if(typeof this._chartData.formatYAxis==`function`)return this._chartData.formatYAxis(e);if(typeof this._chartData.formatYAxis==`string`)return this._formatValueByString(e,this._chartData.formatYAxis)}if(this._chartData?.datasets?.[0]?.formatValue){if(typeof this._chartData.datasets[0].formatValue==`function`)return this._chartData.datasets[0].formatValue(e);if(typeof this._chartData.datasets[0].formatValue==`string`)return this._formatValueByString(e,this._chartData.datasets[0].formatValue)}return this._hasDecimalValues()&&e%1!=0?e.toFixed(1):Math.round(e).toString()}_formatValue(e,t){if(t.formatValue){if(typeof t.formatValue==`function`)return t.formatValue(e);if(typeof t.formatValue==`string`)return this._formatValueByString(e,t.formatValue)}return String(e)}_getAllDatasetsAtX(e){if(!this._chartData)return[];let t=[];return this._chartData.datasets.forEach((n,r)=>{if(!this._isDatasetVisible(n,r))return;let i=n.data.find(t=>String(t.x)===String(e));if(i){let e=this._getDatasetColor(n,r),a=this._formatValue(i.y,n);t.push({name:n.name,value:i.y,color:e,formattedValue:a})}}),t}_findNearestXValue(e){if(!this._chartData)return null;let t=this._getChartBounds(),n=this._getXValues();if(n.length===0)return null;let r=this._chartType===`bar`,i=null,a=1/0;return n.forEach(n=>{let o=r?this._scaleXForBarChart(n,t):this._scaleX(n,t),s=Math.abs(e-o);s<a&&(a=s,i=n)}),i}_setupTooltipScrollHandler(){if(this._chartTooltipScrollHandler){window.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;)e.removeEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}this._chartTooltipScrollHandler=()=>{this._hideTooltip(),this._pinnedXValue=null},window.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),this._chartContainer&&this._chartContainer.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0);let e=this.parentElement;for(;e;){let t=window.getComputedStyle(e),n=t.overflow,r=t.overflowY;(n===`auto`||n===`scroll`||r===`auto`||r===`scroll`)&&e.addEventListener(`scroll`,this._chartTooltipScrollHandler,!0),e=e.parentElement}}_setupChartTooltip(){if(!this._svg||!this._showTooltip)return;this._chartTooltipMouseMove&&this._svg.removeEventListener(`mousemove`,this._chartTooltipMouseMove),this._chartTooltipMouseLeave&&this._svg.removeEventListener(`mouseleave`,this._chartTooltipMouseLeave),this._chartTooltipClick&&this._svg.removeEventListener(`click`,this._chartTooltipClick),this._chartTooltipTouchStart&&this._svg.removeEventListener(`touchstart`,this._chartTooltipTouchStart),this._chartTooltipTouchMove&&this._svg.removeEventListener(`touchmove`,this._chartTooltipTouchMove),this._chartTooltipTouchEnd&&this._svg.removeEventListener(`touchend`,this._chartTooltipTouchEnd),this._cachedTooltipContent.clear(),this._cachedXPositions.clear();let t=this._getChartBounds(),n=0,r=0,i=i=>{!this._chartContainer||!this._svg||(n=i.clientX,r=i.clientY,this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let i=this._svg.getBoundingClientRect(),a=n-i.left,o=r-i.top;if(a<t.x||a>t.x+t.width||o<t.y||o>t.y+t.height){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}let s=this._findNearestXValue(a);if(!s){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;return}if(this._pinnedXValue!==null&&this._pinnedXValue===s){let e=this._pinnedXValue,i=this._getAllDatasetsAtX(e);if(i.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let a=this._cachedTooltipContent.get(e);a||(a=`<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`,i.forEach(e=>{a+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
161
161
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
162
162
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
163
|
-
</div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=`<strong>${s}</strong><br/>`,c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
163
|
+
</div>`}),this._cachedTooltipContent.set(e,a)),this._updateTooltipPosition(n,r),this._lastTooltipContent!==a&&this._showTooltipAt(n,r,a);return}}if(this._activeXValue===s){this._updateTooltipPosition(n,r);return}let c=this._getAllDatasetsAtX(s);if(c.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=s,this._showPlotPointsForX(s),this._showVerticalLineAtX(s,t);let l=this._cachedTooltipContent.get(s);if(!l){if(l=`<strong>${this._formatXAxisForTooltip(s)}</strong><br/>`,c.forEach(e=>{l+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
164
164
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
165
165
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
166
|
-
</div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(s,l)}this._showTooltipAt(n,r,l)}))},a=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},o=e=>{if(!this._chartContainer||!this._svg)return;e.stopPropagation();let n=this._svg.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;if(r<t.x||r>t.x+t.width||i<t.y||i>t.y+t.height)return;let a=this._findNearestXValue(r);if(a)if(this._pinnedXValue===a)this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{this._pinnedXValue=a,this._activeXValue=a;let n=this._getAllDatasetsAtX(a);if(n.length===0)return;this._showPlotPointsForX(a),this._showVerticalLineAtX(a,t);let r=this._cachedTooltipContent.get(a);r||(r=`<strong>${a}</strong><br/>`,n.forEach(e=>{r+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
166
|
+
</div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(s,l)}this._showTooltipAt(n,r,l)}))},a=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},o=e=>{if(!this._chartContainer||!this._svg)return;e.stopPropagation();let n=this._svg.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;if(r<t.x||r>t.x+t.width||i<t.y||i>t.y+t.height)return;let a=this._findNearestXValue(r);if(a)if(this._pinnedXValue===a)this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{this._pinnedXValue=a,this._activeXValue=a;let n=this._getAllDatasetsAtX(a);if(n.length===0)return;this._showPlotPointsForX(a),this._showVerticalLineAtX(a,t);let r=this._cachedTooltipContent.get(a);r||(r=`<strong>${this._formatXAxisForTooltip(a)}</strong><br/>`,n.forEach(e=>{r+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
167
167
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
168
168
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
169
|
-
</div>`}),this._cachedTooltipContent.set(a,r)),this._showTooltipAt(e.clientX,e.clientY,r)}},s=e=>{if(e.preventDefault(),!this._chartContainer||!this._svg)return;let n=e.touches[0];if(!n)return;let r=this._svg.getBoundingClientRect(),i=n.clientX-r.left,a=n.clientY-r.top;if(i<t.x||i>t.x+t.width||a<t.y||a>t.y+t.height){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}let o=this._findNearestXValue(i);if(!o){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}if(this._pinnedXValue===o)this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{this._pinnedXValue=o,this._activeXValue=o;let e=this._getAllDatasetsAtX(o);if(e.length===0)return;this._showPlotPointsForX(o),this._showVerticalLineAtX(o,t);let r=this._cachedTooltipContent.get(o);r||(r=`<strong>${o}</strong><br/>`,e.forEach(e=>{r+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
169
|
+
</div>`}),this._cachedTooltipContent.set(a,r)),this._showTooltipAt(e.clientX,e.clientY,r)}},s=e=>{if(e.preventDefault(),!this._chartContainer||!this._svg)return;let n=e.touches[0];if(!n)return;let r=this._svg.getBoundingClientRect(),i=n.clientX-r.left,a=n.clientY-r.top;if(i<t.x||i>t.x+t.width||a<t.y||a>t.y+t.height){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}let o=this._findNearestXValue(i);if(!o){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}if(this._pinnedXValue===o)this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{this._pinnedXValue=o,this._activeXValue=o;let e=this._getAllDatasetsAtX(o);if(e.length===0)return;this._showPlotPointsForX(o),this._showVerticalLineAtX(o,t);let r=this._cachedTooltipContent.get(o);r||(r=`<strong>${this._formatXAxisForTooltip(o)}</strong><br/>`,e.forEach(e=>{r+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
170
170
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
171
171
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
172
|
-
</div>`}),this._cachedTooltipContent.set(o,r)),this._showTooltipAt(n.clientX,n.clientY,r)}},c=n=>{if(n.preventDefault(),!this._chartContainer||!this._svg)return;let r=n.touches[0];r&&(this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let n=this._svg.getBoundingClientRect(),i=r.clientX-n.left,a=r.clientY-n.top;if(i<t.x||i>t.x+t.width||a<t.y||a>t.y+t.height){if(this._pinnedXValue===null)this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{let e=this._pinnedXValue,n=this._getAllDatasetsAtX(e);if(n.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let i=this._cachedTooltipContent.get(e);i||(i=`<strong>${e}</strong><br/>`,n.forEach(e=>{i+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
172
|
+
</div>`}),this._cachedTooltipContent.set(o,r)),this._showTooltipAt(n.clientX,n.clientY,r)}},c=n=>{if(n.preventDefault(),!this._chartContainer||!this._svg)return;let r=n.touches[0];r&&(this._tooltipAnimationFrame!==null&&cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=requestAnimationFrame(()=>{if(this._tooltipAnimationFrame=null,!this._svg)return;let n=this._svg.getBoundingClientRect(),i=r.clientX-n.left,a=r.clientY-n.top;if(i<t.x||i>t.x+t.width||a<t.y||a>t.y+t.height){if(this._pinnedXValue===null)this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null;else{let e=this._pinnedXValue,n=this._getAllDatasetsAtX(e);if(n.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let i=this._cachedTooltipContent.get(e);i||(i=`<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`,n.forEach(e=>{i+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
173
173
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
174
174
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
175
|
-
</div>`}),this._cachedTooltipContent.set(e,i)),this._updateTooltipPosition(r.clientX,r.clientY),this._lastTooltipContent!==i&&this._showTooltipAt(r.clientX,r.clientY,i)}}return}if(this._pinnedXValue!==null){let e=this._pinnedXValue,n=this._getAllDatasetsAtX(e);if(n.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let i=this._cachedTooltipContent.get(e);i||(i=`<strong>${e}</strong><br/>`,n.forEach(e=>{i+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
175
|
+
</div>`}),this._cachedTooltipContent.set(e,i)),this._updateTooltipPosition(r.clientX,r.clientY),this._lastTooltipContent!==i&&this._showTooltipAt(r.clientX,r.clientY,i)}}return}if(this._pinnedXValue!==null){let e=this._pinnedXValue,n=this._getAllDatasetsAtX(e);if(n.length>0){this._activeXValue=e,this._showPlotPointsForX(e),this._showVerticalLineAtX(e,t);let i=this._cachedTooltipContent.get(e);i||(i=`<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`,n.forEach(e=>{i+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
176
176
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
177
177
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
178
|
-
</div>`}),this._cachedTooltipContent.set(e,i)),this._updateTooltipPosition(r.clientX,r.clientY),this._lastTooltipContent!==i&&this._showTooltipAt(r.clientX,r.clientY,i);return}}let o=this._findNearestXValue(i);if(!o){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}if(this._activeXValue===o){this._updateTooltipPosition(r.clientX,r.clientY);return}let s=this._getAllDatasetsAtX(o);if(s.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=o,this._showPlotPointsForX(o),this._showVerticalLineAtX(o,t);let c=this._cachedTooltipContent.get(o);if(!c){if(c=`<strong>${o}</strong><br/>`,s.forEach(e=>{c+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
178
|
+
</div>`}),this._cachedTooltipContent.set(e,i)),this._updateTooltipPosition(r.clientX,r.clientY),this._lastTooltipContent!==i&&this._showTooltipAt(r.clientX,r.clientY,i);return}}let o=this._findNearestXValue(i);if(!o){this._pinnedXValue===null&&(this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null);return}if(this._activeXValue===o){this._updateTooltipPosition(r.clientX,r.clientY);return}let s=this._getAllDatasetsAtX(o);if(s.length===0){this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine();return}this._activeXValue=o,this._showPlotPointsForX(o),this._showVerticalLineAtX(o,t);let c=this._cachedTooltipContent.get(o);if(!c){if(c=`<strong>${this._formatXAxisForTooltip(o)}</strong><br/>`,s.forEach(e=>{c+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
179
179
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
180
180
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
181
|
-
</div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(o,c)}this._showTooltipAt(r.clientX,r.clientY,c)}))},l=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._pinnedXValue===null&&setTimeout(()=>{this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},500)};this._chartClickOutsideHandler||(this._chartClickOutsideHandler=e=>{if(this._pinnedXValue===null)return;let t=e.target;this._svg&&!this._svg.contains(t)&&(this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null)},document.addEventListener(`click`,this._chartClickOutsideHandler,!0)),this._svg.addEventListener(`mousemove`,i),this._svg.addEventListener(`mouseleave`,a),this._svg.addEventListener(`click`,o),this._svg.addEventListener(`touchstart`,s,{passive:!1}),this._svg.addEventListener(`touchmove`,c,{passive:!1}),this._svg.addEventListener(`touchend`,l),this._chartTooltipMouseMove=i,this._chartTooltipMouseLeave=a,this._chartTooltipClick=o,this._chartTooltipTouchStart=s,this._chartTooltipTouchMove=c,this._chartTooltipTouchEnd=l}_updateTooltipPosition(e,t){if(!this._tooltip||this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)return;let n=this._tooltip.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e+10,o=t-n.height-8;a+n.width>r&&(a=e-n.width-10),a<0&&(a=10),o<0&&(o=t+20),o+n.height>i&&(o=t-n.height-8,o<0&&(o=10));let s=`${a}px`,c=`${o}px`;this._tooltip.style.left!==s&&(this._tooltip.style.left=s),this._tooltip.style.top!==c&&(this._tooltip.style.top=c)}_scaleX(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=t.width/Math.max(1,n.length-1);return t.x+r*i}_scaleY(e,t){let n=this._getYRange();if(n.max===n.min)return t.y+t.height/2;let r=(e-n.min)/(n.max-n.min);return t.y+t.height-r*t.height}_getDatasetColor(e,t,n){return n===void 0?e.color||this._defaultColors[t%this._defaultColors.length]:e.color||this._defaultColors[n%this._defaultColors.length]}_getContrastColor(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}_calculateRotatedLabelHeight(){if(this._rotatedLabelHeight=0,!this._chartData||!this._showGrid)return;let e=this._getXValues();if(e.length<=1)return;let t={width:this._width-(this._showGrid?60:0)-0,height:this._height-(this._showLegend?Math.max(this._legendHeight,60):0)-0,x:this._showGrid?60:0,y:0},n=this._chartType===`bar`,r=[];e.forEach(e=>{let i=n?this._scaleXForBarChart(e,t):this._scaleX(e,t);r.push(i)});let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;i.font=`12px system-ui, -apple-system, sans-serif`;let a=[];e.forEach(e=>{let t=this._formatXAxisValue(e),n=i.measureText(t);a.push(n.width)});let o=!0;for(let t=1;t<e.length;t++){let e=r[t]-r[t-1],n=a[t-1]/2+a[t]/2+10;if(e<Math.max(n,80)){o=!1;break}}if(!o){let e=(Math.max(...a)+12*1.2)*.707;this._rotatedLabelHeight=Math.ceil(e)+10}}_renderGrid(e){if(!this._svg||!this._showGrid)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-grid`);let n=this._getYRange(),r=Math.floor(e.height/35),i=Math.min(5,r);for(let r=0;r<=i;r++){let a=e.y+e.height/i*r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,e.x.toString()),o.setAttribute(`y1`,a.toString()),o.setAttribute(`x2`,(e.x+e.width).toString()),o.setAttribute(`y2`,a.toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let s=n.max-(n.max-n.min)/i*r,c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),l=a+4;r===0&&(l=a+12),c.setAttribute(`x`,`5`),c.setAttribute(`y`,l.toString()),c.setAttribute(`text-anchor`,`start`),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),c.textContent=this._formatYAxisValue(s),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}let a=this._getXValues();if(a.length===0){this._svg.appendChild(t);return}let o=this._chartType===`bar`,s=[];a.forEach(t=>{let n=o?this._scaleXForBarChart(t,e):this._scaleX(t,e);s.push(n)});let c=document.createElement(`canvas`).getContext(`2d`),l=!1,u=Array(a.length).fill(!0);if(c&&a.length>1){c.font=`12px system-ui, -apple-system, sans-serif`;let e=[];a.forEach(t=>{let n=this._formatXAxisValue(t),r=c.measureText(n);e.push(r.width)});let t=!0;for(let n=1;n<a.length;n++){let r=s[n]-s[n-1],i=e[n-1]/2+e[n]/2+10;if(r<Math.max(i,80)){t=!1;break}}if(!t){l=!0;let t=12*1.2;if(this._rotatedLabelHeight===0){let n=(Math.max(...e)+t)*.707;this._rotatedLabelHeight=Math.ceil(n)+10}let n=t*1.5,r=!0;for(let e=1;e<a.length;e++)if(s[e]-s[e-1]<n){r=!1;break}if(!r){let e=n;u=Array(a.length).fill(!1);let t=-1/0;a.length>0&&(u[0]=!0,t=s[0]);for(let n=1;n<a.length-1;n++){let r=s[n];r-t>=e&&(u[n]=!0,t=r)}if(a.length>1){let n=s[a.length-1];if(n-t>=e)u[a.length-1]=!0;else{for(;n-t<e;){let e=!1;for(let n=a.length-2;n>=0;n--)if(u[n]){if(u[n]=!1,n>0){for(let r=n-1;r>=0;r--)if(u[r]){t=s[r],e=!0;break}e||(t=s[0])}else t=s[0];e=!0;break}if(!e)break}n-t>=e&&(u[a.length-1]=!0)}}}}}else u=Array(a.length).fill(!1),a.length>0&&(u[0]=!0),a.length>1&&(u[a.length-1]=!0),this._rotatedLabelHeight=0;l||(this._rotatedLabelHeight=0),a.forEach((n,r)=>{if(u[r]){let i=s[r],o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,i.toString()),o.setAttribute(`y1`,e.y.toString()),o.setAttribute(`x2`,i.toString()),o.setAttribute(`y2`,(e.y+e.height).toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),u=i,d=`middle`;if(!l){if(r===0){let t=e.x;u=Math.max(i,t),d=`start`}else if(r===a.length-1){let t=e.x+e.width;u=Math.min(i,t),d=`end`}}else if(d=`end`,r===a.length-1){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`12px system-ui, -apple-system, sans-serif`;let r=this._formatXAxisValue(n),a=t.measureText(r).width*.707,o=e.x+e.width+100;u=Math.min(i,o-a)}}c.setAttribute(`x`,u.toString());let f=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,p=f;this._showLegend&&(p=f+20+Math.max(this._legendHeight,60));let m=(this._height-e.y-e.height)/p,h=(l?30:20)*m,g=e.y+e.height+h;c.setAttribute(`y`,g.toString()),c.setAttribute(`text-anchor`,d),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),l&&c.setAttribute(`transform`,`rotate(-45 ${u} ${g})`),c.textContent=this._formatXAxisValue(n),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}}),this._svg.appendChild(t)}_renderLineChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),o=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(o.length===0)return;let s=[`M ${o[0].x} ${o[0].y}`];for(let e=1;e<o.length;e++)s.push(`L ${o[e].x} ${o[e].y}`);a.setAttribute(`d`,s.join(` `)),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,i),a.setAttribute(`stroke-width`,`2`),a.setAttribute(`stroke-linecap`,`round`),a.setAttribute(`stroke-linejoin`,`round`),n.appendChild(a),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_scaleXForBarChart(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=n.length+1,a=t.width/i;return t.x+(r+1)*a}_renderBarChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment(),r=this._getXValues(),i=this._chartData.datasets.filter((e,t)=>this._isDatasetVisible(e,t)).length,a=r.length;if(a===0)return;let o=[];r.forEach(t=>{o.push(this._scaleXForBarChart(t,e))}),o.sort((e,t)=>e-t);let s=e.width;if(a>1)for(let e=0;e<o.length-1;e++){let t=o[e+1]-o[e];t>0&&t<s&&(s=t)}else s=e.width*.5;let c=s*.7,l=.2,u=c/((1+l)*i-l),d=u*l,f=(u+d)*i-d;if(f>c){let e=c/f;u*=e,d=u*l,f=(u+d)*i-d}let p=0;this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=-f/2+(u+d)*p;p++,t.data.forEach(o=>{let s=this._scaleXForBarChart(o.x,e),c=this._scaleY(o.y,e),l=e.y+e.height-c,d=s+a,f=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);f.setAttribute(`x`,d.toString()),f.setAttribute(`y`,c.toString()),f.setAttribute(`width`,u.toString()),f.setAttribute(`height`,l.toString()),f.setAttribute(`fill`,i),f.setAttribute(`rx`,`2`),f.setAttribute(`class`,`chart-bar`),f.setAttribute(`data-dataset`,r.toString()),f.setAttribute(`data-x`,String(o.x)),f.setAttribute(`data-y`,o.y.toString()),f.setAttribute(`data-name`,t.name),f.style.cursor=`pointer`,this._showTooltip&&(f.addEventListener(`mouseenter`,e=>{let t=this._getAllDatasetsAtX(o.x),n=`<strong>${o.x}</strong><br/>`;t.forEach(e=>{n+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
181
|
+
</div>`}),this._cachedTooltipContent.size>=e.MAX_CACHE_SIZE){let e=this._cachedTooltipContent.keys().next().value;e!==void 0&&this._cachedTooltipContent.delete(e)}this._cachedTooltipContent.set(o,c)}this._showTooltipAt(r.clientX,r.clientY,c)}))},l=()=>{this._tooltipAnimationFrame!==null&&(cancelAnimationFrame(this._tooltipAnimationFrame),this._tooltipAnimationFrame=null),this._pinnedXValue===null&&setTimeout(()=>{this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null},500)};this._chartClickOutsideHandler||(this._chartClickOutsideHandler=e=>{if(this._pinnedXValue===null)return;let t=e.target;this._svg&&!this._svg.contains(t)&&(this._pinnedXValue=null,this._hideTooltip(),this._hidePlotPoints(),this._hideVerticalLine(),this._activeXValue=null)},document.addEventListener(`click`,this._chartClickOutsideHandler,!0)),this._svg.addEventListener(`mousemove`,i),this._svg.addEventListener(`mouseleave`,a),this._svg.addEventListener(`click`,o),this._svg.addEventListener(`touchstart`,s,{passive:!1}),this._svg.addEventListener(`touchmove`,c,{passive:!1}),this._svg.addEventListener(`touchend`,l),this._chartTooltipMouseMove=i,this._chartTooltipMouseLeave=a,this._chartTooltipClick=o,this._chartTooltipTouchStart=s,this._chartTooltipTouchMove=c,this._chartTooltipTouchEnd=l}_updateTooltipPosition(e,t){if(!this._tooltip||this._tooltip.style.display===`none`||this._tooltip.style.opacity===`0`)return;let n=this._tooltip.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=e+10,o=t-n.height-8;a+n.width>r&&(a=e-n.width-10),a<0&&(a=10),o<0&&(o=t+20),o+n.height>i&&(o=t-n.height-8,o<0&&(o=10));let s=`${a}px`,c=`${o}px`;this._tooltip.style.left!==s&&(this._tooltip.style.left=s),this._tooltip.style.top!==c&&(this._tooltip.style.top=c)}_scaleX(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=t.width/Math.max(1,n.length-1);return t.x+r*i}_scaleY(e,t){let n=this._getYRange();if(n.max===n.min)return t.y+t.height/2;let r=(e-n.min)/(n.max-n.min);return t.y+t.height-r*t.height}_getDatasetColor(e,t,n){return n===void 0?e.color||this._defaultColors[t%this._defaultColors.length]:e.color||this._defaultColors[n%this._defaultColors.length]}_getContrastColor(e){let t=e.replace(`#`,``),n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`}_calculateRotatedLabelHeight(){if(this._rotatedLabelHeight=0,!this._chartData||!this._showGrid)return;let e=this._getXValues();if(e.length<=1)return;let t={width:this._width-(this._showGrid?60:0)-0,height:this._height-(this._showLegend?Math.max(this._legendHeight,60):0)-0,x:this._showGrid?60:0,y:0},n=this._chartType===`bar`,r=[];e.forEach(e=>{let i=n?this._scaleXForBarChart(e,t):this._scaleX(e,t);r.push(i)});let i=document.createElement(`canvas`).getContext(`2d`);if(!i)return;i.font=`12px system-ui, -apple-system, sans-serif`;let a=[];e.forEach(e=>{let t=this._formatXAxisValue(e),n=i.measureText(t);a.push(n.width)});let o=!0;for(let t=1;t<e.length;t++){let e=r[t]-r[t-1],n=a[t-1]/2+a[t]/2+10;if(e<Math.max(n,80)){o=!1;break}}if(!o){let e=(Math.max(...a)+12*1.2)*.707;this._rotatedLabelHeight=Math.ceil(e)+10}}_renderGrid(e){if(!this._svg||!this._showGrid)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-grid`);let n=this._getYRange(),r=Math.floor(e.height/35),i=Math.min(5,r);for(let r=0;r<=i;r++){let a=e.y+e.height/i*r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,e.x.toString()),o.setAttribute(`y1`,a.toString()),o.setAttribute(`x2`,(e.x+e.width).toString()),o.setAttribute(`y2`,a.toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let s=n.max-(n.max-n.min)/i*r,c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),l=a+4;r===0&&(l=a+12),c.setAttribute(`x`,`5`),c.setAttribute(`y`,l.toString()),c.setAttribute(`text-anchor`,`start`),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),c.textContent=this._formatYAxisValue(s),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}let a=this._getXValues();if(a.length===0){this._svg.appendChild(t);return}let o=this._chartType===`bar`,s=[];a.forEach(t=>{let n=o?this._scaleXForBarChart(t,e):this._scaleX(t,e);s.push(n)});let c=document.createElement(`canvas`).getContext(`2d`),l=!1,u=Array(a.length).fill(!0);if(c&&a.length>1){c.font=`12px system-ui, -apple-system, sans-serif`;let e=[];a.forEach(t=>{let n=this._formatXAxisValue(t),r=c.measureText(n);e.push(r.width)});let t=!0;for(let n=1;n<a.length;n++){let r=s[n]-s[n-1],i=e[n-1]/2+e[n]/2+10;if(r<Math.max(i,80)){t=!1;break}}if(!t){l=!0;let t=12*1.2;if(this._rotatedLabelHeight===0){let n=(Math.max(...e)+t)*.707;this._rotatedLabelHeight=Math.ceil(n)+10}let n=t*1.5,r=!0;for(let e=1;e<a.length;e++)if(s[e]-s[e-1]<n){r=!1;break}if(!r){let e=n;u=Array(a.length).fill(!1);let t=-1/0;a.length>0&&(u[0]=!0,t=s[0]);for(let n=1;n<a.length-1;n++){let r=s[n];r-t>=e&&(u[n]=!0,t=r)}if(a.length>1){let n=s[a.length-1];if(n-t>=e)u[a.length-1]=!0;else{for(;n-t<e;){let e=!1;for(let n=a.length-2;n>=0;n--)if(u[n]){if(u[n]=!1,n>0){for(let r=n-1;r>=0;r--)if(u[r]){t=s[r],e=!0;break}e||(t=s[0])}else t=s[0];e=!0;break}if(!e)break}n-t>=e&&(u[a.length-1]=!0)}}}}}else u=Array(a.length).fill(!1),a.length>0&&(u[0]=!0),a.length>1&&(u[a.length-1]=!0),this._rotatedLabelHeight=0;l||(this._rotatedLabelHeight=0),a.forEach((n,r)=>{if(u[r]){let i=s[r],o=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);o.setAttribute(`x1`,i.toString()),o.setAttribute(`y1`,e.y.toString()),o.setAttribute(`x2`,i.toString()),o.setAttribute(`y2`,(e.y+e.height).toString()),o.setAttribute(`stroke`,`#e5e7eb`),o.setAttribute(`stroke-width`,`1`),o.setAttribute(`stroke-dasharray`,`2,2`),document.documentElement.classList.contains(`dark`)&&o.setAttribute(`stroke`,`#374151`),t.appendChild(o);let c=document.createElementNS(`http://www.w3.org/2000/svg`,`text`),u=i,d=`middle`;if(!l){if(r===0){let t=e.x;u=Math.max(i,t),d=`start`}else if(r===a.length-1){let t=e.x+e.width;u=Math.min(i,t),d=`end`}}else if(d=`end`,r===a.length-1){let t=document.createElement(`canvas`).getContext(`2d`);if(t){t.font=`12px system-ui, -apple-system, sans-serif`;let r=this._formatXAxisValue(n),a=t.measureText(r).width*.707,o=e.x+e.width+100;u=Math.min(i,o-a)}}c.setAttribute(`x`,u.toString());let f=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,p=f;this._showLegend&&(p=f+20+Math.max(this._legendHeight,60));let m=(this._height-e.y-e.height)/p,h=(l?30:20)*m,g=e.y+e.height+h;c.setAttribute(`y`,g.toString()),c.setAttribute(`text-anchor`,d),c.setAttribute(`fill`,`#6b7280`),c.setAttribute(`font-size`,`12`),l&&c.setAttribute(`transform`,`rotate(-45 ${u} ${g})`),c.textContent=this._formatXAxisValue(n),document.documentElement.classList.contains(`dark`)&&c.setAttribute(`fill`,`#9ca3af`),t.appendChild(c)}}),this._svg.appendChild(t)}_renderLineChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),o=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(o.length===0)return;let s=[`M ${o[0].x} ${o[0].y}`];for(let e=1;e<o.length;e++)s.push(`L ${o[e].x} ${o[e].y}`);a.setAttribute(`d`,s.join(` `)),a.setAttribute(`fill`,`none`),a.setAttribute(`stroke`,i),a.setAttribute(`stroke-width`,`2`),a.setAttribute(`stroke-linecap`,`round`),a.setAttribute(`stroke-linejoin`,`round`),n.appendChild(a),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_scaleXForBarChart(e,t){let n=this._getXValues();if(n.length===0)return t.x;let r=n.indexOf(e);if(r===-1)return t.x;let i=n.length+1,a=t.width/i;return t.x+(r+1)*a}_renderBarChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment(),r=this._getXValues(),i=this._chartData.datasets.filter((e,t)=>this._isDatasetVisible(e,t)).length,a=r.length;if(a===0)return;let o=[];r.forEach(t=>{o.push(this._scaleXForBarChart(t,e))}),o.sort((e,t)=>e-t);let s=e.width;if(a>1)for(let e=0;e<o.length-1;e++){let t=o[e+1]-o[e];t>0&&t<s&&(s=t)}else s=e.width*.5;let c=s*.7,l=.2,u=c/((1+l)*i-l),d=u*l,f=(u+d)*i-d;if(f>c){let e=c/f;u*=e,d=u*l,f=(u+d)*i-d}let p=0;this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=-f/2+(u+d)*p;p++,t.data.forEach(o=>{let s=this._scaleXForBarChart(o.x,e),c=this._scaleY(o.y,e),l=e.y+e.height-c,d=s+a,f=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);f.setAttribute(`x`,d.toString()),f.setAttribute(`y`,c.toString()),f.setAttribute(`width`,u.toString()),f.setAttribute(`height`,l.toString()),f.setAttribute(`fill`,i),f.setAttribute(`rx`,`2`),f.setAttribute(`class`,`chart-bar`),f.setAttribute(`data-dataset`,r.toString()),f.setAttribute(`data-x`,String(o.x)),f.setAttribute(`data-y`,o.y.toString()),f.setAttribute(`data-name`,t.name),f.style.cursor=`pointer`,this._showTooltip&&(f.addEventListener(`mouseenter`,e=>{let t=this._getAllDatasetsAtX(o.x),n=`<strong>${this._formatXAxisForTooltip(o.x)}</strong><br/>`;t.forEach(e=>{n+=`<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
182
182
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
183
183
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
184
|
-
</div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),f.addEventListener(`mouseleave`,()=>{this._hideTooltip()})),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=[`M ${a[0].x} ${o}`,`L ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)s.push(`L ${a[e].x} ${a[e].y}`);let c=a[a.length-1];s.push(`L ${c.x} ${o}`,`Z`);let l=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);l.setAttribute(`d`,s.join(` `)),l.setAttribute(`fill`,i),l.setAttribute(`fill-opacity`,`0.3`),n.appendChild(l);let u=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(a.length===0)return;let d=[`M ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)d.push(`L ${a[e].x} ${a[e].y}`);u.setAttribute(`d`,d.join(` `)),u.setAttribute(`fill`,`none`),u.setAttribute(`stroke`,i),u.setAttribute(`stroke-width`,`2`),n.appendChild(u),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=null,n=null,r=!1;p.addEventListener(`mouseenter`,a=>{if(n!==null&&(clearTimeout(n),n=null),!r){t!==null&&clearTimeout(t);let n=window.setTimeout(()=>{r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`<strong>${e.x}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s),t=null,this._pieChartTimeouts.delete(n)},150);t=n,this._pieChartTimeouts.add(n)}}),p.addEventListener(`mouseleave`,()=>{if(t!==null&&(clearTimeout(t),t=null),r){n!==null&&clearTimeout(n);let e=window.setTimeout(()=>{r=!1,this._pieChartTooltipShown=!1,this._hideTooltip(),n=null,this._pieChartTimeouts.delete(e)},200);n=e,this._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,a=>{a.stopPropagation(),t!==null&&(clearTimeout(t),t=null),n!==null&&(clearTimeout(n),n=null),r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`<strong>${e.x}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s)})}if(u>5){let e=c+d/2,i=r*.7,a=t+i*Math.cos(e),o=n+i*Math.sin(e),s=this._getContrastColor(f),l=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);l.setAttribute(`x`,a.toString()),l.setAttribute(`y`,o.toString()),l.setAttribute(`text-anchor`,`middle`),l.setAttribute(`dominant-baseline`,`middle`),l.setAttribute(`fill`,s),l.setAttribute(`font-size`,`12`),l.setAttribute(`font-weight`,`500`),l.textContent=`${u.toFixed(1)}%`,p.appendChild(l)}o.appendChild(p),c+=d}),this._svg.appendChild(o)}_calculateLegendHeight(){if(!this._chartData)return 0;let e=this._width-40,t=[];this._chartType===`pie`&&this._chartData.datasets.length>0?this._chartData.datasets[0].data.forEach(e=>{t.push({name:String(e.x),row:0})}):this._chartData.datasets.forEach(e=>{t.push({name:e.name,row:0})});let n=0,r=[];return t.forEach(t=>{let i=20+Math.min(t.name.length*7.5,150);r[n]||(r[n]=[]),r[n].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+i>e&&r[n].length>0&&(n++,r[n]=[]),t.row=n,r[n].push(t)}),r.length*36}_renderLegend(){if(!this._chartData||!this._svg)return{height:0};let e=this._svg.querySelector(`.chart-legend`);e&&e.remove();let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);if(t.setAttribute(`class`,`chart-legend`),!this._chartData)return{height:0};let n=this._chartData,r=this._width-40,i=[];if(this._chartType===`pie`&&n.datasets.length>0){let e=n.datasets[0];e.data.forEach((t,n)=>{let r=t.color||this._getDatasetColor(e,0,n),a=String(t.x);i.push({name:a,color:r,x:0,textX:0,row:0})})}else n.datasets.forEach((e,t)=>{if(!this._isDatasetVisible(e,t))return;let n=this._getDatasetColor(e,t);i.push({name:e.name,color:n,x:0,textX:0,row:0})});let a=0,o=[];i.forEach(e=>{let t=20+Math.min(e.name.length*7.5,150);o[a]||(o[a]=[]),o[a].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+t>r&&o[a].length>0&&(a++,o[a]=[]),e.row=a,o[a].push(e)}),o.forEach(e=>{let t=e.reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150)),0)+(e.length-1)*32,n=(this._width-t)/2;e.forEach(e=>{let t=Math.min(e.name.length*7.5,150);e.x=n,e.textX=n+6+8,n+=20+t+32})}),o.length*36;let s=this._getChartBounds(),c=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,l=c;this._showLegend&&(l=c+20+Math.max(this._legendHeight,60));let u=this._height-s.y-s.height,d=l>0?u/l:1,f=(this._rotatedLabelHeight>0?30:20)*d,p=12*d,m=this._rotatedLabelHeight*d,h=s.y+s.height+f+(this._rotatedLabelHeight>0?m:p)+20*d;return i.forEach(e=>{let n=h+e.row*36+16/2,r=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);r.setAttribute(`cx`,e.x.toString()),r.setAttribute(`cy`,n.toString()),r.setAttribute(`r`,`6`),r.setAttribute(`fill`,e.color),t.appendChild(r);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`);i.setAttribute(`x`,e.textX.toString()),i.setAttribute(`y`,(n-12).toString()),i.setAttribute(`width`,`150`),i.setAttribute(`height`,`24`);let a=document.createElement(`div`);a.style.cssText=`
|
|
184
|
+
</div>`}),this._showTooltipAt(e.clientX,e.clientY,n)}),f.addEventListener(`mouseleave`,()=>{this._hideTooltip()})),n.appendChild(f)})}),t.appendChild(n),this._svg.appendChild(t)}_renderAreaChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds();this._renderGrid(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);t.setAttribute(`class`,`chart-data`);let n=document.createDocumentFragment();this._chartData.datasets.forEach((t,r)=>{if(!this._isDatasetVisible(t,r))return;let i=this._getDatasetColor(t,r),a=t.data.map(t=>({x:this._scaleX(t.x,e),y:this._scaleY(t.y,e)}));if(a.length===0)return;let o=e.y+e.height,s=[`M ${a[0].x} ${o}`,`L ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)s.push(`L ${a[e].x} ${a[e].y}`);let c=a[a.length-1];s.push(`L ${c.x} ${o}`,`Z`);let l=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);l.setAttribute(`d`,s.join(` `)),l.setAttribute(`fill`,i),l.setAttribute(`fill-opacity`,`0.3`),n.appendChild(l);let u=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(a.length===0)return;let d=[`M ${a[0].x} ${a[0].y}`];for(let e=1;e<a.length;e++)d.push(`L ${a[e].x} ${a[e].y}`);u.setAttribute(`d`,d.join(` `)),u.setAttribute(`fill`,`none`),u.setAttribute(`stroke`,i),u.setAttribute(`stroke-width`,`2`),n.appendChild(u),t.data.forEach(a=>{let o=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),s=this._scaleX(a.x,e),c=this._scaleY(a.y,e);o.setAttribute(`cx`,s.toString()),o.setAttribute(`cy`,c.toString()),o.setAttribute(`r`,`4`),o.setAttribute(`fill`,i);let l=document.documentElement.classList.contains(`dark`);o.setAttribute(`stroke`,l?`#1f2937`:`#fff`),o.setAttribute(`stroke-width`,`2`),o.setAttribute(`class`,`chart-point`),o.setAttribute(`data-dataset`,r.toString()),o.setAttribute(`data-x`,String(a.x)),o.setAttribute(`data-y`,a.y.toString()),o.setAttribute(`data-name`,t.name),o.style.opacity=`0`,o.style.pointerEvents=`none`;let u=String(a.x);this._plotPoints.has(u)||this._plotPoints.set(u,[]),this._plotPoints.get(u).push(o),n.appendChild(o)})}),t.appendChild(n),this._svg.appendChild(t)}_renderPieChart(){if(!this._svg||!this._chartData)return;let e=this._getChartBounds(),t=e.x+e.width/2,n=e.y+e.height/2,r=Math.min(e.width,e.height)/2-20,i=this._chartData.datasets[0];if(!i||!i.data||i.data.length===0)return;let a=i.data.reduce((e,t)=>e+t.y,0);if(a===0)return;let o=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);o.setAttribute(`class`,`chart-data`),this._pieChartGroup=o,this._pieChartClickOutsideHandler||(this._pieChartClickOutsideHandler=e=>{if(!this._pieChartTooltipShown)return;let t=e.target;this._pieChartGroup&&!this._pieChartGroup.contains(t)&&(this._pieChartTooltipShown=!1,this._hideTooltip())},document.addEventListener(`click`,this._pieChartClickOutsideHandler,!0));let s=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);s.setAttribute(`cx`,t.toString()),s.setAttribute(`cy`,n.toString()),s.setAttribute(`r`,r.toString()),s.setAttribute(`fill`,`transparent`),s.setAttribute(`pointer-events`,`none`),o.appendChild(s);let c=-Math.PI/2;i.data.forEach((e,s)=>{let l=e.y,u=l/a*100,d=l/a*2*Math.PI,f=e.color||this._getDatasetColor(i,0,s),p=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);p.setAttribute(`class`,`chart-pie-slice-group`),p.setAttribute(`data-index`,s.toString()),p.style.cursor=`pointer`,p.style.transition=`transform 0.2s ease-out`;let m=document.createElementNS(`http://www.w3.org/2000/svg`,`path`),h=r+2,g=t+h*Math.cos(c),_=n+h*Math.sin(c),v=t+h*Math.cos(c+d),y=n+h*Math.sin(c+d),b=d>Math.PI?1:0,x=[`M ${t} ${n}`,`L ${g} ${_}`,`A ${h} ${h} 0 ${b} 1 ${v} ${y}`,`Z`].join(` `);m.setAttribute(`d`,x),m.setAttribute(`fill`,f),m.setAttribute(`class`,`chart-pie-slice`),m.setAttribute(`data-index`,s.toString()),m.setAttribute(`data-x`,String(e.x)),m.setAttribute(`data-y`,e.y.toString()),m.setAttribute(`data-name`,i.name),m.setAttribute(`data-percentage`,u.toFixed(1)),p.appendChild(m);let S=c+d/2,C=Math.cos(S)*10,w=Math.sin(S)*10,T=null,E=null,D=!1;if(p.__chartInstance=this,p.addEventListener(`mouseenter`,function(){if(E!==null&&(clearTimeout(E),E=null),!D){T!==null&&clearTimeout(T);let e=window.setTimeout(()=>{D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`),T=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},150);T=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`mouseleave`,function(){if(T!==null&&(clearTimeout(T),T=null),D){E!==null&&clearTimeout(E);let e=window.setTimeout(()=>{D=!1,this.setAttribute(`transform`,`translate(0, 0)`),E=null,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.delete(e)},200);E=e,this.__chartInstance&&this.__chartInstance._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,function(){T!==null&&(clearTimeout(T),T=null),E!==null&&(clearTimeout(E),E=null),D=!0,this.setAttribute(`transform`,`translate(${C}, ${w})`)}),this._showTooltip){let t=null,n=null,r=!1;p.addEventListener(`mouseenter`,a=>{if(n!==null&&(clearTimeout(n),n=null),!r){t!==null&&clearTimeout(t);let n=window.setTimeout(()=>{r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`<strong>${this._formatXAxisForTooltip(e.x)}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s),t=null,this._pieChartTimeouts.delete(n)},150);t=n,this._pieChartTimeouts.add(n)}}),p.addEventListener(`mouseleave`,()=>{if(t!==null&&(clearTimeout(t),t=null),r){n!==null&&clearTimeout(n);let e=window.setTimeout(()=>{r=!1,this._pieChartTooltipShown=!1,this._hideTooltip(),n=null,this._pieChartTimeouts.delete(e)},200);n=e,this._pieChartTimeouts.add(e)}}),p.addEventListener(`click`,a=>{a.stopPropagation(),t!==null&&(clearTimeout(t),t=null),n!==null&&(clearTimeout(n),n=null),r=!0,this._pieChartTooltipShown=!0;let o=this._formatValue(l,i),s=`<strong>${this._formatXAxisForTooltip(e.x)}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;this._showTooltipAt(a.clientX,a.clientY,s)})}if(u>5){let e=c+d/2,i=r*.7,a=t+i*Math.cos(e),o=n+i*Math.sin(e),s=this._getContrastColor(f),l=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);l.setAttribute(`x`,a.toString()),l.setAttribute(`y`,o.toString()),l.setAttribute(`text-anchor`,`middle`),l.setAttribute(`dominant-baseline`,`middle`),l.setAttribute(`fill`,s),l.setAttribute(`font-size`,`12`),l.setAttribute(`font-weight`,`500`),l.textContent=`${u.toFixed(1)}%`,p.appendChild(l)}o.appendChild(p),c+=d}),this._svg.appendChild(o)}_calculateLegendHeight(){if(!this._chartData)return 0;let e=this._width-40,t=[];this._chartType===`pie`&&this._chartData.datasets.length>0?this._chartData.datasets[0].data.forEach(e=>{t.push({name:String(e.x),row:0})}):this._chartData.datasets.forEach(e=>{t.push({name:e.name,row:0})});let n=0,r=[];return t.forEach(t=>{let i=20+Math.min(t.name.length*7.5,150);r[n]||(r[n]=[]),r[n].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+i>e&&r[n].length>0&&(n++,r[n]=[]),t.row=n,r[n].push(t)}),r.length*36}_renderLegend(){if(!this._chartData||!this._svg)return{height:0};let e=this._svg.querySelector(`.chart-legend`);e&&e.remove();let t=document.createElementNS(`http://www.w3.org/2000/svg`,`g`);if(t.setAttribute(`class`,`chart-legend`),!this._chartData)return{height:0};let n=this._chartData,r=this._width-40,i=[];if(this._chartType===`pie`&&n.datasets.length>0){let e=n.datasets[0];e.data.forEach((t,n)=>{let r=t.color||this._getDatasetColor(e,0,n),a=String(t.x);i.push({name:a,color:r,x:0,textX:0,row:0})})}else n.datasets.forEach((e,t)=>{if(!this._isDatasetVisible(e,t))return;let n=this._getDatasetColor(e,t);i.push({name:e.name,color:n,x:0,textX:0,row:0})});let a=0,o=[];i.forEach(e=>{let t=20+Math.min(e.name.length*7.5,150);o[a]||(o[a]=[]),o[a].reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150))+32,0)+t>r&&o[a].length>0&&(a++,o[a]=[]),e.row=a,o[a].push(e)}),o.forEach(e=>{let t=e.reduce((e,t)=>e+(20+Math.min(t.name.length*7.5,150)),0)+(e.length-1)*32,n=(this._width-t)/2;e.forEach(e=>{let t=Math.min(e.name.length*7.5,150);e.x=n,e.textX=n+6+8,n+=20+t+32})}),o.length*36;let s=this._getChartBounds(),c=(this._rotatedLabelHeight>0?30:20)+this._rotatedLabelHeight+12,l=c;this._showLegend&&(l=c+20+Math.max(this._legendHeight,60));let u=this._height-s.y-s.height,d=l>0?u/l:1,f=(this._rotatedLabelHeight>0?30:20)*d,p=12*d,m=this._rotatedLabelHeight*d,h=s.y+s.height+f+(this._rotatedLabelHeight>0?m:p)+20*d;return i.forEach(e=>{let n=h+e.row*36+16/2,r=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);r.setAttribute(`cx`,e.x.toString()),r.setAttribute(`cy`,n.toString()),r.setAttribute(`r`,`6`),r.setAttribute(`fill`,e.color),t.appendChild(r);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`foreignObject`);i.setAttribute(`x`,e.textX.toString()),i.setAttribute(`y`,(n-12).toString()),i.setAttribute(`width`,`150`),i.setAttribute(`height`,`24`);let a=document.createElement(`div`);a.style.cssText=`
|
|
185
185
|
font-size: 12px;
|
|
186
186
|
font-family: system-ui, -apple-system, sans-serif;
|
|
187
187
|
color: ${document.documentElement.classList.contains(`dark`)?`#d1d5db`:`#374151`};
|
package/dist/index.js
CHANGED
|
@@ -1214,7 +1214,7 @@ var s = class extends HTMLElement {
|
|
|
1214
1214
|
return Array.from(this.classList).some((e) => /^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e));
|
|
1215
1215
|
}
|
|
1216
1216
|
render() {
|
|
1217
|
-
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-900", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200"
|
|
1217
|
+
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-900", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200"), this.hasPaddingClass() || this.classList.add("p-4");
|
|
1218
1218
|
let e = this.getHeading();
|
|
1219
1219
|
e ? (this._headingElement || (this._headingElement = document.createElement("mint-text"), this._headingElement.setAttribute("size", "sub-heading"), this.insertBefore(this._headingElement, this.firstChild)), this._headingElement.textContent = e) : this._headingElement && this._headingElement.parentNode && (this._headingElement.remove(), this._headingElement = null);
|
|
1220
1220
|
}
|
|
@@ -7648,6 +7648,9 @@ var N = class e extends HTMLElement {
|
|
|
7648
7648
|
}
|
|
7649
7649
|
return String(e);
|
|
7650
7650
|
}
|
|
7651
|
+
_formatXAxisForTooltip(e) {
|
|
7652
|
+
return this._formatXAxisValue(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
7653
|
+
}
|
|
7651
7654
|
_formatYAxisValue(e) {
|
|
7652
7655
|
if (this._chartData?.formatYAxis) {
|
|
7653
7656
|
if (typeof this._chartData.formatYAxis == "function") return this._chartData.formatYAxis(e);
|
|
@@ -7729,7 +7732,7 @@ var N = class e extends HTMLElement {
|
|
|
7729
7732
|
if (i.length > 0) {
|
|
7730
7733
|
this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
|
|
7731
7734
|
let a = this._cachedTooltipContent.get(e);
|
|
7732
|
-
a || (a = `<strong>${e}</strong><br/>`, i.forEach((e) => {
|
|
7735
|
+
a || (a = `<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`, i.forEach((e) => {
|
|
7733
7736
|
a += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7734
7737
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7735
7738
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7750,7 +7753,7 @@ var N = class e extends HTMLElement {
|
|
|
7750
7753
|
this._activeXValue = s, this._showPlotPointsForX(s), this._showVerticalLineAtX(s, t);
|
|
7751
7754
|
let l = this._cachedTooltipContent.get(s);
|
|
7752
7755
|
if (!l) {
|
|
7753
|
-
if (l = `<strong>${s}</strong><br/>`, c.forEach((e) => {
|
|
7756
|
+
if (l = `<strong>${this._formatXAxisForTooltip(s)}</strong><br/>`, c.forEach((e) => {
|
|
7754
7757
|
l += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7755
7758
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7756
7759
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7778,7 +7781,7 @@ var N = class e extends HTMLElement {
|
|
|
7778
7781
|
if (n.length === 0) return;
|
|
7779
7782
|
this._showPlotPointsForX(a), this._showVerticalLineAtX(a, t);
|
|
7780
7783
|
let r = this._cachedTooltipContent.get(a);
|
|
7781
|
-
r || (r = `<strong>${a}</strong><br/>`, n.forEach((e) => {
|
|
7784
|
+
r || (r = `<strong>${this._formatXAxisForTooltip(a)}</strong><br/>`, n.forEach((e) => {
|
|
7782
7785
|
r += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7783
7786
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7784
7787
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7806,7 +7809,7 @@ var N = class e extends HTMLElement {
|
|
|
7806
7809
|
if (e.length === 0) return;
|
|
7807
7810
|
this._showPlotPointsForX(o), this._showVerticalLineAtX(o, t);
|
|
7808
7811
|
let r = this._cachedTooltipContent.get(o);
|
|
7809
|
-
r || (r = `<strong>${o}</strong><br/>`, e.forEach((e) => {
|
|
7812
|
+
r || (r = `<strong>${this._formatXAxisForTooltip(o)}</strong><br/>`, e.forEach((e) => {
|
|
7810
7813
|
r += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7811
7814
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7812
7815
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7826,7 +7829,7 @@ var N = class e extends HTMLElement {
|
|
|
7826
7829
|
if (n.length > 0) {
|
|
7827
7830
|
this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
|
|
7828
7831
|
let i = this._cachedTooltipContent.get(e);
|
|
7829
|
-
i || (i = `<strong>${e}</strong><br/>`, n.forEach((e) => {
|
|
7832
|
+
i || (i = `<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`, n.forEach((e) => {
|
|
7830
7833
|
i += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7831
7834
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7832
7835
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7841,7 +7844,7 @@ var N = class e extends HTMLElement {
|
|
|
7841
7844
|
if (n.length > 0) {
|
|
7842
7845
|
this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
|
|
7843
7846
|
let i = this._cachedTooltipContent.get(e);
|
|
7844
|
-
i || (i = `<strong>${e}</strong><br/>`, n.forEach((e) => {
|
|
7847
|
+
i || (i = `<strong>${this._formatXAxisForTooltip(e)}</strong><br/>`, n.forEach((e) => {
|
|
7845
7848
|
i += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7846
7849
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7847
7850
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -7867,7 +7870,7 @@ var N = class e extends HTMLElement {
|
|
|
7867
7870
|
this._activeXValue = o, this._showPlotPointsForX(o), this._showVerticalLineAtX(o, t);
|
|
7868
7871
|
let c = this._cachedTooltipContent.get(o);
|
|
7869
7872
|
if (!c) {
|
|
7870
|
-
if (c = `<strong>${o}</strong><br/>`, s.forEach((e) => {
|
|
7873
|
+
if (c = `<strong>${this._formatXAxisForTooltip(o)}</strong><br/>`, s.forEach((e) => {
|
|
7871
7874
|
c += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
7872
7875
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
7873
7876
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
@@ -8130,7 +8133,7 @@ var N = class e extends HTMLElement {
|
|
|
8130
8133
|
p++, t.data.forEach((o) => {
|
|
8131
8134
|
let s = this._scaleXForBarChart(o.x, e), c = this._scaleY(o.y, e), l = e.y + e.height - c, d = s + a, f = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
8132
8135
|
f.setAttribute("x", d.toString()), f.setAttribute("y", c.toString()), f.setAttribute("width", u.toString()), f.setAttribute("height", l.toString()), f.setAttribute("fill", i), f.setAttribute("rx", "2"), f.setAttribute("class", "chart-bar"), f.setAttribute("data-dataset", r.toString()), f.setAttribute("data-x", String(o.x)), f.setAttribute("data-y", o.y.toString()), f.setAttribute("data-name", t.name), f.style.cursor = "pointer", this._showTooltip && (f.addEventListener("mouseenter", (e) => {
|
|
8133
|
-
let t = this._getAllDatasetsAtX(o.x), n = `<strong>${o.x}</strong><br/>`;
|
|
8136
|
+
let t = this._getAllDatasetsAtX(o.x), n = `<strong>${this._formatXAxisForTooltip(o.x)}</strong><br/>`;
|
|
8134
8137
|
t.forEach((e) => {
|
|
8135
8138
|
n += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
8136
8139
|
<span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
|
|
@@ -8228,7 +8231,7 @@ var N = class e extends HTMLElement {
|
|
|
8228
8231
|
t !== null && clearTimeout(t);
|
|
8229
8232
|
let n = window.setTimeout(() => {
|
|
8230
8233
|
r = !0, this._pieChartTooltipShown = !0;
|
|
8231
|
-
let o = this._formatValue(l, i), s = `<strong>${e.x}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;
|
|
8234
|
+
let o = this._formatValue(l, i), s = `<strong>${this._formatXAxisForTooltip(e.x)}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;
|
|
8232
8235
|
this._showTooltipAt(a.clientX, a.clientY, s), t = null, this._pieChartTimeouts.delete(n);
|
|
8233
8236
|
}, 150);
|
|
8234
8237
|
t = n, this._pieChartTimeouts.add(n);
|
|
@@ -8243,7 +8246,7 @@ var N = class e extends HTMLElement {
|
|
|
8243
8246
|
}
|
|
8244
8247
|
}), p.addEventListener("click", (a) => {
|
|
8245
8248
|
a.stopPropagation(), t !== null && (clearTimeout(t), t = null), n !== null && (clearTimeout(n), n = null), r = !0, this._pieChartTooltipShown = !0;
|
|
8246
|
-
let o = this._formatValue(l, i), s = `<strong>${e.x}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;
|
|
8249
|
+
let o = this._formatValue(l, i), s = `<strong>${this._formatXAxisForTooltip(e.x)}</strong><br/>${i.name}: ${o}<br/>${u.toFixed(1)}%`;
|
|
8247
8250
|
this._showTooltipAt(a.clientX, a.clientY, s);
|
|
8248
8251
|
});
|
|
8249
8252
|
}
|