plossy 0.4.0 → 0.5.0

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,5 +1,5 @@
1
1
  /*!
2
- * Plossy v0.4.0 | MIT License
2
+ * Plossy v0.5.0 | MIT License
3
3
  *
4
4
  * Includes icons from Lucide (https://lucide.dev), some of them derived from Feather.
5
5
  * Full third-party notices (also shipped as LICENSE-LUCIDE):
@@ -52,6 +52,230 @@ var __defProp = Object.defineProperty;
52
52
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
53
53
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
54
54
 
55
+ // src/js/locale/en.js
56
+ var en_default = {
57
+ // Shared
58
+ close: "Close",
59
+ clear: "Clear",
60
+ previous: "Previous",
61
+ next: "Next",
62
+ loading: "Loading",
63
+ // Combobox
64
+ "combobox.empty": "No results",
65
+ "combobox.loading": "Searching\u2026",
66
+ "combobox.create": "Add",
67
+ "combobox.options": "Options",
68
+ "combobox.remove": "Remove: {label}",
69
+ "combobox.minLength": { one: "Type at least {n} character to search", other: "Type at least {n} characters to search" },
70
+ "combobox.error": "Couldn\u2019t load results",
71
+ // Datepicker
72
+ "datepicker.dialog": "Choose a date",
73
+ "datepicker.prevMonth": "Previous month",
74
+ "datepicker.nextMonth": "Next month",
75
+ "datepicker.prevYear": "Previous year",
76
+ "datepicker.nextYear": "Next year",
77
+ "datepicker.prevYears": "Previous years",
78
+ "datepicker.nextYears": "Next years",
79
+ "datepicker.pickMonth": "Choose a month",
80
+ "datepicker.pickYear": "Choose a year",
81
+ "datepicker.today": "Today",
82
+ "datepicker.clear": "Clear",
83
+ // Countdown (screen reader text)
84
+ "countdown.days": "days",
85
+ "countdown.hours": "hr",
86
+ "countdown.minutes": "min",
87
+ "countdown.seconds": "s",
88
+ // Slider, Slideshow
89
+ "slider.carousel": "carousel",
90
+ "slider.slide": "slide",
91
+ "slider.position": "{n} of {count}",
92
+ "slider.previous": "Previous slide",
93
+ "slider.next": "Next slide",
94
+ "slider.goto": "Slide {n}",
95
+ // Lightbox
96
+ "lightbox.label": "Gallery",
97
+ "lightbox.role": "gallery",
98
+ "lightbox.thumbs": "Thumbnails",
99
+ "lightbox.item": "Item {n}",
100
+ "lightbox.error": "Couldn\u2019t load the content.",
101
+ "lightbox.embed": "Embedded content",
102
+ // Modal (Plossy.modal.alert / confirm / prompt)
103
+ "modal.ok": "OK",
104
+ "modal.cancel": "Cancel",
105
+ "modal.close": "Close",
106
+ // Notification, Offcanvas, To top
107
+ "notification.close": "Close notification",
108
+ "offcanvas.label": "Side panel",
109
+ "totop.label": "Back to top",
110
+ // Quantity, Rating, OTP
111
+ "quantity.label": "Quantity",
112
+ "quantity.minus": "Decrease",
113
+ "quantity.plus": "Increase",
114
+ "rating.label": "Rating",
115
+ "otp.label": "One-time code",
116
+ "otp.char": "Character {n} of {count}",
117
+ // Password toggle, password strength
118
+ "password.show": "Show password",
119
+ "password.hide": "Hide password",
120
+ "strength.levels": "Weak, Fair, Good, Strong",
121
+ "strength.meter": "Password strength",
122
+ "strength.empty": "No password",
123
+ "strength.met": "met",
124
+ "strength.unmet": "not met",
125
+ "strength.rule.length": { one: "At least {n} character", other: "At least {n} characters" },
126
+ "strength.rule.case": "Lowercase and uppercase letter",
127
+ "strength.rule.digit": "At least one digit",
128
+ "strength.rule.symbol": "A special character (e.g. ! @ # ?)",
129
+ // Form validation
130
+ "validation.required": "This field is required.",
131
+ "validation.checkbox": "Check this box to continue.",
132
+ "validation.radio": "Choose one of the options.",
133
+ "validation.file": "Choose a file.",
134
+ "validation.select": "Choose an item from the list.",
135
+ "validation.email": "Enter a valid email address, e.g. jane@example.com.",
136
+ "validation.url": "Enter a valid URL, e.g. https://example.com.",
137
+ "validation.type": "Enter a value in the correct format.",
138
+ "validation.pattern": "Enter a value in the required format.",
139
+ "validation.minlength": { one: "Enter at least {n} character (currently {length}).", other: "Enter at least {n} characters (currently {length})." },
140
+ "validation.maxlength": { one: "Enter at most {n} character (currently {length}).", other: "Enter at most {n} characters (currently {length})." },
141
+ "validation.min": "The value can\u2019t be less than {min}.",
142
+ "validation.max": "The value can\u2019t be greater than {max}.",
143
+ "validation.step": "Enter a value that matches the allowed step.",
144
+ "validation.bad": "Enter a valid value.",
145
+ // Upload
146
+ "upload.choose": "Choose files",
147
+ "upload.type": "The file \u201C{name}\u201D has a format that isn\u2019t allowed.",
148
+ "upload.size": "The file \u201C{name}\u201D is too large ({size}). The maximum size is {max} MB.",
149
+ "upload.count": { one: "You can add at most {n} file.", other: "You can add at most {n} files." },
150
+ "upload.remove": "Remove file {name}",
151
+ "upload.progress": "Upload progress: {name}",
152
+ "upload.uploading": "Uploading\u2026 {percent}%",
153
+ "upload.done": "Uploaded",
154
+ "upload.failed": "Couldn\u2019t upload the file.",
155
+ "upload.failedStatus": "Couldn\u2019t upload the file (error {status}).",
156
+ "upload.failedNetwork": "Couldn\u2019t upload the file \u2014 check your connection.",
157
+ // Sortable (screen reader announcements)
158
+ "sortable.help": "Press space to pick up an item. Use the arrow keys to move it, space or Enter to drop it, and Escape to cancel.",
159
+ "sortable.role": "sortable item",
160
+ "sortable.lifted": "Picked up: {label}. Position {n} of {count}. Use the arrow keys to move, space to drop, Escape to cancel.",
161
+ "sortable.moved": "Position {n} of {count}.",
162
+ "sortable.cancelled": "Cancelled. {label} returns to position {n} of {count}.",
163
+ "sortable.dropped": "Dropped: {label}. Position {n} of {count}."
164
+ };
165
+
166
+ // src/js/locale/pl.js
167
+ var pl_default = {
168
+ close: "Zamknij",
169
+ clear: "Wyczy\u015B\u0107",
170
+ previous: "Poprzedni",
171
+ next: "Nast\u0119pny",
172
+ loading: "Wczytywanie",
173
+ "combobox.empty": "Brak wynik\xF3w",
174
+ "combobox.loading": "Szukam\u2026",
175
+ "combobox.create": "Dodaj",
176
+ "combobox.options": "Opcje",
177
+ "combobox.remove": "Usu\u0144: {label}",
178
+ "combobox.minLength": "Wpisz co najmniej {n} zn., aby wyszuka\u0107",
179
+ "combobox.error": "Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w",
180
+ "datepicker.dialog": "Wybierz dat\u0119",
181
+ "datepicker.prevMonth": "Poprzedni miesi\u0105c",
182
+ "datepicker.nextMonth": "Nast\u0119pny miesi\u0105c",
183
+ "datepicker.prevYear": "Poprzedni rok",
184
+ "datepicker.nextYear": "Nast\u0119pny rok",
185
+ "datepicker.prevYears": "Poprzednie lata",
186
+ "datepicker.nextYears": "Nast\u0119pne lata",
187
+ "datepicker.pickMonth": "Wybierz miesi\u0105c",
188
+ "datepicker.pickYear": "Wybierz rok",
189
+ "datepicker.today": "Dzi\u015B",
190
+ "datepicker.clear": "Wyczy\u015B\u0107",
191
+ "countdown.days": "dni",
192
+ "countdown.hours": "godz.",
193
+ "countdown.minutes": "min",
194
+ "countdown.seconds": "s",
195
+ "slider.carousel": "karuzela",
196
+ "slider.slide": "slajd",
197
+ "slider.position": "{n} z {count}",
198
+ "slider.previous": "Poprzedni slajd",
199
+ "slider.next": "Nast\u0119pny slajd",
200
+ "slider.goto": "Slajd {n}",
201
+ "lightbox.label": "Galeria",
202
+ "lightbox.role": "galeria",
203
+ "lightbox.thumbs": "Miniatury",
204
+ "lightbox.item": "Pozycja {n}",
205
+ "lightbox.error": "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.",
206
+ "lightbox.embed": "Osadzona tre\u015B\u0107",
207
+ "modal.ok": "OK",
208
+ "modal.cancel": "Anuluj",
209
+ "modal.close": "Zamknij",
210
+ "notification.close": "Zamknij powiadomienie",
211
+ "offcanvas.label": "Panel boczny",
212
+ "totop.label": "Wr\xF3\u0107 na g\xF3r\u0119 strony",
213
+ "quantity.label": "Ilo\u015B\u0107",
214
+ "quantity.minus": "Mniej",
215
+ "quantity.plus": "Wi\u0119cej",
216
+ "rating.label": "Ocena",
217
+ "otp.label": "Kod jednorazowy",
218
+ "otp.char": "Znak {n} z {count}",
219
+ "password.show": "Poka\u017C has\u0142o",
220
+ "password.hide": "Ukryj has\u0142o",
221
+ "strength.levels": "S\u0142abe, \u015Arednie, Dobre, Silne",
222
+ "strength.meter": "Si\u0142a has\u0142a",
223
+ "strength.empty": "Brak has\u0142a",
224
+ "strength.met": "spe\u0142nione",
225
+ "strength.unmet": "niespe\u0142nione",
226
+ "strength.rule.length": "Co najmniej {n} znak\xF3w",
227
+ "strength.rule.case": "Ma\u0142a i wielka litera",
228
+ "strength.rule.digit": "Co najmniej jedna cyfra",
229
+ "strength.rule.symbol": "Znak specjalny (np. ! @ # ?)",
230
+ "validation.required": "To pole jest wymagane.",
231
+ "validation.checkbox": "Zaznacz to pole, aby kontynuowa\u0107.",
232
+ "validation.radio": "Wybierz jedn\u0105 z opcji.",
233
+ "validation.file": "Wybierz plik.",
234
+ "validation.select": "Wybierz pozycj\u0119 z listy.",
235
+ "validation.email": "Podaj poprawny adres e-mail, np. jan@example.com.",
236
+ "validation.url": "Podaj poprawny adres URL, np. https://example.com.",
237
+ "validation.type": "Podaj warto\u015B\u0107 w poprawnym formacie.",
238
+ "validation.pattern": "Podaj warto\u015B\u0107 w wymaganym formacie.",
239
+ "validation.minlength": {
240
+ one: "Wpisz co najmniej {n} znak (obecnie {length}).",
241
+ few: "Wpisz co najmniej {n} znaki (obecnie {length}).",
242
+ many: "Wpisz co najmniej {n} znak\xF3w (obecnie {length}).",
243
+ other: "Wpisz co najmniej {n} znaku (obecnie {length})."
244
+ },
245
+ "validation.maxlength": {
246
+ one: "Wpisz najwy\u017Cej {n} znak (obecnie {length}).",
247
+ few: "Wpisz najwy\u017Cej {n} znaki (obecnie {length}).",
248
+ many: "Wpisz najwy\u017Cej {n} znak\xF3w (obecnie {length}).",
249
+ other: "Wpisz najwy\u017Cej {n} znaku (obecnie {length})."
250
+ },
251
+ "validation.min": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C {min}.",
252
+ "validation.max": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C {max}.",
253
+ "validation.step": "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.",
254
+ "validation.bad": "Podaj poprawn\u0105 warto\u015B\u0107.",
255
+ "upload.choose": "Wybierz pliki",
256
+ "upload.type": "Plik \u201E{name}\u201D ma niedozwolony format.",
257
+ "upload.size": "Plik \u201E{name}\u201D jest za du\u017Cy ({size}). Maksymalny rozmiar to {max} MB.",
258
+ "upload.count": {
259
+ one: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik.",
260
+ few: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliki.",
261
+ many: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik\xF3w.",
262
+ other: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliku."
263
+ },
264
+ "upload.remove": "Usu\u0144 plik {name}",
265
+ "upload.progress": "Post\u0119p przesy\u0142ania: {name}",
266
+ "upload.uploading": "Przesy\u0142anie\u2026 {percent}%",
267
+ "upload.done": "Przes\u0142ano",
268
+ "upload.failed": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.",
269
+ "upload.failedStatus": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d {status}).",
270
+ "upload.failedNetwork": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.",
271
+ "sortable.help": "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.",
272
+ "sortable.role": "element sortowalny",
273
+ "sortable.lifted": "Podniesiono: {label}. Pozycja {n} z {count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.",
274
+ "sortable.moved": "Pozycja {n} z {count}.",
275
+ "sortable.cancelled": "Anulowano. {label} wraca na pozycj\u0119 {n} z {count}.",
276
+ "sortable.dropped": "Upuszczono: {label}. Pozycja {n} z {count}."
277
+ };
278
+
55
279
  // src/js/core.js
56
280
  var registry = /* @__PURE__ */ new Map();
