@supersoniks/concorde 5.0.0 → 5.0.1

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 (287) hide show
  1. package/.gitlab-ci.yml +0 -13
  2. package/build-infos.json +1 -1
  3. package/concorde-core.bundle.js +257 -273
  4. package/concorde-core.es.js +4127 -4039
  5. package/dist/concorde-core.bundle.js +257 -273
  6. package/dist/concorde-core.es.js +4127 -4039
  7. package/gitlab/job_tests.sh +25 -12
  8. package/index.html +1 -1
  9. package/package.json +3 -1
  10. package/scripts/post-build-docs.js +0 -0
  11. package/scripts/post-build.mjs +0 -0
  12. package/src/core/components/functional/fetch/fetch.md +0 -0
  13. package/src/core/components/functional/if/if.md +0 -0
  14. package/src/core/components/functional/list/list.demo.ts +0 -0
  15. package/src/core/components/functional/list/list.md +0 -0
  16. package/src/core/components/functional/list/list.ts +0 -0
  17. package/src/core/components/functional/router/router.md +0 -0
  18. package/src/core/components/functional/router/router.ts +0 -0
  19. package/src/core/components/functional/sdui/sdui.md +0 -0
  20. package/src/core/components/functional/states/states.md +0 -0
  21. package/src/core/components/functional/submit/submit.md +0 -0
  22. package/src/core/components/ui/_css/size.ts +0 -0
  23. package/src/core/components/ui/alert/alert.ts +0 -0
  24. package/src/core/components/ui/button/button.md +0 -0
  25. package/src/core/components/ui/captcha/altchaStyles.ts +0 -0
  26. package/src/core/components/ui/captcha/captcha.md +0 -0
  27. package/src/core/components/ui/card/card.md +0 -0
  28. package/src/core/components/ui/divider/divider.ts +0 -0
  29. package/src/core/components/ui/form/input/input.md +0 -0
  30. package/src/core/components/ui/form/radio/radio.md +0 -0
  31. package/src/core/components/ui/form/select/select.md +0 -0
  32. package/src/core/components/ui/form/switch/switch.md +0 -0
  33. package/src/core/components/ui/loader/loader.md +0 -0
  34. package/src/core/components/ui/menu/menu.md +0 -0
  35. package/src/core/components/ui/modal/modal-close.ts +0 -0
  36. package/src/core/components/ui/modal/modal.md +0 -0
  37. package/src/core/components/ui/pop/pop.md +103 -1
  38. package/src/core/components/ui/pop/pop.ts +70 -115
  39. package/src/core/components/ui/table/table-caption.ts +0 -0
  40. package/src/core/components/ui/table/table.md +0 -0
  41. package/src/core/components/ui/theme/theme.ts +1 -1
  42. package/src/core/components/ui/tooltip/tooltip.ts +178 -154
  43. package/src/core/utils/positioning.spec.ts +180 -0
  44. package/src/core/utils/positioning.ts +164 -0
  45. package/src/core/utils/route.ts +0 -0
  46. package/src/directives.ts +2 -3
  47. package/src/docs/_core-concept/subscriber.md +0 -0
  48. package/src/docs/_getting-started/concorde-outside.md +0 -0
  49. package/src/docs/_getting-started/my-first-subscriber.md +0 -0
  50. package/src/docs/_getting-started/pubsub.md +0 -0
  51. package/src/docs/_getting-started/start.md +0 -0
  52. package/src/docs/example/users.ts +0 -0
  53. package/src/docs/search/docs-search.json +90 -0
  54. package/src/docs/search/page.ts +0 -0
  55. package/src/docs/tailwind/css/tailwind.css +7 -6
  56. package/src/tsconfig.json +387 -381
  57. package/src/tsconfig.tsbuildinfo +1 -1
  58. package/vitest.setup.ts +49 -13
  59. package/.github/workflows/ci.yml +0 -21
  60. package/.github-export-ignore +0 -30
  61. package/CONTRIBUTING.md +0 -59
  62. package/DEV.md +0 -54
  63. package/LICENSE +0 -21
  64. package/OPEN_SOURCE_CHECKPOINT.md +0 -133
  65. package/concorde-3d.bundle.js +0 -3960
  66. package/concorde-3d.es.js +0 -33433
  67. package/concorde-hugging-face-infer.bundle.js +0 -32
  68. package/concorde-hugging-face-infer.es.js +0 -2952
  69. package/concorde-shader.bundle.js +0 -116
  70. package/concorde-shader.es.js +0 -8353
  71. package/concorde-webgpu.bundle.js +0 -307
  72. package/concorde-webgpu.es.js +0 -8627
  73. package/docs/altcha-widget.js +0 -2662
  74. package/docs/assets/index-BZiZXMU-.css +0 -1
  75. package/docs/assets/index-FmK4JaIM.js +0 -11992
  76. package/docs/crawl/core/components/functional/date/date.html +0 -190
  77. package/docs/crawl/core/components/functional/fetch/fetch.html +0 -109
  78. package/docs/crawl/core/components/functional/if/if.html +0 -27
  79. package/docs/crawl/core/components/functional/jsonata/jsonata.html +0 -79
  80. package/docs/crawl/core/components/functional/list/list.html +0 -70
  81. package/docs/crawl/core/components/functional/mix/mix.html +0 -45
  82. package/docs/crawl/core/components/functional/queue/queue.html +0 -96
  83. package/docs/crawl/core/components/functional/router/router.html +0 -106
  84. package/docs/crawl/core/components/functional/sdui/sdui.html +0 -269
  85. package/docs/crawl/core/components/functional/states/states.html +0 -66
  86. package/docs/crawl/core/components/functional/submit/submit.html +0 -160
  87. package/docs/crawl/core/components/functional/subscriber/subscriber.html +0 -67
  88. package/docs/crawl/core/components/functional/value/value.html +0 -51
  89. package/docs/crawl/core/components/ui/alert/alert.html +0 -110
  90. package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +0 -23
  91. package/docs/crawl/core/components/ui/badge/badge.html +0 -119
  92. package/docs/crawl/core/components/ui/button/button.html +0 -149
  93. package/docs/crawl/core/components/ui/captcha/captcha.html +0 -30
  94. package/docs/crawl/core/components/ui/card/card.html +0 -99
  95. package/docs/crawl/core/components/ui/divider/divider.html +0 -58
  96. package/docs/crawl/core/components/ui/form/checkbox/checkbox.html +0 -73
  97. package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +0 -135
  98. package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +0 -79
  99. package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +0 -62
  100. package/docs/crawl/core/components/ui/form/input/input.html +0 -109
  101. package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +0 -106
  102. package/docs/crawl/core/components/ui/form/radio/radio.html +0 -56
  103. package/docs/crawl/core/components/ui/form/select/select.html +0 -73
  104. package/docs/crawl/core/components/ui/form/switch/switch.html +0 -56
  105. package/docs/crawl/core/components/ui/form/textarea/textarea.html +0 -59
  106. package/docs/crawl/core/components/ui/group/group.html +0 -82
  107. package/docs/crawl/core/components/ui/icon/icon.html +0 -133
  108. package/docs/crawl/core/components/ui/image/image.html +0 -110
  109. package/docs/crawl/core/components/ui/link/link.html +0 -42
  110. package/docs/crawl/core/components/ui/loader/loader.html +0 -50
  111. package/docs/crawl/core/components/ui/menu/menu.html +0 -322
  112. package/docs/crawl/core/components/ui/modal/modal.html +0 -117
  113. package/docs/crawl/core/components/ui/pop/pop.html +0 -102
  114. package/docs/crawl/core/components/ui/progress/progress.html +0 -58
  115. package/docs/crawl/core/components/ui/table/table.html +0 -413
  116. package/docs/crawl/core/components/ui/toast/toast.html +0 -122
  117. package/docs/crawl/core/components/ui/tooltip/tooltip.html +0 -79
  118. package/docs/crawl/docs/_core-concept/dataFlow.html +0 -177
  119. package/docs/crawl/docs/_core-concept/overview.html +0 -66
  120. package/docs/crawl/docs/_core-concept/subscriber.html +0 -75
  121. package/docs/crawl/docs/_decorators/ancestor-attribute.html +0 -116
  122. package/docs/crawl/docs/_decorators/auto-subscribe.html +0 -202
  123. package/docs/crawl/docs/_decorators/bind.html +0 -141
  124. package/docs/crawl/docs/_decorators/get.html +0 -149
  125. package/docs/crawl/docs/_decorators/handle.html +0 -165
  126. package/docs/crawl/docs/_decorators/on-assign.html +0 -355
  127. package/docs/crawl/docs/_decorators/patch.html +0 -78
  128. package/docs/crawl/docs/_decorators/post.html +0 -139
  129. package/docs/crawl/docs/_decorators/publish.html +0 -61
  130. package/docs/crawl/docs/_decorators/put.html +0 -78
  131. package/docs/crawl/docs/_decorators/subscribe.html +0 -109
  132. package/docs/crawl/docs/_decorators/wait-for-ancestors.html +0 -137
  133. package/docs/crawl/docs/_directives/sub.html +0 -93
  134. package/docs/crawl/docs/_getting-started/ai-agents.html +0 -173
  135. package/docs/crawl/docs/_getting-started/concorde-manual-install.html +0 -100
  136. package/docs/crawl/docs/_getting-started/concorde-outside.html +0 -58
  137. package/docs/crawl/docs/_getting-started/create-a-component.html +0 -111
  138. package/docs/crawl/docs/_getting-started/my-first-component.html +0 -189
  139. package/docs/crawl/docs/_getting-started/my-first-subscriber.html +0 -110
  140. package/docs/crawl/docs/_getting-started/pubsub.html +0 -62
  141. package/docs/crawl/docs/_getting-started/start.html +0 -76
  142. package/docs/crawl/docs/_getting-started/theming.html +0 -85
  143. package/docs/crawl/docs/_misc/api-configuration.html +0 -149
  144. package/docs/crawl/docs/_misc/dataProviderKey.html +0 -135
  145. package/docs/crawl/docs/_misc/docs-mock-api.html +0 -158
  146. package/docs/crawl/docs/_misc/dynamic-path.html +0 -180
  147. package/docs/crawl/docs/_misc/endpoint.html +0 -50
  148. package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +0 -138
  149. package/docs/crawl/docs/_misc/html-integration.html +0 -48
  150. package/docs/crawl/hubs/decorators.html +0 -547
  151. package/docs/crawl/hubs/form-components.html +0 -357
  152. package/docs/crawl/hubs/remote-data.html +0 -452
  153. package/docs/crawl/index.html +0 -101
  154. package/docs/css/docs.css +0 -0
  155. package/docs/docs-mock-api-sw.js +0 -720
  156. package/docs/docs-mock-api-sw.js.map +0 -7
  157. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  158. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  159. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  160. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  161. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  162. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  163. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  164. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  165. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  166. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  167. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  168. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  169. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  170. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  171. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  172. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  173. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  174. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  175. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  176. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  177. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  178. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  179. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  180. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  181. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  182. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  183. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  184. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  185. package/docs/img/concorde-icon.svg +0 -5
  186. package/docs/img/concorde-logo.svg +0 -1
  187. package/docs/img/concorde.png +0 -0
  188. package/docs/img/concorde_def.png +0 -0
  189. package/docs/img/concorde_seuil.png.webp +0 -0
  190. package/docs/img/concorde_seuil_invert.png +0 -0
  191. package/docs/img/paul_metrand.jpg +0 -0
  192. package/docs/img/paul_metrand_xs.jpg +0 -0
  193. package/docs/index.html +0 -93
  194. package/docs/llms-full.txt +0 -5787
  195. package/docs/llms.txt +0 -104
  196. package/docs/robots.txt +0 -16
  197. package/docs/sitemap.xml +0 -237
  198. package/docs/src/core/components/functional/date/date.md +0 -290
  199. package/docs/src/core/components/functional/fetch/fetch.md +0 -125
  200. package/docs/src/core/components/functional/if/if.md +0 -9
  201. package/docs/src/core/components/functional/jsonata/jsonata.md +0 -56
  202. package/docs/src/core/components/functional/list/list.md +0 -65
  203. package/docs/src/core/components/functional/mix/mix.md +0 -41
  204. package/docs/src/core/components/functional/queue/queue.md +0 -72
  205. package/docs/src/core/components/functional/router/router.md +0 -94
  206. package/docs/src/core/components/functional/sdui/default-library.json +0 -108
  207. package/docs/src/core/components/functional/sdui/example.json +0 -99
  208. package/docs/src/core/components/functional/sdui/sdui.md +0 -356
  209. package/docs/src/core/components/functional/states/states.md +0 -87
  210. package/docs/src/core/components/functional/submit/submit.md +0 -114
  211. package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
  212. package/docs/src/core/components/functional/value/value.md +0 -35
  213. package/docs/src/core/components/ui/alert/alert.md +0 -121
  214. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  215. package/docs/src/core/components/ui/badge/badge.md +0 -127
  216. package/docs/src/core/components/ui/button/button.md +0 -182
  217. package/docs/src/core/components/ui/captcha/captcha.md +0 -12
  218. package/docs/src/core/components/ui/card/card.md +0 -97
  219. package/docs/src/core/components/ui/divider/divider.md +0 -35
  220. package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
  221. package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
  222. package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
  223. package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
  224. package/docs/src/core/components/ui/form/input/input.md +0 -142
  225. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -133
  226. package/docs/src/core/components/ui/form/radio/radio.md +0 -57
  227. package/docs/src/core/components/ui/form/select/select.md +0 -71
  228. package/docs/src/core/components/ui/form/switch/switch.md +0 -57
  229. package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
  230. package/docs/src/core/components/ui/group/group.md +0 -75
  231. package/docs/src/core/components/ui/icon/icon.md +0 -125
  232. package/docs/src/core/components/ui/icon/icons.json +0 -1
  233. package/docs/src/core/components/ui/image/image.md +0 -107
  234. package/docs/src/core/components/ui/link/link.md +0 -43
  235. package/docs/src/core/components/ui/loader/loader.md +0 -55
  236. package/docs/src/core/components/ui/menu/menu.md +0 -329
  237. package/docs/src/core/components/ui/modal/modal.md +0 -119
  238. package/docs/src/core/components/ui/pop/pop.md +0 -96
  239. package/docs/src/core/components/ui/progress/progress.md +0 -63
  240. package/docs/src/core/components/ui/table/table.md +0 -455
  241. package/docs/src/core/components/ui/toast/toast.md +0 -166
  242. package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
  243. package/docs/src/docs/_core-concept/dataFlow.md +0 -88
  244. package/docs/src/docs/_core-concept/overview.md +0 -57
  245. package/docs/src/docs/_core-concept/subscriber.md +0 -75
  246. package/docs/src/docs/_decorators/ancestor-attribute.md +0 -127
  247. package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
  248. package/docs/src/docs/_decorators/bind.md +0 -167
  249. package/docs/src/docs/_decorators/get.md +0 -162
  250. package/docs/src/docs/_decorators/handle.md +0 -175
  251. package/docs/src/docs/_decorators/on-assign.md +0 -390
  252. package/docs/src/docs/_decorators/patch.md +0 -70
  253. package/docs/src/docs/_decorators/post.md +0 -146
  254. package/docs/src/docs/_decorators/publish.md +0 -55
  255. package/docs/src/docs/_decorators/put.md +0 -70
  256. package/docs/src/docs/_decorators/subscribe.md +0 -100
  257. package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
  258. package/docs/src/docs/_directives/sub.md +0 -91
  259. package/docs/src/docs/_getting-started/ai-agents.md +0 -76
  260. package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
  261. package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
  262. package/docs/src/docs/_getting-started/create-a-component.md +0 -139
  263. package/docs/src/docs/_getting-started/my-first-component.md +0 -236
  264. package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
  265. package/docs/src/docs/_getting-started/pubsub.md +0 -37
  266. package/docs/src/docs/_getting-started/start.md +0 -47
  267. package/docs/src/docs/_getting-started/theming.md +0 -91
  268. package/docs/src/docs/_misc/api-configuration.md +0 -81
  269. package/docs/src/docs/_misc/dataProviderKey.md +0 -168
  270. package/docs/src/docs/_misc/docs-mock-api.md +0 -63
  271. package/docs/src/docs/_misc/dynamic-path.md +0 -71
  272. package/docs/src/docs/_misc/endpoint.md +0 -45
  273. package/docs/src/docs/_misc/formelement-subscriber-removal.md +0 -115
  274. package/docs/src/docs/_misc/html-integration.md +0 -15
  275. package/docs/src/docs/search/docs-search.json +0 -9512
  276. package/docs/src/tag-list.json +0 -1
  277. package/docs/src/tsconfig-model.json +0 -23
  278. package/docs/src/tsconfig.declarations.json +0 -22
  279. package/docs/src/tsconfig.emit.json +0 -23
  280. package/docs/src/tsconfig.json +0 -858
  281. package/docs/svg/regular/plane.svg +0 -1
  282. package/docs/svg/solid/plane.svg +0 -1
  283. package/gitlab/job_github_mirror.sh +0 -39
  284. package/scripts/github-export.mjs +0 -150
  285. package/src/css.d.ts +0 -19
  286. package/src/tsconfig.declarations.json +0 -22
  287. package/src/tsconfig.emit.json +0 -23
