altcha 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/external/altcha.js +2 -4
  2. package/dist/external/altcha.min.js +1 -1
  3. package/dist/external/altcha.umd.cjs +2 -4
  4. package/dist/external/altcha.umd.min.cjs +1 -1
  5. package/dist/i18n/af.js +109 -3
  6. package/dist/i18n/af.umd.cjs +109 -3
  7. package/dist/i18n/africa.js +115 -21
  8. package/dist/i18n/africa.umd.cjs +115 -21
  9. package/dist/i18n/all.js +169 -183
  10. package/dist/i18n/all.umd.cjs +169 -183
  11. package/dist/i18n/am.js +109 -3
  12. package/dist/i18n/am.umd.cjs +109 -3
  13. package/dist/i18n/americas.js +111 -9
  14. package/dist/i18n/americas.umd.cjs +111 -9
  15. package/dist/i18n/ar.js +109 -3
  16. package/dist/i18n/ar.umd.cjs +109 -3
  17. package/dist/i18n/asia.js +132 -72
  18. package/dist/i18n/asia.umd.cjs +132 -72
  19. package/dist/i18n/az.js +109 -3
  20. package/dist/i18n/az.umd.cjs +109 -3
  21. package/dist/i18n/be.js +109 -3
  22. package/dist/i18n/be.umd.cjs +109 -3
  23. package/dist/i18n/bg.js +109 -3
  24. package/dist/i18n/bg.umd.cjs +109 -3
  25. package/dist/i18n/bn.js +109 -3
  26. package/dist/i18n/bn.umd.cjs +109 -3
  27. package/dist/i18n/bs.js +109 -3
  28. package/dist/i18n/bs.umd.cjs +109 -3
  29. package/dist/i18n/ca.js +109 -3
  30. package/dist/i18n/ca.umd.cjs +109 -3
  31. package/dist/i18n/cs.js +109 -3
  32. package/dist/i18n/cs.umd.cjs +109 -3
  33. package/dist/i18n/da.js +109 -3
  34. package/dist/i18n/da.umd.cjs +109 -3
  35. package/dist/i18n/de.js +109 -3
  36. package/dist/i18n/de.umd.cjs +109 -3
  37. package/dist/i18n/el.js +109 -3
  38. package/dist/i18n/el.umd.cjs +109 -3
  39. package/dist/i18n/en.js +109 -3
  40. package/dist/i18n/en.umd.cjs +109 -3
  41. package/dist/i18n/es-419.js +109 -3
  42. package/dist/i18n/es-419.umd.cjs +109 -3
  43. package/dist/i18n/es-es.js +109 -3
  44. package/dist/i18n/es-es.umd.cjs +109 -3
  45. package/dist/i18n/et.js +109 -3
  46. package/dist/i18n/et.umd.cjs +109 -3
  47. package/dist/i18n/eu.js +109 -3
  48. package/dist/i18n/eu.umd.cjs +109 -3
  49. package/dist/i18n/europe.js +145 -111
  50. package/dist/i18n/europe.umd.cjs +145 -111
  51. package/dist/i18n/fa.js +109 -3
  52. package/dist/i18n/fa.umd.cjs +109 -3
  53. package/dist/i18n/fi.js +109 -3
  54. package/dist/i18n/fi.umd.cjs +109 -3
  55. package/dist/i18n/fr-ca.js +109 -3
  56. package/dist/i18n/fr-ca.umd.cjs +109 -3
  57. package/dist/i18n/fr-fr.js +109 -3
  58. package/dist/i18n/fr-fr.umd.cjs +109 -3
  59. package/dist/i18n/ga.js +109 -3
  60. package/dist/i18n/ga.umd.cjs +109 -3
  61. package/dist/i18n/he.js +109 -3
  62. package/dist/i18n/he.umd.cjs +109 -3
  63. package/dist/i18n/hi.js +109 -3
  64. package/dist/i18n/hi.umd.cjs +109 -3
  65. package/dist/i18n/hr.js +109 -3
  66. package/dist/i18n/hr.umd.cjs +109 -3
  67. package/dist/i18n/hu.js +109 -3
  68. package/dist/i18n/hu.umd.cjs +109 -3
  69. package/dist/i18n/hy.js +109 -3
  70. package/dist/i18n/hy.umd.cjs +109 -3
  71. package/dist/i18n/id.js +109 -3
  72. package/dist/i18n/id.umd.cjs +109 -3
  73. package/dist/i18n/is.js +109 -3
  74. package/dist/i18n/is.umd.cjs +109 -3
  75. package/dist/i18n/it.js +109 -3
  76. package/dist/i18n/it.umd.cjs +109 -3
  77. package/dist/i18n/ja.js +109 -3
  78. package/dist/i18n/ja.umd.cjs +109 -3
  79. package/dist/i18n/ka.js +109 -3
  80. package/dist/i18n/ka.umd.cjs +109 -3
  81. package/dist/i18n/kk.js +109 -3
  82. package/dist/i18n/kk.umd.cjs +109 -3
  83. package/dist/i18n/ko.js +109 -3
  84. package/dist/i18n/ko.umd.cjs +109 -3
  85. package/dist/i18n/lb.js +109 -3
  86. package/dist/i18n/lb.umd.cjs +109 -3
  87. package/dist/i18n/lt.js +109 -3
  88. package/dist/i18n/lt.umd.cjs +109 -3
  89. package/dist/i18n/lv.js +109 -3
  90. package/dist/i18n/lv.umd.cjs +109 -3
  91. package/dist/i18n/me.js +109 -3
  92. package/dist/i18n/me.umd.cjs +109 -3
  93. package/dist/i18n/mk.js +109 -3
  94. package/dist/i18n/mk.umd.cjs +109 -3
  95. package/dist/i18n/mr.js +109 -3
  96. package/dist/i18n/mr.umd.cjs +109 -3
  97. package/dist/i18n/mt.js +109 -3
  98. package/dist/i18n/mt.umd.cjs +109 -3
  99. package/dist/i18n/nb.js +109 -3
  100. package/dist/i18n/nb.umd.cjs +109 -3
  101. package/dist/i18n/nl.js +109 -3
  102. package/dist/i18n/nl.umd.cjs +109 -3
  103. package/dist/i18n/pl.js +109 -3
  104. package/dist/i18n/pl.umd.cjs +109 -3
  105. package/dist/i18n/pt-br.js +109 -3
  106. package/dist/i18n/pt-br.umd.cjs +109 -3
  107. package/dist/i18n/pt-pt.js +109 -3
  108. package/dist/i18n/pt-pt.umd.cjs +109 -3
  109. package/dist/i18n/ro.js +109 -3
  110. package/dist/i18n/ro.umd.cjs +109 -3
  111. package/dist/i18n/ru.js +109 -3
  112. package/dist/i18n/ru.umd.cjs +109 -3
  113. package/dist/i18n/sk.js +109 -3
  114. package/dist/i18n/sk.umd.cjs +109 -3
  115. package/dist/i18n/sl.js +109 -3
  116. package/dist/i18n/sl.umd.cjs +109 -3
  117. package/dist/i18n/sq.js +109 -3
  118. package/dist/i18n/sq.umd.cjs +109 -3
  119. package/dist/i18n/sr.js +109 -3
  120. package/dist/i18n/sr.umd.cjs +109 -3
  121. package/dist/i18n/sv.js +109 -3
  122. package/dist/i18n/sv.umd.cjs +109 -3
  123. package/dist/i18n/sw.js +109 -3
  124. package/dist/i18n/sw.umd.cjs +109 -3
  125. package/dist/i18n/ta.js +109 -3
  126. package/dist/i18n/ta.umd.cjs +109 -3
  127. package/dist/i18n/te.js +109 -3
  128. package/dist/i18n/te.umd.cjs +109 -3
  129. package/dist/i18n/th.js +109 -3
  130. package/dist/i18n/th.umd.cjs +109 -3
  131. package/dist/i18n/tk.js +109 -3
  132. package/dist/i18n/tk.umd.cjs +109 -3
  133. package/dist/i18n/tr.js +109 -3
  134. package/dist/i18n/tr.umd.cjs +109 -3
  135. package/dist/i18n/uk.js +109 -3
  136. package/dist/i18n/uk.umd.cjs +109 -3
  137. package/dist/i18n/ur.js +109 -3
  138. package/dist/i18n/ur.umd.cjs +109 -3
  139. package/dist/i18n/uz.js +109 -3
  140. package/dist/i18n/uz.umd.cjs +109 -3
  141. package/dist/i18n/vi.js +109 -3
  142. package/dist/i18n/vi.umd.cjs +109 -3
  143. package/dist/i18n/yo.js +109 -3
  144. package/dist/i18n/yo.umd.cjs +109 -3
  145. package/dist/i18n/zh-cn.js +109 -3
  146. package/dist/i18n/zh-cn.umd.cjs +109 -3
  147. package/dist/i18n/zh-hk.js +109 -3
  148. package/dist/i18n/zh-hk.umd.cjs +109 -3
  149. package/dist/i18n/zh-tw.js +109 -3
  150. package/dist/i18n/zh-tw.umd.cjs +109 -3
  151. package/dist/lib/index.js +2 -0
  152. package/dist/lib/index.min.js +1 -1
  153. package/dist/lib/index.umd.cjs +2 -0
  154. package/dist/lib/index.umd.min.cjs +1 -1
  155. package/dist/main/altcha.i18n.js +67 -187
  156. package/dist/main/altcha.i18n.min.js +1 -1
  157. package/dist/main/altcha.i18n.umd.cjs +67 -187
  158. package/dist/main/altcha.i18n.umd.min.cjs +1 -1
  159. package/dist/main/altcha.js +6 -4
  160. package/dist/main/altcha.min.js +1 -1
  161. package/dist/main/altcha.umd.cjs +6 -4
  162. package/dist/main/altcha.umd.min.cjs +1 -1
  163. package/dist/plugins/obfuscation.plugin.js +3 -0
  164. package/dist/plugins/obfuscation.plugin.min.js +1 -1
  165. package/dist/plugins/obfuscation.plugin.umd.cjs +3 -0
  166. package/dist/plugins/obfuscation.plugin.umd.min.cjs +1 -1
  167. package/dist/workers/argon2id.js +2 -0
  168. package/dist/workers/pbkdf2.js +2 -0
  169. package/dist/workers/scrypt.js +2 -0
  170. package/dist/workers/sha.js +2 -0
  171. package/package.json +4 -2