57
281
  var store = /* @__PURE__ */ new WeakMap();
@@ -65,8 +289,35 @@ var selector = "";
65
289
  var PERSIST = "data-pl-persist";
66
290
  var config = {
67
291
  /** Niszczy instancje elementów usuniętych z dokumentu. `false` — dawne zachowanie (instancje żyją dalej). */
68
- autoDestroy: true
292
+ autoDestroy: true,
293
+ /** Język tekstów interfejsu (np. 'pl'). `null` — według atrybutu `lang` elementu lub strony, domyślnie angielski. */
294
+ locale: null
69
295
  };
296
+ var locales = { en: en_default, pl: pl_default };
297
+ function langOf(el) {
298
+ if (config.locale) return String(config.locale);
299
+ const owner = el?.closest?.("[lang]") || document.documentElement;
300
+ return owner.getAttribute("lang") || "en";
301
+ }
302
+ function localeOf(el) {
303
+ const tag = langOf(el).toLowerCase();
304
+ if (locales[tag]) return tag;
305
+ const base = tag.split("-")[0];
306
+ return locales[base] ? base : "en";
307
+ }
308
+ function t(key, vars = {}, el = null) {
309
+ const lang = localeOf(el);
310
+ let text = locales[lang][key] ?? locales.en[key] ?? key;
311
+ if (typeof text === "object") {
312
+ const form = new Intl.PluralRules(lang).select(Number(vars.n) || 0);
313
+ text = text[form] ?? text.other;
314
+ }
315
+ return String(text).replace(/\{(\w+)\}/g, (match, name) => name in vars ? String(vars[name]) : match);
316
+ }
317
+ function addLocale(code, messages) {
318
+ const key = String(code).toLowerCase();
319
+ locales[key] = { ...locales[key] || {}, ...messages };
320
+ }
70
321
  var api = {};
71
322
  var $ = (sel, ctx = document) => typeof sel === "string" ? ctx.querySelector(sel) : sel || null;
72
323
  var $$ = (sel, ctx = document) => typeof sel === "string" ? [...ctx.querySelectorAll(sel)] : sel ? sel instanceof Element ? [sel] : [...sel] : [];