@@ -1,2952 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- const Le = globalThis, ht = Le.ShadowRoot && (Le.ShadyCSS === void 0 || Le.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, dt = Symbol(), At = /* @__PURE__ */ new WeakMap();
7
- let Dt = class {
8
- constructor(e, t, s) {
9
- if (this._$cssResult$ = !0, s !== dt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
- this.cssText = e, this.t = t;
11
- }
12
- get styleSheet() {
13
- let e = this.o;
14
- const t = this.t;
15
- if (ht && e === void 0) {
16
- const s = t !== void 0 && t.length === 1;
17
- s && (e = At.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && At.set(t, e));
18
- }
19
- return e;
20
- }
21
- toString() {
22
- return this.cssText;
23
- }
24
- };
25
- const es = (n) => new Dt(typeof n == "string" ? n : n + "", void 0, dt), ts = (n, ...e) => {
26
- const t = n.length === 1 ? n[0] : e.reduce(((s, i, r) => s + ((o) => {
27
- if (o._$cssResult$ === !0) return o.cssText;
28
- if (typeof o == "number") return o;
29
- throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
- })(i) + n[r + 1]), n[0]);
31
- return new Dt(t, n, dt);
32
- }, ss = (n, e) => {
33
- if (ht) n.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
34
- else for (const t of e) {
35
- const s = document.createElement("style"), i = Le.litNonce;
36
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = t.cssText, n.appendChild(s);
37
- }
38
- }, St = ht ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
39
- let t = "";
40
- for (const s of e.cssRules) t += s.cssText;
41
- return es(t);
42
- })(n) : n;
43
- /**
44
- * @license
45
- * Copyright 2017 Google LLC
46
- * SPDX-License-Identifier: BSD-3-Clause
47
- */
48
- const { is: ns, defineProperty: is, getOwnPropertyDescriptor: rs, getOwnPropertyNames: os, getOwnPropertySymbols: as, getPrototypeOf: ls } = Object, Re = globalThis, kt = Re.trustedTypes, cs = kt ? kt.emptyScript : "", us = Re.reactiveElementPolyfillSupport, we = (n, e) => n, Oe = { toAttribute(n, e) {
49
- switch (e) {
50
- case Boolean:
51
- n = n ? cs : null;
52
- break;
53
- case Object:
54
- case Array:
55
- n = n == null ? n : JSON.stringify(n);
56
- }
57
- return n;
58
- }, fromAttribute(n, e) {
59
- let t = n;
60
- switch (e) {
61
- case Boolean:
62
- t = n !== null;
63
- break;
64
- case Number:
65
- t = n === null ? null : Number(n);
66
- break;
67
- case Object:
68
- case Array:
69
- try {
70
- t = JSON.parse(n);
71
- } catch {
72
- t = null;
73
- }
74
- }
75
- return t;
76
- } }, ft = (n, e) => !ns(n, e), xt = { attribute: !0, type: String, converter: Oe, reflect: !1, useDefault: !1, hasChanged: ft };
77
- Symbol.metadata ??= Symbol("metadata"), Re.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
78
- let re = class extends HTMLElement {
79
- static addInitializer(e) {
80
- this._$Ei(), (this.l ??= []).push(e);
81
- }
82
- static get observedAttributes() {
83
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
84
- }
85
- static createProperty(e, t = xt) {
86
- if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
87
- const s = Symbol(), i = this.getPropertyDescriptor(e, s, t);
88
- i !== void 0 && is(this.prototype, e, i);
89
- }
90
- }
91
- static getPropertyDescriptor(e, t, s) {
92
- const { get: i, set: r } = rs(this.prototype, e) ?? { get() {
93
- return this[t];
94
- }, set(o) {
95
- this[t] = o;
96
- } };
97
- return { get: i, set(o) {
98
- const l = i?.call(this);
99
- r?.call(this, o), this.requestUpdate(e, l, s);
100
- }, configurable: !0, enumerable: !0 };
101
- }
102
- static getPropertyOptions(e) {
103
- return this.elementProperties.get(e) ?? xt;
104
- }
105
- static _$Ei() {
106
- if (this.hasOwnProperty(we("elementProperties"))) return;
107
- const e = ls(this);
108
- e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
109
- }
110
- static finalize() {
111
- if (this.hasOwnProperty(we("finalized"))) return;
112
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(we("properties"))) {
113
- const t = this.properties, s = [...os(t), ...as(t)];
114
- for (const i of s) this.createProperty(i, t[i]);
115
- }
116
- const e = this[Symbol.metadata];
117
- if (e !== null) {
118
- const t = litPropertyMetadata.get(e);
119
- if (t !== void 0) for (const [s, i] of t) this.elementProperties.set(s, i);
120
- }
121
- this._$Eh = /* @__PURE__ */ new Map();
122
- for (const [t, s] of this.elementProperties) {
123
- const i = this._$Eu(t, s);
124
- i !== void 0 && this._$Eh.set(i, t);
125
- }
126
- this.elementStyles = this.finalizeStyles(this.styles);
127
- }
128
- static finalizeStyles(e) {
129
- const t = [];
130
- if (Array.isArray(e)) {
131
- const s = new Set(e.flat(1 / 0).reverse());
132
- for (const i of s) t.unshift(St(i));
133
- } else e !== void 0 && t.push(St(e));
134
- return t;
135
- }
136
- static _$Eu(e, t) {
137
- const s = t.attribute;
138
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
139
- }
140
- constructor() {
141
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
142
- }
143
- _$Ev() {
144
- this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
145
- }
146
- addController(e) {
147
- (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
148
- }
149
- removeController(e) {
150
- this._$EO?.delete(e);
151
- }
152
- _$E_() {
153
- const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
154
- for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
155
- e.size > 0 && (this._$Ep = e);
156
- }
157
- createRenderRoot() {
158
- const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
159
- return ss(e, this.constructor.elementStyles), e;
160
- }
161
- connectedCallback() {
162
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
163
- }
164
- enableUpdating(e) {
165
- }
166
- disconnectedCallback() {
167
- this._$EO?.forEach(((e) => e.hostDisconnected?.()));
168
- }
169
- attributeChangedCallback(e, t, s) {
170
- this._$AK(e, s);
171
- }
172
- _$ET(e, t) {
173
- const s = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, s);
174
- if (i !== void 0 && s.reflect === !0) {
175
- const r = (s.converter?.toAttribute !== void 0 ? s.converter : Oe).toAttribute(t, s.type);
176
- this._$Em = e, r == null ? this.removeAttribute(i) : this.setAttribute(i, r), this._$Em = null;
177
- }
178
- }
179
- _$AK(e, t) {
180
- const s = this.constructor, i = s._$Eh.get(e);
181
- if (i !== void 0 && this._$Em !== i) {
182
- const r = s.getPropertyOptions(i), o = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : Oe;
183
- this._$Em = i;
184
- const l = o.fromAttribute(t, r.type);
185
- this[i] = l ?? this._$Ej?.get(i) ?? l, this._$Em = null;
186
- }
187
- }
188
- requestUpdate(e, t, s) {
189
- if (e !== void 0) {
190
- const i = this.constructor, r = this[e];
191
- if (s ??= i.getPropertyOptions(e), !((s.hasChanged ?? ft)(r, t) || s.useDefault && s.reflect && r === this._$Ej?.get(e) && !this.hasAttribute(i._$Eu(e, s)))) return;
192
- this.C(e, t, s);
193
- }
194
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
195
- }
196
- C(e, t, { useDefault: s, reflect: i, wrapped: r }, o) {
197
- s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, o ?? t ?? this[e]), r !== !0 || o !== void 0) || (this._$AL.has(e) || (this.hasUpdated || s || (t = void 0), this._$AL.set(e, t)), i === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
198
- }
199
- async _$EP() {
200
- this.isUpdatePending = !0;
201
- try {
202
- await this._$ES;
203
- } catch (t) {
204
- Promise.reject(t);
205
- }
206
- const e = this.scheduleUpdate();
207
- return e != null && await e, !this.isUpdatePending;
208
- }
209
- scheduleUpdate() {
210
- return this.performUpdate();
211
- }
212
- performUpdate() {
213
- if (!this.isUpdatePending) return;
214
- if (!this.hasUpdated) {
215
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
216
- for (const [i, r] of this._$Ep) this[i] = r;
217
- this._$Ep = void 0;
218
- }
219
- const s = this.constructor.elementProperties;
220
- if (s.size > 0) for (const [i, r] of s) {
221
- const { wrapped: o } = r, l = this[i];
222
- o !== !0 || this._$AL.has(i) || l === void 0 || this.C(i, void 0, r, l);
223
- }
224
- }
225
- let e = !1;
226
- const t = this._$AL;
227
- try {
228
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(t)) : this._$EM();
229
- } catch (s) {
230
- throw e = !1, this._$EM(), s;
231
- }
232
- e && this._$AE(t);
233
- }
234
- willUpdate(e) {
235
- }
236
- _$AE(e) {
237
- this._$EO?.forEach(((t) => t.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
238
- }
239
- _$EM() {
240
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
241
- }
242
- get updateComplete() {
243
- return this.getUpdateComplete();
244
- }
245
- getUpdateComplete() {
246
- return this._$ES;
247
- }
248
- shouldUpdate(e) {
249
- return !0;
250
- }
251
- update(e) {
252
- this._$Eq &&= this._$Eq.forEach(((t) => this._$ET(t, this[t]))), this._$EM();
253
- }
254
- updated(e) {
255
- }
256
- firstUpdated(e) {
257
- }
258
- };
259
- re.elementStyles = [], re.shadowRootOptions = { mode: "open" }, re[we("elementProperties")] = /* @__PURE__ */ new Map(), re[we("finalized")] = /* @__PURE__ */ new Map(), us?.({ ReactiveElement: re }), (Re.reactiveElementVersions ??= []).push("2.1.1");
260
- /**
261
- * @license
262
- * Copyright 2017 Google LLC
263
- * SPDX-License-Identifier: BSD-3-Clause
264
- */
265
- const pt = globalThis, Te = pt.trustedTypes, Et = Te ? Te.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, jt = "$lit$", Z = `lit$${Math.random().toFixed(9).slice(2)}$`, Bt = "?" + Z, hs = `<${Bt}>`, ne = document, $e = () => ne.createComment(""), Ae = (n) => n === null || typeof n != "object" && typeof n != "function", gt = Array.isArray, ds = (n) => gt(n) || typeof n?.[Symbol.iterator] == "function", Ge = `[
266
- \f\r]`, me = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Ct = /-->/g, Pt = />/g, te = RegExp(`>|${Ge}(?:([^\\s"'>=/]+)(${Ge}*=${Ge}*(?:[^
267
- \f\r"'\`<>=]|("|')|))|$)`, "g"), Lt = /'/g, Mt = /"/g, zt = /^(?:script|style|textarea|title)$/i, fs = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), ps = fs(1), ce = Symbol.for("lit-noChange"), L = Symbol.for("lit-nothing"), It = /* @__PURE__ */ new WeakMap(), se = ne.createTreeWalker(ne, 129);
268
- function Ft(n, e) {
269
- if (!gt(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
270
- return Et !== void 0 ? Et.createHTML(e) : e;
271
- }
272
- const gs = (n, e) => {
273
- const t = n.length - 1, s = [];
274
- let i, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = me;
275
- for (let l = 0; l < t; l++) {
276
- const c = n[l];
277
- let f, d, u = -1, _ = 0;
278
- for (; _ < c.length && (o.lastIndex = _, d = o.exec(c), d !== null); ) _ = o.lastIndex, o === me ? d[1] === "!--" ? o = Ct : d[1] !== void 0 ? o = Pt : d[2] !== void 0 ? (zt.test(d[2]) && (i = RegExp("</" + d[2], "g")), o = te) : d[3] !== void 0 && (o = te) : o === te ? d[0] === ">" ? (o = i ?? me, u = -1) : d[1] === void 0 ? u = -2 : (u = o.lastIndex - d[2].length, f = d[1], o = d[3] === void 0 ? te : d[3] === '"' ? Mt : Lt) : o === Mt || o === Lt ? o = te : o === Ct || o === Pt ? o = me : (o = te, i = void 0);
279
- const T = o === te && n[l + 1].startsWith("/>") ? " " : "";
280
- r += o === me ? c + hs : u >= 0 ? (s.push(f), c.slice(0, u) + jt + c.slice(u) + Z + T) : c + Z + (u === -2 ? l : T);
281
- }
282
- return [Ft(n, r + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
283
- };
284
- class Se {
285
- constructor({ strings: e, _$litType$: t }, s) {
286
- let i;
287
- this.parts = [];
288
- let r = 0, o = 0;
289
- const l = e.length - 1, c = this.parts, [f, d] = gs(e, t);
290
- if (this.el = Se.createElement(f, s), se.currentNode = this.el.content, t === 2 || t === 3) {
291
- const u = this.el.content.firstChild;
292
- u.replaceWith(...u.childNodes);
293
- }
294
- for (; (i = se.nextNode()) !== null && c.length < l; ) {
295
- if (i.nodeType === 1) {
296
- if (i.hasAttributes()) for (const u of i.getAttributeNames()) if (u.endsWith(jt)) {
297
- const _ = d[o++], T = i.getAttribute(u).split(Z), a = /([.?@])?(.*)/.exec(_);
298
- c.push({ type: 1, index: r, name: a[2], strings: T, ctor: a[1] === "." ? ms : a[1] === "?" ? ys : a[1] === "@" ? ws : De }), i.removeAttribute(u);
299
- } else u.startsWith(Z) && (c.push({ type: 6, index: r }), i.removeAttribute(u));
300
- if (zt.test(i.tagName)) {
301
- const u = i.textContent.split(Z), _ = u.length - 1;
302
- if (_ > 0) {
303
- i.textContent = Te ? Te.emptyScript : "";
304
- for (let T = 0; T < _; T++) i.append(u[T], $e()), se.nextNode(), c.push({ type: 2, index: ++r });
305
- i.append(u[_], $e());
306
- }
307
- }
308
- } else if (i.nodeType === 8) if (i.data === Bt) c.push({ type: 2, index: r });
309
- else {
310
- let u = -1;
311
- for (; (u = i.data.indexOf(Z, u + 1)) !== -1; ) c.push({ type: 7, index: r }), u += Z.length - 1;
312
- }
313
- r++;
314
- }
315
- }
316
- static createElement(e, t) {
317
- const s = ne.createElement("template");
318
- return s.innerHTML = e, s;
319
- }
320
- }
321
- function ue(n, e, t = n, s) {
322
- if (e === ce) return e;
323
- let i = s !== void 0 ? t._$Co?.[s] : t._$Cl;
324
- const r = Ae(e) ? void 0 : e._$litDirective$;
325
- return i?.constructor !== r && (i?._$AO?.(!1), r === void 0 ? i = void 0 : (i = new r(n), i._$AT(n, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = i : t._$Cl = i), i !== void 0 && (e = ue(n, i._$AS(n, e.values), i, s)), e;
326
- }
327
- class _s {
328
- constructor(e, t) {
329
- this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
330
- }
331
- get parentNode() {
332
- return this._$AM.parentNode;
333
- }
334
- get _$AU() {
335
- return this._$AM._$AU;
336
- }
337
- u(e) {
338
- const { el: { content: t }, parts: s } = this._$AD, i = (e?.creationScope ?? ne).importNode(t, !0);
339
- se.currentNode = i;
340
- let r = se.nextNode(), o = 0, l = 0, c = s[0];
341
- for (; c !== void 0; ) {
342
- if (o === c.index) {
343
- let f;
344
- c.type === 2 ? f = new ke(r, r.nextSibling, this, e) : c.type === 1 ? f = new c.ctor(r, c.name, c.strings, this, e) : c.type === 6 && (f = new bs(r, this, e)), this._$AV.push(f), c = s[++l];
345
- }
346
- o !== c?.index && (r = se.nextNode(), o++);
347
- }
348
- return se.currentNode = ne, i;
349
- }
350
- p(e) {
351
- let t = 0;
352
- for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
353
- }
354
- }
355
- class ke {
356
- get _$AU() {
357
- return this._$AM?._$AU ?? this._$Cv;
358
- }
359
- constructor(e, t, s, i) {
360
- this.type = 2, this._$AH = L, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = i, this._$Cv = i?.isConnected ?? !0;
361
- }
362
- get parentNode() {
363
- let e = this._$AA.parentNode;
364
- const t = this._$AM;
365
- return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
366
- }
367
- get startNode() {
368
- return this._$AA;
369
- }
370
- get endNode() {
371
- return this._$AB;
372
- }
373
- _$AI(e, t = this) {
374
- e = ue(this, e, t), Ae(e) ? e === L || e == null || e === "" ? (this._$AH !== L && this._$AR(), this._$AH = L) : e !== this._$AH && e !== ce && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : ds(e) ? this.k(e) : this._(e);
375
- }
376
- O(e) {
377
- return this._$AA.parentNode.insertBefore(e, this._$AB);
378
- }
379
- T(e) {
380
- this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
381
- }
382
- _(e) {
383
- this._$AH !== L && Ae(this._$AH) ? this._$AA.nextSibling.data = e : this.T(ne.createTextNode(e)), this._$AH = e;
384
- }
385
- $(e) {
386
- const { values: t, _$litType$: s } = e, i = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = Se.createElement(Ft(s.h, s.h[0]), this.options)), s);
387
- if (this._$AH?._$AD === i) this._$AH.p(t);
388
- else {
389
- const r = new _s(i, this), o = r.u(this.options);
390
- r.p(t), this.T(o), this._$AH = r;
391
- }
392
- }
393
- _$AC(e) {
394
- let t = It.get(e.strings);
395
- return t === void 0 && It.set(e.strings, t = new Se(e)), t;
396
- }
397
- k(e) {
398
- gt(this._$AH) || (this._$AH = [], this._$AR());
399
- const t = this._$AH;
400
- let s, i = 0;
401
- for (const r of e) i === t.length ? t.push(s = new ke(this.O($e()), this.O($e()), this, this.options)) : s = t[i], s._$AI(r), i++;
402
- i < t.length && (this._$AR(s && s._$AB.nextSibling, i), t.length = i);
403
- }
404
- _$AR(e = this._$AA.nextSibling, t) {
405
- for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
406
- const s = e.nextSibling;
407
- e.remove(), e = s;
408
- }
409
- }
410
- setConnected(e) {
411
- this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
412
- }
413
- }
414
- class De {
415
- get tagName() {
416
- return this.element.tagName;
417
- }
418
- get _$AU() {
419
- return this._$AM._$AU;
420
- }
421
- constructor(e, t, s, i, r) {
422
- this.type = 1, this._$AH = L, this._$AN = void 0, this.element = e, this.name = t, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = L;
423
- }
424
- _$AI(e, t = this, s, i) {
425
- const r = this.strings;
426
- let o = !1;
427
- if (r === void 0) e = ue(this, e, t, 0), o = !Ae(e) || e !== this._$AH && e !== ce, o && (this._$AH = e);
428
- else {
429
- const l = e;
430
- let c, f;
431
- for (e = r[0], c = 0; c < r.length - 1; c++) f = ue(this, l[s + c], t, c), f === ce && (f = this._$AH[c]), o ||= !Ae(f) || f !== this._$AH[c], f === L ? e = L : e !== L && (e += (f ?? "") + r[c + 1]), this._$AH[c] = f;
432
- }
433
- o && !i && this.j(e);
434
- }
435
- j(e) {
436
- e === L ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
437
- }
438
- }
439
- class ms extends De {
440
- constructor() {
441
- super(...arguments), this.type = 3;
442
- }
443
- j(e) {
444
- this.element[this.name] = e === L ? void 0 : e;
445
- }
446
- }
447
- class ys extends De {
448
- constructor() {
449
- super(...arguments), this.type = 4;
450
- }
451
- j(e) {
452
- this.element.toggleAttribute(this.name, !!e && e !== L);
453
- }
454
- }
455
- class ws extends De {
456
- constructor(e, t, s, i, r) {
457
- super(e, t, s, i, r), this.type = 5;
458
- }
459
- _$AI(e, t = this) {
460
- if ((e = ue(this, e, t, 0) ?? L) === ce) return;
461
- const s = this._$AH, i = e === L && s !== L || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, r = e !== L && (s === L || i);
462
- i && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
463
- }
464
- handleEvent(e) {
465
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
466
- }
467
- }
468
- class bs {
469
- constructor(e, t, s) {
470
- this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
471
- }
472
- get _$AU() {
473
- return this._$AM._$AU;
474
- }
475
- _$AI(e) {
476
- ue(this, e);
477
- }
478
- }
479
- const vs = pt.litHtmlPolyfillSupport;
480
- vs?.(Se, ke), (pt.litHtmlVersions ??= []).push("3.3.1");
481
- const $s = (n, e, t) => {
482
- const s = t?.renderBefore ?? e;
483
- let i = s._$litPart$;
484
- if (i === void 0) {
485
- const r = t?.renderBefore ?? null;
486
- s._$litPart$ = i = new ke(e.insertBefore($e(), r), r, void 0, t ?? {});
487
- }
488
- return i._$AI(n), i;
489
- };
490
- /**
491
- * @license
492
- * Copyright 2017 Google LLC
493
- * SPDX-License-Identifier: BSD-3-Clause
494
- */
495
- const _t = globalThis;
496
- class be extends re {
497
- constructor() {
498
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
499
- }
500
- createRenderRoot() {
501
- const e = super.createRenderRoot();
502
- return this.renderOptions.renderBefore ??= e.firstChild, e;
503
- }
504
- update(e) {
505
- const t = this.render();
506
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = $s(t, this.renderRoot, this.renderOptions);
507
- }
508
- connectedCallback() {
509
- super.connectedCallback(), this._$Do?.setConnected(!0);
510
- }
511
- disconnectedCallback() {
512
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
513
- }
514
- render() {
515
- return ce;
516
- }
517
- }
518
- be._$litElement$ = !0, be.finalized = !0, _t.litElementHydrateSupport?.({ LitElement: be });
519
- const As = _t.litElementPolyfillSupport;
520
- As?.({ LitElement: be });
521
- (_t.litElementVersions ??= []).push("4.2.1");
522
- /**
523
- * @license
524
- * Copyright 2017 Google LLC
525
- * SPDX-License-Identifier: BSD-3-Clause
526
- */
527
- const Ss = (n) => (e, t) => {
528
- t !== void 0 ? t.addInitializer((() => {
529
- customElements.define(n, e);
530
- })) : customElements.define(n, e);
531
- };
532
- /**
533
- * @license
534
- * Copyright 2017 Google LLC
535
- * SPDX-License-Identifier: BSD-3-Clause
536
- */
537
- const ks = { attribute: !0, type: String, converter: Oe, reflect: !1, hasChanged: ft }, xs = (n = ks, e, t) => {
538
- const { kind: s, metadata: i } = t;
539
- let r = globalThis.litPropertyMetadata.get(i);
540
- if (r === void 0 && globalThis.litPropertyMetadata.set(i, r = /* @__PURE__ */ new Map()), s === "setter" && ((n = Object.create(n)).wrapped = !0), r.set(t.name, n), s === "accessor") {
541
- const { name: o } = t;
542
- return { set(l) {
543
- const c = e.get.call(this);
544
- e.set.call(this, l), this.requestUpdate(o, c, n);
545
- }, init(l) {
546
- return l !== void 0 && this.C(o, void 0, n, l), l;
547
- } };
548
- }
549
- if (s === "setter") {
550
- const { name: o } = t;
551
- return function(l) {
552
- const c = this[o];
553
- e.call(this, l), this.requestUpdate(o, c, n);
554
- };
555
- }
556
- throw Error("Unsupported decorator location: " + s);
557
- };
558
- function O(n) {
559
- return (e, t) => typeof t == "object" ? xs(n, e, t) : ((s, i, r) => {
560
- const o = i.hasOwnProperty(r);
561
- return i.constructor.createProperty(r, s), o ? Object.getOwnPropertyDescriptor(i, r) : void 0;
562
- })(n, e, t);
563
- }
564
- function _n(n) {
565
- return n;
566
- }
567
- const Es = {
568
- load: "first-use",
569
- trigger: "mutation",
570
- debounceMs: 50,
571
- consentAboveMB: 30,
572
- allowWasmUpToMB: 50,
573
- timeoutMs: 6e4,
574
- maxItems: 2e3,
575
- maxChars: 2e3,
576
- persist: !1,
577
- resultsCacheBytes: 20 * 1024 * 1024
578
- };
579
- let tt = null;
580
- const st = /* @__PURE__ */ new Set();
581
- function Cs(n) {
582
- tt = { ...n, defaults: { ...Es, ...n.defaults } };
583
- for (const e of st) e(tt);
584
- }
585
- function Ps() {
586
- return tt;
587
- }
588
- function Ht(n) {
589
- return st.add(n), () => st.delete(n);
590
- }
591
- const Ls = /\$\{|\{\$/;
592
- function Ms(n) {
593
- return Ls.test(n);
594
- }
595
- function oe(n) {
596
- const e = typeof n == "string" ? n : n.path;
597
- if (Ms(e))
598
- throw new Error(
599
- "Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths."
600
- );
601
- return e;
602
- }
603
- const Ke = "1";
604
- function Is(n) {
605
- const e = n.trim();
606
- if (!e) return !1;
607
- try {
608
- const t = new URL(e, "https://example.invalid/");
609
- return t.protocol === "http:" || t.protocol === "https:" || t.protocol === "blob:";
610
- } catch {
611
- return !1;
612
- }
613
- }
614
- class P {
615
- /** Langue page : `SonicSelectedLanguage` localStorage, sinon `<html lang>`. */
616
- static getLanguage() {
617
- const e = document.documentElement.lang;
618
- return localStorage.getItem("SonicSelectedLanguage") || e;
619
- }
620
- static getCookies() {
621
- return document.cookie.split(";").reduce((e, t) => {
622
- const s = t.indexOf("=");
623
- return e[t.substring(0, s).trim()] = t.substring(
624
- s + 1
625
- ), e;
626
- }, {});
627
- }
628
- /**
629
- * Ancêtre suivant dans l'arbre composé : slot de projection, sinon parentNode / shadow host.
630
- * Nécessaire pour trouver un scroller/clipper dans le shadow d'un ancêtre (ex. #modal.custom-scroll).
631
- */
632
- static nextComposedAncestor(e) {
633
- return e instanceof Element && e.assignedSlot ? e.assignedSlot : e.parentNode || e.host || null;
634
- }
635
- static everyAncestors(e, t) {
636
- let s = e;
637
- for (; s; ) {
638
- if (!t(s)) return;
639
- s = s.parentNode || s.host;
640
- }
641
- }
642
- static overflowMatches(e, t) {
643
- return t.includes(e.overflowY) || t.includes(e.overflowX);
644
- }
645
- static findAncestorByOverflow(e, t) {
646
- let s = e;
647
- for (; s; ) {
648
- if (s instanceof Element && s.nodeType === 1) {
649
- const i = window.getComputedStyle(s);
650
- if (P.overflowMatches(i, t))
651
- return s;
652
- }
653
- s = P.nextComposedAncestor(s);
654
- }
655
- return null;
656
- }
657
- /**
658
- * Ancêtre qui clippe (inclut overflow:hidden) — ex. clamp de sonic-pop.
659
- * Reconnaît aussi overflow:overlay (.custom-scroll) et traverse les slots.
660
- */
661
- static getScrollableAncestor(e) {
662
- return P.findAncestorByOverflow(e, [
663
- "auto",
664
- "scroll",
665
- "hidden",
666
- "overlay"
667
- ]);
668
- }
669
- /**
670
- * Ancêtre réellement scrollable (pas overflow:hidden) — ex. restore scroll Safari de sonic-queue.
671
- */
672
- static getScrollingAncestor(e) {
673
- return P.findAncestorByOverflow(e, ["auto", "scroll", "overlay"]);
674
- }
675
- /** Noms d'attribut DOM à tester (Lit reflect → minuscules, ex. serviceURL → serviceurl). */
676
- static scopeAttributeNames(e) {
677
- const t = e.toLowerCase();
678
- return t === e ? [e] : [e, t];
679
- }
680
- static readScopeAttributeOnElement(e, t) {
681
- for (const s of P.scopeAttributeNames(t))
682
- if (e.hasAttribute(s))
683
- return e.getAttribute(s) ?? "";
684
- return null;
685
- }
686
- /**
687
- * Première valeur d'attribut trouvée en remontant (parentNode / shadow host).
688
- * Ne traverse pas les slots — volontairement distinct de `nextComposedAncestor`.
689
- */
690
- static getAncestorAttributeValue(e, t) {
691
- if (!e) return null;
692
- let s = e;
693
- for (; s; ) {
694
- if (s instanceof HTMLElement) {
695
- const r = P.readScopeAttributeOnElement(s, t);
696
- if (r != null) return r;
697
- }
698
- const i = s.parentNode || s.host;
699
- if (!i) break;
700
- s = i;
701
- }
702
- return null;
703
- }
704
- /**
705
- * Petite fonction utilitaire pour retourner la configuration a passer à l'utilitaire API
706
- * Utilisée pour la configuration du wording / de la traduction ainsi que par le mixin fetcher par exemple
707
- */
708
- static getApiConfiguration(e) {
709
- const t = P.getAncestorAttributeValue(e, "token"), s = P.getAncestorAttributeValue(e, "addHTTPResponse") != null, i = P.getAncestorAttributeValue(e, "serviceURL");
710
- let r = null, o = null;
711
- const l = P.getAncestorAttributeValue(e, "tokenProvider"), c = P.getAncestorAttributeValue(e, "eventsApiToken");
712
- t || (r = P.getAncestorAttributeValue(e, "userName"), o = P.getAncestorAttributeValue(e, "password"));
713
- const f = P.getAncestorAttributeValue(
714
- e,
715
- "credentials"
716
- ) || void 0, d = e.getAttribute("cache"), u = e.hasAttribute("blockUntilDone"), _ = e.hasAttribute("keepAlive");
717
- return {
718
- serviceURL: i,
719
- token: t,
720
- userName: r,
721
- password: o,
722
- authToken: c,
723
- tokenProvider: l,
724
- addHTTPResponse: s,
725
- credentials: f,
726
- cache: d,
727
- blockUntilDone: u,
728
- keepAlive: _
729
- };
730
- }
731
- /** Ancêtre dont le `nodeName` (minuscules) égale `selector` (ex. `"form"`). */
732
- static getClosestElement(e, t) {
733
- let s = e;
734
- for (; s && !(s.nodeName && s.nodeName.toLowerCase() === t); ) {
735
- const i = s.parentNode || s.host;
736
- if (!i) {
737
- s = null;
738
- break;
739
- }
740
- s = i;
741
- }
742
- return s?.nodeName ? s : null;
743
- }
744
- static getClosestForm(e) {
745
- return P.getClosestElement(e, "form");
746
- }
747
- /**
748
- * Ancêtres dont le tagName matche (insensible à la casse), via parentNode / shadow host.
749
- */
750
- static getAncestorsByTagNames(e, t) {
751
- const s = new Set(t.map((o) => o.toLowerCase())), i = [];
752
- let r = e.parentNode || e.host;
753
- for (; r; )
754
- r instanceof Element && s.has(r.tagName.toLowerCase()) && i.push(r), r = r.parentNode || r.host;
755
- return i;
756
- }
757
- /**
758
- * Ancêtres qui matchent l'un des sélecteurs CSS (`element.matches`), via parentNode / shadow host.
759
- */
760
- static getAncestorsBySelectors(e, t) {
761
- const s = [];
762
- let i = e.parentNode || e.host;
763
- for (; i; ) {
764
- if (i instanceof Element)
765
- for (const r of t)
766
- try {
767
- if (i.matches(r)) {
768
- s.push(i);
769
- break;
770
- }
771
- } catch {
772
- }
773
- i = i.parentNode || i.host;
774
- }
775
- return s;
776
- }
777
- /**
778
- * Charge un JS ; true si succès, false sinon.
779
- * `.es.js` / `?module` → `type="module"`. Déduplique sur `script.src` absolu.
780
- * Refuse les schémas non scriptables (`javascript:`, `data:`, …).
781
- */
782
- static async loadJS(e) {
783
- if (!Is(e)) return !1;
784
- const t = typeof document < "u" ? new URL(e, document.baseURI).href : e, s = Array.from(document.scripts).find(
785
- (r) => r.src === t
786
- );
787
- if (s)
788
- return s.dataset.concordeLoaded === Ke ? !0 : new Promise((r) => {
789
- let o = !1;
790
- const l = (f) => {
791
- o || (o = !0, f && (s.dataset.concordeLoaded = Ke), r(f));
792
- };
793
- s.addEventListener("load", () => l(!0), { once: !0 }), s.addEventListener("error", () => l(!1), {
794
- once: !0
795
- });
796
- const c = s.readyState;
797
- if (c === "complete" || c === "loaded") {
798
- l(!0);
799
- return;
800
- }
801
- Promise.resolve().then(() => {
802
- Promise.resolve().then(() => {
803
- o || l(!0);
804
- });
805
- });
806
- });
807
- const i = /\.es\.js(\?|#|$)/.test(e) || /[?&]module(?:&|=|$)/.test(e);
808
- return new Promise((r) => {
809
- const o = document.createElement("script");
810
- o.src = e, i && (o.type = "module"), o.onload = () => {
811
- o.dataset.concordeLoaded = Ke, r(!0);
812
- }, o.onerror = () => r(!1), document.head.appendChild(o);
813
- });
814
- }
815
- /** Charge un CSS ; résout toujours `true` (historique, y compris en erreur). */
816
- static async loadCSS(e) {
817
- return new Promise((t) => {
818
- const s = document.createElement("link");
819
- s.type = "text/css", s.rel = "stylesheet", s.href = e, s.onload = () => t(!0), s.onerror = () => t(!0), document.head.appendChild(s);
820
- });
821
- }
822
- }
823
- class W {
824
- /**
825
- * Effectue une comparaison d'égalité non profonde entre deux objets.
826
- */
827
- /*eslint-disable @typescript-eslint/no-explicit-any*/
828
- static shallowEqual(e, t, s = !0) {
829
- const i = Object.keys(e), r = Object.keys(t);
830
- if (i.length !== r.length && s)
831
- return !1;
832
- for (const o of i) {
833
- const l = e[o], c = t[o];
834
- if (s ? l !== c : l != c)
835
- return !1;
836
- }
837
- return !0;
838
- }
839
- /*eslint-enable @typescript-eslint/no-explicit-any*/
840
- /**
841
- * Effectue une comparaison d'égalité profonde entre deux objets.
842
- */
843
- /*eslint-disable @typescript-eslint/no-explicit-any*/
844
- static deepEqual(e, t, s = !0) {
845
- const i = Object.keys(e), r = Object.keys(t);
846
- if (i.length !== r.length && s)
847
- return !1;
848
- for (const o of i) {
849
- const l = e[o], c = t[o], f = W.isObject(l) && W.isObject(c), d = s ? l !== c : l != c;
850
- if (f && !W.deepEqual(l, c) || !f && d)
851
- return !1;
852
- }
853
- return !0;
854
- }
855
- /*eslint-enable @typescript-eslint/no-explicit-any*/
856
- /**
857
- * @returns true si l'objet est un objet ou un tableau (qui est un objet). mais false si null (car sinon typeof null "object")
858
- */
859
- static isObject(e) {
860
- return e != null && typeof e == "object";
861
- }
862
- /**
863
- * @returns true si l'argument est null ou undefined
864
- */
865
- static isUndefindOrNull(e) {
866
- return e == null;
867
- }
868
- static isEmpty(e) {
869
- return W.isUndefindOrNull(e) ? !0 : Object.keys(e).length === 0;
870
- }
871
- /**
872
- * traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
873
- * Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
874
- */
875
- /*eslint-disable @typescript-eslint/no-explicit-any*/
876
- static traverse(e, t, s = !1) {
877
- for (const i of t) {
878
- const r = e[i];
879
- if (r === void 0)
880
- return;
881
- s && W.isObject(r) ? e = Object.assign(Array.isArray(r) ? [] : {}, e, r) : e = e[i];
882
- }
883
- return e;
884
- }
885
- static traverseDotNotation(e, t, s = !1) {
886
- return W.traverse(e, t.split("."), s);
887
- }
888
- /*eslint-enable @typescript-eslint/no-explicit-any*/
889
- static getURLSearchArray(e, t = "") {
890
- let s = [];
891
- for (let i in e) {
892
- const r = e[i];
893
- t && (i = t + "[" + i + "]"), W.isObject(r) ? s = [
894
- ...s,
895
- ...this.getURLSearchArray(r, i)
896
- ] : s.push(`${i}=${r}`);
897
- }
898
- return s;
899
- }
900
- static getURLSearchString(e) {
901
- return W.getURLSearchArray(e, "").join("&");
902
- }
903
- }
904
- W.traverseDotNotation;
905
- let qt = "sonic";
906
- typeof __SONIC_PREFIX__ < "u" && (qt = __SONIC_PREFIX__);
907
- let Ot = qt.replace(
908
- /-([a-z])/g,
909
- (n) => n[1].toUpperCase()
910
- );
911
- const Os = Ot.charAt(0).toUpperCase() + Ot.slice(1);
912
- function xe(n) {
913
- return Object.prototype.hasOwnProperty.call(n, "__value");
914
- }
915
- function X(n) {
916
- return typeof n == "object" && n !== null;
917
- }
918
- let he = "sonic";
919
- typeof __SONIC_PREFIX__ > "u" && (he = "sonic");
920
- const Xe = he == "sonic" ? "publisher-proxies-data" : he + "-publisher-proxies-data", Y = class Y {
921
- constructor(e, t, s) {
922
- for (this._proxies_ = /* @__PURE__ */ new Map(), this._is_savable_ = !1, this._expiration_delay_ = 1e3 * 60 * 60 * 12, this._invalidate_on_page_show_ = !1, this._invalidateListeners_ = /* @__PURE__ */ new Set(), this._formInvalidateListeners_ = /* @__PURE__ */ new Set(), this._assignListeners_ = /* @__PURE__ */ new Set(), this._mutationListeners_ = /* @__PURE__ */ new Set(), this._fillListeners_ = /* @__PURE__ */ new Set(), this._templateFillListeners_ = /* @__PURE__ */ new Set(), this._lockInternalMutationPublishing_ = !1, this._instanceCounter_ = 0, this._assignmentId_ = 0, this._value_ = e, this.parent = t || null, this._parentKey_ = s, this.root = this, this._instanceCounter_ = 0; this.root.parent; )
923
- this.root = this.root.parent;
924
- }
925
- /**
926
- * Supprime le proxy et ses sous proxy
927
- * Supprime les écouteurs associés
928
- */
929
- delete() {
930
- for (const e in this._proxies_.keys())
931
- e != "_parent_" && this._proxies_.get(e)?.delete();
932
- this._invalidateListeners_.clear(), this._formInvalidateListeners_.clear(), this._assignListeners_.clear(), this._mutationListeners_.clear(), this._fillListeners_.clear(), this._templateFillListeners_.clear(), this._proxies_.clear(), Y.instances.delete(this._instanceCounter_);
933
- }
934
- /**
935
- * Utile pour savoir si quelque chose est en écoute d'une modification sur le proxy via une des methodes associées
936
- */
937
- hasListener() {
938
- return this._templateFillListeners_.size > 0 || this._assignListeners_.size > 0 || this._invalidateListeners_.size > 0 || this._formInvalidateListeners_.size > 0 || this._mutationListeners_.size > 0 || this._fillListeners_.size > 0;
939
- }
940
- _publishInternalMutation_(e = !1) {
941
- if (this._mutationListeners_.forEach(
942
- (t) => t()
943
- ), this._is_savable_ && !F.changed) {
944
- F.changed = !0, F.saveId++;
945
- const t = F.saveId;
946
- setTimeout(
947
- () => F.getInstance().saveToLocalStorage(t),
948
- 1e3
949
- );
950
- }
951
- e || this.parent && this.parent._publishInternalMutation_();
952
- }
953
- async _publishAssignement_(e = !1) {
954
- if (this._assignmentId_++, this._assignmentId_ !== this._assignmentId_) return;
955
- const s = this.get();
956
- this._assignListeners_.forEach((i) => {
957
- i(s);
958
- }), this._publishInternalMutation_(e);
959
- }
960
- _publishInvalidation_() {
961
- this._invalidateListeners_.forEach((e) => e());
962
- }
963
- _publishFormInvalidation_() {
964
- this._formInvalidateListeners_.forEach(
965
- (e) => e()
966
- );
967
- }
968
- _publishDynamicFilling_(e, t) {
969
- this._fillListeners_.forEach((s) => {
970
- s[e] !== t && (s[e] = t);
971
- }), this._publishTemplateFilling_(e, t);
972
- }
973
- _publishTemplateFilling_(e, t) {
974
- this._templateFillListeners_.forEach((s) => {
975
- const i = Object.getOwnPropertyDescriptor(s, e);
976
- i && !i.set && !i.writable || (s.propertyMap && s.propertyMap[e] && (e = s.propertyMap[e]), typeof s[e] < "u" && s[e] !== t && (s[e] = t));
977
- });
978
- }
979
- /**
980
- * Appel la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
981
- * hanlder reçois alors la nouvelle valeur interne du proxy en paramètre
982
- */
983
- onAssign(e, t = !0) {
984
- typeof e == "function" && (this._assignListeners_.has(e) || (this._assignListeners_.add(e), t && e(this.get())));
985
- }
986
- /**
987
- * Stop les appels de la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
988
- */
989
- offAssign(e) {
990
- this._assignListeners_.delete(e);
991
- }
992
- /**
993
- * Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
994
- */
995
- onInvalidate(e) {
996
- typeof e == "function" && this._invalidateListeners_.add(e);
997
- }
998
- /**
999
- * Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
1000
- */
1001
- offInvalidate(e) {
1002
- typeof e == "function" && this._invalidateListeners_.delete(e);
1003
- }
1004
- /**
1005
- * Flag les données comme étant invalides
1006
- */
1007
- invalidate() {
1008
- this._publishInvalidation_();
1009
- }
1010
- /**
1011
- * Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
1012
- */
1013
- onFormInvalidate(e) {
1014
- typeof e == "function" && this._formInvalidateListeners_.add(e);
1015
- }
1016
- /**
1017
- * Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
1018
- */
1019
- offFormInvalidate(e) {
1020
- typeof e == "function" && this._formInvalidateListeners_.delete(e);
1021
- }
1022
- invalidateForm() {
1023
- this._publishFormInvalidation_();
1024
- }
1025
- /**
1026
- * Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
1027
- *
1028
- */
1029
- onInternalMutation(e) {
1030
- typeof e == "function" && (this._mutationListeners_.add(e), e());
1031
- }
1032
- /**
1033
- * Stop les Appels de la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
1034
- */
1035
- offInternalMutation(e) {
1036
- typeof e == "function" && this._mutationListeners_.delete(e);
1037
- }
1038
- /**
1039
- * Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
1040
- * Remplit uniquement les valeurs déjà présentes dans l'objet / tableau passé en paramètre
1041
- */
1042
- startTemplateFilling(e) {
1043
- if (this._templateFillListeners_.add(e), typeof this._value_ == "object")
1044
- for (const t in this._value_) {
1045
- let s = t;
1046
- const i = this._value_[t];
1047
- e.propertyMap && e.propertyMap[t] && (s = e.propertyMap[t]), typeof e[t] < "u" && e[t] !== i && (e[s] = i);
1048
- }
1049
- }
1050
- /**
1051
- * Arrête de maintenir le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
1052
- */
1053
- stopTemplateFilling(e) {
1054
- this._templateFillListeners_.delete(e);
1055
- }
1056
- /**
1057
- * Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
1058
- * Remplit toute valeur qu'elle soit présente ou pas initialement dans l'objet
1059
- */
1060
- startDynamicFilling(e) {
1061
- this._fillListeners_.add(e);
1062
- for (const t in this._value_) {
1063
- const s = this._value_[t];
1064
- e[t] !== s && (e[t] = s);
1065
- }
1066
- }
1067
- /*
1068
- * Arrête de maintenir le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
1069
- */
1070
- stopDynamicFilling(e) {
1071
- this._fillListeners_.delete(e);
1072
- }
1073
- /**
1074
- * Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
1075
- */
1076
- set(e, t = !1) {
1077
- if (this._value_ === e || X(this._value_) && X(e) && e && xe(this._value_) && xe(e) && this._value_.__value === e.__value || !X(e) && e === this._value_.__value)
1078
- return !0;
1079
- this._value_ = X(e) ? e : { __value: e }, this._cachedGet_ = void 0;
1080
- const s = xe(this._value_);
1081
- if (this._parentKey_ && this.parent) {
1082
- const i = xe(this._value_) ? this._value_.__value : this._value_;
1083
- if (this.parent?.get() == null && this.parent?.get() == null)
1084
- if (isNaN(Number(this._parentKey_)))
1085
- this.parent.set({ [this._parentKey_]: i });
1086
- else {
1087
- const r = [];
1088
- r[Number(this._parentKey_)] = i, this.parent.set(r);
1089
- }
1090
- else
1091
- this.parent._value_[this._parentKey_] = i;
1092
- }
1093
- if (s)
1094
- return this._proxies_.forEach((i, r) => {
1095
- r != "_parent_" && (i.set(null), this._publishDynamicFilling_(r, null));
1096
- }), this._publishAssignement_(t), this.parent && this._parentKey_ && this.parent._publishDynamicFilling_(
1097
- this._parentKey_,
1098
- this._value_.__value
1099
- ), !0;
1100
- for (const i in this._value_)
1101
- this._value_[i] === void 0 && delete this._value_[i];
1102
- if (this._proxies_.forEach((i, r) => {
1103
- const o = this._value_[r];
1104
- r != "_parent_" && o === void 0 && o !== null && isNaN(Number(r)) && (i.set(null), this._publishDynamicFilling_(r, null));
1105
- }), this._publishAssignement_(), this.parent && this._parentKey_ && this.parent._publishDynamicFilling_(
1106
- this._parentKey_,
1107
- this._value_
1108
- ), X(this._value_))
1109
- for (const i in this._value_) {
1110
- const r = e[i], l = X(r) ? r : { __value: r };
1111
- if (!this._proxies_.has(i)) {
1112
- this._publishDynamicFilling_(i, r);
1113
- continue;
1114
- }
1115
- this._proxies_.get(i)?.set(l, !0), this._publishDynamicFilling_(i, r);
1116
- }
1117
- return !0;
1118
- }
1119
- get() {
1120
- if (Ts(this), this._cachedGet_ !== void 0) return this._cachedGet_;
1121
- if (Object.prototype.hasOwnProperty.call(this._value_, "__value")) {
1122
- const e = this._value_.__value;
1123
- return this._cachedGet_ = e ?? null;
1124
- }
1125
- return this._cachedGet_ = this._value_ != null ? this._value_ : null;
1126
- }
1127
- /**
1128
- * retourner le webcomponent auquel le proxy est associé
1129
- */
1130
- get $tag() {
1131
- return this._instanceCounter_ || (Y.instancesCounter++, this._instanceCounter_ = Y.instancesCounter), Y.instances.set(this._instanceCounter_, this), "<" + he + '-publisher-proxy publisher="' + this._instanceCounter_ + '"></' + he + "-publisher-proxy>";
1132
- }
1133
- };
1134
- Y.instances = /* @__PURE__ */ new Map(), Y.instancesCounter = 0;
1135
- let Ue = Y;
1136
- const Tt = [];
1137
- function Ts(n) {
1138
- Tt.length > 0 && Tt[0].add(n);
1139
- }
1140
- const m = class m {
1141
- constructor() {
1142
- if (this.enabledLocaStorageProxies = [], this.publishers = /* @__PURE__ */ new Map(), this.localStorageData = {}, this.isLocalStrorageReady = null, this.initialisedData = [], m.instance != null) throw "Singleton / use getInstance";
1143
- m.instance = this, this.isLocalStrorageReady = this.cleanStorageData(), m.initPageShowHandler();
1144
- }
1145
- static initPageShowHandler() {
1146
- m.pageShowHandlerInitialized || (m.pageShowHandlerInitialized = !0, window.addEventListener("pageshow", (e) => {
1147
- e.persisted && m.getInstance().invalidateAll();
1148
- }));
1149
- }
1150
- invalidateAll() {
1151
- this.publishers.forEach((e) => {
1152
- e._invalidate_on_page_show_ && e.invalidate();
1153
- });
1154
- }
1155
- async cleanStorageData() {
1156
- return new Promise((e) => {
1157
- (async () => {
1158
- try {
1159
- let s = localStorage.getItem(Xe), i = null;
1160
- if (s && (i = await this.decompress(s, "gzip")), i)
1161
- try {
1162
- this.localStorageData = JSON.parse(i);
1163
- } catch {
1164
- this.localStorageData = {};
1165
- }
1166
- else
1167
- s = await this.compress("{}", "gzip"), localStorage.setItem(Xe, s), this.localStorageData = {};
1168
- const r = 1e3 * 60 * 60 * 12;
1169
- for (const o in this.localStorageData) {
1170
- const l = this.localStorageData[o], c = (/* @__PURE__ */ new Date()).getTime() - (l.expirationDelayMs || r);
1171
- l.lastModifiationMS < c && delete this.localStorageData[o];
1172
- }
1173
- e(!0);
1174
- } catch {
1175
- window.requestAnimationFrame(() => {
1176
- e(!1);
1177
- }), console.warn("no publisher cache in this browser");
1178
- }
1179
- })();
1180
- });
1181
- }
1182
- /**
1183
- * PublisherManager est un singleton
1184
- */
1185
- static getInstance(e) {
1186
- if (e) {
1187
- const t = m.instances.get(e);
1188
- return t || (console.warn(
1189
- "No PublisherManager instance registered with id:",
1190
- e,
1191
- "creating new one"
1192
- ), new m());
1193
- }
1194
- return m.instance == null ? new m() : m.instance;
1195
- }
1196
- /**
1197
- * shortcut static pour obtenir un publisher vias sont id/adresse sans taper getInstance.
1198
- * Si le publisher n'existe pas, il est créé.
1199
- */
1200
- static get(e, t) {
1201
- return m.getInstance().get(e, t);
1202
- }
1203
- /**
1204
- * Obtenir un publisher vias sont id/adresse
1205
- * Si le publisher n'existe pas, il est créé.
1206
- */
1207
- async setLocalData(e, t) {
1208
- await this.isLocalStrorageReady, e.set(
1209
- this.localStorageData[t + "¤lang_" + P.getLanguage()]?.data || e.get()
1210
- );
1211
- }
1212
- get(e, t) {
1213
- const s = t?.localStorageMode === "enabled", i = t?.invalidateOnPageShow === !0;
1214
- if (!this.publishers.has(e)) {
1215
- const l = nt({});
1216
- this.set(e, l);
1217
- }
1218
- const r = this.publishers.get(e);
1219
- return s && this.initialisedData.indexOf(e) === -1 && (t?.expirationDelayMs && (r._expiration_delay_ = t.expirationDelayMs), r._is_savable_ = !0, this.initialisedData.push(e), this.setLocalData(r, e)), i && (r._invalidate_on_page_show_ = i), this.publishers.get(e);
1220
- }
1221
- /**
1222
- * Remplace un publisher pour l'id fourni par un autre.
1223
- * L'autre publisher n'est pas supprimé.
1224
- */
1225
- set(e, t) {
1226
- this.publishers.set(e, t);
1227
- }
1228
- /**
1229
- * @warning
1230
- * !!!!! ATTENTION !!!!!
1231
- * Il est fort à aprier que vous ne voulez pas utiliser cette methode
1232
- * Il s'agit d'une supression complete
1233
- * * du publisher de la liste
1234
- * * des bindings
1235
- * * de même que ses sous publishers
1236
- *
1237
- * UTILISEZ PLUTÔT la méthode publisher.set({}) pour réinitialiser un publisher sans perdre les ecouteurs
1238
- */
1239
- delete(e) {
1240
- return this.publishers.has(e) ? (this.publishers.delete(e), !0) : !1;
1241
- }
1242
- async saveToLocalStorage(e = 0) {
1243
- if (!(e !== m.saveId && e % 10 != 0))
1244
- try {
1245
- if (!m.changed || m.saving) return;
1246
- m.saving = !0, m.changed = !1;
1247
- const t = Array.from(this.publishers.keys());
1248
- let s = !1;
1249
- for (const i of t) {
1250
- const r = this.publishers.get(i);
1251
- if (!r?._is_savable_) continue;
1252
- const o = r?.get();
1253
- o && (this.localStorageData[i + "¤lang_" + P.getLanguage()] = {
1254
- lastModifiationMS: (/* @__PURE__ */ new Date()).getTime(),
1255
- expirationDelayMs: r._expiration_delay_,
1256
- data: o
1257
- }, s = !0);
1258
- }
1259
- if (s) {
1260
- const i = await this.compress(
1261
- JSON.stringify(this.localStorageData),
1262
- "gzip"
1263
- );
1264
- localStorage.setItem(Xe, i);
1265
- }
1266
- if (m.saving = !1, m.changed) {
1267
- m.saveId++;
1268
- const i = m.saveId;
1269
- setTimeout(() => this.saveToLocalStorage(i), 1e3);
1270
- }
1271
- } catch {
1272
- m.saving = !1;
1273
- }
1274
- }
1275
- async compress(e, t) {
1276
- const s = new TextEncoder().encode(e), i = window, r = new i.CompressionStream(t), o = r.writable.getWriter();
1277
- o.write(s), o.close();
1278
- const l = await new Response(r.readable).arrayBuffer(), c = new Uint8Array(l);
1279
- let f = "";
1280
- for (let d = 0; d < c.length; d++)
1281
- f += String.fromCharCode(c[d]);
1282
- return btoa(f);
1283
- }
1284
- async decompress(e, t) {
1285
- const s = atob(e), r = Uint8Array.from(
1286
- s,
1287
- (d) => d.charCodeAt(0)
1288
- ).buffer, o = window, l = new o.DecompressionStream(t), c = l.writable.getWriter();
1289
- c.write(r), c.close();
1290
- const f = await new Response(l.readable).arrayBuffer();
1291
- return new TextDecoder().decode(f);
1292
- }
1293
- };
1294
- m.buildDate = "Wed Sep 30 2026 10:44:55 GMT+0200 (Central European Summer Time)", m.changed = !1, m.saving = !1, m.saveId = 0, m.instance = null, m.instances = /* @__PURE__ */ new Map(), m.pageShowHandlerInitialized = !1;
1295
- let F = m;
1296
- if (typeof window < "u") {
1297
- const n = window, e = Os + "PublisherManager", t = n[e] || F;
1298
- if (n[e] || (n[e] = F), t !== F) {
1299
- const s = [
1300
- "instance",
1301
- "instances",
1302
- "changed",
1303
- "saving",
1304
- "saveId",
1305
- "pageShowHandlerInitialized"
1306
- ];
1307
- for (const i of s)
1308
- Object.defineProperty(F, i, {
1309
- configurable: !0,
1310
- get() {
1311
- return t[i];
1312
- },
1313
- set(r) {
1314
- t[i] = r;
1315
- }
1316
- });
1317
- }
1318
- }
1319
- const Us = /* @__PURE__ */ new Set([
1320
- "invalidate",
1321
- "onInvalidate",
1322
- "offInvalidate",
1323
- "invalidateForm",
1324
- "onFormInvalidate",
1325
- "offFormInvalidate",
1326
- "onAssign",
1327
- "offAssign",
1328
- "startDynamicFilling",
1329
- "stopDynamicFilling",
1330
- "startTemplateFilling",
1331
- "stopTemplateFilling",
1332
- "onInternalMutation",
1333
- "offInternalMutation",
1334
- "set",
1335
- "get",
1336
- "$tag",
1337
- "_cachedGet_",
1338
- "_templateFillListeners_",
1339
- "_fillListeners_",
1340
- "_assignListeners_",
1341
- "_invalidateListeners_",
1342
- "_formInvalidateListeners_",
1343
- "_publishInternalMutation_",
1344
- "hasListener",
1345
- "delete",
1346
- "_mutationListeners_",
1347
- "_publishDynamicFilling_",
1348
- "_publishInvalidation_",
1349
- "_publishFormInvalidation_",
1350
- "_publishTemplateFilling_",
1351
- "_publishAssignement_",
1352
- "_proxies_",
1353
- "parent",
1354
- "_parentKey_",
1355
- "_value_",
1356
- "_is_savable_",
1357
- "_expiration_delay_",
1358
- "_lockInternalMutationPublishing_",
1359
- "_instanceCounter_",
1360
- "_assignmentId_",
1361
- "_invalidate_on_page_show_"
1362
- ]);
1363
- function Ns(n, e) {
1364
- return {
1365
- /**
1366
- * Lorsque l'on écrit monConteneur = publisher.maClef ou monConteneur = publisher["maClef"] monConteneur contient :
1367
- * Les methodes de PublisherProxy (onAssign... : voir liste dans kle tableaus si dessous), si la clef est une méthode de PublisherProxy,,
1368
- * Sinon un autre proxy qui a comme valeur interne la valeur corespondante à la clef dans l'objet.
1369
- */
1370
- get: function(t, s) {
1371
- if (typeof s == "string" && Us.has(s))
1372
- return n[s];
1373
- if (s == Symbol.toPrimitive)
1374
- return () => e().get();
1375
- if (!n._proxies_.has(s)) {
1376
- const i = n._value_[s], r = nt(
1377
- X(i) ? i : { __value: i },
1378
- n,
1379
- s
1380
- );
1381
- r._proxies_.set("_parent_", e()), n._proxies_.set(s, r);
1382
- }
1383
- return n._proxies_.get(s);
1384
- },
1385
- /**
1386
- * Lorsque l'on écrit publisher.maClef = value ou publisher["maClef"] = value, on assigne la valeur à la clef dans l'objet interne.
1387
- * Les gestionnairs associés sopnt déclenchés en conséquence de manière profonde et remontante si nécessaire.
1388
- */
1389
- set: function(t, s, i) {
1390
- if (s == "_value_")
1391
- return n._value_ = i, !0;
1392
- if (s == "_cachedGet_")
1393
- return n._cachedGet_ = i, !0;
1394
- if (s == "_assignmentId_")
1395
- return n._assignmentId_ = i, !0;
1396
- if (s == "_is_savable_")
1397
- return n._is_savable_ = i, !0;
1398
- if (s == "_expiration_delay_")
1399
- return n._expiration_delay_ = i, !0;
1400
- if (s == "_invalidate_on_page_show_")
1401
- return n._invalidate_on_page_show_ = i, !0;
1402
- if (s == "_instanceCounter_")
1403
- return n._instanceCounter_ = i, !0;
1404
- if (!n._proxies_.has(s)) {
1405
- const o = nt(
1406
- {},
1407
- n,
1408
- s
1409
- );
1410
- o._proxies_.set("_parent_", e()), n._proxies_.set(s, o);
1411
- }
1412
- return n._value_[s] !== i && (n._value_[s] = i, n._publishDynamicFilling_(s, i), n._proxies_.get(s)?.set(X(i) ? i : { __value: i })), !0;
1413
- },
1414
- /**
1415
- * Autres propriétés classiques d'un objet implémentées par le proxy
1416
- */
1417
- deleteProperty: function(t, s) {
1418
- return n._publishDynamicFilling_(s, null), n._proxies_.get(s)?.set(null), delete n._value_[s];
1419
- },
1420
- // enumerate: function (publisherInstance, sKey): CoreJSType {
1421
- // return publisherInstance._value_.keys();
1422
- // },
1423
- has: function(t, s) {
1424
- return s in n._value_ && s != "_lockInternalMutationPublishing_";
1425
- },
1426
- defineProperty: function(t, s, i) {
1427
- return i && "value" in i && (n._value_[s] = i.value), !0;
1428
- },
1429
- getOwnPropertyDescriptor: function(t, s) {
1430
- return {
1431
- enumerable: !0,
1432
- configurable: !0
1433
- };
1434
- },
1435
- ownKeys: function(t) {
1436
- return n._value_.__value ? Object.keys(n._value_.__value) : Object.keys(n._value_);
1437
- }
1438
- };
1439
- }
1440
- function nt(n, e = null, t) {
1441
- const s = new Ue(n, e, t);
1442
- let i = null;
1443
- const r = Ns(s, () => i);
1444
- return i = new Proxy(
1445
- s,
1446
- r
1447
- ), i;
1448
- }
1449
- class Rs extends HTMLElement {
1450
- constructor() {
1451
- super(), this.publisherId = "", this.onAssign = (e) => {
1452
- this.innerHTML = e.toString();
1453
- };
1454
- }
1455
- connectedCallback() {
1456
- this.publisherId = this.getAttribute("publisher") || "", this.publisher = Ue.instances.get(parseInt(this.publisherId)), this.publisher?.onAssign(this.onAssign);
1457
- }
1458
- disconnectedCallback() {
1459
- this.publisher?.offAssign(this.onAssign);
1460
- }
1461
- }
1462
- try {
1463
- customElements.define(
1464
- he + "-publisher-proxy",
1465
- Rs
1466
- );
1467
- } catch {
1468
- }
1469
- function Ds(n) {
1470
- return oe(n);
1471
- }
1472
- function js(n) {
1473
- return n.split(".")[0] ?? n;
1474
- }
1475
- function Bs(n) {
1476
- return `${js(Ds(n))}/_state_`;
1477
- }
1478
- const zs = "concorde-hf-results", it = "results", Fs = 64;
1479
- async function rt(n) {
1480
- const e = globalThis.crypto?.subtle;
1481
- if (e) {
1482
- const i = await e.digest("SHA-256", n);
1483
- return [...new Uint8Array(i)].map((r) => r.toString(16).padStart(2, "0")).join("");
1484
- }
1485
- let t = 2166136261, s = 16777619;
1486
- for (let i = 0; i < n.length; i++)
1487
- t = Math.imul(t ^ n[i], 16777619) >>> 0, s = Math.imul(s ^ n[n.length - 1 - i], 2166136261) >>> 0;
1488
- return `fnv-${t.toString(16)}${s.toString(16)}-${n.length}`;
1489
- }
1490
- async function ot(n) {
1491
- if (n instanceof Blob)
1492
- return {
1493
- $blob: await rt(new Uint8Array(await n.arrayBuffer())),
1494
- type: n.type
1495
- };
1496
- if (ArrayBuffer.isView(n))
1497
- return {
1498
- $typed: n.constructor.name,
1499
- hash: await rt(
1500
- new Uint8Array(n.buffer, n.byteOffset, n.byteLength)
1501
- )
1502
- };
1503
- if (Array.isArray(n)) return Promise.all(n.map(ot));
1504
- if (n && typeof n == "object") {
1505
- const e = {};
1506
- for (const t of Object.keys(n).sort())
1507
- e[t] = await ot(n[t]);
1508
- return e;
1509
- }
1510
- return n;
1511
- }
1512
- async function Hs(n) {
1513
- const e = JSON.stringify(await ot(n));
1514
- return rt(new TextEncoder().encode(e));
1515
- }
1516
- function at(n) {
1517
- return n instanceof Blob ? !0 : Array.isArray(n) ? n.some(at) : n && typeof n == "object" ? Object.values(n).some(at) : !1;
1518
- }
1519
- const Q = /* @__PURE__ */ new Map();
1520
- function lt(n, e) {
1521
- for (Q.delete(n), Q.set(n, e); Q.size > Fs; ) {
1522
- const t = Q.keys().next().value;
1523
- if (t === void 0) break;
1524
- Q.delete(t);
1525
- }
1526
- }
1527
- let Ee = null;
1528
- function mt() {
1529
- return Ee || (Ee = new Promise((n) => {
1530
- try {
1531
- if (typeof indexedDB > "u") return n(null);
1532
- const e = indexedDB.open(zs, 1);
1533
- e.onupgradeneeded = () => {
1534
- e.result.createObjectStore(it, { keyPath: "key" }).createIndex("at", "at");
1535
- }, e.onsuccess = () => n(e.result), e.onerror = () => n(null), e.onblocked = () => n(null);
1536
- } catch {
1537
- n(null);
1538
- }
1539
- }), Ee);
1540
- }
1541
- function de(n, e, t) {
1542
- return new Promise((s) => {
1543
- try {
1544
- const i = n.transaction(it, e), r = t(i.objectStore(it));
1545
- i.oncomplete = () => s(r ? r.result : void 0), i.onerror = () => s(void 0), i.onabort = () => s(void 0);
1546
- } catch {
1547
- s(void 0);
1548
- }
1549
- });
1550
- }
1551
- async function qs(n, e, t) {
1552
- if (Q.has(n)) {
1553
- const r = Q.get(n);
1554
- return lt(n, r), { hit: !0, value: r };
1555
- }
1556
- if (!e) return { hit: !1 };
1557
- const s = await mt();
1558
- if (!s) return { hit: !1 };
1559
- const i = await de(s, "readonly", (r) => r.get(n));
1560
- return i ? t && Date.now() - i.at > t ? { hit: !1 } : (lt(n, i.value), de(s, "readwrite", (r) => r.put({ ...i, at: Date.now() })), { hit: !0, value: i.value }) : { hit: !1 };
1561
- }
1562
- async function Ws(n, e, t, s) {
1563
- if (lt(n, e), !t || at(e)) return;
1564
- const i = await mt();
1565
- if (!i) return;
1566
- let r = 0;
1567
- try {
1568
- r = JSON.stringify(e).length;
1569
- } catch {
1570
- return;
1571
- }
1572
- r > s || (await de(i, "readwrite", (o) => o.put({ key: n, value: e, bytes: r, at: Date.now() })), await Vs(i, s));
1573
- }
1574
- async function Vs(n, e) {
1575
- const t = await de(n, "readonly", (r) => r.getAll()) ?? [];
1576
- let s = t.reduce((r, o) => r + o.bytes, 0);
1577
- if (s <= e) return;
1578
- t.sort((r, o) => r.at - o.at);
1579
- const i = [];
1580
- for (const r of t) {
1581
- if (s <= e) break;
1582
- i.push(r.key), s -= r.bytes;
1583
- }
1584
- await de(n, "readwrite", (r) => {
1585
- for (const o of i) r.delete(o);
1586
- });
1587
- }
1588
- async function Js() {
1589
- Q.clear();
1590
- const n = await mt();
1591
- n && await de(n, "readwrite", (e) => e.clear());
1592
- }
1593
- function Ye(n) {
1594
- return n === null ? "null" : Array.isArray(n) ? "array" : n instanceof Blob ? "Blob" : ArrayBuffer.isView(n) ? n.constructor.name : typeof n;
1595
- }
1596
- function Gs(n) {
1597
- if (n == null || n === "") return null;
1598
- if (typeof n == "function")
1599
- return (s) => {
1600
- const i = n(s);
1601
- return typeof i == "string" ? i : null;
1602
- };
1603
- const e = (typeof n == "string" ? n.split("+") : [...n]).map((s) => s.trim()).filter(Boolean).map((s) => s.split("."));
1604
- if (!e.length) return null;
1605
- const t = (s, i) => {
1606
- if (s == null) return [];
1607
- if (!i.length)
1608
- return typeof s == "string" ? s.trim() ? [s.trim()] : [] : typeof s == "number" ? [String(s)] : Array.isArray(s) ? s.flatMap((l) => t(l, [])) : [];
1609
- if (Array.isArray(s)) return s.flatMap((l) => t(l, i));
1610
- if (typeof s != "object") return [];
1611
- const [r, ...o] = i;
1612
- return t(s[r], o);
1613
- };
1614
- return (s) => {
1615
- const i = e.map((r) => t(s, r).join(", ")).filter((r) => r.length > 0);
1616
- return i.length ? i.join(" — ") : null;
1617
- };
1618
- }
1619
- function Ks(n) {
1620
- return n == null ? !0 : typeof n == "string" ? n.trim().length === 0 : Array.isArray(n) ? n.length === 0 : typeof n == "object" && !(n instanceof Blob) && !ArrayBuffer.isView(n) ? Object.keys(n).length === 0 : !1;
1621
- }
1622
- function Xs(n, e, t) {
1623
- switch (e.kind) {
1624
- case "text": {
1625
- let s = null;
1626
- if (typeof n == "string") s = n.trim();
1627
- else if (n && typeof n == "object" && !Array.isArray(n)) {
1628
- if (!t)
1629
- return {
1630
- ok: !1,
1631
- reason: "objet reçu sans `options.text` pour en extraire le texte"
1632
- };
1633
- s = t(n);
1634
- } else
1635
- return { ok: !1, reason: `texte attendu, reçu ${Ye(n)}` };
1636
- return s ? s.length > e.maxChars ? { ok: !0, payload: s.slice(0, e.maxChars), truncated: !0 } : { ok: !0, payload: s, truncated: !1 } : { ok: !1, reason: "texte vide" };
1637
- }
1638
- case "image":
1639
- return typeof n == "string" && n.trim() ? { ok: !0, payload: n.trim(), truncated: !1 } : n instanceof Blob ? { ok: !0, payload: n, truncated: !1 } : {
1640
- ok: !1,
1641
- reason: `image attendue (URL, data URL ou Blob), reçu ${Ye(n)}`
1642
- };
1643
- case "audio":
1644
- return n instanceof Float32Array || n instanceof Float64Array ? { ok: !0, payload: n, truncated: !1 } : typeof n == "string" && n.trim() ? { ok: !0, payload: n.trim(), truncated: !1 } : {
1645
- ok: !1,
1646
- reason: `audio attendu (Float32Array, Float64Array ou URL), reçu ${Ye(n)}`
1647
- };
1648
- }
1649
- }
1650
- function Wt(n, e) {
1651
- if (Ks(n)) return { kind: "empty" };
1652
- const t = Gs(e.text), s = Array.isArray(n), i = s ? n : [n];
1653
- if (i.length > e.maxItems)
1654
- return {
1655
- kind: "invalid",
1656
- code: "too-large",
1657
- message: `Entrée trop grosse : ${i.length} éléments (maximum ${e.maxItems}).`
1658
- };
1659
- const r = [], o = [], l = [];
1660
- let c = 0;
1661
- if (i.forEach((d, u) => {
1662
- const _ = Xs(d, e, t);
1663
- _.ok ? (r.push(_.payload), o.push(u), _.truncated && c++) : l.push(s ? `[${u}] ${_.reason}` : _.reason);
1664
- }), !r.length)
1665
- return {
1666
- kind: "invalid",
1667
- code: "invalid-input",
1668
- message: `Entrée invalide : ${l.slice(0, 3).join(" ; ")}${l.length > 3 ? ` (+${l.length - 3})` : ""}.`
1669
- };
1670
- const f = [];
1671
- return c && f.push(`${c} texte(s) tronqué(s) à ${e.maxChars} caractères.`), l.length && f.push(
1672
- `${l.length} élément(s) ignoré(s) : ${l.slice(0, 3).join(" ; ")}.`
1673
- ), {
1674
- kind: "ok",
1675
- many: s,
1676
- length: i.length,
1677
- payloads: r,
1678
- positions: o,
1679
- skipped: i.length - r.length,
1680
- truncated: c,
1681
- warnings: f
1682
- };
1683
- }
1684
- function Vt(n, e) {
1685
- const t = new Array(n.length).fill(null);
1686
- return n.positions.forEach((s, i) => {
1687
- t[s] = e[i] ?? null;
1688
- }), t;
1689
- }
1690
- function Ys(n, e) {
1691
- const t = /* @__PURE__ */ new Map();
1692
- let s = Promise.resolve();
1693
- const i = (a) => e.postMessage(a), r = (a, h, g) => i({ id: a, ok: !1, error: { code: h, message: g } }), o = (a) => {
1694
- const h = String(a?.message ?? a).toLowerCase();
1695
- return a?.code ? String(a.code) : h.includes("quota") ? "quota" : h.includes("failed to fetch") || h.includes("network") || h.includes("404") || h.includes("could not locate") ? "network" : "runtime";
1696
- }, l = (a) => {
1697
- const h = { ...a.options || {} };
1698
- return h.revision = a.revision, h;
1699
- }, c = async () => {
1700
- const a = globalThis.navigator?.gpu;
1701
- if (!a || typeof a.requestAdapter != "function") return !1;
1702
- try {
1703
- return !!await a.requestAdapter();
1704
- } catch {
1705
- return !1;
1706
- }
1707
- }, f = (a) => a && typeof a == "object" && typeof a.tolist == "function" && "dims" in a, d = (a) => a && typeof a == "object" && typeof a.toBlob == "function" && typeof a.width == "number" && typeof a.channels == "number", u = async (a) => {
1708
- if (f(a)) return a.tolist();
1709
- if (d(a)) {
1710
- const h = await a.toBlob("image/png");
1711
- return { width: a.width, height: a.height, channels: a.channels, blob: h };
1712
- }
1713
- if (Array.isArray(a)) return Promise.all(a.map(u));
1714
- if (a instanceof Blob) return a;
1715
- if (a && typeof a == "object") {
1716
- const h = {};
1717
- for (const g of Object.keys(a)) h[g] = await u(a[g]);
1718
- return h;
1719
- }
1720
- return a;
1721
- }, _ = (a) => Array.isArray(a) && a.length === 1 && Array.isArray(a[0]) ? a[0] : a, T = {
1722
- async configure({ env: a }) {
1723
- const h = n.env;
1724
- if (h.allowLocalModels = !1, h.allowRemoteModels = !0, h.useBrowserCache = !0, h.useWasmCache = !0, h.cacheKey = a.cacheKey, a.remoteHost && (h.remoteHost = a.remoteHost), a.remotePathTemplate && (h.remotePathTemplate = a.remotePathTemplate), a.wasmPaths && h.backends?.onnx?.wasm) {
1725
- let g = a.wasmPaths;
1726
- if (typeof g == "string") {
1727
- const v = g.endsWith("/") ? g : g + "/", k = String(globalThis.navigator?.userAgent ?? ""), H = /Safari\//.test(k) && !/Chrome|Chromium|Android/.test(k), q = Number((/Version\/(\d+)/.exec(k) ?? [])[1] ?? 99), A = H && q < 26 && !globalThis.navigator?.gpu ? "" : ".asyncify";
1728
- g = {
1729
- mjs: `${v}ort-wasm-simd-threaded${A}.mjs`,
1730
- wasm: `${v}ort-wasm-simd-threaded${A}.wasm`
1731
- };
1732
- }
1733
- h.backends.onnx.wasm.wasmPaths = g;
1734
- }
1735
- if (a.logLevel && n.LogLevel) {
1736
- const g = n.LogLevel[String(a.logLevel).toUpperCase()];
1737
- g !== void 0 && (h.logLevel = g);
1738
- }
1739
- return { version: h.version ?? null };
1740
- },
1741
- async inspect({ model: a }) {
1742
- const h = n.ModelRegistry, g = l(a);
1743
- let v = !1, k = null;
1744
- try {
1745
- v = !!await h?.is_pipeline_cached?.(
1746
- a.task,
1747
- a.repo,
1748
- g
1749
- );
1750
- } catch {
1751
- v = !1;
1752
- }
1753
- try {
1754
- const H = await h?.get_pipeline_files?.(
1755
- a.task,
1756
- a.repo,
1757
- g
1758
- );
1759
- if (H && h?.get_file_metadata) {
1760
- const A = (await Promise.all(
1761
- H.map(
1762
- (y) => h.get_file_metadata(a.repo, y, {
1763
- revision: a.revision
1764
- }).catch(() => null)
1765
- )
1766
- )).map((y) => y?.size);
1767
- A.every((y) => typeof y == "number") && (k = A.reduce((y, S) => y + S, 0));
1768
- }
1769
- } catch {
1770
- k = null;
1771
- }
1772
- return { cached: v, totalBytes: k };
1773
- },
1774
- async load({ model: a, devices: h }) {
1775
- const g = t.get(a.alias);
1776
- if (g) return { backend: g.pipe.__backend, loadMs: 0 };
1777
- const v = performance.now(), k = {}, H = (y) => {
1778
- if (y.status === "progress_total")
1779
- i({
1780
- type: "progress",
1781
- alias: a.alias,
1782
- progress: {
1783
- loadedBytes: y.loaded,
1784
- totalBytes: y.total,
1785
- percent: Math.round(y.progress ?? 0)
1786
- }
1787
- });
1788
- else if (y.status === "progress") {
1789
- k[y.file] = { loaded: y.loaded, total: y.total };
1790
- const S = Object.values(k), U = S.reduce((fe, N) => fe + (N.loaded || 0), 0), D = S.reduce((fe, N) => fe + (N.total || 0), 0);
1791
- i({
1792
- type: "progress",
1793
- alias: a.alias,
1794
- progress: {
1795
- file: y.file,
1796
- loadedBytes: U,
1797
- totalBytes: D,
1798
- percent: D ? Math.round(U / D * 100) : 0
1799
- }
1800
- });
1801
- }
1802
- }, q = [];
1803
- for (const y of h) {
1804
- if (y === "webgpu" && !await c()) {
1805
- q.push("webgpu indisponible");
1806
- continue;
1807
- }
1808
- try {
1809
- const S = await n.pipeline(a.task, a.repo, {
1810
- ...l(a),
1811
- device: y,
1812
- progress_callback: H
1813
- });
1814
- return S.__backend = y, t.set(a.alias, { pipe: S, task: a.task }), {
1815
- backend: y,
1816
- loadMs: Math.round(performance.now() - v)
1817
- };
1818
- } catch (S) {
1819
- const U = o(S);
1820
- if (U === "network" || U === "quota") throw S;
1821
- q.push(`${y} : ${String(S?.message ?? S)}`);
1822
- }
1823
- }
1824
- const A = new Error(
1825
- `Aucun backend utilisable (${q.join(" ; ") || "aucun autorisé"}).`
1826
- );
1827
- throw A.code = "unsupported", A;
1828
- },
1829
- async run({ request: a }) {
1830
- const h = t.get(a.alias);
1831
- if (!h) {
1832
- const A = new Error(`Modèle "${a.alias}" non chargé.`);
1833
- throw A.code = "runtime", A;
1834
- }
1835
- const { pipe: g } = h, v = { ...a.call || {} };
1836
- let k;
1837
- a.positional && (k = v[a.positional], delete v[a.positional]);
1838
- const H = (A) => a.positional ? g(A, k, v) : g(A, v);
1839
- if (a.batch) {
1840
- const A = [];
1841
- for (let S = 0; S < a.inputs.length; S += 32) {
1842
- const U = a.inputs.slice(S, S + 32), D = await u(await H(U));
1843
- A.push(...Array.isArray(D) ? D : [D]);
1844
- }
1845
- return A;
1846
- }
1847
- const q = [];
1848
- for (const A of a.inputs) {
1849
- const y = await u(await H(A));
1850
- q.push(
1851
- h.task === "feature-extraction" || h.task === "image-feature-extraction" ? _(y) : y
1852
- );
1853
- }
1854
- return q;
1855
- },
1856
- async clear({ model: a }) {
1857
- const h = n.ModelRegistry;
1858
- if (a) {
1859
- const v = t.get(a.alias);
1860
- return t.delete(a.alias), await v?.pipe?.dispose?.(), await h?.clear_pipeline_cache?.(
1861
- a.task,
1862
- a.repo,
1863
- l(a)
1864
- ), !0;
1865
- }
1866
- for (const v of t.values()) await v.pipe?.dispose?.();
1867
- t.clear();
1868
- const g = n.env.cacheKey;
1869
- return g && typeof caches < "u" && await caches.delete(g), !0;
1870
- }
1871
- };
1872
- e.addEventListener("message", (a) => {
1873
- const h = a.data;
1874
- !h || typeof h.id != "number" || !T[h.type] || (s = s.then(() => T[h.type](h)).then(
1875
- (g) => i({ id: h.id, ok: !0, result: g }),
1876
- (g) => r(h.id, o(g), String(g?.message ?? g))
1877
- ));
1878
- });
1879
- }
1880
- function Zs(n) {
1881
- return [
1882
- `const hfWorkerMain = ${Ys.toString()};`,
1883
- "const pending = [];",
1884
- "const buffer = (event) => pending.push(event);",
1885
- 'self.addEventListener("message", buffer);',
1886
- "let lib;",
1887
- "try {",
1888
- ` lib = await import(${JSON.stringify(n)});`,
1889
- "} catch (err) {",
1890
- ' self.postMessage({ type: "fatal", message: "Chargement de Transformers.js impossible : " + (err && err.message || err) });',
1891
- " throw err;",
1892
- "}",
1893
- 'self.removeEventListener("message", buffer);',
1894
- "hfWorkerMain(lib, {",
1895
- " postMessage: (message, transfer) => self.postMessage(message, transfer),",
1896
- " addEventListener: (type, listener) => {",
1897
- " self.addEventListener(type, listener);",
1898
- " for (const event of pending.splice(0)) listener(event);",
1899
- " },",
1900
- "});"
1901
- ].join(`
1902
- `);
1903
- }
1904
- class ae extends Error {
1905
- constructor(e, t) {
1906
- super(t), this.code = e, this.name = "HfEngineError";
1907
- }
1908
- }
1909
- class Ne {
1910
- constructor(e) {
1911
- this.createWorker = e, this.worker = null, this.nextId = 1, this.pending = /* @__PURE__ */ new Map(), this.progressListeners = /* @__PURE__ */ new Map(), this.fatal = null;
1912
- }
1913
- /** Worker « blob » qui importe Transformers.js depuis une URL figée. */
1914
- static fromUrl(e) {
1915
- let t = null;
1916
- const s = new Ne(() => {
1917
- const r = Zs(e);
1918
- return t = URL.createObjectURL(
1919
- new Blob([r], { type: "text/javascript" })
1920
- ), new Worker(t, { type: "module", name: "concorde-hf" });
1921
- }), i = s.dispose.bind(s);
1922
- return s.dispose = () => {
1923
- i(), t && URL.revokeObjectURL(t);
1924
- }, s;
1925
- }
1926
- ensureWorker() {
1927
- if (this.fatal) throw this.fatal;
1928
- if (this.worker) return this.worker;
1929
- const e = this.createWorker();
1930
- return e.addEventListener(
1931
- "message",
1932
- (t) => this.onMessage(t.data)
1933
- ), e.addEventListener("error", (t) => {
1934
- this.failAll(
1935
- new ae(
1936
- "runtime",
1937
- `Worker Hugging Face : ${t.message || "erreur de chargement (CSP worker-src / script-src ?)"}`
1938
- )
1939
- );
1940
- }), this.worker = e, e;
1941
- }
1942
- onMessage(e) {
1943
- if ("type" in e) {
1944
- e.type === "progress" ? this.progressListeners.get(e.alias)?.(e.progress) : e.type === "fatal" && this.failAll(new ae("runtime", e.message));
1945
- return;
1946
- }
1947
- const t = this.pending.get(e.id);
1948
- t && (this.pending.delete(e.id), e.ok ? t.resolve(e.result) : t.reject(new ae(e.error.code, e.error.message)));
1949
- }
1950
- failAll(e) {
1951
- this.fatal = e;
1952
- for (const t of this.pending.values()) t.reject(e);
1953
- this.pending.clear();
1954
- }
1955
- request(e) {
1956
- let t;
1957
- try {
1958
- t = this.ensureWorker();
1959
- } catch (i) {
1960
- return Promise.reject(i);
1961
- }
1962
- const s = this.nextId++;
1963
- return new Promise((i, r) => {
1964
- this.pending.set(s, {
1965
- resolve: i,
1966
- reject: r
1967
- }), t.postMessage({ ...e, id: s });
1968
- });
1969
- }
1970
- async configure(e) {
1971
- await this.request({ type: "configure", env: e });
1972
- }
1973
- inspect(e) {
1974
- return this.request({ type: "inspect", model: e });
1975
- }
1976
- async load(e, t, s) {
1977
- this.progressListeners.set(e.alias, s);
1978
- try {
1979
- return await this.request({ type: "load", model: e, devices: t });
1980
- } finally {
1981
- this.progressListeners.delete(e.alias);
1982
- }
1983
- }
1984
- run(e) {
1985
- return this.request({ type: "run", request: e });
1986
- }
1987
- async clear(e) {
1988
- await this.request({ type: "clear", model: e });
1989
- }
1990
- dispose() {
1991
- this.failAll(new ae("runtime", "Moteur arrêté.")), this.worker?.terminate(), this.worker = null;
1992
- }
1993
- }
1994
- const Qs = "concorde-hf-consent:", Ce = 1024 * 1024;
1995
- function Pe() {
1996
- try {
1997
- return typeof localStorage < "u" ? localStorage : null;
1998
- } catch {
1999
- return null;
2000
- }
2001
- }
2002
- function en() {
2003
- const n = globalThis.navigator?.connection;
2004
- return n ? n.saveData === !0 || n.effectiveType === "slow-2g" || n.effectiveType === "2g" : !1;
2005
- }
2006
- class R extends Error {
2007
- constructor(e, t) {
2008
- super(t), this.code = e, this.name = "HfError";
2009
- }
2010
- }
2011
- class Jt {
2012
- constructor(e) {
2013
- this.config = e, this.entries = /* @__PURE__ */ new Map(), this.engine = null, this.configured = null;
2014
- }
2015
- /* ---------------- configuration / moteur ---------------- */
2016
- get resolvedConfig() {
2017
- return this.config;
2018
- }
2019
- getEngine() {
2020
- if (this.engine) return this.engine;
2021
- const e = this.config.runtime;
2022
- return e.source === "engine" ? this.engine = e.engine : e.source === "worker" ? this.engine = new Ne(e.createWorker) : this.engine = Ne.fromUrl(e.url), this.engine;
2023
- }
2024
- async ready() {
2025
- const e = this.getEngine();
2026
- if (!this.configured) {
2027
- const t = this.config.runtime, s = t.source === "engine" ? void 0 : t.wasmPaths ?? (t.source === "cdn" ? new URL(".", t.url).href : void 0);
2028
- this.configured = e.configure({
2029
- cacheKey: `concorde-hf-${t.version}`,
2030
- remoteHost: this.config.remoteHost,
2031
- remotePathTemplate: this.config.remotePathTemplate,
2032
- wasmPaths: s,
2033
- logLevel: this.config.logLevel
2034
- });
2035
- }
2036
- return await this.configured, e;
2037
- }
2038
- dispose() {
2039
- this.engine?.dispose(), this.engine = null, this.configured = null, this.entries.clear();
2040
- }
2041
- /* ---------------- modèles ---------------- */
2042
- hasModel(e) {
2043
- return Object.prototype.hasOwnProperty.call(this.config.models, e);
2044
- }
2045
- model(e) {
2046
- if (!this.hasModel(e)) {
2047
- const s = Object.keys(this.config.models);
2048
- throw new R(
2049
- "not-allowed",
2050
- `[sonic-hugging-face-infer] modèle "${e}" hors liste blanche` + (s.length ? ` (disponibles : ${s.join(", ")}).` : ".")
2051
- );
2052
- }
2053
- const t = this.config.models[e];
2054
- return {
2055
- alias: e,
2056
- task: t.task,
2057
- repo: t.repo,
2058
- revision: t.revision,
2059
- options: t.options ?? {},
2060
- devices: t.devices ?? ["webgpu", "wasm"],
2061
- sizeBytes: t.sizeBytes,
2062
- label: t.label,
2063
- description: t.description,
2064
- defaults: t.defaults
2065
- };
2066
- }
2067
- entry(e) {
2068
- let t = this.entries.get(e);
2069
- return t || (t = { state: { phase: "idle", size: null }, listeners: /* @__PURE__ */ new Set() }, this.entries.set(e, t)), t;
2070
- }
2071
- state(e) {
2072
- return this.entry(e).state;
2073
- }
2074
- subscribe(e, t) {
2075
- const s = this.entry(e);
2076
- return s.listeners.add(t), t(s.state), () => s.listeners.delete(t);
2077
- }
2078
- update(e, t) {
2079
- const s = this.entry(e);
2080
- s.state = { ...s.state, ...t };
2081
- for (const i of s.listeners) i(s.state);
2082
- }
2083
- /** Taille et présence en cache, sans rien télécharger d'autre que des en-têtes. */
2084
- inspect(e) {
2085
- const t = this.entry(e);
2086
- if (!t.inspect) {
2087
- const s = this.model(e);
2088
- t.inspect = (async () => {
2089
- this.update(e, { phase: "checking" });
2090
- let i = s.sizeBytes ?? null, r = !1;
2091
- try {
2092
- const c = await (await this.ready()).inspect(s);
2093
- i = c.totalBytes ?? i, r = c.cached;
2094
- } catch {
2095
- }
2096
- const o = { totalBytes: i, fromCache: r };
2097
- return this.update(e, { size: o, phase: "idle" }), o;
2098
- })();
2099
- }
2100
- return t.inspect;
2101
- }
2102
- /* ---------------- consentement ---------------- */
2103
- consentKey(e) {
2104
- return `${Qs}${e}@${this.model(e).revision}`;
2105
- }
2106
- storedConsent(e) {
2107
- const t = Pe()?.getItem(this.consentKey(e));
2108
- return t === "accepted" || t === "declined" ? t : null;
2109
- }
2110
- accept(e) {
2111
- try {
2112
- Pe()?.setItem(this.consentKey(e), "accepted");
2113
- } catch {
2114
- }
2115
- const t = this.entry(e);
2116
- t.consent?.resolve(!0), t.consent = void 0, t.state.phase === "declined" && this.update(e, { phase: "idle" });
2117
- }
2118
- decline(e) {
2119
- try {
2120
- Pe()?.setItem(this.consentKey(e), "declined");
2121
- } catch {
2122
- }
2123
- const t = this.entry(e);
2124
- t.consent?.resolve(!1), t.consent = void 0, this.update(e, { phase: "declined" });
2125
- }
2126
- revokeConsent(e) {
2127
- try {
2128
- Pe()?.removeItem(this.consentKey(e));
2129
- } catch {
2130
- }
2131
- this.entry(e).state.phase === "declined" && this.update(e, { phase: "idle" });
2132
- }
2133
- askConsent(e) {
2134
- const t = this.storedConsent(e);
2135
- if (t) return Promise.resolve(t === "accepted");
2136
- const s = this.entry(e);
2137
- if (!s.consent) {
2138
- let i;
2139
- const r = new Promise((o) => i = o);
2140
- s.consent = { promise: r, resolve: i };
2141
- }
2142
- return this.update(e, { phase: "awaiting-consent" }), s.consent.promise;
2143
- }
2144
- /* ---------------- chargement ---------------- */
2145
- /**
2146
- * Charge le modèle selon la politique. Résout quand il est prêt ; rejette
2147
- * (`HfError`) si refusé, non supporté, quota insuffisant ou erreur.
2148
- * `policy = "manual"` signifie « appel explicite » : pas de demande de consentement.
2149
- */
2150
- ensureLoaded(e, t) {
2151
- const s = this.entry(e);
2152
- if (s.state.phase === "ready") return Promise.resolve();
2153
- if (s.loading) return s.loading;
2154
- const i = this.load(e, t).finally(() => {
2155
- this.entry(e).loading === i && (s.loading = void 0);
2156
- });
2157
- return s.loading = i, i;
2158
- }
2159
- async load(e, t) {
2160
- const s = this.model(e), i = this.config.defaults, r = await this.inspect(e), o = r?.fromCache === !0, l = r?.totalBytes ?? null;
2161
- if (!o && t !== "manual") {
2162
- const d = this.storedConsent(e);
2163
- if (d === "declined" || this.entry(e).state.phase === "declined")
2164
- throw this.update(e, { phase: "declined" }), new R("declined", "Chargement du modèle refusé par l'utilisateur.");
2165
- const u = l !== null && l > i.consentAboveMB * Ce;
2166
- if ((t === "consent" || u || en()) && d !== "accepted" && !await this.askConsent(e))
2167
- throw this.update(e, { phase: "declined" }), new R("declined", "Chargement du modèle refusé par l'utilisateur.");
2168
- }
2169
- const c = l ?? s.sizeBytes ?? null, f = s.devices.filter(
2170
- (d) => d !== "wasm" || c === null || c <= i.allowWasmUpToMB * Ce
2171
- );
2172
- if (!f.length)
2173
- throw this.update(e, {
2174
- phase: "unsupported",
2175
- error: { code: "unsupported", message: "Aucune exécution autorisée pour ce modèle." }
2176
- }), new R("unsupported", "Aucune exécution autorisée pour ce modèle.");
2177
- if (!o && l) {
2178
- const d = await globalThis.navigator?.storage?.estimate?.().catch(() => null);
2179
- if (d?.quota !== void 0) {
2180
- const u = d.quota - (d.usage ?? 0);
2181
- if (u < l * 1.2) {
2182
- const _ = `Espace de stockage insuffisant (${Math.round(u / Ce)} Mo libres, ${Math.round(l / Ce)} Mo nécessaires).`;
2183
- throw this.update(e, { phase: "error", error: { code: "quota", message: _ } }), new R("quota", _);
2184
- }
2185
- }
2186
- }
2187
- this.update(e, {
2188
- phase: o ? "loading" : "downloading",
2189
- error: void 0,
2190
- progress: void 0
2191
- });
2192
- try {
2193
- const u = await (await this.ready()).load(
2194
- s,
2195
- f,
2196
- (T) => this.update(e, { phase: "downloading", progress: T })
2197
- );
2198
- let _;
2199
- i.persist && !o && (_ = await globalThis.navigator?.storage?.persist?.().catch(() => !1)), this.update(e, {
2200
- phase: "ready",
2201
- backend: u.backend,
2202
- loadMs: u.loadMs,
2203
- persisted: _,
2204
- size: { totalBytes: c, fromCache: o }
2205
- });
2206
- } catch (d) {
2207
- const u = d instanceof ae ? d.code : "runtime", _ = d instanceof Error ? d.message : String(d);
2208
- throw this.update(e, {
2209
- phase: u === "unsupported" ? "unsupported" : "error",
2210
- error: { code: u, message: _ }
2211
- }), new R(u, _);
2212
- }
2213
- }
2214
- /* ---------------- calcul ---------------- */
2215
- async run(e, t) {
2216
- const s = await this.ready();
2217
- let i;
2218
- const r = new Promise((o, l) => {
2219
- i = setTimeout(
2220
- () => l(
2221
- new R("timeout", `Calcul trop long (> ${t} ms), abandonné.`)
2222
- ),
2223
- t
2224
- );
2225
- });
2226
- try {
2227
- return await Promise.race([s.run(e), r]);
2228
- } catch (o) {
2229
- throw o instanceof R ? o : o instanceof ae ? new R(o.code, o.message) : new R("runtime", o instanceof Error ? o.message : String(o));
2230
- } finally {
2231
- clearTimeout(i);
2232
- }
2233
- }
2234
- /* ---------------- nettoyage ---------------- */
2235
- async clearModel(e) {
2236
- const t = this.model(e);
2237
- await (await this.ready()).clear(t);
2238
- const i = this.entry(e);
2239
- i.inspect = void 0, this.update(e, { phase: "idle", size: null, backend: void 0, progress: void 0 });
2240
- }
2241
- async clearAll() {
2242
- await (await this.ready()).clear();
2243
- for (const t of this.entries.keys())
2244
- this.entry(t).inspect = void 0, this.update(t, { phase: "idle", size: null, backend: void 0, progress: void 0 });
2245
- }
2246
- }
2247
- let ve = null;
2248
- Ht((n) => {
2249
- ve?.dispose(), ve = new Jt(n);
2250
- });
2251
- function yt() {
2252
- if (!ve) {
2253
- const n = Ps();
2254
- n && (ve = new Jt(n));
2255
- }
2256
- return ve;
2257
- }
2258
- const I = { type: "boolean" }, x = (n, e) => ({ type: "number", minimum: n, maximum: e }), b = (n, e) => ({ type: "number", integer: !0, minimum: n, maximum: e }), G = (n = 500) => ({ type: "string", maxLength: n }), le = (n = 256) => ({ type: "array", items: b(0), maxItems: n }), Me = (n = 64) => ({ type: "array", items: le(), maxItems: n }), ct = { type: "array", items: G(200), maxItems: 50 }, tn = { anyOf: [G(200), ct] }, Ut = { anyOf: [b(1, 50), { type: "null" }] }, Ze = {
2259
- max_length: b(1, 1024),
2260
- max_new_tokens: b(1, 1024),
2261
- min_length: b(0, 1024),
2262
- min_new_tokens: b(0, 1024),
2263
- early_stopping: { anyOf: [I, { enum: ["never"] }] },
2264
- max_time: x(0, 120),
2265
- do_sample: I,
2266
- num_beams: b(1, 8),
2267
- num_beam_groups: b(1, 8),
2268
- penalty_alpha: x(0, 1),
2269
- use_cache: I,
2270
- temperature: x(0, 5),
2271
- top_k: b(0, 200),
2272
- top_p: x(0, 1),
2273
- typical_p: x(0, 1),
2274
- epsilon_cutoff: x(0, 1),
2275
- eta_cutoff: x(0, 1),
2276
- diversity_penalty: x(0, 10),
2277
- repetition_penalty: x(0, 10),
2278
- encoder_repetition_penalty: x(0, 10),
2279
- length_penalty: x(-10, 10),
2280
- no_repeat_ngram_size: b(0, 32),
2281
- bad_words_ids: Me(),
2282
- force_words_ids: {
2283
- anyOf: [
2284
- Me(),
2285
- { type: "array", items: Me(), maxItems: 64 }
2286
- ]
2287
- },
2288
- renormalize_logits: I,
2289
- forced_bos_token_id: b(0),
2290
- forced_eos_token_id: { anyOf: [b(0), le()] },
2291
- remove_invalid_values: I,
2292
- exponential_decay_length_penalty: {
2293
- type: "tuple",
2294
- prefixItems: [b(0), x()]
2295
- },
2296
- suppress_tokens: le(),
2297
- begin_suppress_tokens: le(),
2298
- forced_decoder_ids: {
2299
- type: "array",
2300
- items: { type: "tuple", prefixItems: [b(0), b(0)] },
2301
- maxItems: 64
2302
- },
2303
- guidance_scale: x(0, 50),
2304
- num_return_sequences: b(1, 8),
2305
- output_attentions: I,
2306
- output_hidden_states: I,
2307
- output_scores: I,
2308
- return_dict_in_generate: I,
2309
- pad_token_id: b(0),
2310
- bos_token_id: b(0),
2311
- eos_token_id: { anyOf: [b(0), le()] },
2312
- encoder_no_repeat_ngram_size: b(0, 32),
2313
- decoder_start_token_id: b(0)
2314
- }, sn = {
2315
- "feature-extraction": {
2316
- pooling: {
2317
- enum: ["none", "mean", "cls", "first_token", "eos", "last_token"]
2318
- },
2319
- normalize: I,
2320
- quantize: I,
2321
- precision: { enum: ["binary", "ubinary"] }
2322
- },
2323
- "text-classification": { top_k: Ut },
2324
- "zero-shot-classification": {
2325
- candidate_labels: tn,
2326
- hypothesis_template: G(300),
2327
- multi_label: I
2328
- },
2329
- translation: Ze,
2330
- "token-classification": {
2331
- ignore_labels: { type: "array", items: G(100), maxItems: 50 },
2332
- aggregation_strategy: { enum: ["none", "simple"] }
2333
- },
2334
- "fill-mask": { top_k: b(1, 50) },
2335
- "question-answering": {
2336
- context: { anyOf: [G(2e4), { type: "array", items: G(2e4), maxItems: 20 }] },
2337
- top_k: b(1, 20)
2338
- },
2339
- "image-classification": { top_k: Ut },
2340
- "zero-shot-image-classification": {
2341
- candidate_labels: ct,
2342
- hypothesis_template: G(300)
2343
- },
2344
- "object-detection": { threshold: x(0, 1), percentage: I },
2345
- "zero-shot-object-detection": {
2346
- candidate_labels: ct,
2347
- threshold: x(0, 1),
2348
- top_k: b(1, 100),
2349
- percentage: I
2350
- },
2351
- "image-feature-extraction": { pool: I },
2352
- "image-segmentation": {
2353
- threshold: x(0, 1),
2354
- mask_threshold: x(0, 1),
2355
- overlap_mask_area_threshold: x(0, 1),
2356
- subtask: { anyOf: [G(50), { type: "null" }] },
2357
- label_ids_to_fuse: le(),
2358
- target_sizes: Me()
2359
- },
2360
- "depth-estimation": {},
2361
- "background-removal": {},
2362
- "image-to-text": Ze,
2363
- "audio-classification": { top_k: b(1, 50) },
2364
- "automatic-speech-recognition": {
2365
- ...Ze,
2366
- return_timestamps: { anyOf: [I, { enum: ["word"] }] },
2367
- chunk_length_s: x(0, 60),
2368
- stride_length_s: x(0, 30),
2369
- force_full_sequences: I,
2370
- language: G(40),
2371
- task: { enum: ["transcribe", "translate"] },
2372
- num_frames: b(0)
2373
- }
2374
- };
2375
- class Qe extends Error {
2376
- constructor(e) {
2377
- super(e), this.name = "HfOptionsError";
2378
- }
2379
- }
2380
- function ye(n) {
2381
- return n === null ? "null" : Array.isArray(n) ? "array" : typeof n;
2382
- }
2383
- function Ie(n, e, t) {
2384
- if ("anyOf" in n) {
2385
- const s = n.anyOf.map((i) => Ie(i, e, t));
2386
- return s.some((i) => i === null) ? null : s[0];
2387
- }
2388
- if ("enum" in n)
2389
- return n.enum.includes(e) ? null : `${t} : valeur ${JSON.stringify(e)} non autorisée (attendu : ${n.enum.map((s) => JSON.stringify(s)).join(" | ")}).`;
2390
- switch (n.type) {
2391
- case "boolean":
2392
- return typeof e == "boolean" ? null : `${t} : booléen attendu, reçu ${ye(e)}.`;
2393
- case "null":
2394
- return e === null ? null : `${t} : null attendu.`;
2395
- case "string":
2396
- return typeof e != "string" ? `${t} : texte attendu, reçu ${ye(e)}.` : n.maxLength !== void 0 && e.length > n.maxLength ? `${t} : texte trop long (${e.length} > ${n.maxLength}).` : null;
2397
- case "number":
2398
- return typeof e != "number" || !Number.isFinite(e) ? `${t} : nombre attendu, reçu ${ye(e)}.` : n.integer && !Number.isInteger(e) ? `${t} : entier attendu.` : n.minimum !== void 0 && e < n.minimum ? `${t} : minimum ${n.minimum}.` : n.maximum !== void 0 && e > n.maximum ? `${t} : maximum ${n.maximum}.` : null;
2399
- case "array": {
2400
- if (!Array.isArray(e))
2401
- return `${t} : liste attendue, reçu ${ye(e)}.`;
2402
- if (n.maxItems !== void 0 && e.length > n.maxItems)
2403
- return `${t} : trop d'éléments (${e.length} > ${n.maxItems}).`;
2404
- for (let s = 0; s < e.length; s++) {
2405
- const i = Ie(n.items, e[s], `${t}[${s}]`);
2406
- if (i) return i;
2407
- }
2408
- return null;
2409
- }
2410
- case "tuple": {
2411
- if (!Array.isArray(e) || e.length !== n.prefixItems.length)
2412
- return `${t} : liste de ${n.prefixItems.length} éléments attendue.`;
2413
- for (let s = 0; s < e.length; s++) {
2414
- const i = Ie(n.prefixItems[s], e[s], `${t}[${s}]`);
2415
- if (i) return i;
2416
- }
2417
- return null;
2418
- }
2419
- }
2420
- }
2421
- function nn(n, e) {
2422
- if (e == null) return {};
2423
- if (typeof e != "object" || Array.isArray(e))
2424
- throw new Qe(
2425
- `[sonic-hugging-face-infer] options.call : objet attendu, reçu ${ye(e)}.`
2426
- );
2427
- const t = sn[n];
2428
- for (const [s, i] of Object.entries(e)) {
2429
- const r = t[s];
2430
- if (!r) {
2431
- const l = Object.keys(t);
2432
- throw new Qe(
2433
- `[sonic-hugging-face-infer] option "${s}" inconnue pour la tâche "${n}"` + (l.length ? ` (autorisées : ${l.join(", ")}).` : " (aucune option).")
2434
- );
2435
- }
2436
- if (i === void 0) continue;
2437
- const o = Ie(r, i, `options.call.${s}`);
2438
- if (o) throw new Qe(`[sonic-hugging-face-infer] ${o}`);
2439
- }
2440
- return e;
2441
- }
2442
- function rn(n) {
2443
- if (!n || typeof n != "object") return !1;
2444
- const e = n;
2445
- return e.blob instanceof Blob && (typeof e.width == "number" || typeof e.height == "number" || typeof e.channels == "number" || typeof e.url == "string" || typeof e.blobUrl == "string");
2446
- }
2447
- function et(n) {
2448
- return typeof n != "string" ? null : n.trim() || null;
2449
- }
2450
- function on(n) {
2451
- if (n == null || n === "") return null;
2452
- if (typeof n == "string") return et(n);
2453
- if (typeof n != "object") return null;
2454
- const e = n;
2455
- return et(e.url) ?? et(e.blobUrl);
2456
- }
2457
- function ut(n, e) {
2458
- if (Array.isArray(n)) {
2459
- for (let s = 0; s < n.length; s++)
2460
- n[s] = ut(n[s], e);
2461
- return n;
2462
- }
2463
- if (!n || typeof n != "object") return n;
2464
- const t = n;
2465
- if (rn(t)) {
2466
- if (on(t)) return n;
2467
- const s = URL.createObjectURL(t.blob);
2468
- return e.push(s), t.url = s, n;
2469
- }
2470
- for (const s of Object.keys(t))
2471
- t[s] = ut(t[s], e);
2472
- return n;
2473
- }
2474
- function Nt(n) {
2475
- for (const e of n)
2476
- try {
2477
- URL.revokeObjectURL(e);
2478
- } catch {
2479
- }
2480
- }
2481
- const Gt = {
2482
- "zero-shot-classification": "candidate_labels",
2483
- "zero-shot-image-classification": "candidate_labels",
2484
- "zero-shot-object-detection": "candidate_labels",
2485
- "question-answering": "context"
2486
- }, Kt = {
2487
- "feature-extraction": "text",
2488
- "text-classification": "text",
2489
- "zero-shot-classification": "text",
2490
- translation: "text",
2491
- "token-classification": "text",
2492
- "fill-mask": "text",
2493
- "question-answering": "text",
2494
- "image-classification": "image",
2495
- "zero-shot-image-classification": "image",
2496
- "object-detection": "image",
2497
- "zero-shot-object-detection": "image",
2498
- "image-feature-extraction": "image",
2499
- "image-segmentation": "image",
2500
- "depth-estimation": "image",
2501
- "background-removal": "image",
2502
- "image-to-text": "image",
2503
- "audio-classification": "audio",
2504
- "automatic-speech-recognition": "audio"
2505
- }, an = 1024 * 1024, ln = 5e3, Rt = 1500;
2506
- function ie(n) {
2507
- const e = n.split("."), t = e.shift();
2508
- let s = F.get(t);
2509
- return e.length && (s = W.traverse(s, e)), s;
2510
- }
2511
- function cn(n) {
2512
- return n === !0 || n === 1 || n === "accepted" || n === "true" || n === "1" || n === "on";
2513
- }
2514
- const un = {
2515
- checking: "loading",
2516
- "awaiting-consent": "awaiting-consent",
2517
- declined: "declined",
2518
- downloading: "downloading",
2519
- loading: "loading",
2520
- ready: "ready",
2521
- error: "error",
2522
- unsupported: "unsupported",
2523
- idle: "idle"
2524
- };
2525
- function hn(n, e) {
2526
- switch (n) {
2527
- case "downloading":
2528
- case "loading":
2529
- case "running":
2530
- return { status: "loading", error: null };
2531
- case "done":
2532
- return {
2533
- status: e == null || Array.isArray(e) && e.length === 0 ? "empty" : "ready",
2534
- error: null
2535
- };
2536
- case "error":
2537
- case "invalid-input":
2538
- return { status: "error", error: null };
2539
- default:
2540
- return { status: "empty", error: null };
2541
- }
2542
- }
2543
- function Xt(n, e) {
2544
- const t = e ?? yt();
2545
- if (!t)
2546
- throw new R(
2547
- "not-allowed",
2548
- "[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé."
2549
- );
2550
- const s = t.model(n.model), i = s.task, r = t.resolvedConfig.defaults, o = n.load ?? r.load, l = n.trigger ?? r.trigger, c = n.debounceMs ?? r.debounceMs, f = n.emptyValue ?? null, d = n.onInvalid ?? "keep", u = (p, w) => p === void 0 ? w : n.untrusted ? Math.min(p, w) : p, _ = u(n.maxItems, r.maxItems), T = u(n.maxChars, r.maxChars), a = u(n.timeoutMs, r.timeoutMs), h = n.persistResults ?? !1, g = t.resolvedConfig.runtime.version, v = oe(n.input), k = oe(n.output);
2551
- if (v === k || k.startsWith(v + ".") || v.startsWith(k + "."))
2552
- throw new Error(
2553
- `[sonic-hugging-face-infer] la sortie "${k}" chevauche l'entrée "${v}".`
2554
- );
2555
- const H = n.status ? oe(n.status) : null, q = ie(k), A = F.get(Bs(k)), y = H ? ie(H) : null;
2556
- let S = null, U = { ...s.defaults ?? {} };
2557
- try {
2558
- const p = n.untrusted ? nn(i, n.call) : n.call ?? {};
2559
- U = { ...U, ...p };
2560
- } catch (p) {
2561
- S = p instanceof Error ? p.message : String(p);
2562
- }
2563
- const D = Gt[i], fe = i === "feature-extraction" && !!U.pooling && U.pooling !== "none";
2564
- let N = "idle", j = t.state(n.model), ee, wt, je, Be, ze = !1, Fe, pe = [], K = 0, B = !1, V = null, He = !1, bt = !1;
2565
- const Yt = () => {
2566
- switch (N) {
2567
- case "empty":
2568
- return "empty";
2569
- case "invalid-input":
2570
- return "invalid-input";
2571
- case "running":
2572
- return "running";
2573
- case "done":
2574
- return "done";
2575
- case "error":
2576
- return "error";
2577
- default:
2578
- return un[j.phase] ?? "idle";
2579
- }
2580
- }, z = () => {
2581
- if (B) return;
2582
- const p = Yt();
2583
- if (A.set(hn(p, Fe)), !y) return;
2584
- const w = !["done", "running", "empty", "invalid-input"].includes(p) && j.error ? j.error : void 0, $ = {
2585
- state: p,
2586
- model: {
2587
- alias: s.alias,
2588
- task: i,
2589
- repo: s.repo,
2590
- revision: s.revision,
2591
- label: s.label,
2592
- description: s.description
2593
- },
2594
- // Toujours un objet (jamais null) : les liaisons `size.totalMB` restent stables.
2595
- size: {
2596
- totalBytes: j.size?.totalBytes ?? null,
2597
- totalMB: j.size?.totalBytes == null ? null : Math.round(j.size.totalBytes / an),
2598
- fromCache: j.size?.fromCache ?? !1
2599
- },
2600
- progress: j.progress,
2601
- backend: j.backend,
2602
- persisted: j.persisted,
2603
- skipped: je,
2604
- warnings: Be,
2605
- timings: { loadMs: j.loadMs, lastRunMs: wt },
2606
- fromResultsCache: ze,
2607
- error: ee ?? w
2608
- };
2609
- y.set(JSON.parse(JSON.stringify($)));
2610
- }, ge = (p) => {
2611
- Nt(pe), pe = [];
2612
- const w = ut(p, pe);
2613
- Fe = w, q.set(w);
2614
- }, qe = async (p) => {
2615
- bt = !0, await t.ensureLoaded(n.model, p);
2616
- }, Zt = async (p) => {
2617
- if (S)
2618
- return N = "error", ee = { code: "invalid-input", message: S }, z(), null;
2619
- const w = ie(v).get(), $ = Wt(w, {
2620
- kind: Kt[i],
2621
- text: n.text,
2622
- maxItems: _,
2623
- maxChars: T
2624
- });
2625
- if ($.kind === "empty")
2626
- return N = "empty", je = void 0, Be = void 0, ge(f), z(), null;
2627
- if ($.kind === "invalid")
2628
- return N = "invalid-input", ee = { code: $.code, message: $.message }, d === "clear" && ge(f), z(), null;
2629
- if (D && (U[D] === void 0 || U[D] === ""))
2630
- return N = "invalid-input", ee = {
2631
- code: "invalid-input",
2632
- message: `options.call.${D} est requis pour la tâche "${i}".`
2633
- }, z(), null;
2634
- je = $.skipped || void 0, Be = $.warnings.length ? $.warnings : void 0;
2635
- const J = await Hs({
2636
- payloads: $.payloads,
2637
- positions: $.positions,
2638
- length: $.length,
2639
- many: $.many,
2640
- alias: s.alias,
2641
- repo: s.repo,
2642
- revision: s.revision,
2643
- options: s.options,
2644
- runtime: g,
2645
- call: U
2646
- });
2647
- if (p !== K || B) return null;
2648
- const C = await qs(J, h, n.resultsTtlMs);
2649
- return p !== K || B ? null : C.hit ? (N = "done", ze = !0, ge(C.value), z(), null) : o === "manual" && j.phase !== "ready" ? (N = "waiting-model", He = !0, z(), null) : { input: $, key: J };
2650
- }, Qt = async (p, w, $) => {
2651
- N = "waiting-model", z();
2652
- try {
2653
- await qe(o);
2654
- } catch (C) {
2655
- if (p !== K || B) return;
2656
- N = "waiting-model", Fe === void 0 && ge(f), (!(C instanceof R) || C.code === "runtime") && (ee = {
2657
- code: C instanceof R ? C.code : "runtime",
2658
- message: C instanceof Error ? C.message : String(C)
2659
- }), z();
2660
- return;
2661
- }
2662
- if (p !== K || B) return;
2663
- N = "running", z();
2664
- const J = performance.now();
2665
- try {
2666
- const C = await t.run(
2667
- {
2668
- alias: s.alias,
2669
- inputs: w.payloads,
2670
- call: U,
2671
- positional: D,
2672
- batch: fe
2673
- },
2674
- a
2675
- );
2676
- if (p !== K || B) return;
2677
- const $t = w.many ? Vt(w, C) : C[0] ?? null;
2678
- wt = Math.round(performance.now() - J), N = "done", ge($t), z(), Ws($, $t, h, r.resultsCacheBytes);
2679
- } catch (C) {
2680
- if (p !== K || B) return;
2681
- N = "error", ee = {
2682
- code: C instanceof R ? C.code : "runtime",
2683
- message: C instanceof Error ? C.message : String(C)
2684
- }, z();
2685
- }
2686
- }, vt = async () => {
2687
- if (B) return;
2688
- const p = ++K;
2689
- ee = void 0, ze = !1;
2690
- const w = await Zt(p);
2691
- !w || p !== K || B || await Qt(p, w.input, w.key);
2692
- }, We = (p = c) => {
2693
- B || (V && clearTimeout(V), V = setTimeout(() => {
2694
- V = null, vt();
2695
- }, p));
2696
- }, Ve = [], Je = (p, w) => {
2697
- const $ = ie(p);
2698
- $.onInternalMutation(w), Ve.push(() => $.offInternalMutation(w));
2699
- };
2700
- if (Ve.push(
2701
- t.subscribe(n.model, (p) => {
2702
- j = p, z(), p.phase === "ready" && He && (He = !1, We(0));
2703
- })
2704
- ), l === "mutation" ? Je(v, () => We()) : z(), n.triggerProvider) {
2705
- const p = oe(n.triggerProvider);
2706
- let w = !0, $ = "";
2707
- Je(p, () => {
2708
- const J = JSON.stringify(ie(p).get() ?? null);
2709
- if (w) {
2710
- w = !1, $ = J;
2711
- return;
2712
- }
2713
- J !== $ && ($ = J, J !== "null" && We(0));
2714
- });
2715
- }
2716
- if (n.consentProvider) {
2717
- const p = oe(n.consentProvider);
2718
- Je(p, () => {
2719
- const w = ie(p).get();
2720
- cn(w) ? t.accept(n.model) : w === "declined" && t.decline(n.model);
2721
- });
2722
- }
2723
- const _e = (p) => {
2724
- B || bt || qe(p).catch(() => {
2725
- });
2726
- };
2727
- if (o === "auto") _e("auto");
2728
- else if (o === "idle") {
2729
- const p = globalThis.requestIdleCallback;
2730
- p ? p(() => _e("idle"), { timeout: ln }) : setTimeout(() => _e("idle"), Rt);
2731
- } else o === "visible" ? n.whenVisible ? n.whenVisible().then(() => _e("visible")) : setTimeout(() => _e("visible"), Rt) : t.inspect(n.model).catch(() => {
2732
- });
2733
- return {
2734
- stop() {
2735
- if (!B) {
2736
- B = !0, V && clearTimeout(V);
2737
- for (const p of Ve) p();
2738
- Nt(pe), pe = [];
2739
- }
2740
- },
2741
- run() {
2742
- return V && clearTimeout(V), V = null, vt();
2743
- },
2744
- async load() {
2745
- await qe("manual");
2746
- },
2747
- accept() {
2748
- t.accept(n.model);
2749
- },
2750
- decline() {
2751
- t.decline(n.model);
2752
- }
2753
- };
2754
- }
2755
- var dn = Object.defineProperty, fn = Object.getOwnPropertyDescriptor, M = (n, e, t, s) => {
2756
- for (var i = s > 1 ? void 0 : s ? fn(e, t) : e, r = n.length - 1, o; r >= 0; r--)
2757
- (o = n[r]) && (i = (s ? o(e, t, i) : o(i)) || i);
2758
- return s && i && dn(e, t, i), i;
2759
- };
2760
- let E = class extends be {
2761
- constructor() {
2762
- super(...arguments), this.model = "", this.inputProvider = "", this.outputProvider = "", this.statusProvider = "", this.triggerProvider = "", this.consentProvider = "", this.options = null, this.load = "", this.trigger = "", this.debounce = null, this.emptyValue = null, this.onInvalid = "keep", this.maxItems = null, this.maxChars = null, this.timeoutMs = null, this.persistResults = !1, this.resultsTtl = null, this.handle = null, this.offConfig = null, this.visible = null, this.whenVisible = () => (this.visible || (this.visible = new Promise((n) => {
2763
- const e = this.parentElement ?? this;
2764
- if (typeof IntersectionObserver > "u") return n();
2765
- const t = new IntersectionObserver((s) => {
2766
- s.some((i) => i.isIntersecting) && (t.disconnect(), n());
2767
- });
2768
- t.observe(e);
2769
- })), this.visible);
2770
- }
2771
- connectedCallback() {
2772
- super.connectedCallback(), this.offConfig = Ht(() => this.restart()), this.hasUpdated && this.restart();
2773
- }
2774
- disconnectedCallback() {
2775
- this.handle?.stop(), this.handle = null, this.offConfig?.(), this.offConfig = null, super.disconnectedCallback();
2776
- }
2777
- updated(n) {
2778
- n.size && this.isConnected && this.restart();
2779
- }
2780
- /** Calcule maintenant sur l'entrée courante. */
2781
- run() {
2782
- return this.handle?.run() ?? Promise.resolve();
2783
- }
2784
- /** Charge le modèle maintenant. */
2785
- loadModel() {
2786
- return this.handle?.load() ?? Promise.resolve();
2787
- }
2788
- accept() {
2789
- this.handle?.accept();
2790
- }
2791
- decline() {
2792
- this.handle?.decline();
2793
- }
2794
- restart() {
2795
- if (this.handle?.stop(), this.handle = null, !!this.isConnected && !(!this.model || !this.inputProvider || !this.outputProvider)) {
2796
- if (!yt()) {
2797
- console.warn(
2798
- "[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé : composant inactif."
2799
- );
2800
- return;
2801
- }
2802
- try {
2803
- this.handle = Xt({
2804
- model: this.model,
2805
- input: this.inputProvider,
2806
- output: this.outputProvider,
2807
- status: this.statusProvider || void 0,
2808
- triggerProvider: this.triggerProvider || void 0,
2809
- consentProvider: this.consentProvider || void 0,
2810
- text: this.options?.text,
2811
- call: this.options?.call,
2812
- untrusted: !0,
2813
- load: this.load || void 0,
2814
- trigger: this.trigger || void 0,
2815
- debounceMs: this.debounce ?? void 0,
2816
- emptyValue: this.emptyValue,
2817
- onInvalid: this.onInvalid,
2818
- maxItems: this.maxItems ?? void 0,
2819
- maxChars: this.maxChars ?? void 0,
2820
- timeoutMs: this.timeoutMs ?? void 0,
2821
- persistResults: this.persistResults,
2822
- resultsTtlMs: this.resultsTtl ?? void 0,
2823
- whenVisible: this.whenVisible
2824
- });
2825
- } catch (n) {
2826
- console.error(n instanceof Error ? n.message : n);
2827
- }
2828
- }
2829
- }
2830
- render() {
2831
- return ps`<slot></slot>`;
2832
- }
2833
- };
2834
- E.styles = [
2835
- ts`
2836
- :host {
2837
- display: contents;
2838
- }
2839
- `
2840
- ];
2841
- M([
2842
- O({ type: String })
2843
- ], E.prototype, "model", 2);
2844
- M([
2845
- O({ type: String })
2846
- ], E.prototype, "inputProvider", 2);
2847
- M([
2848
- O({ type: String })
2849
- ], E.prototype, "outputProvider", 2);
2850
- M([
2851
- O({ type: String })
2852
- ], E.prototype, "statusProvider", 2);
2853
- M([
2854
- O({ type: String })
2855
- ], E.prototype, "triggerProvider", 2);
2856
- M([
2857
- O({ type: String })
2858
- ], E.prototype, "consentProvider", 2);
2859
- M([
2860
- O({ type: Object })
2861
- ], E.prototype, "options", 2);
2862
- M([
2863
- O({ type: String })
2864
- ], E.prototype, "load", 2);
2865
- M([
2866
- O({ type: String })
2867
- ], E.prototype, "trigger", 2);
2868
- M([
2869
- O({ type: Number })
2870
- ], E.prototype, "debounce", 2);
2871
- M([
2872
- O({ type: Object })
2873
- ], E.prototype, "emptyValue", 2);
2874
- M([
2875
- O({ type: String })
2876
- ], E.prototype, "onInvalid", 2);
2877
- M([
2878
- O({ type: Number })
2879
- ], E.prototype, "maxItems", 2);
2880
- M([
2881
- O({ type: Number })
2882
- ], E.prototype, "maxChars", 2);
2883
- M([
2884
- O({ type: Number })
2885
- ], E.prototype, "timeoutMs", 2);
2886
- M([
2887
- O({ type: Boolean })
2888
- ], E.prototype, "persistResults", 2);
2889
- M([
2890
- O({ type: Number })
2891
- ], E.prototype, "resultsTtl", 2);
2892
- E = M([
2893
- Ss("sonic-hugging-face-infer")
2894
- ], E);
2895
- function mn(n) {
2896
- Cs(n);
2897
- const e = yt();
2898
- return {
2899
- models: n.models,
2900
- registry: e,
2901
- infer(t) {
2902
- return Xt(
2903
- {
2904
- ...t,
2905
- input: t.input,
2906
- output: t.output,
2907
- text: t.text,
2908
- call: t.call,
2909
- untrusted: !1
2910
- },
2911
- e
2912
- );
2913
- },
2914
- async run(t, s, i, r = {}) {
2915
- const o = e.model(t), l = e.resolvedConfig.defaults, c = Wt(s, {
2916
- kind: Kt[o.task],
2917
- text: r.text,
2918
- maxItems: l.maxItems,
2919
- maxChars: l.maxChars
2920
- });
2921
- if (c.kind === "empty") return null;
2922
- if (c.kind === "invalid") throw new R("runtime", c.message);
2923
- const f = { ...o.defaults ?? {}, ...i ?? {} }, d = Gt[o.task];
2924
- await e.ensureLoaded(t, r.load ?? "first-use");
2925
- const u = await e.run(
2926
- {
2927
- alias: t,
2928
- inputs: c.payloads,
2929
- call: f,
2930
- positional: d,
2931
- batch: o.task === "feature-extraction" && !!f.pooling && f.pooling !== "none"
2932
- },
2933
- r.timeoutMs ?? l.timeoutMs
2934
- );
2935
- return c.many ? Vt(c, u) : u[0];
2936
- },
2937
- load: (t) => e.ensureLoaded(t, "manual"),
2938
- state: (t) => e.state(t),
2939
- subscribe: (t, s) => e.subscribe(t, s),
2940
- accept: (t) => e.accept(t),
2941
- decline: (t) => e.decline(t),
2942
- revokeConsent: (t) => e.revokeConsent(t),
2943
- clearModel: (t) => e.clearModel(t),
2944
- async clearAll() {
2945
- await e.clearAll(), await Js();
2946
- }
2947
- };
2948
- }
2949
- export {
2950
- mn as configureHuggingFace,
2951
- _n as defineHuggingFaceModels
2952
- };