package/dist/i18n/te.js CHANGED
@@ -1,3 +1,111 @@
1
+ const noop = () => {
2
+ };
3
+ function safe_not_equal(a, b) {
4
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
5
+ }
6
+ function subscribe_to_store(store2, run, invalidate) {
7
+ if (store2 == null) {
8
+ run(void 0);
9
+ return noop;
10
+ }
11
+ const unsub = untrack(
12
+ () => store2.subscribe(
13
+ run,
14
+ // @ts-expect-error
15
+ invalidate
16
+ )
17
+ );
18
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
19
+ }
20
+ const subscriber_queue = [];
21
+ function writable(value, start = noop) {
22
+ let stop = null;
23
+ const subscribers = /* @__PURE__ */ new Set();
24
+ function set(new_value) {
25
+ if (safe_not_equal(value, new_value)) {
26
+ value = new_value;
27
+ if (stop) {
28
+ const run_queue = !subscriber_queue.length;
29
+ for (const subscriber of subscribers) {
30
+ subscriber[1]();
31
+ subscriber_queue.push(subscriber, value);
32
+ }
33
+ if (run_queue) {
34
+ for (let i = 0; i < subscriber_queue.length; i += 2) {
35
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
36
+ }
37
+ subscriber_queue.length = 0;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ function update(fn) {
43
+ set(fn(
44
+ /** @type {T} */
45
+ value
46
+ ));
47
+ }
48
+ function subscribe(run, invalidate = noop) {
49
+ const subscriber = [run, invalidate];
50
+ subscribers.add(subscriber);
51
+ if (subscribers.size === 1) {
52
+ stop = start(set, update) || noop;
53
+ }
54
+ run(
55
+ /** @type {T} */
56
+ value
57
+ );
58
+ return () => {
59
+ subscribers.delete(subscriber);
60
+ if (subscribers.size === 0 && stop) {
61
+ stop();
62
+ stop = null;
63
+ }
64
+ };
65
+ }
66
+ return { set, update, subscribe };
67
+ }
68
+ function get(store2) {
69
+ let value;
70
+ subscribe_to_store(store2, (_) => value = _)();
71
+ return value;
72
+ }
73
+ let untracking = false;
74
+ function untrack(fn) {
75
+ var previous_untracking = untracking;
76
+ try {
77
+ untracking = true;
78
+ return fn();
79
+ } finally {
80
+ untracking = previous_untracking;
81
+ }
82
+ }
83
+ function store(defaultValue) {
84
+ const scope = {
85
+ get: (name) => {
86
+ return get(scope.store)[name];
87
+ },
88
+ set: (name, value) => {
89
+ if (typeof name === "string") {
90
+ Object.assign(get(scope.store), {
91
+ [name]: value
92
+ });
93
+ } else {
94
+ Object.assign(get(scope.store), name);
95
+ }
96
+ scope.store.set(get(scope.store));
97
+ },
98
+ store: writable(defaultValue)
99
+ };
100
+ return scope;
101
+ }
102
+ globalThis.$altcha = globalThis.$altcha || {
103
+ algorithms: /* @__PURE__ */ new Map(),
104
+ defaults: store({}),
105
+ i18n: store({}),
106
+ instances: /* @__PURE__ */ new Set(),
107
+ plugins: /* @__PURE__ */ new Set()
108
+ };
1
109
  const i18n = {
2
110
  ariaLinkLabel: "Altcha (అధికారిక వెబ్‌సైట్)",
3
111
  enterCode: "కోడ్‌ని నమోదు చేయండి",
@@ -17,6 +125,4 @@ const i18n = {
17
125
  cancel: "రద్దు చేయండి",
18
126
  enterCodeFromImage: "కొనసాగడానికి, దయచేసి క్రింది చిత్రంలో ఉన్న కోడ్‌ను నమోదు చేయండి."
19
127
  };
20
- if ("$altcha" in globalThis) {
21
- globalThis.$altcha.i18n.set("te", i18n);
22
- }
128
+ globalThis.$altcha.i18n.set("te", i18n);
@@ -2,6 +2,114 @@
2
2
  typeof define === "function" && define.amd ? define(factory) : factory();
3
3
  })((function() {
4
4
  "use strict";
5
+ const noop = () => {
6
+ };
7
+ function safe_not_equal(a, b) {
8
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
9
+ }
10
+ function subscribe_to_store(store2, run, invalidate) {
11
+ if (store2 == null) {
12
+ run(void 0);
13
+ return noop;
14
+ }
15
+ const unsub = untrack(
16
+ () => store2.subscribe(
17
+ run,
18
+ // @ts-expect-error
19
+ invalidate
20
+ )
21
+ );
22
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
23
+ }
24
+ const subscriber_queue = [];
25
+ function writable(value, start = noop) {
26
+ let stop = null;
27
+ const subscribers = /* @__PURE__ */ new Set();
28
+ function set(new_value) {
29
+ if (safe_not_equal(value, new_value)) {
30
+ value = new_value;
31
+ if (stop) {
32
+ const run_queue = !subscriber_queue.length;
33
+ for (const subscriber of subscribers) {
34
+ subscriber[1]();
35
+ subscriber_queue.push(subscriber, value);
36
+ }
37
+ if (run_queue) {
38
+ for (let i = 0; i < subscriber_queue.length; i += 2) {
39
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
40
+ }
41
+ subscriber_queue.length = 0;
42
+ }
43
+ }
44
+ }
45
+ }
46
+ function update(fn) {
47
+ set(fn(
48
+ /** @type {T} */
49
+ value
50
+ ));
51
+ }
52
+ function subscribe(run, invalidate = noop) {
53
+ const subscriber = [run, invalidate];
54
+ subscribers.add(subscriber);
55
+ if (subscribers.size === 1) {
56
+ stop = start(set, update) || noop;
57
+ }
58
+ run(
59
+ /** @type {T} */
60
+ value
61
+ );
62
+ return () => {
63
+ subscribers.delete(subscriber);
64
+ if (subscribers.size === 0 && stop) {
65
+ stop();
66
+ stop = null;
67
+ }
68
+ };
69
+ }
70
+ return { set, update, subscribe };
71
+ }
72
+ function get(store2) {
73
+ let value;
74
+ subscribe_to_store(store2, (_) => value = _)();
75
+ return value;
76
+ }
77
+ let untracking = false;
78
+ function untrack(fn) {
79
+ var previous_untracking = untracking;
80
+ try {
81
+ untracking = true;
82
+ return fn();
83
+ } finally {
84
+ untracking = previous_untracking;
85
+ }
86
+ }
87
+ function store(defaultValue) {
88
+ const scope = {
89
+ get: (name) => {
90
+ return get(scope.store)[name];
91
+ },
92
+ set: (name, value) => {
93
+ if (typeof name === "string") {
94
+ Object.assign(get(scope.store), {
95
+ [name]: value
96
+ });
97
+ } else {
98
+ Object.assign(get(scope.store), name);
99
+ }
100
+ scope.store.set(get(scope.store));
101
+ },
102
+ store: writable(defaultValue)
103
+ };
104
+ return scope;
105
+ }
106
+ globalThis.$altcha = globalThis.$altcha || {
107
+ algorithms: /* @__PURE__ */ new Map(),
108
+ defaults: store({}),
109
+ i18n: store({}),
110
+ instances: /* @__PURE__ */ new Set(),
111
+ plugins: /* @__PURE__ */ new Set()
112
+ };
5
113
  const i18n = {
6
114
  ariaLinkLabel: "Altcha (అధికారిక వెబ్‌సైట్)",
7
115
  enterCode: "కోడ్‌ని నమోదు చేయండి",
@@ -21,7 +129,5 @@
21
129
  cancel: "రద్దు చేయండి",
22
130
  enterCodeFromImage: "కొనసాగడానికి, దయచేసి క్రింది చిత్రంలో ఉన్న కోడ్‌ను నమోదు చేయండి."
23
131
  };
24
- if ("$altcha" in globalThis) {
25
- globalThis.$altcha.i18n.set("te", i18n);
26
- }
132
+ globalThis.$altcha.i18n.set("te", i18n);
27
133
  }));
package/dist/i18n/th.js CHANGED
@@ -1,3 +1,111 @@
1
+ const noop = () => {
2
+ };
3
+ function safe_not_equal(a, b) {
4
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
5
+ }
6
+ function subscribe_to_store(store2, run, invalidate) {
7
+ if (store2 == null) {
8
+ run(void 0);
9
+ return noop;
10
+ }
11
+ const unsub = untrack(
12
+ () => store2.subscribe(
13
+ run,
14
+ // @ts-expect-error
15
+ invalidate
16
+ )
17
+ );
18
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
19
+ }
20
+ const subscriber_queue = [];
21
+ function writable(value, start = noop) {
22
+ let stop = null;
23
+ const subscribers = /* @__PURE__ */ new Set();
24
+ function set(new_value) {
25
+ if (safe_not_equal(value, new_value)) {
26
+ value = new_value;
27
+ if (stop) {
28
+ const run_queue = !subscriber_queue.length;
29
+ for (const subscriber of subscribers) {
30
+ subscriber[1]();
31
+ subscriber_queue.push(subscriber, value);
32
+ }
33
+ if (run_queue) {
34
+ for (let i = 0; i < subscriber_queue.length; i += 2) {
35
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
36
+ }
37
+ subscriber_queue.length = 0;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ function update(fn) {
43
+ set(fn(
44
+ /** @type {T} */
45
+ value
46
+ ));
47
+ }
48
+ function subscribe(run, invalidate = noop) {
49
+ const subscriber = [run, invalidate];
50
+ subscribers.add(subscriber);
51
+ if (subscribers.size === 1) {
52
+ stop = start(set, update) || noop;
53
+ }
54
+ run(
55
+ /** @type {T} */
56
+ value
57
+ );
58
+ return () => {
59
+ subscribers.delete(subscriber);
60
+ if (subscribers.size === 0 && stop) {
61
+ stop();
62
+ stop = null;
63
+ }
64
+ };
65
+ }
66
+ return { set, update, subscribe };
67
+ }
68
+ function get(store2) {
69
+ let value;
70
+ subscribe_to_store(store2, (_) => value = _)();
71
+ return value;
72
+ }
73
+ let untracking = false;
74
+ function untrack(fn) {
75
+ var previous_untracking = untracking;
76
+ try {
77
+ untracking = true;
78
+ return fn();
79
+ } finally {
80
+ untracking = previous_untracking;
81
+ }
82
+ }
83
+ function store(defaultValue) {
84
+ const scope = {
85
+ get: (name) => {
86
+ return get(scope.store)[name];
87
+ },
88
+ set: (name, value) => {
89
+ if (typeof name === "string") {
90
+ Object.assign(get(scope.store), {
91
+ [name]: value
92
+ });
93
+ } else {
94
+ Object.assign(get(scope.store), name);
95
+ }
96
+ scope.store.set(get(scope.store));
97
+ },
98
+ store: writable(defaultValue)
99
+ };
100
+ return scope;
101
+ }
102
+ globalThis.$altcha = globalThis.$altcha || {
103
+ algorithms: /* @__PURE__ */ new Map(),
104
+ defaults: store({}),
105
+ i18n: store({}),
106
+ instances: /* @__PURE__ */ new Set(),
107
+ plugins: /* @__PURE__ */ new Set()
108
+ };
1
109
  const i18n = {
2
110
  ariaLinkLabel: "Altcha (เว็บไซต์ทางการ)",
3
111
  enterCode: "ป้อนรหัส",
@@ -17,6 +125,4 @@ const i18n = {
17
125
  cancel: "ยกเลิก",
18
126
  enterCodeFromImage: "เพื่อดำเนินการต่อ โปรดป้อนรหัสจากรูปภาพด้านล่าง"
19
127
  };
20
- if ("$altcha" in globalThis) {
21
- globalThis.$altcha.i18n.set("th", i18n);
22
- }
128
+ globalThis.$altcha.i18n.set("th", i18n);
@@ -2,6 +2,114 @@
2
2
  typeof define === "function" && define.amd ? define(factory) : factory();
3
3
  })((function() {
4
4
  "use strict";
5
+ const noop = () => {
6
+ };
7
+ function safe_not_equal(a, b) {
8
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
9
+ }
10
+ function subscribe_to_store(store2, run, invalidate) {
11
+ if (store2 == null) {
12
+ run(void 0);
13
+ return noop;
14
+ }
15
+ const unsub = untrack(
16
+ () => store2.subscribe(
17
+ run,
18
+ // @ts-expect-error
19
+ invalidate
20
+ )
21
+ );
22
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
23
+ }
24
+ const subscriber_queue = [];
25
+ function writable(value, start = noop) {
26
+ let stop = null;
27
+ const subscribers = /* @__PURE__ */ new Set();
28
+ function set(new_value) {
29
+ if (safe_not_equal(value, new_value)) {
30
+ value = new_value;
31
+ if (stop) {
32
+ const run_queue = !subscriber_queue.length;
33
+ for (const subscriber of subscribers) {
34
+ subscriber[1]();
35
+ subscriber_queue.push(subscriber, value);
36
+ }
37
+ if (run_queue) {
38
+ for (let i = 0; i < subscriber_queue.length; i += 2) {
39
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
40
+ }
41
+ subscriber_queue.length = 0;
42
+ }
43
+ }
44
+ }
45
+ }
46
+ function update(fn) {
47
+ set(fn(
48
+ /** @type {T} */
49
+ value
50
+ ));
51
+ }
52
+ function subscribe(run, invalidate = noop) {
53
+ const subscriber = [run, invalidate];
54
+ subscribers.add(subscriber);
55
+ if (subscribers.size === 1) {
56
+ stop = start(set, update) || noop;
57
+ }
58
+ run(
59
+ /** @type {T} */
60
+ value
61
+ );
62
+ return () => {
63
+ subscribers.delete(subscriber);
64
+ if (subscribers.size === 0 && stop) {
65
+ stop();
66
+ stop = null;
67
+ }
68
+ };
69
+ }
70
+ return { set, update, subscribe };
71
+ }
72
+ function get(store2) {
73
+ let value;
74
+ subscribe_to_store(store2, (_) => value = _)();
75
+ return value;
76
+ }
77
+ let untracking = false;
78
+ function untrack(fn) {
79
+ var previous_untracking = untracking;
80
+ try {
81
+ untracking = true;
82
+ return fn();
83
+ } finally {
84
+ untracking = previous_untracking;
85
+ }
86
+ }
87
+ function store(defaultValue) {
88
+ const scope = {
89
+ get: (name) => {
90
+ return get(scope.store)[name];
91
+ },
92
+ set: (name, value) => {
93
+ if (typeof name === "string") {
94
+ Object.assign(get(scope.store), {
95
+ [name]: value
96
+ });
97
+ } else {
98
+ Object.assign(get(scope.store), name);
99
+ }
100
+ scope.store.set(get(scope.store));
101
+ },
102
+ store: writable(defaultValue)
103
+ };
104
+ return scope;
105
+ }
106
+ globalThis.$altcha = globalThis.$altcha || {
107
+ algorithms: /* @__PURE__ */ new Map(),
108
+ defaults: store({}),
109
+ i18n: store({}),
110
+ instances: /* @__PURE__ */ new Set(),
111
+ plugins: /* @__PURE__ */ new Set()
112
+ };
5
113
  const i18n = {
6
114
  ariaLinkLabel: "Altcha (เว็บไซต์ทางการ)",
7
115
  enterCode: "ป้อนรหัส",
@@ -21,7 +129,5 @@
21
129
  cancel: "ยกเลิก",
22
130
  enterCodeFromImage: "เพื่อดำเนินการต่อ โปรดป้อนรหัสจากรูปภาพด้านล่าง"
23
131
  };
24
- if ("$altcha" in globalThis) {
25
- globalThis.$altcha.i18n.set("th", i18n);
26
- }
132
+ globalThis.$altcha.i18n.set("th", i18n);
27
133
  }));
package/dist/i18n/tk.js CHANGED
@@ -1,3 +1,111 @@
1
+ const noop = () => {
2
+ };
3
+ function safe_not_equal(a, b) {
4
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
5
+ }
6
+ function subscribe_to_store(store2, run, invalidate) {
7
+ if (store2 == null) {
8
+ run(void 0);
9
+ return noop;
10
+ }
11
+ const unsub = untrack(
12
+ () => store2.subscribe(
13
+ run,
14
+ // @ts-expect-error
15
+ invalidate
16
+ )
17
+ );
18
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
19
+ }
20
+ const subscriber_queue = [];
21
+ function writable(value, start = noop) {
22
+ let stop = null;
23
+ const subscribers = /* @__PURE__ */ new Set();
24
+ function set(new_value) {
25
+ if (safe_not_equal(value, new_value)) {
26
+ value = new_value;
27
+ if (stop) {
28
+ const run_queue = !subscriber_queue.length;
29
+ for (const subscriber of subscribers) {
30
+ subscriber[1]();
31
+ subscriber_queue.push(subscriber, value);
32
+ }
33
+ if (run_queue) {
34
+ for (let i = 0; i < subscriber_queue.length; i += 2) {
35
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
36
+ }
37
+ subscriber_queue.length = 0;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ function update(fn) {
43
+ set(fn(
44
+ /** @type {T} */
45
+ value
46
+ ));
47
+ }
48
+ function subscribe(run, invalidate = noop) {
49
+ const subscriber = [run, invalidate];
50
+ subscribers.add(subscriber);
51
+ if (subscribers.size === 1) {
52
+ stop = start(set, update) || noop;
53
+ }
54
+ run(
55
+ /** @type {T} */
56
+ value
57
+ );
58
+ return () => {
59
+ subscribers.delete(subscriber);
60
+ if (subscribers.size === 0 && stop) {
61
+ stop();
62
+ stop = null;
63
+ }
64
+ };
65
+ }
66
+ return { set, update, subscribe };
67
+ }
68
+ function get(store2) {
69
+ let value;
70
+ subscribe_to_store(store2, (_) => value = _)();
71
+ return value;
72
+ }
73
+ let untracking = false;
74
+ function untrack(fn) {
75
+ var previous_untracking = untracking;
76
+ try {
77
+ untracking = true;
78
+ return fn();
79
+ } finally {
80
+ untracking = previous_untracking;
81
+ }
82
+ }
83
+ function store(defaultValue) {
84
+ const scope = {
85
+ get: (name) => {
86
+ return get(scope.store)[name];
87
+ },
88
+ set: (name, value) => {
89
+ if (typeof name === "string") {
90
+ Object.assign(get(scope.store), {
91
+ [name]: value
92
+ });
93
+ } else {
94
+ Object.assign(get(scope.store), name);
95
+ }
96
+ scope.store.set(get(scope.store));
97
+ },
98
+ store: writable(defaultValue)
99
+ };
100
+ return scope;
101
+ }
102
+ globalThis.$altcha = globalThis.$altcha || {
103
+ algorithms: /* @__PURE__ */ new Map(),
104
+ defaults: store({}),
105
+ i18n: store({}),
106
+ instances: /* @__PURE__ */ new Set(),
107
+ plugins: /* @__PURE__ */ new Set()
108
+ };
1
109
  const i18n = {
2
110
  ariaLinkLabel: "Altcha (resmi web sahypa)",
3
111
  enterCode: "Kody giriziň",
@@ -17,6 +125,4 @@ const i18n = {
17
125
  cancel: "Ýapmak",
18
126
  enterCodeFromImage: "Dowam etmek üçin, aşakdaky suratyň koduny giriziň."
19
127
  };
20
- if ("$altcha" in globalThis) {
21
- globalThis.$altcha.i18n.set("tk", i18n);
22
- }
128
+ globalThis.$altcha.i18n.set("tk", i18n);