diff --git a/sdkjs-plugins/content/datepicker/CHANGELOG.md b/sdkjs-plugins/content/datepicker/CHANGELOG.md
new file mode 100644
index 00000000..2c9a2d06
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Change Log
+
+## 1.0.0
+
+- Initial release.
diff --git a/sdkjs-plugins/content/datepicker/README.md b/sdkjs-plugins/content/datepicker/README.md
new file mode 100644
index 00000000..b2d6c8b1
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/README.md
@@ -0,0 +1,22 @@
+Overview
+Inserting formatted dates into spreadsheet cells with a calendar interface.
+
+Installation
+Install the Insert QR Plugin from the plugin marketplace.
+Usage
+Activate the DatePicker:
+
+Go to the plugin tab.
+Activate the DatePicker plugin in the "Plugins" section
+Select Cells:
+
+Select the cells area where you would like to print the formatted date.
+Select the date:
+
+Click the "Select the date" option to select desired date from the calendar.
+Select the format:
+
+Click the "Select format" option to format the previously selected date.
+Print the date:
+
+Print the formatted date across the selected cell area.
\ No newline at end of file
diff --git a/sdkjs-plugins/content/datepicker/config.json b/sdkjs-plugins/content/datepicker/config.json
new file mode 100644
index 00000000..e10a2ebd
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/config.json
@@ -0,0 +1,112 @@
+{
+ "name": "Date picker",
+ "nameLocale": {
+ "cs": "Výběr data",
+ "de": "Datumsauswahl",
+ "es": "Selector de fecha",
+ "fr": "Sélecteur de date",
+ "it": "Selettore data",
+ "ja": "日付ピッカー",
+ "pt": "Seletor de data",
+ "ru": "Выбор даты",
+ "sq": "Zgjedhësi i datës",
+ "sr": "Избор датума",
+ "sp": "Izbor datuma",
+ "zh": "日期选择器"
+ },
+ "guid": "asc.{409e5493-56ae-45e1-8423-c73c84a06c50}",
+ "version": "1.0.0",
+ "description": "A plugin to insert formatted dates into cells.",
+ "descriptionLocale": {
+ "cs": "Plugin pro vkládání formátovaných dat do buněk.",
+ "de": "Ein Plugin zum Einfügen formatierter Daten in Zellen.",
+ "es": "Un complemento para insertar fechas formateadas en celdas.",
+ "fr": "Un plugin pour insérer des dates formatées dans les cellules.",
+ "it": "Un plugin per inserire date formattate nelle celle.",
+ "ja": "セルにフォーマットされた日付を挿入するプラグイン。",
+ "pt": "Um plugin para inserir datas formatadas em células.",
+ "ru": "Плагин для вставки отформатированных дат в ячейки.",
+ "sq": "Një shtojcë për të futur data të formatuara në qeliza.",
+ "sr": "Додатак за убацивање форматираних датума у ћелије.",
+ "sp": "Dodatak za ubacivanje formatiranih datuma u ćelije.",
+ "zh": "用于在单元格中插入格式化日期的插件。"
+ },
+ "type": "panel",
+ "icons": ["resources/light/icon.png", "resources/light/icon@2x.png"],
+ "variations": [
+ {
+ "description": "Insert formatted dates into spreadsheet cells with a calendar interface.",
+ "descriptionLocale": {
+ "cs": "Vkládejte formátovaná data do buněk tabulky pomocí kalendářního rozhraní.",
+ "de": "Fügen Sie formatierte Daten mit einer Kalender-Oberfläche in Tabellenzellen ein.",
+ "es": "Inserte fechas formateadas en celdas de hojas de cálculo con una interfaz de calendario.",
+ "fr": "Insérez des dates formatées dans les cellules de feuille de calcul avec une interface de calendrier.",
+ "it": "Inserisci date formattate nelle celle del foglio di calcolo con un'interfaccia calendario.",
+ "ja": "カレンダーインターフェースを使用して、スプレッドシートのセルにフォーマットされた日付を挿入します。",
+ "pt-BR": "Insira datas formatadas em células de planilha com uma interface de calendário.",
+ "ru": "Вставляйте отформатированные даты в ячейки электронной таблицы с помощью календарного интерфейса.",
+ "sq": "Futni data të formatuara në qelizat e fletës së llogaritjes me një ndërfaqe kalendari.",
+ "sr": "Убацујте форматиране датуме у ћелије табеле помоћу календарског интерфејса.",
+ "sp": "Ubacujte formatirane datume u ćelije tabele pomoću kalendarskog interfejsa.",
+ "zh": "使用日历界面将格式化日期插入电子表格单元格。"
+ },
+ "url": "index.html",
+ "icons": ["resources/light/icon.png", "resources/light/icon@2x.png"],
+ "icons2": [
+ {
+ "style": "light",
+ "100%": {
+ "normal": "resources/light/icon.svg"
+ },
+ "125%": {
+ "normal": "resources/light/icon@1.25x.svg"
+ },
+ "150%": {
+ "normal": "resources/light/icon@1.5x.svg"
+ },
+ "175%": {
+ "normal": "resources/light/icon@1.75x.svg"
+ },
+ "200%": {
+ "normal": "resources/light/icon@2x.svg"
+ }
+ },
+ {
+ "style": "dark",
+ "100%": {
+ "normal": "resources/dark/icon-dark.svg"
+ },
+ "125%": {
+ "normal": "resources/dark/icon-dark@1.25x.svg"
+ },
+ "150%": {
+ "normal": "resources/dark/icon-dark@1.5x.svg"
+ },
+ "175%": {
+ "normal": "resources/dark/icon-dark@1.75x.svg"
+ },
+ "200%": {
+ "normal": "resources/dark/icon-dark@2x.svg"
+ }
+ }
+ ],
+ "isViewer": false,
+ "EditorsSupport": ["cell"],
+ "isVisual": true,
+ "isModal": false,
+ "isInsideMode": true,
+ "initDataType": "none",
+ "initData": "",
+ "isUpdateOleOnResize": true,
+ "buttons": [],
+ "store": {
+ "screenshots": [
+ "resources/store/screenshot1.png",
+ "resources/store/screenshot2.png",
+ "resources/store/screenshot3.png",
+ "resources/store/screenshot4.png"
+ ]
+ }
+ }
+ ]
+}
diff --git a/sdkjs-plugins/content/datepicker/deploy/datepicker.plugin b/sdkjs-plugins/content/datepicker/deploy/datepicker.plugin
new file mode 100644
index 00000000..ccc0eb0b
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/deploy/datepicker.plugin differ
diff --git a/sdkjs-plugins/content/datepicker/index.html b/sdkjs-plugins/content/datepicker/index.html
new file mode 100644
index 00000000..dc12774c
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/index.html
@@ -0,0 +1,545 @@
+
+
+
+
+ OnlyOffice Date Picker
+
+
+
+
+
+
+
+ Please do not close the plugin panel.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/button/calendar.png b/sdkjs-plugins/content/datepicker/resources/button/calendar.png
new file mode 100644
index 00000000..bb41660a
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/button/calendar.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/button/calendar.svg b/sdkjs-plugins/content/datepicker/resources/button/calendar.svg
new file mode 100644
index 00000000..2eb39c53
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/button/calendar.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.png b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.png
new file mode 100644
index 00000000..4dea0e03
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.svg b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.svg
new file mode 100644
index 00000000..c72d9be8
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.png b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.png
new file mode 100644
index 00000000..1475a31f
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.svg b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.svg
new file mode 100644
index 00000000..ef9ce661
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.25x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.png b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.png
new file mode 100644
index 00000000..f56cec23
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.svg b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.svg
new file mode 100644
index 00000000..0add96e6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.5x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.png b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.png
new file mode 100644
index 00000000..bef9b39f
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.svg b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.svg
new file mode 100644
index 00000000..355f1257
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@1.75x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.png b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.png
new file mode 100644
index 00000000..ed3bd2f0
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.svg b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.svg
new file mode 100644
index 00000000..f19405b9
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/dark/icon-dark@2x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/1.svg b/sdkjs-plugins/content/datepicker/resources/light/1.svg
new file mode 100644
index 00000000..fcb0acb6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/1.svg
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/2.svg b/sdkjs-plugins/content/datepicker/resources/light/2.svg
new file mode 100644
index 00000000..fcb0acb6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/2.svg
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/3.svg b/sdkjs-plugins/content/datepicker/resources/light/3.svg
new file mode 100644
index 00000000..fcb0acb6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/3.svg
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/4.svg b/sdkjs-plugins/content/datepicker/resources/light/4.svg
new file mode 100644
index 00000000..fcb0acb6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/4.svg
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/5.svg b/sdkjs-plugins/content/datepicker/resources/light/5.svg
new file mode 100644
index 00000000..fcb0acb6
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/5.svg
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon.svg b/sdkjs-plugins/content/datepicker/resources/light/icon.svg
new file mode 100644
index 00000000..6c6189ba
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon2.png b/sdkjs-plugins/content/datepicker/resources/light/icon2.png
new file mode 100644
index 00000000..436b9c6f
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/light/icon2.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x.png b/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x.png
new file mode 100644
index 00000000..e22b2b41
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x2.svg b/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x2.svg
new file mode 100644
index 00000000..ef9ce661
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/icon@1.25x2.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.png b/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.png
new file mode 100644
index 00000000..ee183244
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.svg b/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.svg
new file mode 100644
index 00000000..a8ecce25
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/icon@1.5x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x.svg b/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x.svg
new file mode 100644
index 00000000..a1a3b790
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x2.png b/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x2.png
new file mode 100644
index 00000000..682c5517
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/light/icon@1.75x2.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@2x.png b/sdkjs-plugins/content/datepicker/resources/light/icon@2x.png
new file mode 100644
index 00000000..cf919eb9
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/light/icon@2x.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/light/icon@2x.svg b/sdkjs-plugins/content/datepicker/resources/light/icon@2x.svg
new file mode 100644
index 00000000..68ab1f4c
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/resources/light/icon@2x.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/datepicker/resources/store/screenshot1.png b/sdkjs-plugins/content/datepicker/resources/store/screenshot1.png
new file mode 100644
index 00000000..00094b8c
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/store/screenshot1.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/store/screenshot2.png b/sdkjs-plugins/content/datepicker/resources/store/screenshot2.png
new file mode 100644
index 00000000..866a531b
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/store/screenshot2.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/store/screenshot3.png b/sdkjs-plugins/content/datepicker/resources/store/screenshot3.png
new file mode 100644
index 00000000..9b4a3f0f
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/store/screenshot3.png differ
diff --git a/sdkjs-plugins/content/datepicker/resources/store/screenshot4.png b/sdkjs-plugins/content/datepicker/resources/store/screenshot4.png
new file mode 100644
index 00000000..e9d800a9
Binary files /dev/null and b/sdkjs-plugins/content/datepicker/resources/store/screenshot4.png differ
diff --git a/sdkjs-plugins/content/datepicker/scripts/code.js b/sdkjs-plugins/content/datepicker/scripts/code.js
new file mode 100644
index 00000000..d3dceb7d
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/scripts/code.js
@@ -0,0 +1,1022 @@
+// Helper function to translate and clean up English keys
+function tr(key) {
+ if (window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ const translated = window.Asc.plugin.tr(key);
+
+ // If translation returns the same as key (meaning English), clean it up
+ if (translated === key) {
+ // Remove context markers for English display
+ return key.replace(/ \(full\)|\(short\)/g, "");
+ }
+
+ return translated;
+ }
+
+ // Fallback: clean up the key for display
+ return key.replace(/ \(full\)|\(short\)/g, "");
+}
+
+// Helper function to get proper weekday abbreviations
+function getWeekdayAbbreviation(fullWeekdayName, index) {
+ // Check if this looks like Albanian format (starts with "E " followed by another word)
+ if (fullWeekdayName.startsWith("E ") && fullWeekdayName.length > 2) {
+ // Extract the first letter of the second word
+ const secondWord = fullWeekdayName.substring(2).trim();
+ return secondWord.charAt(0).toUpperCase();
+ }
+
+ // For other languages, use the first 2 characters as before
+ return fullWeekdayName.substring(0, 2);
+}
+
+// Custom Calendar Class with Translation Support
+class CustomCalendar {
+ constructor(input, options = {}) {
+ this.input = input;
+ this.calendar = document.getElementById("customCalendar");
+ this.calendarDays = document.getElementById("calendarDays");
+ this.calendarTitle = document.getElementById("monthYearTitle");
+ this.prevBtn = document.getElementById("prevBtn");
+ this.nextBtn = document.getElementById("nextBtn");
+ this.calendarIcon = document.getElementById("calendarIcon");
+ this.monthView = document.getElementById("monthView");
+ this.yearView = document.getElementById("yearView");
+ this.weekdays = document.getElementById("calendarWeekdays");
+
+ this.currentDate = new Date();
+ this.selectedDate = new Date();
+ this.viewYear = this.currentDate.getFullYear();
+ this.viewMonth = this.currentDate.getMonth();
+ this.isOpen = false;
+ this.currentView = "days";
+
+ // Initialize with English names - will be translated on onTranslate
+ this.months = [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May (full)",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December",
+ ];
+
+ this.monthsShort = [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May (short)",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec",
+ ];
+
+ this.weekdays_full = [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday",
+ ];
+
+ this.init();
+ }
+
+ // Method to update translations when language changes
+ updateLocalization() {
+ if (window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ // Update months array with translations using English keys
+ this.months = [
+ tr("January"),
+ tr("February"),
+ tr("March"),
+ tr("April"),
+ tr("May (full)"),
+ tr("June"),
+ tr("July"),
+ tr("August"),
+ tr("September"),
+ tr("October"),
+ tr("November"),
+ tr("December"),
+ ];
+
+ this.monthsShort = [
+ tr("Jan"),
+ tr("Feb"),
+ tr("Mar"),
+ tr("Apr"),
+ tr("May (short)"),
+ tr("Jun"),
+ tr("Jul"),
+ tr("Aug"),
+ tr("Sep"),
+ tr("Oct"),
+ tr("Nov"),
+ tr("Dec"),
+ ];
+
+ this.weekdays_full = [
+ tr("Sunday"),
+ tr("Monday"),
+ tr("Tuesday"),
+ tr("Wednesday"),
+ tr("Thursday"),
+ tr("Friday"),
+ tr("Saturday"),
+ ];
+
+ // Update month view with translated names
+ const monthElements = document.querySelectorAll(".calendar-month");
+ monthElements.forEach((el, index) => {
+ el.textContent = this.monthsShort[index];
+ });
+
+ // Update the calendar display if it's been rendered
+ if (this.calendarTitle) {
+ this.updateTitle();
+ }
+ }
+ }
+
+ init() {
+ this.render();
+ this.bindEvents();
+ this.updateInput();
+ this.setupIcon();
+ this.applyThemeToIcon();
+ }
+
+ applyThemeToIcon() {
+ const body = document.body;
+ const mainContent = document.getElementById("mainContent");
+ const form = document.getElementById("mainForm");
+
+ let backgroundColor = window.getComputedStyle(body).backgroundColor;
+
+ if (
+ !backgroundColor ||
+ backgroundColor === "rgba(0, 0, 0, 0)" ||
+ backgroundColor === "transparent"
+ ) {
+ if (mainContent) {
+ backgroundColor = window.getComputedStyle(mainContent).backgroundColor;
+ }
+ if (
+ (!backgroundColor ||
+ backgroundColor === "rgba(0, 0, 0, 0)" ||
+ backgroundColor === "transparent") &&
+ form
+ ) {
+ backgroundColor = window.getComputedStyle(form).backgroundColor;
+ }
+ }
+
+ let isDark = false;
+
+ if (backgroundColor && backgroundColor.includes("rgb")) {
+ const rgb = backgroundColor.match(/\d+/g);
+ if (rgb && rgb.length >= 3) {
+ const r = parseInt(rgb[0]);
+ const g = parseInt(rgb[1]);
+ const b = parseInt(rgb[2]);
+
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
+ isDark = luminance < 0.5;
+ }
+ }
+
+ if (isDark) {
+ this.calendarIcon.classList.add("dark-theme");
+ this.calendarIcon.classList.remove("light-theme");
+ } else {
+ this.calendarIcon.classList.add("light-theme");
+ this.calendarIcon.classList.remove("dark-theme");
+ }
+ }
+
+ async setupIcon() {
+ try {
+ // Try multiple path resolution strategies
+ const paths = [
+ // Relative to plugin root
+ "./resources/button/calendar.png",
+ "resources/button/calendar.png",
+ // Absolute from plugin base
+ `${window.location.origin}${window.location.pathname
+ .split("/")
+ .slice(0, -1)
+ .join("/")}/resources/button/calendar.png`,
+ ];
+
+ let success = false;
+ for (const imagePath of paths) {
+ success = await testBackgroundImage(this.calendarIcon, imagePath);
+ if (success) {
+ console.log("Icon loaded from:", imagePath);
+ // Set the background image explicitly
+ this.calendarIcon.style.backgroundImage = `url('${imagePath}')`;
+ break;
+ }
+ }
+
+ if (!success) {
+ console.warn("Failed to load calendar icon from all paths");
+ // Fallback: use a unicode calendar symbol
+ this.calendarIcon.textContent = "📅";
+ this.calendarIcon.style.backgroundImage = "none";
+ }
+ } catch (error) {
+ console.error("Error setting up icon:", error);
+ this.calendarIcon.textContent = "📅";
+ }
+ }
+
+ bindEvents() {
+ this.input.addEventListener("click", () => this.toggle());
+ this.calendarIcon.addEventListener("click", () => this.toggle());
+
+ this.prevBtn.addEventListener("click", () => this.handleNavPrev());
+ this.nextBtn.addEventListener("click", () => this.handleNavNext());
+
+ this.calendarTitle.addEventListener("click", () => this.handleTitleClick());
+
+ document.querySelectorAll(".calendar-month").forEach((monthEl) => {
+ monthEl.addEventListener("click", () => {
+ this.viewMonth = parseInt(monthEl.dataset.month);
+ this.showDayView();
+ });
+ });
+
+ document.addEventListener("click", (e) => {
+ if (!this.input.parentNode.contains(e.target)) {
+ this.hide();
+ }
+ });
+
+ this.calendar.addEventListener("click", (e) => {
+ e.stopPropagation();
+ });
+ }
+
+ handleNavPrev() {
+ if (this.currentView === "days") {
+ this.previousMonth();
+ } else if (this.currentView === "months") {
+ this.viewYear--;
+ this.updateTitle();
+ } else if (this.currentView === "years") {
+ this.viewYear -= 12;
+ this.showYearView();
+ }
+ }
+
+ handleNavNext() {
+ if (this.currentView === "days") {
+ this.nextMonth();
+ } else if (this.currentView === "months") {
+ this.viewYear++;
+ this.updateTitle();
+ } else if (this.currentView === "years") {
+ this.viewYear += 12;
+ this.showYearView();
+ }
+ }
+
+ handleTitleClick() {
+ if (this.currentView === "days") {
+ this.showMonthView();
+ } else if (this.currentView === "months") {
+ this.showYearView();
+ } else {
+ this.showDayView();
+ }
+ }
+
+ toggle() {
+ this.isOpen ? this.hide() : this.show();
+ }
+
+ show() {
+ this.calendar.classList.add("show");
+ this.calendarIcon.classList.add("active");
+ this.isOpen = true;
+ this.applyThemeToCalendar();
+ }
+
+ applyThemeToCalendar() {
+ const body = document.body;
+ const mainContent = document.getElementById("mainContent");
+ const form = document.getElementById("mainForm");
+
+ let backgroundColor = window.getComputedStyle(body).backgroundColor;
+
+ if (
+ !backgroundColor ||
+ backgroundColor === "rgba(0, 0, 0, 0)" ||
+ backgroundColor === "transparent"
+ ) {
+ if (mainContent) {
+ backgroundColor = window.getComputedStyle(mainContent).backgroundColor;
+ }
+ if (
+ (!backgroundColor ||
+ backgroundColor === "rgba(0, 0, 0, 0)" ||
+ backgroundColor === "transparent") &&
+ form
+ ) {
+ backgroundColor = window.getComputedStyle(form).backgroundColor;
+ }
+ }
+
+ let isDark = false;
+ let r = 255,
+ g = 255,
+ b = 255;
+
+ if (backgroundColor && backgroundColor.includes("rgb")) {
+ const rgb = backgroundColor.match(/\d+/g);
+ if (rgb && rgb.length >= 3) {
+ r = parseInt(rgb[0]);
+ g = parseInt(rgb[1]);
+ b = parseInt(rgb[2]);
+
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
+ isDark = luminance < 0.5;
+ }
+ }
+
+ let calendarBgColor, calendarTextColor;
+
+ if (isDark) {
+ const darkerR = Math.max(0, r - 15);
+ const darkerG = Math.max(0, g - 15);
+ const darkerB = Math.max(0, b - 15);
+ calendarBgColor = `rgb(${darkerR}, ${darkerG}, ${darkerB})`;
+ calendarTextColor = "#ffffff";
+ } else {
+ const lighterR = Math.min(255, r + 15);
+ const lighterG = Math.min(255, g + 15);
+ const lighterB = Math.min(255, b + 15);
+ calendarBgColor = `rgb(${lighterR}, ${lighterG}, ${lighterB})`;
+ calendarTextColor = "#000000";
+ }
+
+ this.calendar.style.setProperty(
+ "background-color",
+ calendarBgColor,
+ "important"
+ );
+ this.calendar.style.setProperty("color", calendarTextColor, "important");
+
+ if (isDark) {
+ this.calendarIcon.classList.add("dark-theme");
+ this.calendarIcon.classList.remove("light-theme");
+ } else {
+ this.calendarIcon.classList.add("light-theme");
+ this.calendarIcon.classList.remove("dark-theme");
+ }
+
+ const allElements = this.calendar.querySelectorAll("*");
+ allElements.forEach((element) => {
+ if (
+ !element.matches(".calendar-day:nth-child(7n+1)") &&
+ !element.matches(".calendar-day:nth-child(7n)")
+ ) {
+ element.style.setProperty("color", calendarTextColor, "important");
+ }
+ });
+
+ const selectedElements = this.calendar.querySelectorAll(
+ ".calendar-day.selected, .calendar-month.active, .calendar-year.active"
+ );
+ selectedElements.forEach((element) => {
+ if (isDark) {
+ element.style.setProperty("background-color", "#9ca3af", "important");
+ element.style.setProperty("color", "#ffffff", "important");
+ } else {
+ element.style.setProperty("background-color", "#d1d5db", "important");
+ element.style.setProperty("color", "#000000", "important");
+ }
+ });
+ }
+
+ hide() {
+ this.calendar.classList.remove("show");
+ this.calendarIcon.classList.remove("active");
+ this.isOpen = false;
+ this.showDayView();
+ }
+
+ showMonthView() {
+ this.currentView = "months";
+ this.monthView.style.display = "grid";
+ this.yearView.style.display = "none";
+ this.calendarDays.style.display = "none";
+ this.weekdays.style.display = "none";
+
+ document.querySelectorAll(".calendar-month").forEach((el) => {
+ el.classList.remove("active");
+ if (parseInt(el.dataset.month) === this.viewMonth) {
+ el.classList.add("active");
+ }
+ });
+
+ this.updateTitle();
+ }
+
+ showYearView() {
+ this.currentView = "years";
+ this.monthView.style.display = "none";
+ this.yearView.style.display = "grid";
+ this.calendarDays.style.display = "none";
+ this.weekdays.style.display = "none";
+
+ this.generateYears();
+ this.updateTitle();
+ }
+
+ showDayView() {
+ this.currentView = "days";
+ this.monthView.style.display = "none";
+ this.yearView.style.display = "none";
+ this.calendarDays.style.display = "grid";
+ this.weekdays.style.display = "grid";
+
+ this.render();
+ }
+
+ generateYears() {
+ this.yearView.innerHTML = "";
+ const currentYear = this.viewYear;
+ const startYear = currentYear - 6;
+
+ for (let year = startYear; year < startYear + 12; year++) {
+ const yearEl = document.createElement("div");
+ yearEl.className = "calendar-year";
+ yearEl.textContent = year;
+ yearEl.dataset.year = year;
+ if (year === currentYear) yearEl.classList.add("active");
+
+ yearEl.addEventListener("click", () => {
+ this.viewYear = year;
+ this.showMonthView();
+ });
+ this.yearView.appendChild(yearEl);
+ }
+ }
+
+ previousMonth() {
+ this.viewMonth--;
+ if (this.viewMonth < 0) {
+ this.viewMonth = 11;
+ this.viewYear--;
+ }
+ this.render();
+ }
+
+ nextMonth() {
+ this.viewMonth++;
+ if (this.viewMonth > 11) {
+ this.viewMonth = 0;
+ this.viewYear++;
+ }
+ this.render();
+ }
+
+ render() {
+ this.updateTitle();
+ this.calendarDays.innerHTML = "";
+
+ const firstDay = new Date(this.viewYear, this.viewMonth, 1);
+ const startDate = new Date(firstDay);
+ startDate.setDate(startDate.getDate() - firstDay.getDay());
+
+ // 42 days = 6 rows × 7 days (standard calendar grid to show complete weeks)
+ for (let i = 0; i < 42; i++) {
+ const date = new Date(startDate);
+ date.setDate(startDate.getDate() + i);
+
+ const dayEl = document.createElement("div");
+ dayEl.classList.add("calendar-day");
+ dayEl.textContent = date.getDate();
+
+ if (date.getMonth() !== this.viewMonth) {
+ dayEl.classList.add("other-month");
+ }
+
+ if (this.isSameDay(date, this.currentDate)) {
+ dayEl.classList.add("today");
+ }
+
+ if (this.isSameDay(date, this.selectedDate)) {
+ dayEl.classList.add("selected");
+ }
+
+ dayEl.addEventListener("click", () => {
+ this.selectDate(date);
+ });
+
+ this.calendarDays.appendChild(dayEl);
+ }
+ }
+
+ updateTitle() {
+ if (this.currentView === "days") {
+ this.calendarTitle.textContent = `${this.months[this.viewMonth]} ${
+ this.viewYear
+ }`;
+ } else if (this.currentView === "months") {
+ this.calendarTitle.textContent = this.viewYear;
+ } else {
+ const startYear = this.viewYear - 6;
+ this.calendarTitle.textContent = `${startYear}-${startYear + 11}`;
+ }
+ }
+
+ selectDate(date) {
+ this.selectedDate = new Date(date);
+ this.updateInput();
+ this.render();
+ this.hide();
+ this.input.dispatchEvent(new Event("datechange"));
+
+ // Use requestAnimationFrame to apply styles after render
+ requestAnimationFrame(() => {
+ this.applyGreyToSelected();
+ });
+ }
+
+ applyGreyToSelected() {
+ const calendarBg = window.getComputedStyle(this.calendar).backgroundColor;
+ const isDark = this.isBackgroundDark(calendarBg);
+
+ const selectedElements = this.calendar.querySelectorAll(
+ ".calendar-day.selected, .calendar-month.active, .calendar-year.active"
+ );
+ selectedElements.forEach((element) => {
+ if (isDark) {
+ element.style.setProperty("background-color", "#9ca3af", "important");
+ element.style.setProperty("color", "#ffffff", "important");
+ } else {
+ element.style.setProperty("background-color", "#d1d5db", "important");
+ element.style.setProperty("color", "#000000", "important");
+ }
+ });
+ }
+
+ isBackgroundDark(backgroundColor) {
+ if (backgroundColor && backgroundColor.includes("rgb")) {
+ const rgb = backgroundColor.match(/\d+/g);
+ if (rgb && rgb.length >= 3) {
+ const r = parseInt(rgb[0]);
+ const g = parseInt(rgb[1]);
+ const b = parseInt(rgb[2]);
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
+ return luminance < 0.5;
+ }
+ }
+ return false;
+ }
+
+ updateInput() {
+ const formatSelect = document.getElementById("dateFormat");
+ this.input.value = this.formatDate(this.selectedDate, formatSelect.value);
+ }
+
+ getDate() {
+ return this.selectedDate;
+ }
+
+ setDate(date) {
+ this.selectedDate = new Date(date);
+ this.viewYear = date.getFullYear();
+ this.viewMonth = date.getMonth();
+ this.updateInput();
+ this.render();
+ }
+
+ isSameDay(date1, date2) {
+ return (
+ date1.getDate() === date2.getDate() &&
+ date1.getMonth() === date2.getMonth() &&
+ date1.getFullYear() === date2.getFullYear()
+ );
+ }
+
+ formatDate(date, format) {
+ const day = date.getDate();
+ const dayPadded = String(day).padStart(2, "0");
+ const month = date.getMonth() + 1;
+ const monthPadded = String(month).padStart(2, "0");
+ const year = date.getFullYear();
+ const yearShort = String(year).slice(-2);
+
+ const weekday = this.weekdays_full[date.getDay()];
+ const monthFull = this.months[month - 1];
+ const monthShort = this.monthsShort[month - 1];
+
+ switch (format) {
+ case "MM/DD/YYYY":
+ return `${monthPadded}/${dayPadded}/${year}`;
+ case "dddd, MMMM D, YYYY":
+ return `${weekday}, ${monthFull} ${day}, ${year}`;
+ case "MMMM D, YYYY":
+ return `${monthFull} ${day}, ${year}`;
+ case "M/D/YY":
+ return `${month}/${day}/${yearShort}`;
+ case "YYYY-MM-DD":
+ return `${year}-${monthPadded}-${dayPadded}`;
+ case "D-MMM-YY":
+ return `${dayPadded}-${monthShort}-${yearShort}`;
+ case "M.D.YYYY":
+ return `${month}.${day}.${year}`;
+ default:
+ return `${monthPadded}/${dayPadded}/${year}`;
+ }
+ }
+}
+
+// Global calendar instance
+let globalCalendar = null;
+
+// Background image detection utility
+function testBackgroundImage(element, url) {
+ return new Promise((resolve) => {
+ const testImg = new Image();
+ testImg.onload = () => {
+ element.classList.add("has-bg-image");
+ resolve(true);
+ };
+ testImg.onerror = () => {
+ element.classList.remove("has-bg-image");
+ resolve(false);
+ };
+ testImg.src = url;
+ });
+}
+
+// Initialize plugin
+window.Asc = window.Asc || {};
+window.Asc.plugin = window.Asc.plugin || {};
+window.Asc.scope = window.Asc.scope || {};
+
+window.Asc.plugin.init = function () {
+ if (this.executeMethod) window.pluginAPI = this;
+
+ showLoadingScreen(tr("Initializing plugin..."));
+
+ // Use requestAnimationFrame to ensure loading screen renders before heavy work
+ requestAnimationFrame(() => {
+ initializeDatePicker();
+
+ // Hide loading screen after datepicker renders
+ requestAnimationFrame(() => {
+ hideLoadingScreen();
+ });
+ });
+};
+
+window.Asc.plugin.onTranslate = function () {
+ // Update instruction text
+ const instructionText = document.getElementById("instructionText");
+ if (instructionText) {
+ instructionText.innerHTML = tr(
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell."
+ );
+ }
+
+ // Update labels
+ const selectDateLabel = document.getElementById("selectDateLabel");
+ if (selectDateLabel) {
+ selectDateLabel.innerHTML = tr("Select date");
+ }
+
+ const selectDateFormatLabel = document.getElementById(
+ "selectDateFormatLabel"
+ );
+ if (selectDateFormatLabel) {
+ selectDateFormatLabel.innerHTML = tr("Select date format");
+ }
+
+ // Update button text
+ const insertDateBtn = document.getElementById("insertDate");
+ if (insertDateBtn) {
+ insertDateBtn.innerHTML = tr("Insert date");
+ }
+
+ // Update loading texts
+ const pleaseDoNotClose = document.getElementById("pleaseDoNotClose");
+ if (pleaseDoNotClose) {
+ pleaseDoNotClose.innerHTML = tr(
+ "Please do not close the plugin panel."
+ );
+ }
+
+ const loadingText = document.getElementById("loadingText");
+ if (loadingText) {
+ loadingText.innerHTML = tr("Loading...");
+ }
+
+ // Update input placeholder
+ const dateInput = document.getElementById("dateInput");
+ if (dateInput) {
+ dateInput.placeholder = tr("Select a date");
+ }
+
+ // Update weekday abbreviations in calendar
+ const weekdayElements = document.querySelectorAll("[data-day]");
+ const weekdayKeys = [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday",
+ ];
+
+ weekdayElements.forEach((el, index) => {
+ if (weekdayKeys[index]) {
+ const translated = tr(weekdayKeys[index]);
+ const abbreviation = getWeekdayAbbreviation(translated, index);
+ el.textContent = abbreviation;
+ }
+ });
+
+ // Update calendar instance if it exists
+ if (globalCalendar) {
+ globalCalendar.updateLocalization();
+ globalCalendar.render();
+ }
+};
+
+function showLoadingScreen(message = "Loading...") {
+ const loadingOverlay = document.getElementById("loadingOverlay");
+ const loadingText = document.getElementById("loadingText");
+ if (loadingOverlay && loadingText) {
+ loadingText.textContent = tr(message);
+ loadingOverlay.style.display = "flex";
+ document.getElementById("mainContent").classList.add("loading");
+ }
+}
+
+function hideLoadingScreen() {
+ const loadingOverlay = document.getElementById("loadingOverlay");
+ if (loadingOverlay) {
+ loadingOverlay.style.display = "none";
+ document.getElementById("mainContent").classList.remove("loading");
+ }
+}
+
+// FIXED: Using Asc.scope instead of eval for security and maintainability
+function insertDateValue(formattedDate, selectedDate, selectedFormat) {
+ if (!window.pluginAPI) {
+ console.error("Plugin API not available");
+ throw new Error("Plugin API not available");
+ }
+
+ try {
+ // Convert JavaScript Date to Excel serial number
+ // Excel dates are days since December 30, 1899
+ const excelEpoch = new Date(1899, 11, 30);
+ const excelSerialNumber = Math.floor(
+ (selectedDate - excelEpoch) / (24 * 60 * 60 * 1000)
+ );
+
+ // Store the date value and format in Asc.scope
+ window.Asc.scope.dateValue = excelSerialNumber;
+ window.Asc.scope.formatCode = getExcelFormatCode(selectedFormat);
+
+ // Use Asc.scope - insert as actual date number
+ window.pluginAPI.callCommand(function () {
+ try {
+ // Access the date from Asc.scope
+ var dateValue = Asc.scope.dateValue;
+ var formatCode = Asc.scope.formatCode;
+ var oWorksheet = Api.GetActiveSheet();
+
+ if (!oWorksheet) {
+ return false;
+ }
+
+ var oSelection = oWorksheet.GetSelection();
+ if (!oSelection) {
+ var oActiveCell = oWorksheet.GetActiveCell();
+ if (oActiveCell) {
+ oActiveCell.SetValue(dateValue);
+ oActiveCell.SetNumberFormat(formatCode);
+ return true;
+ }
+ return false;
+ }
+
+ try {
+ oSelection.Clear();
+ oSelection.SetValue(dateValue);
+ oSelection.SetNumberFormat(formatCode);
+ return true;
+ } catch (directError) {
+ try {
+ var oRange = oSelection;
+ if (oRange.GetRowsCount && oRange.GetColsCount) {
+ var rowCount = oRange.GetRowsCount();
+ var colCount = oRange.GetColsCount();
+
+ for (var row = 0; row < rowCount; row++) {
+ for (var col = 0; col < colCount; col++) {
+ var oCell = oRange.GetRows(row).GetCells(col);
+ if (oCell) {
+ oCell.SetValue(dateValue);
+ oCell.SetNumberFormat(formatCode);
+ }
+ }
+ }
+ return true;
+ } else {
+ oSelection.SetValue(dateValue);
+ oSelection.SetNumberFormat(formatCode);
+ return true;
+ }
+ } catch (cellError) {
+ var oActiveCell = oWorksheet.GetActiveCell();
+ if (oActiveCell) {
+ oActiveCell.SetValue(dateValue);
+ oActiveCell.SetNumberFormat(formatCode);
+ return true;
+ }
+ return false;
+ }
+ }
+ } catch (e) {
+ return false;
+ }
+ });
+
+ // Clean up the scope after use
+ delete window.Asc.scope.dateValue;
+ delete window.Asc.scope.formatCode;
+
+ return true;
+ } catch (e) {
+ console.error("Error in insertDateValue:", e);
+ // Clean up on error too
+ delete window.Asc.scope.dateValue;
+ delete window.Asc.scope.formatCode;
+ throw e;
+ }
+}
+
+// Helper function to convert our format strings to Excel number format codes
+function getExcelFormatCode(format) {
+ switch (format) {
+ case "MM/DD/YYYY":
+ return "mm/dd/yyyy";
+ case "dddd, MMMM D, YYYY":
+ return "dddd, mmmm dd, yyyy";
+ case "MMMM D, YYYY":
+ return "mmmm dd, yyyy";
+ case "M/D/YY":
+ return "mm/dd/yy";
+ case "YYYY-MM-DD":
+ return "yyyy-mm-dd";
+ case "D-MMM-YY":
+ return "dd-mmm-yy";
+ case "M.D.YYYY":
+ return "mm.dd.yyyy";
+ default:
+ return "mm/dd/yyyy";
+ }
+}
+
+function validateAndGetFormat(formatSelect) {
+ const format = formatSelect.value;
+ const validFormats = [
+ "MM/DD/YYYY",
+ "dddd, MMMM D, YYYY",
+ "MMMM D, YYYY",
+ "M/D/YY",
+ "YYYY-MM-DD",
+ "D-MMM-YY",
+ "M.D.YYYY",
+ ];
+
+ if (validFormats.includes(format)) {
+ return format;
+ } else {
+ console.warn("Invalid format detected, falling back to default");
+ formatSelect.value = "MM/DD/YYYY";
+ return "MM/DD/YYYY";
+ }
+}
+
+function initializeDatePicker() {
+ const input = document.getElementById("dateInput");
+ const formatSelect = document.getElementById("dateFormat");
+ const insertBtn = document.getElementById("insertDate");
+
+ if (!input || !formatSelect || !insertBtn) return;
+
+ input.setAttribute("data-initialized", "true");
+ const calendar = new CustomCalendar(input);
+
+ // Store global reference for translation updates
+ globalCalendar = calendar;
+
+ function updateFormatOptions(selectedDate) {
+ const formats = [
+ "MM/DD/YYYY",
+ "dddd, MMMM D, YYYY",
+ "MMMM D, YYYY",
+ "M/D/YY",
+ "YYYY-MM-DD",
+ "D-MMM-YY",
+ "M.D.YYYY",
+ ];
+ const currentValue = formatSelect.value;
+ formatSelect.innerHTML = "";
+ formats.forEach((format) => {
+ const option = document.createElement("option");
+ option.value = format;
+ option.textContent = calendar.formatDate(selectedDate, format);
+ formatSelect.appendChild(option);
+ });
+ formatSelect.value = currentValue;
+ }
+
+ updateFormatOptions(new Date());
+
+ formatSelect.addEventListener("change", () => {
+ calendar.updateInput();
+ });
+
+ input.addEventListener("datechange", () =>
+ updateFormatOptions(calendar.getDate())
+ );
+
+ insertBtn.addEventListener("click", () => {
+ const selectedDate = calendar.getDate();
+ if (!selectedDate) {
+ return;
+ }
+
+ // Disable controls
+ insertBtn.disabled = true;
+ formatSelect.disabled = true;
+
+ const currentFormat = validateAndGetFormat(formatSelect);
+ const mainContent = document.getElementById("mainContent");
+ if (mainContent) {
+ mainContent.classList.add("loading");
+ }
+
+ showLoadingScreen(tr("Inserting date..."));
+
+ // Use requestAnimationFrame to ensure loading screen is visible
+ requestAnimationFrame(() => {
+ try {
+ const formattedDate = calendar.formatDate(selectedDate, currentFormat);
+
+ // Insert the date (synchronous operation)
+ insertDateValue(formattedDate, selectedDate, currentFormat);
+
+ // Success! Reset to today's date
+ const todaysDate = new Date();
+ formatSelect.selectedIndex = 0;
+ updateFormatOptions(todaysDate);
+ calendar.setDate(todaysDate);
+ } catch (error) {
+ console.error("Failed to insert date:", error);
+ alert(tr("Failed to insert date. Please try again."));
+ } finally {
+ // Re-enable controls and hide loading after a brief delay for visual feedback
+ requestAnimationFrame(() => {
+ insertBtn.disabled = false;
+ formatSelect.disabled = false;
+ hideLoadingScreen();
+
+ if (mainContent) {
+ mainContent.classList.remove("loading");
+ }
+ });
+ }
+ });
+ });
+
+ // Initial translation update if translations are already available
+ if (window.Asc.plugin.tr) {
+ window.Asc.plugin.onTranslate();
+ }
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/cs-CS.json b/sdkjs-plugins/content/datepicker/translations/cs-CS.json
new file mode 100644
index 00000000..81a1a96a
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/cs-CS.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Vyberte datum a formát , poté klikněte na tlačítko Vložit datum . Datum se zobrazí ve vybrané buňce.",
+ "Select date": "Vybrat datum",
+ "Select a date": "Vyberte datum",
+ "Select date format": "Vybrat formát data",
+ "Insert date": "Vložit datum",
+ "Loading...": "Načítání...",
+ "Loading plugin...": "Načítání pluginu...",
+ "Initializing plugin...": "Inicializace pluginu...",
+ "Inserting date...": "Vkládání data...",
+ "Please do not close the plugin panel.": "Prosím nezavírejte panel pluginu.",
+ "January": "Leden",
+ "February": "Únor",
+ "March": "Březen",
+ "April": "Duben",
+ "May (full)": "Květen",
+ "June": "Červen",
+ "July": "Červenec",
+ "August": "Srpen",
+ "September": "Září",
+ "October": "Říjen",
+ "November": "Listopad",
+ "December": "Prosinec",
+ "Sunday": "Neděle",
+ "Monday": "Pondělí",
+ "Tuesday": "Úterý",
+ "Wednesday": "Středa",
+ "Thursday": "Čtvrtek",
+ "Friday": "Pátek",
+ "Saturday": "Sobota",
+ "Jan": "Led",
+ "Feb": "Úno",
+ "Mar": "Bře",
+ "Apr": "Dub",
+ "May (short)": "Kvě",
+ "Jun": "Čer",
+ "Jul": "Čvc",
+ "Aug": "Srp",
+ "Sep": "Zář",
+ "Oct": "Říj",
+ "Nov": "Lis",
+ "Dec": "Pro"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/de-DE.json b/sdkjs-plugins/content/datepicker/translations/de-DE.json
new file mode 100644
index 00000000..c6773c8e
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/de-DE.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Wählen Sie das Datum und Format , dann klicken Sie auf die Schaltfläche Datum einfügen . Das Datum wird in der ausgewählten Zelle angezeigt.",
+ "Select date": "Datum auswählen",
+ "Select a date": "Datum auswählen",
+ "Select date format": "Datumsformat auswählen",
+ "Insert date": "Datum einfügen",
+ "Loading...": "Wird geladen...",
+ "Loading plugin...": "Plugin wird geladen...",
+ "Initializing plugin...": "Plugin wird initialisiert...",
+ "Inserting date...": "Datum wird eingefügt...",
+ "Please do not close the plugin panel.": "Bitte schließen Sie nicht das Plugin-Panel.",
+ "January": "Januar",
+ "February": "Februar",
+ "March": "März",
+ "April": "April",
+ "May (full)": "Mai",
+ "June": "Juni",
+ "July": "Juli",
+ "August": "August",
+ "September": "September",
+ "October": "Oktober",
+ "November": "November",
+ "December": "Dezember",
+ "Sunday": "Sonntag",
+ "Monday": "Montag",
+ "Tuesday": "Dienstag",
+ "Wednesday": "Mittwoch",
+ "Thursday": "Donnerstag",
+ "Friday": "Freitag",
+ "Saturday": "Samstag",
+ "Jan": "Jan",
+ "Feb": "Feb",
+ "Mar": "Mär",
+ "Apr": "Apr",
+ "May (short)": "Mai",
+ "Jun": "Jun",
+ "Jul": "Jul",
+ "Aug": "Aug",
+ "Sep": "Sep",
+ "Oct": "Okt",
+ "Nov": "Nov",
+ "Dec": "Dez"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/es-ES.json b/sdkjs-plugins/content/datepicker/translations/es-ES.json
new file mode 100644
index 00000000..b8acb3a8
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/es-ES.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Seleccione la fecha y formato , luego haga clic en el botón Insertar fecha . La fecha se mostrará en la celda seleccionada.",
+ "Select date": "Seleccionar fecha",
+ "Select a date": "Seleccione una fecha",
+ "Select date format": "Seleccionar formato de fecha",
+ "Insert date": "Insertar fecha",
+ "Loading...": "Cargando...",
+ "Loading plugin...": "Cargando plugin...",
+ "Initializing plugin...": "Inicializando plugin...",
+ "Inserting date...": "Insertando fecha...",
+ "Please do not close the plugin panel.": "Por favor no cierre el panel del plugin.",
+ "January": "Enero",
+ "February": "Febrero",
+ "March": "Marzo",
+ "April": "Abril",
+ "May (full)": "Mayo",
+ "June": "Junio",
+ "July": "Julio",
+ "August": "Agosto",
+ "September": "Septiembre",
+ "October": "Octubre",
+ "November": "Noviembre",
+ "December": "Diciembre",
+ "Sunday": "Domingo",
+ "Monday": "Lunes",
+ "Tuesday": "Martes",
+ "Wednesday": "Miércoles",
+ "Thursday": "Jueves",
+ "Friday": "Viernes",
+ "Saturday": "Sábado",
+ "Jan": "Ene",
+ "Feb": "Feb",
+ "Mar": "Mar",
+ "Apr": "Abr",
+ "May (short)": "May",
+ "Jun": "Jun",
+ "Jul": "Jul",
+ "Aug": "Ago",
+ "Sep": "Sep",
+ "Oct": "Oct",
+ "Nov": "Nov",
+ "Dec": "Dic"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/fr-FR.json b/sdkjs-plugins/content/datepicker/translations/fr-FR.json
new file mode 100644
index 00000000..bb147d73
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/fr-FR.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Sélectionnez la date et le format , puis cliquez sur le bouton Insérer la date . La date sera affichée dans la cellule sélectionnée.",
+ "Select date": "Sélectionner la date",
+ "Select a date": "Sélectionnez une date",
+ "Select date format": "Sélectionner le format de date",
+ "Insert date": "Insérer la date",
+ "Loading...": "Chargement...",
+ "Loading plugin...": "Chargement du plugin...",
+ "Initializing plugin...": "Initialisation du plugin...",
+ "Inserting date...": "Insertion de la date...",
+ "Please do not close the plugin panel.": "Veuillez ne pas fermer le panneau du plugin.",
+ "January": "Janvier",
+ "February": "Février",
+ "March": "Mars",
+ "April": "Avril",
+ "May (full)": "Mai",
+ "June": "Juin",
+ "July": "Juillet",
+ "August": "Août",
+ "September": "Septembre",
+ "October": "Octobre",
+ "November": "Novembre",
+ "December": "Décembre",
+ "Sunday": "Dimanche",
+ "Monday": "Lundi",
+ "Tuesday": "Mardi",
+ "Wednesday": "Mercredi",
+ "Thursday": "Jeudi",
+ "Friday": "Vendredi",
+ "Saturday": "Samedi",
+ "Jan": "Jan",
+ "Feb": "Fév",
+ "Mar": "Mar",
+ "Apr": "Avr",
+ "May (short)": "Mai",
+ "Jun": "Jun",
+ "Jul": "Jul",
+ "Aug": "Aoû",
+ "Sep": "Sep",
+ "Oct": "Oct",
+ "Nov": "Nov",
+ "Dec": "Déc"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/it-IT.json b/sdkjs-plugins/content/datepicker/translations/it-IT.json
new file mode 100644
index 00000000..55a0b91a
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/it-IT.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Seleziona la data e il formato , poi clicca sul pulsante Inserisci data . La data verrà visualizzata nella cella selezionata.",
+ "Select date": "Seleziona data",
+ "Select a date": "Seleziona una data",
+ "Select date format": "Seleziona formato data",
+ "Insert date": "Inserisci data",
+ "Loading...": "Caricamento...",
+ "Loading plugin...": "Caricamento plugin...",
+ "Initializing plugin...": "Inizializzazione plugin...",
+ "Inserting date...": "Inserimento data...",
+ "Please do not close the plugin panel.": "Si prega di non chiudere il pannello del plugin.",
+ "January": "Gennaio",
+ "February": "Febbraio",
+ "March": "Marzo",
+ "April": "Aprile",
+ "May (full)": "Maggio",
+ "June": "Giugno",
+ "July": "Luglio",
+ "August": "Agosto",
+ "September": "Settembre",
+ "October": "Ottobre",
+ "November": "Novembre",
+ "December": "Dicembre",
+ "Sunday": "Domenica",
+ "Monday": "Lunedì",
+ "Tuesday": "Martedì",
+ "Wednesday": "Mercoledì",
+ "Thursday": "Giovedì",
+ "Friday": "Venerdì",
+ "Saturday": "Sabato",
+ "Jan": "Gen",
+ "Feb": "Feb",
+ "Mar": "Mar",
+ "Apr": "Apr",
+ "May (short)": "Mag",
+ "Jun": "Giu",
+ "Jul": "Lug",
+ "Aug": "Ago",
+ "Sep": "Set",
+ "Oct": "Ott",
+ "Nov": "Nov",
+ "Dec": "Dic"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/ja-JA.json b/sdkjs-plugins/content/datepicker/translations/ja-JA.json
new file mode 100644
index 00000000..467c3194
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/ja-JA.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "日付と形式 を選択し、日付を挿入 ボタンをクリックしてください。選択したセルに日付が表示されます。",
+ "Select date": "日付を選択",
+ "Select a date": "日付を選択してください",
+ "Select date format": "日付形式を選択",
+ "Insert date": "日付を挿入",
+ "Loading...": "読み込み中...",
+ "Loading plugin...": "プラグインを読み込み中...",
+ "Initializing plugin...": "プラグインを初期化中...",
+ "Inserting date...": "日付を挿入中...",
+ "Please do not close the plugin panel.": "プラグインパネルを閉じないで ください。",
+ "January": "1月",
+ "February": "2月",
+ "March": "3月",
+ "April": "4月",
+ "May (full)": "5月",
+ "June": "6月",
+ "July": "7月",
+ "August": "8月",
+ "September": "9月",
+ "October": "10月",
+ "November": "11月",
+ "December": "12月",
+ "Sunday": "日曜日",
+ "Monday": "月曜日",
+ "Tuesday": "火曜日",
+ "Wednesday": "水曜日",
+ "Thursday": "木曜日",
+ "Friday": "金曜日",
+ "Saturday": "土曜日",
+ "Jan": "1月",
+ "Feb": "2月",
+ "Mar": "3月",
+ "Apr": "4月",
+ "May (short)": "5月",
+ "Jun": "6月",
+ "Jul": "7月",
+ "Aug": "8月",
+ "Sep": "9月",
+ "Oct": "10月",
+ "Nov": "11月",
+ "Dec": "12月"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/langs.json b/sdkjs-plugins/content/datepicker/translations/langs.json
new file mode 100644
index 00000000..439c8daf
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/langs.json
@@ -0,0 +1,14 @@
+[
+ "ru-RU",
+ "de-DE",
+ "fr-FR",
+ "es-ES",
+ "pt-BR",
+ "it-IT",
+ "ja-JA",
+ "zh-ZH",
+ "cs-CS",
+ "sq-AL",
+ "sr-RS",
+ "sr-Latn-RS"
+]
diff --git a/sdkjs-plugins/content/datepicker/translations/pt-BR.json b/sdkjs-plugins/content/datepicker/translations/pt-BR.json
new file mode 100644
index 00000000..4527543e
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/pt-BR.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Selecione a data e formato , depois clique no botão Inserir data . A data será exibida na célula selecionada.",
+ "Select date": "Selecionar data",
+ "Select a date": "Selecione uma data",
+ "Select date format": "Selecionar formato de data",
+ "Insert date": "Inserir data",
+ "Loading...": "Carregando...",
+ "Loading plugin...": "Carregando plugin...",
+ "Initializing plugin...": "Inicializando plugin...",
+ "Inserting date...": "Inserindo data...",
+ "Please do not close the plugin panel.": "Por favor não feche o painel do plugin.",
+ "January": "Janeiro",
+ "February": "Fevereiro",
+ "March": "Março",
+ "April": "Abril",
+ "May (full)": "Maio",
+ "June": "Junho",
+ "July": "Julho",
+ "August": "Agosto",
+ "September": "Setembro",
+ "October": "Outubro",
+ "November": "Novembro",
+ "December": "Dezembro",
+ "Sunday": "Domingo",
+ "Monday": "Segunda-feira",
+ "Tuesday": "Terça-feira",
+ "Wednesday": "Quarta-feira",
+ "Thursday": "Quinta-feira",
+ "Friday": "Sexta-feira",
+ "Saturday": "Sábado",
+ "Jan": "Jan",
+ "Feb": "Fev",
+ "Mar": "Mar",
+ "Apr": "Abr",
+ "May (short)": "Mai",
+ "Jun": "Jun",
+ "Jul": "Jul",
+ "Aug": "Ago",
+ "Sep": "Set",
+ "Oct": "Out",
+ "Nov": "Nov",
+ "Dec": "Dez"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/ru-RU.json b/sdkjs-plugins/content/datepicker/translations/ru-RU.json
new file mode 100644
index 00000000..a7b39a32
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/ru-RU.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Выберите дату и формат , затем нажмите кнопку Вставить дату . Дата будет отображена в выбранной ячейке.",
+ "Select date": "Выбрать дату",
+ "Select a date": "Выберите дату",
+ "Select date format": "Выбрать формат даты",
+ "Insert date": "Вставить дату",
+ "Loading...": "Загрузка...",
+ "Loading plugin...": "Загрузка плагина...",
+ "Initializing plugin...": "Инициализация плагина...",
+ "Inserting date...": "Вставка даты...",
+ "Please do not close the plugin panel.": "Пожалуйста, не закрывайте панель плагина.",
+ "January": "Январь",
+ "February": "Февраль",
+ "March": "Март",
+ "April": "Апрель",
+ "May (full)": "Май",
+ "June": "Июнь",
+ "July": "Июль",
+ "August": "Август",
+ "September": "Сентябрь",
+ "October": "Октябрь",
+ "November": "Ноябрь",
+ "December": "Декабрь",
+ "Sunday": "Воскресенье",
+ "Monday": "Понедельник",
+ "Tuesday": "Вторник",
+ "Wednesday": "Среда",
+ "Thursday": "Четверг",
+ "Friday": "Пятница",
+ "Saturday": "Суббота",
+ "Jan": "Янв",
+ "Feb": "Фев",
+ "Mar": "Мар",
+ "Apr": "Апр",
+ "May (short)": "Май",
+ "Jun": "Июн",
+ "Jul": "Июл",
+ "Aug": "Авг",
+ "Sep": "Сен",
+ "Oct": "Окт",
+ "Nov": "Ноя",
+ "Dec": "Дек"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/sq-AL.json b/sdkjs-plugins/content/datepicker/translations/sq-AL.json
new file mode 100644
index 00000000..277f1374
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/sq-AL.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Zgjidhni datën dhe formatin , pastaj klikoni butonin Fut datën . Data do të shfaqet në qelizën e zgjedhur.",
+ "Select date": "Zgjidhni datën",
+ "Select a date": "Zgjidhni një datë",
+ "Select date format": "Zgjidhni formatin e datës",
+ "Insert date": "Fut datën",
+ "Loading...": "Duke ngarkuar...",
+ "Loading plugin...": "Duke ngarkuar plugin-in...",
+ "Initializing plugin...": "Duke inicializuar plugin-in...",
+ "Inserting date...": "Duke futur datën...",
+ "Please do not close the plugin panel.": "Ju lutem mos e mbyllni panelin e plugin-it.",
+ "January": "Janar",
+ "February": "Shkurt",
+ "March": "Mars",
+ "April": "Prill",
+ "May (full)": "Maj",
+ "June": "Qershor",
+ "July": "Korrik",
+ "August": "Gusht",
+ "September": "Shtator",
+ "October": "Tetor",
+ "November": "Nëntor",
+ "December": "Dhjetor",
+ "Sunday": "E diel",
+ "Monday": "E hënë",
+ "Tuesday": "E martë",
+ "Wednesday": "E mërkurë",
+ "Thursday": "E enjte",
+ "Friday": "E premte",
+ "Saturday": "E shtunë",
+ "Jan": "Jan",
+ "Feb": "Shk",
+ "Mar": "Mar",
+ "Apr": "Pri",
+ "May (short)": "Maj",
+ "Jun": "Qer",
+ "Jul": "Kor",
+ "Aug": "Gus",
+ "Sep": "Sht",
+ "Oct": "Tet",
+ "Nov": "Nën",
+ "Dec": "Dhj"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/sr-Latn.json b/sdkjs-plugins/content/datepicker/translations/sr-Latn.json
new file mode 100644
index 00000000..040cef64
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/sr-Latn.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Izaberite datum i format , zatim kliknite na dugme Ubaci datum . Datum će biti prikazan u izabranoj ćeliji.",
+ "Select date": "Izaberi datum",
+ "Select a date": "Izaberite datum",
+ "Select date format": "Izaberi format datuma",
+ "Insert date": "Ubaci datum",
+ "Loading...": "Učitavanje...",
+ "Loading plugin...": "Učitavanje dodatka...",
+ "Initializing plugin...": "Inicijalizacija dodatka...",
+ "Inserting date...": "Ubacivanje datuma...",
+ "Please do not close the plugin panel.": "Molimo ne zatvarajte panel dodatka.",
+ "January": "Januar",
+ "February": "Februar",
+ "March": "Mart",
+ "April": "April",
+ "May (full)": "Maj",
+ "June": "Jun",
+ "July": "Jul",
+ "August": "Avgust",
+ "September": "Septembar",
+ "October": "Oktobar",
+ "November": "Novembar",
+ "December": "Decembar",
+ "Sunday": "Nedelja",
+ "Monday": "Ponedeljak",
+ "Tuesday": "Utorak",
+ "Wednesday": "Sreda",
+ "Thursday": "Četvrtak",
+ "Friday": "Petak",
+ "Saturday": "Subota",
+ "Jan": "Jan",
+ "Feb": "Feb",
+ "Mar": "Mar",
+ "Apr": "Apr",
+ "May (short)": "Maj",
+ "Jun": "Jun",
+ "Jul": "Jul",
+ "Aug": "Avg",
+ "Sep": "Sep",
+ "Oct": "Okt",
+ "Nov": "Nov",
+ "Dec": "Dec"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/sr-RS.json b/sdkjs-plugins/content/datepicker/translations/sr-RS.json
new file mode 100644
index 00000000..ca9ce1d9
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/sr-RS.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "Изаберите датум и формат , затим кликните на дугме Убаци датум . Датум ће бити приказан у изабраној ћелији.",
+ "Select date": "Изабери датум",
+ "Select a date": "Изаберите датум",
+ "Select date format": "Изабери формат датума",
+ "Insert date": "Убаци датум",
+ "Loading...": "Учитавање...",
+ "Loading plugin...": "Учитавање додатка...",
+ "Initializing plugin...": "Иницијализација додатка...",
+ "Inserting date...": "Убацивање датума...",
+ "Please do not close the plugin panel.": "Молимо не затварајте панел додатка.",
+ "January": "Јануар",
+ "February": "Фебруар",
+ "March": "Март",
+ "April": "Април",
+ "May (full)": "Мај",
+ "June": "Јун",
+ "July": "Јул",
+ "August": "Август",
+ "September": "Септембар",
+ "October": "Октобар",
+ "November": "Новембар",
+ "December": "Децембар",
+ "Sunday": "Недеља",
+ "Monday": "Понедељак",
+ "Tuesday": "Уторак",
+ "Wednesday": "Среда",
+ "Thursday": "Четвртак",
+ "Friday": "Петак",
+ "Saturday": "Субота",
+ "Jan": "Јан",
+ "Feb": "Феб",
+ "Mar": "Мар",
+ "Apr": "Апр",
+ "May (short)": "Мај",
+ "Jun": "Јун",
+ "Jul": "Јул",
+ "Aug": "Авг",
+ "Sep": "Сеп",
+ "Oct": "Окт",
+ "Nov": "Нов",
+ "Dec": "Дец"
+}
diff --git a/sdkjs-plugins/content/datepicker/translations/zh-ZH.json b/sdkjs-plugins/content/datepicker/translations/zh-ZH.json
new file mode 100644
index 00000000..c2069c73
--- /dev/null
+++ b/sdkjs-plugins/content/datepicker/translations/zh-ZH.json
@@ -0,0 +1,43 @@
+{
+ "Select the date and format , then click the Insert date button. The date will be displayed in the selected cell.": "选择日期和格式 ,然后点击插入日期 按钮。日期将显示在选定的单元格中。",
+ "Select date": "选择日期",
+ "Select a date": "选择一个日期",
+ "Select date format": "选择日期格式",
+ "Insert date": "插入日期",
+ "Loading...": "加载中...",
+ "Loading plugin...": "加载插件中...",
+ "Initializing plugin...": "初始化插件中...",
+ "Inserting date...": "插入日期中...",
+ "Please do not close the plugin panel.": "请不要关闭 插件面板。",
+ "January": "一月",
+ "February": "二月",
+ "March": "三月",
+ "April": "四月",
+ "May (full)": "五月",
+ "June": "六月",
+ "July": "七月",
+ "August": "八月",
+ "September": "九月",
+ "October": "十月",
+ "November": "十一月",
+ "December": "十二月",
+ "Sunday": "星期日",
+ "Monday": "星期一",
+ "Tuesday": "星期二",
+ "Wednesday": "星期三",
+ "Thursday": "星期四",
+ "Friday": "星期五",
+ "Saturday": "星期六",
+ "Jan": "1月",
+ "Feb": "2月",
+ "Mar": "3月",
+ "Apr": "4月",
+ "May (short)": "5月",
+ "Jun": "6月",
+ "Jul": "7月",
+ "Aug": "8月",
+ "Sep": "9月",
+ "Oct": "10月",
+ "Nov": "11月",
+ "Dec": "12月"
+}
diff --git a/sdkjs-plugins/content/deepl/CHANGELOG.md b/sdkjs-plugins/content/deepl/CHANGELOG.md
index e19b54ff..8cf833dd 100644
--- a/sdkjs-plugins/content/deepl/CHANGELOG.md
+++ b/sdkjs-plugins/content/deepl/CHANGELOG.md
@@ -20,3 +20,7 @@
* Bug fix.
* Using modern API.
+
+## 1.0.5
+
+* Fix work with offline files (Desktop App).
diff --git a/sdkjs-plugins/content/deepl/config.json b/sdkjs-plugins/content/deepl/config.json
index ef467930..a58d045b 100644
--- a/sdkjs-plugins/content/deepl/config.json
+++ b/sdkjs-plugins/content/deepl/config.json
@@ -12,7 +12,7 @@
"zh-ZH": "DeepL"
},
"guid": "asc.{b78a062b-e349-4634-8a44-99825600d299}",
- "version": "1.0.4",
+ "version": "1.0.5",
"variations": [
{
@@ -100,5 +100,7 @@
"categories": ["specAbilities", "work"]
}
}
- ]
+ ],
+
+ "onlyofficeScheme": true
}
diff --git a/sdkjs-plugins/content/deepl/deploy/deepl.plugin b/sdkjs-plugins/content/deepl/deploy/deepl.plugin
index b95a7337..e4b8033c 100644
Binary files a/sdkjs-plugins/content/deepl/deploy/deepl.plugin and b/sdkjs-plugins/content/deepl/deploy/deepl.plugin differ
diff --git a/sdkjs-plugins/content/news/CHANGELOG.md b/sdkjs-plugins/content/news/CHANGELOG.md
new file mode 100644
index 00000000..23477f53
--- /dev/null
+++ b/sdkjs-plugins/content/news/CHANGELOG.md
@@ -0,0 +1,4 @@
+# Change Log
+
+## 1.0.0 - Initial Release
+
diff --git a/sdkjs-plugins/content/news/README.md b/sdkjs-plugins/content/news/README.md
new file mode 100644
index 00000000..86338435
--- /dev/null
+++ b/sdkjs-plugins/content/news/README.md
@@ -0,0 +1,85 @@
+# News Plugin
+
+## Overview
+
+Search through millions of articles from multiple news sources using various news API providers. This plugin allows you to search for articles by keywords and browse top headlines by category and country, then open them directly in your browser.
+
+The plugin supports multiple news API providers. Choose your preferred provider and get a free API key to start using the plugin.
+
+## Features
+
+- **Multiple Providers**: Support for GNews and TheNewsAPI with easy provider switching
+- **Keyword Search**: Search for articles using specific keywords or phrases
+- **Top Headlines**: Browse top headlines by category (Business, Technology, Sports, etc.)
+- **Provider-Specific Options**: Dynamic UI that adapts to each provider's capabilities
+- **Language Support**: Support for multiple languages (English, Spanish, French, German, etc.)
+- **Advanced Settings**: Sort by publication date or relevance, filter by domains (TheNewsAPI)
+- **Display Options**: Choose what to display (available for GNews)
+- **Direct Access**: Click any article to open it in a new browser tab
+
+## Supported Providers
+
+### GNews ([gnews.io](https://gnews.io))
+- 100 requests/day (free tier)
+- Search in title, description, or content
+- 60,000+ news sources
+
+### TheNewsAPI ([thenewsapi.com](https://www.thenewsapi.com))
+- 150 requests/day (free tier)
+- Filter by specific domains
+- Locale-based filtering
+
+## How to use
+
+1. **Choose Provider**: Select your preferred news provider (GNews or TheNewsAPI)
+2. **Get API Key**: Register at your chosen provider's website and get your free API key
+3. **Install Plugin**: Open the plugin from the Plugins tab in ONLYOFFICE
+4. **Setup**: Enter your API key when prompted
+5. **Search**: Use the Search tab to find articles by keywords
+6. **Headlines**: Use the Top Headlines tab to browse news by category
+7. **Open Articles**: Click on any article to open it in your browser
+
+### Search Tab
+
+1. Enter keywords in the search field
+2. **(GNews only)** Choose what to display using the checkboxes (Title, Description, Content)
+3. Optionally configure advanced settings (language, sort order, domains for TheNewsAPI)
+4. Click "Find" to search
+
+### Top Headlines Tab
+
+1. Optionally enter keywords to filter headlines
+2. Select a category (General, Business, Technology, etc.)
+3. Select a country
+4. Click "Find" to get headlines
+
+## Requirements
+
+- ONLYOFFICE Document Editor
+- Internet connection
+- Free API key from your chosen provider ([gnews.io](https://gnews.io) or [thenewsapi.com](https://www.thenewsapi.com))
+
+## Known Issues
+
+- Requires internet connection to fetch articles
+- API rate limits apply based on your provider's plan
+- Some regions may have limited access to certain news sources
+- Each provider requires its own API key
+
+## Support
+
+For issues and feature requests, please contact the plugin developer.
+
+## Documentation
+
+- [ARCHITECTURE.md](ARCHITECTURE.md) - Technical architecture and code organization
+- [PROVIDER_FEATURES.md](PROVIDER_FEATURES.md) - Detailed comparison of provider features and capabilities
+- [CHANGELOG.md](CHANGELOG.md) - Version history and changes
+
+## API Information
+
+This plugin supports multiple news API providers:
+- [GNews API](https://gnews.io) - 100 requests/day free tier
+- [TheNewsAPI](https://www.thenewsapi.com) - 150 requests/day free tier
+
+Please refer to each provider's documentation for API limits and terms of service.
diff --git a/sdkjs-plugins/content/news/config.json b/sdkjs-plugins/content/news/config.json
new file mode 100644
index 00000000..322e2480
--- /dev/null
+++ b/sdkjs-plugins/content/news/config.json
@@ -0,0 +1,102 @@
+{
+ "name": "News",
+ "guid": "asc.{0616AE85-5DBE-4B6B-A0A9-455C4F1503AD}",
+ "version": "1.0.0",
+ "baseUrl": "",
+ "variations": [
+ {
+ "description": "Search through millions of articles from over 80,000 large and small news sources and blogs.",
+ "descriptionLocale": {
+ "ru": "Поиск среди миллионов статей из более чем 80 000 крупных и малых новостных источников и блогов.",
+ "fr": "Recherchez parmi des millions d'articles",
+ "es": "Busque entre millones de artículos de más de 80,000 fuentes de noticias y blogs grandes y pequeños.",
+ "de": "Durchsuchen Sie Millionen von Artikeln aus über 80.000 großen und kleinen Nachrichtenquellen und Blogs.",
+ "br": "Pesquise entre milhões de artigos de mais de 80.000 fontes de notícias e blogs grandes e pequenos.",
+ "it": "Cerca tra milioni di articoli di oltre 80.000 fonti, tra notizie e blog grandi e piccoli.",
+ "zh": "在来自8万多家新闻媒体和博客的数百万篇文章中快速搜索所需信息。",
+ "ja": "80,000を超える大小のニュースソースとブログから数百万の記事を検索します。",
+ "cs-CZ": "Prohledejte miliony článků z více než 80 000 velkých a malých zpravodajských zdrojů a blogů."
+ },
+ "url": "index.html",
+ "icons": [
+ "resources/store/icons/icon.png",
+ "resources/store/icons/icon@2x.png"
+ ],
+ "isViewer": false,
+ "EditorsSupport": ["word", "cell", "slide"],
+ "isVisual": true,
+ "isModal": false,
+ "isInsideMode": true,
+ "initDataType": "none",
+ "initData": "",
+ "isUpdateOleOnResize": true,
+ "buttons": [],
+ "size": [300, 0],
+ "store": {
+ "background": {
+ "light": "#F5F5F5",
+ "dark": "#444444"
+ },
+ "screenshots": [
+ "resources/store/screenshots/screenshot1.png",
+ "resources/store/screenshots/screenshot2.png",
+ "resources/store/screenshots/screenshot3.png"
+ ],
+ "icons": {
+ "light": "resources/store/icons",
+ "dark": "resources/store/icons"
+ },
+ "categories": ["specAbilities", "work"]
+ }
+ },
+ {
+ "description": "About",
+ "descriptionLocale": {
+ "de": "Über",
+ "es": "Acerca de",
+ "fr": "À propos",
+ "it": "Informazioni",
+ "pt": "Sobre",
+ "ru": "О программе",
+ "ja": "について",
+ "zh": "关于",
+ "cs": "O aplikaci",
+ "si": "O programu",
+ "sq": "Rreth"
+ },
+ "url": "index_about.html",
+ "icons": [
+ "resources/store/icons/icon.png",
+ "resources/store/icons/icon@2x.png"
+ ],
+ "isViewer": false,
+ "EditorsSupport": ["word"],
+ "isVisual": true,
+ "isModal": true,
+ "isInsideMode": false,
+ "initDataType": "none",
+ "initData": "",
+ "isUpdateOleOnResize": true,
+ "buttons": [
+ {
+ "text": "Ok",
+ "textLocale": {
+ "de": "OK",
+ "es": "Aceptar",
+ "fr": "OK",
+ "it": "OK",
+ "pt": "OK",
+ "ru": "OK",
+ "ja": "OK",
+ "zh": "确定",
+ "cs": "OK",
+ "si": "V redu",
+ "sq": "OK"
+ },
+ "primary": true
+ }
+ ],
+ "size": [392, 147]
+ }
+ ]
+}
diff --git a/sdkjs-plugins/content/news/deploy/news.plugin b/sdkjs-plugins/content/news/deploy/news.plugin
new file mode 100644
index 00000000..1b123fc4
Binary files /dev/null and b/sdkjs-plugins/content/news/deploy/news.plugin differ
diff --git a/sdkjs-plugins/content/news/index.html b/sdkjs-plugins/content/news/index.html
new file mode 100644
index 00000000..07a7a8d7
--- /dev/null
+++ b/sdkjs-plugins/content/news/index.html
@@ -0,0 +1,262 @@
+
+
+
+
+ News
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ News Provider:
+
+ GNews
+ TheNewsAPI
+ WorldNewsAPI
+
+
+
+
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+ Search
+
+
+ Top Headlines
+
+
+
+
+
+
+
+
+
+
+
+
+ Back to search
+
+
+
+
+
diff --git a/sdkjs-plugins/content/news/index_about.html b/sdkjs-plugins/content/news/index_about.html
new file mode 100644
index 00000000..2e06deb0
--- /dev/null
+++ b/sdkjs-plugins/content/news/index_about.html
@@ -0,0 +1,66 @@
+
+
+
+
+ About
+
+
+
+
+
+
+
+ News Plugin
+
+ This plugin provides a convenient sidebar interface to search and browse
+ news articles from multiple providers including GNews and TheNewsAPI. Search for topics and
+ open relevant news articles in new tabs without leaving your document.
+
+
+ GNews.io |
+ TheNewsAPI.com
+
+
+
diff --git a/sdkjs-plugins/content/news/pre_release.md b/sdkjs-plugins/content/news/pre_release.md
new file mode 100644
index 00000000..cc4561c5
--- /dev/null
+++ b/sdkjs-plugins/content/news/pre_release.md
@@ -0,0 +1,53 @@
+# Change Log
+
+## 0.4.0
+
+- Added WorldNewsAPI as a third news provider
+- WorldNewsAPI: Advanced filtering
+
+## 0.3.0
+
+- Added support for multiple news providers (GNews and TheNewsAPI)
+- Provider selection dropdown with automatic API key clearing on switch
+- Plugin renamed from "GNews API" to "News"
+- Dynamic advanced settings that adapt to selected provider
+- TheNewsAPI: Added domain filtering and search field options
+- New providers.js module for centralized configuration
+
+## 0.2.0
+
+- Major refactoring: Split monolithic code into modular architecture
+- Created separate modules: storage.js, api.js, ui.js, translations.js
+- Enhanced error handling and separation of concerns
+- Zero breaking changes - all existing functionality preserved
+
+## 0.1.3
+
+- Added persistent API key storage using localStorage - users no longer need to re-enter API key each time
+- Fixed "Show advanced settings" translation - now properly translates in all languages
+- Enhanced API key management with automatic loading and pre-filling of stored keys
+- Improved plugin initialization to automatically show search interface when API key is stored
+- Added comprehensive error handling for localStorage operations with fallback support
+
+## 0.1.2
+
+- Added larger icon sizes for marketplace submission
+- Prepared marketplace documentation and assets
+
+## 0.1.1
+
+- Fixed bug where "Back to search" triggered search when checking display options
+- Improved status message handling - no longer shows success message when updating display options
+- Removed hardcoded article limit for headlines to show actual API results
+- Enhanced scrolling support for small plugin heights
+- Repositioned "Reconfigure" button to prevent overlap issues
+
+## 0.1.0
+
+- Initial development version
+- Keyword search functionality
+- Top headlines browsing
+- Support for multiple languages and countries
+- Advanced search settings (sort by date/relevance)
+- Display options for title, description, and content
+- Direct article opening in browser
diff --git a/sdkjs-plugins/content/news/resources/dark/icon.png b/sdkjs-plugins/content/news/resources/dark/icon.png
new file mode 100644
index 00000000..b97aa168
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/dark/icon.png differ
diff --git a/sdkjs-plugins/content/news/resources/dark/icon.svg b/sdkjs-plugins/content/news/resources/dark/icon.svg
new file mode 100644
index 00000000..997de505
--- /dev/null
+++ b/sdkjs-plugins/content/news/resources/dark/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/news/resources/dark/icon@1.25x.png b/sdkjs-plugins/content/news/resources/dark/icon@1.25x.png
new file mode 100644
index 00000000..53b29039
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/dark/icon@1.25x.png differ
diff --git a/sdkjs-plugins/content/news/resources/dark/icon@1.5x.png b/sdkjs-plugins/content/news/resources/dark/icon@1.5x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/dark/icon@1.5x.png differ
diff --git a/sdkjs-plugins/content/news/resources/dark/icon@1.75x.png b/sdkjs-plugins/content/news/resources/dark/icon@1.75x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/dark/icon@1.75x.png differ
diff --git a/sdkjs-plugins/content/news/resources/dark/icon@2x.png b/sdkjs-plugins/content/news/resources/dark/icon@2x.png
new file mode 100644
index 00000000..0a2e3853
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/dark/icon@2x.png differ
diff --git a/sdkjs-plugins/content/news/resources/light/icon.png b/sdkjs-plugins/content/news/resources/light/icon.png
new file mode 100644
index 00000000..b97aa168
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/light/icon.png differ
diff --git a/sdkjs-plugins/content/news/resources/light/icon.svg b/sdkjs-plugins/content/news/resources/light/icon.svg
new file mode 100644
index 00000000..997de505
--- /dev/null
+++ b/sdkjs-plugins/content/news/resources/light/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/news/resources/light/icon@1.25x.png b/sdkjs-plugins/content/news/resources/light/icon@1.25x.png
new file mode 100644
index 00000000..53b29039
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/light/icon@1.25x.png differ
diff --git a/sdkjs-plugins/content/news/resources/light/icon@1.5x.png b/sdkjs-plugins/content/news/resources/light/icon@1.5x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/light/icon@1.5x.png differ
diff --git a/sdkjs-plugins/content/news/resources/light/icon@1.75x.png b/sdkjs-plugins/content/news/resources/light/icon@1.75x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/light/icon@1.75x.png differ
diff --git a/sdkjs-plugins/content/news/resources/light/icon@2x.png b/sdkjs-plugins/content/news/resources/light/icon@2x.png
new file mode 100644
index 00000000..0a2e3853
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/light/icon@2x.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon.png b/sdkjs-plugins/content/news/resources/store/icons/icon.png
new file mode 100644
index 00000000..b97aa168
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/icons/icon.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon.svg b/sdkjs-plugins/content/news/resources/store/icons/icon.svg
new file mode 100644
index 00000000..997de505
--- /dev/null
+++ b/sdkjs-plugins/content/news/resources/store/icons/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon@1.25x.png b/sdkjs-plugins/content/news/resources/store/icons/icon@1.25x.png
new file mode 100644
index 00000000..53b29039
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/icons/icon@1.25x.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon@1.5x.png b/sdkjs-plugins/content/news/resources/store/icons/icon@1.5x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/icons/icon@1.5x.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon@1.75x.png b/sdkjs-plugins/content/news/resources/store/icons/icon@1.75x.png
new file mode 100644
index 00000000..839f5832
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/icons/icon@1.75x.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/icons/icon@2x.png b/sdkjs-plugins/content/news/resources/store/icons/icon@2x.png
new file mode 100644
index 00000000..0a2e3853
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/icons/icon@2x.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/screenshots/screenshot1.png b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot1.png
new file mode 100644
index 00000000..20798010
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot1.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/screenshots/screenshot2.png b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot2.png
new file mode 100644
index 00000000..7916b396
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot2.png differ
diff --git a/sdkjs-plugins/content/news/resources/store/screenshots/screenshot3.png b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot3.png
new file mode 100644
index 00000000..f96df2b8
Binary files /dev/null and b/sdkjs-plugins/content/news/resources/store/screenshots/screenshot3.png differ
diff --git a/sdkjs-plugins/content/news/resources/style/style.css b/sdkjs-plugins/content/news/resources/style/style.css
new file mode 100644
index 00000000..ee2d27da
--- /dev/null
+++ b/sdkjs-plugins/content/news/resources/style/style.css
@@ -0,0 +1,344 @@
+:root {
+ /* Common variables */
+ --space: 8px;
+ --space-lg: 16px;
+
+ --font-family: Arial, sans-serif;
+ --font-size: 12px;
+ --font-size-sm: 10px;
+}
+
+/* Light Theme (Default) */
+body, body[data-theme="light"] {
+ --color-primary: #333;
+ --color-text: #333;
+ --color-text-muted: #666;
+ --color-border: #ddd;
+ --color-bg-hover: #f5f5f5;
+
+ --color-bg: #ffffff;
+ --color-bg-element: #ffffff;
+ --color-bg-subtle: #f8f9fa;
+
+ --color-success-bg: #d4edda;
+ --color-success-text: #155724;
+ --color-success-border: #c3e6cb;
+
+ --color-error-bg: #f8d7da;
+ --color-error-text: #721c24;
+ --color-error-border: #f5c6cb;
+}
+
+/* Dark Theme */
+body[data-theme="dark"] {
+ --color-primary: #ccc;
+ --color-text: #e0e0e0;
+ --color-text-muted: #999;
+ --color-border: #444;
+ --color-bg-hover: #2a2a2a;
+
+ --color-bg: #1a1a1a;
+ --color-bg-element: #2d2d2d;
+ --color-bg-subtle: #2d2d2d;
+
+ --color-success-bg: #1e4d2b;
+ --color-success-text: #90ee90;
+ --color-success-border: #2d5a34;
+
+ --color-error-bg: #4d1e1e;
+ --color-error-text: #ff9999;
+ --color-error-border: #5a2d2d;
+}
+
+* {
+ box-sizing: border-box;
+}
+
+body {
+ font: var(--font-size) var(--font-family);
+ padding: var(--space-lg);
+ margin: 0;
+ color: var(--color-text);
+ background-color: var(--color-bg);
+ height: 100vh;
+ transition: background-color 0.2s, color 0.2s;
+}
+
+input,
+select,
+textarea {
+ width: 100%;
+ padding: var(--space);
+ border: 1px solid var(--color-border);
+ border-radius: 4px;
+ font-size: var(--font-size);
+ font-family: var(--font-family);
+ background-color: var(--color-bg-element);
+ color: var(--color-text);
+}
+
+select option {
+ background-color: var(--color-bg-element);
+ color: var(--color-text);
+}
+
+label {
+ display: block;
+ margin-bottom: var(--space);
+ font-weight: bold;
+ color: var(--color-text);
+}
+
+.btn,
+button,
+.insert-btn,
+.tab-btn {
+ padding: var(--space) var(--space-lg);
+ border: 1px solid var(--color-border);
+ border-radius: 1px;
+ background: var(--color-bg-element);
+ color: var(--color-text);
+ cursor: pointer;
+ font-size: var(--font-size);
+ text-decoration: none;
+ display: inline-block;
+ transition: all 0.2s;
+ width: 100%;
+}
+
+.btn-link {
+ padding: 0;
+ background: none;
+ border: none;
+ text-decoration: underline;
+ text-align: left;
+ color: var(--color-primary);
+}
+
+.btn-back {
+ background: var(--color-bg-element);
+ border: none;
+ padding: var(--space) var(--space-lg);
+ font-size: var(--font-size);
+ color: var(--color-text);
+}
+
+.btn:hover,
+button:hover,
+.insert-btn:hover,
+.btn-back:hover,
+.btn-link:hover,
+.tab-btn:hover {
+ background: var(--color-bg-hover);
+}
+
+.btn-small {
+ padding: 4px var(--space);
+ font-size: var(--font-size-sm);
+}
+
+.form-group,
+.button-group,
+.filter-section {
+ margin-bottom: var(--space-lg);
+}
+
+.filter-header {
+ font-weight: bold;
+ margin-bottom: var(--space);
+ color: var(--color-text);
+}
+
+.results-section {
+ margin-top: var(--space-lg);
+ border-top: 1px solid var(--color-border);
+ padding-top: var(--space-lg);
+}
+
+/* Scrolling support for main containers */
+.setup-screen,
+.search-screen {
+ max-height: 100vh;
+}
+
+.search-form-container,
+.results-section {
+ max-height: calc(100vh - 100px);
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+.articles-container {
+ max-height: calc(100vh - 200px);
+ overflow-y: auto;
+ overflow-x: hidden;
+}
+
+.article-item {
+ padding: var(--space-lg);
+ border-bottom: 1px solid var(--color-border);
+ cursor: pointer;
+ transition: background 0.2s;
+}
+
+.article-item:hover {
+ background: var(--color-bg-hover);
+}
+
+.article-title {
+ font-weight: bold;
+ margin-bottom: var(--space);
+ color: var(--color-text);
+}
+
+.article-description {
+ font-size: var(--font-size-sm);
+ margin-bottom: var(--space);
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ color: var(--color-text);
+}
+
+.article-meta {
+ font-size: var(--font-size-sm);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: var(--space);
+ color: var(--color-text-muted);
+}
+
+.article-meta .open-icon {
+ cursor: pointer;
+ width: 16px;
+ height: 16px;
+ opacity: 0.7;
+ transition: opacity 0.2s;
+ color: var(--color-text-muted);
+}
+
+.article-meta .open-icon:hover {
+ opacity: 1;
+}
+
+#status {
+ padding: var(--space);
+ border-radius: 4px;
+ margin-top: var(--space);
+}
+
+.success {
+ background: var(--color-success-bg);
+ color: var(--color-success-text);
+ border: 1px solid var(--color-success-border);
+}
+
+.error {
+ background: var(--color-error-bg);
+ color: var(--color-error-text);
+ border: 1px solid var(--color-error-border);
+}
+
+.tab-navigation {
+ display: flex;
+ border-bottom: 1px solid var(--color-border);
+ margin-bottom: var(--space-lg);
+}
+
+.tab-btn {
+ flex: 1;
+ border: none;
+ border-bottom: 1px solid var(--color-border);
+ background: none;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: var(--space);
+ color: var(--color-text-muted);
+ padding: var(--space-lg);
+}
+
+.tab-btn svg {
+ width: 16px;
+ height: 16px;
+}
+
+.tab-btn.active {
+ color: var(--color-primary);
+ border-bottom: none;
+ font-weight: bold;
+ background: var(--color-bg);
+ margin-bottom: -1px;
+}
+
+.tab-btn:not(.active) {
+ color: var(--color-text-muted);
+}
+
+.tab-btn:hover:not(.active) {
+ color: var(--color-text);
+ background: var(--color-bg-hover);
+}
+
+.no-results {
+ text-align: center;
+ font-style: italic;
+ padding: var(--space-lg);
+ color: var(--color-text-muted);
+}
+
+.settings-actions .btn-link {
+ text-decoration: underline dotted;
+ display: block;
+ margin-bottom: var(--space);
+}
+
+.checkbox-item {
+ display: flex;
+ align-items: center;
+ margin-bottom: var(--space);
+ color: var(--color-text);
+}
+
+.checkbox-item input {
+ width: auto;
+ margin-right: var(--space);
+}
+
+.help-text {
+ font-size: var(--font-size-sm);
+ margin-top: var(--space);
+ color: var(--color-text-muted);
+}
+
+.help-text a {
+ color: var(--color-primary);
+}
+
+.api-info {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: var(--space);
+ background: var(--color-bg-subtle);
+ border-radius: 4px;
+ margin-bottom: var(--space-lg);
+ color: var(--color-text);
+}
+
+.results-header-container {
+ display: flex;
+ align-items: center;
+ gap: var(--space);
+ margin-bottom: var(--space-lg);
+}
+
+.results-header {
+ color: var(--color-text);
+}
+
+.setup-header p {
+ color: var(--color-text-muted);
+}
diff --git a/sdkjs-plugins/content/news/scripts/api.js b/sdkjs-plugins/content/news/scripts/api.js
new file mode 100644
index 00000000..cccb4885
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/api.js
@@ -0,0 +1,192 @@
+/**
+ * API Manager for News Plugin
+ * Handles all interactions with news APIs
+ */
+
+(function (window) {
+ "use strict";
+
+ /**
+ * API Manager
+ */
+ var APIManager = {
+ apiKey: "",
+ provider: null,
+
+ /**
+ * Set the API key for subsequent requests
+ * @param {string} key - The API key
+ */
+ setApiKey: function (key) {
+ this.apiKey = key;
+ },
+
+ /**
+ * Set the provider for subsequent requests
+ * @param {string} providerId - The provider ID
+ */
+ setProvider: function (providerId) {
+ this.provider = window.NewsProviders.setProvider(providerId);
+ },
+
+ /**
+ * Get current provider
+ */
+ getProvider: function () {
+ return this.provider || window.NewsProviders.getCurrentProvider();
+ },
+
+ /**
+ * Build URL with query parameters
+ * @param {string} base - Base URL
+ * @param {object} params - Query parameters
+ * @returns {string} - Complete URL with parameters
+ */
+ buildUrl: function (base, params) {
+ const url = new URL(base);
+ Object.keys(params).forEach(function (key) {
+ if (params[key] !== null && params[key] !== undefined && params[key] !== "") {
+ url.searchParams.append(key, params[key]);
+ }
+ });
+ return url.toString();
+ },
+
+ /**
+ * Perform a generic API call
+ * @param {string} url - The API endpoint URL
+ * @param {function} callback - Callback function(result)
+ */
+ performAPICall: function (url, callback) {
+ var provider = this.getProvider();
+
+ // Prepare fetch options
+ var fetchOptions = {
+ method: 'GET',
+ };
+
+ // WorldNewsAPI uses header-based authentication
+ if (provider.id === 'worldnewsapi') {
+ fetchOptions.headers = {
+ 'x-api-key': this.apiKey,
+ };
+ }
+
+ fetch(url, fetchOptions)
+ .then(function (response) {
+ if (response.ok) return response.json();
+
+ // Handle specific HTTP errors
+ throw new Error(
+ response.status === 401
+ ? "Invalid API token"
+ : response.status === 429
+ ? "API rate limit exceeded"
+ : response.status === 400
+ ? "Bad request - check your parameters"
+ : "HTTP " + response.status
+ );
+ })
+ .then(function (data) {
+ // Use provider-specific response parser
+ var result = provider.parseResponse(data);
+ callback(result);
+ })
+ .catch(function (error) {
+ console.error("API error:", error);
+
+ const message = error.message.includes("Invalid API token")
+ ? "Invalid API token. Please check your token and try again."
+ : error.message.includes("rate limit")
+ ? "API rate limit exceeded. Please try again later."
+ : error.message.includes("CORS")
+ ? "Network error: CORS issue"
+ : "API failed: " + error.message;
+
+ callback({ success: false, error: message, articles: [] });
+ });
+ },
+
+ /**
+ * Validate an API key
+ * @param {string} apiKey - The API key to validate
+ * @param {function} callback - Callback function(isValid, message)
+ */
+ validateApiKey: function (apiKey, callback) {
+ try {
+ var provider = this.getProvider();
+ const testUrl = provider.buildValidationUrl(apiKey);
+
+ // Prepare fetch options
+ var fetchOptions = {
+ method: 'GET',
+ };
+
+ // WorldNewsAPI uses header-based authentication
+ if (provider.id === 'worldnewsapi') {
+ fetchOptions.headers = {
+ 'x-api-key': apiKey,
+ };
+ }
+
+ fetch(testUrl, fetchOptions)
+ .then(function (response) {
+ if (response.ok) return response.json();
+ throw new Error(
+ response.status === 401
+ ? "Invalid API token"
+ : "API validation failed"
+ );
+ })
+ .then(function (data) {
+ callback(true, "API key is valid");
+ })
+ .catch(function (error) {
+ console.error("Validation error:", error);
+ callback(false, error.message);
+ });
+ } catch (error) {
+ console.error("Validation error:", error);
+ callback(false, "Error validating API key: " + error.message);
+ }
+ },
+
+ /**
+ * Search for articles
+ * @param {string} query - Search query
+ * @param {object} settings - Additional settings (language, sortBy, etc.)
+ * @param {function} callback - Callback function(result)
+ */
+ search: function (query, settings, callback) {
+ try {
+ var provider = this.getProvider();
+ const searchUrl = provider.buildSearchUrl(this.apiKey, query, settings);
+
+ this.performAPICall(searchUrl, callback);
+ } catch (error) {
+ console.error("Search error:", error);
+ callback({ success: false, error: error.message, articles: [] });
+ }
+ },
+
+ /**
+ * Get top headlines
+ * @param {object} params - Parameters (category, country, language, query)
+ * @param {function} callback - Callback function(result)
+ */
+ getTopHeadlines: function (params, callback) {
+ try {
+ var provider = this.getProvider();
+ const headlinesUrl = provider.buildHeadlinesUrl(this.apiKey, params);
+
+ this.performAPICall(headlinesUrl, callback);
+ } catch (error) {
+ console.error("Headlines error:", error);
+ callback({ success: false, error: error.message, articles: [] });
+ }
+ },
+ };
+
+ // Export to global scope
+ window.GNewsAPI = APIManager;
+})(window);
diff --git a/sdkjs-plugins/content/news/scripts/code_new.js b/sdkjs-plugins/content/news/scripts/code_new.js
new file mode 100644
index 00000000..be32e090
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/code_new.js
@@ -0,0 +1,383 @@
+/**
+ * News Plugin - Main Entry Point
+ * Coordinates between API, UI, Storage, and Translation modules
+ */
+
+(function (window, undefined) {
+ "use strict";
+
+ // Plugin state
+ let savedApiKey = "";
+ let savedProvider = "gnews";
+
+ /**
+ * Initialize the plugin
+ */
+ window.Asc.plugin.init = function () {
+ try {
+ // Load saved provider
+ savedProvider = window.GNewsStorage.loadProvider();
+ window.GNewsAPI.setProvider(savedProvider);
+ window.NewsProviders.setProvider(savedProvider);
+ console.log("Loaded provider:", savedProvider);
+
+ // Load saved API key
+ savedApiKey = window.GNewsStorage.loadApiKey();
+ if (savedApiKey) {
+ window.GNewsAPI.setApiKey(savedApiKey);
+ console.log("Loaded API key from storage");
+ }
+
+ // Initialize UI after a short delay
+ setTimeout(function () {
+ window.GNewsUI.initializeDisplayOptions();
+ window.GNewsUI.createAdvancedSettings();
+ window.GNewsUI.initializeProviderSelector(savedProvider);
+ window.GNewsUI.updateProviderInfo();
+
+ if (savedApiKey) {
+ window.GNewsUI.showSearchInterface();
+ setTimeout(function () {
+ const searchInput = window.GNewsUI.$("search-query");
+ if (searchInput) searchInput.focus();
+ }, 100);
+ } else {
+ window.GNewsUI.showApiSetup();
+ }
+
+ setupEventListeners();
+ window.GNewsTranslations.applyTranslations();
+ }, 50);
+ } catch (error) {
+ console.error("Init error:", error);
+ }
+ };
+
+ /**
+ * Handle theme changes
+ */
+ window.Asc.plugin.onThemeChanged = function (theme) {
+ // Set the data-theme attribute on the body
+ document.body.setAttribute("data-theme", theme.type);
+ console.log("Applied theme:", theme.type);
+ };
+
+ /**
+ * Handle translation changes
+ */
+ window.Asc.plugin.onTranslate = function () {
+ window.GNewsTranslations.applyTranslations();
+ };
+
+ /**
+ * Setup event listeners for Enter key support
+ */
+ function setupEventListeners() {
+ const apiKeyInput = window.GNewsUI.$("api-key-setup");
+ const queryInput = window.GNewsUI.$("search-query");
+ const headlinesQueryInput = window.GNewsUI.$("headlines-query");
+
+ if (apiKeyInput) {
+ apiKeyInput.addEventListener("keypress", function (e) {
+ if (e.key === "Enter") {
+ window.saveApiKey();
+ }
+ });
+ }
+
+ if (queryInput) {
+ queryInput.addEventListener("keypress", function (e) {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ window.searchNews();
+ }
+ });
+ }
+
+ if (headlinesQueryInput) {
+ headlinesQueryInput.addEventListener("keypress", function (e) {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ window.getTopHeadlines();
+ }
+ });
+ }
+ }
+
+ /**
+ * Save and validate API key
+ */
+ window.saveApiKey = function () {
+ const apiKeyInput = window.GNewsUI.$("api-key-setup");
+ const apiKey = apiKeyInput.value.trim();
+
+ if (!apiKey) {
+ window.GNewsUI.showStatus("Please enter an API key", true);
+ return;
+ }
+
+ if (apiKey.length < 10) {
+ window.GNewsUI.showStatus("API key seems too short", true);
+ return;
+ }
+
+ window.GNewsUI.setElementState("save-api-btn", true, "Validating...");
+ window.GNewsUI.showStatus("Validating API token...", false);
+
+ window.GNewsAPI.validateApiKey(apiKey, function (isValid, message) {
+ window.GNewsUI.setElementState("save-api-btn", false, "Login");
+
+ if (isValid) {
+ savedApiKey = apiKey;
+ window.GNewsAPI.setApiKey(apiKey);
+
+ if (window.GNewsStorage.saveApiKey(apiKey)) {
+ window.GNewsUI.showStatus("API key saved successfully!", false);
+ } else {
+ window.GNewsUI.showStatus(
+ "API key validated but couldn't save to storage",
+ true
+ );
+ }
+
+ setTimeout(function () {
+ window.GNewsUI.showSearchInterface();
+ const searchInput = window.GNewsUI.$("search-query");
+ if (searchInput) searchInput.focus();
+ }, 1000);
+ } else {
+ window.GNewsUI.showStatus(message || "Invalid API key", true);
+ }
+ });
+ };
+
+ /**
+ * Change/reconfigure API key
+ */
+ window.changeApiKey = function () {
+ savedApiKey = "";
+ window.GNewsAPI.setApiKey("");
+
+ if (window.GNewsStorage.removeApiKey()) {
+ window.GNewsUI.showStatus("API key removed", false);
+ } else {
+ window.GNewsUI.showStatus("Couldn't remove API key from storage", true);
+ }
+
+ window.GNewsUI.showApiSetup();
+ const apiKeyInput = window.GNewsUI.$("api-key-setup");
+ if (apiKeyInput) {
+ apiKeyInput.value = "";
+ apiKeyInput.focus();
+ }
+
+ const status = window.GNewsUI.$("status");
+ if (status) {
+ setTimeout(function () {
+ status.textContent = "";
+ status.className = "";
+ }, 2000);
+ }
+ };
+
+ /**
+ * Change provider
+ */
+ window.changeProvider = function () {
+ const providerSelect = window.GNewsUI.$("provider-select");
+ if (!providerSelect) return;
+
+ const newProvider = providerSelect.value;
+ savedProvider = newProvider;
+
+ window.GNewsAPI.setProvider(newProvider);
+ window.NewsProviders.setProvider(newProvider);
+ window.GNewsStorage.saveProvider(newProvider);
+ window.GNewsUI.currentProvider = newProvider;
+ window.GNewsUI.updateProviderInfo();
+
+
+ // Clear API key since different providers need different keys
+ if (savedApiKey) {
+ window.GNewsUI.showStatus(
+ "Provider changed. Please enter your API key for " +
+ window.NewsProviders.getCurrentProvider().name,
+ false
+ );
+ savedApiKey = "";
+ window.GNewsAPI.setApiKey("");
+ window.GNewsStorage.removeApiKey();
+
+ const apiKeyInput = window.GNewsUI.$("api-key-setup");
+ if (apiKeyInput) {
+ apiKeyInput.value = "";
+ }
+ }
+ };
+
+ /**
+ * Switch between tabs
+ */
+ window.switchTab = function (tabName) {
+ window.GNewsUI.switchTab(tabName);
+ };
+
+ /**
+ * Toggle advanced settings
+ */
+ window.toggleAdvancedSettings = function () {
+ window.GNewsUI.toggleAdvancedSettings();
+ };
+
+ window.advancedSettings = function () {
+ window.toggleAdvancedSettings();
+ };
+
+ /**
+ * Perform news search
+ */
+ window.searchNews = function () {
+ const queryInput = window.GNewsUI.$("search-query");
+ if (!queryInput) {
+ window.GNewsUI.showStatus("Search input not found", true);
+ return;
+ }
+
+ const query = queryInput.value.trim();
+ if (!query) {
+ window.GNewsUI.showStatus("Please enter a search query", true);
+ return;
+ }
+
+ if (!savedApiKey) {
+ window.GNewsUI.showStatus("Please configure your API key first", true);
+ return;
+ }
+
+ window.GNewsUI.setElementState("search-btn", true, "Searching...");
+ window.GNewsUI.showStatus("Searching...", false);
+
+ const settings = window.GNewsUI.getAdvancedSettings("search");
+
+ window.GNewsAPI.search(query, settings, function (result) {
+ window.GNewsUI.setElementState("search-btn", false, "Find");
+
+ if (result.success) {
+ window.GNewsUI.displaySearchResults(result.articles, true);
+ } else {
+ window.GNewsUI.showStatus(result.error || "Search failed", true);
+ }
+ });
+ };
+
+ /**
+ * Get top headlines
+ */
+ window.getTopHeadlines = function () {
+ if (!savedApiKey) {
+ window.GNewsUI.showStatus("Please configure your API key first", true);
+ return;
+ }
+
+ const query = window.GNewsUI.$("headlines-query").value;
+ const category = window.GNewsUI.$("headlines-category").value;
+ const country = window.GNewsUI.$("headlines-country").value;
+ const settings = window.GNewsUI.getAdvancedSettings("headlines");
+
+ window.GNewsUI.setElementState("headlines-btn", true, "Loading...");
+ window.GNewsUI.showStatus("Loading headlines...", false);
+
+ const params = {
+ category: category,
+ country: country,
+ language: settings.language,
+ query: query,
+ domains: settings.domains,
+ exclude_domains: settings.exclude_domains,
+ };
+
+ window.GNewsAPI.getTopHeadlines(params, function (result) {
+ window.GNewsUI.setElementState("headlines-btn", false, "Find");
+
+ if (result.success) {
+ window.GNewsUI.displaySearchResults(result.articles, true);
+ } else {
+ window.GNewsUI.showStatus(result.error || "Failed to load headlines", true);
+ }
+ });
+ };
+
+ /**
+ * Insert single article (open in browser)
+ */
+ window.insertSingleArticle = function (index) {
+ if (index < 0 || index >= window.GNewsUI.currentArticles.length) {
+ window.GNewsUI.showStatus("Invalid article index", true);
+ return;
+ }
+
+ const article = window.GNewsUI.currentArticles[index];
+ window.GNewsUI.openArticleLink(article);
+ };
+
+ /**
+ * Go back to search form
+ */
+ window.goBackToSearch = function () {
+ window.GNewsUI.goBackToSearch();
+ };
+
+ /**
+ * Clear results
+ */
+ window.clearResults = function () {
+ window.GNewsUI.goBackToSearch();
+ };
+
+ /**
+ * Update article display when checkboxes change
+ */
+ window.updateArticleDisplay = function () {
+ if (window.GNewsUI.currentArticles.length > 0) {
+ window.GNewsUI.displaySearchResults(window.GNewsUI.currentArticles, false);
+ }
+ };
+
+ /**
+ * Handle plugin button clicks
+ */
+ window.Asc.plugin.button = function (id) {
+ if (id === -1 || id === 0) {
+ this.executeCommand("close", "");
+ }
+ };
+
+ /**
+ * Handle external mouse events
+ */
+ window.Asc.plugin.onExternalMouseUp = function () {
+ return false;
+ };
+
+ /**
+ * Handle beforeunload event
+ */
+ window.addEventListener("beforeunload", function (e) {
+ window.GNewsUI.currentArticles = [];
+ window.GNewsUI.currentTab = "search";
+ });
+
+ /**
+ * Handle plugin commands
+ */
+ window.Asc.plugin.executeCommand = function (command, data) {
+ if (command === "close") {
+ this.executeCommand("close", "");
+ }
+ };
+
+ /**
+ * Handle method return values
+ */
+ window.Asc.plugin.onMethodReturn = function (returnValue) {};
+})(window, undefined);
diff --git a/sdkjs-plugins/content/news/scripts/providers.js b/sdkjs-plugins/content/news/scripts/providers.js
new file mode 100644
index 00000000..73839dec
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/providers.js
@@ -0,0 +1,421 @@
+/**
+ * News API Providers Configuration
+ * Defines available news API providers and their configurations
+ */
+
+(function (window) {
+ "use strict";
+
+ /**
+ * Provider Configurations
+ */
+ var Providers = {
+ GNEWS: {
+ id: "gnews",
+ name: "GNews",
+ baseUrl: "https://gnews.io/api/v4",
+ website: "https://gnews.io",
+
+ // API endpoints
+ endpoints: {
+ search: "/search",
+ topHeadlines: "/top-headlines",
+ },
+
+ // Build search URL
+ buildSearchUrl: function (apiKey, query, settings) {
+ var urlParams = {
+ q: query,
+ token: apiKey,
+ lang: settings.language || "en",
+ sortby: settings.sortBy || "publishedAt",
+ country: settings.country || "us",
+ };
+
+ // Add "in" parameter (search in title, description, or content)
+ if (settings.searchIn) {
+ urlParams.in = settings.searchIn;
+ }
+
+ return this.buildUrl(this.baseUrl + this.endpoints.search, urlParams);
+ },
+
+ // Build top headlines URL
+ buildHeadlinesUrl: function (apiKey, params) {
+ var urlParams = {
+ token: apiKey,
+ lang: params.language || "en",
+ };
+ if (params.category) urlParams.category = params.category;
+ if (params.country) urlParams.country = params.country;
+ if (params.query) urlParams.q = params.query;
+
+ return this.buildUrl(this.baseUrl + this.endpoints.topHeadlines, urlParams);
+ },
+
+ // Build validation URL
+ buildValidationUrl: function (apiKey) {
+ return this.buildUrl(this.baseUrl + this.endpoints.search, {
+ q: "technology",
+ token: apiKey,
+ max: 1,
+ lang: "en",
+ });
+ },
+
+ // Parse API response
+ parseResponse: function (data) {
+ if (data.articles && Array.isArray(data.articles)) {
+ return {
+ success: true,
+ articles: data.articles.map(function (article) {
+ return {
+ title: article.title,
+ description: article.description,
+ content: article.content,
+ url: article.url,
+ publishedAt: article.publishedAt,
+ source: article.source,
+ };
+ }),
+ };
+ }
+ return {
+ success: false,
+ error: data.errors ? data.errors.join(", ") : "No articles found",
+ articles: [],
+ };
+ },
+
+ // Helper to build URL with params
+ buildUrl: function (base, params) {
+ var url = new URL(base);
+ Object.keys(params).forEach(function (key) {
+ if (params[key] !== null && params[key] !== undefined && params[key] !== "") {
+ url.searchParams.append(key, params[key]);
+ }
+ });
+ return url.toString();
+ },
+ },
+
+ THENEWSAPI: {
+ id: "thenewsapi",
+ name: "TheNewsAPI",
+ baseUrl: "https://api.thenewsapi.com/v1/news",
+ website: "https://www.thenewsapi.com",
+
+ // API endpoints
+ endpoints: {
+ search: "/all",
+ topHeadlines: "/top",
+ },
+
+ // Build search URL
+ buildSearchUrl: function (apiKey, query, settings) {
+ var urlParams = {
+ search: query,
+ api_token: apiKey,
+ language: settings.language || "en",
+ sort: settings.sortBy === "relevance" ? "relevance_score" : "published_at",
+ };
+
+ // Add domains filter if provided
+ if (settings.domains && settings.domains.trim() !== "") {
+ urlParams.domains = settings.domains.trim();
+ }
+
+ // Add search_fields if provided (for searching in specific fields)
+ if (settings.search_fields && settings.search_fields.trim() !== "") {
+ urlParams.search_fields = settings.search_fields.trim();
+ }
+
+ // Add exclude_domains if provided
+ if (settings.exclude_domains && settings.exclude_domains.trim() !== "") {
+ urlParams.exclude_domains = settings.exclude_domains.trim();
+ }
+
+ return this.buildUrl(this.baseUrl + this.endpoints.search, urlParams);
+ },
+
+ // Build top headlines URL
+ buildHeadlinesUrl: function (apiKey, params) {
+ var urlParams = {
+ api_token: apiKey,
+ language: params.language || "en",
+ };
+
+ // Add locale (country) parameter
+ if (params.country) {
+ urlParams.locale = params.country;
+ }
+
+ // Add categories filter if provided
+ if (params.category && params.category !== "") {
+ urlParams.categories = params.category;
+ }
+
+ // Add search query if provided
+ if (params.query && params.query.trim() !== "") {
+ urlParams.search = params.query.trim();
+ }
+
+ // Add domains filter if provided
+ if (params.domains && params.domains.trim() !== "") {
+ urlParams.domains = params.domains.trim();
+ }
+
+ // Add exclude_domains if provided
+ if (params.exclude_domains && params.exclude_domains.trim() !== "") {
+ urlParams.exclude_domains = params.exclude_domains.trim();
+ }
+
+ return this.buildUrl(this.baseUrl + this.endpoints.topHeadlines, urlParams);
+ },
+
+ // Build validation URL
+ buildValidationUrl: function (apiKey) {
+ return this.buildUrl(this.baseUrl + this.endpoints.search, {
+ search: "technology",
+ api_token: apiKey,
+ limit: 1,
+ language: "en",
+ });
+ },
+
+ // Parse API response
+ parseResponse: function (data) {
+ if (data.data && Array.isArray(data.data)) {
+ return {
+ success: true,
+ articles: data.data.map(function (article) {
+ return {
+ title: article.title,
+ description: article.description || article.snippet,
+ content: article.snippet || article.description,
+ url: article.url,
+ publishedAt: article.published_at,
+ source: {
+ name: article.source || "Unknown",
+ },
+ };
+ }),
+ };
+ }
+ return {
+ success: false,
+ error: data.error ? data.error.message : "No articles found",
+ articles: [],
+ };
+ },
+
+ // Helper to build URL with params
+ buildUrl: function (base, params) {
+ var url = new URL(base);
+ Object.keys(params).forEach(function (key) {
+ if (params[key] !== null && params[key] !== undefined && params[key] !== "") {
+ url.searchParams.append(key, params[key]);
+ }
+ });
+ return url.toString();
+ },
+ },
+
+ WORLDNEWSAPI: {
+ id: "worldnewsapi",
+ name: "WorldNewsAPI",
+ baseUrl: "https://api.worldnewsapi.com",
+ website: "https://worldnewsapi.com",
+
+ // API endpoints
+ endpoints: {
+ search: "/search-news",
+ topHeadlines: "/top-news",
+ },
+
+ // Build search URL
+ buildSearchUrl: function (apiKey, query, settings) {
+ var urlParams = {
+ text: query,
+ language: settings.language || "en",
+ number: 100,
+ };
+
+ // WorldNewsAPI only supports 'publish-time' or empty for sort
+ // 'publish-time' = sort by date, empty/omitted = sort by relevance (default)
+ if (settings.sortBy && settings.sortBy === "publish-time") {
+ urlParams.sort = "publish-time";
+ }
+ // If sortBy is 'relevance' or anything else, don't add sort parameter (defaults to relevance)
+
+ // Add text-match-indexes (search in title, content, or both)
+ if (settings.searchIn) {
+ var searchInMap = {
+ 'title': 'title',
+ 'description': 'content',
+ 'content': 'content',
+ 'title,description': 'title,content',
+ 'title,content': 'title,content'
+ };
+ urlParams["text-match-indexes"] = searchInMap[settings.searchIn] || 'title,content';
+ }
+
+ // Add source-country if provided
+ if (settings.country) {
+ urlParams["source-country"] = settings.country;
+ }
+
+ // Add news-sources filter if provided
+ if (settings.domains && settings.domains.trim() !== "") {
+ urlParams["news-sources"] = settings.domains.trim();
+ }
+
+ // Add categories filter if provided
+ if (settings.categories && settings.categories.trim() !== "") {
+ urlParams.categories = settings.categories.trim();
+ }
+
+ // Add authors filter if provided
+ if (settings.authors && settings.authors.trim() !== "") {
+ urlParams.authors = settings.authors.trim();
+ }
+
+ return this.buildUrl(this.baseUrl + this.endpoints.search, urlParams);
+ },
+
+ // Build top headlines URL
+ buildHeadlinesUrl: function (apiKey, params) {
+ var urlParams = {
+ language: params.language || "en",
+ };
+
+ // source-country is required for top-news endpoint
+ urlParams["source-country"] = params.country || "us";
+
+ // Add date if needed (defaults to today)
+ if (params.date) {
+ urlParams.date = params.date;
+ }
+
+ // Add headlines-only parameter if needed
+ if (params.headlinesOnly) {
+ urlParams["headlines-only"] = true;
+ }
+
+ return this.buildUrl(this.baseUrl + this.endpoints.topHeadlines, urlParams);
+ },
+
+ // Build validation URL
+ buildValidationUrl: function (apiKey) {
+ return this.buildUrl(this.baseUrl + this.endpoints.search, {
+ text: "technology",
+ language: "en",
+ number: 1,
+ });
+ },
+
+ // Parse API response
+ parseResponse: function (data) {
+ // Handle search-news response
+ if (data.news && Array.isArray(data.news)) {
+ return {
+ success: true,
+ articles: data.news.map(function (article) {
+ return {
+ title: article.title,
+ description: article.summary || article.text,
+ content: article.text,
+ url: article.url,
+ publishedAt: article.publish_date,
+ source: {
+ name: article.source_country || "Unknown",
+ },
+ };
+ }),
+ };
+ }
+
+ // Handle top-news response (clustered news)
+ if (data.top_news && Array.isArray(data.top_news)) {
+ var allArticles = [];
+ data.top_news.forEach(function (cluster) {
+ if (cluster.news && Array.isArray(cluster.news)) {
+ cluster.news.forEach(function (article) {
+ allArticles.push({
+ title: article.title,
+ description: article.summary || article.text,
+ content: article.text,
+ url: article.url,
+ publishedAt: article.publish_date,
+ source: {
+ name: article.source_country || data.country || "Unknown",
+ },
+ });
+ });
+ }
+ });
+ return {
+ success: true,
+ articles: allArticles,
+ };
+ }
+
+ return {
+ success: false,
+ error: data.message || "No articles found",
+ articles: [],
+ };
+ },
+
+ // Helper to build URL with params
+ buildUrl: function (base, params) {
+ var url = new URL(base);
+ Object.keys(params).forEach(function (key) {
+ if (params[key] !== null && params[key] !== undefined && params[key] !== "") {
+ url.searchParams.append(key, params[key]);
+ }
+ });
+ return url.toString();
+ },
+ },
+ };
+
+ /**
+ * Provider Manager
+ */
+ var ProviderManager = {
+ currentProvider: null,
+
+ /**
+ * Get all available providers
+ */
+ getProviders: function () {
+ return [Providers.GNEWS, Providers.THENEWSAPI, Providers.WORLDNEWSAPI];
+ },
+
+ /**
+ * Get provider by ID
+ */
+ getProvider: function (providerId) {
+ return Providers[providerId.toUpperCase()] || null;
+ },
+
+ /**
+ * Set current provider
+ */
+ setProvider: function (providerId) {
+ this.currentProvider = this.getProvider(providerId);
+ return this.currentProvider;
+ },
+
+ /**
+ * Get current provider
+ */
+ getCurrentProvider: function () {
+ return this.currentProvider || Providers.GNEWS;
+ },
+ };
+
+ // Export to global scope
+ window.NewsProviders = ProviderManager;
+})(window);
diff --git a/sdkjs-plugins/content/news/scripts/storage.js b/sdkjs-plugins/content/news/scripts/storage.js
new file mode 100644
index 00000000..1b5e71e1
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/storage.js
@@ -0,0 +1,141 @@
+/**
+ * Storage Manager for News Plugin
+ * Handles all localStorage operations for API key persistence
+ */
+
+(function (window) {
+ "use strict";
+
+ const STORAGE_KEY = "news-api-key";
+ const PROVIDER_KEY = "news-provider";
+
+ /**
+ * Storage Manager
+ */
+ var StorageManager = {
+ /**
+ * Check if localStorage is available
+ */
+ isAvailable: function () {
+ try {
+ return "localStorage" in window && window.localStorage !== null;
+ } catch (e) {
+ console.error("localStorage not available:", e);
+ return false;
+ }
+ },
+
+ /**
+ * Save API key to localStorage
+ * @param {string} apiKey - The API key to save
+ * @returns {boolean} - Success status
+ */
+ saveApiKey: function (apiKey) {
+ if (!this.isAvailable()) {
+ console.error("localStorage is not available");
+ return false;
+ }
+
+ try {
+ localStorage.setItem(STORAGE_KEY, apiKey);
+ return true;
+ } catch (error) {
+ console.error("Failed to save API key to localStorage:", error);
+ return false;
+ }
+ },
+
+ /**
+ * Load API key from localStorage
+ * @returns {string} - The stored API key or empty string
+ */
+ loadApiKey: function () {
+ if (!this.isAvailable()) {
+ return "";
+ }
+
+ try {
+ return localStorage.getItem(STORAGE_KEY) || "";
+ } catch (error) {
+ console.error("Failed to load API key from localStorage:", error);
+ return "";
+ }
+ },
+
+ /**
+ * Remove API key from localStorage
+ * @returns {boolean} - Success status
+ */
+ removeApiKey: function () {
+ if (!this.isAvailable()) {
+ return false;
+ }
+
+ try {
+ localStorage.removeItem(STORAGE_KEY);
+ return true;
+ } catch (error) {
+ console.error("Failed to remove API key from localStorage:", error);
+ return false;
+ }
+ },
+
+ /**
+ * Save provider selection to localStorage
+ * @param {string} providerId - The provider ID to save
+ * @returns {boolean} - Success status
+ */
+ saveProvider: function (providerId) {
+ if (!this.isAvailable()) {
+ console.error("localStorage is not available");
+ return false;
+ }
+
+ try {
+ localStorage.setItem(PROVIDER_KEY, providerId);
+ return true;
+ } catch (error) {
+ console.error("Failed to save provider to localStorage:", error);
+ return false;
+ }
+ },
+
+ /**
+ * Load provider selection from localStorage
+ * @returns {string} - The stored provider ID or "gnews" as default
+ */
+ loadProvider: function () {
+ if (!this.isAvailable()) {
+ return "gnews";
+ }
+
+ try {
+ return localStorage.getItem(PROVIDER_KEY) || "gnews";
+ } catch (error) {
+ console.error("Failed to load provider from localStorage:", error);
+ return "gnews";
+ }
+ },
+
+ /**
+ * Remove provider selection from localStorage
+ * @returns {boolean} - Success status
+ */
+ removeProvider: function () {
+ if (!this.isAvailable()) {
+ return false;
+ }
+
+ try {
+ localStorage.removeItem(PROVIDER_KEY);
+ return true;
+ } catch (error) {
+ console.error("Failed to remove provider from localStorage:", error);
+ return false;
+ }
+ },
+ };
+
+ // Export to global scope
+ window.GNewsStorage = StorageManager;
+})(window);
diff --git a/sdkjs-plugins/content/news/scripts/translations.js b/sdkjs-plugins/content/news/scripts/translations.js
new file mode 100644
index 00000000..adc790ed
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/translations.js
@@ -0,0 +1,215 @@
+/**
+ * Translation Manager for News Plugin
+ * Handles all UI translations
+ */
+
+(function (window) {
+ "use strict";
+
+ var TranslationManager = {
+ /**
+ * Helper function to get element by ID
+ */
+ $: function (id) {
+ return document.getElementById(id);
+ },
+
+ /**
+ * Safely translate element text content
+ */
+ translateElement: function (elementId, key) {
+ const element = this.$(elementId);
+ if (element && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ element.textContent = window.Asc.plugin.tr(key);
+ }
+ },
+
+ /**
+ * Safely translate input placeholder
+ */
+ translatePlaceholder: function (elementId, key) {
+ const element = this.$(elementId);
+ if (element && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ element.placeholder = window.Asc.plugin.tr(key);
+ }
+ },
+
+ /**
+ * Apply all translations to the UI
+ */
+ applyTranslations: function () {
+ // Main interface elements
+ this.translateElement("description-text", "Search through millions of articles");
+ this.translateElement("description-text-2", "Search through millions of articles");
+ this.translateElement("api-key-label", "API key");
+ this.translateElement("provider-label", "News Provider");
+ this.translatePlaceholder("api-key-setup", "Enter your API key");
+ this.translateElement("get-api-key-text", "Get your free API key");
+
+ // Check button text before translating
+ const saveApiBtn = this.$("save-api-btn");
+ if (saveApiBtn && saveApiBtn.textContent.trim() === "Login") {
+ this.translateElement("save-api-btn", "Login");
+ }
+
+ // Tab labels
+ this.translateElement("search-tab-text", "Search");
+ this.translateElement("headlines-tab-text", "Top Headlines");
+
+ // Form labels
+ this.translateElement("search-prompt-label", "Prompt");
+ this.translateElement("headlines-prompt-label", "Prompt");
+ this.translatePlaceholder("search-query", "Search with keywords");
+ this.translatePlaceholder("headlines-query", "Search with keywords");
+ this.translateElement("search-in-label", "Search in");
+ this.translateElement("title-label", "Title");
+ this.translateElement("description-label", "Description");
+ this.translateElement("content-label", "Content");
+ this.translateElement("advanced-settings-label", "Advanced Settings");
+ this.translateElement("headlines-advanced-settings-label", "Advanced Settings");
+
+ // Buttons
+ const searchBtn = this.$("search-btn");
+ if (searchBtn && searchBtn.textContent.trim() === "Find") {
+ this.translateElement("search-btn", "Find");
+ }
+
+ const headlinesBtn = this.$("headlines-btn");
+ if (headlinesBtn && headlinesBtn.textContent.trim() === "Find") {
+ this.translateElement("headlines-btn", "Find");
+ }
+
+ this.translateElement("advanced-settings-btn", "Show advanced settings");
+ this.translateElement("reconfigure-btn", "Reconfigure");
+ this.translateElement("back-to-search-btn", "Back to search");
+
+ // Category and country options
+ this.translateElement("category-label", "Category");
+ this.translateElement("country-label", "Country");
+
+ // Select options
+ this.translateSelectOptions();
+ this.translateAdvancedSettings();
+ },
+
+ /**
+ * Translate select dropdown options
+ */
+ translateSelectOptions: function () {
+ const options = [
+ { id: "all-categories-option", key: "All Categories" },
+ { id: "general-option", key: "General" },
+ { id: "business-option", key: "Business" },
+ { id: "entertainment-option", key: "Entertainment" },
+ { id: "health-option", key: "Health" },
+ { id: "science-option", key: "Science" },
+ { id: "sports-option", key: "Sports" },
+ { id: "technology-option", key: "Technology" },
+ { id: "us-option", key: "United States" },
+ { id: "gb-option", key: "United Kingdom" },
+ { id: "ca-option", key: "Canada" },
+ { id: "au-option", key: "Australia" },
+ { id: "de-option", key: "Germany" },
+ { id: "fr-option", key: "France" },
+ { id: "jp-option", key: "Japan" },
+ { id: "in-option", key: "India" },
+ ];
+
+ var self = this;
+ options.forEach(function (option) {
+ const element = self.$(option.id);
+ if (element && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ element.textContent = window.Asc.plugin.tr(option.key);
+ }
+ });
+ },
+
+ /**
+ * Translate advanced settings options
+ */
+ translateAdvancedSettings: function () {
+ var self = this;
+ ["search", "headlines"].forEach(function (prefix) {
+ const sortBySelect = self.$(prefix + "-sortby");
+ if (sortBySelect && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ const options = sortBySelect.querySelectorAll("option");
+ if (options[0]) {
+ options[0].textContent = window.Asc.plugin.tr("Publication Date");
+ }
+ if (options[1]) {
+ options[1].textContent = window.Asc.plugin.tr("Relevance");
+ }
+ }
+
+ const langSelect = self.$(prefix + "-lang");
+ if (langSelect && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ const langOptions = langSelect.querySelectorAll("option");
+ const langKeys = [
+ "English",
+ "Spanish",
+ "French",
+ "German",
+ "Italian",
+ "Portuguese",
+ "Japanese",
+ "Chinese",
+ "Arabic",
+ "Russian",
+ "Hindi",
+ "Korean",
+ ];
+ langOptions.forEach(function (option, index) {
+ if (langKeys[index]) {
+ option.textContent = window.Asc.plugin.tr(langKeys[index]);
+ }
+ });
+ }
+
+ // Translate domains label if it exists (TheNewsAPI only)
+ const domainsLabel = document.querySelector('label[for="' + prefix + '-domains"]');
+ if (domainsLabel && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ domainsLabel.textContent = window.Asc.plugin.tr("Domains") + ':';
+ }
+
+ // Translate domains placeholder if it exists
+ const domainsInput = self.$(prefix + "-domains");
+ if (domainsInput && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ domainsInput.placeholder = window.Asc.plugin.tr("e.g., bbc.co.uk, cnn.com");
+ }
+
+ // Translate authors label if it exists (WorldNewsAPI only)
+ const authorsLabel = document.querySelector('label[for="' + prefix + '-authors"]');
+ if (authorsLabel && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ authorsLabel.textContent = window.Asc.plugin.tr("Authors") + ':';
+ }
+
+ // Translate authors placeholder if it exists
+ const authorsInput = self.$(prefix + "-authors");
+ if (authorsInput && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ authorsInput.placeholder = window.Asc.plugin.tr("e.g., John Doe, Jane Smith");
+ }
+
+ // Translate categories label if it exists (WorldNewsAPI and TheNewsAPI)
+ const categoriesLabel = document.querySelector('label[for="' + prefix + '-categories"]');
+ if (categoriesLabel && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ categoriesLabel.textContent = window.Asc.plugin.tr("Categories Filter") + ':';
+ }
+
+ // Translate categories placeholder if it exists
+ const categoriesInput = self.$(prefix + "-categories");
+ if (categoriesInput && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ categoriesInput.placeholder = window.Asc.plugin.tr("e.g., politics, sports");
+ }
+
+ // Translate locale label if it exists (TheNewsAPI only)
+ const localeLabel = document.querySelector('label[for="' + prefix + '-locale"]');
+ if (localeLabel && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ localeLabel.textContent = window.Asc.plugin.tr("Locale") + ':';
+ }
+ });
+ },
+ };
+
+ // Export to global scope
+ window.GNewsTranslations = TranslationManager;
+})(window);
diff --git a/sdkjs-plugins/content/news/scripts/ui.js b/sdkjs-plugins/content/news/scripts/ui.js
new file mode 100644
index 00000000..4d71bb5f
--- /dev/null
+++ b/sdkjs-plugins/content/news/scripts/ui.js
@@ -0,0 +1,691 @@
+/**
+ * UI Manager for News Plugin
+ * Handles all UI state management and DOM manipulation
+ */
+
+(function (window) {
+ "use strict";
+
+ var UIManager = {
+ currentArticles: [],
+ currentTab: "search",
+ currentProvider: "gnews",
+
+ /**
+ * Helper function to get element by ID
+ */
+ $: function (id) {
+ return document.getElementById(id);
+ },
+
+ /**
+ * Set element state (disabled/enabled and text)
+ */
+ setElementState: function (id, disabled, text) {
+ const el = this.$(id);
+ if (el) {
+ if (disabled !== undefined) el.disabled = disabled;
+ if (text !== undefined) el.textContent = text;
+ }
+ },
+
+ /**
+ * Show status message
+ */
+ showStatus: function (message, isError) {
+ const status = this.$("status");
+ if (!status) return;
+
+ status.textContent = message;
+ status.className = isError ? "error" : "success";
+
+ setTimeout(function () {
+ status.textContent = "";
+ status.className = "";
+ }, 4000);
+ },
+
+ /**
+ * Show API setup screen
+ */
+ showApiSetup: function () {
+ this.$("api-setup").style.display = "block";
+ this.$("search-interface").style.display = "none";
+ },
+
+ /**
+ * Show search interface
+ */
+ showSearchInterface: function () {
+ this.$("api-setup").style.display = "none";
+ this.$("search-interface").style.display = "block";
+ },
+
+ /**
+ * Update provider information in UI
+ */
+ updateProviderInfo: function (providerId) {
+ if (providerId) {
+ this.currentProvider = providerId;
+ }
+
+ var provider = window.NewsProviders.getCurrentProvider();
+
+ // Update API key link
+ var apiKeyLink = this.$("provider-website-link");
+ if (apiKeyLink && provider) {
+ apiKeyLink.href = provider.website;
+ apiKeyLink.textContent = provider.website.replace("https://", "").replace("www.", "");
+ }
+
+ // Update placeholder
+ var apiKeyInput = this.$("api-key-setup");
+ if (apiKeyInput && provider) {
+ apiKeyInput.placeholder = "Enter your " + provider.name + " API key";
+ }
+
+ // Recreate advanced settings with provider-specific options
+ this.createAdvancedSettings();
+ },
+
+ /**
+ * Create provider selector HTML
+ */
+ createProviderSelector: function () {
+ var providers = window.NewsProviders.getProviders();
+ var html = 'News Provider: ';
+
+ providers.forEach(function (provider) {
+ html += '' + provider.name + ' ';
+ });
+
+ html += '
';
+ return html;
+ },
+
+ /**
+ * Initialize provider selector
+ */
+ initializeProviderSelector: function (selectedProvider) {
+ var providerSelect = this.$("provider-select");
+ if (providerSelect && selectedProvider) {
+ providerSelect.value = selectedProvider;
+ this.currentProvider = selectedProvider;
+
+ // Update UI for the selected provider
+ window.NewsProviders.setProvider(selectedProvider);
+ this.updateProviderInfo(selectedProvider);
+ }
+ },
+
+ /**
+ * Show search form
+ */
+ showSearchForm: function () {
+ const searchForm = document.querySelector(".search-form-container");
+ const resultsSection = this.$("results-section");
+
+ if (searchForm) searchForm.style.display = "block";
+ if (resultsSection) resultsSection.style.display = "none";
+ },
+
+ /**
+ * Show search results
+ */
+ showSearchResults: function () {
+ const searchForm = document.querySelector(".search-form-container");
+ const resultsSection = this.$("results-section");
+
+ if (searchForm) searchForm.style.display = "none";
+ if (resultsSection) resultsSection.style.display = "block";
+ },
+
+ /**
+ * Switch between tabs
+ */
+ switchTab: function (tabName) {
+ this.currentTab = tabName;
+
+ const searchTab = this.$("search-tab");
+ const headlinesTab = this.$("headlines-tab");
+ const searchContent = this.$("search-content");
+ const headlinesContent = this.$("headlines-content");
+
+ if (tabName === "search") {
+ searchTab.classList.add("active");
+ headlinesTab.classList.remove("active");
+ searchContent.style.display = "block";
+ headlinesContent.style.display = "none";
+ } else {
+ searchTab.classList.remove("active");
+ headlinesTab.classList.add("active");
+ searchContent.style.display = "none";
+ headlinesContent.style.display = "block";
+ }
+
+ const advancedBtn = this.$("advanced-settings-btn");
+ if (advancedBtn && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ advancedBtn.textContent = window.Asc.plugin.tr("Show advanced settings");
+ }
+
+ const searchAdvanced = this.$("search-advanced-settings");
+ const headlinesAdvanced = this.$("headlines-advanced-settings");
+ if (searchAdvanced) searchAdvanced.style.display = "none";
+ if (headlinesAdvanced) headlinesAdvanced.style.display = "none";
+
+ this.showSearchForm();
+ this.currentArticles = [];
+ },
+
+ /**
+ * Toggle advanced settings visibility
+ */
+ toggleAdvancedSettings: function () {
+ const advancedSection = this.$(this.currentTab + "-advanced-settings");
+ const advancedBtn = this.$("advanced-settings-btn");
+
+ if (advancedSection && advancedBtn && window.Asc && window.Asc.plugin && window.Asc.plugin.tr) {
+ if (advancedSection.style.display === "none") {
+ advancedSection.style.display = "block";
+ advancedBtn.textContent = window.Asc.plugin.tr("Hide advanced settings");
+ } else {
+ advancedSection.style.display = "none";
+ advancedBtn.textContent = window.Asc.plugin.tr("Show advanced settings");
+ }
+ }
+ },
+
+ /**
+ * Get display options from checkboxes
+ */
+ getDisplayOptions: function () {
+ if (this.currentTab === "headlines") {
+ return { title: true, description: true, content: false };
+ }
+
+ const showTitle = this.$("show-title").checked;
+ const showDescription = this.$("show-description").checked;
+ const showContent = this.$("show-content").checked;
+
+ if (!showTitle && !showDescription && !showContent) {
+ return { title: true, description: true, content: false };
+ }
+
+ return {
+ title: showTitle,
+ description: showDescription,
+ content: showContent,
+ };
+ },
+
+ /**
+ * Get advanced settings for a tab
+ */
+ getAdvancedSettings: function (tabPrefix) {
+ const sortElement = this.$(tabPrefix + "-sortby");
+ const langElement = this.$(tabPrefix + "-lang");
+ const domainsElement = this.$(tabPrefix + "-domains");
+ const excludeDomainsElement = this.$(tabPrefix + "-exclude-domains");
+ const searchFieldsElement = this.$(tabPrefix + "-search-fields");
+ const authorsElement = this.$(tabPrefix + "-authors");
+ const categoriesElement = this.$(tabPrefix + "-categories");
+
+ var settings = {
+ sortBy: sortElement ? sortElement.value || "publishedAt" : "publishedAt",
+ language: langElement ? langElement.value || "en" : "en",
+ };
+
+ // Add "Search In" settings (for GNews and WorldNewsAPI)
+ if (tabPrefix === "search") {
+ const showTitle = this.$("show-title");
+ const showDescription = this.$("show-description");
+ const showContent = this.$("show-content");
+
+ if (showTitle && showDescription && showContent) {
+ var searchInParts = [];
+ if (showTitle.checked) searchInParts.push("title");
+ if (showDescription.checked || showContent.checked) searchInParts.push("description");
+
+ if (searchInParts.length > 0) {
+ settings.searchIn = searchInParts.join(",");
+ }
+ }
+ }
+
+ // Add provider-specific settings
+ if (domainsElement && domainsElement.value) {
+ settings.domains = domainsElement.value;
+ }
+
+ if (excludeDomainsElement && excludeDomainsElement.value) {
+ settings.exclude_domains = excludeDomainsElement.value;
+ }
+
+ if (searchFieldsElement && searchFieldsElement.value) {
+ settings.search_fields = searchFieldsElement.value;
+ }
+
+ if (authorsElement && authorsElement.value) {
+ settings.authors = authorsElement.value;
+ }
+
+ if (categoriesElement && categoriesElement.value) {
+ settings.categories = categoriesElement.value;
+ }
+
+ return settings;
+ },
+
+ /**
+ * Get provider-specific advanced settings configuration
+ */
+ getProviderAdvancedConfig: function (providerId) {
+ if (providerId === "gnews") {
+ return {
+ supportsDomains: false,
+ supportsSearchIn: true,
+ supportsLocale: false,
+ supportsSearchFields: false,
+ supportsExcludeDomains: false,
+ supportsCategories: false,
+ supportsExcludeCategories: false,
+ supportsAuthors: false,
+ supportsHeadlinesQuery: true,
+ supportsHeadlinesCategory: true,
+ sortOptions: [
+ { value: "publishedAt", label: "Publication Date" },
+ { value: "relevance", label: "Relevance" }
+ ]
+ };
+ } else if (providerId === "thenewsapi") {
+ return {
+ supportsDomains: true,
+ supportsSearchIn: false,
+ supportsLocale: false,
+ supportsSearchFields: true,
+ supportsExcludeDomains: true,
+ supportsCategories: true,
+ supportsExcludeCategories: true,
+ supportsAuthors: false,
+ supportsHeadlinesQuery: true,
+ supportsHeadlinesCategory: true,
+ sortOptions: [
+ { value: "published_at", label: "Publication Date" },
+ { value: "relevance_score", label: "Relevance" }
+ ]
+ };
+ } else if (providerId === "worldnewsapi") {
+ return {
+ supportsDomains: true,
+ supportsSearchIn: true,
+ supportsLocale: false,
+ supportsSearchFields: false,
+ supportsExcludeDomains: false,
+ supportsCategories: true,
+ supportsExcludeCategories: false,
+ supportsAuthors: true,
+ supportsHeadlinesQuery: false,
+ supportsHeadlinesCategory: false,
+ sortOptions: [
+ { value: "publish-time", label: "Publication Date" },
+ { value: "relevance", label: "Relevance" }
+ ]
+ };
+ }
+ // Default configuration
+ return {
+ supportsDomains: false,
+ supportsSearchIn: true,
+ supportsLocale: false,
+ supportsSearchFields: false,
+ supportsExcludeDomains: false,
+ supportsCategories: false,
+ supportsExcludeCategories: false,
+ supportsAuthors: false,
+ supportsHeadlinesQuery: true,
+ supportsHeadlinesCategory: true,
+ sortOptions: [
+ { value: "publishedAt", label: "Publication Date" },
+ { value: "relevance", label: "Relevance" }
+ ]
+ };
+ },
+
+ /**
+ * Create advanced settings HTML based on provider
+ */
+ createAdvancedSettings: function () {
+ var config = this.getProviderAdvancedConfig(this.currentProvider);
+ var tr = window.Asc && window.Asc.plugin && window.Asc.plugin.tr ? window.Asc.plugin.tr : function(s) { return s; };
+
+ // Helper function to build base HTML (sort + language)
+ var buildBaseHTML = function() {
+ var html = "";
+
+ // Sort by dropdown (common to all providers)
+ html += '';
+ html += '' + tr("Sort by") + ': ';
+ html += '';
+ config.sortOptions.forEach(function(opt) {
+ html += '' + tr(opt.label) + ' ';
+ });
+ html += ' ';
+ html += '
';
+
+ // Language dropdown (common to all providers)
+ html += '';
+ html += '' + tr("Language") + ': ';
+ html += '';
+ html += '' + tr("English") + ' ';
+ html += '' + tr("Spanish") + ' ';
+ html += '' + tr("French") + ' ';
+ html += '' + tr("German") + ' ';
+ html += '' + tr("Italian") + ' ';
+ html += '' + tr("Portuguese") + ' ';
+ html += '' + tr("Japanese") + ' ';
+ html += '' + tr("Chinese") + ' ';
+ html += '' + tr("Arabic") + ' ';
+ html += '' + tr("Russian") + ' ';
+ html += '' + tr("Hindi") + ' ';
+ html += '' + tr("Korean") + ' ';
+ html += ' ';
+ html += '
';
+
+ return html;
+ };
+
+ // Helper function to build provider-specific fields
+ var buildProviderFields = function(isHeadlines) {
+ var html = "";
+
+ // For WorldNewsAPI Top Headlines, skip domains, authors, and categories
+ if (isHeadlines && this.currentProvider === "worldnewsapi") {
+ // Don't add domains, authors, or categories for WorldNewsAPI headlines
+ return html;
+ }
+
+ // Provider-specific: Domains (TheNewsAPI and WorldNewsAPI search)
+ if (config.supportsDomains) {
+ html += '';
+ }
+
+ // Provider-specific: Exclude Domains (TheNewsAPI)
+ if (config.supportsExcludeDomains) {
+ html += '';
+ }
+
+ // Provider-specific: Authors (WorldNewsAPI search only)
+ if (config.supportsAuthors) {
+ html += '';
+ }
+
+ // Provider-specific: Categories (WorldNewsAPI search and TheNewsAPI)
+ if (config.supportsCategories) {
+ html += '';
+ }
+
+ return html;
+ }.bind(this);
+
+ // Build HTML for search tab
+ var searchHTML = buildBaseHTML() + buildProviderFields(false);
+
+ // Build HTML for headlines tab
+ var headlinesHTML = buildBaseHTML() + buildProviderFields(true);
+
+ // Provider-specific: Search Fields (TheNewsAPI, search only)
+ if (config.supportsSearchFields) {
+ var searchFieldsHTML = '';
+
+ searchHTML += searchFieldsHTML;
+ }
+
+ // Apply HTML to search tab
+ var searchOptionsEl = this.$('search-advanced-options');
+ if (searchOptionsEl) {
+ searchOptionsEl.innerHTML = searchHTML.replace(/PREFIX/g, 'search');
+ }
+
+ // Apply HTML to headlines tab
+ var headlinesOptionsEl = this.$('headlines-advanced-options');
+ if (headlinesOptionsEl) {
+ headlinesOptionsEl.innerHTML = headlinesHTML.replace(/PREFIX/g, 'headlines');
+ }
+
+ // Update "Search In" visibility for search tab
+ this.updateSearchInVisibility(config.supportsSearchIn);
+
+ // Update headlines query visibility based on provider
+ this.updateHeadlinesQueryVisibility(config.supportsHeadlinesQuery);
+
+ // Update headlines category visibility based on provider
+ this.updateHeadlinesCategoryVisibility(config.supportsHeadlinesCategory);
+ },
+
+ /**
+ * Update "Search In" section visibility
+ */
+ updateSearchInVisibility: function (visible) {
+ var searchInSection = this.$('search-in-section');
+ if (searchInSection) {
+ searchInSection.style.display = visible ? 'block' : 'none';
+ }
+ },
+
+ /**
+ * Update headlines query field visibility based on provider support
+ */
+ updateHeadlinesQueryVisibility: function (visible) {
+ var headlinesQueryGroup = this.$('headlines-query');
+ if (headlinesQueryGroup && headlinesQueryGroup.parentElement) {
+ // Hide/show the entire form-group containing the query field
+ headlinesQueryGroup.parentElement.style.display = visible ? 'block' : 'none';
+ }
+ },
+
+ /**
+ * Update headlines category field visibility based on provider support
+ */
+ updateHeadlinesCategoryVisibility: function (visible) {
+ var headlinesCategoryGroup = this.$('headlines-category');
+ if (headlinesCategoryGroup && headlinesCategoryGroup.parentElement) {
+ // Hide/show the entire form-group containing the category field
+ headlinesCategoryGroup.parentElement.style.display = visible ? 'block' : 'none';
+ }
+ },
+
+ /**
+ * Initialize display options checkboxes
+ */
+ initializeDisplayOptions: function () {
+ const checkboxes = ["show-title", "show-description", "show-content"];
+ var self = this;
+ checkboxes.forEach(function (id, index) {
+ const el = self.$(id);
+ if (el) el.checked = index < 2;
+ });
+ },
+
+ /**
+ * Display search results
+ */
+ displaySearchResults: function (articles, showStatusMessage) {
+ this.currentArticles = articles;
+ const resultsList = this.$("articles-list");
+
+ if (!resultsList) return;
+
+ if (articles.length === 0) {
+ // Clear the results header when no articles found
+ const resultsHeader = document.querySelector(".results-header");
+ if (resultsHeader) {
+ resultsHeader.textContent = "";
+ }
+
+ resultsList.innerHTML =
+ '' +
+ (window.Asc.plugin.tr
+ ? window.Asc.plugin.tr("No articles found")
+ : "No articles found. Try a different search query.") +
+ "
";
+ this.showSearchResults();
+ if (showStatusMessage) {
+ this.showStatus("No articles found", true);
+ }
+ return;
+ }
+
+ const displayOptions = this.getDisplayOptions();
+ this.updateResultsHeader(articles.length, displayOptions);
+
+ let html = "";
+ articles.forEach(function (article, index) {
+ html += '';
+ html += '
';
+ html += '
' + UIManager.escapeHtml(article.title) + " ";
+ html +=
+ '
' +
+ UIManager.escapeHtml(article.source.name) +
+ " • " +
+ new Date(article.publishedAt).toLocaleDateString() +
+ "
";
+ if (article.description) {
+ html +=
+ '
' +
+ UIManager.escapeHtml(article.description) +
+ "
";
+ }
+ html += "
";
+ html +=
+ '
' +
+ (window.Asc.plugin.tr ? window.Asc.plugin.tr("Open") : "Open") +
+ " ";
+ html += "
";
+ });
+
+ resultsList.innerHTML = html;
+ this.showSearchResults();
+
+ if (showStatusMessage) {
+ this.showStatus("Found " + articles.length + " articles", false);
+ }
+ },
+
+ /**
+ * Update results header
+ */
+ updateResultsHeader: function (count, displayOptions) {
+ const resultsHeader = document.querySelector(".results-header");
+ if (!resultsHeader) return;
+
+ if (count === 0) {
+ resultsHeader.textContent = "";
+ return;
+ }
+
+ const searchFields = [];
+ if (displayOptions.title) {
+ searchFields.push(
+ window.Asc.plugin.tr ? window.Asc.plugin.tr("title") : "title"
+ );
+ }
+ if (displayOptions.description) {
+ searchFields.push(
+ window.Asc.plugin.tr
+ ? window.Asc.plugin.tr("description")
+ : "description"
+ );
+ }
+ if (displayOptions.content) {
+ searchFields.push(
+ window.Asc.plugin.tr ? window.Asc.plugin.tr("content") : "content"
+ );
+ }
+
+ const allFieldsText = window.Asc.plugin.tr
+ ? window.Asc.plugin.tr("all fields")
+ : "all fields";
+ const searchFieldsText =
+ searchFields.length === 0 ? allFieldsText : searchFields.join(", ");
+ const successText = window.Asc.plugin.tr
+ ? window.Asc.plugin.tr("Success! {0} results were found by {1}")
+ : "Success! {0} results were found by {1}";
+ const headerText = successText
+ .replace("{0}", count)
+ .replace("{1}", searchFieldsText);
+
+ resultsHeader.textContent = headerText;
+ },
+
+ /**
+ * Escape HTML to prevent XSS
+ */
+ escapeHtml: function (text) {
+ const div = document.createElement("div");
+ div.textContent = text;
+ return div.innerHTML;
+ },
+
+ /**
+ * Open article link in browser
+ */
+ openArticleLink: function (article) {
+ if (!article.url) {
+ this.showStatus("Article URL not available", true);
+ return;
+ }
+
+ try {
+ window.open(article.url, "_blank");
+ } catch (error) {
+ console.error("Failed to open article:", error);
+ this.showStatus("Failed to open article", true);
+ }
+ },
+
+ /**
+ * Clear results and go back to search
+ */
+ goBackToSearch: function () {
+ this.showSearchForm();
+ this.currentArticles = [];
+ const status = this.$("status");
+ if (status) {
+ status.textContent = "";
+ status.className = "";
+ }
+ },
+ };
+
+ // Export to global scope
+ window.GNewsUI = UIManager;
+})(window);
diff --git a/sdkjs-plugins/content/news/translations/cs-CZ.json b/sdkjs-plugins/content/news/translations/cs-CZ.json
new file mode 100644
index 00000000..366c06ec
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/cs-CZ.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Prohledejte miliony článků z více než 80 000 velkých a malých zpravodajských zdrojů a blogů.",
+ "API key": "API klíč:",
+ "Enter your API key": "Zadejte svůj API klíč",
+ "Get your free API key": "Získejte svůj bezplatný API klíč z",
+ "Login": "Přihlášení",
+ "Search": "Hledat",
+ "Top Headlines": "Hlavní zprávy",
+ "Prompt": "Dotaz",
+ "Search with keywords": "Hledejte pomocí jednotlivých klíčových slov nebo obklopte úplné fráze uvozovkami",
+ "Search in": "Hledat v",
+ "Title": "Název",
+ "Description": "Popis",
+ "Content": "Obsah",
+ "Advanced Settings": "Pokročilá nastavení",
+ "Find": "Najít",
+ "Category": "Kategorie:",
+ "All Categories": "Všechny kategorie",
+ "General": "Obecné",
+ "Business": "Podnikání",
+ "Entertainment": "Zábava",
+ "Health": "Zdraví",
+ "Science": "Věda",
+ "Sports": "Sport",
+ "Technology": "Technologie",
+ "Country": "Země:",
+ "United States": "Spojené státy",
+ "United Kingdom": "Velká Británie",
+ "Canada": "Kanada",
+ "Australia": "Austrálie",
+ "Germany": "Německo",
+ "France": "Francie",
+ "Japan": "Japonsko",
+ "India": "Indie",
+ "Show advanced settings": "Zobrazit pokročilá nastavení",
+ "Hide advanced settings": "Skrýt pokročilá nastavení",
+ "Reconfigure": "Překonfigurovat",
+ "Search Results": "Výsledky hledání",
+ "Back to search": "Zpět k hledání",
+ "Sort by": "Řadit podle:",
+ "Publication Date": "Datum publikace (nejnovější první)",
+ "Relevance": "Relevance (nejlepší shoda první)",
+ "Language": "Jazyk:",
+ "English": "Angličtina",
+ "Spanish": "Španělština",
+ "French": "Francouzština",
+ "German": "Němčina",
+ "Italian": "Italština",
+ "Portuguese": "Portugalština",
+ "Japanese": "Japonština",
+ "Chinese": "Čínština",
+ "Arabic": "Arabština",
+ "Russian": "Ruština",
+ "Hindi": "Hindština",
+ "Korean": "Korejština",
+ "No articles found for your search": "Pro vaše vyhledávání nebyly nalezeny žádné články",
+ "Success! {0} results were found by {1}": "Úspěch! Nalezeno {0} výsledků pomocí {1}",
+ "all fields": "všechna pole"
+}
diff --git a/sdkjs-plugins/content/news/translations/de-DE.json b/sdkjs-plugins/content/news/translations/de-DE.json
new file mode 100644
index 00000000..61e1886c
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/de-DE.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Durchsuchen Sie Millionen von Artikeln aus über 80.000 großen und kleinen Nachrichtenquellen und Blogs.",
+ "API key": "API-Schlüssel:",
+ "Enter your API key": "Geben Sie Ihren API-Schlüssel ein",
+ "Get your free API key": "Erhalten Sie Ihren kostenlosen API-Schlüssel von",
+ "Login": "Anmelden",
+ "Search": "Suchen",
+ "Top Headlines": "Top-Schlagzeilen",
+ "Prompt": "Anfrage",
+ "Search with keywords": "Suchen Sie mit einzelnen Schlüsselwörtern oder setzen Sie vollständige Phrasen in Anführungszeichen",
+ "Search in": "Suchen in",
+ "Title": "Titel",
+ "Description": "Beschreibung",
+ "Content": "Inhalt",
+ "Advanced Settings": "Erweiterte Einstellungen",
+ "Find": "Finden",
+ "Category": "Kategorie:",
+ "All Categories": "Alle Kategorien",
+ "General": "Allgemein",
+ "Business": "Geschäft",
+ "Entertainment": "Unterhaltung",
+ "Health": "Gesundheit",
+ "Science": "Wissenschaft",
+ "Sports": "Sport",
+ "Technology": "Technologie",
+ "Country": "Land:",
+ "United States": "Vereinigte Staaten",
+ "United Kingdom": "Vereinigtes Königreich",
+ "Canada": "Kanada",
+ "Australia": "Australien",
+ "Germany": "Deutschland",
+ "France": "Frankreich",
+ "Japan": "Japan",
+ "India": "Indien",
+ "Show advanced settings": "Erweiterte Einstellungen anzeigen",
+ "Hide advanced settings": "Erweiterte Einstellungen ausblenden",
+ "Reconfigure": "Neu konfigurieren",
+ "Search Results": "Suchergebnisse",
+ "Back to search": "Zurück zur Suche",
+ "Sort by": "Sortieren nach:",
+ "Publication Date": "Veröffentlichungsdatum (neueste zuerst)",
+ "Relevance": "Relevanz (beste Übereinstimmung zuerst)",
+ "Language": "Sprache:",
+ "English": "Englisch",
+ "Spanish": "Spanisch",
+ "French": "Französisch",
+ "German": "Deutsch",
+ "Italian": "Italienisch",
+ "Portuguese": "Portugiesisch",
+ "Japanese": "Japanisch",
+ "Chinese": "Chinesisch",
+ "Arabic": "Arabisch",
+ "Russian": "Russisch",
+ "Hindi": "Hindi",
+ "Korean": "Koreanisch",
+ "No articles found for your search": "Keine Artikel für Ihre Suche gefunden",
+ "Success! {0} results were found by {1}": "Erfolg! {0} Ergebnisse wurden durch {1} gefunden",
+ "all fields": "alle Felder"
+}
diff --git a/sdkjs-plugins/content/news/translations/en-US.json b/sdkjs-plugins/content/news/translations/en-US.json
new file mode 100644
index 00000000..e56dc2fd
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/en-US.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Search through millions of articles from over 80,000 large and small news sources and blogs.",
+ "API key": "API key:",
+ "Enter your API key": "Enter your API key",
+ "Get your free API key": "Get your free API key from",
+ "Login": "Login",
+ "Search": "Search",
+ "Top Headlines": "Top Headlines",
+ "Prompt": "Prompt",
+ "Search with keywords": "Search with singular keywords, or surround complete phrases with quotation marks",
+ "Search in": "Search in",
+ "Title": "Title",
+ "Description": "Description",
+ "Content": "Content",
+ "Advanced Settings": "Advanced Settings",
+ "Find": "Find",
+ "Category": "Category:",
+ "All Categories": "All Categories",
+ "General": "General",
+ "Business": "Business",
+ "Entertainment": "Entertainment",
+ "Health": "Health",
+ "Science": "Science",
+ "Sports": "Sports",
+ "Technology": "Technology",
+ "Country": "Country:",
+ "United States": "United States",
+ "United Kingdom": "United Kingdom",
+ "Canada": "Canada",
+ "Australia": "Australia",
+ "Germany": "Germany",
+ "France": "France",
+ "Japan": "Japan",
+ "India": "India",
+ "Show advanced settings": "Show advanced settings",
+ "Hide advanced settings": "Hide advanced settings",
+ "Reconfigure": "Reconfigure",
+ "Search Results": "Search Results",
+ "Back to search": "Back to search",
+ "Sort by": "Sort by:",
+ "Publication Date": "Publication Date (newest first)",
+ "Relevance": "Relevance (best match first)",
+ "Language": "Language:",
+ "English": "English",
+ "Spanish": "Spanish",
+ "French": "French",
+ "German": "German",
+ "Italian": "Italian",
+ "Portuguese": "Portuguese",
+ "Japanese": "Japanese",
+ "Chinese": "Chinese",
+ "Arabic": "Arabic",
+ "Russian": "Russian",
+ "Hindi": "Hindi",
+ "Korean": "Korean",
+ "No articles found for your search": "No articles found for your search",
+ "Success! {0} results were found by {1}": "Success! {0} results were found by {1}",
+ "all fields": "all fields"
+}
diff --git a/sdkjs-plugins/content/news/translations/es-ES.json b/sdkjs-plugins/content/news/translations/es-ES.json
new file mode 100644
index 00000000..9e1c80be
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/es-ES.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Busque entre millones de artículos de más de 80,000 fuentes de noticias y blogs grandes y pequeños.",
+ "API key": "Clave API:",
+ "Enter your API key": "Ingrese su clave API",
+ "Get your free API key": "Obtenga su clave API gratuita desde",
+ "Login": "Iniciar sesión",
+ "Search": "Buscar",
+ "Top Headlines": "Titulares principales",
+ "Prompt": "Consulta",
+ "Search with keywords": "Busque con palabras clave singulares o rodee frases completas con comillas",
+ "Search in": "Buscar en",
+ "Title": "Título",
+ "Description": "Descripción",
+ "Content": "Contenido",
+ "Advanced Settings": "Configuración avanzada",
+ "Find": "Buscar",
+ "Category": "Categoría:",
+ "All Categories": "Todas las categorías",
+ "General": "General",
+ "Business": "Negocios",
+ "Entertainment": "Entretenimiento",
+ "Health": "Salud",
+ "Science": "Ciencia",
+ "Sports": "Deportes",
+ "Technology": "Tecnología",
+ "Country": "País:",
+ "United States": "Estados Unidos",
+ "United Kingdom": "Reino Unido",
+ "Canada": "Canadá",
+ "Australia": "Australia",
+ "Germany": "Alemania",
+ "France": "Francia",
+ "Japan": "Japón",
+ "India": "India",
+ "Show advanced settings": "Mostrar configuración avanzada",
+ "Hide advanced settings": "Ocultar configuración avanzada",
+ "Reconfigure": "Reconfigurar",
+ "Search Results": "Resultados de búsqueda",
+ "Back to search": "Volver a la búsqueda",
+ "Sort by": "Ordenar por:",
+ "Publication Date": "Fecha de publicación (más reciente primero)",
+ "Relevance": "Relevancia (mejor coincidencia primero)",
+ "Language": "Idioma:",
+ "English": "Inglés",
+ "Spanish": "Español",
+ "French": "Francés",
+ "German": "Alemán",
+ "Italian": "Italiano",
+ "Portuguese": "Portugués",
+ "Japanese": "Japonés",
+ "Chinese": "Chino",
+ "Arabic": "Árabe",
+ "Russian": "Ruso",
+ "Hindi": "Hindi",
+ "Korean": "Coreano",
+ "No articles found for your search": "No se encontraron artículos para su búsqueda",
+ "Success! {0} results were found by {1}": "¡Éxito! Se encontraron {0} resultados por {1}",
+ "all fields": "todos los campos"
+}
diff --git a/sdkjs-plugins/content/news/translations/fr-FR.json b/sdkjs-plugins/content/news/translations/fr-FR.json
new file mode 100644
index 00000000..26522a92
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/fr-FR.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Recherchez parmi des millions d'articles",
+ "API key": "Clé API",
+ "Enter your API key": "Entrez votre clé API",
+ "Get your free API key": "Obtenez votre clé API gratuite",
+ "Login": "Connexion",
+ "Search": "Rechercher",
+ "Top Headlines": "Titres principaux",
+ "Prompt": "Requête",
+ "Search with keywords": "Recherche par mots-clés",
+ "Search in": "Rechercher dans",
+ "Title": "Titre",
+ "Description": "Description",
+ "Content": "Contenu",
+ "Advanced Settings": "Paramètres avancés",
+ "Find": "Rechercher",
+ "Category": "Catégorie :",
+ "All Categories": "Toutes les catégories",
+ "General": "Général",
+ "Business": "Business",
+ "Entertainment": "Divertissement",
+ "Health": "Santé",
+ "Science": "Science",
+ "Sports": "Sports",
+ "Technology": "Technologie",
+ "Country": "Pays :",
+ "United States": "États-Unis",
+ "United Kingdom": "Royaume-Uni",
+ "Canada": "Canada",
+ "Australia": "Australie",
+ "Germany": "Allemagne",
+ "France": "France",
+ "Japan": "Japon",
+ "India": "Inde",
+ "Show advanced settings": "Afficher les paramètres avancés",
+ "Hide advanced settings": "Masquer les paramètres avancés",
+ "Reconfigure": "Reconfigurer",
+ "Search Results": "Résultats de recherche",
+ "Back to search": "Retour à la recherche",
+ "Sort by": "Trier par :",
+ "Publication Date": "Date de publication",
+ "Relevance": "Pertinence",
+ "Language": "Langue :",
+ "English": "Anglais",
+ "Spanish": "Espagnol",
+ "French": "Français",
+ "German": "Allemand",
+ "Italian": "Italien",
+ "Portuguese": "Portugais",
+ "Japanese": "Japonais",
+ "Chinese": "Chinois",
+ "Arabic": "Arabe",
+ "Russian": "Russe",
+ "Hindi": "Hindi",
+ "Korean": "Coréen",
+ "No articles found for your search": "Aucun article trouvé pour votre recherche",
+ "Success! {0} results were found by {1}": "Succès ! {0} résultats ont été trouvés par {1}",
+ "all fields": "tous les champs"
+}
diff --git a/sdkjs-plugins/content/news/translations/it-IT.json b/sdkjs-plugins/content/news/translations/it-IT.json
new file mode 100644
index 00000000..bfbbe7d1
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/it-IT.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Cerca tra milioni di articoli di oltre 80.000 fonti, tra notizie e blog grandi e piccoli.",
+ "API key": "Chiave API:",
+ "Enter your API key": "Inserisci la tua chiave API",
+ "Get your free API key": "Ottieni la tua chiave API gratuita",
+ "Login": "Accedi",
+ "Search": "Cerca",
+ "Top Headlines": "Titoli principali",
+ "Prompt": "Richiesta",
+ "Search with keywords": "Cerca con parole chiave singole o con frasi complete con virgolette",
+ "Search in": "Cerca in",
+ "Title": "Titolo",
+ "Description": "Descrizione",
+ "Content": "Contenuto",
+ "Advanced Settings": "Impostazioni avanzate",
+ "Find": "Trova",
+ "Category": "Categoria:",
+ "All Categories": "Tutte le categorie",
+ "General": "Generale",
+ "Business": "Affari",
+ "Entertainment": "Intrattenimento",
+ "Health": "Salute",
+ "Science": "Scienza",
+ "Sports": "Sport",
+ "Technology": "Tecnologia",
+ "Country": "Paese:",
+ "United States": "Stati Uniti",
+ "United Kingdom": "Regno Unito",
+ "Canada": "Canada",
+ "Australia": "Australia",
+ "Germany": "Germania",
+ "France": "Francia",
+ "Japan": "Giappone",
+ "India": "India",
+ "Show advanced settings": "Mostra impostazioni avanzate",
+ "Hide advanced settings": "Nascondi impostazioni avanzate",
+ "Reconfigure": "Riconfigura",
+ "Search Results": "Risultati della ricerca",
+ "Back to search": "Torna alla ricerca",
+ "Sort by": "Ordina per:",
+ "Publication Date": "Data di pubblicazione (più recente prima)",
+ "Relevance": "Rilevanza (migliore corrispondenza prima)",
+ "Language": "Lingua:",
+ "English": "Inglese",
+ "Spanish": "Spagnolo",
+ "French": "Francese",
+ "German": "Tedesco",
+ "Italian": "Italiano",
+ "Portuguese": "Portoghese",
+ "Japanese": "Giapponese",
+ "Chinese": "Cinese",
+ "Arabic": "Arabo",
+ "Russian": "Russo",
+ "Hindi": "Hindi",
+ "Korean": "Coreano",
+ "No articles found for your search": "Nessun articolo trovato per la tua ricerca",
+ "Success! {0} results were found by {1}": "Successo! {0} risultati sono stati trovati da {1}",
+ "all fields": "tutti i campi"
+}
diff --git a/sdkjs-plugins/content/news/translations/ja-JA.json b/sdkjs-plugins/content/news/translations/ja-JA.json
new file mode 100644
index 00000000..1b5b8855
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/ja-JA.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "80,000を超える大小のニュースソースとブログから数百万の記事を検索します。",
+ "API key": "APIキー:",
+ "Enter your API key": "APIキーを入力してください",
+ "Get your free API key": "無料のAPIキーを取得",
+ "Login": "ログイン",
+ "Search": "検索",
+ "Top Headlines": "トップニュース",
+ "Prompt": "プロンプト",
+ "Search with keywords": "単一のキーワードで検索するか、完全なフレーズを引用符で囲んでください",
+ "Search in": "検索対象",
+ "Title": "タイトル",
+ "Description": "説明",
+ "Content": "コンテンツ",
+ "Advanced Settings": "詳細設定",
+ "Find": "検索",
+ "Category": "カテゴリ:",
+ "All Categories": "すべてのカテゴリ",
+ "General": "一般",
+ "Business": "ビジネス",
+ "Entertainment": "エンターテイメント",
+ "Health": "健康",
+ "Science": "科学",
+ "Sports": "スポーツ",
+ "Technology": "技術",
+ "Country": "国:",
+ "United States": "アメリカ合衆国",
+ "United Kingdom": "イギリス",
+ "Canada": "カナダ",
+ "Australia": "オーストラリア",
+ "Germany": "ドイツ",
+ "France": "フランス",
+ "Japan": "日本",
+ "India": "インド",
+ "Show advanced settings": "詳細設定を表示",
+ "Hide advanced settings": "詳細設定を非表示",
+ "Reconfigure": "再設定",
+ "Search Results": "検索結果",
+ "Back to search": "検索に戻る",
+ "Sort by": "並び順:",
+ "Publication Date": "公開日(新しい順)",
+ "Relevance": "関連性(最適な一致順)",
+ "Language": "言語:",
+ "English": "英語",
+ "Spanish": "スペイン語",
+ "French": "フランス語",
+ "German": "ドイツ語",
+ "Italian": "イタリア語",
+ "Portuguese": "ポルトガル語",
+ "Japanese": "日本語",
+ "Chinese": "中国語",
+ "Arabic": "アラビア語",
+ "Russian": "ロシア語",
+ "Hindi": "ヒンディー語",
+ "Korean": "韓国語",
+ "No articles found for your search": "検索条件に一致する記事が見つかりませんでした",
+ "Success! {0} results were found by {1}": "成功!{1}で{0}件の結果が見つかりました",
+ "all fields": "すべてのフィールド"
+}
diff --git a/sdkjs-plugins/content/news/translations/langs.json b/sdkjs-plugins/content/news/translations/langs.json
new file mode 100644
index 00000000..9163f7ab
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/langs.json
@@ -0,0 +1,12 @@
+[
+ "cs-CZ",
+ "de-DE",
+ "es-ES",
+ "fr-FR",
+ "ja-JA",
+ "ru-RU",
+ "pt-BR",
+ "si-LK",
+ "zh-ZH",
+ "it-IT"
+]
diff --git a/sdkjs-plugins/content/news/translations/pt-BR.json b/sdkjs-plugins/content/news/translations/pt-BR.json
new file mode 100644
index 00000000..4acfa7f1
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/pt-BR.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Pesquise entre milhões de artigos de mais de 80.000 fontes de notícias e blogs grandes e pequenos.",
+ "API key": "Chave da API:",
+ "Enter your API key": "Digite sua chave da API",
+ "Get your free API key": "Obtenha sua chave da API gratuita em",
+ "Login": "Entrar",
+ "Search": "Pesquisar",
+ "Top Headlines": "Principais manchetes",
+ "Prompt": "Consulta",
+ "Search with keywords": "Pesquise com palavras-chave singulares ou coloque frases completas entre aspas",
+ "Search in": "Pesquisar em",
+ "Title": "Título",
+ "Description": "Descrição",
+ "Content": "Conteúdo",
+ "Advanced Settings": "Configurações avançadas",
+ "Find": "Encontrar",
+ "Category": "Categoria:",
+ "All Categories": "Todas as categorias",
+ "General": "Geral",
+ "Business": "Negócios",
+ "Entertainment": "Entretenimento",
+ "Health": "Saúde",
+ "Science": "Ciência",
+ "Sports": "Esportes",
+ "Technology": "Tecnologia",
+ "Country": "País:",
+ "United States": "Estados Unidos",
+ "United Kingdom": "Reino Unido",
+ "Canada": "Canadá",
+ "Australia": "Austrália",
+ "Germany": "Alemanha",
+ "France": "França",
+ "Japan": "Japão",
+ "India": "Índia",
+ "Show advanced settings": "Mostrar configurações avançadas",
+ "Hide advanced settings": "Ocultar configurações avançadas",
+ "Reconfigure": "Reconfigurar",
+ "Search Results": "Resultados da pesquisa",
+ "Back to search": "Voltar à pesquisa",
+ "Sort by": "Ordenar por:",
+ "Publication Date": "Data de publicação (mais recente primeiro)",
+ "Relevance": "Relevância (melhor correspondência primeiro)",
+ "Language": "Idioma:",
+ "English": "Inglês",
+ "Spanish": "Espanhol",
+ "French": "Francês",
+ "German": "Alemão",
+ "Italian": "Italiano",
+ "Portuguese": "Português",
+ "Japanese": "Japonês",
+ "Chinese": "Chinês",
+ "Arabic": "Árabe",
+ "Russian": "Russo",
+ "Hindi": "Hindi",
+ "Korean": "Coreano",
+ "No articles found for your search": "Nenhum artigo encontrado para sua pesquisa",
+ "Success! {0} results were found by {1}": "Sucesso! {0} resultados foram encontrados por {1}",
+ "all fields": "todos os campos"
+}
diff --git a/sdkjs-plugins/content/news/translations/ru-RU.json b/sdkjs-plugins/content/news/translations/ru-RU.json
new file mode 100644
index 00000000..469edd00
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/ru-RU.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "Поиск среди миллионов статей из более чем 80 000 крупных и малых новостных источников и блогов.",
+ "API key": "ключ API:",
+ "Enter your API key": "Введите ваш ключ API",
+ "Get your free API key": "Получите бесплатный ключ API из",
+ "Login": "Вход",
+ "Search": "Поиск",
+ "Top Headlines": "Главные новости",
+ "Prompt": "Запрос",
+ "Search with keywords": "Искать по отдельным ключевым словам или заключать целые фразы в кавычки",
+ "Search in": "Искать в",
+ "Title": "Заголовок",
+ "Description": "Описание",
+ "Content": "Содержание",
+ "Advanced Settings": "Расширенные настройки",
+ "Find": "Найти",
+ "Category": "Категория:",
+ "All Categories": "Все категории",
+ "General": "Общее",
+ "Business": "Бизнес",
+ "Entertainment": "Развлечения",
+ "Health": "Здоровье",
+ "Science": "Наука",
+ "Sports": "Спорт",
+ "Technology": "Технологии",
+ "Country": "Страна:",
+ "United States": "Соединённые Штаты",
+ "United Kingdom": "Великобритания",
+ "Canada": "Канада",
+ "Australia": "Австралия",
+ "Germany": "Германия",
+ "France": "Франция",
+ "Japan": "Япония",
+ "India": "Индия",
+ "Show advanced settings": "Показать расширенные настройки",
+ "Hide advanced settings": "Скрыть расширенные настройки",
+ "Reconfigure": "Перенастроить",
+ "Search Results": "Результаты поиска",
+ "Back to search": "Вернуться к поиску",
+ "Sort by": "Сортировать по:",
+ "Publication Date": "Дата публикации (сначала недавние)",
+ "Relevance": "Релевантность (сначала наилучшее совпадение)",
+ "Language": "Язык:",
+ "English": "Английский",
+ "Spanish": "Испанский",
+ "French": "Французский",
+ "German": "Немецкий",
+ "Italian": "Итальянский",
+ "Portuguese": "Португальский",
+ "Japanese": "Японский",
+ "Chinese": "Китайский",
+ "Arabic": "Арабский",
+ "Russian": "Русский",
+ "Hindi": "Хинди",
+ "Korean": "Корейский",
+ "No articles found for your search": "Статьи по вашему запросу не найдены",
+ "Success! {0} results were found by {1}": "Успех! Найдено {0} результатов по {1}",
+ "all fields": "все поля"
+}
diff --git a/sdkjs-plugins/content/news/translations/si-LK.json b/sdkjs-plugins/content/news/translations/si-LK.json
new file mode 100644
index 00000000..5b558ef8
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/si-LK.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "ලක්ෂ ගණනක් ලිපි සෙවීමට",
+ "API key": "API යතුර:",
+ "Enter your API key": "ඔබගේ API යතුර ඇතුළත් කරන්න",
+ "Get your free API key": "ඔබගේ නොමිලේ API යතුර ලබා ගන්න",
+ "Login": "ඇතුළු වන්න",
+ "Search": "සෙවීම",
+ "Top Headlines": "උපරිම ශීර්ෂ සේරියාව",
+ "Prompt": "උදව් වචනය",
+ "Search with keywords": "යතුරු වචන භාවිතයෙන් සෙවීම, හෝ සම්පූර්ණ වාක්ය උද්ධෘත ලකුණු තුළ දැමීම",
+ "Search in": "සෙවීම කරන්න:",
+ "Title": "ශීර්ෂය",
+ "Description": "විස්තරය",
+ "Content": "අන්තර්ගතය",
+ "Advanced Settings": "උසස් සැකසුම්",
+ "Find": "සොයන්න",
+ "Category": "වර්ගය:",
+ "All Categories": "සියලුම වර්ග",
+ "General": "සාමාන්ය",
+ "Business": "ව්යාපාර",
+ "Entertainment": "විනෝදාස්වාදය",
+ "Health": "සෞඛ්යය",
+ "Science": "විද්යාව",
+ "Sports": "ක්රීඩා",
+ "Technology": "තාක්ෂණය",
+ "Country": "රට:",
+ "United States": "එක්සත් ජනපදය",
+ "United Kingdom": "එක්සත් රාජධානිය",
+ "Canada": "කැනඩාව",
+ "Australia": "ඕස්ට්රේලියාව",
+ "Germany": "ජර්මනිය",
+ "France": "ප්රංශය",
+ "Japan": "ජපානය",
+ "India": "ඉන්දියාව",
+ "Show advanced settings": "උසස් සැකසුම් පෙන්වන්න",
+ "Hide advanced settings": "උසස් සැකසුම් සඟවන්න",
+ "Reconfigure": "නැවත සැකසීම",
+ "Search Results": "සෙවීමේ ප්රතිඵල",
+ "Back to search": "සෙවීමට ආපසු",
+ "Sort by": "පෙළගස්වන්න:",
+ "Publication Date": "ප්රකාශන දිනය (අලුත්ම මුලින්)",
+ "Relevance": "සම්බන්ධතාවය (හොඳම ගැලපීම මුලින්)",
+ "Language": "භාෂාව:",
+ "English": "ඉංග්රීසි",
+ "Spanish": "ස්පාඤ්ඤ",
+ "French": "ප්රංශ",
+ "German": "ජර්මානු",
+ "Italian": "ඉතාලි",
+ "Portuguese": "පෘතුගීසි",
+ "Japanese": "ජපන්",
+ "Chinese": "චීන",
+ "Arabic": "අරාබි",
+ "Russian": "රුසියානු",
+ "Hindi": "හින්දි",
+ "Korean": "කොරියානු",
+ "No articles found for your search": "ඔබගේ සෙවීම සඳහා කිසිදු ලිපියක් හමු නොවීය",
+ "Success! {0} results were found by {1}": "සාර්ථකයි! {1} මගින් {0} ප්රතිඵල හමු විය",
+ "all fields": "සියලුම ක්ෂේත්ර"
+}
diff --git a/sdkjs-plugins/content/news/translations/zh-ZH.json b/sdkjs-plugins/content/news/translations/zh-ZH.json
new file mode 100644
index 00000000..48e84443
--- /dev/null
+++ b/sdkjs-plugins/content/news/translations/zh-ZH.json
@@ -0,0 +1,59 @@
+{
+ "Search through millions of articles": "在来自8万多家新闻媒体和博客的数百万篇文章中快速搜索所需信息。",
+ "API key": "API 密钥:",
+ "Enter your API key": "输入您的 API 密钥",
+ "Get your free API key": "获取免费API密钥:",
+ "Login": "登录",
+ "Search": "搜索",
+ "Top Headlines": "头条新闻",
+ "Prompt": "查询",
+ "Search with keywords": "使用单个关键词搜索,或用引号括起完整短语搜素",
+ "Search in": "搜索范围:",
+ "Title": "标题",
+ "Description": "描述",
+ "Content": "内容",
+ "Advanced Settings": "高级设置",
+ "Find": "搜素",
+ "Category": "类别:",
+ "All Categories": "所有类别",
+ "General": "综合",
+ "Business": "商业",
+ "Entertainment": "娱乐",
+ "Health": "健康",
+ "Science": "科学",
+ "Sports": "体育",
+ "Technology": "科技",
+ "Country": "国家:",
+ "United States": "美国",
+ "United Kingdom": "英国",
+ "Canada": "加拿大",
+ "Australia": "澳大利亚",
+ "Germany": "德国",
+ "France": "法国",
+ "Japan": "日本",
+ "India": "印度",
+ "Show advanced settings": "显示高级设置",
+ "Hide advanced settings": "隐藏高级设置",
+ "Reconfigure": "重新配置",
+ "Search Results": "搜索结果",
+ "Back to search": "返回搜索",
+ "Sort by": "排序方式:",
+ "Publication Date": "发布时间(最新优先)",
+ "Relevance": "相关性(最佳匹配优先)",
+ "Language": "语言:",
+ "English": "英语",
+ "Spanish": "西班牙语",
+ "French": "法语",
+ "German": "德语",
+ "Italian": "意大利语",
+ "Portuguese": "葡萄牙语",
+ "Japanese": "日语",
+ "Chinese": "中文",
+ "Arabic": "阿拉伯语",
+ "Russian": "俄语",
+ "Hindi": "印地语",
+ "Korean": "韩语",
+ "No articles found for your search": "未找到与您搜索相关的文章",
+ "Success! {0} results were found by {1}": "成功!通过{1}找到了{0}个结果",
+ "all fields": "所有字段"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/CHANGELOG.md b/sdkjs-plugins/content/texthighlighter/CHANGELOG.md
new file mode 100644
index 00000000..2c9a2d06
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Change Log
+
+## 1.0.0
+
+- Initial release.
diff --git a/sdkjs-plugins/content/texthighlighter/README.md b/sdkjs-plugins/content/texthighlighter/README.md
new file mode 100644
index 00000000..b956e732
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/README.md
@@ -0,0 +1,55 @@
+## Overview
+
+The **Text Highlighter** plugin allows users to highlight selected text in the Document, Presentation, and Text Editors with customizable colors. It provides an easy way to emphasize important information and visually organize content.
+
+The plugin supports:
+
+* Highlighting text with multiple color options.
+* Removing existing highlights.
+* Compatibility across different editors (Document, Presentation, Text).
+
+---
+
+## Installation
+
+1. Install the **Text Highlighter Plugin** from the plugin marketplace.
+2. Once installed, it will appear in the plugin tab of the editor.
+
+---
+
+## Usage
+
+### Activate the Text Highlighter Plugin
+
+* Go to the **Plugin** tab.
+* Click the **Text Highlighter** plugin in the "Plugins" section.
+
+### Highlight Text
+
+1. Select the text you want to highlight.
+2. Choose your highlight color from the available options.
+3. Click the **Highlight** button to apply the chosen color.
+
+### Remove Highlight
+
+* Select the highlighted text.
+* Click the **Remove Highlight** option to clear the applied color.
+
+### Supported Editors
+
+* **Document Editor**: Works for paragraphs, words, and inline selections.
+* **Presentation Editor**: Supports highlighting within text boxes and slides.
+* **Text Editor**: Provides basic highlighting functionality for selected content.
+
+---
+
+## Note for Spreadsheet Editor
+
+Highlighting text is not supported in the Spreadsheet Editor, as cells do not handle inline text formatting in the same way.
+
+---
+
+## Additional Information
+
+If you need more details about how to use or develop plugins for ONLYOFFICE, please refer to the [ONLYOFFICE Plugin Documentation](https://api.onlyoffice.com/docspace/plugins-sdk/get-started).
+
diff --git a/sdkjs-plugins/content/texthighlighter/codealike.json b/sdkjs-plugins/content/texthighlighter/codealike.json
new file mode 100644
index 00000000..a4b892c4
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/codealike.json
@@ -0,0 +1 @@
+{"projectId":"9c15a3e0-4231-11f0-aa14-d53a61904019","projectName":"text-highlighter"}
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/config.json b/sdkjs-plugins/content/texthighlighter/config.json
new file mode 100644
index 00000000..07ed8e97
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/config.json
@@ -0,0 +1,103 @@
+{
+ "name": "Text Highlighter",
+ "nameLocale": {
+ "en-US": "Text Highlighter",
+ "ru": "Выделение текста",
+ "de": "Texthervorhebung",
+ "fr": "Surligneur de texte",
+ "es": "Resaltador de texto",
+ "pt-BR": "Marcador de Texto",
+ "it": "Evidenziatore di Testo",
+ "ja": "テキストハイライター",
+ "uk": "Виділення тексту",
+ "zh": "文本高亮",
+ "cs-CS": "Zvýrazňovač textu",
+ "sq-AL": "Theksues Teksti",
+ "sr-Cyrl-RS": "Истакнувач текста",
+ "sr-Latn-RS": "Istaknuvač teksta"
+ },
+
+ "version": "1.0.0",
+ "baseUrl": "https://raza2004.github.io/onlyoffice.github.io/sdkjs-plugins/content/texthighlighter/",
+ "guid": "asc.{07FD8DFA-DFE0-4089-AL24-0730933CC804}",
+
+ "manifestVersion": "7.3.0",
+
+
+ "variations": [
+ {
+ "description": "This plugin allows you to search for text and apply highlighting, color, and formatting styles in the document.",
+ "descriptionLocale": {
+ "en": "This plugin allows you to search for text and apply highlighting, color, and formatting styles in the document.",
+ "ru": "Этот плагин позволяет вам искать текст и применять выделение, цвет и стили форматирования в документе.",
+ "de": "Dieses Plugin ermöglicht das Suchen von Text und das Anwenden von Hervorhebungen, Farben und Formatierungen im Dokument.",
+ "fr": "Ce plugin vous permet de rechercher du texte et d'appliquer des styles de surlignage, de couleur et de formatage dans le document.",
+ "es": "Este complemento le permite buscar texto y aplicar estilos de resaltado, color y formato en el documento.",
+ "pt-BR": "Este plugin permite pesquisar texto e aplicar estilos de destaque, cor e formatação no documento.",
+ "it": "Questo plugin consente di cercare testo e applicare stili di evidenziazione, colore e formattazione nel documento.",
+ "ja": "このプラグインを使用すると、ドキュメント内のテキストを検索し、ハイライト、色、およびフォーマットスタイルを適用できます。",
+ "zh": "此插件允许您在文档中搜索文本并应用高亮、颜色和格式样式。",
+ "uk": "Цей плагін дозволяє виконувати пошук тексту та застосовувати виділення, колір і стилі форматування у вашому документі.",
+ "cs-CS": "Tento plugin umožňuje vyhledávat text a aplikovat zvýraznění, barvu a formátovací styly v dokumentu.",
+ "sq-AL": "Ky shtojcë ju lejon të kërkoni tekst dhe të aplikoni stilet e theksimit, ngjyrës dhe formatimit në dokument.",
+ "sr-Cyrl-RS": "Овај додатак вам омогућава да претражујете текст и примењујете стилове истакнутог текста, боје и форматирања у документу.",
+ "sr-Latn-RS": "Ovaj dodatak vam omogućava da pretražujete tekst i primenjujete stilove istaknutog teksta, boje i formatiranja u dokumentu."
+
+ },
+ "url": "index.html",
+ "type": "panel",
+ "size": [300, 600],
+ "isViewer" : true,
+ "EditorsSupport" : ["word", "pdf"],
+ "isVisual" : true,
+ "isModal" : false,
+ "isInsideMode" : true,
+ "initDataType" : "text",
+ "isUpdateOleOnResize" : true,
+ "initOnSelectionChanged": true,
+ "events": ["onSelectionChanged", "onClick", "onApply", "onGetSelectedText"],
+ "methods": ["ApplyHighlight", "GetSelectedText"],
+ "buttons": [],
+ "icons": ["resources/light/icon.svg","resources/light/icon@2x.svg" ],
+ "icons2": [
+ {
+ "theme": "flat",
+ "style": "light",
+ "100%": { "normal": "resources/light/icon.svg" },
+ "125%": { "normal": "resources/light/icon@1.25x.svg" },
+ "150%": { "normal": "resources/light/icon@1.5x.svg" },
+ "175%": { "normal": "resources/light/icon@1.75x.svg" },
+ "200%": { "normal": "resources/light/icon@2x.svg" },
+ "default": { "normal": "resources/light/icon.svg" }
+ },
+ {
+ "theme": "flatDark",
+ "style": "dark",
+ "100%": { "normal": "resources/dark/icon.svg" },
+ "125%": { "normal": "resources/dark/icon@1.25x.svg" },
+ "150%": { "normal": "resources/dark/icon@1.5x.svg" },
+ "175%": { "normal": "resources/dark/icon@1.75x.svg" },
+ "200%": { "normal": "resources/dark/icon@2x.svg" }
+ }
+ ],
+
+ "store": {
+ "background": {
+ "light": "#107cbc",
+ "dark": "#5f55af"
+ },
+ "screenshots" : [
+ "resources/store/screenshots/screen_1.png",
+ "resources/store/screenshots/screen_2.png",
+ "resources/store/screenshots/screen_3.png",
+ "resources/store/screenshots/screen_4.png"
+ ],
+ "categories": ["work","specAbilities"],
+ "icons": {
+ "light": "resources/store/icons",
+ "dark": "resources/store/icons"
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/deploy/texthighlighter.plugin b/sdkjs-plugins/content/texthighlighter/deploy/texthighlighter.plugin
new file mode 100644
index 00000000..5038bc49
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/deploy/texthighlighter.plugin differ
diff --git a/sdkjs-plugins/content/texthighlighter/index.html b/sdkjs-plugins/content/texthighlighter/index.html
new file mode 100644
index 00000000..bd3cd22c
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/index.html
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/dark/icon.svg b/sdkjs-plugins/content/texthighlighter/resources/dark/icon.svg
new file mode 100644
index 00000000..1f4dd726
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/dark/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.25x.svg b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.25x.svg
new file mode 100644
index 00000000..10aa63e4
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.25x.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.5x.svg b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.5x.svg
new file mode 100644
index 00000000..1c071a5f
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.5x.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.75x.svg b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.75x.svg
new file mode 100644
index 00000000..f5bdfd7f
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@1.75x.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/dark/icon@2x.svg b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@2x.svg
new file mode 100644
index 00000000..c167cf36
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/dark/icon@2x.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/light/icon.svg b/sdkjs-plugins/content/texthighlighter/resources/light/icon.svg
new file mode 100644
index 00000000..ec5d8b45
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/light/icon.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.25x.svg b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.25x.svg
new file mode 100644
index 00000000..822bd1a5
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.25x.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.5x.svg b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.5x.svg
new file mode 100644
index 00000000..2dc31bcc
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.5x.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.75x.svg b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.75x.svg
new file mode 100644
index 00000000..af17193a
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/light/icon@1.75x.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/light/icon@2x.svg b/sdkjs-plugins/content/texthighlighter/resources/light/icon@2x.svg
new file mode 100644
index 00000000..312d16dd
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/light/icon@2x.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.png b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.png
new file mode 100644
index 00000000..9defea17
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.svg b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.svg
new file mode 100644
index 00000000..ec5d8b45
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.25x.png b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.25x.png
new file mode 100644
index 00000000..49379d80
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.25x.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.5x.png b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.5x.png
new file mode 100644
index 00000000..1f4b3f7f
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.5x.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.75x.png b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.75x.png
new file mode 100644
index 00000000..4aeeb439
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@1.75x.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@2x.png b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@2x.png
new file mode 100644
index 00000000..4aeeb439
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/icons/icon@2x.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_1.png b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_1.png
new file mode 100644
index 00000000..e100a3b0
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_1.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_2.png b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_2.png
new file mode 100644
index 00000000..609fde79
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_2.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_3.png b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_3.png
new file mode 100644
index 00000000..0815a6c7
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_3.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_4.png b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_4.png
new file mode 100644
index 00000000..19cbfd79
Binary files /dev/null and b/sdkjs-plugins/content/texthighlighter/resources/store/screenshots/screen_4.png differ
diff --git a/sdkjs-plugins/content/texthighlighter/scripts/code.js b/sdkjs-plugins/content/texthighlighter/scripts/code.js
new file mode 100644
index 00000000..15935349
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/scripts/code.js
@@ -0,0 +1,320 @@
+(function (window) {
+ "use strict";
+
+ // === 1) Dropdown toggle bindings (run once on DOM load)
+ document.addEventListener("DOMContentLoaded", () => {
+ document.querySelectorAll(".dropdown-header").forEach((header) => {
+ header.addEventListener("click", () => {
+ header.parentElement.classList.toggle("open");
+ });
+ });
+ });
+
+ // 2) Theme change handler
+ function onThemeChanged(theme) {
+ // Let OnlyOffice apply its base styling
+ window.Asc.plugin.onThemeChangedBase(theme);
+
+ // Toggle our dark-mode class
+ document.body.classList.toggle("dark-mode", theme.type === "dark");
+ }
+ window.Asc.plugin.attachEvent?.("onThemeChanged", onThemeChanged);
+ window.Asc.plugin.onThemeChanged = onThemeChanged;
+
+ // UI elements (filled in init)
+ let searchInput, ignoreCaseBox, applyBtn;
+ let stateInput, stateNo, stateDone;
+ let loader, foundCountSpan;
+ let highlightMore1, highlightMore2, revertBtn;
+
+ window.Asc.plugin.init = function (text) {
+ // Cache DOM nodes
+ searchInput = document.getElementById("searchText");
+ ignoreCaseBox = document.getElementById("ignoreCase");
+ applyBtn = document.getElementById("ApplyButton");
+ stateInput = document.getElementById("state-input");
+ stateNo = document.getElementById("state-no-results");
+ stateDone = document.getElementById("state-done");
+ loader = document.getElementById("loader");
+ foundCountSpan = document.getElementById("foundCount");
+ highlightMore1 = document.getElementById("HighlightMore1");
+ highlightMore2 = document.getElementById("HighlightMore2");
+ revertBtn = document.getElementById("RevertToOriginal");
+
+ Asc.scope.textColor = "#000000";
+ const pickrEl = document.getElementById("textColorPicker");
+ if (pickrEl) {
+ const pickr = Pickr.create({
+ el: pickrEl,
+ theme: "classic",
+ default: "#000000",
+ components: {
+ preview: true,
+ opacity: true,
+ hue: true,
+ interaction: {
+ hex: true,
+ rgba: false,
+ input: true,
+ clear: false,
+ save: true,
+ },
+ },
+ });
+
+ pickr.on("init", (instance) => {
+ const hex = instance.getColor().toHEXA().toString();
+ Asc.scope.textColor = hex;
+ Asc.scope.lastTxtColor = hex;
+ });
+
+ pickr.on("save", (color) => {
+ const hex = color.toHEXA().toString();
+ Asc.scope.textColor = hex;
+ Asc.scope.lastTxtColor = hex;
+ pickr.hide();
+ });
+ }
+
+ // Simple state-switchers
+ function showInput() {
+ stateInput.style.display = "";
+ stateNo.style.display = "none";
+ stateDone.style.display = "none";
+ loader.style.display = "none";
+ }
+
+ // Wire up UI
+ applyBtn.disabled = true;
+ searchInput.addEventListener("input", () => {
+ applyBtn.disabled = !searchInput.value.trim();
+ Asc.scope.appliedToSelection = false;
+ });
+
+ applyBtn.addEventListener("click", onApply);
+ highlightMore1.addEventListener("click", showInput);
+ highlightMore2.addEventListener("click", showInput);
+ revertBtn.addEventListener("click", onRevert);
+
+ // If the plugin was opened with a selection, use it
+ if (text && text.trim()) {
+ searchInput.value = text.trim();
+ applyBtn.disabled = false;
+ }
+
+ // React when user changes selection in the document
+ if (window.Asc.plugin.attachEvent) {
+ window.Asc.plugin.attachEvent("onSelectionChanged", (sel) => {
+ if (sel && sel.text) {
+ searchInput.value = sel.text;
+ applyBtn.disabled = false;
+ }
+ });
+ }
+
+ // Initialize last-term storage
+ Asc.scope.lastTerm = "";
+ Asc.scope.lastCaseSens = false;
+
+ // Show the initial state
+ showInput();
+ };
+
+ // 3) Apply highlights
+ function onApply() {
+ // Reset undo count for each new apply action
+ Asc.scope.undoCount = 1;
+
+ const caseSens = !ignoreCaseBox.checked;
+ const hlColor = document.getElementById("highlightColor").value;
+ const txtColor = Asc.scope.textColor || "#000000";
+ const doBold = document.getElementById("boldCheckbox").checked;
+ const doItalic = document.getElementById("italicCheckbox").checked;
+ const doUnder = document.getElementById("underlineCheckbox").checked;
+ const doStrike = document.getElementById("strikeCheckbox").checked;
+
+ // Store properties in Asc.scope
+ Asc.scope.caseSens = caseSens;
+ Asc.scope.hlColor = hlColor;
+ Asc.scope.txtColor = txtColor;
+ Asc.scope.doBold = doBold;
+ Asc.scope.doItalic = doItalic;
+ Asc.scope.doUnder = doUnder;
+ Asc.scope.doStrike = doStrike;
+ Asc.scope.lastTerm = searchInput.value.trim();
+
+ // Transition UI
+ stateInput.style.display = "none";
+ stateNo.style.display = "none";
+ stateDone.style.display = "none";
+ loader.style.display = "";
+
+ window.Asc.plugin.callCommand(function () {
+ const doc = Api.GetDocument();
+ const core = doc.GetCore();
+ core.SetLanguage("fr-FR");
+
+ const language = core.GetLanguage();
+
+ const range = doc.GetRangeBySelect();
+ const textPr = Api.CreateTextPr();
+
+ // Set all text properties
+ textPr.SetHighlight(Asc.scope.hlColor);
+ if (Asc.scope.doBold) textPr.SetBold(true);
+ if (Asc.scope.doItalic) textPr.SetItalic(true);
+ if (Asc.scope.doUnder) textPr.SetUnderline(true);
+ if (Asc.scope.doStrike) textPr.SetStrikeout(true);
+
+ if (Asc.scope.txtColor !== "#000000") {
+ const rgb = Asc.scope.txtColor
+ .slice(1)
+ .match(/.{2}/g)
+ .map((h) => parseInt(h, 16));
+ textPr.SetColor(rgb[0], rgb[1], rgb[2], false);
+ }
+
+ if (range && range.GetText && range.GetText() !== "") {
+ // Apply to selected range
+ range.SetTextPr(textPr);
+ Asc.scope.appliedViaSelection = true;
+ return 1;
+ } else if (Asc.scope.lastTerm) {
+ // Search mode if no selection
+ const results = doc.Search(Asc.scope.lastTerm, Asc.scope.caseSens);
+ results.forEach((result) => {
+ result.SetTextPr(textPr);
+ });
+ Asc.scope.appliedViaSelection = false;
+ return results.length;
+ } else {
+ // Apply to entire document
+ const paragraphs = doc.GetAllParagraphs();
+ paragraphs.forEach((para) => {
+ para.SetTextPr(textPr);
+ });
+ Asc.scope.appliedViaSelection = true;
+ return paragraphs.length;
+ }
+ }, false);
+ }
+
+ // 4) Revert highlights
+
+ function onRevert() {
+ // If nothing was applied, exit safely
+ if (!Asc.scope.undoCount || Asc.scope.undoCount <= 0) {
+ resetToMainView();
+ return;
+ }
+
+ loader.style.display = "";
+
+ const performUndo = (stepsRemaining) => {
+ if (stepsRemaining <= 0) {
+ // Done undoing → clean state
+ Asc.scope.undoCount = 0;
+ Asc.scope.lastTerm = "";
+ Asc.scope.appliedViaSelection = false;
+
+ loader.style.display = "none";
+
+ // Show clean UI again
+ resetToMainView();
+ return;
+ }
+
+ // Perform 1 undo → then recursively undo the rest
+ window.Asc.plugin.executeMethod("Undo", null, () => {
+ setTimeout(() => performUndo(stepsRemaining - 1), 100);
+ });
+ };
+
+ // Start the undo chain
+ performUndo(Asc.scope.undoCount);
+ }
+ function resetToMainView() {
+ stateInput.style.display = "";
+ stateNo.style.display = "none";
+ stateDone.style.display = "none";
+ loader.style.display = "none";
+ }
+
+ // 5) After each callCommand
+ window.Asc.plugin.onCommandCallback = function (count) {
+ const n = Number(count) || 0;
+ loader.style.display = "none";
+
+ if (n === 0) {
+ stateNo.style.display = "";
+ stateDone.style.display = "none";
+ stateInput.style.display = "none";
+ } else if (Asc.scope.appliedViaSelection) {
+ // show input again, so user can immediately re‐apply or revert
+ stateInput.style.display = "none";
+ stateDone.style.display = "";
+ stateNo.style.display = "";
+ } else {
+ // regular search‐based Done UI
+ foundCountSpan.textContent = n;
+ stateDone.style.display = "";
+ stateInput.style.display = "none";
+ stateNo.style.display = "none";
+ }
+ };
+
+ Asc.scope.undoCount = 1; // one full operation to undo
+
+ // 6) Translation hookup
+ window.Asc.plugin.onTranslate = function () {
+ const $ = (id) => document.getElementById(id);
+ const trSafe = (key) => {
+ const t = window.Asc.plugin.tr(key);
+ return t && t !== key ? t : null; // null → fallback to English text from HTML
+ };
+
+ // Simple text replacements
+ const applyTr = (id) => {
+ const el = $(id);
+ if (!el) return;
+ const translated = trSafe(id);
+ if (translated) el.innerHTML = translated; // fallback happens automatically
+ };
+
+ // IDs to translate
+ const idsToTranslate = [
+ "PluginInstructions",
+ "TextToSearch",
+ "IgnoreCase",
+ "HighlightColor",
+ "HighlightYellow",
+ "HighlightGreen",
+ "HighlightBlue",
+ "HighlightRed",
+ "HighlightNone",
+ "TextColorHeader",
+ "TextFormattingHeader",
+ "FormatBold",
+ "FormatItalic",
+ "FormatUnderline",
+ "FormatStrike",
+ "ApplyButton",
+ "SearchNoResults",
+ "SearchDone",
+ "MatchesFound",
+ "HighlightMore1",
+ "HighlightMore2",
+ "RevertToOriginal",
+ "LoadingMessage",
+ ];
+
+ idsToTranslate.forEach(applyTr);
+
+ // Placeholder translation
+ const input = $("searchText");
+ if (input) {
+ const placeholder = trSafe("SearchPlaceholder");
+ if (placeholder) input.placeholder = placeholder;
+ }
+ };
+})(window);
diff --git a/sdkjs-plugins/content/texthighlighter/styles.css b/sdkjs-plugins/content/texthighlighter/styles.css
new file mode 100644
index 00000000..a1a90da2
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/styles.css
@@ -0,0 +1,329 @@
+body {
+ background: #fff;
+ overflow-y: scroll;
+
+ color: #333;
+}
+
+.container {
+ padding: 13px;
+ overflow-y: auto;
+ height: 95vh;
+}
+
+.container::-webkit-scrollbar {
+ display: none;
+}
+
+.header {
+ font-size: 0.8em;
+ margin-top: 10px;
+ font-family: Arial, Helvetica, sans-serif;
+ margin-bottom: 20px;
+}
+
+/* */
+#highlightColor {
+ color: black;
+ padding: 0.2em;
+ max-width: 80px;
+ font-size: 0.8em;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ background-color: #f9f9f9;
+ cursor: pointer;
+}
+
+#highlightColor:hover {
+ border-color: #aaa;
+}
+
+#highlightColor option {
+ padding: 0.5em;
+ background-color: #fff;
+ color: #252525;
+}
+
+#highlightColor option:hover {
+ background-color: #ddd;
+}
+
+#highlightColor option[value="yellow"] {
+ background-color: #ffffcc;
+}
+
+#highlightColor option[value="green"] {
+ background-color: #ccffcc;
+}
+
+#highlightColor option[value="blue"] {
+ background-color: #4781d1;
+}
+
+#highlightColor option[value="red"] {
+ background-color: #ffcccc;
+}
+
+
+/* */
+/* Hide scrollbar for IE, Edge and Firefox */
+.container {
+ -ms-overflow-style: none;
+ /* IE and Edge */
+ scrollbar-width: none;
+ /* Firefox */
+}
+
+.container p {
+ font-size: 12px;
+ margin: 10px 0;
+ text-align: center;
+}
+
+#state-no-results button,
+#state-done button {
+ width: 100%;
+ margin-top: 8px;
+}
+
+#state-done p:first-child {
+ font-weight: bold;
+}
+
+/* Dropdown panel wrapper */
+.dropdown {
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ margin-bottom: 12px;
+ overflow: hidden;
+}
+
+/* Header always visible */
+.dropdown-header {
+ padding: 10px;
+ background: #f9f9f9;
+ cursor: pointer;
+ position: relative;
+ font-weight: bold;
+}
+
+/* The little arrow */
+.dropdown-header .arrow {
+ position: absolute;
+ right: 12px;
+ transition: transform 0.2s;
+}
+
+/* Collapsed by default */
+.dropdown-content {
+ max-height: 0;
+ overflow: hidden;
+ transition: max-height 0.3s ease;
+ background: #fff;
+ padding: 0 10px;
+}
+
+/* When open, allow comfortable height */
+.dropdown.open .dropdown-content {
+ max-height: 150px;
+ /* adjust if you need more space */
+ padding: 10px;
+}
+
+/* Rotate arrow when open */
+.dropdown.open .dropdown-header .arrow {
+ transform: rotate(90deg);
+}
+
+/* Formatting options laid out */
+.format-options {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+}
+
+.format-options label {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ background: #f0f0f0;
+ padding: 6px 10px;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+
+.section {
+ margin-bottom: 10px;
+ padding: 0 2px 12px 0;
+
+}
+
+.section label {
+ font-weight: bold;
+ align-items: center;
+ font-size: 15px;
+ margin-bottom: 6px;
+}
+
+input[type="text"] {
+ width: 100%;
+ border-radius: 4px;
+ margin-top: 6px;
+ padding: 8px;
+ box-sizing: border-box;
+}
+
+.format-options {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+}
+
+.format-option {
+ display: flex;
+ align-items: center;
+ padding: 5px 10px;
+ background: #f0f0f0;
+ border-radius: 4px;
+ cursor: pointer;
+}
+
+.format-option:hover {
+ background: #e0e0e0;
+}
+
+.format-option.active {
+ background: #446995;
+ color: white;
+}
+
+.applyButton {
+ background: #446995;
+ color: white;
+ border: none;
+ padding: 10px 20px;
+ cursor: pointer;
+ border-radius: 4px;
+ font-weight: bold;
+ width: 100%;
+ margin-top: 18px;
+ margin-bottom: 15px;
+}
+
+.applyButton:disabled {
+ background: #cccccc;
+ cursor: not-allowed;
+}
+
+.message {
+ margin-top: 15px;
+ padding: 10px;
+ border-radius: 4px;
+ text-align: center;
+}
+
+#loader {
+ text-align: center;
+ font-style: italic;
+ color: #666;
+}
+
+body.dark-mode {
+ background: #404040;
+ color: #ddd;
+}
+
+body.dark-mode input[type="text"],
+body.dark-mode select,
+body.dark-mode .dropdown-content {
+ background: #2a2a2a;
+ color: #ddd;
+ border-color: #444;
+}
+
+body.dark-mode .dropdown-header {
+ background: #2a2a2a;
+ color: #ddd;
+ border-color: #444;
+}
+
+body.dark-mode .dropdown.open .dropdown-content {
+ background: #2a2a2a;
+}
+
+body.dark-mode .format-options label {
+ background: #333;
+ color: #eee;
+}
+
+body.dark-mode .format-options label:hover {
+ background: #3a3a3a;
+}
+
+body.dark-mode button {
+ background: #fff !important;
+ opacity: 0.8 !important;
+ color: #333 !important;
+}
+
+body.dark-mode button:disabled {
+ background: #fff !important;
+ opacity: 0.5 !important;
+ color: #333 !important;
+}
+
+body.dark-mode .loader {
+ color: #aaa;
+}
+
+/* ─── Desktop/wide screens ─────────────────────────────────── */
+@media (min-width: 1300px) {
+ .container {
+ max-width: 500px;
+ /* widen the panel */
+ font-size: 0.9rem;
+ /* bump up base text */
+ padding: 18px;
+ }
+
+ h3 {
+ font-size: 1.1rem;
+ margin-bottom: 1rem;
+ }
+
+ input[type="text"],
+ select {
+ font-size: 0.8rem;
+ padding: 10px;
+ }
+
+ .dropdown-header {
+ font-size: 1rem;
+ padding: 12px;
+ }
+
+ .dropdown-content input,
+ .format-options label {
+ font-size: 0.85rem;
+ }
+
+ .applyButton,
+ #state-no-results button,
+ #state-done button {
+ font-size: 0.85rem;
+ padding: 12px;
+ }
+
+ /* Make the container scroll if it grows taller than the sidebar */
+}
+
+#textColorPicker {
+ width: 100%;
+ height: 32px;
+ border: 1px solid #444;
+ border-radius: 4px;
+ cursor: pointer;
+ background: #000;
+ /* initial default color swatch */
+}
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/translations/cs-CS.json b/sdkjs-plugins/content/texthighlighter/translations/cs-CS.json
new file mode 100644
index 00000000..1c9b5214
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/cs-CS.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Zvýrazňovač textu",
+ "PluginInstructions": "Zadejte nebo vyberte slovo nebo frázi pro hledání v textu dokumentu a nakonfigurujte potřebná nastavení.",
+
+ "TextToSearch": "Text k vyhledání:",
+ "SearchPlaceholder": "Zadejte text nebo vyberte v dokumentu",
+ "IgnoreCase": "Ignorovat velikost písmen",
+
+ "HighlightColor": "Barva zvýraznění:",
+ "HighlightYellow": "Žlutá",
+ "HighlightGreen": "Zelená",
+ "HighlightBlue": "Modrá",
+ "HighlightRed": "Červená",
+ "HighlightNone": "Bez výplně",
+
+ "TextColorHeader": "Barva textu",
+ "ArrowDropdown": "▸",
+ "TextColorPicker": "Vyberte barvu textu",
+
+ "TextFormattingHeader": "Formátování textu",
+ "FormatBold": "Tučné",
+ "FormatItalic": "Kurzíva",
+ "FormatUnderline": "Podtržení",
+ "FormatStrike": "Přeškrtnutí",
+
+ "ApplyButton": "Použít",
+
+ "SearchNoResults": "Hledání dokončeno. Nebyly nalezeny žádné shody. ",
+ "HighlightMore": "Zvýraznit více",
+ "HighlightMore2": "Zvýraznit více",
+
+ "SearchDone": "Hotovo! Hledání bylo dokončeno a styly byly aplikovány.",
+ "MatchesFound": "Nalezené shody:",
+ "RevertToOriginal": "Vrátit zpět",
+
+ "LoadingMessage": "Zpracovávám...",
+
+ "AboutTitle": "Zvýrazňovač textu",
+ "AboutVersion": "Verze 1.0.0",
+ "AboutDescription": "Tento plugin umožňuje vyhledávat text a aplikovat zvýraznění, barvu a formátování ve vašem dokumentu.",
+ "AboutCopyright": "© 2025 ONLYOFFICE Plugin"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/de-DE.json b/sdkjs-plugins/content/texthighlighter/translations/de-DE.json
new file mode 100644
index 00000000..0734e115
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/de-DE.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Texthervorhebung",
+ "PluginInstructions": "Geben Sie ein Wort oder einen Satz ein oder wählen Sie es aus dem Dokument aus, und konfigurieren Sie die gewünschten Einstellungen.",
+
+ "TextToSearch": "Zu suchender Text:",
+ "SearchPlaceholder": "Text eingeben oder im Dokument auswählen",
+ "IgnoreCase": "Groß-/Kleinschreibung ignorieren",
+
+ "HighlightColor": "Hervorhebungsfarbe:",
+ "HighlightYellow": "Gelb",
+ "HighlightGreen": "Grün",
+ "HighlightBlue": "Blau",
+ "HighlightRed": "Rot",
+ "HighlightNone": "Keine Füllung",
+ "ArrowDropdown": "▸",
+
+ "TextColorHeader": "Textfarbe",
+ "TextColorPicker": "Textfarbe wählen",
+
+ "TextFormattingHeader": "Textformatierung",
+ "FormatBold": "Fett",
+ "FormatItalic": "Kursiv",
+ "FormatUnderline": "Unterstrichen",
+ "FormatStrike": "Durchgestrichen",
+
+ "ApplyButton": "Anwenden",
+
+ "SearchNoResults": "Suche abgeschlossen. Keine Treffer gefunden. ",
+ "HighlightMore": "Mehr hervorheben",
+ "HighlightMore2": "Mehr hervorheben",
+
+ "SearchDone": "Fertig! Die Suche ist abgeschlossen und die Stile wurden angewendet.",
+ "MatchesFound": "Gefundene Treffer:",
+ "RevertToOriginal": "Wiederherstellen",
+
+ "LoadingMessage": "Verarbeitung läuft...",
+
+ "AboutTitle": "Texthervorhebung",
+ "AboutVersion": "Version 1.0.0",
+ "AboutDescription": "Dieses Plugin ermöglicht das Suchen von Text und das Anwenden von Hervorhebungen, Farben und Formatierungen im Dokument.",
+ "AboutCopyright": "© 2025 ONLYOFFICE-Plugin"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/en-US.json b/sdkjs-plugins/content/texthighlighter/translations/en-US.json
new file mode 100644
index 00000000..e28b17b0
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/en-US.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Text Highlighter",
+ "PluginInstructions": "Enter or select a word or phrase to search in the document text, and configure the necessary settings.",
+
+ "TextToSearch": "Text to search:",
+ "SearchPlaceholder": "Enter text or select in document",
+ "IgnoreCase": "Ignore case",
+
+ "HighlightColor": "Highlight color :",
+ "HighlightYellow": "Yellow",
+ "HighlightGreen": "Green",
+ "HighlightBlue": "Blue",
+ "HighlightRed": "Red",
+ "HighlightNone": "No Fill",
+ "ArrowDropdown": "▸",
+
+ "TextColorHeader": "Text color",
+ "TextColorPicker": "Choose text color",
+
+ "TextFormattingHeader": "Text formatting",
+ "FormatBold": "Bold",
+ "FormatItalic": "Italic",
+ "FormatUnderline": "Underline",
+ "FormatStrike": "Strikethrough",
+
+ "ApplyButton": "Apply",
+
+ "SearchNoResults": "Search completed. No matches found. ",
+ "HighlightMore": "Highlight more",
+ "HighlightMore2": "Highlight more",
+
+ "SearchDone": "Done! The search is complete and styles have been applied.",
+ "MatchesFound": "Matches found:",
+ "RevertToOriginal": "Revert",
+
+ "LoadingMessage": "Processing...",
+
+ "AboutTitle": "Text Highlighter",
+ "AboutVersion": "Version 1.0.0",
+ "AboutDescription": "This plugin allows you to search text and apply highlighting, color, and formatting styles in your document.",
+ "AboutCopyright": "© 2025 ONLYOFFICE Plugin"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/es-ES.json b/sdkjs-plugins/content/texthighlighter/translations/es-ES.json
new file mode 100644
index 00000000..4fede6e1
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/es-ES.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Resaltador de Texto",
+ "PluginInstructions": "Introduce o selecciona una palabra o frase para buscar en el texto del documento, y configura los ajustes necesarios.",
+
+ "TextToSearch": "Texto a buscar:",
+ "SearchPlaceholder": "Introduce texto o selecciona en el documento",
+ "IgnoreCase": "Ignorar mayúsculas/minúsculas",
+
+ "HighlightColor": "Color de resaltado:",
+ "HighlightYellow": "Amarillo",
+ "HighlightGreen": "Verde",
+ "HighlightBlue": "Azul",
+ "HighlightRed": "Rojo",
+ "HighlightNone": "Sin relleno",
+ "ArrowDropdown": "▸",
+
+ "TextColorHeader": "Color del texto",
+ "TextColorPicker": "Elige el color del texto",
+
+ "TextFormattingHeader": "Formato del texto",
+ "FormatBold": "Negrita",
+ "FormatItalic": "Cursiva",
+ "FormatUnderline": "Subrayado",
+ "FormatStrike": "Tachado",
+
+ "ApplyButton": "Aplicar",
+
+ "SearchNoResults": "Búsqueda completada. No se encontraron coincidencias. ",
+ "HighlightMore": "Resaltar más",
+ "HighlightMore2": "Resaltar más",
+
+ "SearchDone": "¡Hecho! La búsqueda se completó y se aplicaron los estilos.",
+ "MatchesFound": "Coincidencias encontradas:",
+ "RevertToOriginal": "Revertir",
+
+ "LoadingMessage": "Procesando...",
+
+ "AboutTitle": "Resaltador de Texto",
+ "AboutVersion": "Versión 1.0.0",
+ "AboutDescription": "Este complemento te permite buscar texto y aplicar resaltado, color y estilos de formato en tu documento.",
+ "AboutCopyright": "© 2025 Complemento ONLYOFFICE"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/fr-FR.json b/sdkjs-plugins/content/texthighlighter/translations/fr-FR.json
new file mode 100644
index 00000000..b9f83546
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/fr-FR.json
@@ -0,0 +1,41 @@
+{
+ "TextHighlighter": "Surligneur de texte",
+ "PluginInstructions": "Entrez ou sélectionnez un mot ou une expression à rechercher dans le texte du document, puis configurez les paramètres nécessaires.",
+
+ "TextToSearch": "Texte à rechercher :",
+ "SearchPlaceholder": "Entrez du texte ou sélectionnez-le dans le document",
+ "IgnoreCase": "Ignorer la casse",
+
+ "HighlightColor": "Couleur de surlignage :",
+ "HighlightYellow": "Jaune",
+ "HighlightGreen": "Vert",
+ "HighlightBlue": "Bleu",
+ "HighlightRed": "Rouge",
+ "HighlightNone": "Pas de remplissage",
+"ArrowDropdown": "▸",
+ "TextColorHeader": "Couleur du texte",
+ "TextColorPicker": "Choisir la couleur du texte",
+
+ "TextFormattingHeader": "Formatage du texte",
+ "FormatBold": "Gras",
+ "FormatItalic": "Italique",
+ "FormatUnderline": "Souligné",
+ "FormatStrike": "Barré",
+
+ "ApplyButton": "Appliquer",
+
+ "SearchNoResults": "Recherche terminée. Aucun résultat trouvé. ",
+ "HighlightMore": "Surligner plus",
+ "HighlightMore2": "Surligner plus",
+
+ "SearchDone": "Terminé ! La recherche est terminée et les styles ont été appliqués.",
+ "MatchesFound": "Correspondances trouvées :",
+ "RevertToOriginal": "Revenir",
+
+ "LoadingMessage": "Traitement en cours...",
+
+ "AboutTitle": "Surligneur de texte",
+ "AboutVersion": "Version 1.0.0",
+ "AboutDescription": "Ce plugin permet de rechercher du texte et d'appliquer des styles de surlignage, de couleur et de formatage dans le document.",
+ "AboutCopyright": "© 2025 Plugin ONLYOFFICE"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/it-IT.json b/sdkjs-plugins/content/texthighlighter/translations/it-IT.json
new file mode 100644
index 00000000..d1c6a961
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/it-IT.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Evidenziatore di Testo",
+ "PluginInstructions": "Inserisci o seleziona una parola o frase da cercare nel testo del documento e configura le impostazioni necessarie.",
+
+ "TextToSearch": "Testo da cercare:",
+ "SearchPlaceholder": "Inserisci testo o seleziona nel documento",
+ "IgnoreCase": "Ignora maiuscole/minuscole",
+
+ "HighlightColor": "Colore evidenziazione:",
+ "HighlightYellow": "Giallo",
+ "HighlightGreen": "Verde",
+ "HighlightBlue": "Blu",
+ "HighlightRed": "Rosso",
+ "HighlightNone": "Nessun riempimento",
+
+ "TextColorHeader": "Colore del testo",
+ "TextColorPicker": "Scegli colore del testo",
+ "ArrowDropdown": "▸",
+
+ "TextFormattingHeader": "Formattazione testo",
+ "FormatBold": "Grassetto",
+ "FormatItalic": "Corsivo",
+ "FormatUnderline": "Sottolineato",
+ "FormatStrike": "Barrato",
+
+ "ApplyButton": "Applica",
+
+ "SearchNoResults": "Ricerca completata. Nessuna corrispondenza trovata. ",
+ "HighlightMore": "Evidenzia di più",
+ "HighlightMore2": "Evidenzia di più",
+
+ "SearchDone": "Fatto! La ricerca è completa e gli stili sono stati applicati.",
+ "MatchesFound": "Corrispondenze trovate:",
+ "RevertToOriginal": "Ripristina",
+
+ "LoadingMessage": "Elaborazione...",
+
+ "AboutTitle": "Evidenziatore di Testo",
+ "AboutVersion": "Versione 1.0.0",
+ "AboutDescription": "Questo plugin consente di cercare il testo e applicare evidenziazioni, colori e formattazioni nel documento.",
+ "AboutCopyright": "© 2025 Plugin ONLYOFFICE"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/ja-JA.json b/sdkjs-plugins/content/texthighlighter/translations/ja-JA.json
new file mode 100644
index 00000000..236f0a88
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/ja-JA.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "テキストハイライター",
+ "PluginInstructions": "検索する単語またはフレーズ を入力または選択し、必要な設定を構成します。",
+
+ "TextToSearch": "検索するテキスト:",
+ "SearchPlaceholder": "テキストを入力またはドキュメントから選択",
+ "IgnoreCase": "大文字と小文字を区別しない",
+
+ "HighlightColor": "ハイライトの色:",
+ "HighlightYellow": "黄色",
+ "HighlightGreen": "緑",
+ "HighlightBlue": "青",
+ "HighlightRed": "赤",
+ "HighlightNone": "塗りなし",
+ "ArrowDropdown": "▸",
+
+ "TextColorHeader": "テキストの色",
+ "TextColorPicker": "テキストの色を選択",
+
+ "TextFormattingHeader": "テキストの書式",
+ "FormatBold": "太字",
+ "FormatItalic": "斜体",
+ "FormatUnderline": "下線",
+ "FormatStrike": "取り消し線",
+
+ "ApplyButton": "適用",
+
+ "SearchNoResults": "検索完了。一致するものは見つかりませんでした。 ",
+ "HighlightMore": "さらにハイライト",
+ "HighlightMore2": "さらにハイライト",
+
+ "SearchDone": "完了!検索が完了し、スタイルが適用されました。",
+ "MatchesFound": "一致件数:",
+ "RevertToOriginal": "元に戻す",
+
+ "LoadingMessage": "処理中...",
+
+ "AboutTitle": "テキストハイライター",
+ "AboutVersion": "バージョン 1.0.0",
+ "AboutDescription": "このプラグインでは、テキストの検索およびハイライト、色、書式スタイルの適用が可能です。",
+ "AboutCopyright": "© 2025 ONLYOFFICE プラグイン"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/langs.json b/sdkjs-plugins/content/texthighlighter/translations/langs.json
new file mode 100644
index 00000000..0b245632
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/langs.json
@@ -0,0 +1,13 @@
+[
+ "ru-RU",
+ "de-DE",
+ "fr-FR",
+ "es-ES",
+ "pt-BR",
+ "it-IT",
+ "ja-JA",
+ "zh-ZH",
+ "cs-CS",
+ "sq-AL",
+ "uk-UA"
+]
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/translations/pt-BR.json b/sdkjs-plugins/content/texthighlighter/translations/pt-BR.json
new file mode 100644
index 00000000..155931dd
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/pt-BR.json
@@ -0,0 +1,33 @@
+{
+ "TextHighlighter": "Realçador de Texto",
+ "PluginInstructions": "Digite ou selecione uma palavra ou frase para buscar no texto do documento e configure as opções necessárias.",
+ "TextToSearch": "Texto para buscar:",
+ "SearchPlaceholder": "Digite ou selecione no documento",
+ "IgnoreCase": "Ignorar maiúsculas/minúsculas",
+ "HighlightColor": "Cor do destaque:",
+ "HighlightYellow": "Amarelo",
+ "HighlightGreen": "Verde",
+ "HighlightBlue": "Azul",
+ "HighlightRed": "Vermelho",
+ "HighlightNone": "Sem preenchimento",
+ "TextColorHeader": "Cor do texto",
+ "TextColorPicker": "Escolher cor do texto",
+ "TextFormattingHeader": "Formatação do texto",
+ "FormatBold": "Negrito",
+ "FormatItalic": "Itálico",
+ "FormatUnderline": "Sublinhado",
+ "FormatStrike": "Tachado",
+ "ApplyButton": "Aplicar",
+ "SearchNoResults": "Busca concluída. Nenhuma correspondência encontrada. ",
+ "HighlightMore": "Realçar mais",
+ "HighlightMore2": "Realçar mais",
+ "ArrowDropdown": "▸",
+ "SearchDone": "Concluído! A busca foi finalizada e os estilos foram aplicados.",
+ "MatchesFound": "Correspondências encontradas:",
+ "RevertToOriginal": "Reverter",
+ "LoadingMessage": "Processando...",
+ "AboutTitle": "Realçador de Texto",
+ "AboutVersion": "Versão 1.0.0",
+ "AboutDescription": "Este plugin permite buscar texto e aplicar realce, cor e estilos de formatação no seu documento.",
+ "AboutCopyright": "© 2025 Plugin ONLYOFFICE"
+}
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/translations/ru-RU.json b/sdkjs-plugins/content/texthighlighter/translations/ru-RU.json
new file mode 100644
index 00000000..754c58d2
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/ru-RU.json
@@ -0,0 +1,33 @@
+{
+ "TextHighlighter": "Выделение текста",
+ "PluginInstructions": "Введите или выберите слово или фразу для поиска в тексте документа и настройте необходимые параметры.",
+ "TextToSearch": "Текст для поиска:",
+ "SearchPlaceholder": "Введите текст или выберите в документе",
+ "IgnoreCase": "Игнорировать регистр",
+ "HighlightColor": "Цвет выделения:",
+ "HighlightYellow": "Жёлтый",
+ "HighlightGreen": "Зелёный",
+ "HighlightBlue": "Синий",
+ "HighlightRed": "Красный",
+ "HighlightNone": "Без заливки",
+ "TextColorHeader": "Цвет текста",
+ "TextColorPicker": "Выбрать цвет текста",
+ "TextFormattingHeader": "Форматирование текста",
+ "FormatBold": "Жирный",
+ "FormatItalic": "Курсив",
+ "FormatUnderline": "Подчёркнутый",
+ "FormatStrike": "Зачёркнутый",
+ "ApplyButton": "Применить",
+ "SearchNoResults": "Поиск завершён. Совпадения не найдены. ",
+ "HighlightMore": "Выделить ещё",
+ "HighlightMore2": "Выделить ещё",
+ "ArrowDropdown": "▸",
+ "SearchDone": "Готово! Поиск завершён, стили применены.",
+ "MatchesFound": "Найдено совпадений:",
+ "RevertToOriginal": "Вернуть",
+ "LoadingMessage": "Обработка...",
+ "AboutTitle": "Выделение текста",
+ "AboutVersion": "Версия 1.0.0",
+ "AboutDescription": "Этот плагин позволяет искать текст и применять стили выделения, цвета и форматирования в документе.",
+ "AboutCopyright": "© 2025 Плагин ONLYOFFICE"
+}
\ No newline at end of file
diff --git a/sdkjs-plugins/content/texthighlighter/translations/sq-AL.json b/sdkjs-plugins/content/texthighlighter/translations/sq-AL.json
new file mode 100644
index 00000000..3a768c87
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/sq-AL.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Theksues Teksti",
+ "PluginInstructions": "Shkruani ose zgjidhni një fjalë ose frazë për të kërkuar në tekstin e dokumentit dhe konfiguroni cilësimet e nevojshme.",
+
+ "TextToSearch": "Teksti për të kërkuar:",
+ "SearchPlaceholder": "Shkruani tekstin ose zgjidhni në dokument",
+ "IgnoreCase": "Injoro shkronjat e mëdha/vogla",
+
+ "HighlightColor": "Ngjyra e theksimit:",
+ "HighlightYellow": "E verdhë",
+ "HighlightGreen": "E gjelbër",
+ "HighlightBlue": "Blu",
+ "HighlightRed": "E kuqe",
+ "HighlightNone": "Pa mbushje",
+
+ "TextColorHeader": "Ngjyra e tekstit",
+ "TextColorPicker": "Zgjidh ngjyrën e tekstit",
+
+ "TextFormattingHeader": "Formatimi i tekstit",
+ "FormatBold": "Trashë",
+ "FormatItalic": "Pjerrët",
+ "FormatUnderline": "Nënvizuar",
+ "FormatStrike": "Me vijë në mes",
+
+ "ApplyButton": "Zbato",
+
+ "SearchNoResults": "Kërkimi përfundoi. Asnjë përputhje nuk u gjet. ",
+ "HighlightMore": "Thekso më shumë",
+ "HighlightMore2": "Thekso më shumë",
+ "ArrowDropdown": "▸",
+
+ "SearchDone": "U krye! Kërkimi përfundoi dhe stilet u aplikuan.",
+ "MatchesFound": "Përputhje të gjetura:",
+ "RevertToOriginal": "Kthehu",
+
+ "LoadingMessage": "Duke përpunuar...",
+
+ "AboutTitle": "Theksues Teksti",
+ "AboutVersion": "Versioni 1.0.0",
+ "AboutDescription": "Ky shtesë ju lejon të kërkoni tekst dhe të aplikoni theksim, ngjyra dhe formate në dokumentin tuaj.",
+ "AboutCopyright": "© 2025 ONLYOFFICE Plugin"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/sr-Cyrl-RS.json b/sdkjs-plugins/content/texthighlighter/translations/sr-Cyrl-RS.json
new file mode 100644
index 00000000..debe96ec
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/sr-Cyrl-RS.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Означивач текста",
+ "PluginInstructions": "Унесите или изаберите реч или фразу за претрагу у тексту документа и подесите потребна подешавања.",
+
+ "TextToSearch": "Текст за претрагу:",
+ "SearchPlaceholder": "Унесите текст или изаберите у документу",
+ "IgnoreCase": "Игнориши велика/мала слова",
+
+ "HighlightColor": "Боја означавања:",
+ "HighlightYellow": "Жута",
+ "HighlightGreen": "Зелена",
+ "HighlightBlue": "Плава",
+ "HighlightRed": "Црвена",
+ "HighlightNone": "Без испуне",
+
+ "TextColorHeader": "Боја текста",
+ "TextColorPicker": "Изабери боју текста",
+
+ "TextFormattingHeader": "Форматирање текста",
+ "FormatBold": "Подебљано",
+ "FormatItalic": "Курзив",
+ "FormatUnderline": "Подвучено",
+ "FormatStrike": "Прецртано",
+
+ "ApplyButton": "Примени",
+
+ "SearchNoResults": "Претрага завршена. Нема пронађених поклапања. ",
+ "HighlightMore": "Означи више",
+ "HighlightMore2": "Означи више",
+ "ArrowDropdown": "▸",
+
+ "SearchDone": "Готово! Претрага је завршена и стилови су примењени.",
+ "MatchesFound": "Пронађена поклапања:",
+ "RevertToOriginal": "Врати на оригинал",
+
+ "LoadingMessage": "Обрада у току...",
+
+ "AboutTitle": "Означивач текста",
+ "AboutVersion": "Верзија 1.0.0",
+ "AboutDescription": "Овај додатак омогућава претрагу текста и примену означавања, боја и форматирања у документу.",
+ "AboutCopyright": "© 2025 ONLYOFFICE Plugin"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/sr-Latn-RS.json b/sdkjs-plugins/content/texthighlighter/translations/sr-Latn-RS.json
new file mode 100644
index 00000000..b654b63f
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/sr-Latn-RS.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Označivač teksta",
+ "PluginInstructions": "Unesite ili izaberite reč ili frazu za pretragu u tekstu dokumenta i podesite potrebna podešavanja.",
+
+ "TextToSearch": "Tekst za pretragu:",
+ "SearchPlaceholder": "Unesite tekst ili izaberite u dokumentu",
+ "IgnoreCase": "Ignoriši velika/mala slova",
+
+ "HighlightColor": "Boja označavanja:",
+ "HighlightYellow": "Žuta",
+ "HighlightGreen": "Zelena",
+ "HighlightBlue": "Plava",
+ "HighlightRed": "Crvena",
+ "HighlightNone": "Bez ispune",
+
+ "TextColorHeader": "Boja teksta",
+ "TextColorPicker": "Izaberi boju teksta",
+
+ "TextFormattingHeader": "Formatiranje teksta",
+ "FormatBold": "Podebljano",
+ "FormatItalic": "Kurziv",
+ "FormatUnderline": "Podvučeno",
+ "FormatStrike": "Precrtano",
+
+ "ApplyButton": "Primeni",
+
+ "SearchNoResults": "Pretraga završena. Nema pronađenih poklapanja. ",
+ "HighlightMore": "Označi više",
+ "HighlightMore2": "Označi više",
+ "ArrowDropdown": "▸",
+
+ "SearchDone": "Gotovo! Pretraga je završena i stilovi su primenjeni.",
+ "MatchesFound": "Pronađena poklapanja:",
+ "RevertToOriginal": "Vrati na original",
+
+ "LoadingMessage": "Obrada u toku...",
+
+ "AboutTitle": "Označivač teksta",
+ "AboutVersion": "Verzija 1.0.0",
+ "AboutDescription": "Ovaj dodatak omogućava pretragu teksta i primenu označavanja, boja i formatiranja u dokumentu.",
+ "AboutCopyright": "© 2025 ONLYOFFICE Plugin "
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/uk-UA.json b/sdkjs-plugins/content/texthighlighter/translations/uk-UA.json
new file mode 100644
index 00000000..60a8720e
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/uk-UA.json
@@ -0,0 +1,42 @@
+{
+ "TextHighlighter": "Виділення тексту",
+ "PluginInstructions": "Введіть або виберіть слово чи фразу для пошуку в документі та налаштуйте необхідні параметри.",
+
+ "TextToSearch": "Текст для пошуку:",
+ "SearchPlaceholder": "Введіть текст або виберіть у документі",
+ "IgnoreCase": "Ігнорувати регістр",
+
+ "HighlightColor": "Колір виділення:",
+ "HighlightYellow": "Жовтий",
+ "HighlightGreen": "Зелений",
+ "HighlightBlue": "Синій",
+ "HighlightRed": "Червоний",
+ "HighlightNone": "Без заповнення",
+ "ArrowDropdown": "▸",
+
+ "TextColorHeader": "Колір тексту",
+ "TextColorPicker": "Виберіть колір тексту",
+
+ "TextFormattingHeader": "Форматування тексту",
+ "FormatBold": "Жирний",
+ "FormatItalic": "Курсив",
+ "FormatUnderline": "Підкреслення",
+ "FormatStrike": "Закреслення",
+
+ "ApplyButton": "Застосувати",
+
+ "SearchNoResults": "Пошук завершено. Збігів не знайдено. ",
+ "HighlightMore": "Виділити ще",
+ "HighlightMore2": "Виділити ще",
+
+ "SearchDone": "Готово! Пошук завершено, стилі застосовано.",
+ "MatchesFound": "Знайдено збігів:",
+ "RevertToOriginal": "Повернути",
+
+ "LoadingMessage": "Обробка...",
+
+ "AboutTitle": "Виділення тексту",
+ "AboutVersion": "Версія 1.0.0",
+ "AboutDescription": "Цей плагін дозволяє виконувати пошук тексту та застосовувати виділення, колір і стилі форматування у вашому документі.",
+ "AboutCopyright": "© 2025 Плагін ONLYOFFICE"
+}
diff --git a/sdkjs-plugins/content/texthighlighter/translations/zh-ZH.json b/sdkjs-plugins/content/texthighlighter/translations/zh-ZH.json
new file mode 100644
index 00000000..81217b41
--- /dev/null
+++ b/sdkjs-plugins/content/texthighlighter/translations/zh-ZH.json
@@ -0,0 +1,41 @@
+{
+ "TextHighlighter": "文本高亮器",
+ "PluginInstructions": "输入或选择要搜索的单词或短语 ,并配置所需设置。",
+
+ "TextToSearch": "搜索文本:",
+ "SearchPlaceholder": "输入文本或在文档中选择",
+ "IgnoreCase": "忽略大小写",
+
+ "HighlightColor": "高亮颜色:",
+ "HighlightYellow": "黄色",
+ "HighlightGreen": "绿色",
+ "HighlightBlue": "蓝色",
+ "HighlightRed": "红色",
+ "HighlightNone": "无填充",
+
+ "TextColorHeader": "文字颜色",
+ "TextColorPicker": "选择文字颜色",
+
+ "TextFormattingHeader": "文字格式",
+ "FormatBold": "加粗",
+ "FormatItalic": "斜体",
+ "FormatUnderline": "下划线",
+ "FormatStrike": "删除线",
+
+ "ApplyButton": "应用",
+
+ "SearchNoResults": "搜索完成。未找到匹配项。 ",
+ "HighlightMore": "继续高亮",
+ "HighlightMore2": "继续高亮",
+ "ArrowDropdown": "▸",
+ "SearchDone": "完成!搜索已完成并应用样式。",
+ "MatchesFound": "找到匹配项:",
+ "RevertToOriginal": "恢复",
+
+ "LoadingMessage": "处理中...",
+
+ "AboutTitle": "文本高亮器",
+ "AboutVersion": "版本 1.0.0",
+ "AboutDescription": "该插件允许您搜索文本并在文档中应用高亮、颜色和格式样式。",
+ "AboutCopyright": "© 2025 ONLYOFFICE 插件"
+}
diff --git a/sdkjs-plugins/content/zotero/.dev/config.json b/sdkjs-plugins/content/zotero/.dev/config.json
index 5d3b1aca..cf8d9166 100644
--- a/sdkjs-plugins/content/zotero/.dev/config.json
+++ b/sdkjs-plugins/content/zotero/.dev/config.json
@@ -1,3 +1,15 @@
{
- "excludes": [".dev/*"]
+ "excludes": [
+ ".dev/*",
+ "node_modules/*",
+ "src/*",
+ "*.map",
+ ".browserslistrc",
+ ".gitignore",
+ "LICENSE",
+ "package.json",
+ "README.md",
+ "package-lock.json",
+ "rollup.config.mjs"
+ ]
}
diff --git a/sdkjs-plugins/content/zotero/CHANGELOG.md b/sdkjs-plugins/content/zotero/CHANGELOG.md
index cdf4ea88..1098874e 100644
--- a/sdkjs-plugins/content/zotero/CHANGELOG.md
+++ b/sdkjs-plugins/content/zotero/CHANGELOG.md
@@ -6,13 +6,13 @@
## 1.0.1
-* Add translations for Japan and Chine languages.
-* Add ability to work with fields, instead of text.
+* Add translations for Japanese and Chinese languages.
+* Add ability to work with fields instead of text.
* Add ability to update links and bibliography.
## 1.0.2
-* Fix problem with IE.
+* Fix the problem with IE.
## 1.0.4
@@ -20,10 +20,18 @@
## 1.0.5
-* Support offline mode.
-* Ability for users to upload their own styles
-* Ability to work with styles that inherit behavior from a parent
-* Fix for bibliography sorting
-* Fix for citation numbering
-* Improved compatibility with MS Word
-* Removing extra lines in a bibliography
\ No newline at end of file
+* Offline mode support for the Desktop Editors.
+* Ability for users to upload custom citation styles.
+* Add support for styles that inherit behavior from parent styles.
+* Fix bibliography sorting issues.
+* Fix citation numbering issues.
+* Improved compatibility with MS Word.
+* Remove extra blank lines in bibliography.
+
+## 1.0.6
+
+* Refreshed interface for better usability
+* The ability to choose which library to search in
+* Ability to add prefix and suffix
+* "Omit author" feature
+* Citation locators support: Added ability to include page numbers, chapters, sections, and other location references in citations
diff --git a/sdkjs-plugins/content/zotero/LICENSE b/sdkjs-plugins/content/zotero/LICENSE
new file mode 100644
index 00000000..7fc72555
--- /dev/null
+++ b/sdkjs-plugins/content/zotero/LICENSE
@@ -0,0 +1,31 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2025
+ *
+ * This program is a free software product. You can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License (AGPL)
+ * version 3 as published by the Free Software Foundation. In accordance with
+ * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
+ * that Ascensio System SIA expressly excludes the warranty of non-infringement
+ * of any third-party rights.
+ *
+ * This program is distributed WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
+ * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
+ *
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of the Program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU AGPL version 3.
+ *
+ * Pursuant to Section 7(b) of the License you must retain the original Product
+ * logo when distributing the program. Pursuant to Section 7(e) we decline to
+ * grant you any rights under trademark law for use of our trademarks.
+ *
+ * All the Product's GUI elements, including illustrations and icon sets, as
+ * well as technical writing content are licensed under the terms of the
+ * Creative Commons Attribution-ShareAlike 4.0 International. See the License
+ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
+ *
+ */
\ No newline at end of file
diff --git a/sdkjs-plugins/content/zotero/README.md b/sdkjs-plugins/content/zotero/README.md
index 428866de..298d7a35 100644
--- a/sdkjs-plugins/content/zotero/README.md
+++ b/sdkjs-plugins/content/zotero/README.md
@@ -2,7 +2,7 @@
Zotero plugin allows users to create bibliographies in ONLYOFFICE editors using Zotero service.
-The plugin is pre-installed in ONLYOFFICE Workspace (both Enterprise and Community Edition), ONLYOFFICE cloud service, and ONLYOFFICE Personal. It can also be installed to Document Server and desktop editors manually.
+The plugin is pre-installed in ONLYOFFICE Workspace (both Enterprise and Community Edition), ONLYOFFICE cloud service, and ONLYOFFICE Personal. It can also be installed to Document Server and desktop editors manually.
## How to use
@@ -18,9 +18,7 @@ The plugin is pre-installed in ONLYOFFICE Workspace (both Enterprise and Communi
6. Press the button `Refresh` to refresh all citations and a bibliography fields into the document.
-7. Press the button `Synchronize` to synchronize data with zotero service and update data into the document.
-
-8. If you want to open this document in other editors, you should convert all fields to text. Press the button `Save as text` for it.
+7. If you want to open this document in other editors(which do not have the Zotero plugin), you should convert all fields to text. Press the button `Unlink citations` for it.
Please note that Zotero works only with user’s personal library associated with the your account. The desired sources must be added to your library in Zotero before you can search and add them to your bibliography via plugin.
@@ -28,7 +26,7 @@ Please note that Zotero works only with user’s personal library associated wit
Two installation ways are available:
-1. Put the folder with the plugin code to ONLYOFFICE Document Server folder depending on the operating system:
+1. Put the folder with the plugin code to ONLYOFFICE Document Server folder depending on the operating system:
For Linux - `/var/www/onlyoffice/documentserver/sdkjs-plugins/`.
@@ -37,47 +35,48 @@ Two installation ways are available:
The plugins will be available to all the users users of ONLYOFFICE Document Server.
No service restart is required.
-2. Edit the Document Server config to add the following lines:
+2. Edit the Document Server config to add the following lines:
- ```
- var docEditor = new DocsAPI.DocEditor("placeholder", {
- "editorConfig": {
- "plugins": {
- "autostart": [
- "asc.{BFC5D5C6-89DE-4168-9565-ABD8D1E48711}",
- ...
- ],
- "pluginsData": [
- "https://example.com/path/to/zotero/config.json",
- ...
- ]
+ ```
+ var docEditor = new DocsAPI.DocEditor("placeholder", {
+ "editorConfig": {
+ "plugins": {
+ "autostart": [
+ "asc.{BFC5D5C6-89DE-4168-9565-ABD8D1E48711}",
+ ...
+ ],
+ "pluginsData": [
+ "https://example.com/path/to/zotero/config.json",
+ ...
+ ]
+ },
+ ...
},
...
- },
- ...
- });
- ```
-**Important**: when you integrate ONLYOFFICE Document Server with a 3rd-party storage, you need to use special connectors (integration apps). If you compile a connector from source code or create a new one, you can add plugins using Document Server config. If you use ready connectors (e.g. from ownCloud/Nextcloud marketplaces) adding plugins via config is not applicable.
+ });
+ ```
+
+ **Important**: when you integrate ONLYOFFICE Document Server with a 3rd-party storage, you need to use special connectors (integration apps). If you compile a connector from source code or create a new one, you can add plugins using Document Server config. If you use ready connectors (e.g. from ownCloud/Nextcloud marketplaces) adding plugins via config is not applicable.
## How to install to desktop
-* Archive the plugin files (the archive must contain config.json, index.html, and pluginCode.js).
-* Change the file extension to .plugin.
-* Go to the Plugins tab, click Manage Plugins >> Add plugin, browse for the .plugin file.
+- Archive the plugin files (the archive must contain config.json, index.html, and pluginCode.js).
+- Change the file extension to .plugin.
+- Go to the Plugins tab, click Manage Plugins >> Add plugin, browse for the .plugin file.
## Configuration
1. Find Zotero plugin in `Plugins` tab of the ONLYOFFICE Document Editor and click it.
-2. Log in to your Zotero account.
+2. Log in to your Zotero account.
-3. Follow `Zotero API settings` link from the plugin’s window. If you are logged in, you'll be able to proceed. If you are not logged in, you'll see an error message. In this case, click `Log in` (top right corner of your screen).
+3. Follow `Zotero API settings` link from the plugin’s window. If you are logged in, you'll be able to proceed. If you are not logged in, you'll see an error message. In this case, click `Log in` (top right corner of your screen).
4. Press `Create new private key`.
5. Fill in `Key Description`, make sure `Allow library access` box is checked and press `Save Key`.
-5. Copy the newly created key and paste to `API Key` field in the plugin’s interface and save it.
+6. Copy the newly created key and paste to `API Key` field in the plugin’s interface and save it.
## Offline mode
@@ -86,10 +85,26 @@ Two installation ways are available:
3. Make sure the application API is open for interaction. (`Edit` -> `Settings` -> `Advanced` -> `Allow other applications on this computer to communicate with Zotero`)
### Update locale files downloaded offline
+
```bash
cd .dev/offline-files-update && npm run start && cd ../..
```
+## For developers
+
+Build:
+
+```bash
+npm i
+npm run build:all
+```
+
+Watch mode - automatically rebuild when files change:
+
+```bash
+npm run watch
+```
+
## Known issues
For CentOS users with SELinx enabled, after copying the src folder to sdkjs-plugins, plugins may not work due to the variable file security context. To restore the rights, use the following command:
diff --git a/sdkjs-plugins/content/zotero/config.json b/sdkjs-plugins/content/zotero/config.json
index acaf26f2..958ac256 100644
--- a/sdkjs-plugins/content/zotero/config.json
+++ b/sdkjs-plugins/content/zotero/config.json
@@ -11,7 +11,7 @@
"sr-Latn-RS": "Zotero"
},
"guid": "asc.{BFC5D5C6-89DE-4168-9565-ABD8D1E48711}",
- "version": "1.0.5",
+ "version": "1.0.6",
"minVersion": "7.3.3",
"variations" : [
diff --git a/sdkjs-plugins/content/zotero/deploy/zotero.plugin b/sdkjs-plugins/content/zotero/deploy/zotero.plugin
index 401e3a05..bdf6d0ef 100644
Binary files a/sdkjs-plugins/content/zotero/deploy/zotero.plugin and b/sdkjs-plugins/content/zotero/deploy/zotero.plugin differ
diff --git a/sdkjs-plugins/content/zotero/dist/bundle.es5.js b/sdkjs-plugins/content/zotero/dist/bundle.es5.js
new file mode 100644
index 00000000..6ec83c78
--- /dev/null
+++ b/sdkjs-plugins/content/zotero/dist/bundle.es5.js
@@ -0,0 +1,15637 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2025
+ *
+ * This program is a free software product. You can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License (AGPL)
+ * version 3 as published by the Free Software Foundation. In accordance with
+ * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
+ * that Ascensio System SIA expressly excludes the warranty of non-infringement
+ * of any third-party rights.
+ *
+ * This program is distributed WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
+ * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
+ *
+ * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of the Program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU AGPL version 3.
+ *
+ * Pursuant to Section 7(b) of the License you must retain the original Product
+ * logo when distributing the program. Pursuant to Section 7(e) we decline to
+ * grant you any rights under trademark law for use of our trademarks.
+ *
+ * All the Product's GUI elements, including illustrations and icon sets, as
+ * well as technical writing content are licensed under the terms of the
+ * Creative Commons Attribution-ShareAlike 4.0 International. See the License
+ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
+ *
+ */
+(function(factory) {
+ typeof define === "function" && define.amd ? define(factory) : factory();
+})(function() {
+ "use strict";
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
+ var es_array_filter = {};
+ var globalThis_1;
+ var hasRequiredGlobalThis;
+ function requireGlobalThis() {
+ if (hasRequiredGlobalThis) return globalThis_1;
+ hasRequiredGlobalThis = 1;
+ var check = function(it) {
+ return it && it.Math === Math && it;
+ };
+ globalThis_1 = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof commonjsGlobal == "object" && commonjsGlobal) || check(typeof globalThis_1 == "object" && globalThis_1) || function() {
+ return this;
+ }() || Function("return this")();
+ return globalThis_1;
+ }
+ var objectGetOwnPropertyDescriptor = {};
+ var fails;
+ var hasRequiredFails;
+ function requireFails() {
+ if (hasRequiredFails) return fails;
+ hasRequiredFails = 1;
+ fails = function(exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+ };
+ return fails;
+ }
+ var descriptors;
+ var hasRequiredDescriptors;
+ function requireDescriptors() {
+ if (hasRequiredDescriptors) return descriptors;
+ hasRequiredDescriptors = 1;
+ var fails = requireFails();
+ descriptors = !fails(function() {
+ return Object.defineProperty({}, 1, {
+ get: function() {
+ return 7;
+ }
+ })[1] !== 7;
+ });
+ return descriptors;
+ }
+ var functionBindNative;
+ var hasRequiredFunctionBindNative;
+ function requireFunctionBindNative() {
+ if (hasRequiredFunctionBindNative) return functionBindNative;
+ hasRequiredFunctionBindNative = 1;
+ var fails = requireFails();
+ functionBindNative = !fails(function() {
+ var test = function() {}.bind();
+ return typeof test != "function" || test.hasOwnProperty("prototype");
+ });
+ return functionBindNative;
+ }
+ var functionCall;
+ var hasRequiredFunctionCall;
+ function requireFunctionCall() {
+ if (hasRequiredFunctionCall) return functionCall;
+ hasRequiredFunctionCall = 1;
+ var NATIVE_BIND = requireFunctionBindNative();
+ var call = Function.prototype.call;
+ functionCall = NATIVE_BIND ? call.bind(call) : function() {
+ return call.apply(call, arguments);
+ };
+ return functionCall;
+ }
+ var objectPropertyIsEnumerable = {};
+ var hasRequiredObjectPropertyIsEnumerable;
+ function requireObjectPropertyIsEnumerable() {
+ if (hasRequiredObjectPropertyIsEnumerable) return objectPropertyIsEnumerable;
+ hasRequiredObjectPropertyIsEnumerable = 1;
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({
+ 1: 2
+ }, 1);
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+ } : $propertyIsEnumerable;
+ return objectPropertyIsEnumerable;
+ }
+ var createPropertyDescriptor;
+ var hasRequiredCreatePropertyDescriptor;
+ function requireCreatePropertyDescriptor() {
+ if (hasRequiredCreatePropertyDescriptor) return createPropertyDescriptor;
+ hasRequiredCreatePropertyDescriptor = 1;
+ createPropertyDescriptor = function(bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+ };
+ return createPropertyDescriptor;
+ }
+ var functionUncurryThis;
+ var hasRequiredFunctionUncurryThis;
+ function requireFunctionUncurryThis() {
+ if (hasRequiredFunctionUncurryThis) return functionUncurryThis;
+ hasRequiredFunctionUncurryThis = 1;
+ var NATIVE_BIND = requireFunctionBindNative();
+ var FunctionPrototype = Function.prototype;
+ var call = FunctionPrototype.call;
+ var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
+ functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function(fn) {
+ return function() {
+ return call.apply(fn, arguments);
+ };
+ };
+ return functionUncurryThis;
+ }
+ var classofRaw;
+ var hasRequiredClassofRaw;
+ function requireClassofRaw() {
+ if (hasRequiredClassofRaw) return classofRaw;
+ hasRequiredClassofRaw = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var toString = uncurryThis({}.toString);
+ var stringSlice = uncurryThis("".slice);
+ classofRaw = function(it) {
+ return stringSlice(toString(it), 8, -1);
+ };
+ return classofRaw;
+ }
+ var indexedObject;
+ var hasRequiredIndexedObject;
+ function requireIndexedObject() {
+ if (hasRequiredIndexedObject) return indexedObject;
+ hasRequiredIndexedObject = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var fails = requireFails();
+ var classof = requireClassofRaw();
+ var $Object = Object;
+ var split = uncurryThis("".split);
+ indexedObject = fails(function() {
+ return !$Object("z").propertyIsEnumerable(0);
+ }) ? function(it) {
+ return classof(it) === "String" ? split(it, "") : $Object(it);
+ } : $Object;
+ return indexedObject;
+ }
+ var isNullOrUndefined;
+ var hasRequiredIsNullOrUndefined;
+ function requireIsNullOrUndefined() {
+ if (hasRequiredIsNullOrUndefined) return isNullOrUndefined;
+ hasRequiredIsNullOrUndefined = 1;
+ isNullOrUndefined = function(it) {
+ return it === null || it === undefined;
+ };
+ return isNullOrUndefined;
+ }
+ var requireObjectCoercible;
+ var hasRequiredRequireObjectCoercible;
+ function requireRequireObjectCoercible() {
+ if (hasRequiredRequireObjectCoercible) return requireObjectCoercible;
+ hasRequiredRequireObjectCoercible = 1;
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var $TypeError = TypeError;
+ requireObjectCoercible = function(it) {
+ if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
+ return it;
+ };
+ return requireObjectCoercible;
+ }
+ var toIndexedObject;
+ var hasRequiredToIndexedObject;
+ function requireToIndexedObject() {
+ if (hasRequiredToIndexedObject) return toIndexedObject;
+ hasRequiredToIndexedObject = 1;
+ var IndexedObject = requireIndexedObject();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ toIndexedObject = function(it) {
+ return IndexedObject(requireObjectCoercible(it));
+ };
+ return toIndexedObject;
+ }
+ var isCallable;
+ var hasRequiredIsCallable;
+ function requireIsCallable() {
+ if (hasRequiredIsCallable) return isCallable;
+ hasRequiredIsCallable = 1;
+ var documentAll = typeof document == "object" && document.all;
+ isCallable = typeof documentAll == "undefined" && documentAll !== undefined ? function(argument) {
+ return typeof argument == "function" || argument === documentAll;
+ } : function(argument) {
+ return typeof argument == "function";
+ };
+ return isCallable;
+ }
+ var isObject;
+ var hasRequiredIsObject;
+ function requireIsObject() {
+ if (hasRequiredIsObject) return isObject;
+ hasRequiredIsObject = 1;
+ var isCallable = requireIsCallable();
+ isObject = function(it) {
+ return typeof it == "object" ? it !== null : isCallable(it);
+ };
+ return isObject;
+ }
+ var getBuiltIn;
+ var hasRequiredGetBuiltIn;
+ function requireGetBuiltIn() {
+ if (hasRequiredGetBuiltIn) return getBuiltIn;
+ hasRequiredGetBuiltIn = 1;
+ var globalThis = requireGlobalThis();
+ var isCallable = requireIsCallable();
+ var aFunction = function(argument) {
+ return isCallable(argument) ? argument : undefined;
+ };
+ getBuiltIn = function(namespace, method) {
+ return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
+ };
+ return getBuiltIn;
+ }
+ var objectIsPrototypeOf;
+ var hasRequiredObjectIsPrototypeOf;
+ function requireObjectIsPrototypeOf() {
+ if (hasRequiredObjectIsPrototypeOf) return objectIsPrototypeOf;
+ hasRequiredObjectIsPrototypeOf = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ objectIsPrototypeOf = uncurryThis({}.isPrototypeOf);
+ return objectIsPrototypeOf;
+ }
+ var environmentUserAgent;
+ var hasRequiredEnvironmentUserAgent;
+ function requireEnvironmentUserAgent() {
+ if (hasRequiredEnvironmentUserAgent) return environmentUserAgent;
+ hasRequiredEnvironmentUserAgent = 1;
+ var globalThis = requireGlobalThis();
+ var navigator = globalThis.navigator;
+ var userAgent = navigator && navigator.userAgent;
+ environmentUserAgent = userAgent ? String(userAgent) : "";
+ return environmentUserAgent;
+ }
+ var environmentV8Version;
+ var hasRequiredEnvironmentV8Version;
+ function requireEnvironmentV8Version() {
+ if (hasRequiredEnvironmentV8Version) return environmentV8Version;
+ hasRequiredEnvironmentV8Version = 1;
+ var globalThis = requireGlobalThis();
+ var userAgent = requireEnvironmentUserAgent();
+ var process = globalThis.process;
+ var Deno = globalThis.Deno;
+ var versions = process && process.versions || Deno && Deno.version;
+ var v8 = versions && versions.v8;
+ var match, version;
+ if (v8) {
+ match = v8.split(".");
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
+ }
+ if (!version && userAgent) {
+ match = userAgent.match(/Edge\/(\d+)/);
+ if (!match || match[1] >= 74) {
+ match = userAgent.match(/Chrome\/(\d+)/);
+ if (match) version = +match[1];
+ }
+ }
+ environmentV8Version = version;
+ return environmentV8Version;
+ }
+ var symbolConstructorDetection;
+ var hasRequiredSymbolConstructorDetection;
+ function requireSymbolConstructorDetection() {
+ if (hasRequiredSymbolConstructorDetection) return symbolConstructorDetection;
+ hasRequiredSymbolConstructorDetection = 1;
+ var V8_VERSION = requireEnvironmentV8Version();
+ var fails = requireFails();
+ var globalThis = requireGlobalThis();
+ var $String = globalThis.String;
+ symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function() {
+ var symbol = Symbol("symbol detection");
+ return !$String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
+ });
+ return symbolConstructorDetection;
+ }
+ var useSymbolAsUid;
+ var hasRequiredUseSymbolAsUid;
+ function requireUseSymbolAsUid() {
+ if (hasRequiredUseSymbolAsUid) return useSymbolAsUid;
+ hasRequiredUseSymbolAsUid = 1;
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ useSymbolAsUid = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
+ return useSymbolAsUid;
+ }
+ var isSymbol;
+ var hasRequiredIsSymbol;
+ function requireIsSymbol() {
+ if (hasRequiredIsSymbol) return isSymbol;
+ hasRequiredIsSymbol = 1;
+ var getBuiltIn = requireGetBuiltIn();
+ var isCallable = requireIsCallable();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var USE_SYMBOL_AS_UID = requireUseSymbolAsUid();
+ var $Object = Object;
+ isSymbol = USE_SYMBOL_AS_UID ? function(it) {
+ return typeof it == "symbol";
+ } : function(it) {
+ var $Symbol = getBuiltIn("Symbol");
+ return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
+ };
+ return isSymbol;
+ }
+ var tryToString;
+ var hasRequiredTryToString;
+ function requireTryToString() {
+ if (hasRequiredTryToString) return tryToString;
+ hasRequiredTryToString = 1;
+ var $String = String;
+ tryToString = function(argument) {
+ try {
+ return $String(argument);
+ } catch (error) {
+ return "Object";
+ }
+ };
+ return tryToString;
+ }
+ var aCallable;
+ var hasRequiredACallable;
+ function requireACallable() {
+ if (hasRequiredACallable) return aCallable;
+ hasRequiredACallable = 1;
+ var isCallable = requireIsCallable();
+ var tryToString = requireTryToString();
+ var $TypeError = TypeError;
+ aCallable = function(argument) {
+ if (isCallable(argument)) return argument;
+ throw new $TypeError(tryToString(argument) + " is not a function");
+ };
+ return aCallable;
+ }
+ var getMethod;
+ var hasRequiredGetMethod;
+ function requireGetMethod() {
+ if (hasRequiredGetMethod) return getMethod;
+ hasRequiredGetMethod = 1;
+ var aCallable = requireACallable();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ getMethod = function(V, P) {
+ var func = V[P];
+ return isNullOrUndefined(func) ? undefined : aCallable(func);
+ };
+ return getMethod;
+ }
+ var ordinaryToPrimitive;
+ var hasRequiredOrdinaryToPrimitive;
+ function requireOrdinaryToPrimitive() {
+ if (hasRequiredOrdinaryToPrimitive) return ordinaryToPrimitive;
+ hasRequiredOrdinaryToPrimitive = 1;
+ var call = requireFunctionCall();
+ var isCallable = requireIsCallable();
+ var isObject = requireIsObject();
+ var $TypeError = TypeError;
+ ordinaryToPrimitive = function(input, pref) {
+ var fn, val;
+ if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
+ if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
+ if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
+ throw new $TypeError("Can't convert object to primitive value");
+ };
+ return ordinaryToPrimitive;
+ }
+ var sharedStore = {
+ exports: {}
+ };
+ var isPure;
+ var hasRequiredIsPure;
+ function requireIsPure() {
+ if (hasRequiredIsPure) return isPure;
+ hasRequiredIsPure = 1;
+ isPure = false;
+ return isPure;
+ }
+ var defineGlobalProperty;
+ var hasRequiredDefineGlobalProperty;
+ function requireDefineGlobalProperty() {
+ if (hasRequiredDefineGlobalProperty) return defineGlobalProperty;
+ hasRequiredDefineGlobalProperty = 1;
+ var globalThis = requireGlobalThis();
+ var defineProperty = Object.defineProperty;
+ defineGlobalProperty = function(key, value) {
+ try {
+ defineProperty(globalThis, key, {
+ value: value,
+ configurable: true,
+ writable: true
+ });
+ } catch (error) {
+ globalThis[key] = value;
+ }
+ return value;
+ };
+ return defineGlobalProperty;
+ }
+ var hasRequiredSharedStore;
+ function requireSharedStore() {
+ if (hasRequiredSharedStore) return sharedStore.exports;
+ hasRequiredSharedStore = 1;
+ var IS_PURE = requireIsPure();
+ var globalThis = requireGlobalThis();
+ var defineGlobalProperty = requireDefineGlobalProperty();
+ var SHARED = "__core-js_shared__";
+ var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
+ (store.versions || (store.versions = [])).push({
+ version: "3.47.0",
+ mode: IS_PURE ? "pure" : "global",
+ copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",
+ license: "https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",
+ source: "https://github.com/zloirock/core-js"
+ });
+ return sharedStore.exports;
+ }
+ var shared;
+ var hasRequiredShared;
+ function requireShared() {
+ if (hasRequiredShared) return shared;
+ hasRequiredShared = 1;
+ var store = requireSharedStore();
+ shared = function(key, value) {
+ return store[key] || (store[key] = value || {});
+ };
+ return shared;
+ }
+ var toObject;
+ var hasRequiredToObject;
+ function requireToObject() {
+ if (hasRequiredToObject) return toObject;
+ hasRequiredToObject = 1;
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var $Object = Object;
+ toObject = function(argument) {
+ return $Object(requireObjectCoercible(argument));
+ };
+ return toObject;
+ }
+ var hasOwnProperty_1;
+ var hasRequiredHasOwnProperty;
+ function requireHasOwnProperty() {
+ if (hasRequiredHasOwnProperty) return hasOwnProperty_1;
+ hasRequiredHasOwnProperty = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var toObject = requireToObject();
+ var hasOwnProperty = uncurryThis({}.hasOwnProperty);
+ hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
+ return hasOwnProperty(toObject(it), key);
+ };
+ return hasOwnProperty_1;
+ }
+ var uid;
+ var hasRequiredUid;
+ function requireUid() {
+ if (hasRequiredUid) return uid;
+ hasRequiredUid = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var id = 0;
+ var postfix = Math.random();
+ var toString = uncurryThis(1.1.toString);
+ uid = function(key) {
+ return "Symbol(" + (key === undefined ? "" : key) + ")_" + toString(++id + postfix, 36);
+ };
+ return uid;
+ }
+ var wellKnownSymbol;
+ var hasRequiredWellKnownSymbol;
+ function requireWellKnownSymbol() {
+ if (hasRequiredWellKnownSymbol) return wellKnownSymbol;
+ hasRequiredWellKnownSymbol = 1;
+ var globalThis = requireGlobalThis();
+ var shared = requireShared();
+ var hasOwn = requireHasOwnProperty();
+ var uid = requireUid();
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ var USE_SYMBOL_AS_UID = requireUseSymbolAsUid();
+ var Symbol = globalThis.Symbol;
+ var WellKnownSymbolsStore = shared("wks");
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol["for"] || Symbol : Symbol && Symbol.withoutSetter || uid;
+ wellKnownSymbol = function(name) {
+ if (!hasOwn(WellKnownSymbolsStore, name)) {
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) ? Symbol[name] : createWellKnownSymbol("Symbol." + name);
+ }
+ return WellKnownSymbolsStore[name];
+ };
+ return wellKnownSymbol;
+ }
+ var toPrimitive;
+ var hasRequiredToPrimitive;
+ function requireToPrimitive() {
+ if (hasRequiredToPrimitive) return toPrimitive;
+ hasRequiredToPrimitive = 1;
+ var call = requireFunctionCall();
+ var isObject = requireIsObject();
+ var isSymbol = requireIsSymbol();
+ var getMethod = requireGetMethod();
+ var ordinaryToPrimitive = requireOrdinaryToPrimitive();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var $TypeError = TypeError;
+ var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
+ toPrimitive = function(input, pref) {
+ if (!isObject(input) || isSymbol(input)) return input;
+ var exoticToPrim = getMethod(input, TO_PRIMITIVE);
+ var result;
+ if (exoticToPrim) {
+ if (pref === undefined) pref = "default";
+ result = call(exoticToPrim, input, pref);
+ if (!isObject(result) || isSymbol(result)) return result;
+ throw new $TypeError("Can't convert object to primitive value");
+ }
+ if (pref === undefined) pref = "number";
+ return ordinaryToPrimitive(input, pref);
+ };
+ return toPrimitive;
+ }
+ var toPropertyKey;
+ var hasRequiredToPropertyKey;
+ function requireToPropertyKey() {
+ if (hasRequiredToPropertyKey) return toPropertyKey;
+ hasRequiredToPropertyKey = 1;
+ var toPrimitive = requireToPrimitive();
+ var isSymbol = requireIsSymbol();
+ toPropertyKey = function(argument) {
+ var key = toPrimitive(argument, "string");
+ return isSymbol(key) ? key : key + "";
+ };
+ return toPropertyKey;
+ }
+ var documentCreateElement;
+ var hasRequiredDocumentCreateElement;
+ function requireDocumentCreateElement() {
+ if (hasRequiredDocumentCreateElement) return documentCreateElement;
+ hasRequiredDocumentCreateElement = 1;
+ var globalThis = requireGlobalThis();
+ var isObject = requireIsObject();
+ var document = globalThis.document;
+ var EXISTS = isObject(document) && isObject(document.createElement);
+ documentCreateElement = function(it) {
+ return EXISTS ? document.createElement(it) : {};
+ };
+ return documentCreateElement;
+ }
+ var ie8DomDefine;
+ var hasRequiredIe8DomDefine;
+ function requireIe8DomDefine() {
+ if (hasRequiredIe8DomDefine) return ie8DomDefine;
+ hasRequiredIe8DomDefine = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var fails = requireFails();
+ var createElement = requireDocumentCreateElement();
+ ie8DomDefine = !DESCRIPTORS && !fails(function() {
+ return Object.defineProperty(createElement("div"), "a", {
+ get: function() {
+ return 7;
+ }
+ }).a !== 7;
+ });
+ return ie8DomDefine;
+ }
+ var hasRequiredObjectGetOwnPropertyDescriptor;
+ function requireObjectGetOwnPropertyDescriptor() {
+ if (hasRequiredObjectGetOwnPropertyDescriptor) return objectGetOwnPropertyDescriptor;
+ hasRequiredObjectGetOwnPropertyDescriptor = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var call = requireFunctionCall();
+ var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ var toIndexedObject = requireToIndexedObject();
+ var toPropertyKey = requireToPropertyKey();
+ var hasOwn = requireHasOwnProperty();
+ var IE8_DOM_DEFINE = requireIe8DomDefine();
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPropertyKey(P);
+ if (IE8_DOM_DEFINE) try {
+ return $getOwnPropertyDescriptor(O, P);
+ } catch (error) {}
+ if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
+ };
+ return objectGetOwnPropertyDescriptor;
+ }
+ var objectDefineProperty = {};
+ var v8PrototypeDefineBug;
+ var hasRequiredV8PrototypeDefineBug;
+ function requireV8PrototypeDefineBug() {
+ if (hasRequiredV8PrototypeDefineBug) return v8PrototypeDefineBug;
+ hasRequiredV8PrototypeDefineBug = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var fails = requireFails();
+ v8PrototypeDefineBug = DESCRIPTORS && fails(function() {
+ return Object.defineProperty(function() {}, "prototype", {
+ value: 42,
+ writable: false
+ }).prototype !== 42;
+ });
+ return v8PrototypeDefineBug;
+ }
+ var anObject;
+ var hasRequiredAnObject;
+ function requireAnObject() {
+ if (hasRequiredAnObject) return anObject;
+ hasRequiredAnObject = 1;
+ var isObject = requireIsObject();
+ var $String = String;
+ var $TypeError = TypeError;
+ anObject = function(argument) {
+ if (isObject(argument)) return argument;
+ throw new $TypeError($String(argument) + " is not an object");
+ };
+ return anObject;
+ }
+ var hasRequiredObjectDefineProperty;
+ function requireObjectDefineProperty() {
+ if (hasRequiredObjectDefineProperty) return objectDefineProperty;
+ hasRequiredObjectDefineProperty = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var IE8_DOM_DEFINE = requireIe8DomDefine();
+ var V8_PROTOTYPE_DEFINE_BUG = requireV8PrototypeDefineBug();
+ var anObject = requireAnObject();
+ var toPropertyKey = requireToPropertyKey();
+ var $TypeError = TypeError;
+ var $defineProperty = Object.defineProperty;
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var ENUMERABLE = "enumerable";
+ var CONFIGURABLE = "configurable";
+ var WRITABLE = "writable";
+ objectDefineProperty.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPropertyKey(P);
+ anObject(Attributes);
+ if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
+ var current = $getOwnPropertyDescriptor(O, P);
+ if (current && current[WRITABLE]) {
+ O[P] = Attributes.value;
+ Attributes = {
+ configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
+ writable: false
+ };
+ }
+ }
+ return $defineProperty(O, P, Attributes);
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPropertyKey(P);
+ anObject(Attributes);
+ if (IE8_DOM_DEFINE) try {
+ return $defineProperty(O, P, Attributes);
+ } catch (error) {}
+ if ("get" in Attributes || "set" in Attributes) throw new $TypeError("Accessors not supported");
+ if ("value" in Attributes) O[P] = Attributes.value;
+ return O;
+ };
+ return objectDefineProperty;
+ }
+ var createNonEnumerableProperty;
+ var hasRequiredCreateNonEnumerableProperty;
+ function requireCreateNonEnumerableProperty() {
+ if (hasRequiredCreateNonEnumerableProperty) return createNonEnumerableProperty;
+ hasRequiredCreateNonEnumerableProperty = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var definePropertyModule = requireObjectDefineProperty();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ createNonEnumerableProperty = DESCRIPTORS ? function(object, key, value) {
+ return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
+ } : function(object, key, value) {
+ object[key] = value;
+ return object;
+ };
+ return createNonEnumerableProperty;
+ }
+ var makeBuiltIn = {
+ exports: {}
+ };
+ var functionName;
+ var hasRequiredFunctionName;
+ function requireFunctionName() {
+ if (hasRequiredFunctionName) return functionName;
+ hasRequiredFunctionName = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var hasOwn = requireHasOwnProperty();
+ var FunctionPrototype = Function.prototype;
+ var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
+ var EXISTS = hasOwn(FunctionPrototype, "name");
+ var PROPER = EXISTS && function something() {}.name === "something";
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
+ functionName = {
+ EXISTS: EXISTS,
+ PROPER: PROPER,
+ CONFIGURABLE: CONFIGURABLE
+ };
+ return functionName;
+ }
+ var inspectSource;
+ var hasRequiredInspectSource;
+ function requireInspectSource() {
+ if (hasRequiredInspectSource) return inspectSource;
+ hasRequiredInspectSource = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var isCallable = requireIsCallable();
+ var store = requireSharedStore();
+ var functionToString = uncurryThis(Function.toString);
+ if (!isCallable(store.inspectSource)) {
+ store.inspectSource = function(it) {
+ return functionToString(it);
+ };
+ }
+ inspectSource = store.inspectSource;
+ return inspectSource;
+ }
+ var weakMapBasicDetection;
+ var hasRequiredWeakMapBasicDetection;
+ function requireWeakMapBasicDetection() {
+ if (hasRequiredWeakMapBasicDetection) return weakMapBasicDetection;
+ hasRequiredWeakMapBasicDetection = 1;
+ var globalThis = requireGlobalThis();
+ var isCallable = requireIsCallable();
+ var WeakMap = globalThis.WeakMap;
+ weakMapBasicDetection = isCallable(WeakMap) && /native code/.test(String(WeakMap));
+ return weakMapBasicDetection;
+ }
+ var sharedKey;
+ var hasRequiredSharedKey;
+ function requireSharedKey() {
+ if (hasRequiredSharedKey) return sharedKey;
+ hasRequiredSharedKey = 1;
+ var shared = requireShared();
+ var uid = requireUid();
+ var keys = shared("keys");
+ sharedKey = function(key) {
+ return keys[key] || (keys[key] = uid(key));
+ };
+ return sharedKey;
+ }
+ var hiddenKeys;
+ var hasRequiredHiddenKeys;
+ function requireHiddenKeys() {
+ if (hasRequiredHiddenKeys) return hiddenKeys;
+ hasRequiredHiddenKeys = 1;
+ hiddenKeys = {};
+ return hiddenKeys;
+ }
+ var internalState;
+ var hasRequiredInternalState;
+ function requireInternalState() {
+ if (hasRequiredInternalState) return internalState;
+ hasRequiredInternalState = 1;
+ var NATIVE_WEAK_MAP = requireWeakMapBasicDetection();
+ var globalThis = requireGlobalThis();
+ var isObject = requireIsObject();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var hasOwn = requireHasOwnProperty();
+ var shared = requireSharedStore();
+ var sharedKey = requireSharedKey();
+ var hiddenKeys = requireHiddenKeys();
+ var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
+ var TypeError = globalThis.TypeError;
+ var WeakMap = globalThis.WeakMap;
+ var set, get, has;
+ var enforce = function(it) {
+ return has(it) ? get(it) : set(it, {});
+ };
+ var getterFor = function(TYPE) {
+ return function(it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw new TypeError("Incompatible receiver, " + TYPE + " required");
+ }
+ return state;
+ };
+ };
+ if (NATIVE_WEAK_MAP || shared.state) {
+ var store = shared.state || (shared.state = new WeakMap);
+ store.get = store.get;
+ store.has = store.has;
+ store.set = store.set;
+ set = function(it, metadata) {
+ if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
+ metadata.facade = it;
+ store.set(it, metadata);
+ return metadata;
+ };
+ get = function(it) {
+ return store.get(it) || {};
+ };
+ has = function(it) {
+ return store.has(it);
+ };
+ } else {
+ var STATE = sharedKey("state");
+ hiddenKeys[STATE] = true;
+ set = function(it, metadata) {
+ if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
+ metadata.facade = it;
+ createNonEnumerableProperty(it, STATE, metadata);
+ return metadata;
+ };
+ get = function(it) {
+ return hasOwn(it, STATE) ? it[STATE] : {};
+ };
+ has = function(it) {
+ return hasOwn(it, STATE);
+ };
+ }
+ internalState = {
+ set: set,
+ get: get,
+ has: has,
+ enforce: enforce,
+ getterFor: getterFor
+ };
+ return internalState;
+ }
+ var hasRequiredMakeBuiltIn;
+ function requireMakeBuiltIn() {
+ if (hasRequiredMakeBuiltIn) return makeBuiltIn.exports;
+ hasRequiredMakeBuiltIn = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var fails = requireFails();
+ var isCallable = requireIsCallable();
+ var hasOwn = requireHasOwnProperty();
+ var DESCRIPTORS = requireDescriptors();
+ var CONFIGURABLE_FUNCTION_NAME = requireFunctionName().CONFIGURABLE;
+ var inspectSource = requireInspectSource();
+ var InternalStateModule = requireInternalState();
+ var enforceInternalState = InternalStateModule.enforce;
+ var getInternalState = InternalStateModule.get;
+ var $String = String;
+ var defineProperty = Object.defineProperty;
+ var stringSlice = uncurryThis("".slice);
+ var replace = uncurryThis("".replace);
+ var join = uncurryThis([].join);
+ var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
+ return defineProperty(function() {}, "length", {
+ value: 8
+ }).length !== 8;
+ });
+ var TEMPLATE = String(String).split("String");
+ var makeBuiltIn$1 = makeBuiltIn.exports = function(value, name, options) {
+ if (stringSlice($String(name), 0, 7) === "Symbol(") {
+ name = "[" + replace($String(name), /^Symbol\(([^)]*)\).*$/, "$1") + "]";
+ }
+ if (options && options.getter) name = "get " + name;
+ if (options && options.setter) name = "set " + name;
+ if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
+ if (DESCRIPTORS) defineProperty(value, "name", {
+ value: name,
+ configurable: true
+ }); else value.name = name;
+ }
+ if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) {
+ defineProperty(value, "length", {
+ value: options.arity
+ });
+ }
+ try {
+ if (options && hasOwn(options, "constructor") && options.constructor) {
+ if (DESCRIPTORS) defineProperty(value, "prototype", {
+ writable: false
+ });
+ } else if (value.prototype) value.prototype = undefined;
+ } catch (error) {}
+ var state = enforceInternalState(value);
+ if (!hasOwn(state, "source")) {
+ state.source = join(TEMPLATE, typeof name == "string" ? name : "");
+ }
+ return value;
+ };
+ Function.prototype.toString = makeBuiltIn$1(function toString() {
+ return isCallable(this) && getInternalState(this).source || inspectSource(this);
+ }, "toString");
+ return makeBuiltIn.exports;
+ }
+ var defineBuiltIn;
+ var hasRequiredDefineBuiltIn;
+ function requireDefineBuiltIn() {
+ if (hasRequiredDefineBuiltIn) return defineBuiltIn;
+ hasRequiredDefineBuiltIn = 1;
+ var isCallable = requireIsCallable();
+ var definePropertyModule = requireObjectDefineProperty();
+ var makeBuiltIn = requireMakeBuiltIn();
+ var defineGlobalProperty = requireDefineGlobalProperty();
+ defineBuiltIn = function(O, key, value, options) {
+ if (!options) options = {};
+ var simple = options.enumerable;
+ var name = options.name !== undefined ? options.name : key;
+ if (isCallable(value)) makeBuiltIn(value, name, options);
+ if (options.global) {
+ if (simple) O[key] = value; else defineGlobalProperty(key, value);
+ } else {
+ try {
+ if (!options.unsafe) delete O[key]; else if (O[key]) simple = true;
+ } catch (error) {}
+ if (simple) O[key] = value; else definePropertyModule.f(O, key, {
+ value: value,
+ enumerable: false,
+ configurable: !options.nonConfigurable,
+ writable: !options.nonWritable
+ });
+ }
+ return O;
+ };
+ return defineBuiltIn;
+ }
+ var objectGetOwnPropertyNames = {};
+ var mathTrunc;
+ var hasRequiredMathTrunc;
+ function requireMathTrunc() {
+ if (hasRequiredMathTrunc) return mathTrunc;
+ hasRequiredMathTrunc = 1;
+ var ceil = Math.ceil;
+ var floor = Math.floor;
+ mathTrunc = Math.trunc || function trunc(x) {
+ var n = +x;
+ return (n > 0 ? floor : ceil)(n);
+ };
+ return mathTrunc;
+ }
+ var toIntegerOrInfinity;
+ var hasRequiredToIntegerOrInfinity;
+ function requireToIntegerOrInfinity() {
+ if (hasRequiredToIntegerOrInfinity) return toIntegerOrInfinity;
+ hasRequiredToIntegerOrInfinity = 1;
+ var trunc = requireMathTrunc();
+ toIntegerOrInfinity = function(argument) {
+ var number = +argument;
+ return number !== number || number === 0 ? 0 : trunc(number);
+ };
+ return toIntegerOrInfinity;
+ }
+ var toAbsoluteIndex;
+ var hasRequiredToAbsoluteIndex;
+ function requireToAbsoluteIndex() {
+ if (hasRequiredToAbsoluteIndex) return toAbsoluteIndex;
+ hasRequiredToAbsoluteIndex = 1;
+ var toIntegerOrInfinity = requireToIntegerOrInfinity();
+ var max = Math.max;
+ var min = Math.min;
+ toAbsoluteIndex = function(index, length) {
+ var integer = toIntegerOrInfinity(index);
+ return integer < 0 ? max(integer + length, 0) : min(integer, length);
+ };
+ return toAbsoluteIndex;
+ }
+ var toLength;
+ var hasRequiredToLength;
+ function requireToLength() {
+ if (hasRequiredToLength) return toLength;
+ hasRequiredToLength = 1;
+ var toIntegerOrInfinity = requireToIntegerOrInfinity();
+ var min = Math.min;
+ toLength = function(argument) {
+ var len = toIntegerOrInfinity(argument);
+ return len > 0 ? min(len, 9007199254740991) : 0;
+ };
+ return toLength;
+ }
+ var lengthOfArrayLike;
+ var hasRequiredLengthOfArrayLike;
+ function requireLengthOfArrayLike() {
+ if (hasRequiredLengthOfArrayLike) return lengthOfArrayLike;
+ hasRequiredLengthOfArrayLike = 1;
+ var toLength = requireToLength();
+ lengthOfArrayLike = function(obj) {
+ return toLength(obj.length);
+ };
+ return lengthOfArrayLike;
+ }
+ var arrayIncludes;
+ var hasRequiredArrayIncludes;
+ function requireArrayIncludes() {
+ if (hasRequiredArrayIncludes) return arrayIncludes;
+ hasRequiredArrayIncludes = 1;
+ var toIndexedObject = requireToIndexedObject();
+ var toAbsoluteIndex = requireToAbsoluteIndex();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var createMethod = function(IS_INCLUDES) {
+ return function($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = lengthOfArrayLike(O);
+ if (length === 0) return !IS_INCLUDES && -1;
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ if (IS_INCLUDES && el !== el) while (length > index) {
+ value = O[index++];
+ if (value !== value) return true;
+ } else for (;length > index; index++) {
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
+ }
+ return !IS_INCLUDES && -1;
+ };
+ };
+ arrayIncludes = {
+ includes: createMethod(true),
+ indexOf: createMethod(false)
+ };
+ return arrayIncludes;
+ }
+ var objectKeysInternal;
+ var hasRequiredObjectKeysInternal;
+ function requireObjectKeysInternal() {
+ if (hasRequiredObjectKeysInternal) return objectKeysInternal;
+ hasRequiredObjectKeysInternal = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var hasOwn = requireHasOwnProperty();
+ var toIndexedObject = requireToIndexedObject();
+ var indexOf = requireArrayIncludes().indexOf;
+ var hiddenKeys = requireHiddenKeys();
+ var push = uncurryThis([].push);
+ objectKeysInternal = function(object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
+ while (names.length > i) if (hasOwn(O, key = names[i++])) {
+ ~indexOf(result, key) || push(result, key);
+ }
+ return result;
+ };
+ return objectKeysInternal;
+ }
+ var enumBugKeys;
+ var hasRequiredEnumBugKeys;
+ function requireEnumBugKeys() {
+ if (hasRequiredEnumBugKeys) return enumBugKeys;
+ hasRequiredEnumBugKeys = 1;
+ enumBugKeys = [ "constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf" ];
+ return enumBugKeys;
+ }
+ var hasRequiredObjectGetOwnPropertyNames;
+ function requireObjectGetOwnPropertyNames() {
+ if (hasRequiredObjectGetOwnPropertyNames) return objectGetOwnPropertyNames;
+ hasRequiredObjectGetOwnPropertyNames = 1;
+ var internalObjectKeys = requireObjectKeysInternal();
+ var enumBugKeys = requireEnumBugKeys();
+ var hiddenKeys = enumBugKeys.concat("length", "prototype");
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return internalObjectKeys(O, hiddenKeys);
+ };
+ return objectGetOwnPropertyNames;
+ }
+ var objectGetOwnPropertySymbols = {};
+ var hasRequiredObjectGetOwnPropertySymbols;
+ function requireObjectGetOwnPropertySymbols() {
+ if (hasRequiredObjectGetOwnPropertySymbols) return objectGetOwnPropertySymbols;
+ hasRequiredObjectGetOwnPropertySymbols = 1;
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
+ return objectGetOwnPropertySymbols;
+ }
+ var ownKeys$1;
+ var hasRequiredOwnKeys;
+ function requireOwnKeys() {
+ if (hasRequiredOwnKeys) return ownKeys$1;
+ hasRequiredOwnKeys = 1;
+ var getBuiltIn = requireGetBuiltIn();
+ var uncurryThis = requireFunctionUncurryThis();
+ var getOwnPropertyNamesModule = requireObjectGetOwnPropertyNames();
+ var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
+ var anObject = requireAnObject();
+ var concat = uncurryThis([].concat);
+ ownKeys$1 = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
+ var keys = getOwnPropertyNamesModule.f(anObject(it));
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
+ };
+ return ownKeys$1;
+ }
+ var copyConstructorProperties;
+ var hasRequiredCopyConstructorProperties;
+ function requireCopyConstructorProperties() {
+ if (hasRequiredCopyConstructorProperties) return copyConstructorProperties;
+ hasRequiredCopyConstructorProperties = 1;
+ var hasOwn = requireHasOwnProperty();
+ var ownKeys = requireOwnKeys();
+ var getOwnPropertyDescriptorModule = requireObjectGetOwnPropertyDescriptor();
+ var definePropertyModule = requireObjectDefineProperty();
+ copyConstructorProperties = function(target, source, exceptions) {
+ var keys = ownKeys(source);
+ var defineProperty = definePropertyModule.f;
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+ }
+ };
+ return copyConstructorProperties;
+ }
+ var isForced_1;
+ var hasRequiredIsForced;
+ function requireIsForced() {
+ if (hasRequiredIsForced) return isForced_1;
+ hasRequiredIsForced = 1;
+ var fails = requireFails();
+ var isCallable = requireIsCallable();
+ var replacement = /#|\.prototype\./;
+ var isForced = function(feature, detection) {
+ var value = data[normalize(feature)];
+ return value === POLYFILL ? true : value === NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
+ };
+ var normalize = isForced.normalize = function(string) {
+ return String(string).replace(replacement, ".").toLowerCase();
+ };
+ var data = isForced.data = {};
+ var NATIVE = isForced.NATIVE = "N";
+ var POLYFILL = isForced.POLYFILL = "P";
+ isForced_1 = isForced;
+ return isForced_1;
+ }
+ var _export;
+ var hasRequired_export;
+ function require_export() {
+ if (hasRequired_export) return _export;
+ hasRequired_export = 1;
+ var globalThis = requireGlobalThis();
+ var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f;
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var defineGlobalProperty = requireDefineGlobalProperty();
+ var copyConstructorProperties = requireCopyConstructorProperties();
+ var isForced = requireIsForced();
+ _export = function(options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = globalThis;
+ } else if (STATIC) {
+ target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
+ } else {
+ target = globalThis[TARGET] && globalThis[TARGET].prototype;
+ }
+ if (target) for (key in source) {
+ sourceProperty = source[key];
+ if (options.dontCallGetSet) {
+ descriptor = getOwnPropertyDescriptor(target, key);
+ targetProperty = descriptor && descriptor.value;
+ } else targetProperty = target[key];
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
+ if (!FORCED && targetProperty !== undefined) {
+ if (typeof sourceProperty == typeof targetProperty) continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ if (options.sham || targetProperty && targetProperty.sham) {
+ createNonEnumerableProperty(sourceProperty, "sham", true);
+ }
+ defineBuiltIn(target, key, sourceProperty, options);
+ }
+ };
+ return _export;
+ }
+ var functionUncurryThisClause;
+ var hasRequiredFunctionUncurryThisClause;
+ function requireFunctionUncurryThisClause() {
+ if (hasRequiredFunctionUncurryThisClause) return functionUncurryThisClause;
+ hasRequiredFunctionUncurryThisClause = 1;
+ var classofRaw = requireClassofRaw();
+ var uncurryThis = requireFunctionUncurryThis();
+ functionUncurryThisClause = function(fn) {
+ if (classofRaw(fn) === "Function") return uncurryThis(fn);
+ };
+ return functionUncurryThisClause;
+ }
+ var functionBindContext;
+ var hasRequiredFunctionBindContext;
+ function requireFunctionBindContext() {
+ if (hasRequiredFunctionBindContext) return functionBindContext;
+ hasRequiredFunctionBindContext = 1;
+ var uncurryThis = requireFunctionUncurryThisClause();
+ var aCallable = requireACallable();
+ var NATIVE_BIND = requireFunctionBindNative();
+ var bind = uncurryThis(uncurryThis.bind);
+ functionBindContext = function(fn, that) {
+ aCallable(fn);
+ return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function() {
+ return fn.apply(that, arguments);
+ };
+ };
+ return functionBindContext;
+ }
+ var isArray;
+ var hasRequiredIsArray;
+ function requireIsArray() {
+ if (hasRequiredIsArray) return isArray;
+ hasRequiredIsArray = 1;
+ var classof = requireClassofRaw();
+ isArray = Array.isArray || function isArray(argument) {
+ return classof(argument) === "Array";
+ };
+ return isArray;
+ }
+ var toStringTagSupport;
+ var hasRequiredToStringTagSupport;
+ function requireToStringTagSupport() {
+ if (hasRequiredToStringTagSupport) return toStringTagSupport;
+ hasRequiredToStringTagSupport = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ var test = {};
+ test[TO_STRING_TAG] = "z";
+ toStringTagSupport = String(test) === "[object z]";
+ return toStringTagSupport;
+ }
+ var classof;
+ var hasRequiredClassof;
+ function requireClassof() {
+ if (hasRequiredClassof) return classof;
+ hasRequiredClassof = 1;
+ var TO_STRING_TAG_SUPPORT = requireToStringTagSupport();
+ var isCallable = requireIsCallable();
+ var classofRaw = requireClassofRaw();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ var $Object = Object;
+ var CORRECT_ARGUMENTS = classofRaw(function() {
+ return arguments;
+ }()) === "Arguments";
+ var tryGet = function(it, key) {
+ try {
+ return it[key];
+ } catch (error) {}
+ };
+ classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
+ var O, tag, result;
+ return it === undefined ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) === "Object" && isCallable(O.callee) ? "Arguments" : result;
+ };
+ return classof;
+ }
+ var isConstructor;
+ var hasRequiredIsConstructor;
+ function requireIsConstructor() {
+ if (hasRequiredIsConstructor) return isConstructor;
+ hasRequiredIsConstructor = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var fails = requireFails();
+ var isCallable = requireIsCallable();
+ var classof = requireClassof();
+ var getBuiltIn = requireGetBuiltIn();
+ var inspectSource = requireInspectSource();
+ var noop = function() {};
+ var construct = getBuiltIn("Reflect", "construct");
+ var constructorRegExp = /^\s*(?:class|function)\b/;
+ var exec = uncurryThis(constructorRegExp.exec);
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
+ var isConstructorModern = function isConstructor(argument) {
+ if (!isCallable(argument)) return false;
+ try {
+ construct(noop, [], argument);
+ return true;
+ } catch (error) {
+ return false;
+ }
+ };
+ var isConstructorLegacy = function isConstructor(argument) {
+ if (!isCallable(argument)) return false;
+ switch (classof(argument)) {
+ case "AsyncFunction":
+ case "GeneratorFunction":
+ case "AsyncGeneratorFunction":
+ return false;
+ }
+ try {
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
+ } catch (error) {
+ return true;
+ }
+ };
+ isConstructorLegacy.sham = true;
+ isConstructor = !construct || fails(function() {
+ var called;
+ return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
+ called = true;
+ }) || called;
+ }) ? isConstructorLegacy : isConstructorModern;
+ return isConstructor;
+ }
+ var arraySpeciesConstructor;
+ var hasRequiredArraySpeciesConstructor;
+ function requireArraySpeciesConstructor() {
+ if (hasRequiredArraySpeciesConstructor) return arraySpeciesConstructor;
+ hasRequiredArraySpeciesConstructor = 1;
+ var isArray = requireIsArray();
+ var isConstructor = requireIsConstructor();
+ var isObject = requireIsObject();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var SPECIES = wellKnownSymbol("species");
+ var $Array = Array;
+ arraySpeciesConstructor = function(originalArray) {
+ var C;
+ if (isArray(originalArray)) {
+ C = originalArray.constructor;
+ if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ }
+ return C === undefined ? $Array : C;
+ };
+ return arraySpeciesConstructor;
+ }
+ var arraySpeciesCreate;
+ var hasRequiredArraySpeciesCreate;
+ function requireArraySpeciesCreate() {
+ if (hasRequiredArraySpeciesCreate) return arraySpeciesCreate;
+ hasRequiredArraySpeciesCreate = 1;
+ var arraySpeciesConstructor = requireArraySpeciesConstructor();
+ arraySpeciesCreate = function(originalArray, length) {
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
+ };
+ return arraySpeciesCreate;
+ }
+ var arrayIteration;
+ var hasRequiredArrayIteration;
+ function requireArrayIteration() {
+ if (hasRequiredArrayIteration) return arrayIteration;
+ hasRequiredArrayIteration = 1;
+ var bind = requireFunctionBindContext();
+ var uncurryThis = requireFunctionUncurryThis();
+ var IndexedObject = requireIndexedObject();
+ var toObject = requireToObject();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var arraySpeciesCreate = requireArraySpeciesCreate();
+ var push = uncurryThis([].push);
+ var createMethod = function(TYPE) {
+ var IS_MAP = TYPE === 1;
+ var IS_FILTER = TYPE === 2;
+ var IS_SOME = TYPE === 3;
+ var IS_EVERY = TYPE === 4;
+ var IS_FIND_INDEX = TYPE === 6;
+ var IS_FILTER_REJECT = TYPE === 7;
+ var NO_HOLES = TYPE === 5 || IS_FIND_INDEX;
+ return function($this, callbackfn, that, specificCreate) {
+ var O = toObject($this);
+ var self = IndexedObject(O);
+ var length = lengthOfArrayLike(self);
+ var boundFunction = bind(callbackfn, that);
+ var index = 0;
+ var create = specificCreate || arraySpeciesCreate;
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
+ var value, result;
+ for (;length > index; index++) if (NO_HOLES || index in self) {
+ value = self[index];
+ result = boundFunction(value, index, O);
+ if (TYPE) {
+ if (IS_MAP) target[index] = result; else if (result) switch (TYPE) {
+ case 3:
+ return true;
+
+ case 5:
+ return value;
+
+ case 6:
+ return index;
+
+ case 2:
+ push(target, value);
+ } else switch (TYPE) {
+ case 4:
+ return false;
+
+ case 7:
+ push(target, value);
+ }
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
+ };
+ };
+ arrayIteration = {
+ forEach: createMethod(0),
+ map: createMethod(1),
+ filter: createMethod(2),
+ some: createMethod(3),
+ every: createMethod(4),
+ find: createMethod(5),
+ findIndex: createMethod(6),
+ filterReject: createMethod(7)
+ };
+ return arrayIteration;
+ }
+ var arrayMethodHasSpeciesSupport;
+ var hasRequiredArrayMethodHasSpeciesSupport;
+ function requireArrayMethodHasSpeciesSupport() {
+ if (hasRequiredArrayMethodHasSpeciesSupport) return arrayMethodHasSpeciesSupport;
+ hasRequiredArrayMethodHasSpeciesSupport = 1;
+ var fails = requireFails();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var V8_VERSION = requireEnvironmentV8Version();
+ var SPECIES = wellKnownSymbol("species");
+ arrayMethodHasSpeciesSupport = function(METHOD_NAME) {
+ return V8_VERSION >= 51 || !fails(function() {
+ var array = [];
+ var constructor = array.constructor = {};
+ constructor[SPECIES] = function() {
+ return {
+ foo: 1
+ };
+ };
+ return array[METHOD_NAME](Boolean).foo !== 1;
+ });
+ };
+ return arrayMethodHasSpeciesSupport;
+ }
+ var hasRequiredEs_array_filter;
+ function requireEs_array_filter() {
+ if (hasRequiredEs_array_filter) return es_array_filter;
+ hasRequiredEs_array_filter = 1;
+ var $ = require_export();
+ var $filter = requireArrayIteration().filter;
+ var arrayMethodHasSpeciesSupport = requireArrayMethodHasSpeciesSupport();
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("filter");
+ $({
+ target: "Array",
+ proto: true,
+ forced: !HAS_SPECIES_SUPPORT
+ }, {
+ filter: function filter(callbackfn) {
+ return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+ return es_array_filter;
+ }
+ requireEs_array_filter();
+ var objectDefineProperties = {};
+ var objectKeys;
+ var hasRequiredObjectKeys;
+ function requireObjectKeys() {
+ if (hasRequiredObjectKeys) return objectKeys;
+ hasRequiredObjectKeys = 1;
+ var internalObjectKeys = requireObjectKeysInternal();
+ var enumBugKeys = requireEnumBugKeys();
+ objectKeys = Object.keys || function keys(O) {
+ return internalObjectKeys(O, enumBugKeys);
+ };
+ return objectKeys;
+ }
+ var hasRequiredObjectDefineProperties;
+ function requireObjectDefineProperties() {
+ if (hasRequiredObjectDefineProperties) return objectDefineProperties;
+ hasRequiredObjectDefineProperties = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var V8_PROTOTYPE_DEFINE_BUG = requireV8PrototypeDefineBug();
+ var definePropertyModule = requireObjectDefineProperty();
+ var anObject = requireAnObject();
+ var toIndexedObject = requireToIndexedObject();
+ var objectKeys = requireObjectKeys();
+ objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var props = toIndexedObject(Properties);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var index = 0;
+ var key;
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
+ return O;
+ };
+ return objectDefineProperties;
+ }
+ var html;
+ var hasRequiredHtml;
+ function requireHtml() {
+ if (hasRequiredHtml) return html;
+ hasRequiredHtml = 1;
+ var getBuiltIn = requireGetBuiltIn();
+ html = getBuiltIn("document", "documentElement");
+ return html;
+ }
+ var objectCreate;
+ var hasRequiredObjectCreate;
+ function requireObjectCreate() {
+ if (hasRequiredObjectCreate) return objectCreate;
+ hasRequiredObjectCreate = 1;
+ var anObject = requireAnObject();
+ var definePropertiesModule = requireObjectDefineProperties();
+ var enumBugKeys = requireEnumBugKeys();
+ var hiddenKeys = requireHiddenKeys();
+ var html = requireHtml();
+ var documentCreateElement = requireDocumentCreateElement();
+ var sharedKey = requireSharedKey();
+ var GT = ">";
+ var LT = "<";
+ var PROTOTYPE = "prototype";
+ var SCRIPT = "script";
+ var IE_PROTO = sharedKey("IE_PROTO");
+ var EmptyConstructor = function() {};
+ var scriptTag = function(content) {
+ return LT + SCRIPT + GT + content + LT + "/" + SCRIPT + GT;
+ };
+ var NullProtoObjectViaActiveX = function(activeXDocument) {
+ activeXDocument.write(scriptTag(""));
+ activeXDocument.close();
+ var temp = activeXDocument.parentWindow.Object;
+ activeXDocument = null;
+ return temp;
+ };
+ var NullProtoObjectViaIFrame = function() {
+ var iframe = documentCreateElement("iframe");
+ var JS = "java" + SCRIPT + ":";
+ var iframeDocument;
+ iframe.style.display = "none";
+ html.appendChild(iframe);
+ iframe.src = String(JS);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(scriptTag("document.F=Object"));
+ iframeDocument.close();
+ return iframeDocument.F;
+ };
+ var activeXDocument;
+ var NullProtoObject = function() {
+ try {
+ activeXDocument = new ActiveXObject("htmlfile");
+ } catch (error) {}
+ NullProtoObject = typeof document != "undefined" ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
+ var length = enumBugKeys.length;
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
+ return NullProtoObject();
+ };
+ hiddenKeys[IE_PROTO] = true;
+ objectCreate = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ EmptyConstructor[PROTOTYPE] = anObject(O);
+ result = new EmptyConstructor;
+ EmptyConstructor[PROTOTYPE] = null;
+ result[IE_PROTO] = O;
+ } else result = NullProtoObject();
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
+ };
+ return objectCreate;
+ }
+ var addToUnscopables;
+ var hasRequiredAddToUnscopables;
+ function requireAddToUnscopables() {
+ if (hasRequiredAddToUnscopables) return addToUnscopables;
+ hasRequiredAddToUnscopables = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var create = requireObjectCreate();
+ var defineProperty = requireObjectDefineProperty().f;
+ var UNSCOPABLES = wellKnownSymbol("unscopables");
+ var ArrayPrototype = Array.prototype;
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
+ defineProperty(ArrayPrototype, UNSCOPABLES, {
+ configurable: true,
+ value: create(null)
+ });
+ }
+ addToUnscopables = function(key) {
+ ArrayPrototype[UNSCOPABLES][key] = true;
+ };
+ return addToUnscopables;
+ }
+ var iterators;
+ var hasRequiredIterators;
+ function requireIterators() {
+ if (hasRequiredIterators) return iterators;
+ hasRequiredIterators = 1;
+ iterators = {};
+ return iterators;
+ }
+ var correctPrototypeGetter;
+ var hasRequiredCorrectPrototypeGetter;
+ function requireCorrectPrototypeGetter() {
+ if (hasRequiredCorrectPrototypeGetter) return correctPrototypeGetter;
+ hasRequiredCorrectPrototypeGetter = 1;
+ var fails = requireFails();
+ correctPrototypeGetter = !fails(function() {
+ function F() {}
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F) !== F.prototype;
+ });
+ return correctPrototypeGetter;
+ }
+ var objectGetPrototypeOf;
+ var hasRequiredObjectGetPrototypeOf;
+ function requireObjectGetPrototypeOf() {
+ if (hasRequiredObjectGetPrototypeOf) return objectGetPrototypeOf;
+ hasRequiredObjectGetPrototypeOf = 1;
+ var hasOwn = requireHasOwnProperty();
+ var isCallable = requireIsCallable();
+ var toObject = requireToObject();
+ var sharedKey = requireSharedKey();
+ var CORRECT_PROTOTYPE_GETTER = requireCorrectPrototypeGetter();
+ var IE_PROTO = sharedKey("IE_PROTO");
+ var $Object = Object;
+ var ObjectPrototype = $Object.prototype;
+ objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function(O) {
+ var object = toObject(O);
+ if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
+ var constructor = object.constructor;
+ if (isCallable(constructor) && object instanceof constructor) {
+ return constructor.prototype;
+ }
+ return object instanceof $Object ? ObjectPrototype : null;
+ };
+ return objectGetPrototypeOf;
+ }
+ var iteratorsCore;
+ var hasRequiredIteratorsCore;
+ function requireIteratorsCore() {
+ if (hasRequiredIteratorsCore) return iteratorsCore;
+ hasRequiredIteratorsCore = 1;
+ var fails = requireFails();
+ var isCallable = requireIsCallable();
+ var isObject = requireIsObject();
+ var create = requireObjectCreate();
+ var getPrototypeOf = requireObjectGetPrototypeOf();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var IS_PURE = requireIsPure();
+ var ITERATOR = wellKnownSymbol("iterator");
+ var BUGGY_SAFARI_ITERATORS = false;
+ var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+ if ([].keys) {
+ arrayIterator = [].keys();
+ if (!("next" in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else {
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+ }
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function() {
+ var test = {};
+ return IteratorPrototype[ITERATOR].call(test) !== test;
+ });
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
+ if (!isCallable(IteratorPrototype[ITERATOR])) {
+ defineBuiltIn(IteratorPrototype, ITERATOR, function() {
+ return this;
+ });
+ }
+ iteratorsCore = {
+ IteratorPrototype: IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
+ };
+ return iteratorsCore;
+ }
+ var setToStringTag;
+ var hasRequiredSetToStringTag;
+ function requireSetToStringTag() {
+ if (hasRequiredSetToStringTag) return setToStringTag;
+ hasRequiredSetToStringTag = 1;
+ var defineProperty = requireObjectDefineProperty().f;
+ var hasOwn = requireHasOwnProperty();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ setToStringTag = function(target, TAG, STATIC) {
+ if (target && !STATIC) target = target.prototype;
+ if (target && !hasOwn(target, TO_STRING_TAG)) {
+ defineProperty(target, TO_STRING_TAG, {
+ configurable: true,
+ value: TAG
+ });
+ }
+ };
+ return setToStringTag;
+ }
+ var iteratorCreateConstructor;
+ var hasRequiredIteratorCreateConstructor;
+ function requireIteratorCreateConstructor() {
+ if (hasRequiredIteratorCreateConstructor) return iteratorCreateConstructor;
+ hasRequiredIteratorCreateConstructor = 1;
+ var IteratorPrototype = requireIteratorsCore().IteratorPrototype;
+ var create = requireObjectCreate();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ var setToStringTag = requireSetToStringTag();
+ var Iterators = requireIterators();
+ var returnThis = function() {
+ return this;
+ };
+ iteratorCreateConstructor = function(IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
+ var TO_STRING_TAG = NAME + " Iterator";
+ IteratorConstructor.prototype = create(IteratorPrototype, {
+ next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next)
+ });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
+ Iterators[TO_STRING_TAG] = returnThis;
+ return IteratorConstructor;
+ };
+ return iteratorCreateConstructor;
+ }
+ var functionUncurryThisAccessor;
+ var hasRequiredFunctionUncurryThisAccessor;
+ function requireFunctionUncurryThisAccessor() {
+ if (hasRequiredFunctionUncurryThisAccessor) return functionUncurryThisAccessor;
+ hasRequiredFunctionUncurryThisAccessor = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var aCallable = requireACallable();
+ functionUncurryThisAccessor = function(object, key, method) {
+ try {
+ return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
+ } catch (error) {}
+ };
+ return functionUncurryThisAccessor;
+ }
+ var isPossiblePrototype;
+ var hasRequiredIsPossiblePrototype;
+ function requireIsPossiblePrototype() {
+ if (hasRequiredIsPossiblePrototype) return isPossiblePrototype;
+ hasRequiredIsPossiblePrototype = 1;
+ var isObject = requireIsObject();
+ isPossiblePrototype = function(argument) {
+ return isObject(argument) || argument === null;
+ };
+ return isPossiblePrototype;
+ }
+ var aPossiblePrototype;
+ var hasRequiredAPossiblePrototype;
+ function requireAPossiblePrototype() {
+ if (hasRequiredAPossiblePrototype) return aPossiblePrototype;
+ hasRequiredAPossiblePrototype = 1;
+ var isPossiblePrototype = requireIsPossiblePrototype();
+ var $String = String;
+ var $TypeError = TypeError;
+ aPossiblePrototype = function(argument) {
+ if (isPossiblePrototype(argument)) return argument;
+ throw new $TypeError("Can't set " + $String(argument) + " as a prototype");
+ };
+ return aPossiblePrototype;
+ }
+ var objectSetPrototypeOf;
+ var hasRequiredObjectSetPrototypeOf;
+ function requireObjectSetPrototypeOf() {
+ if (hasRequiredObjectSetPrototypeOf) return objectSetPrototypeOf;
+ hasRequiredObjectSetPrototypeOf = 1;
+ var uncurryThisAccessor = requireFunctionUncurryThisAccessor();
+ var isObject = requireIsObject();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var aPossiblePrototype = requireAPossiblePrototype();
+ objectSetPrototypeOf = Object.setPrototypeOf || ("__proto__" in {} ? function() {
+ var CORRECT_SETTER = false;
+ var test = {};
+ var setter;
+ try {
+ setter = uncurryThisAccessor(Object.prototype, "__proto__", "set");
+ setter(test, []);
+ CORRECT_SETTER = test instanceof Array;
+ } catch (error) {}
+ return function setPrototypeOf(O, proto) {
+ requireObjectCoercible(O);
+ aPossiblePrototype(proto);
+ if (!isObject(O)) return O;
+ if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto;
+ return O;
+ };
+ }() : undefined);
+ return objectSetPrototypeOf;
+ }
+ var iteratorDefine;
+ var hasRequiredIteratorDefine;
+ function requireIteratorDefine() {
+ if (hasRequiredIteratorDefine) return iteratorDefine;
+ hasRequiredIteratorDefine = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ var IS_PURE = requireIsPure();
+ var FunctionName = requireFunctionName();
+ var isCallable = requireIsCallable();
+ var createIteratorConstructor = requireIteratorCreateConstructor();
+ var getPrototypeOf = requireObjectGetPrototypeOf();
+ var setPrototypeOf = requireObjectSetPrototypeOf();
+ var setToStringTag = requireSetToStringTag();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var Iterators = requireIterators();
+ var IteratorsCore = requireIteratorsCore();
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
+ var ITERATOR = wellKnownSymbol("iterator");
+ var KEYS = "keys";
+ var VALUES = "values";
+ var ENTRIES = "entries";
+ var returnThis = function() {
+ return this;
+ };
+ iteratorDefine = function(Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+ var getIterationMethod = function(KIND) {
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS:
+ return function keys() {
+ return new IteratorConstructor(this, KIND);
+ };
+
+ case VALUES:
+ return function values() {
+ return new IteratorConstructor(this, KIND);
+ };
+
+ case ENTRIES:
+ return function entries() {
+ return new IteratorConstructor(this, KIND);
+ };
+ }
+ return function() {
+ return new IteratorConstructor(this);
+ };
+ };
+ var TO_STRING_TAG = NAME + " Iterator";
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype["@@iterator"] || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME === "Array" ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable));
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
+ if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
+ if (setPrototypeOf) {
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
+ } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
+ defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
+ if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
+ }
+ }
+ if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
+ createNonEnumerableProperty(IterablePrototype, "name", VALUES);
+ } else {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() {
+ return call(nativeIterator, this);
+ };
+ }
+ }
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED) for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
+ }
+ } else $({
+ target: NAME,
+ proto: true,
+ forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
+ }, methods);
+ }
+ if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
+ defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, {
+ name: DEFAULT
+ });
+ }
+ Iterators[NAME] = defaultIterator;
+ return methods;
+ };
+ return iteratorDefine;
+ }
+ var createIterResultObject;
+ var hasRequiredCreateIterResultObject;
+ function requireCreateIterResultObject() {
+ if (hasRequiredCreateIterResultObject) return createIterResultObject;
+ hasRequiredCreateIterResultObject = 1;
+ createIterResultObject = function(value, done) {
+ return {
+ value: value,
+ done: done
+ };
+ };
+ return createIterResultObject;
+ }
+ var es_array_iterator;
+ var hasRequiredEs_array_iterator;
+ function requireEs_array_iterator() {
+ if (hasRequiredEs_array_iterator) return es_array_iterator;
+ hasRequiredEs_array_iterator = 1;
+ var toIndexedObject = requireToIndexedObject();
+ var addToUnscopables = requireAddToUnscopables();
+ var Iterators = requireIterators();
+ var InternalStateModule = requireInternalState();
+ var defineProperty = requireObjectDefineProperty().f;
+ var defineIterator = requireIteratorDefine();
+ var createIterResultObject = requireCreateIterResultObject();
+ var IS_PURE = requireIsPure();
+ var DESCRIPTORS = requireDescriptors();
+ var ARRAY_ITERATOR = "Array Iterator";
+ var setInternalState = InternalStateModule.set;
+ var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
+ es_array_iterator = defineIterator(Array, "Array", function(iterated, kind) {
+ setInternalState(this, {
+ type: ARRAY_ITERATOR,
+ target: toIndexedObject(iterated),
+ index: 0,
+ kind: kind
+ });
+ }, function() {
+ var state = getInternalState(this);
+ var target = state.target;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = null;
+ return createIterResultObject(undefined, true);
+ }
+ switch (state.kind) {
+ case "keys":
+ return createIterResultObject(index, false);
+
+ case "values":
+ return createIterResultObject(target[index], false);
+ }
+ return createIterResultObject([ index, target[index] ], false);
+ }, "values");
+ var values = Iterators.Arguments = Iterators.Array;
+ addToUnscopables("keys");
+ addToUnscopables("values");
+ addToUnscopables("entries");
+ if (!IS_PURE && DESCRIPTORS && values.name !== "values") try {
+ defineProperty(values, "name", {
+ value: "values"
+ });
+ } catch (error) {}
+ return es_array_iterator;
+ }
+ requireEs_array_iterator();
+ var es_array_join = {};
+ var arrayMethodIsStrict;
+ var hasRequiredArrayMethodIsStrict;
+ function requireArrayMethodIsStrict() {
+ if (hasRequiredArrayMethodIsStrict) return arrayMethodIsStrict;
+ hasRequiredArrayMethodIsStrict = 1;
+ var fails = requireFails();
+ arrayMethodIsStrict = function(METHOD_NAME, argument) {
+ var method = [][METHOD_NAME];
+ return !!method && fails(function() {
+ method.call(null, argument || function() {
+ return 1;
+ }, 1);
+ });
+ };
+ return arrayMethodIsStrict;
+ }
+ var hasRequiredEs_array_join;
+ function requireEs_array_join() {
+ if (hasRequiredEs_array_join) return es_array_join;
+ hasRequiredEs_array_join = 1;
+ var $ = require_export();
+ var uncurryThis = requireFunctionUncurryThis();
+ var IndexedObject = requireIndexedObject();
+ var toIndexedObject = requireToIndexedObject();
+ var arrayMethodIsStrict = requireArrayMethodIsStrict();
+ var nativeJoin = uncurryThis([].join);
+ var ES3_STRINGS = IndexedObject !== Object;
+ var FORCED = ES3_STRINGS || !arrayMethodIsStrict("join", ",");
+ $({
+ target: "Array",
+ proto: true,
+ forced: FORCED
+ }, {
+ join: function join(separator) {
+ return nativeJoin(toIndexedObject(this), separator === undefined ? "," : separator);
+ }
+ });
+ return es_array_join;
+ }
+ requireEs_array_join();
+ var es_function_name = {};
+ var defineBuiltInAccessor;
+ var hasRequiredDefineBuiltInAccessor;
+ function requireDefineBuiltInAccessor() {
+ if (hasRequiredDefineBuiltInAccessor) return defineBuiltInAccessor;
+ hasRequiredDefineBuiltInAccessor = 1;
+ var makeBuiltIn = requireMakeBuiltIn();
+ var defineProperty = requireObjectDefineProperty();
+ defineBuiltInAccessor = function(target, name, descriptor) {
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, {
+ getter: true
+ });
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, {
+ setter: true
+ });
+ return defineProperty.f(target, name, descriptor);
+ };
+ return defineBuiltInAccessor;
+ }
+ var hasRequiredEs_function_name;
+ function requireEs_function_name() {
+ if (hasRequiredEs_function_name) return es_function_name;
+ hasRequiredEs_function_name = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var FUNCTION_NAME_EXISTS = requireFunctionName().EXISTS;
+ var uncurryThis = requireFunctionUncurryThis();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var FunctionPrototype = Function.prototype;
+ var functionToString = uncurryThis(FunctionPrototype.toString);
+ var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
+ var regExpExec = uncurryThis(nameRE.exec);
+ var NAME = "name";
+ if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
+ defineBuiltInAccessor(FunctionPrototype, NAME, {
+ configurable: true,
+ get: function() {
+ try {
+ return regExpExec(nameRE, functionToString(this))[1];
+ } catch (error) {
+ return "";
+ }
+ }
+ });
+ }
+ return es_function_name;
+ }
+ requireEs_function_name();
+ var es_object_toString = {};
+ var objectToString;
+ var hasRequiredObjectToString;
+ function requireObjectToString() {
+ if (hasRequiredObjectToString) return objectToString;
+ hasRequiredObjectToString = 1;
+ var TO_STRING_TAG_SUPPORT = requireToStringTagSupport();
+ var classof = requireClassof();
+ objectToString = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
+ return "[object " + classof(this) + "]";
+ };
+ return objectToString;
+ }
+ var hasRequiredEs_object_toString;
+ function requireEs_object_toString() {
+ if (hasRequiredEs_object_toString) return es_object_toString;
+ hasRequiredEs_object_toString = 1;
+ var TO_STRING_TAG_SUPPORT = requireToStringTagSupport();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var toString = requireObjectToString();
+ if (!TO_STRING_TAG_SUPPORT) {
+ defineBuiltIn(Object.prototype, "toString", toString, {
+ unsafe: true
+ });
+ }
+ return es_object_toString;
+ }
+ requireEs_object_toString();
+ var es_promise = {};
+ var es_promise_constructor = {};
+ var environment;
+ var hasRequiredEnvironment;
+ function requireEnvironment() {
+ if (hasRequiredEnvironment) return environment;
+ hasRequiredEnvironment = 1;
+ var globalThis = requireGlobalThis();
+ var userAgent = requireEnvironmentUserAgent();
+ var classof = requireClassofRaw();
+ var userAgentStartsWith = function(string) {
+ return userAgent.slice(0, string.length) === string;
+ };
+ environment = function() {
+ if (userAgentStartsWith("Bun/")) return "BUN";
+ if (userAgentStartsWith("Cloudflare-Workers")) return "CLOUDFLARE";
+ if (userAgentStartsWith("Deno/")) return "DENO";
+ if (userAgentStartsWith("Node.js/")) return "NODE";
+ if (globalThis.Bun && typeof Bun.version == "string") return "BUN";
+ if (globalThis.Deno && typeof Deno.version == "object") return "DENO";
+ if (classof(globalThis.process) === "process") return "NODE";
+ if (globalThis.window && globalThis.document) return "BROWSER";
+ return "REST";
+ }();
+ return environment;
+ }
+ var environmentIsNode;
+ var hasRequiredEnvironmentIsNode;
+ function requireEnvironmentIsNode() {
+ if (hasRequiredEnvironmentIsNode) return environmentIsNode;
+ hasRequiredEnvironmentIsNode = 1;
+ var ENVIRONMENT = requireEnvironment();
+ environmentIsNode = ENVIRONMENT === "NODE";
+ return environmentIsNode;
+ }
+ var path;
+ var hasRequiredPath;
+ function requirePath() {
+ if (hasRequiredPath) return path;
+ hasRequiredPath = 1;
+ var globalThis = requireGlobalThis();
+ path = globalThis;
+ return path;
+ }
+ var setSpecies;
+ var hasRequiredSetSpecies;
+ function requireSetSpecies() {
+ if (hasRequiredSetSpecies) return setSpecies;
+ hasRequiredSetSpecies = 1;
+ var getBuiltIn = requireGetBuiltIn();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var DESCRIPTORS = requireDescriptors();
+ var SPECIES = wellKnownSymbol("species");
+ setSpecies = function(CONSTRUCTOR_NAME) {
+ var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
+ if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
+ defineBuiltInAccessor(Constructor, SPECIES, {
+ configurable: true,
+ get: function() {
+ return this;
+ }
+ });
+ }
+ };
+ return setSpecies;
+ }
+ var anInstance;
+ var hasRequiredAnInstance;
+ function requireAnInstance() {
+ if (hasRequiredAnInstance) return anInstance;
+ hasRequiredAnInstance = 1;
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var $TypeError = TypeError;
+ anInstance = function(it, Prototype) {
+ if (isPrototypeOf(Prototype, it)) return it;
+ throw new $TypeError("Incorrect invocation");
+ };
+ return anInstance;
+ }
+ var aConstructor;
+ var hasRequiredAConstructor;
+ function requireAConstructor() {
+ if (hasRequiredAConstructor) return aConstructor;
+ hasRequiredAConstructor = 1;
+ var isConstructor = requireIsConstructor();
+ var tryToString = requireTryToString();
+ var $TypeError = TypeError;
+ aConstructor = function(argument) {
+ if (isConstructor(argument)) return argument;
+ throw new $TypeError(tryToString(argument) + " is not a constructor");
+ };
+ return aConstructor;
+ }
+ var speciesConstructor;
+ var hasRequiredSpeciesConstructor;
+ function requireSpeciesConstructor() {
+ if (hasRequiredSpeciesConstructor) return speciesConstructor;
+ hasRequiredSpeciesConstructor = 1;
+ var anObject = requireAnObject();
+ var aConstructor = requireAConstructor();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var SPECIES = wellKnownSymbol("species");
+ speciesConstructor = function(O, defaultConstructor) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);
+ };
+ return speciesConstructor;
+ }
+ var functionApply;
+ var hasRequiredFunctionApply;
+ function requireFunctionApply() {
+ if (hasRequiredFunctionApply) return functionApply;
+ hasRequiredFunctionApply = 1;
+ var NATIVE_BIND = requireFunctionBindNative();
+ var FunctionPrototype = Function.prototype;
+ var apply = FunctionPrototype.apply;
+ var call = FunctionPrototype.call;
+ functionApply = typeof Reflect == "object" && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function() {
+ return call.apply(apply, arguments);
+ });
+ return functionApply;
+ }
+ var arraySlice;
+ var hasRequiredArraySlice;
+ function requireArraySlice() {
+ if (hasRequiredArraySlice) return arraySlice;
+ hasRequiredArraySlice = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ arraySlice = uncurryThis([].slice);
+ return arraySlice;
+ }
+ var validateArgumentsLength;
+ var hasRequiredValidateArgumentsLength;
+ function requireValidateArgumentsLength() {
+ if (hasRequiredValidateArgumentsLength) return validateArgumentsLength;
+ hasRequiredValidateArgumentsLength = 1;
+ var $TypeError = TypeError;
+ validateArgumentsLength = function(passed, required) {
+ if (passed < required) throw new $TypeError("Not enough arguments");
+ return passed;
+ };
+ return validateArgumentsLength;
+ }
+ var environmentIsIos;
+ var hasRequiredEnvironmentIsIos;
+ function requireEnvironmentIsIos() {
+ if (hasRequiredEnvironmentIsIos) return environmentIsIos;
+ hasRequiredEnvironmentIsIos = 1;
+ var userAgent = requireEnvironmentUserAgent();
+ environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
+ return environmentIsIos;
+ }
+ var task;
+ var hasRequiredTask;
+ function requireTask() {
+ if (hasRequiredTask) return task;
+ hasRequiredTask = 1;
+ var globalThis = requireGlobalThis();
+ var apply = requireFunctionApply();
+ var bind = requireFunctionBindContext();
+ var isCallable = requireIsCallable();
+ var hasOwn = requireHasOwnProperty();
+ var fails = requireFails();
+ var html = requireHtml();
+ var arraySlice = requireArraySlice();
+ var createElement = requireDocumentCreateElement();
+ var validateArgumentsLength = requireValidateArgumentsLength();
+ var IS_IOS = requireEnvironmentIsIos();
+ var IS_NODE = requireEnvironmentIsNode();
+ var set = globalThis.setImmediate;
+ var clear = globalThis.clearImmediate;
+ var process = globalThis.process;
+ var Dispatch = globalThis.Dispatch;
+ var Function = globalThis.Function;
+ var MessageChannel = globalThis.MessageChannel;
+ var String = globalThis.String;
+ var counter = 0;
+ var queue = {};
+ var ONREADYSTATECHANGE = "onreadystatechange";
+ var $location, defer, channel, port;
+ fails(function() {
+ $location = globalThis.location;
+ });
+ var run = function(id) {
+ if (hasOwn(queue, id)) {
+ var fn = queue[id];
+ delete queue[id];
+ fn();
+ }
+ };
+ var runner = function(id) {
+ return function() {
+ run(id);
+ };
+ };
+ var eventListener = function(event) {
+ run(event.data);
+ };
+ var globalPostMessageDefer = function(id) {
+ globalThis.postMessage(String(id), $location.protocol + "//" + $location.host);
+ };
+ if (!set || !clear) {
+ set = function setImmediate(handler) {
+ validateArgumentsLength(arguments.length, 1);
+ var fn = isCallable(handler) ? handler : Function(handler);
+ var args = arraySlice(arguments, 1);
+ queue[++counter] = function() {
+ apply(fn, undefined, args);
+ };
+ defer(counter);
+ return counter;
+ };
+ clear = function clearImmediate(id) {
+ delete queue[id];
+ };
+ if (IS_NODE) {
+ defer = function(id) {
+ process.nextTick(runner(id));
+ };
+ } else if (Dispatch && Dispatch.now) {
+ defer = function(id) {
+ Dispatch.now(runner(id));
+ };
+ } else if (MessageChannel && !IS_IOS) {
+ channel = new MessageChannel;
+ port = channel.port2;
+ channel.port1.onmessage = eventListener;
+ defer = bind(port.postMessage, port);
+ } else if (globalThis.addEventListener && isCallable(globalThis.postMessage) && !globalThis.importScripts && $location && $location.protocol !== "file:" && !fails(globalPostMessageDefer)) {
+ defer = globalPostMessageDefer;
+ globalThis.addEventListener("message", eventListener, false);
+ } else if (ONREADYSTATECHANGE in createElement("script")) {
+ defer = function(id) {
+ html.appendChild(createElement("script"))[ONREADYSTATECHANGE] = function() {
+ html.removeChild(this);
+ run(id);
+ };
+ };
+ } else {
+ defer = function(id) {
+ setTimeout(runner(id), 0);
+ };
+ }
+ }
+ task = {
+ set: set,
+ clear: clear
+ };
+ return task;
+ }
+ var safeGetBuiltIn;
+ var hasRequiredSafeGetBuiltIn;
+ function requireSafeGetBuiltIn() {
+ if (hasRequiredSafeGetBuiltIn) return safeGetBuiltIn;
+ hasRequiredSafeGetBuiltIn = 1;
+ var globalThis = requireGlobalThis();
+ var DESCRIPTORS = requireDescriptors();
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ safeGetBuiltIn = function(name) {
+ if (!DESCRIPTORS) return globalThis[name];
+ var descriptor = getOwnPropertyDescriptor(globalThis, name);
+ return descriptor && descriptor.value;
+ };
+ return safeGetBuiltIn;
+ }
+ var queue;
+ var hasRequiredQueue;
+ function requireQueue() {
+ if (hasRequiredQueue) return queue;
+ hasRequiredQueue = 1;
+ var Queue = function() {
+ this.head = null;
+ this.tail = null;
+ };
+ Queue.prototype = {
+ add: function(item) {
+ var entry = {
+ item: item,
+ next: null
+ };
+ var tail = this.tail;
+ if (tail) tail.next = entry; else this.head = entry;
+ this.tail = entry;
+ },
+ get: function() {
+ var entry = this.head;
+ if (entry) {
+ var next = this.head = entry.next;
+ if (next === null) this.tail = null;
+ return entry.item;
+ }
+ }
+ };
+ queue = Queue;
+ return queue;
+ }
+ var environmentIsIosPebble;
+ var hasRequiredEnvironmentIsIosPebble;
+ function requireEnvironmentIsIosPebble() {
+ if (hasRequiredEnvironmentIsIosPebble) return environmentIsIosPebble;
+ hasRequiredEnvironmentIsIosPebble = 1;
+ var userAgent = requireEnvironmentUserAgent();
+ environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent) && typeof Pebble != "undefined";
+ return environmentIsIosPebble;
+ }
+ var environmentIsWebosWebkit;
+ var hasRequiredEnvironmentIsWebosWebkit;
+ function requireEnvironmentIsWebosWebkit() {
+ if (hasRequiredEnvironmentIsWebosWebkit) return environmentIsWebosWebkit;
+ hasRequiredEnvironmentIsWebosWebkit = 1;
+ var userAgent = requireEnvironmentUserAgent();
+ environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
+ return environmentIsWebosWebkit;
+ }
+ var microtask_1;
+ var hasRequiredMicrotask;
+ function requireMicrotask() {
+ if (hasRequiredMicrotask) return microtask_1;
+ hasRequiredMicrotask = 1;
+ var globalThis = requireGlobalThis();
+ var safeGetBuiltIn = requireSafeGetBuiltIn();
+ var bind = requireFunctionBindContext();
+ var macrotask = requireTask().set;
+ var Queue = requireQueue();
+ var IS_IOS = requireEnvironmentIsIos();
+ var IS_IOS_PEBBLE = requireEnvironmentIsIosPebble();
+ var IS_WEBOS_WEBKIT = requireEnvironmentIsWebosWebkit();
+ var IS_NODE = requireEnvironmentIsNode();
+ var MutationObserver = globalThis.MutationObserver || globalThis.WebKitMutationObserver;
+ var document = globalThis.document;
+ var process = globalThis.process;
+ var Promise = globalThis.Promise;
+ var microtask = safeGetBuiltIn("queueMicrotask");
+ var notify, toggle, node, promise, then;
+ if (!microtask) {
+ var queue = new Queue;
+ var flush = function() {
+ var parent, fn;
+ if (IS_NODE && (parent = process.domain)) parent.exit();
+ while (fn = queue.get()) try {
+ fn();
+ } catch (error) {
+ if (queue.head) notify();
+ throw error;
+ }
+ if (parent) parent.enter();
+ };
+ if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
+ toggle = true;
+ node = document.createTextNode("");
+ new MutationObserver(flush).observe(node, {
+ characterData: true
+ });
+ notify = function() {
+ node.data = toggle = !toggle;
+ };
+ } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
+ promise = Promise.resolve(undefined);
+ promise.constructor = Promise;
+ then = bind(promise.then, promise);
+ notify = function() {
+ then(flush);
+ };
+ } else if (IS_NODE) {
+ notify = function() {
+ process.nextTick(flush);
+ };
+ } else {
+ macrotask = bind(macrotask, globalThis);
+ notify = function() {
+ macrotask(flush);
+ };
+ }
+ microtask = function(fn) {
+ if (!queue.head) notify();
+ queue.add(fn);
+ };
+ }
+ microtask_1 = microtask;
+ return microtask_1;
+ }
+ var hostReportErrors;
+ var hasRequiredHostReportErrors;
+ function requireHostReportErrors() {
+ if (hasRequiredHostReportErrors) return hostReportErrors;
+ hasRequiredHostReportErrors = 1;
+ hostReportErrors = function(a, b) {
+ try {
+ arguments.length === 1 ? console.error(a) : console.error(a, b);
+ } catch (error) {}
+ };
+ return hostReportErrors;
+ }
+ var perform;
+ var hasRequiredPerform;
+ function requirePerform() {
+ if (hasRequiredPerform) return perform;
+ hasRequiredPerform = 1;
+ perform = function(exec) {
+ try {
+ return {
+ error: false,
+ value: exec()
+ };
+ } catch (error) {
+ return {
+ error: true,
+ value: error
+ };
+ }
+ };
+ return perform;
+ }
+ var promiseNativeConstructor;
+ var hasRequiredPromiseNativeConstructor;
+ function requirePromiseNativeConstructor() {
+ if (hasRequiredPromiseNativeConstructor) return promiseNativeConstructor;
+ hasRequiredPromiseNativeConstructor = 1;
+ var globalThis = requireGlobalThis();
+ promiseNativeConstructor = globalThis.Promise;
+ return promiseNativeConstructor;
+ }
+ var promiseConstructorDetection;
+ var hasRequiredPromiseConstructorDetection;
+ function requirePromiseConstructorDetection() {
+ if (hasRequiredPromiseConstructorDetection) return promiseConstructorDetection;
+ hasRequiredPromiseConstructorDetection = 1;
+ var globalThis = requireGlobalThis();
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var isCallable = requireIsCallable();
+ var isForced = requireIsForced();
+ var inspectSource = requireInspectSource();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var ENVIRONMENT = requireEnvironment();
+ var IS_PURE = requireIsPure();
+ var V8_VERSION = requireEnvironmentV8Version();
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
+ var SPECIES = wellKnownSymbol("species");
+ var SUBCLASSING = false;
+ var NATIVE_PROMISE_REJECTION_EVENT = isCallable(globalThis.PromiseRejectionEvent);
+ var FORCED_PROMISE_CONSTRUCTOR = isForced("Promise", function() {
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
+ if (IS_PURE && !(NativePromisePrototype["catch"] && NativePromisePrototype["finally"])) return true;
+ if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
+ var promise = new NativePromiseConstructor(function(resolve) {
+ resolve(1);
+ });
+ var FakePromise = function(exec) {
+ exec(function() {}, function() {});
+ };
+ var constructor = promise.constructor = {};
+ constructor[SPECIES] = FakePromise;
+ SUBCLASSING = promise.then(function() {}) instanceof FakePromise;
+ if (!SUBCLASSING) return true;
+ }
+ return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === "BROWSER" || ENVIRONMENT === "DENO") && !NATIVE_PROMISE_REJECTION_EVENT;
+ });
+ promiseConstructorDetection = {
+ CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
+ REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
+ SUBCLASSING: SUBCLASSING
+ };
+ return promiseConstructorDetection;
+ }
+ var newPromiseCapability = {};
+ var hasRequiredNewPromiseCapability;
+ function requireNewPromiseCapability() {
+ if (hasRequiredNewPromiseCapability) return newPromiseCapability;
+ hasRequiredNewPromiseCapability = 1;
+ var aCallable = requireACallable();
+ var $TypeError = TypeError;
+ var PromiseCapability = function(C) {
+ var resolve, reject;
+ this.promise = new C(function($$resolve, $$reject) {
+ if (resolve !== undefined || reject !== undefined) throw new $TypeError("Bad Promise constructor");
+ resolve = $$resolve;
+ reject = $$reject;
+ });
+ this.resolve = aCallable(resolve);
+ this.reject = aCallable(reject);
+ };
+ newPromiseCapability.f = function(C) {
+ return new PromiseCapability(C);
+ };
+ return newPromiseCapability;
+ }
+ var hasRequiredEs_promise_constructor;
+ function requireEs_promise_constructor() {
+ if (hasRequiredEs_promise_constructor) return es_promise_constructor;
+ hasRequiredEs_promise_constructor = 1;
+ var $ = require_export();
+ var IS_PURE = requireIsPure();
+ var IS_NODE = requireEnvironmentIsNode();
+ var globalThis = requireGlobalThis();
+ var path = requirePath();
+ var call = requireFunctionCall();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var setPrototypeOf = requireObjectSetPrototypeOf();
+ var setToStringTag = requireSetToStringTag();
+ var setSpecies = requireSetSpecies();
+ var aCallable = requireACallable();
+ var isCallable = requireIsCallable();
+ var isObject = requireIsObject();
+ var anInstance = requireAnInstance();
+ var speciesConstructor = requireSpeciesConstructor();
+ var task = requireTask().set;
+ var microtask = requireMicrotask();
+ var hostReportErrors = requireHostReportErrors();
+ var perform = requirePerform();
+ var Queue = requireQueue();
+ var InternalStateModule = requireInternalState();
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var PromiseConstructorDetection = requirePromiseConstructorDetection();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var PROMISE = "Promise";
+ var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
+ var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
+ var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
+ var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
+ var setInternalState = InternalStateModule.set;
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
+ var PromiseConstructor = NativePromiseConstructor;
+ var PromisePrototype = NativePromisePrototype;
+ var TypeError = globalThis.TypeError;
+ var document = globalThis.document;
+ var process = globalThis.process;
+ var newPromiseCapability = newPromiseCapabilityModule.f;
+ var newGenericPromiseCapability = newPromiseCapability;
+ var DISPATCH_EVENT = !!(document && document.createEvent && globalThis.dispatchEvent);
+ var UNHANDLED_REJECTION = "unhandledrejection";
+ var REJECTION_HANDLED = "rejectionhandled";
+ var PENDING = 0;
+ var FULFILLED = 1;
+ var REJECTED = 2;
+ var HANDLED = 1;
+ var UNHANDLED = 2;
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
+ var isThenable = function(it) {
+ var then;
+ return isObject(it) && isCallable(then = it.then) ? then : false;
+ };
+ var callReaction = function(reaction, state) {
+ var value = state.value;
+ var ok = state.state === FULFILLED;
+ var handler = ok ? reaction.ok : reaction.fail;
+ var resolve = reaction.resolve;
+ var reject = reaction.reject;
+ var domain = reaction.domain;
+ var result, then, exited;
+ try {
+ if (handler) {
+ if (!ok) {
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
+ state.rejection = HANDLED;
+ }
+ if (handler === true) result = value; else {
+ if (domain) domain.enter();
+ result = handler(value);
+ if (domain) {
+ domain.exit();
+ exited = true;
+ }
+ }
+ if (result === reaction.promise) {
+ reject(new TypeError("Promise-chain cycle"));
+ } else if (then = isThenable(result)) {
+ call(then, result, resolve, reject);
+ } else resolve(result);
+ } else reject(value);
+ } catch (error) {
+ if (domain && !exited) domain.exit();
+ reject(error);
+ }
+ };
+ var notify = function(state, isReject) {
+ if (state.notified) return;
+ state.notified = true;
+ microtask(function() {
+ var reactions = state.reactions;
+ var reaction;
+ while (reaction = reactions.get()) {
+ callReaction(reaction, state);
+ }
+ state.notified = false;
+ if (isReject && !state.rejection) onUnhandled(state);
+ });
+ };
+ var dispatchEvent = function(name, promise, reason) {
+ var event, handler;
+ if (DISPATCH_EVENT) {
+ event = document.createEvent("Event");
+ event.promise = promise;
+ event.reason = reason;
+ event.initEvent(name, false, true);
+ globalThis.dispatchEvent(event);
+ } else event = {
+ promise: promise,
+ reason: reason
+ };
+ if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis["on" + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors("Unhandled promise rejection", reason);
+ };
+ var onUnhandled = function(state) {
+ call(task, globalThis, function() {
+ var promise = state.facade;
+ var value = state.value;
+ var IS_UNHANDLED = isUnhandled(state);
+ var result;
+ if (IS_UNHANDLED) {
+ result = perform(function() {
+ if (IS_NODE) {
+ process.emit("unhandledRejection", value, promise);
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
+ });
+ state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
+ if (result.error) throw result.value;
+ }
+ });
+ };
+ var isUnhandled = function(state) {
+ return state.rejection !== HANDLED && !state.parent;
+ };
+ var onHandleUnhandled = function(state) {
+ call(task, globalThis, function() {
+ var promise = state.facade;
+ if (IS_NODE) {
+ process.emit("rejectionHandled", promise);
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
+ });
+ };
+ var bind = function(fn, state, unwrap) {
+ return function(value) {
+ fn(state, value, unwrap);
+ };
+ };
+ var internalReject = function(state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ state.value = value;
+ state.state = REJECTED;
+ notify(state, true);
+ };
+ var internalResolve = function(state, value, unwrap) {
+ if (state.done) return;
+ state.done = true;
+ if (unwrap) state = unwrap;
+ try {
+ if (state.facade === value) throw new TypeError("Promise can't be resolved itself");
+ var then = isThenable(value);
+ if (then) {
+ microtask(function() {
+ var wrapper = {
+ done: false
+ };
+ try {
+ call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state));
+ } catch (error) {
+ internalReject(wrapper, error, state);
+ }
+ });
+ } else {
+ state.value = value;
+ state.state = FULFILLED;
+ notify(state, false);
+ }
+ } catch (error) {
+ internalReject({
+ done: false
+ }, error, state);
+ }
+ };
+ if (FORCED_PROMISE_CONSTRUCTOR) {
+ PromiseConstructor = function Promise(executor) {
+ anInstance(this, PromisePrototype);
+ aCallable(executor);
+ call(Internal, this);
+ var state = getInternalPromiseState(this);
+ try {
+ executor(bind(internalResolve, state), bind(internalReject, state));
+ } catch (error) {
+ internalReject(state, error);
+ }
+ };
+ PromisePrototype = PromiseConstructor.prototype;
+ Internal = function Promise(executor) {
+ setInternalState(this, {
+ type: PROMISE,
+ done: false,
+ notified: false,
+ parent: false,
+ reactions: new Queue,
+ rejection: false,
+ state: PENDING,
+ value: null
+ });
+ };
+ Internal.prototype = defineBuiltIn(PromisePrototype, "then", function then(onFulfilled, onRejected) {
+ var state = getInternalPromiseState(this);
+ var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
+ state.parent = true;
+ reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
+ reaction.fail = isCallable(onRejected) && onRejected;
+ reaction.domain = IS_NODE ? process.domain : undefined;
+ if (state.state === PENDING) state.reactions.add(reaction); else microtask(function() {
+ callReaction(reaction, state);
+ });
+ return reaction.promise;
+ });
+ OwnPromiseCapability = function() {
+ var promise = new Internal;
+ var state = getInternalPromiseState(promise);
+ this.promise = promise;
+ this.resolve = bind(internalResolve, state);
+ this.reject = bind(internalReject, state);
+ };
+ newPromiseCapabilityModule.f = newPromiseCapability = function(C) {
+ return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
+ };
+ if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
+ nativeThen = NativePromisePrototype.then;
+ if (!NATIVE_PROMISE_SUBCLASSING) {
+ defineBuiltIn(NativePromisePrototype, "then", function then(onFulfilled, onRejected) {
+ var that = this;
+ return new PromiseConstructor(function(resolve, reject) {
+ call(nativeThen, that, resolve, reject);
+ }).then(onFulfilled, onRejected);
+ }, {
+ unsafe: true
+ });
+ }
+ try {
+ delete NativePromisePrototype.constructor;
+ } catch (error) {}
+ if (setPrototypeOf) {
+ setPrototypeOf(NativePromisePrototype, PromisePrototype);
+ }
+ }
+ }
+ $({
+ global: true,
+ constructor: true,
+ wrap: true,
+ forced: FORCED_PROMISE_CONSTRUCTOR
+ }, {
+ Promise: PromiseConstructor
+ });
+ PromiseWrapper = path.Promise;
+ setToStringTag(PromiseConstructor, PROMISE, false, true);
+ setSpecies(PROMISE);
+ return es_promise_constructor;
+ }
+ var es_promise_all = {};
+ var isArrayIteratorMethod;
+ var hasRequiredIsArrayIteratorMethod;
+ function requireIsArrayIteratorMethod() {
+ if (hasRequiredIsArrayIteratorMethod) return isArrayIteratorMethod;
+ hasRequiredIsArrayIteratorMethod = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var Iterators = requireIterators();
+ var ITERATOR = wellKnownSymbol("iterator");
+ var ArrayPrototype = Array.prototype;
+ isArrayIteratorMethod = function(it) {
+ return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
+ };
+ return isArrayIteratorMethod;
+ }
+ var getIteratorMethod;
+ var hasRequiredGetIteratorMethod;
+ function requireGetIteratorMethod() {
+ if (hasRequiredGetIteratorMethod) return getIteratorMethod;
+ hasRequiredGetIteratorMethod = 1;
+ var classof = requireClassof();
+ var getMethod = requireGetMethod();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var Iterators = requireIterators();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var ITERATOR = wellKnownSymbol("iterator");
+ getIteratorMethod = function(it) {
+ if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
+ };
+ return getIteratorMethod;
+ }
+ var getIterator;
+ var hasRequiredGetIterator;
+ function requireGetIterator() {
+ if (hasRequiredGetIterator) return getIterator;
+ hasRequiredGetIterator = 1;
+ var call = requireFunctionCall();
+ var aCallable = requireACallable();
+ var anObject = requireAnObject();
+ var tryToString = requireTryToString();
+ var getIteratorMethod = requireGetIteratorMethod();
+ var $TypeError = TypeError;
+ getIterator = function(argument, usingIterator) {
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
+ if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
+ throw new $TypeError(tryToString(argument) + " is not iterable");
+ };
+ return getIterator;
+ }
+ var iteratorClose;
+ var hasRequiredIteratorClose;
+ function requireIteratorClose() {
+ if (hasRequiredIteratorClose) return iteratorClose;
+ hasRequiredIteratorClose = 1;
+ var call = requireFunctionCall();
+ var anObject = requireAnObject();
+ var getMethod = requireGetMethod();
+ iteratorClose = function(iterator, kind, value) {
+ var innerResult, innerError;
+ anObject(iterator);
+ try {
+ innerResult = getMethod(iterator, "return");
+ if (!innerResult) {
+ if (kind === "throw") throw value;
+ return value;
+ }
+ innerResult = call(innerResult, iterator);
+ } catch (error) {
+ innerError = true;
+ innerResult = error;
+ }
+ if (kind === "throw") throw value;
+ if (innerError) throw innerResult;
+ anObject(innerResult);
+ return value;
+ };
+ return iteratorClose;
+ }
+ var iterate;
+ var hasRequiredIterate;
+ function requireIterate() {
+ if (hasRequiredIterate) return iterate;
+ hasRequiredIterate = 1;
+ var bind = requireFunctionBindContext();
+ var call = requireFunctionCall();
+ var anObject = requireAnObject();
+ var tryToString = requireTryToString();
+ var isArrayIteratorMethod = requireIsArrayIteratorMethod();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var getIterator = requireGetIterator();
+ var getIteratorMethod = requireGetIteratorMethod();
+ var iteratorClose = requireIteratorClose();
+ var $TypeError = TypeError;
+ var Result = function(stopped, result) {
+ this.stopped = stopped;
+ this.result = result;
+ };
+ var ResultPrototype = Result.prototype;
+ iterate = function(iterable, unboundFunction, options) {
+ var that = options && options.that;
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
+ var IS_RECORD = !!(options && options.IS_RECORD);
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
+ var fn = bind(unboundFunction, that);
+ var iterator, iterFn, index, length, result, next, step;
+ var stop = function(condition) {
+ if (iterator) iteratorClose(iterator, "normal");
+ return new Result(true, condition);
+ };
+ var callFn = function(value) {
+ if (AS_ENTRIES) {
+ anObject(value);
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
+ }
+ return INTERRUPTED ? fn(value, stop) : fn(value);
+ };
+ if (IS_RECORD) {
+ iterator = iterable.iterator;
+ } else if (IS_ITERATOR) {
+ iterator = iterable;
+ } else {
+ iterFn = getIteratorMethod(iterable);
+ if (!iterFn) throw new $TypeError(tryToString(iterable) + " is not iterable");
+ if (isArrayIteratorMethod(iterFn)) {
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
+ result = callFn(iterable[index]);
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
+ }
+ return new Result(false);
+ }
+ iterator = getIterator(iterable, iterFn);
+ }
+ next = IS_RECORD ? iterable.next : iterator.next;
+ while (!(step = call(next, iterator)).done) {
+ try {
+ result = callFn(step.value);
+ } catch (error) {
+ iteratorClose(iterator, "throw", error);
+ }
+ if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result)) return result;
+ }
+ return new Result(false);
+ };
+ return iterate;
+ }
+ var checkCorrectnessOfIteration;
+ var hasRequiredCheckCorrectnessOfIteration;
+ function requireCheckCorrectnessOfIteration() {
+ if (hasRequiredCheckCorrectnessOfIteration) return checkCorrectnessOfIteration;
+ hasRequiredCheckCorrectnessOfIteration = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var ITERATOR = wellKnownSymbol("iterator");
+ var SAFE_CLOSING = false;
+ try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function() {
+ return {
+ done: !!called++
+ };
+ },
+ return: function() {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR] = function() {
+ return this;
+ };
+ Array.from(iteratorWithReturn, function() {
+ throw 2;
+ });
+ } catch (error) {}
+ checkCorrectnessOfIteration = function(exec, SKIP_CLOSING) {
+ try {
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
+ } catch (error) {
+ return false;
+ }
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR] = function() {
+ return {
+ next: function() {
+ return {
+ done: ITERATION_SUPPORT = true
+ };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) {}
+ return ITERATION_SUPPORT;
+ };
+ return checkCorrectnessOfIteration;
+ }
+ var promiseStaticsIncorrectIteration;
+ var hasRequiredPromiseStaticsIncorrectIteration;
+ function requirePromiseStaticsIncorrectIteration() {
+ if (hasRequiredPromiseStaticsIncorrectIteration) return promiseStaticsIncorrectIteration;
+ hasRequiredPromiseStaticsIncorrectIteration = 1;
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var checkCorrectnessOfIteration = requireCheckCorrectnessOfIteration();
+ var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR;
+ promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function(iterable) {
+ NativePromiseConstructor.all(iterable).then(undefined, function() {});
+ });
+ return promiseStaticsIncorrectIteration;
+ }
+ var hasRequiredEs_promise_all;
+ function requireEs_promise_all() {
+ if (hasRequiredEs_promise_all) return es_promise_all;
+ hasRequiredEs_promise_all = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ var aCallable = requireACallable();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var perform = requirePerform();
+ var iterate = requireIterate();
+ var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration();
+ $({
+ target: "Promise",
+ stat: true,
+ forced: PROMISE_STATICS_INCORRECT_ITERATION
+ }, {
+ all: function all(iterable) {
+ var C = this;
+ var capability = newPromiseCapabilityModule.f(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function() {
+ var $promiseResolve = aCallable(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate(iterable, function(promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ remaining++;
+ call($promiseResolve, C, promise).then(function(value) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[index] = value;
+ --remaining || resolve(values);
+ }, reject);
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+ });
+ return es_promise_all;
+ }
+ var es_promise_catch = {};
+ var hasRequiredEs_promise_catch;
+ function requireEs_promise_catch() {
+ if (hasRequiredEs_promise_catch) return es_promise_catch;
+ hasRequiredEs_promise_catch = 1;
+ var $ = require_export();
+ var IS_PURE = requireIsPure();
+ var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR;
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var getBuiltIn = requireGetBuiltIn();
+ var isCallable = requireIsCallable();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
+ $({
+ target: "Promise",
+ proto: true,
+ forced: FORCED_PROMISE_CONSTRUCTOR,
+ real: true
+ }, {
+ catch: function(onRejected) {
+ return this.then(undefined, onRejected);
+ }
+ });
+ if (!IS_PURE && isCallable(NativePromiseConstructor)) {
+ var method = getBuiltIn("Promise").prototype["catch"];
+ if (NativePromisePrototype["catch"] !== method) {
+ defineBuiltIn(NativePromisePrototype, "catch", method, {
+ unsafe: true
+ });
+ }
+ }
+ return es_promise_catch;
+ }
+ var es_promise_race = {};
+ var hasRequiredEs_promise_race;
+ function requireEs_promise_race() {
+ if (hasRequiredEs_promise_race) return es_promise_race;
+ hasRequiredEs_promise_race = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ var aCallable = requireACallable();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var perform = requirePerform();
+ var iterate = requireIterate();
+ var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration();
+ $({
+ target: "Promise",
+ stat: true,
+ forced: PROMISE_STATICS_INCORRECT_ITERATION
+ }, {
+ race: function race(iterable) {
+ var C = this;
+ var capability = newPromiseCapabilityModule.f(C);
+ var reject = capability.reject;
+ var result = perform(function() {
+ var $promiseResolve = aCallable(C.resolve);
+ iterate(iterable, function(promise) {
+ call($promiseResolve, C, promise).then(capability.resolve, reject);
+ });
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+ });
+ return es_promise_race;
+ }
+ var es_promise_reject = {};
+ var hasRequiredEs_promise_reject;
+ function requireEs_promise_reject() {
+ if (hasRequiredEs_promise_reject) return es_promise_reject;
+ hasRequiredEs_promise_reject = 1;
+ var $ = require_export();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR;
+ $({
+ target: "Promise",
+ stat: true,
+ forced: FORCED_PROMISE_CONSTRUCTOR
+ }, {
+ reject: function reject(r) {
+ var capability = newPromiseCapabilityModule.f(this);
+ var capabilityReject = capability.reject;
+ capabilityReject(r);
+ return capability.promise;
+ }
+ });
+ return es_promise_reject;
+ }
+ var es_promise_resolve = {};
+ var promiseResolve;
+ var hasRequiredPromiseResolve;
+ function requirePromiseResolve() {
+ if (hasRequiredPromiseResolve) return promiseResolve;
+ hasRequiredPromiseResolve = 1;
+ var anObject = requireAnObject();
+ var isObject = requireIsObject();
+ var newPromiseCapability = requireNewPromiseCapability();
+ promiseResolve = function(C, x) {
+ anObject(C);
+ if (isObject(x) && x.constructor === C) return x;
+ var promiseCapability = newPromiseCapability.f(C);
+ var resolve = promiseCapability.resolve;
+ resolve(x);
+ return promiseCapability.promise;
+ };
+ return promiseResolve;
+ }
+ var hasRequiredEs_promise_resolve;
+ function requireEs_promise_resolve() {
+ if (hasRequiredEs_promise_resolve) return es_promise_resolve;
+ hasRequiredEs_promise_resolve = 1;
+ var $ = require_export();
+ var getBuiltIn = requireGetBuiltIn();
+ var IS_PURE = requireIsPure();
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var FORCED_PROMISE_CONSTRUCTOR = requirePromiseConstructorDetection().CONSTRUCTOR;
+ var promiseResolve = requirePromiseResolve();
+ var PromiseConstructorWrapper = getBuiltIn("Promise");
+ var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
+ $({
+ target: "Promise",
+ stat: true,
+ forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR
+ }, {
+ resolve: function resolve(x) {
+ return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
+ }
+ });
+ return es_promise_resolve;
+ }
+ var hasRequiredEs_promise;
+ function requireEs_promise() {
+ if (hasRequiredEs_promise) return es_promise;
+ hasRequiredEs_promise = 1;
+ requireEs_promise_constructor();
+ requireEs_promise_all();
+ requireEs_promise_catch();
+ requireEs_promise_race();
+ requireEs_promise_reject();
+ requireEs_promise_resolve();
+ return es_promise;
+ }
+ requireEs_promise();
+ var es_promise_finally = {};
+ var hasRequiredEs_promise_finally;
+ function requireEs_promise_finally() {
+ if (hasRequiredEs_promise_finally) return es_promise_finally;
+ hasRequiredEs_promise_finally = 1;
+ var $ = require_export();
+ var IS_PURE = requireIsPure();
+ var NativePromiseConstructor = requirePromiseNativeConstructor();
+ var fails = requireFails();
+ var getBuiltIn = requireGetBuiltIn();
+ var isCallable = requireIsCallable();
+ var speciesConstructor = requireSpeciesConstructor();
+ var promiseResolve = requirePromiseResolve();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
+ var NON_GENERIC = !!NativePromiseConstructor && fails(function() {
+ NativePromisePrototype["finally"].call({
+ then: function() {}
+ }, function() {});
+ });
+ $({
+ target: "Promise",
+ proto: true,
+ real: true,
+ forced: NON_GENERIC
+ }, {
+ finally: function(onFinally) {
+ var C = speciesConstructor(this, getBuiltIn("Promise"));
+ var isFunction = isCallable(onFinally);
+ return this.then(isFunction ? function(x) {
+ return promiseResolve(C, onFinally()).then(function() {
+ return x;
+ });
+ } : onFinally, isFunction ? function(e) {
+ return promiseResolve(C, onFinally()).then(function() {
+ throw e;
+ });
+ } : onFinally);
+ }
+ });
+ if (!IS_PURE && isCallable(NativePromiseConstructor)) {
+ var method = getBuiltIn("Promise").prototype["finally"];
+ if (NativePromisePrototype["finally"] !== method) {
+ defineBuiltIn(NativePromisePrototype, "finally", method, {
+ unsafe: true
+ });
+ }
+ }
+ return es_promise_finally;
+ }
+ requireEs_promise_finally();
+ var es_string_iterator = {};
+ var toString;
+ var hasRequiredToString;
+ function requireToString() {
+ if (hasRequiredToString) return toString;
+ hasRequiredToString = 1;
+ var classof = requireClassof();
+ var $String = String;
+ toString = function(argument) {
+ if (classof(argument) === "Symbol") throw new TypeError("Cannot convert a Symbol value to a string");
+ return $String(argument);
+ };
+ return toString;
+ }
+ var stringMultibyte;
+ var hasRequiredStringMultibyte;
+ function requireStringMultibyte() {
+ if (hasRequiredStringMultibyte) return stringMultibyte;
+ hasRequiredStringMultibyte = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var toIntegerOrInfinity = requireToIntegerOrInfinity();
+ var toString = requireToString();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var charAt = uncurryThis("".charAt);
+ var charCodeAt = uncurryThis("".charCodeAt);
+ var stringSlice = uncurryThis("".slice);
+ var createMethod = function(CONVERT_TO_STRING) {
+ return function($this, pos) {
+ var S = toString(requireObjectCoercible($this));
+ var position = toIntegerOrInfinity(pos);
+ var size = S.length;
+ var first, second;
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? "" : undefined;
+ first = charCodeAt(S, position);
+ return first < 55296 || first > 56319 || position + 1 === size || (second = charCodeAt(S, position + 1)) < 56320 || second > 57343 ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 55296 << 10) + (second - 56320) + 65536;
+ };
+ };
+ stringMultibyte = {
+ codeAt: createMethod(false),
+ charAt: createMethod(true)
+ };
+ return stringMultibyte;
+ }
+ var hasRequiredEs_string_iterator;
+ function requireEs_string_iterator() {
+ if (hasRequiredEs_string_iterator) return es_string_iterator;
+ hasRequiredEs_string_iterator = 1;
+ var charAt = requireStringMultibyte().charAt;
+ var toString = requireToString();
+ var InternalStateModule = requireInternalState();
+ var defineIterator = requireIteratorDefine();
+ var createIterResultObject = requireCreateIterResultObject();
+ var STRING_ITERATOR = "String Iterator";
+ var setInternalState = InternalStateModule.set;
+ var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
+ defineIterator(String, "String", function(iterated) {
+ setInternalState(this, {
+ type: STRING_ITERATOR,
+ string: toString(iterated),
+ index: 0
+ });
+ }, function next() {
+ var state = getInternalState(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length) return createIterResultObject(undefined, true);
+ point = charAt(string, index);
+ state.index += point.length;
+ return createIterResultObject(point, false);
+ });
+ return es_string_iterator;
+ }
+ requireEs_string_iterator();
+ var es_string_trim = {};
+ var whitespaces;
+ var hasRequiredWhitespaces;
+ function requireWhitespaces() {
+ if (hasRequiredWhitespaces) return whitespaces;
+ hasRequiredWhitespaces = 1;
+ whitespaces = "\t\n\v\f\r " + " \u2028\u2029\ufeff";
+ return whitespaces;
+ }
+ var stringTrim;
+ var hasRequiredStringTrim;
+ function requireStringTrim() {
+ if (hasRequiredStringTrim) return stringTrim;
+ hasRequiredStringTrim = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var toString = requireToString();
+ var whitespaces = requireWhitespaces();
+ var replace = uncurryThis("".replace);
+ var ltrim = RegExp("^[" + whitespaces + "]+");
+ var rtrim = RegExp("(^|[^" + whitespaces + "])[" + whitespaces + "]+$");
+ var createMethod = function(TYPE) {
+ return function($this) {
+ var string = toString(requireObjectCoercible($this));
+ if (TYPE & 1) string = replace(string, ltrim, "");
+ if (TYPE & 2) string = replace(string, rtrim, "$1");
+ return string;
+ };
+ };
+ stringTrim = {
+ start: createMethod(1),
+ end: createMethod(2),
+ trim: createMethod(3)
+ };
+ return stringTrim;
+ }
+ var stringTrimForced;
+ var hasRequiredStringTrimForced;
+ function requireStringTrimForced() {
+ if (hasRequiredStringTrimForced) return stringTrimForced;
+ hasRequiredStringTrimForced = 1;
+ var PROPER_FUNCTION_NAME = requireFunctionName().PROPER;
+ var fails = requireFails();
+ var whitespaces = requireWhitespaces();
+ var non = "
";
+ stringTrimForced = function(METHOD_NAME) {
+ return fails(function() {
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() !== non || PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME;
+ });
+ };
+ return stringTrimForced;
+ }
+ var hasRequiredEs_string_trim;
+ function requireEs_string_trim() {
+ if (hasRequiredEs_string_trim) return es_string_trim;
+ hasRequiredEs_string_trim = 1;
+ var $ = require_export();
+ var $trim = requireStringTrim().trim;
+ var forcedStringTrimMethod = requireStringTrimForced();
+ $({
+ target: "String",
+ proto: true,
+ forced: forcedStringTrimMethod("trim")
+ }, {
+ trim: function trim() {
+ return $trim(this);
+ }
+ });
+ return es_string_trim;
+ }
+ requireEs_string_trim();
+ var esnext_aggregateError = {};
+ var es_aggregateError = {};
+ var es_aggregateError_constructor = {};
+ var installErrorCause;
+ var hasRequiredInstallErrorCause;
+ function requireInstallErrorCause() {
+ if (hasRequiredInstallErrorCause) return installErrorCause;
+ hasRequiredInstallErrorCause = 1;
+ var isObject = requireIsObject();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ installErrorCause = function(O, options) {
+ if (isObject(options) && "cause" in options) {
+ createNonEnumerableProperty(O, "cause", options.cause);
+ }
+ };
+ return installErrorCause;
+ }
+ var errorStackClear;
+ var hasRequiredErrorStackClear;
+ function requireErrorStackClear() {
+ if (hasRequiredErrorStackClear) return errorStackClear;
+ hasRequiredErrorStackClear = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var $Error = Error;
+ var replace = uncurryThis("".replace);
+ var TEST = function(arg) {
+ return String(new $Error(arg).stack);
+ }("zxcasd");
+ var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
+ var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
+ errorStackClear = function(stack, dropEntries) {
+ if (IS_V8_OR_CHAKRA_STACK && typeof stack == "string" && !$Error.prepareStackTrace) {
+ while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, "");
+ }
+ return stack;
+ };
+ return errorStackClear;
+ }
+ var errorStackInstallable;
+ var hasRequiredErrorStackInstallable;
+ function requireErrorStackInstallable() {
+ if (hasRequiredErrorStackInstallable) return errorStackInstallable;
+ hasRequiredErrorStackInstallable = 1;
+ var fails = requireFails();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ errorStackInstallable = !fails(function() {
+ var error = new Error("a");
+ if (!("stack" in error)) return true;
+ Object.defineProperty(error, "stack", createPropertyDescriptor(1, 7));
+ return error.stack !== 7;
+ });
+ return errorStackInstallable;
+ }
+ var errorStackInstall;
+ var hasRequiredErrorStackInstall;
+ function requireErrorStackInstall() {
+ if (hasRequiredErrorStackInstall) return errorStackInstall;
+ hasRequiredErrorStackInstall = 1;
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var clearErrorStack = requireErrorStackClear();
+ var ERROR_STACK_INSTALLABLE = requireErrorStackInstallable();
+ var captureStackTrace = Error.captureStackTrace;
+ errorStackInstall = function(error, C, stack, dropEntries) {
+ if (ERROR_STACK_INSTALLABLE) {
+ if (captureStackTrace) captureStackTrace(error, C); else createNonEnumerableProperty(error, "stack", clearErrorStack(stack, dropEntries));
+ }
+ };
+ return errorStackInstall;
+ }
+ var normalizeStringArgument;
+ var hasRequiredNormalizeStringArgument;
+ function requireNormalizeStringArgument() {
+ if (hasRequiredNormalizeStringArgument) return normalizeStringArgument;
+ hasRequiredNormalizeStringArgument = 1;
+ var toString = requireToString();
+ normalizeStringArgument = function(argument, $default) {
+ return argument === undefined ? arguments.length < 2 ? "" : $default : toString(argument);
+ };
+ return normalizeStringArgument;
+ }
+ var hasRequiredEs_aggregateError_constructor;
+ function requireEs_aggregateError_constructor() {
+ if (hasRequiredEs_aggregateError_constructor) return es_aggregateError_constructor;
+ hasRequiredEs_aggregateError_constructor = 1;
+ var $ = require_export();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var getPrototypeOf = requireObjectGetPrototypeOf();
+ var setPrototypeOf = requireObjectSetPrototypeOf();
+ var copyConstructorProperties = requireCopyConstructorProperties();
+ var create = requireObjectCreate();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ var installErrorCause = requireInstallErrorCause();
+ var installErrorStack = requireErrorStackInstall();
+ var iterate = requireIterate();
+ var normalizeStringArgument = requireNormalizeStringArgument();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var TO_STRING_TAG = wellKnownSymbol("toStringTag");
+ var $Error = Error;
+ var push = [].push;
+ var $AggregateError = function AggregateError(errors, message) {
+ var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
+ var that;
+ if (setPrototypeOf) {
+ that = setPrototypeOf(new $Error, isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
+ } else {
+ that = isInstance ? this : create(AggregateErrorPrototype);
+ createNonEnumerableProperty(that, TO_STRING_TAG, "Error");
+ }
+ if (message !== undefined) createNonEnumerableProperty(that, "message", normalizeStringArgument(message));
+ installErrorStack(that, $AggregateError, that.stack, 1);
+ if (arguments.length > 2) installErrorCause(that, arguments[2]);
+ var errorsArray = [];
+ iterate(errors, push, {
+ that: errorsArray
+ });
+ createNonEnumerableProperty(that, "errors", errorsArray);
+ return that;
+ };
+ if (setPrototypeOf) setPrototypeOf($AggregateError, $Error); else copyConstructorProperties($AggregateError, $Error, {
+ name: true
+ });
+ var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
+ constructor: createPropertyDescriptor(1, $AggregateError),
+ message: createPropertyDescriptor(1, ""),
+ name: createPropertyDescriptor(1, "AggregateError")
+ });
+ $({
+ global: true,
+ constructor: true,
+ arity: 2
+ }, {
+ AggregateError: $AggregateError
+ });
+ return es_aggregateError_constructor;
+ }
+ var hasRequiredEs_aggregateError;
+ function requireEs_aggregateError() {
+ if (hasRequiredEs_aggregateError) return es_aggregateError;
+ hasRequiredEs_aggregateError = 1;
+ requireEs_aggregateError_constructor();
+ return es_aggregateError;
+ }
+ var hasRequiredEsnext_aggregateError;
+ function requireEsnext_aggregateError() {
+ if (hasRequiredEsnext_aggregateError) return esnext_aggregateError;
+ hasRequiredEsnext_aggregateError = 1;
+ requireEs_aggregateError();
+ return esnext_aggregateError;
+ }
+ requireEsnext_aggregateError();
+ var esnext_promise_allSettled = {};
+ var es_promise_allSettled = {};
+ var hasRequiredEs_promise_allSettled;
+ function requireEs_promise_allSettled() {
+ if (hasRequiredEs_promise_allSettled) return es_promise_allSettled;
+ hasRequiredEs_promise_allSettled = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ var aCallable = requireACallable();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var perform = requirePerform();
+ var iterate = requireIterate();
+ var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration();
+ $({
+ target: "Promise",
+ stat: true,
+ forced: PROMISE_STATICS_INCORRECT_ITERATION
+ }, {
+ allSettled: function allSettled(iterable) {
+ var C = this;
+ var capability = newPromiseCapabilityModule.f(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function() {
+ var promiseResolve = aCallable(C.resolve);
+ var values = [];
+ var counter = 0;
+ var remaining = 1;
+ iterate(iterable, function(promise) {
+ var index = counter++;
+ var alreadyCalled = false;
+ remaining++;
+ call(promiseResolve, C, promise).then(function(value) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[index] = {
+ status: "fulfilled",
+ value: value
+ };
+ --remaining || resolve(values);
+ }, function(error) {
+ if (alreadyCalled) return;
+ alreadyCalled = true;
+ values[index] = {
+ status: "rejected",
+ reason: error
+ };
+ --remaining || resolve(values);
+ });
+ });
+ --remaining || resolve(values);
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+ });
+ return es_promise_allSettled;
+ }
+ var hasRequiredEsnext_promise_allSettled;
+ function requireEsnext_promise_allSettled() {
+ if (hasRequiredEsnext_promise_allSettled) return esnext_promise_allSettled;
+ hasRequiredEsnext_promise_allSettled = 1;
+ requireEs_promise_allSettled();
+ return esnext_promise_allSettled;
+ }
+ requireEsnext_promise_allSettled();
+ var esnext_promise_any = {};
+ var es_promise_any = {};
+ var hasRequiredEs_promise_any;
+ function requireEs_promise_any() {
+ if (hasRequiredEs_promise_any) return es_promise_any;
+ hasRequiredEs_promise_any = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ var aCallable = requireACallable();
+ var getBuiltIn = requireGetBuiltIn();
+ var newPromiseCapabilityModule = requireNewPromiseCapability();
+ var perform = requirePerform();
+ var iterate = requireIterate();
+ var PROMISE_STATICS_INCORRECT_ITERATION = requirePromiseStaticsIncorrectIteration();
+ var PROMISE_ANY_ERROR = "No one promise resolved";
+ $({
+ target: "Promise",
+ stat: true,
+ forced: PROMISE_STATICS_INCORRECT_ITERATION
+ }, {
+ any: function any(iterable) {
+ var C = this;
+ var AggregateError = getBuiltIn("AggregateError");
+ var capability = newPromiseCapabilityModule.f(C);
+ var resolve = capability.resolve;
+ var reject = capability.reject;
+ var result = perform(function() {
+ var promiseResolve = aCallable(C.resolve);
+ var errors = [];
+ var counter = 0;
+ var remaining = 1;
+ var alreadyResolved = false;
+ iterate(iterable, function(promise) {
+ var index = counter++;
+ var alreadyRejected = false;
+ remaining++;
+ call(promiseResolve, C, promise).then(function(value) {
+ if (alreadyRejected || alreadyResolved) return;
+ alreadyResolved = true;
+ resolve(value);
+ }, function(error) {
+ if (alreadyRejected || alreadyResolved) return;
+ alreadyRejected = true;
+ errors[index] = error;
+ --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
+ });
+ });
+ --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
+ });
+ if (result.error) reject(result.value);
+ return capability.promise;
+ }
+ });
+ return es_promise_any;
+ }
+ var hasRequiredEsnext_promise_any;
+ function requireEsnext_promise_any() {
+ if (hasRequiredEsnext_promise_any) return esnext_promise_any;
+ hasRequiredEsnext_promise_any = 1;
+ requireEs_promise_any();
+ return esnext_promise_any;
+ }
+ requireEsnext_promise_any();
+ var web_domCollections_forEach = {};
+ var domIterables;
+ var hasRequiredDomIterables;
+ function requireDomIterables() {
+ if (hasRequiredDomIterables) return domIterables;
+ hasRequiredDomIterables = 1;
+ domIterables = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+ };
+ return domIterables;
+ }
+ var domTokenListPrototype;
+ var hasRequiredDomTokenListPrototype;
+ function requireDomTokenListPrototype() {
+ if (hasRequiredDomTokenListPrototype) return domTokenListPrototype;
+ hasRequiredDomTokenListPrototype = 1;
+ var documentCreateElement = requireDocumentCreateElement();
+ var classList = documentCreateElement("span").classList;
+ var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
+ domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
+ return domTokenListPrototype;
+ }
+ var arrayForEach;
+ var hasRequiredArrayForEach;
+ function requireArrayForEach() {
+ if (hasRequiredArrayForEach) return arrayForEach;
+ hasRequiredArrayForEach = 1;
+ var $forEach = requireArrayIteration().forEach;
+ var arrayMethodIsStrict = requireArrayMethodIsStrict();
+ var STRICT_METHOD = arrayMethodIsStrict("forEach");
+ arrayForEach = !STRICT_METHOD ? function forEach(callbackfn) {
+ return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ } : [].forEach;
+ return arrayForEach;
+ }
+ var hasRequiredWeb_domCollections_forEach;
+ function requireWeb_domCollections_forEach() {
+ if (hasRequiredWeb_domCollections_forEach) return web_domCollections_forEach;
+ hasRequiredWeb_domCollections_forEach = 1;
+ var globalThis = requireGlobalThis();
+ var DOMIterables = requireDomIterables();
+ var DOMTokenListPrototype = requireDomTokenListPrototype();
+ var forEach = requireArrayForEach();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var handlePrototype = function(CollectionPrototype) {
+ if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
+ createNonEnumerableProperty(CollectionPrototype, "forEach", forEach);
+ } catch (error) {
+ CollectionPrototype.forEach = forEach;
+ }
+ };
+ for (var COLLECTION_NAME in DOMIterables) {
+ if (DOMIterables[COLLECTION_NAME]) {
+ handlePrototype(globalThis[COLLECTION_NAME] && globalThis[COLLECTION_NAME].prototype);
+ }
+ }
+ handlePrototype(DOMTokenListPrototype);
+ return web_domCollections_forEach;
+ }
+ requireWeb_domCollections_forEach();
+ var web_domCollections_iterator = {};
+ var hasRequiredWeb_domCollections_iterator;
+ function requireWeb_domCollections_iterator() {
+ if (hasRequiredWeb_domCollections_iterator) return web_domCollections_iterator;
+ hasRequiredWeb_domCollections_iterator = 1;
+ var globalThis = requireGlobalThis();
+ var DOMIterables = requireDomIterables();
+ var DOMTokenListPrototype = requireDomTokenListPrototype();
+ var ArrayIteratorMethods = requireEs_array_iterator();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var setToStringTag = requireSetToStringTag();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var ITERATOR = wellKnownSymbol("iterator");
+ var ArrayValues = ArrayIteratorMethods.values;
+ var handlePrototype = function(CollectionPrototype, COLLECTION_NAME) {
+ if (CollectionPrototype) {
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
+ } catch (error) {
+ CollectionPrototype[ITERATOR] = ArrayValues;
+ }
+ setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
+ } catch (error) {
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
+ }
+ }
+ }
+ };
+ for (var COLLECTION_NAME in DOMIterables) {
+ handlePrototype(globalThis[COLLECTION_NAME] && globalThis[COLLECTION_NAME].prototype, COLLECTION_NAME);
+ }
+ handlePrototype(DOMTokenListPrototype, "DOMTokenList");
+ return web_domCollections_iterator;
+ }
+ requireWeb_domCollections_iterator();
+ var Theme = {
+ addStylesForComponents: function addStylesForComponents(theme) {
+ var styles = "";
+ if (theme["background-toolbar"]) {
+ styles += ".loader-body,\n" + ".loader-bg { background-color: " + theme["background-toolbar"] + "; }\n";
+ styles += ".loader-body { box-shadow: 0 0 99px 99px " + theme["background-toolbar"] + "; }\n";
+ }
+ if (theme["background-loader"]) {
+ styles += ".loader-image { color: " + theme["background-loader"] + "; }\n";
+ }
+ if (theme["background-normal"]) {
+ styles += ".custom-button-secondary-icon,\n" + ".custom-button-secondary,\n" + ".input-field-element,\n" + ".selectbox-search-input,\n" + ".selectbox-header,\n" + ".selectbox-dropdown,\n" + ".radio-visual, \n" + ".checkbox-visual, \n" + ".message { background-color: " + theme["background-normal"] + "; }\n";
+ }
+ if (theme["text-inverse"]) {
+ styles += ".custom-button-primary { color: " + theme["text-inverse"] + "; }\n";
+ }
+ if (theme["border-regular-control"]) {
+ styles += ".custom-button-icon-only:active:not(.custom-button-disabled),\n" + ".custom-button-secondary-icon:active:not(.custom-button-disabled),\n" + ".custom-button-secondary:active:not(.custom-button-disabled),\n" + ".custom-button-icon-only:hover:not(.custom-button-disabled),\n" + ".custom-button-secondary-icon:hover:not(.custom-button-disabled),\n" + ".custom-button-secondary:hover:not(.custom-button-disabled),\n" + ".custom-button-secondary,\n" + ".custom-button-secondary-icon,\n" + ".input-field-element,\n" + ".checkbox-visual,\n" + ".radio-visual,\n" + ".selectbox-header,\n" + ".selectbox-dropdown,\n" + ".selectbox-search-input:focus,\n" + ".message { border-color: " + theme["border-regular-control"] + "; }\n";
+ styles += ".selectbox-search,\n" + ".selectbox-option-divider { border-color: " + theme["border-regular-control"] + " !important; }\n";
+ }
+ if (theme["border-error"]) {
+ styles += ".input-field-invalid .input-field-element { border-color: " + theme["border-error"] + "; }\n";
+ }
+ if (theme["border-control-focus"]) {
+ styles += ".custom-button-icon-only:focus:not(:active):not(:hover),\n" + ".custom-button-secondary-icon:focus:not(:active):not(:hover),\n" + ".custom-button-secondary:focus:not(:active):not(:hover),\n" + ".input-field-element:focus,\n" + ".input-field-focused .input-field-element,\n" + ".selectbox-header:active,\n" + ".selectbox-header:focus,\n" + ".selectbox-header-open { border-color: " + theme["border-control-focus"] + "; }\n";
+ }
+ if (theme["highlight-button-hover"]) {
+ styles += ".custom-button-icon-only:hover:not(.custom-button-disabled),\n" + ".custom-button-secondary-icon:hover:not(.custom-button-disabled),\n" + ".custom-button-secondary:hover:not(.custom-button-disabled),\n" + ".selectbox-custom-option:hover,\n" + ".selectbox-option:hover { background-color: " + theme["highlight-button-hover"] + "; }\n";
+ }
+ if (theme["highlight-button-pressed"]) {
+ styles += ".custom-button-icon-only:active:not(.custom-button-disabled),\n" + ".custom-button-secondary-icon:active:not(.custom-button-disabled),\n" + ".custom-button-secondary:active:not(.custom-button-disabled),\n" + ".selectbox-option-selected:hover,\n" + ".selectbox-option-selected { background-color: " + theme["highlight-button-pressed"] + "; }\n";
+ styles += ".selectbox-dropdown { box-shadow: 1px 1px 4px -1px " + theme["highlight-button-pressed"] + "; }\n";
+ }
+ if (theme["highlight-primary-dialog-button-hover"]) {
+ styles += ".custom-button-primary:hover:not(.custom-button-disabled) { background-color: " + theme["highlight-primary-dialog-button-hover"] + "; border-color: " + theme["highlight-primary-dialog-button-hover"] + "; }\n";
+ }
+ if (theme["background-primary-dialog-button"]) {
+ styles += ".checkbox-indeterminate,\n" + ".custom-button-primary { background-color: " + theme["background-primary-dialog-button"] + "; border-color: " + theme["background-primary-dialog-button"] + "; }\n";
+ }
+ if (theme["background-toolbar-additional"]) {
+ styles += ".custom-button-secondary-icon:disabled,\n" + ".custom-button-secondary-icon.custom-button-disabled,\n" + ".custom-button-secondary:disabled,\n" + ".custom-button-secondary.custom-button-disabled { background-color: " + theme["background-toolbar-additional"] + "; border-color: " + theme["background-toolbar-additional"] + "; }\n";
+ }
+ if (theme["text-normal"]) {
+ styles += ".custom-button-secondary-icon,\n" + ".custom-button-secondary,\n" + ".custom-button-secondary-icon,\n" + ".custom-button-icon-only,\n" + ".selectbox-search-input,\n" + ".loader-image,\n" + ".input-field-element { color: " + theme["text-normal"] + "; }\n";
+ styles += ".input-field-search-icon svg { fill: " + theme["text-normal"] + "; }\n";
+ }
+ if (theme["text-secondary"]) {
+ styles += ".message-close:hover,\n" + ".input-field-clear:hover { color: " + theme["text-secondary"] + "; }\n";
+ }
+ if (theme["text-tertiary"]) {
+ styles += ".input-field-clear,\n" + ".message-container:hover .message-close,\n" + ".custom-button-secondary-icon:disabled,\n" + ".custom-button-secondary-icon.custom-button-disabled,\n" + ".custom-button-secondary:disabled,\n" + ".custom-button-secondary.custom-button-disabled,\n" + ".input-field-element::placeholder,\n" + ".selectbox-search-input::placeholder { color: " + theme["text-tertiary"] + "; }\n";
+ }
+ var fontSize = "11px";
+ if ([ "theme-white", "theme-night" ].indexOf(theme.name) !== -1 || [ "theme-white", "theme-night" ].indexOf(theme.Name) !== -1) {
+ fontSize = "12px";
+ styles += ".message,\n" + ".custom-button,\n" + ".selectbox-header,\n" + ".input-field-element { border-radius: 4px; }\n";
+ styles += ".radio--checked .radio-visual { border-width: 4px; }\n";
+ styles += ".checkbox-checkmark { color: " + theme["text-inverse"] + "; }\n";
+ styles += ".checkbox--checked .checkbox-visual { background-color: " + theme["background-primary-dialog-button"] + "; }\n";
+ styles += ".radio--checked .radio-visual,\n" + ".checkbox--checked .checkbox-visual { border-color: " + theme["background-primary-dialog-button"] + "; }\n";
+ styles += ".radio-button-container:hover:not(.radio--checked) .radio-visual,\n" + ".checkbox-container:hover:not(.checkbox--disabled) .checkbox-visual { background-color: " + theme["highlight-button-hover"] + "; }\n";
+ styles += ".checkbox--checked:hover:not(.checkbox--disabled) .checkbox-visual { border-color: " + theme["highlight-primary-dialog-button-hover"] + "; background-color: " + theme["highlight-primary-dialog-button-hover"] + "; }\n";
+ styles += ".radio--checked:hover:not(.radio--disabled) .radio-visual { border-color: " + theme["highlight-primary-dialog-button-hover"] + "; }\n";
+ styles += "body { font-size: 12px; }\n";
+ } else {
+ styles += ".checkbox-checkmark { color: " + theme["text-normal"] + "; }\n";
+ styles += ".radio--checked .radio-visual { background-color: " + theme["text-normal"] + ";\n box-shadow: 0 0 0 2px" + theme["background-normal"] + " inset; }\n";
+ styles += ".radio-button-container:hover .radio-visual,\n" + ".checkbox-container:hover:not(.checkbox--disabled) .checkbox-visual { border-color: " + theme["border-control-focus"] + "; }\n";
+ }
+ styles += "body, input, textarea, select, button { font-size: " + fontSize + "; }\n";
+ var styleTheme = document.getElementById("componentsStyles");
+ if (!styleTheme) {
+ styleTheme = document.createElement("style");
+ styleTheme.id = "componentsStyles";
+ styleTheme.innerHTML = styles;
+ document.getElementsByTagName("head")[0].appendChild(styleTheme);
+ return styles;
+ }
+ styleTheme.innerHTML = styles;
+ return styles;
+ },
+ fixThemeForIE: function fixThemeForIE(theme) {
+ if (!theme["background-toolbar"]) {
+ theme["background-toolbar"] = "#f7f7f7";
+ }
+ if (!theme["text-normal"]) {
+ theme["text-normal"] = "rgb(51, 51, 51)";
+ }
+ if (!theme["text-secondary"]) {
+ theme["text-secondary"] = "#848484";
+ }
+ if (!theme["highlight-button-hover"]) {
+ theme["highlight-button-hover"] = "#e0e0e0";
+ }
+ if (!theme["background-normal"]) {
+ theme["background-normal"] = "white";
+ }
+ if (!theme["background-loader"]) {
+ theme["background-loader"] = "rgba(24, 24, 24, 0.9)";
+ }
+ if (!theme["highlight-button-pressed"]) {
+ theme["highlight-button-pressed"] = "#cbcbcb";
+ }
+ if (!theme["text-inverse"]) {
+ theme["text-inverse"] = "white";
+ }
+ if (!theme["border-regular-control"]) {
+ theme["border-regular-control"] = "#c0c0c0";
+ }
+ if (!theme["border-error"]) {
+ theme["border-error"] = "#f62211";
+ }
+ if (!theme["border-control-focus"]) {
+ theme["border-control-focus"] = "#848484";
+ }
+ if (!theme["highlight-primary-dialog-button-hover"]) {
+ theme["highlight-primary-dialog-button-hover"] = "#1c1c1c";
+ }
+ if (!theme["background-primary-dialog-button"]) {
+ theme["background-primary-dialog-button"] = "#444444";
+ }
+ if (!theme["background-toolbar-additional"]) {
+ theme["background-toolbar-additional"] = "#efefef";
+ }
+ if (!theme["text-tertiary"]) {
+ theme["text-tertiary"] = "#bdbdbd";
+ }
+ return theme;
+ }
+ };
+ var es_array_map = {};
+ var hasRequiredEs_array_map;
+ function requireEs_array_map() {
+ if (hasRequiredEs_array_map) return es_array_map;
+ hasRequiredEs_array_map = 1;
+ var $ = require_export();
+ var $map = requireArrayIteration().map;
+ var arrayMethodHasSpeciesSupport = requireArrayMethodHasSpeciesSupport();
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("map");
+ $({
+ target: "Array",
+ proto: true,
+ forced: !HAS_SPECIES_SUPPORT
+ }, {
+ map: function map(callbackfn) {
+ return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+ return es_array_map;
+ }
+ requireEs_array_map();
+ function Router() {
+ this._states = [ "mainState", "loginState", "settingsState" ];
+ this._routes = [ "main", "login", "settings" ];
+ this._currentRoute = "login";
+ this._currentRouteIndex = 1;
+ this._containers = this._states.map(function(route) {
+ var container = document.getElementById(route);
+ if (!container) throw new Error("container ".concat(route, " not found"));
+ return container;
+ });
+ }
+ Router.prototype.getRoute = function() {
+ return this._currentRoute;
+ };
+ Router.prototype._setCurrentRoute = function(route) {
+ this._containers[this._currentRouteIndex].classList.add("hidden");
+ this._currentRoute = route;
+ this._currentRouteIndex = this._routes.indexOf(route);
+ this._containers[this._currentRouteIndex].classList.remove("hidden");
+ };
+ Router.prototype.openMain = function() {
+ this._setCurrentRoute("main");
+ };
+ Router.prototype.openLogin = function() {
+ this._setCurrentRoute("login");
+ };
+ Router.prototype.openSettings = function() {
+ this._setCurrentRoute("settings");
+ };
+ var zoteroEnvironment = {
+ restApiUrl: "https://api.zotero.org/",
+ desktopApiUrl: "http://127.0.0.1:23119/api/"
+ };
+ var ZoteroApiChecker = {
+ _done: false,
+ _desktop: false,
+ _hasPermission: true,
+ _online: false,
+ _hasKey: false,
+ _timeout: 1e3,
+ _callback: function _callback(e) {},
+ _desktopVersion: function() {
+ if (window.navigator && window.navigator.userAgent.toLowerCase().indexOf("ascdesktopeditor") < 0) return false;
+ if (window.location && window.location.protocol == "file:") return true;
+ var src = window.document.currentScript ? window.document.currentScript.getAttribute("src") : "";
+ if (src && 0 == src.indexOf("file:///")) return true;
+ return false;
+ }(),
+ runApisChecker: function runApisChecker(sdk) {
+ var self = this;
+ self._done = false;
+ function attemptCheck() {
+ if (self._done) return;
+ self._checkApiAvailable(sdk).then(function(res) {
+ if (self._done) return;
+ if (res.online && res.hasKey) {
+ self._done = true;
+ } else if (res.desktop && res.hasPermission) {
+ self._done = true;
+ }
+ self._callback(res);
+ setTimeout(attemptCheck, self._timeout);
+ });
+ }
+ attemptCheck();
+ return {
+ subscribe: function subscribe(callbackFn) {
+ self._callback = callbackFn;
+ },
+ unsubscribe: function unsubscribe() {
+ self._done = true;
+ self._callback = function() {};
+ }
+ };
+ },
+ checkStatus: function checkStatus(sdk) {
+ return this._checkApiAvailable(sdk);
+ },
+ successfullyLoggedInUsingApiKey: function successfullyLoggedInUsingApiKey() {
+ this._done = true;
+ this._callback({
+ online: true,
+ hasKey: true,
+ desktop: this._desktop,
+ hasPermission: this._hasPermission,
+ desktopVersion: this._desktopVersion
+ });
+ },
+ _checkApiAvailable: function _checkApiAvailable(sdk) {
+ var self = this;
+ return Promise.all([ fetch(zoteroEnvironment.restApiUrl, {
+ method: "GET",
+ cache: "no-cache"
+ }).then(function(res) {
+ return res.status === 200;
+ }).catch(function() {
+ return false;
+ }), self._sendDesktopRequest(zoteroEnvironment.desktopApiUrl).then(function(res) {
+ self._hasPermission = res.hasPermission;
+ return res.isZoteroRunning;
+ }).catch(function() {
+ return false;
+ }) ]).then(function(apisAvailable) {
+ self._online = apisAvailable[0];
+ self._desktop = apisAvailable[1];
+ self._hasKey = sdk.hasSettings();
+ return {
+ online: self._online,
+ hasKey: self._hasKey,
+ desktop: self._desktop,
+ hasPermission: self._hasPermission,
+ desktopVersion: self._desktopVersion
+ };
+ });
+ },
+ _sendDesktopRequest: function _sendDesktopRequest(url) {
+ var self = this;
+ return new Promise(function(resolve, reject) {
+ if (!self._desktopVersion) {
+ resolve({
+ hasPermission: false,
+ isZoteroRunning: false
+ });
+ return;
+ }
+ window.AscSimpleRequest.createRequest({
+ url: url,
+ method: "GET",
+ headers: {
+ "Zotero-API-Version": "3",
+ "User-Agent": "AscDesktopEditor"
+ },
+ complete: function complete(e) {
+ var hasPermission = false;
+ var isZoteroRunning = false;
+ if (e.responseStatus == 403) {
+ hasPermission = false;
+ isZoteroRunning = true;
+ } else if (e.responseStatus === 200) {
+ isZoteroRunning = true;
+ hasPermission = true;
+ }
+ resolve({
+ hasPermission: hasPermission,
+ isZoteroRunning: isZoteroRunning
+ });
+ },
+ error: function error(e) {
+ if (e.statusCode == -102) e.statusCode = 404;
+ reject(e);
+ }
+ });
+ });
+ }
+ };
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ function _assertClassBrand(e, t, n) {
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
+ throw new TypeError("Private element is not present on this object");
+ }
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
+ try {
+ var i = n[a](c), u = i.value;
+ } catch (n) {
+ return void e(n);
+ }
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
+ }
+ function _asyncToGenerator(n) {
+ return function() {
+ var t = this, e = arguments;
+ return new Promise(function(r, o) {
+ var a = n.apply(t, e);
+ function _next(n) {
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
+ }
+ function _throw(n) {
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
+ }
+ _next(void 0);
+ });
+ };
+ }
+ function _checkPrivateRedeclaration(e, t) {
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
+ }
+ function _classCallCheck(a, n) {
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
+ }
+ function _classPrivateFieldGet2(s, a) {
+ return s.get(_assertClassBrand(s, a));
+ }
+ function _classPrivateFieldInitSpec(e, t, a) {
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
+ }
+ function _classPrivateFieldSet2(s, a, r) {
+ return s.set(_assertClassBrand(s, a), r), r;
+ }
+ function _classPrivateMethodInitSpec(e, a) {
+ _checkPrivateRedeclaration(e, a), a.add(e);
+ }
+ function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true),
+ Object.defineProperty(e, _toPropertyKey(o.key), o);
+ }
+ }
+ function _createClass(e, r, t) {
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
+ writable: false
+ }), e;
+ }
+ function _createForOfIteratorHelper(r, e) {
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
+ if (!t) {
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
+ t && (r = t);
+ var n = 0, F = function() {};
+ return {
+ s: F,
+ n: function() {
+ return n >= r.length ? {
+ done: true
+ } : {
+ done: false,
+ value: r[n++]
+ };
+ },
+ e: function(r) {
+ throw r;
+ },
+ f: F
+ };
+ }
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
+ }
+ var o, a = true, u = false;
+ return {
+ s: function() {
+ t = t.call(r);
+ },
+ n: function() {
+ var r = t.next();
+ return a = r.done, r;
+ },
+ e: function(r) {
+ u = true, o = r;
+ },
+ f: function() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ }
+ };
+ }
+ function _defineProperty(e, r, t) {
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ }) : e[r] = t, e;
+ }
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ r && (o = o.filter(function(r) {
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
+ })), t.push.apply(t, o);
+ }
+ return t;
+ }
+ function _objectSpread2(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r) {
+ _defineProperty(e, r, t[r]);
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
+ });
+ }
+ return e;
+ }
+ function _regenerator() {
+ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag";
+ function i(r, n, o, i) {
+ var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype);
+ return _regeneratorDefine(u, "_invoke", function(r, n, o) {
+ var i, c, u, f = 0, p = o || [], y = false, G = {
+ p: 0,
+ n: 0,
+ v: e,
+ a: d,
+ f: d.bind(e, 4),
+ d: function(t, r) {
+ return i = t, c = 0, u = e, G.n = r, a;
+ }
+ };
+ function d(r, n) {
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
+ var o, i = p[t], d = G.p, l = i[2];
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0,
+ G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n,
+ G.n = l, c = 0));
+ }
+ if (o || r > 1) return a;
+ throw y = true, n;
+ }
+ return function(o, p, l) {
+ if (f > 1) throw TypeError("Generator is already running");
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y; ) {
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
+ try {
+ if (f = 2, i) {
+ if (c || (o = "next"), t = i[o]) {
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
+ if (!t.done) return t;
+ u = t.value, c < 2 && (c = 0);
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"),
+ c = 1);
+ i = e;
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
+ } catch (t) {
+ i = e, c = 1, u = t;
+ } finally {
+ f = 1;
+ }
+ }
+ return {
+ value: t,
+ done: y
+ };
+ };
+ }(r, o, i), true), u;
+ }
+ var a = {};
+ function Generator() {}
+ function GeneratorFunction() {}
+ function GeneratorFunctionPrototype() {}
+ t = Object.getPrototypeOf;
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function() {
+ return this;
+ }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
+ function f(e) {
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype,
+ _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u),
+ e;
+ }
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype),
+ _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction),
+ GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"),
+ _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function() {
+ return this;
+ }), _regeneratorDefine(u, "toString", function() {
+ return "[object Generator]";
+ }), (_regenerator = function() {
+ return {
+ w: i,
+ m: f
+ };
+ })();
+ }
+ function _regeneratorDefine(e, r, n, t) {
+ var i = Object.defineProperty;
+ try {
+ i({}, "", {});
+ } catch (e) {
+ i = 0;
+ }
+ _regeneratorDefine = function(e, r, n, t) {
+ function o(r, n) {
+ _regeneratorDefine(e, r, function(e) {
+ return this._invoke(r, n, e);
+ });
+ }
+ r ? i ? i(e, r, {
+ value: n,
+ enumerable: !t,
+ configurable: !t,
+ writable: !t
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
+ }, _regeneratorDefine(e, r, n, t);
+ }
+ function _toPrimitive(t, r) {
+ if ("object" != typeof t || !t) return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r);
+ if ("object" != typeof i) return i;
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return String(t);
+ }
+ function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == typeof i ? i : i + "";
+ }
+ function _typeof(o) {
+ "@babel/helpers - typeof";
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
+ return typeof o;
+ } : function(o) {
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
+ }, _typeof(o);
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
+ }
+ }
+ var es_number_constructor = {};
+ var inheritIfRequired;
+ var hasRequiredInheritIfRequired;
+ function requireInheritIfRequired() {
+ if (hasRequiredInheritIfRequired) return inheritIfRequired;
+ hasRequiredInheritIfRequired = 1;
+ var isCallable = requireIsCallable();
+ var isObject = requireIsObject();
+ var setPrototypeOf = requireObjectSetPrototypeOf();
+ inheritIfRequired = function($this, dummy, Wrapper) {
+ var NewTarget, NewTargetPrototype;
+ if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) setPrototypeOf($this, NewTargetPrototype);
+ return $this;
+ };
+ return inheritIfRequired;
+ }
+ var thisNumberValue;
+ var hasRequiredThisNumberValue;
+ function requireThisNumberValue() {
+ if (hasRequiredThisNumberValue) return thisNumberValue;
+ hasRequiredThisNumberValue = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ thisNumberValue = uncurryThis(1.1.valueOf);
+ return thisNumberValue;
+ }
+ var hasRequiredEs_number_constructor;
+ function requireEs_number_constructor() {
+ if (hasRequiredEs_number_constructor) return es_number_constructor;
+ hasRequiredEs_number_constructor = 1;
+ var $ = require_export();
+ var IS_PURE = requireIsPure();
+ var DESCRIPTORS = requireDescriptors();
+ var globalThis = requireGlobalThis();
+ var path = requirePath();
+ var uncurryThis = requireFunctionUncurryThis();
+ var isForced = requireIsForced();
+ var hasOwn = requireHasOwnProperty();
+ var inheritIfRequired = requireInheritIfRequired();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var isSymbol = requireIsSymbol();
+ var toPrimitive = requireToPrimitive();
+ var fails = requireFails();
+ var getOwnPropertyNames = requireObjectGetOwnPropertyNames().f;
+ var getOwnPropertyDescriptor = requireObjectGetOwnPropertyDescriptor().f;
+ var defineProperty = requireObjectDefineProperty().f;
+ var thisNumberValue = requireThisNumberValue();
+ var trim = requireStringTrim().trim;
+ var NUMBER = "Number";
+ var NativeNumber = globalThis[NUMBER];
+ var PureNumberNamespace = path[NUMBER];
+ var NumberPrototype = NativeNumber.prototype;
+ var TypeError = globalThis.TypeError;
+ var stringSlice = uncurryThis("".slice);
+ var charCodeAt = uncurryThis("".charCodeAt);
+ var toNumeric = function(value) {
+ var primValue = toPrimitive(value, "number");
+ return typeof primValue == "bigint" ? primValue : toNumber(primValue);
+ };
+ var toNumber = function(argument) {
+ var it = toPrimitive(argument, "number");
+ var first, third, radix, maxCode, digits, length, index, code;
+ if (isSymbol(it)) throw new TypeError("Cannot convert a Symbol value to a number");
+ if (typeof it == "string" && it.length > 2) {
+ it = trim(it);
+ first = charCodeAt(it, 0);
+ if (first === 43 || first === 45) {
+ third = charCodeAt(it, 2);
+ if (third === 88 || third === 120) return NaN;
+ } else if (first === 48) {
+ switch (charCodeAt(it, 1)) {
+ case 66:
+ case 98:
+ radix = 2;
+ maxCode = 49;
+ break;
+
+ case 79:
+ case 111:
+ radix = 8;
+ maxCode = 55;
+ break;
+
+ default:
+ return +it;
+ }
+ digits = stringSlice(it, 2);
+ length = digits.length;
+ for (index = 0; index < length; index++) {
+ code = charCodeAt(digits, index);
+ if (code < 48 || code > maxCode) return NaN;
+ }
+ return parseInt(digits, radix);
+ }
+ }
+ return +it;
+ };
+ var FORCED = isForced(NUMBER, !NativeNumber(" 0o1") || !NativeNumber("0b1") || NativeNumber("+0x1"));
+ var calledWithNew = function(dummy) {
+ return isPrototypeOf(NumberPrototype, dummy) && fails(function() {
+ thisNumberValue(dummy);
+ });
+ };
+ var NumberWrapper = function Number(value) {
+ var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
+ return calledWithNew(this) ? inheritIfRequired(Object(n), this, NumberWrapper) : n;
+ };
+ NumberWrapper.prototype = NumberPrototype;
+ if (FORCED && !IS_PURE) NumberPrototype.constructor = NumberWrapper;
+ $({
+ global: true,
+ constructor: true,
+ wrap: true,
+ forced: FORCED
+ }, {
+ Number: NumberWrapper
+ });
+ var copyConstructorProperties = function(target, source) {
+ for (var keys = DESCRIPTORS ? getOwnPropertyNames(source) : ("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY," + "EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt," + "fromString,range").split(","), j = 0, key; keys.length > j; j++) {
+ if (hasOwn(source, key = keys[j]) && !hasOwn(target, key)) {
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+ }
+ };
+ if (IS_PURE && PureNumberNamespace) copyConstructorProperties(path[NUMBER], PureNumberNamespace);
+ if (FORCED || IS_PURE) copyConstructorProperties(path[NUMBER], NativeNumber);
+ return es_number_constructor;
+ }
+ requireEs_number_constructor();
+ var es_object_keys = {};
+ var hasRequiredEs_object_keys;
+ function requireEs_object_keys() {
+ if (hasRequiredEs_object_keys) return es_object_keys;
+ hasRequiredEs_object_keys = 1;
+ var $ = require_export();
+ var toObject = requireToObject();
+ var nativeKeys = requireObjectKeys();
+ var fails = requireFails();
+ var FAILS_ON_PRIMITIVES = fails(function() {
+ nativeKeys(1);
+ });
+ $({
+ target: "Object",
+ stat: true,
+ forced: FAILS_ON_PRIMITIVES
+ }, {
+ keys: function keys(it) {
+ return nativeKeys(toObject(it));
+ }
+ });
+ return es_object_keys;
+ }
+ requireEs_object_keys();
+ var es_regexp_exec = {};
+ var regexpFlags;
+ var hasRequiredRegexpFlags;
+ function requireRegexpFlags() {
+ if (hasRequiredRegexpFlags) return regexpFlags;
+ hasRequiredRegexpFlags = 1;
+ var anObject = requireAnObject();
+ regexpFlags = function() {
+ var that = anObject(this);
+ var result = "";
+ if (that.hasIndices) result += "d";
+ if (that.global) result += "g";
+ if (that.ignoreCase) result += "i";
+ if (that.multiline) result += "m";
+ if (that.dotAll) result += "s";
+ if (that.unicode) result += "u";
+ if (that.unicodeSets) result += "v";
+ if (that.sticky) result += "y";
+ return result;
+ };
+ return regexpFlags;
+ }
+ var regexpStickyHelpers;
+ var hasRequiredRegexpStickyHelpers;
+ function requireRegexpStickyHelpers() {
+ if (hasRequiredRegexpStickyHelpers) return regexpStickyHelpers;
+ hasRequiredRegexpStickyHelpers = 1;
+ var fails = requireFails();
+ var globalThis = requireGlobalThis();
+ var $RegExp = globalThis.RegExp;
+ var UNSUPPORTED_Y = fails(function() {
+ var re = $RegExp("a", "y");
+ re.lastIndex = 2;
+ return re.exec("abcd") !== null;
+ });
+ var MISSED_STICKY = UNSUPPORTED_Y || fails(function() {
+ return !$RegExp("a", "y").sticky;
+ });
+ var BROKEN_CARET = UNSUPPORTED_Y || fails(function() {
+ var re = $RegExp("^r", "gy");
+ re.lastIndex = 2;
+ return re.exec("str") !== null;
+ });
+ regexpStickyHelpers = {
+ BROKEN_CARET: BROKEN_CARET,
+ MISSED_STICKY: MISSED_STICKY,
+ UNSUPPORTED_Y: UNSUPPORTED_Y
+ };
+ return regexpStickyHelpers;
+ }
+ var regexpUnsupportedDotAll;
+ var hasRequiredRegexpUnsupportedDotAll;
+ function requireRegexpUnsupportedDotAll() {
+ if (hasRequiredRegexpUnsupportedDotAll) return regexpUnsupportedDotAll;
+ hasRequiredRegexpUnsupportedDotAll = 1;
+ var fails = requireFails();
+ var globalThis = requireGlobalThis();
+ var $RegExp = globalThis.RegExp;
+ regexpUnsupportedDotAll = fails(function() {
+ var re = $RegExp(".", "s");
+ return !(re.dotAll && re.test("\n") && re.flags === "s");
+ });
+ return regexpUnsupportedDotAll;
+ }
+ var regexpUnsupportedNcg;
+ var hasRequiredRegexpUnsupportedNcg;
+ function requireRegexpUnsupportedNcg() {
+ if (hasRequiredRegexpUnsupportedNcg) return regexpUnsupportedNcg;
+ hasRequiredRegexpUnsupportedNcg = 1;
+ var fails = requireFails();
+ var globalThis = requireGlobalThis();
+ var $RegExp = globalThis.RegExp;
+ regexpUnsupportedNcg = fails(function() {
+ var re = $RegExp("(?b)", "g");
+ return re.exec("b").groups.a !== "b" || "b".replace(re, "$ c") !== "bc";
+ });
+ return regexpUnsupportedNcg;
+ }
+ var regexpExec;
+ var hasRequiredRegexpExec;
+ function requireRegexpExec() {
+ if (hasRequiredRegexpExec) return regexpExec;
+ hasRequiredRegexpExec = 1;
+ var call = requireFunctionCall();
+ var uncurryThis = requireFunctionUncurryThis();
+ var toString = requireToString();
+ var regexpFlags = requireRegexpFlags();
+ var stickyHelpers = requireRegexpStickyHelpers();
+ var shared = requireShared();
+ var create = requireObjectCreate();
+ var getInternalState = requireInternalState().get;
+ var UNSUPPORTED_DOT_ALL = requireRegexpUnsupportedDotAll();
+ var UNSUPPORTED_NCG = requireRegexpUnsupportedNcg();
+ var nativeReplace = shared("native-string-replace", String.prototype.replace);
+ var nativeExec = RegExp.prototype.exec;
+ var patchedExec = nativeExec;
+ var charAt = uncurryThis("".charAt);
+ var indexOf = uncurryThis("".indexOf);
+ var replace = uncurryThis("".replace);
+ var stringSlice = uncurryThis("".slice);
+ var UPDATES_LAST_INDEX_WRONG = function() {
+ var re1 = /a/;
+ var re2 = /b*/g;
+ call(nativeExec, re1, "a");
+ call(nativeExec, re2, "a");
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
+ }();
+ var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
+ var NPCG_INCLUDED = /()??/.exec("")[1] !== undefined;
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
+ if (PATCH) {
+ patchedExec = function exec(string) {
+ var re = this;
+ var state = getInternalState(re);
+ var str = toString(string);
+ var raw = state.raw;
+ var result, reCopy, lastIndex, match, i, object, group;
+ if (raw) {
+ raw.lastIndex = re.lastIndex;
+ result = call(patchedExec, raw, str);
+ re.lastIndex = raw.lastIndex;
+ return result;
+ }
+ var groups = state.groups;
+ var sticky = UNSUPPORTED_Y && re.sticky;
+ var flags = call(regexpFlags, re);
+ var source = re.source;
+ var charsAdded = 0;
+ var strCopy = str;
+ if (sticky) {
+ flags = replace(flags, "y", "");
+ if (indexOf(flags, "g") === -1) {
+ flags += "g";
+ }
+ strCopy = stringSlice(str, re.lastIndex);
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== "\n")) {
+ source = "(?: " + source + ")";
+ strCopy = " " + strCopy;
+ charsAdded++;
+ }
+ reCopy = new RegExp("^(?:" + source + ")", flags);
+ }
+ if (NPCG_INCLUDED) {
+ reCopy = new RegExp("^" + source + "$(?!\\s)", flags);
+ }
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
+ match = call(nativeExec, sticky ? reCopy : re, strCopy);
+ if (sticky) {
+ if (match) {
+ match.input = stringSlice(match.input, charsAdded);
+ match[0] = stringSlice(match[0], charsAdded);
+ match.index = re.lastIndex;
+ re.lastIndex += match[0].length;
+ } else re.lastIndex = 0;
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
+ }
+ if (NPCG_INCLUDED && match && match.length > 1) {
+ call(nativeReplace, match[0], reCopy, function() {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+ if (match && groups) {
+ match.groups = object = create(null);
+ for (i = 0; i < groups.length; i++) {
+ group = groups[i];
+ object[group[0]] = match[group[1]];
+ }
+ }
+ return match;
+ };
+ }
+ regexpExec = patchedExec;
+ return regexpExec;
+ }
+ var hasRequiredEs_regexp_exec;
+ function requireEs_regexp_exec() {
+ if (hasRequiredEs_regexp_exec) return es_regexp_exec;
+ hasRequiredEs_regexp_exec = 1;
+ var $ = require_export();
+ var exec = requireRegexpExec();
+ $({
+ target: "RegExp",
+ proto: true,
+ forced: /./.exec !== exec
+ }, {
+ exec: exec
+ });
+ return es_regexp_exec;
+ }
+ requireEs_regexp_exec();
+ var web_url = {};
+ var web_url_constructor = {};
+ var urlConstructorDetection;
+ var hasRequiredUrlConstructorDetection;
+ function requireUrlConstructorDetection() {
+ if (hasRequiredUrlConstructorDetection) return urlConstructorDetection;
+ hasRequiredUrlConstructorDetection = 1;
+ var fails = requireFails();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var DESCRIPTORS = requireDescriptors();
+ var IS_PURE = requireIsPure();
+ var ITERATOR = wellKnownSymbol("iterator");
+ urlConstructorDetection = !fails(function() {
+ var url = new URL("b?a=1&b=2&c=3", "https://a");
+ var params = url.searchParams;
+ var params2 = new URLSearchParams("a=1&a=2&b=3");
+ var result = "";
+ url.pathname = "c%20d";
+ params.forEach(function(value, key) {
+ params["delete"]("b");
+ result += key + value;
+ });
+ params2["delete"]("a", 2);
+ params2["delete"]("b", undefined);
+ return IS_PURE && (!url.toJSON || !params2.has("a", 1) || params2.has("a", 2) || !params2.has("a", undefined) || params2.has("b")) || !params.size && (IS_PURE || !DESCRIPTORS) || !params.sort || url.href !== "https://a/c%20d?a=1&c=3" || params.get("c") !== "3" || String(new URLSearchParams("?a=1")) !== "a=1" || !params[ITERATOR] || new URL("https://a@b").username !== "a" || new URLSearchParams(new URLSearchParams("a=b")).get("a") !== "b" || new URL("https://тест").host !== "xn--e1aybc" || new URL("https://a#б").hash !== "#%D0%B1" || result !== "a1c3" || new URL("https://x", undefined).host !== "x";
+ });
+ return urlConstructorDetection;
+ }
+ var objectAssign;
+ var hasRequiredObjectAssign;
+ function requireObjectAssign() {
+ if (hasRequiredObjectAssign) return objectAssign;
+ hasRequiredObjectAssign = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var uncurryThis = requireFunctionUncurryThis();
+ var call = requireFunctionCall();
+ var fails = requireFails();
+ var objectKeys = requireObjectKeys();
+ var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
+ var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable();
+ var toObject = requireToObject();
+ var IndexedObject = requireIndexedObject();
+ var $assign = Object.assign;
+ var defineProperty = Object.defineProperty;
+ var concat = uncurryThis([].concat);
+ objectAssign = !$assign || fails(function() {
+ if (DESCRIPTORS && $assign({
+ b: 1
+ }, $assign(defineProperty({}, "a", {
+ enumerable: true,
+ get: function() {
+ defineProperty(this, "b", {
+ value: 3,
+ enumerable: false
+ });
+ }
+ }), {
+ b: 2
+ })).b !== 1) return true;
+ var A = {};
+ var B = {};
+ var symbol = Symbol("assign detection");
+ var alphabet = "abcdefghijklmnopqrst";
+ A[symbol] = 7;
+ alphabet.split("").forEach(function(chr) {
+ B[chr] = chr;
+ });
+ return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join("") !== alphabet;
+ }) ? function assign(target, source) {
+ var T = toObject(target);
+ var argumentsLength = arguments.length;
+ var index = 1;
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
+ while (argumentsLength > index) {
+ var S = IndexedObject(arguments[index++]);
+ var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) {
+ key = keys[j++];
+ if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
+ }
+ }
+ return T;
+ } : $assign;
+ return objectAssign;
+ }
+ var callWithSafeIterationClosing;
+ var hasRequiredCallWithSafeIterationClosing;
+ function requireCallWithSafeIterationClosing() {
+ if (hasRequiredCallWithSafeIterationClosing) return callWithSafeIterationClosing;
+ hasRequiredCallWithSafeIterationClosing = 1;
+ var anObject = requireAnObject();
+ var iteratorClose = requireIteratorClose();
+ callWithSafeIterationClosing = function(iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ } catch (error) {
+ iteratorClose(iterator, "throw", error);
+ }
+ };
+ return callWithSafeIterationClosing;
+ }
+ var createProperty;
+ var hasRequiredCreateProperty;
+ function requireCreateProperty() {
+ if (hasRequiredCreateProperty) return createProperty;
+ hasRequiredCreateProperty = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var definePropertyModule = requireObjectDefineProperty();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ createProperty = function(object, key, value) {
+ if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value)); else object[key] = value;
+ };
+ return createProperty;
+ }
+ var arrayFrom;
+ var hasRequiredArrayFrom;
+ function requireArrayFrom() {
+ if (hasRequiredArrayFrom) return arrayFrom;
+ hasRequiredArrayFrom = 1;
+ var bind = requireFunctionBindContext();
+ var call = requireFunctionCall();
+ var toObject = requireToObject();
+ var callWithSafeIterationClosing = requireCallWithSafeIterationClosing();
+ var isArrayIteratorMethod = requireIsArrayIteratorMethod();
+ var isConstructor = requireIsConstructor();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var createProperty = requireCreateProperty();
+ var getIterator = requireGetIterator();
+ var getIteratorMethod = requireGetIteratorMethod();
+ var $Array = Array;
+ arrayFrom = function from(arrayLike) {
+ var O = toObject(arrayLike);
+ var IS_CONSTRUCTOR = isConstructor(this);
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
+ var iteratorMethod = getIteratorMethod(O);
+ var index = 0;
+ var length, result, step, iterator, next, value;
+ if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
+ result = IS_CONSTRUCTOR ? new this : [];
+ iterator = getIterator(O, iteratorMethod);
+ next = iterator.next;
+ for (;!(step = call(next, iterator)).done; index++) {
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [ step.value, index ], true) : step.value;
+ createProperty(result, index, value);
+ }
+ } else {
+ length = lengthOfArrayLike(O);
+ result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
+ for (;length > index; index++) {
+ value = mapping ? mapfn(O[index], index) : O[index];
+ createProperty(result, index, value);
+ }
+ }
+ result.length = index;
+ return result;
+ };
+ return arrayFrom;
+ }
+ var stringPunycodeToAscii;
+ var hasRequiredStringPunycodeToAscii;
+ function requireStringPunycodeToAscii() {
+ if (hasRequiredStringPunycodeToAscii) return stringPunycodeToAscii;
+ hasRequiredStringPunycodeToAscii = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var maxInt = 2147483647;
+ var base = 36;
+ var tMin = 1;
+ var tMax = 26;
+ var skew = 38;
+ var damp = 700;
+ var initialBias = 72;
+ var initialN = 128;
+ var delimiter = "-";
+ var regexNonASCII = /[^\0-\u007E]/;
+ var regexSeparators = /[.\u3002\uFF0E\uFF61]/g;
+ var OVERFLOW_ERROR = "Overflow: input needs wider integers to process";
+ var baseMinusTMin = base - tMin;
+ var $RangeError = RangeError;
+ var exec = uncurryThis(regexSeparators.exec);
+ var floor = Math.floor;
+ var fromCharCode = String.fromCharCode;
+ var charCodeAt = uncurryThis("".charCodeAt);
+ var join = uncurryThis([].join);
+ var push = uncurryThis([].push);
+ var replace = uncurryThis("".replace);
+ var split = uncurryThis("".split);
+ var toLowerCase = uncurryThis("".toLowerCase);
+ var ucs2decode = function(string) {
+ var output = [];
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var value = charCodeAt(string, counter++);
+ if (value >= 55296 && value <= 56319 && counter < length) {
+ var extra = charCodeAt(string, counter++);
+ if ((extra & 64512) === 56320) {
+ push(output, ((value & 1023) << 10) + (extra & 1023) + 65536);
+ } else {
+ push(output, value);
+ counter--;
+ }
+ } else {
+ push(output, value);
+ }
+ }
+ return output;
+ };
+ var digitToBasic = function(digit) {
+ return digit + 22 + 75 * (digit < 26);
+ };
+ var adapt = function(delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ while (delta > baseMinusTMin * tMax >> 1) {
+ delta = floor(delta / baseMinusTMin);
+ k += base;
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ };
+ var encode = function(input) {
+ var output = [];
+ input = ucs2decode(input);
+ var inputLength = input.length;
+ var n = initialN;
+ var delta = 0;
+ var bias = initialBias;
+ var i, currentValue;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < 128) {
+ push(output, fromCharCode(currentValue));
+ }
+ }
+ var basicLength = output.length;
+ var handledCPCount = basicLength;
+ if (basicLength) {
+ push(output, delimiter);
+ }
+ while (handledCPCount < inputLength) {
+ var m = maxInt;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+ var handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ throw new $RangeError(OVERFLOW_ERROR);
+ }
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < n && ++delta > maxInt) {
+ throw new $RangeError(OVERFLOW_ERROR);
+ }
+ if (currentValue === n) {
+ var q = delta;
+ var k = base;
+ while (true) {
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
+ if (q < t) break;
+ var qMinusT = q - t;
+ var baseMinusT = base - t;
+ push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
+ q = floor(qMinusT / baseMinusT);
+ k += base;
+ }
+ push(output, fromCharCode(digitToBasic(q)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
+ delta = 0;
+ handledCPCount++;
+ }
+ }
+ delta++;
+ n++;
+ }
+ return join(output, "");
+ };
+ stringPunycodeToAscii = function(input) {
+ var encoded = [];
+ var labels = split(replace(toLowerCase(input), regexSeparators, "."), ".");
+ var i, label;
+ for (i = 0; i < labels.length; i++) {
+ label = labels[i];
+ push(encoded, exec(regexNonASCII, label) ? "xn--" + encode(label) : label);
+ }
+ return join(encoded, ".");
+ };
+ return stringPunycodeToAscii;
+ }
+ var es_string_fromCodePoint = {};
+ var hasRequiredEs_string_fromCodePoint;
+ function requireEs_string_fromCodePoint() {
+ if (hasRequiredEs_string_fromCodePoint) return es_string_fromCodePoint;
+ hasRequiredEs_string_fromCodePoint = 1;
+ var $ = require_export();
+ var uncurryThis = requireFunctionUncurryThis();
+ var toAbsoluteIndex = requireToAbsoluteIndex();
+ var $RangeError = RangeError;
+ var fromCharCode = String.fromCharCode;
+ var $fromCodePoint = String.fromCodePoint;
+ var join = uncurryThis([].join);
+ var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length !== 1;
+ $({
+ target: "String",
+ stat: true,
+ arity: 1,
+ forced: INCORRECT_LENGTH
+ }, {
+ fromCodePoint: function fromCodePoint(x) {
+ var elements = [];
+ var length = arguments.length;
+ var i = 0;
+ var code;
+ while (length > i) {
+ code = +arguments[i++];
+ if (toAbsoluteIndex(code, 1114111) !== code) throw new $RangeError(code + " is not a valid code point");
+ elements[i] = code < 65536 ? fromCharCode(code) : fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320);
+ }
+ return join(elements, "");
+ }
+ });
+ return es_string_fromCodePoint;
+ }
+ var defineBuiltIns;
+ var hasRequiredDefineBuiltIns;
+ function requireDefineBuiltIns() {
+ if (hasRequiredDefineBuiltIns) return defineBuiltIns;
+ hasRequiredDefineBuiltIns = 1;
+ var defineBuiltIn = requireDefineBuiltIn();
+ defineBuiltIns = function(target, src, options) {
+ for (var key in src) defineBuiltIn(target, key, src[key], options);
+ return target;
+ };
+ return defineBuiltIns;
+ }
+ var arraySort;
+ var hasRequiredArraySort;
+ function requireArraySort() {
+ if (hasRequiredArraySort) return arraySort;
+ hasRequiredArraySort = 1;
+ var arraySlice = requireArraySlice();
+ var floor = Math.floor;
+ var sort = function(array, comparefn) {
+ var length = array.length;
+ if (length < 8) {
+ var i = 1;
+ var element, j;
+ while (i < length) {
+ j = i;
+ element = array[i];
+ while (j && comparefn(array[j - 1], element) > 0) {
+ array[j] = array[--j];
+ }
+ if (j !== i++) array[j] = element;
+ }
+ } else {
+ var middle = floor(length / 2);
+ var left = sort(arraySlice(array, 0, middle), comparefn);
+ var right = sort(arraySlice(array, middle), comparefn);
+ var llength = left.length;
+ var rlength = right.length;
+ var lindex = 0;
+ var rindex = 0;
+ while (lindex < llength || rindex < rlength) {
+ array[lindex + rindex] = lindex < llength && rindex < rlength ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++];
+ }
+ }
+ return array;
+ };
+ arraySort = sort;
+ return arraySort;
+ }
+ var web_urlSearchParams_constructor;
+ var hasRequiredWeb_urlSearchParams_constructor;
+ function requireWeb_urlSearchParams_constructor() {
+ if (hasRequiredWeb_urlSearchParams_constructor) return web_urlSearchParams_constructor;
+ hasRequiredWeb_urlSearchParams_constructor = 1;
+ requireEs_array_iterator();
+ requireEs_string_fromCodePoint();
+ var $ = require_export();
+ var globalThis = requireGlobalThis();
+ var safeGetBuiltIn = requireSafeGetBuiltIn();
+ var getBuiltIn = requireGetBuiltIn();
+ var call = requireFunctionCall();
+ var uncurryThis = requireFunctionUncurryThis();
+ var DESCRIPTORS = requireDescriptors();
+ var USE_NATIVE_URL = requireUrlConstructorDetection();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var defineBuiltIns = requireDefineBuiltIns();
+ var setToStringTag = requireSetToStringTag();
+ var createIteratorConstructor = requireIteratorCreateConstructor();
+ var InternalStateModule = requireInternalState();
+ var anInstance = requireAnInstance();
+ var isCallable = requireIsCallable();
+ var hasOwn = requireHasOwnProperty();
+ var bind = requireFunctionBindContext();
+ var classof = requireClassof();
+ var anObject = requireAnObject();
+ var isObject = requireIsObject();
+ var $toString = requireToString();
+ var create = requireObjectCreate();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ var getIterator = requireGetIterator();
+ var getIteratorMethod = requireGetIteratorMethod();
+ var createIterResultObject = requireCreateIterResultObject();
+ var validateArgumentsLength = requireValidateArgumentsLength();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var arraySort = requireArraySort();
+ var ITERATOR = wellKnownSymbol("iterator");
+ var URL_SEARCH_PARAMS = "URLSearchParams";
+ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + "Iterator";
+ var setInternalState = InternalStateModule.set;
+ var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
+ var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
+ var nativeFetch = safeGetBuiltIn("fetch");
+ var NativeRequest = safeGetBuiltIn("Request");
+ var Headers = safeGetBuiltIn("Headers");
+ var RequestPrototype = NativeRequest && NativeRequest.prototype;
+ var HeadersPrototype = Headers && Headers.prototype;
+ var TypeError = globalThis.TypeError;
+ var encodeURIComponent = globalThis.encodeURIComponent;
+ var fromCharCode = String.fromCharCode;
+ var fromCodePoint = getBuiltIn("String", "fromCodePoint");
+ var $parseInt = parseInt;
+ var charAt = uncurryThis("".charAt);
+ var join = uncurryThis([].join);
+ var push = uncurryThis([].push);
+ var replace = uncurryThis("".replace);
+ var shift = uncurryThis([].shift);
+ var splice = uncurryThis([].splice);
+ var split = uncurryThis("".split);
+ var stringSlice = uncurryThis("".slice);
+ var exec = uncurryThis(/./.exec);
+ var plus = /\+/g;
+ var FALLBACK_REPLACER = "�";
+ var VALID_HEX = /^[0-9a-f]+$/i;
+ var parseHexOctet = function(string, start) {
+ var substr = stringSlice(string, start, start + 2);
+ if (!exec(VALID_HEX, substr)) return NaN;
+ return $parseInt(substr, 16);
+ };
+ var getLeadingOnes = function(octet) {
+ var count = 0;
+ for (var mask = 128; mask > 0 && (octet & mask) !== 0; mask >>= 1) {
+ count++;
+ }
+ return count;
+ };
+ var utf8Decode = function(octets) {
+ var codePoint = null;
+ switch (octets.length) {
+ case 1:
+ codePoint = octets[0];
+ break;
+
+ case 2:
+ codePoint = (octets[0] & 31) << 6 | octets[1] & 63;
+ break;
+
+ case 3:
+ codePoint = (octets[0] & 15) << 12 | (octets[1] & 63) << 6 | octets[2] & 63;
+ break;
+
+ case 4:
+ codePoint = (octets[0] & 7) << 18 | (octets[1] & 63) << 12 | (octets[2] & 63) << 6 | octets[3] & 63;
+ break;
+ }
+ return codePoint > 1114111 ? null : codePoint;
+ };
+ var decode = function(input) {
+ input = replace(input, plus, " ");
+ var length = input.length;
+ var result = "";
+ var i = 0;
+ while (i < length) {
+ var decodedChar = charAt(input, i);
+ if (decodedChar === "%") {
+ if (charAt(input, i + 1) === "%" || i + 3 > length) {
+ result += "%";
+ i++;
+ continue;
+ }
+ var octet = parseHexOctet(input, i + 1);
+ if (octet !== octet) {
+ result += decodedChar;
+ i++;
+ continue;
+ }
+ i += 2;
+ var byteSequenceLength = getLeadingOnes(octet);
+ if (byteSequenceLength === 0) {
+ decodedChar = fromCharCode(octet);
+ } else {
+ if (byteSequenceLength === 1 || byteSequenceLength > 4) {
+ result += FALLBACK_REPLACER;
+ i++;
+ continue;
+ }
+ var octets = [ octet ];
+ var sequenceIndex = 1;
+ while (sequenceIndex < byteSequenceLength) {
+ i++;
+ if (i + 3 > length || charAt(input, i) !== "%") break;
+ var nextByte = parseHexOctet(input, i + 1);
+ if (nextByte !== nextByte) {
+ i += 3;
+ break;
+ }
+ if (nextByte > 191 || nextByte < 128) break;
+ push(octets, nextByte);
+ i += 2;
+ sequenceIndex++;
+ }
+ if (octets.length !== byteSequenceLength) {
+ result += FALLBACK_REPLACER;
+ continue;
+ }
+ var codePoint = utf8Decode(octets);
+ if (codePoint === null) {
+ result += FALLBACK_REPLACER;
+ } else {
+ decodedChar = fromCodePoint(codePoint);
+ }
+ }
+ }
+ result += decodedChar;
+ i++;
+ }
+ return result;
+ };
+ var find = /[!'()~]|%20/g;
+ var replacements = {
+ "!": "%21",
+ "'": "%27",
+ "(": "%28",
+ ")": "%29",
+ "~": "%7E",
+ "%20": "+"
+ };
+ var replacer = function(match) {
+ return replacements[match];
+ };
+ var serialize = function(it) {
+ return replace(encodeURIComponent(it), find, replacer);
+ };
+ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
+ setInternalState(this, {
+ type: URL_SEARCH_PARAMS_ITERATOR,
+ target: getInternalParamsState(params).entries,
+ index: 0,
+ kind: kind
+ });
+ }, URL_SEARCH_PARAMS, function next() {
+ var state = getInternalIteratorState(this);
+ var target = state.target;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = null;
+ return createIterResultObject(undefined, true);
+ }
+ var entry = target[index];
+ switch (state.kind) {
+ case "keys":
+ return createIterResultObject(entry.key, false);
+
+ case "values":
+ return createIterResultObject(entry.value, false);
+ }
+ return createIterResultObject([ entry.key, entry.value ], false);
+ }, true);
+ var URLSearchParamsState = function(init) {
+ this.entries = [];
+ this.url = null;
+ if (init !== undefined) {
+ if (isObject(init)) this.parseObject(init); else this.parseQuery(typeof init == "string" ? charAt(init, 0) === "?" ? stringSlice(init, 1) : init : $toString(init));
+ }
+ };
+ URLSearchParamsState.prototype = {
+ type: URL_SEARCH_PARAMS,
+ bindURL: function(url) {
+ this.url = url;
+ this.update();
+ },
+ parseObject: function(object) {
+ var entries = this.entries;
+ var iteratorMethod = getIteratorMethod(object);
+ var iterator, next, step, entryIterator, entryNext, first, second;
+ if (iteratorMethod) {
+ iterator = getIterator(object, iteratorMethod);
+ next = iterator.next;
+ while (!(step = call(next, iterator)).done) {
+ entryIterator = getIterator(anObject(step.value));
+ entryNext = entryIterator.next;
+ if ((first = call(entryNext, entryIterator)).done || (second = call(entryNext, entryIterator)).done || !call(entryNext, entryIterator).done) throw new TypeError("Expected sequence with length 2");
+ push(entries, {
+ key: $toString(first.value),
+ value: $toString(second.value)
+ });
+ }
+ } else for (var key in object) if (hasOwn(object, key)) {
+ push(entries, {
+ key: key,
+ value: $toString(object[key])
+ });
+ }
+ },
+ parseQuery: function(query) {
+ if (query) {
+ var entries = this.entries;
+ var attributes = split(query, "&");
+ var index = 0;
+ var attribute, entry;
+ while (index < attributes.length) {
+ attribute = attributes[index++];
+ if (attribute.length) {
+ entry = split(attribute, "=");
+ push(entries, {
+ key: decode(shift(entry)),
+ value: decode(join(entry, "="))
+ });
+ }
+ }
+ }
+ },
+ serialize: function() {
+ var entries = this.entries;
+ var result = [];
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ push(result, serialize(entry.key) + "=" + serialize(entry.value));
+ }
+ return join(result, "&");
+ },
+ update: function() {
+ this.entries.length = 0;
+ this.parseQuery(this.url.query);
+ },
+ updateURL: function() {
+ if (this.url) this.url.update();
+ }
+ };
+ var URLSearchParamsConstructor = function URLSearchParams() {
+ anInstance(this, URLSearchParamsPrototype);
+ var init = arguments.length > 0 ? arguments[0] : undefined;
+ var state = setInternalState(this, new URLSearchParamsState(init));
+ if (!DESCRIPTORS) this.size = state.entries.length;
+ };
+ var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
+ defineBuiltIns(URLSearchParamsPrototype, {
+ append: function append(name, value) {
+ var state = getInternalParamsState(this);
+ validateArgumentsLength(arguments.length, 2);
+ push(state.entries, {
+ key: $toString(name),
+ value: $toString(value)
+ });
+ if (!DESCRIPTORS) this.size++;
+ state.updateURL();
+ },
+ delete: function(name) {
+ var state = getInternalParamsState(this);
+ var length = validateArgumentsLength(arguments.length, 1);
+ var entries = state.entries;
+ var key = $toString(name);
+ var $value = length < 2 ? undefined : arguments[1];
+ var value = $value === undefined ? $value : $toString($value);
+ var index = 0;
+ while (index < entries.length) {
+ var entry = entries[index];
+ if (entry.key === key && (value === undefined || entry.value === value)) {
+ splice(entries, index, 1);
+ if (value !== undefined) break;
+ } else index++;
+ }
+ if (!DESCRIPTORS) this.size = entries.length;
+ state.updateURL();
+ },
+ get: function get(name) {
+ var entries = getInternalParamsState(this).entries;
+ validateArgumentsLength(arguments.length, 1);
+ var key = $toString(name);
+ var index = 0;
+ for (;index < entries.length; index++) {
+ if (entries[index].key === key) return entries[index].value;
+ }
+ return null;
+ },
+ getAll: function getAll(name) {
+ var entries = getInternalParamsState(this).entries;
+ validateArgumentsLength(arguments.length, 1);
+ var key = $toString(name);
+ var result = [];
+ var index = 0;
+ for (;index < entries.length; index++) {
+ if (entries[index].key === key) push(result, entries[index].value);
+ }
+ return result;
+ },
+ has: function has(name) {
+ var entries = getInternalParamsState(this).entries;
+ var length = validateArgumentsLength(arguments.length, 1);
+ var key = $toString(name);
+ var $value = length < 2 ? undefined : arguments[1];
+ var value = $value === undefined ? $value : $toString($value);
+ var index = 0;
+ while (index < entries.length) {
+ var entry = entries[index++];
+ if (entry.key === key && (value === undefined || entry.value === value)) return true;
+ }
+ return false;
+ },
+ set: function set(name, value) {
+ var state = getInternalParamsState(this);
+ validateArgumentsLength(arguments.length, 1);
+ var entries = state.entries;
+ var found = false;
+ var key = $toString(name);
+ var val = $toString(value);
+ var index = 0;
+ var entry;
+ for (;index < entries.length; index++) {
+ entry = entries[index];
+ if (entry.key === key) {
+ if (found) splice(entries, index--, 1); else {
+ found = true;
+ entry.value = val;
+ }
+ }
+ }
+ if (!found) push(entries, {
+ key: key,
+ value: val
+ });
+ if (!DESCRIPTORS) this.size = entries.length;
+ state.updateURL();
+ },
+ sort: function sort() {
+ var state = getInternalParamsState(this);
+ arraySort(state.entries, function(a, b) {
+ return a.key > b.key ? 1 : -1;
+ });
+ state.updateURL();
+ },
+ forEach: function forEach(callback) {
+ var entries = getInternalParamsState(this).entries;
+ var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined);
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ boundFunction(entry.value, entry.key, this);
+ }
+ },
+ keys: function keys() {
+ return new URLSearchParamsIterator(this, "keys");
+ },
+ values: function values() {
+ return new URLSearchParamsIterator(this, "values");
+ },
+ entries: function entries() {
+ return new URLSearchParamsIterator(this, "entries");
+ }
+ }, {
+ enumerable: true
+ });
+ defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, {
+ name: "entries"
+ });
+ defineBuiltIn(URLSearchParamsPrototype, "toString", function toString() {
+ return getInternalParamsState(this).serialize();
+ }, {
+ enumerable: true
+ });
+ if (DESCRIPTORS) defineBuiltInAccessor(URLSearchParamsPrototype, "size", {
+ get: function size() {
+ return getInternalParamsState(this).entries.length;
+ },
+ configurable: true,
+ enumerable: true
+ });
+ setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+ $({
+ global: true,
+ constructor: true,
+ forced: !USE_NATIVE_URL
+ }, {
+ URLSearchParams: URLSearchParamsConstructor
+ });
+ if (!USE_NATIVE_URL && isCallable(Headers)) {
+ var headersHas = uncurryThis(HeadersPrototype.has);
+ var headersSet = uncurryThis(HeadersPrototype.set);
+ var wrapRequestOptions = function(init) {
+ if (isObject(init)) {
+ var body = init.body;
+ var headers;
+ if (classof(body) === URL_SEARCH_PARAMS) {
+ headers = init.headers ? new Headers(init.headers) : new Headers;
+ if (!headersHas(headers, "content-type")) {
+ headersSet(headers, "content-type", "application/x-www-form-urlencoded;charset=UTF-8");
+ }
+ return create(init, {
+ body: createPropertyDescriptor(0, $toString(body)),
+ headers: createPropertyDescriptor(0, headers)
+ });
+ }
+ }
+ return init;
+ };
+ if (isCallable(nativeFetch)) {
+ $({
+ global: true,
+ enumerable: true,
+ dontCallGetSet: true,
+ forced: true
+ }, {
+ fetch: function fetch(input) {
+ return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
+ }
+ });
+ }
+ if (isCallable(NativeRequest)) {
+ var RequestConstructor = function Request(input) {
+ anInstance(this, RequestPrototype);
+ return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
+ };
+ RequestPrototype.constructor = RequestConstructor;
+ RequestConstructor.prototype = RequestPrototype;
+ $({
+ global: true,
+ constructor: true,
+ dontCallGetSet: true,
+ forced: true
+ }, {
+ Request: RequestConstructor
+ });
+ }
+ }
+ web_urlSearchParams_constructor = {
+ URLSearchParams: URLSearchParamsConstructor,
+ getState: getInternalParamsState
+ };
+ return web_urlSearchParams_constructor;
+ }
+ var hasRequiredWeb_url_constructor;
+ function requireWeb_url_constructor() {
+ if (hasRequiredWeb_url_constructor) return web_url_constructor;
+ hasRequiredWeb_url_constructor = 1;
+ requireEs_string_iterator();
+ var $ = require_export();
+ var DESCRIPTORS = requireDescriptors();
+ var USE_NATIVE_URL = requireUrlConstructorDetection();
+ var globalThis = requireGlobalThis();
+ var bind = requireFunctionBindContext();
+ var uncurryThis = requireFunctionUncurryThis();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var anInstance = requireAnInstance();
+ var hasOwn = requireHasOwnProperty();
+ var assign = requireObjectAssign();
+ var arrayFrom = requireArrayFrom();
+ var arraySlice = requireArraySlice();
+ var codeAt = requireStringMultibyte().codeAt;
+ var toASCII = requireStringPunycodeToAscii();
+ var $toString = requireToString();
+ var setToStringTag = requireSetToStringTag();
+ var validateArgumentsLength = requireValidateArgumentsLength();
+ var URLSearchParamsModule = requireWeb_urlSearchParams_constructor();
+ var InternalStateModule = requireInternalState();
+ var setInternalState = InternalStateModule.set;
+ var getInternalURLState = InternalStateModule.getterFor("URL");
+ var URLSearchParams = URLSearchParamsModule.URLSearchParams;
+ var getInternalSearchParamsState = URLSearchParamsModule.getState;
+ var NativeURL = globalThis.URL;
+ var TypeError = globalThis.TypeError;
+ var parseInt = globalThis.parseInt;
+ var floor = Math.floor;
+ var pow = Math.pow;
+ var charAt = uncurryThis("".charAt);
+ var exec = uncurryThis(/./.exec);
+ var join = uncurryThis([].join);
+ var numberToString = uncurryThis(1.1.toString);
+ var pop = uncurryThis([].pop);
+ var push = uncurryThis([].push);
+ var replace = uncurryThis("".replace);
+ var shift = uncurryThis([].shift);
+ var split = uncurryThis("".split);
+ var stringSlice = uncurryThis("".slice);
+ var toLowerCase = uncurryThis("".toLowerCase);
+ var unshift = uncurryThis([].unshift);
+ var INVALID_AUTHORITY = "Invalid authority";
+ var INVALID_SCHEME = "Invalid scheme";
+ var INVALID_HOST = "Invalid host";
+ var INVALID_PORT = "Invalid port";
+ var ALPHA = /[a-z]/i;
+ var ALPHANUMERIC = /[\d+-.a-z]/i;
+ var DIGIT = /\d/;
+ var HEX_START = /^0x/i;
+ var OCT = /^[0-7]+$/;
+ var DEC = /^\d+$/;
+ var HEX = /^[\da-f]+$/i;
+ var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/;
+ var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/;
+ var LEADING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+/;
+ var TRAILING_C0_CONTROL_OR_SPACE = /(^|[^\u0000-\u0020])[\u0000-\u0020]+$/;
+ var TAB_AND_NEW_LINE = /[\t\n\r]/g;
+ var EOF;
+ var parseIPv4 = function(input) {
+ var parts = split(input, ".");
+ var partsLength, numbers, index, part, radix, number, ipv4;
+ if (parts.length && parts[parts.length - 1] === "") {
+ parts.length--;
+ }
+ partsLength = parts.length;
+ if (partsLength > 4) return input;
+ numbers = [];
+ for (index = 0; index < partsLength; index++) {
+ part = parts[index];
+ if (part === "") return input;
+ radix = 10;
+ if (part.length > 1 && charAt(part, 0) === "0") {
+ radix = exec(HEX_START, part) ? 16 : 8;
+ part = stringSlice(part, radix === 8 ? 1 : 2);
+ }
+ if (part === "") {
+ number = 0;
+ } else {
+ if (!exec(radix === 10 ? DEC : radix === 8 ? OCT : HEX, part)) return input;
+ number = parseInt(part, radix);
+ }
+ push(numbers, number);
+ }
+ for (index = 0; index < partsLength; index++) {
+ number = numbers[index];
+ if (index === partsLength - 1) {
+ if (number >= pow(256, 5 - partsLength)) return null;
+ } else if (number > 255) return null;
+ }
+ ipv4 = pop(numbers);
+ for (index = 0; index < numbers.length; index++) {
+ ipv4 += numbers[index] * pow(256, 3 - index);
+ }
+ return ipv4;
+ };
+ var parseIPv6 = function(input) {
+ var address = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
+ var pieceIndex = 0;
+ var compress = null;
+ var pointer = 0;
+ var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
+ var chr = function() {
+ return charAt(input, pointer);
+ };
+ if (chr() === ":") {
+ if (charAt(input, 1) !== ":") return;
+ pointer += 2;
+ pieceIndex++;
+ compress = pieceIndex;
+ }
+ while (chr()) {
+ if (pieceIndex === 8) return;
+ if (chr() === ":") {
+ if (compress !== null) return;
+ pointer++;
+ pieceIndex++;
+ compress = pieceIndex;
+ continue;
+ }
+ value = length = 0;
+ while (length < 4 && exec(HEX, chr())) {
+ value = value * 16 + parseInt(chr(), 16);
+ pointer++;
+ length++;
+ }
+ if (chr() === ".") {
+ if (length === 0) return;
+ pointer -= length;
+ if (pieceIndex > 6) return;
+ numbersSeen = 0;
+ while (chr()) {
+ ipv4Piece = null;
+ if (numbersSeen > 0) {
+ if (chr() === "." && numbersSeen < 4) pointer++; else return;
+ }
+ if (!exec(DIGIT, chr())) return;
+ while (exec(DIGIT, chr())) {
+ number = parseInt(chr(), 10);
+ if (ipv4Piece === null) ipv4Piece = number; else if (ipv4Piece === 0) return; else ipv4Piece = ipv4Piece * 10 + number;
+ if (ipv4Piece > 255) return;
+ pointer++;
+ }
+ address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
+ numbersSeen++;
+ if (numbersSeen === 2 || numbersSeen === 4) pieceIndex++;
+ }
+ if (numbersSeen !== 4) return;
+ break;
+ } else if (chr() === ":") {
+ pointer++;
+ if (!chr()) return;
+ } else if (chr()) return;
+ address[pieceIndex++] = value;
+ }
+ if (compress !== null) {
+ swaps = pieceIndex - compress;
+ pieceIndex = 7;
+ while (pieceIndex !== 0 && swaps > 0) {
+ swap = address[pieceIndex];
+ address[pieceIndex--] = address[compress + swaps - 1];
+ address[compress + --swaps] = swap;
+ }
+ } else if (pieceIndex !== 8) return;
+ return address;
+ };
+ var findLongestZeroSequence = function(ipv6) {
+ var maxIndex = null;
+ var maxLength = 1;
+ var currStart = null;
+ var currLength = 0;
+ var index = 0;
+ for (;index < 8; index++) {
+ if (ipv6[index] !== 0) {
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ currStart = null;
+ currLength = 0;
+ } else {
+ if (currStart === null) currStart = index;
+ ++currLength;
+ }
+ }
+ return currLength > maxLength ? currStart : maxIndex;
+ };
+ var serializeHost = function(host) {
+ var result, index, compress, ignore0;
+ if (typeof host == "number") {
+ result = [];
+ for (index = 0; index < 4; index++) {
+ unshift(result, host % 256);
+ host = floor(host / 256);
+ }
+ return join(result, ".");
+ }
+ if (typeof host == "object") {
+ result = "";
+ compress = findLongestZeroSequence(host);
+ for (index = 0; index < 8; index++) {
+ if (ignore0 && host[index] === 0) continue;
+ if (ignore0) ignore0 = false;
+ if (compress === index) {
+ result += index ? ":" : "::";
+ ignore0 = true;
+ } else {
+ result += numberToString(host[index], 16);
+ if (index < 7) result += ":";
+ }
+ }
+ return "[" + result + "]";
+ }
+ return host;
+ };
+ var C0ControlPercentEncodeSet = {};
+ var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
+ " ": 1,
+ '"': 1,
+ "<": 1,
+ ">": 1,
+ "`": 1
+ });
+ var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
+ "#": 1,
+ "?": 1,
+ "{": 1,
+ "}": 1
+ });
+ var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
+ "/": 1,
+ ":": 1,
+ ";": 1,
+ "=": 1,
+ "@": 1,
+ "[": 1,
+ "\\": 1,
+ "]": 1,
+ "^": 1,
+ "|": 1
+ });
+ var percentEncode = function(chr, set) {
+ var code = codeAt(chr, 0);
+ return code > 32 && code < 127 && !hasOwn(set, chr) ? chr : encodeURIComponent(chr);
+ };
+ var specialSchemes = {
+ ftp: 21,
+ file: null,
+ http: 80,
+ https: 443,
+ ws: 80,
+ wss: 443
+ };
+ var isWindowsDriveLetter = function(string, normalized) {
+ var second;
+ return string.length === 2 && exec(ALPHA, charAt(string, 0)) && ((second = charAt(string, 1)) === ":" || !normalized && second === "|");
+ };
+ var startsWithWindowsDriveLetter = function(string) {
+ var third;
+ return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && (string.length === 2 || ((third = charAt(string, 2)) === "/" || third === "\\" || third === "?" || third === "#"));
+ };
+ var isSingleDot = function(segment) {
+ return segment === "." || toLowerCase(segment) === "%2e";
+ };
+ var isDoubleDot = function(segment) {
+ segment = toLowerCase(segment);
+ return segment === ".." || segment === "%2e." || segment === ".%2e" || segment === "%2e%2e";
+ };
+ var SCHEME_START = {};
+ var SCHEME = {};
+ var NO_SCHEME = {};
+ var SPECIAL_RELATIVE_OR_AUTHORITY = {};
+ var PATH_OR_AUTHORITY = {};
+ var RELATIVE = {};
+ var RELATIVE_SLASH = {};
+ var SPECIAL_AUTHORITY_SLASHES = {};
+ var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
+ var AUTHORITY = {};
+ var HOST = {};
+ var HOSTNAME = {};
+ var PORT = {};
+ var FILE = {};
+ var FILE_SLASH = {};
+ var FILE_HOST = {};
+ var PATH_START = {};
+ var PATH = {};
+ var CANNOT_BE_A_BASE_URL_PATH = {};
+ var QUERY = {};
+ var FRAGMENT = {};
+ var URLState = function(url, isBase, base) {
+ var urlString = $toString(url);
+ var baseState, failure, searchParams;
+ if (isBase) {
+ failure = this.parse(urlString);
+ if (failure) throw new TypeError(failure);
+ this.searchParams = null;
+ } else {
+ if (base !== undefined) baseState = new URLState(base, true);
+ failure = this.parse(urlString, null, baseState);
+ if (failure) throw new TypeError(failure);
+ searchParams = getInternalSearchParamsState(new URLSearchParams);
+ searchParams.bindURL(this);
+ this.searchParams = searchParams;
+ }
+ };
+ URLState.prototype = {
+ type: "URL",
+ parse: function(input, stateOverride, base) {
+ var url = this;
+ var state = stateOverride || SCHEME_START;
+ var pointer = 0;
+ var buffer = "";
+ var seenAt = false;
+ var seenBracket = false;
+ var seenPasswordToken = false;
+ var codePoints, chr, bufferCodePoints, failure;
+ input = $toString(input);
+ if (!stateOverride) {
+ url.scheme = "";
+ url.username = "";
+ url.password = "";
+ url.host = null;
+ url.port = null;
+ url.path = [];
+ url.query = null;
+ url.fragment = null;
+ url.cannotBeABaseURL = false;
+ input = replace(input, LEADING_C0_CONTROL_OR_SPACE, "");
+ input = replace(input, TRAILING_C0_CONTROL_OR_SPACE, "$1");
+ }
+ input = replace(input, TAB_AND_NEW_LINE, "");
+ codePoints = arrayFrom(input);
+ while (pointer <= codePoints.length) {
+ chr = codePoints[pointer];
+ switch (state) {
+ case SCHEME_START:
+ if (chr && exec(ALPHA, chr)) {
+ buffer += toLowerCase(chr);
+ state = SCHEME;
+ } else if (!stateOverride) {
+ state = NO_SCHEME;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case SCHEME:
+ if (chr && (exec(ALPHANUMERIC, chr) || chr === "+" || chr === "-" || chr === ".")) {
+ buffer += toLowerCase(chr);
+ } else if (chr === ":") {
+ if (stateOverride && (url.isSpecial() !== hasOwn(specialSchemes, buffer) || buffer === "file" && (url.includesCredentials() || url.port !== null) || url.scheme === "file" && !url.host)) return;
+ url.scheme = buffer;
+ if (stateOverride) {
+ if (url.isSpecial() && specialSchemes[url.scheme] === url.port) url.port = null;
+ return;
+ }
+ buffer = "";
+ if (url.scheme === "file") {
+ state = FILE;
+ } else if (url.isSpecial() && base && base.scheme === url.scheme) {
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
+ } else if (url.isSpecial()) {
+ state = SPECIAL_AUTHORITY_SLASHES;
+ } else if (codePoints[pointer + 1] === "/") {
+ state = PATH_OR_AUTHORITY;
+ pointer++;
+ } else {
+ url.cannotBeABaseURL = true;
+ push(url.path, "");
+ state = CANNOT_BE_A_BASE_URL_PATH;
+ }
+ } else if (!stateOverride) {
+ buffer = "";
+ state = NO_SCHEME;
+ pointer = 0;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case NO_SCHEME:
+ if (!base || base.cannotBeABaseURL && chr !== "#") return INVALID_SCHEME;
+ if (base.cannotBeABaseURL && chr === "#") {
+ url.scheme = base.scheme;
+ url.path = arraySlice(base.path);
+ url.query = base.query;
+ url.fragment = "";
+ url.cannotBeABaseURL = true;
+ state = FRAGMENT;
+ break;
+ }
+ state = base.scheme === "file" ? FILE : RELATIVE;
+ continue;
+
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
+ if (chr === "/" && codePoints[pointer + 1] === "/") {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ pointer++;
+ } else {
+ state = RELATIVE;
+ continue;
+ }
+ break;
+
+ case PATH_OR_AUTHORITY:
+ if (chr === "/") {
+ state = AUTHORITY;
+ break;
+ } else {
+ state = PATH;
+ continue;
+ }
+
+ case RELATIVE:
+ url.scheme = base.scheme;
+ if (chr === EOF) {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = arraySlice(base.path);
+ url.query = base.query;
+ } else if (chr === "/" || chr === "\\" && url.isSpecial()) {
+ state = RELATIVE_SLASH;
+ } else if (chr === "?") {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = arraySlice(base.path);
+ url.query = "";
+ state = QUERY;
+ } else if (chr === "#") {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = arraySlice(base.path);
+ url.query = base.query;
+ url.fragment = "";
+ state = FRAGMENT;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = arraySlice(base.path);
+ url.path.length--;
+ state = PATH;
+ continue;
+ }
+ break;
+
+ case RELATIVE_SLASH:
+ if (url.isSpecial() && (chr === "/" || chr === "\\")) {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ } else if (chr === "/") {
+ state = AUTHORITY;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ state = PATH;
+ continue;
+ }
+ break;
+
+ case SPECIAL_AUTHORITY_SLASHES:
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ if (chr !== "/" || charAt(buffer, pointer + 1) !== "/") continue;
+ pointer++;
+ break;
+
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
+ if (chr !== "/" && chr !== "\\") {
+ state = AUTHORITY;
+ continue;
+ }
+ break;
+
+ case AUTHORITY:
+ if (chr === "@") {
+ if (seenAt) buffer = "%40" + buffer;
+ seenAt = true;
+ bufferCodePoints = arrayFrom(buffer);
+ for (var i = 0; i < bufferCodePoints.length; i++) {
+ var codePoint = bufferCodePoints[i];
+ if (codePoint === ":" && !seenPasswordToken) {
+ seenPasswordToken = true;
+ continue;
+ }
+ var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
+ if (seenPasswordToken) url.password += encodedCodePoints; else url.username += encodedCodePoints;
+ }
+ buffer = "";
+ } else if (chr === EOF || chr === "/" || chr === "?" || chr === "#" || chr === "\\" && url.isSpecial()) {
+ if (seenAt && buffer === "") return INVALID_AUTHORITY;
+ pointer -= arrayFrom(buffer).length + 1;
+ buffer = "";
+ state = HOST;
+ } else buffer += chr;
+ break;
+
+ case HOST:
+ case HOSTNAME:
+ if (stateOverride && url.scheme === "file") {
+ state = FILE_HOST;
+ continue;
+ } else if (chr === ":" && !seenBracket) {
+ if (buffer === "") return INVALID_HOST;
+ failure = url.parseHost(buffer);
+ if (failure) return failure;
+ buffer = "";
+ state = PORT;
+ if (stateOverride === HOSTNAME) return;
+ } else if (chr === EOF || chr === "/" || chr === "?" || chr === "#" || chr === "\\" && url.isSpecial()) {
+ if (url.isSpecial() && buffer === "") return INVALID_HOST;
+ if (stateOverride && buffer === "" && (url.includesCredentials() || url.port !== null)) return;
+ failure = url.parseHost(buffer);
+ if (failure) return failure;
+ buffer = "";
+ state = PATH_START;
+ if (stateOverride) return;
+ continue;
+ } else {
+ if (chr === "[") seenBracket = true; else if (chr === "]") seenBracket = false;
+ buffer += chr;
+ }
+ break;
+
+ case PORT:
+ if (exec(DIGIT, chr)) {
+ buffer += chr;
+ } else if (chr === EOF || chr === "/" || chr === "?" || chr === "#" || chr === "\\" && url.isSpecial() || stateOverride) {
+ if (buffer !== "") {
+ var port = parseInt(buffer, 10);
+ if (port > 65535) return INVALID_PORT;
+ url.port = url.isSpecial() && port === specialSchemes[url.scheme] ? null : port;
+ buffer = "";
+ }
+ if (stateOverride) return;
+ state = PATH_START;
+ continue;
+ } else return INVALID_PORT;
+ break;
+
+ case FILE:
+ url.scheme = "file";
+ if (chr === "/" || chr === "\\") state = FILE_SLASH; else if (base && base.scheme === "file") {
+ switch (chr) {
+ case EOF:
+ url.host = base.host;
+ url.path = arraySlice(base.path);
+ url.query = base.query;
+ break;
+
+ case "?":
+ url.host = base.host;
+ url.path = arraySlice(base.path);
+ url.query = "";
+ state = QUERY;
+ break;
+
+ case "#":
+ url.host = base.host;
+ url.path = arraySlice(base.path);
+ url.query = base.query;
+ url.fragment = "";
+ state = FRAGMENT;
+ break;
+
+ default:
+ if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ""))) {
+ url.host = base.host;
+ url.path = arraySlice(base.path);
+ url.shortenPath();
+ }
+ state = PATH;
+ continue;
+ }
+ } else {
+ state = PATH;
+ continue;
+ }
+ break;
+
+ case FILE_SLASH:
+ if (chr === "/" || chr === "\\") {
+ state = FILE_HOST;
+ break;
+ }
+ if (base && base.scheme === "file" && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ""))) {
+ if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]); else url.host = base.host;
+ }
+ state = PATH;
+ continue;
+
+ case FILE_HOST:
+ if (chr === EOF || chr === "/" || chr === "\\" || chr === "?" || chr === "#") {
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
+ state = PATH;
+ } else if (buffer === "") {
+ url.host = "";
+ if (stateOverride) return;
+ state = PATH_START;
+ } else {
+ failure = url.parseHost(buffer);
+ if (failure) return failure;
+ if (url.host === "localhost") url.host = "";
+ if (stateOverride) return;
+ buffer = "";
+ state = PATH_START;
+ }
+ continue;
+ } else buffer += chr;
+ break;
+
+ case PATH_START:
+ if (url.isSpecial()) {
+ state = PATH;
+ if (chr !== "/" && chr !== "\\") continue;
+ } else if (!stateOverride && chr === "?") {
+ url.query = "";
+ state = QUERY;
+ } else if (!stateOverride && chr === "#") {
+ url.fragment = "";
+ state = FRAGMENT;
+ } else if (chr !== EOF) {
+ state = PATH;
+ if (chr !== "/") continue;
+ }
+ break;
+
+ case PATH:
+ if (chr === EOF || chr === "/" || chr === "\\" && url.isSpecial() || !stateOverride && (chr === "?" || chr === "#")) {
+ if (isDoubleDot(buffer)) {
+ url.shortenPath();
+ if (chr !== "/" && !(chr === "\\" && url.isSpecial())) {
+ push(url.path, "");
+ }
+ } else if (isSingleDot(buffer)) {
+ if (chr !== "/" && !(chr === "\\" && url.isSpecial())) {
+ push(url.path, "");
+ }
+ } else {
+ if (url.scheme === "file" && !url.path.length && isWindowsDriveLetter(buffer)) {
+ if (url.host) url.host = "";
+ buffer = charAt(buffer, 0) + ":";
+ }
+ push(url.path, buffer);
+ }
+ buffer = "";
+ if (url.scheme === "file" && (chr === EOF || chr === "?" || chr === "#")) {
+ while (url.path.length > 1 && url.path[0] === "") {
+ shift(url.path);
+ }
+ }
+ if (chr === "?") {
+ url.query = "";
+ state = QUERY;
+ } else if (chr === "#") {
+ url.fragment = "";
+ state = FRAGMENT;
+ }
+ } else {
+ buffer += percentEncode(chr, pathPercentEncodeSet);
+ }
+ break;
+
+ case CANNOT_BE_A_BASE_URL_PATH:
+ if (chr === "?") {
+ url.query = "";
+ state = QUERY;
+ } else if (chr === "#") {
+ url.fragment = "";
+ state = FRAGMENT;
+ } else if (chr !== EOF) {
+ url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet);
+ }
+ break;
+
+ case QUERY:
+ if (!stateOverride && chr === "#") {
+ url.fragment = "";
+ state = FRAGMENT;
+ } else if (chr !== EOF) {
+ if (chr === "'" && url.isSpecial()) url.query += "%27"; else if (chr === "#") url.query += "%23"; else url.query += percentEncode(chr, C0ControlPercentEncodeSet);
+ }
+ break;
+
+ case FRAGMENT:
+ if (chr !== EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet);
+ break;
+ }
+ pointer++;
+ }
+ },
+ parseHost: function(input) {
+ var result, codePoints, index;
+ if (charAt(input, 0) === "[") {
+ if (charAt(input, input.length - 1) !== "]") return INVALID_HOST;
+ result = parseIPv6(stringSlice(input, 1, -1));
+ if (!result) return INVALID_HOST;
+ this.host = result;
+ } else if (!this.isSpecial()) {
+ if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST;
+ result = "";
+ codePoints = arrayFrom(input);
+ for (index = 0; index < codePoints.length; index++) {
+ result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
+ }
+ this.host = result;
+ } else {
+ input = toASCII(input);
+ if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST;
+ result = parseIPv4(input);
+ if (result === null) return INVALID_HOST;
+ this.host = result;
+ }
+ },
+ cannotHaveUsernamePasswordPort: function() {
+ return !this.host || this.cannotBeABaseURL || this.scheme === "file";
+ },
+ includesCredentials: function() {
+ return this.username !== "" || this.password !== "";
+ },
+ isSpecial: function() {
+ return hasOwn(specialSchemes, this.scheme);
+ },
+ shortenPath: function() {
+ var path = this.path;
+ var pathSize = path.length;
+ if (pathSize && (this.scheme !== "file" || pathSize !== 1 || !isWindowsDriveLetter(path[0], true))) {
+ path.length--;
+ }
+ },
+ serialize: function() {
+ var url = this;
+ var scheme = url.scheme;
+ var username = url.username;
+ var password = url.password;
+ var host = url.host;
+ var port = url.port;
+ var path = url.path;
+ var query = url.query;
+ var fragment = url.fragment;
+ var output = scheme + ":";
+ if (host !== null) {
+ output += "//";
+ if (url.includesCredentials()) {
+ output += username + (password ? ":" + password : "") + "@";
+ }
+ output += serializeHost(host);
+ if (port !== null) output += ":" + port;
+ } else if (scheme === "file") output += "//";
+ output += url.cannotBeABaseURL ? path[0] : path.length ? "/" + join(path, "/") : "";
+ if (query !== null) output += "?" + query;
+ if (fragment !== null) output += "#" + fragment;
+ return output;
+ },
+ setHref: function(href) {
+ var failure = this.parse(href);
+ if (failure) throw new TypeError(failure);
+ this.searchParams.update();
+ },
+ getOrigin: function() {
+ var scheme = this.scheme;
+ var port = this.port;
+ if (scheme === "blob") try {
+ return new URLConstructor(scheme.path[0]).origin;
+ } catch (error) {
+ return "null";
+ }
+ if (scheme === "file" || !this.isSpecial()) return "null";
+ return scheme + "://" + serializeHost(this.host) + (port !== null ? ":" + port : "");
+ },
+ getProtocol: function() {
+ return this.scheme + ":";
+ },
+ setProtocol: function(protocol) {
+ this.parse($toString(protocol) + ":", SCHEME_START);
+ },
+ getUsername: function() {
+ return this.username;
+ },
+ setUsername: function(username) {
+ var codePoints = arrayFrom($toString(username));
+ if (this.cannotHaveUsernamePasswordPort()) return;
+ this.username = "";
+ for (var i = 0; i < codePoints.length; i++) {
+ this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ },
+ getPassword: function() {
+ return this.password;
+ },
+ setPassword: function(password) {
+ var codePoints = arrayFrom($toString(password));
+ if (this.cannotHaveUsernamePasswordPort()) return;
+ this.password = "";
+ for (var i = 0; i < codePoints.length; i++) {
+ this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ },
+ getHost: function() {
+ var host = this.host;
+ var port = this.port;
+ return host === null ? "" : port === null ? serializeHost(host) : serializeHost(host) + ":" + port;
+ },
+ setHost: function(host) {
+ if (this.cannotBeABaseURL) return;
+ this.parse(host, HOST);
+ },
+ getHostname: function() {
+ var host = this.host;
+ return host === null ? "" : serializeHost(host);
+ },
+ setHostname: function(hostname) {
+ if (this.cannotBeABaseURL) return;
+ this.parse(hostname, HOSTNAME);
+ },
+ getPort: function() {
+ var port = this.port;
+ return port === null ? "" : $toString(port);
+ },
+ setPort: function(port) {
+ if (this.cannotHaveUsernamePasswordPort()) return;
+ port = $toString(port);
+ if (port === "") this.port = null; else this.parse(port, PORT);
+ },
+ getPathname: function() {
+ var path = this.path;
+ return this.cannotBeABaseURL ? path[0] : path.length ? "/" + join(path, "/") : "";
+ },
+ setPathname: function(pathname) {
+ if (this.cannotBeABaseURL) return;
+ this.path = [];
+ this.parse(pathname, PATH_START);
+ },
+ getSearch: function() {
+ var query = this.query;
+ return query ? "?" + query : "";
+ },
+ setSearch: function(search) {
+ search = $toString(search);
+ if (search === "") {
+ this.query = null;
+ } else {
+ if (charAt(search, 0) === "?") search = stringSlice(search, 1);
+ this.query = "";
+ this.parse(search, QUERY);
+ }
+ this.searchParams.update();
+ },
+ getSearchParams: function() {
+ return this.searchParams.facade;
+ },
+ getHash: function() {
+ var fragment = this.fragment;
+ return fragment ? "#" + fragment : "";
+ },
+ setHash: function(hash) {
+ hash = $toString(hash);
+ if (hash === "") {
+ this.fragment = null;
+ return;
+ }
+ if (charAt(hash, 0) === "#") hash = stringSlice(hash, 1);
+ this.fragment = "";
+ this.parse(hash, FRAGMENT);
+ },
+ update: function() {
+ this.query = this.searchParams.serialize() || null;
+ }
+ };
+ var URLConstructor = function URL(url) {
+ var that = anInstance(this, URLPrototype);
+ var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined;
+ var state = setInternalState(that, new URLState(url, false, base));
+ if (!DESCRIPTORS) {
+ that.href = state.serialize();
+ that.origin = state.getOrigin();
+ that.protocol = state.getProtocol();
+ that.username = state.getUsername();
+ that.password = state.getPassword();
+ that.host = state.getHost();
+ that.hostname = state.getHostname();
+ that.port = state.getPort();
+ that.pathname = state.getPathname();
+ that.search = state.getSearch();
+ that.searchParams = state.getSearchParams();
+ that.hash = state.getHash();
+ }
+ };
+ var URLPrototype = URLConstructor.prototype;
+ var accessorDescriptor = function(getter, setter) {
+ return {
+ get: function() {
+ return getInternalURLState(this)[getter]();
+ },
+ set: setter && function(value) {
+ return getInternalURLState(this)[setter](value);
+ },
+ configurable: true,
+ enumerable: true
+ };
+ };
+ if (DESCRIPTORS) {
+ defineBuiltInAccessor(URLPrototype, "href", accessorDescriptor("serialize", "setHref"));
+ defineBuiltInAccessor(URLPrototype, "origin", accessorDescriptor("getOrigin"));
+ defineBuiltInAccessor(URLPrototype, "protocol", accessorDescriptor("getProtocol", "setProtocol"));
+ defineBuiltInAccessor(URLPrototype, "username", accessorDescriptor("getUsername", "setUsername"));
+ defineBuiltInAccessor(URLPrototype, "password", accessorDescriptor("getPassword", "setPassword"));
+ defineBuiltInAccessor(URLPrototype, "host", accessorDescriptor("getHost", "setHost"));
+ defineBuiltInAccessor(URLPrototype, "hostname", accessorDescriptor("getHostname", "setHostname"));
+ defineBuiltInAccessor(URLPrototype, "port", accessorDescriptor("getPort", "setPort"));
+ defineBuiltInAccessor(URLPrototype, "pathname", accessorDescriptor("getPathname", "setPathname"));
+ defineBuiltInAccessor(URLPrototype, "search", accessorDescriptor("getSearch", "setSearch"));
+ defineBuiltInAccessor(URLPrototype, "searchParams", accessorDescriptor("getSearchParams"));
+ defineBuiltInAccessor(URLPrototype, "hash", accessorDescriptor("getHash", "setHash"));
+ }
+ defineBuiltIn(URLPrototype, "toJSON", function toJSON() {
+ return getInternalURLState(this).serialize();
+ }, {
+ enumerable: true
+ });
+ defineBuiltIn(URLPrototype, "toString", function toString() {
+ return getInternalURLState(this).serialize();
+ }, {
+ enumerable: true
+ });
+ if (NativeURL) {
+ var nativeCreateObjectURL = NativeURL.createObjectURL;
+ var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
+ if (nativeCreateObjectURL) defineBuiltIn(URLConstructor, "createObjectURL", bind(nativeCreateObjectURL, NativeURL));
+ if (nativeRevokeObjectURL) defineBuiltIn(URLConstructor, "revokeObjectURL", bind(nativeRevokeObjectURL, NativeURL));
+ }
+ setToStringTag(URLConstructor, "URL");
+ $({
+ global: true,
+ constructor: true,
+ forced: !USE_NATIVE_URL,
+ sham: !DESCRIPTORS
+ }, {
+ URL: URLConstructor
+ });
+ return web_url_constructor;
+ }
+ var hasRequiredWeb_url;
+ function requireWeb_url() {
+ if (hasRequiredWeb_url) return web_url;
+ hasRequiredWeb_url = 1;
+ requireWeb_url_constructor();
+ return web_url;
+ }
+ requireWeb_url();
+ var web_url_toJson = {};
+ var hasRequiredWeb_url_toJson;
+ function requireWeb_url_toJson() {
+ if (hasRequiredWeb_url_toJson) return web_url_toJson;
+ hasRequiredWeb_url_toJson = 1;
+ var $ = require_export();
+ var call = requireFunctionCall();
+ $({
+ target: "URL",
+ proto: true,
+ enumerable: true
+ }, {
+ toJSON: function toJSON() {
+ return call(URL.prototype.toString, this);
+ }
+ });
+ return web_url_toJson;
+ }
+ requireWeb_url_toJson();
+ var web_urlSearchParams = {};
+ var hasRequiredWeb_urlSearchParams;
+ function requireWeb_urlSearchParams() {
+ if (hasRequiredWeb_urlSearchParams) return web_urlSearchParams;
+ hasRequiredWeb_urlSearchParams = 1;
+ requireWeb_urlSearchParams_constructor();
+ return web_urlSearchParams;
+ }
+ requireWeb_urlSearchParams();
+ var es_array_concat = {};
+ var doesNotExceedSafeInteger;
+ var hasRequiredDoesNotExceedSafeInteger;
+ function requireDoesNotExceedSafeInteger() {
+ if (hasRequiredDoesNotExceedSafeInteger) return doesNotExceedSafeInteger;
+ hasRequiredDoesNotExceedSafeInteger = 1;
+ var $TypeError = TypeError;
+ var MAX_SAFE_INTEGER = 9007199254740991;
+ doesNotExceedSafeInteger = function(it) {
+ if (it > MAX_SAFE_INTEGER) throw $TypeError("Maximum allowed index exceeded");
+ return it;
+ };
+ return doesNotExceedSafeInteger;
+ }
+ var hasRequiredEs_array_concat;
+ function requireEs_array_concat() {
+ if (hasRequiredEs_array_concat) return es_array_concat;
+ hasRequiredEs_array_concat = 1;
+ var $ = require_export();
+ var fails = requireFails();
+ var isArray = requireIsArray();
+ var isObject = requireIsObject();
+ var toObject = requireToObject();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var doesNotExceedSafeInteger = requireDoesNotExceedSafeInteger();
+ var createProperty = requireCreateProperty();
+ var arraySpeciesCreate = requireArraySpeciesCreate();
+ var arrayMethodHasSpeciesSupport = requireArrayMethodHasSpeciesSupport();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var V8_VERSION = requireEnvironmentV8Version();
+ var IS_CONCAT_SPREADABLE = wellKnownSymbol("isConcatSpreadable");
+ var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function() {
+ var array = [];
+ array[IS_CONCAT_SPREADABLE] = false;
+ return array.concat()[0] !== array;
+ });
+ var isConcatSpreadable = function(O) {
+ if (!isObject(O)) return false;
+ var spreadable = O[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray(O);
+ };
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport("concat");
+ $({
+ target: "Array",
+ proto: true,
+ arity: 1,
+ forced: FORCED
+ }, {
+ concat: function concat(arg) {
+ var O = toObject(this);
+ var A = arraySpeciesCreate(O, 0);
+ var n = 0;
+ var i, k, length, len, E;
+ for (i = -1, length = arguments.length; i < length; i++) {
+ E = i === -1 ? O : arguments[i];
+ if (isConcatSpreadable(E)) {
+ len = lengthOfArrayLike(E);
+ doesNotExceedSafeInteger(n + len);
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
+ } else {
+ doesNotExceedSafeInteger(n + 1);
+ createProperty(A, n++, E);
+ }
+ }
+ A.length = n;
+ return A;
+ }
+ });
+ return es_array_concat;
+ }
+ requireEs_array_concat();
+ var es_array_includes = {};
+ var hasRequiredEs_array_includes;
+ function requireEs_array_includes() {
+ if (hasRequiredEs_array_includes) return es_array_includes;
+ hasRequiredEs_array_includes = 1;
+ var $ = require_export();
+ var $includes = requireArrayIncludes().includes;
+ var fails = requireFails();
+ var addToUnscopables = requireAddToUnscopables();
+ var BROKEN_ON_SPARSE = fails(function() {
+ return !Array(1).includes();
+ });
+ $({
+ target: "Array",
+ proto: true,
+ forced: BROKEN_ON_SPARSE
+ }, {
+ includes: function includes(el) {
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+ addToUnscopables("includes");
+ return es_array_includes;
+ }
+ requireEs_array_includes();
+ var es_string_includes = {};
+ var isRegexp;
+ var hasRequiredIsRegexp;
+ function requireIsRegexp() {
+ if (hasRequiredIsRegexp) return isRegexp;
+ hasRequiredIsRegexp = 1;
+ var isObject = requireIsObject();
+ var classof = requireClassofRaw();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var MATCH = wellKnownSymbol("match");
+ isRegexp = function(it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === "RegExp");
+ };
+ return isRegexp;
+ }
+ var notARegexp;
+ var hasRequiredNotARegexp;
+ function requireNotARegexp() {
+ if (hasRequiredNotARegexp) return notARegexp;
+ hasRequiredNotARegexp = 1;
+ var isRegExp = requireIsRegexp();
+ var $TypeError = TypeError;
+ notARegexp = function(it) {
+ if (isRegExp(it)) {
+ throw new $TypeError("The method doesn't accept regular expressions");
+ }
+ return it;
+ };
+ return notARegexp;
+ }
+ var correctIsRegexpLogic;
+ var hasRequiredCorrectIsRegexpLogic;
+ function requireCorrectIsRegexpLogic() {
+ if (hasRequiredCorrectIsRegexpLogic) return correctIsRegexpLogic;
+ hasRequiredCorrectIsRegexpLogic = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var MATCH = wellKnownSymbol("match");
+ correctIsRegexpLogic = function(METHOD_NAME) {
+ var regexp = /./;
+ try {
+ "/./"[METHOD_NAME](regexp);
+ } catch (error1) {
+ try {
+ regexp[MATCH] = false;
+ return "/./"[METHOD_NAME](regexp);
+ } catch (error2) {}
+ }
+ return false;
+ };
+ return correctIsRegexpLogic;
+ }
+ var hasRequiredEs_string_includes;
+ function requireEs_string_includes() {
+ if (hasRequiredEs_string_includes) return es_string_includes;
+ hasRequiredEs_string_includes = 1;
+ var $ = require_export();
+ var uncurryThis = requireFunctionUncurryThis();
+ var notARegExp = requireNotARegexp();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var toString = requireToString();
+ var correctIsRegExpLogic = requireCorrectIsRegexpLogic();
+ var stringIndexOf = uncurryThis("".indexOf);
+ $({
+ target: "String",
+ proto: true,
+ forced: !correctIsRegExpLogic("includes")
+ }, {
+ includes: function includes(searchString) {
+ return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+ return es_string_includes;
+ }
+ requireEs_string_includes();
+ var es_weakMap = {};
+ var es_weakMap_constructor = {};
+ var freezing;
+ var hasRequiredFreezing;
+ function requireFreezing() {
+ if (hasRequiredFreezing) return freezing;
+ hasRequiredFreezing = 1;
+ var fails = requireFails();
+ freezing = !fails(function() {
+ return Object.isExtensible(Object.preventExtensions({}));
+ });
+ return freezing;
+ }
+ var internalMetadata = {
+ exports: {}
+ };
+ var objectGetOwnPropertyNamesExternal = {};
+ var hasRequiredObjectGetOwnPropertyNamesExternal;
+ function requireObjectGetOwnPropertyNamesExternal() {
+ if (hasRequiredObjectGetOwnPropertyNamesExternal) return objectGetOwnPropertyNamesExternal;
+ hasRequiredObjectGetOwnPropertyNamesExternal = 1;
+ var classof = requireClassofRaw();
+ var toIndexedObject = requireToIndexedObject();
+ var $getOwnPropertyNames = requireObjectGetOwnPropertyNames().f;
+ var arraySlice = requireArraySlice();
+ var windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
+ var getWindowNames = function(it) {
+ try {
+ return $getOwnPropertyNames(it);
+ } catch (error) {
+ return arraySlice(windowNames);
+ }
+ };
+ objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) {
+ return windowNames && classof(it) === "Window" ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
+ };
+ return objectGetOwnPropertyNamesExternal;
+ }
+ var arrayBufferNonExtensible;
+ var hasRequiredArrayBufferNonExtensible;
+ function requireArrayBufferNonExtensible() {
+ if (hasRequiredArrayBufferNonExtensible) return arrayBufferNonExtensible;
+ hasRequiredArrayBufferNonExtensible = 1;
+ var fails = requireFails();
+ arrayBufferNonExtensible = fails(function() {
+ if (typeof ArrayBuffer == "function") {
+ var buffer = new ArrayBuffer(8);
+ if (Object.isExtensible(buffer)) Object.defineProperty(buffer, "a", {
+ value: 8
+ });
+ }
+ });
+ return arrayBufferNonExtensible;
+ }
+ var objectIsExtensible;
+ var hasRequiredObjectIsExtensible;
+ function requireObjectIsExtensible() {
+ if (hasRequiredObjectIsExtensible) return objectIsExtensible;
+ hasRequiredObjectIsExtensible = 1;
+ var fails = requireFails();
+ var isObject = requireIsObject();
+ var classof = requireClassofRaw();
+ var ARRAY_BUFFER_NON_EXTENSIBLE = requireArrayBufferNonExtensible();
+ var $isExtensible = Object.isExtensible;
+ var FAILS_ON_PRIMITIVES = fails(function() {});
+ objectIsExtensible = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
+ if (!isObject(it)) return false;
+ if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) === "ArrayBuffer") return false;
+ return $isExtensible ? $isExtensible(it) : true;
+ } : $isExtensible;
+ return objectIsExtensible;
+ }
+ var hasRequiredInternalMetadata;
+ function requireInternalMetadata() {
+ if (hasRequiredInternalMetadata) return internalMetadata.exports;
+ hasRequiredInternalMetadata = 1;
+ var $ = require_export();
+ var uncurryThis = requireFunctionUncurryThis();
+ var hiddenKeys = requireHiddenKeys();
+ var isObject = requireIsObject();
+ var hasOwn = requireHasOwnProperty();
+ var defineProperty = requireObjectDefineProperty().f;
+ var getOwnPropertyNamesModule = requireObjectGetOwnPropertyNames();
+ var getOwnPropertyNamesExternalModule = requireObjectGetOwnPropertyNamesExternal();
+ var isExtensible = requireObjectIsExtensible();
+ var uid = requireUid();
+ var FREEZING = requireFreezing();
+ var REQUIRED = false;
+ var METADATA = uid("meta");
+ var id = 0;
+ var setMetadata = function(it) {
+ defineProperty(it, METADATA, {
+ value: {
+ objectID: "O" + id++,
+ weakData: {}
+ }
+ });
+ };
+ var fastKey = function(it, create) {
+ if (!isObject(it)) return typeof it == "symbol" ? it : (typeof it == "string" ? "S" : "P") + it;
+ if (!hasOwn(it, METADATA)) {
+ if (!isExtensible(it)) return "F";
+ if (!create) return "E";
+ setMetadata(it);
+ }
+ return it[METADATA].objectID;
+ };
+ var getWeakData = function(it, create) {
+ if (!hasOwn(it, METADATA)) {
+ if (!isExtensible(it)) return true;
+ if (!create) return false;
+ setMetadata(it);
+ }
+ return it[METADATA].weakData;
+ };
+ var onFreeze = function(it) {
+ if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
+ return it;
+ };
+ var enable = function() {
+ meta.enable = function() {};
+ REQUIRED = true;
+ var getOwnPropertyNames = getOwnPropertyNamesModule.f;
+ var splice = uncurryThis([].splice);
+ var test = {};
+ test[METADATA] = 1;
+ if (getOwnPropertyNames(test).length) {
+ getOwnPropertyNamesModule.f = function(it) {
+ var result = getOwnPropertyNames(it);
+ for (var i = 0, length = result.length; i < length; i++) {
+ if (result[i] === METADATA) {
+ splice(result, i, 1);
+ break;
+ }
+ }
+ return result;
+ };
+ $({
+ target: "Object",
+ stat: true,
+ forced: true
+ }, {
+ getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
+ });
+ }
+ };
+ var meta = internalMetadata.exports = {
+ enable: enable,
+ fastKey: fastKey,
+ getWeakData: getWeakData,
+ onFreeze: onFreeze
+ };
+ hiddenKeys[METADATA] = true;
+ return internalMetadata.exports;
+ }
+ var collection;
+ var hasRequiredCollection;
+ function requireCollection() {
+ if (hasRequiredCollection) return collection;
+ hasRequiredCollection = 1;
+ var $ = require_export();
+ var globalThis = requireGlobalThis();
+ var uncurryThis = requireFunctionUncurryThis();
+ var isForced = requireIsForced();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var InternalMetadataModule = requireInternalMetadata();
+ var iterate = requireIterate();
+ var anInstance = requireAnInstance();
+ var isCallable = requireIsCallable();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var isObject = requireIsObject();
+ var fails = requireFails();
+ var checkCorrectnessOfIteration = requireCheckCorrectnessOfIteration();
+ var setToStringTag = requireSetToStringTag();
+ var inheritIfRequired = requireInheritIfRequired();
+ collection = function(CONSTRUCTOR_NAME, wrapper, common) {
+ var IS_MAP = CONSTRUCTOR_NAME.indexOf("Map") !== -1;
+ var IS_WEAK = CONSTRUCTOR_NAME.indexOf("Weak") !== -1;
+ var ADDER = IS_MAP ? "set" : "add";
+ var NativeConstructor = globalThis[CONSTRUCTOR_NAME];
+ var NativePrototype = NativeConstructor && NativeConstructor.prototype;
+ var Constructor = NativeConstructor;
+ var exported = {};
+ var fixMethod = function(KEY) {
+ var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
+ defineBuiltIn(NativePrototype, KEY, KEY === "add" ? function add(value) {
+ uncurriedNativeMethod(this, value === 0 ? 0 : value);
+ return this;
+ } : KEY === "delete" ? function(key) {
+ return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
+ } : KEY === "get" ? function get(key) {
+ return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
+ } : KEY === "has" ? function has(key) {
+ return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
+ } : function set(key, value) {
+ uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
+ return this;
+ });
+ };
+ var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function() {
+ (new NativeConstructor).entries().next();
+ })));
+ if (REPLACE) {
+ Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
+ InternalMetadataModule.enable();
+ } else if (isForced(CONSTRUCTOR_NAME, true)) {
+ var instance = new Constructor;
+ var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) !== instance;
+ var THROWS_ON_PRIMITIVES = fails(function() {
+ instance.has(1);
+ });
+ var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function(iterable) {
+ new NativeConstructor(iterable);
+ });
+ var BUGGY_ZERO = !IS_WEAK && fails(function() {
+ var $instance = new NativeConstructor;
+ var index = 5;
+ while (index--) $instance[ADDER](index, index);
+ return !$instance.has(-0);
+ });
+ if (!ACCEPT_ITERABLES) {
+ Constructor = wrapper(function(dummy, iterable) {
+ anInstance(dummy, NativePrototype);
+ var that = inheritIfRequired(new NativeConstructor, dummy, Constructor);
+ if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], {
+ that: that,
+ AS_ENTRIES: IS_MAP
+ });
+ return that;
+ });
+ Constructor.prototype = NativePrototype;
+ NativePrototype.constructor = Constructor;
+ }
+ if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
+ fixMethod("delete");
+ fixMethod("has");
+ IS_MAP && fixMethod("get");
+ }
+ if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
+ if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
+ }
+ exported[CONSTRUCTOR_NAME] = Constructor;
+ $({
+ global: true,
+ constructor: true,
+ forced: Constructor !== NativeConstructor
+ }, exported);
+ setToStringTag(Constructor, CONSTRUCTOR_NAME);
+ if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
+ return Constructor;
+ };
+ return collection;
+ }
+ var collectionWeak;
+ var hasRequiredCollectionWeak;
+ function requireCollectionWeak() {
+ if (hasRequiredCollectionWeak) return collectionWeak;
+ hasRequiredCollectionWeak = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var defineBuiltIns = requireDefineBuiltIns();
+ var getWeakData = requireInternalMetadata().getWeakData;
+ var anInstance = requireAnInstance();
+ var anObject = requireAnObject();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var isObject = requireIsObject();
+ var iterate = requireIterate();
+ var ArrayIterationModule = requireArrayIteration();
+ var hasOwn = requireHasOwnProperty();
+ var InternalStateModule = requireInternalState();
+ var setInternalState = InternalStateModule.set;
+ var internalStateGetterFor = InternalStateModule.getterFor;
+ var find = ArrayIterationModule.find;
+ var findIndex = ArrayIterationModule.findIndex;
+ var splice = uncurryThis([].splice);
+ var id = 0;
+ var uncaughtFrozenStore = function(state) {
+ return state.frozen || (state.frozen = new UncaughtFrozenStore);
+ };
+ var UncaughtFrozenStore = function() {
+ this.entries = [];
+ };
+ var findUncaughtFrozen = function(store, key) {
+ return find(store.entries, function(it) {
+ return it[0] === key;
+ });
+ };
+ UncaughtFrozenStore.prototype = {
+ get: function(key) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) return entry[1];
+ },
+ has: function(key) {
+ return !!findUncaughtFrozen(this, key);
+ },
+ set: function(key, value) {
+ var entry = findUncaughtFrozen(this, key);
+ if (entry) entry[1] = value; else this.entries.push([ key, value ]);
+ },
+ delete: function(key) {
+ var index = findIndex(this.entries, function(it) {
+ return it[0] === key;
+ });
+ if (~index) splice(this.entries, index, 1);
+ return !!~index;
+ }
+ };
+ collectionWeak = {
+ getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var Constructor = wrapper(function(that, iterable) {
+ anInstance(that, Prototype);
+ setInternalState(that, {
+ type: CONSTRUCTOR_NAME,
+ id: id++,
+ frozen: null
+ });
+ if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], {
+ that: that,
+ AS_ENTRIES: IS_MAP
+ });
+ });
+ var Prototype = Constructor.prototype;
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var define = function(that, key, value) {
+ var state = getInternalState(that);
+ var data = getWeakData(anObject(key), true);
+ if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value;
+ return that;
+ };
+ defineBuiltIns(Prototype, {
+ delete: function(key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state)["delete"](key);
+ return data && hasOwn(data, state.id) && delete data[state.id];
+ },
+ has: function has(key) {
+ var state = getInternalState(this);
+ if (!isObject(key)) return false;
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).has(key);
+ return data && hasOwn(data, state.id);
+ }
+ });
+ defineBuiltIns(Prototype, IS_MAP ? {
+ get: function get(key) {
+ var state = getInternalState(this);
+ if (isObject(key)) {
+ var data = getWeakData(key);
+ if (data === true) return uncaughtFrozenStore(state).get(key);
+ if (data) return data[state.id];
+ }
+ },
+ set: function set(key, value) {
+ return define(this, key, value);
+ }
+ } : {
+ add: function add(value) {
+ return define(this, value, true);
+ }
+ });
+ return Constructor;
+ }
+ };
+ return collectionWeak;
+ }
+ var hasRequiredEs_weakMap_constructor;
+ function requireEs_weakMap_constructor() {
+ if (hasRequiredEs_weakMap_constructor) return es_weakMap_constructor;
+ hasRequiredEs_weakMap_constructor = 1;
+ var FREEZING = requireFreezing();
+ var globalThis = requireGlobalThis();
+ var uncurryThis = requireFunctionUncurryThis();
+ var defineBuiltIns = requireDefineBuiltIns();
+ var InternalMetadataModule = requireInternalMetadata();
+ var collection = requireCollection();
+ var collectionWeak = requireCollectionWeak();
+ var isObject = requireIsObject();
+ var enforceInternalState = requireInternalState().enforce;
+ var fails = requireFails();
+ var NATIVE_WEAK_MAP = requireWeakMapBasicDetection();
+ var $Object = Object;
+ var isArray = Array.isArray;
+ var isExtensible = $Object.isExtensible;
+ var isFrozen = $Object.isFrozen;
+ var isSealed = $Object.isSealed;
+ var freeze = $Object.freeze;
+ var seal = $Object.seal;
+ var IS_IE11 = !globalThis.ActiveXObject && "ActiveXObject" in globalThis;
+ var InternalWeakMap;
+ var wrapper = function(init) {
+ return function WeakMap() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+ };
+ var $WeakMap = collection("WeakMap", wrapper, collectionWeak);
+ var WeakMapPrototype = $WeakMap.prototype;
+ var nativeSet = uncurryThis(WeakMapPrototype.set);
+ var hasMSEdgeFreezingBug = function() {
+ return FREEZING && fails(function() {
+ var frozenArray = freeze([]);
+ nativeSet(new $WeakMap, frozenArray, 1);
+ return !isFrozen(frozenArray);
+ });
+ };
+ if (NATIVE_WEAK_MAP) if (IS_IE11) {
+ InternalWeakMap = collectionWeak.getConstructor(wrapper, "WeakMap", true);
+ InternalMetadataModule.enable();
+ var nativeDelete = uncurryThis(WeakMapPrototype["delete"]);
+ var nativeHas = uncurryThis(WeakMapPrototype.has);
+ var nativeGet = uncurryThis(WeakMapPrototype.get);
+ defineBuiltIns(WeakMapPrototype, {
+ delete: function(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceInternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap;
+ return nativeDelete(this, key) || state.frozen["delete"](key);
+ }
+ return nativeDelete(this, key);
+ },
+ has: function has(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceInternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap;
+ return nativeHas(this, key) || state.frozen.has(key);
+ }
+ return nativeHas(this, key);
+ },
+ get: function get(key) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceInternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap;
+ return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
+ }
+ return nativeGet(this, key);
+ },
+ set: function set(key, value) {
+ if (isObject(key) && !isExtensible(key)) {
+ var state = enforceInternalState(this);
+ if (!state.frozen) state.frozen = new InternalWeakMap;
+ nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
+ } else nativeSet(this, key, value);
+ return this;
+ }
+ });
+ } else if (hasMSEdgeFreezingBug()) {
+ defineBuiltIns(WeakMapPrototype, {
+ set: function set(key, value) {
+ var arrayIntegrityLevel;
+ if (isArray(key)) {
+ if (isFrozen(key)) arrayIntegrityLevel = freeze; else if (isSealed(key)) arrayIntegrityLevel = seal;
+ }
+ nativeSet(this, key, value);
+ if (arrayIntegrityLevel) arrayIntegrityLevel(key);
+ return this;
+ }
+ });
+ }
+ return es_weakMap_constructor;
+ }
+ var hasRequiredEs_weakMap;
+ function requireEs_weakMap() {
+ if (hasRequiredEs_weakMap) return es_weakMap;
+ hasRequiredEs_weakMap = 1;
+ requireEs_weakMap_constructor();
+ return es_weakMap;
+ }
+ requireEs_weakMap();
+ var es_weakSet = {};
+ var es_weakSet_constructor = {};
+ var hasRequiredEs_weakSet_constructor;
+ function requireEs_weakSet_constructor() {
+ if (hasRequiredEs_weakSet_constructor) return es_weakSet_constructor;
+ hasRequiredEs_weakSet_constructor = 1;
+ var collection = requireCollection();
+ var collectionWeak = requireCollectionWeak();
+ collection("WeakSet", function(init) {
+ return function WeakSet() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+ }, collectionWeak);
+ return es_weakSet_constructor;
+ }
+ var hasRequiredEs_weakSet;
+ function requireEs_weakSet() {
+ if (hasRequiredEs_weakSet) return es_weakSet;
+ hasRequiredEs_weakSet = 1;
+ requireEs_weakSet_constructor();
+ return es_weakSet;
+ }
+ requireEs_weakSet();
+ var _maxRetries = new WeakMap;
+ var _initialDelay = new WeakMap;
+ var _maxDelay = new WeakMap;
+ var _backoffFactor = new WeakMap;
+ var _retryOn = new WeakMap;
+ var _requestLimit = new WeakMap;
+ var _requestWindow = new WeakMap;
+ var _requestTimestamps = new WeakMap;
+ var _requestCount = new WeakMap;
+ var _lastRequestTime = new WeakMap;
+ var _RateLimitedFetcher_brand = new WeakSet;
+ var RateLimitedFetcher = function() {
+ function RateLimitedFetcher() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ _classCallCheck(this, RateLimitedFetcher);
+ _classPrivateMethodInitSpec(this, _RateLimitedFetcher_brand);
+ _classPrivateFieldInitSpec(this, _maxRetries, void 0);
+ _classPrivateFieldInitSpec(this, _initialDelay, void 0);
+ _classPrivateFieldInitSpec(this, _maxDelay, void 0);
+ _classPrivateFieldInitSpec(this, _backoffFactor, void 0);
+ _classPrivateFieldInitSpec(this, _retryOn, void 0);
+ _classPrivateFieldInitSpec(this, _requestLimit, void 0);
+ _classPrivateFieldInitSpec(this, _requestWindow, void 0);
+ _classPrivateFieldInitSpec(this, _requestTimestamps, void 0);
+ _classPrivateFieldInitSpec(this, _requestCount, void 0);
+ _classPrivateFieldInitSpec(this, _lastRequestTime, void 0);
+ _classPrivateFieldSet2(_maxRetries, this, options.maxRetries || 5);
+ _classPrivateFieldSet2(_initialDelay, this, options.initialDelay || 1e3);
+ _classPrivateFieldSet2(_maxDelay, this, options.maxDelay || 5e3);
+ _classPrivateFieldSet2(_backoffFactor, this, options.backoffFactor || 2);
+ _classPrivateFieldSet2(_retryOn, this, options.retryOn || [ 429, 502, 503, 504 ]);
+ _classPrivateFieldSet2(_requestLimit, this, 10);
+ _classPrivateFieldSet2(_requestWindow, this, 5e3);
+ _classPrivateFieldSet2(_requestTimestamps, this, []);
+ _classPrivateFieldSet2(_requestCount, this, 0);
+ _classPrivateFieldSet2(_lastRequestTime, this, 0);
+ }
+ return _createClass(RateLimitedFetcher, [ {
+ key: "fetchWithRetry",
+ value: function() {
+ var _fetchWithRetry = _asyncToGenerator(_regenerator().m(function _callee(url, headers, attempt) {
+ var response, delay, message, _delay2, _t;
+ return _regenerator().w(function(_context) {
+ while (1) switch (_context.p = _context.n) {
+ case 0:
+ _context.p = 0;
+ _context.n = 1;
+ return _assertClassBrand(_RateLimitedFetcher_brand, this, _checkAndApplyRateLimit).call(this);
+
+ case 1:
+ _context.n = 2;
+ return fetch(url, {
+ headers: headers
+ });
+
+ case 2:
+ response = _context.v;
+ if (!response.ok) {
+ _context.n = 3;
+ break;
+ }
+ return _context.a(2, response);
+
+ case 3:
+ if (!(_classPrivateFieldGet2(_retryOn, this).includes(response.status) && attempt < _classPrivateFieldGet2(_maxRetries, this))) {
+ _context.n = 5;
+ break;
+ }
+ delay = _assertClassBrand(_RateLimitedFetcher_brand, this, _calculateDelay).call(this, attempt, response);
+ console.log("Attempt ".concat(attempt + 1, "/").concat(_classPrivateFieldGet2(_maxRetries, this), " failed with ").concat(response.status, ". Retrying in ").concat(delay, "ms"));
+ _context.n = 4;
+ return _assertClassBrand(_RateLimitedFetcher_brand, this, _delay).call(this, delay);
+
+ case 4:
+ return _context.a(2, this.fetchWithRetry(url, headers, attempt + 1));
+
+ case 5:
+ throw new Error("".concat(response.status, " ").concat(response.statusText));
+
+ case 6:
+ _context.p = 6;
+ _t = _context.v;
+ if (!(attempt >= _classPrivateFieldGet2(_maxRetries, this))) {
+ _context.n = 7;
+ break;
+ }
+ message = "";
+ if (_t instanceof Error) {
+ message = _t.message;
+ }
+ throw new Error("Request failed after ".concat(_classPrivateFieldGet2(_maxRetries, this), " attempts: ").concat(message));
+
+ case 7:
+ if (!(attempt < _classPrivateFieldGet2(_maxRetries, this))) {
+ _context.n = 9;
+ break;
+ }
+ _delay2 = _assertClassBrand(_RateLimitedFetcher_brand, this, _calculateDelay).call(this, attempt);
+ console.log("Network error on attempt ".concat(attempt + 1, ". Retrying in ").concat(_delay2, "ms"));
+ _context.n = 8;
+ return _assertClassBrand(_RateLimitedFetcher_brand, this, _delay).call(this, _delay2);
+
+ case 8:
+ return _context.a(2, this.fetchWithRetry(url, headers, attempt + 1));
+
+ case 9:
+ throw _t;
+
+ case 10:
+ return _context.a(2);
+ }
+ }, _callee, this, [ [ 0, 6 ] ]);
+ }));
+ function fetchWithRetry(_x, _x2, _x3) {
+ return _fetchWithRetry.apply(this, arguments);
+ }
+ return fetchWithRetry;
+ }()
+ }, {
+ key: "resetCounter",
+ value: function resetCounter() {
+ _classPrivateFieldSet2(_requestTimestamps, this, []);
+ _classPrivateFieldSet2(_requestCount, this, 0);
+ _classPrivateFieldSet2(_lastRequestTime, this, 0);
+ }
+ } ]);
+ }();
+ function _cleanupOldRequests() {
+ var _this = this;
+ var now = Date.now();
+ _classPrivateFieldSet2(_requestTimestamps, this, _classPrivateFieldGet2(_requestTimestamps, this).filter(function(timestamp) {
+ return now - timestamp < _classPrivateFieldGet2(_requestWindow, _this);
+ }));
+ }
+ function _checkAndApplyRateLimit() {
+ return _checkAndApplyRateLimit2.apply(this, arguments);
+ }
+ function _checkAndApplyRateLimit2() {
+ _checkAndApplyRateLimit2 = _asyncToGenerator(_regenerator().m(function _callee2() {
+ var _this$requestCount;
+ var oldestRequest, timeSinceOldest, waitTime, now, timeSinceLastRequest, minDelay;
+ return _regenerator().w(function(_context2) {
+ while (1) switch (_context2.n) {
+ case 0:
+ _assertClassBrand(_RateLimitedFetcher_brand, this, _cleanupOldRequests).call(this);
+ if (!(_classPrivateFieldGet2(_requestTimestamps, this).length >= _classPrivateFieldGet2(_requestLimit, this))) {
+ _context2.n = 2;
+ break;
+ }
+ oldestRequest = _classPrivateFieldGet2(_requestTimestamps, this)[0];
+ timeSinceOldest = Date.now() - oldestRequest;
+ if (!(timeSinceOldest < _classPrivateFieldGet2(_requestWindow, this))) {
+ _context2.n = 2;
+ break;
+ }
+ waitTime = 500 * _classPrivateFieldGet2(_requestTimestamps, this).length - _classPrivateFieldGet2(_requestLimit, this);
+ if (waitTime < 0) {
+ waitTime = 0;
+ console.warn("Wait time is less than 0");
+ }
+ console.log("Rate limit prevention: ".concat(_classPrivateFieldGet2(_requestTimestamps, this).length, " requests in last ").concat(_classPrivateFieldGet2(_requestWindow, this), "ms. Waiting ").concat(waitTime, "ms..."));
+ _context2.n = 1;
+ return _assertClassBrand(_RateLimitedFetcher_brand, this, _delay).call(this, waitTime);
+
+ case 1:
+ _assertClassBrand(_RateLimitedFetcher_brand, this, _cleanupOldRequests).call(this);
+
+ case 2:
+ _classPrivateFieldGet2(_requestTimestamps, this).push(Date.now());
+ _classPrivateFieldSet2(_requestCount, this, (_this$requestCount = _classPrivateFieldGet2(_requestCount, this),
+ _this$requestCount++, _this$requestCount));
+ now = Date.now();
+ timeSinceLastRequest = now - _classPrivateFieldGet2(_lastRequestTime, this);
+ minDelay = 100;
+ if (!(timeSinceLastRequest < minDelay && _classPrivateFieldGet2(_lastRequestTime, this) > 0)) {
+ _context2.n = 3;
+ break;
+ }
+ _context2.n = 3;
+ return _assertClassBrand(_RateLimitedFetcher_brand, this, _delay).call(this, minDelay - timeSinceLastRequest);
+
+ case 3:
+ _classPrivateFieldSet2(_lastRequestTime, this, Date.now());
+
+ case 4:
+ return _context2.a(2);
+ }
+ }, _callee2, this);
+ }));
+ return _checkAndApplyRateLimit2.apply(this, arguments);
+ }
+ function _calculateDelay(attempt) {
+ var response = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
+ var retryAfterHeader = response === null || response === void 0 ? void 0 : response.headers.get("Retry-After");
+ if (retryAfterHeader) {
+ var seconds = parseInt(retryAfterHeader);
+ if (seconds > 86400) {
+ var timestamp = parseInt(retryAfterHeader) * 1e3;
+ return Math.max(0, timestamp - Date.now());
+ }
+ return seconds * 1e3;
+ }
+ var exponentialDelay = _classPrivateFieldGet2(_initialDelay, this) * Math.pow(_classPrivateFieldGet2(_backoffFactor, this), attempt);
+ var jitter = Math.random() * 1e3;
+ return Math.min(exponentialDelay + jitter, _classPrivateFieldGet2(_maxDelay, this));
+ }
+ function _delay(ms) {
+ return new Promise(function(resolve) {
+ return setTimeout(resolve, ms);
+ });
+ }
+ var ZoteroSdk = function ZoteroSdk() {
+ this._apiKey = null;
+ this._userId = 0;
+ this._userGroups = [];
+ this._isOnlineAvailable = true;
+ this._fetcher = new RateLimitedFetcher({
+ maxRetries: 5,
+ initialDelay: 5e3
+ });
+ };
+ ZoteroSdk.prototype.ZOTERO_API_VERSION = "3";
+ ZoteroSdk.prototype.USER_AGENT = "AscDesktopEditor";
+ ZoteroSdk.prototype.DEFAULT_FORMAT = "csljson";
+ ZoteroSdk.prototype.STORAGE_KEYS = {
+ USER_ID: "zoteroUserId",
+ API_KEY: "zoteroApiKey"
+ };
+ ZoteroSdk.prototype.API_PATHS = {
+ USERS: "users",
+ GROUPS: "groups",
+ ITEMS: "items",
+ KEYS: "keys"
+ };
+ ZoteroSdk.prototype._getBaseUrl = function() {
+ return this._isOnlineAvailable ? zoteroEnvironment.restApiUrl : zoteroEnvironment.desktopApiUrl;
+ };
+ ZoteroSdk.prototype._getDesktopRequest = function(url) {
+ var self = this;
+ return new Promise(function(resolve, reject) {
+ window.AscSimpleRequest.createRequest({
+ url: url,
+ method: "GET",
+ headers: {
+ "Zotero-API-Version": self.ZOTERO_API_VERSION,
+ "User-Agent": self.USER_AGENT
+ },
+ complete: resolve,
+ error: function error(_error) {
+ if (_error.statusCode === -102) {
+ _error.statusCode = 404;
+ _error.message = "Connection to Zotero failed. Make sure Zotero is running";
+ }
+ reject(_error);
+ }
+ });
+ });
+ };
+ ZoteroSdk.prototype._getOnlineRequest = function(url) {
+ var headers = {
+ "Zotero-API-Version": this.ZOTERO_API_VERSION,
+ "Zotero-API-Key": this._apiKey || ""
+ };
+ return fetch(url, {
+ headers: headers
+ }).then(function(response) {
+ if (!response.ok) {
+ var message = response.status + " " + response.statusText;
+ console.error(message);
+ throw new Error(message);
+ }
+ return response;
+ }).catch(function(error) {
+ if (_typeof(error) === "object") {
+ error.message = "Connection to Zotero failed";
+ }
+ throw error;
+ });
+ };
+ ZoteroSdk.prototype._getRequestWithOfflineSupport = function(url) {
+ return this._isOnlineAvailable ? this._getOnlineRequest(url) : this._getDesktopRequest(url.href);
+ };
+ ZoteroSdk.prototype._buildGetRequest = function(path, queryParams) {
+ queryParams = queryParams || {};
+ var url = new URL(path, this._getBaseUrl());
+ Object.keys(queryParams).forEach(function(key) {
+ if (queryParams[key] !== undefined && queryParams[key] !== null) {
+ url.searchParams.append(key, queryParams[key]);
+ }
+ });
+ return this._getRequestWithOfflineSupport(url);
+ };
+ ZoteroSdk.prototype._parseLinkHeader = function(headerValue) {
+ var links = {};
+ var linkHeaderRegex = /<(.*?)>; rel="(.*?)"/g;
+ if (!headerValue) return links;
+ var match;
+ while ((match = linkHeaderRegex.exec(headerValue.trim())) !== null) {
+ links[match[2]] = match[1];
+ }
+ return links;
+ };
+ ZoteroSdk.prototype._parseDesktopItemsResponse = function(promise, resolve, reject, id) {
+ return promise.then(function(response) {
+ return {
+ items: JSON.parse(response.responseText),
+ id: id
+ };
+ }).then(resolve).catch(reject);
+ };
+ ZoteroSdk.prototype._parseItemsResponse = function(promise, resolve, reject, id) {
+ var self = this;
+ return promise.then(function(response) {
+ return Promise.all([ response.json(), response ]);
+ }).then(function(results) {
+ var json = results[0];
+ var response = results[1];
+ var links = self._parseLinkHeader(response.headers.get("Link") || "");
+ var result = {
+ items: json,
+ id: id
+ };
+ if (_typeof(json) === "object" && json.items) {
+ result.items = json.items;
+ }
+ if (links.next) {
+ result.next = function() {
+ return new Promise(function(rs, rj) {
+ self._parseItemsResponse(self._getOnlineRequest(new URL(links.next)), rs, rj, id);
+ });
+ };
+ }
+ resolve(result);
+ }).catch(reject);
+ };
+ ZoteroSdk.prototype._parseResponse = function(promise, resolve, reject, id) {
+ if (this._isOnlineAvailable) {
+ var fetchPromise = promise;
+ this._parseItemsResponse(fetchPromise, resolve, reject, id);
+ } else {
+ var ascSimplePromise = promise;
+ this._parseDesktopItemsResponse(ascSimplePromise, resolve, reject, id);
+ }
+ };
+ ZoteroSdk.prototype.getItems = function(search, itemsID, format) {
+ var self = this;
+ format = format || self.DEFAULT_FORMAT;
+ return new Promise(function(resolve, reject) {
+ var queryParams = {
+ format: format
+ };
+ if (search) {
+ queryParams.q = search;
+ } else if (itemsID) {
+ queryParams.itemKey = itemsID.join(",");
+ }
+ var path = self.API_PATHS.USERS + "/" + self._userId + "/" + self.API_PATHS.ITEMS;
+ var request = self._buildGetRequest(path, queryParams);
+ return self._parseResponse(request, resolve, reject, self._userId);
+ });
+ };
+ ZoteroSdk.prototype.getGroupItems = function(search, groupId, itemsID, format) {
+ var self = this;
+ format = format || self.DEFAULT_FORMAT;
+ return new Promise(function(resolve, reject) {
+ var queryParams = {
+ format: format
+ };
+ if (search) {
+ queryParams.q = search;
+ } else if (itemsID) {
+ queryParams.itemKey = itemsID.join(",");
+ }
+ var path = self.API_PATHS.GROUPS + "/" + groupId + "/" + self.API_PATHS.ITEMS;
+ var request = self._buildGetRequest(path, queryParams);
+ return self._parseResponse(request, resolve, reject, groupId);
+ });
+ };
+ ZoteroSdk.prototype.getUserGroups = function() {
+ var self = this;
+ return new Promise(function(resolve, reject) {
+ if (self._userGroups.length > 0) {
+ resolve(self._userGroups);
+ return;
+ }
+ var path = self.API_PATHS.USERS + "/" + self._userId + "/groups";
+ self._buildGetRequest(path).then(function(response) {
+ if (self._isOnlineAvailable) {
+ var fetchResponse = response;
+ if (!fetchResponse.ok) {
+ throw new Error(fetchResponse.status + " " + fetchResponse.statusText);
+ }
+ return fetchResponse.json();
+ }
+ var ascSimpleResponse = response;
+ return JSON.parse(ascSimpleResponse.responseText);
+ }).then(function(groups) {
+ self._userGroups = groups.map(function(group) {
+ return {
+ id: group.id,
+ name: group.data.name
+ };
+ });
+ resolve(self._userGroups);
+ }).catch(reject);
+ });
+ };
+ ZoteroSdk.prototype.setApiKey = function(key) {
+ var self = this;
+ var path = this.API_PATHS.KEYS + "/" + key;
+ return this._buildGetRequest(path).then(function(response) {
+ var fetchResponse = response;
+ if (!fetchResponse.ok) {
+ throw new Error(fetchResponse.status + " " + fetchResponse.statusText);
+ }
+ return fetchResponse.json();
+ }).then(function(keyData) {
+ self._saveSettings(keyData.userID, key);
+ return true;
+ });
+ };
+ ZoteroSdk.prototype._applySettings = function(userId, apiKey) {
+ this._userId = userId;
+ this._apiKey = apiKey;
+ };
+ ZoteroSdk.prototype._saveSettings = function(userId, apiKey) {
+ this._applySettings(userId, apiKey);
+ localStorage.setItem(this.STORAGE_KEYS.USER_ID, String(userId));
+ localStorage.setItem(this.STORAGE_KEYS.API_KEY, apiKey);
+ };
+ ZoteroSdk.prototype.hasSettings = function() {
+ var userId = localStorage.getItem(this.STORAGE_KEYS.USER_ID);
+ var apiKey = localStorage.getItem(this.STORAGE_KEYS.API_KEY);
+ if (userId && apiKey) {
+ this._applySettings(Number(userId), apiKey);
+ return true;
+ }
+ return false;
+ };
+ ZoteroSdk.prototype.clearSettings = function() {
+ localStorage.removeItem(this.STORAGE_KEYS.USER_ID);
+ localStorage.removeItem(this.STORAGE_KEYS.API_KEY);
+ this._userGroups = [];
+ this._userId = 0;
+ this._apiKey = null;
+ };
+ ZoteroSdk.prototype.getUserId = function() {
+ return this._userId;
+ };
+ ZoteroSdk.prototype.setIsOnlineAvailable = function(isOnline) {
+ this._isOnlineAvailable = isOnline;
+ };
+ var es_regexp_toString = {};
+ var regexpFlagsDetection;
+ var hasRequiredRegexpFlagsDetection;
+ function requireRegexpFlagsDetection() {
+ if (hasRequiredRegexpFlagsDetection) return regexpFlagsDetection;
+ hasRequiredRegexpFlagsDetection = 1;
+ var globalThis = requireGlobalThis();
+ var fails = requireFails();
+ var RegExp = globalThis.RegExp;
+ var FLAGS_GETTER_IS_CORRECT = !fails(function() {
+ var INDICES_SUPPORT = true;
+ try {
+ RegExp(".", "d");
+ } catch (error) {
+ INDICES_SUPPORT = false;
+ }
+ var O = {};
+ var calls = "";
+ var expected = INDICES_SUPPORT ? "dgimsy" : "gimsy";
+ var addGetter = function(key, chr) {
+ Object.defineProperty(O, key, {
+ get: function() {
+ calls += chr;
+ return true;
+ }
+ });
+ };
+ var pairs = {
+ dotAll: "s",
+ global: "g",
+ ignoreCase: "i",
+ multiline: "m",
+ sticky: "y"
+ };
+ if (INDICES_SUPPORT) pairs.hasIndices = "d";
+ for (var key in pairs) addGetter(key, pairs[key]);
+ var result = Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get.call(O);
+ return result !== expected || calls !== expected;
+ });
+ regexpFlagsDetection = {
+ correct: FLAGS_GETTER_IS_CORRECT
+ };
+ return regexpFlagsDetection;
+ }
+ var regexpGetFlags;
+ var hasRequiredRegexpGetFlags;
+ function requireRegexpGetFlags() {
+ if (hasRequiredRegexpGetFlags) return regexpGetFlags;
+ hasRequiredRegexpGetFlags = 1;
+ var call = requireFunctionCall();
+ var hasOwn = requireHasOwnProperty();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var regExpFlagsDetection = requireRegexpFlagsDetection();
+ var regExpFlagsGetterImplementation = requireRegexpFlags();
+ var RegExpPrototype = RegExp.prototype;
+ regexpGetFlags = regExpFlagsDetection.correct ? function(it) {
+ return it.flags;
+ } : function(it) {
+ return !regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype, it) && !hasOwn(it, "flags") ? call(regExpFlagsGetterImplementation, it) : it.flags;
+ };
+ return regexpGetFlags;
+ }
+ var hasRequiredEs_regexp_toString;
+ function requireEs_regexp_toString() {
+ if (hasRequiredEs_regexp_toString) return es_regexp_toString;
+ hasRequiredEs_regexp_toString = 1;
+ var PROPER_FUNCTION_NAME = requireFunctionName().PROPER;
+ var defineBuiltIn = requireDefineBuiltIn();
+ var anObject = requireAnObject();
+ var $toString = requireToString();
+ var fails = requireFails();
+ var getRegExpFlags = requireRegexpGetFlags();
+ var TO_STRING = "toString";
+ var RegExpPrototype = RegExp.prototype;
+ var nativeToString = RegExpPrototype[TO_STRING];
+ var NOT_GENERIC = fails(function() {
+ return nativeToString.call({
+ source: "a",
+ flags: "b"
+ }) !== "/a/b";
+ });
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
+ if (NOT_GENERIC || INCORRECT_NAME) {
+ defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
+ var R = anObject(this);
+ var pattern = $toString(R.source);
+ var flags = $toString(getRegExpFlags(R));
+ return "/" + pattern + "/" + flags;
+ }, {
+ unsafe: true
+ });
+ }
+ return es_regexp_toString;
+ }
+ requireEs_regexp_toString();
+ var es_array_slice = {};
+ var hasRequiredEs_array_slice;
+ function requireEs_array_slice() {
+ if (hasRequiredEs_array_slice) return es_array_slice;
+ hasRequiredEs_array_slice = 1;
+ var $ = require_export();
+ var isArray = requireIsArray();
+ var isConstructor = requireIsConstructor();
+ var isObject = requireIsObject();
+ var toAbsoluteIndex = requireToAbsoluteIndex();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var toIndexedObject = requireToIndexedObject();
+ var createProperty = requireCreateProperty();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var arrayMethodHasSpeciesSupport = requireArrayMethodHasSpeciesSupport();
+ var nativeSlice = requireArraySlice();
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("slice");
+ var SPECIES = wellKnownSymbol("species");
+ var $Array = Array;
+ var max = Math.max;
+ $({
+ target: "Array",
+ proto: true,
+ forced: !HAS_SPECIES_SUPPORT
+ }, {
+ slice: function slice(start, end) {
+ var O = toIndexedObject(this);
+ var length = lengthOfArrayLike(O);
+ var k = toAbsoluteIndex(start, length);
+ var fin = toAbsoluteIndex(end === undefined ? length : end, length);
+ var Constructor, result, n;
+ if (isArray(O)) {
+ Constructor = O.constructor;
+ if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
+ Constructor = undefined;
+ } else if (isObject(Constructor)) {
+ Constructor = Constructor[SPECIES];
+ if (Constructor === null) Constructor = undefined;
+ }
+ if (Constructor === $Array || Constructor === undefined) {
+ return nativeSlice(O, k, fin);
+ }
+ }
+ result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
+ for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
+ result.length = n;
+ return result;
+ }
+ });
+ return es_array_slice;
+ }
+ requireEs_array_slice();
+ var es_regexp_constructor = {};
+ var proxyAccessor;
+ var hasRequiredProxyAccessor;
+ function requireProxyAccessor() {
+ if (hasRequiredProxyAccessor) return proxyAccessor;
+ hasRequiredProxyAccessor = 1;
+ var defineProperty = requireObjectDefineProperty().f;
+ proxyAccessor = function(Target, Source, key) {
+ key in Target || defineProperty(Target, key, {
+ configurable: true,
+ get: function() {
+ return Source[key];
+ },
+ set: function(it) {
+ Source[key] = it;
+ }
+ });
+ };
+ return proxyAccessor;
+ }
+ var hasRequiredEs_regexp_constructor;
+ function requireEs_regexp_constructor() {
+ if (hasRequiredEs_regexp_constructor) return es_regexp_constructor;
+ hasRequiredEs_regexp_constructor = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var globalThis = requireGlobalThis();
+ var uncurryThis = requireFunctionUncurryThis();
+ var isForced = requireIsForced();
+ var inheritIfRequired = requireInheritIfRequired();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var create = requireObjectCreate();
+ var getOwnPropertyNames = requireObjectGetOwnPropertyNames().f;
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var isRegExp = requireIsRegexp();
+ var toString = requireToString();
+ var getRegExpFlags = requireRegexpGetFlags();
+ var stickyHelpers = requireRegexpStickyHelpers();
+ var proxyAccessor = requireProxyAccessor();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var fails = requireFails();
+ var hasOwn = requireHasOwnProperty();
+ var enforceInternalState = requireInternalState().enforce;
+ var setSpecies = requireSetSpecies();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var UNSUPPORTED_DOT_ALL = requireRegexpUnsupportedDotAll();
+ var UNSUPPORTED_NCG = requireRegexpUnsupportedNcg();
+ var MATCH = wellKnownSymbol("match");
+ var NativeRegExp = globalThis.RegExp;
+ var RegExpPrototype = NativeRegExp.prototype;
+ var SyntaxError = globalThis.SyntaxError;
+ var exec = uncurryThis(RegExpPrototype.exec);
+ var charAt = uncurryThis("".charAt);
+ var replace = uncurryThis("".replace);
+ var stringIndexOf = uncurryThis("".indexOf);
+ var stringSlice = uncurryThis("".slice);
+ var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
+ var re1 = /a/g;
+ var re2 = /a/g;
+ var CORRECT_NEW = new NativeRegExp(re1) !== re1;
+ var MISSED_STICKY = stickyHelpers.MISSED_STICKY;
+ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
+ var BASE_FORCED = DESCRIPTORS && (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function() {
+ re2[MATCH] = false;
+ return NativeRegExp(re1) !== re1 || NativeRegExp(re2) === re2 || String(NativeRegExp(re1, "i")) !== "/a/i";
+ }));
+ var handleDotAll = function(string) {
+ var length = string.length;
+ var index = 0;
+ var result = "";
+ var brackets = false;
+ var chr;
+ for (;index <= length; index++) {
+ chr = charAt(string, index);
+ if (chr === "\\") {
+ result += chr + charAt(string, ++index);
+ continue;
+ }
+ if (!brackets && chr === ".") {
+ result += "[\\s\\S]";
+ } else {
+ if (chr === "[") {
+ brackets = true;
+ } else if (chr === "]") {
+ brackets = false;
+ }
+ result += chr;
+ }
+ }
+ return result;
+ };
+ var handleNCG = function(string) {
+ var length = string.length;
+ var index = 0;
+ var result = "";
+ var named = [];
+ var names = create(null);
+ var brackets = false;
+ var ncg = false;
+ var groupid = 0;
+ var groupname = "";
+ var chr;
+ for (;index <= length; index++) {
+ chr = charAt(string, index);
+ if (chr === "\\") {
+ chr += charAt(string, ++index);
+ } else if (chr === "]") {
+ brackets = false;
+ } else if (!brackets) switch (true) {
+ case chr === "[":
+ brackets = true;
+ break;
+
+ case chr === "(":
+ result += chr;
+ if (stringSlice(string, index + 1, index + 3) === "?:") {
+ continue;
+ }
+ if (exec(IS_NCG, stringSlice(string, index + 1))) {
+ index += 2;
+ ncg = true;
+ }
+ groupid++;
+ continue;
+
+ case chr === ">" && ncg:
+ if (groupname === "" || hasOwn(names, groupname)) {
+ throw new SyntaxError("Invalid capture group name");
+ }
+ names[groupname] = true;
+ named[named.length] = [ groupname, groupid ];
+ ncg = false;
+ groupname = "";
+ continue;
+ }
+ if (ncg) groupname += chr; else result += chr;
+ }
+ return [ result, named ];
+ };
+ if (isForced("RegExp", BASE_FORCED)) {
+ var RegExpWrapper = function RegExp(pattern, flags) {
+ var thisIsRegExp = isPrototypeOf(RegExpPrototype, this);
+ var patternIsRegExp = isRegExp(pattern);
+ var flagsAreUndefined = flags === undefined;
+ var groups = [];
+ var rawPattern = pattern;
+ var rawFlags, dotAll, sticky, handled, result, state;
+ if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
+ return pattern;
+ }
+ if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) {
+ pattern = pattern.source;
+ if (flagsAreUndefined) flags = getRegExpFlags(rawPattern);
+ }
+ pattern = pattern === undefined ? "" : toString(pattern);
+ flags = flags === undefined ? "" : toString(flags);
+ rawPattern = pattern;
+ if (UNSUPPORTED_DOT_ALL && "dotAll" in re1) {
+ dotAll = !!flags && stringIndexOf(flags, "s") > -1;
+ if (dotAll) flags = replace(flags, /s/g, "");
+ }
+ rawFlags = flags;
+ if (MISSED_STICKY && "sticky" in re1) {
+ sticky = !!flags && stringIndexOf(flags, "y") > -1;
+ if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, "");
+ }
+ if (UNSUPPORTED_NCG) {
+ handled = handleNCG(pattern);
+ pattern = handled[0];
+ groups = handled[1];
+ }
+ result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
+ if (dotAll || sticky || groups.length) {
+ state = enforceInternalState(result);
+ if (dotAll) {
+ state.dotAll = true;
+ state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
+ }
+ if (sticky) state.sticky = true;
+ if (groups.length) state.groups = groups;
+ }
+ if (pattern !== rawPattern) try {
+ createNonEnumerableProperty(result, "source", rawPattern === "" ? "(?:)" : rawPattern);
+ } catch (error) {}
+ return result;
+ };
+ for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index; ) {
+ proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);
+ }
+ RegExpPrototype.constructor = RegExpWrapper;
+ RegExpWrapper.prototype = RegExpPrototype;
+ defineBuiltIn(globalThis, "RegExp", RegExpWrapper, {
+ constructor: true
+ });
+ }
+ setSpecies("RegExp");
+ return es_regexp_constructor;
+ }
+ requireEs_regexp_constructor();
+ var es_string_search = {};
+ var fixRegexpWellKnownSymbolLogic;
+ var hasRequiredFixRegexpWellKnownSymbolLogic;
+ function requireFixRegexpWellKnownSymbolLogic() {
+ if (hasRequiredFixRegexpWellKnownSymbolLogic) return fixRegexpWellKnownSymbolLogic;
+ hasRequiredFixRegexpWellKnownSymbolLogic = 1;
+ requireEs_regexp_exec();
+ var call = requireFunctionCall();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var regexpExec = requireRegexpExec();
+ var fails = requireFails();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var createNonEnumerableProperty = requireCreateNonEnumerableProperty();
+ var SPECIES = wellKnownSymbol("species");
+ var RegExpPrototype = RegExp.prototype;
+ fixRegexpWellKnownSymbolLogic = function(KEY, exec, FORCED, SHAM) {
+ var SYMBOL = wellKnownSymbol(KEY);
+ var DELEGATES_TO_SYMBOL = !fails(function() {
+ var O = {};
+ O[SYMBOL] = function() {
+ return 7;
+ };
+ return ""[KEY](O) !== 7;
+ });
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function() {
+ var execCalled = false;
+ var re = /a/;
+ if (KEY === "split") {
+ var constructor = {};
+ constructor[SPECIES] = function() {
+ return re;
+ };
+ re = {
+ constructor: constructor,
+ flags: ""
+ };
+ re[SYMBOL] = /./[SYMBOL];
+ }
+ re.exec = function() {
+ execCalled = true;
+ return null;
+ };
+ re[SYMBOL]("");
+ return !execCalled;
+ });
+ if (!DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || FORCED) {
+ var nativeRegExpMethod = /./[SYMBOL];
+ var methods = exec(SYMBOL, ""[KEY], function(nativeMethod, regexp, str, arg2, forceStringMethod) {
+ var $exec = regexp.exec;
+ if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
+ return {
+ done: true,
+ value: call(nativeRegExpMethod, regexp, str, arg2)
+ };
+ }
+ return {
+ done: true,
+ value: call(nativeMethod, str, regexp, arg2)
+ };
+ }
+ return {
+ done: false
+ };
+ });
+ defineBuiltIn(String.prototype, KEY, methods[0]);
+ defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
+ }
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], "sham", true);
+ };
+ return fixRegexpWellKnownSymbolLogic;
+ }
+ var sameValue;
+ var hasRequiredSameValue;
+ function requireSameValue() {
+ if (hasRequiredSameValue) return sameValue;
+ hasRequiredSameValue = 1;
+ sameValue = Object.is || function is(x, y) {
+ return x === y ? x !== 0 || 1 / x === 1 / y : x !== x && y !== y;
+ };
+ return sameValue;
+ }
+ var regexpExecAbstract;
+ var hasRequiredRegexpExecAbstract;
+ function requireRegexpExecAbstract() {
+ if (hasRequiredRegexpExecAbstract) return regexpExecAbstract;
+ hasRequiredRegexpExecAbstract = 1;
+ var call = requireFunctionCall();
+ var anObject = requireAnObject();
+ var isCallable = requireIsCallable();
+ var classof = requireClassofRaw();
+ var regexpExec = requireRegexpExec();
+ var $TypeError = TypeError;
+ regexpExecAbstract = function(R, S) {
+ var exec = R.exec;
+ if (isCallable(exec)) {
+ var result = call(exec, R, S);
+ if (result !== null) anObject(result);
+ return result;
+ }
+ if (classof(R) === "RegExp") return call(regexpExec, R, S);
+ throw new $TypeError("RegExp#exec called on incompatible receiver");
+ };
+ return regexpExecAbstract;
+ }
+ var hasRequiredEs_string_search;
+ function requireEs_string_search() {
+ if (hasRequiredEs_string_search) return es_string_search;
+ hasRequiredEs_string_search = 1;
+ var call = requireFunctionCall();
+ var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic();
+ var anObject = requireAnObject();
+ var isObject = requireIsObject();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var sameValue = requireSameValue();
+ var toString = requireToString();
+ var getMethod = requireGetMethod();
+ var regExpExec = requireRegexpExecAbstract();
+ fixRegExpWellKnownSymbolLogic("search", function(SEARCH, nativeSearch, maybeCallNative) {
+ return [ function search(regexp) {
+ var O = requireObjectCoercible(this);
+ var searcher = isObject(regexp) ? getMethod(regexp, SEARCH) : undefined;
+ return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
+ }, function(string) {
+ var rx = anObject(this);
+ var S = toString(string);
+ var res = maybeCallNative(nativeSearch, rx, S);
+ if (res.done) return res.value;
+ var previousLastIndex = rx.lastIndex;
+ if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
+ var result = regExpExec(rx, S);
+ if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
+ return result === null ? -1 : result.index;
+ } ];
+ });
+ return es_string_search;
+ }
+ requireEs_string_search();
+ function InputField(input, options) {
+ var self = this;
+ options = options || {};
+ if (typeof input === "string") {
+ var temp = document.getElementById(input);
+ if (temp instanceof HTMLInputElement) {
+ input = temp;
+ }
+ }
+ if (input instanceof HTMLInputElement) {
+ this.input = input;
+ } else {
+ throw new Error("Invalid input element");
+ }
+ this._container = document.createElement("div");
+ this._options = {
+ type: options.type || input.type || "text",
+ placeholder: options.placeholder || input.placeholder || "",
+ value: options.value || input.value || "",
+ autofocus: options.autofocus || false,
+ disabled: options.disabled || false,
+ readonly: options.readonly || false,
+ required: options.required || false,
+ showCounter: options.showCounter || false,
+ showClear: options.showClear !== undefined ? options.showClear : true,
+ autocomplete: options.autocomplete || "off"
+ };
+ for (var key in options) {
+ if (!this._options.hasOwnProperty(key)) {
+ this._options[key] = options[key];
+ }
+ }
+ this._id = input.id || "input_" + Math.random().toString(36).slice(2, 9);
+ this.isFocused = false;
+ this.isValid = true;
+ this._validationMessage = "";
+ this._subscribers = [];
+ this._boundHandles = {
+ focus: function focus(e) {
+ self._handleFocus(e);
+ },
+ blur: function blur(e) {
+ self._handleBlur(e);
+ },
+ input: function input(e) {
+ self._handleInput(e);
+ },
+ keydown: function keydown(e) {
+ self._handleKeydown(e);
+ },
+ clear: function clear() {
+ self.clear();
+ },
+ validate: function validate() {
+ self.validate();
+ }
+ };
+ this._clearButton = null;
+ this._counter = null;
+ this._counterCurrent = null;
+ this._counterMax = null;
+ this._validationElement = document.createElement("div");
+ if (this._options.type === "search") {
+ this._searchIcon = document.createElement("span");
+ this._boundHandles.search = this._triggerSubmit.bind(this);
+ this._container.classList.add("input-field-search");
+ }
+ this._createDOM();
+ this._bindEvents();
+ this._updateState();
+ if (this._options.autofocus) {
+ setTimeout(function(self) {
+ return function() {
+ self.focus();
+ };
+ }(this), 100);
+ }
+ }
+ InputField.prototype = {
+ constructor: InputField,
+ input: null,
+ _container: null,
+ _options: {},
+ _id: "",
+ isFocused: false,
+ isValid: true,
+ _validationMessage: "",
+ _subscribers: [],
+ _boundHandles: null,
+ _clearButton: null,
+ _counter: null,
+ _counterCurrent: null,
+ _counterMax: null,
+ _validationElement: null,
+ _createDOM: function _createDOM() {
+ var parent = this.input.parentNode;
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild(this._container);
+ this._container.className += " input-field-container input-field-container-" + this._id;
+ var inputField = document.createElement("div");
+ this._container.appendChild(inputField);
+ inputField.className += " input-field";
+ if (this._options.disabled) {
+ inputField.className += " input-field-disabled";
+ }
+ var inputFieldMain = document.createElement("div");
+ inputField.appendChild(inputFieldMain);
+ inputFieldMain.className += " input-field-main";
+ this.input.className += " input-field-element";
+ this.input.type = this._options.type || "text";
+ this.input.placeholder = this._options.placeholder || "";
+ this.input.value = String(this._options.value) || "";
+ if (this._options.disabled) {
+ this.input.disabled = true;
+ }
+ if (this._options.readonly) {
+ this.input.readOnly = true;
+ }
+ if (this._options.required) {
+ this.input.required = true;
+ }
+ if (this._options.maxLength) {
+ this.input.maxLength = this._options.maxLength;
+ }
+ if (this._options.pattern) {
+ this.input.pattern = this._options.pattern;
+ }
+ if (this._options.autocomplete) {
+ this.input.autocomplete = this._options.autocomplete;
+ }
+ if (this._options.showCounter) {
+ this._counter = document.createElement("div");
+ inputField.appendChild(this._counter);
+ this._counter.className += " input-field-counter";
+ this._counterCurrent = document.createElement("span");
+ this._counterCurrent.className += " input-field-counter-current";
+ this._counterCurrent.textContent = "0";
+ this._counter.appendChild(this._counterCurrent);
+ var span = document.createElement("span");
+ span.textContent = "/";
+ this._counter.appendChild(span);
+ this._counterMax = document.createElement("span");
+ this._counterMax.className += " input-field-counter-max";
+ this._counterMax.textContent = String(this._options.maxLength) || "∞";
+ this._counter.appendChild(this._counterMax);
+ }
+ inputField.appendChild(this._validationElement);
+ this._validationElement.className += " input-field-validation";
+ this._validationElement.style.display = "none";
+ if (this._options.showClear) {
+ this.input.className += " input-field-clearable";
+ this._clearButton = document.createElement("button");
+ inputField.appendChild(this._clearButton);
+ this._clearButton.className += " input-field-clear";
+ this._clearButton.style.display = "none";
+ this._clearButton.textContent = "×";
+ }
+ if (this._options.showSearchIcon) {
+ this._searchIcon.classList.add("input-field-search-icon");
+ this._searchIcon.innerHTML = '' + ' ' + " ";
+ inputFieldMain.appendChild(this._searchIcon);
+ }
+ if (parent) {
+ parent.insertBefore(fragment, this.input);
+ }
+ inputFieldMain.appendChild(this.input);
+ },
+ _bindEvents: function _bindEvents() {
+ this.input.addEventListener("focus", this._boundHandles.focus);
+ this.input.addEventListener("blur", this._boundHandles.blur);
+ this.input.addEventListener("input", this._boundHandles.input);
+ this.input.addEventListener("keydown", this._boundHandles.keydown);
+ if (this._clearButton) {
+ this._clearButton.addEventListener("click", this._boundHandles.clear);
+ }
+ if (this._options.showSearchIcon && this._boundHandles.search) {
+ this._searchIcon.addEventListener("click", this._boundHandles.search);
+ }
+ this.input.addEventListener("change", this._boundHandles.validate);
+ },
+ _handleFocus: function _handleFocus(e) {
+ this.isFocused = true;
+ this._container.className += " input-field-focused";
+ this._updateClearButton();
+ this._triggerFocusEvent(e);
+ },
+ _handleBlur: function _handleBlur(e) {
+ this.isFocused = false;
+ var classes = this._container.className.split(" ");
+ var newClasses = [];
+ for (var i = 0; i < classes.length; i++) {
+ if (classes[i] !== "input-field-focused") {
+ newClasses.push(classes[i]);
+ }
+ }
+ this._container.className = newClasses.join(" ");
+ this.validate();
+ this._triggerBlurEvent(e);
+ },
+ _handleInput: function _handleInput(e) {
+ this._updateClearButton();
+ this._updateCounter();
+ this._triggerInputEvent(e);
+ },
+ _handleKeydown: function _handleKeydown(e) {
+ var key = e.key || e.keyCode;
+ if ((key === "Escape" || key === 27) && this._options.showClear) {
+ this.clear();
+ e.preventDefault();
+ }
+ if (key === "Enter" || key === 13) {
+ this._triggerSubmit();
+ }
+ },
+ _updateClearButton: function _updateClearButton() {
+ if (this._clearButton) {
+ var hasValue = this.input.value.length > 0;
+ this._clearButton.style.display = hasValue ? "block" : "none";
+ }
+ },
+ _updateCounter: function _updateCounter() {
+ if (this._counter && this._options.maxLength) {
+ var current = this.input.value.length;
+ var max = this._options.maxLength;
+ if (this._counterCurrent) {
+ this._counterCurrent.textContent = String(current);
+ }
+ if (this._counterMax) {
+ this._counterMax.textContent = String(max);
+ }
+ if (current > max * .9) {
+ var counterClasses = this._counter.className.split(" ");
+ if (counterClasses.indexOf("input-field-counter-warning") === -1) {
+ this._counter.className += " input-field-counter-warning";
+ }
+ } else {
+ this._counter.className = this._counter.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-counter-warning";
+ }).join(" ");
+ }
+ if (current > max) {
+ var counterClasses = this._counter.className.split(" ");
+ if (counterClasses.indexOf("input-field-counter-error") === -1) {
+ this._counter.className += " input-field-counter-error";
+ }
+ } else {
+ this._counter.className = this._counter.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-counter-error";
+ }).join(" ");
+ }
+ }
+ },
+ validate: function validate() {
+ if (!this._options.validation) {
+ this.isValid = true;
+ return true;
+ }
+ var value = this.input.value;
+ var isValid = true;
+ var message = "";
+ if (this._options.required && !value.trim()) {
+ isValid = false;
+ message = "This field is required";
+ } else if (this._options.minLength && value.length < this._options.minLength) {
+ isValid = false;
+ message = "Minimum length is " + this._options.minLength + " characters";
+ } else if (this._options.maxLength && value.length > this._options.maxLength) {
+ isValid = false;
+ message = "Maximum length is " + this._options.maxLength + " characters";
+ } else if (this._options.pattern && !new RegExp(this._options.pattern).test(value)) {
+ isValid = false;
+ message = "Invalid format";
+ }
+ if (isValid && typeof this._options.validation === "function") {
+ var customValidation = this._options.validation(value);
+ if (customValidation && !customValidation.isValid) {
+ isValid = false;
+ message = customValidation.message || "Invalid value";
+ }
+ }
+ this.isValid = isValid;
+ this._validationMessage = message;
+ this.updateValidationState();
+ return isValid;
+ },
+ updateValidationState: function updateValidationState() {
+ if (!this.isValid) {
+ this._validationElement.textContent = this._validationMessage;
+ this._validationElement.style.display = "block";
+ var containerClasses = this._container.className.split(" ");
+ if (containerClasses.indexOf("input-field-invalid") === -1) {
+ this._container.className += " input-field-invalid";
+ }
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-valid";
+ }).join(" ");
+ } else if (this.input.value.length > 0) {
+ this._validationElement.style.display = "none";
+ var containerClasses = this._container.className.split(" ");
+ if (containerClasses.indexOf("input-field-valid") === -1) {
+ this._container.className += " input-field-valid";
+ }
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-invalid";
+ }).join(" ");
+ } else {
+ this._validationElement.style.display = "none";
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-valid" && cls !== "input-field-invalid";
+ }).join(" ");
+ }
+ },
+ _updateState: function _updateState() {
+ this._updateClearButton();
+ this._updateCounter();
+ this.validate();
+ },
+ getValue: function getValue() {
+ return this.input.value.trim();
+ },
+ setValue: function setValue(value) {
+ this.input.value = value;
+ this._updateState();
+ this._triggerChange();
+ },
+ setPlaceholder: function setPlaceholder(value) {
+ this.input.placeholder = value;
+ this._options.placeholder = value;
+ },
+ clear: function clear(bFocus) {
+ bFocus = bFocus !== undefined ? bFocus : true;
+ this.setValue("");
+ if (bFocus) {
+ this.input.focus();
+ }
+ },
+ focus: function focus() {
+ this.input.focus();
+ },
+ blur: function blur() {
+ this.input.blur();
+ },
+ enable: function enable() {
+ this.input.disabled = false;
+ this._options.disabled = false;
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-disabled";
+ }).join(" ");
+ },
+ disable: function disable() {
+ this.input.disabled = true;
+ this._options.disabled = true;
+ var containerClasses = this._container.className.split(" ");
+ if (containerClasses.indexOf("input-field-disabled") === -1) {
+ this._container.className += " input-field-disabled";
+ }
+ },
+ subscribe: function subscribe(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ },
+ _triggerInputEvent: function _triggerInputEvent(e) {
+ var detail = {
+ value: this.input.value,
+ originalEvent: e
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "inputfield:input",
+ detail: detail
+ });
+ });
+ },
+ _triggerFocusEvent: function _triggerFocusEvent(e) {
+ var detail = {
+ value: this.input.value,
+ originalEvent: e
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "inputfield:focus",
+ detail: detail
+ });
+ });
+ },
+ _triggerBlurEvent: function _triggerBlurEvent(e) {
+ var detail = {
+ value: this.input.value,
+ originalEvent: e
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "inputfield:blur",
+ detail: detail
+ });
+ });
+ },
+ _triggerChange: function _triggerChange() {
+ var detail = {
+ value: this.input.value,
+ isValid: this.isValid
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "inputfield:change",
+ detail: detail
+ });
+ });
+ },
+ _triggerSubmit: function _triggerSubmit() {
+ var detail = {
+ value: this.input.value,
+ isValid: this.isValid
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "inputfield:submit",
+ detail: detail
+ });
+ });
+ },
+ destroy: function destroy() {
+ this._subscribers = [];
+ if (this._boundHandles) {
+ try {
+ this.input.removeEventListener("focus", this._boundHandles.focus);
+ this.input.removeEventListener("blur", this._boundHandles.blur);
+ this.input.removeEventListener("input", this._boundHandles.input);
+ this.input.removeEventListener("keydown", this._boundHandles.keydown);
+ if (this._clearButton) {
+ this._clearButton.removeEventListener("click", this._boundHandles.clear);
+ }
+ if (this._options.showSearchIcon && this._boundHandles.search) {
+ this._searchIcon.removeEventListener("click", this._boundHandles.search);
+ }
+ this.input.removeEventListener("change", this._boundHandles.validate);
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ this._container.innerHTML = "";
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "input-field-container";
+ }).join(" ");
+ }
+ };
+ var es_object_assign = {};
+ var hasRequiredEs_object_assign;
+ function requireEs_object_assign() {
+ if (hasRequiredEs_object_assign) return es_object_assign;
+ hasRequiredEs_object_assign = 1;
+ var $ = require_export();
+ var assign = requireObjectAssign();
+ $({
+ target: "Object",
+ stat: true,
+ arity: 2,
+ forced: Object.assign !== assign
+ }, {
+ assign: assign
+ });
+ return es_object_assign;
+ }
+ requireEs_object_assign();
+ function Message(container, options) {
+ if (typeof container === "string") {
+ var temp = document.getElementById(container);
+ if (temp instanceof HTMLElement) {
+ container = temp;
+ }
+ }
+ if (container instanceof HTMLElement) {
+ this.container = container;
+ } else {
+ throw new Error("Invalid container element");
+ }
+ this._options = Object.assign(this._options, options);
+ this._isShow = false;
+ }
+ Message.prototype = {
+ constructor: Message,
+ _options: {
+ type: "info",
+ text: "",
+ title: "",
+ duration: 0,
+ closeButton: true,
+ autoClose: false,
+ closeOnClickOutside: true
+ },
+ _outsideClickListener: null,
+ _element: null,
+ _timeoutId: null,
+ _create: function _create() {
+ var messageEl = document.createElement("div");
+ messageEl.className = "message message-" + this._options.type;
+ messageEl.setAttribute("role", "alert");
+ var title = this._options.title;
+ if (!title) {
+ title = "Error";
+ switch (this._options.type) {
+ case "success":
+ title = "Success";
+ break;
+
+ case "warning":
+ title = "Warning";
+ break;
+
+ case "info":
+ title = "Information";
+ break;
+ }
+ }
+ var text = this._options.text;
+ if (!text) {
+ text = "";
+ switch (this._options.type) {
+ case "success":
+ text = "Operation completed successfully.";
+ break;
+
+ case "warning":
+ text = "Please be cautious.";
+ break;
+
+ case "error":
+ text = "Something went wrong.";
+ break;
+ }
+ }
+ messageEl.innerHTML = '' + '' + title + " " + '' + text + " " + "
";
+ if (this._options.closeButton) {
+ var closeBtn = document.createElement("button");
+ closeBtn.className = "message-close";
+ closeBtn.textContent = "×";
+ closeBtn.setAttribute("aria-label", "Close");
+ closeBtn.onclick = this.close.bind(this);
+ messageEl.appendChild(closeBtn);
+ }
+ return messageEl;
+ },
+ addOutsideClickListener: function addOutsideClickListener() {
+ if (this._outsideClickListener) {
+ document.removeEventListener("click", this._outsideClickListener);
+ }
+ var self = this;
+ this._outsideClickListener = function(e) {
+ if (e.target instanceof HTMLElement === false) {
+ return;
+ }
+ if (self._element && !self._element.contains(e.target)) {
+ self.close();
+ }
+ };
+ setTimeout(function() {
+ if (!self._outsideClickListener) {
+ return;
+ }
+ document.addEventListener("click", self._outsideClickListener);
+ }, 10);
+ },
+ removeOutsideClickListener: function removeOutsideClickListener() {
+ if (this._outsideClickListener) {
+ document.removeEventListener("click", this._outsideClickListener);
+ this._outsideClickListener = null;
+ }
+ },
+ show: function show(text, title) {
+ if (this._isShow) {
+ return this;
+ }
+ this._isShow = true;
+ if (!this.container.classList.contains("message-container")) {
+ this.container.classList.add("message-container");
+ }
+ if (title) {
+ this._options.title = title;
+ }
+ if (text) {
+ this._options.text = text;
+ }
+ var messageEl = this._create();
+ this._element = messageEl;
+ this.container.appendChild(messageEl);
+ setTimeout(function() {
+ messageEl.style.opacity = "1";
+ messageEl.style.transform = "translateY(0)";
+ }, 10);
+ if (this._options.autoClose && Number(this._options.duration) > 0) {
+ this._timeoutId = setTimeout(this.close.bind(this), this._options.duration);
+ }
+ if (this._options.closeOnClickOutside) {
+ this.addOutsideClickListener();
+ }
+ return this;
+ },
+ close: function close() {
+ this._isShow = false;
+ if (!this._element || !this._element.parentNode) {
+ return;
+ }
+ if (this._timeoutId) {
+ clearTimeout(this._timeoutId);
+ this._timeoutId = null;
+ }
+ this.removeOutsideClickListener();
+ var _element = this._element;
+ _element.style.opacity = "0";
+ _element.style.transform = "translateY(-20px)";
+ setTimeout(function() {
+ if (_element.parentNode) {
+ _element.parentNode.removeChild(_element);
+ }
+ }, 300);
+ }
+ };
+ function Button(button, options) {
+ var self = this;
+ if (typeof button === "string") {
+ var temp = document.getElementById(button);
+ if (temp instanceof HTMLButtonElement) {
+ button = temp;
+ }
+ }
+ if (button instanceof HTMLButtonElement) {
+ this._button = button;
+ } else {
+ throw new Error("Invalid button");
+ }
+ this._container = document.createElement("div");
+ this._options = options || {};
+ this._options.text = this._options.text || button.textContent.trim();
+ this._options.type = this._options.type || "button";
+ this._options.variant = this._options.variant || "primary";
+ this._options.size = this._options.size || "medium";
+ this._options.iconPosition = this._options.iconPosition || "left";
+ this.isLoading = false;
+ this._originalText = this._options.text;
+ this._subscribers = [];
+ this._boundHandles = {
+ click: function click(e) {
+ self._handleClick(e);
+ },
+ mouseenter: function mouseenter() {
+ self._handleMouseEnter();
+ },
+ mouseleave: function mouseleave() {
+ self._handleMouseLeave();
+ },
+ focus: function focus() {
+ self._handleFocus();
+ },
+ blur: function blur() {
+ self._handleBlur();
+ },
+ keydown: function keydown(e) {
+ self._handleKeydown(e);
+ }
+ };
+ this._createDOM();
+ this._bindEvents();
+ this.updateState();
+ }
+ Button.prototype = {
+ constructor: Button,
+ _button: null,
+ _buttonText: null,
+ _spinner: null,
+ _badgeElement: null,
+ _createDOM: function _createDOM() {
+ var parent = this._button.parentNode;
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild(this._container);
+ this._container.className += " custom-button-container";
+ this._button.className += " custom-button";
+ this._button.className += " custom-button-" + this._options.variant;
+ this._button.className += " custom-button-" + this._options.size;
+ if (this._options.disabled) {
+ this._button.className += " custom-button-disabled";
+ }
+ if (this._options.loading) {
+ this._container.className += " custom-button-loading";
+ }
+ if (this._options.type) {
+ this._button.type = this._options.type;
+ }
+ if (this._options.tooltip) {
+ this._button.title = this._options.tooltip;
+ }
+ if (this._options.disabled) {
+ this._button.disabled = true;
+ }
+ if (this._options.text) {
+ this._button.textContent = "";
+ this._buttonText = document.createElement("span");
+ this._buttonText.className = "custom-button-text";
+ this._buttonText.textContent = this._options.text || "";
+ if (this._options.icon) {
+ var iconSpan = document.createElement("span");
+ iconSpan.className = "custom-button-icon";
+ if (this._options.iconPosition === "left") {
+ iconSpan.className += " custom-button-icon-left";
+ this._button.appendChild(iconSpan);
+ this._button.appendChild(this._buttonText);
+ } else {
+ iconSpan.className += " custom-button-icon-right";
+ this._button.appendChild(this._buttonText);
+ this._button.appendChild(iconSpan);
+ }
+ iconSpan.innerHTML = this._options.icon;
+ } else {
+ this._button.appendChild(this._buttonText);
+ }
+ }
+ if (this._options.loading) {
+ this._spinner = document.createElement("span");
+ this._spinner.className = "custom-button-spinner";
+ this._button.appendChild(this._spinner);
+ }
+ if (this._options.badge) {
+ this._badgeElement = document.createElement("span");
+ this._badgeElement.className = "custom-button-badge";
+ this._badgeElement.textContent = this._options.badge;
+ this._button.appendChild(this._badgeElement);
+ }
+ if (parent) {
+ parent.insertBefore(fragment, this._button);
+ }
+ this._container.appendChild(this._button);
+ },
+ _bindEvents: function _bindEvents() {
+ this._button.addEventListener("click", this._boundHandles.click);
+ this._button.addEventListener("mouseenter", this._boundHandles.mouseenter);
+ this._button.addEventListener("mouseleave", this._boundHandles.mouseleave);
+ this._button.addEventListener("focus", this._boundHandles.focus);
+ this._button.addEventListener("blur", this._boundHandles.blur);
+ this._button.addEventListener("keydown", this._boundHandles.keydown);
+ },
+ _handleClick: function _handleClick(e) {
+ if (this._options.disabled || this.isLoading) {
+ e.preventDefault();
+ e.stopPropagation();
+ return;
+ }
+ this.triggerClickEvent(e);
+ },
+ _handleMouseEnter: function _handleMouseEnter() {
+ var classes = this._button.className.split(" ");
+ if (classes.indexOf("custom-button-hover") === -1) {
+ this._button.className += " custom-button-hover";
+ }
+ this.triggerEvent("mouseenter");
+ },
+ _handleMouseLeave: function _handleMouseLeave() {
+ this._button.className = this._button.className.split(" ").filter(function(cls) {
+ return cls !== "custom-button-hover";
+ }).join(" ");
+ this.triggerEvent("mouseleave");
+ },
+ _handleFocus: function _handleFocus() {
+ var classes = this._button.className.split(" ");
+ if (classes.indexOf("custom-button-focused") === -1) {
+ this._button.className += " custom-button-focused";
+ }
+ this.triggerEvent("focus");
+ },
+ _handleBlur: function _handleBlur() {
+ this._button.className = this._button.className.split(" ").filter(function(cls) {
+ return cls !== "custom-button-focused";
+ }).join(" ");
+ this.triggerEvent("blur");
+ },
+ _handleKeydown: function _handleKeydown(e) {
+ var key = e.key || e.keyCode;
+ if (key === " " || key === "Enter" || key === 32 || key === 13) {
+ if (this._button.tagName === "BUTTON") ; else {
+ e.preventDefault();
+ this._button.click();
+ }
+ } else if (key === "Escape" || key === 27) {
+ this._button.blur();
+ }
+ this.triggerEvent("keydown", {
+ key: key
+ });
+ },
+ subscribe: function subscribe(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ },
+ setText: function setText(text) {
+ if (typeof text === "undefined") return;
+ this._options.text = text;
+ if (!this._buttonText) {
+ this._buttonText = document.createElement("span");
+ this._buttonText.className = "custom-button-text";
+ this._buttonText.textContent = "";
+ this._button.appendChild(this._buttonText);
+ }
+ this._buttonText.textContent = text;
+ },
+ setIcon: function setIcon(icon, position) {
+ this._options.icon = icon;
+ this._options.iconPosition = position || "left";
+ },
+ setBadge: function setBadge(badge) {
+ if (typeof badge === "undefined") return;
+ this._options.badge = badge;
+ if (this._badgeElement) {
+ this._badgeElement.textContent = badge;
+ this._badgeElement.style.display = badge ? "flex" : "none";
+ }
+ },
+ setVariant: function setVariant(variant) {
+ if (typeof variant === "undefined") return;
+ var oldClass = "custom-button-" + this._options.variant;
+ var newClass = "custom-button-" + variant;
+ this._button.className = this._button.className.split(" ").filter(function(cls) {
+ return cls !== oldClass;
+ }).join(" ") + " " + newClass;
+ this._options.variant = variant;
+ },
+ setSize: function setSize(size) {
+ if (typeof size === "undefined") return;
+ var oldClass = "custom-button-" + this._options.size;
+ var newClass = "custom-button-" + size;
+ this._button.className = this._button.className.split(" ").filter(function(cls) {
+ return cls !== oldClass;
+ }).join(" ") + " " + newClass;
+ this._options.size = size;
+ },
+ enable: function enable() {
+ this._options.disabled = false;
+ this._button.disabled = false;
+ this._button.className = this._button.className.split(" ").filter(function(cls) {
+ return cls !== "custom-button-disabled";
+ }).join(" ");
+ },
+ disable: function disable() {
+ this._options.disabled = true;
+ this._button.disabled = true;
+ var classes = this._button.className.split(" ");
+ if (classes.indexOf("custom-button-disabled") === -1) {
+ this._button.className += " custom-button-disabled";
+ }
+ },
+ startLoading: function startLoading() {
+ this.isLoading = true;
+ if (typeof this._options.text !== "undefined") this._originalText = this._options.text;
+ var containerClasses = this._container.className.split(" ");
+ if (containerClasses.indexOf("custom-button-loading") === -1) {
+ this._container.className += " custom-button-loading";
+ }
+ if (this._spinner) {
+ this._spinner.style.display = "inline-block";
+ }
+ if (this._buttonText) {
+ this._buttonText.textContent = "Loading...";
+ }
+ this._button.disabled = true;
+ },
+ stopLoading: function stopLoading() {
+ this.isLoading = false;
+ this._container.className = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "custom-button-loading";
+ }).join(" ");
+ if (this._spinner) {
+ this._spinner.style.display = "none";
+ }
+ if (this._buttonText) {
+ this._buttonText.textContent = this._originalText;
+ }
+ this._button.disabled = !!this._options.disabled;
+ },
+ setTooltip: function setTooltip(tooltip) {
+ if (typeof tooltip === "undefined") return;
+ this._options.tooltip = tooltip;
+ this._button.title = tooltip || "";
+ },
+ triggerClickEvent: function triggerClickEvent(e) {
+ var detail = {
+ originalEvent: e,
+ button: this
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "button:click",
+ detail: detail
+ });
+ });
+ },
+ triggerEvent: function triggerEvent(eventName, detail) {
+ detail = detail || {};
+ detail.button = this;
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "button:" + eventName,
+ detail: detail
+ });
+ });
+ },
+ updateState: function updateState() {
+ if (this._options.disabled) {
+ this.disable();
+ } else {
+ this.enable();
+ }
+ if (this._options.loading) {
+ this.startLoading();
+ }
+ },
+ destroy: function destroy() {
+ this._subscribers = [];
+ if (this._boundHandles) {
+ try {
+ this._button.removeEventListener("click", this._boundHandles.click);
+ this._button.removeEventListener("mouseenter", this._boundHandles.mouseenter);
+ this._button.removeEventListener("mouseleave", this._boundHandles.mouseleave);
+ this._button.removeEventListener("focus", this._boundHandles.focus);
+ this._button.removeEventListener("blur", this._boundHandles.blur);
+ this._button.removeEventListener("keydown", this._boundHandles.keydown);
+ } catch (error) {
+ console.error(error);
+ }
+ }
+ this._container.innerHTML = "";
+ var containerClasses = this._container.className.split(" ").filter(function(cls) {
+ return cls !== "custom-button-container";
+ }).join(" ");
+ this._container.className = containerClasses;
+ }
+ };
+ var es_array_splice = {};
+ var arraySetLength;
+ var hasRequiredArraySetLength;
+ function requireArraySetLength() {
+ if (hasRequiredArraySetLength) return arraySetLength;
+ hasRequiredArraySetLength = 1;
+ var DESCRIPTORS = requireDescriptors();
+ var isArray = requireIsArray();
+ var $TypeError = TypeError;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function() {
+ if (this !== undefined) return true;
+ try {
+ Object.defineProperty([], "length", {
+ writable: false
+ }).length = 1;
+ } catch (error) {
+ return error instanceof TypeError;
+ }
+ }();
+ arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function(O, length) {
+ if (isArray(O) && !getOwnPropertyDescriptor(O, "length").writable) {
+ throw new $TypeError("Cannot set read only .length");
+ }
+ return O.length = length;
+ } : function(O, length) {
+ return O.length = length;
+ };
+ return arraySetLength;
+ }
+ var deletePropertyOrThrow;
+ var hasRequiredDeletePropertyOrThrow;
+ function requireDeletePropertyOrThrow() {
+ if (hasRequiredDeletePropertyOrThrow) return deletePropertyOrThrow;
+ hasRequiredDeletePropertyOrThrow = 1;
+ var tryToString = requireTryToString();
+ var $TypeError = TypeError;
+ deletePropertyOrThrow = function(O, P) {
+ if (!delete O[P]) throw new $TypeError("Cannot delete property " + tryToString(P) + " of " + tryToString(O));
+ };
+ return deletePropertyOrThrow;
+ }
+ var hasRequiredEs_array_splice;
+ function requireEs_array_splice() {
+ if (hasRequiredEs_array_splice) return es_array_splice;
+ hasRequiredEs_array_splice = 1;
+ var $ = require_export();
+ var toObject = requireToObject();
+ var toAbsoluteIndex = requireToAbsoluteIndex();
+ var toIntegerOrInfinity = requireToIntegerOrInfinity();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var setArrayLength = requireArraySetLength();
+ var doesNotExceedSafeInteger = requireDoesNotExceedSafeInteger();
+ var arraySpeciesCreate = requireArraySpeciesCreate();
+ var createProperty = requireCreateProperty();
+ var deletePropertyOrThrow = requireDeletePropertyOrThrow();
+ var arrayMethodHasSpeciesSupport = requireArrayMethodHasSpeciesSupport();
+ var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport("splice");
+ var max = Math.max;
+ var min = Math.min;
+ $({
+ target: "Array",
+ proto: true,
+ forced: !HAS_SPECIES_SUPPORT
+ }, {
+ splice: function splice(start, deleteCount) {
+ var O = toObject(this);
+ var len = lengthOfArrayLike(O);
+ var actualStart = toAbsoluteIndex(start, len);
+ var argumentsLength = arguments.length;
+ var insertCount, actualDeleteCount, A, k, from, to;
+ if (argumentsLength === 0) {
+ insertCount = actualDeleteCount = 0;
+ } else if (argumentsLength === 1) {
+ insertCount = 0;
+ actualDeleteCount = len - actualStart;
+ } else {
+ insertCount = argumentsLength - 2;
+ actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
+ }
+ doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
+ A = arraySpeciesCreate(O, actualDeleteCount);
+ for (k = 0; k < actualDeleteCount; k++) {
+ from = actualStart + k;
+ if (from in O) createProperty(A, k, O[from]);
+ }
+ A.length = actualDeleteCount;
+ if (insertCount < actualDeleteCount) {
+ for (k = actualStart; k < len - actualDeleteCount; k++) {
+ from = k + actualDeleteCount;
+ to = k + insertCount;
+ if (from in O) O[to] = O[from]; else deletePropertyOrThrow(O, to);
+ }
+ for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);
+ } else if (insertCount > actualDeleteCount) {
+ for (k = len - actualDeleteCount; k > actualStart; k--) {
+ from = k + actualDeleteCount - 1;
+ to = k + insertCount - 1;
+ if (from in O) O[to] = O[from]; else deletePropertyOrThrow(O, to);
+ }
+ }
+ for (k = 0; k < insertCount; k++) {
+ O[k + actualStart] = arguments[k + 2];
+ }
+ setArrayLength(O, len - actualDeleteCount + insertCount);
+ return A;
+ }
+ });
+ return es_array_splice;
+ }
+ requireEs_array_splice();
+ var es_map = {};
+ var es_map_constructor = {};
+ var collectionStrong;
+ var hasRequiredCollectionStrong;
+ function requireCollectionStrong() {
+ if (hasRequiredCollectionStrong) return collectionStrong;
+ hasRequiredCollectionStrong = 1;
+ var create = requireObjectCreate();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var defineBuiltIns = requireDefineBuiltIns();
+ var bind = requireFunctionBindContext();
+ var anInstance = requireAnInstance();
+ var isNullOrUndefined = requireIsNullOrUndefined();
+ var iterate = requireIterate();
+ var defineIterator = requireIteratorDefine();
+ var createIterResultObject = requireCreateIterResultObject();
+ var setSpecies = requireSetSpecies();
+ var DESCRIPTORS = requireDescriptors();
+ var fastKey = requireInternalMetadata().fastKey;
+ var InternalStateModule = requireInternalState();
+ var setInternalState = InternalStateModule.set;
+ var internalStateGetterFor = InternalStateModule.getterFor;
+ collectionStrong = {
+ getConstructor: function(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
+ var Constructor = wrapper(function(that, iterable) {
+ anInstance(that, Prototype);
+ setInternalState(that, {
+ type: CONSTRUCTOR_NAME,
+ index: create(null),
+ first: null,
+ last: null,
+ size: 0
+ });
+ if (!DESCRIPTORS) that.size = 0;
+ if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], {
+ that: that,
+ AS_ENTRIES: IS_MAP
+ });
+ });
+ var Prototype = Constructor.prototype;
+ var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var define = function(that, key, value) {
+ var state = getInternalState(that);
+ var entry = getEntry(that, key);
+ var previous, index;
+ if (entry) {
+ entry.value = value;
+ } else {
+ state.last = entry = {
+ index: index = fastKey(key, true),
+ key: key,
+ value: value,
+ previous: previous = state.last,
+ next: null,
+ removed: false
+ };
+ if (!state.first) state.first = entry;
+ if (previous) previous.next = entry;
+ if (DESCRIPTORS) state.size++; else that.size++;
+ if (index !== "F") state.index[index] = entry;
+ }
+ return that;
+ };
+ var getEntry = function(that, key) {
+ var state = getInternalState(that);
+ var index = fastKey(key);
+ var entry;
+ if (index !== "F") return state.index[index];
+ for (entry = state.first; entry; entry = entry.next) {
+ if (entry.key === key) return entry;
+ }
+ };
+ defineBuiltIns(Prototype, {
+ clear: function clear() {
+ var that = this;
+ var state = getInternalState(that);
+ var entry = state.first;
+ while (entry) {
+ entry.removed = true;
+ if (entry.previous) entry.previous = entry.previous.next = null;
+ entry = entry.next;
+ }
+ state.first = state.last = null;
+ state.index = create(null);
+ if (DESCRIPTORS) state.size = 0; else that.size = 0;
+ },
+ delete: function(key) {
+ var that = this;
+ var state = getInternalState(that);
+ var entry = getEntry(that, key);
+ if (entry) {
+ var next = entry.next;
+ var prev = entry.previous;
+ delete state.index[entry.index];
+ entry.removed = true;
+ if (prev) prev.next = next;
+ if (next) next.previous = prev;
+ if (state.first === entry) state.first = next;
+ if (state.last === entry) state.last = prev;
+ if (DESCRIPTORS) state.size--; else that.size--;
+ }
+ return !!entry;
+ },
+ forEach: function forEach(callbackfn) {
+ var state = getInternalState(this);
+ var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ var entry;
+ while (entry = entry ? entry.next : state.first) {
+ boundFunction(entry.value, entry.key, this);
+ while (entry && entry.removed) entry = entry.previous;
+ }
+ },
+ has: function has(key) {
+ return !!getEntry(this, key);
+ }
+ });
+ defineBuiltIns(Prototype, IS_MAP ? {
+ get: function get(key) {
+ var entry = getEntry(this, key);
+ return entry && entry.value;
+ },
+ set: function set(key, value) {
+ return define(this, key === 0 ? 0 : key, value);
+ }
+ } : {
+ add: function add(value) {
+ return define(this, value = value === 0 ? 0 : value, value);
+ }
+ });
+ if (DESCRIPTORS) defineBuiltInAccessor(Prototype, "size", {
+ configurable: true,
+ get: function() {
+ return getInternalState(this).size;
+ }
+ });
+ return Constructor;
+ },
+ setStrong: function(Constructor, CONSTRUCTOR_NAME, IS_MAP) {
+ var ITERATOR_NAME = CONSTRUCTOR_NAME + " Iterator";
+ var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
+ var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
+ defineIterator(Constructor, CONSTRUCTOR_NAME, function(iterated, kind) {
+ setInternalState(this, {
+ type: ITERATOR_NAME,
+ target: iterated,
+ state: getInternalCollectionState(iterated),
+ kind: kind,
+ last: null
+ });
+ }, function() {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var entry = state.last;
+ while (entry && entry.removed) entry = entry.previous;
+ if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
+ state.target = null;
+ return createIterResultObject(undefined, true);
+ }
+ if (kind === "keys") return createIterResultObject(entry.key, false);
+ if (kind === "values") return createIterResultObject(entry.value, false);
+ return createIterResultObject([ entry.key, entry.value ], false);
+ }, IS_MAP ? "entries" : "values", !IS_MAP, true);
+ setSpecies(CONSTRUCTOR_NAME);
+ }
+ };
+ return collectionStrong;
+ }
+ var hasRequiredEs_map_constructor;
+ function requireEs_map_constructor() {
+ if (hasRequiredEs_map_constructor) return es_map_constructor;
+ hasRequiredEs_map_constructor = 1;
+ var collection = requireCollection();
+ var collectionStrong = requireCollectionStrong();
+ collection("Map", function(init) {
+ return function Map() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+ }, collectionStrong);
+ return es_map_constructor;
+ }
+ var hasRequiredEs_map;
+ function requireEs_map() {
+ if (hasRequiredEs_map) return es_map;
+ hasRequiredEs_map = 1;
+ requireEs_map_constructor();
+ return es_map;
+ }
+ requireEs_map();
+ var _container$1 = new WeakMap;
+ var _input = new WeakMap;
+ var _visualRadio = new WeakMap;
+ var _labelElement = new WeakMap;
+ var _options = new WeakMap;
+ var _handlers = new WeakMap;
+ var _subscribers = new WeakMap;
+ var _Radio_brand = new WeakSet;
+ var Radio = function() {
+ function Radio(_radio, options) {
+ _classCallCheck(this, Radio);
+ _classPrivateMethodInitSpec(this, _Radio_brand);
+ _classPrivateFieldInitSpec(this, _container$1, void 0);
+ _classPrivateFieldInitSpec(this, _input, void 0);
+ _classPrivateFieldInitSpec(this, _visualRadio, void 0);
+ _classPrivateFieldInitSpec(this, _labelElement, null);
+ _classPrivateFieldInitSpec(this, _options, void 0);
+ _classPrivateFieldInitSpec(this, _handlers, new Map);
+ _classPrivateFieldInitSpec(this, _subscribers, []);
+ if (typeof _radio === "string") {
+ var temp = document.getElementById(_radio);
+ if (temp instanceof HTMLInputElement) {
+ _radio = temp;
+ }
+ }
+ if (!(_radio instanceof HTMLInputElement)) {
+ throw new Error("Invalid input element");
+ }
+ _classPrivateFieldSet2(_input, this, _radio);
+ _classPrivateFieldSet2(_options, this, Object.assign({
+ id: "radio_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 11)),
+ checked: false,
+ disabled: false,
+ indeterminate: false,
+ label: "",
+ name: "",
+ value: "on"
+ }, options));
+ _assertClassBrand(_Radio_brand, this, _applyInputAttributes).call(this);
+ _classPrivateFieldSet2(_container$1, this, document.createElement("div"));
+ _classPrivateFieldSet2(_visualRadio, this, document.createElement("span"));
+ _assertClassBrand(_Radio_brand, this, _createDOM$2).call(this);
+ _assertClassBrand(_Radio_brand, this, _setupEventListeners).call(this);
+ _assertClassBrand(_Radio_brand, this, _updateVisualState).call(this);
+ if (!_classPrivateFieldGet2(_options, this).name) {
+ throw new Error("Name attribute is required");
+ }
+ var sameNameInstances = _instances$1._.get(_classPrivateFieldGet2(_options, this).name);
+ if (!sameNameInstances) {
+ sameNameInstances = new Array;
+ _instances$1._.set(_classPrivateFieldGet2(_options, this).name, sameNameInstances);
+ }
+ sameNameInstances.push(this);
+ }
+ return _createClass(Radio, [ {
+ key: "subscribe",
+ value: function subscribe(callback) {
+ var self = this;
+ _classPrivateFieldGet2(_subscribers, this).push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ _classPrivateFieldSet2(_subscribers, self, _classPrivateFieldGet2(_subscribers, self).filter(function(cb) {
+ return cb !== callback;
+ }));
+ }
+ };
+ }
+ }, {
+ key: "getElement",
+ value: function getElement() {
+ return _classPrivateFieldGet2(_container$1, this);
+ }
+ }, {
+ key: "check",
+ value: function check(bSilent) {
+ var _this = this;
+ if (_classPrivateFieldGet2(_options, this).disabled || _classPrivateFieldGet2(_options, this).checked) return;
+ if (_classPrivateFieldGet2(_options, this).name) {
+ var radios = _instances$1._.get(_classPrivateFieldGet2(_options, this).name);
+ radios && radios.forEach(function(radio) {
+ if (radio !== _this && _classPrivateFieldGet2(_options, radio).checked) {
+ radio.uncheck();
+ }
+ });
+ }
+ _classPrivateFieldGet2(_options, this).checked = true;
+ _assertClassBrand(_Radio_brand, this, _updateVisualState).call(this);
+ if (bSilent) return;
+ _assertClassBrand(_Radio_brand, this, _triggerChange$1).call(this);
+ }
+ }, {
+ key: "uncheck",
+ value: function uncheck(bSilent) {
+ if (_classPrivateFieldGet2(_options, this).disabled || !_classPrivateFieldGet2(_options, this).checked) return;
+ _classPrivateFieldGet2(_options, this).checked = false;
+ _assertClassBrand(_Radio_brand, this, _updateVisualState).call(this);
+ if (bSilent) return;
+ _assertClassBrand(_Radio_brand, this, _triggerChange$1).call(this);
+ }
+ }, {
+ key: "enable",
+ value: function enable() {
+ if (!_classPrivateFieldGet2(_options, this).disabled) return;
+ _classPrivateFieldGet2(_options, this).disabled = false;
+ _classPrivateFieldGet2(_input, this).disabled = false;
+ _classPrivateFieldGet2(_container$1, this).setAttribute("aria-disabled", "false");
+ if (_classPrivateFieldGet2(_options, this).checked) {
+ _classPrivateFieldGet2(_container$1, this).tabIndex = 0;
+ } else {
+ _assertClassBrand(_Radio_brand, this, _updateRadioGroupTabIndex).call(this);
+ }
+ _classPrivateFieldGet2(_container$1, this).classList.remove("radio--disabled");
+ }
+ }, {
+ key: "disable",
+ value: function disable() {
+ if (_classPrivateFieldGet2(_options, this).disabled) return;
+ _classPrivateFieldGet2(_options, this).disabled = true;
+ _classPrivateFieldGet2(_input, this).disabled = true;
+ _classPrivateFieldGet2(_container$1, this).setAttribute("aria-disabled", "true");
+ _classPrivateFieldGet2(_container$1, this).tabIndex = -1;
+ _classPrivateFieldGet2(_container$1, this).classList.add("radio--disabled");
+ }
+ }, {
+ key: "setLabel",
+ value: function setLabel(label) {
+ _classPrivateFieldGet2(_options, this).label = label;
+ if (_classPrivateFieldGet2(_labelElement, this)) {
+ _classPrivateFieldGet2(_labelElement, this).textContent = label;
+ } else if (label) {
+ _classPrivateFieldSet2(_labelElement, this, document.createElement("label"));
+ _classPrivateFieldGet2(_labelElement, this).className = "radio-label";
+ _classPrivateFieldGet2(_labelElement, this).htmlFor = String(_classPrivateFieldGet2(_options, this).id);
+ _classPrivateFieldGet2(_labelElement, this).textContent = label;
+ _classPrivateFieldGet2(_container$1, this).appendChild(_classPrivateFieldGet2(_labelElement, this));
+ }
+ }
+ }, {
+ key: "getState",
+ value: function getState() {
+ return {
+ checked: !!_classPrivateFieldGet2(_options, this).checked,
+ disabled: !!_classPrivateFieldGet2(_options, this).disabled,
+ value: _classPrivateFieldGet2(_options, this).value || "",
+ name: _classPrivateFieldGet2(_options, this).name || ""
+ };
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ var _this2 = this;
+ _classPrivateFieldSet2(_subscribers, this, []);
+ if (!_classPrivateFieldGet2(_options, this).name) return;
+ var sameNameInstances = _instances$1._.get(_classPrivateFieldGet2(_options, this).name);
+ if (sameNameInstances) {
+ var index = sameNameInstances.indexOf(this);
+ if (index >= 0) sameNameInstances.splice(index, 1);
+ }
+ _classPrivateFieldGet2(_handlers, this).forEach(function(handler, event) {
+ _classPrivateFieldGet2(_container$1, _this2).removeEventListener(event, handler);
+ });
+ _classPrivateFieldGet2(_handlers, this).clear();
+ if (_classPrivateFieldGet2(_container$1, this) && _classPrivateFieldGet2(_container$1, this).parentNode) {
+ _classPrivateFieldGet2(_container$1, this).parentNode.removeChild(_classPrivateFieldGet2(_container$1, this));
+ }
+ _classPrivateFieldSet2(_labelElement, this, null);
+ }
+ } ]);
+ }();
+ function _applyInputAttributes() {
+ _classPrivateFieldGet2(_input, this).type = "radio";
+ var elId = _classPrivateFieldGet2(_input, this).getAttribute("id");
+ var elName = _classPrivateFieldGet2(_input, this).getAttribute("name");
+ var elValue = _classPrivateFieldGet2(_input, this).getAttribute("value");
+ var elChecked = _classPrivateFieldGet2(_input, this).getAttribute("checked");
+ var elDisabled = _classPrivateFieldGet2(_input, this).getAttribute("disabled");
+ if (elId !== null) {
+ _classPrivateFieldGet2(_options, this).id = elId;
+ } else if (_classPrivateFieldGet2(_options, this).id) {
+ _classPrivateFieldGet2(_input, this).setAttribute("id", _classPrivateFieldGet2(_options, this).id);
+ }
+ if (elName !== null) {
+ _classPrivateFieldGet2(_options, this).name = elName;
+ } else if (_classPrivateFieldGet2(_options, this).name) {
+ _classPrivateFieldGet2(_input, this).setAttribute("name", _classPrivateFieldGet2(_options, this).name);
+ }
+ if (elValue !== null) {
+ _classPrivateFieldGet2(_options, this).value = elValue;
+ } else if (_classPrivateFieldGet2(_options, this).value) {
+ _classPrivateFieldGet2(_input, this).setAttribute("value", _classPrivateFieldGet2(_options, this).value);
+ }
+ if (elChecked !== null) {
+ _classPrivateFieldGet2(_options, this).checked = elChecked === "true";
+ } else if (_classPrivateFieldGet2(_options, this).checked) {
+ _classPrivateFieldGet2(_input, this).setAttribute("checked", "true");
+ }
+ if (elDisabled !== null) {
+ _classPrivateFieldGet2(_options, this).disabled = elDisabled === "true";
+ } else if (_classPrivateFieldGet2(_options, this).disabled) {
+ _classPrivateFieldGet2(_input, this).setAttribute("disabled", "true");
+ }
+ }
+ function _createDOM$2() {
+ var parent = _classPrivateFieldGet2(_input, this).parentNode;
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild(_classPrivateFieldGet2(_container$1, this));
+ _classPrivateFieldGet2(_container$1, this).classList.add("radio-button-container");
+ _classPrivateFieldGet2(_container$1, this).setAttribute("role", "radio");
+ _classPrivateFieldGet2(_container$1, this).setAttribute("aria-checked", String(!!_classPrivateFieldGet2(_options, this).checked));
+ _classPrivateFieldGet2(_container$1, this).setAttribute("aria-disabled", String(!!_classPrivateFieldGet2(_options, this).disabled));
+ _classPrivateFieldGet2(_container$1, this).tabIndex = _classPrivateFieldGet2(_options, this).disabled ? -1 : 0;
+ _classPrivateFieldGet2(_visualRadio, this).className = "radio-visual";
+ _classPrivateFieldGet2(_visualRadio, this).setAttribute("aria-hidden", "true");
+ if (_classPrivateFieldGet2(_options, this).label) {
+ _classPrivateFieldSet2(_labelElement, this, document.createElement("label"));
+ _classPrivateFieldGet2(_labelElement, this).className = "i18n radio-label";
+ _classPrivateFieldGet2(_labelElement, this).htmlFor = String(_classPrivateFieldGet2(_options, this).id);
+ _classPrivateFieldGet2(_labelElement, this).textContent = _classPrivateFieldGet2(_options, this).label;
+ }
+ if (_classPrivateFieldGet2(_options, this).disabled) {
+ _classPrivateFieldGet2(_container$1, this).classList.add("radio--disabled");
+ }
+ if (parent) {
+ parent.insertBefore(fragment, _classPrivateFieldGet2(_input, this));
+ }
+ _classPrivateFieldGet2(_container$1, this).appendChild(_classPrivateFieldGet2(_input, this));
+ _classPrivateFieldGet2(_container$1, this).appendChild(_classPrivateFieldGet2(_visualRadio, this));
+ if (_classPrivateFieldGet2(_labelElement, this)) {
+ _classPrivateFieldGet2(_container$1, this).appendChild(_classPrivateFieldGet2(_labelElement, this));
+ }
+ _assertClassBrand(_Radio_brand, this, _updateRadioGroupTabIndex).call(this);
+ }
+ function _updateRadioGroupTabIndex() {
+ var _this3 = this;
+ if (_classPrivateFieldGet2(_options, this).checked) {
+ _classPrivateFieldGet2(_container$1, this).tabIndex = _classPrivateFieldGet2(_options, this).disabled ? -1 : 0;
+ } else if (_classPrivateFieldGet2(_options, this).name && _instances$1._.has(_classPrivateFieldGet2(_options, this).name)) {
+ var radios = _instances$1._.get(_classPrivateFieldGet2(_options, this).name);
+ var hasChecked = false;
+ radios && radios.forEach(function(radio) {
+ if (_classPrivateFieldGet2(_options, radio).checked && radio !== _this3) {
+ hasChecked = true;
+ }
+ });
+ if (!hasChecked && !_classPrivateFieldGet2(_options, this).checked && !_classPrivateFieldGet2(_options, this).disabled) {
+ _classPrivateFieldGet2(_container$1, this).tabIndex = 0;
+ } else {
+ _classPrivateFieldGet2(_container$1, this).tabIndex = -1;
+ }
+ }
+ }
+ function _setupEventListeners() {
+ var _this4 = this;
+ var handleClick = function handleClick(e) {
+ e.preventDefault();
+ if (!_classPrivateFieldGet2(_options, _this4).disabled && !_classPrivateFieldGet2(_options, _this4).checked) {
+ _this4.check();
+ _classPrivateFieldGet2(_container$1, _this4).focus();
+ }
+ };
+ var handleKeyDown = function handleKeyDown(e) {
+ if (_classPrivateFieldGet2(_options, _this4).disabled) return;
+ switch (e.key) {
+ case " ":
+ case "Spacebar":
+ case "Enter":
+ e.preventDefault();
+ if (!_classPrivateFieldGet2(_options, _this4).checked) {
+ _this4.check();
+ }
+ break;
+ }
+ };
+ var handleFocus = function handleFocus() {
+ _classPrivateFieldGet2(_container$1, _this4).classList.add("radio--focused");
+ };
+ var handleBlur = function handleBlur() {
+ _classPrivateFieldGet2(_container$1, _this4).classList.remove("radio--focused");
+ };
+ _classPrivateFieldGet2(_handlers, this).set("click", handleClick);
+ _classPrivateFieldGet2(_handlers, this).set("keydown", handleKeyDown);
+ _classPrivateFieldGet2(_handlers, this).set("focus", handleFocus);
+ _classPrivateFieldGet2(_handlers, this).set("blur", handleBlur);
+ _classPrivateFieldGet2(_container$1, this).addEventListener("click", handleClick);
+ _classPrivateFieldGet2(_container$1, this).addEventListener("keydown", handleKeyDown);
+ _classPrivateFieldGet2(_container$1, this).addEventListener("focus", handleFocus);
+ _classPrivateFieldGet2(_container$1, this).addEventListener("blur", handleBlur);
+ }
+ function _updateVisualState() {
+ _classPrivateFieldGet2(_container$1, this).setAttribute("aria-checked", String(!!_classPrivateFieldGet2(_options, this).checked));
+ _classPrivateFieldGet2(_container$1, this).classList.toggle("radio--checked", _classPrivateFieldGet2(_options, this).checked);
+ _classPrivateFieldGet2(_input, this).checked = !!_classPrivateFieldGet2(_options, this).checked;
+ _assertClassBrand(_Radio_brand, this, _updateRadioGroupTabIndex).call(this);
+ }
+ function _triggerChange$1(e) {
+ var detail = this.getState();
+ var objEvent = {
+ type: "radio:change",
+ detail: detail
+ };
+ if (e) {
+ objEvent.originalEvent = e;
+ }
+ _classPrivateFieldGet2(_subscribers, this).forEach(function(cb) {
+ cb(objEvent);
+ });
+ }
+ var _instances$1 = {
+ _: new Map
+ };
+ function Checkbox(checkbox, options) {
+ if (typeof checkbox === "string") {
+ var temp = document.getElementById(checkbox);
+ if (temp instanceof HTMLInputElement) {
+ checkbox = temp;
+ }
+ }
+ if (checkbox instanceof HTMLInputElement === false) {
+ throw new Error("Invalid input element");
+ }
+ this._options = Object.assign({
+ id: "checkbox_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 11)),
+ checked: false,
+ disabled: false,
+ indeterminate: false,
+ label: "",
+ name: "",
+ value: "on"
+ }, options);
+ this._options.disabled = options.disabled || false;
+ this._handlers = new Map;
+ this._createDOM(checkbox);
+ this._setupEventListeners();
+ this._updateVisualState();
+ this._subscribers = [];
+ }
+ Checkbox.prototype = {
+ constructor: Checkbox,
+ _container: null,
+ _input: null,
+ _visualCheckbox: null,
+ _labelElement: null,
+ _createDOM: function _createDOM(checkbox) {
+ var parent = checkbox.parentNode;
+ var fragment = document.createDocumentFragment();
+ this._container = document.createElement("div");
+ fragment.appendChild(this._container);
+ this._container.classList.add("checkbox-container");
+ this._container.setAttribute("role", "checkbox");
+ this._container.setAttribute("aria-checked", this._options.checked ? "true" : "false");
+ this._container.setAttribute("aria-disabled", this._options.disabled ? "true" : "false");
+ this._container.tabIndex = this._options.disabled ? -1 : 0;
+ this._input = checkbox;
+ var elId = this._input.getAttribute("id");
+ if (elId !== null) {
+ this._options.id = elId;
+ } else if (this._options.id) {
+ this._input.setAttribute("id", this._options.id);
+ }
+ this._input.type = "checkbox";
+ if (this._options.name) {
+ this._input.name = this._options.name;
+ }
+ if (this._options.value) {
+ this._input.value = this._options.value;
+ }
+ this._input.checked = !!this._options.checked;
+ if (this._options.disabled) {
+ this._input.disabled = true;
+ }
+ if (this._options.indeterminate) {
+ this._input.indeterminate = true;
+ }
+ this._visualCheckbox = document.createElement("span");
+ this._visualCheckbox.className = "checkbox-visual";
+ this._visualCheckbox.setAttribute("aria-hidden", "true");
+ var svgNS = "http://www.w3.org/2000/svg";
+ var checkmarkSVG = document.createElementNS(svgNS, "svg");
+ checkmarkSVG.setAttribute("viewBox", "0 0 10 8");
+ checkmarkSVG.setAttribute("class", "checkbox-checkmark");
+ var path = document.createElementNS(svgNS, "path");
+ path.setAttribute("d", "M0.682129 3.40702L3.68213 6.20702L9.18218 0.707116");
+ path.setAttribute("fill", "none");
+ path.setAttribute("stroke", "currentColor");
+ path.setAttribute("stroke-width", "2");
+ checkmarkSVG.appendChild(path);
+ this._visualCheckbox.appendChild(checkmarkSVG);
+ var indeterminateLine = document.createElement("span");
+ indeterminateLine.className = "checkbox-indeterminate";
+ this._visualCheckbox.appendChild(indeterminateLine);
+ if (this._options.label) {
+ this._labelElement = document.createElement("label");
+ this._labelElement.className = "checkbox-label i18n";
+ if (this._options.id) this._labelElement.htmlFor = this._options.id;
+ this._labelElement.textContent = this._options.label;
+ if (this._options.title) {
+ this._labelElement.setAttribute("title", this._options.label);
+ }
+ }
+ if (this._options.disabled) {
+ this._container.classList.add("checkbox--disabled");
+ }
+ if (parent) {
+ parent.insertBefore(fragment, checkbox);
+ }
+ this._container.appendChild(this._input);
+ this._container.appendChild(this._visualCheckbox);
+ if (this._labelElement) {
+ this._container.appendChild(this._labelElement);
+ }
+ },
+ _setupEventListeners: function _setupEventListeners() {
+ var self = this;
+ if (!this._container) return;
+ var handleClick = function handleClick(e) {
+ e.preventDefault();
+ if (!self._options.disabled && self._container) {
+ self.toggle();
+ self._container.focus();
+ }
+ };
+ var handleKeyDown = function handleKeyDown(e) {
+ if (self._options.disabled) return;
+ switch (e.key) {
+ case " ":
+ case "Spacebar":
+ case "Enter":
+ e.preventDefault();
+ self.toggle();
+ break;
+
+ case "ArrowRight":
+ case "ArrowDown":
+ e.preventDefault();
+ if (!self._options.checked && !self._options.indeterminate) {
+ self._options.checked ? self.setIndeterminate() : self.check();
+ }
+ break;
+
+ case "ArrowLeft":
+ case "ArrowUp":
+ e.preventDefault();
+ if (self._options.checked || self._options.indeterminate) {
+ self._options.indeterminate ? self.uncheck() : self.setIndeterminate();
+ }
+ break;
+ }
+ };
+ var handleFocus = function handleFocus() {
+ if (!self._container) return;
+ self._container.classList.add("checkbox--focused");
+ };
+ var handleBlur = function handleBlur() {
+ if (!self._container) return;
+ self._container.classList.remove("checkbox--focused");
+ };
+ this._handlers.set("click", handleClick);
+ this._handlers.set("keydown", handleKeyDown);
+ this._handlers.set("focus", handleFocus);
+ this._handlers.set("blur", handleBlur);
+ this._container.addEventListener("click", handleClick);
+ this._container.addEventListener("keydown", handleKeyDown);
+ this._container.addEventListener("focus", handleFocus);
+ this._container.addEventListener("blur", handleBlur);
+ },
+ _updateVisualState: function _updateVisualState() {
+ if (!this._container || !this._input) return;
+ this._container.setAttribute("aria-checked", this._options.indeterminate ? "mixed" : String(this._options.checked));
+ this._container.classList.toggle("checkbox--checked", this._options.checked);
+ this._container.classList.toggle("checkbox--indeterminate", this._options.indeterminate);
+ this._input.checked = !!this._options.checked;
+ this._input.indeterminate = !!this._options.indeterminate;
+ },
+ toggle: function toggle() {
+ if (this._options.disabled) return !!this._options.checked;
+ if (this._options.indeterminate) {
+ this._options.indeterminate = false;
+ this._options.checked = true;
+ } else {
+ this._options.checked = !this._options.checked;
+ }
+ this._updateVisualState();
+ this._triggerChange();
+ return this._options.checked;
+ },
+ check: function check(bSilent) {
+ if (this._options.disabled || this._options.checked && !this._options.indeterminate) return;
+ this._options.checked = true;
+ this._options.indeterminate = false;
+ this._updateVisualState();
+ if (!bSilent) this._triggerChange();
+ },
+ uncheck: function uncheck(bSilent) {
+ if (this._options.disabled || !this._options.checked && !this._options.indeterminate) return;
+ this._options.checked = false;
+ this._options.indeterminate = false;
+ this._updateVisualState();
+ if (!bSilent) this._triggerChange();
+ },
+ setIndeterminate: function setIndeterminate() {
+ if (this._options.disabled || this._options.indeterminate) return;
+ this._options.indeterminate = true;
+ this._updateVisualState();
+ this._triggerChange();
+ },
+ enable: function enable() {
+ if (!this._options.disabled || !this._container || !this._input) return;
+ this._options.disabled = false;
+ this._input.disabled = false;
+ this._container.setAttribute("aria-disabled", "false");
+ this._container.tabIndex = 0;
+ this._container.classList.remove("checkbox--disabled");
+ },
+ disable: function disable() {
+ if (this._options.disabled || !this._container || !this._input) return;
+ this._options.disabled = true;
+ this._input.disabled = true;
+ this._container.setAttribute("aria-disabled", "true");
+ this._container.tabIndex = -1;
+ this._container.classList.add("checkbox--disabled");
+ },
+ setLabel: function setLabel(label) {
+ this._options.label = label;
+ if (this._labelElement) {
+ this._labelElement.textContent = label;
+ } else if (label && this._container) {
+ this._labelElement = document.createElement("label");
+ this._labelElement.className = "checkbox-label";
+ if (this._options.id) this._labelElement.htmlFor = this._options.id;
+ this._labelElement.textContent = label;
+ this._container.appendChild(this._labelElement);
+ }
+ if (this._options.title && this._labelElement) {
+ this._labelElement.setAttribute("title", label);
+ }
+ },
+ getState: function getState() {
+ if (this._input) {
+ return {
+ checked: this._input.checked,
+ disabled: this._input.disabled,
+ value: this._input.value
+ };
+ }
+ return {
+ checked: false,
+ disabled: false,
+ value: ""
+ };
+ },
+ subscribe: function subscribe(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ },
+ _triggerChange: function _triggerChange(e) {
+ var detail = this.getState();
+ var objEvent = {
+ type: "checkbox:change",
+ detail: detail
+ };
+ if (e) {
+ objEvent.originalEvent = e;
+ }
+ this._subscribers.forEach(function(cb) {
+ cb(objEvent);
+ });
+ },
+ destroy: function destroy() {
+ var _this = this;
+ this._subscribers = [];
+ this._handlers.forEach(function(handler, event) {
+ _this._container && _this._container.removeEventListener(event, handler);
+ });
+ this._handlers.clear();
+ if (this._container && this._container.parentNode) {
+ this._container.parentNode.removeChild(this._container);
+ }
+ this._container = null;
+ this._input = null;
+ this._visualCheckbox = null;
+ this._labelElement = null;
+ }
+ };
+ var es_symbol = {};
+ var es_symbol_constructor = {};
+ var wellKnownSymbolWrapped = {};
+ var hasRequiredWellKnownSymbolWrapped;
+ function requireWellKnownSymbolWrapped() {
+ if (hasRequiredWellKnownSymbolWrapped) return wellKnownSymbolWrapped;
+ hasRequiredWellKnownSymbolWrapped = 1;
+ var wellKnownSymbol = requireWellKnownSymbol();
+ wellKnownSymbolWrapped.f = wellKnownSymbol;
+ return wellKnownSymbolWrapped;
+ }
+ var wellKnownSymbolDefine;
+ var hasRequiredWellKnownSymbolDefine;
+ function requireWellKnownSymbolDefine() {
+ if (hasRequiredWellKnownSymbolDefine) return wellKnownSymbolDefine;
+ hasRequiredWellKnownSymbolDefine = 1;
+ var path = requirePath();
+ var hasOwn = requireHasOwnProperty();
+ var wrappedWellKnownSymbolModule = requireWellKnownSymbolWrapped();
+ var defineProperty = requireObjectDefineProperty().f;
+ wellKnownSymbolDefine = function(NAME) {
+ var Symbol = path.Symbol || (path.Symbol = {});
+ if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
+ value: wrappedWellKnownSymbolModule.f(NAME)
+ });
+ };
+ return wellKnownSymbolDefine;
+ }
+ var symbolDefineToPrimitive;
+ var hasRequiredSymbolDefineToPrimitive;
+ function requireSymbolDefineToPrimitive() {
+ if (hasRequiredSymbolDefineToPrimitive) return symbolDefineToPrimitive;
+ hasRequiredSymbolDefineToPrimitive = 1;
+ var call = requireFunctionCall();
+ var getBuiltIn = requireGetBuiltIn();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var defineBuiltIn = requireDefineBuiltIn();
+ symbolDefineToPrimitive = function() {
+ var Symbol = getBuiltIn("Symbol");
+ var SymbolPrototype = Symbol && Symbol.prototype;
+ var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
+ var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
+ if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
+ defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function(hint) {
+ return call(valueOf, this);
+ }, {
+ arity: 1
+ });
+ }
+ };
+ return symbolDefineToPrimitive;
+ }
+ var hasRequiredEs_symbol_constructor;
+ function requireEs_symbol_constructor() {
+ if (hasRequiredEs_symbol_constructor) return es_symbol_constructor;
+ hasRequiredEs_symbol_constructor = 1;
+ var $ = require_export();
+ var globalThis = requireGlobalThis();
+ var call = requireFunctionCall();
+ var uncurryThis = requireFunctionUncurryThis();
+ var IS_PURE = requireIsPure();
+ var DESCRIPTORS = requireDescriptors();
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ var fails = requireFails();
+ var hasOwn = requireHasOwnProperty();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var anObject = requireAnObject();
+ var toIndexedObject = requireToIndexedObject();
+ var toPropertyKey = requireToPropertyKey();
+ var $toString = requireToString();
+ var createPropertyDescriptor = requireCreatePropertyDescriptor();
+ var nativeObjectCreate = requireObjectCreate();
+ var objectKeys = requireObjectKeys();
+ var getOwnPropertyNamesModule = requireObjectGetOwnPropertyNames();
+ var getOwnPropertyNamesExternal = requireObjectGetOwnPropertyNamesExternal();
+ var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
+ var getOwnPropertyDescriptorModule = requireObjectGetOwnPropertyDescriptor();
+ var definePropertyModule = requireObjectDefineProperty();
+ var definePropertiesModule = requireObjectDefineProperties();
+ var propertyIsEnumerableModule = requireObjectPropertyIsEnumerable();
+ var defineBuiltIn = requireDefineBuiltIn();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var shared = requireShared();
+ var sharedKey = requireSharedKey();
+ var hiddenKeys = requireHiddenKeys();
+ var uid = requireUid();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var wrappedWellKnownSymbolModule = requireWellKnownSymbolWrapped();
+ var defineWellKnownSymbol = requireWellKnownSymbolDefine();
+ var defineSymbolToPrimitive = requireSymbolDefineToPrimitive();
+ var setToStringTag = requireSetToStringTag();
+ var InternalStateModule = requireInternalState();
+ var $forEach = requireArrayIteration().forEach;
+ var HIDDEN = sharedKey("hidden");
+ var SYMBOL = "Symbol";
+ var PROTOTYPE = "prototype";
+ var setInternalState = InternalStateModule.set;
+ var getInternalState = InternalStateModule.getterFor(SYMBOL);
+ var ObjectPrototype = Object[PROTOTYPE];
+ var $Symbol = globalThis.Symbol;
+ var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
+ var RangeError = globalThis.RangeError;
+ var TypeError = globalThis.TypeError;
+ var QObject = globalThis.QObject;
+ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+ var nativeDefineProperty = definePropertyModule.f;
+ var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
+ var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
+ var push = uncurryThis([].push);
+ var AllSymbols = shared("symbols");
+ var ObjectPrototypeSymbols = shared("op-symbols");
+ var WellKnownSymbolsStore = shared("wks");
+ var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
+ var fallbackDefineProperty = function(O, P, Attributes) {
+ var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
+ if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
+ nativeDefineProperty(O, P, Attributes);
+ if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
+ nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
+ }
+ };
+ var setSymbolDescriptor = DESCRIPTORS && fails(function() {
+ return nativeObjectCreate(nativeDefineProperty({}, "a", {
+ get: function() {
+ return nativeDefineProperty(this, "a", {
+ value: 7
+ }).a;
+ }
+ })).a !== 7;
+ }) ? fallbackDefineProperty : nativeDefineProperty;
+ var wrap = function(tag, description) {
+ var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
+ setInternalState(symbol, {
+ type: SYMBOL,
+ tag: tag,
+ description: description
+ });
+ if (!DESCRIPTORS) symbol.description = description;
+ return symbol;
+ };
+ var $defineProperty = function defineProperty(O, P, Attributes) {
+ if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
+ anObject(O);
+ var key = toPropertyKey(P);
+ anObject(Attributes);
+ if (hasOwn(AllSymbols, key)) {
+ if (!Attributes.enumerable) {
+ if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, nativeObjectCreate(null)));
+ O[HIDDEN][key] = true;
+ } else {
+ if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
+ Attributes = nativeObjectCreate(Attributes, {
+ enumerable: createPropertyDescriptor(0, false)
+ });
+ }
+ return setSymbolDescriptor(O, key, Attributes);
+ }
+ return nativeDefineProperty(O, key, Attributes);
+ };
+ var $defineProperties = function defineProperties(O, Properties) {
+ anObject(O);
+ var properties = toIndexedObject(Properties);
+ var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
+ $forEach(keys, function(key) {
+ if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
+ });
+ return O;
+ };
+ var $create = function create(O, Properties) {
+ return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
+ };
+ var $propertyIsEnumerable = function propertyIsEnumerable(V) {
+ var P = toPropertyKey(V);
+ var enumerable = call(nativePropertyIsEnumerable, this, P);
+ if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
+ return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
+ };
+ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
+ var it = toIndexedObject(O);
+ var key = toPropertyKey(P);
+ if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
+ var descriptor = nativeGetOwnPropertyDescriptor(it, key);
+ if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
+ descriptor.enumerable = true;
+ }
+ return descriptor;
+ };
+ var $getOwnPropertyNames = function getOwnPropertyNames(O) {
+ var names = nativeGetOwnPropertyNames(toIndexedObject(O));
+ var result = [];
+ $forEach(names, function(key) {
+ if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
+ });
+ return result;
+ };
+ var $getOwnPropertySymbols = function(O) {
+ var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
+ var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
+ var result = [];
+ $forEach(names, function(key) {
+ if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
+ push(result, AllSymbols[key]);
+ }
+ });
+ return result;
+ };
+ if (!NATIVE_SYMBOL) {
+ $Symbol = function Symbol() {
+ if (isPrototypeOf(SymbolPrototype, this)) throw new TypeError("Symbol is not a constructor");
+ var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
+ var tag = uid(description);
+ var setter = function(value) {
+ var $this = this === undefined ? globalThis : this;
+ if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
+ if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false;
+ var descriptor = createPropertyDescriptor(1, value);
+ try {
+ setSymbolDescriptor($this, tag, descriptor);
+ } catch (error) {
+ if (!(error instanceof RangeError)) throw error;
+ fallbackDefineProperty($this, tag, descriptor);
+ }
+ };
+ if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, {
+ configurable: true,
+ set: setter
+ });
+ return wrap(tag, description);
+ };
+ SymbolPrototype = $Symbol[PROTOTYPE];
+ defineBuiltIn(SymbolPrototype, "toString", function toString() {
+ return getInternalState(this).tag;
+ });
+ defineBuiltIn($Symbol, "withoutSetter", function(description) {
+ return wrap(uid(description), description);
+ });
+ propertyIsEnumerableModule.f = $propertyIsEnumerable;
+ definePropertyModule.f = $defineProperty;
+ definePropertiesModule.f = $defineProperties;
+ getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
+ getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
+ getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
+ wrappedWellKnownSymbolModule.f = function(name) {
+ return wrap(wellKnownSymbol(name), name);
+ };
+ if (DESCRIPTORS) {
+ defineBuiltInAccessor(SymbolPrototype, "description", {
+ configurable: true,
+ get: function description() {
+ return getInternalState(this).description;
+ }
+ });
+ if (!IS_PURE) {
+ defineBuiltIn(ObjectPrototype, "propertyIsEnumerable", $propertyIsEnumerable, {
+ unsafe: true
+ });
+ }
+ }
+ }
+ $({
+ global: true,
+ constructor: true,
+ wrap: true,
+ forced: !NATIVE_SYMBOL,
+ sham: !NATIVE_SYMBOL
+ }, {
+ Symbol: $Symbol
+ });
+ $forEach(objectKeys(WellKnownSymbolsStore), function(name) {
+ defineWellKnownSymbol(name);
+ });
+ $({
+ target: SYMBOL,
+ stat: true,
+ forced: !NATIVE_SYMBOL
+ }, {
+ useSetter: function() {
+ USE_SETTER = true;
+ },
+ useSimple: function() {
+ USE_SETTER = false;
+ }
+ });
+ $({
+ target: "Object",
+ stat: true,
+ forced: !NATIVE_SYMBOL,
+ sham: !DESCRIPTORS
+ }, {
+ create: $create,
+ defineProperty: $defineProperty,
+ defineProperties: $defineProperties,
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor
+ });
+ $({
+ target: "Object",
+ stat: true,
+ forced: !NATIVE_SYMBOL
+ }, {
+ getOwnPropertyNames: $getOwnPropertyNames
+ });
+ defineSymbolToPrimitive();
+ setToStringTag($Symbol, SYMBOL);
+ hiddenKeys[HIDDEN] = true;
+ return es_symbol_constructor;
+ }
+ var es_symbol_for = {};
+ var symbolRegistryDetection;
+ var hasRequiredSymbolRegistryDetection;
+ function requireSymbolRegistryDetection() {
+ if (hasRequiredSymbolRegistryDetection) return symbolRegistryDetection;
+ hasRequiredSymbolRegistryDetection = 1;
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ symbolRegistryDetection = NATIVE_SYMBOL && !!Symbol["for"] && !!Symbol.keyFor;
+ return symbolRegistryDetection;
+ }
+ var hasRequiredEs_symbol_for;
+ function requireEs_symbol_for() {
+ if (hasRequiredEs_symbol_for) return es_symbol_for;
+ hasRequiredEs_symbol_for = 1;
+ var $ = require_export();
+ var getBuiltIn = requireGetBuiltIn();
+ var hasOwn = requireHasOwnProperty();
+ var toString = requireToString();
+ var shared = requireShared();
+ var NATIVE_SYMBOL_REGISTRY = requireSymbolRegistryDetection();
+ var StringToSymbolRegistry = shared("string-to-symbol-registry");
+ var SymbolToStringRegistry = shared("symbol-to-string-registry");
+ $({
+ target: "Symbol",
+ stat: true,
+ forced: !NATIVE_SYMBOL_REGISTRY
+ }, {
+ for: function(key) {
+ var string = toString(key);
+ if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
+ var symbol = getBuiltIn("Symbol")(string);
+ StringToSymbolRegistry[string] = symbol;
+ SymbolToStringRegistry[symbol] = string;
+ return symbol;
+ }
+ });
+ return es_symbol_for;
+ }
+ var es_symbol_keyFor = {};
+ var hasRequiredEs_symbol_keyFor;
+ function requireEs_symbol_keyFor() {
+ if (hasRequiredEs_symbol_keyFor) return es_symbol_keyFor;
+ hasRequiredEs_symbol_keyFor = 1;
+ var $ = require_export();
+ var hasOwn = requireHasOwnProperty();
+ var isSymbol = requireIsSymbol();
+ var tryToString = requireTryToString();
+ var shared = requireShared();
+ var NATIVE_SYMBOL_REGISTRY = requireSymbolRegistryDetection();
+ var SymbolToStringRegistry = shared("symbol-to-string-registry");
+ $({
+ target: "Symbol",
+ stat: true,
+ forced: !NATIVE_SYMBOL_REGISTRY
+ }, {
+ keyFor: function keyFor(sym) {
+ if (!isSymbol(sym)) throw new TypeError(tryToString(sym) + " is not a symbol");
+ if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
+ }
+ });
+ return es_symbol_keyFor;
+ }
+ var es_json_stringify = {};
+ var isRawJson;
+ var hasRequiredIsRawJson;
+ function requireIsRawJson() {
+ if (hasRequiredIsRawJson) return isRawJson;
+ hasRequiredIsRawJson = 1;
+ var isObject = requireIsObject();
+ var getInternalState = requireInternalState().get;
+ isRawJson = function isRawJSON(O) {
+ if (!isObject(O)) return false;
+ var state = getInternalState(O);
+ return !!state && state.type === "RawJSON";
+ };
+ return isRawJson;
+ }
+ var parseJsonString;
+ var hasRequiredParseJsonString;
+ function requireParseJsonString() {
+ if (hasRequiredParseJsonString) return parseJsonString;
+ hasRequiredParseJsonString = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var hasOwn = requireHasOwnProperty();
+ var $SyntaxError = SyntaxError;
+ var $parseInt = parseInt;
+ var fromCharCode = String.fromCharCode;
+ var at = uncurryThis("".charAt);
+ var slice = uncurryThis("".slice);
+ var exec = uncurryThis(/./.exec);
+ var codePoints = {
+ '\\"': '"',
+ "\\\\": "\\",
+ "\\/": "/",
+ "\\b": "\b",
+ "\\f": "\f",
+ "\\n": "\n",
+ "\\r": "\r",
+ "\\t": "\t"
+ };
+ var IS_4_HEX_DIGITS = /^[\da-f]{4}$/i;
+ var IS_C0_CONTROL_CODE = /^[\u0000-\u001F]$/;
+ parseJsonString = function(source, i) {
+ var unterminated = true;
+ var value = "";
+ while (i < source.length) {
+ var chr = at(source, i);
+ if (chr === "\\") {
+ var twoChars = slice(source, i, i + 2);
+ if (hasOwn(codePoints, twoChars)) {
+ value += codePoints[twoChars];
+ i += 2;
+ } else if (twoChars === "\\u") {
+ i += 2;
+ var fourHexDigits = slice(source, i, i + 4);
+ if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError("Bad Unicode escape at: " + i);
+ value += fromCharCode($parseInt(fourHexDigits, 16));
+ i += 4;
+ } else throw new $SyntaxError('Unknown escape sequence: "' + twoChars + '"');
+ } else if (chr === '"') {
+ unterminated = false;
+ i++;
+ break;
+ } else {
+ if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError("Bad control character in string literal at: " + i);
+ value += chr;
+ i++;
+ }
+ }
+ if (unterminated) throw new $SyntaxError("Unterminated string at: " + i);
+ return {
+ value: value,
+ end: i
+ };
+ };
+ return parseJsonString;
+ }
+ var nativeRawJson;
+ var hasRequiredNativeRawJson;
+ function requireNativeRawJson() {
+ if (hasRequiredNativeRawJson) return nativeRawJson;
+ hasRequiredNativeRawJson = 1;
+ var fails = requireFails();
+ nativeRawJson = !fails(function() {
+ var unsafeInt = "9007199254740993";
+ var raw = JSON.rawJSON(unsafeInt);
+ return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt;
+ });
+ return nativeRawJson;
+ }
+ var hasRequiredEs_json_stringify;
+ function requireEs_json_stringify() {
+ if (hasRequiredEs_json_stringify) return es_json_stringify;
+ hasRequiredEs_json_stringify = 1;
+ var $ = require_export();
+ var getBuiltIn = requireGetBuiltIn();
+ var apply = requireFunctionApply();
+ var call = requireFunctionCall();
+ var uncurryThis = requireFunctionUncurryThis();
+ var fails = requireFails();
+ var isArray = requireIsArray();
+ var isCallable = requireIsCallable();
+ var isRawJSON = requireIsRawJson();
+ var isSymbol = requireIsSymbol();
+ var classof = requireClassofRaw();
+ var toString = requireToString();
+ var arraySlice = requireArraySlice();
+ var parseJSONString = requireParseJsonString();
+ var uid = requireUid();
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ var NATIVE_RAW_JSON = requireNativeRawJson();
+ var $String = String;
+ var $stringify = getBuiltIn("JSON", "stringify");
+ var exec = uncurryThis(/./.exec);
+ var charAt = uncurryThis("".charAt);
+ var charCodeAt = uncurryThis("".charCodeAt);
+ var replace = uncurryThis("".replace);
+ var slice = uncurryThis("".slice);
+ var push = uncurryThis([].push);
+ var numberToString = uncurryThis(1.1.toString);
+ var surrogates = /[\uD800-\uDFFF]/g;
+ var lowSurrogates = /^[\uD800-\uDBFF]$/;
+ var hiSurrogates = /^[\uDC00-\uDFFF]$/;
+ var MARK = uid();
+ var MARK_LENGTH = MARK.length;
+ var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function() {
+ var symbol = getBuiltIn("Symbol")("stringify detection");
+ return $stringify([ symbol ]) !== "[null]" || $stringify({
+ a: symbol
+ }) !== "{}" || $stringify(Object(symbol)) !== "{}";
+ });
+ var ILL_FORMED_UNICODE = fails(function() {
+ return $stringify("\udf06\ud834") !== '"\\udf06\\ud834"' || $stringify("\udead") !== '"\\udead"';
+ });
+ var stringifyWithProperSymbolsConversion = WRONG_SYMBOLS_CONVERSION ? function(it, replacer) {
+ var args = arraySlice(arguments);
+ var $replacer = getReplacerFunction(replacer);
+ if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return;
+ args[1] = function(key, value) {
+ if (isCallable($replacer)) value = call($replacer, this, $String(key), value);
+ if (!isSymbol(value)) return value;
+ };
+ return apply($stringify, null, args);
+ } : $stringify;
+ var fixIllFormedJSON = function(match, offset, string) {
+ var prev = charAt(string, offset - 1);
+ var next = charAt(string, offset + 1);
+ if (exec(lowSurrogates, match) && !exec(hiSurrogates, next) || exec(hiSurrogates, match) && !exec(lowSurrogates, prev)) {
+ return "\\u" + numberToString(charCodeAt(match, 0), 16);
+ }
+ return match;
+ };
+ var getReplacerFunction = function(replacer) {
+ if (isCallable(replacer)) return replacer;
+ if (!isArray(replacer)) return;
+ var rawLength = replacer.length;
+ var keys = [];
+ for (var i = 0; i < rawLength; i++) {
+ var element = replacer[i];
+ if (typeof element == "string") push(keys, element); else if (typeof element == "number" || classof(element) === "Number" || classof(element) === "String") push(keys, toString(element));
+ }
+ var keysLength = keys.length;
+ var root = true;
+ return function(key, value) {
+ if (root) {
+ root = false;
+ return value;
+ }
+ if (isArray(this)) return value;
+ for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;
+ };
+ };
+ if ($stringify) $({
+ target: "JSON",
+ stat: true,
+ arity: 3,
+ forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON
+ }, {
+ stringify: function stringify(text, replacer, space) {
+ var replacerFunction = getReplacerFunction(replacer);
+ var rawStrings = [];
+ var json = stringifyWithProperSymbolsConversion(text, function(key, value) {
+ var v = isCallable(replacerFunction) ? call(replacerFunction, this, $String(key), value) : value;
+ return !NATIVE_RAW_JSON && isRawJSON(v) ? MARK + (push(rawStrings, v.rawJSON) - 1) : v;
+ }, space);
+ if (typeof json != "string") return json;
+ if (ILL_FORMED_UNICODE) json = replace(json, surrogates, fixIllFormedJSON);
+ if (NATIVE_RAW_JSON) return json;
+ var result = "";
+ var length = json.length;
+ for (var i = 0; i < length; i++) {
+ var chr = charAt(json, i);
+ if (chr === '"') {
+ var end = parseJSONString(json, ++i).end - 1;
+ var string = slice(json, i, end);
+ result += slice(string, 0, MARK_LENGTH) === MARK ? rawStrings[slice(string, MARK_LENGTH)] : '"' + string + '"';
+ i = end;
+ } else result += chr;
+ }
+ return result;
+ }
+ });
+ return es_json_stringify;
+ }
+ var es_object_getOwnPropertySymbols = {};
+ var hasRequiredEs_object_getOwnPropertySymbols;
+ function requireEs_object_getOwnPropertySymbols() {
+ if (hasRequiredEs_object_getOwnPropertySymbols) return es_object_getOwnPropertySymbols;
+ hasRequiredEs_object_getOwnPropertySymbols = 1;
+ var $ = require_export();
+ var NATIVE_SYMBOL = requireSymbolConstructorDetection();
+ var fails = requireFails();
+ var getOwnPropertySymbolsModule = requireObjectGetOwnPropertySymbols();
+ var toObject = requireToObject();
+ var FORCED = !NATIVE_SYMBOL || fails(function() {
+ getOwnPropertySymbolsModule.f(1);
+ });
+ $({
+ target: "Object",
+ stat: true,
+ forced: FORCED
+ }, {
+ getOwnPropertySymbols: function getOwnPropertySymbols(it) {
+ var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
+ }
+ });
+ return es_object_getOwnPropertySymbols;
+ }
+ var hasRequiredEs_symbol;
+ function requireEs_symbol() {
+ if (hasRequiredEs_symbol) return es_symbol;
+ hasRequiredEs_symbol = 1;
+ requireEs_symbol_constructor();
+ requireEs_symbol_for();
+ requireEs_symbol_keyFor();
+ requireEs_json_stringify();
+ requireEs_object_getOwnPropertySymbols();
+ return es_symbol;
+ }
+ requireEs_symbol();
+ var es_symbol_description = {};
+ var hasRequiredEs_symbol_description;
+ function requireEs_symbol_description() {
+ if (hasRequiredEs_symbol_description) return es_symbol_description;
+ hasRequiredEs_symbol_description = 1;
+ var $ = require_export();
+ var DESCRIPTORS = requireDescriptors();
+ var globalThis = requireGlobalThis();
+ var uncurryThis = requireFunctionUncurryThis();
+ var hasOwn = requireHasOwnProperty();
+ var isCallable = requireIsCallable();
+ var isPrototypeOf = requireObjectIsPrototypeOf();
+ var toString = requireToString();
+ var defineBuiltInAccessor = requireDefineBuiltInAccessor();
+ var copyConstructorProperties = requireCopyConstructorProperties();
+ var NativeSymbol = globalThis.Symbol;
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
+ if (DESCRIPTORS && isCallable(NativeSymbol) && (!("description" in SymbolPrototype) || NativeSymbol().description !== undefined)) {
+ var EmptyStringDescriptionStore = {};
+ var SymbolWrapper = function Symbol() {
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
+ var result = isPrototypeOf(SymbolPrototype, this) ? new NativeSymbol(description) : description === undefined ? NativeSymbol() : NativeSymbol(description);
+ if (description === "") EmptyStringDescriptionStore[result] = true;
+ return result;
+ };
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
+ SymbolWrapper.prototype = SymbolPrototype;
+ SymbolPrototype.constructor = SymbolWrapper;
+ var NATIVE_SYMBOL = String(NativeSymbol("description detection")) === "Symbol(description detection)";
+ var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);
+ var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
+ var replace = uncurryThis("".replace);
+ var stringSlice = uncurryThis("".slice);
+ defineBuiltInAccessor(SymbolPrototype, "description", {
+ configurable: true,
+ get: function description() {
+ var symbol = thisSymbolValue(this);
+ if (hasOwn(EmptyStringDescriptionStore, symbol)) return "";
+ var string = symbolDescriptiveString(symbol);
+ var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, "$1");
+ return desc === "" ? undefined : desc;
+ }
+ });
+ $({
+ global: true,
+ constructor: true,
+ forced: true
+ }, {
+ Symbol: SymbolWrapper
+ });
+ }
+ return es_symbol_description;
+ }
+ requireEs_symbol_description();
+ var es_array_find = {};
+ var hasRequiredEs_array_find;
+ function requireEs_array_find() {
+ if (hasRequiredEs_array_find) return es_array_find;
+ hasRequiredEs_array_find = 1;
+ var $ = require_export();
+ var $find = requireArrayIteration().find;
+ var addToUnscopables = requireAddToUnscopables();
+ var FIND = "find";
+ var SKIPS_HOLES = true;
+ if (FIND in []) Array(1)[FIND](function() {
+ SKIPS_HOLES = false;
+ });
+ $({
+ target: "Array",
+ proto: true,
+ forced: SKIPS_HOLES
+ }, {
+ find: function find(callbackfn) {
+ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+ });
+ addToUnscopables(FIND);
+ return es_array_find;
+ }
+ requireEs_array_find();
+ var es_array_from = {};
+ var hasRequiredEs_array_from;
+ function requireEs_array_from() {
+ if (hasRequiredEs_array_from) return es_array_from;
+ hasRequiredEs_array_from = 1;
+ var $ = require_export();
+ var from = requireArrayFrom();
+ var checkCorrectnessOfIteration = requireCheckCorrectnessOfIteration();
+ var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function(iterable) {
+ Array.from(iterable);
+ });
+ $({
+ target: "Array",
+ stat: true,
+ forced: INCORRECT_ITERATION
+ }, {
+ from: from
+ });
+ return es_array_from;
+ }
+ requireEs_array_from();
+ var es_set = {};
+ var es_set_constructor = {};
+ var hasRequiredEs_set_constructor;
+ function requireEs_set_constructor() {
+ if (hasRequiredEs_set_constructor) return es_set_constructor;
+ hasRequiredEs_set_constructor = 1;
+ var collection = requireCollection();
+ var collectionStrong = requireCollectionStrong();
+ collection("Set", function(init) {
+ return function Set() {
+ return init(this, arguments.length ? arguments[0] : undefined);
+ };
+ }, collectionStrong);
+ return es_set_constructor;
+ }
+ var hasRequiredEs_set;
+ function requireEs_set() {
+ if (hasRequiredEs_set) return es_set;
+ hasRequiredEs_set = 1;
+ requireEs_set_constructor();
+ return es_set;
+ }
+ requireEs_set();
+ var _SelectBox_brand = new WeakSet;
+ var SelectBox = function() {
+ function SelectBox(container, options) {
+ var _this = this;
+ _classCallCheck(this, SelectBox);
+ _classPrivateMethodInitSpec(this, _SelectBox_brand);
+ if (typeof container === "string") {
+ var _temp = document.getElementById(container);
+ if (_temp instanceof HTMLElement) {
+ container = _temp;
+ }
+ }
+ if (container instanceof HTMLElement) {
+ this._container = container;
+ } else {
+ throw new Error("Invalid container");
+ }
+ this._options = Object.assign(options, {
+ placeholder: options.placeholder || "Select...",
+ searchable: options.searchable || false,
+ multiple: options.multiple || false,
+ description: options.description || ""
+ });
+ this._selectedValues = new Set;
+ this.isOpen = false;
+ this._items = [];
+ this._customItems = [];
+ this._subscribers = [];
+ this._boundHandles = {
+ toggle: function toggle(e) {
+ _assertClassBrand(_SelectBox_brand, _this, _toggle).call(_this, e);
+ },
+ search: function search(e) {
+ _assertClassBrand(_SelectBox_brand, _this, _handleSearch).call(_this, e);
+ },
+ close: function close(e) {
+ if (e.target instanceof HTMLElement && !_this._container.contains(e.target) && !e.target.classList.contains("selectbox-option")) {
+ _assertClassBrand(_SelectBox_brand, _this, _closeDropdown).call(_this);
+ }
+ },
+ keydown: function keydown(e) {
+ _assertClassBrand(_SelectBox_brand, _this, _handleKeydown).call(_this, e);
+ },
+ dropdownClick: function dropdownClick(e) {
+ _assertClassBrand(_SelectBox_brand, _this, _handleDropdownClick).call(_this, e);
+ }
+ };
+ this._optionsContainer = null;
+ this.searchInput = null;
+ this._select = document.createElement("div");
+ this._header = document.createElement("div");
+ this._selectedText = document.createElement("span");
+ this._arrow = document.createElement("span");
+ this._dropdown = document.createElement("div");
+ _assertClassBrand(_SelectBox_brand, this, _createDOM$1).call(this);
+ _assertClassBrand(_SelectBox_brand, this, _bindEvents).call(this);
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this);
+ _instances._.add(this);
+ }
+ return _createClass(SelectBox, [ {
+ key: "openDropdown",
+ value: function openDropdown() {
+ if (!this.isOpen) {
+ document.addEventListener("click", this._boundHandles.close);
+ }
+ this.isOpen = true;
+ this._dropdown.style.display = "block";
+ this._arrow.className += " selectbox-arrow-open";
+ this._header.className += " selectbox-header-open";
+ if (this.searchInput) {
+ setTimeout(function(self) {
+ return function() {
+ if (self.searchInput) {
+ self.searchInput.focus();
+ }
+ };
+ }(this), 100);
+ }
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this);
+ }
+ }, {
+ key: "subscribe",
+ value: function subscribe(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ }
+ }, {
+ key: "addItem",
+ value: function addItem(value, text, selected) {
+ selected = selected || false;
+ var bHasItem = this._items.some(function(item) {
+ return item && item.value === value;
+ });
+ if (bHasItem) {
+ var item = this._items.find(function(item) {
+ return item && item.value === value;
+ });
+ if (item) item.selected = selected;
+ } else {
+ this._items.push({
+ value: value,
+ text: text,
+ selected: selected
+ });
+ }
+ if (selected) {
+ if (this._options.multiple) {
+ this._selectedValues.add(value);
+ } else {
+ this._selectedValues.clear();
+ this._selectedValues.add(value);
+ }
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ }
+ }, {
+ key: "addItems",
+ value: function addItems(values, selectedValue) {
+ var self = this;
+ values.forEach(function(pair, index) {
+ var bHasItem = self._items.some(function(item) {
+ return item && item.value === pair[0];
+ });
+ if (bHasItem) return;
+ var isSelected = selectedValue ? pair[0] === selectedValue : index === 0;
+ if (isSelected) {
+ if (self._options.multiple) {
+ self._selectedValues.add(pair[0]);
+ } else {
+ self._selectedValues.clear();
+ self._selectedValues.add(pair[0]);
+ }
+ }
+ self._items.push({
+ value: pair[0],
+ text: pair[1],
+ selected: isSelected
+ });
+ }, this);
+ if (this.isOpen) {
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this);
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ }
+ }, {
+ key: "addCustomItem",
+ value: function addCustomItem(value, text) {
+ this._customItems.push({
+ value: value,
+ text: text,
+ selected: false
+ });
+ }
+ }, {
+ key: "addSeparator",
+ value: function addSeparator() {
+ this._items.push(null);
+ }
+ }, {
+ key: "removeItem",
+ value: function removeItem(value) {
+ this._items = this._items.filter(function(item) {
+ if (item === null || item.value !== value) {
+ return true;
+ }
+ return false;
+ });
+ this._customItems = this._customItems.filter(function(item) {
+ if (item === null || item.value !== value) {
+ return true;
+ }
+ return false;
+ });
+ this._selectedValues.delete(value);
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ }
+ }, {
+ key: "getSelectedValue",
+ value: function getSelectedValue() {
+ if (this._options.multiple) {
+ console.error("Method getSelectedValue is only available for single-select boxes.");
+ return null;
+ } else {
+ var values = Array.from(this._selectedValues);
+ return values.length > 0 ? values[0] : null;
+ }
+ }
+ }, {
+ key: "getSelectedValues",
+ value: function getSelectedValues() {
+ if (this._options.multiple) {
+ return Array.from(this._selectedValues);
+ } else {
+ var values = Array.from(this._selectedValues);
+ return values.length > 0 ? values[0] : null;
+ }
+ }
+ }, {
+ key: "selectItems",
+ value: function selectItems(values, bSilent) {
+ var self = this;
+ if (!this._options.multiple && Array.isArray(values)) {
+ console.error("Method selectItem is only available for multi-select boxes.");
+ return;
+ }
+ var value = "";
+ if (this._options.multiple) {
+ var checkMultiOption = function checkMultiOption(value) {
+ if (self._optionsContainer) {
+ var option = self._optionsContainer.querySelector('[data-value="' + value + '"]');
+ if (option) {
+ var checkbox = option.querySelector('input[type="checkbox"]');
+ if (checkbox && checkbox instanceof HTMLInputElement) {
+ checkbox.checked = true;
+ }
+ option.classList.add("selectbox-option-selected");
+ option.classList.add("checkbox--checked");
+ }
+ }
+ };
+ if (Array.isArray(values)) {
+ for (var i = 0; i < values.length; i++) {
+ value = values[i];
+ if (!this._selectedValues.has(value)) {
+ this._selectedValues.add(value);
+ checkMultiOption(value);
+ }
+ }
+ } else {
+ value = values;
+ if (!this._selectedValues.has(value)) {
+ this._selectedValues.add(value);
+ checkMultiOption(value);
+ }
+ }
+ } else if (!Array.isArray(values)) {
+ value = values;
+ this._selectedValues.clear();
+ this._selectedValues.add(value);
+ if (this._optionsContainer) {
+ var selectedOptions = this._optionsContainer.querySelectorAll('.selectbox-option-selected[data-value="' + value + '"]');
+ selectedOptions.forEach(function(option) {
+ option.classList.remove("selectbox-option-selected");
+ option.classList.remove("checkbox--checked");
+ });
+ var option = this._optionsContainer.querySelector('[data-value="' + value + '"]');
+ if (option) {
+ option.classList.add("selectbox-option-selected");
+ option.classList.add("checkbox--checked");
+ }
+ }
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ if (bSilent) {
+ return;
+ }
+ _assertClassBrand(_SelectBox_brand, this, _triggerChange).call(this, value, true);
+ }
+ }, {
+ key: "unselectItems",
+ value: function unselectItems(values, bSilent) {
+ var self = this;
+ if (!this._options.multiple) {
+ console.error("Method unselectItem is only available for multi-select boxes.");
+ return;
+ }
+ var value = "";
+ var uncheckMultiOption = function uncheckMultiOption(value) {
+ if (self._optionsContainer) {
+ var option = self._optionsContainer.querySelector('[data-value="' + value + '"]');
+ if (option) {
+ var checkbox = option.querySelector('input[type="checkbox"]');
+ if (checkbox && checkbox instanceof HTMLInputElement) {
+ checkbox.checked = false;
+ }
+ option.classList.remove("selectbox-option-selected");
+ option.classList.remove("checkbox--checked");
+ }
+ }
+ };
+ if (Array.isArray(values)) {
+ for (var i = 0; i < values.length; i++) {
+ value = values[i];
+ if (this._selectedValues.has(value)) {
+ this._selectedValues.delete(value);
+ uncheckMultiOption(value);
+ }
+ }
+ } else {
+ value = values;
+ if (this._selectedValues.has(value)) {
+ this._selectedValues.delete(value);
+ uncheckMultiOption(value);
+ }
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ if (bSilent) {
+ return;
+ }
+ _assertClassBrand(_SelectBox_brand, this, _triggerChange).call(this, value, true);
+ }
+ }, {
+ key: "disable",
+ value: function disable() {
+ this._select.classList.add("selectbox-disabled");
+ }
+ }, {
+ key: "enable",
+ value: function enable() {
+ this._select.classList.remove("selectbox-disabled");
+ }
+ }, {
+ key: "clear",
+ value: function clear(bSelectFirst) {
+ bSelectFirst = bSelectFirst || false;
+ this._selectedValues.clear();
+ if (bSelectFirst && this._items.length > 0) {
+ var firstItem = this._items[0];
+ if (firstItem) {
+ this._selectedValues.add(firstItem.value);
+ }
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this);
+ }
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ this._subscribers = [];
+ _instances._.delete(this);
+ try {
+ if (this._header && this._boundHandles) {
+ this._header.removeEventListener("click", this._boundHandles.toggle);
+ }
+ if (this.searchInput && this._boundHandles) {
+ this.searchInput.removeEventListener("input", this._boundHandles.search);
+ }
+ if (this._dropdown && this._boundHandles) {
+ this._dropdown.removeEventListener("click", this._boundHandles.dropdownClick);
+ }
+ if (document && this._boundHandles) {
+ document.removeEventListener("click", this._boundHandles.close);
+ }
+ if (this._header && this._boundHandles) {
+ this._header.removeEventListener("keydown", this._boundHandles.keydown);
+ }
+ if (this._dropdown && this._boundHandles) {
+ this._dropdown.removeEventListener("keydown", this._boundHandles.keydown);
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ this._container.innerHTML = "";
+ var containerClasses = this._container.className.split(" ");
+ var newClasses = [];
+ for (var i = 0; i < containerClasses.length; i++) {
+ if (containerClasses[i] !== "selectbox-container") {
+ newClasses.push(containerClasses[i]);
+ }
+ }
+ this._container.className = newClasses.join(" ");
+ }
+ } ]);
+ }();
+ function _createDOM$1() {
+ this._container.innerHTML = "";
+ this._container.className += " selectbox-container";
+ var fragment = document.createDocumentFragment();
+ this._select.className += " selectbox";
+ if (this._options.multiple) {
+ this._select.className += " selectbox-multiple";
+ }
+ fragment.appendChild(this._select);
+ this._header.className += " selectbox-header";
+ this._select.appendChild(this._header);
+ this._header.setAttribute("tabindex", "0");
+ this._selectedText.className += " selectbox-selected-text";
+ this._selectedText.textContent = this._options.placeholder;
+ this._header.appendChild(this._selectedText);
+ this._arrow.className += " selectbox-arrow";
+ this._arrow.innerHTML = '' + ' ' + " ";
+ this._header.appendChild(this._arrow);
+ this._dropdown.className += " selectbox-dropdown";
+ this._select.appendChild(this._dropdown);
+ if (this._options.description) {
+ var description = document.createElement("div");
+ description.className += " i18n selectbox-description";
+ description.textContent = this._options.description;
+ this._dropdown.appendChild(description);
+ }
+ if (this._options.searchable) {
+ var search = document.createElement("div");
+ search.className += " selectbox-search";
+ this._dropdown.appendChild(search);
+ this.searchInput = document.createElement("input");
+ this.searchInput.className += " selectbox-search-input";
+ this.searchInput.type = "text";
+ this.searchInput.placeholder = "Search...";
+ search.appendChild(this.searchInput);
+ }
+ this._optionsContainer = document.createElement("div");
+ this._optionsContainer.className += " selectbox-options";
+ this._dropdown.appendChild(this._optionsContainer);
+ this._container.appendChild(fragment);
+ }
+ function _bindEvents() {
+ this._header.addEventListener("click", this._boundHandles.toggle);
+ if (this.searchInput) {
+ this.searchInput.addEventListener("input", this._boundHandles.search);
+ }
+ this._dropdown.addEventListener("click", this._boundHandles.dropdownClick);
+ this._dropdown.addEventListener("wheel", function(e) {
+ e.stopPropagation();
+ });
+ this._header.addEventListener("keydown", this._boundHandles.keydown);
+ this._dropdown.addEventListener("keydown", this._boundHandles.keydown);
+ }
+ function _toggle(e) {
+ e && e.stopPropagation();
+ this.isOpen ? _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this) : this.openDropdown();
+ if (e && e.type === "click") {
+ var _iterator = _createForOfIteratorHelper(_instances._), _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var selBox = _step.value;
+ if (selBox.isOpen && selBox !== this) {
+ _assertClassBrand(_SelectBox_brand, selBox, _closeDropdown).call(selBox);
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ }
+ function _closeDropdown() {
+ if (this.isOpen && document && this._boundHandles) {
+ document.removeEventListener("click", this._boundHandles.close);
+ }
+ this.isOpen = false;
+ this._dropdown.style.display = "none";
+ var arrowClasses = this._arrow.className.split(" ");
+ var newArrowClasses = [];
+ for (var i = 0; i < arrowClasses.length; i++) {
+ if (arrowClasses[i] !== "selectbox-arrow-open") {
+ newArrowClasses.push(arrowClasses[i]);
+ }
+ }
+ this._arrow.className = newArrowClasses.join(" ");
+ var headerClasses = this._header.className.split(" ");
+ var newHeaderClasses = [];
+ for (var i = 0; i < headerClasses.length; i++) {
+ if (headerClasses[i] !== "selectbox-header-open") {
+ newHeaderClasses.push(headerClasses[i]);
+ }
+ }
+ this._header.className = newHeaderClasses.join(" ");
+ if (this.searchInput) {
+ this.searchInput.value = "";
+ }
+ }
+ function _handleSearch(e) {
+ var target = e.target;
+ if (!(target instanceof HTMLInputElement)) {
+ return;
+ }
+ var searchTerm = target.value.toLowerCase();
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this, searchTerm);
+ }
+ function _selectNextPrevItem(direction) {
+ var searchTerm = this.searchInput ? this.searchInput.value.toLowerCase() : "";
+ var newItem;
+ var items = this._items.filter(function(item) {
+ return item !== null;
+ });
+ if (searchTerm) {
+ items = items.filter(function(item) {
+ return item.text.toLowerCase().indexOf(searchTerm) !== -1;
+ });
+ }
+ if (items.length === 0) {
+ return;
+ }
+ if (direction === "up") {
+ if (this._selectedValues.size === 0 && items.length > 0) {
+ newItem = items[items.length - 1];
+ this._selectedValues.add(newItem.value);
+ } else {
+ var selectedArray = Array.from(this._selectedValues);
+ var currentIndex = -1;
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].value === selectedArray[0]) {
+ currentIndex = i;
+ break;
+ }
+ }
+ var prevIndex = (currentIndex - 1 + items.length) % items.length;
+ this._selectedValues.clear();
+ newItem = items[prevIndex];
+ this._selectedValues.add(newItem.value);
+ }
+ } else {
+ if (this._selectedValues.size === 0 && items.length > 0) {
+ newItem = items[0];
+ this._selectedValues.add(newItem.value);
+ } else {
+ var selectedArray = Array.from(this._selectedValues);
+ var currentIndex = -1;
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].value === selectedArray[0]) {
+ currentIndex = i;
+ break;
+ }
+ }
+ var nextIndex = (currentIndex + 1) % items.length;
+ if (nextIndex === items.length) {
+ nextIndex = 0;
+ }
+ this._selectedValues.clear();
+ newItem = items[nextIndex];
+ this._selectedValues.add(newItem.value);
+ }
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ _assertClassBrand(_SelectBox_brand, this, _renderOptions).call(this, searchTerm, true);
+ _assertClassBrand(_SelectBox_brand, this, _triggerChange).call(this, newItem.value, true);
+ }
+ function _handleKeydown(e) {
+ var key = e.key || e.keyCode;
+ switch (key) {
+ case "Enter":
+ case 13:
+ e.preventDefault();
+ _assertClassBrand(_SelectBox_brand, this, _toggle).call(this, e);
+ break;
+
+ case "Escape":
+ case 27:
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ break;
+
+ case "ArrowDown":
+ case 40:
+ e.preventDefault();
+ _assertClassBrand(_SelectBox_brand, this, _selectNextPrevItem).call(this, "down");
+ break;
+
+ case "ArrowUp":
+ case 38:
+ e.preventDefault();
+ _assertClassBrand(_SelectBox_brand, this, _selectNextPrevItem).call(this, "up");
+ break;
+
+ case "Tab":
+ case 9:
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ break;
+ }
+ }
+ function _renderOptions(searchTerm, scrollIntoView) {
+ searchTerm = searchTerm || "";
+ if (!this._optionsContainer) return;
+ this._optionsContainer.innerHTML = "";
+ var selectedOption = null;
+ var filteredItems = this._items;
+ if (searchTerm) {
+ filteredItems = filteredItems.filter(function(item) {
+ return item !== null && item.text.toLowerCase().indexOf(searchTerm) !== -1;
+ });
+ }
+ var fragment = document.createDocumentFragment();
+ for (var i = 0; i < filteredItems.length; i++) {
+ var item = filteredItems[i];
+ if (!item) {
+ var hr = document.createElement("hr");
+ hr.className += " selectbox-option-divider";
+ fragment.appendChild(hr);
+ continue;
+ }
+ var option = document.createElement("div");
+ option.className += " selectbox-option";
+ if (this._selectedValues.has(item.value)) {
+ option.className += " selectbox-option-selected checkbox--checked";
+ selectedOption = option;
+ }
+ option.setAttribute("data-value", item.value);
+ var label = document.createElement("label");
+ label.className += " selectbox-option-text";
+ label.textContent = item.text;
+ if (this._options.multiple) {
+ option.className += " selectbox-option-checkbox";
+ var input = document.createElement("input");
+ input.type = "checkbox";
+ input.id = "checkbox-" + item.value;
+ input.className += " selectbox-checkbox";
+ input.checked = this._selectedValues.has(item.value);
+ option.appendChild(input);
+ var visualCheckbox = document.createElement("span");
+ visualCheckbox.className = "checkbox-visual";
+ visualCheckbox.setAttribute("aria-hidden", "true");
+ var svgNS = "http://www.w3.org/2000/svg";
+ var checkmarkSVG = document.createElementNS(svgNS, "svg");
+ checkmarkSVG.setAttribute("viewBox", "0 0 10 8");
+ checkmarkSVG.setAttribute("class", "checkbox-checkmark");
+ var path = document.createElementNS(svgNS, "path");
+ path.setAttribute("d", "M0.682129 3.40702L3.68213 6.20702L9.18218 0.707116");
+ path.setAttribute("fill", "none");
+ path.setAttribute("stroke", "currentColor");
+ path.setAttribute("stroke-width", "2");
+ checkmarkSVG.appendChild(path);
+ visualCheckbox.appendChild(checkmarkSVG);
+ option.appendChild(visualCheckbox);
+ }
+ option.appendChild(label);
+ fragment.appendChild(option);
+ }
+ if (this._customItems.length) {
+ var _hr = document.createElement("hr");
+ _hr.className += " selectbox-option-divider";
+ fragment.appendChild(_hr);
+ }
+ for (var i = 0; i < this._customItems.length; i++) {
+ var _item = this._customItems[i];
+ var _option = document.createElement("label");
+ _option.className += " selectbox-custom-option";
+ _option.setAttribute("data-value", _item.value);
+ _option.setAttribute("for", _item.value);
+ var span = document.createElement("span");
+ span.className += " selectbox-option-text";
+ span.textContent = _item.text;
+ _option.appendChild(span);
+ fragment.appendChild(_option);
+ }
+ this._optionsContainer.appendChild(fragment);
+ if (scrollIntoView && this.isOpen && this._optionsContainer && selectedOption) {
+ try {
+ if (selectedOption.scrollIntoView) {
+ selectedOption.scrollIntoView({
+ block: "nearest"
+ });
+ }
+ } catch (err) {
+ console.error(err);
+ }
+ }
+ }
+ function _handleDropdownClick(e) {
+ var target = e.target || e.srcElement;
+ var option = null;
+ if (target && target instanceof HTMLElement) {
+ var temp = null;
+ var classList = target.className.split(" ");
+ var hasOptionClass = false;
+ for (var i = 0; i < classList.length; i++) {
+ if (classList[i] === "selectbox-option") {
+ hasOptionClass = true;
+ break;
+ } else if (classList[i] === "selectbox-custom-option") {
+ var val = target.getAttribute("data-value");
+ if (val) {
+ e.stopPropagation();
+ _assertClassBrand(_SelectBox_brand, this, _triggerCustomChange).call(this, val);
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ return;
+ }
+ break;
+ }
+ }
+ if (hasOptionClass) {
+ temp = target;
+ } else if (target.parentNode && target.parentNode instanceof HTMLElement) {
+ var parentClassList = target.parentNode.className.split(" ");
+ var parentHasOptionClass = false;
+ for (var i = 0; i < parentClassList.length; i++) {
+ if (parentClassList[i] === "selectbox-option") {
+ parentHasOptionClass = true;
+ break;
+ } else if (parentClassList[i] === "selectbox-custom-option") {
+ var _val = target.parentNode.getAttribute("data-value");
+ if (_val) {
+ e.stopPropagation();
+ _assertClassBrand(_SelectBox_brand, this, _triggerCustomChange).call(this, _val);
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ return;
+ }
+ break;
+ }
+ }
+ if (parentHasOptionClass) {
+ temp = target.parentNode;
+ }
+ }
+ if (temp instanceof HTMLDivElement) {
+ option = temp;
+ } else {
+ return;
+ }
+ } else {
+ return;
+ }
+ var value = option.getAttribute("data-value");
+ if (value === null) return;
+ var enabled = true;
+ if (this._options.multiple) {
+ if (this._selectedValues.has(value)) {
+ this.unselectItems(value, true);
+ enabled = false;
+ } else {
+ this.selectItems(value, true);
+ }
+ } else {
+ this.selectItems(value, true);
+ _assertClassBrand(_SelectBox_brand, this, _closeDropdown).call(this);
+ }
+ _assertClassBrand(_SelectBox_brand, this, _updateSelectedText).call(this);
+ _assertClassBrand(_SelectBox_brand, this, _triggerChange).call(this, value, enabled);
+ }
+ function _updateSelectedText() {
+ if (this._selectedValues.size === 0) {
+ this._selectedText.textContent = this._options.placeholder;
+ return;
+ }
+ if (this._options.multiple) {
+ var selectedItems = [];
+ for (var i = 0; i < this._items.length; i++) {
+ var item = this._items[i];
+ if (item && this._selectedValues.has(item.value)) {
+ selectedItems.push(item);
+ }
+ }
+ if (selectedItems.length === 0) {
+ this._selectedText.textContent = this._options.placeholder;
+ } else if (selectedItems.length === 1) {
+ this._selectedText.textContent = selectedItems[0].text;
+ } else {
+ this._selectedText.textContent = selectedItems.length + " items selected";
+ }
+ } else {
+ var selectedItem = null;
+ for (var i = 0; i < this._items.length; i++) {
+ var item = this._items[i];
+ if (item && this._selectedValues.has(item.value)) {
+ selectedItem = item;
+ break;
+ }
+ }
+ this._selectedText.textContent = selectedItem ? selectedItem.text : this._options.placeholder;
+ }
+ }
+ function _triggerChange(currentValue, enabled) {
+ var values = Array.from(this._selectedValues);
+ var items = [];
+ for (var i = 0; i < this._items.length; i++) {
+ var item = this._items[i];
+ if (item && this._selectedValues.has(item.value)) {
+ items.push(item);
+ }
+ }
+ var detail = {
+ values: values,
+ items: items,
+ current: currentValue,
+ enabled: enabled
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "selectbox:change",
+ detail: detail
+ });
+ });
+ }
+ function _triggerCustomChange(currentValue) {
+ var detail = {
+ values: [],
+ current: currentValue,
+ enabled: false
+ };
+ this._subscribers.forEach(function(cb) {
+ cb({
+ type: "selectbox:custom",
+ detail: detail
+ });
+ });
+ }
+ var _instances = {
+ _: new Set
+ };
+ var _container = new WeakMap;
+ var _Loader_brand = new WeakSet;
+ var Loader = function() {
+ function Loader(containerId, _text) {
+ _classCallCheck(this, Loader);
+ _classPrivateMethodInitSpec(this, _Loader_brand);
+ _classPrivateFieldInitSpec(this, _container, void 0);
+ var temp = document.getElementById(containerId);
+ if (temp instanceof HTMLElement === false) throw new Error("Invalid container");
+ _classPrivateFieldSet2(_container, this, temp);
+ _assertClassBrand(_Loader_brand, this, _createDOM).call(this, _text);
+ }
+ return _createClass(Loader, [ {
+ key: "show",
+ value: function show() {
+ var _classPrivateFieldGet2$1;
+ (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.classList.remove("hidden");
+ }
+ }, {
+ key: "hide",
+ value: function hide() {
+ var _classPrivateFieldGet3;
+ (_classPrivateFieldGet3 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.classList.add("hidden");
+ }
+ } ], [ {
+ key: "show",
+ value: function show() {
+ var _assertClassBrand$_;
+ (_assertClassBrand$_ = _assertClassBrand(Loader, this, _mainLoaderContainer)._) === null || _assertClassBrand$_ === void 0 || _assertClassBrand$_.classList.remove("hidden");
+ }
+ }, {
+ key: "hide",
+ value: function hide() {
+ var _assertClassBrand$_2;
+ (_assertClassBrand$_2 = _assertClassBrand(Loader, this, _mainLoaderContainer)._) === null || _assertClassBrand$_2 === void 0 || _assertClassBrand$_2.classList.add("hidden");
+ }
+ } ]);
+ }();
+ function _createDOM(text) {
+ _classPrivateFieldGet2(_container, this).classList.add("loader-container");
+ var svgNS = "http://www.w3.org/2000/svg";
+ var image = document.createElementNS(svgNS, "svg");
+ image.classList.add("loader-image");
+ image.setAttribute("viewBox", "0 0 20 20");
+ var circle = document.createElementNS(svgNS, "circle");
+ circle.setAttribute("cx", "10");
+ circle.setAttribute("cy", "10");
+ circle.setAttribute("fill", "none");
+ circle.setAttribute("stroke", "currentColor");
+ circle.setAttribute("stroke-width", "1.5");
+ circle.setAttribute("r", "7.25");
+ circle.setAttribute("stroke-dasharray", "160%, 40%");
+ image.appendChild(circle);
+ _classPrivateFieldGet2(_container, this).appendChild(image);
+ var title = document.createElement("div");
+ title.classList.add("loader-title");
+ title.classList.add("i18n");
+ title.innerText = text;
+ _classPrivateFieldGet2(_container, this).appendChild(title);
+ }
+ var _mainLoaderContainer = {
+ _: document.getElementById("loader")
+ };
+ function translate(message) {
+ return window.Asc.plugin.tr(message);
+ }
+ var es_string_replace = {};
+ var advanceStringIndex;
+ var hasRequiredAdvanceStringIndex;
+ function requireAdvanceStringIndex() {
+ if (hasRequiredAdvanceStringIndex) return advanceStringIndex;
+ hasRequiredAdvanceStringIndex = 1;
+ var charAt = requireStringMultibyte().charAt;
+ advanceStringIndex = function(S, index, unicode) {
+ return index + (unicode ? charAt(S, index).length : 1);
+ };
+ return advanceStringIndex;
+ }
+ var getSubstitution;
+ var hasRequiredGetSubstitution;
+ function requireGetSubstitution() {
+ if (hasRequiredGetSubstitution) return getSubstitution;
+ hasRequiredGetSubstitution = 1;
+ var uncurryThis = requireFunctionUncurryThis();
+ var toObject = requireToObject();
+ var floor = Math.floor;
+ var charAt = uncurryThis("".charAt);
+ var replace = uncurryThis("".replace);
+ var stringSlice = uncurryThis("".slice);
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
+ getSubstitution = function(matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return replace(replacement, symbols, function(match, ch) {
+ var capture;
+ switch (charAt(ch, 0)) {
+ case "$":
+ return "$";
+
+ case "&":
+ return matched;
+
+ case "`":
+ return stringSlice(str, 0, position);
+
+ case "'":
+ return stringSlice(str, tailPos);
+
+ case "<":
+ capture = namedCaptures[stringSlice(ch, 1, -1)];
+ break;
+
+ default:
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? "" : capture;
+ });
+ };
+ return getSubstitution;
+ }
+ var hasRequiredEs_string_replace;
+ function requireEs_string_replace() {
+ if (hasRequiredEs_string_replace) return es_string_replace;
+ hasRequiredEs_string_replace = 1;
+ var apply = requireFunctionApply();
+ var call = requireFunctionCall();
+ var uncurryThis = requireFunctionUncurryThis();
+ var fixRegExpWellKnownSymbolLogic = requireFixRegexpWellKnownSymbolLogic();
+ var fails = requireFails();
+ var anObject = requireAnObject();
+ var isCallable = requireIsCallable();
+ var isObject = requireIsObject();
+ var toIntegerOrInfinity = requireToIntegerOrInfinity();
+ var toLength = requireToLength();
+ var toString = requireToString();
+ var requireObjectCoercible = requireRequireObjectCoercible();
+ var advanceStringIndex = requireAdvanceStringIndex();
+ var getMethod = requireGetMethod();
+ var getSubstitution = requireGetSubstitution();
+ var getRegExpFlags = requireRegexpGetFlags();
+ var regExpExec = requireRegexpExecAbstract();
+ var wellKnownSymbol = requireWellKnownSymbol();
+ var REPLACE = wellKnownSymbol("replace");
+ var max = Math.max;
+ var min = Math.min;
+ var concat = uncurryThis([].concat);
+ var push = uncurryThis([].push);
+ var stringIndexOf = uncurryThis("".indexOf);
+ var stringSlice = uncurryThis("".slice);
+ var maybeToString = function(it) {
+ return it === undefined ? it : String(it);
+ };
+ var REPLACE_KEEPS_$0 = function() {
+ return "a".replace(/./, "$0") === "$0";
+ }();
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = function() {
+ if (/./[REPLACE]) {
+ return /./[REPLACE]("a", "$0") === "";
+ }
+ return false;
+ }();
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function() {
+ var re = /./;
+ re.exec = function() {
+ var result = [];
+ result.groups = {
+ a: "7"
+ };
+ return result;
+ };
+ return "".replace(re, "$ ") !== "7";
+ });
+ fixRegExpWellKnownSymbolLogic("replace", function(_, nativeReplace, maybeCallNative) {
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? "$" : "$0";
+ return [ function replace(searchValue, replaceValue) {
+ var O = requireObjectCoercible(this);
+ var replacer = isObject(searchValue) ? getMethod(searchValue, REPLACE) : undefined;
+ return replacer ? call(replacer, searchValue, O, replaceValue) : call(nativeReplace, toString(O), searchValue, replaceValue);
+ }, function(string, replaceValue) {
+ var rx = anObject(this);
+ var S = toString(string);
+ if (typeof replaceValue == "string" && stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 && stringIndexOf(replaceValue, "$<") === -1) {
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
+ if (res.done) return res.value;
+ }
+ var functionalReplace = isCallable(replaceValue);
+ if (!functionalReplace) replaceValue = toString(replaceValue);
+ var flags = toString(getRegExpFlags(rx));
+ var global = stringIndexOf(flags, "g") !== -1;
+ var fullUnicode;
+ if (global) {
+ fullUnicode = stringIndexOf(flags, "u") !== -1;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ var result;
+ while (true) {
+ result = regExpExec(rx, S);
+ if (result === null) break;
+ push(results, result);
+ if (!global) break;
+ var matchStr = toString(result[0]);
+ if (matchStr === "") rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+ var accumulatedResult = "";
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+ var matched = toString(result[0]);
+ var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
+ var captures = [];
+ var replacement;
+ for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = concat([ matched ], captures, position, S);
+ if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
+ replacement = toString(apply(replaceValue, undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
+ }
+ if (position >= nextSourcePosition) {
+ accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
+ }
+ }
+ return accumulatedResult + stringSlice(S, nextSourcePosition);
+ } ];
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
+ return es_string_replace;
+ }
+ requireEs_string_replace();
+ var es_array_sort = {};
+ var environmentFfVersion;
+ var hasRequiredEnvironmentFfVersion;
+ function requireEnvironmentFfVersion() {
+ if (hasRequiredEnvironmentFfVersion) return environmentFfVersion;
+ hasRequiredEnvironmentFfVersion = 1;
+ var userAgent = requireEnvironmentUserAgent();
+ var firefox = userAgent.match(/firefox\/(\d+)/i);
+ environmentFfVersion = !!firefox && +firefox[1];
+ return environmentFfVersion;
+ }
+ var environmentIsIeOrEdge;
+ var hasRequiredEnvironmentIsIeOrEdge;
+ function requireEnvironmentIsIeOrEdge() {
+ if (hasRequiredEnvironmentIsIeOrEdge) return environmentIsIeOrEdge;
+ hasRequiredEnvironmentIsIeOrEdge = 1;
+ var UA = requireEnvironmentUserAgent();
+ environmentIsIeOrEdge = /MSIE|Trident/.test(UA);
+ return environmentIsIeOrEdge;
+ }
+ var environmentWebkitVersion;
+ var hasRequiredEnvironmentWebkitVersion;
+ function requireEnvironmentWebkitVersion() {
+ if (hasRequiredEnvironmentWebkitVersion) return environmentWebkitVersion;
+ hasRequiredEnvironmentWebkitVersion = 1;
+ var userAgent = requireEnvironmentUserAgent();
+ var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
+ environmentWebkitVersion = !!webkit && +webkit[1];
+ return environmentWebkitVersion;
+ }
+ var hasRequiredEs_array_sort;
+ function requireEs_array_sort() {
+ if (hasRequiredEs_array_sort) return es_array_sort;
+ hasRequiredEs_array_sort = 1;
+ var $ = require_export();
+ var uncurryThis = requireFunctionUncurryThis();
+ var aCallable = requireACallable();
+ var toObject = requireToObject();
+ var lengthOfArrayLike = requireLengthOfArrayLike();
+ var deletePropertyOrThrow = requireDeletePropertyOrThrow();
+ var toString = requireToString();
+ var fails = requireFails();
+ var internalSort = requireArraySort();
+ var arrayMethodIsStrict = requireArrayMethodIsStrict();
+ var FF = requireEnvironmentFfVersion();
+ var IE_OR_EDGE = requireEnvironmentIsIeOrEdge();
+ var V8 = requireEnvironmentV8Version();
+ var WEBKIT = requireEnvironmentWebkitVersion();
+ var test = [];
+ var nativeSort = uncurryThis(test.sort);
+ var push = uncurryThis(test.push);
+ var FAILS_ON_UNDEFINED = fails(function() {
+ test.sort(undefined);
+ });
+ var FAILS_ON_NULL = fails(function() {
+ test.sort(null);
+ });
+ var STRICT_METHOD = arrayMethodIsStrict("sort");
+ var STABLE_SORT = !fails(function() {
+ if (V8) return V8 < 70;
+ if (FF && FF > 3) return;
+ if (IE_OR_EDGE) return true;
+ if (WEBKIT) return WEBKIT < 603;
+ var result = "";
+ var code, chr, value, index;
+ for (code = 65; code < 76; code++) {
+ chr = String.fromCharCode(code);
+ switch (code) {
+ case 66:
+ case 69:
+ case 70:
+ case 72:
+ value = 3;
+ break;
+
+ case 68:
+ case 71:
+ value = 4;
+ break;
+
+ default:
+ value = 2;
+ }
+ for (index = 0; index < 47; index++) {
+ test.push({
+ k: chr + index,
+ v: value
+ });
+ }
+ }
+ test.sort(function(a, b) {
+ return b.v - a.v;
+ });
+ for (index = 0; index < test.length; index++) {
+ chr = test[index].k.charAt(0);
+ if (result.charAt(result.length - 1) !== chr) result += chr;
+ }
+ return result !== "DGBEFHACIJK";
+ });
+ var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
+ var getSortCompare = function(comparefn) {
+ return function(x, y) {
+ if (y === undefined) return -1;
+ if (x === undefined) return 1;
+ if (comparefn !== undefined) return +comparefn(x, y) || 0;
+ return toString(x) > toString(y) ? 1 : -1;
+ };
+ };
+ $({
+ target: "Array",
+ proto: true,
+ forced: FORCED
+ }, {
+ sort: function sort(comparefn) {
+ if (comparefn !== undefined) aCallable(comparefn);
+ var array = toObject(this);
+ if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
+ var items = [];
+ var arrayLength = lengthOfArrayLike(array);
+ var itemsLength, index;
+ for (index = 0; index < arrayLength; index++) {
+ if (index in array) push(items, array[index]);
+ }
+ internalSort(items, getSortCompare(comparefn));
+ itemsLength = lengthOfArrayLike(items);
+ index = 0;
+ while (index < itemsLength) array[index] = items[index++];
+ while (index < arrayLength) deletePropertyOrThrow(array, index++);
+ return array;
+ }
+ });
+ return es_array_sort;
+ }
+ requireEs_array_sort();
+ function CitationDocService(citPrefix, citSuffix, bibPrefix, bibSuffix) {
+ this._citPrefixOld = "ZOTERO_CITATION";
+ this._bibPrefixOld = "ZOTERO_BIBLIOGRAPHY";
+ this._citPrefix = citPrefix;
+ this._citSuffix = citSuffix;
+ this._bibPrefix = bibPrefix;
+ this._bibSuffix = bibSuffix;
+ this._repeatTimeout;
+ this._formatter = null;
+ }
+ CitationDocService.prototype._addAddinField = function(field) {
+ return new Promise(function(resolve) {
+ window.Asc.plugin.executeMethod("AddAddinField", [ field ], resolve);
+ });
+ };
+ CitationDocService.prototype.addBibliography = function(text, value) {
+ var self = this;
+ var supSubPositions = this._removeSuperSubTagsWithPositions(text);
+ var field = {
+ Value: this._bibPrefix + value + this._bibSuffix,
+ Content: supSubPositions.text
+ };
+ return this._addAddinField(field).then(function() {
+ if (!supSubPositions.positions.length) return;
+ return self._setSuperSubByPositions(supSubPositions.positions);
+ });
+ };
+ CitationDocService.prototype.addCitation = function(text, value, notesStyle) {
+ var self = this;
+ var supSubPositions = this._removeSuperSubTagsWithPositions(text);
+ var field = {
+ Value: this._citPrefix + " " + this._citSuffix + value,
+ Content: supSubPositions.text
+ };
+ if ("footnotes" === notesStyle) {
+ window.Asc.plugin.callCommand(function() {
+ var oDocument = Api.GetDocument();
+ oDocument.AddFootnote();
+ });
+ } else if ("endnotes" === notesStyle) {
+ window.Asc.plugin.callCommand(function() {
+ var oDocument = Api.GetDocument();
+ oDocument.AddEndnote();
+ });
+ }
+ return this._addAddinField(field).then(function() {
+ if (!supSubPositions.positions.length) return;
+ return self._setSuperSubByPositions(supSubPositions.positions);
+ });
+ };
+ CitationDocService.prototype._getAllAddinFields = function() {
+ return new Promise(function(resolve, reject) {
+ window.Asc.plugin.executeMethod("GetAllAddinFields", null, resolve);
+ });
+ };
+ CitationDocService.prototype.getAddinZoteroFields = function() {
+ var self = this;
+ return new Promise(function(resolve, reject) {
+ self._getAllAddinFields().then(function(arrFields) {
+ try {
+ if (arrFields.length) {
+ arrFields = arrFields.filter(function(field) {
+ return field.Value.indexOf(self._citPrefix) !== -1 || field.Value.indexOf(self._bibPrefix) !== -1 || field.Value.indexOf(self._citPrefixOld) !== -1 || field.Value.indexOf(self._bibPrefixOld) !== -1;
+ });
+ }
+ } catch (e) {
+ reject(e);
+ }
+ console.warn(arrFields);
+ resolve(arrFields);
+ });
+ });
+ };
+ CitationDocService.prototype._removeSuperSubTagsWithPositions = function(escapedHtmlText) {
+ var positions = [];
+ var currentIndex = 0;
+ var result = "";
+ var tempResult = escapedHtmlText;
+ tempResult = tempResult.replace(/]*>([^<]*)<\/sup>/gi, function(match, content, offset) {
+ var start = offset + currentIndex;
+ var end = start + content.length;
+ positions.push({
+ type: "sup",
+ content: content,
+ start: start,
+ end: end,
+ originalMatch: match
+ });
+ currentIndex += content.length - match.length;
+ return content;
+ });
+ currentIndex = 0;
+ result = tempResult;
+ tempResult = tempResult.replace(/]*>([^<]*)<\/sub>/gi, function(match, content, offset) {
+ var start = offset + currentIndex;
+ var end = start + content.length;
+ positions.push({
+ type: "sub",
+ content: content,
+ start: start,
+ end: end,
+ originalMatch: match
+ });
+ currentIndex += content.length - match.length;
+ return content;
+ });
+ result = tempResult;
+ return {
+ text: result,
+ positions: positions.sort(function(a, b) {
+ return a.start - b.start;
+ })
+ };
+ };
+ CitationDocService.prototype.saveAsText = function() {
+ return this.getAddinZoteroFields().then(function(arrFields) {
+ var count = arrFields.length;
+ if (!count) {
+ window.Asc.plugin.executeCommand("close", "");
+ return false;
+ }
+ return new Promise(function(resolve) {
+ arrFields.forEach(function(field) {
+ window.Asc.plugin.executeMethod("RemoveFieldWrapper", [ field.FieldId ], function() {
+ count--;
+ if (!count) {
+ resolve(true);
+ window.Asc.plugin.executeCommand("close", "");
+ }
+ });
+ });
+ });
+ });
+ };
+ CitationDocService.prototype._setSuperSubByPositions = function(positions) {
+ return new Promise(function(resolve) {
+ var isCalc = true;
+ var isClose = false;
+ Asc.scope.positions = positions;
+ Asc.plugin.callCommand(function() {
+ var doc = Api.GetDocument();
+ var run = doc.GetCurrentRun();
+ Asc.scope.positions.forEach(function(pos) {
+ var range = run.GetRange(pos.start, pos.end);
+ if ("sup" === pos.type) {
+ range.SetVertAlign("superscript");
+ } else {
+ range.SetVertAlign("subscript");
+ }
+ });
+ }, isClose, isCalc, resolve);
+ });
+ };
+ CitationDocService.prototype.updateAddinFields = function(fields) {
+ return new Promise(function(resolve) {
+ window.Asc.plugin.executeMethod("UpdateAddinFields", [ fields ], resolve);
+ });
+ };
+ function CitationItemData(id) {
+ if (typeof id !== "string" && typeof id !== "number") {
+ throw new Error("CitationItemData: id is required");
+ }
+ this._id = id;
+ this._type = undefined;
+ this._citationKey = undefined;
+ this._categories = new Array;
+ this._language = undefined;
+ this._journalAbbreviation = undefined;
+ this._shortTitle = undefined;
+ this._author = new Array;
+ this._chair = new Array;
+ this._collectionEditor = new Array;
+ this._compiler = new Array;
+ this._composer = new Array;
+ this._containerAuthor = new Array;
+ this._contributor = new Array;
+ this._curator = new Array;
+ this._director = new Array;
+ this._editor = new Array;
+ this._editorialDirector = new Array;
+ this._executiveProducer = new Array;
+ this._guest = new Array;
+ this._host = new Array;
+ this._illustrator = new Array;
+ this._narrator = new Array;
+ this._organizer = new Array;
+ this._originalAuthor = new Array;
+ this._performer = new Array;
+ this._producer = new Array;
+ this._recipient = new Array;
+ this._reviewedAuthor = new Array;
+ this._scriptwriter = new Array;
+ this._seriesCreator = new Array;
+ this._translator = new Array;
+ this._accessed = {};
+ this._container = {};
+ this._eventDate = {};
+ this._issued = {};
+ this._originalDate = {};
+ this._submitted = {};
+ this._abstract = undefined;
+ this._annote = undefined;
+ this._archive = undefined;
+ this._archiveCollection = undefined;
+ this._archiveLocation = undefined;
+ this._archivePlace = undefined;
+ this._authority = undefined;
+ this._callNumber = undefined;
+ this._chapterNumber = undefined;
+ this._citationNumber = undefined;
+ this._citationLabel = undefined;
+ this._collectionNumber = undefined;
+ this._collectionTitle = undefined;
+ this._containerTitle = undefined;
+ this._containerTitleShort = undefined;
+ this._dimensions = undefined;
+ this._DOI = undefined;
+ this._edition = undefined;
+ this._event = undefined;
+ this._eventTitle = undefined;
+ this._eventPlace = undefined;
+ this._firstReferenceNoteNumber = undefined;
+ this._genre = undefined;
+ this._ISBN = undefined;
+ this._ISSN = undefined;
+ this._issue = undefined;
+ this._jurisdiction = undefined;
+ this._keyword = undefined;
+ this._locator = undefined;
+ this._medium = undefined;
+ this._note = undefined;
+ this._number = undefined;
+ this._numberOfPages = undefined;
+ this._numberOfVolumes = undefined;
+ this._originalPublisher = undefined;
+ this._originalPublisherPlace = undefined;
+ this._originalTitle = undefined;
+ this._page = undefined;
+ this._part = undefined;
+ this._partTitle = undefined;
+ this._pageFirst = undefined;
+ this._PMCID = undefined;
+ this._PMID = undefined;
+ this._printing = undefined;
+ this._publisher = undefined;
+ this._publisherPlace = undefined;
+ this._references = undefined;
+ this._reviewedGenre = undefined;
+ this._reviewedTitle = undefined;
+ this._scale = undefined;
+ this._section = undefined;
+ this._source = undefined;
+ this._status = undefined;
+ this._title = undefined;
+ this._titleShort = undefined;
+ this._URL = undefined;
+ this._version = undefined;
+ this._volume = undefined;
+ this._volumeTitle = undefined;
+ this._volumeTitleShort = undefined;
+ this._yearSuffix = undefined;
+ this._custom = {};
+ this.schema = "https://raw.githubusercontent.com/citation-style-language/schema/master/schemas/input/csl-data.json#/items";
+ }
+ CitationItemData.prototype._addCustomProperty = function(key, value) {
+ this._custom[key] = value;
+ return this;
+ };
+ CitationItemData.prototype.getCustomProperty = function(key) {
+ if (Object.hasOwnProperty.call(this._custom, key)) return this._custom[key];
+ return null;
+ };
+ CitationItemData.prototype.fillFromObject = function(itemDataObject) {
+ if (Object.hasOwnProperty.call(itemDataObject, "type")) {
+ this._type = itemDataObject.type;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "categories")) {
+ this._categories = itemDataObject.categories;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "citation-key")) {
+ this._citationKey = itemDataObject["citation-key"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "language")) {
+ this._language = itemDataObject.language;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "journalAbbreviation")) {
+ this._journalAbbreviation = itemDataObject.journalAbbreviation;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "shortTitle")) {
+ this._shortTitle = itemDataObject.shortTitle;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "author")) {
+ this._author = itemDataObject.author;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "chair")) {
+ this._chair = itemDataObject.chair;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "collection-editor")) {
+ this._collectionEditor = itemDataObject["collection-editor"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "compiler")) {
+ this._compiler = itemDataObject.compiler;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "composer")) {
+ this._composer = itemDataObject.composer;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "container-author")) {
+ this._containerAuthor = itemDataObject["container-author"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "contributor")) {
+ this._contributor = itemDataObject.contributor;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "curator")) {
+ this._curator = itemDataObject.curator;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "director")) {
+ this._director = itemDataObject.director;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "editorial-director")) {
+ this._editorialDirector = itemDataObject["editorial-director"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "editor")) {
+ this._editor = itemDataObject.editor;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "executive-producer")) {
+ this._executiveProducer = itemDataObject["executive-producer"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "guest")) {
+ this._guest = itemDataObject.guest;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "host")) {
+ this._host = itemDataObject.host;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "illustrator")) {
+ this._illustrator = itemDataObject.illustrator;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "narrator")) {
+ this._narrator = itemDataObject.narrator;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "organizer")) {
+ this._organizer = itemDataObject.organizer;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "original-author")) {
+ this._originalAuthor = itemDataObject["original-author"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "performer")) {
+ this._performer = itemDataObject.performer;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "producer")) {
+ this._producer = itemDataObject.producer;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "recipient")) {
+ this._recipient = itemDataObject.recipient;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "reviewed-author")) {
+ this._reviewedAuthor = itemDataObject["reviewed-author"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "script-writer")) {
+ this._scriptWriter = itemDataObject["script-writer"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "series-creator")) {
+ this._seriesCreator = itemDataObject["series-creator"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "translator")) {
+ this._translator = itemDataObject.translator;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "accessed")) {
+ this._accessed = itemDataObject.accessed;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "container")) {
+ this._container = itemDataObject.container;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "event-date")) {
+ this._eventDate = itemDataObject["event-date"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "issued")) {
+ this._issued = itemDataObject.issued;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "original-date")) {
+ this._originalDate = itemDataObject["original-date"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "submitted")) {
+ this._submitted = itemDataObject.submitted;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "abstract")) {
+ this._abstract = itemDataObject.abstract;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "annote")) {
+ this._annote = itemDataObject.annote;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "archive")) {
+ this._archive = itemDataObject.archive;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "archive_collection")) {
+ this._archiveCollection = itemDataObject["archive_collection"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "archive_location")) {
+ this._archiveLocation = itemDataObject["archive_location"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "archive-place")) {
+ this._archivePlace = itemDataObject["archive-place"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "authority")) {
+ this._authority = itemDataObject.authority;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "call-number")) {
+ this._callNumber = itemDataObject["call-number"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "chapter-number")) {
+ this._chapterNumber = itemDataObject["chapter-number"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "citation-number")) {
+ this._citationNumber = itemDataObject["citation-number"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "citation-label")) {
+ this._citationLabel = itemDataObject["citation-label"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "collection-number")) {
+ this._collectionNumber = itemDataObject["collection-number"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "collection-title")) {
+ this._collectionTitle = itemDataObject["collection-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "container-title")) {
+ this._containerTitle = itemDataObject["container-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "container-title-short")) {
+ this._containerTitleShort = itemDataObject["container-title-short"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "dimensions")) {
+ this._dimensions = itemDataObject.dimensions;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "DOI")) {
+ this._DOI = itemDataObject.DOI;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "edition")) {
+ this._edition = itemDataObject.edition;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "event")) {
+ this._event = itemDataObject.event;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "event-title")) {
+ this._eventTitle = itemDataObject["event-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "event-place")) {
+ this._eventPlace = itemDataObject["event-place"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "first-reference-note-number")) {
+ this._firstReferenceNoteNumber = itemDataObject["first-reference-note-number"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "genre")) {
+ this._genre = itemDataObject.genre;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "ISBN")) {
+ this._ISBN = itemDataObject.ISBN;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "ISSN")) {
+ this._ISSN = itemDataObject.ISSN;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "issue")) {
+ this._issue = itemDataObject.issue;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "jurisdiction")) {
+ this._jurisdiction = itemDataObject.jurisdiction;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "keyword")) {
+ this._keyword = itemDataObject.keyword;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "locator")) {
+ this._locator = itemDataObject.locator;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "medium")) {
+ this._medium = itemDataObject.medium;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "note")) {
+ this._note = itemDataObject.note;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "number")) {
+ this._number = itemDataObject.number;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "number-of-pages")) {
+ this._numberOfPages = itemDataObject["number-of-pages"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "number-of-volumes")) {
+ this._numberOfVolumes = itemDataObject["number-of-volumes"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "original-publisher")) {
+ this._originalPublisher = itemDataObject["original-publisher"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "original-publisher-place")) {
+ this._originalPublisherPlace = itemDataObject["original-publisher-place"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "original-title")) {
+ this._originalTitle = itemDataObject["original-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "page")) {
+ this._page = itemDataObject.page;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "page-first")) {
+ this._pageFirst = itemDataObject["page-first"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "part")) {
+ this._part = itemDataObject.part;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "part-title")) {
+ this._partTitle = itemDataObject["part-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "PMCID")) {
+ this._PMCID = itemDataObject.PMCID;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "PMID")) {
+ this._PMID = itemDataObject.PMID;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "printing")) {
+ this._printing = itemDataObject.printing;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "publisher")) {
+ this._publisher = itemDataObject.publisher;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "publisher-place")) {
+ this._publisherPlace = itemDataObject["publisher-place"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "references")) {
+ this._references = itemDataObject.references;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "reviewed-genre")) {
+ this._reviewedGenre = itemDataObject["reviewed-genre"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "reviewed-title")) {
+ this._reviewedTitle = itemDataObject["reviewed-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "scale")) {
+ this._scale = itemDataObject.scale;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "section")) {
+ this._section = itemDataObject.section;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "source")) {
+ this._source = itemDataObject.source;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "status")) {
+ this._status = itemDataObject.status;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "title")) {
+ this._title = itemDataObject.title;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "title-short")) {
+ this._titleShort = itemDataObject["title-short"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "URL")) {
+ this._URL = itemDataObject.URL;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "version")) {
+ this._version = itemDataObject.version;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "volume")) {
+ this._volume = itemDataObject.volume;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "volume-title")) {
+ this._volumeTitle = itemDataObject["volume-title"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "volume-title-short")) {
+ this._volumeTitleShort = itemDataObject["volume-title-short"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "year-suffix")) {
+ this._yearSuffix = itemDataObject["year-suffix"];
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "custom")) {
+ this._custom = itemDataObject.custom;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "userID")) {
+ this._addCustomProperty("userID", itemDataObject.userID);
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "groupID")) {
+ this._addCustomProperty("groupID", itemDataObject.groupID);
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "creators")) {
+ var self = this;
+ itemDataObject.creators.forEach(function(creator) {
+ var author = {};
+ if (creator.firstName) {
+ author.given = creator.firstName;
+ }
+ if (creator.lastName) {
+ author.family = creator.lastName;
+ }
+ var bHasAuthor = self._author.some(function(a) {
+ if (a.family !== author.family && (a.family || author.family)) {
+ return false;
+ }
+ if (a.given !== author.given && (a.given || author.given)) {
+ return false;
+ }
+ return true;
+ });
+ if (bHasAuthor) {
+ return;
+ }
+ self._author.push(author);
+ }, this);
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "libraryCatalog")) {
+ this._source = itemDataObject.libraryCatalog;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "place")) {
+ this._eventPlace = itemDataObject.place;
+ this._publisherPlace = itemDataObject.place;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "numberOfVolumes")) {
+ this._numberOfVolumes = itemDataObject.numberOfVolumes;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "callNumber")) {
+ this._callNumber = itemDataObject.callNumber;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "seriesNumber")) {
+ this._collectionNumber = itemDataObject.seriesNumber;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "series")) {
+ this._collectionTitle = itemDataObject.series;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "bookTitle")) {
+ this._containerTitle = itemDataObject.bookTitle;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "extra")) {
+ this._note = itemDataObject.extra;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "rights")) {
+ this._license = itemDataObject.rights;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "archiveLocation")) {
+ this._archiveLocation = itemDataObject.archiveLocation;
+ }
+ if (Object.hasOwnProperty.call(itemDataObject, "abstractNote")) {
+ this._abstract = itemDataObject.abstractNote;
+ }
+ };
+ CitationItemData.prototype.getTitle = function() {
+ return this._title;
+ };
+ CitationItemData.prototype.getType = function() {
+ return this._type;
+ };
+ CitationItemData.prototype.setType = function(type) {
+ this._type = type;
+ return this;
+ };
+ CitationItemData.prototype.setCitationKey = function(key) {
+ this._citationKey = key;
+ return this;
+ };
+ CitationItemData.prototype.setCategories = function(categories) {
+ this._categories = categories;
+ return this;
+ };
+ CitationItemData.prototype.setLanguage = function(language) {
+ this._language = language;
+ return this;
+ };
+ CitationItemData.prototype.setJournalAbbreviation = function(journalAbbreviation) {
+ this._journalAbbreviation = journalAbbreviation;
+ return this;
+ };
+ CitationItemData.prototype.setShortTitle = function(shortTitle) {
+ this._shortTitle = shortTitle;
+ return this;
+ };
+ CitationItemData.prototype.setAuthor = function(author) {
+ this._author = Array.isArray(author) ? author : [ author ];
+ return this;
+ };
+ CitationItemData.prototype.setChair = function(chair) {
+ this._chair = Array.isArray(chair) ? chair : [ chair ];
+ return this;
+ };
+ CitationItemData.prototype.setCollectionEditor = function(collectionEditor) {
+ this._collectionEditor = Array.isArray(collectionEditor) ? collectionEditor : [ collectionEditor ];
+ return this;
+ };
+ CitationItemData.prototype.setCompiler = function(compiler) {
+ this._compiler = Array.isArray(compiler) ? compiler : [ compiler ];
+ return this;
+ };
+ CitationItemData.prototype.setComposer = function(composer) {
+ this._composer = Array.isArray(composer) ? composer : [ composer ];
+ return this;
+ };
+ CitationItemData.prototype.setContainerAuthor = function(containerAuthor) {
+ this._containerAuthor = Array.isArray(containerAuthor) ? containerAuthor : [ containerAuthor ];
+ return this;
+ };
+ CitationItemData.prototype.setContributor = function(contributor) {
+ this._contributor = Array.isArray(contributor) ? contributor : [ contributor ];
+ return this;
+ };
+ CitationItemData.prototype.setCurator = function(curator) {
+ this._curator = Array.isArray(curator) ? curator : [ curator ];
+ return this;
+ };
+ CitationItemData.prototype.setDirector = function(director) {
+ this._director = Array.isArray(director) ? director : [ director ];
+ return this;
+ };
+ CitationItemData.prototype.setEditor = function(editor) {
+ this._editor = Array.isArray(editor) ? editor : [ editor ];
+ return this;
+ };
+ CitationItemData.prototype.setEditorialDirector = function(editorialDirector) {
+ this._editorialDirector = Array.isArray(editorialDirector) ? editorialDirector : [ editorialDirector ];
+ return this;
+ };
+ CitationItemData.prototype.setExecutiveProducer = function(executiveProducer) {
+ this._executiveProducer = Array.isArray(executiveProducer) ? executiveProducer : [ executiveProducer ];
+ return this;
+ };
+ CitationItemData.prototype.setGuest = function(guest) {
+ this._guest = Array.isArray(guest) ? guest : [ guest ];
+ return this;
+ };
+ CitationItemData.prototype.setHost = function(host) {
+ this._host = Array.isArray(host) ? host : [ host ];
+ return this;
+ };
+ CitationItemData.prototype.setIllustrator = function(illustrator) {
+ this._illustrator = Array.isArray(illustrator) ? illustrator : [ illustrator ];
+ return this;
+ };
+ CitationItemData.prototype.setNarrator = function(narrator) {
+ this._narrator = Array.isArray(narrator) ? narrator : [ narrator ];
+ return this;
+ };
+ CitationItemData.prototype.setOrganizer = function(organizer) {
+ this._organizer = Array.isArray(organizer) ? organizer : [ organizer ];
+ return this;
+ };
+ CitationItemData.prototype.setOriginalAuthor = function(originalAuthor) {
+ this._originalAuthor = Array.isArray(originalAuthor) ? originalAuthor : [ originalAuthor ];
+ return this;
+ };
+ CitationItemData.prototype.setPerformer = function(performer) {
+ this._performer = Array.isArray(performer) ? performer : [ performer ];
+ return this;
+ };
+ CitationItemData.prototype.setProducer = function(producer) {
+ this._producer = Array.isArray(producer) ? producer : [ producer ];
+ return this;
+ };
+ CitationItemData.prototype.setRecipient = function(recipient) {
+ this._recipient = Array.isArray(recipient) ? recipient : [ recipient ];
+ return this;
+ };
+ CitationItemData.prototype.setReviewedAuthor = function(reviewedAuthor) {
+ this._reviewedAuthor = Array.isArray(reviewedAuthor) ? reviewedAuthor : [ reviewedAuthor ];
+ return this;
+ };
+ CitationItemData.prototype.setScriptwriter = function(scriptwriter) {
+ this._scriptwriter = Array.isArray(scriptwriter) ? scriptwriter : [ scriptwriter ];
+ return this;
+ };
+ CitationItemData.prototype.setSeriesCreator = function(seriesCreator) {
+ this._seriesCreator = Array.isArray(seriesCreator) ? seriesCreator : [ seriesCreator ];
+ return this;
+ };
+ CitationItemData.prototype.setTranslator = function(translator) {
+ this._translator = Array.isArray(translator) ? translator : [ translator ];
+ return this;
+ };
+ CitationItemData.prototype.setAccessed = function(accessed) {
+ this._accessed = accessed || {};
+ return this;
+ };
+ CitationItemData.prototype.setContainer = function(container) {
+ this._container = container || {};
+ return this;
+ };
+ CitationItemData.prototype.setEventDate = function(eventDate) {
+ this._eventDate = eventDate || {};
+ return this;
+ };
+ CitationItemData.prototype.setIssued = function(issued) {
+ this._issued = issued || {};
+ return this;
+ };
+ CitationItemData.prototype.setOriginalDate = function(originalDate) {
+ this._originalDate = originalDate || {};
+ return this;
+ };
+ CitationItemData.prototype.setSubmitted = function(submitted) {
+ this._submitted = submitted || {};
+ return this;
+ };
+ CitationItemData.prototype.setAbstract = function(abstract) {
+ this._abstract = abstract;
+ return this;
+ };
+ CitationItemData.prototype.setAnnote = function(annote) {
+ this._annote = annote;
+ return this;
+ };
+ CitationItemData.prototype.setArchive = function(archive) {
+ this._archive = archive;
+ return this;
+ };
+ CitationItemData.prototype.setArchiveCollection = function(archiveCollection) {
+ this._archiveCollection = archiveCollection;
+ return this;
+ };
+ CitationItemData.prototype.setArchiveLocation = function(archiveLocation) {
+ this._archiveLocation = archiveLocation;
+ return this;
+ };
+ CitationItemData.prototype.setArchivePlace = function(archivePlace) {
+ this._archivePlace = archivePlace;
+ return this;
+ };
+ CitationItemData.prototype.setAuthority = function(authority) {
+ this._authority = authority;
+ return this;
+ };
+ CitationItemData.prototype.setCallNumber = function(callNumber) {
+ this._callNumber = callNumber;
+ return this;
+ };
+ CitationItemData.prototype.setChapterNumber = function(chapterNumber) {
+ this._chapterNumber = chapterNumber;
+ return this;
+ };
+ CitationItemData.prototype.setCitationNumber = function(citationNumber) {
+ this._citationNumber = citationNumber;
+ return this;
+ };
+ CitationItemData.prototype.setCitationLabel = function(citationLabel) {
+ this._citationLabel = citationLabel;
+ return this;
+ };
+ CitationItemData.prototype.setCollectionNumber = function(collectionNumber) {
+ this._collectionNumber = collectionNumber;
+ return this;
+ };
+ CitationItemData.prototype.setCollectionTitle = function(collectionTitle) {
+ this._collectionTitle = collectionTitle;
+ return this;
+ };
+ CitationItemData.prototype.setContainerTitle = function(containerTitle) {
+ this._containerTitle = containerTitle;
+ return this;
+ };
+ CitationItemData.prototype.setContainerTitleShort = function(containerTitleShort) {
+ this._containerTitleShort = containerTitleShort;
+ return this;
+ };
+ CitationItemData.prototype.setDimensions = function(dimensions) {
+ this._dimensions = dimensions;
+ return this;
+ };
+ CitationItemData.prototype.setDOI = function(DOI) {
+ this._DOI = DOI;
+ return this;
+ };
+ CitationItemData.prototype.setEdition = function(edition) {
+ this._edition = edition;
+ return this;
+ };
+ CitationItemData.prototype.setEvent = function(event) {
+ this._event = event;
+ return this;
+ };
+ CitationItemData.prototype.setEventTitle = function(eventTitle) {
+ this._eventTitle = eventTitle;
+ return this;
+ };
+ CitationItemData.prototype.setEventPlace = function(eventPlace) {
+ this._eventPlace = eventPlace;
+ return this;
+ };
+ CitationItemData.prototype.setFirstReferenceNoteNumber = function(firstReferenceNoteNumber) {
+ this._firstReferenceNoteNumber = firstReferenceNoteNumber;
+ return this;
+ };
+ CitationItemData.prototype.setGenre = function(genre) {
+ this._genre = genre;
+ return this;
+ };
+ CitationItemData.prototype.setISBN = function(ISBN) {
+ this._ISBN = ISBN;
+ return this;
+ };
+ CitationItemData.prototype.setISSN = function(ISSN) {
+ this._ISSN = ISSN;
+ return this;
+ };
+ CitationItemData.prototype.setIssue = function(issue) {
+ this._issue = issue;
+ return this;
+ };
+ CitationItemData.prototype.setJurisdiction = function(jurisdiction) {
+ this._jurisdiction = jurisdiction;
+ return this;
+ };
+ CitationItemData.prototype.setKeyword = function(keyword) {
+ this._keyword = keyword;
+ return this;
+ };
+ CitationItemData.prototype.setLocator = function(locator) {
+ this._locator = locator;
+ return this;
+ };
+ CitationItemData.prototype.setMedium = function(medium) {
+ this._medium = medium;
+ return this;
+ };
+ CitationItemData.prototype.setNote = function(note) {
+ this._note = note;
+ return this;
+ };
+ CitationItemData.prototype.setNumber = function(number) {
+ this._number = number;
+ return this;
+ };
+ CitationItemData.prototype.setNumberOfPages = function(numberOfPages) {
+ this._numberOfPages = numberOfPages;
+ return this;
+ };
+ CitationItemData.prototype.setNumberOfVolumes = function(numberOfVolumes) {
+ this._numberOfVolumes = numberOfVolumes;
+ return this;
+ };
+ CitationItemData.prototype.setOriginalPublisher = function(originalPublisher) {
+ this._originalPublisher = originalPublisher;
+ return this;
+ };
+ CitationItemData.prototype.setOriginalPublisherPlace = function(originalPublisherPlace) {
+ this._originalPublisherPlace = originalPublisherPlace;
+ return this;
+ };
+ CitationItemData.prototype.setOriginalTitle = function(originalTitle) {
+ this._originalTitle = originalTitle;
+ return this;
+ };
+ CitationItemData.prototype.setPage = function(page) {
+ this._page = page;
+ return this;
+ };
+ CitationItemData.prototype.setPageFirst = function(pageFirst) {
+ this._pageFirst = pageFirst;
+ return this;
+ };
+ CitationItemData.prototype.setPart = function(part) {
+ this._part = part;
+ return this;
+ };
+ CitationItemData.prototype.setPartTitle = function(partTitle) {
+ this._partTitle = partTitle;
+ return this;
+ };
+ CitationItemData.prototype.setPMCID = function(PMCID) {
+ this._PMCID = PMCID;
+ return this;
+ };
+ CitationItemData.prototype.setPMID = function(PMID) {
+ this._PMID = PMID;
+ return this;
+ };
+ CitationItemData.prototype.setPrinting = function(printing) {
+ this._printing = printing;
+ return this;
+ };
+ CitationItemData.prototype.setPublisher = function(publisher) {
+ this._publisher = publisher;
+ return this;
+ };
+ CitationItemData.prototype.setPublisherPlace = function(publisherPlace) {
+ this._publisherPlace = publisherPlace;
+ return this;
+ };
+ CitationItemData.prototype.setReferences = function(references) {
+ this._references = references;
+ return this;
+ };
+ CitationItemData.prototype.setReviewedGenre = function(reviewedGenre) {
+ this._reviewedGenre = reviewedGenre;
+ return this;
+ };
+ CitationItemData.prototype.setReviewedTitle = function(reviewedTitle) {
+ this._reviewedTitle = reviewedTitle;
+ return this;
+ };
+ CitationItemData.prototype.setScale = function(scale) {
+ this._scale = scale;
+ return this;
+ };
+ CitationItemData.prototype.setSection = function(section) {
+ this._section = section;
+ return this;
+ };
+ CitationItemData.prototype.setSource = function(source) {
+ this._source = source;
+ return this;
+ };
+ CitationItemData.prototype.setStatus = function(status) {
+ this._status = status;
+ return this;
+ };
+ CitationItemData.prototype.setTitle = function(title) {
+ this._title = title;
+ return this;
+ };
+ CitationItemData.prototype.setTitleShort = function(titleShort) {
+ this._titleShort = titleShort;
+ return this;
+ };
+ CitationItemData.prototype.setURL = function(URL) {
+ this._URL = URL;
+ return this;
+ };
+ CitationItemData.prototype.setVersion = function(version) {
+ this._version = version;
+ return this;
+ };
+ CitationItemData.prototype.setVolume = function(volume) {
+ this._volume = volume;
+ return this;
+ };
+ CitationItemData.prototype.setVolumeTitle = function(volumeTitle) {
+ this._volumeTitle = volumeTitle;
+ return this;
+ };
+ CitationItemData.prototype.setVolumeTitleShort = function(volumeTitleShort) {
+ this._volumeTitleShort = volumeTitleShort;
+ return this;
+ };
+ CitationItemData.prototype.setYearSuffix = function(yearSuffix) {
+ this._yearSuffix = yearSuffix;
+ return this;
+ };
+ CitationItemData.prototype.setCustom = function(custom) {
+ this._custom = Object.assign(this._custom, custom);
+ return this;
+ };
+ CitationItemData.prototype.toJSON = function() {
+ var result = {};
+ result.id = this._id;
+ if (this._type !== undefined && this._type !== "") result.type = this._type;
+ if (this._citationKey !== undefined && this._citationKey !== "") result["citation-key"] = this._citationKey;
+ if (this._categories.length > 0) result.categories = this._categories;
+ if (this._language !== undefined && this._language !== "") result.language = this._language;
+ if (this._journalAbbreviation !== undefined && this._journalAbbreviation !== "") result.journalAbbreviation = this._journalAbbreviation;
+ if (this._shortTitle !== undefined && this._shortTitle !== "") {
+ result.shortTitle = this._shortTitle;
+ if (this._titleShort === undefined) result["title-short"] = this._shortTitle;
+ }
+ if (this._author.length > 0) result.author = this._author;
+ if (this._chair.length > 0) result.chair = this._chair;
+ if (this._collectionEditor.length > 0) result["collection-editor"] = this._collectionEditor;
+ if (this._compiler.length > 0) result.compiler = this._compiler;
+ if (this._composer.length > 0) result.composer = this._composer;
+ if (this._containerAuthor.length > 0) result["container-author"] = this._containerAuthor;
+ if (this._contributor.length > 0) result.contributor = this._contributor;
+ if (this._curator.length > 0) result.curator = this._curator;
+ if (this._director.length > 0) result.director = this._director;
+ if (this._editor.length > 0) result.editor = this._editor;
+ if (this._editorialDirector.length > 0) result["editorial-director"] = this._editorialDirector;
+ if (this._executiveProducer.length > 0) result["executive-producer"] = this._executiveProducer;
+ if (this._guest.length > 0) result.guest = this._guest;
+ if (this._host.length > 0) result.host = this._host;
+ if (this._illustrator.length > 0) result.illustrator = this._illustrator;
+ if (this._narrator.length > 0) result.narrator = this._narrator;
+ if (this._organizer.length > 0) result.organizer = this._organizer;
+ if (this._originalAuthor.length > 0) result["original-author"] = this._originalAuthor;
+ if (this._performer.length > 0) result.performer = this._performer;
+ if (this._producer.length > 0) result.producer = this._producer;
+ if (this._recipient.length > 0) result.recipient = this._recipient;
+ if (this._reviewedAuthor.length > 0) result["reviewed-author"] = this._reviewedAuthor;
+ if (this._scriptwriter.length > 0) result["script-writer"] = this._scriptwriter;
+ if (this._seriesCreator.length > 0) result["series-creator"] = this._seriesCreator;
+ if (this._translator.length > 0) result.translator = this._translator;
+ if (Object.keys(this._accessed).length > 0) result.accessed = this._accessed;
+ if (Object.keys(this._container).length > 0) result.container = this._container;
+ if (Object.keys(this._eventDate).length > 0) result["event-date"] = this._eventDate;
+ if (Object.keys(this._issued).length > 0) result.issued = this._issued;
+ if (Object.keys(this._originalDate).length > 0) result["original-date"] = this._originalDate;
+ if (Object.keys(this._submitted).length > 0) result.submitted = this._submitted;
+ if (this._abstract !== undefined && this._abstract !== "") result.abstract = this._abstract;
+ if (this._annote !== undefined && this._annote !== "") result.annote = this._annote;
+ if (this._archive !== undefined && this._archive !== "") result.archive = this._archive;
+ if (this._archiveCollection !== undefined && this._archiveCollection !== "") result["archive_collection"] = this._archiveCollection;
+ if (this._archiveLocation !== undefined && this._archiveLocation !== "") result["archive_location"] = this._archiveLocation;
+ if (this._archivePlace !== undefined && this._archivePlace !== "") result["archive-place"] = this._archivePlace;
+ if (this._authority !== undefined && this._authority !== "") result.authority = this._authority;
+ if (this._callNumber !== undefined && this._callNumber !== "") result["call-number"] = this._callNumber;
+ if (this._chapterNumber !== undefined && this._chapterNumber !== "") result["chapter-number"] = this._chapterNumber;
+ if (this._citationNumber !== undefined && this._citationNumber !== "") result["citation-number"] = this._citationNumber;
+ if (this._citationLabel !== undefined && this._citationLabel !== "") result["citation-label"] = this._citationLabel;
+ if (this._collectionNumber !== undefined && this._collectionNumber !== "") result["collection-number"] = this._collectionNumber;
+ if (this._collectionTitle !== undefined && this._collectionTitle !== "") result["collection-title"] = this._collectionTitle;
+ if (this._containerTitle !== undefined && this._containerTitle !== "") result["container-title"] = this._containerTitle;
+ if (this._containerTitleShort !== undefined && this._containerTitleShort !== "") result["container-title-short"] = this._containerTitleShort;
+ if (this._dimensions !== undefined && this._dimensions !== "") result.dimensions = this._dimensions;
+ if (this._DOI !== undefined && this._DOI !== "") result.DOI = this._DOI;
+ if (this._edition !== undefined && this._edition !== "") result.edition = this._edition;
+ if (this._event !== undefined && this._event !== "") result.event = this._event;
+ if (this._eventTitle !== undefined && this._eventTitle !== "") result["event-title"] = this._eventTitle;
+ if (this._eventPlace !== undefined && this._eventPlace !== "") result["event-place"] = this._eventPlace;
+ if (this._firstReferenceNoteNumber !== undefined && this._firstReferenceNoteNumber !== "") result["first-reference-note-number"] = this._firstReferenceNoteNumber;
+ if (this._genre !== undefined && this._genre !== "") result.genre = this._genre;
+ if (this._ISBN !== undefined && this._ISBN !== "") result.ISBN = this._ISBN;
+ if (this._ISSN !== undefined && this._ISSN !== "") result.ISSN = this._ISSN;
+ if (this._issue !== undefined && this._issue !== "") result.issue = this._issue;
+ if (this._jurisdiction !== undefined && this._jurisdiction !== "") result.jurisdiction = this._jurisdiction;
+ if (this._keyword !== undefined && this._keyword !== "") result.keyword = this._keyword;
+ if (this._locator !== undefined && this._locator !== "") result.locator = this._locator;
+ if (this._medium !== undefined && this._medium !== "") result.medium = this._medium;
+ if (this._note !== undefined && this._note !== "") result.note = this._note;
+ if (this._number !== undefined && this._number !== "") result.number = this._number;
+ if (this._numberOfPages !== undefined && this._numberOfPages !== "") result["number-of-pages"] = this._numberOfPages;
+ if (this._numberOfVolumes !== undefined && this._numberOfVolumes !== "") result["number-of-volumes"] = this._numberOfVolumes;
+ if (this._originalPublisher !== undefined && this._originalPublisher !== "") result["original-publisher"] = this._originalPublisher;
+ if (this._originalPublisherPlace !== undefined && this._originalPublisherPlace !== "") result["original-publisher-place"] = this._originalPublisherPlace;
+ if (this._originalTitle !== undefined && this._originalTitle !== "") result["original-title"] = this._originalTitle;
+ if (this._page !== undefined && this._page !== "") result.page = this._page;
+ if (this._pageFirst !== undefined && this._pageFirst !== "") result["page-first"] = this._pageFirst;
+ if (this._part !== undefined && this._part !== "") result.part = this._part;
+ if (this._partTitle !== undefined && this._partTitle !== "") result["part-title"] = this._partTitle;
+ if (this._PMCID !== undefined && this._PMCID !== "") result.PMCID = this._PMCID;
+ if (this._PMID !== undefined && this._PMID !== "") result.PMID = this._PMID;
+ if (this._printing !== undefined && this._printing !== "") result.printing = this._printing;
+ if (this._publisher !== undefined && this._publisher !== "") result.publisher = this._publisher;
+ if (this._publisherPlace !== undefined && this._publisherPlace !== "") result["publisher-place"] = this._publisherPlace;
+ if (this._references !== undefined && this._references !== "") result.references = this._references;
+ if (this._reviewedGenre !== undefined && this._reviewedGenre !== "") result["reviewed-genre"] = this._reviewedGenre;
+ if (this._reviewedTitle !== undefined && this._reviewedTitle !== "") result["reviewed-title"] = this._reviewedTitle;
+ if (this._scale !== undefined && this._scale !== "") result.scale = this._scale;
+ if (this._section !== undefined && this._section !== "") result.section = this._section;
+ if (this._source !== undefined && this._source !== "") result.source = this._source;
+ if (this._status !== undefined && this._status !== "") result.status = this._status;
+ if (this._title !== undefined && this._title !== "") result.title = this._title;
+ if (this._titleShort !== undefined && this._titleShort !== "") result["title-short"] = this._titleShort;
+ if (this._URL !== undefined && this._URL !== "") result.URL = this._URL;
+ if (this._version !== undefined && this._version !== "") result.version = this._version;
+ if (this._volume !== undefined && this._volume !== "") result.volume = this._volume;
+ if (this._volumeTitle !== undefined && this._volumeTitle !== "") result["volume-title"] = this._volumeTitle;
+ if (this._volumeTitleShort !== undefined && this._volumeTitleShort !== "") result["volume-title-short"] = this._volumeTitleShort;
+ if (this._yearSuffix !== undefined && this._yearSuffix !== "") result["year-suffix"] = this._yearSuffix;
+ if (Object.keys(this._custom).length !== 0) result.custom = this._custom;
+ if (this._license !== undefined && this._license !== "") result.license = this._license;
+ return result;
+ };
+ function CitationItem(id) {
+ if (typeof id !== "string" && typeof id !== "number") {
+ throw new Error("CitationItem: id is required");
+ }
+ this.id = id;
+ this._itemData = new CitationItemData(id);
+ this._prefix = undefined;
+ this._suffix = undefined;
+ this._locator = undefined;
+ this._label = undefined;
+ this._suppressAuthor = undefined;
+ this._authorOnly = undefined;
+ this._uris = new Array;
+ }
+ CitationItem.prototype.fillFromObject = function(itemObject) {
+ var self = this;
+ if (Object.hasOwnProperty.call(itemObject, "version") && Object.hasOwnProperty.call(itemObject, "library")) {
+ this._itemData.fillFromObject(itemObject.data);
+ if (Object.hasOwnProperty.call(itemObject, "links")) {
+ if (Object.hasOwnProperty.call(itemObject.links, "self")) {
+ this.addUri(itemObject.links.self.href);
+ }
+ if (Object.hasOwnProperty.call(itemObject.links, "alternate")) {
+ this.addUri(itemObject.links.alternate.href);
+ }
+ }
+ } else if (Object.hasOwnProperty.call(itemObject, "itemData")) {
+ this._itemData.fillFromObject(itemObject.itemData);
+ } else {
+ this._itemData.fillFromObject(itemObject);
+ }
+ if (Object.hasOwnProperty.call(itemObject, "prefix")) this._prefix = itemObject.prefix;
+ if (Object.hasOwnProperty.call(itemObject, "suffix")) this._suffix = itemObject.suffix;
+ if (Object.hasOwnProperty.call(itemObject, "locator")) this._locator = itemObject.locator;
+ if (Object.hasOwnProperty.call(itemObject, "label")) this._label = itemObject.label;
+ if (Object.hasOwnProperty.call(itemObject, "suppress-author")) this._suppressAuthor = itemObject["suppress-author"];
+ if (Object.hasOwnProperty.call(itemObject, "author-only")) this._authorOnly = itemObject["author-only"];
+ if (Object.hasOwnProperty.call(itemObject, "uris")) {
+ itemObject.uris.forEach(function(uri) {
+ self.addUri(uri);
+ }, this);
+ }
+ };
+ CitationItem.prototype.getInfoForCitationCluster = function() {
+ var info = {
+ id: this.id,
+ "suppress-author": this._suppressAuthor
+ };
+ if (this._prefix) {
+ info.prefix = this._prefix;
+ }
+ if (this._suffix) {
+ info.suffix = this._suffix;
+ }
+ if (this._locator) {
+ info.locator = this._locator;
+ }
+ if (this._label) {
+ info.label = this._label;
+ }
+ return info;
+ };
+ CitationItem.prototype.getItemData = function() {
+ return this._itemData;
+ };
+ CitationItem.prototype.getProperty = function(key) {
+ if (this._itemData.getCustomProperty(key) !== null) {
+ return this._itemData.getCustomProperty(key);
+ }
+ return null;
+ };
+ CitationItem.prototype.setPrefix = function(prefix) {
+ this._prefix = prefix;
+ return this;
+ };
+ CitationItem.prototype.setSuffix = function(suffix) {
+ this._suffix = suffix;
+ return this;
+ };
+ CitationItem.prototype.setLocator = function(locator) {
+ this._locator = locator;
+ return this;
+ };
+ CitationItem.prototype.setLabel = function(label) {
+ if (label) {
+ var validLabels = [ "act", "appendix", "article-locator", "book", "canon", "chapter", "column", "elocation", "equation", "figure", "folio", "issue", "line", "note", "opus", "page", "paragraph", "part", "rule", "scene", "section", "sub-verbo", "supplement", "table", "timestamp", "title-locator", "verse", "version", "volume" ];
+ if (validLabels.indexOf(label) === -1) {
+ throw new Error('CitationItem.setLocator: Invalid label "' + label + '"');
+ }
+ this._label = label;
+ }
+ return this;
+ };
+ CitationItem.prototype.setSuppressAuthor = function(value) {
+ this._suppressAuthor = value;
+ return this;
+ };
+ CitationItem.prototype.setAuthorOnly = function(value) {
+ this._authorOnly = value;
+ return this;
+ };
+ CitationItem.prototype.addUri = function(uri) {
+ if (this._uris.indexOf(uri) !== -1) {
+ return this;
+ }
+ this._uris.push(uri);
+ return this;
+ };
+ CitationItem.prototype.toJSON = function() {
+ var result = {};
+ result.id = this.id;
+ if (this._itemData) {
+ result.itemData = this._itemData.toJSON ? this._itemData.toJSON() : this._itemData;
+ }
+ if (this._prefix !== undefined) result.prefix = this._prefix;
+ if (this._suffix !== undefined) result.suffix = this._suffix;
+ if (this._locator !== undefined) result.locator = this._locator;
+ if (this._label !== undefined) result.label = this._label;
+ if (this._suppressAuthor !== undefined) result["suppress-author"] = this._suppressAuthor;
+ if (this._authorOnly !== undefined) result["author-only"] = this._authorOnly;
+ if (this._uris.length) result.uris = this._uris;
+ return result;
+ };
+ CitationItem.prototype.toFlatJSON = function(index) {
+ var oldItem = {
+ id: this.id,
+ index: index
+ };
+ if (this._suppressAuthor !== undefined) {
+ oldItem["suppress-author"] = this._suppressAuthor;
+ }
+ var itemDataObject = this._itemData.toJSON();
+ Object.assign(oldItem, itemDataObject);
+ if (typeof this._itemData.getCustomProperty("userID") !== "undefined" && this._itemData.getCustomProperty("userID") !== null) {
+ oldItem.userID = String(this._itemData.getCustomProperty("userID"));
+ }
+ if (typeof this._itemData.getCustomProperty("groupID") !== "undefined" && this._itemData.getCustomProperty("groupID") !== null) {
+ oldItem.groupID = String(this._itemData.getCustomProperty("groupID"));
+ }
+ return oldItem;
+ };
+ var _items = new WeakMap;
+ var _ids = new WeakMap;
+ var CSLCitationStorage = function() {
+ function CSLCitationStorage() {
+ _classCallCheck(this, CSLCitationStorage);
+ _classPrivateFieldInitSpec(this, _items, void 0);
+ _classPrivateFieldInitSpec(this, _ids, void 0);
+ _classPrivateFieldSet2(_items, this, []);
+ _classPrivateFieldSet2(_ids, this, []);
+ this.size = 0;
+ }
+ return _createClass(CSLCitationStorage, [ {
+ key: "get",
+ value: function get(id) {
+ id = id.toString();
+ var index = _classPrivateFieldGet2(_ids, this).indexOf(id);
+ if (index >= 0) return _classPrivateFieldGet2(_items, this)[index];
+ return null;
+ }
+ }, {
+ key: "getIndex",
+ value: function getIndex(id) {
+ id = id.toString();
+ return _classPrivateFieldGet2(_ids, this).indexOf(id);
+ }
+ }, {
+ key: "clear",
+ value: function clear() {
+ _classPrivateFieldSet2(_items, this, []);
+ _classPrivateFieldSet2(_ids, this, []);
+ this.size = 0;
+ return this;
+ }
+ }, {
+ key: "delete",
+ value: function _delete(id) {
+ id = id.toString();
+ var index = _classPrivateFieldGet2(_ids, this).indexOf(id);
+ if (index >= 0) {
+ _classPrivateFieldGet2(_items, this).splice(index, 1);
+ _classPrivateFieldGet2(_ids, this).splice(index, 1);
+ this.size--;
+ }
+ return this;
+ }
+ }, {
+ key: "forEach",
+ value: function forEach(callback) {
+ for (var i = 0; i < this.size; i++) {
+ callback(_classPrivateFieldGet2(_items, this)[i], _classPrivateFieldGet2(_ids, this)[i], this);
+ }
+ }
+ }, {
+ key: "has",
+ value: function has(id) {
+ id = id.toString();
+ return _classPrivateFieldGet2(_ids, this).indexOf(id) >= 0;
+ }
+ }, {
+ key: "set",
+ value: function set(id, item) {
+ id = id.toString();
+ var index = _classPrivateFieldGet2(_ids, this).indexOf(id);
+ if (index >= 0) {
+ _classPrivateFieldGet2(_items, this)[index] = item;
+ return this;
+ }
+ _classPrivateFieldGet2(_items, this).push(item);
+ _classPrivateFieldGet2(_ids, this).push(id);
+ this.size++;
+ return this;
+ }
+ } ]);
+ }();
+ function CSLCitation(itemsStartIndex, citationID) {
+ if (!citationID) {
+ citationID = this._generateId();
+ }
+ if (typeof itemsStartIndex !== "number") {
+ throw new Error("itemsStartIndex is required");
+ }
+ this.citationID = citationID;
+ this._itemsStartIndex = itemsStartIndex;
+ this._citationItems = new Array;
+ this._properties = {};
+ this._schema = "https://raw.githubusercontent.com/citation-style-language/schema/master/schemas/input/csl-citation.json";
+ }
+ CSLCitation.prototype.fillFromObject = function(citationObject) {
+ if (Object.hasOwnProperty.call(citationObject, "properties") || Object.hasOwnProperty.call(citationObject, "schema")) {
+ return this._fillFromCitationObject(citationObject);
+ } else if (Object.hasOwnProperty.call(citationObject, "citationItems")) {
+ return this._fillFromFlatCitationObject(citationObject);
+ } else if (Object.hasOwnProperty.call(citationObject, "version") && Object.hasOwnProperty.call(citationObject, "library")) {
+ return this._fillFromJson(citationObject);
+ }
+ return this._fillFromCslJson(citationObject);
+ };
+ CSLCitation.prototype._fillFromCitationObject = function(citationObject) {
+ var self = this;
+ if (Object.hasOwnProperty.call(citationObject, "schema")) ;
+ if (Object.hasOwnProperty.call(citationObject, "properties")) {
+ this._setProperties(citationObject.properties);
+ }
+ if (!Object.hasOwnProperty.call(citationObject, "citationItems")) {
+ console.error("citationItems is empty");
+ return 0;
+ }
+ var existingIds = this._citationItems.map(function(item) {
+ return item.id;
+ });
+ citationObject.citationItems.forEach(function(item) {
+ var id = item.id;
+ var citationItem;
+ if (existingIds.indexOf(id) >= 0) {
+ citationItem = self._citationItems[existingIds.indexOf(id)];
+ } else {
+ citationItem = new CitationItem(id);
+ existingIds.push(id);
+ }
+ if (typeof id === "number") {
+ id = self._extractIdFromWord365Citation(item);
+ }
+ citationItem.fillFromObject(item);
+ self._addCitationItem(citationItem);
+ }, this);
+ return existingIds.length;
+ };
+ CSLCitation.prototype._fillFromFlatCitationObject = function(citationObject) {
+ var self = this;
+ if (citationObject.citationItems.length === 0) {
+ console.error("CSLCitation.citationItems: citationItems is empty");
+ return 0;
+ } else if (citationObject.citationItems.length > 1) {
+ console.warn("CSLCitation.citationItems: citationItems has more than one item");
+ }
+ citationObject.citationItems.forEach(function(itemObject) {
+ self._fillFromCslJson(itemObject);
+ }, this);
+ return 1;
+ };
+ CSLCitation.prototype._fillFromCslJson = function(itemObject) {
+ this._itemsStartIndex;
+ var id = itemObject.id;
+ var citationItem;
+ var existingIds = this._citationItems.map(function(item) {
+ return item.id;
+ });
+ if (existingIds.indexOf(id) >= 0) {
+ citationItem = this._citationItems[existingIds.indexOf(id)];
+ } else {
+ citationItem = new CitationItem(id);
+ }
+ citationItem.fillFromObject(itemObject);
+ this._addCitationItem(citationItem);
+ return 1;
+ };
+ CSLCitation.prototype._fillFromJson = function(itemObject) {
+ this._itemsStartIndex;
+ if (!Object.hasOwnProperty.call(itemObject, "data")) {
+ console.error("Invalid citation object");
+ return 0;
+ }
+ var existingIds = this._citationItems.map(function(item) {
+ return item.id;
+ });
+ var id = itemObject.data.key;
+ var citationItem;
+ if (existingIds.indexOf(id) >= 0) {
+ citationItem = this._citationItems[existingIds.indexOf(id)];
+ } else {
+ citationItem = new CitationItem(id);
+ }
+ citationItem.fillFromObject(itemObject);
+ this._addCitationItem(citationItem);
+ return 1;
+ };
+ CSLCitation.prototype.getCitationItems = function() {
+ return this._citationItems;
+ };
+ CSLCitation.prototype.getDoNotUpdate = function() {
+ if (Object.hasOwnProperty.call(this._properties, "dontUpdate")) {
+ return !!this._properties.dontUpdate;
+ }
+ return false;
+ };
+ CSLCitation.prototype.getInfoForCitationCluster = function() {
+ return this._citationItems.map(function(item) {
+ return item.getInfoForCitationCluster();
+ }, this);
+ };
+ CSLCitation.prototype.getPlainCitation = function() {
+ if (Object.hasOwnProperty.call(this._properties, "plainCitation")) {
+ return String(this._properties.plainCitation);
+ }
+ return "";
+ };
+ CSLCitation.prototype._addCitationItem = function(item) {
+ var existingIds = this._citationItems.map(function(item) {
+ return item.id;
+ });
+ if (existingIds.indexOf(item.id) >= 0) {
+ this._citationItems[existingIds.indexOf(item.id)] = item;
+ return this;
+ }
+ this._citationItems.push(item);
+ return this;
+ };
+ CSLCitation.prototype.addDoNotUpdate = function() {
+ this._setProperties({
+ dontUpdate: true
+ });
+ return this;
+ };
+ CSLCitation.prototype.addPlainCitation = function(plainCitation) {
+ this._setProperties({
+ plainCitation: plainCitation
+ });
+ return this;
+ };
+ CSLCitation.prototype._setProperties = function(properties) {
+ var self = this;
+ Object.keys(properties).forEach(function(key) {
+ if (Object.hasOwnProperty.call(properties, key)) {
+ self._properties[key] = properties[key];
+ }
+ }, this);
+ return this;
+ };
+ CSLCitation.prototype._setSchema = function(schema) {
+ this._schema = schema;
+ return this;
+ };
+ CSLCitation.prototype._extractIdFromWord365Citation = function(item) {
+ if (Object.hasOwnProperty.call(item, "uris") && item.uris.length) {
+ var index = item.uris[0].lastIndexOf("/");
+ return item.uris[0].slice(index + 1);
+ }
+ return item.id;
+ };
+ CSLCitation.prototype._generateId = function() {
+ return Math.random().toString(36).substring(2, 15);
+ };
+ CSLCitation.prototype.validate = function() {
+ var errors = [];
+ if (!this._schema) errors.push("Schema is required");
+ if (!this.citationID) errors.push("citationID is required");
+ if (this._citationItems && Array.isArray(this._citationItems)) {
+ for (var i = 0; i < this._citationItems.length; i++) {
+ if (!this._citationItems[i].id) {
+ errors.push("Citation item at index " + i + " must have an id");
+ }
+ }
+ }
+ return errors.length === 0 ? true : errors;
+ };
+ CSLCitation.prototype.toJSON = function() {
+ var result = {
+ citationID: this.citationID,
+ schema: this._schema
+ };
+ if (this._properties && Object.keys(this._properties).length > 0) {
+ result.properties = this._properties;
+ }
+ if (this._citationItems && this._citationItems.length > 0) {
+ result.citationItems = this._citationItems.map(function(item) {
+ return item.toJSON();
+ });
+ }
+ return result;
+ };
+ function SearchFilterComponents() {
+ this._searchField = new InputField("searchField", {
+ type: "text",
+ autofocus: true,
+ showClear: false
+ });
+ this._filterButton = new Button("filterButton", {
+ variant: "secondary-icon",
+ size: "small"
+ });
+ this._librarySelectList = new SelectBox("librarySelectList", {
+ placeholder: translate("No items selected"),
+ multiple: true,
+ description: translate("Search in:")
+ });
+ this._subscribers = [];
+ this._addEventListeners();
+ }
+ SearchFilterComponents.prototype._addEventListeners = function() {
+ var self = this;
+ this._searchField.subscribe(function(e) {
+ if (e.type === "inputfield:blur" || e.type === "inputfield:submit") {
+ var selectedGroups = self._getSelectedGroups();
+ self._subscribers.forEach(function(cb) {
+ cb(e.detail.value, selectedGroups);
+ });
+ }
+ });
+ this._filterButton.subscribe(function(e) {
+ if (e.type === "button:click") {
+ if (!self._librarySelectList.isOpen) {
+ if (e.detail.originalEvent) {
+ e.detail.originalEvent.stopPropagation();
+ }
+ self._librarySelectList.openDropdown();
+ }
+ }
+ });
+ };
+ SearchFilterComponents.prototype.addGroups = function(groups) {
+ var self = this;
+ var savedGroups = localStorage.getItem("selectedGroups");
+ var selectedItems = savedGroups ? JSON.parse(savedGroups).map(function(id) {
+ return id.toString();
+ }) : [ "my_library", "group_libraries" ];
+ var hasSelected = false;
+ groups.forEach(function(group) {
+ group.id = String(group.id);
+ });
+ var customGroups = [ {
+ id: "my_library",
+ name: translate("My Library")
+ }, {
+ id: "group_libraries",
+ name: translate("Group Libraries")
+ } ];
+ !hasSelected && customGroups.forEach(function(group) {
+ if (selectedItems.indexOf(group.id) !== -1) {
+ hasSelected = true;
+ }
+ });
+ !hasSelected && groups.forEach(function(group) {
+ if (selectedItems.indexOf(group.id.toString()) !== -1) {
+ hasSelected = true;
+ }
+ });
+ if (!hasSelected) {
+ selectedItems = [ "my_library", "group_libraries" ];
+ }
+ var addGroupToSelectBox = function addGroupToSelectBox(id, name, selected) {
+ if (typeof id === "number") {
+ id = id.toString();
+ }
+ if (self._librarySelectList instanceof SelectBox) self._librarySelectList.addItem(id, name, selected);
+ };
+ for (var i = 0; i < customGroups.length; i++) {
+ var id = customGroups[i].id;
+ var name = customGroups[i].name;
+ addGroupToSelectBox(id, name, selectedItems.indexOf(id) !== -1);
+ }
+ if (groups.length === 0) {
+ return;
+ }
+ this._librarySelectList.addSeparator();
+ var selected = selectedItems.indexOf("group_libraries") !== -1;
+ for (var i = 0; i < groups.length; i++) {
+ var _id = groups[i].id;
+ var _name = groups[i].name;
+ addGroupToSelectBox(_id, _name, selected || selectedItems.indexOf(_id.toString()) !== -1);
+ }
+ this._selectedGroupsWatcher(customGroups, groups);
+ };
+ SearchFilterComponents.prototype._getSelectedGroups = function() {
+ var self = this;
+ var ids = this._librarySelectList.getSelectedValues();
+ if (Array.isArray(ids) === false || ids.length === 0) {
+ setTimeout(function() {
+ self._librarySelectList.openDropdown();
+ }, 500);
+ }
+ if (ids === null || typeof ids === "string") {
+ return [];
+ }
+ return ids;
+ };
+ SearchFilterComponents.prototype.subscribe = function(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ };
+ SearchFilterComponents.prototype._selectedGroupsWatcher = function(customGroups, groups) {
+ var self = this;
+ if (this._librarySelectList instanceof SelectBox === false) {
+ return;
+ }
+ this._librarySelectList.subscribe(function(event) {
+ if (event.type !== "selectbox:change") {
+ return;
+ }
+ var aGroupsToSave = [];
+ var values = event.detail.values;
+ var current = event.detail.current;
+ var bEnabled = event.detail.enabled;
+ var customIds = customGroups.map(function(group) {
+ return group.id;
+ });
+ var ids = groups.map(function(group) {
+ return group.id.toString();
+ });
+ var bWasCustom = customIds.indexOf(String(current)) !== -1;
+ if (bWasCustom) {
+ if (current === "group_libraries") {
+ if (bEnabled) {
+ aGroupsToSave.push("group_libraries");
+ self._librarySelectList.selectItems(ids, true);
+ } else {
+ self._librarySelectList.unselectItems(ids, true);
+ }
+ if (values.indexOf("my_library") !== -1) {
+ aGroupsToSave.push("my_library");
+ }
+ } else {
+ if (values.indexOf("group_libraries") !== -1) {
+ aGroupsToSave.push("group_libraries");
+ if (bEnabled) {
+ aGroupsToSave.push(current);
+ }
+ } else {
+ aGroupsToSave = values.slice();
+ }
+ }
+ } else if (!bWasCustom) {
+ var bAllGroupsSelected = ids.every(function(id) {
+ return values.indexOf(id) !== -1;
+ });
+ if (bAllGroupsSelected) {
+ self._librarySelectList.selectItems("group_libraries", true);
+ aGroupsToSave.push("group_libraries");
+ if (values.indexOf("my_library") !== -1) {
+ aGroupsToSave.push("my_library");
+ }
+ } else {
+ self._librarySelectList.unselectItems("group_libraries", true);
+ aGroupsToSave = values.filter(function(value) {
+ return value !== "group_libraries";
+ });
+ }
+ }
+ if (aGroupsToSave.length === 0) {
+ localStorage.removeItem("selectedGroups");
+ } else {
+ localStorage.setItem("selectedGroups", JSON.stringify(aGroupsToSave));
+ }
+ });
+ };
+ function SelectCitationsComponent(displayNoneClass, fLoadMore, fShouldLoadMore) {
+ this._displayNoneClass = displayNoneClass;
+ this._items = {};
+ this._html = {};
+ this._checks = {};
+ this._LOCATOR_VALUES = [ [ "appendix", "Appendix" ], [ "article", "Article" ], [ "book", "Book" ], [ "chapter", "Chapter" ], [ "column", "Column" ], [ "figure", "Figure" ], [ "folio", "Folio" ], [ "issue", "Issue" ], [ "line", "Line" ], [ "note", "Note" ], [ "opus", "Opus" ], [ "page", "Page" ], [ "paragraph", "Paragraph" ], [ "part", "Part" ], [ "rule", "Rule" ], [ "section", "Section" ], [ "sub-verbo", "Sub verbo" ], [ "table", "Table" ], [ "title", "Title" ], [ "verses", "Verses" ], [ "volume", "Volume" ] ];
+ this._cancelSelectBtn = document.getElementById("cancelSelectBtn");
+ this._docsHolder = document.getElementById("docsHolder");
+ this._nothingFound = document.getElementById("nothingFound");
+ this._docsThumb = document.getElementById("docsThumb");
+ this._selectedWrapper = document.getElementById("selectedWrapper");
+ this._selectedHolder = document.getElementById("selectedHolder");
+ this._selectedInfo = document.getElementById("selectedInfo");
+ this._selectedCount = document.getElementById("selectedCount");
+ this._selectedThumb = document.getElementById("selectedThumb");
+ if (this._selectedHolder && this._selectedThumb) {
+ this._selectedScroller = this._initScrollBox(this._selectedHolder, this._selectedThumb, 20);
+ }
+ if (this._docsHolder && this._docsThumb) {
+ this._docsScroller = this._initScrollBox(this._docsHolder, this._docsThumb, 40, this._checkDocsScroll.bind(this));
+ }
+ this._subscribers = [];
+ this._fShouldLoadMore = fShouldLoadMore;
+ this._fLoadMore = fLoadMore;
+ this._loadTimeout;
+ this._init();
+ }
+ SelectCitationsComponent.prototype._init = function() {
+ var self = this;
+ if (this._cancelSelectBtn) {
+ this._cancelSelectBtn.onclick = function(e) {
+ var ids = [];
+ for (var id in self._items) {
+ ids.push(id);
+ }
+ for (var i = 0; i < ids.length; i++) {
+ self._removeSelected(ids[i]);
+ }
+ };
+ }
+ };
+ SelectCitationsComponent.prototype.clearLibrary = function() {
+ this._nothingFound && this._nothingFound.classList.add(this._displayNoneClass);
+ var holder = this._docsHolder;
+ while (holder && holder.lastChild) {
+ holder.removeChild(holder.lastChild);
+ }
+ if (holder) holder.scrollTop = 0;
+ this._docsScroller.onscroll();
+ };
+ SelectCitationsComponent.prototype.displayNothingFound = function() {
+ this.clearLibrary();
+ this._nothingFound && this._nothingFound.classList.remove(this._displayNoneClass);
+ };
+ SelectCitationsComponent.prototype.displaySearchItems = function(res, err) {
+ var _this = this;
+ var self = this;
+ var holder = this._docsHolder;
+ var numOfShown = 0;
+ return new Promise(function(resolve, reject) {
+ if (res && res.items && res.items.length > 0) {
+ var page = document.createElement("div");
+ if (holder) page.classList.add("page" + holder.children.length);
+ for (var index = 0; index < res.items.length; index++) {
+ var item = res.items[index];
+ page.appendChild(self._buildDocElement(item));
+ numOfShown++;
+ }
+ if (holder) holder.appendChild(page);
+ } else if (err) {
+ reject(err);
+ }
+ _this._docsScroller.onscroll();
+ resolve(numOfShown);
+ });
+ };
+ SelectCitationsComponent.prototype.getSelectedItems = function() {
+ var items = Object.assign({}, this._items || {});
+ return items;
+ };
+ SelectCitationsComponent.prototype.removeItems = function(keys) {
+ var self = this;
+ keys.forEach(function(key) {
+ self._removeSelected(key);
+ });
+ };
+ SelectCitationsComponent.prototype.subscribe = function(callback) {
+ var self = this;
+ this._subscribers.push(callback);
+ return {
+ unsubscribe: function unsubscribe() {
+ self._subscribers = self._subscribers.filter(function(cb) {
+ return cb !== callback;
+ });
+ }
+ };
+ };
+ SelectCitationsComponent.prototype._buildDocElement = function(item) {
+ var self = this;
+ var root = document.createElement("div");
+ root.classList.add("doc");
+ var docInfo = document.createElement("div");
+ docInfo.classList.add("docInfo");
+ var checkHolder = document.createElement("div");
+ var label = "";
+ if (item.author && item.author.length > 0) {
+ label = item.author.map(function(a) {
+ if (a.family && a.given) {
+ return a.family.trim() + ", " + a.given.trim();
+ } else if (a.family) {
+ return a.family.trim();
+ } else if (a.given) {
+ return a.given.trim();
+ }
+ return "";
+ }).join("; ");
+ }
+ var arrow = document.createElement("div");
+ arrow.classList.add("selectbox-arrow");
+ arrow.innerHTML = '' + ' ';
+ var title = document.createElement("div");
+ title.textContent = item.title.trim();
+ title.classList.add("truncate-text");
+ title.classList.add("secondary-text");
+ if (item.publisher || item["publisher-place"]) {
+ title.textContent += " · " + (item.publisher || item["publisher-place"] || "");
+ }
+ if (item.issued && item.issued["date-parts"]) {
+ var date = item.issued["date-parts"][0];
+ if (label.length > 20) {
+ title.textContent += " (" + date.join("-") + ")";
+ } else {
+ if (label.length > 0 && label.slice(-1) !== "." && label.slice(-1) !== ",") label += ".";
+ label += " " + date.join("-");
+ }
+ }
+ if (label.length === 0) {
+ label = title.textContent;
+ }
+ title.setAttribute("title", title.textContent);
+ docInfo.appendChild(title);
+ var check = document.createElement("input");
+ checkHolder.appendChild(check);
+ var checkInput = new Checkbox(check, {
+ checked: !!this._items[item.id],
+ label: label,
+ title: true,
+ id: item.id
+ });
+ if (this._items[item.id]) {
+ this._checks[item.id] = checkInput;
+ }
+ checkHolder.appendChild(arrow);
+ root.appendChild(checkHolder);
+ root.appendChild(docInfo);
+ var params;
+ function toggleItem() {
+ root.classList.toggle("doc-open");
+ if (!params) {
+ params = self._buildCitationParams(item);
+ root.appendChild(params);
+ }
+ }
+ arrow.onclick = toggleItem;
+ checkInput.subscribe(function(event) {
+ if (event.type !== "checkbox:change") {
+ return;
+ }
+ if (event.detail.checked) {
+ self._addSelected(item, checkInput);
+ } else {
+ self._removeSelected(item.id);
+ }
+ });
+ return root;
+ };
+ SelectCitationsComponent.prototype._buildCitationParams = function(item) {
+ var locatorLabel = localStorage.getItem("selectedLocator") || "page";
+ item.label = locatorLabel;
+ var params = document.createDocumentFragment();
+ var prefixSuffixContainer = document.createElement("div");
+ var prefix = document.createElement("input");
+ var suffix = document.createElement("input");
+ var locatorContainer = document.createElement("div");
+ var locatorSelect = document.createElement("div");
+ var locator = document.createElement("input");
+ var omitAuthorContainer = document.createElement("div");
+ var omitAuthor = document.createElement("input");
+ params.appendChild(prefixSuffixContainer);
+ prefixSuffixContainer.appendChild(prefix);
+ prefixSuffixContainer.appendChild(suffix);
+ params.appendChild(locatorContainer);
+ locatorContainer.appendChild(locatorSelect);
+ locatorContainer.appendChild(locator);
+ var locatorPlaceholder = "";
+ params.appendChild(omitAuthorContainer);
+ omitAuthorContainer.appendChild(omitAuthor);
+ var prefixInput = new InputField(prefix, {
+ type: "text",
+ placeholder: "Prefix"
+ });
+ var suffixInput = new InputField(suffix, {
+ type: "text",
+ placeholder: "Suffix"
+ });
+ var locatorSelectbox = new SelectBox(locatorSelect, {
+ placeholder: "Locator"
+ });
+ this._LOCATOR_VALUES.forEach(function(info) {
+ var selected = info[0] === locatorLabel;
+ locatorSelectbox.addItem(info[0], info[1], selected);
+ if (selected) {
+ locatorPlaceholder = info[1];
+ }
+ });
+ var locatorInput = new InputField(locator, {
+ type: "text",
+ placeholder: locatorPlaceholder
+ });
+ var omitAuthorInput = new Checkbox(omitAuthor, {
+ label: "Omit author"
+ });
+ prefixInput.subscribe(function(event) {
+ if (event.type !== "inputfield:input") {
+ return;
+ }
+ item.prefix = event.detail.value;
+ });
+ suffixInput.subscribe(function(event) {
+ if (event.type !== "inputfield:input") {
+ return;
+ }
+ item.suffix = event.detail.value;
+ });
+ locatorInput.subscribe(function(event) {
+ if (event.type !== "inputfield:input") {
+ return;
+ }
+ item.locator = event.detail.value;
+ });
+ locatorSelectbox.subscribe(function(event) {
+ if (event.type !== "selectbox:change") {
+ return;
+ }
+ if (!event.detail.items) {
+ return;
+ }
+ var eventItem = event.detail.items[0];
+ locatorInput.setPlaceholder(eventItem.text);
+ item.label = event.detail.values[0].toString();
+ localStorage.setItem("selectedLocator", item.label);
+ });
+ omitAuthorInput.subscribe(function(event) {
+ if (event.type !== "checkbox:change") {
+ return;
+ }
+ item["suppress-author"] = event.detail.checked;
+ });
+ return params;
+ };
+ SelectCitationsComponent.prototype._buildSelectedElement = function(item) {
+ var self = this;
+ var root = document.createElement("div");
+ root.classList.add("selDoc");
+ var span = document.createElement("span");
+ if (item.author && item.author.length > 0) {
+ span.textContent = item.author.map(function(a) {
+ return a.family + ", " + a.given;
+ }).join("; ");
+ } else {
+ span.textContent = item.title;
+ }
+ if (item.issued && item.issued["date-parts"]) {
+ span.textContent += " " + item.issued["date-parts"][0].join("-");
+ }
+ span.setAttribute("title", span.textContent);
+ root.appendChild(span);
+ var remove = document.createElement("span");
+ remove.onclick = function() {
+ self._removeSelected(item.id);
+ };
+ remove.innerHTML = '' + ' ';
+ root.appendChild(remove);
+ return root;
+ };
+ SelectCitationsComponent.prototype._addSelected = function(item, checkbox) {
+ var el = this._buildSelectedElement(item);
+ this._items[item.id] = item;
+ this._html[item.id] = el;
+ this._checks[item.id] = checkbox;
+ if (this._selectedHolder) {
+ this._selectedHolder.appendChild(el);
+ }
+ this._docsScroller.onscroll();
+ this._selectedScroller.onscroll();
+ this._checkSelected();
+ };
+ SelectCitationsComponent.prototype._checkDocsScroll = function(holder, thumb) {
+ var self = this;
+ if (this._fShouldLoadMore(holder)) {
+ if (this._loadTimeout) {
+ clearTimeout(this._loadTimeout);
+ }
+ if (!lastSearch.obj && !lastSearch.text.trim() && !lastSearch.groups.length) return;
+ this._loadTimeout = setTimeout(function() {
+ if (self._fShouldLoadMore(holder)) {
+ self._fLoadMore();
+ }
+ }, 500);
+ }
+ };
+ SelectCitationsComponent.prototype._initScrollBox = function(holder, thumb, minThumbHeight, onscroll) {
+ var scroller = {};
+ scroller.onscroll = this._checkScroll(holder, thumb, minThumbHeight, onscroll);
+ holder.onwheel = function(e) {
+ holder.scrollTop += e.deltaY > 10 || e.deltaY < -10 ? e.deltaY : e.deltaY * 20;
+ scroller.onscroll();
+ };
+ thumb.onmousedown = function(e) {
+ thumb.classList.add("scrolling");
+ var y = e.clientY;
+ var initialPos = holder.scrollTop;
+ window.onmouseup = function(e) {
+ thumb.classList.remove("scrolling");
+ window.onmouseup = null;
+ window.onmousemove = null;
+ };
+ window.onmousemove = function(e) {
+ var delta = e.clientY - y;
+ var percMoved = delta / holder.clientHeight;
+ var deltaScroll = holder.scrollHeight * percMoved;
+ holder.scrollTop = initialPos + deltaScroll;
+ scroller.onscroll();
+ };
+ };
+ document.body.addEventListener("resize", function() {
+ scroller.onscroll();
+ });
+ return scroller;
+ };
+ SelectCitationsComponent.prototype._checkScroll = function(holder, thumb, minThumbHeight, func) {
+ var displayNoneClass = this._displayNoneClass;
+ return function() {
+ if (holder.scrollHeight <= holder.clientHeight) {
+ thumb.classList.add(displayNoneClass);
+ } else {
+ thumb.classList.remove(displayNoneClass);
+ var height = holder.clientHeight / holder.scrollHeight * holder.clientHeight;
+ height = height < minThumbHeight ? minThumbHeight : height;
+ thumb.style.height = height + "px";
+ var scroll = holder.scrollHeight - holder.clientHeight;
+ var percScrolled = holder.scrollTop / scroll;
+ var margin = percScrolled * (holder.clientHeight - height);
+ thumb.style.marginTop = margin + "px";
+ }
+ if (func) func(holder, thumb);
+ };
+ };
+ SelectCitationsComponent.prototype._removeSelected = function(id) {
+ var el = this._html[id];
+ if (this._selectedHolder) {
+ this._selectedHolder.removeChild(el);
+ }
+ delete this._items[id];
+ delete this._html[id];
+ if (this._checks[id]) {
+ this._checks[id].uncheck(true);
+ delete this._checks[id];
+ }
+ this._docsScroller.onscroll();
+ this._selectedScroller.onscroll();
+ this._checkSelected();
+ };
+ SelectCitationsComponent.prototype._checkSelected = function() {
+ var numOfSelected = this.count();
+ if (!this._selectedInfo || !this._selectedCount || !this._selectedWrapper) {
+ return;
+ }
+ if (numOfSelected <= 0) {
+ this._selectedWrapper.classList.add(this._displayNoneClass);
+ this._selectedInfo.classList.add(this._displayNoneClass);
+ } else {
+ this._selectedWrapper.classList.remove(this._displayNoneClass);
+ this._selectedInfo.classList.remove(this._displayNoneClass);
+ this._selectedCount.textContent = numOfSelected + " " + translate("selected");
+ }
+ this._subscribers.forEach(function(cb) {
+ cb(numOfSelected);
+ });
+ };
+ SelectCitationsComponent.prototype.count = function() {
+ var k = 0;
+ for (var i in this._items) k++;
+ return k;
+ };
+ var AdditionalWindow = function() {
+ function AdditionalWindow() {
+ _classCallCheck(this, AdditionalWindow);
+ this._window = null;
+ }
+ return _createClass(AdditionalWindow, [ {
+ key: "show",
+ value: function show(fileName, description, text) {
+ var variation = {
+ url: fileName + ".html",
+ description: window.Asc.plugin.tr(description),
+ isVisual: true,
+ isModal: false,
+ EditorsSupport: [ "word" ],
+ size: [ 400, 310 ],
+ isViewer: true,
+ isDisplayedInViewer: false,
+ isInsideMode: false
+ };
+ this._window = new window.Asc.PluginWindow;
+ this._window.show(variation);
+ this._window.button = function(id) {
+ console.log("button", id);
+ window.Asc.plugin.executeCommand("close", "");
+ };
+ }
+ }, {
+ key: "hide",
+ value: function hide() {}
+ } ]);
+ }();
+ var _onUserEditCitationManuallyWindow = new WeakMap;
+ var _CitationService_brand = new WeakSet;
+ var CitationService = function() {
+ function CitationService(localesManager, cslStylesManager, sdk) {
+ _classCallCheck(this, CitationService);
+ _classPrivateMethodInitSpec(this, _CitationService_brand);
+ _classPrivateFieldInitSpec(this, _onUserEditCitationManuallyWindow, void 0);
+ this._bibPlaceholderIfEmpty = "Please insert some citation into the document.";
+ this._citPrefixNew = "ZOTERO_ITEM";
+ this._citSuffixNew = "CSL_CITATION";
+ this._citPrefix = "ZOTERO_CITATION";
+ this._bibPrefixNew = "ZOTERO_BIBL";
+ this._bibSuffixNew = "CSL_BIBLIOGRAPHY";
+ this._bibPrefix = "ZOTERO_BIBLIOGRAPHY";
+ this._sdk = sdk;
+ this._localesManager = localesManager;
+ this._cslStylesManager = cslStylesManager;
+ this._storage = new CSLCitationStorage;
+ this._formatter;
+ this.citationDocService = new CitationDocService(this._citPrefixNew, this._citSuffixNew, this._bibPrefixNew, this._bibSuffixNew);
+ this._notesStyle;
+ this._styleFormat;
+ _classPrivateFieldSet2(_onUserEditCitationManuallyWindow, this, new AdditionalWindow);
+ }
+ return _createClass(CitationService, [ {
+ key: "saveAsText",
+ value: function saveAsText() {
+ return this.citationDocService.saveAsText();
+ }
+ }, {
+ key: "setNotesStyle",
+ value: function setNotesStyle(notesStyle) {
+ this._notesStyle = notesStyle;
+ }
+ }, {
+ key: "setStyleFormat",
+ value: function setStyleFormat(styleFormat) {
+ this._styleFormat = styleFormat;
+ }
+ }, {
+ key: "insertSelectedCitations",
+ value: function insertSelectedCitations(items) {
+ var self = this;
+ var cslCitation = new CSLCitation(self._storage.size, "");
+ for (var citationID in items) {
+ var item = items[citationID];
+ cslCitation.fillFromObject(item);
+ }
+ return _assertClassBrand(_CitationService_brand, this, _getSelectedInJsonFormat).call(this, items).then(function(items) {
+ items.forEach(function(item) {
+ cslCitation.fillFromObject(item);
+ });
+ return _assertClassBrand(_CitationService_brand, self, _formatInsertLink).call(self, cslCitation);
+ });
+ }
+ }, {
+ key: "updateCslItems",
+ value: function updateCslItems(bUpdateAll, bPastBib) {
+ this._storage.clear();
+ var self = this;
+ return _assertClassBrand(_CitationService_brand, this, _synchronizeStorageWithDocItems).call(this).then(function(info) {
+ info.fields;
+ var updatedFields = info.updatedFields, bibField = info.bibField, bibFieldValue = info.bibFieldValue;
+ if (!bUpdateAll && !bPastBib) {
+ return [];
+ }
+ if (bibField) {
+ if (updatedFields.length === 0) {
+ bibField["Content"] = translate(self._bibPlaceholderIfEmpty);
+ } else {
+ var bibliography = _assertClassBrand(_CitationService_brand, self, _makeBibliography).call(self);
+ bibField["Content"] = bibliography;
+ }
+ updatedFields.push(bibField);
+ } else if (bPastBib) {
+ var _bibliography = _assertClassBrand(_CitationService_brand, self, _makeBibliography).call(self);
+ if (updatedFields.length === 0) {
+ _bibliography = translate(self._bibPlaceholderIfEmpty);
+ }
+ if (self._cslStylesManager.isLastUsedStyleContainBibliography()) {
+ return self.citationDocService.addBibliography(_bibliography, bibFieldValue).then(function() {
+ return updatedFields;
+ });
+ } else {
+ throw "The current bibliographic style does not describe the bibliography";
+ }
+ }
+ return updatedFields;
+ }).then(function(updatedFields) {
+ if (updatedFields && updatedFields.length) {
+ return self.citationDocService.updateAddinFields(updatedFields);
+ }
+ });
+ }
+ } ]);
+ }();
+ function _formatInsertLink(cslCitation) {
+ var self = this;
+ var bUpdateItems = false;
+ var keys = [];
+ var keysL = [];
+ return Promise.resolve().then(function() {
+ cslCitation.getCitationItems().forEach(function(item) {
+ if (!self._storage.has(item.id)) {
+ bUpdateItems = true;
+ }
+ self._storage.set(item.id, item);
+ keys.push(item.id);
+ keysL.push(item.getInfoForCitationCluster());
+ });
+ if (bUpdateItems) {
+ var arrIds = [];
+ self._storage.forEach(function(item, id) {
+ arrIds.push(id);
+ });
+ self._formatter.updateItems(arrIds);
+ }
+ }).then(function() {
+ var fragment = document.createDocumentFragment();
+ var tempElement = document.createElement("div");
+ fragment.appendChild(tempElement);
+ tempElement.innerHTML = self._formatter.makeCitationCluster(keysL);
+ cslCitation.addPlainCitation(tempElement.innerText);
+ var notesStyle = null;
+ if ("note" === self._styleFormat) {
+ notesStyle = self._notesStyle;
+ }
+ return self.citationDocService.addCitation(tempElement.innerText, JSON.stringify(cslCitation.toJSON()), notesStyle);
+ }).then(function() {
+ return keys;
+ });
+ }
+ function _getSelectedInJsonFormat(items) {
+ var arrUsrItems = [];
+ var arrGroupsItems = {};
+ for (var citationID in items) {
+ var item = items[citationID];
+ var userID = item["userID"];
+ var _groupID = item["groupID"];
+ if (userID) {
+ arrUsrItems.push(item.id);
+ } else if (_groupID) {
+ if (!arrGroupsItems[_groupID]) {
+ arrGroupsItems[_groupID] = [];
+ }
+ arrGroupsItems[_groupID].push(item.id);
+ }
+ }
+ var promises = [];
+ if (arrUsrItems.length) {
+ promises.push(this._sdk.getItems(null, arrUsrItems, "json").then(function(res) {
+ var items = res.items || [];
+ return items;
+ }));
+ }
+ for (var groupID in arrGroupsItems) {
+ if (Object.hasOwnProperty.call(arrGroupsItems, groupID)) {
+ promises.push(this._sdk.getGroupItems(null, groupID, arrGroupsItems[groupID], "json").then(function(res) {
+ var items = res.items || [];
+ return items;
+ }));
+ }
+ }
+ return Promise.all(promises).then(function(res) {
+ var items = [];
+ res.forEach(function(resItems) {
+ items = items.concat(resItems);
+ });
+ return items;
+ });
+ }
+ function _makeBibliography() {
+ var self = this;
+ var fragment = document.createDocumentFragment();
+ var tempElement = document.createElement("div");
+ fragment.appendChild(tempElement);
+ try {
+ var bibItems = new Array(self._storage.size);
+ var bibObject = self._formatter.makeBibliography();
+ for (var i = 0; i < bibObject[0].entry_ids.length; i++) {
+ var citationId = bibObject[0].entry_ids[i][0];
+ var citationIndex = self._storage.getIndex(citationId);
+ var bibText = bibObject[1][i];
+ while (bibText.indexOf("\n") !== bibText.lastIndexOf("\n")) {
+ bibText = bibText.replace(/\n/, "");
+ }
+ bibItems[citationIndex] = bibText;
+ }
+ tempElement.innerHTML = bibItems.join("");
+ } catch (e) {
+ if (false === self._cslStylesManager.isLastUsedStyleContainBibliography()) {
+ tempElement.textContent = "";
+ } else {
+ console.error(e);
+ throw "Failed to apply this style.";
+ }
+ }
+ return tempElement.innerText;
+ }
+ function _extractField(field) {
+ var citationObject;
+ var citationStartIndex = field.Value.indexOf("{");
+ var citationEndIndex = field.Value.lastIndexOf("}");
+ if (citationStartIndex !== -1) {
+ var citationString = field.Value.slice(citationStartIndex, citationEndIndex + 1);
+ citationObject = JSON.parse(citationString);
+ }
+ return citationObject;
+ }
+ function _synchronizeStorageWithDocItems() {
+ var self = this;
+ return this.citationDocService.getAddinZoteroFields().then(function(arrFields) {
+ var fragment = document.createDocumentFragment();
+ var tempElement = document.createElement("div");
+ fragment.appendChild(tempElement);
+ var numOfItems = 0;
+ var bibFieldValue = " ";
+ var bibField = arrFields.find(function(field) {
+ return field.Value.indexOf(self._bibPrefixNew) !== -1 || field.Value.indexOf(self._bibPrefix) !== -1;
+ });
+ if (bibField) {
+ var citationObject = _assertClassBrand(_CitationService_brand, self, _extractField).call(self, bibField);
+ if (_typeof(citationObject) === "object" && Object.keys(citationObject).length > 0) {
+ bibFieldValue = JSON.stringify(citationObject);
+ }
+ }
+ var fields = arrFields.filter(function(field) {
+ return field.Value.indexOf(self._citPrefixNew) !== -1 || field.Value.indexOf(self._citPrefix) !== -1;
+ });
+ var fieldsWithCitations = fields.map(function(field) {
+ var citationObject = _assertClassBrand(_CitationService_brand, self, _extractField).call(self, field);
+ var citationID = "";
+ if (field.Value.indexOf(self._citPrefix) === -1) {
+ citationID = citationObject.citationID;
+ }
+ var cslCitation = new CSLCitation(numOfItems, citationID);
+ numOfItems += cslCitation.fillFromObject(citationObject);
+ cslCitation.getCitationItems().forEach(function(item) {
+ self._storage.set(item.id, item);
+ });
+ return {
+ field: _objectSpread2({}, field),
+ cslCitation: cslCitation
+ };
+ });
+ _assertClassBrand(_CitationService_brand, self, _updateFormatter).call(self);
+ var updatedFields = fieldsWithCitations.map(function(_ref, index) {
+ var field = _ref.field, cslCitation = _ref.cslCitation;
+ var keysL = cslCitation.getInfoForCitationCluster();
+ tempElement.innerHTML = self._formatter.makeCitationCluster(keysL);
+ var oldContent = field["Content"];
+ var newContent = tempElement.innerText;
+ if (oldContent !== newContent) {
+ field["Content"] = newContent;
+ }
+ console.log(cslCitation.getDoNotUpdate());
+ if (cslCitation) {
+ field["Value"] = self._citPrefixNew + " " + self._citSuffixNew + JSON.stringify(cslCitation.toJSON());
+ }
+ return field;
+ });
+ return {
+ fields: fields,
+ updatedFields: updatedFields,
+ bibField: bibField,
+ bibFieldValue: bibFieldValue
+ };
+ });
+ }
+ function _updateFormatter() {
+ var self = this;
+ var arrIds = [];
+ this._storage.forEach(function(item, id) {
+ arrIds.push(id);
+ });
+ this._formatter = new CSL.Engine({
+ retrieveLocale: function retrieveLocale(id) {
+ if (self._localesManager.getLocale(id)) {
+ return self._localesManager.getLocale(id);
+ }
+ return self._localesManager.getLocale();
+ },
+ retrieveItem: function retrieveItem(id) {
+ var item = self._storage.get(id);
+ var index = self._storage.getIndex(id);
+ if (!item) return null;
+ return item.toFlatJSON(index);
+ }
+ }, this._cslStylesManager.cached(this._cslStylesManager.getLastUsedStyleIdOrDefault()), this._localesManager.getLastUsedLanguage(), true);
+ if (arrIds.length) {
+ this._formatter.updateItems(arrIds);
+ }
+ return;
+ }
+ var CslStylesParser = {
+ getStyleInfo: function getStyleInfo(name, style) {
+ var parser = new DOMParser;
+ var xmlDoc = parser.parseFromString(style, "text/xml");
+ var styleInfo = {
+ categories: {
+ fields: [],
+ format: ""
+ },
+ dependent: 0,
+ href: "",
+ name: name,
+ title: "",
+ updated: ""
+ };
+ var title = xmlDoc.querySelector("info title");
+ if (title) styleInfo.title = title.textContent;
+ var href = xmlDoc.querySelector('info link[rel="self"]');
+ if (href) {
+ var attribute = href.getAttribute("href");
+ if (attribute) styleInfo.href = attribute;
+ }
+ var parent = xmlDoc.querySelector('info link[rel="independent-parent"]');
+ if (parent) {
+ var _attribute = parent.getAttribute("href");
+ if (_attribute) styleInfo.parent = _attribute;
+ styleInfo.dependent = 1;
+ }
+ var updated = xmlDoc.querySelector("info updated");
+ if (updated) styleInfo.updated = updated.textContent;
+ var categoryFormat = xmlDoc.querySelector("info category[citation-format]");
+ if (categoryFormat) {
+ var _attribute2 = categoryFormat.getAttribute("citation-format");
+ if (_attribute2) styleInfo.categories.format = _attribute2;
+ }
+ var categoryFields = xmlDoc.querySelectorAll("info category[field]");
+ if (categoryFields) {
+ categoryFields.forEach(function(category) {
+ var attribute = category.getAttribute("field");
+ if (attribute) styleInfo.categories.fields.push(attribute);
+ });
+ }
+ return styleInfo;
+ },
+ getCitationFormat: function getCitationFormat(styleContent) {
+ var parser = new DOMParser;
+ var xmlDoc = parser.parseFromString(styleContent, "text/xml");
+ var format = xmlDoc.querySelector("info category[citation-format]");
+ if (!format) throw new Error("Citation format not found");
+ var type = format.getAttribute("citation-format");
+ if (!type) throw new Error("Citation format not found");
+ switch (type) {
+ case "note":
+ case "numeric":
+ case "author":
+ case "author-date":
+ case "label":
+ return type;
+ }
+ throw new Error("Invalid citation format");
+ },
+ isStyleContainBibliography: function isStyleContainBibliography(styleContent) {
+ return styleContent.indexOf(" -1;
+ }
+ };
+ function CslStylesStorage() {
+ this._customStyleNamesKey = "zoteroCustomStyleNames";
+ this._customStylesKey = "zoteroCustomStyles";
+ }
+ CslStylesStorage.prototype.getStyleNames = function() {
+ var customStyleNames = localStorage.getItem(this._customStyleNamesKey);
+ if (customStyleNames) {
+ return JSON.parse(customStyleNames);
+ } else {
+ return [];
+ }
+ };
+ CslStylesStorage.prototype._getStyles = function() {
+ var customStyles = localStorage.getItem(this._customStylesKey);
+ if (customStyles) {
+ return JSON.parse(customStyles);
+ } else {
+ return [];
+ }
+ };
+ CslStylesStorage.prototype.getStyle = function(name) {
+ var customStyleNames = this.getStyleNames();
+ var styleIndex = customStyleNames.indexOf(name);
+ if (styleIndex === -1) {
+ return null;
+ }
+ return this._getStyles()[styleIndex];
+ };
+ CslStylesStorage.prototype.getStylesInfo = function() {
+ var customStyleNames = this.getStyleNames();
+ var customStyles = this._getStyles();
+ var styles = [];
+ for (var i = 0; i < customStyleNames.length; i++) {
+ var result = CslStylesParser.getStyleInfo(customStyleNames[i], customStyles[i]);
+ styles.push(result);
+ }
+ return styles;
+ };
+ CslStylesStorage.prototype.setStyle = function(name, data) {
+ var customStyleNames = this.getStyleNames();
+ var customStyles = this._getStyles();
+ var styleIndex = customStyleNames.indexOf(name);
+ if (styleIndex === -1) {
+ styleIndex = customStyleNames.length;
+ }
+ customStyleNames[styleIndex] = name;
+ customStyles[styleIndex] = data;
+ localStorage.setItem(this._customStyleNamesKey, JSON.stringify(customStyleNames));
+ localStorage.setItem(this._customStylesKey, JSON.stringify(customStyles));
+ return CslStylesParser.getStyleInfo(name, data);
+ };
+ CslStylesStorage.prototype.deleteStyle = function(name) {
+ var customStyleNames = this.getStyleNames();
+ var customStyles = this._getStyles();
+ var styleIndex = customStyleNames.indexOf(name);
+ if (styleIndex === -1) {
+ return name;
+ }
+ customStyleNames.splice(styleIndex, 1);
+ customStyles.splice(styleIndex, 1);
+ localStorage.setItem(this._customStyleNamesKey, JSON.stringify(customStyleNames));
+ localStorage.setItem(this._customStylesKey, JSON.stringify(customStyles));
+ return name;
+ };
+ function CslStylesManager() {
+ this._isOnlineAvailable = false;
+ this._isDesktopAvailable = false;
+ this._customStylesStorage = new CslStylesStorage;
+ this._STYLES_JSON_URL = "https://www.zotero.org/styles-files/styles.json";
+ this._STYLES_JSON_LOCAL = "./resources/csl/styles.json";
+ this._STYLES_URL = "https://www.zotero.org/styles/";
+ this._STYLES_LOCAL = "./resources/csl/styles/";
+ this._lastStyleKey = "zoteroStyleId";
+ this._lastNotesStyleKey = "zoteroNotesStyleId";
+ this._lastFormatKey = "zoteroFormatId";
+ this._lastUsedStyleContainBibliographyKey = "zoteroContainBibliography";
+ this._defaultStyles = [ "american-medical-association", "american-political-science-association", "apa", "american-sociological-association", "chicago-author-date-17th-edition", "harvard-cite-them-right-10th-edition", "ieee", "modern-language-association-8th-edition", "nature" ];
+ this._cache = {};
+ }
+ CslStylesManager.prototype.addCustomStyle = function(file) {
+ var self = this;
+ return new Promise(function(resolve, reject) {
+ var fileName = file.name.toLowerCase();
+ if (fileName.slice(-4) === ".csl" || fileName.slice(-4) === ".xml") {
+ fileName = fileName.substring(0, fileName.length - 4).trim();
+ } else {
+ reject("Please select a .csl or .xml file.");
+ }
+ if (file.size > 1024 * 1024) {
+ reject("Maximum file size is 1 MB.");
+ }
+ resolve(fileName);
+ }).then(function(fileName) {
+ return self._readCSLFile(file).then(function(content) {
+ if (self._defaultStyles.indexOf(fileName) === -1) {
+ self._defaultStyles.push(fileName);
+ }
+ return self._customStylesStorage.setStyle(fileName, content);
+ });
+ });
+ };
+ CslStylesManager.prototype.getLastUsedFormat = function() {
+ var lastUsedFormat = localStorage.getItem(this._lastFormatKey);
+ switch (lastUsedFormat) {
+ case "note":
+ case "numeric":
+ case "author":
+ case "author-date":
+ case "label":
+ return lastUsedFormat;
+ }
+ return "numeric";
+ };
+ CslStylesManager.prototype.getLastUsedNotesStyle = function() {
+ var lastUsedNotesStyle = localStorage.getItem(this._lastNotesStyleKey);
+ if (lastUsedNotesStyle === "footnotes" || lastUsedNotesStyle === "endnotes") {
+ return lastUsedNotesStyle;
+ }
+ return "footnotes";
+ };
+ CslStylesManager.prototype.getLastUsedStyleId = function() {
+ var lastUsedStyle = localStorage.getItem(this._lastStyleKey);
+ if (lastUsedStyle) {
+ return lastUsedStyle;
+ }
+ return null;
+ };
+ CslStylesManager.prototype.getLastUsedStyleIdOrDefault = function() {
+ var lastUsedStyle = localStorage.getItem(this._lastStyleKey);
+ if (lastUsedStyle) {
+ return lastUsedStyle;
+ }
+ return "ieee";
+ };
+ CslStylesManager.prototype.getStyle = function(styleName) {
+ var saveToLocalStorage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var self = this;
+ return Promise.resolve(styleName).then(function(styleName) {
+ if (self._cache[styleName]) {
+ return self._cache[styleName];
+ }
+ var customStyleNames = self._customStylesStorage.getStyleNames();
+ if (customStyleNames.indexOf(styleName) !== -1) {
+ return self._customStylesStorage.getStyle(styleName);
+ }
+ var url = self._STYLES_LOCAL + styleName + ".csl";
+ if (self._isOnlineAvailable) {
+ url = self._STYLES_URL + styleName;
+ }
+ return fetch(url).then(function(resp) {
+ return resp.text();
+ });
+ }).then(function(content) {
+ if (content && !self._isValidCSL(content) && self._isOnlineAvailable) {
+ var styleInfo = CslStylesParser.getStyleInfo(styleName, content);
+ if (styleInfo && styleInfo.dependent > 0 && styleInfo.parent) {
+ return fetch(styleInfo.parent).then(function(resp) {
+ return resp.text();
+ });
+ }
+ }
+ return content;
+ }).then(function(content) {
+ var styleFormat = content && CslStylesParser.getCitationFormat(content) || "numeric";
+ var result = {
+ content: content,
+ styleFormat: styleFormat
+ };
+ if (content && saveToLocalStorage) {
+ self._saveLastUsedStyle(styleName, content, styleFormat);
+ }
+ return result;
+ });
+ };
+ CslStylesManager.prototype.getStylesInfo = function() {
+ var self = this;
+ return Promise.all([ this._getStylesJson(), this._customStylesStorage.getStylesInfo() ]).then(function(styles) {
+ var lastStyle = self.getLastUsedStyleId() || "ieee";
+ var resultStyles = [];
+ var resultStyleNames = self._customStylesStorage.getStyleNames();
+ var loadedStyles = styles[0];
+ var customStyles = styles[1];
+ if (self._isDesktopAvailable && !self._isOnlineAvailable) {
+ loadedStyles = loadedStyles.filter(function(style) {
+ return self._defaultStyles.indexOf(style.name) >= 0 || style.name == lastStyle;
+ });
+ }
+ customStyles.forEach(function(style) {
+ if (lastStyle === style.name) {
+ resultStyles.unshift(style);
+ } else {
+ resultStyles.push(style);
+ }
+ if (self._defaultStyles.indexOf(style.name) === -1) {
+ self._defaultStyles.push(style.name);
+ }
+ });
+ loadedStyles.forEach(function(style) {
+ if (resultStyleNames.indexOf(style.name) !== -1) {
+ return;
+ }
+ if (lastStyle === style.name) {
+ resultStyles.unshift(style);
+ } else {
+ resultStyles.push(style);
+ }
+ });
+ return resultStyles;
+ });
+ };
+ CslStylesManager.prototype._getStylesJson = function() {
+ var url = this._STYLES_JSON_LOCAL;
+ if (this._isOnlineAvailable) {
+ url = this._STYLES_JSON_URL;
+ }
+ return fetch(url).then(function(resp) {
+ return resp.json();
+ });
+ };
+ CslStylesManager.prototype.cached = function(id) {
+ if (Object.hasOwnProperty.call(this._cache, id)) {
+ return this._cache[id];
+ }
+ return null;
+ };
+ CslStylesManager.prototype.isLastUsedStyleContainBibliography = function() {
+ var containBibliography = localStorage.getItem(this._lastUsedStyleContainBibliographyKey);
+ return containBibliography !== "false";
+ };
+ CslStylesManager.prototype.isStyleDefault = function(styleName) {
+ return this._defaultStyles.indexOf(styleName) >= 0;
+ };
+ CslStylesManager.prototype._isValidCSL = function(content) {
+ return content.indexOf(" -1 && content.indexOf("
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
To use Zotero you should get an API key. Navigate to Zotero API settings .
Create and copy API key into the field below.
-
- API Key
-
-
-
Save
-
Save as text
-
Work with local Zotero
+
+
+
+
+ This plugin help you search references by author, title or year in your own library.
+
+
+ To use Zotero you should get an API key.
+ Navigate to
+ Zotero API
+ settings .
+ Create and copy API key into the field below.
+
+
+
+ Click
+ Connect to Local Zotero
+ to access your local Zotero library.
+ No API key required.
+
+ Connect to Local Zotero
+
+
+
+ Click
+ Unlink citations
+ to replace all active Zotero citations and Bibliography with plain text.
+ After conversion, citations can no longer be updated.
+
+
Unlink citations
+
+
+
Search the references you want to cite in this document.
+
+
+
+
Nothing found
+
-
-
-
-
- ×
-
-
-
+
-
-
-
- Insert Bibliography
- Refresh
-
-
- Synchronize
-
-
-
-
-
Language
-
-
-
- Afrikaans
- Arabic
- Bulgarian
- Catalan
- Czech
- Welsh
- Danish
- German (Austria)
- German (Switzerland)
- German (Germany)
- Greek
- English (UK)
- English (US)
- Spanish (Chile)
- Spanish (Spain)
- Spanish (Mexico)
- Estonian
- Basque
- Persian
- Finnish
- French (Canada)
- French (France)
- Hebrew
- Croatian
- Hungarian
- Indonesian
- Icelandic
- Italian
- Japanese
- Khmer
- Korean
- Latin
- Lithuanian
- Latvian
- Mongolian
- Norwegian (Bokmål)
- Dutch
- Norwegian (Nynorsk)
- Polish
- Portuguese (Brazil)
- Portuguese (Portugal)
- Romanian
- Russian
- Slovak
- Slovenian
- Serbian
- Swedish
- Thai
- Turkish
- Ukrainian
- Vietnamese
- Chinese (PRC)
- Chinese (Taiwan)
-
-
-
-
-
-
Display citations as:
-
-
-
- Footnotes
-
-
-
- Endnotes
-
-
+
+
+
+ 0 selected
+ Cancel selection
+
+
+
+
Insert Bibliography
+
Refresh
+
+
+ Configure how citations will be formatted in your document.
+
+
+
Style
+
+
+
Language
+
+
+
+
+
+
Display citations as:
+
+
+
+
+
+
+
+
+
+ Done
+ Cancel
+
+
-
-
-
-
-
-
-
+
-
+
+