@@ -493,6 +744,8 @@ Object.assign(api, {
493
744
  scan,
494
745
  getInstance,
495
746
  config,
747
+ addLocale,
748
+ locales,
496
749
  Component,
497
750
  util: {
498
751
  $,
@@ -500,6 +753,8 @@ Object.assign(api, {
500
753
  uid,
501
754
  clamp,
502
755
  parseOptions,
756
+ t,
757
+ langOf,
503
758
  queryTargets,
504
759
  focusables,
505
760
  animationsDone,
@@ -724,7 +979,6 @@ var UNITS = [
724
979
  ["minutes", 60],
725
980
  ["seconds", 1]
726
981
  ];
727
- var LABELS = { days: "dni", hours: "godz.", minutes: "min", seconds: "s" };
728
982
  var Countdown = class extends Component {
729
983
  init() {
730
984
  this.timer = null;
@@ -759,7 +1013,7 @@ var Countdown = class extends Component {
759
1013
  if (date !== "" && date !== null && date !== void 0) {
760
1014
  const time = typeof date === "number" ? date : Date.parse(date);
761
1015
  if (!Number.isNaN(time)) return time;
762
- console.warn(`[Plossy] countdown: nieprawid\u0142owa data \u201E${date}"`);
1016
+ console.warn(`[Plossy] countdown: invalid date "${date}"`);
763
1017
  }
764
1018
  return Date.now() + Math.max(0, Number(seconds) || 0) * 1e3;
765
1019
  }
@@ -841,7 +1095,7 @@ var Countdown = class extends Component {
841
1095
  }
842
1096
  if (!changed) return;
843
1097
  this.el.style.setProperty("--pl-countdown-progress", this.total ? String(1 - ms / this.total) : "0");
844
- const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${LABELS[unit]}`).join(" ");
1098
+ const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${t(`countdown.${unit}`, {}, this.el)}`).join(" ");
845
1099
  if (key !== this.srKey) {
846
1100
  this.srKey = key;
847
1101
  this.sr.textContent = key;
@@ -1298,7 +1552,7 @@ var Totop = class extends Component {
1298
1552
  const { el } = this;
1299
1553
  this.active = null;
1300
1554
  if (!el.hasAttribute("aria-label") && !el.textContent.trim()) {
1301
- el.setAttribute("aria-label", "Wr\xF3\u0107 na g\xF3r\u0119 strony");
1555
+ el.setAttribute("aria-label", t("totop.label", {}, el));
1302
1556
  }
1303
1557
  if (!el.matches("a[href], button")) {
1304
1558
  if (!el.hasAttribute("role")) el.setAttribute("role", "button");
@@ -1390,14 +1644,14 @@ register("totop", Totop);
1390
1644
  // src/js/components/upload.js
1391
1645
  var svg = (name) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icons_default[name] || ""}</svg>`;
1392
1646
  var escapeHtml = (str) => String(str).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1393
- function formatSize(bytes) {
1647
+ function formatSize(bytes, lang = "en") {
1394
1648
  const units = ["B", "KB", "MB", "GB"];
1395
1649
  let i = 0;
1396
1650
  while (bytes >= 1024 && i < units.length - 1) {
1397
1651
  bytes /= 1024;
1398
1652
  i++;
1399
1653
  }
1400
- return `${bytes.toLocaleString("pl-PL", { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1654
+ return `${bytes.toLocaleString(lang, { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1401
1655
  }
1402
1656
  function typeIcon(file) {
1403
1657
  const type = file.type || "";
@@ -1433,7 +1687,7 @@ var Upload = class extends Component {
1433
1687
  this.input.type = "file";
1434
1688
  this.input.tabIndex = -1;
1435
1689
  this.input.name = options.name;
1436
- this.input.setAttribute("aria-label", "Wybierz pliki");
1690
+ this.input.setAttribute("aria-label", t("upload.choose", {}, el));
1437
1691
  this.input.hidden = true;
1438
1692
  el.append(this.input);
1439
1693
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
@@ -1525,14 +1779,14 @@ var Upload = class extends Component {
1525
1779
  for (const file of files) {
1526
1780
  let error = null;
1527
1781
  if (!matchesAccept(file, options.accept)) {
1528
- error = { type: "type", message: `Plik \u201E${file.name}\u201D ma niedozwolony format.` };
1782
+ error = { type: "type", message: t("upload.type", { name: file.name }, this.el) };
1529
1783
  } else if (options.maxSize && file.size > options.maxSize * 1024 * 1024) {
1530
1784
  error = {
1531
1785
  type: "size",
1532
- message: `Plik \u201E${file.name}\u201D jest za du\u017Cy (${formatSize(file.size)}). Maksymalny rozmiar to ${options.maxSize} MB.`
1786
+ message: t("upload.size", { name: file.name, size: formatSize(file.size, langOf(this.el)), max: options.maxSize }, this.el)
1533
1787
  };
1534
1788
  } else if (options.maxFiles && this.entries.length + accepted.length >= options.maxFiles) {
1535
- error = { type: "count", message: `Mo\u017Cna doda\u0107 najwy\u017Cej ${options.maxFiles} ${plural(options.maxFiles)}.` };
1789
+ error = { type: "count", message: t("upload.count", { n: options.maxFiles }, this.el) };
1536
1790
  }
1537
1791
  if (error) {
1538
1792
  if (error.type !== "count" || !errors.some((other) => other.type === "count")) errors.push({ ...error, file });
@@ -1563,7 +1817,7 @@ var Upload = class extends Component {
1563
1817
  thumb = `<img src="${entry.objectUrl}" alt="">`;
1564
1818
  }
1565
1819
  const name = escapeHtml(file.name);
1566
- item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="Usu\u0144 plik ${name}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Post\u0119p przesy\u0142ania: ${name}"><span class="pl-upload-bar"></span></span>`;
1820
+ item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="${escapeHtml(t("upload.remove", { name: file.name }, this.el))}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="${escapeHtml(t("upload.progress", { name: file.name }, this.el))}"><span class="pl-upload-bar"></span></span>`;
1567
1821
  entry.el = item;
1568
1822
  this.list.append(item);
1569
1823
  this.describe(entry);
@@ -1573,7 +1827,7 @@ var Upload = class extends Component {
1573
1827
  describe(entry, text) {
1574
1828
  const { file } = entry;
1575
1829
  const ext = file.name.includes(".") ? file.name.split(".").pop().toUpperCase() : "";
1576
- const base = [formatSize(file.size), ext].filter(Boolean).join(" \xB7 ");
1830
+ const base = [formatSize(file.size, langOf(this.el)), ext].filter(Boolean).join(" \xB7 ");
1577
1831
  const meta2 = $(".pl-upload-meta", entry.el);
1578
1832
  if (meta2) meta2.textContent = text ? `${text}` : base;
1579
1833
  entry.base = base;
@@ -1593,7 +1847,7 @@ var Upload = class extends Component {
1593
1847
  entry.el.classList.remove("pl-upload-item-error");
1594
1848
  entry.el.style.setProperty("--pl-upload-value", percent / 100);
1595
1849
  $(".pl-upload-progress", entry.el)?.setAttribute("aria-valuenow", percent);
1596
- this.describe(entry, `Przesy\u0142anie\u2026 ${percent}%`);
1850
+ this.describe(entry, t("upload.uploading", { percent }, this.el));
1597
1851
  this.emit("progress", { file: entry.file, percent, ...detail });
1598
1852
  }
1599
1853
  /** Oznacza plik jako przesłany. */
@@ -1606,12 +1860,12 @@ var Upload = class extends Component {
1606
1860
  entry.el.classList.remove("pl-upload-item-uploading", "pl-upload-item-error");
1607
1861
  entry.el.classList.add("pl-upload-item-done");
1608
1862
  this.describe(entry);
1609
- this.describe(entry, `${entry.base} \xB7 Przes\u0142ano`);
1863
+ this.describe(entry, `${entry.base} \xB7 ${t("upload.done", {}, this.el)}`);
1610
1864
  this.emit("complete", { file: entry.file, response, xhr });
1611
1865
  if (this.entries.every((other) => other.status === "done")) this.emit("completeall", { files: this.files });
1612
1866
  }
1613
1867
  /** Oznacza plik jako nieprzesłany. */
1614
- fail(target, message = "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.", xhr = null) {
1868
+ fail(target, message = t("upload.failed", {}, this.el), xhr = null) {
1615
1869
  const entry = this.find(target);
1616
1870
  if (!entry) return;
1617
1871
  entry.status = "error";
@@ -1647,12 +1901,12 @@ var Upload = class extends Component {
1647
1901
  }
1648
1902
  this.complete(entry, response, xhr);
1649
1903
  } else {
1650
- this.fail(entry, `Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d ${xhr.status}).`, xhr);
1904
+ this.fail(entry, t("upload.failedStatus", { status: xhr.status }, this.el), xhr);
1651
1905
  }
1652
1906
  });
1653
1907
  xhr.addEventListener("error", () => {
1654
1908
  entry.xhr = null;
1655
- this.fail(entry, "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.", xhr);
1909
+ this.fail(entry, t("upload.failedNetwork", {}, this.el), xhr);
1656
1910
  });
1657
1911
  if (!this.emit("beforesend", { file: entry.file, xhr, data }, true)) {
1658
1912
  entry.xhr = null;
@@ -1744,12 +1998,6 @@ __publicField(Upload, "defaults", {
1744
1998
  messages: true
1745
1999
  // pokazuj komunikaty błędów pod strefą
1746
2000
  });
1747
- function plural(n) {
1748
- if (n === 1) return "plik";
1749
- const mod10 = n % 10;
1750
- const mod100 = n % 100;
1751
- return mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14) ? "pliki" : "plik\xF3w";
1752
- }
1753
2001
  register("upload", Upload);
1754
2002
 
1755
2003
  // src/js/components/otp.js
@@ -1774,7 +2022,7 @@ var Otp = class extends Component {
1774
2022
  const disabled = this.input.disabled;
1775
2023
  const initial = this.sanitize(this.input.value || "");
1776
2024
  el.setAttribute("role", "group");
1777
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2025
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("otp.label", {}, el));
1778
2026
  this.boxes = [];
1779
2027
  this.generated = [];
1780
2028
  let group = null;
@@ -1802,7 +2050,7 @@ var Otp = class extends Component {
1802
2050
  box.spellcheck = false;
1803
2051
  box.disabled = disabled;
1804
2052
  box.style.setProperty("--pl-otp-index", i);
1805
- box.setAttribute("aria-label", `Znak ${i + 1} z ${length}`);
2053
+ box.setAttribute("aria-label", t("otp.char", { n: i + 1, count: length }, this.el));
1806
2054
  group.append(box);
1807
2055
  this.boxes.push(box);
1808
2056
  }
@@ -1829,20 +2077,20 @@ var Otp = class extends Component {
1829
2077
  const box = event.target;
1830
2078
  if (!box.classList?.contains("pl-otp-box")) return;
1831
2079
  const index = this.boxes.indexOf(box);
1832
- let chars2 = this.sanitize(box.value);
2080
+ let chars = this.sanitize(box.value);
1833
2081
  const prev = this.prev?.[index];
1834
- if (prev && chars2.length === 2) chars2 = chars2.replace(prev, "") || prev;
2082
+ if (prev && chars.length === 2) chars = chars.replace(prev, "") || prev;
1835
2083
  box.value = "";
1836
- if (chars2) this.fill(chars2.length >= this.options.length ? 0 : index, chars2);
2084
+ if (chars) this.fill(chars.length >= this.options.length ? 0 : index, chars);
1837
2085
  else this.update();
1838
2086
  });
1839
2087
  this.on(el, "paste", (event) => {
1840
2088
  const box = event.target;
1841
2089
  if (!box.classList?.contains("pl-otp-box")) return;
1842
2090
  event.preventDefault();
1843
- const chars2 = this.sanitize(event.clipboardData?.getData("text") || "");
1844
- if (!chars2) return this.reject(box);
1845
- this.fill(chars2.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars2);
2091
+ const chars = this.sanitize(event.clipboardData?.getData("text") || "");
2092
+ if (!chars) return this.reject(box);
2093
+ this.fill(chars.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars);
1846
2094
  });
1847
2095
  this.on(el, "keydown", (event) => {
1848
2096
  const box = event.target;
@@ -1914,10 +2162,10 @@ var Otp = class extends Component {
1914
2162
  return this.boxes.every((box) => box.value);
1915
2163
  }
1916
2164
  /** Wpisuje znaki od pozycji `index` i przenosi fokus dalej. */
1917
- fill(index, chars2) {
2165
+ fill(index, chars) {
1918
2166
  index = Math.max(0, index);
1919
2167
  let last = index;
1920
- [...chars2].slice(0, this.boxes.length - index).forEach((char, offset) => {
2168
+ [...chars].slice(0, this.boxes.length - index).forEach((char, offset) => {
1921
2169
  const box = this.boxes[index + offset];
1922
2170
  box.value = char;
1923
2171
  this.pop(box);
@@ -1943,9 +2191,9 @@ var Otp = class extends Component {
1943
2191
  setTimeout(() => box.classList.remove("pl-otp-shake"), 450);
1944
2192
  }
1945
2193
  write(code, silent = false) {
1946
- const chars2 = [...this.sanitize(code)];
2194
+ const chars = [...this.sanitize(code)];
1947
2195
  this.boxes.forEach((box, i) => {
1948
- box.value = chars2[i] || "";
2196
+ box.value = chars[i] || "";
1949
2197
  });
1950
2198
  this.update(silent);
1951
2199
  }
@@ -2034,24 +2282,21 @@ __publicField(Otp, "defaults", {
2034
2282
  autofocus: false,
2035
2283
  submit: false,
2036
2284
  // po wpisaniu całego kodu wysyła formularz
2037
- label: "Kod jednorazowy"
2285
+ label: null
2286
+ // domyślnie z tekstów języka strony
2038
2287
  });
2039
2288
  __publicField(Otp, "primary", "length");
2040
2289
  register("otp", Otp);
2041
2290
 
2042
2291
  // src/js/components/strength.js
2043
- var RULES = {
2044
- length: (min) => `Co najmniej ${min} znak\xF3w`,
2045
- case: () => "Ma\u0142a i wielka litera",
2046
- digit: () => "Co najmniej jedna cyfra",
2047
- symbol: () => "Znak specjalny (np. ! @ # ?)"
2048
- };
2292
+ var RULES = ["length", "case", "digit", "symbol"];
2049
2293
  var Strength = class extends Component {
2050
2294
  init() {
2051
2295
  var _a;
2052
2296
  const { el, options } = this;
2053
2297
  el.classList.add("pl-strength");
2054
2298
  this.input = options.input && $(options.input) || $("input", el);
2299
+ options.labels ?? (options.labels = t("strength.levels", {}, el));
2055
2300
  if (typeof options.labels === "string") options.labels = options.labels.split(",").map((label) => label.trim());
2056
2301
  this.created = [];
2057
2302
  this.score = 0;
@@ -2068,7 +2313,7 @@ var Strength = class extends Component {
2068
2313
  for (let i = 0; i < 4; i++) this.meter.append(this.make("span", "pl-strength-segment"));
2069
2314
  }
2070
2315
  this.meter.setAttribute("role", "meter");
2071
- this.meter.setAttribute("aria-label", "Si\u0142a has\u0142a");
2316
+ this.meter.setAttribute("aria-label", t("strength.meter", {}, el));
2072
2317
  this.meter.setAttribute("aria-valuemin", "0");
2073
2318
  this.meter.setAttribute("aria-valuemax", "4");
2074
2319
  this.labelEl = $(".pl-strength-label", el);
@@ -2085,10 +2330,10 @@ var Strength = class extends Component {
2085
2330
  this.created.push(this.rulesEl);
2086
2331
  }
2087
2332
  if (this.rulesEl && !this.rulesEl.children.length) {
2088
- for (const [rule, text] of Object.entries(RULES)) {
2333
+ for (const rule of RULES) {
2089
2334
  const item = this.make("li", "pl-strength-rule");
2090
2335
  item.dataset.rule = rule;
2091
- item.textContent = text(options.minLength);
2336
+ item.textContent = t(`strength.rule.${rule}`, { n: options.minLength }, el);
2092
2337
  this.rulesEl.append(item);
2093
2338
  }
2094
2339
  }
@@ -2139,13 +2384,13 @@ var Strength = class extends Component {
2139
2384
  this.el.dataset.score = score;
2140
2385
  [...this.meter.children].forEach((segment, i) => segment.classList.toggle("pl-active", i < score));
2141
2386
  this.meter.setAttribute("aria-valuenow", score);
2142
- this.meter.setAttribute("aria-valuetext", label || "Brak has\u0142a");
2387
+ this.meter.setAttribute("aria-valuetext", label || t("strength.empty", {}, this.el));
2143
2388
  if (this.labelEl) this.labelEl.textContent = label;
2144
2389
  if (this.rulesEl) {
2145
2390
  for (const item of this.rulesEl.querySelectorAll("[data-rule]")) {
2146
2391
  const met = !!rules[item.dataset.rule];
2147
2392
  item.classList.toggle("pl-active", met);
2148
- item.setAttribute("aria-label", `${item.textContent} \u2014 ${met ? "spe\u0142nione" : "niespe\u0142nione"}`);
2393
+ item.setAttribute("aria-label", `${item.textContent} \u2014 ${t(met ? "strength.met" : "strength.unmet", {}, this.el)}`);
2149
2394
  }
2150
2395
  }
2151
2396
  const changed = score !== this.score;
@@ -2160,7 +2405,8 @@ __publicField(Strength, "defaults", {
2160
2405
  // lista wymagań odhaczanych na żywo
2161
2406
  label: true,
2162
2407
  // etykieta słowna
2163
- labels: ["S\u0142abe", "\u015Arednie", "Dobre", "Silne"],
2408
+ labels: null,
2409
+ // cztery poziomy; domyślnie z tekstów języka strony
2164
2410
  input: "",
2165
2411
  // selektor pola, gdy leży poza komponentem
2166
2412
  emptyLabel: ""
@@ -2178,7 +2424,7 @@ var Rating = class extends Component {
2178
2424
  el.classList.toggle("pl-rating-readonly", !!options.readonly);
2179
2425
  el.style.setProperty("--pl-rating-max", max);
2180
2426
  el.setAttribute("role", "radiogroup");
2181
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2427
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("rating.label", {}, el));
2182
2428
  const name = options.name || uid("pl-rating");
2183
2429
  const make = (value) => {
2184
2430
  const input = document.createElement("input");
@@ -2270,7 +2516,8 @@ __publicField(Rating, "defaults", {
2270
2516
  readonly: false,
2271
2517
  clearable: true,
2272
2518
  // ponowne kliknięcie wybranej gwiazdki zeruje ocenę
2273
- label: "Ocena",
2519
+ label: null,
2520
+ // domyślnie z tekstów języka strony
2274
2521
  star: "gwiazdka|gwiazdki|gwiazdek"
2275
2522
  // odmiana do etykiet ARIA
2276
2523
  });
@@ -2292,12 +2539,12 @@ var Quantity = class extends Component {
2292
2539
  }
2293
2540
  this.input.classList.add("pl-quantity-input");
2294
2541
  if (!this.input.hasAttribute("inputmode")) this.input.inputMode = "numeric";
2295
- if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", "Ilo\u015B\u0107");
2542
+ if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", t("quantity.label", {}, el));
2296
2543
  const make = (dir) => {
2297
2544
  const button = document.createElement("button");
2298
2545
  button.type = "button";
2299
2546
  button.className = `pl-quantity-button ${dir < 0 ? "pl-quantity-minus" : "pl-quantity-plus"}`;
2300
- button.setAttribute("aria-label", dir < 0 ? options.minusLabel : options.plusLabel);
2547
+ button.setAttribute("aria-label", dir < 0 ? options.minusLabel ?? t("quantity.minus", {}, el) : options.plusLabel ?? t("quantity.plus", {}, el));
2301
2548
  button.tabIndex = -1;
2302
2549
  this.on(button, "pointerdown", (event) => {
2303
2550
  if (event.button) return;
@@ -2413,8 +2660,9 @@ __publicField(Quantity, "defaults", {
2413
2660
  step: null,
2414
2661
  repeat: true,
2415
2662
  // przytrzymanie przycisku powtarza zmianę
2416
- minusLabel: "Mniej",
2417
- plusLabel: "Wi\u0119cej"
2663
+ minusLabel: null,
2664
+ // domyślnie z tekstów języka strony
2665
+ plusLabel: null
2418
2666
  });
2419
2667
  register("quantity", Quantity);
2420
2668
 
@@ -2432,6 +2680,9 @@ function normalize(list) {
2432
2680
  var Combobox = class extends Component {
2433
2681
  init() {
2434
2682
  const { el, options } = this;
2683
+ options.emptyText ?? (options.emptyText = t("combobox.empty", {}, el));
2684
+ options.loadingText ?? (options.loadingText = t("combobox.loading", {}, el));
2685
+ options.createText ?? (options.createText = t("combobox.create", {}, el));
2435
2686
  this.isSelect = el.tagName === "SELECT";
2436
2687
  this.multiple = this.isSelect && el.multiple;
2437
2688
  this.isOpen = false;
@@ -2504,7 +2755,7 @@ var Combobox = class extends Component {
2504
2755
  this.clearButton.type = "button";
2505
2756
  this.clearButton.className = "pl-combobox-clear";
2506
2757
  this.clearButton.tabIndex = -1;
2507
- this.clearButton.setAttribute("aria-label", "Wyczy\u015B\u0107");
2758
+ this.clearButton.setAttribute("aria-label", t("clear", {}, el));
2508
2759
  this.clearButton.innerHTML = svg2("x");
2509
2760
  this.clearButton.hidden = true;
2510
2761
  if (options.clearable) control.append(this.clearButton);
@@ -2519,7 +2770,7 @@ var Combobox = class extends Component {
2519
2770
  list.hidden = true;
2520
2771
  if (this.multiple) list.setAttribute("aria-multiselectable", "true");
2521
2772
  if (input.getAttribute("aria-labelledby")) list.setAttribute("aria-labelledby", input.getAttribute("aria-labelledby"));
2522
- else list.setAttribute("aria-label", this.placeholder || "Opcje");
2773
+ else list.setAttribute("aria-label", this.placeholder || t("combobox.options", {}, el));
2523
2774
  wrapper.append(control, list);
2524
2775
  this.onDestroy(() => {
2525
2776
  this.stopPlace?.();
@@ -2659,7 +2910,7 @@ var Combobox = class extends Component {
2659
2910
  const chip = document.createElement("span");
2660
2911
  chip.className = "pl-combobox-chip";
2661
2912
  chip.dataset.value = item.value;
2662
- chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="Usu\u0144: ${escapeHtml2(item.label)}">${svg2("x")}</button>`;
2913
+ chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="${escapeHtml2(t("combobox.remove", { label: item.label }, this.el))}">${svg2("x")}</button>`;
2663
2914
  control.insertBefore(chip, input);
2664
2915
  }
2665
2916
  chips.forEach((chip) => chip.remove());
@@ -2796,7 +3047,7 @@ var Combobox = class extends Component {
2796
3047
  this.request++;
2797
3048
  this.setLoading(false);
2798
3049
  this.items = this.isSelect ? [...this.selected] : [];
2799
- this.renderList(options.minLength > 0 ? `Wpisz co najmniej ${options.minLength} zn., aby wyszuka\u0107` : options.emptyText);
3050
+ this.renderList(options.minLength > 0 ? t("combobox.minLength", { n: options.minLength }, this.el) : options.emptyText);
2800
3051
  return;
2801
3052
  }
2802
3053
  this.setLoading(true);
@@ -2821,7 +3072,7 @@ var Combobox = class extends Component {
2821
3072
  } catch (error) {
2822
3073
  if (signal.aborted || token2 !== this.request) return;
2823
3074
  this.setLoading(false);
2824
- this.renderMessage("Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w");
3075
+ this.renderMessage(t("combobox.error", {}, this.el));
2825
3076
  this.emit("error", { error });
2826
3077
  }
2827
3078
  }
@@ -3102,9 +3353,10 @@ __publicField(Combobox, "defaults", {
3102
3353
  // opóźnienie zapytań `source` (ms)
3103
3354
  placement: "bottom-start",
3104
3355
  offset: 6,
3105
- emptyText: "Brak wynik\xF3w",
3106
- loadingText: "Szukam\u2026",
3107
- createText: "Dodaj"
3356
+ emptyText: null,
3357
+ // domyślnie z tekstów języka strony
3358
+ loadingText: null,
3359
+ createText: null
3108
3360
  });
3109
3361
  register("combobox", Combobox);
3110
3362
 
@@ -3135,26 +3387,16 @@ function toDate(value) {
3135
3387
  return date.getMonth() === Number(match[2]) - 1 ? date : null;
3136
3388
  }
3137
3389
  var TOKENS = /yyyy|yy|MMMM|MMM|MM|M|dd|d/g;
3138
- var LABELS2 = {
3139
- dialog: "Wybierz dat\u0119",
3140
- prevMonth: "Poprzedni miesi\u0105c",
3141
- nextMonth: "Nast\u0119pny miesi\u0105c",
3142
- prevYear: "Poprzedni rok",
3143
- nextYear: "Nast\u0119pny rok",
3144
- prevYears: "Poprzednie lata",
3145
- nextYears: "Nast\u0119pne lata",
3146
- pickMonth: "Wybierz miesi\u0105c",
3147
- pickYear: "Wybierz rok",
3148
- today: "Dzi\u015B",
3149
- clear: "Wyczy\u015B\u0107"
3150
- };
3390
+ var LABEL_KEYS = ["dialog", "prevMonth", "nextMonth", "prevYear", "nextYear", "prevYears", "nextYears", "pickMonth", "pickYear", "today", "clear"];
3151
3391
  var Datepicker = class extends Component {
3152
3392
  init() {
3153
3393
  const { el, options } = this;
3154
3394
  this.isInput = el.tagName === "INPUT";
3155
3395
  this.inline = !!options.inline || !this.isInput;
3156
3396
  this.input = this.isInput ? el : null;
3157
- this.labels = { ...LABELS2, ...options.labels || {} };
3397
+ options.locale ?? (options.locale = langOf(el));
3398
+ const defaults = Object.fromEntries(LABEL_KEYS.map((key) => [key, t(`datepicker.${key}`, {}, el)]));
3399
+ this.labels = { ...defaults, ...options.labels || {} };
3158
3400
  this.isOpen = false;
3159
3401
  this.view = "days";
3160
3402
  this.start = null;
@@ -3215,7 +3457,7 @@ var Datepicker = class extends Component {
3215
3457
  try {
3216
3458
  return new Intl.DateTimeFormat(options.locale, opts);
3217
3459
  } catch {
3218
- return new Intl.DateTimeFormat("pl", opts);
3460
+ return new Intl.DateTimeFormat("en", opts);
3219
3461
  }
3220
3462
  };
3221
3463
  this.fmt = {
@@ -3801,7 +4043,8 @@ __publicField(Datepicker, "defaults", {
3801
4043
  // dni tygodnia: 0 = niedziela … 6 = sobota, np. "0,6"
3802
4044
  disabledDates: "",
3803
4045
  // konkretne daty ISO rozdzielone przecinkami
3804
- locale: "pl",
4046
+ locale: null,
4047
+ // domyślnie język strony (atrybut lang)
3805
4048
  format: "dd.MM.yyyy",
3806
4049
  separator: " \u2013 ",
3807
4050
  // łącznik dat zakresu
@@ -3820,7 +4063,6 @@ __publicField(Datepicker, "defaults", {
3820
4063
  register("datepicker", Datepicker);
3821
4064
 
3822
4065
  // src/js/components/range.js
3823
- var numberFormat = typeof Intl !== "undefined" ? new Intl.NumberFormat("pl-PL", { maximumFractionDigits: 6 }) : null;
3824
4066
  var Range = class extends Component {
3825
4067
  init() {
3826
4068
  const { el, options } = this;
@@ -3928,7 +4170,8 @@ var Range = class extends Component {
3928
4170
  return max > min ? clamp((Number(input.value) - min) / (max - min), 0, 1) : 0;
3929
4171
  }
3930
4172
  format(value) {
3931
- const text = numberFormat ? numberFormat.format(value) : String(value);
4173
+ this.numberFormat ?? (this.numberFormat = new Intl.NumberFormat(langOf(this.el), { maximumFractionDigits: 6 }));
4174
+ const text = this.numberFormat.format(value);
3932
4175
  return `${this.options.prefix}${text}${this.options.suffix}`;
3933
4176
  }
3934
4177
  /** Wartość (liczba) albo para [od, do] w trybie dual. */
@@ -4143,7 +4386,7 @@ var PasswordToggle = class extends Component {
4143
4386
  const { el, options } = this;
4144
4387
  const visible = this.visible;
4145
4388
  el.setAttribute("aria-pressed", String(visible));
4146
- el.setAttribute("aria-label", visible ? options.labelHide : options.labelShow);
4389
+ el.setAttribute("aria-label", visible ? options.labelHide ?? t("password.hide", {}, el) : options.labelShow ?? t("password.show", {}, el));
4147
4390
  el.classList.toggle("pl-active", visible);
4148
4391
  const icon = el.matches("[data-pl-icon]") ? el : $("[data-pl-icon]", el);
4149
4392
  if (icon) {
@@ -4174,8 +4417,9 @@ __publicField(PasswordToggle, "defaults", {
4174
4417
  // selektor pola; domyślnie pole hasła w tym samym opakowaniu
4175
4418
  iconShow: "eye",
4176
4419
  iconHide: "eye-off",
4177
- labelShow: "Poka\u017C has\u0142o",
4178
- labelHide: "Ukryj has\u0142o"
4420
+ labelShow: null,
4421
+ // domyślnie z tekstów języka strony
4422
+ labelHide: null
4179
4423
  });
4180
4424
  __publicField(PasswordToggle, "primary", "target");
4181
4425
  register("password-toggle", PasswordToggle);
@@ -4231,7 +4475,7 @@ var FormClear = class extends Component {
4231
4475
  init() {
4232
4476
  const { el } = this;
4233
4477
  if (el.matches("button") && !el.hasAttribute("type")) el.type = "button";
4234
- if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", "Wyczy\u015B\u0107");
4478
+ if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", t("clear", {}, el));
4235
4479
  this.on(el, "click", (event) => {
4236
4480
  event.preventDefault();
4237
4481
  this.clear();
@@ -4251,38 +4495,31 @@ var FormClear = class extends Component {
4251
4495
  __publicField(FormClear, "defaults", { target: "" });
4252
4496
  __publicField(FormClear, "primary", "target");
4253
4497
  register("form-clear", FormClear);
4254
- var plural2 = (n, one, few, many) => {
4255
- const mod10 = n % 10;
4256
- const mod100 = n % 100;
4257
- if (n === 1) return one;
4258
- if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return few;
4259
- return many;
4260
- };
4261
- var chars = (n) => `${n} ${plural2(n, "znak", "znaki", "znak\xF3w")}`;
4262
4498
  function messageFor(field) {
4263
4499
  const v = field.validity;
4264
4500
  const custom = (key) => field.getAttribute(`data-pl-message-${key}`);
4501
+ const text = (key, vars) => t(`validation.${key}`, vars, field);
4265
4502
  if (v.valueMissing) {
4266
4503
  if (custom("required")) return custom("required");
4267
- if (field.type === "checkbox") return "Zaznacz to pole, aby kontynuowa\u0107.";
4268
- if (field.type === "radio") return "Wybierz jedn\u0105 z opcji.";
4269
- if (field.type === "file") return "Wybierz plik.";
4270
- if (field.matches("select")) return "Wybierz pozycj\u0119 z listy.";
4271
- return "To pole jest wymagane.";
4504
+ if (field.type === "checkbox") return text("checkbox");
4505
+ if (field.type === "radio") return text("radio");
4506
+ if (field.type === "file") return text("file");
4507
+ if (field.matches("select")) return text("select");
4508
+ return text("required");
4272
4509
  }
4273
4510
  if (v.typeMismatch) {
4274
4511
  if (custom("type")) return custom("type");
4275
- if (field.type === "email") return "Podaj poprawny adres e-mail, np. jan@example.com.";
4276
- if (field.type === "url") return "Podaj poprawny adres URL, np. https://example.com.";
4277
- return "Podaj warto\u015B\u0107 w poprawnym formacie.";
4278
- }
4279
- if (v.patternMismatch) return custom("pattern") || field.title || "Podaj warto\u015B\u0107 w wymaganym formacie.";
4280
- if (v.tooShort) return custom("minlength") || `Wpisz co najmniej ${chars(field.minLength)} (obecnie ${field.value.length}).`;
4281
- if (v.tooLong) return custom("maxlength") || `Wpisz najwy\u017Cej ${chars(field.maxLength)} (obecnie ${field.value.length}).`;
4282
- if (v.rangeUnderflow) return custom("min") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C ${field.min}.`;
4283
- if (v.rangeOverflow) return custom("max") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C ${field.max}.`;
4284
- if (v.stepMismatch) return custom("step") || "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.";
4285
- if (v.badInput) return custom("type") || "Podaj poprawn\u0105 warto\u015B\u0107.";
4512
+ if (field.type === "email") return text("email");
4513
+ if (field.type === "url") return text("url");
4514
+ return text("type");
4515
+ }
4516
+ if (v.patternMismatch) return custom("pattern") || field.title || text("pattern");
4517
+ if (v.tooShort) return custom("minlength") || text("minlength", { n: field.minLength, length: field.value.length });
4518
+ if (v.tooLong) return custom("maxlength") || text("maxlength", { n: field.maxLength, length: field.value.length });
4519
+ if (v.rangeUnderflow) return custom("min") || text("min", { min: field.min });
4520
+ if (v.rangeOverflow) return custom("max") || text("max", { max: field.max });
4521
+ if (v.stepMismatch) return custom("step") || text("step");
4522
+ if (v.badInput) return custom("type") || text("bad");
4286
4523
  if (v.customError) return field.validationMessage;
4287
4524
  return "";
4288
4525
  }
@@ -5012,7 +5249,7 @@ var Popover = class extends Component {
5012
5249
  const button = document.createElement("button");
5013
5250
  button.type = "button";
5014
5251
  button.className = "pl-close";
5015
- button.setAttribute("aria-label", "Zamknij");
5252
+ button.setAttribute("aria-label", t("close", {}, this.el));
5016
5253
  button.setAttribute("data-pl-popover-close", "");
5017
5254
  return button;
5018
5255
  };
@@ -5358,7 +5595,7 @@ var Modal = class extends Overlay {
5358
5595
  __publicField(Modal, "defaults", { ...Overlay.defaults });
5359
5596
  register("modal", Modal);
5360
5597
  delegateOpen("modal");
5361
- var labels = { ok: "OK", cancel: "Anuluj", close: "Zamknij" };
5598
+ var labels = {};
5362
5599
  var escapeHtml3 = (value) => String(value ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
5363
5600
  function dialog(content, options = {}) {
5364
5601
  const { cls = "", ...rest } = options;
@@ -5383,8 +5620,8 @@ function ask(kind, message, options = {}, value = "") {
5383
5620
  const {
5384
5621
  title = "",
5385
5622
  html = false,
5386
- ok = labels.ok,
5387
- cancel = labels.cancel,
5623
+ ok = labels.ok ?? t("modal.ok"),
5624
+ cancel = labels.cancel ?? t("modal.cancel"),
5388
5625
  tone = "primary",
5389
5626
  cls = "pl-modal-small pl-modal-center",
5390
5627
  placeholder = "",
@@ -5448,7 +5685,7 @@ var Offcanvas = class extends Overlay {
5448
5685
  this.side = side;
5449
5686
  SIDES.forEach((name) => el.classList.toggle(`pl-offcanvas-${name}`, name === side));
5450
5687
  el.classList.toggle("pl-offcanvas-no-overlay", !this.options.overlay);
5451
- if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", "Panel boczny");
5688
+ if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", t("offcanvas.label", {}, el));
5452
5689
  this.on(el, "click", (event) => {
5453
5690
  if (!this.options.anchorClose) return;
5454
5691
  const link = event.target.closest('a[href^="#"]');
@@ -5648,7 +5885,7 @@ var Toast = class {
5648
5885
  const close = document.createElement("button");
5649
5886
  close.type = "button";
5650
5887
  close.className = "pl-close pl-notification-close";
5651
- close.setAttribute("aria-label", "Zamknij powiadomienie");
5888
+ close.setAttribute("aria-label", t("notification.close"));
5652
5889
  close.addEventListener("click", () => this.close());
5653
5890
  el.append(close);
5654
5891
  }
@@ -5916,20 +6153,20 @@ var LightboxPanel = class {
5916
6153
  const el = document.createElement("dialog");
5917
6154
  el.className = `pl-lightbox pl-lightbox-${animation === "fade" ? "fade" : "slide"}`;
5918
6155
  el.dataset.plTheme = "dark";
5919
- el.setAttribute("aria-label", "Galeria");
5920
- el.setAttribute("aria-roledescription", "galeria");
6156
+ el.setAttribute("aria-label", t("lightbox.label", {}, el));
6157
+ el.setAttribute("aria-roledescription", t("lightbox.role", {}, el));
5921
6158
  el.innerHTML = `
5922
6159
  <div class="pl-lightbox-backdrop"></div>
5923
6160
  <div class="pl-lightbox-toolbar">
5924
6161
  ${counter && many ? '<span class="pl-lightbox-counter" aria-live="polite"></span>' : ""}
5925
- <button class="pl-close pl-lightbox-close" type="button" aria-label="Zamknij"></button>
6162
+ <button class="pl-close pl-lightbox-close" type="button" aria-label="${t("close", {}, el)}"></button>
5926
6163
  </div>
5927
6164
  <div class="pl-lightbox-stage"></div>
5928
- ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="Poprzedni">${ICONS2.previous}</button>
5929
- <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="Nast\u0119pny">${ICONS2.next}</button>` : ""}
6165
+ ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="${t("previous", {}, el)}">${ICONS2.previous}</button>
6166
+ <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="${t("next", {}, el)}">${ICONS2.next}</button>` : ""}
5930
6167
  <div class="pl-lightbox-footer">
5931
6168
  <div class="pl-lightbox-caption"></div>
5932
- ${thumbs && many ? '<div class="pl-lightbox-thumbs" role="tablist" aria-label="Miniatury"></div>' : ""}
6169
+ ${thumbs && many ? `<div class="pl-lightbox-thumbs" role="tablist" aria-label="${t("lightbox.thumbs", {}, el)}"></div>` : ""}
5933
6170
  </div>`;
5934
6171
  this.el = el;
5935
6172
  this.stage = el.querySelector(".pl-lightbox-stage");
@@ -5944,7 +6181,7 @@ var LightboxPanel = class {
5944
6181
  button.type = "button";
5945
6182
  button.className = "pl-lightbox-thumb";
5946
6183
  button.setAttribute("role", "tab");
5947
- button.setAttribute("aria-label", `Pozycja ${i + 1}${item.caption ? `: ${item.caption}` : ""}`);
6184
+ button.setAttribute("aria-label", `${t("lightbox.item", { n: i + 1 }, this.el)}${item.caption ? `: ${item.caption}` : ""}`);
5948
6185
  const src = item.thumb || (item.type === "image" ? item.source : "");
5949
6186
  if (src) {
5950
6187
  const img = document.createElement("img");
@@ -6054,7 +6291,7 @@ var LightboxPanel = class {
6054
6291
  const spinner = document.createElement("div");
6055
6292
  spinner.className = "pl-lightbox-spinner";
6056
6293
  spinner.setAttribute("role", "status");
6057
- spinner.setAttribute("aria-label", "Wczytywanie");
6294
+ spinner.setAttribute("aria-label", t("loading", {}, this.el));
6058
6295
  const done = () => {
6059
6296
  wrap.classList.remove("pl-loading");
6060
6297
  spinner.remove();
@@ -6063,7 +6300,7 @@ var LightboxPanel = class {
6063
6300
  done();
6064
6301
  const error = document.createElement("div");
6065
6302
  error.className = "pl-lightbox-error";
6066
- error.textContent = "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.";
6303
+ error.textContent = t("lightbox.error", {}, this.el);
6067
6304
  wrap.querySelector(".pl-lightbox-media")?.replaceWith(error);
6068
6305
  };
6069
6306
  let media;
@@ -6080,7 +6317,7 @@ var LightboxPanel = class {
6080
6317
  media = document.createElement("iframe");
6081
6318
  media.allow = "autoplay; fullscreen; picture-in-picture; encrypted-media";
6082
6319
  media.allowFullscreen = true;
6083
- media.title = item.caption || "Osadzona tre\u015B\u0107";
6320
+ media.title = item.caption || t("lightbox.embed", {}, this.el);
6084
6321
  media.addEventListener("load", done, { once: true });
6085
6322
  media.src = embedUrl(item.source);
6086
6323
  } else {
@@ -6871,12 +7108,12 @@ register("switcher", Switcher);
6871
7108
 
6872
7109
  // src/js/components/scroll.js
6873
7110
  var EASINGS = {
6874
- linear: (t) => t,
6875
- "ease-in": (t) => t * t * t,
6876
- "ease-out": (t) => 1 - (1 - t) ** 4,
6877
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2,
7111
+ linear: (t2) => t2,
7112
+ "ease-in": (t2) => t2 * t2 * t2,
7113
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
7114
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2,
6878
7115
  // Lekkie przestrzelenie i powrót.
6879
- spring: (t) => 1 + 2.2 * (t - 1) ** 3 + 1.2 * (t - 1) ** 2
7116
+ spring: (t2) => 1 + 2.2 * (t2 - 1) ** 3 + 1.2 * (t2 - 1) ** 2
6880
7117
  };
6881
7118
  var running = /* @__PURE__ */ new WeakMap();
6882
7119
  function scrollParent(el) {
@@ -6930,9 +7167,9 @@ function scrollTo(target, options = {}) {
6930
7167
  finish(false);
6931
7168
  };
6932
7169
  const step = (now) => {
6933
- const t = clamp((now - startTime) / time, 0, 1);
6934
- container.scrollTop = start2 + distance * ease(t);
6935
- if (t < 1) frame = requestAnimationFrame(step);
7170
+ const t2 = clamp((now - startTime) / time, 0, 1);
7171
+ container.scrollTop = start2 + distance * ease(t2);
7172
+ if (t2 < 1) frame = requestAnimationFrame(step);
6936
7173
  else {
6937
7174
  container.scrollTop = end;
6938
7175
  finish(true);
@@ -7725,9 +7962,9 @@ function rubber(distance, dimension, factor = 0.55) {
7725
7962
  function velocityTracker() {
7726
7963
  let samples = [];
7727
7964
  return {
7728
- add(x, t) {
7729
- samples.push({ x, t });
7730
- while (samples.length > 2 && t - samples[0].t > 100) samples.shift();
7965
+ add(x, t2) {
7966
+ samples.push({ x, t: t2 });
7967
+ while (samples.length > 2 && t2 - samples[0].t > 100) samples.shift();
7731
7968
  },
7732
7969
  get(now) {
7733
7970
  if (samples.length < 2) return 0;
@@ -7756,11 +7993,11 @@ var Carousel = class extends Component {
7756
7993
  this._timer = 0;
7757
7994
  this._remaining = 0;
7758
7995
  this._startedAt = 0;
7759
- const L = this.constructor.labels;
7996
+ const carousel = t("slider.carousel", {}, el);
7760
7997
  if (!el.hasAttribute("role")) el.setAttribute("role", "region");
7761
- el.setAttribute("aria-roledescription", L.carousel);
7998
+ el.setAttribute("aria-roledescription", carousel);
7762
7999
  if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) {
7763
- el.setAttribute("aria-label", L.carousel[0].toUpperCase() + L.carousel.slice(1));
8000
+ el.setAttribute("aria-label", carousel[0].toUpperCase() + carousel.slice(1));
7764
8001
  }
7765
8002
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
7766
8003
  (_a = this.list).id || (_a.id = uid(`pl-${p}`));
@@ -7820,20 +8057,19 @@ var Carousel = class extends Component {
7820
8057
  }
7821
8058
  /** Opisuje slajdy dla czytników ekranu. */
7822
8059
  labelSlides() {
7823
- const L = this.constructor.labels;
7824
8060
  const slides = this.slides;
8061
+ const role = t("slider.slide", {}, this.el);
7825
8062
  slides.forEach((slide, i) => {
7826
8063
  if (!slide.matches("li")) slide.setAttribute("role", "group");
7827
- slide.setAttribute("aria-roledescription", L.slide);
8064
+ slide.setAttribute("aria-roledescription", role);
7828
8065
  if (slide.hasAttribute("aria-label") && !slide.dataset.plAuto) return;
7829
8066
  slide.dataset.plAuto = "1";
7830
- slide.setAttribute("aria-label", `${i + 1} ${L.of} ${slides.length}`);
8067
+ slide.setAttribute("aria-label", t("slider.position", { n: i + 1, count: slides.length }, this.el));
7831
8068
  });
7832
8069
  }
7833
8070
  /** Buduje kropki w pustych `.pl-{p}-nav` i numeruje pozycje własnych nawigacji. */
7834
8071
  buildNav() {
7835
8072
  const p = this.constructor.prefix;
7836
- const L = this.constructor.labels;
7837
8073
  const indexes = this.navIndexes();
7838
8074
  for (const nav of $$(`.pl-${p}-nav`, this.el)) {
7839
8075
  if (!this.owns(nav)) continue;
@@ -7841,7 +8077,7 @@ var Carousel = class extends Component {
7841
8077
  this.generatedNavs.add(nav);
7842
8078
  const current2 = [...nav.children].map((li) => li.getAttribute(this.attr)).join();
7843
8079
  if (current2 !== indexes.join()) {
7844
- nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${L.goto} ${i + 1}"></a></li>`).join("");
8080
+ nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${t("slider.goto", { n: i + 1 }, this.el)}"></a></li>`).join("");
7845
8081
  }
7846
8082
  } else {
7847
8083
  [...nav.children].forEach((item, i) => {
@@ -7944,14 +8180,6 @@ var Carousel = class extends Component {
7944
8180
  }
7945
8181
  };
7946
8182
  __publicField(Carousel, "prefix", "slider");
7947
- __publicField(Carousel, "labels", {
7948
- carousel: "karuzela",
7949
- slide: "slajd",
7950
- of: "z",
7951
- previous: "Poprzedni slajd",
7952
- next: "Nast\u0119pny slajd",
7953
- goto: "Slajd"
7954
- });
7955
8183
  var Slider = class extends Carousel {
7956
8184
  init() {
7957
8185
  if (!this.setup()) return;
@@ -8651,7 +8879,7 @@ function a11yNodes() {
8651
8879
  helpText = document.createElement("div");
8652
8880
  helpText.id = "pl-sortable-help";
8653
8881
  helpText.hidden = true;
8654
- helpText.textContent = "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.";
8882
+ helpText.textContent = t("sortable.help");
8655
8883
  liveRegion = document.createElement("div");
8656
8884
  liveRegion.setAttribute("aria-live", "assertive");
8657
8885
  liveRegion.setAttribute("aria-atomic", "true");
@@ -8745,7 +8973,7 @@ var Sortable = class extends Component {
8745
8973
  if (!item.dataset.plSortableTab && item.hasAttribute("tabindex")) continue;
8746
8974
  item.dataset.plSortableTab = item === current2 ? "0" : "-1";
8747
8975
  item.tabIndex = item === current2 ? 0 : -1;
8748
- item.setAttribute("aria-roledescription", "element sortowalny");
8976
+ item.setAttribute("aria-roledescription", t("sortable.role", {}, this.el));
8749
8977
  item.setAttribute("aria-describedby", help.id);
8750
8978
  }
8751
8979
  }
@@ -8883,22 +9111,22 @@ var Sortable = class extends Component {
8883
9111
  return;
8884
9112
  }
8885
9113
  if (animating.has(target)) return;
8886
- const t = target.getBoundingClientRect();
9114
+ const t2 = target.getBoundingClientRect();
8887
9115
  const r = item.getBoundingClientRect();
8888
9116
  let before;
8889
9117
  if (item.parentElement === sortable.el) {
8890
9118
  before = Boolean(item.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_PRECEDING);
8891
- const sameRow = t.top < r.bottom - 1 && t.bottom > r.top + 1;
8892
- if (sameRow && t.width > r.width + 1) {
8893
- if (before ? s.x > t.left + r.width : s.x < t.right - r.width) return;
8894
- } else if (!sameRow && t.height > r.height + 1) {
8895
- if (before ? s.y > t.top + r.height : s.y < t.bottom - r.height) return;
9119
+ const sameRow = t2.top < r.bottom - 1 && t2.bottom > r.top + 1;
9120
+ if (sameRow && t2.width > r.width + 1) {
9121
+ if (before ? s.x > t2.left + r.width : s.x < t2.right - r.width) return;
9122
+ } else if (!sameRow && t2.height > r.height + 1) {
9123
+ if (before ? s.y > t2.top + r.height : s.y < t2.bottom - r.height) return;
8896
9124
  }
8897
9125
  } else {
8898
9126
  const sibling = target.nextElementSibling || target.previousElementSibling;
8899
9127
  const sr = sibling?.getBoundingClientRect();
8900
- const horizontal = sr ? sr.top < t.bottom - 1 && sr.bottom > t.top + 1 : false;
8901
- before = horizontal ? s.x < t.left + t.width / 2 : s.y < t.top + t.height / 2;
9128
+ const horizontal = sr ? sr.top < t2.bottom - 1 && sr.bottom > t2.top + 1 : false;
9129
+ before = horizontal ? s.x < t2.left + t2.width / 2 : s.y < t2.top + t2.height / 2;
8902
9130
  }
8903
9131
  this.insert(sortable, before ? target : target.nextElementSibling);
8904
9132
  }
@@ -9029,7 +9257,7 @@ var Sortable = class extends Component {
9029
9257
  if (!this.emit("start", { item, index, from: index }, true)) return;
9030
9258
  this.kb = { item, next: item.nextElementSibling, index };
9031
9259
  item.classList.add("pl-sortable-grabbed");
9032
- announce(`Podniesiono: ${this.label(item)}. Pozycja ${index + 1} z ${count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.`);
9260
+ announce(t("sortable.lifted", { label: this.label(item), n: index + 1, count }, this.el));
9033
9261
  } else if (arrow || key === "Home" || key === "End") {
9034
9262
  const next = key === "Home" ? this.items[0] : key === "End" ? this.items[count - 1] : this.neighbor(item, key);
9035
9263
  if (next) {
@@ -9049,7 +9277,7 @@ var Sortable = class extends Component {
9049
9277
  item.focus({ preventScroll: true });
9050
9278
  this.kbMoving = false;
9051
9279
  item.scrollIntoView({ block: "nearest", inline: "nearest" });
9052
- announce(`Pozycja ${this.items.indexOf(item) + 1} z ${count}.`);
9280
+ announce(t("sortable.moved", { n: this.items.indexOf(item) + 1, count }, this.el));
9053
9281
  } else if (key === " " || key === "Enter") {
9054
9282
  event.preventDefault();
9055
9283
  this.dropKey();
@@ -9076,7 +9304,7 @@ var Sortable = class extends Component {
9076
9304
  const to = this.items.indexOf(item);
9077
9305
  const count = this.items.length;
9078
9306
  announce(
9079
- cancelled ? `Anulowano. ${this.label(item)} wraca na pozycj\u0119 ${to + 1} z ${count}.` : `Upuszczono: ${this.label(item)}. Pozycja ${to + 1} z ${count}.`
9307
+ cancelled ? t("sortable.cancelled", { label: this.label(item), n: to + 1, count }, this.el) : t("sortable.dropped", { label: this.label(item), n: to + 1, count }, this.el)
9080
9308
  );
9081
9309
  if (to !== k.index) this.emit("moved", { item, from: k.index, to });
9082
9310
  this.emit("stop", { item, from: k.index, to, target: this, cancelled });
@@ -9099,7 +9327,6 @@ register("sortable", Sortable);
9099
9327
  // src/js/components/filter.js
9100
9328
  var EASE3 = "cubic-bezier(0.33, 0.5, 0.2, 1)";
9101
9329
  var CONTROL = "[data-pl-filter-control]";
9102
- var collator = typeof Intl !== "undefined" ? new Intl.Collator("pl", { numeric: true, sensitivity: "base" }) : null;
9103
9330
  function parseControl(control) {
9104
9331
  const raw = control.getAttribute("data-pl-filter-control") || "";
9105
9332
  const parsed = parseOptions(raw, { filter: "", group: "", sort: "", order: "asc" }, "filter");
@@ -9225,7 +9452,8 @@ var Filter = class extends Component {
9225
9452
  const [attribute, order] = this.state.sort;
9226
9453
  let sorted = children;
9227
9454
  if (attribute) {
9228
- const compare = (a, b) => collator ? collator.compare(a, b) : a < b ? -1 : a > b ? 1 : 0;
9455
+ const collator = new Intl.Collator(langOf(this.el), { numeric: true, sensitivity: "base" });
9456
+ const compare = (a, b) => collator.compare(a, b);
9229
9457
  sorted = [...children].sort(
9230
9458
  (a, b) => compare(a.getAttribute(attribute) || "", b.getAttribute(attribute) || "") * (order === "desc" ? -1 : 1)
9231
9459
  );
@@ -9489,9 +9717,9 @@ register("video", Video);
9489
9717
 
9490
9718
  // src/js/components/counter.js
9491
9719
  var EASINGS2 = {
9492
- linear: (t) => t,
9493
- "ease-out": (t) => 1 - (1 - t) ** 4,
9494
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2
9720
+ linear: (t2) => t2,
9721
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
9722
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2
9495
9723
  };
9496
9724
  var Counter = class extends Component {
9497
9725
  init() {
@@ -9500,21 +9728,30 @@ var Counter = class extends Component {
9500
9728
  this.timer = 0;
9501
9729
  this.done = false;
9502
9730
  const text = el.textContent.trim();
9731
+ options.locale ?? (options.locale = langOf(el));
9503
9732
  if (options.to === null || options.to === "") {
9504
- const parsed = parseFloat(text.replace(/[^\d,.-]/g, "").replace(/\.(?=\d{3}(\D|$))/g, "").replace(",", "."));
9733
+ const decimal = (() => {
9734
+ try {
9735
+ return new Intl.NumberFormat(options.locale).format(1.5).replace(/\d/g, "") || ".";
9736
+ } catch {
9737
+ return ".";
9738
+ }
9739
+ })();
9740
+ const digits = text.replace(new RegExp(`[^\\d\\-${decimal === "." ? "\\." : decimal}]`, "g"), "");
9741
+ const parsed = parseFloat(decimal === "." ? digits : digits.replace(decimal, "."));
9505
9742
  this.to = Number.isNaN(parsed) ? 0 : parsed;
9506
9743
  } else {
9507
9744
  this.to = Number(options.to) || 0;
9508
9745
  }
9509
9746
  this.from = Number(options.from) || 0;
9510
9747
  try {
9511
- this.formatter = new Intl.NumberFormat(options.locale || "pl-PL", {
9748
+ this.formatter = new Intl.NumberFormat(options.locale || "en", {
9512
9749
  minimumFractionDigits: options.decimals,
9513
9750
  maximumFractionDigits: options.decimals,
9514
9751
  useGrouping: "always"
9515
9752
  });
9516
9753
  } catch {
9517
- this.formatter = new Intl.NumberFormat("pl-PL", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9754
+ this.formatter = new Intl.NumberFormat("en", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9518
9755
  }
9519
9756
  this.visual = document.createElement("span");
9520
9757
  this.visual.setAttribute("aria-hidden", "true");
@@ -9601,9 +9838,9 @@ var Counter = class extends Component {
9601
9838
  const run = () => {
9602
9839
  const startTime = performance.now();
9603
9840
  const step = (now) => {
9604
- const t = Math.min((now - startTime) / duration, 1);
9605
- if (t < 1) {
9606
- this.render(from + (end - from) * ease(t));
9841
+ const t2 = Math.min((now - startTime) / duration, 1);
9842
+ if (t2 < 1) {
9843
+ this.render(from + (end - from) * ease(t2));
9607
9844
  this.frame = requestAnimationFrame(step);
9608
9845
  } else {
9609
9846
  this.frame = 0;
@@ -9624,12 +9861,13 @@ __publicField(Counter, "defaults", {
9624
9861
  delay: 0,
9625
9862
  decimals: 0,
9626
9863
  separator: null,
9627
- // separator tysięcy; domyślnie wg locale (pl-PL: spacja niełamiąca)
9864
+ // separator tysięcy; domyślnie wg języka (pl: spacja niełamiąca, en: przecinek)
9628
9865
  decimal: null,
9629
- // separator dziesiętny; domyślnie wg locale (pl-PL: przecinek)
9866
+ // separator dziesiętny; domyślnie wg języka (pl: przecinek, en: kropka)
9630
9867
  prefix: "",
9631
9868
  suffix: "",
9632
- locale: "pl-PL",
9869
+ locale: null,
9870
+ // domyślnie język strony (atrybut lang)
9633
9871
  easing: "ease-out",
9634
9872
  // linear | ease-out | ease-in-out
9635
9873
  once: true,
@@ -9818,6 +10056,7 @@ export {
9818
10056
  $,
9819
10057
  $$,
9820
10058
  Component,
10059
+ addLocale,
9821
10060
  animateClass,
9822
10061
  animationsDone,
9823
10062
  api,
@@ -9830,6 +10069,9 @@ export {
9830
10069
  focusables,
9831
10070
  getInstance,
9832
10071
  hideLayer,
10072
+ langOf,
10073
+ localeOf,
10074
+ locales,
9833
10075
  lockScroll,
9834
10076
  parseOptions,
9835
10077
  place,
@@ -9840,6 +10082,7 @@ export {
9840
10082
  scan,
9841
10083
  showLayer,
9842
10084
  start,
10085
+ t,
9843
10086
  toggleHeight,
9844
10087
  uid,
9845
10088
  unlockScroll