@supersoniks/concorde 4.9.95 → 4.9.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +0,0 @@
1
- var ConcordeHF=(function(xe){"use strict";/**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const Ee=globalThis,Be=Ee.ShadowRoot&&(Ee.ShadyCSS===void 0||Ee.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ze=Symbol(),wt=new WeakMap;let vt=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==ze)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Be&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=wt.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&wt.set(t,e))}return e}toString(){return this.cssText}};const Zt=n=>new vt(typeof n=="string"?n:n+"",void 0,ze),Qt=(n,...e)=>{const t=n.length===1?n[0]:e.reduce(((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;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.")})(i)+n[r+1]),n[0]);return new vt(t,n,ze)},es=(n,e)=>{if(Be)n.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const s=document.createElement("style"),i=Ee.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},$t=Be?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return Zt(t)})(n):n;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:ts,defineProperty:ss,getOwnPropertyDescriptor:ns,getOwnPropertyNames:is,getOwnPropertySymbols:rs,getPrototypeOf:os}=Object,Ce=globalThis,At=Ce.trustedTypes,as=At?At.emptyScript:"",ls=Ce.reactiveElementPolyfillSupport,fe=(n,e)=>n,Pe={toAttribute(n,e){switch(e){case Boolean:n=n?as:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Fe=(n,e)=>!ts(n,e),St={attribute:!0,type:String,converter:Pe,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),Ce.litPropertyMetadata??=new WeakMap;let ie=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=St){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){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&ss(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:r}=ns(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const l=i?.call(this);r?.call(this,o),this.requestUpdate(e,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??St}static _$Ei(){if(this.hasOwnProperty(fe("elementProperties")))return;const e=os(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(fe("properties"))){const t=this.properties,s=[...is(t),...rs(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift($t(i))}else e!==void 0&&t.push($t(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return es(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(s.converter?.toAttribute!==void 0?s.converter:Pe).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:Pe;this._$Em=i;const l=o.fromAttribute(t,r.type);this[i]=l??this._$Ej?.get(i)??l,this._$Em=null}}requestUpdate(e,t,s){if(e!==void 0){const i=this.constructor,r=this[e];if(s??=i.getPropertyOptions(e),!((s.hasChanged??Fe)(r,t)||s.useDefault&&s.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this._$Ej??=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??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,r]of this._$Ep)this[i]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,r]of s){const{wrapped:o}=r,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,r,l)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((s=>s.hostUpdate?.())),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};ie.elementStyles=[],ie.shadowRootOptions={mode:"open"},ie[fe("elementProperties")]=new Map,ie[fe("finalized")]=new Map,ls?.({ReactiveElement:ie}),(Ce.reactiveElementVersions??=[]).push("2.1.1");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const He=globalThis,Le=He.trustedTypes,kt=Le?Le.createPolicy("lit-html",{createHTML:n=>n}):void 0,xt="$lit$",K=`lit$${Math.random().toFixed(9).slice(2)}$`,Et="?"+K,cs=`<${Et}>`,ee=document,pe=()=>ee.createComment(""),ge=n=>n===null||typeof n!="object"&&typeof n!="function",qe=Array.isArray,us=n=>qe(n)||typeof n?.[Symbol.iterator]=="function",We=`[
14
- \f\r]`,_e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ct=/-->/g,Pt=/>/g,te=RegExp(`>|${We}(?:([^\\s"'>=/]+)(${We}*=${We}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Lt=/'/g,Mt=/"/g,It=/^(?:script|style|textarea|title)$/i,hs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),ds=hs(1),re=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ot=new WeakMap,se=ee.createTreeWalker(ee,129);function Tt(n,e){if(!qe(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return kt!==void 0?kt.createHTML(e):e}const fs=(n,e)=>{const t=n.length-1,s=[];let i,r=e===2?"<svg>":e===3?"<math>":"",o=_e;for(let l=0;l<t;l++){const c=n[l];let f,d,u=-1,m=0;for(;m<c.length&&(o.lastIndex=m,d=o.exec(c),d!==null);)m=o.lastIndex,o===_e?d[1]==="!--"?o=Ct:d[1]!==void 0?o=Pt:d[2]!==void 0?(It.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=te):d[3]!==void 0&&(o=te):o===te?d[0]===">"?(o=i??_e,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=_e:(o=te,i=void 0);const T=o===te&&n[l+1].startsWith("/>")?" ":"";r+=o===_e?c+cs:u>=0?(s.push(f),c.slice(0,u)+xt+c.slice(u)+K+T):c+K+(u===-2?l:T)}return[Tt(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class me{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let r=0,o=0;const l=e.length-1,c=this.parts,[f,d]=fs(e,t);if(this.el=me.createElement(f,s),se.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=se.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(xt)){const m=d[o++],T=i.getAttribute(u).split(K),a=/([.?@])?(.*)/.exec(m);c.push({type:1,index:r,name:a[2],strings:T,ctor:a[1]==="."?gs:a[1]==="?"?_s:a[1]==="@"?ms:Me}),i.removeAttribute(u)}else u.startsWith(K)&&(c.push({type:6,index:r}),i.removeAttribute(u));if(It.test(i.tagName)){const u=i.textContent.split(K),m=u.length-1;if(m>0){i.textContent=Le?Le.emptyScript:"";for(let T=0;T<m;T++)i.append(u[T],pe()),se.nextNode(),c.push({type:2,index:++r});i.append(u[m],pe())}}}else if(i.nodeType===8)if(i.data===Et)c.push({type:2,index:r});else{let u=-1;for(;(u=i.data.indexOf(K,u+1))!==-1;)c.push({type:7,index:r}),u+=K.length-1}r++}}static createElement(e,t){const s=ee.createElement("template");return s.innerHTML=e,s}}function oe(n,e,t=n,s){if(e===re)return e;let i=s!==void 0?t._$Co?.[s]:t._$Cl;const r=ge(e)?void 0:e._$litDirective$;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=oe(n,i._$AS(n,e.values),i,s)),e}class ps{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??ee).importNode(t,!0);se.currentNode=i;let r=se.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let f;c.type===2?f=new ye(r,r.nextSibling,this,e):c.type===1?f=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(f=new ys(r,this,e)),this._$AV.push(f),c=s[++l]}o!==c?.index&&(r=se.nextNode(),o++)}return se.currentNode=ee,i}p(e){let t=0;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++}}class ye{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=oe(this,e,t),ge(e)?e===P||e==null||e===""?(this._$AH!==P&&this._$AR(),this._$AH=P):e!==this._$AH&&e!==re&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):us(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==P&&ge(this._$AH)?this._$AA.nextSibling.data=e:this.T(ee.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=me.createElement(Tt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const r=new ps(i,this),o=r.u(this.options);r.p(t),this.T(o),this._$AH=r}}_$AC(e){let t=Ot.get(e.strings);return t===void 0&&Ot.set(e.strings,t=new me(e)),t}k(e){qe(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const r of e)i===t.length?t.push(s=new ye(this.O(pe()),this.O(pe()),this,this.options)):s=t[i],s._$AI(r),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Me{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,r){this.type=1,this._$AH=P,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=P}_$AI(e,t=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=oe(this,e,t,0),o=!ge(e)||e!==this._$AH&&e!==re,o&&(this._$AH=e);else{const l=e;let c,f;for(e=r[0],c=0;c<r.length-1;c++)f=oe(this,l[s+c],t,c),f===re&&(f=this._$AH[c]),o||=!ge(f)||f!==this._$AH[c],f===P?e=P:e!==P&&(e+=(f??"")+r[c+1]),this._$AH[c]=f}o&&!i&&this.j(e)}j(e){e===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class gs extends Me{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===P?void 0:e}}class _s extends Me{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==P)}}class ms extends Me{constructor(e,t,s,i,r){super(e,t,s,i,r),this.type=5}_$AI(e,t=this){if((e=oe(this,e,t,0)??P)===re)return;const s=this._$AH,i=e===P&&s!==P||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==P&&(s===P||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ys{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){oe(this,e)}}const bs=He.litHtmlPolyfillSupport;bs?.(me,ye),(He.litHtmlVersions??=[]).push("3.3.1");const ws=(n,e,t)=>{const s=t?.renderBefore??e;let i=s._$litPart$;if(i===void 0){const r=t?.renderBefore??null;s._$litPart$=i=new ye(e.insertBefore(pe(),r),r,void 0,t??{})}return i._$AI(n),i};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */const Ve=globalThis;class be extends ie{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ws(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return re}}be._$litElement$=!0,be.finalized=!0,Ve.litElementHydrateSupport?.({LitElement:be});const vs=Ve.litElementPolyfillSupport;vs?.({LitElement:be}),(Ve.litElementVersions??=[]).push("4.2.1");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const $s=n=>(e,t)=>{t!==void 0?t.addInitializer((()=>{customElements.define(n,e)})):customElements.define(n,e)};/**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */const As={attribute:!0,type:String,converter:Pe,reflect:!1,hasChanged:Fe},Ss=(n=As,e,t)=>{const{kind:s,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),s==="setter"&&((n=Object.create(n)).wrapped=!0),r.set(t.name,n),s==="accessor"){const{name:o}=t;return{set(l){const c=e.get.call(this);e.set.call(this,l),this.requestUpdate(o,c,n)},init(l){return l!==void 0&&this.C(o,void 0,n,l),l}}}if(s==="setter"){const{name:o}=t;return function(l){const c=this[o];e.call(this,l),this.requestUpdate(o,c,n)}}throw Error("Unsupported decorator location: "+s)};function I(n){return(e,t)=>typeof t=="object"?Ss(n,e,t):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,e,t)}function ks(n){return n}const xs={load:"first-use",trigger:"mutation",debounceMs:50,consentAboveMB:30,allowWasmUpToMB:50,timeoutMs:6e4,maxItems:2e3,maxChars:2e3,persist:!1,resultsCacheBytes:20*1024*1024};let Je=null;const Ge=new Set;function Es(n){Je={...n,defaults:{...xs,...n.defaults}};for(const e of Ge)e(Je)}function Cs(){return Je}function Ut(n){return Ge.add(n),()=>Ge.delete(n)}const Ps=/\$\{|\{\$/;function Ls(n){return Ps.test(n)}function ae(n){const e=typeof n=="string"?n:n.path;if(Ls(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Ke="1";function Ms(n){const e=n.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}class L{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const s=t.indexOf("=");return e[t.substring(0,s).trim()]=t.substring(s+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let s=e;for(;s;){if(!t(s))return;s=s.parentNode||s.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let s=e;for(;s;){if(s instanceof Element&&s.nodeType===1){const i=window.getComputedStyle(s);if(L.overflowMatches(i,t))return s}s=L.nextComposedAncestor(s)}return null}static getScrollableAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return L.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const s of L.scopeAttributeNames(t))if(e.hasAttribute(s))return e.getAttribute(s)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let s=e;for(;s;){if(s instanceof HTMLElement){const r=L.readScopeAttributeOnElement(s,t);if(r!=null)return r}const i=s.parentNode||s.host;if(!i)break;s=i}return null}static getApiConfiguration(e){const t=L.getAncestorAttributeValue(e,"token"),s=L.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=L.getAncestorAttributeValue(e,"serviceURL");let r=null,o=null;const l=L.getAncestorAttributeValue(e,"tokenProvider"),c=L.getAncestorAttributeValue(e,"eventsApiToken");t||(r=L.getAncestorAttributeValue(e,"userName"),o=L.getAncestorAttributeValue(e,"password"));const f=L.getAncestorAttributeValue(e,"credentials")||void 0,d=e.getAttribute("cache"),u=e.hasAttribute("blockUntilDone"),m=e.hasAttribute("keepAlive");return{serviceURL:i,token:t,userName:r,password:o,authToken:c,tokenProvider:l,addHTTPResponse:s,credentials:f,cache:d,blockUntilDone:u,keepAlive:m}}static getClosestElement(e,t){let s=e;for(;s&&!(s.nodeName&&s.nodeName.toLowerCase()===t);){const i=s.parentNode||s.host;if(!i){s=null;break}s=i}return s?.nodeName?s:null}static getClosestForm(e){return L.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const s=new Set(t.map(o=>o.toLowerCase())),i=[];let r=e.parentNode||e.host;for(;r;)r instanceof Element&&s.has(r.tagName.toLowerCase())&&i.push(r),r=r.parentNode||r.host;return i}static getAncestorsBySelectors(e,t){const s=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const r of t)try{if(i.matches(r)){s.push(i);break}}catch{}i=i.parentNode||i.host}return s}static async loadJS(e){if(!Ms(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,s=Array.from(document.scripts).find(r=>r.src===t);if(s)return s.dataset.concordeLoaded===Ke?!0:new Promise(r=>{let o=!1;const l=f=>{o||(o=!0,f&&(s.dataset.concordeLoaded=Ke),r(f))};s.addEventListener("load",()=>l(!0),{once:!0}),s.addEventListener("error",()=>l(!1),{once:!0});const c=s.readyState;if(c==="complete"||c==="loaded"){l(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||l(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(r=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded=Ke,r(!0)},o.onerror=()=>r(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(t=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,s.onload=()=>t(!0),s.onerror=()=>t(!0),document.head.appendChild(s)})}}class q{static shallowEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o];if(s?l!==c:l!=c)return!1}return!0}static deepEqual(e,t,s=!0){const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length&&s)return!1;for(const o of i){const l=e[o],c=t[o],f=q.isObject(l)&&q.isObject(c),d=s?l!==c:l!=c;if(f&&!q.deepEqual(l,c)||!f&&d)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return q.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,s=!1){for(const i of t){const r=e[i];if(r===void 0)return;s&&q.isObject(r)?e=Object.assign(Array.isArray(r)?[]:{},e,r):e=e[i]}return e}static traverseDotNotation(e,t,s=!1){return q.traverse(e,t.split("."),s)}static getURLSearchArray(e,t=""){let s=[];for(let i in e){const r=e[i];t&&(i=t+"["+i+"]"),q.isObject(r)?s=[...s,...this.getURLSearchArray(r,i)]:s.push(`${i}=${r}`)}return s}static getURLSearchString(e){return q.getURLSearchArray(e,"").join("&")}}q.traverseDotNotation;let Nt="sonic";typeof __SONIC_PREFIX__<"u"&&(Nt=__SONIC_PREFIX__);let Rt=Nt.replace(/-([a-z])/g,n=>n[1].toUpperCase());const Is=Rt.charAt(0).toUpperCase()+Rt.slice(1);function Ie(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function X(n){return typeof n=="object"&&n!==null}let le="sonic";typeof __SONIC_PREFIX__>"u"&&(le="sonic");const Xe=le=="sonic"?"publisher-proxies-data":le+"-publisher-proxies-data",Z=class Z{constructor(e,t,s){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=432e5,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=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;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),Z.instances.delete(this._instanceCounter_)}hasListener(){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}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!D.changed){D.changed=!0,D.saveId++;const t=D.saveId;setTimeout(()=>D.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach(i=>{i(s)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(s=>{s[e]!==t&&(s[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(s=>{const i=Object.getOwnPropertyDescriptor(s,e);i&&!i.set&&!i.writable||(s.propertyMap&&s.propertyMap[e]&&(e=s.propertyMap[e]),typeof s[e]<"u"&&s[e]!==t&&(s[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let s=t;const i=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(s=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==i&&(e[s]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const s=this._value_[t];e[t]!==s&&(e[t]=s)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||X(this._value_)&&X(e)&&e&&Ie(this._value_)&&Ie(e)&&this._value_.__value===e.__value||!X(e)&&e===this._value_.__value)return!0;this._value_=X(e)?e:{__value:e},this._cachedGet_=void 0;const s=Ie(this._value_);if(this._parentKey_&&this.parent){const i=Ie(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const r=[];r[Number(this._parentKey_)]=i,this.parent.set(r)}else this.parent._value_[this._parentKey_]=i}if(s)return this._proxies_.forEach((i,r)=>{r!="_parent_"&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,r)=>{const o=this._value_[r];r!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(r))&&(i.set(null),this._publishDynamicFilling_(r,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),X(this._value_))for(const i in this._value_){const r=e[i],l=X(r)?r:{__value:r};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,r);continue}this._proxies_.get(i)?.set(l,!0),this._publishDynamicFilling_(i,r)}return!0}get(){if(Os(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(Z.instancesCounter++,this._instanceCounter_=Z.instancesCounter),Z.instances.set(this._instanceCounter_,this),"<"+le+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+le+"-publisher-proxy>"}};Z.instances=new Map,Z.instancesCounter=0;let Oe=Z;const Dt=[];function Os(n){Dt.length>0&&Dt[0].add(n)}const _=class _{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],_.instance!=null)throw"Singleton / use getInstance";_.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),_.initPageShowHandler()}static initPageShowHandler(){_.pageShowHandlerInitialized||(_.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&_.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let s=localStorage.getItem(Xe),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem(Xe,s),this.localStorageData={};const r=1e3*60*60*12;for(const o in this.localStorageData){const l=this.localStorageData[o],c=new Date().getTime()-(l.expirationDelayMs||r);l.lastModifiationMS<c&&delete this.localStorageData[o]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=_.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new _)}return _.instance==null?new _:_.instance}static get(e,t){return _.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+L.getLanguage()]?.data||e.get())}get(e,t){const s=t?.localStorageMode==="enabled",i=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const l=Ye({});this.set(e,l)}const r=this.publishers.get(e);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)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==_.saveId&&e%10!=0))try{if(!_.changed||_.saving)return;_.saving=!0,_.changed=!1;const t=Array.from(this.publishers.keys());let s=!1;for(const i of t){const r=this.publishers.get(i);if(!r?._is_savable_)continue;const o=r?.get();o&&(this.localStorageData[i+"¤lang_"+L.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:r._expiration_delay_,data:o},s=!0)}if(s){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Xe,i)}if(_.saving=!1,_.changed){_.saveId++;const i=_.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{_.saving=!1}}async compress(e,t){const s=new TextEncoder().encode(e),i=window,r=new i.CompressionStream(t),o=r.writable.getWriter();o.write(s),o.close();const l=await new Response(r.readable).arrayBuffer(),c=new Uint8Array(l);let f="";for(let d=0;d<c.length;d++)f+=String.fromCharCode(c[d]);return btoa(f)}async decompress(e,t){const s=atob(e),r=Uint8Array.from(s,d=>d.charCodeAt(0)).buffer,o=window,l=new o.DecompressionStream(t),c=l.writable.getWriter();c.write(r),c.close();const f=await new Response(l.readable).arrayBuffer();return new TextDecoder().decode(f)}};_.buildDate="Mon Sep 28 2026 08:00:14 GMT+0200 (Central European Summer Time)",_.changed=!1,_.saving=!1,_.saveId=0,_.instance=null,_.instances=new Map,_.pageShowHandlerInitialized=!1;let D=_;if(typeof window<"u"){const n=window,e=Is+"PublisherManager",t=n[e]||D;if(n[e]||(n[e]=D),t!==D){const s=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of s)Object.defineProperty(D,i,{configurable:!0,get(){return t[i]},set(r){t[i]=r}})}}const Ts=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function Us(n,e){return{get:function(t,s){if(typeof s=="string"&&Ts.has(s))return n[s];if(s==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(s)){const i=n._value_[s],r=Ye(X(i)?i:{__value:i},n,s);r._proxies_.set("_parent_",e()),n._proxies_.set(s,r)}return n._proxies_.get(s)},set:function(t,s,i){if(s=="_value_")return n._value_=i,!0;if(s=="_cachedGet_")return n._cachedGet_=i,!0;if(s=="_assignmentId_")return n._assignmentId_=i,!0;if(s=="_is_savable_")return n._is_savable_=i,!0;if(s=="_expiration_delay_")return n._expiration_delay_=i,!0;if(s=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=i,!0;if(s=="_instanceCounter_")return n._instanceCounter_=i,!0;if(!n._proxies_.has(s)){const o=Ye({},n,s);o._proxies_.set("_parent_",e()),n._proxies_.set(s,o)}return n._value_[s]!==i&&(n._value_[s]=i,n._publishDynamicFilling_(s,i),n._proxies_.get(s)?.set(X(i)?i:{__value:i})),!0},deleteProperty:function(t,s){return n._publishDynamicFilling_(s,null),n._proxies_.get(s)?.set(null),delete n._value_[s]},has:function(t,s){return s in n._value_&&s!="_lockInternalMutationPublishing_"},defineProperty:function(t,s,i){return i&&"value"in i&&(n._value_[s]=i.value),!0},getOwnPropertyDescriptor:function(t,s){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function Ye(n,e=null,t){const s=new Oe(n,e,t);let i=null;const r=Us(s,()=>i);return i=new Proxy(s,r),i}class Ns extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Oe.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(le+"-publisher-proxy",Ns)}catch{}function Rs(n){return ae(n)}function Ds(n){return n.split(".")[0]??n}function js(n){return`${Ds(Rs(n))}/_state_`}const Bs="concorde-hf-results",Ze="results",zs=64;async function Qe(n){const e=globalThis.crypto?.subtle;if(e){const i=await e.digest("SHA-256",n);return[...new Uint8Array(i)].map(r=>r.toString(16).padStart(2,"0")).join("")}let t=2166136261,s=16777619;for(let i=0;i<n.length;i++)t=Math.imul(t^n[i],16777619)>>>0,s=Math.imul(s^n[n.length-1-i],2166136261)>>>0;return`fnv-${t.toString(16)}${s.toString(16)}-${n.length}`}async function et(n){if(n instanceof Blob)return{$blob:await Qe(new Uint8Array(await n.arrayBuffer())),type:n.type};if(ArrayBuffer.isView(n))return{$typed:n.constructor.name,hash:await Qe(new Uint8Array(n.buffer,n.byteOffset,n.byteLength))};if(Array.isArray(n))return Promise.all(n.map(et));if(n&&typeof n=="object"){const e={};for(const t of Object.keys(n).sort())e[t]=await et(n[t]);return e}return n}async function Fs(n){const e=JSON.stringify(await et(n));return Qe(new TextEncoder().encode(e))}function tt(n){return n instanceof Blob?!0:Array.isArray(n)?n.some(tt):n&&typeof n=="object"?Object.values(n).some(tt):!1}const Y=new Map;function st(n,e){for(Y.delete(n),Y.set(n,e);Y.size>zs;){const t=Y.keys().next().value;if(t===void 0)break;Y.delete(t)}}let Te=null;function nt(){return Te||(Te=new Promise(n=>{try{if(typeof indexedDB>"u")return n(null);const e=indexedDB.open(Bs,1);e.onupgradeneeded=()=>{e.result.createObjectStore(Ze,{keyPath:"key"}).createIndex("at","at")},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null),e.onblocked=()=>n(null)}catch{n(null)}}),Te)}function ce(n,e,t){return new Promise(s=>{try{const i=n.transaction(Ze,e),r=t(i.objectStore(Ze));i.oncomplete=()=>s(r?r.result:void 0),i.onerror=()=>s(void 0),i.onabort=()=>s(void 0)}catch{s(void 0)}})}async function Hs(n,e,t){if(Y.has(n)){const r=Y.get(n);return st(n,r),{hit:!0,value:r}}if(!e)return{hit:!1};const s=await nt();if(!s)return{hit:!1};const i=await ce(s,"readonly",r=>r.get(n));return i?t&&Date.now()-i.at>t?{hit:!1}:(st(n,i.value),ce(s,"readwrite",r=>r.put({...i,at:Date.now()})),{hit:!0,value:i.value}):{hit:!1}}async function qs(n,e,t,s){if(st(n,e),!t||tt(e))return;const i=await nt();if(!i)return;let r=0;try{r=JSON.stringify(e).length}catch{return}r>s||(await ce(i,"readwrite",o=>o.put({key:n,value:e,bytes:r,at:Date.now()})),await Ws(i,s))}async function Ws(n,e){const t=await ce(n,"readonly",r=>r.getAll())??[];let s=t.reduce((r,o)=>r+o.bytes,0);if(s<=e)return;t.sort((r,o)=>r.at-o.at);const i=[];for(const r of t){if(s<=e)break;i.push(r.key),s-=r.bytes}await ce(n,"readwrite",r=>{for(const o of i)r.delete(o)})}async function Vs(){Y.clear();const n=await nt();n&&await ce(n,"readwrite",e=>e.clear())}function it(n){return n===null?"null":Array.isArray(n)?"array":n instanceof Blob?"Blob":ArrayBuffer.isView(n)?n.constructor.name:typeof n}function Js(n){if(n==null||n==="")return null;if(typeof n=="function")return s=>{const i=n(s);return typeof i=="string"?i:null};const e=(typeof n=="string"?n.split("+"):[...n]).map(s=>s.trim()).filter(Boolean).map(s=>s.split("."));if(!e.length)return null;const t=(s,i)=>{if(s==null)return[];if(!i.length)return typeof s=="string"?s.trim()?[s.trim()]:[]:typeof s=="number"?[String(s)]:Array.isArray(s)?s.flatMap(l=>t(l,[])):[];if(Array.isArray(s))return s.flatMap(l=>t(l,i));if(typeof s!="object")return[];const[r,...o]=i;return t(s[r],o)};return s=>{const i=e.map(r=>t(s,r).join(", ")).filter(r=>r.length>0);return i.length?i.join(" — "):null}}function Gs(n){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}function Ks(n,e,t){switch(e.kind){case"text":{let s=null;if(typeof n=="string")s=n.trim();else if(n&&typeof n=="object"&&!Array.isArray(n)){if(!t)return{ok:!1,reason:"objet reçu sans `options.text` pour en extraire le texte"};s=t(n)}else return{ok:!1,reason:`texte attendu, reçu ${it(n)}`};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"}}case"image":return typeof n=="string"&&n.trim()?{ok:!0,payload:n.trim(),truncated:!1}:n instanceof Blob?{ok:!0,payload:n,truncated:!1}:{ok:!1,reason:`image attendue (URL, data URL ou Blob), reçu ${it(n)}`};case"audio":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}:{ok:!1,reason:`audio attendu (Float32Array, Float64Array ou URL), reçu ${it(n)}`}}}function jt(n,e){if(Gs(n))return{kind:"empty"};const t=Js(e.text),s=Array.isArray(n),i=s?n:[n];if(i.length>e.maxItems)return{kind:"invalid",code:"too-large",message:`Entrée trop grosse : ${i.length} éléments (maximum ${e.maxItems}).`};const r=[],o=[],l=[];let c=0;if(i.forEach((d,u)=>{const m=Ks(d,e,t);m.ok?(r.push(m.payload),o.push(u),m.truncated&&c++):l.push(s?`[${u}] ${m.reason}`:m.reason)}),!r.length)return{kind:"invalid",code:"invalid-input",message:`Entrée invalide : ${l.slice(0,3).join(" ; ")}${l.length>3?` (+${l.length-3})`:""}.`};const f=[];return c&&f.push(`${c} texte(s) tronqué(s) à ${e.maxChars} caractères.`),l.length&&f.push(`${l.length} élément(s) ignoré(s) : ${l.slice(0,3).join(" ; ")}.`),{kind:"ok",many:s,length:i.length,payloads:r,positions:o,skipped:i.length-r.length,truncated:c,warnings:f}}function Bt(n,e){const t=new Array(n.length).fill(null);return n.positions.forEach((s,i)=>{t[s]=e[i]??null}),t}function Xs(n,e){const t=new Map;let s=Promise.resolve();const i=a=>e.postMessage(a),r=(a,h,g)=>i({id:a,ok:!1,error:{code:h,message:g}}),o=a=>{const h=String(a?.message??a).toLowerCase();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"},l=a=>{const h={...a.options||{}};return h.revision=a.revision,h},c=async()=>{const a=globalThis.navigator?.gpu;if(!a||typeof a.requestAdapter!="function")return!1;try{return!!await a.requestAdapter()}catch{return!1}},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=>{if(f(a))return a.tolist();if(d(a)){const h=await a.toBlob("image/png");return{width:a.width,height:a.height,channels:a.channels,blob:h}}if(Array.isArray(a))return Promise.all(a.map(u));if(a instanceof Blob)return a;if(a&&typeof a=="object"){const h={};for(const g of Object.keys(a))h[g]=await u(a[g]);return h}return a},m=a=>Array.isArray(a)&&a.length===1&&Array.isArray(a[0])?a[0]:a,T={async configure({env:a}){const h=n.env;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){let g=a.wasmPaths;if(typeof g=="string"){const v=g.endsWith("/")?g:g+"/",E=String(globalThis.navigator?.userAgent??""),H=/Safari\//.test(E)&&!/Chrome|Chromium|Android/.test(E),W=Number((/Version\/(\d+)/.exec(E)??[])[1]??99),A=H&&W<26&&!globalThis.navigator?.gpu?"":".asyncify";g={mjs:`${v}ort-wasm-simd-threaded${A}.mjs`,wasm:`${v}ort-wasm-simd-threaded${A}.wasm`}}h.backends.onnx.wasm.wasmPaths=g}if(a.logLevel&&n.LogLevel){const g=n.LogLevel[String(a.logLevel).toUpperCase()];g!==void 0&&(h.logLevel=g)}return{version:h.version??null}},async inspect({model:a}){const h=n.ModelRegistry,g=l(a);let v=!1,E=null;try{v=!!await h?.is_pipeline_cached?.(a.task,a.repo,g)}catch{v=!1}try{const H=await h?.get_pipeline_files?.(a.task,a.repo,g);if(H&&h?.get_file_metadata){const A=(await Promise.all(H.map(y=>h.get_file_metadata(a.repo,y,{revision:a.revision}).catch(()=>null)))).map(y=>y?.size);A.every(y=>typeof y=="number")&&(E=A.reduce((y,S)=>y+S,0))}}catch{E=null}return{cached:v,totalBytes:E}},async load({model:a,devices:h}){const g=t.get(a.alias);if(g)return{backend:g.pipe.__backend,loadMs:0};const v=performance.now(),E={},H=y=>{if(y.status==="progress_total")i({type:"progress",alias:a.alias,progress:{loadedBytes:y.loaded,totalBytes:y.total,percent:Math.round(y.progress??0)}});else if(y.status==="progress"){E[y.file]={loaded:y.loaded,total:y.total};const S=Object.values(E),U=S.reduce(($e,N)=>$e+(N.loaded||0),0),j=S.reduce(($e,N)=>$e+(N.total||0),0);i({type:"progress",alias:a.alias,progress:{file:y.file,loadedBytes:U,totalBytes:j,percent:j?Math.round(U/j*100):0}})}},W=[];for(const y of h){if(y==="webgpu"&&!await c()){W.push("webgpu indisponible");continue}try{const S=await n.pipeline(a.task,a.repo,{...l(a),device:y,progress_callback:H});return S.__backend=y,t.set(a.alias,{pipe:S,task:a.task}),{backend:y,loadMs:Math.round(performance.now()-v)}}catch(S){const U=o(S);if(U==="network"||U==="quota")throw S;W.push(`${y} : ${String(S?.message??S)}`)}}const A=new Error(`Aucun backend utilisable (${W.join(" ; ")||"aucun autorisé"}).`);throw A.code="unsupported",A},async run({request:a}){const h=t.get(a.alias);if(!h){const A=new Error(`Modèle "${a.alias}" non chargé.`);throw A.code="runtime",A}const{pipe:g}=h,v={...a.call||{}};let E;a.positional&&(E=v[a.positional],delete v[a.positional]);const H=A=>a.positional?g(A,E,v):g(A,v);if(a.batch){const A=[];for(let S=0;S<a.inputs.length;S+=32){const U=a.inputs.slice(S,S+32),j=await u(await H(U));A.push(...Array.isArray(j)?j:[j])}return A}const W=[];for(const A of a.inputs){const y=await u(await H(A));W.push(h.task==="feature-extraction"||h.task==="image-feature-extraction"?m(y):y)}return W},async clear({model:a}){const h=n.ModelRegistry;if(a){const v=t.get(a.alias);return t.delete(a.alias),await v?.pipe?.dispose?.(),await h?.clear_pipeline_cache?.(a.task,a.repo,l(a)),!0}for(const v of t.values())await v.pipe?.dispose?.();t.clear();const g=n.env.cacheKey;return g&&typeof caches<"u"&&await caches.delete(g),!0}};e.addEventListener("message",a=>{const h=a.data;!h||typeof h.id!="number"||!T[h.type]||(s=s.then(()=>T[h.type](h)).then(g=>i({id:h.id,ok:!0,result:g}),g=>r(h.id,o(g),String(g?.message??g))))})}function Ys(n){return[`const hfWorkerMain = ${Xs.toString()};`,"const pending = [];","const buffer = (event) => pending.push(event);",'self.addEventListener("message", buffer);',"let lib;","try {",` lib = await import(${JSON.stringify(n)});`,"} catch (err) {",' self.postMessage({ type: "fatal", message: "Chargement de Transformers.js impossible : " + (err && err.message || err) });'," throw err;","}",'self.removeEventListener("message", buffer);',"hfWorkerMain(lib, {"," postMessage: (message, transfer) => self.postMessage(message, transfer),"," addEventListener: (type, listener) => {"," self.addEventListener(type, listener);"," for (const event of pending.splice(0)) listener(event);"," },","});"].join(`
28
- `)}class ue extends Error{constructor(e,t){super(t),this.code=e,this.name="HfEngineError"}}class Ue{constructor(e){this.createWorker=e,this.worker=null,this.nextId=1,this.pending=new Map,this.progressListeners=new Map,this.fatal=null}static fromUrl(e){let t=null;const s=new Ue(()=>{const r=Ys(e);return t=URL.createObjectURL(new Blob([r],{type:"text/javascript"})),new Worker(t,{type:"module",name:"concorde-hf"})}),i=s.dispose.bind(s);return s.dispose=()=>{i(),t&&URL.revokeObjectURL(t)},s}ensureWorker(){if(this.fatal)throw this.fatal;if(this.worker)return this.worker;const e=this.createWorker();return e.addEventListener("message",t=>this.onMessage(t.data)),e.addEventListener("error",t=>{this.failAll(new ue("runtime",`Worker Hugging Face : ${t.message||"erreur de chargement (CSP worker-src / script-src ?)"}`))}),this.worker=e,e}onMessage(e){if("type"in e){e.type==="progress"?this.progressListeners.get(e.alias)?.(e.progress):e.type==="fatal"&&this.failAll(new ue("runtime",e.message));return}const t=this.pending.get(e.id);t&&(this.pending.delete(e.id),e.ok?t.resolve(e.result):t.reject(new ue(e.error.code,e.error.message)))}failAll(e){this.fatal=e;for(const t of this.pending.values())t.reject(e);this.pending.clear()}request(e){let t;try{t=this.ensureWorker()}catch(i){return Promise.reject(i)}const s=this.nextId++;return new Promise((i,r)=>{this.pending.set(s,{resolve:i,reject:r}),t.postMessage({...e,id:s})})}async configure(e){await this.request({type:"configure",env:e})}inspect(e){return this.request({type:"inspect",model:e})}async load(e,t,s){this.progressListeners.set(e.alias,s);try{return await this.request({type:"load",model:e,devices:t})}finally{this.progressListeners.delete(e.alias)}}run(e){return this.request({type:"run",request:e})}async clear(e){await this.request({type:"clear",model:e})}dispose(){this.failAll(new ue("runtime","Moteur arrêté.")),this.worker?.terminate(),this.worker=null}}const Zs="concorde-hf-consent:",Ne=1024*1024;function Re(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function Qs(){const n=globalThis.navigator?.connection;return n?n.saveData===!0||n.effectiveType==="slow-2g"||n.effectiveType==="2g":!1}class R extends Error{constructor(e,t){super(t),this.code=e,this.name="HfError"}}class zt{constructor(e){this.config=e,this.entries=new Map,this.engine=null,this.configured=null}get resolvedConfig(){return this.config}getEngine(){if(this.engine)return this.engine;const e=this.config.runtime;return e.source==="engine"?this.engine=e.engine:e.source==="worker"?this.engine=new Ue(e.createWorker):this.engine=Ue.fromUrl(e.url),this.engine}async ready(){const e=this.getEngine();if(!this.configured){const t=this.config.runtime,s=t.source==="engine"?void 0:t.wasmPaths??(t.source==="cdn"?new URL(".",t.url).href:void 0);this.configured=e.configure({cacheKey:`concorde-hf-${t.version}`,remoteHost:this.config.remoteHost,remotePathTemplate:this.config.remotePathTemplate,wasmPaths:s,logLevel:this.config.logLevel})}return await this.configured,e}dispose(){this.engine?.dispose(),this.engine=null,this.configured=null,this.entries.clear()}hasModel(e){return Object.prototype.hasOwnProperty.call(this.config.models,e)}model(e){if(!this.hasModel(e)){const s=Object.keys(this.config.models);throw new R("not-allowed",`[sonic-hugging-face-infer] modèle "${e}" hors liste blanche`+(s.length?` (disponibles : ${s.join(", ")}).`:"."))}const t=this.config.models[e];return{alias:e,task:t.task,repo:t.repo,revision:t.revision,options:t.options??{},devices:t.devices??["webgpu","wasm"],sizeBytes:t.sizeBytes,label:t.label,description:t.description,defaults:t.defaults}}entry(e){let t=this.entries.get(e);return t||(t={state:{phase:"idle",size:null},listeners:new Set},this.entries.set(e,t)),t}state(e){return this.entry(e).state}subscribe(e,t){const s=this.entry(e);return s.listeners.add(t),t(s.state),()=>s.listeners.delete(t)}update(e,t){const s=this.entry(e);s.state={...s.state,...t};for(const i of s.listeners)i(s.state)}inspect(e){const t=this.entry(e);if(!t.inspect){const s=this.model(e);t.inspect=(async()=>{this.update(e,{phase:"checking"});let i=s.sizeBytes??null,r=!1;try{const c=await(await this.ready()).inspect(s);i=c.totalBytes??i,r=c.cached}catch{}const o={totalBytes:i,fromCache:r};return this.update(e,{size:o,phase:"idle"}),o})()}return t.inspect}consentKey(e){return`${Zs}${e}@${this.model(e).revision}`}storedConsent(e){const t=Re()?.getItem(this.consentKey(e));return t==="accepted"||t==="declined"?t:null}accept(e){try{Re()?.setItem(this.consentKey(e),"accepted")}catch{}const t=this.entry(e);t.consent?.resolve(!0),t.consent=void 0,t.state.phase==="declined"&&this.update(e,{phase:"idle"})}decline(e){try{Re()?.setItem(this.consentKey(e),"declined")}catch{}const t=this.entry(e);t.consent?.resolve(!1),t.consent=void 0,this.update(e,{phase:"declined"})}revokeConsent(e){try{Re()?.removeItem(this.consentKey(e))}catch{}this.entry(e).state.phase==="declined"&&this.update(e,{phase:"idle"})}askConsent(e){const t=this.storedConsent(e);if(t)return Promise.resolve(t==="accepted");const s=this.entry(e);if(!s.consent){let i;const r=new Promise(o=>i=o);s.consent={promise:r,resolve:i}}return this.update(e,{phase:"awaiting-consent"}),s.consent.promise}ensureLoaded(e,t){const s=this.entry(e);if(s.state.phase==="ready")return Promise.resolve();if(s.loading)return s.loading;const i=this.load(e,t).finally(()=>{this.entry(e).loading===i&&(s.loading=void 0)});return s.loading=i,i}async load(e,t){const s=this.model(e),i=this.config.defaults,r=await this.inspect(e),o=r?.fromCache===!0,l=r?.totalBytes??null;if(!o&&t!=="manual"){const d=this.storedConsent(e);if(d==="declined"||this.entry(e).state.phase==="declined")throw this.update(e,{phase:"declined"}),new R("declined","Chargement du modèle refusé par l'utilisateur.");const u=l!==null&&l>i.consentAboveMB*Ne;if((t==="consent"||u||Qs())&&d!=="accepted"&&!await this.askConsent(e))throw this.update(e,{phase:"declined"}),new R("declined","Chargement du modèle refusé par l'utilisateur.")}const c=l??s.sizeBytes??null,f=s.devices.filter(d=>d!=="wasm"||c===null||c<=i.allowWasmUpToMB*Ne);if(!f.length)throw this.update(e,{phase:"unsupported",error:{code:"unsupported",message:"Aucune exécution autorisée pour ce modèle."}}),new R("unsupported","Aucune exécution autorisée pour ce modèle.");if(!o&&l){const d=await globalThis.navigator?.storage?.estimate?.().catch(()=>null);if(d?.quota!==void 0){const u=d.quota-(d.usage??0);if(u<l*1.2){const m=`Espace de stockage insuffisant (${Math.round(u/Ne)} Mo libres, ${Math.round(l/Ne)} Mo nécessaires).`;throw this.update(e,{phase:"error",error:{code:"quota",message:m}}),new R("quota",m)}}}this.update(e,{phase:o?"loading":"downloading",error:void 0,progress:void 0});try{const u=await(await this.ready()).load(s,f,T=>this.update(e,{phase:"downloading",progress:T}));let m;i.persist&&!o&&(m=await globalThis.navigator?.storage?.persist?.().catch(()=>!1)),this.update(e,{phase:"ready",backend:u.backend,loadMs:u.loadMs,persisted:m,size:{totalBytes:c,fromCache:o}})}catch(d){const u=d instanceof ue?d.code:"runtime",m=d instanceof Error?d.message:String(d);throw this.update(e,{phase:u==="unsupported"?"unsupported":"error",error:{code:u,message:m}}),new R(u,m)}}async run(e,t){const s=await this.ready();let i;const r=new Promise((o,l)=>{i=setTimeout(()=>l(new R("timeout",`Calcul trop long (> ${t} ms), abandonné.`)),t)});try{return await Promise.race([s.run(e),r])}catch(o){throw o instanceof R?o:o instanceof ue?new R(o.code,o.message):new R("runtime",o instanceof Error?o.message:String(o))}finally{clearTimeout(i)}}async clearModel(e){const t=this.model(e);await(await this.ready()).clear(t);const i=this.entry(e);i.inspect=void 0,this.update(e,{phase:"idle",size:null,backend:void 0,progress:void 0})}async clearAll(){await(await this.ready()).clear();for(const t of this.entries.keys())this.entry(t).inspect=void 0,this.update(t,{phase:"idle",size:null,backend:void 0,progress:void 0})}}let we=null;Ut(n=>{we?.dispose(),we=new zt(n)});function rt(){if(!we){const n=Cs();n&&(we=new zt(n))}return we}function mn(n){return n}const O={type:"boolean"},k=(n,e)=>({type:"number",minimum:n,maximum:e}),b=(n,e)=>({type:"number",integer:!0,minimum:n,maximum:e}),V=(n=500)=>({type:"string",maxLength:n}),he=(n=256)=>({type:"array",items:b(0),maxItems:n}),De=(n=64)=>({type:"array",items:he(),maxItems:n}),ot={type:"array",items:V(200),maxItems:50},en={anyOf:[V(200),ot]},Ft={anyOf:[b(1,50),{type:"null"}]},at={max_length:b(1,1024),max_new_tokens:b(1,1024),min_length:b(0,1024),min_new_tokens:b(0,1024),early_stopping:{anyOf:[O,{enum:["never"]}]},max_time:k(0,120),do_sample:O,num_beams:b(1,8),num_beam_groups:b(1,8),penalty_alpha:k(0,1),use_cache:O,temperature:k(0,5),top_k:b(0,200),top_p:k(0,1),typical_p:k(0,1),epsilon_cutoff:k(0,1),eta_cutoff:k(0,1),diversity_penalty:k(0,10),repetition_penalty:k(0,10),encoder_repetition_penalty:k(0,10),length_penalty:k(-10,10),no_repeat_ngram_size:b(0,32),bad_words_ids:De(),force_words_ids:{anyOf:[De(),{type:"array",items:De(),maxItems:64}]},renormalize_logits:O,forced_bos_token_id:b(0),forced_eos_token_id:{anyOf:[b(0),he()]},remove_invalid_values:O,exponential_decay_length_penalty:{type:"tuple",prefixItems:[b(0),k()]},suppress_tokens:he(),begin_suppress_tokens:he(),forced_decoder_ids:{type:"array",items:{type:"tuple",prefixItems:[b(0),b(0)]},maxItems:64},guidance_scale:k(0,50),num_return_sequences:b(1,8),output_attentions:O,output_hidden_states:O,output_scores:O,return_dict_in_generate:O,pad_token_id:b(0),bos_token_id:b(0),eos_token_id:{anyOf:[b(0),he()]},encoder_no_repeat_ngram_size:b(0,32),decoder_start_token_id:b(0)},tn={"feature-extraction":{pooling:{enum:["none","mean","cls","first_token","eos","last_token"]},normalize:O,quantize:O,precision:{enum:["binary","ubinary"]}},"text-classification":{top_k:Ft},"zero-shot-classification":{candidate_labels:en,hypothesis_template:V(300),multi_label:O},translation:at,"token-classification":{ignore_labels:{type:"array",items:V(100),maxItems:50},aggregation_strategy:{enum:["none","simple"]}},"fill-mask":{top_k:b(1,50)},"question-answering":{context:{anyOf:[V(2e4),{type:"array",items:V(2e4),maxItems:20}]},top_k:b(1,20)},"image-classification":{top_k:Ft},"zero-shot-image-classification":{candidate_labels:ot,hypothesis_template:V(300)},"object-detection":{threshold:k(0,1),percentage:O},"zero-shot-object-detection":{candidate_labels:ot,threshold:k(0,1),top_k:b(1,100),percentage:O},"image-feature-extraction":{pool:O},"image-segmentation":{threshold:k(0,1),mask_threshold:k(0,1),overlap_mask_area_threshold:k(0,1),subtask:{anyOf:[V(50),{type:"null"}]},label_ids_to_fuse:he(),target_sizes:De()},"depth-estimation":{},"background-removal":{},"image-to-text":at,"audio-classification":{top_k:b(1,50)},"automatic-speech-recognition":{...at,return_timestamps:{anyOf:[O,{enum:["word"]}]},chunk_length_s:k(0,60),stride_length_s:k(0,30),force_full_sequences:O,language:V(40),task:{enum:["transcribe","translate"]},num_frames:b(0)}};class lt extends Error{constructor(e){super(e),this.name="HfOptionsError"}}function ve(n){return n===null?"null":Array.isArray(n)?"array":typeof n}function je(n,e,t){if("anyOf"in n){const s=n.anyOf.map(i=>je(i,e,t));return s.some(i=>i===null)?null:s[0]}if("enum"in n)return n.enum.includes(e)?null:`${t} : valeur ${JSON.stringify(e)} non autorisée (attendu : ${n.enum.map(s=>JSON.stringify(s)).join(" | ")}).`;switch(n.type){case"boolean":return typeof e=="boolean"?null:`${t} : booléen attendu, reçu ${ve(e)}.`;case"null":return e===null?null:`${t} : null attendu.`;case"string":return typeof e!="string"?`${t} : texte attendu, reçu ${ve(e)}.`:n.maxLength!==void 0&&e.length>n.maxLength?`${t} : texte trop long (${e.length} > ${n.maxLength}).`:null;case"number":return typeof e!="number"||!Number.isFinite(e)?`${t} : nombre attendu, reçu ${ve(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;case"array":{if(!Array.isArray(e))return`${t} : liste attendue, reçu ${ve(e)}.`;if(n.maxItems!==void 0&&e.length>n.maxItems)return`${t} : trop d'éléments (${e.length} > ${n.maxItems}).`;for(let s=0;s<e.length;s++){const i=je(n.items,e[s],`${t}[${s}]`);if(i)return i}return null}case"tuple":{if(!Array.isArray(e)||e.length!==n.prefixItems.length)return`${t} : liste de ${n.prefixItems.length} éléments attendue.`;for(let s=0;s<e.length;s++){const i=je(n.prefixItems[s],e[s],`${t}[${s}]`);if(i)return i}return null}}}function sn(n,e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new lt(`[sonic-hugging-face-infer] options.call : objet attendu, reçu ${ve(e)}.`);const t=tn[n];for(const[s,i]of Object.entries(e)){const r=t[s];if(!r){const l=Object.keys(t);throw new lt(`[sonic-hugging-face-infer] option "${s}" inconnue pour la tâche "${n}"`+(l.length?` (autorisées : ${l.join(", ")}).`:" (aucune option)."))}if(i===void 0)continue;const o=je(r,i,`options.call.${s}`);if(o)throw new lt(`[sonic-hugging-face-infer] ${o}`)}return e}function nn(n){if(!n||typeof n!="object")return!1;const e=n;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")}function ct(n){return typeof n!="string"?null:n.trim()||null}function rn(n){if(n==null||n==="")return null;if(typeof n=="string")return ct(n);if(typeof n!="object")return null;const e=n;return ct(e.url)??ct(e.blobUrl)}function ut(n,e){if(Array.isArray(n)){for(let s=0;s<n.length;s++)n[s]=ut(n[s],e);return n}if(!n||typeof n!="object")return n;const t=n;if(nn(t)){if(rn(t))return n;const s=URL.createObjectURL(t.blob);return e.push(s),t.url=s,n}for(const s of Object.keys(t))t[s]=ut(t[s],e);return n}function Ht(n){for(const e of n)try{URL.revokeObjectURL(e)}catch{}}const qt={"zero-shot-classification":"candidate_labels","zero-shot-image-classification":"candidate_labels","zero-shot-object-detection":"candidate_labels","question-answering":"context"},Wt={"feature-extraction":"text","text-classification":"text","zero-shot-classification":"text",translation:"text","token-classification":"text","fill-mask":"text","question-answering":"text","image-classification":"image","zero-shot-image-classification":"image","object-detection":"image","zero-shot-object-detection":"image","image-feature-extraction":"image","image-segmentation":"image","depth-estimation":"image","background-removal":"image","image-to-text":"image","audio-classification":"audio","automatic-speech-recognition":"audio"},on=1024*1024,an=5e3,Vt=1500;function de(n){const e=n.split("."),t=e.shift();let s=D.get(t);return e.length&&(s=q.traverse(s,e)),s}function ln(n){return n===!0||n===1||n==="accepted"||n==="true"||n==="1"||n==="on"}const cn={checking:"loading","awaiting-consent":"awaiting-consent",declined:"declined",downloading:"downloading",loading:"loading",ready:"ready",error:"error",unsupported:"unsupported",idle:"idle"};function un(n,e){switch(n){case"downloading":case"loading":case"running":return{status:"loading",error:null};case"done":return{status:e==null||Array.isArray(e)&&e.length===0?"empty":"ready",error:null};case"error":case"invalid-input":return{status:"error",error:null};default:return{status:"empty",error:null}}}function Jt(n,e){const t=e??rt();if(!t)throw new R("not-allowed","[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé.");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,m=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=ae(n.input),E=ae(n.output);if(v===E||E.startsWith(v+".")||v.startsWith(E+"."))throw new Error(`[sonic-hugging-face-infer] la sortie "${E}" chevauche l'entrée "${v}".`);const H=n.status?ae(n.status):null,W=de(E),A=D.get(js(E)),y=H?de(H):null;let S=null,U={...s.defaults??{}};try{const p=n.untrusted?sn(i,n.call):n.call??{};U={...U,...p}}catch(p){S=p instanceof Error?p.message:String(p)}const j=qt[i],$e=i==="feature-extraction"&&!!U.pooling&&U.pooling!=="none";let N="idle",B=t.state(n.model),ne,Gt,ht,dt,ft=!1,pt,Ae=[],Q=0,z=!1,J=null,gt=!1,Kt=!1;const pn=()=>{switch(N){case"empty":return"empty";case"invalid-input":return"invalid-input";case"running":return"running";case"done":return"done";case"error":return"error";default:return cn[B.phase]??"idle"}},F=()=>{if(z)return;const p=pn();if(A.set(un(p,pt)),!y)return;const w=!["done","running","empty","invalid-input"].includes(p)&&B.error?B.error:void 0,$={state:p,model:{alias:s.alias,task:i,repo:s.repo,revision:s.revision,label:s.label,description:s.description},size:{totalBytes:B.size?.totalBytes??null,totalMB:B.size?.totalBytes==null?null:Math.round(B.size.totalBytes/on),fromCache:B.size?.fromCache??!1},progress:B.progress,backend:B.backend,persisted:B.persisted,skipped:ht,warnings:dt,timings:{loadMs:B.loadMs,lastRunMs:Gt},fromResultsCache:ft,error:ne??w};y.set(JSON.parse(JSON.stringify($)))},Se=p=>{Ht(Ae),Ae=[];const w=ut(p,Ae);pt=w,W.set(w)},_t=async p=>{Kt=!0,await t.ensureLoaded(n.model,p)},gn=async p=>{if(S)return N="error",ne={code:"invalid-input",message:S},F(),null;const w=de(v).get(),$=jt(w,{kind:Wt[i],text:n.text,maxItems:m,maxChars:T});if($.kind==="empty")return N="empty",ht=void 0,dt=void 0,Se(f),F(),null;if($.kind==="invalid")return N="invalid-input",ne={code:$.code,message:$.message},d==="clear"&&Se(f),F(),null;if(j&&(U[j]===void 0||U[j]===""))return N="invalid-input",ne={code:"invalid-input",message:`options.call.${j} est requis pour la tâche "${i}".`},F(),null;ht=$.skipped||void 0,dt=$.warnings.length?$.warnings:void 0;const G=await Fs({payloads:$.payloads,positions:$.positions,length:$.length,many:$.many,alias:s.alias,repo:s.repo,revision:s.revision,options:s.options,runtime:g,call:U});if(p!==Q||z)return null;const C=await Hs(G,h,n.resultsTtlMs);return p!==Q||z?null:C.hit?(N="done",ft=!0,Se(C.value),F(),null):o==="manual"&&B.phase!=="ready"?(N="waiting-model",gt=!0,F(),null):{input:$,key:G}},_n=async(p,w,$)=>{N="waiting-model",F();try{await _t(o)}catch(C){if(p!==Q||z)return;N="waiting-model",pt===void 0&&Se(f),(!(C instanceof R)||C.code==="runtime")&&(ne={code:C instanceof R?C.code:"runtime",message:C instanceof Error?C.message:String(C)}),F();return}if(p!==Q||z)return;N="running",F();const G=performance.now();try{const C=await t.run({alias:s.alias,inputs:w.payloads,call:U,positional:j,batch:$e},a);if(p!==Q||z)return;const Yt=w.many?Bt(w,C):C[0]??null;Gt=Math.round(performance.now()-G),N="done",Se(Yt),F(),qs($,Yt,h,r.resultsCacheBytes)}catch(C){if(p!==Q||z)return;N="error",ne={code:C instanceof R?C.code:"runtime",message:C instanceof Error?C.message:String(C)},F()}},Xt=async()=>{if(z)return;const p=++Q;ne=void 0,ft=!1;const w=await gn(p);!w||p!==Q||z||await _n(p,w.input,w.key)},mt=(p=c)=>{z||(J&&clearTimeout(J),J=setTimeout(()=>{J=null,Xt()},p))},yt=[],bt=(p,w)=>{const $=de(p);$.onInternalMutation(w),yt.push(()=>$.offInternalMutation(w))};if(yt.push(t.subscribe(n.model,p=>{B=p,F(),p.phase==="ready"&&gt&&(gt=!1,mt(0))})),l==="mutation"?bt(v,()=>mt()):F(),n.triggerProvider){const p=ae(n.triggerProvider);let w=!0,$="";bt(p,()=>{const G=JSON.stringify(de(p).get()??null);if(w){w=!1,$=G;return}G!==$&&($=G,G!=="null"&&mt(0))})}if(n.consentProvider){const p=ae(n.consentProvider);bt(p,()=>{const w=de(p).get();ln(w)?t.accept(n.model):w==="declined"&&t.decline(n.model)})}const ke=p=>{z||Kt||_t(p).catch(()=>{})};if(o==="auto")ke("auto");else if(o==="idle"){const p=globalThis.requestIdleCallback;p?p(()=>ke("idle"),{timeout:an}):setTimeout(()=>ke("idle"),Vt)}else o==="visible"?n.whenVisible?n.whenVisible().then(()=>ke("visible")):setTimeout(()=>ke("visible"),Vt):t.inspect(n.model).catch(()=>{});return{stop(){if(!z){z=!0,J&&clearTimeout(J);for(const p of yt)p();Ht(Ae),Ae=[]}},run(){return J&&clearTimeout(J),J=null,Xt()},async load(){await _t("manual")},accept(){t.accept(n.model)},decline(){t.decline(n.model)}}}var hn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,M=(n,e,t,s)=>{for(var i=s>1?void 0:s?dn(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&hn(e,t,i),i};let x=class extends be{constructor(){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=>{const e=this.parentElement??this;if(typeof IntersectionObserver>"u")return n();const t=new IntersectionObserver(s=>{s.some(i=>i.isIntersecting)&&(t.disconnect(),n())});t.observe(e)})),this.visible)}connectedCallback(){super.connectedCallback(),this.offConfig=Ut(()=>this.restart()),this.hasUpdated&&this.restart()}disconnectedCallback(){this.handle?.stop(),this.handle=null,this.offConfig?.(),this.offConfig=null,super.disconnectedCallback()}updated(n){n.size&&this.isConnected&&this.restart()}run(){return this.handle?.run()??Promise.resolve()}loadModel(){return this.handle?.load()??Promise.resolve()}accept(){this.handle?.accept()}decline(){this.handle?.decline()}restart(){if(this.handle?.stop(),this.handle=null,!!this.isConnected&&!(!this.model||!this.inputProvider||!this.outputProvider)){if(!rt()){console.warn("[sonic-hugging-face-infer] configureHuggingFace() n'a pas été appelé : composant inactif.");return}try{this.handle=Jt({model:this.model,input:this.inputProvider,output:this.outputProvider,status:this.statusProvider||void 0,triggerProvider:this.triggerProvider||void 0,consentProvider:this.consentProvider||void 0,text:this.options?.text,call:this.options?.call,untrusted:!0,load:this.load||void 0,trigger:this.trigger||void 0,debounceMs:this.debounce??void 0,emptyValue:this.emptyValue,onInvalid:this.onInvalid,maxItems:this.maxItems??void 0,maxChars:this.maxChars??void 0,timeoutMs:this.timeoutMs??void 0,persistResults:this.persistResults,resultsTtlMs:this.resultsTtl??void 0,whenVisible:this.whenVisible})}catch(n){console.error(n instanceof Error?n.message:n)}}}render(){return ds`<slot></slot>`}};x.styles=[Qt`
29
- :host {
30
- display: contents;
31
- }
32
- `],M([I({type:String})],x.prototype,"model",2),M([I({type:String})],x.prototype,"inputProvider",2),M([I({type:String})],x.prototype,"outputProvider",2),M([I({type:String})],x.prototype,"statusProvider",2),M([I({type:String})],x.prototype,"triggerProvider",2),M([I({type:String})],x.prototype,"consentProvider",2),M([I({type:Object})],x.prototype,"options",2),M([I({type:String})],x.prototype,"load",2),M([I({type:String})],x.prototype,"trigger",2),M([I({type:Number})],x.prototype,"debounce",2),M([I({type:Object})],x.prototype,"emptyValue",2),M([I({type:String})],x.prototype,"onInvalid",2),M([I({type:Number})],x.prototype,"maxItems",2),M([I({type:Number})],x.prototype,"maxChars",2),M([I({type:Number})],x.prototype,"timeoutMs",2),M([I({type:Boolean})],x.prototype,"persistResults",2),M([I({type:Number})],x.prototype,"resultsTtl",2),x=M([$s("sonic-hugging-face-infer")],x);function fn(n){Es(n);const e=rt();return{models:n.models,registry:e,infer(t){return Jt({...t,input:t.input,output:t.output,text:t.text,call:t.call,untrusted:!1},e)},async run(t,s,i,r={}){const o=e.model(t),l=e.resolvedConfig.defaults,c=jt(s,{kind:Wt[o.task],text:r.text,maxItems:l.maxItems,maxChars:l.maxChars});if(c.kind==="empty")return null;if(c.kind==="invalid")throw new R("runtime",c.message);const f={...o.defaults??{},...i??{}},d=qt[o.task];await e.ensureLoaded(t,r.load??"first-use");const u=await e.run({alias:t,inputs:c.payloads,call:f,positional:d,batch:o.task==="feature-extraction"&&!!f.pooling&&f.pooling!=="none"},r.timeoutMs??l.timeoutMs);return c.many?Bt(c,u):u[0]},load:t=>e.ensureLoaded(t,"manual"),state:t=>e.state(t),subscribe:(t,s)=>e.subscribe(t,s),accept:t=>e.accept(t),decline:t=>e.decline(t),revokeConsent:t=>e.revokeConsent(t),clearModel:t=>e.clearModel(t),async clearAll(){await e.clearAll(),await Vs()}}}return xe.configureHuggingFace=fn,xe.defineHuggingFaceModels=ks,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"}),xe})({});