@supersoniks/concorde 4.9.97-visual-stack.0 → 4.9.98-visual-stack.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-infos.json +1 -1
- package/concorde-3d.bundle.js +143 -143
- package/concorde-3d.es.js +1393 -1377
- package/concorde-core.bundle.js +1 -1
- package/concorde-core.es.js +1 -1
- package/concorde-hugging-face-infer.bundle.js +1 -1
- package/concorde-hugging-face-infer.es.js +1 -1
- package/concorde-shader.bundle.js +19 -19
- package/concorde-shader.es.js +2317 -2172
- package/concorde-webgpu.bundle.js +30 -30
- package/concorde-webgpu.es.js +2439 -2346
- package/dist/concorde-3d.bundle.js +143 -143
- package/dist/concorde-3d.es.js +1393 -1377
- package/dist/concorde-core.bundle.js +1 -1
- package/dist/concorde-core.es.js +1 -1
- package/dist/concorde-hugging-face-infer.bundle.js +1 -1
- package/dist/concorde-hugging-face-infer.es.js +1 -1
- package/dist/concorde-shader.bundle.js +19 -19
- package/dist/concorde-shader.es.js +2317 -2172
- package/dist/concorde-webgpu.bundle.js +30 -30
- package/dist/concorde-webgpu.es.js +2439 -2346
- package/dist/js/core/components/functional/3d/3d.js +11 -1
- package/dist/js/core/components/functional/3d/3d.js.map +1 -1
- package/dist/js/core/components/functional/3d/constants.js +2 -0
- package/dist/js/core/components/functional/3d/constants.js.map +1 -1
- package/dist/js/core/components/functional/3d/frame-source.js +22 -0
- package/dist/js/core/components/functional/3d/frame-source.js.map +1 -0
- package/dist/js/core/components/functional/3d/reload.js +3 -0
- package/dist/js/core/components/functional/3d/reload.js.map +1 -1
- package/dist/js/core/components/functional/shader/gl-runtime.js +152 -17
- package/dist/js/core/components/functional/shader/gl-runtime.js.map +1 -1
- package/dist/js/core/components/functional/shader/shader.js +55 -6
- package/dist/js/core/components/functional/shader/shader.js.map +1 -1
- package/dist/js/core/components/functional/shader/types.js.map +1 -1
- package/dist/js/core/components/functional/webgpu/webgpu.js +9 -0
- package/dist/js/core/components/functional/webgpu/webgpu.js.map +1 -1
- package/dist/js/core/utils/mediaRef.js +49 -0
- package/dist/js/core/utils/mediaRef.js.map +1 -1
- package/dist/types/core/components/functional/3d/3d.d.ts +7 -2
- package/dist/types/core/components/functional/3d/3d.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/constants.d.ts +1 -1
- package/dist/types/core/components/functional/3d/constants.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/frame-source.d.ts +23 -0
- package/dist/types/core/components/functional/3d/frame-source.d.ts.map +1 -0
- package/dist/types/core/components/functional/3d/reload.d.ts +3 -0
- package/dist/types/core/components/functional/3d/reload.d.ts.map +1 -1
- package/dist/types/core/components/functional/3d/types.d.ts +7 -0
- package/dist/types/core/components/functional/3d/types.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/gl-runtime.d.ts +20 -1
- package/dist/types/core/components/functional/shader/gl-runtime.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/shader.d.ts +14 -3
- package/dist/types/core/components/functional/shader/shader.d.ts.map +1 -1
- package/dist/types/core/components/functional/shader/types.d.ts +6 -0
- package/dist/types/core/components/functional/shader/types.d.ts.map +1 -1
- package/dist/types/core/components/functional/webgpu/webgpu.d.ts +4 -0
- package/dist/types/core/components/functional/webgpu/webgpu.d.ts.map +1 -1
- package/dist/types/core/utils/mediaRef.d.ts +19 -0
- package/dist/types/core/utils/mediaRef.d.ts.map +1 -1
- package/package.json +13 -1
- package/src/core/components/functional/3d/3d.md +12 -2
- package/src/core/components/functional/3d/3d.ts +12 -1
- package/src/core/components/functional/3d/constants.ts +2 -0
- package/src/core/components/functional/3d/frame-source.ts +30 -0
- package/src/core/components/functional/3d/reload.ts +6 -0
- package/src/core/components/functional/3d/types.ts +5 -0
- package/src/core/components/functional/shader/gl-runtime.ts +205 -24
- package/src/core/components/functional/shader/shader.md +10 -8
- package/src/core/components/functional/shader/shader.spec.ts +83 -3
- package/src/core/components/functional/shader/shader.ts +61 -6
- package/src/core/components/functional/shader/types.ts +3 -1
- package/src/core/components/functional/webgpu/webgpu.ts +9 -0
- package/src/core/utils/mediaRef.spec.ts +36 -0
- package/src/core/utils/mediaRef.ts +63 -0
- package/src/docs/_misc/visual-stack.md +18 -2
- package/src/docs/components/docs-demo-sources.ts +14 -0
- package/src/docs/docs.ts +1 -0
- package/src/docs/example/docs-3d-shader-live-demo.ts +98 -0
- package/src/docs/search/docs-search.json +2347 -877
- package/src/tsconfig.json +9 -0
- package/src/tsconfig.tsbuildinfo +1 -1
package/concorde-core.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(an){typeof define=="function"&&define.amd?define(an):an()})((function(){"use strict";var Oe,et;function vl(t){const e=t.trim();if(!e)return!1;try{const s=new URL(e,"https://example.invalid/");return s.protocol==="http:"||s.protocol==="https:"||s.protocol==="blob:"}catch{return!1}}let Je=class Ct{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,s){let r=e;for(;r;){if(!s(r))return;r=r.parentNode||r.host}}static overflowMatches(e,s){return s.includes(e.overflowY)||s.includes(e.overflowX)}static findAncestorByOverflow(e,s){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const i=window.getComputedStyle(r);if(Ct.overflowMatches(i,s))return r}r=Ct.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const s=e.toLowerCase();return s===e?[e]:[e,s]}static readScopeAttributeOnElement(e,s){for(const r of Ct.scopeAttributeNames(s))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,s){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const n=Ct.readScopeAttributeOnElement(r,s);if(n!=null)return n}const i=r.parentNode||r.host;if(!i)break;r=i}return null}static getApiConfiguration(e){const s=Ct.getAncestorAttributeValue(e,"token"),r=Ct.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=Ct.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const c=Ct.getAncestorAttributeValue(e,"tokenProvider"),h=Ct.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ct.getAncestorAttributeValue(e,"userName"),o=Ct.getAncestorAttributeValue(e,"password"));const b=Ct.getAncestorAttributeValue(e,"credentials")||void 0,k=e.getAttribute("cache"),g=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:i,token:s,userName:n,password:o,authToken:h,tokenProvider:c,addHTTPResponse:r,credentials:b,cache:k,blockUntilDone:g,keepAlive:f}}static getClosestElement(e,s){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===s);){const i=r.parentNode||r.host;if(!i){r=null;break}r=i}return r?.nodeName?r:null}static getClosestForm(e){return Ct.getClosestElement(e,"form")}static getAncestorsByTagNames(e,s){const r=new Set(s.map(o=>o.toLowerCase())),i=[];let n=e.parentNode||e.host;for(;n;)n instanceof Element&&r.has(n.tagName.toLowerCase())&&i.push(n),n=n.parentNode||n.host;return i}static getAncestorsBySelectors(e,s){const r=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const n of s)try{if(i.matches(n)){r.push(i);break}}catch{}i=i.parentNode||i.host}return r}static async loadJS(e){if(!vl(e))return!1;const s=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(n=>n.src===s);if(r)return r.dataset.concordeLoaded==="1"?!0:new Promise(n=>{let o=!1;const c=b=>{o||(o=!0,b&&(r.dataset.concordeLoaded="1"),n(b))};r.addEventListener("load",()=>c(!0),{once:!0}),r.addEventListener("error",()=>c(!1),{once:!0});const h=r.readyState;if(h==="complete"||h==="loaded"){c(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||c(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(n=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded="1",n(!0)},o.onerror=()=>n(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(s=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>s(!0),r.onerror=()=>s(!0),document.head.appendChild(r)})}};const ln=t=>{const e=document.documentElement;new MutationObserver(r=>{for(const i of r)i.type==="attributes"&&i.attributeName==="lang"&&t()}).observe(e,{attributes:!0,attributeFilter:["lang"]})};let Tr=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=Je.getLanguage());const i=(b,k)=>[Math.floor(b/k),b%k];function n(b,k,g){return new Intl.NumberFormat(b,{style:"unit",unit:k,unitDisplay:g}).format}const[o,c]=i(e,60),h=[];return o&&h.push(n(s,"hour",r)(o)),c&&h.push(n(s,"minute",r)(c)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(h)}static js(e){try{return Function("return "+e)()}catch{return""}}};class xo{constructor(e){this.path=e}toString(){return this.path}}function So(t){return new Proxy(t,{get(e,s){if(s==="path")return e.path;if(s==="toString")return e.toString.bind(e);if(s===Symbol.toStringTag)return"DataProviderKey";if(typeof s=="symbol")return e[s];const r=e.path?`${e.path}.${String(s)}`:String(s);return So(new xo(r))}})}const yl=/\$\{|\{\$/;function wl(t){return yl.test(t)}function di(t){const e=typeof t=="string"?t:t.path;if(wl(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Ss=function(t){return this instanceof Ss?So(new xo(t)):new Ss(t)};let at=class xs{static shallowEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o];if(r?c!==h:c!=h)return!1}return!0}static deepEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o],b=xs.isObject(c)&&xs.isObject(h),k=r?c!==h:c!=h;if(b&&!xs.deepEqual(c,h)||!b&&k)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return xs.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const i of s){const n=e[i];if(n===void 0)return;r&&xs.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[i]}return e}static traverseDotNotation(e,s,r=!1){return xs.traverse(e,s.split("."),r)}static getURLSearchArray(e,s=""){let r=[];for(let i in e){const n=e[i];s&&(i=s+"["+i+"]"),xs.isObject(n)?r=[...r,...this.getURLSearchArray(n,i)]:r.push(`${i}=${n}`)}return r}static getURLSearchString(e){return xs.getURLSearchArray(e,"").join("&")}};const kt=at.traverseDotNotation;let _l=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(s=>{setTimeout(s,e)})}},Ao="sonic";typeof __SONIC_PREFIX__<"u"&&(Ao=__SONIC_PREFIX__);let Co=Ao.replace(/-([a-z])/g,t=>t[1].toUpperCase());const cn=Co.charAt(0).toUpperCase()+Co.slice(1),Pl=new Set(["localStorageMode","expirationDelayMs","invalidateOnPageShow"]);function ko(t){return t==null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).some(e=>Pl.has(e))}function pi(t){return Object.prototype.hasOwnProperty.call(t,"__value")}function As(t){return typeof t=="object"&&t!==null}let ur="sonic";typeof __SONIC_PREFIX__>"u"&&(ur="sonic");const un=ur=="sonic"?"publisher-proxies-data":ur+"-publisher-proxies-data",Us=class Us{constructor(e,s,r){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,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=s||null,this._parentKey_=r,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(),Us.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(s=>s()),this._is_savable_&&!be.changed){be.changed=!0,be.saveId++;const s=be.saveId;setTimeout(()=>be.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(i=>{i(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const i=Object.getOwnPropertyDescriptor(r,e);i&&!i.set&&!i.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&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 s in this._value_){let r=s;const i=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==i&&(e[r]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,s=!1){if(this._value_===e||As(this._value_)&&As(e)&&e&&pi(this._value_)&&pi(e)&&this._value_.__value===e.__value||!As(e)&&e===this._value_.__value)return!0;this._value_=As(e)?e:{__value:e},this._cachedGet_=void 0;const r=pi(this._value_);if(this._parentKey_&&this.parent){const i=pi(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 n=[];n[Number(this._parentKey_)]=i,this.parent.set(n)}else this.parent._value_[this._parentKey_]=i}if(r)return this._proxies_.forEach((i,n)=>{n!="_parent_"&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(s),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,n)=>{const o=this._value_[n];n!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(n))&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),As(this._value_))for(const i in this._value_){const n=e[i],c=As(n)?n:{__value:n};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,n);continue}this._proxies_.get(i)?.set(c,!0),this._publishDynamicFilling_(i,n)}return!0}get(){if(xl(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_||(Us.instancesCounter++,this._instanceCounter_=Us.instancesCounter),Us.instances.set(this._instanceCounter_,this),"<"+ur+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+ur+"-publisher-proxy>"}};Us.instances=new Map,Us.instancesCounter=0;let Lr=Us;const fi=[];function xl(t){fi.length>0&&fi[0].add(t)}function $o(){fi.unshift(new Set)}function Do(){return fi.shift()}const Te=class Te{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],Te.instance!=null)throw"Singleton / use getInstance";Te.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),Te.initPageShowHandler()}static initPageShowHandler(){Te.pageShowHandlerInitialized||(Te.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&Te.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem(un),i=null;if(r&&(i=await this.decompress(r,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(un,r),this.localStorageData={};const n=1e3*60*60*12;for(const o in this.localStorageData){const c=this.localStorageData[o],h=new Date().getTime()-(c.expirationDelayMs||n);c.lastModifiationMS<h&&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 s=Te.instances.get(e);return s||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new Te)}return Te.instance==null?new Te:Te.instance}static get(e,s){return Te.getInstance().get(e,s)}async setLocalData(e,s){await this.isLocalStrorageReady,e.set(this.localStorageData[s+"¤lang_"+Je.getLanguage()]?.data||e.get())}get(e,s){const r=s?.localStorageMode==="enabled",i=s?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const c=hn({});this.set(e,c)}const n=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(s?.expirationDelayMs&&(n._expiration_delay_=s.expirationDelayMs),n._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(n,e)),i&&(n._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==Te.saveId&&e%10!=0))try{if(!Te.changed||Te.saving)return;Te.saving=!0,Te.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const i of s){const n=this.publishers.get(i);if(!n?._is_savable_)continue;const o=n?.get();o&&(this.localStorageData[i+"¤lang_"+Je.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:n._expiration_delay_,data:o},r=!0)}if(r){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(un,i)}if(Te.saving=!1,Te.changed){Te.saveId++;const i=Te.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{Te.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),i=window,n=new i.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const c=await new Response(n.readable).arrayBuffer(),h=new Uint8Array(c);let b="";for(let k=0;k<h.length;k++)b+=String.fromCharCode(h[k]);return btoa(b)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,k=>k.charCodeAt(0)).buffer,o=window,c=new o.DecompressionStream(s),h=c.writable.getWriter();h.write(n),h.close();const b=await new Response(c.readable).arrayBuffer();return new TextDecoder().decode(b)}};Te.buildDate="Tue Sep 29 2026 17:50:53 GMT+0200 (Central European Summer Time)",Te.changed=!1,Te.saving=!1,Te.saveId=0,Te.instance=null,Te.instances=new Map,Te.pageShowHandlerInitialized=!1;let be=Te;if(typeof window<"u"){const t=window,e=cn+"PublisherManager",s=t[e]||be;if(t[e]||(t[e]=be),s!==be){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of r)Object.defineProperty(be,i,{configurable:!0,get(){return s[i]},set(n){s[i]=n}})}}const Sl=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 Al(t,e){return{get:function(s,r){if(typeof r=="string"&&Sl.has(r))return t[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!t._proxies_.has(r)){const i=t._value_[r],n=hn(As(i)?i:{__value:i},t,r);n._proxies_.set("_parent_",e()),t._proxies_.set(r,n)}return t._proxies_.get(r)},set:function(s,r,i){if(r=="_value_")return t._value_=i,!0;if(r=="_cachedGet_")return t._cachedGet_=i,!0;if(r=="_assignmentId_")return t._assignmentId_=i,!0;if(r=="_is_savable_")return t._is_savable_=i,!0;if(r=="_expiration_delay_")return t._expiration_delay_=i,!0;if(r=="_invalidate_on_page_show_")return t._invalidate_on_page_show_=i,!0;if(r=="_instanceCounter_")return t._instanceCounter_=i,!0;if(!t._proxies_.has(r)){const o=hn({},t,r);o._proxies_.set("_parent_",e()),t._proxies_.set(r,o)}return t._value_[r]!==i&&(t._value_[r]=i,t._publishDynamicFilling_(r,i),t._proxies_.get(r)?.set(As(i)?i:{__value:i})),!0},deleteProperty:function(s,r){return t._publishDynamicFilling_(r,null),t._proxies_.get(r)?.set(null),delete t._value_[r]},has:function(s,r){return r in t._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(s,r,i){return i&&"value"in i&&(t._value_[r]=i.value),!0},getOwnPropertyDescriptor:function(s,r){return{enumerable:!0,configurable:!0}},ownKeys:function(s){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}}}function hn(t,e=null,s){const r=new Lr(t,e,s);let i=null;const n=Al(r,()=>i);return i=new Proxy(r,n),i}class Cl extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Lr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(ur+"-publisher-proxy",Cl)}catch{}const gi=(t,e)=>{if(typeof t=="function"){const s=t;return $o(),s(),Do()}if(typeof t=="string"){const s=t.split("."),r=s.shift()||"";let i=be.get(r,e);i=at.traverse(i,s);const n=new Set;return n.add(i),n}return new Set([t])};function kl(t){const e=di(t);return gi(e).values().next().value?.get()}function bi(t,e,s){const r=di(t);return gi(r,s).values().next().value}function $l(t,e){return ko(e)?bi(t,void 0,e):bi(t)}function mi(t,e){return ko(e)?bi(t,void 0,e):bi(t)}function Dl(t,e){const s=di(t);gi(s).values().next().value?.set(e)}let vi=(Oe=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(Oe.observedElements.keys()).forEach(e=>Oe.unObserve(e)))}static observe(e){if(!e||!Oe.enabled||Oe.observedElements.has(e))return;const s=new MutationObserver(Oe.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(i=>Oe.addPublisherListeners(i)),Oe.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>Oe.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Oe.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Oe.addPublisherListeners(s)):e.childNodes.forEach(s=>Oe.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Oe.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Oe.removePublisherListeners(s)):e.childNodes.forEach(s=>Oe.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":Oe.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{Oe.onAdded(r)}),s.removedNodes.forEach(r=>{Oe.onRemoved(r)});break}}static removePublisherListeners(e){const s=Oe.publisherListeners.get(e);s&&(Oe.publisherListeners.delete(e),s.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(i=>i.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,i=>i.substring(1).toUpperCase()),bindedVariablesDescriptor:Oe.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){Oe.removePublisherListeners(e);const s=Je.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=be.getInstance().get(s),i=Oe.getDataBindItems(e),n=[];i.forEach(o=>{const c=o.bindedVariablesDescriptor,h=o.propertyToUpdate;for(const b of c.variables){const k=b;let g=r;g=Oe.getSubPublisher(r,k);const f=e,A={publisher:g,onAssign:()=>{const E=c.variables.map(U=>Oe.getSubPublisher(r,U)?.get());let O=c.expression,N=!1;if(E.length==1&&c.variables[0].join(".")==O.substring(1)){let U=E[0];U===null&&(U=""),f[h]=U;return}for(let U=0;U<E.length;U++){let P=E[U];const y=c.variables[U];P===null&&(N=!0,P=void 0),O=O.replace("$"+y.join("."),P)}if(O.indexOf("|")!=-1){const U=O.indexOf("|");if(U==0)O=Tr.js(O.substring(1));else{const P=O.substring(0,U),y=O.substring(U+1),I=Tr[P];O=N?"":I?I(y):O}}else O=N?"":O;f[h]=O}};g?.onAssign(A.onAssign),n.push(A)}}),Oe.publisherListeners.set(e,n)}},Oe.observedElements=new Map,Oe.enabled=!0,Oe.publisherListeners=new Map,Oe);vi.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=vi);/**
|
|
1
|
+
(function(an){typeof define=="function"&&define.amd?define(an):an()})((function(){"use strict";var Oe,et;function vl(t){const e=t.trim();if(!e)return!1;try{const s=new URL(e,"https://example.invalid/");return s.protocol==="http:"||s.protocol==="https:"||s.protocol==="blob:"}catch{return!1}}let Je=class Ct{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,s){let r=e;for(;r;){if(!s(r))return;r=r.parentNode||r.host}}static overflowMatches(e,s){return s.includes(e.overflowY)||s.includes(e.overflowX)}static findAncestorByOverflow(e,s){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const i=window.getComputedStyle(r);if(Ct.overflowMatches(i,s))return r}r=Ct.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ct.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const s=e.toLowerCase();return s===e?[e]:[e,s]}static readScopeAttributeOnElement(e,s){for(const r of Ct.scopeAttributeNames(s))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,s){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const n=Ct.readScopeAttributeOnElement(r,s);if(n!=null)return n}const i=r.parentNode||r.host;if(!i)break;r=i}return null}static getApiConfiguration(e){const s=Ct.getAncestorAttributeValue(e,"token"),r=Ct.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=Ct.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const c=Ct.getAncestorAttributeValue(e,"tokenProvider"),h=Ct.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ct.getAncestorAttributeValue(e,"userName"),o=Ct.getAncestorAttributeValue(e,"password"));const b=Ct.getAncestorAttributeValue(e,"credentials")||void 0,k=e.getAttribute("cache"),g=e.hasAttribute("blockUntilDone"),f=e.hasAttribute("keepAlive");return{serviceURL:i,token:s,userName:n,password:o,authToken:h,tokenProvider:c,addHTTPResponse:r,credentials:b,cache:k,blockUntilDone:g,keepAlive:f}}static getClosestElement(e,s){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===s);){const i=r.parentNode||r.host;if(!i){r=null;break}r=i}return r?.nodeName?r:null}static getClosestForm(e){return Ct.getClosestElement(e,"form")}static getAncestorsByTagNames(e,s){const r=new Set(s.map(o=>o.toLowerCase())),i=[];let n=e.parentNode||e.host;for(;n;)n instanceof Element&&r.has(n.tagName.toLowerCase())&&i.push(n),n=n.parentNode||n.host;return i}static getAncestorsBySelectors(e,s){const r=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const n of s)try{if(i.matches(n)){r.push(i);break}}catch{}i=i.parentNode||i.host}return r}static async loadJS(e){if(!vl(e))return!1;const s=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(n=>n.src===s);if(r)return r.dataset.concordeLoaded==="1"?!0:new Promise(n=>{let o=!1;const c=b=>{o||(o=!0,b&&(r.dataset.concordeLoaded="1"),n(b))};r.addEventListener("load",()=>c(!0),{once:!0}),r.addEventListener("error",()=>c(!1),{once:!0});const h=r.readyState;if(h==="complete"||h==="loaded"){c(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||c(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(n=>{const o=document.createElement("script");o.src=e,i&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded="1",n(!0)},o.onerror=()=>n(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(s=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>s(!0),r.onerror=()=>s(!0),document.head.appendChild(r)})}};const ln=t=>{const e=document.documentElement;new MutationObserver(r=>{for(const i of r)i.type==="attributes"&&i.attributeName==="lang"&&t()}).observe(e,{attributes:!0,attributeFilter:["lang"]})};let Tr=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=Je.getLanguage());const i=(b,k)=>[Math.floor(b/k),b%k];function n(b,k,g){return new Intl.NumberFormat(b,{style:"unit",unit:k,unitDisplay:g}).format}const[o,c]=i(e,60),h=[];return o&&h.push(n(s,"hour",r)(o)),c&&h.push(n(s,"minute",r)(c)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(h)}static js(e){try{return Function("return "+e)()}catch{return""}}};class xo{constructor(e){this.path=e}toString(){return this.path}}function So(t){return new Proxy(t,{get(e,s){if(s==="path")return e.path;if(s==="toString")return e.toString.bind(e);if(s===Symbol.toStringTag)return"DataProviderKey";if(typeof s=="symbol")return e[s];const r=e.path?`${e.path}.${String(s)}`:String(s);return So(new xo(r))}})}const yl=/\$\{|\{\$/;function wl(t){return yl.test(t)}function di(t){const e=typeof t=="string"?t:t.path;if(wl(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Ss=function(t){return this instanceof Ss?So(new xo(t)):new Ss(t)};let at=class xs{static shallowEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o];if(r?c!==h:c!=h)return!1}return!0}static deepEqual(e,s,r=!0){const i=Object.keys(e),n=Object.keys(s);if(i.length!==n.length&&r)return!1;for(const o of i){const c=e[o],h=s[o],b=xs.isObject(c)&&xs.isObject(h),k=r?c!==h:c!=h;if(b&&!xs.deepEqual(c,h)||!b&&k)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return xs.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const i of s){const n=e[i];if(n===void 0)return;r&&xs.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[i]}return e}static traverseDotNotation(e,s,r=!1){return xs.traverse(e,s.split("."),r)}static getURLSearchArray(e,s=""){let r=[];for(let i in e){const n=e[i];s&&(i=s+"["+i+"]"),xs.isObject(n)?r=[...r,...this.getURLSearchArray(n,i)]:r.push(`${i}=${n}`)}return r}static getURLSearchString(e){return xs.getURLSearchArray(e,"").join("&")}};const kt=at.traverseDotNotation;let _l=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(s=>{setTimeout(s,e)})}},Ao="sonic";typeof __SONIC_PREFIX__<"u"&&(Ao=__SONIC_PREFIX__);let Co=Ao.replace(/-([a-z])/g,t=>t[1].toUpperCase());const cn=Co.charAt(0).toUpperCase()+Co.slice(1),Pl=new Set(["localStorageMode","expirationDelayMs","invalidateOnPageShow"]);function ko(t){return t==null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).some(e=>Pl.has(e))}function pi(t){return Object.prototype.hasOwnProperty.call(t,"__value")}function As(t){return typeof t=="object"&&t!==null}let ur="sonic";typeof __SONIC_PREFIX__>"u"&&(ur="sonic");const un=ur=="sonic"?"publisher-proxies-data":ur+"-publisher-proxies-data",Us=class Us{constructor(e,s,r){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=1e3*60*60*12,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=s||null,this._parentKey_=r,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(),Us.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(s=>s()),this._is_savable_&&!be.changed){be.changed=!0,be.saveId++;const s=be.saveId;setTimeout(()=>be.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(i=>{i(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const i=Object.getOwnPropertyDescriptor(r,e);i&&!i.set&&!i.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&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 s in this._value_){let r=s;const i=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==i&&(e[r]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,s=!1){if(this._value_===e||As(this._value_)&&As(e)&&e&&pi(this._value_)&&pi(e)&&this._value_.__value===e.__value||!As(e)&&e===this._value_.__value)return!0;this._value_=As(e)?e:{__value:e},this._cachedGet_=void 0;const r=pi(this._value_);if(this._parentKey_&&this.parent){const i=pi(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 n=[];n[Number(this._parentKey_)]=i,this.parent.set(n)}else this.parent._value_[this._parentKey_]=i}if(r)return this._proxies_.forEach((i,n)=>{n!="_parent_"&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(s),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,n)=>{const o=this._value_[n];n!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(n))&&(i.set(null),this._publishDynamicFilling_(n,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),As(this._value_))for(const i in this._value_){const n=e[i],c=As(n)?n:{__value:n};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,n);continue}this._proxies_.get(i)?.set(c,!0),this._publishDynamicFilling_(i,n)}return!0}get(){if(xl(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_||(Us.instancesCounter++,this._instanceCounter_=Us.instancesCounter),Us.instances.set(this._instanceCounter_,this),"<"+ur+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+ur+"-publisher-proxy>"}};Us.instances=new Map,Us.instancesCounter=0;let Lr=Us;const fi=[];function xl(t){fi.length>0&&fi[0].add(t)}function $o(){fi.unshift(new Set)}function Do(){return fi.shift()}const Te=class Te{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],Te.instance!=null)throw"Singleton / use getInstance";Te.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),Te.initPageShowHandler()}static initPageShowHandler(){Te.pageShowHandlerInitialized||(Te.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&Te.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem(un),i=null;if(r&&(i=await this.decompress(r,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(un,r),this.localStorageData={};const n=1e3*60*60*12;for(const o in this.localStorageData){const c=this.localStorageData[o],h=new Date().getTime()-(c.expirationDelayMs||n);c.lastModifiationMS<h&&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 s=Te.instances.get(e);return s||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new Te)}return Te.instance==null?new Te:Te.instance}static get(e,s){return Te.getInstance().get(e,s)}async setLocalData(e,s){await this.isLocalStrorageReady,e.set(this.localStorageData[s+"¤lang_"+Je.getLanguage()]?.data||e.get())}get(e,s){const r=s?.localStorageMode==="enabled",i=s?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const c=hn({});this.set(e,c)}const n=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(s?.expirationDelayMs&&(n._expiration_delay_=s.expirationDelayMs),n._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(n,e)),i&&(n._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==Te.saveId&&e%10!=0))try{if(!Te.changed||Te.saving)return;Te.saving=!0,Te.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const i of s){const n=this.publishers.get(i);if(!n?._is_savable_)continue;const o=n?.get();o&&(this.localStorageData[i+"¤lang_"+Je.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:n._expiration_delay_,data:o},r=!0)}if(r){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(un,i)}if(Te.saving=!1,Te.changed){Te.saveId++;const i=Te.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{Te.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),i=window,n=new i.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const c=await new Response(n.readable).arrayBuffer(),h=new Uint8Array(c);let b="";for(let k=0;k<h.length;k++)b+=String.fromCharCode(h[k]);return btoa(b)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,k=>k.charCodeAt(0)).buffer,o=window,c=new o.DecompressionStream(s),h=c.writable.getWriter();h.write(n),h.close();const b=await new Response(c.readable).arrayBuffer();return new TextDecoder().decode(b)}};Te.buildDate="Tue Sep 29 2026 21:11:48 GMT+0200 (Central European Summer Time)",Te.changed=!1,Te.saving=!1,Te.saveId=0,Te.instance=null,Te.instances=new Map,Te.pageShowHandlerInitialized=!1;let be=Te;if(typeof window<"u"){const t=window,e=cn+"PublisherManager",s=t[e]||be;if(t[e]||(t[e]=be),s!==be){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of r)Object.defineProperty(be,i,{configurable:!0,get(){return s[i]},set(n){s[i]=n}})}}const Sl=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 Al(t,e){return{get:function(s,r){if(typeof r=="string"&&Sl.has(r))return t[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!t._proxies_.has(r)){const i=t._value_[r],n=hn(As(i)?i:{__value:i},t,r);n._proxies_.set("_parent_",e()),t._proxies_.set(r,n)}return t._proxies_.get(r)},set:function(s,r,i){if(r=="_value_")return t._value_=i,!0;if(r=="_cachedGet_")return t._cachedGet_=i,!0;if(r=="_assignmentId_")return t._assignmentId_=i,!0;if(r=="_is_savable_")return t._is_savable_=i,!0;if(r=="_expiration_delay_")return t._expiration_delay_=i,!0;if(r=="_invalidate_on_page_show_")return t._invalidate_on_page_show_=i,!0;if(r=="_instanceCounter_")return t._instanceCounter_=i,!0;if(!t._proxies_.has(r)){const o=hn({},t,r);o._proxies_.set("_parent_",e()),t._proxies_.set(r,o)}return t._value_[r]!==i&&(t._value_[r]=i,t._publishDynamicFilling_(r,i),t._proxies_.get(r)?.set(As(i)?i:{__value:i})),!0},deleteProperty:function(s,r){return t._publishDynamicFilling_(r,null),t._proxies_.get(r)?.set(null),delete t._value_[r]},has:function(s,r){return r in t._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(s,r,i){return i&&"value"in i&&(t._value_[r]=i.value),!0},getOwnPropertyDescriptor:function(s,r){return{enumerable:!0,configurable:!0}},ownKeys:function(s){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}}}function hn(t,e=null,s){const r=new Lr(t,e,s);let i=null;const n=Al(r,()=>i);return i=new Proxy(r,n),i}class Cl extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=Lr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(ur+"-publisher-proxy",Cl)}catch{}const gi=(t,e)=>{if(typeof t=="function"){const s=t;return $o(),s(),Do()}if(typeof t=="string"){const s=t.split("."),r=s.shift()||"";let i=be.get(r,e);i=at.traverse(i,s);const n=new Set;return n.add(i),n}return new Set([t])};function kl(t){const e=di(t);return gi(e).values().next().value?.get()}function bi(t,e,s){const r=di(t);return gi(r,s).values().next().value}function $l(t,e){return ko(e)?bi(t,void 0,e):bi(t)}function mi(t,e){return ko(e)?bi(t,void 0,e):bi(t)}function Dl(t,e){const s=di(t);gi(s).values().next().value?.set(e)}let vi=(Oe=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(Oe.observedElements.keys()).forEach(e=>Oe.unObserve(e)))}static observe(e){if(!e||!Oe.enabled||Oe.observedElements.has(e))return;const s=new MutationObserver(Oe.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(i=>Oe.addPublisherListeners(i)),Oe.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>Oe.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Oe.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Oe.addPublisherListeners(s)):e.childNodes.forEach(s=>Oe.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&Oe.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>Oe.removePublisherListeners(s)):e.childNodes.forEach(s=>Oe.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":Oe.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{Oe.onAdded(r)}),s.removedNodes.forEach(r=>{Oe.onRemoved(r)});break}}static removePublisherListeners(e){const s=Oe.publisherListeners.get(e);s&&(Oe.publisherListeners.delete(e),s.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(i=>i.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,i=>i.substring(1).toUpperCase()),bindedVariablesDescriptor:Oe.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){Oe.removePublisherListeners(e);const s=Je.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=be.getInstance().get(s),i=Oe.getDataBindItems(e),n=[];i.forEach(o=>{const c=o.bindedVariablesDescriptor,h=o.propertyToUpdate;for(const b of c.variables){const k=b;let g=r;g=Oe.getSubPublisher(r,k);const f=e,A={publisher:g,onAssign:()=>{const E=c.variables.map(U=>Oe.getSubPublisher(r,U)?.get());let O=c.expression,N=!1;if(E.length==1&&c.variables[0].join(".")==O.substring(1)){let U=E[0];U===null&&(U=""),f[h]=U;return}for(let U=0;U<E.length;U++){let P=E[U];const y=c.variables[U];P===null&&(N=!0,P=void 0),O=O.replace("$"+y.join("."),P)}if(O.indexOf("|")!=-1){const U=O.indexOf("|");if(U==0)O=Tr.js(O.substring(1));else{const P=O.substring(0,U),y=O.substring(U+1),I=Tr[P];O=N?"":I?I(y):O}}else O=N?"":O;f[h]=O}};g?.onAssign(A.onAssign),n.push(A)}}),Oe.publisherListeners.set(e,n)}},Oe.observedElements=new Map,Oe.enabled=!0,Oe.publisherListeners=new Map,Oe);vi.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=vi);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
package/concorde-core.es.js
CHANGED
|
@@ -792,7 +792,7 @@ const Le = class Le {
|
|
|
792
792
|
return new TextDecoder().decode(b);
|
|
793
793
|
}
|
|
794
794
|
};
|
|
795
|
-
Le.buildDate = "Tue Sep 29 2026
|
|
795
|
+
Le.buildDate = "Tue Sep 29 2026 21:11:48 GMT+0200 (Central European Summer Time)", Le.changed = !1, Le.saving = !1, Le.saveId = 0, Le.instance = null, Le.instances = /* @__PURE__ */ new Map(), Le.pageShowHandlerInitialized = !1;
|
|
796
796
|
let ve = Le;
|
|
797
797
|
if (typeof window < "u") {
|
|
798
798
|
const t = window, e = vn + "PublisherManager", s = t[e] || ve;
|
|
@@ -24,7 +24,7 @@ var ConcordeHF=(function(xe){"use strict";/**
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
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="Tue Sep 29 2026 17:50:59 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(`
|
|
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="Tue Sep 29 2026 21:11:55 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
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=!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
29
|
:host {
|
|
30
30
|
display: contents;
|
|
@@ -1291,7 +1291,7 @@ const m = class m {
|
|
|
1291
1291
|
return new TextDecoder().decode(f);
|
|
1292
1292
|
}
|
|
1293
1293
|
};
|
|
1294
|
-
m.buildDate = "Tue Sep 29 2026
|
|
1294
|
+
m.buildDate = "Tue Sep 29 2026 21:11: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
1295
|
let F = m;
|
|
1296
1296
|
if (typeof window < "u") {
|
|
1297
1297
|
const n = window, e = Os + "PublisherManager", t = n[e] || F;
|