@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
|
@@ -2,36 +2,36 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var de,
|
|
5
|
+
*/var de,De;const Xt=globalThis,pr=Xt.ShadowRoot&&(Xt.ShadyCSS===void 0||Xt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,mr=Symbol(),jr=new WeakMap;let Br=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==mr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(pr&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=jr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&jr.set(t,e))}return e}toString(){return this.cssText}};const Un=n=>new Br(typeof n=="string"?n:n+"",void 0,mr),On=(n,...e)=>{const t=n.length===1?n[0]:e.reduce(((r,s,u)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[u+1]),n[0]);return new Br(t,n,mr)},Fn=(n,e)=>{if(pr)n.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const r=document.createElement("style"),s=Xt.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=t.cssText,n.appendChild(r)}},qr=pr?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return Un(t)})(n):n;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is
|
|
9
|
+
*/const{is:$n,defineProperty:Nn,getOwnPropertyDescriptor:In,getOwnPropertyNames:jn,getOwnPropertySymbols:Bn,getPrototypeOf:qn}=Object,Yt=globalThis,Hr=Yt.trustedTypes,Hn=Hr?Hr.emptyScript:"",zn=Yt.reactiveElementPolyfillSupport,Lt=(n,e)=>n,Jt={toAttribute(n,e){switch(e){case Boolean:n=n?Hn:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},gr=(n,e)=>!$n(n,e),zr={attribute:!0,type:String,converter:Jt,reflect:!1,useDefault:!1,hasChanged:gr};Symbol.metadata??=Symbol("metadata"),Yt.litPropertyMetadata??=new WeakMap;let _t=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=zr){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(e,r,t);s!==void 0&&Nn(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){const{get:s,set:u}=In(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:s,set(a){const d=s?.call(this);u?.call(this,a),this.requestUpdate(e,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??zr}static _$Ei(){if(this.hasOwnProperty(Lt("elementProperties")))return;const e=qn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Lt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Lt("properties"))){const t=this.properties,r=[...jn(t),...Bn(t)];for(const s of r)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,s]of t)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const s=this._$Eu(t,r);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const s of r)t.unshift(qr(s))}else e!==void 0&&t.push(qr(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Fn(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(s!==void 0&&r.reflect===!0){const u=(r.converter?.toAttribute!==void 0?r.converter:Jt).toAttribute(t,r.type);this._$Em=e,u==null?this.removeAttribute(s):this.setAttribute(s,u),this._$Em=null}}_$AK(e,t){const r=this.constructor,s=r._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const u=r.getPropertyOptions(s),a=typeof u.converter=="function"?{fromAttribute:u.converter}:u.converter?.fromAttribute!==void 0?u.converter:Jt;this._$Em=s;const d=a.fromAttribute(t,u.type);this[s]=d??this._$Ej?.get(s)??d,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const s=this.constructor,u=this[e];if(r??=s.getPropertyOptions(e),!((r.hasChanged??gr)(u,t)||r.useDefault&&r.reflect&&u===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:u},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),u!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[s,u]of this._$Ep)this[s]=u;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[s,u]of r){const{wrapped:a}=u,d=this[s];a!==!0||this._$AL.has(s)||d===void 0||this.C(s,void 0,u,d)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((r=>r.hostUpdate?.())),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Lt("elementProperties")]=new Map,_t[Lt("finalized")]=new Map,zn?.({ReactiveElement:_t}),(Yt.reactiveElementVersions??=[]).push("2.1.1");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const vr=globalThis,Kt=vr.trustedTypes,Gr=Kt?Kt.createPolicy("lit-html",{createHTML:n=>n}):void 0,Vr="$lit$",lt=`lit$${Math.random().toFixed(9).slice(2)}$`,Wr="?"+lt,Gn=`<${Wr}>`,gt=document,Mt=()=>gt.createComment(""),Ut=n=>n===null||typeof n!="object"&&typeof n!="function",br=Array.isArray,Vn=n=>br(n)||typeof n?.[Symbol.iterator]=="function",yr=`[
|
|
14
|
+
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xr=/-->/g,Yr=/>/g,vt=RegExp(`>|${yr}(?:([^\\s"'>=/]+)(${yr}*=${yr}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jr=/'/g,Kr=/"/g,Zr=/^(?:script|style|textarea|title)$/i,Wn=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),Qr=Wn(1),At=Symbol.for("lit-noChange"),Fe=Symbol.for("lit-nothing"),en=new WeakMap,bt=gt.createTreeWalker(gt,129);function tn(n,e){if(!br(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gr!==void 0?Gr.createHTML(e):e}const Xn=(n,e)=>{const t=n.length-1,r=[];let s,u=e===2?"<svg>":e===3?"<math>":"",a=Ot;for(let d=0;d<t;d++){const y=n[d];let T,M,S=-1,w=0;for(;w<y.length&&(a.lastIndex=w,M=a.exec(y),M!==null);)w=a.lastIndex,a===Ot?M[1]==="!--"?a=Xr:M[1]!==void 0?a=Yr:M[2]!==void 0?(Zr.test(M[2])&&(s=RegExp("</"+M[2],"g")),a=vt):M[3]!==void 0&&(a=vt):a===vt?M[0]===">"?(a=s??Ot,S=-1):M[1]===void 0?S=-2:(S=a.lastIndex-M[2].length,T=M[1],a=M[3]===void 0?vt:M[3]==='"'?Kr:Jr):a===Kr||a===Jr?a=vt:a===Xr||a===Yr?a=Ot:(a=vt,s=void 0);const C=a===vt&&n[d+1].startsWith("/>")?" ":"";u+=a===Ot?y+Gn:S>=0?(r.push(T),y.slice(0,S)+Vr+y.slice(S)+lt+C):y+lt+(S===-2?d:C)}return[tn(n,u+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class Ft{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let u=0,a=0;const d=e.length-1,y=this.parts,[T,M]=Xn(e,t);if(this.el=Ft.createElement(T,r),bt.currentNode=this.el.content,t===2||t===3){const S=this.el.content.firstChild;S.replaceWith(...S.childNodes)}for(;(s=bt.nextNode())!==null&&y.length<d;){if(s.nodeType===1){if(s.hasAttributes())for(const S of s.getAttributeNames())if(S.endsWith(Vr)){const w=M[a++],C=s.getAttribute(S).split(lt),D=/([.?@])?(.*)/.exec(w);y.push({type:1,index:u,name:D[2],strings:C,ctor:D[1]==="."?Jn:D[1]==="?"?Kn:D[1]==="@"?Zn:Zt}),s.removeAttribute(S)}else S.startsWith(lt)&&(y.push({type:6,index:u}),s.removeAttribute(S));if(Zr.test(s.tagName)){const S=s.textContent.split(lt),w=S.length-1;if(w>0){s.textContent=Kt?Kt.emptyScript:"";for(let C=0;C<w;C++)s.append(S[C],Mt()),bt.nextNode(),y.push({type:2,index:++u});s.append(S[w],Mt())}}}else if(s.nodeType===8)if(s.data===Wr)y.push({type:2,index:u});else{let S=-1;for(;(S=s.data.indexOf(lt,S+1))!==-1;)y.push({type:7,index:u}),S+=lt.length-1}u++}}static createElement(e,t){const r=gt.createElement("template");return r.innerHTML=e,r}}function xt(n,e,t=n,r){if(e===At)return e;let s=r!==void 0?t._$Co?.[r]:t._$Cl;const u=Ut(e)?void 0:e._$litDirective$;return s?.constructor!==u&&(s?._$AO?.(!1),u===void 0?s=void 0:(s=new u(n),s._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=s:t._$Cl=s),s!==void 0&&(e=xt(n,s._$AS(n,e.values),s,r)),e}class Yn{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,s=(e?.creationScope??gt).importNode(t,!0);bt.currentNode=s;let u=bt.nextNode(),a=0,d=0,y=r[0];for(;y!==void 0;){if(a===y.index){let T;y.type===2?T=new $t(u,u.nextSibling,this,e):y.type===1?T=new y.ctor(u,y.name,y.strings,this,e):y.type===6&&(T=new Qn(u,this,e)),this._$AV.push(T),y=r[++d]}a!==y?.index&&(u=bt.nextNode(),a++)}return bt.currentNode=gt,s}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class $t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,s){this.type=2,this._$AH=Fe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=xt(this,e,t),Ut(e)?e===Fe||e==null||e===""?(this._$AH!==Fe&&this._$AR(),this._$AH=Fe):e!==this._$AH&&e!==At&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Vn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Fe&&Ut(this._$AH)?this._$AA.nextSibling.data=e:this.T(gt.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Ft.createElement(tn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{const u=new Yn(s,this),a=u.u(this.options);u.p(t),this.T(a),this._$AH=u}}_$AC(e){let t=en.get(e.strings);return t===void 0&&en.set(e.strings,t=new Ft(e)),t}k(e){br(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const u of e)s===t.length?t.push(r=new $t(this.O(Mt()),this.O(Mt()),this,this.options)):r=t[s],r._$AI(u),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Zt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,s,u){this.type=1,this._$AH=Fe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=u,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Fe}_$AI(e,t=this,r,s){const u=this.strings;let a=!1;if(u===void 0)e=xt(this,e,t,0),a=!Ut(e)||e!==this._$AH&&e!==At,a&&(this._$AH=e);else{const d=e;let y,T;for(e=u[0],y=0;y<u.length-1;y++)T=xt(this,d[r+y],t,y),T===At&&(T=this._$AH[y]),a||=!Ut(T)||T!==this._$AH[y],T===Fe?e=Fe:e!==Fe&&(e+=(T??"")+u[y+1]),this._$AH[y]=T}a&&!s&&this.j(e)}j(e){e===Fe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Jn extends Zt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Fe?void 0:e}}class Kn extends Zt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Fe)}}class Zn extends Zt{constructor(e,t,r,s,u){super(e,t,r,s,u),this.type=5}_$AI(e,t=this){if((e=xt(this,e,t,0)??Fe)===At)return;const r=this._$AH,s=e===Fe&&r!==Fe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,u=e!==Fe&&(r===Fe||s);s&&this.element.removeEventListener(this.name,this,r),u&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Qn{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){xt(this,e)}}const ei=vr.litHtmlPolyfillSupport;ei?.(Ft,$t),(vr.litHtmlVersions??=[]).push("3.3.1");const ti=(n,e,t)=>{const r=t?.renderBefore??e;let s=r._$litPart$;if(s===void 0){const u=t?.renderBefore??null;r._$litPart$=s=new $t(e.insertBefore(Mt(),u),u,void 0,t??{})}return s._$AI(n),s};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const wr=globalThis;class Nt extends
|
|
19
|
+
*/const wr=globalThis;class Nt extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ti(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return At}}Nt._$litElement$=!0,Nt.finalized=!0,wr.litElementHydrateSupport?.({LitElement:Nt});const ri=wr.litElementPolyfillSupport;ri?.({LitElement:Nt}),(wr.litElementVersions??=[]).push("4.2.1");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const ni=n=>(e,t)=>{t!==void 0?t.addInitializer((()=>{customElements.define(n,e)})):customElements.define(n,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const ii={attribute:!0,type:String,converter:Jt,reflect:!1,hasChanged:gr},si=(n=ii,e,t)=>{const{kind:r,metadata:s}=t;let u=globalThis.litPropertyMetadata.get(s);if(u===void 0&&globalThis.litPropertyMetadata.set(s,u=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),u.set(t.name,n),r==="accessor"){const{name:a}=t;return{set(d){const y=e.get.call(this);e.set.call(this,d),this.requestUpdate(a,y,n)},init(d){return d!==void 0&&this.C(a,void 0,n,d),d}}}if(r==="setter"){const{name:a}=t;return function(d){const y=this[a];e.call(this,d),this.requestUpdate(a,y,n)}}throw Error("Unsupported decorator location: "+r)};function Y(n){return(e,t)=>typeof t=="object"?si(n,e,t):((r,s,u)=>{const a=s.hasOwnProperty(u);return s.constructor.createProperty(u,r),a?Object.getOwnPropertyDescriptor(s,u):void 0})(n,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function ri(n){return X({...n,state:!0,attribute:!1})}const Ar="1";function ni(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}}let at=class Ge{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const r=t.indexOf("=");return e[t.substring(0,r).trim()]=t.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let r=e;for(;r;){if(!t(r))return;r=r.parentNode||r.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const s=window.getComputedStyle(r);if(Ge.overflowMatches(s,t))return r}r=Ge.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ge.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ge.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const r of Ge.scopeAttributeNames(t))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const u=Ge.readScopeAttributeOnElement(r,t);if(u!=null)return u}const s=r.parentNode||r.host;if(!s)break;r=s}return null}static getApiConfiguration(e){const t=Ge.getAncestorAttributeValue(e,"token"),r=Ge.getAncestorAttributeValue(e,"addHTTPResponse")!=null,s=Ge.getAncestorAttributeValue(e,"serviceURL");let u=null,o=null;const p=Ge.getAncestorAttributeValue(e,"tokenProvider"),y=Ge.getAncestorAttributeValue(e,"eventsApiToken");t||(u=Ge.getAncestorAttributeValue(e,"userName"),o=Ge.getAncestorAttributeValue(e,"password"));const P=Ge.getAncestorAttributeValue(e,"credentials")||void 0,M=e.getAttribute("cache"),k=e.hasAttribute("blockUntilDone"),w=e.hasAttribute("keepAlive");return{serviceURL:s,token:t,userName:u,password:o,authToken:y,tokenProvider:p,addHTTPResponse:r,credentials:P,cache:M,blockUntilDone:k,keepAlive:w}}static getClosestElement(e,t){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===t);){const s=r.parentNode||r.host;if(!s){r=null;break}r=s}return r?.nodeName?r:null}static getClosestForm(e){return Ge.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const r=new Set(t.map(o=>o.toLowerCase())),s=[];let u=e.parentNode||e.host;for(;u;)u instanceof Element&&r.has(u.tagName.toLowerCase())&&s.push(u),u=u.parentNode||u.host;return s}static getAncestorsBySelectors(e,t){const r=[];let s=e.parentNode||e.host;for(;s;){if(s instanceof Element)for(const u of t)try{if(s.matches(u)){r.push(s);break}}catch{}s=s.parentNode||s.host}return r}static async loadJS(e){if(!ni(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(u=>u.src===t);if(r)return r.dataset.concordeLoaded===Ar?!0:new Promise(u=>{let o=!1;const p=P=>{o||(o=!0,P&&(r.dataset.concordeLoaded=Ar),u(P))};r.addEventListener("load",()=>p(!0),{once:!0}),r.addEventListener("error",()=>p(!1),{once:!0});const y=r.readyState;if(y==="complete"||y==="loaded"){p(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{o||p(!0)})})});const s=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(u=>{const o=document.createElement("script");o.src=e,s&&(o.type="module"),o.onload=()=>{o.dataset.concordeLoaded=Ar,u(!0)},o.onerror=()=>u(!1),document.head.appendChild(o)})}static async loadCSS(e){return new Promise(t=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>t(!0),r.onerror=()=>t(!0),document.head.appendChild(r)})}};function Er(n){return typeof n!="string"?null:n.trim()||null}function ii(n){if(n==null||n==="")return null;if(typeof n=="string")return Er(n);if(typeof n!="object")return null;const e=n;return Er(e.url)??Er(e.blobUrl)}function It(n){for(const e of n)try{URL.revokeObjectURL(e)}catch{}}let si=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(t=>{setTimeout(t,e)})}},tn="sonic";typeof __SONIC_PREFIX__<"u"&&(tn=__SONIC_PREFIX__);let rn=tn.replace(/-([a-z])/g,n=>n[1].toUpperCase());const ai=rn.charAt(0).toUpperCase()+rn.slice(1);let oi=class At{static areEqual(e,t){return e.length===t.length?e.every((r,s)=>r===t[s]):!1}static from2d(e){return{to1D:()=>{let t=[];return e.forEach(r=>t=t.concat(r)),this.from(t)}}}static from(e){return{get:()=>e||[],everyItem:()=>({has:()=>({same:()=>({value:()=>({forKey:t=>{if(e.length<1)return!0;const r=(e[0]||{})[t];return e.every(s=>(s||{})[t]==r)}})})}),value:()=>({forKey:t=>At.from(e.map(r=>r[t]))}),copy:()=>({fromKey:t=>({toKey:r=>{e.forEach(s=>{s[r]=Array.isArray(s[t])?[...s[t]]:typeof s[t]=="object"&&s[t]!=null?{...s[t]}:s[t]})}})})}),map:t=>At.from(e.map(t)),filter:t=>At.from(e.filter(t)),find:t=>e.find(t),some:t=>e.some(t),every:t=>e.every(t),group:()=>({byKey:t=>{const r=[],s=new Map;for(const u of e){const o=u[t];if(!s.has(o)){const p=r.length;s.set(o,p);const y={items:[]};y[t]=o,r.push(y)}r[s.get(o)].items.push(u)}return At.from(r)}}),without:()=>({duplicates:()=>({forKey:t=>{const r=[...new Set(e.map(s=>s[t]))];return At.from(r.map(s=>e.find(u=>u[t]==s)))}}),itemsIn:t=>({havingSameValue:()=>({forKey:r=>{const s=(u,o)=>p=>u[o]!=p[o];return At.from(e.filter(u=>t.every(s(u,r))))}})})})}}},_r=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,t="",r="long"){t||(t=at.getLanguage());const s=(P,M)=>[Math.floor(P/M),P%M];function u(P,M,k){return new Intl.NumberFormat(P,{style:"unit",unit:M,unitDisplay:k}).format}const[o,p]=s(e,60),y=[];return o&&y.push(u(t,"hour",r)(o)),p&&y.push(u(t,"minute",r)(p)),new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(y)}static js(e){try{return Function("return "+e)()}catch{return""}}};class nn{constructor(e){this.path=e}toString(){return this.path}}function sn(n){return new Proxy(n,{get(e,t){if(t==="path")return e.path;if(t==="toString")return e.toString.bind(e);if(t===Symbol.toStringTag)return"DataProviderKey";if(typeof t=="symbol")return e[t];const r=e.path?`${e.path}.${String(t)}`:String(t);return sn(new nn(r))}})}const ui=/\$\{|\{\$/;function ci(n){return ui.test(n)}function li(n){const e=n;if(ci(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Qt=function(n){return this instanceof Qt?sn(new nn(n)):new Qt(n)};let er=class ct{static shallowEqual(e,t,r=!0){const s=Object.keys(e),u=Object.keys(t);if(s.length!==u.length&&r)return!1;for(const o of s){const p=e[o],y=t[o];if(r?p!==y:p!=y)return!1}return!0}static deepEqual(e,t,r=!0){const s=Object.keys(e),u=Object.keys(t);if(s.length!==u.length&&r)return!1;for(const o of s){const p=e[o],y=t[o],P=ct.isObject(p)&&ct.isObject(y),M=r?p!==y:p!=y;if(P&&!ct.deepEqual(p,y)||!P&&M)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ct.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,r=!1){for(const s of t){const u=e[s];if(u===void 0)return;r&&ct.isObject(u)?e=Object.assign(Array.isArray(u)?[]:{},e,u):e=e[s]}return e}static traverseDotNotation(e,t,r=!1){return ct.traverse(e,t.split("."),r)}static getURLSearchArray(e,t=""){let r=[];for(let s in e){const u=e[s];t&&(s=t+"["+s+"]"),ct.isObject(u)?r=[...r,...this.getURLSearchArray(u,s)]:r.push(`${s}=${u}`)}return r}static getURLSearchString(e){return ct.getURLSearchArray(e,"").join("&")}};er.traverseDotNotation;function fi(n){return!1}function tr(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function ft(n){return typeof n=="object"&&n!==null}let kt="sonic";typeof __SONIC_PREFIX__>"u"&&(kt="sonic");const xr=kt=="sonic"?"publisher-proxies-data":kt+"-publisher-proxies-data",dt=class dt{constructor(e,t,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=t||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(),dt.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_&&!$e.changed){$e.changed=!0,$e.saveId++;const t=$e.saveId;setTimeout(()=>$e.getInstance().saveToLocalStorage(t),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(s=>{s(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(r=>{r[e]!==t&&(r[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(r=>{const s=Object.getOwnPropertyDescriptor(r,e);s&&!s.set&&!s.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==t&&(r[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 r=t;const s=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(r=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==s&&(e[r]=s)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const r=this._value_[t];e[t]!==r&&(e[t]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||ft(this._value_)&&ft(e)&&e&&tr(this._value_)&&tr(e)&&this._value_.__value===e.__value||!ft(e)&&e===this._value_.__value)return!0;this._value_=ft(e)?e:{__value:e},this._cachedGet_=void 0;const r=tr(this._value_);if(this._parentKey_&&this.parent){const s=tr(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_]:s});else{const u=[];u[Number(this._parentKey_)]=s,this.parent.set(u)}else this.parent._value_[this._parentKey_]=s}if(r)return this._proxies_.forEach((s,u)=>{u!="_parent_"&&(s.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const s in this._value_)this._value_[s]===void 0&&delete this._value_[s];if(this._proxies_.forEach((s,u)=>{const o=this._value_[u];u!="_parent_"&&o===void 0&&o!==null&&isNaN(Number(u))&&(s.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),ft(this._value_))for(const s in this._value_){const u=e[s],p=ft(u)?u:{__value:u};if(!this._proxies_.has(s)){this._publishDynamicFilling_(s,u);continue}this._proxies_.get(s)?.set(p,!0),this._publishDynamicFilling_(s,u)}return!0}get(){if(hi(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_||(dt.instancesCounter++,this._instanceCounter_=dt.instancesCounter),dt.instances.set(this._instanceCounter_,this),"<"+kt+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+kt+"-publisher-proxy>"}};dt.instances=new Map,dt.instancesCounter=0;let rr=dt;const an=[];function hi(n){an.length>0&&an[0].add(n)}const ge=class ge{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],ge.instance!=null)throw"Singleton / use getInstance";ge.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),ge.initPageShowHandler()}static initPageShowHandler(){ge.pageShowHandlerInitialized||(ge.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&ge.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(xr),s=null;if(r&&(s=await this.decompress(r,"gzip")),s)try{this.localStorageData=JSON.parse(s)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(xr,r),this.localStorageData={};const u=1e3*60*60*12;for(const o in this.localStorageData){const p=this.localStorageData[o],y=new Date().getTime()-(p.expirationDelayMs||u);p.lastModifiationMS<y&&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=ge.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new ge)}return ge.instance==null?new ge:ge.instance}static get(e,t){return ge.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+at.getLanguage()]?.data||e.get())}get(e,t){const r=t?.localStorageMode==="enabled",s=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const p=kr({});this.set(e,p)}const u=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(u._expiration_delay_=t.expirationDelayMs),u._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(u,e)),s&&(u._invalidate_on_page_show_=s),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!==ge.saveId&&e%10!=0))try{if(!ge.changed||ge.saving)return;ge.saving=!0,ge.changed=!1;const t=Array.from(this.publishers.keys());let r=!1;for(const s of t){const u=this.publishers.get(s);if(!u?._is_savable_)continue;const o=u?.get();o&&(this.localStorageData[s+"¤lang_"+at.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:u._expiration_delay_,data:o},r=!0)}if(r){const s=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(xr,s)}if(ge.saving=!1,ge.changed){ge.saveId++;const s=ge.saveId;setTimeout(()=>this.saveToLocalStorage(s),1e3)}}catch{ge.saving=!1}}async compress(e,t){const r=new TextEncoder().encode(e),s=window,u=new s.CompressionStream(t),o=u.writable.getWriter();o.write(r),o.close();const p=await new Response(u.readable).arrayBuffer(),y=new Uint8Array(p);let P="";for(let M=0;M<y.length;M++)P+=String.fromCharCode(y[M]);return btoa(P)}async decompress(e,t){const r=atob(e),u=Uint8Array.from(r,M=>M.charCodeAt(0)).buffer,o=window,p=new o.DecompressionStream(t),y=p.writable.getWriter();y.write(u),y.close();const P=await new Response(p.readable).arrayBuffer();return new TextDecoder().decode(P)}};ge.buildDate="Tue Sep 29 2026 17:50:57 GMT+0200 (Central European Summer Time)",ge.changed=!1,ge.saving=!1,ge.saveId=0,ge.instance=null,ge.instances=new Map,ge.pageShowHandlerInitialized=!1;let $e=ge;if(typeof window<"u"){const n=window,e=ai+"PublisherManager",t=n[e]||$e;if(n[e]||(n[e]=$e),t!==$e){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const s of r)Object.defineProperty($e,s,{configurable:!0,get(){return t[s]},set(u){t[s]=u}})}}const di=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 pi(n,e){return{get:function(t,r){if(typeof r=="string"&&di.has(r))return n[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(r)){const s=n._value_[r],u=kr(ft(s)?s:{__value:s},n,r);u._proxies_.set("_parent_",e()),n._proxies_.set(r,u)}return n._proxies_.get(r)},set:function(t,r,s){if(r=="_value_")return n._value_=s,!0;if(r=="_cachedGet_")return n._cachedGet_=s,!0;if(r=="_assignmentId_")return n._assignmentId_=s,!0;if(r=="_is_savable_")return n._is_savable_=s,!0;if(r=="_expiration_delay_")return n._expiration_delay_=s,!0;if(r=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=s,!0;if(r=="_instanceCounter_")return n._instanceCounter_=s,!0;if(!n._proxies_.has(r)){const o=kr({},n,r);o._proxies_.set("_parent_",e()),n._proxies_.set(r,o)}return n._value_[r]!==s&&(n._value_[r]=s,n._publishDynamicFilling_(r,s),n._proxies_.get(r)?.set(ft(s)?s:{__value:s})),!0},deleteProperty:function(t,r){return n._publishDynamicFilling_(r,null),n._proxies_.get(r)?.set(null),delete n._value_[r]},has:function(t,r){return r in n._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(t,r,s){return s&&"value"in s&&(n._value_[r]=s.value),!0},getOwnPropertyDescriptor:function(t,r){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function kr(n,e=null,t){const r=new rr(n,e,t);let s=null;const u=pi(r,()=>s);return s=new Proxy(r,u),s}class mi extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=rr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(kt+"-publisher-proxy",mi)}catch{}const vi=(n,e)=>{{const t=n.split("."),r=t.shift()||"";let s=$e.get(r,e);s=er.traverse(s,t);const u=new Set;return u.add(s),u}};function on(n,e,t){const r=li(n);return vi(r,t).values().next().value}function gi(n,e){return fi()?on(n,void 0,e):on(n)}let Sr=(de=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(de.observedElements.keys()).forEach(e=>de.unObserve(e)))}static observe(e){if(!e||!de.enabled||de.observedElements.has(e))return;const t=new MutationObserver(de.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],t.observe(e,r),e.querySelectorAll("[data-bind]").forEach(s=>de.addPublisherListeners(s)),de.observedElements.set(e,t)}static unObserve(e){if(!e)return;const t=this.observedElements.get(e);t&&(t.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>de.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&de.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>de.addPublisherListeners(t)):e.childNodes.forEach(t=>de.onAdded(t))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&de.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>de.removePublisherListeners(t)):e.childNodes.forEach(t=>de.onRemoved(t))}static onMutation(e){for(const t of e)switch(t.type){case"attributes":de.addPublisherListeners(t.target);break;case"childList":t.addedNodes.forEach(r=>{de.onAdded(r)}),t.removedNodes.forEach(r=>{de.onRemoved(r)});break}}static removePublisherListeners(e){const t=de.publisherListeners.get(e);t&&(de.publisherListeners.delete(e),t.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let t=e.match(/(\$(?:\w+\\?\.?)+)/g);return t?t=t.map(r=>r.replace("$","")):t=[e],t=t.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:t.map(r=>r.split(/\b\.\b/).map(s=>s.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(t=>t.name.indexOf("::")==0).map(t=>({propertyToUpdate:t.name.substring(2).replace(/-((html)|\w)/g,s=>s.substring(1).toUpperCase()),bindedVariablesDescriptor:de.getVariablesDescriptor(t.value)})):[]}static getSubPublisher(e,t){if(!t)return e;for(const r of t)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){de.removePublisherListeners(e);const t=at.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!t)return;const r=$e.getInstance().get(t),s=de.getDataBindItems(e),u=[];s.forEach(o=>{const p=o.bindedVariablesDescriptor,y=o.propertyToUpdate;for(const P of p.variables){const M=P;let k=r;k=de.getSubPublisher(r,M);const w=e,C={publisher:k,onAssign:()=>{const R=p.variables.map(J=>de.getSubPublisher(r,J)?.get());let N=p.expression,ee=!1;if(R.length==1&&p.variables[0].join(".")==N.substring(1)){let J=R[0];J===null&&(J=""),w[y]=J;return}for(let J=0;J<R.length;J++){let E=R[J];const v=p.variables[J];E===null&&(ee=!0,E=void 0),N=N.replace("$"+v.join("."),E)}if(N.indexOf("|")!=-1){const J=N.indexOf("|");if(J==0)N=_r.js(N.substring(1));else{const E=N.substring(0,J),v=N.substring(J+1),O=_r[E];N=ee?"":O?O(v):N}}else N=ee?"":N;w[y]=N}};k?.onAssign(C.onAssign),u.push(C)}}),de.publisherListeners.set(e,u)}},de.observedElements=new Map,de.enabled=!0,de.publisherListeners=new Map,de);Sr.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=Sr);let bi=(Re=class{static listen(){if(!Re.listening)return;const e=document.location?.href.replace(document.location.origin,"");Re.prevURL&&Re.prevURL!=e&&(Re.prevURL=e,Re.listeners.forEach(t=>{t.location=e})),window.requestAnimationFrame(Re.listen)}static offChange(e){const t=Re.listeners.indexOf(e);t!=-1&&(Re.listeners.splice(t,1),Re.listeners.length==0&&(Re.listening=!1))}static onChange(e){Re.listening||(Re.listening=!0,Re.listen()),Re.listeners.push(e),e.location=this.prevURL}static changeFromComponent(e){const t=e.goBack,r=document.referrer;if(t!=null){const P=document.location.origin,M=(t||P).toString(),w=r.indexOf("http")==0?new URL(r).origin!=P:!1,C=r=="",R=history.length<3,N=C&&R,ee=M!=document.location.href;if(w&&ee||N){const E=history.state||{};E.concorde=E.concorde||{},E.concorde.hasDoneHistoryBack=!0,history.pushState(E,document.title),history.back(),document.location.replace(M)}else history.back();return}let s=e.getAttribute("to")||"";if(s||(s=e.href?.toString()||""),!s)return;if(s.indexOf("#")==0){document.location.hash=s.substring(1);return}const u=new URL(s,document.location.href),o=u.pathname.split("/"),p=[];let y="";for(const P of o)P!=y&&p.push(P),y=P;s="/"+p.join("/")+u.search+(u.hash?+u.hash:""),e.hasAttribute("pushState")?history.pushState(null,"",s):e.hasAttribute("replaceState")?history.replaceState(null,"",s):document.location.href=s}static updateComponentActiveState(e){if(e.autoActive=="disabled")return;const t=e.href?.toString()||"";if(e.href&&t.indexOf("http")!=0){const r=new URL(t,document.location.href),s=new URL(e.location||"",document.location.origin);let u=!1;e.autoActive=="strict"?u=r.pathname==s.pathname&&r.hash==s.hash&&r.search==s.search:e.autoActive=="strict-path-only"?u=r.pathname==s.pathname&&r.hash==s.hash:u=s.href.indexOf(r.href)==0,u?e.setAttribute("active","true"):e.removeAttribute("active")}}},Re.listeners=[],Re.listening=!1,Re.prevURL=document.location?.href.replace(document.location.origin,""),Re);function un(n){if(n==null||typeof n!="object"||Array.isArray(n))return n;const e={...n};return delete e._sonic_http_response_,e}const ye=class ye{constructor(e){this.addHTTPResponse=!1,this.cache="default",this.isServiceSimulated=!1,this.blockUntilDone=!1,this.keepAlive=!1,this.serviceURL=e.serviceURL,this.blockUntilDone=e.blockUntilDone||!1,this.serviceURL=="publisher://"&&(this.isServiceSimulated=!0),this.serviceURL||(this.serviceURL=document.location.origin),this.userName=e.userName,this.password=e.password,e.token&&(this.token=e.token),this.tokenProvider=e.tokenProvider,this.authToken=e.authToken,this.addHTTPResponse=e.addHTTPResponse||!1,this.credentials=e.credentials,this.cache=e.cache||"default",this.keepAlive=e.keepAlive||!1}set token(e){if(this._token=e,!e){ye.tokens.delete(this.serviceURL);return}ye.invalidTokens.includes(e)||ye.tokens.set(this.serviceURL,e)}get token(){return ye.invalidTokens.includes(this._token)?ye.tokens.get(this.serviceURL):this._token}handleInvalidToken(e){e&&(ye.invalidTokens.includes(e)||(ye.invalidTokens.push(e),this.token=null))}async handleResult(e,t){ye.firstCallDoneFlags.set(this.serviceURL,"done"),this.lastResult=e;const r=e.headers.get("content-type")?.toLowerCase(),s=e.status;let u={};if(!r||r.indexOf("text/")==0)u={text:await e.text()};else try{u=await e.json()}catch{u={}}if(this.addHTTPResponse&&er.isObject(u)&&(u._sonic_http_response_=e),s===498&&!ye.failledTokenUpdates.has(this.serviceURL))if(this.handleInvalidToken(this.token),t.apiMethod==="get"){const p=await this.get(t.path,t.additionalHeaders);if(p==null)throw new Error("GET retry failed after token refresh");u=p}else u=await this[t.apiMethod](t.path,t.data,t.method,t.additionalHeaders);return gi("sonic-api").lastResponse.set({http:e,processed:u}),u}async auth(){if(this.token)return;if(ye.tokens.has(this.serviceURL)){this.token=ye.tokens.get(this.serviceURL);return}if(!this.tokenProvider)return;let e={};this.userName&&this.password?e={Authorization:"Basic "+window.btoa(unescape(encodeURIComponent(this.userName+":"+this.password)))}:this.authToken&&(e={Authorization:"Bearer "+this.authToken});const t=new URL(this.serviceURL),r=t.protocol+"//"+t.host,s=await fetch(this.computeURL(this.tokenProvider,{serviceHost:r}),{headers:e,credentials:this.credentials,keepalive:this.keepAlive});try{const u=await s.json();u.token?this.token=u.token:ye.failledTokenUpdates.set(this.serviceURL,!0)}catch{ye.failledTokenUpdates.set(this.serviceURL,!0)}}async localGet(e,t){const r=$e.get(e),s=new URLSearchParams(t.split("?")[1]||""),u=r.get();let o=[];Array.isArray(u)?o=u:o=[u];const p=[];let y=Number.POSITIVE_INFINITY,P=0,M=0;if(s.has("limit")&&(y=parseInt(s.get("limit")||"0"),M++),s.has("offset")&&(P=parseInt(s.get("offset")||"0"),M++),M>0&&(s.delete("limit"),s.delete("offset")),s.size===0)return o.slice(P,P+y);for(const[k,w]of s.entries()){const C=w.split(",").map(R=>R.trim());for(const R of C)for(const N of o)if(typeof N!="object")isNaN(+N)?N.toString().toLowerCase().includes(w.toLowerCase())&&p.push(N):N===w&&p.push(N);else{const ee=N;if(!ee[k])continue;isNaN(+ee[k])?ee[k]?.toString().toLowerCase().includes(R.toLowerCase())&&p.push(N):ee[k]===R&&p.push(N)}}return p.slice(P,P+y)}firstCallDone(){return new Promise(e=>{if(!ye.firstCallDoneFlags.has(this.serviceURL))ye.firstCallDoneFlags.set(this.serviceURL,"loading"),e(!0);else{const t=()=>{[void 0,"loading"].includes(ye.firstCallDoneFlags.get(this.serviceURL))?window.requestAnimationFrame(t):e(!0)};t()}})}async get(e,t){const r=/dataProvider\((.*?)\)(.*?)$/;if(r.test(e)){this.blockUntilDone&&(await this.firstCallDone(),ye.firstCallDoneFlags.set(this.serviceURL,"loading"));const P=e.match(r);if(!P)throw new Error("dataProvider path is not valid");return await this.localGet(P[1],P[2])}const s={apiMethod:"get",path:e,additionalHeaders:t},u=await this.createHeaders(t),o=this.computeURL(e),p=JSON.stringify({url:o,headers:u,credentials:this.credentials,cache:this.cache,keepAlive:this.keepAlive});if(this.blockUntilDone&&(await this.firstCallDone(),ye.firstCallDoneFlags.set(this.serviceURL,"loading")),!ye.loadingGetPromises.has(p)){const P=new Promise(async M=>{try{const k=await fetch(o,{headers:u,credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),w=await this.handleResult(k,s);M({processed:w,response:this.lastResult})}catch{ye.firstCallDoneFlags.set(this.serviceURL,"error"),M(null)}});ye.loadingGetPromises.set(p,P)}const y=await ye.loadingGetPromises.get(p);return ye.loadingGetPromises.delete(p),y?(this.lastResult=y.response,y.processed):null}async getDetailed(e,t){const r=/dataProvider\((.*?)\)(.*?)$/.test(e),s=await this.get(e,t);if(s==null)return;const u=un(s),o=this.computeURL(e);if(r)return{request:new Request(o,{method:"GET"}),result:u};const p=await this.createHeaders(t);return{request:new Request(o,{method:"GET",headers:new Headers(p),credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),response:this.lastResult,result:u}}async sendDetailed(e,t,r,s){const u=await this.send(e,t,r,s);if(u==null)return;const o=un(u),p=this.computeURL(e),y=await this.createHeaders({Accept:"application/json","Content-Type":"application/json",...s});return{request:new Request(p,{method:r,headers:new Headers(y),credentials:this.credentials,body:JSON.stringify(t),keepalive:this.keepAlive}),response:this.lastResult,result:o}}async postDetailed(e,t,r){return this.sendDetailed(e,t,"POST",r)}async putDetailed(e,t,r){return this.sendDetailed(e,t,"PUT",r)}async patchDetailed(e,t,r){return this.sendDetailed(e,t,"PATCH",r)}async createHeaders(e){await this.auth();const t={};return this.token&&(t.Authorization="Bearer "+this.token),t["Accept-Language"]=at.getLanguage(),e&&Object.assign(t,e),t}computeURL(e,t={}){let r="";e.startsWith("http")?r=e:r=this.serviceURL+"/"+e,r.startsWith("http")||(r=window.location.origin+r);const s=new URL(r);for(const u in t)s.searchParams.set(u,t[u]);return s.toString().replace(/([^(https?:)])\/{2,}/g,"$1/")}async send(e,t,r="POST",s){const u={apiMethod:"send",path:e,additionalHeaders:s,method:r,data:t},o=await this.createHeaders(s);o.Accept="application/json",o["Content-Type"]="application/json";const p=await fetch(this.computeURL(e),{headers:o,credentials:this.credentials,method:r,body:JSON.stringify(t),keepalive:this.keepAlive});return await this.handleResult(p,u)}async submitFormData(e,t,r="POST",s){const u={apiMethod:"submitFormData",path:e,additionalHeaders:s,method:r,data:t},o=await this.createHeaders(s);o.Accept="application/json";const p=new FormData,y=t;for(const M in y)p.set(M,y[M]);const P=await fetch(this.computeURL(e),{headers:o,credentials:this.credentials,method:r,body:p,keepalive:this.keepAlive});return await this.handleResult(P,u)}async put(e,t,r){return this.send(e,t,"PUT",r)}async post(e,t,r){return this.send(e,t,"POST",r)}async patch(e,t,r){return this.send(e,t,"PATCH",r)}async delete(e,t,r){return this.send(e,t,"delete",r)}};ye.loadingGetPromises=new Map,ye.tokens=new Map,ye.invalidTokens=[],ye.failledTokenUpdates=new Map,ye.firstCallDoneFlags=new Map;let Pr=ye;at.getApiConfiguration(document.body||document.documentElement);var cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yi(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jt={exports:{}},wi=jt.exports,ln;function Ai(){return ln||(ln=1,(function(n,e){var t=[].slice;(function(r,s){return e!==null?n.exports=s():r.UrlPattern=s()})(wi,function(){var r,s,u,o,p,y,P,M,k,w,C,R,N,ee,J;return k=function(E){return E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},P=function(E,v){var O,A,T;for(T=[],O=-1,A=E.length;++O<A;)T=T.concat(v(E[O]));return T},ee=function(E,v){var O,A,T;for(T="",O=-1,A=E.length;++O<A;)T+=v(E[O]);return T},N=function(E){return new RegExp(E.toString()+"|").exec("").length-1},C=function(E,v){var O,A,T,H,F;for(H={},O=-1,T=E.length;++O<T;)A=E[O],F=v[O],F!=null&&(H[A]!=null?(Array.isArray(H[A])||(H[A]=[H[A]]),H[A].push(F)):H[A]=F);return H},r={},r.Result=function(E,v){this.value=E,this.rest=v},r.Tagged=function(E,v){this.tag=E,this.value=v},r.tag=function(E,v){return function(O){var A,T;if(A=v(O),A!=null)return T=new r.Tagged(E,A.value),new r.Result(T,A.rest)}},r.regex=function(E){return function(v){var O,A;if(O=E.exec(v),O!=null)return A=O[0],new r.Result(A,v.slice(A.length))}},r.sequence=function(){var E;return E=1<=arguments.length?t.call(arguments,0):[],function(v){var O,A,T,H,F,re;for(O=-1,A=E.length,re=[],H=v;++O<A;){if(T=E[O],F=T(H),F==null)return;re.push(F.value),H=F.rest}return new r.Result(re,H)}},r.pick=function(){var E,v;return E=arguments[0],v=2<=arguments.length?t.call(arguments,1):[],function(O){var A,T;if(T=r.sequence.apply(r,v)(O),T!=null)return A=T.value,T.value=A[E],T}},r.string=function(E){var v;return v=E.length,function(O){if(O.slice(0,v)===E)return new r.Result(E,O.slice(v))}},r.lazy=function(E){var v;return v=null,function(O){return v==null&&(v=E()),v(O)}},r.baseMany=function(E,v,O,A,T){var H,F,re,ae;for(re=T,ae=O?"":[];!(v!=null&&(H=v(re),H!=null)||(F=E(re),F==null));)O?ae+=F.value:ae.push(F.value),re=F.rest;if(!(A&&ae.length===0))return new r.Result(ae,re)},r.many1=function(E){return function(v){return r.baseMany(E,null,!1,!0,v)}},r.concatMany1Till=function(E,v){return function(O){return r.baseMany(E,v,!0,!0,O)}},r.firstChoice=function(){var E;return E=1<=arguments.length?t.call(arguments,0):[],function(v){var O,A,T,H;for(O=-1,A=E.length;++O<A;)if(T=E[O],H=T(v),H!=null)return H}},R=function(E){var v;return v={},v.wildcard=r.tag("wildcard",r.string(E.wildcardChar)),v.optional=r.tag("optional",r.pick(1,r.string(E.optionalSegmentStartChar),r.lazy(function(){return v.pattern}),r.string(E.optionalSegmentEndChar))),v.name=r.regex(new RegExp("^["+E.segmentNameCharset+"]+")),v.named=r.tag("named",r.pick(1,r.string(E.segmentNameStartChar),r.lazy(function(){return v.name}))),v.escapedChar=r.pick(1,r.string(E.escapeChar),r.regex(/^./)),v.static=r.tag("static",r.concatMany1Till(r.firstChoice(r.lazy(function(){return v.escapedChar}),r.regex(/^./)),r.firstChoice(r.string(E.segmentNameStartChar),r.string(E.optionalSegmentStartChar),r.string(E.optionalSegmentEndChar),v.wildcard))),v.token=r.lazy(function(){return r.firstChoice(v.wildcard,v.optional,v.named,v.static)}),v.pattern=r.many1(r.lazy(function(){return v.token})),v},M={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},y=function(E,v){if(Array.isArray(E))return ee(E,function(O){return y(O,v)});switch(E.tag){case"wildcard":return"(.*?)";case"named":return"(["+v+"]+)";case"static":return k(E.value);case"optional":return"(?:"+y(E.value,v)+")?"}},p=function(E,v){return v==null&&(v=M.segmentValueCharset),"^"+y(E,v)+"$"},o=function(E){if(Array.isArray(E))return P(E,o);switch(E.tag){case"wildcard":return["_"];case"named":return[E.value];case"static":return[];case"optional":return o(E.value)}},w=function(E,v,O,A){var T,H,F,re;if(A==null&&(A=!1),re=E[v],re==null){if(A)throw new Error("no values provided for key `"+v+"`");return}if(T=O[v]||0,H=Array.isArray(re)?re.length-1:0,T>H){if(A)throw new Error("too few values provided for key `"+v+"`");return}return F=Array.isArray(re)?re[T]:re,A&&(O[v]=T+1),F},u=function(E,v,O){var A,T;if(Array.isArray(E)){for(A=-1,T=E.length;++A<T;)if(u(E[A],v,O))return!0;return!1}switch(E.tag){case"wildcard":return w(v,"_",O,!1)!=null;case"named":return w(v,E.value,O,!1)!=null;case"static":return!1;case"optional":return u(E.value,v,O)}},J=function(E,v,O){if(Array.isArray(E))return ee(E,function(A){return J(A,v,O)});switch(E.tag){case"wildcard":return w(v,"_",O,!0);case"named":return w(v,E.value,O,!0);case"static":return E.value;case"optional":return u(E.value,v,O)?J(E.value,v,O):""}},s=function(E,v){var O,A,T,H,F;if(E instanceof s){this.isRegex=E.isRegex,this.regex=E.regex,this.ast=E.ast,this.names=E.names;return}if(this.isRegex=E instanceof RegExp,!(typeof E=="string"||this.isRegex))throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=E,v!=null){if(!Array.isArray(v))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(O=N(this.regex),v.length!==O)throw new Error("regex contains "+O+" groups but array of group names contains "+v.length);this.names=v}return}if(E==="")throw new Error("argument must not be the empty string");if(F=E.replace(/\s+/g,""),F!==E)throw new Error("argument must not contain whitespace");if(A={escapeChar:v?.escapeChar||M.escapeChar,segmentNameStartChar:v?.segmentNameStartChar||M.segmentNameStartChar,segmentNameCharset:v?.segmentNameCharset||M.segmentNameCharset,segmentValueCharset:v?.segmentValueCharset||M.segmentValueCharset,optionalSegmentStartChar:v?.optionalSegmentStartChar||M.optionalSegmentStartChar,optionalSegmentEndChar:v?.optionalSegmentEndChar||M.optionalSegmentEndChar,wildcardChar:v?.wildcardChar||M.wildcardChar},H=R(A),T=H.pattern(E),T==null)throw new Error("couldn't parse pattern");if(T.rest!=="")throw new Error("could only partially parse pattern");this.ast=T.value,this.regex=new RegExp(p(this.ast,A.segmentValueCharset)),this.names=o(this.ast)},s.prototype.match=function(E){var v,O;return O=this.regex.exec(E),O==null?null:(v=O.slice(1),this.names?C(this.names,v):v)},s.prototype.stringify=function(E){if(E==null&&(E={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(E!==Object(E))throw new Error("argument must be an object or undefined");return J(this.ast,E,{})},s.escapeForRegex=k,s.concatMap=P,s.stringConcatMap=ee,s.regexGroupCount=N,s.keysAndValuesToObject=C,s.P=r,s.newParser=R,s.defaultOptions=M,s.astNodeToRegexString=p,s.astNodeToNames=o,s.getParam=w,s.astNodeContainsSegmentsForProvidedParams=u,s.stringify=J,s})})(jt,jt.exports)),jt.exports}var Ei=Ai();const _i=yi(Ei);class Tr{constructor(e){this.path=Tr.normalizePath(e)}getDataProviderKey(){return new Qt(this.path)}static normalizePath(e){const t=String(e).trim();if(!t)throw new RangeError("Endpoint: path cannot be empty");if(/^https?:\/\//i.test(t)){let y;try{y=new URL(t)}catch{throw new RangeError("Endpoint: invalid absolute URL")}return y.pathname=y.pathname.replace(/\/+/g,"/"),y.href}const r=t.indexOf("?"),s=t.indexOf("#");let u=t.length;r>=0&&(u=Math.min(u,r)),s>=0&&(u=Math.min(u,s));let o=t.slice(0,u);const p=t.slice(u);if(o=o.replace(/^\/+/,""),o=o.replace(/\/+/g,"/"),!o&&p)throw new RangeError("Endpoint: path cannot be empty");return o+p}static isNonEmpty(e){return String(e).trim().length>0}static looksLikeDataProviderPath(e){return/^\s*dataProvider\s*\(/i.test(String(e))}toString(){return this.path}}function nr(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Cr={exports:{}},fn;function xi(){return fn||(fn=1,(function(n,e){(function(t){n.exports=t()})(function(){return(function(){function t(r,s,u){function o(P,M){if(!s[P]){if(!r[P]){var k=typeof nr=="function"&&nr;if(!M&&k)return k(P,!0);if(p)return p(P,!0);var w=new Error("Cannot find module '"+P+"'");throw w.code="MODULE_NOT_FOUND",w}var C=s[P]={exports:{}};r[P][0].call(C.exports,function(R){var N=r[P][1][R];return o(N||R)},C,C.exports,t,r,s,u)}return s[P].exports}for(var p=typeof nr=="function"&&nr,y=0;y<u.length;y++)o(u[y]);return o}return t})()({1:[function(t,r,s){const u=t("./utils"),o=(function(){const p=u.stringToArray,y=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],P=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],M=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],k=["Thousand","Million","Billion","Trillion"];function w(_,D){var S=function(B,I,L){var q="";if(B<=19)q=(I?" and ":"")+(L?P[B]:y[B]);else if(B<100){const he=Math.floor(B/10),ue=B%10;q=(I?" and ":"")+M[he-2],ue>0?q+="-"+S(ue,!1,L):L&&(q=q.substring(0,q.length-1)+"ieth")}else if(B<1e3){const he=Math.floor(B/100),ue=B%100;q=(I?", ":"")+y[he]+" Hundred",ue>0?q+=S(ue,!0,L):L&&(q+="th")}else{var K=Math.floor(Math.log10(B)/3);K>k.length&&(K=k.length);const he=Math.pow(10,K*3),ue=Math.floor(B/he),te=B-ue*he;q=(I?", ":"")+S(ue,!1,!1)+" "+k[K-1],te>0?q+=S(te,!0,L):L&&(q+="th")}return q},U=S(_,!1,D);return U}const C=Object.create(null);y.forEach(function(_,D){C[_.toLowerCase()]=D}),P.forEach(function(_,D){C[_.toLowerCase()]=D}),M.forEach(function(_,D){const S=_.toLowerCase();C[S]=(D+2)*10,C[S.substring(0,_.length-1)+"ieth"]=C[S]}),C.hundredth=100,k.forEach(function(_,D){const S=_.toLowerCase(),U=Math.pow(10,(D+1)*3);C[S]=U,C[S+"th"]=U});function R(_){const S=_.split(/,\s|\sand\s|[\s\\-]/).map(I=>C[I]);let U=[0];return S.forEach(I=>{if(I<100){let L=U.pop();L>=1e3&&(U.push(L),L=0),U.push(L+I)}else U.push(U.pop()*I)}),U.reduce((I,L)=>I+L,0)}const N=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],ee={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function J(_){for(var D=0;D<N.length;D++){const S=N[D];if(_>=S[0])return S[1]+J(_-S[0])}return""}function E(_){for(var D=0,S=1,U=_.length-1;U>=0;U--){const B=_[U],I=ee[B];I<S?D-=I:(S=I,D+=I)}return D}function v(_,D){for(var S=[],U=D.charCodeAt(0);_>0;)S.unshift(String.fromCharCode((_-1)%26+U)),_=Math.floor((_-1)/26);return S.join("")}function O(_,D){for(var S=D.charCodeAt(0),U=0,B=0;B<_.length;B++)U+=(_.charCodeAt(_.length-B-1)-S+1)*Math.pow(26,B);return U}function A(_,D){if(typeof _>"u")return;_=Math.floor(_);const S=ae(D);return F(_,S)}const T={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},H={UPPER:"upper",LOWER:"lower",TITLE:"title"};function F(_,D){let S;const U=_<0;switch(_=Math.abs(_),D.primary){case T.LETTERS:S=v(_,D.case===H.UPPER?"A":"a");break;case T.ROMAN:S=J(_),D.case===H.UPPER&&(S=S.toUpperCase());break;case T.WORDS:S=w(_,D.ordinal),D.case===H.UPPER?S=S.toUpperCase():D.case===H.LOWER&&(S=S.toLowerCase());break;case T.DECIMAL:S=""+_;var B=D.mandatoryDigits-S.length;if(B>0){var I=new Array(B+1).join("0");S=I+S}if(D.zeroCode!==48&&(S=p(S).map(he=>String.fromCodePoint(he.codePointAt(0)+D.zeroCode-48)).join("")),D.regular){const he=Math.floor((S.length-1)/D.groupingSeparators.position);for(let ue=he;ue>0;ue--){const te=S.length-ue*D.groupingSeparators.position;S=S.substr(0,te)+D.groupingSeparators.character+S.substr(te)}}else D.groupingSeparators.reverse().forEach(he=>{const ue=S.length-he.position;S=S.substr(0,ue)+he.character+S.substr(ue)});if(D.ordinal){var L={1:"st",2:"nd",3:"rd"},q=S[S.length-1],K=L[q];(!K||S.length>1&&S[S.length-2]==="1")&&(K="th"),S=S+K}break;case T.SEQUENCE:throw{code:"D3130",value:D.token}}return U&&(S="-"+S),S}const re=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function ae(_){const D={type:"integer",primary:T.DECIMAL,case:H.LOWER,ordinal:!1};let S,U;const B=_.lastIndexOf(";");switch(B===-1?S=_:(S=_.substring(0,B),U=_.substring(B+1),U[0]==="o"&&(D.ordinal=!0)),S){case"A":D.case=H.UPPER;case"a":D.primary=T.LETTERS;break;case"I":D.case=H.UPPER;case"i":D.primary=T.ROMAN;break;case"W":D.case=H.UPPER,D.primary=T.WORDS;break;case"Ww":D.case=H.TITLE,D.primary=T.WORDS;break;case"w":D.primary=T.WORDS;break;default:{let I=null,L=0,q=0,K=[],he=0;if(p(S).map(te=>te.codePointAt(0)).reverse().forEach(te=>{let Z=!1;for(let le=0;le<re.length;le++){const Q=re[le];if(te>=Q&&te<=Q+9){if(Z=!0,L++,he++,I===null)I=Q;else if(Q!==I)throw{code:"D3131"};break}}Z||(te===35?(he++,q++):K.push({position:he,character:String.fromCodePoint(te)}))}),L>0){D.primary=T.DECIMAL,D.zeroCode=I,D.mandatoryDigits=L,D.optionalDigits=q;const Z=function(le){if(le.length===0)return 0;const Q=le[0].character;for(let Le=1;Le<le.length;Le++)if(le[Le].character!==Q)return 0;const Ne=le.map(Le=>Le.position),Qe=function(Le,Be){return Be===0?Le:Qe(Be,Le%Be)},je=Ne.reduce(Qe);for(let Le=1;Le<=Ne.length;Le++)if(Ne.indexOf(Le*je)===-1)return 0;return je}(K);Z>0?(D.regular=!0,D.groupingSeparators={position:Z,character:K[0].character}):(D.regular=!1,D.groupingSeparators=K)}else D.primary=T.SEQUENCE,D.token=S}}return D}const Ee={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function ve(_){var D=[];const S={type:"datetime",parts:D},U=function(Z,le){if(le>Z){let Q=_.substring(Z,le);Q=Q.split("]]").join("]"),D.push({type:"literal",value:Q})}};for(var B=0,I=0;I<_.length;){if(_.charAt(I)==="["){if(_.charAt(I+1)==="["){U(B,I),D.push({type:"literal",value:"["}),I+=2,B=I;continue}if(U(B,I),B=I,I=_.indexOf("]",B),I===-1)throw{code:"D3135"};let Z=_.substring(B+1,I);Z=Z.split(/\s+/).join("");var L={type:"marker",component:Z.charAt(0)},q=Z.lastIndexOf(","),K;if(q!==-1){const le=Z.substring(q+1),Q=le.indexOf("-");let Ne,Qe;const je=function(Be){if(!(typeof Be>"u"||Be==="*"))return parseInt(Be)};Q===-1?Ne=le:(Ne=le.substring(0,Q),Qe=le.substring(Q+1));const Le={min:je(Ne),max:je(Qe)};L.width=Le,K=Z.substring(1,q)}else K=Z.substring(1);if(K.length===1)L.presentation1=K;else if(K.length>1){var he=K.charAt(K.length-1);"atco".indexOf(he)!==-1?(L.presentation2=he,he==="o"&&(L.ordinal=!0),L.presentation1=K.substring(0,K.length-1)):L.presentation1=K}else L.presentation1=Ee[L.component];if(typeof L.presentation1>"u")throw{code:"D3132",value:L.component};if(L.presentation1[0]==="n")L.names=H.LOWER;else if(L.presentation1[0]==="N")L.presentation1[1]==="n"?L.names=H.TITLE:L.names=H.UPPER;else if("YMDdFWwXxHhmsf".indexOf(L.component)!==-1){var ue=L.presentation1;if(L.presentation2&&(ue+=";"+L.presentation2),L.integerFormat=ae(ue),L.width&&L.width.min!==void 0&&L.integerFormat.mandatoryDigits<L.width.min&&(L.integerFormat.mandatoryDigits=L.width.min),L.component==="Y")if(L.n=-1,L.width&&L.width.max!==void 0)L.n=L.width.max,L.integerFormat.mandatoryDigits=L.n;else{var te=L.integerFormat.mandatoryDigits+L.integerFormat.optionalDigits;te>=2&&(L.n=te)}const le=D[D.length-1];le&&le.integerFormat&&(le.integerFormat.parseWidth=le.integerFormat.mandatoryDigits)}(L.component==="Z"||L.component==="z")&&(L.integerFormat=ae(L.presentation1)),D.push(L),B=I+1}I++}return U(B,I),S}const pe=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Te=["January","February","March","April","May","June","July","August","September","October","November","December"],Je=1e3*60*60*24,ce=function(_){const D=Date.UTC(_.year,_.month);var S=new Date(D).getUTCDay();return S===0&&(S=7),S>4?D+(8-S)*Je:D-(S-1)*Je},me=function(_,D){return{year:_,month:D,nextMonth:function(){return D===11?me(_+1,0):me(_,D+1)},previousMonth:function(){return D===0?me(_-1,11):me(_,D-1)},nextYear:function(){return me(_+1,D)},previousYear:function(){return me(_-1,D)}}},We=function(_,D){return(D-_)/(Je*7)+1},ie=(_,D)=>{let S;switch(D){case"Y":S=_.getUTCFullYear();break;case"M":S=_.getUTCMonth()+1;break;case"D":S=_.getUTCDate();break;case"d":{const U=Date.UTC(_.getUTCFullYear(),_.getUTCMonth(),_.getUTCDate()),B=Date.UTC(_.getUTCFullYear(),0);S=(U-B)/Je+1;break}case"F":S=_.getUTCDay(),S===0&&(S=7);break;case"W":{const U=me(_.getUTCFullYear(),0),B=ce(U),I=Date.UTC(U.year,_.getUTCMonth(),_.getUTCDate());let L=We(B,I);if(L>52){const q=ce(U.nextYear());I>=q&&(L=1)}else if(L<1){const q=ce(U.previousYear());L=We(q,I)}S=Math.floor(L);break}case"w":{const U=me(_.getUTCFullYear(),_.getUTCMonth()),B=ce(U),I=Date.UTC(U.year,U.month,_.getUTCDate());let L=We(B,I);if(L>4){const q=ce(U.nextMonth());I>=q&&(L=1)}else if(L<1){const q=ce(U.previousMonth());L=We(q,I)}S=Math.floor(L);break}case"X":{const U=me(_.getUTCFullYear(),0),B=ce(U),I=ce(U.nextYear()),L=_.getTime();L<B?S=U.year-1:L>=I?S=U.year+1:S=U.year;break}case"x":{const U=me(_.getUTCFullYear(),_.getUTCMonth()),B=ce(U),I=U.nextMonth(),L=ce(I),q=_.getTime();q<B?S=U.previousMonth().month+1:q>=L?S=I.month+1:S=U.month+1;break}case"H":S=_.getUTCHours();break;case"h":S=_.getUTCHours(),S=S%12,S===0&&(S=12);break;case"P":S=_.getUTCHours()>=12?"pm":"am";break;case"m":S=_.getUTCMinutes();break;case"s":S=_.getUTCSeconds();break;case"f":S=_.getUTCMilliseconds();break;case"Z":case"z":break;case"C":S="ISO";break;case"E":S="ISO";break}return S};let Ce=null;function nt(_,D,S){var U=0,B=0;if(typeof S<"u"){const ue=parseInt(S);U=Math.floor(ue/100),B=ue%100}var I=function(ue,te){var Z=ie(ue,te.component);if("YMDdFWwXxHhms".indexOf(te.component)!==-1)if(te.component==="Y"&&te.n!==-1&&(Z=Z%Math.pow(10,te.n)),te.names){if(te.component==="M"||te.component==="x")Z=Te[Z-1];else if(te.component==="F")Z=pe[Z];else throw{code:"D3133",value:te.component};te.names===H.UPPER?Z=Z.toUpperCase():te.names===H.LOWER&&(Z=Z.toLowerCase()),te.width&&Z.length>te.width.max&&(Z=Z.substring(0,te.width.max))}else Z=F(Z,te.integerFormat);else if(te.component==="f")Z=F(Z,te.integerFormat);else if(te.component==="Z"||te.component==="z"){const le=U*100+B;if(te.integerFormat.regular)Z=F(le,te.integerFormat);else{const Q=te.integerFormat.mandatoryDigits;if(Q===1||Q===2)Z=F(U,te.integerFormat),B!==0&&(Z+=":"+A(B,"00"));else if(Q===3||Q===4)Z=F(le,te.integerFormat);else throw{code:"D3134",value:Q}}le>=0&&(Z="+"+Z),te.component==="z"&&(Z="GMT"+Z),le===0&&te.presentation2==="t"&&(Z="Z")}else te.component==="P"&&te.names===H.UPPER&&(Z=Z.toUpperCase());return Z};let L;typeof D>"u"?(Ce===null&&(Ce=ve("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),L=Ce):L=ve(D);const q=(60*U+B)*60*1e3,K=new Date(_+q);let he="";return L.parts.forEach(function(ue){ue.type==="literal"?he+=ue.value:he+=I(K,ue)}),he}function h(_){var D=Object.create(null);if(_.type==="datetime")D.type="datetime",D.parts=_.parts.map(function(S){var U=Object.create(null);if(S.type==="literal")U.regex=S.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(S.component==="Z"||S.component==="z"){let I;Array.isArray(S.integerFormat.groupingSeparators)||(I=S.integerFormat.groupingSeparators),U.regex="",S.component==="z"&&(U.regex="GMT"),U.regex+="[-+][0-9]+",I&&(U.regex+=I.character+"[0-9]+"),U.parse=function(L){S.component==="z"&&(L=L.substring(3));let q=0,K=0;return I?(q=Number.parseInt(L.substring(0,L.indexOf(I.character))),K=Number.parseInt(L.substring(L.indexOf(I.character)+1))):L.length-1<=2?q=Number.parseInt(L):(q=Number.parseInt(L.substring(0,3)),K=Number.parseInt(L.substring(3))),q*60+K}}else if(S.component==="f")U.regex="[0-9]+",U.parse=function(I){return parseFloat("0."+I.substring(0,3))*1e3};else if(S.integerFormat)U=h(S.integerFormat);else{U.regex="[a-zA-Z]+";var B=Object.create(null);if(S.component==="M"||S.component==="x")Te.forEach(function(I,L){S.width&&S.width.max?B[I.substring(0,S.width.max)]=L+1:B[I]=L+1});else if(S.component==="F")pe.forEach(function(I,L){L>0&&(S.width&&S.width.max?B[I.substring(0,S.width.max)]=L:B[I]=L)});else if(S.component==="P")B={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:S.component};U.parse=function(I){return B[I]}}return U.component=S.component,U});else{D.type="integer";const S=_.case===H.UPPER;switch(_.primary){case T.LETTERS:D.regex=S?"[A-Z]+":"[a-z]+",D.parse=function(U){return O(U,S?"A":"a")};break;case T.ROMAN:D.regex=S?"[MDCLXVI]+":"[mdclxvi]+",D.parse=function(U){return E(S?U:U.toUpperCase())};break;case T.WORDS:D.regex="(?:"+u.keys(C).concat("and","[\\-, ]").join("|")+")+",D.parse=function(U){return R(U.toLowerCase())};break;case T.DECIMAL:D.regex="[0-9]",_.parseWidth?D.regex+=`{${_.parseWidth}}`:D.regex+="+",_.ordinal&&(D.regex+="(?:th|st|nd|rd)"),D.parse=function(U){let B=U;return _.ordinal&&(B=U.substring(0,U.length-2)),_.regular?B=B.split(",").join(""):_.groupingSeparators.forEach(I=>{B=B.split(I.character).join("")}),_.zeroCode!==48&&(B=B.split("").map(I=>String.fromCodePoint(I.codePointAt(0)-_.zeroCode+48)).join("")),parseInt(B)};break;case T.SEQUENCE:throw{code:"D3130",value:_.token}}}return D}function b(_,D){if(typeof _>"u")return;const S=ae(D);return h(S).parse(_)}function G(_,D){const S=ve(D),U=h(S),B="^"+U.parts.map(K=>"("+K.regex+")").join("")+"$";var L=new RegExp(B,"i").exec(_);if(L!==null){const Q=Object.create(null);for(let c=1;c<L.length;c++){const f=U.parts[c-1];f.parse&&(Q[f.component]=f.parse(L[c]))}if(Object.getOwnPropertyNames(Q).length===0)return;let Ne=0;const Qe=c=>{Ne<<=1,Ne+=c?1:0},je=c=>!(~c&Ne)&&!!(c&Ne);"YXMxWwdD".split("").forEach(c=>Qe(Q[c]));const Be=!je(161)&&je(130),ot=je(84),Tt=!ot&&je(72);Ne=0,"PHhmsf".split("").forEach(c=>Qe(Q[c]));const z=!je(23)&&je(47),tt=(Be?"YD":ot?"XxwF":Tt?"XWF":"YMD")+(z?"Phmsf":"Hmsf"),Ht=this.environment.timestamp;let it=!1,yt=!1;if(tt.split("").forEach(c=>{if(typeof Q[c]>"u")it?(Q[c]="MDd".indexOf(c)!==-1?1:0,yt=!0):Q[c]=ie(Ht,c);else if(it=!0,yt)throw{code:"D3136"}}),Q.M>0?Q.M-=1:Q.M=0,Be){const c=Date.UTC(Q.Y,0),f=(Q.d-1)*1e3*60*60*24,d=new Date(c+f);Q.M=d.getUTCMonth(),Q.D=d.getUTCDate()}if(ot)throw{code:"D3136"};if(Tt)throw{code:"D3136"};z&&(Q.H=Q.h===12?0:Q.h,Q.P===1&&(Q.H+=12));var q=Date.UTC(Q.Y,Q.M,Q.D,Q.H,Q.m,Q.s,Q.f);return(Q.Z||Q.z)&&(q-=(Q.Z||Q.z)*60*1e3),q}}var fe=new RegExp("^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function _e(_,D){if(!(typeof _>"u"))if(typeof D>"u"){if(!fe.test(_))throw{stack:new Error().stack,code:"D3110",value:_};return Date.parse(_)}else return G.call(this,_,D)}function we(_,D,S){if(!(typeof _>"u"))return nt.call(this,_,D,S)}return{formatInteger:A,parseInteger:b,fromMillis:we,toMillis:_e}})();r.exports=o},{"./utils":6}],2:[function(t,r,s){(function(u){(function(){var o=t("./utils");const p=(()=>{var y=o.isNumeric,P=o.isArrayOfStrings,M=o.isArrayOfNumbers,k=o.isSequence,w=o.isFunction,C=o.isLambda,R=o.isPromise,N=o.getFunctionArity,ee=o.isDeepEqual,J=o.stringToArray;function E(i){if(!(typeof i>"u")){var a=0;return i.forEach(function(l){a+=l}),a}}function v(i){return typeof i>"u"?0:i.length}function O(i){if(!(typeof i>"u"||i.length===0))return Math.max.apply(Math,i)}function A(i){if(!(typeof i>"u"||i.length===0))return Math.min.apply(Math,i)}function T(i){if(!(typeof i>"u"||i.length===0)){var a=0;return i.forEach(function(l){a+=l}),a/i.length}}function H(i,a=!1){if(!(typeof i>"u")){var l;if(typeof i=="string")l=i;else if(w(i))l="";else{if(typeof i=="number"&&!isFinite(i))throw{code:"D3001",value:i,stack:new Error().stack};var g=a?2:0;Array.isArray(i)&&i.outerWrapper&&(i=i[0]),l=JSON.stringify(i,function(m,x){return typeof x<"u"&&x!==null&&y(x)?x.toPrecision&&!Number.isInteger(x)?Number(x.toPrecision(15)):x:x&&w(x)?"":x},g)}return l}}function F(i,a,l){if(!(typeof i>"u")){var g=J(i),m=g.length;if(m+a<0&&(a=0),typeof l<"u"){if(l<=0)return"";var x=a>=0?a+l:m+a+l;return g.slice(a,x).join("")}return g.slice(a).join("")}}function re(i,a){if(!(typeof i>"u")){var l=i.indexOf(a);return l>-1?i.substr(0,l):i}}function ae(i,a){if(!(typeof i>"u")){var l=i.indexOf(a);return l>-1?i.substr(l+a.length):i}}function Ee(i){if(!(typeof i>"u"))return i.toLowerCase()}function ve(i){if(!(typeof i>"u"))return i.toUpperCase()}function pe(i){if(!(typeof i>"u"))return J(i).length}function Te(i){if(!(typeof i>"u")){var a=i.replace(/[ \t\n\r]+/gm," ");return a.charAt(0)===" "&&(a=a.substring(1)),a.charAt(a.length-1)===" "&&(a=a.substring(0,a.length-1)),a}}function Je(i,a,l){if(!(typeof i>"u")){(typeof l>"u"||l.length===0)&&(l=" ");var g;a=Math.trunc(a);var m=Math.abs(a)-pe(i);if(m>0){var x=new Array(m+1).join(l);l.length>1&&(x=F(x,0,m)),a>0?g=i+x:g=x+i}else g=i;return g}}async function ce(i,a){var l=i.apply(this,[a]);if(R(l)&&(l=await l),l&&!(typeof l.start=="number"||l.end==="number"||Array.isArray(l.groups)||w(l.next)))throw{code:"T1010",stack:new Error().stack};return l}async function me(i,a){if(!(typeof i>"u"||typeof a>"u")){var l;if(typeof a=="string")l=i.indexOf(a)!==-1;else{var g=await ce(a,i);l=typeof g<"u"}return l}}async function We(i,a,l){if(!(typeof i>"u")){if(l<0)throw{stack:new Error().stack,value:l,code:"D3040",index:3};var g=this.createSequence();if(typeof l>"u"||l>0){var m=0,x=await ce(a,i);if(typeof x<"u")for(;typeof x<"u"&&(typeof l>"u"||m<l);)g.push({match:x.match,index:x.start,groups:x.groups}),x=await ce(x.next),m++}return g}}async function ie(i,a,l,g){if(!(typeof i>"u")){var m=this;if(a==="")throw{code:"D3010",stack:new Error().stack,value:a,index:2};if(g<0)throw{code:"D3011",stack:new Error().stack,value:g,index:4};var x;typeof l=="string"?x=function(ke){for(var Me="",be=0,De=l.indexOf("$",be);De!==-1&&be<l.length;){Me+=l.substring(be,De),be=De+1;var et=l.charAt(be);if(et==="$")Me+="$",be++;else if(et==="0")Me+=ke.match,be++;else{var qe;if(ke.groups.length===0?qe=1:qe=Math.floor(Math.log(ke.groups.length)*Math.LOG10E)+1,De=parseInt(l.substring(be,be+qe),10),qe>1&&De>ke.groups.length&&(De=parseInt(l.substring(be,be+qe-1),10)),isNaN(De))Me+="$";else{if(ke.groups.length>0){var st=ke.groups[De-1];typeof st<"u"&&(Me+=st)}be+=De.toString().length}}De=l.indexOf("$",be)}return Me+=l.substring(be),Me}:x=l;var $="",j=0;if(typeof g>"u"||g>0){var se=0;if(typeof a=="string"){for(var W=i.indexOf(a,j);W!==-1&&(typeof g>"u"||se<g);)$+=i.substring(j,W),$+=l,j=W+a.length,se++,W=i.indexOf(a,j);$+=i.substring(j)}else{var Ae=await ce(a,i);if(typeof Ae<"u"){for(;typeof Ae<"u"&&(typeof g>"u"||se<g);){$+=i.substring(j,Ae.start);var xe=x.apply(m,[Ae]);if(R(xe)&&(xe=await xe),typeof xe=="string")$+=xe;else throw{code:"D3012",stack:new Error().stack,value:xe};j=Ae.start+Ae.match.length,se++,Ae=await ce(Ae.next)}$+=i.substring(j)}else $=i}}else $=i;return $}}function Ce(i){if(!(typeof i>"u")){var a=typeof window<"u"?window.btoa:function(l){return new u.Buffer.from(l,"binary").toString("base64")};return a(i)}}function nt(i){if(!(typeof i>"u")){var a=typeof window<"u"?window.atob:function(l){return new u.Buffer.from(l,"base64").toString("binary")};return a(i)}}function h(i){if(!(typeof i>"u")){var a;try{a=encodeURIComponent(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"encodeUrlComponent"}}return a}}function b(i){if(!(typeof i>"u")){var a;try{a=encodeURI(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"encodeUrl"}}return a}}function G(i){if(!(typeof i>"u")){var a;try{a=decodeURIComponent(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"decodeUrlComponent"}}return a}}function fe(i){if(!(typeof i>"u")){var a;try{a=decodeURI(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"decodeUrl"}}return a}}async function _e(i,a,l){if(!(typeof i>"u")){if(l<0)throw{code:"D3020",stack:new Error().stack,value:l,index:3};var g=[];if(typeof l>"u"||l>0)if(typeof a=="string")g=i.split(a,l);else{var m=0,x=await ce(a,i);if(typeof x<"u"){for(var $=0;typeof x<"u"&&(typeof l>"u"||m<l);)g.push(i.substring($,x.start)),$=x.end,x=await ce(x.next),m++;(typeof l>"u"||m<l)&&g.push(i.substring($))}else g.push(i)}return g}}function we(i,a){if(!(typeof i>"u"))return typeof a>"u"&&(a=""),i.join(a)}function _(i,a,l){if(!(typeof i>"u")){var g={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},m=g;typeof l<"u"&&o.keys(l).forEach(function(ne){m[ne]=l[ne]});for(var x=[],$=m["zero-digit"].charCodeAt(0),j=$;j<$+10;j++)x.push(String.fromCharCode(j));var se=x.concat([m["decimal-separator"],m["exponent-separator"],m["grouping-separator"],m.digit,m["pattern-separator"]]),W=a.split(m["pattern-separator"]);if(W.length>2)throw{code:"D3080",stack:new Error().stack};var Ae=function(ne){var Pe=(function(){for(var Ue,Ze=0;Ze<ne.length;Ze++)if(Ue=ne.charAt(Ze),se.indexOf(Ue)!==-1&&Ue!==m["exponent-separator"])return ne.substring(0,Ze);return""})(),He=(function(){for(var Ue,Ze=ne.length-1;Ze>=0;Ze--)if(Ue=ne.charAt(Ze),se.indexOf(Ue)!==-1&&Ue!==m["exponent-separator"])return ne.substring(Ze+1);return""})(),Se=ne.substring(Pe.length,ne.length-He.length),Ye,mt,Xe,wt,Ke=ne.indexOf(m["exponent-separator"],Pe.length);Ke===-1||Ke>ne.length-He.length?(Ye=Se,mt=void 0):(Ye=Se.substring(0,Ke),mt=Se.substring(Ke+1));var rt=Ye.indexOf(m["decimal-separator"]);return rt===-1?(Xe=Ye,wt=He):(Xe=Ye.substring(0,rt),wt=Ye.substring(rt+1)),{prefix:Pe,suffix:He,activePart:Se,mantissaPart:Ye,exponentPart:mt,integerPart:Xe,fractionalPart:wt,subpicture:ne}},xe=function(ne){var Pe,He,Se=ne.subpicture,Ye=Se.indexOf(m["decimal-separator"]);Ye!==Se.lastIndexOf(m["decimal-separator"])&&(Pe="D3081"),Se.indexOf(m.percent)!==Se.lastIndexOf(m.percent)&&(Pe="D3082"),Se.indexOf(m["per-mille"])!==Se.lastIndexOf(m["per-mille"])&&(Pe="D3083"),Se.indexOf(m.percent)!==-1&&Se.indexOf(m["per-mille"])!==-1&&(Pe="D3084");var mt=!1;for(He=0;He<ne.mantissaPart.length;He++){var Xe=ne.mantissaPart.charAt(He);if(x.indexOf(Xe)!==-1||Xe===m.digit){mt=!0;break}}mt||(Pe="D3085");var wt=ne.activePart.split("").map(function(Ue){return se.indexOf(Ue)===-1?"p":"a"}).join("");wt.indexOf("p")!==-1&&(Pe="D3086"),Ye!==-1?(Se.charAt(Ye-1)===m["grouping-separator"]||Se.charAt(Ye+1)===m["grouping-separator"])&&(Pe="D3087"):ne.integerPart.charAt(ne.integerPart.length-1)===m["grouping-separator"]&&(Pe="D3088"),Se.indexOf(m["grouping-separator"]+m["grouping-separator"])!==-1&&(Pe="D3089");var Ke=ne.integerPart.indexOf(m.digit);Ke!==-1&&ne.integerPart.substring(0,Ke).split("").filter(function(Ue){return x.indexOf(Ue)>-1}).length>0&&(Pe="D3090"),Ke=ne.fractionalPart.lastIndexOf(m.digit),Ke!==-1&&ne.fractionalPart.substring(Ke).split("").filter(function(Ue){return x.indexOf(Ue)>-1}).length>0&&(Pe="D3091");var rt=typeof ne.exponentPart=="string";if(rt&&ne.exponentPart.length>0&&(Se.indexOf(m.percent)!==-1||Se.indexOf(m["per-mille"])!==-1)&&(Pe="D3092"),rt&&(ne.exponentPart.length===0||ne.exponentPart.split("").filter(function(Ue){return x.indexOf(Ue)===-1}).length>0)&&(Pe="D3093"),Pe)throw{code:Pe,stack:new Error().stack}},ke=function(ne){var Pe=function(Ie,hr){for(var Wt=[],ut=Ie.indexOf(m["grouping-separator"]);ut!==-1;){var dr=(hr?Ie.substring(0,ut):Ie.substring(ut)).split("").filter(function(Rt){return x.indexOf(Rt)!==-1||Rt===m.digit}).length;Wt.push(dr),ut=ne.integerPart.indexOf(m["grouping-separator"],ut+1)}return Wt},He=Pe(ne.integerPart),Se=function(Ie){if(Ie.length===0)return 0;for(var hr=function(dr,Rt){return Rt===0?dr:hr(Rt,dr%Rt)},Wt=Ie.reduce(hr),ut=1;ut<=Ie.length;ut++)if(Ie.indexOf(ut*Wt)===-1)return 0;return Wt},Ye=Se(He),mt=Pe(ne.fractionalPart,!0),Xe=ne.integerPart.split("").filter(function(Ie){return x.indexOf(Ie)!==-1}).length,wt=Xe,Ke=ne.fractionalPart.split(""),rt=Ke.filter(function(Ie){return x.indexOf(Ie)!==-1}).length,Ue=Ke.filter(function(Ie){return x.indexOf(Ie)!==-1||Ie===m.digit}).length,Ze=typeof ne.exponentPart=="string";Xe===0&&Ue===0&&(Ze?(rt=1,Ue=1):Xe=1),Ze&&Xe===0&&ne.integerPart.indexOf(m.digit)!==-1&&(Xe=1),Xe===0&&rt===0&&(rt=1);var Cn=0;return Ze&&(Cn=ne.exponentPart.split("").filter(function(Ie){return x.indexOf(Ie)!==-1}).length),{integerPartGroupingPositions:He,regularGrouping:Ye,minimumIntegerPartSize:Xe,scalingFactor:wt,prefix:ne.prefix,fractionalPartGroupingPositions:mt,minimumFactionalPartSize:rt,maximumFactionalPartSize:Ue,minimumExponentSize:Cn,suffix:ne.suffix,picture:ne.subpicture}},Me=W.map(Ae);Me.forEach(xe);var be=Me.map(ke),De=m["minus-sign"],et=m["zero-digit"],qe=m["decimal-separator"],st=m["grouping-separator"];be.length===1&&(be.push(JSON.parse(JSON.stringify(be[0]))),be[1].prefix=De+be[1].prefix);var Oe;i>=0?Oe=be[0]:Oe=be[1];var Gt;Oe.picture.indexOf(m.percent)!==-1?Gt=i*100:Oe.picture.indexOf(m["per-mille"])!==-1?Gt=i*1e3:Gt=i;var pt,Dt;if(Oe.minimumExponentSize===0)pt=Gt;else{var ls=Math.pow(10,Oe.scalingFactor),fs=Math.pow(10,Oe.scalingFactor-1);if(pt=Gt,Dt=0,pt!==0){for(;Math.abs(pt)<fs;)pt*=10,Dt-=1;for(;Math.abs(pt)>ls;)pt/=10,Dt+=1}}var hs=L(pt,Oe.maximumFactionalPartSize),Pn=function(ne,Pe){var He=Math.abs(ne).toFixed(Pe);return et!=="0"&&(He=He.split("").map(function(Se){return Se>="0"&&Se<="9"?x[Se.charCodeAt(0)-48]:Se}).join("")),He},oe=Pn(hs,Oe.maximumFactionalPartSize),ze=oe.indexOf(".");for(ze===-1?oe=oe+qe:oe=oe.replace(".",qe);oe.charAt(0)===et;)oe=oe.substring(1);for(;oe.charAt(oe.length-1)===et;)oe=oe.substring(0,oe.length-1);ze=oe.indexOf(qe);var Vt=Oe.minimumIntegerPartSize-ze,Tn=Oe.minimumFactionalPartSize-(oe.length-ze-1);if(oe=(Vt>0?new Array(Vt+1).join(et):"")+oe,oe=oe+(Tn>0?new Array(Tn+1).join(et):""),ze=oe.indexOf(qe),Oe.regularGrouping>0)for(var ds=Math.floor((ze-1)/Oe.regularGrouping),lr=1;lr<=ds;lr++)oe=[oe.slice(0,ze-lr*Oe.regularGrouping),st,oe.slice(ze-lr*Oe.regularGrouping)].join("");else Oe.integerPartGroupingPositions.forEach(function(ne){oe=[oe.slice(0,ze-ne),st,oe.slice(ze-ne)].join(""),ze++});if(ze=oe.indexOf(qe),Oe.fractionalPartGroupingPositions.forEach(function(ne){oe=[oe.slice(0,ne+ze+1),st,oe.slice(ne+ze+1)].join("")}),ze=oe.indexOf(qe),(Oe.picture.indexOf(qe)===-1||ze===oe.length-1)&&(oe=oe.substring(0,oe.length-1)),typeof Dt<"u"){var fr=Pn(Dt,0);Vt=Oe.minimumExponentSize-fr.length,Vt>0&&(fr=new Array(Vt+1).join(et)+fr),oe=oe+m["exponent-separator"]+(Dt<0?De:"")+fr}return oe=Oe.prefix+oe+Oe.suffix,oe}}function D(i,a){if(!(typeof i>"u")){if(i=L(i),typeof a>"u"?a=10:a=L(a),a<2||a>36)throw{code:"D3100",stack:new Error().stack,value:a};var l=i.toString(a);return l}}function S(i){var a;if(!(typeof i>"u")){if(typeof i=="number")a=i;else if(typeof i=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(i)&&!isNaN(parseFloat(i))&&isFinite(i))a=parseFloat(i);else if(typeof i=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(i))a=Number(i);else if(i===!0)a=1;else if(i===!1)a=0;else throw{code:"D3030",value:i,stack:new Error().stack,index:1};return a}}function U(i){var a;if(!(typeof i>"u"))return a=Math.abs(i),a}function B(i){var a;if(!(typeof i>"u"))return a=Math.floor(i),a}function I(i){var a;if(!(typeof i>"u"))return a=Math.ceil(i),a}function L(i,a){var l;if(!(typeof i>"u")){if(a){var g=i.toString().split("e");i=+(g[0]+"e"+(g[1]?+g[1]+a:a))}l=Math.round(i);var m=l-i;return Math.abs(m)===.5&&Math.abs(l%2)===1&&(l=l-1),a&&(g=l.toString().split("e"),l=+(g[0]+"e"+(g[1]?+g[1]-a:-a))),Object.is(l,-0)&&(l=0),l}}function q(i){var a;if(!(typeof i>"u")){if(i<0)throw{stack:new Error().stack,code:"D3060",index:1,value:i};return a=Math.sqrt(i),a}}function K(i,a){var l;if(!(typeof i>"u")){if(l=Math.pow(i,a),!isFinite(l))throw{stack:new Error().stack,code:"D3061",index:1,value:i,exp:a};return l}}function he(){return Math.random()}function ue(i){if(!(typeof i>"u")){var a=!1;if(Array.isArray(i)){if(i.length===1)a=ue(i[0]);else if(i.length>1){var l=i.filter(function(g){return ue(g)});a=l.length>0}}else typeof i=="string"?i.length>0&&(a=!0):y(i)?i!==0&&(a=!0):i!==null&&typeof i=="object"&&!w(i)?o.keys(i).length>0&&(a=!0):typeof i=="boolean"&&i===!0&&(a=!0);return a}}function te(i){if(!(typeof i>"u"))return!ue(i)}function Z(i,a,l,g){var m=[a],x=N(i);return x>=2&&m.push(l),x>=3&&m.push(g),m}async function le(i,a){if(!(typeof i>"u")){for(var l=this.createSequence(),g=0;g<i.length;g++){var m=Z(a,i[g],g,i),x=await a.apply(this,m);typeof x<"u"&&l.push(x)}return l}}async function Q(i,a){if(!(typeof i>"u")){for(var l=this.createSequence(),g=0;g<i.length;g++){var m=i[g],x=Z(a,m,g,i),$=await a.apply(this,x);ue($)&&l.push(m)}return l}}async function Ne(i,a){if(!(typeof i>"u")){for(var l=!1,g,m=0;m<i.length;m++){var x=i[m],$=!0;if(typeof a<"u"){var j=Z(a,x,m,i),se=await a.apply(this,j);$=ue(se)}if($)if(!l)g=x,l=!0;else throw{stack:new Error().stack,code:"D3138",index:m}}if(!l)throw{stack:new Error().stack,code:"D3139"};return g}}function Qe(){for(var i=[],a=Array.prototype.slice.call(arguments),l=Math.min.apply(Math,a.map(function(x){return Array.isArray(x)?x.length:0})),g=0;g<l;g++){var m=a.map(x=>x[g]);i.push(m)}return i}async function je(i,a,l){if(!(typeof i>"u")){var g,m=N(a);if(m<2)throw{stack:new Error().stack,code:"D3050",index:1};var x;for(typeof l>"u"&&i.length>0?(g=i[0],x=1):(g=l,x=0);x<i.length;){var $=[g,i[x]];m>=3&&$.push(x),m>=4&&$.push(i),g=await a.apply(this,$),x++}return g}}function Le(i){var a=this.createSequence();if(Array.isArray(i)){for(var l=Object.create(null),g=0;g<i.length;g++){var m=Le.call(this,i[g]);m.forEach(function(x){l[x]=!0})}a=Le.call(this,l)}else i!==null&&typeof i=="object"&&!w(i)&&o.keys(i).forEach(x=>a.push(x));return a}function Be(i,a){var l;if(Array.isArray(i)){l=this.createSequence();for(var g=0;g<i.length;g++){var m=Be.call(this,i[g],a);typeof m<"u"&&(Array.isArray(m)?m.forEach(x=>l.push(x)):l.push(m))}}else i!==null&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,a)&&!w(i)&&(l=i[a]);return l}function ot(i,a){if(typeof i>"u")return a;if(typeof a>"u")return i;Array.isArray(i)||(i=this.createSequence(i)),Array.isArray(a)||(a=[a]);const l=i.length+a.length;if(this.options&&l>this.options.sequence)throw{code:"D2015",stack:new Error().stack,value:l};return i.concat(a)}function Tt(i){return!(typeof i>"u")}function Ct(i){var a=this.createSequence();if(Array.isArray(i))for(var l=0;l<i.length;l++)a=ot.call(this,a,Ct.call(this,i[l]));else if(i!==null&&typeof i=="object"&&!C(i))for(const m of o.keys(i)){var g=Object.create(null);g[m]=i[m],a.push(g)}else a=i;return a}function z(i){if(!(typeof i>"u")){var a=Object.create(null);return i.forEach(function(l){for(const g of o.keys(l))a[g]=l[g]}),a}}function ur(i){if(!(typeof i>"u")){if(i.length<=1)return i;for(var a=i.length,l=new Array(a),g=0;g<a;g++)l[a-g-1]=i[g];return l}}async function cr(i,a){var l=this.createSequence();for(const x of o.keys(i)){var g=Z(a,i[x],x,i),m=await a.apply(this,g);typeof m<"u"&&l.push(m)}return l}function tt(i){throw{code:"D3137",stack:new Error().stack,message:i||"$error() function evaluated"}}function Ht(i,a){if(!i)throw{code:"D3141",stack:new Error().stack,message:a||"$assert() statement failed"}}function it(i){if(i!==void 0)return i===null?"null":y(i)?"number":typeof i=="string"?"string":typeof i=="boolean"?"boolean":Array.isArray(i)?"array":w(i)?"function":"object"}async function yt(i,a){if(!(typeof i>"u")){if(i.length<=1)return i;var l;if(typeof a>"u"){if(!M(i)&&!P(i))throw{stack:new Error().stack,code:"D3070",index:1};l=async function($,j){return $>j}}else l=a;var g=async function($,j){var se=async function(Ae,xe,ke){xe.length===0?Array.prototype.push.apply(Ae,ke):ke.length===0?Array.prototype.push.apply(Ae,xe):await l(xe[0],ke[0])?(Ae.push(ke[0]),await se(Ae,xe,ke.slice(1))):(Ae.push(xe[0]),await se(Ae,xe.slice(1),ke))},W=[];return await se(W,$,j),W},m=async function($){if(!Array.isArray($)||$.length<=1)return $;var j=Math.floor($.length/2),se=$.slice(0,j),W=$.slice(j);return se=await m(se),W=await m(W),await g(se,W)},x=await m(i);return x}}function c(i){if(!(typeof i>"u")){if(i.length<=1)return i;for(var a=new Array(i.length),l=0;l<i.length;l++){var g=Math.floor(Math.random()*(l+1));l!==g&&(a[l]=a[g]),a[g]=i[l]}return a}}function f(i){if(!(typeof i>"u")){if(!Array.isArray(i)||i.length<=1)return i;for(var a=k(i)?this.createSequence():[],l=0;l<i.length;l++){for(var g=i[l],m=!1,x=0;x<a.length;x++)if(ee(g,a[x])){m=!0;break}m||a.push(g)}return a}}async function d(i,a){var l=Object.create(null);for(const $ of o.keys(i)){var g=i[$],m=Z(a,g,$,i),x=await a.apply(this,m);ue(x)&&(l[$]=g)}return o.keys(l).length===0&&(l=void 0),l}return{sum:E,count:v,max:O,min:A,average:T,string:H,substring:F,substringBefore:re,substringAfter:ae,lowercase:Ee,uppercase:ve,length:pe,trim:Te,pad:Je,match:We,contains:me,replace:ie,split:_e,join:we,formatNumber:_,formatBase:D,number:S,floor:B,ceil:I,round:L,abs:U,sqrt:q,power:K,random:he,boolean:ue,not:te,map:le,zip:Qe,filter:Q,single:Ne,foldLeft:je,sift:d,keys:Le,lookup:Be,append:ot,exists:Tt,spread:Ct,merge:z,reverse:ur,each:cr,error:tt,assert:Ht,type:it,sort:yt,shuffle:c,distinct:f,base64encode:Ce,base64decode:nt,encodeUrlComponent:h,encodeUrl:b,decodeUrlComponent:G,decodeUrl:fe}})();r.exports=p}).call(this)}).call(this,typeof cn<"u"?cn:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(t,r,s){var u=t("./datetime"),o=t("./functions"),p=t("./utils"),y=t("./parser"),P=t("./signature"),M=(function(){var k=p.isNumeric,w=p.isArrayOfStrings,C=p.isArrayOfNumbers,R=p.isSequence,N=p.isFunction,ee=p.isLambda,J=p.isIterable,E=p.isPromise,v=p.getFunctionArity,O=p.isDeepEqual,A=tt(null);async function T(c,f,d){var i;d.base.depth++,d.base.guardrails();var a=d.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(a&&await a(c,f,d),c.type){case"path":i=await H(c,f,d);break;case"binary":i=await pe(c,f,d);break;case"unary":i=await Te(c,f,d);break;case"name":i=Je(c,f,d);break;case"string":case"number":case"value":i=ce(c);break;case"wildcard":i=me(c,f,d);break;case"descendant":i=ie(c,f,d);break;case"parent":i=d.lookup(c.slot.label);break;case"condition":i=await B(c,f,d);break;case"block":i=await I(c,f,d);break;case"bind":i=await U(c,f,d);break;case"regex":i=L(c,f,d);break;case"function":i=await Z(c,f,d);break;case"variable":i=q(c,f,d);break;case"lambda":i=Ne(c,f,d);break;case"partial":i=await Qe(c,f,d);break;case"apply":i=await te(c,f,d);break;case"transform":i=he(c,f,d);break}if(Object.prototype.hasOwnProperty.call(c,"predicate"))for(var l=0;l<c.predicate.length;l++)i=await ve(c.predicate[l].expr,i,d);c.type!=="path"&&Object.prototype.hasOwnProperty.call(c,"group")&&(i=await _(c.group,i,d));var g=d.lookup(Symbol.for("jsonata.__evaluate_exit"));return g&&await g(c,f,d,i),i&&R(i)&&!i.tupleStream&&(c.keepArray&&(i.keepSingleton=!0),i.length===0?i=void 0:i.length===1&&(i=i.keepSingleton?i:i[0])),d.base.depth--,i}async function H(c,f,d){var i;Array.isArray(f)&&c.steps[0].type!=="variable"?i=f:i=d.base.createSequence(f);for(var a,l=!1,g=void 0,m=0;m<c.steps.length;m++){var x=c.steps[m];if(x.tuple&&(l=!0),m===0&&x.consarray?a=await T(x,i,d):l?g=await Ee(x,i,g,d):a=await re(x,i,d,m===c.steps.length-1),!l&&(typeof a>"u"||a.length===0))break;typeof x.focus>"u"&&(i=a)}if(l)if(c.tuple)a=g;else for(a=d.base.createSequence(),m=0;m<g.length;m++)a.push(g[m]["@"]);return c.keepSingletonArray&&(Array.isArray(a)&&a.cons&&!a.sequence&&(a=d.base.createSequence(a)),a.keepSingleton=!0),Object.prototype.hasOwnProperty.call(c,"group")&&(a=await _(c.group,l?g:a,d)),a}function F(c,f){var d=tt(c);for(const i of p.keys(f))d.bind(i,f[i]);return d}async function re(c,f,d,i){var a;if(c.type==="sort")return a=await K(c,f,d),c.stages&&(a=await ae(c.stages,a,d)),a;a=d.base.createSequence();for(var l=0;l<f.length;l++){var g=await T(c,f[l],d);if(c.stages)for(var m=0;m<c.stages.length;m++)g=await ve(c.stages[m].expr,g,d);typeof g<"u"&&a.push(g)}var x=d.base.createSequence();return i&&a.length===1&&Array.isArray(a[0])&&!R(a[0])?x=a[0]:Array.prototype.forEach.call(a,function($){!Array.isArray($)||$.cons?x.push($):Array.prototype.forEach.call($,j=>x.push(j))}),x}async function ae(c,f,d){for(var i=f,a=0;a<c.length;a++){var l=c[a];switch(l.type){case"filter":i=await ve(l.expr,i,d);break;case"index":for(var g=0;g<i.length;g++){var m=i[g];m[l.value]=g}break}}return i}async function Ee(c,f,d,i){var a;if(c.type==="sort"){if(d)a=await K(c,d,i);else{var l=await K(c,f,i);a=i.base.createSequence(),a.tupleStream=!0;for(var g=0;g<l.length;g++){var m={"@":l[g]};m[c.index]=g,a.push(m)}}return c.stages&&(a=await ae(c.stages,a,i)),a}a=i.base.createSequence(),a.tupleStream=!0;var x=i;d===void 0&&(d=f.map(W=>({"@":W})));for(var $=0;$<d.length;$++){x=F(i,d[$]);var j=await T(c,d[$]["@"],x);if(typeof j<"u"){Array.isArray(j)||(j=[j]);for(var se=0;se<j.length;se++)m=Object.create(null),Object.assign(m,d[$]),j.tupleStream?Object.assign(m,j[se]):(c.focus?(m[c.focus]=j[se],m["@"]=d[$]["@"]):m["@"]=j[se],c.index&&(m[c.index]=se),c.ancestor&&(m[c.ancestor.label]=d[$]["@"])),a.push(m)}}return c.stages&&(a=await ae(c.stages,a,i)),a}async function ve(c,f,d){var i=d.base.createSequence();if(f&&f.tupleStream&&(i.tupleStream=!0),Array.isArray(f)||(f=d.base.createSequence(f)),c.type==="number"){var a=Math.floor(c.value);a<0&&(a=f.length+a);var l=await f[a];typeof l<"u"&&(Array.isArray(l)?i=l:i.push(l))}else for(a=0;a<f.length;a++){var l=f[a],g=l,m=d;f.tupleStream&&(g=l["@"],m=F(d,l));var x=await T(c,g,m);k(x)&&(x=[x]),C(x)?Array.prototype.forEach.call(x,function(j){var se=Math.floor(j);se<0&&(se=f.length+se),se===a&&i.push(l)}):o.boolean(x)&&i.push(l)}return i}async function pe(c,f,d){var i,a=await T(c.lhs,f,d),l=c.value,g=async()=>await T(c.rhs,f,d);if(l==="and"||l==="or")try{return await fe(a,g,l)}catch(x){throw x.position=c.position,x.token=l,x}var m=await g();try{switch(l){case"+":case"-":case"*":case"/":case"%":i=nt(a,m,l);break;case"=":case"!=":i=h(a,m,l);break;case"<":case"<=":case">":case">=":i=b(a,m,l);break;case"&":i=we(a,m);break;case"..":i=S(a,m,d);break;case"in":i=G(a,m);break}}catch(x){throw x.position=c.position,x.token=l,x}return i}async function Te(c,f,d){var i,a={options:d.base.options,createSequence:d.base.createSequence};switch(c.value){case"-":if(i=await T(c.expression,f,d),typeof i>"u")i=void 0;else if(k(i))i=-i;else throw{code:"D1002",stack:new Error().stack,position:c.position,token:c.value,value:i};break;case"[":i=[];let m=await Promise.all(c.expressions.map(async(x,$)=>(d.isParallelCall=$>0,[x,await T(x,f,d)])));for(let x of m){var[l,g]=x;typeof g<"u"&&(l.value==="["?i.push(g):i=o.append.call(a,i,g))}c.consarray&&Object.defineProperty(i,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":i=await _(c,f,d);break}return i}function Je(c,f,d){var i={createSequence:d.base.createSequence};return o.lookup.call(i,f,c.value)}function ce(c){return c.value}function me(c,f,d){var i={options:d.base.options,createSequence:d.base.createSequence},a=i.createSequence();return Array.isArray(f)&&f.outerWrapper&&f.length>0&&(f=f[0]),f!==null&&typeof f=="object"&&!N(f)&&p.keys(f).forEach(function(l){var g=f[l];Array.isArray(g)?(g=We(g),a=o.append.call(i,a,g)):a.push(g)}),a}function We(c,f){return typeof f>"u"&&(f=[]),Array.isArray(c)?Array.prototype.forEach.call(c,function(d){We(d,f)}):f.push(c),f}function ie(c,f,d){var i,a=d.base.createSequence();return typeof f<"u"&&(Ce(f,a),a.length===1?i=a[0]:i=a),i}function Ce(c,f){Array.isArray(c)||f.push(c),Array.isArray(c)?Array.prototype.forEach.call(c,function(d){Ce(d,f)}):c!==null&&typeof c=="object"&&!N(c)&&p.keys(c).forEach(function(d){Ce(c[d],f)})}function nt(c,f,d){var i;if(typeof c<"u"&&!k(c))throw{code:"T2001",stack:new Error().stack,value:c};if(typeof f<"u"&&!k(f))throw{code:"T2002",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u")return i;switch(d){case"+":i=c+f;break;case"-":i=c-f;break;case"*":i=c*f;break;case"/":i=c/f;break;case"%":i=c%f;break}return i}function h(c,f,d){var i,a=typeof c,l=typeof f;if(a==="undefined"||l==="undefined")return!1;switch(d){case"=":i=O(c,f);break;case"!=":i=!O(c,f);break}return i}function b(c,f,d){var i,a=typeof c,l=typeof f,g=a==="undefined"||a==="string"||a==="number",m=l==="undefined"||l==="string"||l==="number";if(!g||!m)throw{code:"T2010",stack:new Error().stack,value:a==="string"||a==="number"?f:c};if(!(a==="undefined"||l==="undefined")){if(a!==l)throw{code:"T2009",stack:new Error().stack,value:c,value2:f};switch(d){case"<":i=c<f;break;case"<=":i=c<=f;break;case">":i=c>f;break;case">=":i=c>=f;break}return i}}function G(c,f){var d=!1;if(typeof c>"u"||typeof f>"u")return!1;Array.isArray(f)||(f=[f]);for(var i=0;i<f.length;i++)if(f[i]===c){d=!0;break}return d}async function fe(c,f,d){var i,a=_e(c);switch(d){case"and":i=a&&_e(await f());break;case"or":i=a||_e(await f());break}return i}function _e(c){var f=o.boolean(c);return typeof f>"u"?!1:f}function we(c,f){var d,i="",a="";return typeof c<"u"&&(i=o.string(c)),typeof f<"u"&&(a=o.string(f)),d=i.concat(a),d}async function _(c,f,d){var i=Object.create(null),a=Object.create(null),l=!!(f&&f.tupleStream),g={options:d.base.options,createSequence:d.base.createSequence};Array.isArray(f)||(d.base.options,f=g.createSequence(f)),f.length===0&&!l&&f.push(void 0);for(var m=0;m<f.length;m++)for(var x=f[m],$=l?F(d,x):d,j=0;j<c.lhs.length;j++){var se=c.lhs[j],W=await T(se[0],l?x["@"]:x,$);if(typeof W!="string"&&W!==void 0)throw{code:"T1003",stack:new Error().stack,position:c.position,value:W};if(W!==void 0){if(W==="_jsonata_lambda"||W==="_jsonata_function")throw{code:"D1013",stack:new Error().stack,position:c.position,value:W};var Ae={data:x,exprIndex:j};if(Object.prototype.hasOwnProperty.call(a,W)){if(a[W].exprIndex!==j)throw{code:"D1009",stack:new Error().stack,position:c.position,value:W};a[W].data=o.append.call(g,a[W].data,x)}else a[W]=Ae}}let xe=await Promise.all(p.keys(a).map(async(Me,be)=>{let De=a[Me];var et=De.data,qe=d;if(l){var st=D(De.data,d);et=st["@"],delete st["@"],qe=F(d,st)}return d.isParallelCall=be>0,[Me,await T(c.lhs[De.exprIndex][1],et,qe)]}));for(let Me of xe){var[W,ke]=await Me;typeof ke<"u"&&(i[W]=ke)}return i}function D(c,f){if(!Array.isArray(c))return c;var d=Object.create(null),i={options:f.base.options,createSequence:f.base.createSequence};Object.assign(d,c[0]);for(var a=1;a<c.length;a++)for(const l of p.keys(c[a]))d[l]=o.append.call(i,d[l],c[a][l]);return d}function S(c,f,d){var i;if(typeof c<"u"&&!Number.isInteger(c))throw{code:"T2003",stack:new Error().stack,value:c};if(typeof f<"u"&&!Number.isInteger(f))throw{code:"T2004",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u"||c>f)return i;var a=f-c+1;if(a>1e7)throw{code:"D2014",stack:new Error().stack,value:a};if(d.base.options&&a>d.base.options.sequence)throw{code:"D2015",stack:new Error().stack,value:a};i=new Array(a);for(var l=c,g=0;l<=f;l++,g++)i[g]=l;return i.sequence=!0,i}async function U(c,f,d){var i=await T(c.rhs,f,d);return d.bind(c.lhs.value,i),i}async function B(c,f,d){var i,a=await T(c.condition,f,d);return o.boolean(a)?i=await T(c.then,f,d):typeof c.else<"u"&&(i=await T(c.else,f,d)),i}async function I(c,f,d){for(var i,a=tt(d),l=0;l<c.expressions.length;l++)i=await T(c.expressions[l],f,a);return i}function L(c,f,d){var i=new d.base.RegexEngine(c.value),a=function(l,g){var m;i.lastIndex=g||0;var x=i.exec(l);if(x!==null){if(m={match:x[0],start:x.index,end:x.index+x[0].length,groups:[]},x.length>1)for(var $=1;$<x.length;$++)m.groups.push(x[$]);m.next=function(){if(!(i.lastIndex>=l.length)){var j=a(l,i.lastIndex);if(j&&j.match==="")throw{code:"D1004",stack:new Error().stack,position:c.position,value:c.value.source};return j}}}return m};return a}function q(c,f,d){var i;return c.value===""?i=f&&f.outerWrapper?f[0]:f:i=d.lookup(c.value),i}async function K(c,f,d){var i,a=f,l=!!f.tupleStream,g=async function(x,$){for(var j=0,se=0;j===0&&se<c.terms.length;se++){var W=c.terms[se],Ae=x,xe=d;l&&(Ae=x["@"],xe=F(d,x));var ke=await T(W.expression,Ae,xe);Ae=$,xe=d,l&&(Ae=$["@"],xe=F(d,$));var Me=await T(W.expression,Ae,xe),be=typeof ke,De=typeof Me;if(be==="undefined"){j=De==="undefined"?0:1;continue}if(De==="undefined"){j=-1;continue}if(!(be==="string"||be==="number")||!(De==="string"||De==="number"))throw{code:"T2008",stack:new Error().stack,position:c.position,value:be==="string"||be==="number"?Me:ke};if(be!==De)throw{code:"T2007",stack:new Error().stack,position:c.position,value:ke,value2:Me};ke!==Me&&(ke<Me?j=-1:j=1,W.descending===!0&&(j=-j))}return j===1},m={environment:d,input:f};return i=await o.sort.apply(m,[a,g]),i}function he(c,f,d){var i=async function(a){if(!(typeof a>"u")){var l=d.lookup("clone");if(!N(l))throw{code:"T2013",stack:new Error().stack,position:c.position};var g=await le(l,[a],null,d),m=await T(c.pattern,g,d);if(typeof m<"u"){Array.isArray(m)||(m=[m]);for(var x=0;x<m.length;x++){var $=m[x],j=await T(c.update,$,d),se=typeof j;if(se!=="undefined"){if(se!=="object"||j===null||Array.isArray(j))throw{code:"T2011",stack:new Error().stack,position:c.update.position,value:j};for(const ke of p.keys(j))$[ke]=j[ke]}if(typeof c.delete<"u"){var W=await T(c.delete,$,d);if(typeof W<"u"){var Ae=W;if(Array.isArray(W)||(W=[W]),!w(W))throw{code:"T2012",stack:new Error().stack,position:c.delete.position,value:Ae};for(var xe=0;xe<W.length;xe++)typeof $=="object"&&$!==null&&delete $[W[xe]]}}}}return g}};return z(i,"<(oa):o>")}var ue=y("function($f, $g) { function($x){ $g($f($x)) } }");async function te(c,f,d){var i,a=await T(c.lhs,f,d);if(c.rhs.type==="function")i=await Z(c.rhs,f,d,{context:a});else{var l=await T(c.rhs,f,d);if(!N(l))throw{code:"T2006",stack:new Error().stack,position:c.position,value:l};if(N(a)){var g=await T(ue,null,d);i=await le(g,[a,l],null,d)}else i=await le(l,[a],null,d)}return i}async function Z(c,f,d,i){var a,l=await T(c.procedure,f,d);if(typeof l>"u"&&c.procedure.type==="path"&&d.lookup(c.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};var g=[];typeof i<"u"&&g.push(i.context);for(var m=0;m<c.arguments.length;m++){const $=await T(c.arguments[m],f,d);if(N($)){const j=async function(...se){return await le($,se,null,d)};j.arity=v($),g.push(j)}else g.push($)}var x=c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value;try{typeof l=="object"&&(l.token=x,l.position=c.position),a=await le(l,g,f,d)}catch($){throw $.position||($.position=c.position),$.token||($.token=x),$}return a}async function le(c,f,d,i){var a;for(a=await Q(c,f,d,i);ee(a)&&a.thunk===!0;){var l=await T(a.body.procedure,a.input,a.environment);a.body.procedure.type==="variable"&&(l.token=a.body.procedure.value),l.position=a.body.procedure.position;for(var g=[],m=0;m<a.body.arguments.length;m++)g.push(await T(a.body.arguments[m],a.input,a.environment));a=await Q(l,g,d,i)}return a}async function Q(c,f,d,i){var a;try{var l=f;if(c&&(l=je(c.signature,f,d)),ee(c))a=await Le(c,l);else if(c&&c._jsonata_function===!0){var g={environment:i,input:d,options:i.base.options,createSequence:i.base.createSequence};a=c.implementation.apply(g,l),J(a)&&(a=a.next().value),E(a)&&(a=await a)}else if(typeof c=="function")a=c.apply(d,l),E(a)&&(a=await a);else throw{code:"T1006",stack:new Error().stack}}catch(m){throw c&&(typeof m.token>"u"&&typeof c.token<"u"&&(m.token=c.token),m.position=c.position||m.position),m}return a}function Ne(c,f,d){var i={_jsonata_lambda:!0,input:f,environment:d,arguments:c.arguments,signature:c.signature,body:c.body};return c.thunk===!0&&(i.thunk=!0),i.apply=async function(a,l){return await le(i,l,f,a?a.environment:d)},i}async function Qe(c,f,d){for(var i,a=[],l=0;l<c.arguments.length;l++){var g=c.arguments[l];g.type==="operator"&&g.value==="?"?a.push(g):a.push(await T(g,f,d))}var m=await T(c.procedure,f,d);if(typeof m>"u"&&c.procedure.type==="path"&&d.lookup(c.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};if(ee(m))i=Be(m,a,d);else if(m&&m._jsonata_function===!0)i=ot(m.implementation,a,d);else if(typeof m=="function")i=ot(m,a,d);else throw{code:"T1008",stack:new Error().stack,position:c.position,token:c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value};return i}function je(c,f,d){if(typeof c>"u")return f;var i=c.validate(f,d);return i}async function Le(c,f){var d,i=tt(c.environment);return Array.prototype.forEach.call(c.arguments,function(a,l){i.bind(a.value,f[l])}),typeof c.body=="function"?d=await Tt(c.body,i):d=await T(c.body,c.input,i),d}function Be(c,f,d){var i=tt(c.environment||d),a=[];Array.prototype.forEach.call(c.arguments,function(g,m){var x=f[m];x&&x.type==="operator"&&x.value==="?"?a.push(g):i.bind(g.value,x)});var l={_jsonata_lambda:!0,input:c.input,environment:i,arguments:a,body:c.body};return l}function ot(c,f,d){var i=Ct(c);i=i.map(function(m){return"$"+m.trim()});var a="function("+i.join(", ")+"){ _ }",l=y(a);l.body=c;var g=Be(l,f,d);return g}async function Tt(c,f){var d=Ct(c),i=d.map(function(g){return f.lookup(g.trim())}),a={environment:f,createSequence:f.base.createSequence},l=c.apply(a,i);return E(l)&&(l=await l),l}function Ct(c){var f=c.toString(),d=/\(([^)]*)\)/.exec(f)[1],i=d.split(",");return i}function z(c,f){var d={_jsonata_function:!0,implementation:c};return typeof f<"u"&&(d.signature=P(f)),d}async function ur(c,f){if(!(typeof c>"u")){var d=this.input;typeof f<"u"&&(d=f,Array.isArray(d)&&!R(d)&&(d=this.createSequence(d),d.outerWrapper=!0));try{var i=y(c,!1)}catch(l){throw it(l),{stack:new Error().stack,code:"D3120",value:l.message,error:l}}try{var a=await T(i,d,this.environment)}catch(l){throw it(l),{stack:new Error().stack,code:"D3121",value:l.message,error:l}}return a}}function cr(c){if(!(typeof c>"u"))return JSON.parse(o.string(c))}function tt(c){var f=Object.create(null);const d={bind:function(a,l){f[a]=l},lookup:function(a){var l;return Object.prototype.hasOwnProperty.call(f,a)?l=f[a]:c&&(l=c.lookup(a)),l},timestamp:c?c.timestamp:null,async:c?c.async:!1,isParallelCall:c?c.isParallelCall:!1,global:c?c.global:{ancestry:[null]}};if(c){var i=c.lookup(Symbol.for("jsonata.__createFrame_push"));i&&i(c,d),d.base=c.base}return d}A.bind("sum",z(o.sum,"<a<n>:n>")),A.bind("count",z(o.count,"<a:n>")),A.bind("max",z(o.max,"<a<n>:n>")),A.bind("min",z(o.min,"<a<n>:n>")),A.bind("average",z(o.average,"<a<n>:n>")),A.bind("string",z(o.string,"<x-b?:s>")),A.bind("substring",z(o.substring,"<s-nn?:s>")),A.bind("substringBefore",z(o.substringBefore,"<s-s:s>")),A.bind("substringAfter",z(o.substringAfter,"<s-s:s>")),A.bind("lowercase",z(o.lowercase,"<s-:s>")),A.bind("uppercase",z(o.uppercase,"<s-:s>")),A.bind("length",z(o.length,"<s-:n>")),A.bind("trim",z(o.trim,"<s-:s>")),A.bind("pad",z(o.pad,"<s-ns?:s>")),A.bind("match",z(o.match,"<s-f<s:o>n?:a<o>>")),A.bind("contains",z(o.contains,"<s-(sf):b>")),A.bind("replace",z(o.replace,"<s-(sf)(sf)n?:s>")),A.bind("split",z(o.split,"<s-(sf)n?:a<s>>")),A.bind("join",z(o.join,"<a<s>s?:s>")),A.bind("formatNumber",z(o.formatNumber,"<n-so?:s>")),A.bind("formatBase",z(o.formatBase,"<n-n?:s>")),A.bind("formatInteger",z(u.formatInteger,"<n-s:s>")),A.bind("parseInteger",z(u.parseInteger,"<s-s:n>")),A.bind("number",z(o.number,"<(nsb)-:n>")),A.bind("floor",z(o.floor,"<n-:n>")),A.bind("ceil",z(o.ceil,"<n-:n>")),A.bind("round",z(o.round,"<n-n?:n>")),A.bind("abs",z(o.abs,"<n-:n>")),A.bind("sqrt",z(o.sqrt,"<n-:n>")),A.bind("power",z(o.power,"<n-n:n>")),A.bind("random",z(o.random,"<:n>")),A.bind("boolean",z(o.boolean,"<x-:b>")),A.bind("not",z(o.not,"<x-:b>")),A.bind("map",z(o.map,"<af>")),A.bind("zip",z(o.zip,"<a+>")),A.bind("filter",z(o.filter,"<af>")),A.bind("single",z(o.single,"<af?>")),A.bind("reduce",z(o.foldLeft,"<afj?:j>")),A.bind("sift",z(o.sift,"<o-f?:o>")),A.bind("keys",z(o.keys,"<x-:a<s>>")),A.bind("lookup",z(o.lookup,"<x-s:x>")),A.bind("append",z(o.append,"<xx:a>")),A.bind("exists",z(o.exists,"<x:b>")),A.bind("spread",z(o.spread,"<x-:a<o>>")),A.bind("merge",z(o.merge,"<a<o>:o>")),A.bind("reverse",z(o.reverse,"<a:a>")),A.bind("each",z(o.each,"<o-f:a>")),A.bind("error",z(o.error,"<s?:x>")),A.bind("assert",z(o.assert,"<bs?:x>")),A.bind("type",z(o.type,"<x:s>")),A.bind("sort",z(o.sort,"<af?:a>")),A.bind("shuffle",z(o.shuffle,"<a:a>")),A.bind("distinct",z(o.distinct,"<x:x>")),A.bind("base64encode",z(o.base64encode,"<s-:s>")),A.bind("base64decode",z(o.base64decode,"<s-:s>")),A.bind("encodeUrlComponent",z(o.encodeUrlComponent,"<s-:s>")),A.bind("encodeUrl",z(o.encodeUrl,"<s-:s>")),A.bind("decodeUrlComponent",z(o.decodeUrlComponent,"<s-:s>")),A.bind("decodeUrl",z(o.decodeUrl,"<s-:s>")),A.bind("eval",z(ur,"<sx?:x>")),A.bind("toMillis",z(u.toMillis,"<s-s?:n>")),A.bind("fromMillis",z(u.fromMillis,"<n-s?s?:s>")),A.bind("clone",z(cr,"<(oa)-:o>"));var Ht={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",D1011:"Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive",D1012:"Evaluation timeout after {{value}} milliseconds. Check for infinite loop",D1013:"Object property names starting with _jsonata_ are reserved for internal use: {{value}}",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.",D2015:"The maximum sequence length of {{value}} was exceeded.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function it(c){var f=Ht[c.code];if(typeof f<"u"){var d=f.replace(/\{\{\{([^}]+)}}}/g,function(){return c[arguments[1]]});d=d.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(c[arguments[1]])}),c.message=d}}function yt(c,f){var d,i;try{d=y(c,f&&f.recover),i=d.errors,delete d.errors}catch(g){throw it(g),g}var a=tt(A),l=new Date;return a.bind("now",z(function(g,m){return u.fromMillis(l.getTime(),g,m)},"<s?s?:s>")),a.bind("millis",z(function(){return l.getTime()},"<:n>")),{evaluate:async function(g,m,x){if(typeof i<"u"){var $={code:"S0500",position:0};throw it($),$}const j=tt(a);for(const W of p.keys(m))j.bind(W,m[W]);if(j.bind("$",g),l=new Date,j.timestamp=l,j.options=f,j.createSequence=function(){var W=[];return f&&f.sequence&&(W.push=function(...Ae){if(W.length+Ae.length>f.sequence)throw{code:"D2015",stack:new Error().stack,value:f.sequence};return Array.prototype.push.apply(W,Ae)}),W.sequence=!0,arguments.length===1&&W.push(arguments[0]),W},Array.isArray(g)&&!R(g)&&(g=j.createSequence(g),g.outerWrapper=!0),f&&(f.timeout||f.stack)){const W=Date.now();j.guardrails=function(){if(f.stack>0&&j.depth>f.stack)throw{code:"D1011",value:f.stack,stack:new Error().stack};if(f.timeout>0&&Date.now()-W>f.timeout)throw{code:"D1012",value:f.timeout,stack:new Error().stack}}}else j.guardrails=function(){};j.base=j,j.depth=0,f&&f.RegexEngine?j.RegexEngine=f.RegexEngine:j.RegexEngine=RegExp;var se;try{return se=await T(d,g,j),typeof x=="function"&&x(null,se),se}catch(W){throw it(W),W}},assign:function(g,m){a.bind(g,m)},registerFunction:function(g,m,x){var $=z(m,x);a.bind(g,$)},ast:function(){return d},errors:function(){return i}}}return yt.parser=y,yt})();r.exports=M},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(t,r,s){var u=t("./signature");const o=(()=>{var p={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},y={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
32
|
-
`,r:"\r",t:" "},
|
|
33
|
-
\r\v`.indexOf(
|
|
34
|
-
\r\v`.indexOf(Te)>-1||Object.prototype.hasOwnProperty.call(p,Te)){if(k.charAt(w)==="$")return Ee=k.substring(w+1,pe),w=pe,R("variable",Ee);switch(Ee=k.substring(w,pe),w=pe,Ee){case"or":case"in":case"and":return R("operator",Ee);case"true":return R("value",!0);case"false":return R("value",!1);case"null":return R("value",null);default:return w===C&&Ee===""?null:R("name",Ee)}}else pe++};return ee},M=function(k,w){var C,R,N=Object.create(null),ee=[],J=function(){var h=[];C.id!=="(end)"&&h.push({type:C.type,value:C.value,position:C.position});for(var b=R();b!==null;)h.push(b),b=R();return h},E={nud:function(){var h={code:"S0211",token:this.value,position:this.position};if(w)return h.remaining=J(),h.type="error",ee.push(h),h;throw h.stack=new Error().stack,h}},v=function(h,b){var G=N[h];return b=b||0,G?b>=G.lbp&&(G.lbp=b):(G=Object.create(E),G.id=G.value=h,G.lbp=b,N[h]=G),G},O=function(h){if(w){h.remaining=J(),ee.push(h);var b=N["(error)"];return C=Object.create(b),C.error=h,C.type="(error)",C}else throw h.stack=new Error().stack,h},A=function(h,b){if(h&&C.id!==h){var G;C.id==="(end)"?G="S0203":G="S0202";var fe={code:G,position:C.position,token:C.value,value:h};return O(fe)}var _e=R(b);if(_e===null)return C=N["(end)"],C.position=k.length,C;var we=_e.value,_=_e.type,D;switch(_){case"name":case"variable":D=N["(name)"];break;case"operator":if(D=N[we],!D)return O({code:"S0204",stack:new Error().stack,position:_e.position,token:we});break;case"string":case"number":case"value":D=N["(literal)"];break;case"regex":_="regex",D=N["(regex)"];break;default:return O({code:"S0205",stack:new Error().stack,position:_e.position,token:we})}return C=Object.create(D),C.value=we,C.type=_,C.position=_e.position,C},T=function(h){var b,G=C;for(A(null,!0),b=G.nud();h<C.lbp;)G=C,A(),b=G.led(b);return b},H=function(h){var b=v(h,0);b.nud=function(){return this}},F=function(h,b,G){var fe=b||p[h],_e=v(h,fe);return _e.led=G||function(we){return this.lhs=we,this.rhs=T(fe),this.type="binary",this},_e},re=function(h,b,G){var fe=v(h,b);return fe.led=G,fe},ae=function(h,b){var G=v(h);return G.nud=b||function(){return this.expression=T(70),this.type="unary",this},G};H("(end)"),H("(name)"),H("(literal)"),H("(regex)"),v(":"),v(";"),v(","),v(")"),v("]"),v("}"),v(".."),F("."),F("+"),F("-"),F("*"),F("/"),F("%"),F("="),F("<"),F(">"),F("!="),F("<="),F(">="),F("&"),F("and"),F("or"),F("in"),H("and"),H("or"),H("in"),ae("-"),F("~>"),F("??",p["??"],function(h){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[JSON.parse(JSON.stringify(h))]},this.then=h,this.else=T(0),this}),re("(error)",10,function(h){return this.lhs=h,this.error=C.error,this.remaining=J(),this.type="error",this}),ae("*",function(){return this.type="wildcard",this}),ae("**",function(){return this.type="descendant",this}),ae("%",function(){return this.type="parent",this}),F("(",p["("],function(h){if(this.procedure=h,this.type="function",this.arguments=[],C.id!==")")for(;C.type==="operator"&&C.id==="?"?(this.type="partial",this.arguments.push(C),A("?")):this.arguments.push(T(0)),C.id===",";)A(",");if(A(")",!0),h.type==="name"&&(h.value==="function"||h.value==="λ")){if(this.arguments.forEach(function(we,_){if(we.type!=="variable")return O({code:"S0208",stack:new Error().stack,position:we.position,token:we.value,value:_+1})}),this.type="lambda",C.id==="<"){for(var b=C.position,G=1,fe="<";G>0&&C.id!=="{"&&C.id!=="(end)";){var _e=A();_e.id===">"?G--:_e.id==="<"&&G++,fe+=_e.value}A(">");try{this.signature=u(fe)}catch(we){return we.position=b+we.offset,O(we)}}A("{"),this.body=T(0),A("}")}return this}),ae("(",function(){for(var h=[];C.id!==")"&&(h.push(T(0)),C.id===";");)A(";");return A(")",!0),this.type="block",this.expressions=h,this}),ae("[",function(){var h=[];if(C.id!=="]")for(;;){var b=T(0);if(C.id===".."){var G={type:"binary",value:"..",position:C.position,lhs:b};A(".."),G.rhs=T(0),b=G}if(h.push(b),C.id!==",")break;A(",")}return A("]",!0),this.expressions=h,this.type="unary",this}),F("[",p["["],function(h){if(C.id==="]"){for(var b=h;b&&b.type==="binary"&&b.value==="[";)b=b.lhs;return b.keepArray=!0,A("]"),h}else return this.lhs=h,this.rhs=T(p["]"]),this.type="binary",A("]",!0),this}),F("^",p["^"],function(h){A("(");for(var b=[];;){var G={descending:!1};if(C.id==="<"?A("<"):C.id===">"&&(G.descending=!0,A(">")),G.expression=T(0),b.push(G),C.id!==",")break;A(",")}return A(")"),this.lhs=h,this.rhs=b,this.type="binary",this});var Ee=function(h){var b=[];if(C.id!=="}")for(;;){var G=T(0);A(":");var fe=T(0);if(b.push([G,fe]),C.id!==",")break;A(",")}return A("}",!0),typeof h>"u"?(this.lhs=b,this.type="unary"):(this.lhs=h,this.rhs=b,this.type="binary"),this};ae("{",Ee),F("{",p["{"],Ee),re(":=",p[":="],function(h){return h.type!=="variable"?O({code:"S0212",stack:new Error().stack,position:h.position,token:h.value}):(this.lhs=h,this.rhs=T(p[":="]-1),this.type="binary",this)}),F("@",p["@"],function(h){return this.lhs=h,this.rhs=T(p["@"]),this.rhs.type!=="variable"?O({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),F("#",p["#"],function(h){return this.lhs=h,this.rhs=T(p["#"]),this.rhs.type!=="variable"?O({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),F("?",p["?"],function(h){return this.type="condition",this.condition=h,this.then=T(0),C.id===":"&&(A(":"),this.else=T(0)),this}),F("?:",p["?:"],function(h){return this.type="condition",this.condition=JSON.parse(JSON.stringify(h)),this.then=h,this.else=T(0),this}),ae("|",function(){return this.type="transform",this.pattern=T(0),A("|"),this.update=T(0),C.id===","&&(A(","),this.delete=T(0)),A("|"),this});var ve=function(h){var b;if(h.type==="function"&&!h.predicate){var G={type:"lambda",thunk:!0,arguments:[],position:h.position};G.body=h,b=G}else if(h.type==="condition")h.then=ve(h.then),typeof h.else<"u"&&(h.else=ve(h.else)),b=h;else if(h.type==="block"){var fe=h.expressions.length;fe>0&&(h.expressions[fe-1]=ve(h.expressions[fe-1])),b=h}else b=h;return b},pe=0,Te=0,Je=[],ce=function(h,b){switch(h.type){case"name":case"wildcard":b.level--,b.level===0&&(typeof h.ancestor>"u"||(Je[b.index].slot.label=h.ancestor.label),h.ancestor=b,h.tuple=!0);break;case"parent":b.level++;break;case"block":h.expressions.length>0&&(h.tuple=!0,b=ce(h.expressions[h.expressions.length-1],b));break;case"path":h.tuple=!0;var G=h.steps.length-1;for(b=ce(h.steps[G--],b);b.level>0&&G>=0;)b=ce(h.steps[G--],b);break;default:throw{code:"S0217",token:h.type,position:h.position}}return b},me=function(h,b){if(typeof b.seekingParent<"u"||b.type==="parent"){var G=typeof b.seekingParent<"u"?b.seekingParent:[];b.type==="parent"&&G.push(b.slot),typeof h.seekingParent>"u"?h.seekingParent=G:Array.prototype.push.apply(h.seekingParent,G)}},We=function(h){var b=h.steps.length-1,G=h.steps[b],fe=typeof G.seekingParent<"u"?G.seekingParent:[];G.type==="parent"&&fe.push(G.slot);for(var _e=0;_e<fe.length;_e++){var we=fe[_e];for(b=h.steps.length-2;we.level>0;){if(b<0){typeof h.seekingParent>"u"?h.seekingParent=[we]:h.seekingParent.push(we);break}for(var _=h.steps[b--];b>=0&&_.focus&&h.steps[b].focus;)_=h.steps[b--];we=ce(_,we)}}},ie=function(h){var b;switch(h.type){case"binary":switch(h.value){case".":var G=ie(h.lhs);G.type==="path"?b=G:b={type:"path",steps:[G]},G.type==="parent"&&(b.seekingParent=[G.slot]);var fe=ie(h.rhs);fe.type==="path"?Array.prototype.push.apply(b.steps,fe.steps):(typeof fe.predicate<"u"&&(fe.stages=fe.predicate,delete fe.predicate),b.steps.push(fe)),b.steps.filter(function(q){if(q.type==="number"||q.type==="value")throw{code:"S0213",stack:new Error().stack,position:q.position,value:q.value};return q.type==="string"}).forEach(function(q){q.type="name"}),b.steps.filter(function(q){return q.keepArray===!0}).length>0&&(b.keepSingletonArray=!0);var _e=b.steps[0];_e.type==="unary"&&_e.value==="["&&(_e.consarray=!0);var we=b.steps[b.steps.length-1];we.type==="unary"&&we.value==="["&&(we.consarray=!0),We(b);break;case"[":b=ie(h.lhs);var _=b,D="predicate";if(b.type==="path"&&(_=b.steps[b.steps.length-1],D="stages"),typeof _.group<"u")throw{code:"S0209",stack:new Error().stack,position:h.position};typeof _[D]>"u"&&(_[D]=[]);var S=ie(h.rhs);typeof S.seekingParent<"u"&&(S.seekingParent.forEach(q=>{q.level===1?ce(_,q):q.level--}),me(_,S)),_[D].push({type:"filter",expr:S,position:h.position});break;case"{":if(b=ie(h.lhs),typeof b.group<"u")throw{code:"S0210",stack:new Error().stack,position:h.position};b.group={lhs:h.rhs.map(function(q){return[ie(q[0]),ie(q[1])]}),position:h.position};break;case"^":b=ie(h.lhs),b.type!=="path"&&(b={type:"path",steps:[b]});var U={type:"sort",position:h.position};U.terms=h.rhs.map(function(q){var K=ie(q.expression);return me(U,K),{descending:q.descending,expression:K}}),b.steps.push(U),We(b);break;case":=":b={type:"bind",value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),me(b,b.rhs);break;case"@":if(b=ie(h.lhs),_=b,b.type==="path"&&(_=b.steps[b.steps.length-1]),typeof _.stages<"u"||typeof _.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:h.position};if(_.type==="sort")throw{code:"S0216",stack:new Error().stack,position:h.position};h.keepArray&&(_.keepArray=!0),_.focus=h.rhs.value,_.tuple=!0;break;case"#":b=ie(h.lhs),_=b,b.type==="path"?_=b.steps[b.steps.length-1]:(b={type:"path",steps:[b]},typeof _.predicate<"u"&&(_.stages=_.predicate,delete _.predicate)),typeof _.stages>"u"?_.index=h.rhs.value:_.stages.push({type:"index",value:h.rhs.value,position:h.position}),_.tuple=!0;break;case"~>":b={type:"apply",value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),b.keepArray=b.lhs.keepArray||b.rhs.keepArray;break;default:b={type:h.type,value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),me(b,b.lhs),me(b,b.rhs)}break;case"unary":b={type:h.type,value:h.value,position:h.position},h.value==="["?b.expressions=h.expressions.map(function(q){var K=ie(q);return me(b,K),K}):h.value==="{"?b.lhs=h.lhs.map(function(q){var K=ie(q[0]);me(b,K);var he=ie(q[1]);return me(b,he),[K,he]}):(b.expression=ie(h.expression),h.value==="-"&&b.expression.type==="number"?(b=b.expression,b.value=-b.value):me(b,b.expression));break;case"function":case"partial":b={type:h.type,name:h.name,value:h.value,position:h.position},b.arguments=h.arguments.map(function(q){var K=ie(q);return me(b,K),K}),b.procedure=ie(h.procedure);break;case"lambda":b={type:h.type,arguments:h.arguments,signature:h.signature,position:h.position};var B=ie(h.body);b.body=ve(B);break;case"condition":b={type:h.type,position:h.position},b.condition=ie(h.condition),me(b,b.condition),b.then=ie(h.then),me(b,b.then),typeof h.else<"u"&&(b.else=ie(h.else),me(b,b.else));break;case"transform":b={type:h.type,position:h.position},b.pattern=ie(h.pattern),b.update=ie(h.update),typeof h.delete<"u"&&(b.delete=ie(h.delete));break;case"block":b={type:h.type,position:h.position},b.expressions=h.expressions.map(function(q){var K=ie(q);return me(b,K),(K.consarray||K.type==="path"&&K.steps[0].consarray)&&(b.consarray=!0),K});break;case"name":b={type:"path",steps:[h]},h.keepArray&&(b.keepSingletonArray=!0);break;case"parent":b={type:"parent",slot:{label:"!"+pe++,level:1,index:Te++}},Je.push(b);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":b=h;break;case"operator":if(h.value==="and"||h.value==="or"||h.value==="in")h.type="name",b=ie(h);else if(h.value==="?")b=h;else throw{code:"S0201",stack:new Error().stack,position:h.position,token:h.value};break;case"error":b=h,h.lhs&&(b=ie(h.lhs));break;default:var I="S0206";h.id==="(end)"&&(I="S0207");var L={code:I,position:h.position,token:h.value};if(w)return ee.push(L),{type:"error",error:L};throw L.stack=new Error().stack,L}return h.keepArray&&(b.keepArray=!0),b};R=P(k),A();var Ce=T(0);if(C.id!=="(end)"){var nt={code:"S0201",position:C.position,token:C.value};O(nt)}if(Ce=ie(Ce),Ce.type==="parent"||typeof Ce.seekingParent<"u")throw{code:"S0217",token:Ce.type,position:Ce.position};return ee.length>0&&(Ce.errors=ee),Ce};return M})();r.exports=o},{"./signature":5}],5:[function(t,r,s){var u=t("./utils");const o=(()=>{var p={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function y(P){for(var M=1,k=[],w=Object.create(null),C=w;M<P.length;){var R=P.charAt(M);if(R===":")break;var N=function(){k.push(w),C=w,w=Object.create(null)},ee=function(F,re,ae,Ee){for(var ve=1,pe=re;pe<F.length;)if(pe++,R=F.charAt(pe),R===Ee){if(ve--,ve===0)break}else R===ae&&ve++;return pe};switch(R){case"s":case"n":case"b":case"l":case"o":w.regex="["+R+"m]",w.type=R,N();break;case"a":w.regex="[asnblfom]",w.type=R,w.array=!0,N();break;case"f":w.regex="f",w.type=R,N();break;case"j":w.regex="[asnblom]",w.type=R,N();break;case"x":w.regex="[asnblfom]",w.type=R,N();break;case"-":C.context=!0,C.contextRegex=new RegExp(C.regex),C.regex+="?";break;case"?":case"+":C.regex+=R;break;case"(":var J=ee(P,M,"(",")"),E=P.substring(M+1,J);if(E.indexOf("<")===-1)w.regex="["+E+"m]";else throw{code:"S0402",stack:new Error().stack,value:E,offset:M};w.type="("+E+")",M=J,N();break;case"<":if(C.type==="a"||C.type==="f"){var v=ee(P,M,"<",">");C.subtype=P.substring(M+1,v),M=v}else throw{code:"S0401",stack:new Error().stack,value:C.type,offset:M};break}M++}var O="^"+k.map(function(F){return"("+F.regex+")"}).join("")+"$",A=new RegExp(O),T=function(F){var re;if(u.isFunction(F))re="f";else{var ae=typeof F;switch(ae){case"string":re="s";break;case"number":re="n";break;case"boolean":re="b";break;case"object":F===null?re="l":Array.isArray(F)?re="a":re="o";break;case"undefined":default:re="m"}}return re},H=function(F,re){for(var ae="^",Ee=0,ve=0;ve<k.length;ve++){ae+=k[ve].regex;var pe=re.match(ae);if(pe===null)throw{code:"T0410",stack:new Error().stack,value:F[Ee],index:Ee+1};Ee=pe[0].length}throw{code:"T0410",stack:new Error().stack,value:F[Ee],index:Ee+1}};return{definition:P,validate:function(F,re){var ae="";F.forEach(function(Te){ae+=T(Te)});var Ee=A.exec(ae);if(Ee){var ve=[],pe=0;return k.forEach(function(Te,Je){var ce=F[pe],me=Ee[Je+1];if(me==="")if(Te.context&&Te.contextRegex){var We=T(re);if(Te.contextRegex.test(We))ve.push(re);else throw{code:"T0411",stack:new Error().stack,value:re,index:pe+1}}else ve.push(ce),pe++;else me.split("").forEach(function(ie){if(ce=F[pe],Te.type==="a"){if(ie==="m")ce=void 0;else{var Ce=!0;if(typeof Te.subtype<"u"){if(ie!=="a"&&me!==Te.subtype)Ce=!1;else if(ie==="a"&&ce.length>0){var nt=T(ce[0]);if(nt!==Te.subtype.charAt(0))Ce=!1;else{var h=ce.filter(function(b){return T(b)!==nt});Ce=h.length===0}}}if(!Ce)throw{code:"T0412",stack:new Error().stack,value:ce,index:pe+1,type:p[Te.subtype]};ie!=="a"&&(ce=[ce])}ve.push(ce),pe++}else ve.push(ce),pe++})}),ve}H(F,ae)}}}return y})();r.exports=o},{"./utils":6}],6:[function(t,r,s){const u=(()=>{function o(v){var O=!1;if(typeof v=="number"&&(O=!isNaN(v),O&&!isFinite(v)))throw{code:"D1001",value:v,stack:new Error().stack};return O}function p(v){var O=!1;return Array.isArray(v)&&(O=v.filter(function(A){return typeof A!="string"}).length===0),O}function y(v){var O=!1;return Array.isArray(v)&&(O=v.filter(function(A){return!o(A)}).length===0),O}function P(v){return v.sequence===!0&&Array.isArray(v)}function M(v){return v&&(v._jsonata_function===!0||v._jsonata_lambda===!0)||typeof v=="function"}function k(v){var O=typeof v.arity=="number"?v.arity:typeof v.implementation=="function"?v.implementation.length:typeof v.length=="number"?v.length:v.arguments.length;return O}function w(v){return v&&v._jsonata_lambda===!0}var C=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function R(v){return typeof v=="object"&&v!==null&&C in v&&"next"in v&&typeof v.next=="function"}function N(v,O){if(v===O)return!0;if(typeof v=="object"&&typeof O=="object"&&v!==null&&O!==null){if(Array.isArray(v)&&Array.isArray(O)){if(v.length!==O.length)return!1;for(var A=0;A<v.length;A++)if(!N(v[A],O[A]))return!1;return!0}var T=Object.getOwnPropertyNames(v),H=Object.getOwnPropertyNames(O);if(T.length!==H.length)return!1;for(T=T.sort(),H=H.sort(),A=0;A<T.length;A++)if(T[A]!==H[A])return!1;for(A=0;A<T.length;A++){var F=T[A];if(!N(v[F],O[F]))return!1}return!0}return!1}function ee(v){return typeof v=="object"&&v!==null&&"then"in v&&typeof v.then=="function"}function J(v){var O=[];for(let A of v)O.push(A);return O}function E(v){return typeof v=="object"&&v!==null?Object.keys(v):[]}return{isNumeric:o,isArrayOfStrings:p,isArrayOfNumbers:y,isSequence:P,isFunction:M,isLambda:w,isIterable:R,getFunctionArity:k,isDeepEqual:N,stringToArray:J,isPromise:ee,keys:E}})();r.exports=u},{}]},{},[3])(3)})})(Cr)),Cr.exports}xi();const ki=150,hn=10,Si=200,Pi=16,dn=new WeakMap;let pn=!1;function ir(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Bt(n){if(n===window)return{x:window.scrollX,y:window.scrollY};const e=n;return{x:e.scrollLeft,y:e.scrollTop}}function Ti(n,e,t){if(n===window){window.scrollTo(e,t);return}const r=n;typeof r.scrollTo=="function"?r.scrollTo(e,t):(r.scrollLeft=e,r.scrollTop=t)}function Ci(n){if(n===window){const t=document.documentElement;return Math.max(0,t.scrollHeight-window.innerHeight)}const e=n;return Math.max(0,e.scrollHeight-e.clientHeight)}function St(n){let e=dn.get(n);if(!e){const t=Bt(n);e={x:t.x,y:t.y,restoring:!1,watching:!1,userEngaged:!1,raf:0,stickyFrames:0},dn.set(n,e)}return e}function sr(n){St(n).userEngaged=!0}function ar(n){const e=St(n);clearTimeout(e.settleTimer),e.settleTimer=setTimeout(()=>{e.userEngaged=!1,e.settleTimer=void 0},ki)}function mn(n,e){return e-n>=Si}function Pt(n){if(!ir())return;const e=St(n);if(e.restoring)return;const t=Bt(n);if(mn(t.y,e.y)){Dr(n);return}e.x=t.x,e.y=t.y}function Di(n){if(!ir())return;const e=St(n),t=Ci(n),r=e.x,s=t>0?Math.min(e.y,t):e.y,{x:u,y:o}=Bt(n);if(!(Math.abs(r-u)<=hn&&Math.abs(s-o)<=hn)){e.restoring=!0;try{Ti(n,r,s)}finally{requestAnimationFrame(()=>{e.restoring=!1})}}}function Dr(n){const e=St(n);if(e.stickyFrames=Pi,e.raf)return;const t=()=>{e.raf=0,Di(n),e.stickyFrames>0&&(e.stickyFrames--,e.raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)}function Rr(n){Dr(n)}function qt(n){if(!ir())return;const e=St(n);if(e.watching)return;e.watching=!0;const t=n===window?window:n,r=()=>{if(e.restoring)return;const{y:R}=Bt(n);if(mn(R,e.y)){Dr(n);return}if(e.userEngaged){Pt(n),ar(n);return}Pt(n)},s=R=>vn(R)===n,u=R=>{s(R)&&(Pt(n),sr(n))},o=R=>{s(R)&&ar(n)},p=R=>{s(R)&&(Pt(n),sr(n),ar(n))};t.addEventListener("scroll",r,{passive:!0}),t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchend",o,{passive:!0}),t.addEventListener("touchcancel",o,{passive:!0}),t.addEventListener("wheel",p,{passive:!0}),t.addEventListener("pointerdown",u,{passive:!0}),t.addEventListener("pointerup",o,{passive:!0}),t.addEventListener("pointercancel",o,{passive:!0});const y=Bt(n);if(e.x=y.x,e.y=y.y,n===window){const R=new ResizeObserver(()=>Rr(window));R.observe(document.documentElement),e.resizeObserver=R;return}const P=n,M=new ResizeObserver(()=>Rr(P));M.observe(P);for(const R of Array.from(P.children))M.observe(R);e.resizeObserver=M;const k=()=>Rr(P),w=new MutationObserver(R=>{for(const N of R)if(N.type==="childList")for(const ee of Array.from(N.addedNodes))ee instanceof Element&&M.observe(ee);k()});w.observe(P,{childList:!0,subtree:!0,characterData:!0});const C=P.getRootNode();C instanceof ShadowRoot&&C.host&&w.observe(C.host,{childList:!0,subtree:!0,characterData:!0}),e.mutationObserver=w}function vn(n){for(const e of n.composedPath())if(!(e===window||e===document)&&e instanceof HTMLElement&&gn(e))return e;return window}function gn(n){if(!(n instanceof HTMLElement)||n===document.documentElement||n===document.body)return!1;const e=getComputedStyle(n).overflowY;return e==="auto"||e==="scroll"||e==="overlay"}function Lr(n){for(const t of n.composedPath())t===window||t===document||t instanceof HTMLElement&&gn(t)&&qt(t);const e=vn(n);qt(e),n.type==="wheel"?(Pt(e),sr(e),ar(e)):(n.type==="touchstart"||n.type==="pointerdown")&&(Pt(e),sr(e))}function or(n){n instanceof Element&&n.classList?.contains("custom-scroll")&&qt(n),n.querySelectorAll?.(".custom-scroll").forEach(e=>{e instanceof HTMLElement&&qt(e)})}function Mr(n){or(n),new MutationObserver(t=>{for(const r of t)for(const s of Array.from(r.addedNodes))s instanceof Element&&or(s)}).observe(n,{childList:!0,subtree:!0})}function Or(n){n.querySelectorAll?.("*").forEach(e=>{e.shadowRoot&&(Mr(e.shadowRoot),Or(e.shadowRoot))})}function Ri(){const n=Element.prototype;if(n.__safariScrollGuardPatched)return;n.__safariScrollGuardPatched=!0;const e=n.attachShadow;n.attachShadow=function(r){const s=e.call(this,r);return Mr(s),s}}function Li(){if(typeof window>"u"||pn||(pn=!0,!ir()))return;qt(window),Ri();const n={capture:!0,passive:!0};window.addEventListener("wheel",Lr,n),window.addEventListener("touchstart",Lr,n),window.addEventListener("pointerdown",Lr,n);const e=()=>{or(document),Or(document)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e(),new MutationObserver(r=>{for(const s of r)for(const u of Array.from(s.addedNodes))u instanceof Element&&(or(u),u.shadowRoot&&Mr(u.shadowRoot),Or(u))}).observe(document.documentElement,{childList:!0,subtree:!0})}const Mi=si,Oi=oi,Ui=Sr,Fi=_r,$i=at,Ni=bi,Ii=er,ji=Pr,Bi=_i;Li(),window["concorde-utils"]=window["concorde-utils"]||{},window["concorde-utils"]={Utils:Mi,Arrays:Oi,DataBindObserver:Ui,Format:Fi,HTML:$i,LocationHandler:Ni,Objects:Ii,PublisherManager:$e,api:ji,URLPattern:Bi,Endpoint:Tr,DataProviderKey:Qt};const qi=`#version 300 es
|
|
31
|
+
*/function ai(n){return Y({...n,state:!0,attribute:!1})}const Er="1";function oi(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}}let at=class Ge{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const r=t.indexOf("=");return e[t.substring(0,r).trim()]=t.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let r=e;for(;r;){if(!t(r))return;r=r.parentNode||r.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const s=window.getComputedStyle(r);if(Ge.overflowMatches(s,t))return r}r=Ge.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return Ge.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return Ge.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const r of Ge.scopeAttributeNames(t))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const u=Ge.readScopeAttributeOnElement(r,t);if(u!=null)return u}const s=r.parentNode||r.host;if(!s)break;r=s}return null}static getApiConfiguration(e){const t=Ge.getAncestorAttributeValue(e,"token"),r=Ge.getAncestorAttributeValue(e,"addHTTPResponse")!=null,s=Ge.getAncestorAttributeValue(e,"serviceURL");let u=null,a=null;const d=Ge.getAncestorAttributeValue(e,"tokenProvider"),y=Ge.getAncestorAttributeValue(e,"eventsApiToken");t||(u=Ge.getAncestorAttributeValue(e,"userName"),a=Ge.getAncestorAttributeValue(e,"password"));const T=Ge.getAncestorAttributeValue(e,"credentials")||void 0,M=e.getAttribute("cache"),S=e.hasAttribute("blockUntilDone"),w=e.hasAttribute("keepAlive");return{serviceURL:s,token:t,userName:u,password:a,authToken:y,tokenProvider:d,addHTTPResponse:r,credentials:T,cache:M,blockUntilDone:S,keepAlive:w}}static getClosestElement(e,t){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===t);){const s=r.parentNode||r.host;if(!s){r=null;break}r=s}return r?.nodeName?r:null}static getClosestForm(e){return Ge.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const r=new Set(t.map(a=>a.toLowerCase())),s=[];let u=e.parentNode||e.host;for(;u;)u instanceof Element&&r.has(u.tagName.toLowerCase())&&s.push(u),u=u.parentNode||u.host;return s}static getAncestorsBySelectors(e,t){const r=[];let s=e.parentNode||e.host;for(;s;){if(s instanceof Element)for(const u of t)try{if(s.matches(u)){r.push(s);break}}catch{}s=s.parentNode||s.host}return r}static async loadJS(e){if(!oi(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(u=>u.src===t);if(r)return r.dataset.concordeLoaded===Er?!0:new Promise(u=>{let a=!1;const d=T=>{a||(a=!0,T&&(r.dataset.concordeLoaded=Er),u(T))};r.addEventListener("load",()=>d(!0),{once:!0}),r.addEventListener("error",()=>d(!1),{once:!0});const y=r.readyState;if(y==="complete"||y==="loaded"){d(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{a||d(!0)})})});const s=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(u=>{const a=document.createElement("script");a.src=e,s&&(a.type="module"),a.onload=()=>{a.dataset.concordeLoaded=Er,u(!0)},a.onerror=()=>u(!1),document.head.appendChild(a)})}static async loadCSS(e){return new Promise(t=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>t(!0),r.onerror=()=>t(!0),document.head.appendChild(r)})}};function rn(n){if(!n||typeof n!="object")return!1;const e=n;return typeof e.getFrameCanvas=="function"&&typeof e.frameSeq=="number"}const nn="#__sonic_frame_";let ui=0;const _r=new Map,sn=new WeakMap;function ci(n){const e=sn.get(n);if(e)return e;const t=`${nn}${++ui}`;return _r.set(t,n),sn.set(n,t),t}function li(n){if(!n.startsWith(nn))return null;const e=_r.get(n)??null;return e&&!e.isConnected?(_r.delete(n),null):e}function fi(n){if(n==null)return null;if(typeof n=="string"){const e=n.trim();return e?e.startsWith("#")?e:`#${e}`:null}return typeof Element<"u"&&n instanceof Element?n.id?`#${n.id}`:ci(n):null}function Ar(n){return typeof n!="string"?null:n.trim()||null}function hi(n){if(n==null||n==="")return null;if(typeof n=="string")return Ar(n);if(typeof n!="object")return null;const e=n;return Ar(e.url)??Ar(e.blobUrl)}function It(n){for(const e of n)try{URL.revokeObjectURL(e)}catch{}}let di=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(t=>{setTimeout(t,e)})}},an="sonic";typeof __SONIC_PREFIX__<"u"&&(an=__SONIC_PREFIX__);let on=an.replace(/-([a-z])/g,n=>n[1].toUpperCase());const pi=on.charAt(0).toUpperCase()+on.slice(1);let mi=class Et{static areEqual(e,t){return e.length===t.length?e.every((r,s)=>r===t[s]):!1}static from2d(e){return{to1D:()=>{let t=[];return e.forEach(r=>t=t.concat(r)),this.from(t)}}}static from(e){return{get:()=>e||[],everyItem:()=>({has:()=>({same:()=>({value:()=>({forKey:t=>{if(e.length<1)return!0;const r=(e[0]||{})[t];return e.every(s=>(s||{})[t]==r)}})})}),value:()=>({forKey:t=>Et.from(e.map(r=>r[t]))}),copy:()=>({fromKey:t=>({toKey:r=>{e.forEach(s=>{s[r]=Array.isArray(s[t])?[...s[t]]:typeof s[t]=="object"&&s[t]!=null?{...s[t]}:s[t]})}})})}),map:t=>Et.from(e.map(t)),filter:t=>Et.from(e.filter(t)),find:t=>e.find(t),some:t=>e.some(t),every:t=>e.every(t),group:()=>({byKey:t=>{const r=[],s=new Map;for(const u of e){const a=u[t];if(!s.has(a)){const d=r.length;s.set(a,d);const y={items:[]};y[t]=a,r.push(y)}r[s.get(a)].items.push(u)}return Et.from(r)}}),without:()=>({duplicates:()=>({forKey:t=>{const r=[...new Set(e.map(s=>s[t]))];return Et.from(r.map(s=>e.find(u=>u[t]==s)))}}),itemsIn:t=>({havingSameValue:()=>({forKey:r=>{const s=(u,a)=>d=>u[a]!=d[a];return Et.from(e.filter(u=>t.every(s(u,r))))}})})})}}},xr=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,t="",r="long"){t||(t=at.getLanguage());const s=(T,M)=>[Math.floor(T/M),T%M];function u(T,M,S){return new Intl.NumberFormat(T,{style:"unit",unit:M,unitDisplay:S}).format}const[a,d]=s(e,60),y=[];return a&&y.push(u(t,"hour",r)(a)),d&&y.push(u(t,"minute",r)(d)),new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(y)}static js(e){try{return Function("return "+e)()}catch{return""}}};class un{constructor(e){this.path=e}toString(){return this.path}}function cn(n){return new Proxy(n,{get(e,t){if(t==="path")return e.path;if(t==="toString")return e.toString.bind(e);if(t===Symbol.toStringTag)return"DataProviderKey";if(typeof t=="symbol")return e[t];const r=e.path?`${e.path}.${String(t)}`:String(t);return cn(new un(r))}})}const gi=/\$\{|\{\$/;function vi(n){return gi.test(n)}function bi(n){const e=n;if(vi(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const Qt=function(n){return this instanceof Qt?cn(new un(n)):new Qt(n)};let er=class ct{static shallowEqual(e,t,r=!0){const s=Object.keys(e),u=Object.keys(t);if(s.length!==u.length&&r)return!1;for(const a of s){const d=e[a],y=t[a];if(r?d!==y:d!=y)return!1}return!0}static deepEqual(e,t,r=!0){const s=Object.keys(e),u=Object.keys(t);if(s.length!==u.length&&r)return!1;for(const a of s){const d=e[a],y=t[a],T=ct.isObject(d)&&ct.isObject(y),M=r?d!==y:d!=y;if(T&&!ct.deepEqual(d,y)||!T&&M)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ct.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,r=!1){for(const s of t){const u=e[s];if(u===void 0)return;r&&ct.isObject(u)?e=Object.assign(Array.isArray(u)?[]:{},e,u):e=e[s]}return e}static traverseDotNotation(e,t,r=!1){return ct.traverse(e,t.split("."),r)}static getURLSearchArray(e,t=""){let r=[];for(let s in e){const u=e[s];t&&(s=t+"["+s+"]"),ct.isObject(u)?r=[...r,...this.getURLSearchArray(u,s)]:r.push(`${s}=${u}`)}return r}static getURLSearchString(e){return ct.getURLSearchArray(e,"").join("&")}};er.traverseDotNotation;function yi(n){return!1}function tr(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function ft(n){return typeof n=="object"&&n!==null}let St="sonic";typeof __SONIC_PREFIX__>"u"&&(St="sonic");const Sr=St=="sonic"?"publisher-proxies-data":St+"-publisher-proxies-data",dt=class dt{constructor(e,t,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=t||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(),dt.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_&&!$e.changed){$e.changed=!0,$e.saveId++;const t=$e.saveId;setTimeout(()=>$e.getInstance().saveToLocalStorage(t),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(s=>{s(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(r=>{r[e]!==t&&(r[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(r=>{const s=Object.getOwnPropertyDescriptor(r,e);s&&!s.set&&!s.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==t&&(r[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 r=t;const s=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(r=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==s&&(e[r]=s)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const r=this._value_[t];e[t]!==r&&(e[t]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||ft(this._value_)&&ft(e)&&e&&tr(this._value_)&&tr(e)&&this._value_.__value===e.__value||!ft(e)&&e===this._value_.__value)return!0;this._value_=ft(e)?e:{__value:e},this._cachedGet_=void 0;const r=tr(this._value_);if(this._parentKey_&&this.parent){const s=tr(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_]:s});else{const u=[];u[Number(this._parentKey_)]=s,this.parent.set(u)}else this.parent._value_[this._parentKey_]=s}if(r)return this._proxies_.forEach((s,u)=>{u!="_parent_"&&(s.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const s in this._value_)this._value_[s]===void 0&&delete this._value_[s];if(this._proxies_.forEach((s,u)=>{const a=this._value_[u];u!="_parent_"&&a===void 0&&a!==null&&isNaN(Number(u))&&(s.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),ft(this._value_))for(const s in this._value_){const u=e[s],d=ft(u)?u:{__value:u};if(!this._proxies_.has(s)){this._publishDynamicFilling_(s,u);continue}this._proxies_.get(s)?.set(d,!0),this._publishDynamicFilling_(s,u)}return!0}get(){if(wi(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_||(dt.instancesCounter++,this._instanceCounter_=dt.instancesCounter),dt.instances.set(this._instanceCounter_,this),"<"+St+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+St+"-publisher-proxy>"}};dt.instances=new Map,dt.instancesCounter=0;let rr=dt;const ln=[];function wi(n){ln.length>0&&ln[0].add(n)}const ve=class ve{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],ve.instance!=null)throw"Singleton / use getInstance";ve.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),ve.initPageShowHandler()}static initPageShowHandler(){ve.pageShowHandlerInitialized||(ve.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&ve.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(Sr),s=null;if(r&&(s=await this.decompress(r,"gzip")),s)try{this.localStorageData=JSON.parse(s)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(Sr,r),this.localStorageData={};const u=1e3*60*60*12;for(const a in this.localStorageData){const d=this.localStorageData[a],y=new Date().getTime()-(d.expirationDelayMs||u);d.lastModifiationMS<y&&delete this.localStorageData[a]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=ve.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new ve)}return ve.instance==null?new ve:ve.instance}static get(e,t){return ve.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+at.getLanguage()]?.data||e.get())}get(e,t){const r=t?.localStorageMode==="enabled",s=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const d=kr({});this.set(e,d)}const u=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(u._expiration_delay_=t.expirationDelayMs),u._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(u,e)),s&&(u._invalidate_on_page_show_=s),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!==ve.saveId&&e%10!=0))try{if(!ve.changed||ve.saving)return;ve.saving=!0,ve.changed=!1;const t=Array.from(this.publishers.keys());let r=!1;for(const s of t){const u=this.publishers.get(s);if(!u?._is_savable_)continue;const a=u?.get();a&&(this.localStorageData[s+"¤lang_"+at.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:u._expiration_delay_,data:a},r=!0)}if(r){const s=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Sr,s)}if(ve.saving=!1,ve.changed){ve.saveId++;const s=ve.saveId;setTimeout(()=>this.saveToLocalStorage(s),1e3)}}catch{ve.saving=!1}}async compress(e,t){const r=new TextEncoder().encode(e),s=window,u=new s.CompressionStream(t),a=u.writable.getWriter();a.write(r),a.close();const d=await new Response(u.readable).arrayBuffer(),y=new Uint8Array(d);let T="";for(let M=0;M<y.length;M++)T+=String.fromCharCode(y[M]);return btoa(T)}async decompress(e,t){const r=atob(e),u=Uint8Array.from(r,M=>M.charCodeAt(0)).buffer,a=window,d=new a.DecompressionStream(t),y=d.writable.getWriter();y.write(u),y.close();const T=await new Response(d.readable).arrayBuffer();return new TextDecoder().decode(T)}};ve.buildDate="Tue Sep 29 2026 21:11:53 GMT+0200 (Central European Summer Time)",ve.changed=!1,ve.saving=!1,ve.saveId=0,ve.instance=null,ve.instances=new Map,ve.pageShowHandlerInitialized=!1;let $e=ve;if(typeof window<"u"){const n=window,e=pi+"PublisherManager",t=n[e]||$e;if(n[e]||(n[e]=$e),t!==$e){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const s of r)Object.defineProperty($e,s,{configurable:!0,get(){return t[s]},set(u){t[s]=u}})}}const Ei=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 _i(n,e){return{get:function(t,r){if(typeof r=="string"&&Ei.has(r))return n[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(r)){const s=n._value_[r],u=kr(ft(s)?s:{__value:s},n,r);u._proxies_.set("_parent_",e()),n._proxies_.set(r,u)}return n._proxies_.get(r)},set:function(t,r,s){if(r=="_value_")return n._value_=s,!0;if(r=="_cachedGet_")return n._cachedGet_=s,!0;if(r=="_assignmentId_")return n._assignmentId_=s,!0;if(r=="_is_savable_")return n._is_savable_=s,!0;if(r=="_expiration_delay_")return n._expiration_delay_=s,!0;if(r=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=s,!0;if(r=="_instanceCounter_")return n._instanceCounter_=s,!0;if(!n._proxies_.has(r)){const a=kr({},n,r);a._proxies_.set("_parent_",e()),n._proxies_.set(r,a)}return n._value_[r]!==s&&(n._value_[r]=s,n._publishDynamicFilling_(r,s),n._proxies_.get(r)?.set(ft(s)?s:{__value:s})),!0},deleteProperty:function(t,r){return n._publishDynamicFilling_(r,null),n._proxies_.get(r)?.set(null),delete n._value_[r]},has:function(t,r){return r in n._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(t,r,s){return s&&"value"in s&&(n._value_[r]=s.value),!0},getOwnPropertyDescriptor:function(t,r){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function kr(n,e=null,t){const r=new rr(n,e,t);let s=null;const u=_i(r,()=>s);return s=new Proxy(r,u),s}class Ai extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=rr.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(St+"-publisher-proxy",Ai)}catch{}const xi=(n,e)=>{{const t=n.split("."),r=t.shift()||"";let s=$e.get(r,e);s=er.traverse(s,t);const u=new Set;return u.add(s),u}};function fn(n,e,t){const r=bi(n);return xi(r,t).values().next().value}function Si(n,e){return yi()?fn(n,void 0,e):fn(n)}let Tr=(de=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(de.observedElements.keys()).forEach(e=>de.unObserve(e)))}static observe(e){if(!e||!de.enabled||de.observedElements.has(e))return;const t=new MutationObserver(de.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],t.observe(e,r),e.querySelectorAll("[data-bind]").forEach(s=>de.addPublisherListeners(s)),de.observedElements.set(e,t)}static unObserve(e){if(!e)return;const t=this.observedElements.get(e);t&&(t.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>de.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&de.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>de.addPublisherListeners(t)):e.childNodes.forEach(t=>de.onAdded(t))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&de.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>de.removePublisherListeners(t)):e.childNodes.forEach(t=>de.onRemoved(t))}static onMutation(e){for(const t of e)switch(t.type){case"attributes":de.addPublisherListeners(t.target);break;case"childList":t.addedNodes.forEach(r=>{de.onAdded(r)}),t.removedNodes.forEach(r=>{de.onRemoved(r)});break}}static removePublisherListeners(e){const t=de.publisherListeners.get(e);t&&(de.publisherListeners.delete(e),t.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let t=e.match(/(\$(?:\w+\\?\.?)+)/g);return t?t=t.map(r=>r.replace("$","")):t=[e],t=t.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:t.map(r=>r.split(/\b\.\b/).map(s=>s.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(t=>t.name.indexOf("::")==0).map(t=>({propertyToUpdate:t.name.substring(2).replace(/-((html)|\w)/g,s=>s.substring(1).toUpperCase()),bindedVariablesDescriptor:de.getVariablesDescriptor(t.value)})):[]}static getSubPublisher(e,t){if(!t)return e;for(const r of t)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){de.removePublisherListeners(e);const t=at.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!t)return;const r=$e.getInstance().get(t),s=de.getDataBindItems(e),u=[];s.forEach(a=>{const d=a.bindedVariablesDescriptor,y=a.propertyToUpdate;for(const T of d.variables){const M=T;let S=r;S=de.getSubPublisher(r,M);const w=e,C={publisher:S,onAssign:()=>{const D=d.variables.map(J=>de.getSubPublisher(r,J)?.get());let N=d.expression,ee=!1;if(D.length==1&&d.variables[0].join(".")==N.substring(1)){let J=D[0];J===null&&(J=""),w[y]=J;return}for(let J=0;J<D.length;J++){let _=D[J];const g=d.variables[J];_===null&&(ee=!0,_=void 0),N=N.replace("$"+g.join("."),_)}if(N.indexOf("|")!=-1){const J=N.indexOf("|");if(J==0)N=xr.js(N.substring(1));else{const _=N.substring(0,J),g=N.substring(J+1),U=xr[_];N=ee?"":U?U(g):N}}else N=ee?"":N;w[y]=N}};S?.onAssign(C.onAssign),u.push(C)}}),de.publisherListeners.set(e,u)}},de.observedElements=new Map,de.enabled=!0,de.publisherListeners=new Map,de);Tr.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=Tr);let ki=(De=class{static listen(){if(!De.listening)return;const e=document.location?.href.replace(document.location.origin,"");De.prevURL&&De.prevURL!=e&&(De.prevURL=e,De.listeners.forEach(t=>{t.location=e})),window.requestAnimationFrame(De.listen)}static offChange(e){const t=De.listeners.indexOf(e);t!=-1&&(De.listeners.splice(t,1),De.listeners.length==0&&(De.listening=!1))}static onChange(e){De.listening||(De.listening=!0,De.listen()),De.listeners.push(e),e.location=this.prevURL}static changeFromComponent(e){const t=e.goBack,r=document.referrer;if(t!=null){const T=document.location.origin,M=(t||T).toString(),w=r.indexOf("http")==0?new URL(r).origin!=T:!1,C=r=="",D=history.length<3,N=C&&D,ee=M!=document.location.href;if(w&&ee||N){const _=history.state||{};_.concorde=_.concorde||{},_.concorde.hasDoneHistoryBack=!0,history.pushState(_,document.title),history.back(),document.location.replace(M)}else history.back();return}let s=e.getAttribute("to")||"";if(s||(s=e.href?.toString()||""),!s)return;if(s.indexOf("#")==0){document.location.hash=s.substring(1);return}const u=new URL(s,document.location.href),a=u.pathname.split("/"),d=[];let y="";for(const T of a)T!=y&&d.push(T),y=T;s="/"+d.join("/")+u.search+(u.hash?+u.hash:""),e.hasAttribute("pushState")?history.pushState(null,"",s):e.hasAttribute("replaceState")?history.replaceState(null,"",s):document.location.href=s}static updateComponentActiveState(e){if(e.autoActive=="disabled")return;const t=e.href?.toString()||"";if(e.href&&t.indexOf("http")!=0){const r=new URL(t,document.location.href),s=new URL(e.location||"",document.location.origin);let u=!1;e.autoActive=="strict"?u=r.pathname==s.pathname&&r.hash==s.hash&&r.search==s.search:e.autoActive=="strict-path-only"?u=r.pathname==s.pathname&&r.hash==s.hash:u=s.href.indexOf(r.href)==0,u?e.setAttribute("active","true"):e.removeAttribute("active")}}},De.listeners=[],De.listening=!1,De.prevURL=document.location?.href.replace(document.location.origin,""),De);function hn(n){if(n==null||typeof n!="object"||Array.isArray(n))return n;const e={...n};return delete e._sonic_http_response_,e}const ye=class ye{constructor(e){this.addHTTPResponse=!1,this.cache="default",this.isServiceSimulated=!1,this.blockUntilDone=!1,this.keepAlive=!1,this.serviceURL=e.serviceURL,this.blockUntilDone=e.blockUntilDone||!1,this.serviceURL=="publisher://"&&(this.isServiceSimulated=!0),this.serviceURL||(this.serviceURL=document.location.origin),this.userName=e.userName,this.password=e.password,e.token&&(this.token=e.token),this.tokenProvider=e.tokenProvider,this.authToken=e.authToken,this.addHTTPResponse=e.addHTTPResponse||!1,this.credentials=e.credentials,this.cache=e.cache||"default",this.keepAlive=e.keepAlive||!1}set token(e){if(this._token=e,!e){ye.tokens.delete(this.serviceURL);return}ye.invalidTokens.includes(e)||ye.tokens.set(this.serviceURL,e)}get token(){return ye.invalidTokens.includes(this._token)?ye.tokens.get(this.serviceURL):this._token}handleInvalidToken(e){e&&(ye.invalidTokens.includes(e)||(ye.invalidTokens.push(e),this.token=null))}async handleResult(e,t){ye.firstCallDoneFlags.set(this.serviceURL,"done"),this.lastResult=e;const r=e.headers.get("content-type")?.toLowerCase(),s=e.status;let u={};if(!r||r.indexOf("text/")==0)u={text:await e.text()};else try{u=await e.json()}catch{u={}}if(this.addHTTPResponse&&er.isObject(u)&&(u._sonic_http_response_=e),s===498&&!ye.failledTokenUpdates.has(this.serviceURL))if(this.handleInvalidToken(this.token),t.apiMethod==="get"){const d=await this.get(t.path,t.additionalHeaders);if(d==null)throw new Error("GET retry failed after token refresh");u=d}else u=await this[t.apiMethod](t.path,t.data,t.method,t.additionalHeaders);return Si("sonic-api").lastResponse.set({http:e,processed:u}),u}async auth(){if(this.token)return;if(ye.tokens.has(this.serviceURL)){this.token=ye.tokens.get(this.serviceURL);return}if(!this.tokenProvider)return;let e={};this.userName&&this.password?e={Authorization:"Basic "+window.btoa(unescape(encodeURIComponent(this.userName+":"+this.password)))}:this.authToken&&(e={Authorization:"Bearer "+this.authToken});const t=new URL(this.serviceURL),r=t.protocol+"//"+t.host,s=await fetch(this.computeURL(this.tokenProvider,{serviceHost:r}),{headers:e,credentials:this.credentials,keepalive:this.keepAlive});try{const u=await s.json();u.token?this.token=u.token:ye.failledTokenUpdates.set(this.serviceURL,!0)}catch{ye.failledTokenUpdates.set(this.serviceURL,!0)}}async localGet(e,t){const r=$e.get(e),s=new URLSearchParams(t.split("?")[1]||""),u=r.get();let a=[];Array.isArray(u)?a=u:a=[u];const d=[];let y=Number.POSITIVE_INFINITY,T=0,M=0;if(s.has("limit")&&(y=parseInt(s.get("limit")||"0"),M++),s.has("offset")&&(T=parseInt(s.get("offset")||"0"),M++),M>0&&(s.delete("limit"),s.delete("offset")),s.size===0)return a.slice(T,T+y);for(const[S,w]of s.entries()){const C=w.split(",").map(D=>D.trim());for(const D of C)for(const N of a)if(typeof N!="object")isNaN(+N)?N.toString().toLowerCase().includes(w.toLowerCase())&&d.push(N):N===w&&d.push(N);else{const ee=N;if(!ee[S])continue;isNaN(+ee[S])?ee[S]?.toString().toLowerCase().includes(D.toLowerCase())&&d.push(N):ee[S]===D&&d.push(N)}}return d.slice(T,T+y)}firstCallDone(){return new Promise(e=>{if(!ye.firstCallDoneFlags.has(this.serviceURL))ye.firstCallDoneFlags.set(this.serviceURL,"loading"),e(!0);else{const t=()=>{[void 0,"loading"].includes(ye.firstCallDoneFlags.get(this.serviceURL))?window.requestAnimationFrame(t):e(!0)};t()}})}async get(e,t){const r=/dataProvider\((.*?)\)(.*?)$/;if(r.test(e)){this.blockUntilDone&&(await this.firstCallDone(),ye.firstCallDoneFlags.set(this.serviceURL,"loading"));const T=e.match(r);if(!T)throw new Error("dataProvider path is not valid");return await this.localGet(T[1],T[2])}const s={apiMethod:"get",path:e,additionalHeaders:t},u=await this.createHeaders(t),a=this.computeURL(e),d=JSON.stringify({url:a,headers:u,credentials:this.credentials,cache:this.cache,keepAlive:this.keepAlive});if(this.blockUntilDone&&(await this.firstCallDone(),ye.firstCallDoneFlags.set(this.serviceURL,"loading")),!ye.loadingGetPromises.has(d)){const T=new Promise(async M=>{try{const S=await fetch(a,{headers:u,credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),w=await this.handleResult(S,s);M({processed:w,response:this.lastResult})}catch{ye.firstCallDoneFlags.set(this.serviceURL,"error"),M(null)}});ye.loadingGetPromises.set(d,T)}const y=await ye.loadingGetPromises.get(d);return ye.loadingGetPromises.delete(d),y?(this.lastResult=y.response,y.processed):null}async getDetailed(e,t){const r=/dataProvider\((.*?)\)(.*?)$/.test(e),s=await this.get(e,t);if(s==null)return;const u=hn(s),a=this.computeURL(e);if(r)return{request:new Request(a,{method:"GET"}),result:u};const d=await this.createHeaders(t);return{request:new Request(a,{method:"GET",headers:new Headers(d),credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),response:this.lastResult,result:u}}async sendDetailed(e,t,r,s){const u=await this.send(e,t,r,s);if(u==null)return;const a=hn(u),d=this.computeURL(e),y=await this.createHeaders({Accept:"application/json","Content-Type":"application/json",...s});return{request:new Request(d,{method:r,headers:new Headers(y),credentials:this.credentials,body:JSON.stringify(t),keepalive:this.keepAlive}),response:this.lastResult,result:a}}async postDetailed(e,t,r){return this.sendDetailed(e,t,"POST",r)}async putDetailed(e,t,r){return this.sendDetailed(e,t,"PUT",r)}async patchDetailed(e,t,r){return this.sendDetailed(e,t,"PATCH",r)}async createHeaders(e){await this.auth();const t={};return this.token&&(t.Authorization="Bearer "+this.token),t["Accept-Language"]=at.getLanguage(),e&&Object.assign(t,e),t}computeURL(e,t={}){let r="";e.startsWith("http")?r=e:r=this.serviceURL+"/"+e,r.startsWith("http")||(r=window.location.origin+r);const s=new URL(r);for(const u in t)s.searchParams.set(u,t[u]);return s.toString().replace(/([^(https?:)])\/{2,}/g,"$1/")}async send(e,t,r="POST",s){const u={apiMethod:"send",path:e,additionalHeaders:s,method:r,data:t},a=await this.createHeaders(s);a.Accept="application/json",a["Content-Type"]="application/json";const d=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:r,body:JSON.stringify(t),keepalive:this.keepAlive});return await this.handleResult(d,u)}async submitFormData(e,t,r="POST",s){const u={apiMethod:"submitFormData",path:e,additionalHeaders:s,method:r,data:t},a=await this.createHeaders(s);a.Accept="application/json";const d=new FormData,y=t;for(const M in y)d.set(M,y[M]);const T=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:r,body:d,keepalive:this.keepAlive});return await this.handleResult(T,u)}async put(e,t,r){return this.send(e,t,"PUT",r)}async post(e,t,r){return this.send(e,t,"POST",r)}async patch(e,t,r){return this.send(e,t,"PATCH",r)}async delete(e,t,r){return this.send(e,t,"delete",r)}};ye.loadingGetPromises=new Map,ye.tokens=new Map,ye.invalidTokens=[],ye.failledTokenUpdates=new Map,ye.firstCallDoneFlags=new Map;let Pr=ye;at.getApiConfiguration(document.body||document.documentElement);var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ti(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jt={exports:{}},Pi=jt.exports,pn;function Ci(){return pn||(pn=1,(function(n,e){var t=[].slice;(function(r,s){return e!==null?n.exports=s():r.UrlPattern=s()})(Pi,function(){var r,s,u,a,d,y,T,M,S,w,C,D,N,ee,J;return S=function(_){return _.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},T=function(_,g){var U,E,P;for(P=[],U=-1,E=_.length;++U<E;)P=P.concat(g(_[U]));return P},ee=function(_,g){var U,E,P;for(P="",U=-1,E=_.length;++U<E;)P+=g(_[U]);return P},N=function(_){return new RegExp(_.toString()+"|").exec("").length-1},C=function(_,g){var U,E,P,z,F;for(z={},U=-1,P=_.length;++U<P;)E=_[U],F=g[U],F!=null&&(z[E]!=null?(Array.isArray(z[E])||(z[E]=[z[E]]),z[E].push(F)):z[E]=F);return z},r={},r.Result=function(_,g){this.value=_,this.rest=g},r.Tagged=function(_,g){this.tag=_,this.value=g},r.tag=function(_,g){return function(U){var E,P;if(E=g(U),E!=null)return P=new r.Tagged(_,E.value),new r.Result(P,E.rest)}},r.regex=function(_){return function(g){var U,E;if(U=_.exec(g),U!=null)return E=U[0],new r.Result(E,g.slice(E.length))}},r.sequence=function(){var _;return _=1<=arguments.length?t.call(arguments,0):[],function(g){var U,E,P,z,F,re;for(U=-1,E=_.length,re=[],z=g;++U<E;){if(P=_[U],F=P(z),F==null)return;re.push(F.value),z=F.rest}return new r.Result(re,z)}},r.pick=function(){var _,g;return _=arguments[0],g=2<=arguments.length?t.call(arguments,1):[],function(U){var E,P;if(P=r.sequence.apply(r,g)(U),P!=null)return E=P.value,P.value=E[_],P}},r.string=function(_){var g;return g=_.length,function(U){if(U.slice(0,g)===_)return new r.Result(_,U.slice(g))}},r.lazy=function(_){var g;return g=null,function(U){return g==null&&(g=_()),g(U)}},r.baseMany=function(_,g,U,E,P){var z,F,re,ae;for(re=P,ae=U?"":[];!(g!=null&&(z=g(re),z!=null)||(F=_(re),F==null));)U?ae+=F.value:ae.push(F.value),re=F.rest;if(!(E&&ae.length===0))return new r.Result(ae,re)},r.many1=function(_){return function(g){return r.baseMany(_,null,!1,!0,g)}},r.concatMany1Till=function(_,g){return function(U){return r.baseMany(_,g,!0,!0,U)}},r.firstChoice=function(){var _;return _=1<=arguments.length?t.call(arguments,0):[],function(g){var U,E,P,z;for(U=-1,E=_.length;++U<E;)if(P=_[U],z=P(g),z!=null)return z}},D=function(_){var g;return g={},g.wildcard=r.tag("wildcard",r.string(_.wildcardChar)),g.optional=r.tag("optional",r.pick(1,r.string(_.optionalSegmentStartChar),r.lazy(function(){return g.pattern}),r.string(_.optionalSegmentEndChar))),g.name=r.regex(new RegExp("^["+_.segmentNameCharset+"]+")),g.named=r.tag("named",r.pick(1,r.string(_.segmentNameStartChar),r.lazy(function(){return g.name}))),g.escapedChar=r.pick(1,r.string(_.escapeChar),r.regex(/^./)),g.static=r.tag("static",r.concatMany1Till(r.firstChoice(r.lazy(function(){return g.escapedChar}),r.regex(/^./)),r.firstChoice(r.string(_.segmentNameStartChar),r.string(_.optionalSegmentStartChar),r.string(_.optionalSegmentEndChar),g.wildcard))),g.token=r.lazy(function(){return r.firstChoice(g.wildcard,g.optional,g.named,g.static)}),g.pattern=r.many1(r.lazy(function(){return g.token})),g},M={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},y=function(_,g){if(Array.isArray(_))return ee(_,function(U){return y(U,g)});switch(_.tag){case"wildcard":return"(.*?)";case"named":return"(["+g+"]+)";case"static":return S(_.value);case"optional":return"(?:"+y(_.value,g)+")?"}},d=function(_,g){return g==null&&(g=M.segmentValueCharset),"^"+y(_,g)+"$"},a=function(_){if(Array.isArray(_))return T(_,a);switch(_.tag){case"wildcard":return["_"];case"named":return[_.value];case"static":return[];case"optional":return a(_.value)}},w=function(_,g,U,E){var P,z,F,re;if(E==null&&(E=!1),re=_[g],re==null){if(E)throw new Error("no values provided for key `"+g+"`");return}if(P=U[g]||0,z=Array.isArray(re)?re.length-1:0,P>z){if(E)throw new Error("too few values provided for key `"+g+"`");return}return F=Array.isArray(re)?re[P]:re,E&&(U[g]=P+1),F},u=function(_,g,U){var E,P;if(Array.isArray(_)){for(E=-1,P=_.length;++E<P;)if(u(_[E],g,U))return!0;return!1}switch(_.tag){case"wildcard":return w(g,"_",U,!1)!=null;case"named":return w(g,_.value,U,!1)!=null;case"static":return!1;case"optional":return u(_.value,g,U)}},J=function(_,g,U){if(Array.isArray(_))return ee(_,function(E){return J(E,g,U)});switch(_.tag){case"wildcard":return w(g,"_",U,!0);case"named":return w(g,_.value,U,!0);case"static":return _.value;case"optional":return u(_.value,g,U)?J(_.value,g,U):""}},s=function(_,g){var U,E,P,z,F;if(_ instanceof s){this.isRegex=_.isRegex,this.regex=_.regex,this.ast=_.ast,this.names=_.names;return}if(this.isRegex=_ instanceof RegExp,!(typeof _=="string"||this.isRegex))throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=_,g!=null){if(!Array.isArray(g))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(U=N(this.regex),g.length!==U)throw new Error("regex contains "+U+" groups but array of group names contains "+g.length);this.names=g}return}if(_==="")throw new Error("argument must not be the empty string");if(F=_.replace(/\s+/g,""),F!==_)throw new Error("argument must not contain whitespace");if(E={escapeChar:g?.escapeChar||M.escapeChar,segmentNameStartChar:g?.segmentNameStartChar||M.segmentNameStartChar,segmentNameCharset:g?.segmentNameCharset||M.segmentNameCharset,segmentValueCharset:g?.segmentValueCharset||M.segmentValueCharset,optionalSegmentStartChar:g?.optionalSegmentStartChar||M.optionalSegmentStartChar,optionalSegmentEndChar:g?.optionalSegmentEndChar||M.optionalSegmentEndChar,wildcardChar:g?.wildcardChar||M.wildcardChar},z=D(E),P=z.pattern(_),P==null)throw new Error("couldn't parse pattern");if(P.rest!=="")throw new Error("could only partially parse pattern");this.ast=P.value,this.regex=new RegExp(d(this.ast,E.segmentValueCharset)),this.names=a(this.ast)},s.prototype.match=function(_){var g,U;return U=this.regex.exec(_),U==null?null:(g=U.slice(1),this.names?C(this.names,g):g)},s.prototype.stringify=function(_){if(_==null&&(_={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(_!==Object(_))throw new Error("argument must be an object or undefined");return J(this.ast,_,{})},s.escapeForRegex=S,s.concatMap=T,s.stringConcatMap=ee,s.regexGroupCount=N,s.keysAndValuesToObject=C,s.P=r,s.newParser=D,s.defaultOptions=M,s.astNodeToRegexString=d,s.astNodeToNames=a,s.getParam=w,s.astNodeContainsSegmentsForProvidedParams=u,s.stringify=J,s})})(jt,jt.exports)),jt.exports}var Ri=Ci();const Di=Ti(Ri);class Cr{constructor(e){this.path=Cr.normalizePath(e)}getDataProviderKey(){return new Qt(this.path)}static normalizePath(e){const t=String(e).trim();if(!t)throw new RangeError("Endpoint: path cannot be empty");if(/^https?:\/\//i.test(t)){let y;try{y=new URL(t)}catch{throw new RangeError("Endpoint: invalid absolute URL")}return y.pathname=y.pathname.replace(/\/+/g,"/"),y.href}const r=t.indexOf("?"),s=t.indexOf("#");let u=t.length;r>=0&&(u=Math.min(u,r)),s>=0&&(u=Math.min(u,s));let a=t.slice(0,u);const d=t.slice(u);if(a=a.replace(/^\/+/,""),a=a.replace(/\/+/g,"/"),!a&&d)throw new RangeError("Endpoint: path cannot be empty");return a+d}static isNonEmpty(e){return String(e).trim().length>0}static looksLikeDataProviderPath(e){return/^\s*dataProvider\s*\(/i.test(String(e))}toString(){return this.path}}function nr(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Rr={exports:{}},mn;function Li(){return mn||(mn=1,(function(n,e){(function(t){n.exports=t()})(function(){return(function(){function t(r,s,u){function a(T,M){if(!s[T]){if(!r[T]){var S=typeof nr=="function"&&nr;if(!M&&S)return S(T,!0);if(d)return d(T,!0);var w=new Error("Cannot find module '"+T+"'");throw w.code="MODULE_NOT_FOUND",w}var C=s[T]={exports:{}};r[T][0].call(C.exports,function(D){var N=r[T][1][D];return a(N||D)},C,C.exports,t,r,s,u)}return s[T].exports}for(var d=typeof nr=="function"&&nr,y=0;y<u.length;y++)a(u[y]);return a}return t})()({1:[function(t,r,s){const u=t("./utils"),a=(function(){const d=u.stringToArray,y=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],T=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],M=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],S=["Thousand","Million","Billion","Trillion"];function w(A,R){var k=function(B,I,L){var q="";if(B<=19)q=(I?" and ":"")+(L?T[B]:y[B]);else if(B<100){const he=Math.floor(B/10),ue=B%10;q=(I?" and ":"")+M[he-2],ue>0?q+="-"+k(ue,!1,L):L&&(q=q.substring(0,q.length-1)+"ieth")}else if(B<1e3){const he=Math.floor(B/100),ue=B%100;q=(I?", ":"")+y[he]+" Hundred",ue>0?q+=k(ue,!0,L):L&&(q+="th")}else{var K=Math.floor(Math.log10(B)/3);K>S.length&&(K=S.length);const he=Math.pow(10,K*3),ue=Math.floor(B/he),te=B-ue*he;q=(I?", ":"")+k(ue,!1,!1)+" "+S[K-1],te>0?q+=k(te,!0,L):L&&(q+="th")}return q},O=k(A,!1,R);return O}const C=Object.create(null);y.forEach(function(A,R){C[A.toLowerCase()]=R}),T.forEach(function(A,R){C[A.toLowerCase()]=R}),M.forEach(function(A,R){const k=A.toLowerCase();C[k]=(R+2)*10,C[k.substring(0,A.length-1)+"ieth"]=C[k]}),C.hundredth=100,S.forEach(function(A,R){const k=A.toLowerCase(),O=Math.pow(10,(R+1)*3);C[k]=O,C[k+"th"]=O});function D(A){const k=A.split(/,\s|\sand\s|[\s\\-]/).map(I=>C[I]);let O=[0];return k.forEach(I=>{if(I<100){let L=O.pop();L>=1e3&&(O.push(L),L=0),O.push(L+I)}else O.push(O.pop()*I)}),O.reduce((I,L)=>I+L,0)}const N=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],ee={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function J(A){for(var R=0;R<N.length;R++){const k=N[R];if(A>=k[0])return k[1]+J(A-k[0])}return""}function _(A){for(var R=0,k=1,O=A.length-1;O>=0;O--){const B=A[O],I=ee[B];I<k?R-=I:(k=I,R+=I)}return R}function g(A,R){for(var k=[],O=R.charCodeAt(0);A>0;)k.unshift(String.fromCharCode((A-1)%26+O)),A=Math.floor((A-1)/26);return k.join("")}function U(A,R){for(var k=R.charCodeAt(0),O=0,B=0;B<A.length;B++)O+=(A.charCodeAt(A.length-B-1)-k+1)*Math.pow(26,B);return O}function E(A,R){if(typeof A>"u")return;A=Math.floor(A);const k=ae(R);return F(A,k)}const P={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},z={UPPER:"upper",LOWER:"lower",TITLE:"title"};function F(A,R){let k;const O=A<0;switch(A=Math.abs(A),R.primary){case P.LETTERS:k=g(A,R.case===z.UPPER?"A":"a");break;case P.ROMAN:k=J(A),R.case===z.UPPER&&(k=k.toUpperCase());break;case P.WORDS:k=w(A,R.ordinal),R.case===z.UPPER?k=k.toUpperCase():R.case===z.LOWER&&(k=k.toLowerCase());break;case P.DECIMAL:k=""+A;var B=R.mandatoryDigits-k.length;if(B>0){var I=new Array(B+1).join("0");k=I+k}if(R.zeroCode!==48&&(k=d(k).map(he=>String.fromCodePoint(he.codePointAt(0)+R.zeroCode-48)).join("")),R.regular){const he=Math.floor((k.length-1)/R.groupingSeparators.position);for(let ue=he;ue>0;ue--){const te=k.length-ue*R.groupingSeparators.position;k=k.substr(0,te)+R.groupingSeparators.character+k.substr(te)}}else R.groupingSeparators.reverse().forEach(he=>{const ue=k.length-he.position;k=k.substr(0,ue)+he.character+k.substr(ue)});if(R.ordinal){var L={1:"st",2:"nd",3:"rd"},q=k[k.length-1],K=L[q];(!K||k.length>1&&k[k.length-2]==="1")&&(K="th"),k=k+K}break;case P.SEQUENCE:throw{code:"D3130",value:R.token}}return O&&(k="-"+k),k}const re=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function ae(A){const R={type:"integer",primary:P.DECIMAL,case:z.LOWER,ordinal:!1};let k,O;const B=A.lastIndexOf(";");switch(B===-1?k=A:(k=A.substring(0,B),O=A.substring(B+1),O[0]==="o"&&(R.ordinal=!0)),k){case"A":R.case=z.UPPER;case"a":R.primary=P.LETTERS;break;case"I":R.case=z.UPPER;case"i":R.primary=P.ROMAN;break;case"W":R.case=z.UPPER,R.primary=P.WORDS;break;case"Ww":R.case=z.TITLE,R.primary=P.WORDS;break;case"w":R.primary=P.WORDS;break;default:{let I=null,L=0,q=0,K=[],he=0;if(d(k).map(te=>te.codePointAt(0)).reverse().forEach(te=>{let Z=!1;for(let le=0;le<re.length;le++){const Q=re[le];if(te>=Q&&te<=Q+9){if(Z=!0,L++,he++,I===null)I=Q;else if(Q!==I)throw{code:"D3131"};break}}Z||(te===35?(he++,q++):K.push({position:he,character:String.fromCodePoint(te)}))}),L>0){R.primary=P.DECIMAL,R.zeroCode=I,R.mandatoryDigits=L,R.optionalDigits=q;const Z=function(le){if(le.length===0)return 0;const Q=le[0].character;for(let Le=1;Le<le.length;Le++)if(le[Le].character!==Q)return 0;const Ne=le.map(Le=>Le.position),Qe=function(Le,Be){return Be===0?Le:Qe(Be,Le%Be)},je=Ne.reduce(Qe);for(let Le=1;Le<=Ne.length;Le++)if(Ne.indexOf(Le*je)===-1)return 0;return je}(K);Z>0?(R.regular=!0,R.groupingSeparators={position:Z,character:K[0].character}):(R.regular=!1,R.groupingSeparators=K)}else R.primary=P.SEQUENCE,R.token=k}}return R}const _e={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function ge(A){var R=[];const k={type:"datetime",parts:R},O=function(Z,le){if(le>Z){let Q=A.substring(Z,le);Q=Q.split("]]").join("]"),R.push({type:"literal",value:Q})}};for(var B=0,I=0;I<A.length;){if(A.charAt(I)==="["){if(A.charAt(I+1)==="["){O(B,I),R.push({type:"literal",value:"["}),I+=2,B=I;continue}if(O(B,I),B=I,I=A.indexOf("]",B),I===-1)throw{code:"D3135"};let Z=A.substring(B+1,I);Z=Z.split(/\s+/).join("");var L={type:"marker",component:Z.charAt(0)},q=Z.lastIndexOf(","),K;if(q!==-1){const le=Z.substring(q+1),Q=le.indexOf("-");let Ne,Qe;const je=function(Be){if(!(typeof Be>"u"||Be==="*"))return parseInt(Be)};Q===-1?Ne=le:(Ne=le.substring(0,Q),Qe=le.substring(Q+1));const Le={min:je(Ne),max:je(Qe)};L.width=Le,K=Z.substring(1,q)}else K=Z.substring(1);if(K.length===1)L.presentation1=K;else if(K.length>1){var he=K.charAt(K.length-1);"atco".indexOf(he)!==-1?(L.presentation2=he,he==="o"&&(L.ordinal=!0),L.presentation1=K.substring(0,K.length-1)):L.presentation1=K}else L.presentation1=_e[L.component];if(typeof L.presentation1>"u")throw{code:"D3132",value:L.component};if(L.presentation1[0]==="n")L.names=z.LOWER;else if(L.presentation1[0]==="N")L.presentation1[1]==="n"?L.names=z.TITLE:L.names=z.UPPER;else if("YMDdFWwXxHhmsf".indexOf(L.component)!==-1){var ue=L.presentation1;if(L.presentation2&&(ue+=";"+L.presentation2),L.integerFormat=ae(ue),L.width&&L.width.min!==void 0&&L.integerFormat.mandatoryDigits<L.width.min&&(L.integerFormat.mandatoryDigits=L.width.min),L.component==="Y")if(L.n=-1,L.width&&L.width.max!==void 0)L.n=L.width.max,L.integerFormat.mandatoryDigits=L.n;else{var te=L.integerFormat.mandatoryDigits+L.integerFormat.optionalDigits;te>=2&&(L.n=te)}const le=R[R.length-1];le&&le.integerFormat&&(le.integerFormat.parseWidth=le.integerFormat.mandatoryDigits)}(L.component==="Z"||L.component==="z")&&(L.integerFormat=ae(L.presentation1)),R.push(L),B=I+1}I++}return O(B,I),k}const pe=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],Je=1e3*60*60*24,ce=function(A){const R=Date.UTC(A.year,A.month);var k=new Date(R).getUTCDay();return k===0&&(k=7),k>4?R+(8-k)*Je:R-(k-1)*Je},me=function(A,R){return{year:A,month:R,nextMonth:function(){return R===11?me(A+1,0):me(A,R+1)},previousMonth:function(){return R===0?me(A-1,11):me(A,R-1)},nextYear:function(){return me(A+1,R)},previousYear:function(){return me(A-1,R)}}},We=function(A,R){return(R-A)/(Je*7)+1},ie=(A,R)=>{let k;switch(R){case"Y":k=A.getUTCFullYear();break;case"M":k=A.getUTCMonth()+1;break;case"D":k=A.getUTCDate();break;case"d":{const O=Date.UTC(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate()),B=Date.UTC(A.getUTCFullYear(),0);k=(O-B)/Je+1;break}case"F":k=A.getUTCDay(),k===0&&(k=7);break;case"W":{const O=me(A.getUTCFullYear(),0),B=ce(O),I=Date.UTC(O.year,A.getUTCMonth(),A.getUTCDate());let L=We(B,I);if(L>52){const q=ce(O.nextYear());I>=q&&(L=1)}else if(L<1){const q=ce(O.previousYear());L=We(q,I)}k=Math.floor(L);break}case"w":{const O=me(A.getUTCFullYear(),A.getUTCMonth()),B=ce(O),I=Date.UTC(O.year,O.month,A.getUTCDate());let L=We(B,I);if(L>4){const q=ce(O.nextMonth());I>=q&&(L=1)}else if(L<1){const q=ce(O.previousMonth());L=We(q,I)}k=Math.floor(L);break}case"X":{const O=me(A.getUTCFullYear(),0),B=ce(O),I=ce(O.nextYear()),L=A.getTime();L<B?k=O.year-1:L>=I?k=O.year+1:k=O.year;break}case"x":{const O=me(A.getUTCFullYear(),A.getUTCMonth()),B=ce(O),I=O.nextMonth(),L=ce(I),q=A.getTime();q<B?k=O.previousMonth().month+1:q>=L?k=I.month+1:k=O.month+1;break}case"H":k=A.getUTCHours();break;case"h":k=A.getUTCHours(),k=k%12,k===0&&(k=12);break;case"P":k=A.getUTCHours()>=12?"pm":"am";break;case"m":k=A.getUTCMinutes();break;case"s":k=A.getUTCSeconds();break;case"f":k=A.getUTCMilliseconds();break;case"Z":case"z":break;case"C":k="ISO";break;case"E":k="ISO";break}return k};let Ce=null;function nt(A,R,k){var O=0,B=0;if(typeof k<"u"){const ue=parseInt(k);O=Math.floor(ue/100),B=ue%100}var I=function(ue,te){var Z=ie(ue,te.component);if("YMDdFWwXxHhms".indexOf(te.component)!==-1)if(te.component==="Y"&&te.n!==-1&&(Z=Z%Math.pow(10,te.n)),te.names){if(te.component==="M"||te.component==="x")Z=Pe[Z-1];else if(te.component==="F")Z=pe[Z];else throw{code:"D3133",value:te.component};te.names===z.UPPER?Z=Z.toUpperCase():te.names===z.LOWER&&(Z=Z.toLowerCase()),te.width&&Z.length>te.width.max&&(Z=Z.substring(0,te.width.max))}else Z=F(Z,te.integerFormat);else if(te.component==="f")Z=F(Z,te.integerFormat);else if(te.component==="Z"||te.component==="z"){const le=O*100+B;if(te.integerFormat.regular)Z=F(le,te.integerFormat);else{const Q=te.integerFormat.mandatoryDigits;if(Q===1||Q===2)Z=F(O,te.integerFormat),B!==0&&(Z+=":"+E(B,"00"));else if(Q===3||Q===4)Z=F(le,te.integerFormat);else throw{code:"D3134",value:Q}}le>=0&&(Z="+"+Z),te.component==="z"&&(Z="GMT"+Z),le===0&&te.presentation2==="t"&&(Z="Z")}else te.component==="P"&&te.names===z.UPPER&&(Z=Z.toUpperCase());return Z};let L;typeof R>"u"?(Ce===null&&(Ce=ge("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),L=Ce):L=ge(R);const q=(60*O+B)*60*1e3,K=new Date(A+q);let he="";return L.parts.forEach(function(ue){ue.type==="literal"?he+=ue.value:he+=I(K,ue)}),he}function h(A){var R=Object.create(null);if(A.type==="datetime")R.type="datetime",R.parts=A.parts.map(function(k){var O=Object.create(null);if(k.type==="literal")O.regex=k.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(k.component==="Z"||k.component==="z"){let I;Array.isArray(k.integerFormat.groupingSeparators)||(I=k.integerFormat.groupingSeparators),O.regex="",k.component==="z"&&(O.regex="GMT"),O.regex+="[-+][0-9]+",I&&(O.regex+=I.character+"[0-9]+"),O.parse=function(L){k.component==="z"&&(L=L.substring(3));let q=0,K=0;return I?(q=Number.parseInt(L.substring(0,L.indexOf(I.character))),K=Number.parseInt(L.substring(L.indexOf(I.character)+1))):L.length-1<=2?q=Number.parseInt(L):(q=Number.parseInt(L.substring(0,3)),K=Number.parseInt(L.substring(3))),q*60+K}}else if(k.component==="f")O.regex="[0-9]+",O.parse=function(I){return parseFloat("0."+I.substring(0,3))*1e3};else if(k.integerFormat)O=h(k.integerFormat);else{O.regex="[a-zA-Z]+";var B=Object.create(null);if(k.component==="M"||k.component==="x")Pe.forEach(function(I,L){k.width&&k.width.max?B[I.substring(0,k.width.max)]=L+1:B[I]=L+1});else if(k.component==="F")pe.forEach(function(I,L){L>0&&(k.width&&k.width.max?B[I.substring(0,k.width.max)]=L:B[I]=L)});else if(k.component==="P")B={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:k.component};O.parse=function(I){return B[I]}}return O.component=k.component,O});else{R.type="integer";const k=A.case===z.UPPER;switch(A.primary){case P.LETTERS:R.regex=k?"[A-Z]+":"[a-z]+",R.parse=function(O){return U(O,k?"A":"a")};break;case P.ROMAN:R.regex=k?"[MDCLXVI]+":"[mdclxvi]+",R.parse=function(O){return _(k?O:O.toUpperCase())};break;case P.WORDS:R.regex="(?:"+u.keys(C).concat("and","[\\-, ]").join("|")+")+",R.parse=function(O){return D(O.toLowerCase())};break;case P.DECIMAL:R.regex="[0-9]",A.parseWidth?R.regex+=`{${A.parseWidth}}`:R.regex+="+",A.ordinal&&(R.regex+="(?:th|st|nd|rd)"),R.parse=function(O){let B=O;return A.ordinal&&(B=O.substring(0,O.length-2)),A.regular?B=B.split(",").join(""):A.groupingSeparators.forEach(I=>{B=B.split(I.character).join("")}),A.zeroCode!==48&&(B=B.split("").map(I=>String.fromCodePoint(I.codePointAt(0)-A.zeroCode+48)).join("")),parseInt(B)};break;case P.SEQUENCE:throw{code:"D3130",value:A.token}}}return R}function b(A,R){if(typeof A>"u")return;const k=ae(R);return h(k).parse(A)}function G(A,R){const k=ge(R),O=h(k),B="^"+O.parts.map(K=>"("+K.regex+")").join("")+"$";var L=new RegExp(B,"i").exec(A);if(L!==null){const Q=Object.create(null);for(let c=1;c<L.length;c++){const f=O.parts[c-1];f.parse&&(Q[f.component]=f.parse(L[c]))}if(Object.getOwnPropertyNames(Q).length===0)return;let Ne=0;const Qe=c=>{Ne<<=1,Ne+=c?1:0},je=c=>!(~c&Ne)&&!!(c&Ne);"YXMxWwdD".split("").forEach(c=>Qe(Q[c]));const Be=!je(161)&&je(130),ot=je(84),Pt=!ot&&je(72);Ne=0,"PHhmsf".split("").forEach(c=>Qe(Q[c]));const H=!je(23)&&je(47),tt=(Be?"YD":ot?"XxwF":Pt?"XWF":"YMD")+(H?"Phmsf":"Hmsf"),zt=this.environment.timestamp;let it=!1,yt=!1;if(tt.split("").forEach(c=>{if(typeof Q[c]>"u")it?(Q[c]="MDd".indexOf(c)!==-1?1:0,yt=!0):Q[c]=ie(zt,c);else if(it=!0,yt)throw{code:"D3136"}}),Q.M>0?Q.M-=1:Q.M=0,Be){const c=Date.UTC(Q.Y,0),f=(Q.d-1)*1e3*60*60*24,p=new Date(c+f);Q.M=p.getUTCMonth(),Q.D=p.getUTCDate()}if(ot)throw{code:"D3136"};if(Pt)throw{code:"D3136"};H&&(Q.H=Q.h===12?0:Q.h,Q.P===1&&(Q.H+=12));var q=Date.UTC(Q.Y,Q.M,Q.D,Q.H,Q.m,Q.s,Q.f);return(Q.Z||Q.z)&&(q-=(Q.Z||Q.z)*60*1e3),q}}var fe=new RegExp("^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function Ae(A,R){if(!(typeof A>"u"))if(typeof R>"u"){if(!fe.test(A))throw{stack:new Error().stack,code:"D3110",value:A};return Date.parse(A)}else return G.call(this,A,R)}function we(A,R,k){if(!(typeof A>"u"))return nt.call(this,A,R,k)}return{formatInteger:E,parseInteger:b,fromMillis:we,toMillis:Ae}})();r.exports=a},{"./utils":6}],2:[function(t,r,s){(function(u){(function(){var a=t("./utils");const d=(()=>{var y=a.isNumeric,T=a.isArrayOfStrings,M=a.isArrayOfNumbers,S=a.isSequence,w=a.isFunction,C=a.isLambda,D=a.isPromise,N=a.getFunctionArity,ee=a.isDeepEqual,J=a.stringToArray;function _(i){if(!(typeof i>"u")){var o=0;return i.forEach(function(l){o+=l}),o}}function g(i){return typeof i>"u"?0:i.length}function U(i){if(!(typeof i>"u"||i.length===0))return Math.max.apply(Math,i)}function E(i){if(!(typeof i>"u"||i.length===0))return Math.min.apply(Math,i)}function P(i){if(!(typeof i>"u"||i.length===0)){var o=0;return i.forEach(function(l){o+=l}),o/i.length}}function z(i,o=!1){if(!(typeof i>"u")){var l;if(typeof i=="string")l=i;else if(w(i))l="";else{if(typeof i=="number"&&!isFinite(i))throw{code:"D3001",value:i,stack:new Error().stack};var v=o?2:0;Array.isArray(i)&&i.outerWrapper&&(i=i[0]),l=JSON.stringify(i,function(m,x){return typeof x<"u"&&x!==null&&y(x)?x.toPrecision&&!Number.isInteger(x)?Number(x.toPrecision(15)):x:x&&w(x)?"":x},v)}return l}}function F(i,o,l){if(!(typeof i>"u")){var v=J(i),m=v.length;if(m+o<0&&(o=0),typeof l<"u"){if(l<=0)return"";var x=o>=0?o+l:m+o+l;return v.slice(o,x).join("")}return v.slice(o).join("")}}function re(i,o){if(!(typeof i>"u")){var l=i.indexOf(o);return l>-1?i.substr(0,l):i}}function ae(i,o){if(!(typeof i>"u")){var l=i.indexOf(o);return l>-1?i.substr(l+o.length):i}}function _e(i){if(!(typeof i>"u"))return i.toLowerCase()}function ge(i){if(!(typeof i>"u"))return i.toUpperCase()}function pe(i){if(!(typeof i>"u"))return J(i).length}function Pe(i){if(!(typeof i>"u")){var o=i.replace(/[ \t\n\r]+/gm," ");return o.charAt(0)===" "&&(o=o.substring(1)),o.charAt(o.length-1)===" "&&(o=o.substring(0,o.length-1)),o}}function Je(i,o,l){if(!(typeof i>"u")){(typeof l>"u"||l.length===0)&&(l=" ");var v;o=Math.trunc(o);var m=Math.abs(o)-pe(i);if(m>0){var x=new Array(m+1).join(l);l.length>1&&(x=F(x,0,m)),o>0?v=i+x:v=x+i}else v=i;return v}}async function ce(i,o){var l=i.apply(this,[o]);if(D(l)&&(l=await l),l&&!(typeof l.start=="number"||l.end==="number"||Array.isArray(l.groups)||w(l.next)))throw{code:"T1010",stack:new Error().stack};return l}async function me(i,o){if(!(typeof i>"u"||typeof o>"u")){var l;if(typeof o=="string")l=i.indexOf(o)!==-1;else{var v=await ce(o,i);l=typeof v<"u"}return l}}async function We(i,o,l){if(!(typeof i>"u")){if(l<0)throw{stack:new Error().stack,value:l,code:"D3040",index:3};var v=this.createSequence();if(typeof l>"u"||l>0){var m=0,x=await ce(o,i);if(typeof x<"u")for(;typeof x<"u"&&(typeof l>"u"||m<l);)v.push({match:x.match,index:x.start,groups:x.groups}),x=await ce(x.next),m++}return v}}async function ie(i,o,l,v){if(!(typeof i>"u")){var m=this;if(o==="")throw{code:"D3010",stack:new Error().stack,value:o,index:2};if(v<0)throw{code:"D3011",stack:new Error().stack,value:v,index:4};var x;typeof l=="string"?x=function(Se){for(var Me="",be=0,Re=l.indexOf("$",be);Re!==-1&&be<l.length;){Me+=l.substring(be,Re),be=Re+1;var et=l.charAt(be);if(et==="$")Me+="$",be++;else if(et==="0")Me+=Se.match,be++;else{var qe;if(Se.groups.length===0?qe=1:qe=Math.floor(Math.log(Se.groups.length)*Math.LOG10E)+1,Re=parseInt(l.substring(be,be+qe),10),qe>1&&Re>Se.groups.length&&(Re=parseInt(l.substring(be,be+qe-1),10)),isNaN(Re))Me+="$";else{if(Se.groups.length>0){var st=Se.groups[Re-1];typeof st<"u"&&(Me+=st)}be+=Re.toString().length}}Re=l.indexOf("$",be)}return Me+=l.substring(be),Me}:x=l;var $="",j=0;if(typeof v>"u"||v>0){var se=0;if(typeof o=="string"){for(var W=i.indexOf(o,j);W!==-1&&(typeof v>"u"||se<v);)$+=i.substring(j,W),$+=l,j=W+o.length,se++,W=i.indexOf(o,j);$+=i.substring(j)}else{var Ee=await ce(o,i);if(typeof Ee<"u"){for(;typeof Ee<"u"&&(typeof v>"u"||se<v);){$+=i.substring(j,Ee.start);var xe=x.apply(m,[Ee]);if(D(xe)&&(xe=await xe),typeof xe=="string")$+=xe;else throw{code:"D3012",stack:new Error().stack,value:xe};j=Ee.start+Ee.match.length,se++,Ee=await ce(Ee.next)}$+=i.substring(j)}else $=i}}else $=i;return $}}function Ce(i){if(!(typeof i>"u")){var o=typeof window<"u"?window.btoa:function(l){return new u.Buffer.from(l,"binary").toString("base64")};return o(i)}}function nt(i){if(!(typeof i>"u")){var o=typeof window<"u"?window.atob:function(l){return new u.Buffer.from(l,"base64").toString("binary")};return o(i)}}function h(i){if(!(typeof i>"u")){var o;try{o=encodeURIComponent(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"encodeUrlComponent"}}return o}}function b(i){if(!(typeof i>"u")){var o;try{o=encodeURI(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"encodeUrl"}}return o}}function G(i){if(!(typeof i>"u")){var o;try{o=decodeURIComponent(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"decodeUrlComponent"}}return o}}function fe(i){if(!(typeof i>"u")){var o;try{o=decodeURI(i)}catch{throw{code:"D3140",stack:new Error().stack,value:i,functionName:"decodeUrl"}}return o}}async function Ae(i,o,l){if(!(typeof i>"u")){if(l<0)throw{code:"D3020",stack:new Error().stack,value:l,index:3};var v=[];if(typeof l>"u"||l>0)if(typeof o=="string")v=i.split(o,l);else{var m=0,x=await ce(o,i);if(typeof x<"u"){for(var $=0;typeof x<"u"&&(typeof l>"u"||m<l);)v.push(i.substring($,x.start)),$=x.end,x=await ce(x.next),m++;(typeof l>"u"||m<l)&&v.push(i.substring($))}else v.push(i)}return v}}function we(i,o){if(!(typeof i>"u"))return typeof o>"u"&&(o=""),i.join(o)}function A(i,o,l){if(!(typeof i>"u")){var v={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},m=v;typeof l<"u"&&a.keys(l).forEach(function(ne){m[ne]=l[ne]});for(var x=[],$=m["zero-digit"].charCodeAt(0),j=$;j<$+10;j++)x.push(String.fromCharCode(j));var se=x.concat([m["decimal-separator"],m["exponent-separator"],m["grouping-separator"],m.digit,m["pattern-separator"]]),W=o.split(m["pattern-separator"]);if(W.length>2)throw{code:"D3080",stack:new Error().stack};var Ee=function(ne){var Te=(function(){for(var Oe,Ze=0;Ze<ne.length;Ze++)if(Oe=ne.charAt(Ze),se.indexOf(Oe)!==-1&&Oe!==m["exponent-separator"])return ne.substring(0,Ze);return""})(),ze=(function(){for(var Oe,Ze=ne.length-1;Ze>=0;Ze--)if(Oe=ne.charAt(Ze),se.indexOf(Oe)!==-1&&Oe!==m["exponent-separator"])return ne.substring(Ze+1);return""})(),ke=ne.substring(Te.length,ne.length-ze.length),Xe,mt,Ye,wt,Ke=ne.indexOf(m["exponent-separator"],Te.length);Ke===-1||Ke>ne.length-ze.length?(Xe=ke,mt=void 0):(Xe=ke.substring(0,Ke),mt=ke.substring(Ke+1));var rt=Xe.indexOf(m["decimal-separator"]);return rt===-1?(Ye=Xe,wt=ze):(Ye=Xe.substring(0,rt),wt=Xe.substring(rt+1)),{prefix:Te,suffix:ze,activePart:ke,mantissaPart:Xe,exponentPart:mt,integerPart:Ye,fractionalPart:wt,subpicture:ne}},xe=function(ne){var Te,ze,ke=ne.subpicture,Xe=ke.indexOf(m["decimal-separator"]);Xe!==ke.lastIndexOf(m["decimal-separator"])&&(Te="D3081"),ke.indexOf(m.percent)!==ke.lastIndexOf(m.percent)&&(Te="D3082"),ke.indexOf(m["per-mille"])!==ke.lastIndexOf(m["per-mille"])&&(Te="D3083"),ke.indexOf(m.percent)!==-1&&ke.indexOf(m["per-mille"])!==-1&&(Te="D3084");var mt=!1;for(ze=0;ze<ne.mantissaPart.length;ze++){var Ye=ne.mantissaPart.charAt(ze);if(x.indexOf(Ye)!==-1||Ye===m.digit){mt=!0;break}}mt||(Te="D3085");var wt=ne.activePart.split("").map(function(Oe){return se.indexOf(Oe)===-1?"p":"a"}).join("");wt.indexOf("p")!==-1&&(Te="D3086"),Xe!==-1?(ke.charAt(Xe-1)===m["grouping-separator"]||ke.charAt(Xe+1)===m["grouping-separator"])&&(Te="D3087"):ne.integerPart.charAt(ne.integerPart.length-1)===m["grouping-separator"]&&(Te="D3088"),ke.indexOf(m["grouping-separator"]+m["grouping-separator"])!==-1&&(Te="D3089");var Ke=ne.integerPart.indexOf(m.digit);Ke!==-1&&ne.integerPart.substring(0,Ke).split("").filter(function(Oe){return x.indexOf(Oe)>-1}).length>0&&(Te="D3090"),Ke=ne.fractionalPart.lastIndexOf(m.digit),Ke!==-1&&ne.fractionalPart.substring(Ke).split("").filter(function(Oe){return x.indexOf(Oe)>-1}).length>0&&(Te="D3091");var rt=typeof ne.exponentPart=="string";if(rt&&ne.exponentPart.length>0&&(ke.indexOf(m.percent)!==-1||ke.indexOf(m["per-mille"])!==-1)&&(Te="D3092"),rt&&(ne.exponentPart.length===0||ne.exponentPart.split("").filter(function(Oe){return x.indexOf(Oe)===-1}).length>0)&&(Te="D3093"),Te)throw{code:Te,stack:new Error().stack}},Se=function(ne){var Te=function(Ie,hr){for(var Wt=[],ut=Ie.indexOf(m["grouping-separator"]);ut!==-1;){var dr=(hr?Ie.substring(0,ut):Ie.substring(ut)).split("").filter(function(Dt){return x.indexOf(Dt)!==-1||Dt===m.digit}).length;Wt.push(dr),ut=ne.integerPart.indexOf(m["grouping-separator"],ut+1)}return Wt},ze=Te(ne.integerPart),ke=function(Ie){if(Ie.length===0)return 0;for(var hr=function(dr,Dt){return Dt===0?dr:hr(Dt,dr%Dt)},Wt=Ie.reduce(hr),ut=1;ut<=Ie.length;ut++)if(Ie.indexOf(ut*Wt)===-1)return 0;return Wt},Xe=ke(ze),mt=Te(ne.fractionalPart,!0),Ye=ne.integerPart.split("").filter(function(Ie){return x.indexOf(Ie)!==-1}).length,wt=Ye,Ke=ne.fractionalPart.split(""),rt=Ke.filter(function(Ie){return x.indexOf(Ie)!==-1}).length,Oe=Ke.filter(function(Ie){return x.indexOf(Ie)!==-1||Ie===m.digit}).length,Ze=typeof ne.exponentPart=="string";Ye===0&&Oe===0&&(Ze?(rt=1,Oe=1):Ye=1),Ze&&Ye===0&&ne.integerPart.indexOf(m.digit)!==-1&&(Ye=1),Ye===0&&rt===0&&(rt=1);var Mn=0;return Ze&&(Mn=ne.exponentPart.split("").filter(function(Ie){return x.indexOf(Ie)!==-1}).length),{integerPartGroupingPositions:ze,regularGrouping:Xe,minimumIntegerPartSize:Ye,scalingFactor:wt,prefix:ne.prefix,fractionalPartGroupingPositions:mt,minimumFactionalPartSize:rt,maximumFactionalPartSize:Oe,minimumExponentSize:Mn,suffix:ne.suffix,picture:ne.subpicture}},Me=W.map(Ee);Me.forEach(xe);var be=Me.map(Se),Re=m["minus-sign"],et=m["zero-digit"],qe=m["decimal-separator"],st=m["grouping-separator"];be.length===1&&(be.push(JSON.parse(JSON.stringify(be[0]))),be[1].prefix=Re+be[1].prefix);var Ue;i>=0?Ue=be[0]:Ue=be[1];var Gt;Ue.picture.indexOf(m.percent)!==-1?Gt=i*100:Ue.picture.indexOf(m["per-mille"])!==-1?Gt=i*1e3:Gt=i;var pt,Rt;if(Ue.minimumExponentSize===0)pt=Gt;else{var ws=Math.pow(10,Ue.scalingFactor),Es=Math.pow(10,Ue.scalingFactor-1);if(pt=Gt,Rt=0,pt!==0){for(;Math.abs(pt)<Es;)pt*=10,Rt-=1;for(;Math.abs(pt)>ws;)pt/=10,Rt+=1}}var _s=L(pt,Ue.maximumFactionalPartSize),Dn=function(ne,Te){var ze=Math.abs(ne).toFixed(Te);return et!=="0"&&(ze=ze.split("").map(function(ke){return ke>="0"&&ke<="9"?x[ke.charCodeAt(0)-48]:ke}).join("")),ze},oe=Dn(_s,Ue.maximumFactionalPartSize),He=oe.indexOf(".");for(He===-1?oe=oe+qe:oe=oe.replace(".",qe);oe.charAt(0)===et;)oe=oe.substring(1);for(;oe.charAt(oe.length-1)===et;)oe=oe.substring(0,oe.length-1);He=oe.indexOf(qe);var Vt=Ue.minimumIntegerPartSize-He,Ln=Ue.minimumFactionalPartSize-(oe.length-He-1);if(oe=(Vt>0?new Array(Vt+1).join(et):"")+oe,oe=oe+(Ln>0?new Array(Ln+1).join(et):""),He=oe.indexOf(qe),Ue.regularGrouping>0)for(var As=Math.floor((He-1)/Ue.regularGrouping),lr=1;lr<=As;lr++)oe=[oe.slice(0,He-lr*Ue.regularGrouping),st,oe.slice(He-lr*Ue.regularGrouping)].join("");else Ue.integerPartGroupingPositions.forEach(function(ne){oe=[oe.slice(0,He-ne),st,oe.slice(He-ne)].join(""),He++});if(He=oe.indexOf(qe),Ue.fractionalPartGroupingPositions.forEach(function(ne){oe=[oe.slice(0,ne+He+1),st,oe.slice(ne+He+1)].join("")}),He=oe.indexOf(qe),(Ue.picture.indexOf(qe)===-1||He===oe.length-1)&&(oe=oe.substring(0,oe.length-1)),typeof Rt<"u"){var fr=Dn(Rt,0);Vt=Ue.minimumExponentSize-fr.length,Vt>0&&(fr=new Array(Vt+1).join(et)+fr),oe=oe+m["exponent-separator"]+(Rt<0?Re:"")+fr}return oe=Ue.prefix+oe+Ue.suffix,oe}}function R(i,o){if(!(typeof i>"u")){if(i=L(i),typeof o>"u"?o=10:o=L(o),o<2||o>36)throw{code:"D3100",stack:new Error().stack,value:o};var l=i.toString(o);return l}}function k(i){var o;if(!(typeof i>"u")){if(typeof i=="number")o=i;else if(typeof i=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(i)&&!isNaN(parseFloat(i))&&isFinite(i))o=parseFloat(i);else if(typeof i=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(i))o=Number(i);else if(i===!0)o=1;else if(i===!1)o=0;else throw{code:"D3030",value:i,stack:new Error().stack,index:1};return o}}function O(i){var o;if(!(typeof i>"u"))return o=Math.abs(i),o}function B(i){var o;if(!(typeof i>"u"))return o=Math.floor(i),o}function I(i){var o;if(!(typeof i>"u"))return o=Math.ceil(i),o}function L(i,o){var l;if(!(typeof i>"u")){if(o){var v=i.toString().split("e");i=+(v[0]+"e"+(v[1]?+v[1]+o:o))}l=Math.round(i);var m=l-i;return Math.abs(m)===.5&&Math.abs(l%2)===1&&(l=l-1),o&&(v=l.toString().split("e"),l=+(v[0]+"e"+(v[1]?+v[1]-o:-o))),Object.is(l,-0)&&(l=0),l}}function q(i){var o;if(!(typeof i>"u")){if(i<0)throw{stack:new Error().stack,code:"D3060",index:1,value:i};return o=Math.sqrt(i),o}}function K(i,o){var l;if(!(typeof i>"u")){if(l=Math.pow(i,o),!isFinite(l))throw{stack:new Error().stack,code:"D3061",index:1,value:i,exp:o};return l}}function he(){return Math.random()}function ue(i){if(!(typeof i>"u")){var o=!1;if(Array.isArray(i)){if(i.length===1)o=ue(i[0]);else if(i.length>1){var l=i.filter(function(v){return ue(v)});o=l.length>0}}else typeof i=="string"?i.length>0&&(o=!0):y(i)?i!==0&&(o=!0):i!==null&&typeof i=="object"&&!w(i)?a.keys(i).length>0&&(o=!0):typeof i=="boolean"&&i===!0&&(o=!0);return o}}function te(i){if(!(typeof i>"u"))return!ue(i)}function Z(i,o,l,v){var m=[o],x=N(i);return x>=2&&m.push(l),x>=3&&m.push(v),m}async function le(i,o){if(!(typeof i>"u")){for(var l=this.createSequence(),v=0;v<i.length;v++){var m=Z(o,i[v],v,i),x=await o.apply(this,m);typeof x<"u"&&l.push(x)}return l}}async function Q(i,o){if(!(typeof i>"u")){for(var l=this.createSequence(),v=0;v<i.length;v++){var m=i[v],x=Z(o,m,v,i),$=await o.apply(this,x);ue($)&&l.push(m)}return l}}async function Ne(i,o){if(!(typeof i>"u")){for(var l=!1,v,m=0;m<i.length;m++){var x=i[m],$=!0;if(typeof o<"u"){var j=Z(o,x,m,i),se=await o.apply(this,j);$=ue(se)}if($)if(!l)v=x,l=!0;else throw{stack:new Error().stack,code:"D3138",index:m}}if(!l)throw{stack:new Error().stack,code:"D3139"};return v}}function Qe(){for(var i=[],o=Array.prototype.slice.call(arguments),l=Math.min.apply(Math,o.map(function(x){return Array.isArray(x)?x.length:0})),v=0;v<l;v++){var m=o.map(x=>x[v]);i.push(m)}return i}async function je(i,o,l){if(!(typeof i>"u")){var v,m=N(o);if(m<2)throw{stack:new Error().stack,code:"D3050",index:1};var x;for(typeof l>"u"&&i.length>0?(v=i[0],x=1):(v=l,x=0);x<i.length;){var $=[v,i[x]];m>=3&&$.push(x),m>=4&&$.push(i),v=await o.apply(this,$),x++}return v}}function Le(i){var o=this.createSequence();if(Array.isArray(i)){for(var l=Object.create(null),v=0;v<i.length;v++){var m=Le.call(this,i[v]);m.forEach(function(x){l[x]=!0})}o=Le.call(this,l)}else i!==null&&typeof i=="object"&&!w(i)&&a.keys(i).forEach(x=>o.push(x));return o}function Be(i,o){var l;if(Array.isArray(i)){l=this.createSequence();for(var v=0;v<i.length;v++){var m=Be.call(this,i[v],o);typeof m<"u"&&(Array.isArray(m)?m.forEach(x=>l.push(x)):l.push(m))}}else i!==null&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,o)&&!w(i)&&(l=i[o]);return l}function ot(i,o){if(typeof i>"u")return o;if(typeof o>"u")return i;Array.isArray(i)||(i=this.createSequence(i)),Array.isArray(o)||(o=[o]);const l=i.length+o.length;if(this.options&&l>this.options.sequence)throw{code:"D2015",stack:new Error().stack,value:l};return i.concat(o)}function Pt(i){return!(typeof i>"u")}function Ct(i){var o=this.createSequence();if(Array.isArray(i))for(var l=0;l<i.length;l++)o=ot.call(this,o,Ct.call(this,i[l]));else if(i!==null&&typeof i=="object"&&!C(i))for(const m of a.keys(i)){var v=Object.create(null);v[m]=i[m],o.push(v)}else o=i;return o}function H(i){if(!(typeof i>"u")){var o=Object.create(null);return i.forEach(function(l){for(const v of a.keys(l))o[v]=l[v]}),o}}function ur(i){if(!(typeof i>"u")){if(i.length<=1)return i;for(var o=i.length,l=new Array(o),v=0;v<o;v++)l[o-v-1]=i[v];return l}}async function cr(i,o){var l=this.createSequence();for(const x of a.keys(i)){var v=Z(o,i[x],x,i),m=await o.apply(this,v);typeof m<"u"&&l.push(m)}return l}function tt(i){throw{code:"D3137",stack:new Error().stack,message:i||"$error() function evaluated"}}function zt(i,o){if(!i)throw{code:"D3141",stack:new Error().stack,message:o||"$assert() statement failed"}}function it(i){if(i!==void 0)return i===null?"null":y(i)?"number":typeof i=="string"?"string":typeof i=="boolean"?"boolean":Array.isArray(i)?"array":w(i)?"function":"object"}async function yt(i,o){if(!(typeof i>"u")){if(i.length<=1)return i;var l;if(typeof o>"u"){if(!M(i)&&!T(i))throw{stack:new Error().stack,code:"D3070",index:1};l=async function($,j){return $>j}}else l=o;var v=async function($,j){var se=async function(Ee,xe,Se){xe.length===0?Array.prototype.push.apply(Ee,Se):Se.length===0?Array.prototype.push.apply(Ee,xe):await l(xe[0],Se[0])?(Ee.push(Se[0]),await se(Ee,xe,Se.slice(1))):(Ee.push(xe[0]),await se(Ee,xe.slice(1),Se))},W=[];return await se(W,$,j),W},m=async function($){if(!Array.isArray($)||$.length<=1)return $;var j=Math.floor($.length/2),se=$.slice(0,j),W=$.slice(j);return se=await m(se),W=await m(W),await v(se,W)},x=await m(i);return x}}function c(i){if(!(typeof i>"u")){if(i.length<=1)return i;for(var o=new Array(i.length),l=0;l<i.length;l++){var v=Math.floor(Math.random()*(l+1));l!==v&&(o[l]=o[v]),o[v]=i[l]}return o}}function f(i){if(!(typeof i>"u")){if(!Array.isArray(i)||i.length<=1)return i;for(var o=S(i)?this.createSequence():[],l=0;l<i.length;l++){for(var v=i[l],m=!1,x=0;x<o.length;x++)if(ee(v,o[x])){m=!0;break}m||o.push(v)}return o}}async function p(i,o){var l=Object.create(null);for(const $ of a.keys(i)){var v=i[$],m=Z(o,v,$,i),x=await o.apply(this,m);ue(x)&&(l[$]=v)}return a.keys(l).length===0&&(l=void 0),l}return{sum:_,count:g,max:U,min:E,average:P,string:z,substring:F,substringBefore:re,substringAfter:ae,lowercase:_e,uppercase:ge,length:pe,trim:Pe,pad:Je,match:We,contains:me,replace:ie,split:Ae,join:we,formatNumber:A,formatBase:R,number:k,floor:B,ceil:I,round:L,abs:O,sqrt:q,power:K,random:he,boolean:ue,not:te,map:le,zip:Qe,filter:Q,single:Ne,foldLeft:je,sift:p,keys:Le,lookup:Be,append:ot,exists:Pt,spread:Ct,merge:H,reverse:ur,each:cr,error:tt,assert:zt,type:it,sort:yt,shuffle:c,distinct:f,base64encode:Ce,base64decode:nt,encodeUrlComponent:h,encodeUrl:b,decodeUrlComponent:G,decodeUrl:fe}})();r.exports=d}).call(this)}).call(this,typeof dn<"u"?dn:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(t,r,s){var u=t("./datetime"),a=t("./functions"),d=t("./utils"),y=t("./parser"),T=t("./signature"),M=(function(){var S=d.isNumeric,w=d.isArrayOfStrings,C=d.isArrayOfNumbers,D=d.isSequence,N=d.isFunction,ee=d.isLambda,J=d.isIterable,_=d.isPromise,g=d.getFunctionArity,U=d.isDeepEqual,E=tt(null);async function P(c,f,p){var i;p.base.depth++,p.base.guardrails();var o=p.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(o&&await o(c,f,p),c.type){case"path":i=await z(c,f,p);break;case"binary":i=await pe(c,f,p);break;case"unary":i=await Pe(c,f,p);break;case"name":i=Je(c,f,p);break;case"string":case"number":case"value":i=ce(c);break;case"wildcard":i=me(c,f,p);break;case"descendant":i=ie(c,f,p);break;case"parent":i=p.lookup(c.slot.label);break;case"condition":i=await B(c,f,p);break;case"block":i=await I(c,f,p);break;case"bind":i=await O(c,f,p);break;case"regex":i=L(c,f,p);break;case"function":i=await Z(c,f,p);break;case"variable":i=q(c,f,p);break;case"lambda":i=Ne(c,f,p);break;case"partial":i=await Qe(c,f,p);break;case"apply":i=await te(c,f,p);break;case"transform":i=he(c,f,p);break}if(Object.prototype.hasOwnProperty.call(c,"predicate"))for(var l=0;l<c.predicate.length;l++)i=await ge(c.predicate[l].expr,i,p);c.type!=="path"&&Object.prototype.hasOwnProperty.call(c,"group")&&(i=await A(c.group,i,p));var v=p.lookup(Symbol.for("jsonata.__evaluate_exit"));return v&&await v(c,f,p,i),i&&D(i)&&!i.tupleStream&&(c.keepArray&&(i.keepSingleton=!0),i.length===0?i=void 0:i.length===1&&(i=i.keepSingleton?i:i[0])),p.base.depth--,i}async function z(c,f,p){var i;Array.isArray(f)&&c.steps[0].type!=="variable"?i=f:i=p.base.createSequence(f);for(var o,l=!1,v=void 0,m=0;m<c.steps.length;m++){var x=c.steps[m];if(x.tuple&&(l=!0),m===0&&x.consarray?o=await P(x,i,p):l?v=await _e(x,i,v,p):o=await re(x,i,p,m===c.steps.length-1),!l&&(typeof o>"u"||o.length===0))break;typeof x.focus>"u"&&(i=o)}if(l)if(c.tuple)o=v;else for(o=p.base.createSequence(),m=0;m<v.length;m++)o.push(v[m]["@"]);return c.keepSingletonArray&&(Array.isArray(o)&&o.cons&&!o.sequence&&(o=p.base.createSequence(o)),o.keepSingleton=!0),Object.prototype.hasOwnProperty.call(c,"group")&&(o=await A(c.group,l?v:o,p)),o}function F(c,f){var p=tt(c);for(const i of d.keys(f))p.bind(i,f[i]);return p}async function re(c,f,p,i){var o;if(c.type==="sort")return o=await K(c,f,p),c.stages&&(o=await ae(c.stages,o,p)),o;o=p.base.createSequence();for(var l=0;l<f.length;l++){var v=await P(c,f[l],p);if(c.stages)for(var m=0;m<c.stages.length;m++)v=await ge(c.stages[m].expr,v,p);typeof v<"u"&&o.push(v)}var x=p.base.createSequence();return i&&o.length===1&&Array.isArray(o[0])&&!D(o[0])?x=o[0]:Array.prototype.forEach.call(o,function($){!Array.isArray($)||$.cons?x.push($):Array.prototype.forEach.call($,j=>x.push(j))}),x}async function ae(c,f,p){for(var i=f,o=0;o<c.length;o++){var l=c[o];switch(l.type){case"filter":i=await ge(l.expr,i,p);break;case"index":for(var v=0;v<i.length;v++){var m=i[v];m[l.value]=v}break}}return i}async function _e(c,f,p,i){var o;if(c.type==="sort"){if(p)o=await K(c,p,i);else{var l=await K(c,f,i);o=i.base.createSequence(),o.tupleStream=!0;for(var v=0;v<l.length;v++){var m={"@":l[v]};m[c.index]=v,o.push(m)}}return c.stages&&(o=await ae(c.stages,o,i)),o}o=i.base.createSequence(),o.tupleStream=!0;var x=i;p===void 0&&(p=f.map(W=>({"@":W})));for(var $=0;$<p.length;$++){x=F(i,p[$]);var j=await P(c,p[$]["@"],x);if(typeof j<"u"){Array.isArray(j)||(j=[j]);for(var se=0;se<j.length;se++)m=Object.create(null),Object.assign(m,p[$]),j.tupleStream?Object.assign(m,j[se]):(c.focus?(m[c.focus]=j[se],m["@"]=p[$]["@"]):m["@"]=j[se],c.index&&(m[c.index]=se),c.ancestor&&(m[c.ancestor.label]=p[$]["@"])),o.push(m)}}return c.stages&&(o=await ae(c.stages,o,i)),o}async function ge(c,f,p){var i=p.base.createSequence();if(f&&f.tupleStream&&(i.tupleStream=!0),Array.isArray(f)||(f=p.base.createSequence(f)),c.type==="number"){var o=Math.floor(c.value);o<0&&(o=f.length+o);var l=await f[o];typeof l<"u"&&(Array.isArray(l)?i=l:i.push(l))}else for(o=0;o<f.length;o++){var l=f[o],v=l,m=p;f.tupleStream&&(v=l["@"],m=F(p,l));var x=await P(c,v,m);S(x)&&(x=[x]),C(x)?Array.prototype.forEach.call(x,function(j){var se=Math.floor(j);se<0&&(se=f.length+se),se===o&&i.push(l)}):a.boolean(x)&&i.push(l)}return i}async function pe(c,f,p){var i,o=await P(c.lhs,f,p),l=c.value,v=async()=>await P(c.rhs,f,p);if(l==="and"||l==="or")try{return await fe(o,v,l)}catch(x){throw x.position=c.position,x.token=l,x}var m=await v();try{switch(l){case"+":case"-":case"*":case"/":case"%":i=nt(o,m,l);break;case"=":case"!=":i=h(o,m,l);break;case"<":case"<=":case">":case">=":i=b(o,m,l);break;case"&":i=we(o,m);break;case"..":i=k(o,m,p);break;case"in":i=G(o,m);break}}catch(x){throw x.position=c.position,x.token=l,x}return i}async function Pe(c,f,p){var i,o={options:p.base.options,createSequence:p.base.createSequence};switch(c.value){case"-":if(i=await P(c.expression,f,p),typeof i>"u")i=void 0;else if(S(i))i=-i;else throw{code:"D1002",stack:new Error().stack,position:c.position,token:c.value,value:i};break;case"[":i=[];let m=await Promise.all(c.expressions.map(async(x,$)=>(p.isParallelCall=$>0,[x,await P(x,f,p)])));for(let x of m){var[l,v]=x;typeof v<"u"&&(l.value==="["?i.push(v):i=a.append.call(o,i,v))}c.consarray&&Object.defineProperty(i,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":i=await A(c,f,p);break}return i}function Je(c,f,p){var i={createSequence:p.base.createSequence};return a.lookup.call(i,f,c.value)}function ce(c){return c.value}function me(c,f,p){var i={options:p.base.options,createSequence:p.base.createSequence},o=i.createSequence();return Array.isArray(f)&&f.outerWrapper&&f.length>0&&(f=f[0]),f!==null&&typeof f=="object"&&!N(f)&&d.keys(f).forEach(function(l){var v=f[l];Array.isArray(v)?(v=We(v),o=a.append.call(i,o,v)):o.push(v)}),o}function We(c,f){return typeof f>"u"&&(f=[]),Array.isArray(c)?Array.prototype.forEach.call(c,function(p){We(p,f)}):f.push(c),f}function ie(c,f,p){var i,o=p.base.createSequence();return typeof f<"u"&&(Ce(f,o),o.length===1?i=o[0]:i=o),i}function Ce(c,f){Array.isArray(c)||f.push(c),Array.isArray(c)?Array.prototype.forEach.call(c,function(p){Ce(p,f)}):c!==null&&typeof c=="object"&&!N(c)&&d.keys(c).forEach(function(p){Ce(c[p],f)})}function nt(c,f,p){var i;if(typeof c<"u"&&!S(c))throw{code:"T2001",stack:new Error().stack,value:c};if(typeof f<"u"&&!S(f))throw{code:"T2002",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u")return i;switch(p){case"+":i=c+f;break;case"-":i=c-f;break;case"*":i=c*f;break;case"/":i=c/f;break;case"%":i=c%f;break}return i}function h(c,f,p){var i,o=typeof c,l=typeof f;if(o==="undefined"||l==="undefined")return!1;switch(p){case"=":i=U(c,f);break;case"!=":i=!U(c,f);break}return i}function b(c,f,p){var i,o=typeof c,l=typeof f,v=o==="undefined"||o==="string"||o==="number",m=l==="undefined"||l==="string"||l==="number";if(!v||!m)throw{code:"T2010",stack:new Error().stack,value:o==="string"||o==="number"?f:c};if(!(o==="undefined"||l==="undefined")){if(o!==l)throw{code:"T2009",stack:new Error().stack,value:c,value2:f};switch(p){case"<":i=c<f;break;case"<=":i=c<=f;break;case">":i=c>f;break;case">=":i=c>=f;break}return i}}function G(c,f){var p=!1;if(typeof c>"u"||typeof f>"u")return!1;Array.isArray(f)||(f=[f]);for(var i=0;i<f.length;i++)if(f[i]===c){p=!0;break}return p}async function fe(c,f,p){var i,o=Ae(c);switch(p){case"and":i=o&&Ae(await f());break;case"or":i=o||Ae(await f());break}return i}function Ae(c){var f=a.boolean(c);return typeof f>"u"?!1:f}function we(c,f){var p,i="",o="";return typeof c<"u"&&(i=a.string(c)),typeof f<"u"&&(o=a.string(f)),p=i.concat(o),p}async function A(c,f,p){var i=Object.create(null),o=Object.create(null),l=!!(f&&f.tupleStream),v={options:p.base.options,createSequence:p.base.createSequence};Array.isArray(f)||(p.base.options,f=v.createSequence(f)),f.length===0&&!l&&f.push(void 0);for(var m=0;m<f.length;m++)for(var x=f[m],$=l?F(p,x):p,j=0;j<c.lhs.length;j++){var se=c.lhs[j],W=await P(se[0],l?x["@"]:x,$);if(typeof W!="string"&&W!==void 0)throw{code:"T1003",stack:new Error().stack,position:c.position,value:W};if(W!==void 0){if(W==="_jsonata_lambda"||W==="_jsonata_function")throw{code:"D1013",stack:new Error().stack,position:c.position,value:W};var Ee={data:x,exprIndex:j};if(Object.prototype.hasOwnProperty.call(o,W)){if(o[W].exprIndex!==j)throw{code:"D1009",stack:new Error().stack,position:c.position,value:W};o[W].data=a.append.call(v,o[W].data,x)}else o[W]=Ee}}let xe=await Promise.all(d.keys(o).map(async(Me,be)=>{let Re=o[Me];var et=Re.data,qe=p;if(l){var st=R(Re.data,p);et=st["@"],delete st["@"],qe=F(p,st)}return p.isParallelCall=be>0,[Me,await P(c.lhs[Re.exprIndex][1],et,qe)]}));for(let Me of xe){var[W,Se]=await Me;typeof Se<"u"&&(i[W]=Se)}return i}function R(c,f){if(!Array.isArray(c))return c;var p=Object.create(null),i={options:f.base.options,createSequence:f.base.createSequence};Object.assign(p,c[0]);for(var o=1;o<c.length;o++)for(const l of d.keys(c[o]))p[l]=a.append.call(i,p[l],c[o][l]);return p}function k(c,f,p){var i;if(typeof c<"u"&&!Number.isInteger(c))throw{code:"T2003",stack:new Error().stack,value:c};if(typeof f<"u"&&!Number.isInteger(f))throw{code:"T2004",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u"||c>f)return i;var o=f-c+1;if(o>1e7)throw{code:"D2014",stack:new Error().stack,value:o};if(p.base.options&&o>p.base.options.sequence)throw{code:"D2015",stack:new Error().stack,value:o};i=new Array(o);for(var l=c,v=0;l<=f;l++,v++)i[v]=l;return i.sequence=!0,i}async function O(c,f,p){var i=await P(c.rhs,f,p);return p.bind(c.lhs.value,i),i}async function B(c,f,p){var i,o=await P(c.condition,f,p);return a.boolean(o)?i=await P(c.then,f,p):typeof c.else<"u"&&(i=await P(c.else,f,p)),i}async function I(c,f,p){for(var i,o=tt(p),l=0;l<c.expressions.length;l++)i=await P(c.expressions[l],f,o);return i}function L(c,f,p){var i=new p.base.RegexEngine(c.value),o=function(l,v){var m;i.lastIndex=v||0;var x=i.exec(l);if(x!==null){if(m={match:x[0],start:x.index,end:x.index+x[0].length,groups:[]},x.length>1)for(var $=1;$<x.length;$++)m.groups.push(x[$]);m.next=function(){if(!(i.lastIndex>=l.length)){var j=o(l,i.lastIndex);if(j&&j.match==="")throw{code:"D1004",stack:new Error().stack,position:c.position,value:c.value.source};return j}}}return m};return o}function q(c,f,p){var i;return c.value===""?i=f&&f.outerWrapper?f[0]:f:i=p.lookup(c.value),i}async function K(c,f,p){var i,o=f,l=!!f.tupleStream,v=async function(x,$){for(var j=0,se=0;j===0&&se<c.terms.length;se++){var W=c.terms[se],Ee=x,xe=p;l&&(Ee=x["@"],xe=F(p,x));var Se=await P(W.expression,Ee,xe);Ee=$,xe=p,l&&(Ee=$["@"],xe=F(p,$));var Me=await P(W.expression,Ee,xe),be=typeof Se,Re=typeof Me;if(be==="undefined"){j=Re==="undefined"?0:1;continue}if(Re==="undefined"){j=-1;continue}if(!(be==="string"||be==="number")||!(Re==="string"||Re==="number"))throw{code:"T2008",stack:new Error().stack,position:c.position,value:be==="string"||be==="number"?Me:Se};if(be!==Re)throw{code:"T2007",stack:new Error().stack,position:c.position,value:Se,value2:Me};Se!==Me&&(Se<Me?j=-1:j=1,W.descending===!0&&(j=-j))}return j===1},m={environment:p,input:f};return i=await a.sort.apply(m,[o,v]),i}function he(c,f,p){var i=async function(o){if(!(typeof o>"u")){var l=p.lookup("clone");if(!N(l))throw{code:"T2013",stack:new Error().stack,position:c.position};var v=await le(l,[o],null,p),m=await P(c.pattern,v,p);if(typeof m<"u"){Array.isArray(m)||(m=[m]);for(var x=0;x<m.length;x++){var $=m[x],j=await P(c.update,$,p),se=typeof j;if(se!=="undefined"){if(se!=="object"||j===null||Array.isArray(j))throw{code:"T2011",stack:new Error().stack,position:c.update.position,value:j};for(const Se of d.keys(j))$[Se]=j[Se]}if(typeof c.delete<"u"){var W=await P(c.delete,$,p);if(typeof W<"u"){var Ee=W;if(Array.isArray(W)||(W=[W]),!w(W))throw{code:"T2012",stack:new Error().stack,position:c.delete.position,value:Ee};for(var xe=0;xe<W.length;xe++)typeof $=="object"&&$!==null&&delete $[W[xe]]}}}}return v}};return H(i,"<(oa):o>")}var ue=y("function($f, $g) { function($x){ $g($f($x)) } }");async function te(c,f,p){var i,o=await P(c.lhs,f,p);if(c.rhs.type==="function")i=await Z(c.rhs,f,p,{context:o});else{var l=await P(c.rhs,f,p);if(!N(l))throw{code:"T2006",stack:new Error().stack,position:c.position,value:l};if(N(o)){var v=await P(ue,null,p);i=await le(v,[o,l],null,p)}else i=await le(l,[o],null,p)}return i}async function Z(c,f,p,i){var o,l=await P(c.procedure,f,p);if(typeof l>"u"&&c.procedure.type==="path"&&p.lookup(c.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};var v=[];typeof i<"u"&&v.push(i.context);for(var m=0;m<c.arguments.length;m++){const $=await P(c.arguments[m],f,p);if(N($)){const j=async function(...se){return await le($,se,null,p)};j.arity=g($),v.push(j)}else v.push($)}var x=c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value;try{typeof l=="object"&&(l.token=x,l.position=c.position),o=await le(l,v,f,p)}catch($){throw $.position||($.position=c.position),$.token||($.token=x),$}return o}async function le(c,f,p,i){var o;for(o=await Q(c,f,p,i);ee(o)&&o.thunk===!0;){var l=await P(o.body.procedure,o.input,o.environment);o.body.procedure.type==="variable"&&(l.token=o.body.procedure.value),l.position=o.body.procedure.position;for(var v=[],m=0;m<o.body.arguments.length;m++)v.push(await P(o.body.arguments[m],o.input,o.environment));o=await Q(l,v,p,i)}return o}async function Q(c,f,p,i){var o;try{var l=f;if(c&&(l=je(c.signature,f,p)),ee(c))o=await Le(c,l);else if(c&&c._jsonata_function===!0){var v={environment:i,input:p,options:i.base.options,createSequence:i.base.createSequence};o=c.implementation.apply(v,l),J(o)&&(o=o.next().value),_(o)&&(o=await o)}else if(typeof c=="function")o=c.apply(p,l),_(o)&&(o=await o);else throw{code:"T1006",stack:new Error().stack}}catch(m){throw c&&(typeof m.token>"u"&&typeof c.token<"u"&&(m.token=c.token),m.position=c.position||m.position),m}return o}function Ne(c,f,p){var i={_jsonata_lambda:!0,input:f,environment:p,arguments:c.arguments,signature:c.signature,body:c.body};return c.thunk===!0&&(i.thunk=!0),i.apply=async function(o,l){return await le(i,l,f,o?o.environment:p)},i}async function Qe(c,f,p){for(var i,o=[],l=0;l<c.arguments.length;l++){var v=c.arguments[l];v.type==="operator"&&v.value==="?"?o.push(v):o.push(await P(v,f,p))}var m=await P(c.procedure,f,p);if(typeof m>"u"&&c.procedure.type==="path"&&p.lookup(c.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};if(ee(m))i=Be(m,o,p);else if(m&&m._jsonata_function===!0)i=ot(m.implementation,o,p);else if(typeof m=="function")i=ot(m,o,p);else throw{code:"T1008",stack:new Error().stack,position:c.position,token:c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value};return i}function je(c,f,p){if(typeof c>"u")return f;var i=c.validate(f,p);return i}async function Le(c,f){var p,i=tt(c.environment);return Array.prototype.forEach.call(c.arguments,function(o,l){i.bind(o.value,f[l])}),typeof c.body=="function"?p=await Pt(c.body,i):p=await P(c.body,c.input,i),p}function Be(c,f,p){var i=tt(c.environment||p),o=[];Array.prototype.forEach.call(c.arguments,function(v,m){var x=f[m];x&&x.type==="operator"&&x.value==="?"?o.push(v):i.bind(v.value,x)});var l={_jsonata_lambda:!0,input:c.input,environment:i,arguments:o,body:c.body};return l}function ot(c,f,p){var i=Ct(c);i=i.map(function(m){return"$"+m.trim()});var o="function("+i.join(", ")+"){ _ }",l=y(o);l.body=c;var v=Be(l,f,p);return v}async function Pt(c,f){var p=Ct(c),i=p.map(function(v){return f.lookup(v.trim())}),o={environment:f,createSequence:f.base.createSequence},l=c.apply(o,i);return _(l)&&(l=await l),l}function Ct(c){var f=c.toString(),p=/\(([^)]*)\)/.exec(f)[1],i=p.split(",");return i}function H(c,f){var p={_jsonata_function:!0,implementation:c};return typeof f<"u"&&(p.signature=T(f)),p}async function ur(c,f){if(!(typeof c>"u")){var p=this.input;typeof f<"u"&&(p=f,Array.isArray(p)&&!D(p)&&(p=this.createSequence(p),p.outerWrapper=!0));try{var i=y(c,!1)}catch(l){throw it(l),{stack:new Error().stack,code:"D3120",value:l.message,error:l}}try{var o=await P(i,p,this.environment)}catch(l){throw it(l),{stack:new Error().stack,code:"D3121",value:l.message,error:l}}return o}}function cr(c){if(!(typeof c>"u"))return JSON.parse(a.string(c))}function tt(c){var f=Object.create(null);const p={bind:function(o,l){f[o]=l},lookup:function(o){var l;return Object.prototype.hasOwnProperty.call(f,o)?l=f[o]:c&&(l=c.lookup(o)),l},timestamp:c?c.timestamp:null,async:c?c.async:!1,isParallelCall:c?c.isParallelCall:!1,global:c?c.global:{ancestry:[null]}};if(c){var i=c.lookup(Symbol.for("jsonata.__createFrame_push"));i&&i(c,p),p.base=c.base}return p}E.bind("sum",H(a.sum,"<a<n>:n>")),E.bind("count",H(a.count,"<a:n>")),E.bind("max",H(a.max,"<a<n>:n>")),E.bind("min",H(a.min,"<a<n>:n>")),E.bind("average",H(a.average,"<a<n>:n>")),E.bind("string",H(a.string,"<x-b?:s>")),E.bind("substring",H(a.substring,"<s-nn?:s>")),E.bind("substringBefore",H(a.substringBefore,"<s-s:s>")),E.bind("substringAfter",H(a.substringAfter,"<s-s:s>")),E.bind("lowercase",H(a.lowercase,"<s-:s>")),E.bind("uppercase",H(a.uppercase,"<s-:s>")),E.bind("length",H(a.length,"<s-:n>")),E.bind("trim",H(a.trim,"<s-:s>")),E.bind("pad",H(a.pad,"<s-ns?:s>")),E.bind("match",H(a.match,"<s-f<s:o>n?:a<o>>")),E.bind("contains",H(a.contains,"<s-(sf):b>")),E.bind("replace",H(a.replace,"<s-(sf)(sf)n?:s>")),E.bind("split",H(a.split,"<s-(sf)n?:a<s>>")),E.bind("join",H(a.join,"<a<s>s?:s>")),E.bind("formatNumber",H(a.formatNumber,"<n-so?:s>")),E.bind("formatBase",H(a.formatBase,"<n-n?:s>")),E.bind("formatInteger",H(u.formatInteger,"<n-s:s>")),E.bind("parseInteger",H(u.parseInteger,"<s-s:n>")),E.bind("number",H(a.number,"<(nsb)-:n>")),E.bind("floor",H(a.floor,"<n-:n>")),E.bind("ceil",H(a.ceil,"<n-:n>")),E.bind("round",H(a.round,"<n-n?:n>")),E.bind("abs",H(a.abs,"<n-:n>")),E.bind("sqrt",H(a.sqrt,"<n-:n>")),E.bind("power",H(a.power,"<n-n:n>")),E.bind("random",H(a.random,"<:n>")),E.bind("boolean",H(a.boolean,"<x-:b>")),E.bind("not",H(a.not,"<x-:b>")),E.bind("map",H(a.map,"<af>")),E.bind("zip",H(a.zip,"<a+>")),E.bind("filter",H(a.filter,"<af>")),E.bind("single",H(a.single,"<af?>")),E.bind("reduce",H(a.foldLeft,"<afj?:j>")),E.bind("sift",H(a.sift,"<o-f?:o>")),E.bind("keys",H(a.keys,"<x-:a<s>>")),E.bind("lookup",H(a.lookup,"<x-s:x>")),E.bind("append",H(a.append,"<xx:a>")),E.bind("exists",H(a.exists,"<x:b>")),E.bind("spread",H(a.spread,"<x-:a<o>>")),E.bind("merge",H(a.merge,"<a<o>:o>")),E.bind("reverse",H(a.reverse,"<a:a>")),E.bind("each",H(a.each,"<o-f:a>")),E.bind("error",H(a.error,"<s?:x>")),E.bind("assert",H(a.assert,"<bs?:x>")),E.bind("type",H(a.type,"<x:s>")),E.bind("sort",H(a.sort,"<af?:a>")),E.bind("shuffle",H(a.shuffle,"<a:a>")),E.bind("distinct",H(a.distinct,"<x:x>")),E.bind("base64encode",H(a.base64encode,"<s-:s>")),E.bind("base64decode",H(a.base64decode,"<s-:s>")),E.bind("encodeUrlComponent",H(a.encodeUrlComponent,"<s-:s>")),E.bind("encodeUrl",H(a.encodeUrl,"<s-:s>")),E.bind("decodeUrlComponent",H(a.decodeUrlComponent,"<s-:s>")),E.bind("decodeUrl",H(a.decodeUrl,"<s-:s>")),E.bind("eval",H(ur,"<sx?:x>")),E.bind("toMillis",H(u.toMillis,"<s-s?:n>")),E.bind("fromMillis",H(u.fromMillis,"<n-s?s?:s>")),E.bind("clone",H(cr,"<(oa)-:o>"));var zt={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",D1011:"Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive",D1012:"Evaluation timeout after {{value}} milliseconds. Check for infinite loop",D1013:"Object property names starting with _jsonata_ are reserved for internal use: {{value}}",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.",D2015:"The maximum sequence length of {{value}} was exceeded.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function it(c){var f=zt[c.code];if(typeof f<"u"){var p=f.replace(/\{\{\{([^}]+)}}}/g,function(){return c[arguments[1]]});p=p.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(c[arguments[1]])}),c.message=p}}function yt(c,f){var p,i;try{p=y(c,f&&f.recover),i=p.errors,delete p.errors}catch(v){throw it(v),v}var o=tt(E),l=new Date;return o.bind("now",H(function(v,m){return u.fromMillis(l.getTime(),v,m)},"<s?s?:s>")),o.bind("millis",H(function(){return l.getTime()},"<:n>")),{evaluate:async function(v,m,x){if(typeof i<"u"){var $={code:"S0500",position:0};throw it($),$}const j=tt(o);for(const W of d.keys(m))j.bind(W,m[W]);if(j.bind("$",v),l=new Date,j.timestamp=l,j.options=f,j.createSequence=function(){var W=[];return f&&f.sequence&&(W.push=function(...Ee){if(W.length+Ee.length>f.sequence)throw{code:"D2015",stack:new Error().stack,value:f.sequence};return Array.prototype.push.apply(W,Ee)}),W.sequence=!0,arguments.length===1&&W.push(arguments[0]),W},Array.isArray(v)&&!D(v)&&(v=j.createSequence(v),v.outerWrapper=!0),f&&(f.timeout||f.stack)){const W=Date.now();j.guardrails=function(){if(f.stack>0&&j.depth>f.stack)throw{code:"D1011",value:f.stack,stack:new Error().stack};if(f.timeout>0&&Date.now()-W>f.timeout)throw{code:"D1012",value:f.timeout,stack:new Error().stack}}}else j.guardrails=function(){};j.base=j,j.depth=0,f&&f.RegexEngine?j.RegexEngine=f.RegexEngine:j.RegexEngine=RegExp;var se;try{return se=await P(p,v,j),typeof x=="function"&&x(null,se),se}catch(W){throw it(W),W}},assign:function(v,m){o.bind(v,m)},registerFunction:function(v,m,x){var $=H(m,x);o.bind(v,$)},ast:function(){return p},errors:function(){return i}}}return yt.parser=y,yt})();r.exports=M},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(t,r,s){var u=t("./signature");const a=(()=>{var d={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},y={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
32
|
+
`,r:"\r",t:" "},T=function(S){var w=0,C=S.length,D=function(J,_){var g={type:J,value:_,position:w};return g},N=function(){for(var J=w,_=0,g,U,E=function(z){if(S.charAt(z)==="/"&&_===0){for(var F=0;S.charAt(z-(F+1))==="\\";)F++;if(F%2===0)return!0}return!1};w<C;){var P=S.charAt(w);if(E(w)){if(g=S.substring(J,w),g==="")throw{code:"S0301",stack:new Error().stack,position:w};for(w++,P=S.charAt(w),J=w;P==="i"||P==="m";)w++,P=S.charAt(w);return U=S.substring(J,w)+"g",new RegExp(g,U)}(P==="("||P==="["||P==="{")&&S.charAt(w-1)!=="\\"&&_++,(P===")"||P==="]"||P==="}")&&S.charAt(w-1)!=="\\"&&_--,w++}throw{code:"S0302",stack:new Error().stack,position:w}},ee=function(J){if(w>=C)return null;for(var _=S.charAt(w);w<C&&`
|
|
33
|
+
\r\v`.indexOf(_)>-1;)w++,_=S.charAt(w);if(_==="/"&&S.charAt(w+1)==="*"){var g=w;for(w+=2,_=S.charAt(w);!(_==="*"&&S.charAt(w+1)==="/");)if(_=S.charAt(++w),w>=C)throw{code:"S0106",stack:new Error().stack,position:g};return w+=2,_=S.charAt(w),ee(J)}if(J!==!0&&_==="/")return w++,D("regex",N());if(_==="."&&S.charAt(w+1)===".")return w+=2,D("operator","..");if(_===":"&&S.charAt(w+1)==="=")return w+=2,D("operator",":=");if(_==="!"&&S.charAt(w+1)==="=")return w+=2,D("operator","!=");if(_===">"&&S.charAt(w+1)==="=")return w+=2,D("operator",">=");if(_==="<"&&S.charAt(w+1)==="=")return w+=2,D("operator","<=");if(_==="*"&&S.charAt(w+1)==="*")return w+=2,D("operator","**");if(_==="~"&&S.charAt(w+1)===">")return w+=2,D("operator","~>");if(_==="?"&&S.charAt(w+1)===":")return w+=2,D("operator","?:");if(_==="?"&&S.charAt(w+1)==="?")return w+=2,D("operator","??");if(Object.prototype.hasOwnProperty.call(d,_))return w++,D("operator",_);if(_==='"'||_==="'"){var U=_;w++;for(var E="";w<C;){if(_=S.charAt(w),_==="\\")if(w++,_=S.charAt(w),Object.prototype.hasOwnProperty.call(y,_))E+=y[_];else if(_==="u"){var P=S.substr(w+1,4);if(/^[0-9a-fA-F]+$/.test(P)){var z=parseInt(P,16);E+=String.fromCharCode(z),w+=4}else throw{code:"S0104",stack:new Error().stack,position:w}}else throw{code:"S0103",stack:new Error().stack,position:w,token:_};else{if(_===U)return w++,D("string",E);E+=_}w++}throw{code:"S0101",stack:new Error().stack,position:w}}var F=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,re=F.exec(S.substring(w));if(re!==null){var ae=parseFloat(re[0]);if(!isNaN(ae)&&isFinite(ae))return w+=re[0].length,D("number",ae);throw{code:"S0102",stack:new Error().stack,position:w,token:re[0]}}var _e;if(_==="`"){w++;var ge=S.indexOf("`",w);if(ge!==-1)return _e=S.substring(w,ge),w=ge+1,D("name",_e);throw w=C,{code:"S0105",stack:new Error().stack,position:w}}for(var pe=w,Pe;;)if(Pe=S.charAt(pe),pe===C||`
|
|
34
|
+
\r\v`.indexOf(Pe)>-1||Object.prototype.hasOwnProperty.call(d,Pe)){if(S.charAt(w)==="$")return _e=S.substring(w+1,pe),w=pe,D("variable",_e);switch(_e=S.substring(w,pe),w=pe,_e){case"or":case"in":case"and":return D("operator",_e);case"true":return D("value",!0);case"false":return D("value",!1);case"null":return D("value",null);default:return w===C&&_e===""?null:D("name",_e)}}else pe++};return ee},M=function(S,w){var C,D,N=Object.create(null),ee=[],J=function(){var h=[];C.id!=="(end)"&&h.push({type:C.type,value:C.value,position:C.position});for(var b=D();b!==null;)h.push(b),b=D();return h},_={nud:function(){var h={code:"S0211",token:this.value,position:this.position};if(w)return h.remaining=J(),h.type="error",ee.push(h),h;throw h.stack=new Error().stack,h}},g=function(h,b){var G=N[h];return b=b||0,G?b>=G.lbp&&(G.lbp=b):(G=Object.create(_),G.id=G.value=h,G.lbp=b,N[h]=G),G},U=function(h){if(w){h.remaining=J(),ee.push(h);var b=N["(error)"];return C=Object.create(b),C.error=h,C.type="(error)",C}else throw h.stack=new Error().stack,h},E=function(h,b){if(h&&C.id!==h){var G;C.id==="(end)"?G="S0203":G="S0202";var fe={code:G,position:C.position,token:C.value,value:h};return U(fe)}var Ae=D(b);if(Ae===null)return C=N["(end)"],C.position=S.length,C;var we=Ae.value,A=Ae.type,R;switch(A){case"name":case"variable":R=N["(name)"];break;case"operator":if(R=N[we],!R)return U({code:"S0204",stack:new Error().stack,position:Ae.position,token:we});break;case"string":case"number":case"value":R=N["(literal)"];break;case"regex":A="regex",R=N["(regex)"];break;default:return U({code:"S0205",stack:new Error().stack,position:Ae.position,token:we})}return C=Object.create(R),C.value=we,C.type=A,C.position=Ae.position,C},P=function(h){var b,G=C;for(E(null,!0),b=G.nud();h<C.lbp;)G=C,E(),b=G.led(b);return b},z=function(h){var b=g(h,0);b.nud=function(){return this}},F=function(h,b,G){var fe=b||d[h],Ae=g(h,fe);return Ae.led=G||function(we){return this.lhs=we,this.rhs=P(fe),this.type="binary",this},Ae},re=function(h,b,G){var fe=g(h,b);return fe.led=G,fe},ae=function(h,b){var G=g(h);return G.nud=b||function(){return this.expression=P(70),this.type="unary",this},G};z("(end)"),z("(name)"),z("(literal)"),z("(regex)"),g(":"),g(";"),g(","),g(")"),g("]"),g("}"),g(".."),F("."),F("+"),F("-"),F("*"),F("/"),F("%"),F("="),F("<"),F(">"),F("!="),F("<="),F(">="),F("&"),F("and"),F("or"),F("in"),z("and"),z("or"),z("in"),ae("-"),F("~>"),F("??",d["??"],function(h){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[JSON.parse(JSON.stringify(h))]},this.then=h,this.else=P(0),this}),re("(error)",10,function(h){return this.lhs=h,this.error=C.error,this.remaining=J(),this.type="error",this}),ae("*",function(){return this.type="wildcard",this}),ae("**",function(){return this.type="descendant",this}),ae("%",function(){return this.type="parent",this}),F("(",d["("],function(h){if(this.procedure=h,this.type="function",this.arguments=[],C.id!==")")for(;C.type==="operator"&&C.id==="?"?(this.type="partial",this.arguments.push(C),E("?")):this.arguments.push(P(0)),C.id===",";)E(",");if(E(")",!0),h.type==="name"&&(h.value==="function"||h.value==="λ")){if(this.arguments.forEach(function(we,A){if(we.type!=="variable")return U({code:"S0208",stack:new Error().stack,position:we.position,token:we.value,value:A+1})}),this.type="lambda",C.id==="<"){for(var b=C.position,G=1,fe="<";G>0&&C.id!=="{"&&C.id!=="(end)";){var Ae=E();Ae.id===">"?G--:Ae.id==="<"&&G++,fe+=Ae.value}E(">");try{this.signature=u(fe)}catch(we){return we.position=b+we.offset,U(we)}}E("{"),this.body=P(0),E("}")}return this}),ae("(",function(){for(var h=[];C.id!==")"&&(h.push(P(0)),C.id===";");)E(";");return E(")",!0),this.type="block",this.expressions=h,this}),ae("[",function(){var h=[];if(C.id!=="]")for(;;){var b=P(0);if(C.id===".."){var G={type:"binary",value:"..",position:C.position,lhs:b};E(".."),G.rhs=P(0),b=G}if(h.push(b),C.id!==",")break;E(",")}return E("]",!0),this.expressions=h,this.type="unary",this}),F("[",d["["],function(h){if(C.id==="]"){for(var b=h;b&&b.type==="binary"&&b.value==="[";)b=b.lhs;return b.keepArray=!0,E("]"),h}else return this.lhs=h,this.rhs=P(d["]"]),this.type="binary",E("]",!0),this}),F("^",d["^"],function(h){E("(");for(var b=[];;){var G={descending:!1};if(C.id==="<"?E("<"):C.id===">"&&(G.descending=!0,E(">")),G.expression=P(0),b.push(G),C.id!==",")break;E(",")}return E(")"),this.lhs=h,this.rhs=b,this.type="binary",this});var _e=function(h){var b=[];if(C.id!=="}")for(;;){var G=P(0);E(":");var fe=P(0);if(b.push([G,fe]),C.id!==",")break;E(",")}return E("}",!0),typeof h>"u"?(this.lhs=b,this.type="unary"):(this.lhs=h,this.rhs=b,this.type="binary"),this};ae("{",_e),F("{",d["{"],_e),re(":=",d[":="],function(h){return h.type!=="variable"?U({code:"S0212",stack:new Error().stack,position:h.position,token:h.value}):(this.lhs=h,this.rhs=P(d[":="]-1),this.type="binary",this)}),F("@",d["@"],function(h){return this.lhs=h,this.rhs=P(d["@"]),this.rhs.type!=="variable"?U({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),F("#",d["#"],function(h){return this.lhs=h,this.rhs=P(d["#"]),this.rhs.type!=="variable"?U({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),F("?",d["?"],function(h){return this.type="condition",this.condition=h,this.then=P(0),C.id===":"&&(E(":"),this.else=P(0)),this}),F("?:",d["?:"],function(h){return this.type="condition",this.condition=JSON.parse(JSON.stringify(h)),this.then=h,this.else=P(0),this}),ae("|",function(){return this.type="transform",this.pattern=P(0),E("|"),this.update=P(0),C.id===","&&(E(","),this.delete=P(0)),E("|"),this});var ge=function(h){var b;if(h.type==="function"&&!h.predicate){var G={type:"lambda",thunk:!0,arguments:[],position:h.position};G.body=h,b=G}else if(h.type==="condition")h.then=ge(h.then),typeof h.else<"u"&&(h.else=ge(h.else)),b=h;else if(h.type==="block"){var fe=h.expressions.length;fe>0&&(h.expressions[fe-1]=ge(h.expressions[fe-1])),b=h}else b=h;return b},pe=0,Pe=0,Je=[],ce=function(h,b){switch(h.type){case"name":case"wildcard":b.level--,b.level===0&&(typeof h.ancestor>"u"||(Je[b.index].slot.label=h.ancestor.label),h.ancestor=b,h.tuple=!0);break;case"parent":b.level++;break;case"block":h.expressions.length>0&&(h.tuple=!0,b=ce(h.expressions[h.expressions.length-1],b));break;case"path":h.tuple=!0;var G=h.steps.length-1;for(b=ce(h.steps[G--],b);b.level>0&&G>=0;)b=ce(h.steps[G--],b);break;default:throw{code:"S0217",token:h.type,position:h.position}}return b},me=function(h,b){if(typeof b.seekingParent<"u"||b.type==="parent"){var G=typeof b.seekingParent<"u"?b.seekingParent:[];b.type==="parent"&&G.push(b.slot),typeof h.seekingParent>"u"?h.seekingParent=G:Array.prototype.push.apply(h.seekingParent,G)}},We=function(h){var b=h.steps.length-1,G=h.steps[b],fe=typeof G.seekingParent<"u"?G.seekingParent:[];G.type==="parent"&&fe.push(G.slot);for(var Ae=0;Ae<fe.length;Ae++){var we=fe[Ae];for(b=h.steps.length-2;we.level>0;){if(b<0){typeof h.seekingParent>"u"?h.seekingParent=[we]:h.seekingParent.push(we);break}for(var A=h.steps[b--];b>=0&&A.focus&&h.steps[b].focus;)A=h.steps[b--];we=ce(A,we)}}},ie=function(h){var b;switch(h.type){case"binary":switch(h.value){case".":var G=ie(h.lhs);G.type==="path"?b=G:b={type:"path",steps:[G]},G.type==="parent"&&(b.seekingParent=[G.slot]);var fe=ie(h.rhs);fe.type==="path"?Array.prototype.push.apply(b.steps,fe.steps):(typeof fe.predicate<"u"&&(fe.stages=fe.predicate,delete fe.predicate),b.steps.push(fe)),b.steps.filter(function(q){if(q.type==="number"||q.type==="value")throw{code:"S0213",stack:new Error().stack,position:q.position,value:q.value};return q.type==="string"}).forEach(function(q){q.type="name"}),b.steps.filter(function(q){return q.keepArray===!0}).length>0&&(b.keepSingletonArray=!0);var Ae=b.steps[0];Ae.type==="unary"&&Ae.value==="["&&(Ae.consarray=!0);var we=b.steps[b.steps.length-1];we.type==="unary"&&we.value==="["&&(we.consarray=!0),We(b);break;case"[":b=ie(h.lhs);var A=b,R="predicate";if(b.type==="path"&&(A=b.steps[b.steps.length-1],R="stages"),typeof A.group<"u")throw{code:"S0209",stack:new Error().stack,position:h.position};typeof A[R]>"u"&&(A[R]=[]);var k=ie(h.rhs);typeof k.seekingParent<"u"&&(k.seekingParent.forEach(q=>{q.level===1?ce(A,q):q.level--}),me(A,k)),A[R].push({type:"filter",expr:k,position:h.position});break;case"{":if(b=ie(h.lhs),typeof b.group<"u")throw{code:"S0210",stack:new Error().stack,position:h.position};b.group={lhs:h.rhs.map(function(q){return[ie(q[0]),ie(q[1])]}),position:h.position};break;case"^":b=ie(h.lhs),b.type!=="path"&&(b={type:"path",steps:[b]});var O={type:"sort",position:h.position};O.terms=h.rhs.map(function(q){var K=ie(q.expression);return me(O,K),{descending:q.descending,expression:K}}),b.steps.push(O),We(b);break;case":=":b={type:"bind",value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),me(b,b.rhs);break;case"@":if(b=ie(h.lhs),A=b,b.type==="path"&&(A=b.steps[b.steps.length-1]),typeof A.stages<"u"||typeof A.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:h.position};if(A.type==="sort")throw{code:"S0216",stack:new Error().stack,position:h.position};h.keepArray&&(A.keepArray=!0),A.focus=h.rhs.value,A.tuple=!0;break;case"#":b=ie(h.lhs),A=b,b.type==="path"?A=b.steps[b.steps.length-1]:(b={type:"path",steps:[b]},typeof A.predicate<"u"&&(A.stages=A.predicate,delete A.predicate)),typeof A.stages>"u"?A.index=h.rhs.value:A.stages.push({type:"index",value:h.rhs.value,position:h.position}),A.tuple=!0;break;case"~>":b={type:"apply",value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),b.keepArray=b.lhs.keepArray||b.rhs.keepArray;break;default:b={type:h.type,value:h.value,position:h.position},b.lhs=ie(h.lhs),b.rhs=ie(h.rhs),me(b,b.lhs),me(b,b.rhs)}break;case"unary":b={type:h.type,value:h.value,position:h.position},h.value==="["?b.expressions=h.expressions.map(function(q){var K=ie(q);return me(b,K),K}):h.value==="{"?b.lhs=h.lhs.map(function(q){var K=ie(q[0]);me(b,K);var he=ie(q[1]);return me(b,he),[K,he]}):(b.expression=ie(h.expression),h.value==="-"&&b.expression.type==="number"?(b=b.expression,b.value=-b.value):me(b,b.expression));break;case"function":case"partial":b={type:h.type,name:h.name,value:h.value,position:h.position},b.arguments=h.arguments.map(function(q){var K=ie(q);return me(b,K),K}),b.procedure=ie(h.procedure);break;case"lambda":b={type:h.type,arguments:h.arguments,signature:h.signature,position:h.position};var B=ie(h.body);b.body=ge(B);break;case"condition":b={type:h.type,position:h.position},b.condition=ie(h.condition),me(b,b.condition),b.then=ie(h.then),me(b,b.then),typeof h.else<"u"&&(b.else=ie(h.else),me(b,b.else));break;case"transform":b={type:h.type,position:h.position},b.pattern=ie(h.pattern),b.update=ie(h.update),typeof h.delete<"u"&&(b.delete=ie(h.delete));break;case"block":b={type:h.type,position:h.position},b.expressions=h.expressions.map(function(q){var K=ie(q);return me(b,K),(K.consarray||K.type==="path"&&K.steps[0].consarray)&&(b.consarray=!0),K});break;case"name":b={type:"path",steps:[h]},h.keepArray&&(b.keepSingletonArray=!0);break;case"parent":b={type:"parent",slot:{label:"!"+pe++,level:1,index:Pe++}},Je.push(b);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":b=h;break;case"operator":if(h.value==="and"||h.value==="or"||h.value==="in")h.type="name",b=ie(h);else if(h.value==="?")b=h;else throw{code:"S0201",stack:new Error().stack,position:h.position,token:h.value};break;case"error":b=h,h.lhs&&(b=ie(h.lhs));break;default:var I="S0206";h.id==="(end)"&&(I="S0207");var L={code:I,position:h.position,token:h.value};if(w)return ee.push(L),{type:"error",error:L};throw L.stack=new Error().stack,L}return h.keepArray&&(b.keepArray=!0),b};D=T(S),E();var Ce=P(0);if(C.id!=="(end)"){var nt={code:"S0201",position:C.position,token:C.value};U(nt)}if(Ce=ie(Ce),Ce.type==="parent"||typeof Ce.seekingParent<"u")throw{code:"S0217",token:Ce.type,position:Ce.position};return ee.length>0&&(Ce.errors=ee),Ce};return M})();r.exports=a},{"./signature":5}],5:[function(t,r,s){var u=t("./utils");const a=(()=>{var d={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function y(T){for(var M=1,S=[],w=Object.create(null),C=w;M<T.length;){var D=T.charAt(M);if(D===":")break;var N=function(){S.push(w),C=w,w=Object.create(null)},ee=function(F,re,ae,_e){for(var ge=1,pe=re;pe<F.length;)if(pe++,D=F.charAt(pe),D===_e){if(ge--,ge===0)break}else D===ae&&ge++;return pe};switch(D){case"s":case"n":case"b":case"l":case"o":w.regex="["+D+"m]",w.type=D,N();break;case"a":w.regex="[asnblfom]",w.type=D,w.array=!0,N();break;case"f":w.regex="f",w.type=D,N();break;case"j":w.regex="[asnblom]",w.type=D,N();break;case"x":w.regex="[asnblfom]",w.type=D,N();break;case"-":C.context=!0,C.contextRegex=new RegExp(C.regex),C.regex+="?";break;case"?":case"+":C.regex+=D;break;case"(":var J=ee(T,M,"(",")"),_=T.substring(M+1,J);if(_.indexOf("<")===-1)w.regex="["+_+"m]";else throw{code:"S0402",stack:new Error().stack,value:_,offset:M};w.type="("+_+")",M=J,N();break;case"<":if(C.type==="a"||C.type==="f"){var g=ee(T,M,"<",">");C.subtype=T.substring(M+1,g),M=g}else throw{code:"S0401",stack:new Error().stack,value:C.type,offset:M};break}M++}var U="^"+S.map(function(F){return"("+F.regex+")"}).join("")+"$",E=new RegExp(U),P=function(F){var re;if(u.isFunction(F))re="f";else{var ae=typeof F;switch(ae){case"string":re="s";break;case"number":re="n";break;case"boolean":re="b";break;case"object":F===null?re="l":Array.isArray(F)?re="a":re="o";break;case"undefined":default:re="m"}}return re},z=function(F,re){for(var ae="^",_e=0,ge=0;ge<S.length;ge++){ae+=S[ge].regex;var pe=re.match(ae);if(pe===null)throw{code:"T0410",stack:new Error().stack,value:F[_e],index:_e+1};_e=pe[0].length}throw{code:"T0410",stack:new Error().stack,value:F[_e],index:_e+1}};return{definition:T,validate:function(F,re){var ae="";F.forEach(function(Pe){ae+=P(Pe)});var _e=E.exec(ae);if(_e){var ge=[],pe=0;return S.forEach(function(Pe,Je){var ce=F[pe],me=_e[Je+1];if(me==="")if(Pe.context&&Pe.contextRegex){var We=P(re);if(Pe.contextRegex.test(We))ge.push(re);else throw{code:"T0411",stack:new Error().stack,value:re,index:pe+1}}else ge.push(ce),pe++;else me.split("").forEach(function(ie){if(ce=F[pe],Pe.type==="a"){if(ie==="m")ce=void 0;else{var Ce=!0;if(typeof Pe.subtype<"u"){if(ie!=="a"&&me!==Pe.subtype)Ce=!1;else if(ie==="a"&&ce.length>0){var nt=P(ce[0]);if(nt!==Pe.subtype.charAt(0))Ce=!1;else{var h=ce.filter(function(b){return P(b)!==nt});Ce=h.length===0}}}if(!Ce)throw{code:"T0412",stack:new Error().stack,value:ce,index:pe+1,type:d[Pe.subtype]};ie!=="a"&&(ce=[ce])}ge.push(ce),pe++}else ge.push(ce),pe++})}),ge}z(F,ae)}}}return y})();r.exports=a},{"./utils":6}],6:[function(t,r,s){const u=(()=>{function a(g){var U=!1;if(typeof g=="number"&&(U=!isNaN(g),U&&!isFinite(g)))throw{code:"D1001",value:g,stack:new Error().stack};return U}function d(g){var U=!1;return Array.isArray(g)&&(U=g.filter(function(E){return typeof E!="string"}).length===0),U}function y(g){var U=!1;return Array.isArray(g)&&(U=g.filter(function(E){return!a(E)}).length===0),U}function T(g){return g.sequence===!0&&Array.isArray(g)}function M(g){return g&&(g._jsonata_function===!0||g._jsonata_lambda===!0)||typeof g=="function"}function S(g){var U=typeof g.arity=="number"?g.arity:typeof g.implementation=="function"?g.implementation.length:typeof g.length=="number"?g.length:g.arguments.length;return U}function w(g){return g&&g._jsonata_lambda===!0}var C=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function D(g){return typeof g=="object"&&g!==null&&C in g&&"next"in g&&typeof g.next=="function"}function N(g,U){if(g===U)return!0;if(typeof g=="object"&&typeof U=="object"&&g!==null&&U!==null){if(Array.isArray(g)&&Array.isArray(U)){if(g.length!==U.length)return!1;for(var E=0;E<g.length;E++)if(!N(g[E],U[E]))return!1;return!0}var P=Object.getOwnPropertyNames(g),z=Object.getOwnPropertyNames(U);if(P.length!==z.length)return!1;for(P=P.sort(),z=z.sort(),E=0;E<P.length;E++)if(P[E]!==z[E])return!1;for(E=0;E<P.length;E++){var F=P[E];if(!N(g[F],U[F]))return!1}return!0}return!1}function ee(g){return typeof g=="object"&&g!==null&&"then"in g&&typeof g.then=="function"}function J(g){var U=[];for(let E of g)U.push(E);return U}function _(g){return typeof g=="object"&&g!==null?Object.keys(g):[]}return{isNumeric:a,isArrayOfStrings:d,isArrayOfNumbers:y,isSequence:T,isFunction:M,isLambda:w,isIterable:D,getFunctionArity:S,isDeepEqual:N,stringToArray:J,isPromise:ee,keys:_}})();r.exports=u},{}]},{},[3])(3)})})(Rr)),Rr.exports}Li();const Mi=150,gn=10,Ui=200,Oi=16,vn=new WeakMap;let bn=!1;function ir(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Bt(n){if(n===window)return{x:window.scrollX,y:window.scrollY};const e=n;return{x:e.scrollLeft,y:e.scrollTop}}function Fi(n,e,t){if(n===window){window.scrollTo(e,t);return}const r=n;typeof r.scrollTo=="function"?r.scrollTo(e,t):(r.scrollLeft=e,r.scrollTop=t)}function $i(n){if(n===window){const t=document.documentElement;return Math.max(0,t.scrollHeight-window.innerHeight)}const e=n;return Math.max(0,e.scrollHeight-e.clientHeight)}function kt(n){let e=vn.get(n);if(!e){const t=Bt(n);e={x:t.x,y:t.y,restoring:!1,watching:!1,userEngaged:!1,raf:0,stickyFrames:0},vn.set(n,e)}return e}function sr(n){kt(n).userEngaged=!0}function ar(n){const e=kt(n);clearTimeout(e.settleTimer),e.settleTimer=setTimeout(()=>{e.userEngaged=!1,e.settleTimer=void 0},Mi)}function yn(n,e){return e-n>=Ui}function Tt(n){if(!ir())return;const e=kt(n);if(e.restoring)return;const t=Bt(n);if(yn(t.y,e.y)){Dr(n);return}e.x=t.x,e.y=t.y}function Ni(n){if(!ir())return;const e=kt(n),t=$i(n),r=e.x,s=t>0?Math.min(e.y,t):e.y,{x:u,y:a}=Bt(n);if(!(Math.abs(r-u)<=gn&&Math.abs(s-a)<=gn)){e.restoring=!0;try{Fi(n,r,s)}finally{requestAnimationFrame(()=>{e.restoring=!1})}}}function Dr(n){const e=kt(n);if(e.stickyFrames=Oi,e.raf)return;const t=()=>{e.raf=0,Ni(n),e.stickyFrames>0&&(e.stickyFrames--,e.raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)}function Lr(n){Dr(n)}function qt(n){if(!ir())return;const e=kt(n);if(e.watching)return;e.watching=!0;const t=n===window?window:n,r=()=>{if(e.restoring)return;const{y:D}=Bt(n);if(yn(D,e.y)){Dr(n);return}if(e.userEngaged){Tt(n),ar(n);return}Tt(n)},s=D=>wn(D)===n,u=D=>{s(D)&&(Tt(n),sr(n))},a=D=>{s(D)&&ar(n)},d=D=>{s(D)&&(Tt(n),sr(n),ar(n))};t.addEventListener("scroll",r,{passive:!0}),t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchend",a,{passive:!0}),t.addEventListener("touchcancel",a,{passive:!0}),t.addEventListener("wheel",d,{passive:!0}),t.addEventListener("pointerdown",u,{passive:!0}),t.addEventListener("pointerup",a,{passive:!0}),t.addEventListener("pointercancel",a,{passive:!0});const y=Bt(n);if(e.x=y.x,e.y=y.y,n===window){const D=new ResizeObserver(()=>Lr(window));D.observe(document.documentElement),e.resizeObserver=D;return}const T=n,M=new ResizeObserver(()=>Lr(T));M.observe(T);for(const D of Array.from(T.children))M.observe(D);e.resizeObserver=M;const S=()=>Lr(T),w=new MutationObserver(D=>{for(const N of D)if(N.type==="childList")for(const ee of Array.from(N.addedNodes))ee instanceof Element&&M.observe(ee);S()});w.observe(T,{childList:!0,subtree:!0,characterData:!0});const C=T.getRootNode();C instanceof ShadowRoot&&C.host&&w.observe(C.host,{childList:!0,subtree:!0,characterData:!0}),e.mutationObserver=w}function wn(n){for(const e of n.composedPath())if(!(e===window||e===document)&&e instanceof HTMLElement&&En(e))return e;return window}function En(n){if(!(n instanceof HTMLElement)||n===document.documentElement||n===document.body)return!1;const e=getComputedStyle(n).overflowY;return e==="auto"||e==="scroll"||e==="overlay"}function Mr(n){for(const t of n.composedPath())t===window||t===document||t instanceof HTMLElement&&En(t)&&qt(t);const e=wn(n);qt(e),n.type==="wheel"?(Tt(e),sr(e),ar(e)):(n.type==="touchstart"||n.type==="pointerdown")&&(Tt(e),sr(e))}function or(n){n instanceof Element&&n.classList?.contains("custom-scroll")&&qt(n),n.querySelectorAll?.(".custom-scroll").forEach(e=>{e instanceof HTMLElement&&qt(e)})}function Ur(n){or(n),new MutationObserver(t=>{for(const r of t)for(const s of Array.from(r.addedNodes))s instanceof Element&&or(s)}).observe(n,{childList:!0,subtree:!0})}function Or(n){n.querySelectorAll?.("*").forEach(e=>{e.shadowRoot&&(Ur(e.shadowRoot),Or(e.shadowRoot))})}function Ii(){const n=Element.prototype;if(n.__safariScrollGuardPatched)return;n.__safariScrollGuardPatched=!0;const e=n.attachShadow;n.attachShadow=function(r){const s=e.call(this,r);return Ur(s),s}}function ji(){if(typeof window>"u"||bn||(bn=!0,!ir()))return;qt(window),Ii();const n={capture:!0,passive:!0};window.addEventListener("wheel",Mr,n),window.addEventListener("touchstart",Mr,n),window.addEventListener("pointerdown",Mr,n);const e=()=>{or(document),Or(document)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e(),new MutationObserver(r=>{for(const s of r)for(const u of Array.from(s.addedNodes))u instanceof Element&&(or(u),u.shadowRoot&&Ur(u.shadowRoot),Or(u))}).observe(document.documentElement,{childList:!0,subtree:!0})}const Bi=di,qi=mi,Hi=Tr,zi=xr,Gi=at,Vi=ki,Wi=er,Xi=Pr,Yi=Di;ji(),window["concorde-utils"]=window["concorde-utils"]||{},window["concorde-utils"]={Utils:Bi,Arrays:qi,DataBindObserver:Hi,Format:zi,HTML:Gi,LocationHandler:Vi,Objects:Wi,PublisherManager:$e,api:Xi,URLPattern:Yi,Endpoint:Cr,DataProviderKey:Qt};const Ji=`#version 300 es
|
|
35
35
|
precision highp float;
|
|
36
36
|
precision highp int;
|
|
37
37
|
precision mediump sampler2D;
|
|
@@ -57,22 +57,22 @@ uniform float uParam3;
|
|
|
57
57
|
|
|
58
58
|
out vec4 sonicFragColor;
|
|
59
59
|
|
|
60
|
-
`,
|
|
60
|
+
`,Ki=`
|
|
61
61
|
void main() {
|
|
62
62
|
mainImage(sonicFragColor, gl_FragCoord.xy);
|
|
63
63
|
}
|
|
64
|
-
`,
|
|
64
|
+
`,Zi=`#version 300 es
|
|
65
65
|
precision highp float;
|
|
66
66
|
layout(location = 0) in vec2 aPos;
|
|
67
67
|
void main() {
|
|
68
68
|
gl_Position = vec4(aPos, 0.0, 1.0);
|
|
69
69
|
}
|
|
70
|
-
`;function
|
|
70
|
+
`;function Qi(n,e){return Ji+(n?n+`
|
|
71
71
|
`:"")+e+`
|
|
72
|
-
`+zi}function zt(n){if(n===""||n===null||n===void 0)return null;if(typeof n=="number")return n===0||n===1||n===2||n===3?n:null;const e=n.trim().toLowerCase();return e==="0"||e==="param0"?0:e==="1"||e==="param1"?1:e==="2"||e==="param2"?2:e==="3"||e==="param3"?3:null}function Ur(n){if(n===""||n===null||n===void 0)return null;const e=n.trim().toLowerCase();return e==="none"||e==="off"||e==="false"?null:e==="image"?"image":e==="buffer-a"||e==="buffera"||e==="a"?"bufferA":e==="buffer-b"||e==="bufferb"||e==="b"?"bufferB":e==="buffer-c"||e==="bufferc"||e==="c"?"bufferC":e==="buffer-d"||e==="bufferd"||e==="d"?"bufferD":null}function Vi(n,e,t,r={}){const s=Math.max(0,Math.min(1,r.threshold??.5)),u=Math.max(0,Math.floor(r.maxCount??8)),o=Math.max(1,Math.floor(r.minDistance??16));if(u===0||e<1||t<1||n.length<e*t*4)return[];const p=s*255,y=[];for(let k=1;k<t-1;k++)for(let w=1;w<e-1;w++){const C=(k*e+w)*4,R=n[C];if(R<p)continue;let N=!0;for(let ee=-1;ee<=1&&N;ee++)for(let J=-1;J<=1;J++){if(J===0&&ee===0)continue;const E=((k+ee)*e+(w+J))*4;if(n[E]>R){N=!1;break}}N&&y.push({x:w,y:k,score:R/255})}y.sort((k,w)=>w.score-k.score);const P=[],M=o*o;for(const k of y){if(P.length>=u)break;let w=!0;for(const C of P){const R=k.x-C.x,N=k.y-C.y;if(R*R+N*N<M){w=!1;break}}w&&P.push(k)}return P}function bn(n,e,t,r,s=128){if(e<1||t<1)return null;const u=typeof n.w=="number"&&typeof n.h=="number"&&Number.isFinite(n.w)&&Number.isFinite(n.h)&&n.w>0&&n.h>0;let o,p,y,P;if(u)o=Math.floor(n.x*e),p=Math.floor(n.y*t),y=Math.max(1,Math.round(n.w*e)),P=Math.max(1,Math.round(n.h*t));else{const M=Math.min(s,Math.max(1,Math.floor(n.patch??r))),k=n.x*e,w=n.y*t;y=M,P=M,o=Math.floor(k-M/2),p=Math.floor(w-M/2)}return o<0&&(y+=o,o=0),p<0&&(P+=p,p=0),o+y>e&&(y=e-o),p+P>t&&(P=t-p),y<1||P<1?null:(y=Math.min(y,s),P=Math.min(P,s),{x:o,y:p,w:y,h:P})}function yn(n){const e=Math.floor(n.length/4);if(e<1)return{r:0,g:0,b:0,a:0,luma:0};let t=0,r=0,s=0,u=0;for(let o=0;o<e;o++){const p=o*4;t+=n[p],r+=n[p+1],s+=n[p+2],u+=n[p+3]}return t/=e*255,r/=e*255,s/=e*255,u/=e*255,{r:t,g:r,b:s,a:u,luma:.2126*t+.7152*r+.0722*s}}class ht extends Error{constructor(e,t,r){super(e),this.pass=t,this.infoLog=r,this.name="ShaderCompileError"}}const Wi=["bufferA","bufferB","bufferC","bufferD","image"],Yi=["bufferA","bufferB","bufferC","bufferD"];function Xi(n){return/\.(webm|mp4|ogg|mov)(\?|#|$)/i.test(n)}function wn(n,e,t,r){const s=n.createShader(e);if(!s)throw new ht("Unable to create shader",r,"");if(n.shaderSource(s,t),n.compileShader(s),!n.getShaderParameter(s,n.COMPILE_STATUS)){const u=n.getShaderInfoLog(s)||"";throw n.deleteShader(s),new ht(`Compile error (${r}): ${u}`,r,u)}return s}function Ji(n,e,t,r){const s=n.createProgram();if(!s)throw new ht("Unable to create program","link","");if(n.attachShader(s,e),n.attachShader(s,t),n.linkProgram(s),!n.getProgramParameter(s,n.LINK_STATUS)){const u=n.getProgramInfoLog(s)||"";throw n.deleteProgram(s),new ht(`Link error (${r}): ${u}`,"link",u)}return s}function Ki(n,e){return{iResolution:n.getUniformLocation(e,"iResolution"),iTime:n.getUniformLocation(e,"iTime"),iTimeDelta:n.getUniformLocation(e,"iTimeDelta"),iFrameRate:n.getUniformLocation(e,"iFrameRate"),iFrame:n.getUniformLocation(e,"iFrame"),iMouse:n.getUniformLocation(e,"iMouse"),iDate:n.getUniformLocation(e,"iDate"),iSampleRate:n.getUniformLocation(e,"iSampleRate"),iChannelTime:n.getUniformLocation(e,"iChannelTime[0]")||n.getUniformLocation(e,"iChannelTime"),iChannelResolution:n.getUniformLocation(e,"iChannelResolution[0]")||n.getUniformLocation(e,"iChannelResolution"),iChannel:[0,1,2,3].map(t=>n.getUniformLocation(e,`iChannel${t}`)),uParam:[0,1,2,3].map(t=>n.getUniformLocation(e,`uParam${t}`))}}function Fr(n,e,t){const r=n.createTexture();if(!r)throw new Error("Unable to create texture");return n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA8,e,t,0,n.RGBA,n.UNSIGNED_BYTE,null),r}function An(n,e){const t=n.createFramebuffer();if(!t)throw new Error("Unable to create framebuffer");n.bindFramebuffer(n.FRAMEBUFFER,t),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0);const r=n.checkFramebufferStatus(n.FRAMEBUFFER);if(r!==n.FRAMEBUFFER_COMPLETE)throw new Error(`Incomplete framebuffer: ${r}`);return n.bindFramebuffer(n.FRAMEBUFFER,null),t}function En(n,e,t){const r=[Fr(n,e,t),Fr(n,e,t)],s=[An(n,r[0]),An(n,r[1])];return{textures:r,framebuffers:s,index:0}}function $r(n,e){for(const t of e.textures)n.deleteTexture(t);for(const t of e.framebuffers)n.deleteFramebuffer(t)}function Zi(n,e){const t=(n??"").trim();if(!t)return e?{kind:"url",url:e}:{kind:"none"};const r=t.toLowerCase();return r==="self"?{kind:"self"}:r==="buffer-a"||r==="buffera"||r==="a"?{kind:"buffer",buffer:"bufferA"}:r==="buffer-b"||r==="bufferb"||r==="b"?{kind:"buffer",buffer:"bufferB"}:r==="buffer-c"||r==="bufferc"||r==="c"?{kind:"buffer",buffer:"bufferC"}:r==="buffer-d"||r==="bufferd"||r==="d"?{kind:"buffer",buffer:"bufferD"}:r==="none"||r==="null"?{kind:"none"}:{kind:"url",url:t}}class Qi{constructor(e){this.vao=null,this.vertexShader=null,this.programs=new Map,this.buffers=new Map,this.external=new Map,this.width=0,this.height=0,this.passChannels=new Map,this.activePasses=[],this.blackTexture=null;const t=e.getContext("webgl2",{antialias:!1,alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0,powerPreference:"default"});if(!t||t.isContextLost())throw new Error("WebGL2 not available");this.canvas=e,this.gl=t,this.initGeometry(),this.blackTexture=Fr(t,1,1),t.bindTexture(t.TEXTURE_2D,this.blackTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255]))}get isLost(){return this.gl.isContextLost()}initGeometry(){const e=this.gl,t=e.createVertexArray();if(!t)throw new Error("Unable to create VAO");this.vao=t,e.bindVertexArray(t);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.bindVertexArray(null)}resize(e,t){const r=Math.max(1,Math.floor(e)),s=Math.max(1,Math.floor(t));if(!(r===this.width&&s===this.height)){this.width=r,this.height=s,this.canvas.width=r,this.canvas.height=s;for(const u of Yi){const o=this.buffers.get(u);o&&$r(this.gl,o),this.programs.has(u)&&this.buffers.set(u,En(this.gl,r,s))}}}setSources(e,t){if(this.gl.isContextLost())throw new Error("WebGL context lost");this.disposePrograms(),this.passChannels=t,this.activePasses=[],this.vertexShader=wn(this.gl,this.gl.VERTEX_SHADER,Hi,"vertex");for(const r of Wi){const s=r==="image"?e.image:e[r];if(!s?.trim())continue;const u=Gi(e.common||"",s),o=wn(this.gl,this.gl.FRAGMENT_SHADER,u,r),p=Ji(this.gl,this.vertexShader,o,r);if(this.gl.deleteShader(o),this.programs.set(r,{program:p,uniforms:Ki(this.gl,p)}),this.activePasses.push(r),r!=="image"&&this.width>0){const y=this.buffers.get(r);y&&$r(this.gl,y),this.buffers.set(r,En(this.gl,this.width,this.height))}}if(!this.programs.has("image"))throw new ht("image pass is required","image","Missing image shader source")}async ensureTextures(e){const t=[...new Set(e.filter(Boolean))];await Promise.all(t.map(r=>this.loadTexture(r)))}updateVideoTextures(){const e=this.gl;for(const t of this.external.values()){const r=t.video;!r||r.readyState<2||(e.bindTexture(e.TEXTURE_2D,t.texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,e.RGBA,e.UNSIGNED_BYTE,r),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),t.width=r.videoWidth||t.width,t.height=r.videoHeight||t.height)}}setVideosPlaying(e){for(const t of this.external.values())t.video&&(e?t.video.play().catch(()=>{}):t.video.pause())}getTextureSize(e){const t=this.external.get(e);return!t||t.width<1||t.height<1?null:{width:t.width,height:t.height}}loadTexture(e){return this.external.get(e)?Promise.resolve():Xi(e)?this.loadVideoTexture(e):new Promise((r,s)=>{const u=new Image;u.crossOrigin="anonymous",u.onload=()=>{const o=this.gl,p=o.createTexture();if(!p){s(new Error("Unable to create texture"));return}o.bindTexture(o.TEXTURE_2D,p),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,1),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA8,o.RGBA,o.UNSIGNED_BYTE,u),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:p,width:u.naturalWidth||u.width,height:u.naturalHeight||u.height,url:e}),r()},u.onerror=()=>s(new Error(`Failed to load texture: ${e}`)),u.src=e})}loadVideoTexture(e){return new Promise((t,r)=>{const s=document.createElement("video");s.crossOrigin="anonymous",s.muted=!0,s.loop=!0,s.playsInline=!0,s.preload="auto";let u=!1;const o=()=>{u||(u=!0,r(new Error(`Failed to load video: ${e}`)))},p=()=>{if(u||!s.videoWidth)return;u=!0;const y=this.gl,P=y.createTexture();if(!P){r(new Error("Unable to create texture"));return}y.bindTexture(y.TEXTURE_2D,P),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,1),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.texImage2D(y.TEXTURE_2D,0,y.RGBA8,y.RGBA,y.UNSIGNED_BYTE,s),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:P,width:s.videoWidth,height:s.videoHeight,url:e,video:s}),s.play().catch(()=>{}),t()};s.addEventListener("loadeddata",p),s.addEventListener("error",o),s.src=e,s.load()})}resolveChannel(e,t){const r={texture:this.blackTexture,width:1,height:1};if(t.kind==="none")return r;if(t.kind==="url"){const o=this.external.get(t.url);return o?{texture:o.texture,width:o.width,height:o.height}:r}const s=t.kind==="self"?e==="image"?null:e:t.buffer;if(!s)return r;const u=this.buffers.get(s);return u?{texture:u.textures[u.index],width:this.width,height:this.height}:r}bindChannels(e,t){const r=this.gl,s=this.passChannels.get(e)||[{kind:"none"},{kind:"none"},{kind:"none"},{kind:"none"}],u=[];for(let o=0;o<4;o++){const p=this.resolveChannel(e,s[o]);r.activeTexture(r.TEXTURE0+o),r.bindTexture(r.TEXTURE_2D,p.texture),t.iChannel[o]&&r.uniform1i(t.iChannel[o],o),u.push(p.width,p.height,1)}t.iChannelResolution&&r.uniform3fv(t.iChannelResolution,u),t.iChannelTime&&r.uniform1fv(t.iChannelTime,[0,0,0,0])}setCommonUniforms(e,t){const r=this.gl,s=this.width,u=this.height;if(e.iResolution&&r.uniform3f(e.iResolution,s,u,1),e.iTime&&r.uniform1f(e.iTime,t.time),e.iTimeDelta&&r.uniform1f(e.iTimeDelta,t.timeDelta),e.iFrameRate&&r.uniform1f(e.iFrameRate,t.timeDelta>0?1/t.timeDelta:60),e.iFrame&&r.uniform1i(e.iFrame,t.frame),e.iMouse&&r.uniform4f(e.iMouse,t.mouse[0],t.mouse[1],t.mouse[2],t.mouse[3]),e.iDate){const o=new Date;r.uniform4f(e.iDate,o.getFullYear(),o.getMonth(),o.getDate(),o.getHours()*3600+o.getMinutes()*60+o.getSeconds()+o.getMilliseconds()*.001)}e.iSampleRate&&r.uniform1f(e.iSampleRate,44100);for(let o=0;o<4;o++)e.uParam[o]&&r.uniform1f(e.uParam[o],t.params[o])}render(e){const t=this.gl;if(!this.vao||this.width<1||this.height<1)return;this.updateVideoTextures(),t.bindVertexArray(this.vao),t.viewport(0,0,this.width,this.height),t.disable(t.DEPTH_TEST),t.disable(t.BLEND);for(const s of this.activePasses){if(s==="image")continue;const u=this.programs.get(s),o=this.buffers.get(s);if(!u||!o)continue;const p=1-o.index;t.bindFramebuffer(t.FRAMEBUFFER,o.framebuffers[p]),t.viewport(0,0,this.width,this.height),t.useProgram(u.program),this.setCommonUniforms(u.uniforms,e),this.bindChannels(s,u.uniforms),t.drawArrays(t.TRIANGLES,0,3),o.index=p}const r=this.programs.get("image");r&&(t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,this.width,this.height),t.useProgram(r.program),this.setCommonUniforms(r.uniforms,e),this.bindChannels("image",r.uniforms),t.drawArrays(t.TRIANGLES,0,3),t.bindVertexArray(null))}readRect(e,t,r,s){return this.readFramebufferRect(null,e,t,r,s)}readBufferRect(e,t,r,s,u){if(e==="image")return this.readRect(t,r,s,u);const o=this.buffers.get(e);return o?this.readFramebufferRect(o.framebuffers[o.index],t,r,s,u):null}readPixel(e,t){const r=this.readRect(Math.floor(e),Math.floor(t),1,1);return!r||r.data.length<4?[0,0,0,0]:[r.data[0],r.data[1],r.data[2],r.data[3]]}readFramebufferRect(e,t,r,s,u){const o=this.gl;if(o.isContextLost()||this.width<1||this.height<1)return null;let p=Math.floor(t),y=Math.floor(r),P=Math.floor(s),M=Math.floor(u);if(P<1||M<1||(p<0&&(P+=p,p=0),y<0&&(M+=y,y=0),p+P>this.width&&(P=this.width-p),y+M>this.height&&(M=this.height-y),P<1||M<1))return null;const k=new Uint8Array(P*M*4);return o.bindFramebuffer(o.FRAMEBUFFER,e),o.readPixels(p,y,P,M,o.RGBA,o.UNSIGNED_BYTE,k),o.bindFramebuffer(o.FRAMEBUFFER,null),{x:p,y,width:P,height:M,data:k}}get size(){return{width:this.width,height:this.height}}disposePrograms(){for(const e of this.programs.values())this.gl.deleteProgram(e.program);this.programs.clear(),this.activePasses=[],this.vertexShader&&(this.gl.deleteShader(this.vertexShader),this.vertexShader=null)}dispose(e=!0){if(this.gl.isContextLost())this.programs.clear(),this.buffers.clear(),this.external.clear(),this.blackTexture=null,this.vao=null,this.vertexShader=null;else{this.disposePrograms();for(const t of this.buffers.values())$r(this.gl,t);this.buffers.clear();for(const t of this.external.values())t.video&&(t.video.pause(),t.video.removeAttribute("src"),t.video.load()),this.gl.deleteTexture(t.texture);this.external.clear(),this.blackTexture&&(this.gl.deleteTexture(this.blackTexture),this.blackTexture=null),this.vao&&(this.gl.deleteVertexArray(this.vao),this.vao=null),e&&this.gl.getExtension("WEBGL_lose_context")?.loseContext()}}}var es=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,Y=(n,e,t,r)=>{for(var s=r>1?void 0:r?ts(e,t):e,u=n.length-1,o;u>=0;u--)(o=n[u])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&es(e,t,s),s};const rs="sonic-shader",_n=128,ns=["time","frame","mouseX","mouseY","hovering"],is=["param0","param1","param2","param3"],ss=["channel0","channel1","channel2","channel3","imageCh0","imageCh1","imageCh2","imageCh3","bufferACh0","bufferACh1","bufferACh2","bufferACh3","bufferBCh0","bufferBCh1","bufferBCh2","bufferBCh3","bufferCCh0","bufferCCh1","bufferCCh2","bufferCCh3","bufferDCh0","bufferDCh1","bufferDCh2","bufferDCh3"],as=["sampleR","sampleG","sampleB","sampleA","sampleLuma"],os=["extracts","extractCount","extractSeq"];function us(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ve(n,e){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"&&n.trim()!==""){const t=Number(n);if(Number.isFinite(t))return t}return e}function cs(n){if(n===null||n==="")return"";if(typeof n=="string")return n.trim();const e=ii(n);if(e)return e;if(!(n&&typeof n=="object"))return""}function xn(n){if(!Array.isArray(n))return[];const e=[];for(const t of n){if(!t||typeof t!="object")continue;const r=t,s=Ve(r.x,NaN),u=Ve(r.y,NaN);if(!Number.isFinite(s)||!Number.isFinite(u))continue;const o={x:s,y:u,source:"manual"};typeof r.id=="string"&&r.id&&(o.id=r.id),"w"in r&&(o.w=Ve(r.w,0)),"h"in r&&(o.h=Ve(r.h,0)),"patch"in r&&(o.patch=Ve(r.patch,16)),e.push(o)}return e}const Nr=4;async function kn(n,e,t){if(typeof document>"u"||e<1||t<1)return null;try{const r=document.createElement("canvas");r.width=e,r.height=t;const s=r.getContext("2d");if(!s)return null;const u=s.createImageData(e,t),o=u.data;for(let P=0;P<t;P++){const M=(t-1-P)*e*Nr,k=P*e*Nr;for(let w=0;w<e*Nr;w++)o[k+w]=n[M+w]}s.putImageData(u,0,0);const p=await new Promise(P=>{try{r.toBlob(M=>P(M),"image/png")}catch{P(null)}});return p?URL.createObjectURL(p):r.toDataURL("image/png")||null}catch{return null}}function Sn(n,e){n.blobUrl=e,n.url=e}let V=class extends Nt{constructor(){super(...arguments),this.image="",this.bufferA="",this.bufferB="",this.bufferC="",this.bufferD="",this.common="",this.channel0="",this.channel1="",this.channel2="",this.channel3="",this.imageCh0="",this.imageCh1="",this.imageCh2="",this.imageCh3="",this.bufferACh0="",this.bufferACh1="",this.bufferACh2="",this.bufferACh3="",this.bufferBCh0="",this.bufferBCh1="",this.bufferBCh2="",this.bufferBCh3="",this.bufferCCh0="",this.bufferCCh1="",this.bufferCCh2="",this.bufferCCh3="",this.bufferDCh0="",this.bufferDCh1="",this.bufferDCh2="",this.bufferDCh3="",this.play=!0,this.playOnHover=!1,this.mouse=!0,this.mouseMode="direct",this.mouseSpeed=8,this.hoverParam="",this.hoverSpeed=10,this.releaseOffscreen=!0,this.dprMax=2,this.param0=0,this.param1=0,this.param2=0,this.param3=0,this.dataProvider="",this.outDataProvider="",this.sample=!1,this.outInterval=80,this.extract=!1,this.extractInterval=0,this.extractSource="image",this.extractMask="none",this.extractThreshold=.5,this.extractMax=8,this.extractPatch=16,this.extractBitmaps=!1,this.extractDataProvider="",this.aspectRatio="",this.errorMessage="",this.runtime=null,this.raf=0,this.startTime=0,this.lastTime=0,this.frame=0,this.mouseVec=[0,0,0,0],this.mouseTarget=[0,0],this.mouseFollow=[0,0],this.mouseHasPointer=!1,this.pointerDown=!1,this.hovering=!1,this.hoverGoal=0,this.hoverMix=0,this.leaveRaf=0,this.outEventListeners=0,this.extractEventListeners=0,this.releasing=!1,this.inView=!0,this.resizeObserver=null,this.intersectionObserver=null,this.rebuildToken=0,this.ready=!1,this.formPublisher=null,this.outPublisher=null,this.extractPublisher=null,this.lastOutAt=0,this.lastExtractAt=0,this.manualRois=[],this.lastBlobUrls=[],this.pendingRevokeUrls=[],this.extractRunning=!1,this.extractSeq=0,this.onFormMutation=()=>{const n=this.formPublisher?.get()??{};this.applyFormParams(n)},this.onContextLost=n=>{n.preventDefault(),!this.releasing&&(this.rebuildToken++,this.stopLoop(),this.ready=!1,this.runtime=null)},this.onContextRestored=()=>{this.releasing||!this.inView||this.ensureRuntime()},this.loop=()=>{this.raf=requestAnimationFrame(this.loop),this.drawFrame(performance.now()),this.playOnHover&&!this.hovering&&this.hoverSettled()&&(this.stopLoop(),this.runtime?.setVideosPlaying(!1))},this.onPointerMove=n=>{if(!this.mouse)return;const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t),this.pointerDown&&(this.mouseVec[2]=e,this.mouseVec[3]=t)},this.onPointerDown=n=>{if(!this.mouse)return;this.pointerDown=!0,this.setPointerCapture?.(n.pointerId);const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t,!0),this.mouseVec[2]=e,this.mouseVec[3]=t},this.onPointerUp=n=>{if(!this.mouse)return;this.pointerDown=!1;const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t),this.mouseVec[2]=-Math.abs(this.mouseVec[2]),this.mouseVec[3]=-Math.abs(this.mouseVec[3])},this.onPointerEnter=()=>{this.leaveRaf&&(cancelAnimationFrame(this.leaveRaf),this.leaveRaf=0),this.hovering=!0,this.hoverGoal=1,this.syncPlayback()},this.onPointerLeave=()=>{this.leaveRaf&&cancelAnimationFrame(this.leaveRaf),this.leaveRaf=requestAnimationFrame(()=>{this.leaveRaf=0,!(!this.isConnected||this.matches(":hover"))&&(this.hovering=!1,this.hoverGoal=0,this.pointerDown=!1,this.syncPlayback())})}}connectedCallback(){super.connectedCallback(),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointerleave",this.onPointerLeave),this.addEventListener("pointerenter",this.onPointerEnter),this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher()}addEventListener(n,e,t){n==="out"&&e&&this.outEventListeners++,n==="extract"&&e&&this.extractEventListeners++,super.addEventListener(n,e,t)}removeEventListener(n,e,t){n==="out"&&e&&(this.outEventListeners=Math.max(0,this.outEventListeners-1)),n==="extract"&&e&&(this.extractEventListeners=Math.max(0,this.extractEventListeners-1)),super.removeEventListener(n,e,t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointerleave",this.onPointerLeave),this.removeEventListener("pointerenter",this.onPointerEnter),this.leaveRaf&&(cancelAnimationFrame(this.leaveRaf),this.leaveRaf=0),this.unbindFormProvider(),this.unbindContextEvents(),this.revokeBlobUrls();for(const n of this.pendingRevokeUrls)try{URL.revokeObjectURL(n)}catch{}this.pendingRevokeUrls=[],this.stopLoop(),this.resizeObserver?.disconnect(),this.intersectionObserver?.disconnect(),this.rebuildToken++,this.ready=!1,this.releasing=!0,this.runtime?.dispose(!0),this.runtime=null,this.outPublisher=null,this.releasing=!1}firstUpdated(){this.resizeObserver=new ResizeObserver(()=>this.syncSize()),this.resizeObserver.observe(this),this.intersectionObserver=new IntersectionObserver(n=>{this.inView=n.some(e=>e.isIntersecting),this.syncVisibility()},{threshold:0}),this.intersectionObserver.observe(this),this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher(),requestAnimationFrame(()=>{(this.inView||!this.releaseOffscreen)&&this.ensureRuntime()})}updated(n){if(!this.runtime)return;["image","bufferA","bufferB","bufferC","bufferD","common","channel0","channel1","channel2","channel3","imageCh0","imageCh1","imageCh2","imageCh3","bufferACh0","bufferACh1","bufferACh2","bufferACh3","bufferBCh0","bufferBCh1","bufferBCh2","bufferBCh3","bufferCCh0","bufferCCh1","bufferCCh2","bufferCCh3","bufferDCh0","bufferDCh1","bufferDCh2","bufferDCh3"].some(t=>n.has(t))&&this.rebuild(),n.has("play")&&this.syncPlayback(),(n.has("dataProvider")||n.has("outDataProvider")||n.has("extractDataProvider"))&&(this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher()),n.has("aspectRatio")&&this.applyAspectRatio()}applyAspectRatio(n){const e=this.aspectRatio.trim();if(e){this.style.setProperty("--sonic-shader-ar",e.includes("/")?e:e.replace(":"," / "));return}const t=n||this.channel0,r=t?this.runtime?.getTextureSize(t):null;if(r){this.style.setProperty("--sonic-shader-ar",`${r.width} / ${r.height}`);return}this.style.removeProperty("--sonic-shader-ar")}resolveFormProviderId(){const n=this.dataProvider?.trim();return n||at.getAncestorAttributeValue(this,"dataProvider")||at.getAncestorAttributeValue(this,"formDataProvider")||""}unbindFormProvider(){this.formPublisher&&(this.formPublisher.offInternalMutation(this.onFormMutation),this.formPublisher=null)}bindFormProvider(){this.unbindFormProvider();const n=this.resolveFormProviderId();n&&(this.formPublisher=$e.get(n),this.formPublisher.onInternalMutation(this.onFormMutation),this.onFormMutation())}resolveOutProviderId(){const n=this.outDataProvider?.trim();return n||this.resolveFormProviderId()}bindOutPublisher(){const n=this.resolveOutProviderId();this.outPublisher=n?$e.get(n):null}resolveExtractProviderId(){const n=this.extractDataProvider?.trim();return n||this.resolveOutProviderId()}bindExtractPublisher(){const n=this.resolveExtractProviderId();this.extractPublisher=n?$e.get(n):null}applyFormParams(n){const e=n&&typeof n=="object"?n:{},t=zt(this.hoverParam);t!==0&&(this.param0=Ve(e.param0,this.param0)),t!==1&&(this.param1=Ve(e.param1,this.param1)),t!==2&&(this.param2=Ve(e.param2,this.param2)),t!==3&&(this.param3=Ve(e.param3,this.param3)),"mouseSpeed"in e&&(this.mouseSpeed=Ve(e.mouseSpeed,this.mouseSpeed)),"hoverSpeed"in e&&(this.hoverSpeed=Ve(e.hoverSpeed,this.hoverSpeed)),"extractThreshold"in e&&(this.extractThreshold=Ve(e.extractThreshold,this.extractThreshold)),"extractMax"in e&&(this.extractMax=Ve(e.extractMax,this.extractMax)),"extractPatch"in e&&(this.extractPatch=Ve(e.extractPatch,this.extractPatch)),"rois"in e&&(this.manualRois=xn(e.rois));for(const r of ss){if(!(r in e))continue;const s=cs(e[r]);s!==void 0&&this[r]!==s&&(this[r]=s)}}effectiveParams(){const n=[this.param0,this.param1,this.param2,this.param3],e=zt(this.hoverParam);return e!==null&&(n[e]=this.hoverMix),n}releaseRuntime(){this.rebuildToken++,this.stopLoop(),this.ready=!1,this.releasing=!0,this.unbindContextEvents(),this.runtime?.dispose(!1),this.runtime=null,this.releasing=!1}getCanvas(){return this.renderRoot?.querySelector("canvas")??null}bindContextEvents(){const n=this.getCanvas();n?.addEventListener("webglcontextlost",this.onContextLost),n?.addEventListener("webglcontextrestored",this.onContextRestored)}unbindContextEvents(){const n=this.getCanvas();n?.removeEventListener("webglcontextlost",this.onContextLost),n?.removeEventListener("webglcontextrestored",this.onContextRestored)}async ensureRuntime(){if(this.runtime&&!this.runtime.isLost||(this.runtime=null,await this.updateComplete,!this.isConnected||!this.inView&&this.releaseOffscreen))return;const n=this.getCanvas();if(n)try{this.errorMessage="",this.runtime=new Qi(n),this.bindContextEvents(),this.syncSize(),await this.rebuild()}catch(e){this.emitError(e)}}syncVisibility(){if(!this.inView&&this.releaseOffscreen){this.releaseRuntime();return}if(this.inView&&(!this.runtime||this.runtime.isLost)){this.ensureRuntime();return}this.syncPlayback()}syncSize(){if(!this.runtime)return;const n=this.getBoundingClientRect(),e=Math.max(n.width,this.clientWidth,1),t=Math.max(n.height,this.clientHeight,1),r=Math.min(window.devicePixelRatio||1,this.dprMax);this.runtime.resize(e*r,t*r),this.ready&&this.drawFrame(performance.now())}buildChannels(n){const e=[this.channel0,this.channel1,this.channel2,this.channel3],t=n==="image"?[this.imageCh0,this.imageCh1,this.imageCh2,this.imageCh3]:n==="bufferA"?[this.bufferACh0,this.bufferACh1,this.bufferACh2,this.bufferACh3]:n==="bufferB"?[this.bufferBCh0,this.bufferBCh1,this.bufferBCh2,this.bufferBCh3]:n==="bufferC"?[this.bufferCCh0,this.bufferCCh1,this.bufferCCh2,this.bufferCCh3]:[this.bufferDCh0,this.bufferDCh1,this.bufferDCh2,this.bufferDCh3];return[0,1,2,3].map(r=>Zi(t[r],e[r]))}collectUrls(n){const e=[];for(const t of n.values())for(const r of t)r.kind==="url"&&e.push(r.url);return e}async rebuild(){if(!this.runtime||this.runtime.isLost||!this.image.trim())return;const n=++this.rebuildToken;this.errorMessage="";const e={common:this.common,image:this.image,bufferA:this.bufferA,bufferB:this.bufferB,bufferC:this.bufferC,bufferD:this.bufferD},t=new Map;for(const r of["bufferA","bufferB","bufferC","bufferD","image"])t.set(r,this.buildChannels(r));try{this.syncSize();const r=this.collectUrls(t);if(await this.runtime.ensureTextures(r),n!==this.rebuildToken||!this.runtime||this.runtime.isLost||(this.applyAspectRatio(this.channel0||r[0]),this.syncSize(),this.runtime.setSources(e,t),n!==this.rebuildToken||!this.runtime||this.runtime.isLost))return;this.ready=!0,this.startTime=performance.now(),this.lastTime=this.startTime,this.frame=0,this.drawFrame(this.startTime),this.syncPlayback()}catch(r){if(n!==this.rebuildToken)return;this.ready=!1,this.stopLoop(),this.emitError(r)}}emitError(n){const e=n instanceof ht||n instanceof Error?n.message:String(n);this.errorMessage=e,this.dispatchEvent(new CustomEvent("error",{detail:{message:e,pass:n instanceof ht?n.pass:void 0,infoLog:n instanceof ht?n.infoLog:void 0},bubbles:!0,composed:!0}))}shouldAnimate(){return!this.play||!this.ready||!this.inView||us()||!this.runtime?!1:this.playOnHover?this.hovering||!this.hoverSettled():!0}hoverSettled(){return zt(this.hoverParam)===null?!0:Math.abs(this.hoverMix-this.hoverGoal)<.002}syncPlayback(){this.shouldAnimate()?(this.runtime?.setVideosPlaying(!0),this.raf||(this.lastTime=performance.now(),this.loop())):(this.stopLoop(),this.runtime?.setVideosPlaying(!1),this.ready&&this.drawFrame(performance.now()))}stopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=0)}drawFrame(n){if(!this.runtime||!this.ready)return;const e=(n-this.startTime)/1e3,t=Math.max(0,(n-this.lastTime)/1e3);this.lastTime=n,this.advanceMouseFollow(t),this.advanceHover(t);const r=this.effectiveParams();this.runtime.render({time:e,timeDelta:t,frame:this.frame++,mouse:this.mouseVec,params:r}),this.maybePublishOut(n,e,r),this.maybeExtract(n,e)}round3(n){return Math.round(n*1e3)/1e3}buildOutput(n,e,t=!1){const{width:r,height:s}=this.runtime?.size??{width:1,height:1},u=this.mouseHasPointer,o=u&&r>0?this.mouseVec[0]/r:.5,p=u&&s>0?this.mouseVec[1]/s:.5,y=e??this.effectiveParams(),P={time:this.round3(n),frame:this.frame,mouseX:this.round3(o),mouseY:this.round3(p),hovering:this.hovering?1:0,param0:this.round3(y[0]),param1:this.round3(y[1]),param2:this.round3(y[2]),param3:this.round3(y[3])};if(t&&this.runtime){const M=u?this.mouseVec[0]:r*.5,k=u?this.mouseVec[1]:s*.5,[w,C,R,N]=this.runtime.readPixel(M,k),ee=w/255,J=C/255,E=R/255,v=N/255;P.sampleR=this.round3(ee),P.sampleG=this.round3(J),P.sampleB=this.round3(E),P.sampleA=this.round3(v),P.sampleLuma=this.round3(.2126*ee+.7152*J+.0722*E)}return P}publisherFieldHasListener(n){return!!this.outPublisher?._proxies_?.get(n)?.hasListener?.()}hasOutConsumers(){if(this.outEventListeners>0)return!0;if(!this.outPublisher)return!1;for(const n of ns)if(this.publisherFieldHasListener(n))return!0;for(const n of as)if(this.publisherFieldHasListener(n))return!0;return!1}shouldSkipParamOutWrite(n){if(!is.includes(n)||!this.formPublisher||this.formPublisher!==this.outPublisher)return!1;const e=zt(this.hoverParam);return e===null?!0:Number(n.slice(5))!==e}needsSampleRead(){return this.sample&&this.hasOutConsumers()}maybePublishOut(n,e,t){if(this.outPublisher||this.bindOutPublisher(),!this.hasOutConsumers())return;const r=Math.max(16,this.outInterval||80);if(n-this.lastOutAt<r)return;this.lastOutAt=n;const s=this.buildOutput(e,t,this.needsSampleRead()),u=this.outPublisher;if(u){for(const[o,p]of Object.entries(s))if(p!==void 0&&!this.shouldSkipParamOutWrite(o))try{u[o].set(p)}catch{}}this.dispatchEvent(new CustomEvent("out",{detail:s,bubbles:!0,composed:!0}))}revokeBlobUrls(){for(const n of this.lastBlobUrls)try{URL.revokeObjectURL(n)}catch{}this.lastBlobUrls=[]}scheduleRevokePreviousBlobs(n){const e=n.filter(r=>r.startsWith("blob:"));if(e.length===0)return;this.pendingRevokeUrls.push(...e);const t=e;window.setTimeout(()=>{for(const r of t){try{URL.revokeObjectURL(r)}catch{}const s=this.pendingRevokeUrls.indexOf(r);s>=0&&this.pendingRevokeUrls.splice(s,1)}},1500)}publisherHasFieldListener(n,e){return!!n?._proxies_?.get(e)?.hasListener?.()}hasExtractConsumers(){if(this.extractEventListeners>0)return!0;const n=this.extractPublisher;if(!n)return!1;for(const e of os)if(this.publisherHasFieldListener(n,e))return!0;return!1}syncManualRoisFromPublishers(){const n=e=>{if(e?.get)try{const t=e.get()??{};"rois"in t&&(this.manualRois=xn(t.rois))}catch{}};n(this.formPublisher),this.extractPublisher&&this.extractPublisher!==this.formPublisher&&n(this.extractPublisher)}resolveExtractInterval(){return this.extractInterval>0?Math.max(16,this.extractInterval):Math.max(16,this.outInterval||100)}async readRegion(n){return!this.runtime||!this.ready?null:await this.buildExtractItem(n,"manual",void 0)}async extractNow(){const n=(performance.now()-this.startTime)/1e3;return this.runExtract(n)}async maybeExtract(n,e){!this.extract||!this.ready||!this.runtime||(this.extractPublisher||this.bindExtractPublisher(),this.hasExtractConsumers()&&(n-this.lastExtractAt<this.resolveExtractInterval()||this.extractRunning||(this.lastExtractAt=n,await this.runExtract(e))))}async runExtract(n){const e={frame:this.frame,time:this.round3(n),items:[]};if(!this.runtime||!this.ready)return e;this.extractRunning=!0;try{this.syncManualRoisFromPublishers();const{width:t,height:r}=this.runtime.size,s=this.manualRois.map(k=>({...k,source:"manual"})),u=Ur(this.extractMask);if(u){const k=this.runtime.readBufferRect(u,0,0,t,r);if(k){const w=Vi(k.data,k.width,k.height,{threshold:this.extractThreshold,maxCount:Math.max(0,Math.floor(this.extractMax)),minDistance:Math.max(8,Math.floor(Math.min(this.extractPatch/3,16)))}),C=w[0]?.score||1;for(let R=0;R<w.length;R++){const N=w[R];s.push({id:`detect-${R}`,x:(N.x+.5)/t,y:(N.y+.5)/r,patch:this.extractPatch,source:"detect",score:C>0?N.score/C:N.score})}}}const o=[];let p=0;const y=Ur(this.extractSource)??"image";for(const k of s){const w=k.source==="detect"?"detect":"manual";if(w==="detect"){if(p>=Math.max(0,Math.floor(this.extractMax)))continue;p++}const C=bn(k,t,r,this.extractPatch,_n);if(!C)continue;const R=y==="image"?this.runtime.readRect(C.x,C.y,C.w,C.h):this.runtime.readBufferRect(y,C.x,C.y,C.w,C.h);if(!R)continue;const N=new Uint8Array(R.data),ee=yn(N),J={id:k.id||`${w}-${C.x}-${C.y}`,x:this.round3(R.x/t),y:this.round3(R.y/r),w:this.round3(R.width/t),h:this.round3(R.height/r),meanR:this.round3(ee.r),meanG:this.round3(ee.g),meanB:this.round3(ee.b),meanA:this.round3(ee.a),meanLuma:this.round3(ee.luma),source:w};typeof k.score=="number"&&(J.score=this.round3(k.score)),o.push({item:J,rgba:N,width:R.width,height:R.height})}if(this.extractBitmaps){const k=this.rebuildToken;for(const w of o){if(k!==this.rebuildToken||!this.isConnected){for(const R of o)R.item.blobUrl&&It([R.item.blobUrl]);return e}const C=await kn(w.rgba,w.width,w.height);if(k!==this.rebuildToken||!this.isConnected){C&&It([C]);for(const R of o)R.item.blobUrl&&It([R.item.blobUrl]);return e}C&&Sn(w.item,C)}}if(!this.isConnected){for(const k of o)k.item.blobUrl&&It([k.item.blobUrl]);return e}const P=o.map(k=>k.item),M={frame:this.frame,time:this.round3(n),items:P};return this.publishExtract(M),M}finally{this.extractRunning=!1}}async buildExtractItem(n,e,t){if(!this.runtime)return null;const{width:r,height:s}=this.runtime.size,u=bn(n,r,s,this.extractPatch,_n);if(!u)return null;const o=Ur(this.extractSource)??"image",p=o==="image"?this.runtime.readRect(u.x,u.y,u.w,u.h):this.runtime.readBufferRect(o,u.x,u.y,u.w,u.h);if(!p)return null;const y=yn(p.data),P={id:n.id||`${e}-${u.x}-${u.y}`,x:this.round3(p.x/r),y:this.round3(p.y/s),w:this.round3(p.width/r),h:this.round3(p.height/s),meanR:this.round3(y.r),meanG:this.round3(y.g),meanB:this.round3(y.b),meanA:this.round3(y.a),meanLuma:this.round3(y.luma),source:e};if(typeof t=="number"&&(P.score=this.round3(t)),this.extractBitmaps){const M=this.rebuildToken,k=await kn(p.data,p.width,p.height);if(M!==this.rebuildToken||!this.isConnected)return k&&It([k]),null;k&&Sn(P,k)}return P}publishExtract(n){this.scheduleRevokePreviousBlobs(this.lastBlobUrls),this.lastBlobUrls=[];for(const t of n.items)t.blobUrl&&this.lastBlobUrls.push(t.blobUrl);this.extractSeq++,this.extractPublisher||this.bindExtractPublisher();const e=this.extractPublisher;if(e)try{const t=e.get?.()??{};e.set({...t,rois:Array.isArray(t.rois)?t.rois:this.manualRois,extracts:n.items,extractCount:n.items.length,extractSeq:this.extractSeq})}catch{try{e.extracts.set(n.items),e.extractCount.set(n.items.length),e.extractSeq.set(this.extractSeq)}catch{}}this.dispatchEvent(new CustomEvent("extract",{detail:n,bubbles:!0,composed:!0}))}advanceMouseFollow(n){if(!this.mouse||this.mouseMode!=="target"||!this.mouseHasPointer)return;const e=Math.max(0,this.mouseSpeed),t=e<=0||n<=0?1:1-Math.exp(-e*n);this.mouseFollow[0]+=(this.mouseTarget[0]-this.mouseFollow[0])*t,this.mouseFollow[1]+=(this.mouseTarget[1]-this.mouseFollow[1])*t,this.mouseVec[0]=this.mouseFollow[0],this.mouseVec[1]=this.mouseFollow[1]}advanceHover(n){if(zt(this.hoverParam)===null)return;const e=Math.max(0,this.hoverSpeed),t=e<=0||n<=0?1:1-Math.exp(-e*n),r=this.hoverMix+(this.hoverGoal-this.hoverMix)*t;this.hoverMix=Math.abs(r-this.hoverGoal)<.002?this.hoverGoal:r}localPointer(n){const e=this.getBoundingClientRect(),t=Math.min(window.devicePixelRatio||1,this.dprMax),r=(n.clientX-e.left)*t,s=(e.height-(n.clientY-e.top))*t;return{x:r,y:s}}setPointerTarget(n,e,t=!1){this.mouseTarget[0]=n,this.mouseTarget[1]=e,(!this.mouseHasPointer||t||this.mouseMode==="direct")&&(this.mouseHasPointer=!0,this.mouseFollow[0]=n,this.mouseFollow[1]=e,this.mouseVec[0]=n,this.mouseVec[1]=e)}render(){return Zr`
|
|
72
|
+
`+Ki}function Ht(n){if(n===""||n===null||n===void 0)return null;if(typeof n=="number")return n===0||n===1||n===2||n===3?n:null;const e=n.trim().toLowerCase();return e==="0"||e==="param0"?0:e==="1"||e==="param1"?1:e==="2"||e==="param2"?2:e==="3"||e==="param3"?3:null}function Fr(n){if(n===""||n===null||n===void 0)return null;const e=n.trim().toLowerCase();return e==="none"||e==="off"||e==="false"?null:e==="image"?"image":e==="buffer-a"||e==="buffera"||e==="a"?"bufferA":e==="buffer-b"||e==="bufferb"||e==="b"?"bufferB":e==="buffer-c"||e==="bufferc"||e==="c"?"bufferC":e==="buffer-d"||e==="bufferd"||e==="d"?"bufferD":null}function es(n,e,t,r={}){const s=Math.max(0,Math.min(1,r.threshold??.5)),u=Math.max(0,Math.floor(r.maxCount??8)),a=Math.max(1,Math.floor(r.minDistance??16));if(u===0||e<1||t<1||n.length<e*t*4)return[];const d=s*255,y=[];for(let S=1;S<t-1;S++)for(let w=1;w<e-1;w++){const C=(S*e+w)*4,D=n[C];if(D<d)continue;let N=!0;for(let ee=-1;ee<=1&&N;ee++)for(let J=-1;J<=1;J++){if(J===0&&ee===0)continue;const _=((S+ee)*e+(w+J))*4;if(n[_]>D){N=!1;break}}N&&y.push({x:w,y:S,score:D/255})}y.sort((S,w)=>w.score-S.score);const T=[],M=a*a;for(const S of y){if(T.length>=u)break;let w=!0;for(const C of T){const D=S.x-C.x,N=S.y-C.y;if(D*D+N*N<M){w=!1;break}}w&&T.push(S)}return T}function _n(n,e,t,r,s=128){if(e<1||t<1)return null;const u=typeof n.w=="number"&&typeof n.h=="number"&&Number.isFinite(n.w)&&Number.isFinite(n.h)&&n.w>0&&n.h>0;let a,d,y,T;if(u)a=Math.floor(n.x*e),d=Math.floor(n.y*t),y=Math.max(1,Math.round(n.w*e)),T=Math.max(1,Math.round(n.h*t));else{const M=Math.min(s,Math.max(1,Math.floor(n.patch??r))),S=n.x*e,w=n.y*t;y=M,T=M,a=Math.floor(S-M/2),d=Math.floor(w-M/2)}return a<0&&(y+=a,a=0),d<0&&(T+=d,d=0),a+y>e&&(y=e-a),d+T>t&&(T=t-d),y<1||T<1?null:(y=Math.min(y,s),T=Math.min(T,s),{x:a,y:d,w:y,h:T})}function An(n){const e=Math.floor(n.length/4);if(e<1)return{r:0,g:0,b:0,a:0,luma:0};let t=0,r=0,s=0,u=0;for(let a=0;a<e;a++){const d=a*4;t+=n[d],r+=n[d+1],s+=n[d+2],u+=n[d+3]}return t/=e*255,r/=e*255,s/=e*255,u/=e*255,{r:t,g:r,b:s,a:u,luma:.2126*t+.7152*r+.0722*s}}class ht extends Error{constructor(e,t,r){super(e),this.pass=t,this.infoLog=r,this.name="ShaderCompileError"}}const ts=["bufferA","bufferB","bufferC","bufferD","image"],rs=["bufferA","bufferB","bufferC","bufferD"];function ns(n,e,t){if(!n)return{upload:!1,texSource:null};if(typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){const r=n.currentSrc||n.src||"";return!r||!n.complete||n.naturalWidth<1?{upload:!1,texSource:null}:t===r&&e>0?{upload:!1,texSource:null,nextSrc:r}:{upload:!0,texSource:n,nextSrc:r}}if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement)return n.readyState<2||n.videoWidth<1?{upload:!1,texSource:null}:{upload:!0,texSource:n};if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement)return n.width<1||n.height<1?{upload:!1,texSource:null}:{upload:!0,texSource:n};if(rn(n)){if(n.frameSeq===e)return{upload:!1,texSource:null};const r=n.getFrameCanvas();return!r||r.width<1||r.height<1?{upload:!1,texSource:null}:{upload:!0,texSource:r}}return{upload:!1,texSource:null}}function is(n){return/\.(webm|mp4|ogg|mov)(\?|#|$)/i.test(n)}function ss(n){return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?{width:n.videoWidth||1,height:n.videoHeight||1}:typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement?{width:n.naturalWidth||n.width||1,height:n.naturalHeight||n.height||1}:"width"in n&&"height"in n?{width:Math.max(1,Number(n.width)||1),height:Math.max(1,Number(n.height)||1)}:{width:1,height:1}}function xn(n,e,t,r){const s=n.createShader(e);if(!s)throw new ht("Unable to create shader",r,"");if(n.shaderSource(s,t),n.compileShader(s),!n.getShaderParameter(s,n.COMPILE_STATUS)){const u=n.getShaderInfoLog(s)||"";throw n.deleteShader(s),new ht(`Compile error (${r}): ${u}`,r,u)}return s}function as(n,e,t,r){const s=n.createProgram();if(!s)throw new ht("Unable to create program","link","");if(n.attachShader(s,e),n.attachShader(s,t),n.linkProgram(s),!n.getProgramParameter(s,n.LINK_STATUS)){const u=n.getProgramInfoLog(s)||"";throw n.deleteProgram(s),new ht(`Link error (${r}): ${u}`,"link",u)}return s}function os(n,e){return{iResolution:n.getUniformLocation(e,"iResolution"),iTime:n.getUniformLocation(e,"iTime"),iTimeDelta:n.getUniformLocation(e,"iTimeDelta"),iFrameRate:n.getUniformLocation(e,"iFrameRate"),iFrame:n.getUniformLocation(e,"iFrame"),iMouse:n.getUniformLocation(e,"iMouse"),iDate:n.getUniformLocation(e,"iDate"),iSampleRate:n.getUniformLocation(e,"iSampleRate"),iChannelTime:n.getUniformLocation(e,"iChannelTime[0]")||n.getUniformLocation(e,"iChannelTime"),iChannelResolution:n.getUniformLocation(e,"iChannelResolution[0]")||n.getUniformLocation(e,"iChannelResolution"),iChannel:[0,1,2,3].map(t=>n.getUniformLocation(e,`iChannel${t}`)),uParam:[0,1,2,3].map(t=>n.getUniformLocation(e,`uParam${t}`))}}function $r(n,e,t){const r=n.createTexture();if(!r)throw new Error("Unable to create texture");return n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA8,e,t,0,n.RGBA,n.UNSIGNED_BYTE,null),r}function Sn(n,e){const t=n.createFramebuffer();if(!t)throw new Error("Unable to create framebuffer");n.bindFramebuffer(n.FRAMEBUFFER,t),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0);const r=n.checkFramebufferStatus(n.FRAMEBUFFER);if(r!==n.FRAMEBUFFER_COMPLETE)throw new Error(`Incomplete framebuffer: ${r}`);return n.bindFramebuffer(n.FRAMEBUFFER,null),t}function kn(n,e,t){const r=[$r(n,e,t),$r(n,e,t)],s=[Sn(n,r[0]),Sn(n,r[1])];return{textures:r,framebuffers:s,index:0}}function Nr(n,e){for(const t of e.textures)n.deleteTexture(t);for(const t of e.framebuffers)n.deleteFramebuffer(t)}function us(n,e){const t=(n??"").trim();if(!t){const s=(e??"").trim();return s.startsWith("#")?{kind:"element",key:s}:s?{kind:"url",url:s}:{kind:"none"}}if(t.startsWith("#"))return{kind:"element",key:t};const r=t.toLowerCase();return r==="self"?{kind:"self"}:r==="buffer-a"||r==="buffera"||r==="a"?{kind:"buffer",buffer:"bufferA"}:r==="buffer-b"||r==="bufferb"||r==="b"?{kind:"buffer",buffer:"bufferB"}:r==="buffer-c"||r==="bufferc"||r==="c"?{kind:"buffer",buffer:"bufferC"}:r==="buffer-d"||r==="bufferd"||r==="d"?{kind:"buffer",buffer:"bufferD"}:r==="none"||r==="null"?{kind:"none"}:{kind:"url",url:t}}class cs{constructor(e){this.vao=null,this.vertexShader=null,this.programs=new Map,this.buffers=new Map,this.external=new Map,this.width=0,this.height=0,this.passChannels=new Map,this.activePasses=[],this.blackTexture=null,this.elementResolver=null;const t=e.getContext("webgl2",{antialias:!1,alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0,powerPreference:"default"});if(!t||t.isContextLost())throw new Error("WebGL2 not available");this.canvas=e,this.gl=t,this.initGeometry(),this.blackTexture=$r(t,1,1),t.bindTexture(t.TEXTURE_2D,this.blackTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255]))}get isLost(){return this.gl.isContextLost()}initGeometry(){const e=this.gl,t=e.createVertexArray();if(!t)throw new Error("Unable to create VAO");this.vao=t,e.bindVertexArray(t);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.bindVertexArray(null)}resize(e,t){const r=Math.max(1,Math.floor(e)),s=Math.max(1,Math.floor(t));if(!(r===this.width&&s===this.height)){this.width=r,this.height=s,this.canvas.width=r,this.canvas.height=s;for(const u of rs){const a=this.buffers.get(u);a&&Nr(this.gl,a),this.programs.has(u)&&this.buffers.set(u,kn(this.gl,r,s))}}}setSources(e,t){if(this.gl.isContextLost())throw new Error("WebGL context lost");this.disposePrograms(),this.passChannels=t,this.activePasses=[],this.vertexShader=xn(this.gl,this.gl.VERTEX_SHADER,Zi,"vertex");for(const r of ts){const s=r==="image"?e.image:e[r];if(!s?.trim())continue;const u=Qi(e.common||"",s),a=xn(this.gl,this.gl.FRAGMENT_SHADER,u,r),d=as(this.gl,this.vertexShader,a,r);if(this.gl.deleteShader(a),this.programs.set(r,{program:d,uniforms:os(this.gl,d)}),this.activePasses.push(r),r!=="image"&&this.width>0){const y=this.buffers.get(r);y&&Nr(this.gl,y),this.buffers.set(r,kn(this.gl,this.width,this.height))}}if(!this.programs.has("image"))throw new ht("image pass is required","image","Missing image shader source")}async ensureTextures(e){const t=[...new Set(e.filter(Boolean))];await Promise.all(t.map(r=>this.loadTexture(r)))}ensureElementTexture(e){if(this.external.has(e))return;const t=this.gl,r=t.createTexture();r&&(t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255])),this.external.set(e,{texture:r,width:1,height:1,url:e,lastSeq:0}))}updateElementTextures(e){const t=this.gl;for(const[r,s]of this.external){let u=s.video??s.source??null;r.startsWith("#")&&e&&(u=e(r),s.source=u),typeof HTMLVideoElement<"u"&&u instanceof HTMLVideoElement&&(s.video=u);const a=ns(u,s.lastSeq,s.lastSrc);if(!a.upload||!a.texSource)continue;const d=ss(a.texSource);t.bindTexture(t.TEXTURE_2D,s.texture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),s.width===d.width&&s.height===d.height&&s.lastSeq>0?t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,a.texSource):(t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,t.RGBA,t.UNSIGNED_BYTE,a.texSource),s.width=d.width,s.height=d.height),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,0),rn(u)?s.lastSeq=u.frameSeq:s.lastSeq=(s.lastSeq||0)+1,a.nextSrc!==void 0&&(s.lastSrc=a.nextSrc)}}updateVideoTextures(){this.updateElementTextures()}setVideosPlaying(e){for(const t of this.external.values()){const r=t.video||(typeof HTMLVideoElement<"u"&&t.source instanceof HTMLVideoElement?t.source:null);r&&(e?r.play().catch(()=>{}):r.pause())}}getTextureSize(e){const t=this.external.get(e);return!t||t.width<1||t.height<1?null:{width:t.width,height:t.height}}loadTexture(e){return this.external.get(e)?Promise.resolve():is(e)?this.loadVideoTexture(e):new Promise((r,s)=>{const u=new Image;u.crossOrigin="anonymous",u.onload=()=>{const a=this.gl,d=a.createTexture();if(!d){s(new Error("Unable to create texture"));return}a.bindTexture(a.TEXTURE_2D,d),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,1),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA8,a.RGBA,a.UNSIGNED_BYTE,u),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:d,width:u.naturalWidth||u.width,height:u.naturalHeight||u.height,url:e,lastSeq:0}),r()},u.onerror=()=>s(new Error(`Failed to load texture: ${e}`)),u.src=e})}loadVideoTexture(e){return new Promise((t,r)=>{const s=document.createElement("video");s.crossOrigin="anonymous",s.muted=!0,s.loop=!0,s.playsInline=!0,s.preload="auto";let u=!1;const a=()=>{u||(u=!0,r(new Error(`Failed to load video: ${e}`)))},d=()=>{if(u||!s.videoWidth)return;u=!0;const y=this.gl,T=y.createTexture();if(!T){r(new Error("Unable to create texture"));return}y.bindTexture(y.TEXTURE_2D,T),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,1),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.texImage2D(y.TEXTURE_2D,0,y.RGBA8,y.RGBA,y.UNSIGNED_BYTE,s),y.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:T,width:s.videoWidth,height:s.videoHeight,url:e,video:s,lastSeq:0}),s.play().catch(()=>{}),t()};s.addEventListener("loadeddata",d),s.addEventListener("error",a),s.src=e,s.load()})}resolveChannel(e,t){const r={texture:this.blackTexture,width:1,height:1};if(t.kind==="none")return r;if(t.kind==="url"||t.kind==="element"){const a=t.kind==="url"?t.url:t.key,d=this.external.get(a);return d?{texture:d.texture,width:d.width,height:d.height}:r}const s=t.kind==="self"?e==="image"?null:e:t.buffer;if(!s)return r;const u=this.buffers.get(s);return u?{texture:u.textures[u.index],width:this.width,height:this.height}:r}bindChannels(e,t){const r=this.gl,s=this.passChannels.get(e)||[{kind:"none"},{kind:"none"},{kind:"none"},{kind:"none"}],u=[];for(let a=0;a<4;a++){const d=this.resolveChannel(e,s[a]);r.activeTexture(r.TEXTURE0+a),r.bindTexture(r.TEXTURE_2D,d.texture),t.iChannel[a]&&r.uniform1i(t.iChannel[a],a),u.push(d.width,d.height,1)}t.iChannelResolution&&r.uniform3fv(t.iChannelResolution,u),t.iChannelTime&&r.uniform1fv(t.iChannelTime,[0,0,0,0])}setCommonUniforms(e,t){const r=this.gl,s=this.width,u=this.height;if(e.iResolution&&r.uniform3f(e.iResolution,s,u,1),e.iTime&&r.uniform1f(e.iTime,t.time),e.iTimeDelta&&r.uniform1f(e.iTimeDelta,t.timeDelta),e.iFrameRate&&r.uniform1f(e.iFrameRate,t.timeDelta>0?1/t.timeDelta:60),e.iFrame&&r.uniform1i(e.iFrame,t.frame),e.iMouse&&r.uniform4f(e.iMouse,t.mouse[0],t.mouse[1],t.mouse[2],t.mouse[3]),e.iDate){const a=new Date;r.uniform4f(e.iDate,a.getFullYear(),a.getMonth(),a.getDate(),a.getHours()*3600+a.getMinutes()*60+a.getSeconds()+a.getMilliseconds()*.001)}e.iSampleRate&&r.uniform1f(e.iSampleRate,44100);for(let a=0;a<4;a++)e.uParam[a]&&r.uniform1f(e.uParam[a],t.params[a])}setElementResolver(e){this.elementResolver=e}render(e){const t=this.gl;if(!this.vao||this.width<1||this.height<1)return;this.updateElementTextures(this.elementResolver??void 0),t.bindVertexArray(this.vao),t.viewport(0,0,this.width,this.height),t.disable(t.DEPTH_TEST),t.disable(t.BLEND);for(const s of this.activePasses){if(s==="image")continue;const u=this.programs.get(s),a=this.buffers.get(s);if(!u||!a)continue;const d=1-a.index;t.bindFramebuffer(t.FRAMEBUFFER,a.framebuffers[d]),t.viewport(0,0,this.width,this.height),t.useProgram(u.program),this.setCommonUniforms(u.uniforms,e),this.bindChannels(s,u.uniforms),t.drawArrays(t.TRIANGLES,0,3),a.index=d}const r=this.programs.get("image");r&&(t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,this.width,this.height),t.useProgram(r.program),this.setCommonUniforms(r.uniforms,e),this.bindChannels("image",r.uniforms),t.drawArrays(t.TRIANGLES,0,3),t.bindVertexArray(null))}readRect(e,t,r,s){return this.readFramebufferRect(null,e,t,r,s)}readBufferRect(e,t,r,s,u){if(e==="image")return this.readRect(t,r,s,u);const a=this.buffers.get(e);return a?this.readFramebufferRect(a.framebuffers[a.index],t,r,s,u):null}readPixel(e,t){const r=this.readRect(Math.floor(e),Math.floor(t),1,1);return!r||r.data.length<4?[0,0,0,0]:[r.data[0],r.data[1],r.data[2],r.data[3]]}readFramebufferRect(e,t,r,s,u){const a=this.gl;if(a.isContextLost()||this.width<1||this.height<1)return null;let d=Math.floor(t),y=Math.floor(r),T=Math.floor(s),M=Math.floor(u);if(T<1||M<1||(d<0&&(T+=d,d=0),y<0&&(M+=y,y=0),d+T>this.width&&(T=this.width-d),y+M>this.height&&(M=this.height-y),T<1||M<1))return null;const S=new Uint8Array(T*M*4);return a.bindFramebuffer(a.FRAMEBUFFER,e),a.readPixels(d,y,T,M,a.RGBA,a.UNSIGNED_BYTE,S),a.bindFramebuffer(a.FRAMEBUFFER,null),{x:d,y,width:T,height:M,data:S}}get size(){return{width:this.width,height:this.height}}disposePrograms(){for(const e of this.programs.values())this.gl.deleteProgram(e.program);this.programs.clear(),this.activePasses=[],this.vertexShader&&(this.gl.deleteShader(this.vertexShader),this.vertexShader=null)}dispose(e=!0){if(this.gl.isContextLost())this.programs.clear(),this.buffers.clear(),this.external.clear(),this.blackTexture=null,this.vao=null,this.vertexShader=null;else{this.disposePrograms();for(const t of this.buffers.values())Nr(this.gl,t);this.buffers.clear();for(const t of this.external.values())t.video&&(t.video.pause(),t.video.removeAttribute("src"),t.video.load()),this.gl.deleteTexture(t.texture);this.external.clear(),this.blackTexture&&(this.gl.deleteTexture(this.blackTexture),this.blackTexture=null),this.vao&&(this.gl.deleteVertexArray(this.vao),this.vao=null),e&&this.gl.getExtension("WEBGL_lose_context")?.loseContext()}}}var ls=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,X=(n,e,t,r)=>{for(var s=r>1?void 0:r?fs(e,t):e,u=n.length-1,a;u>=0;u--)(a=n[u])&&(s=(r?a(e,t,s):a(s))||s);return r&&s&&ls(e,t,s),s};const hs="sonic-shader",Tn=128,ds=["time","frame","mouseX","mouseY","hovering"],ps=["param0","param1","param2","param3"],ms=["channel0","channel1","channel2","channel3","imageCh0","imageCh1","imageCh2","imageCh3","bufferACh0","bufferACh1","bufferACh2","bufferACh3","bufferBCh0","bufferBCh1","bufferBCh2","bufferBCh3","bufferCCh0","bufferCCh1","bufferCCh2","bufferCCh3","bufferDCh0","bufferDCh1","bufferDCh2","bufferDCh3"],gs=["sampleR","sampleG","sampleB","sampleA","sampleLuma"],vs=["extracts","extractCount","extractSeq"];function bs(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ve(n,e){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"&&n.trim()!==""){const t=Number(n);if(Number.isFinite(t))return t}return e}function ys(n){if(n===null||n==="")return"";if(typeof n=="string")return n.trim();const e=hi(n);if(e)return e;if(n&&typeof n=="object"){const t=n.element,r=fi(t);return r||void 0}return""}function Pn(n){if(!Array.isArray(n))return[];const e=[];for(const t of n){if(!t||typeof t!="object")continue;const r=t,s=Ve(r.x,NaN),u=Ve(r.y,NaN);if(!Number.isFinite(s)||!Number.isFinite(u))continue;const a={x:s,y:u,source:"manual"};typeof r.id=="string"&&r.id&&(a.id=r.id),"w"in r&&(a.w=Ve(r.w,0)),"h"in r&&(a.h=Ve(r.h,0)),"patch"in r&&(a.patch=Ve(r.patch,16)),e.push(a)}return e}const Ir=4;async function Cn(n,e,t){if(typeof document>"u"||e<1||t<1)return null;try{const r=document.createElement("canvas");r.width=e,r.height=t;const s=r.getContext("2d");if(!s)return null;const u=s.createImageData(e,t),a=u.data;for(let T=0;T<t;T++){const M=(t-1-T)*e*Ir,S=T*e*Ir;for(let w=0;w<e*Ir;w++)a[S+w]=n[M+w]}s.putImageData(u,0,0);const d=await new Promise(T=>{try{r.toBlob(M=>T(M),"image/png")}catch{T(null)}});return d?URL.createObjectURL(d):r.toDataURL("image/png")||null}catch{return null}}function Rn(n,e){n.blobUrl=e,n.url=e}let V=class extends Nt{constructor(){super(...arguments),this.image="",this.bufferA="",this.bufferB="",this.bufferC="",this.bufferD="",this.common="",this.channel0="",this.channel1="",this.channel2="",this.channel3="",this.imageCh0="",this.imageCh1="",this.imageCh2="",this.imageCh3="",this.bufferACh0="",this.bufferACh1="",this.bufferACh2="",this.bufferACh3="",this.bufferBCh0="",this.bufferBCh1="",this.bufferBCh2="",this.bufferBCh3="",this.bufferCCh0="",this.bufferCCh1="",this.bufferCCh2="",this.bufferCCh3="",this.bufferDCh0="",this.bufferDCh1="",this.bufferDCh2="",this.bufferDCh3="",this.play=!0,this.playOnHover=!1,this.mouse=!0,this.mouseMode="direct",this.mouseSpeed=8,this.hoverParam="",this.hoverSpeed=10,this.releaseOffscreen=!0,this.dprMax=2,this.param0=0,this.param1=0,this.param2=0,this.param3=0,this.dataProvider="",this.outDataProvider="",this.sample=!1,this.outInterval=80,this.extract=!1,this.extractInterval=0,this.extractSource="image",this.extractMask="none",this.extractThreshold=.5,this.extractMax=8,this.extractPatch=16,this.extractBitmaps=!1,this.extractDataProvider="",this.aspectRatio="",this.errorMessage="",this.runtime=null,this.raf=0,this.startTime=0,this.lastTime=0,this.frame=0,this.frameSeq=0,this.mouseVec=[0,0,0,0],this.mouseTarget=[0,0],this.mouseFollow=[0,0],this.mouseHasPointer=!1,this.pointerDown=!1,this.hovering=!1,this.hoverGoal=0,this.hoverMix=0,this.leaveRaf=0,this.outEventListeners=0,this.extractEventListeners=0,this.releasing=!1,this.inView=!0,this.resizeObserver=null,this.intersectionObserver=null,this.rebuildToken=0,this.ready=!1,this.formPublisher=null,this.outPublisher=null,this.extractPublisher=null,this.lastOutAt=0,this.lastExtractAt=0,this.manualRois=[],this.lastBlobUrls=[],this.pendingRevokeUrls=[],this.extractRunning=!1,this.extractSeq=0,this.onFormMutation=()=>{const n=this.formPublisher?.get()??{};this.applyFormParams(n)},this.onContextLost=n=>{n.preventDefault(),!this.releasing&&(this.rebuildToken++,this.stopLoop(),this.ready=!1,this.runtime=null)},this.onContextRestored=()=>{this.releasing||!this.inView||this.ensureRuntime()},this.loop=()=>{this.raf=requestAnimationFrame(this.loop),this.drawFrame(performance.now()),this.playOnHover&&!this.hovering&&this.hoverSettled()&&(this.stopLoop(),this.runtime?.setVideosPlaying(!1))},this.onPointerMove=n=>{if(!this.mouse)return;const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t),this.pointerDown&&(this.mouseVec[2]=e,this.mouseVec[3]=t)},this.onPointerDown=n=>{if(!this.mouse)return;this.pointerDown=!0,this.setPointerCapture?.(n.pointerId);const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t,!0),this.mouseVec[2]=e,this.mouseVec[3]=t},this.onPointerUp=n=>{if(!this.mouse)return;this.pointerDown=!1;const{x:e,y:t}=this.localPointer(n);this.setPointerTarget(e,t),this.mouseVec[2]=-Math.abs(this.mouseVec[2]),this.mouseVec[3]=-Math.abs(this.mouseVec[3])},this.onPointerEnter=()=>{this.leaveRaf&&(cancelAnimationFrame(this.leaveRaf),this.leaveRaf=0),this.hovering=!0,this.hoverGoal=1,this.syncPlayback()},this.onPointerLeave=()=>{this.leaveRaf&&cancelAnimationFrame(this.leaveRaf),this.leaveRaf=requestAnimationFrame(()=>{this.leaveRaf=0,!(!this.isConnected||this.matches(":hover"))&&(this.hovering=!1,this.hoverGoal=0,this.pointerDown=!1,this.syncPlayback())})}}connectedCallback(){super.connectedCallback(),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointerleave",this.onPointerLeave),this.addEventListener("pointerenter",this.onPointerEnter),this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher()}addEventListener(n,e,t){n==="out"&&e&&this.outEventListeners++,n==="extract"&&e&&this.extractEventListeners++,super.addEventListener(n,e,t)}removeEventListener(n,e,t){n==="out"&&e&&(this.outEventListeners=Math.max(0,this.outEventListeners-1)),n==="extract"&&e&&(this.extractEventListeners=Math.max(0,this.extractEventListeners-1)),super.removeEventListener(n,e,t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointerleave",this.onPointerLeave),this.removeEventListener("pointerenter",this.onPointerEnter),this.leaveRaf&&(cancelAnimationFrame(this.leaveRaf),this.leaveRaf=0),this.unbindFormProvider(),this.unbindContextEvents(),this.revokeBlobUrls();for(const n of this.pendingRevokeUrls)try{URL.revokeObjectURL(n)}catch{}this.pendingRevokeUrls=[],this.stopLoop(),this.resizeObserver?.disconnect(),this.intersectionObserver?.disconnect(),this.rebuildToken++,this.ready=!1,this.releasing=!0,this.runtime?.dispose(!0),this.runtime=null,this.outPublisher=null,this.releasing=!1}firstUpdated(){this.resizeObserver=new ResizeObserver(()=>this.syncSize()),this.resizeObserver.observe(this),this.intersectionObserver=new IntersectionObserver(n=>{this.inView=n.some(e=>e.isIntersecting),this.syncVisibility()},{threshold:0}),this.intersectionObserver.observe(this),this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher(),requestAnimationFrame(()=>{(this.inView||!this.releaseOffscreen)&&this.ensureRuntime()})}updated(n){if(!this.runtime)return;["image","bufferA","bufferB","bufferC","bufferD","common","channel0","channel1","channel2","channel3","imageCh0","imageCh1","imageCh2","imageCh3","bufferACh0","bufferACh1","bufferACh2","bufferACh3","bufferBCh0","bufferBCh1","bufferBCh2","bufferBCh3","bufferCCh0","bufferCCh1","bufferCCh2","bufferCCh3","bufferDCh0","bufferDCh1","bufferDCh2","bufferDCh3"].some(t=>n.has(t))&&this.rebuild(),n.has("play")&&this.syncPlayback(),(n.has("dataProvider")||n.has("outDataProvider")||n.has("extractDataProvider"))&&(this.bindFormProvider(),this.bindOutPublisher(),this.bindExtractPublisher()),n.has("aspectRatio")&&this.applyAspectRatio()}applyAspectRatio(n){const e=this.aspectRatio.trim();if(e){this.style.setProperty("--sonic-shader-ar",e.includes("/")?e:e.replace(":"," / "));return}const t=n||this.channel0,r=t?this.runtime?.getTextureSize(t):null;if(r){this.style.setProperty("--sonic-shader-ar",`${r.width} / ${r.height}`);return}this.style.removeProperty("--sonic-shader-ar")}resolveFormProviderId(){const n=this.dataProvider?.trim();return n||at.getAncestorAttributeValue(this,"dataProvider")||at.getAncestorAttributeValue(this,"formDataProvider")||""}unbindFormProvider(){this.formPublisher&&(this.formPublisher.offInternalMutation(this.onFormMutation),this.formPublisher=null)}bindFormProvider(){this.unbindFormProvider();const n=this.resolveFormProviderId();n&&(this.formPublisher=$e.get(n),this.formPublisher.onInternalMutation(this.onFormMutation),this.onFormMutation())}resolveOutProviderId(){const n=this.outDataProvider?.trim();return n||this.resolveFormProviderId()}bindOutPublisher(){const n=this.resolveOutProviderId();this.outPublisher=n?$e.get(n):null}resolveExtractProviderId(){const n=this.extractDataProvider?.trim();return n||this.resolveOutProviderId()}bindExtractPublisher(){const n=this.resolveExtractProviderId();this.extractPublisher=n?$e.get(n):null}applyFormParams(n){const e=n&&typeof n=="object"?n:{},t=Ht(this.hoverParam);t!==0&&(this.param0=Ve(e.param0,this.param0)),t!==1&&(this.param1=Ve(e.param1,this.param1)),t!==2&&(this.param2=Ve(e.param2,this.param2)),t!==3&&(this.param3=Ve(e.param3,this.param3)),"mouseSpeed"in e&&(this.mouseSpeed=Ve(e.mouseSpeed,this.mouseSpeed)),"hoverSpeed"in e&&(this.hoverSpeed=Ve(e.hoverSpeed,this.hoverSpeed)),"extractThreshold"in e&&(this.extractThreshold=Ve(e.extractThreshold,this.extractThreshold)),"extractMax"in e&&(this.extractMax=Ve(e.extractMax,this.extractMax)),"extractPatch"in e&&(this.extractPatch=Ve(e.extractPatch,this.extractPatch)),"rois"in e&&(this.manualRois=Pn(e.rois));for(const r of ms){if(!(r in e))continue;const s=ys(e[r]);s!==void 0&&this[r]!==s&&(this[r]=s)}}effectiveParams(){const n=[this.param0,this.param1,this.param2,this.param3],e=Ht(this.hoverParam);return e!==null&&(n[e]=this.hoverMix),n}releaseRuntime(){this.rebuildToken++,this.stopLoop(),this.ready=!1,this.releasing=!0,this.unbindContextEvents(),this.runtime?.dispose(!1),this.runtime=null,this.releasing=!1}getCanvas(){return this.renderRoot?.querySelector("canvas")??null}getFrameCanvas(){return!this.ready||!this.runtime||this.runtime.isLost?null:this.getCanvas()}lookupElement(n){if(!n.startsWith("#"))return null;const e=li(n);if(e)return e;const t=n.slice(1);if(!t||t.startsWith("__sonic_frame_"))return null;const r=this.getRootNode();if(r instanceof Document||r instanceof ShadowRoot){const s=r.getElementById(t);if(s)return s}return typeof document<"u"?document.getElementById(t):null}bindContextEvents(){const n=this.getCanvas();n?.addEventListener("webglcontextlost",this.onContextLost),n?.addEventListener("webglcontextrestored",this.onContextRestored)}unbindContextEvents(){const n=this.getCanvas();n?.removeEventListener("webglcontextlost",this.onContextLost),n?.removeEventListener("webglcontextrestored",this.onContextRestored)}async ensureRuntime(){if(this.runtime&&!this.runtime.isLost||(this.runtime=null,await this.updateComplete,!this.isConnected||!this.inView&&this.releaseOffscreen))return;const n=this.getCanvas();if(n)try{this.errorMessage="",this.runtime=new cs(n),this.runtime.setElementResolver(e=>this.lookupElement(e)),this.bindContextEvents(),this.syncSize(),await this.rebuild()}catch(e){this.emitError(e)}}syncVisibility(){if(!this.inView&&this.releaseOffscreen){this.releaseRuntime();return}if(this.inView&&(!this.runtime||this.runtime.isLost)){this.ensureRuntime();return}this.syncPlayback()}syncSize(){if(!this.runtime)return;const n=this.getBoundingClientRect(),e=Math.max(n.width,this.clientWidth,1),t=Math.max(n.height,this.clientHeight,1),r=Math.min(window.devicePixelRatio||1,this.dprMax);this.runtime.resize(e*r,t*r),this.ready&&this.drawFrame(performance.now())}buildChannels(n){const e=[this.channel0,this.channel1,this.channel2,this.channel3],t=n==="image"?[this.imageCh0,this.imageCh1,this.imageCh2,this.imageCh3]:n==="bufferA"?[this.bufferACh0,this.bufferACh1,this.bufferACh2,this.bufferACh3]:n==="bufferB"?[this.bufferBCh0,this.bufferBCh1,this.bufferBCh2,this.bufferBCh3]:n==="bufferC"?[this.bufferCCh0,this.bufferCCh1,this.bufferCCh2,this.bufferCCh3]:[this.bufferDCh0,this.bufferDCh1,this.bufferDCh2,this.bufferDCh3];return[0,1,2,3].map(r=>us(t[r],e[r]))}collectUrls(n){const e=[];for(const t of n.values())for(const r of t)r.kind==="url"&&e.push(r.url);return e}collectElementKeys(n){const e=[];for(const t of n.values())for(const r of t)r.kind==="element"&&e.push(r.key);return[...new Set(e)]}async rebuild(){if(!this.runtime||this.runtime.isLost||!this.image.trim())return;const n=++this.rebuildToken;this.errorMessage="";const e={common:this.common,image:this.image,bufferA:this.bufferA,bufferB:this.bufferB,bufferC:this.bufferC,bufferD:this.bufferD},t=new Map;for(const r of["bufferA","bufferB","bufferC","bufferD","image"])t.set(r,this.buildChannels(r));try{this.syncSize();const r=this.collectUrls(t);await this.runtime.ensureTextures(r);for(const u of this.collectElementKeys(t))this.runtime.ensureElementTexture(u);if(n!==this.rebuildToken||!this.runtime||this.runtime.isLost)return;const s=this.channel0.startsWith("#")?"":this.channel0||r[0];if(this.applyAspectRatio(s),this.syncSize(),this.runtime.setSources(e,t),n!==this.rebuildToken||!this.runtime||this.runtime.isLost)return;this.ready=!0,this.startTime=performance.now(),this.lastTime=this.startTime,this.frame=0,this.drawFrame(this.startTime),this.syncPlayback()}catch(r){if(n!==this.rebuildToken)return;this.ready=!1,this.stopLoop(),this.emitError(r)}}emitError(n){const e=n instanceof ht||n instanceof Error?n.message:String(n);this.errorMessage=e,this.dispatchEvent(new CustomEvent("error",{detail:{message:e,pass:n instanceof ht?n.pass:void 0,infoLog:n instanceof ht?n.infoLog:void 0},bubbles:!0,composed:!0}))}shouldAnimate(){return!this.play||!this.ready||!this.inView||bs()||!this.runtime?!1:this.playOnHover?this.hovering||!this.hoverSettled():!0}hoverSettled(){return Ht(this.hoverParam)===null?!0:Math.abs(this.hoverMix-this.hoverGoal)<.002}syncPlayback(){this.shouldAnimate()?(this.runtime?.setVideosPlaying(!0),this.raf||(this.lastTime=performance.now(),this.loop())):(this.stopLoop(),this.runtime?.setVideosPlaying(!1),this.ready&&this.drawFrame(performance.now()))}stopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=0)}drawFrame(n){if(!this.runtime||!this.ready)return;const e=(n-this.startTime)/1e3,t=Math.max(0,(n-this.lastTime)/1e3);this.lastTime=n,this.advanceMouseFollow(t),this.advanceHover(t);const r=this.effectiveParams();this.runtime.render({time:e,timeDelta:t,frame:this.frame++,mouse:this.mouseVec,params:r}),this.frameSeq++,this.maybePublishOut(n,e,r),this.maybeExtract(n,e)}round3(n){return Math.round(n*1e3)/1e3}buildOutput(n,e,t=!1){const{width:r,height:s}=this.runtime?.size??{width:1,height:1},u=this.mouseHasPointer,a=u&&r>0?this.mouseVec[0]/r:.5,d=u&&s>0?this.mouseVec[1]/s:.5,y=e??this.effectiveParams(),T={time:this.round3(n),frame:this.frame,mouseX:this.round3(a),mouseY:this.round3(d),hovering:this.hovering?1:0,param0:this.round3(y[0]),param1:this.round3(y[1]),param2:this.round3(y[2]),param3:this.round3(y[3])};if(t&&this.runtime){const M=u?this.mouseVec[0]:r*.5,S=u?this.mouseVec[1]:s*.5,[w,C,D,N]=this.runtime.readPixel(M,S),ee=w/255,J=C/255,_=D/255,g=N/255;T.sampleR=this.round3(ee),T.sampleG=this.round3(J),T.sampleB=this.round3(_),T.sampleA=this.round3(g),T.sampleLuma=this.round3(.2126*ee+.7152*J+.0722*_)}return T}publisherFieldHasListener(n){return!!this.outPublisher?._proxies_?.get(n)?.hasListener?.()}hasOutConsumers(){if(this.outEventListeners>0)return!0;if(!this.outPublisher)return!1;for(const n of ds)if(this.publisherFieldHasListener(n))return!0;for(const n of gs)if(this.publisherFieldHasListener(n))return!0;return!1}shouldSkipParamOutWrite(n){if(!ps.includes(n)||!this.formPublisher||this.formPublisher!==this.outPublisher)return!1;const e=Ht(this.hoverParam);return e===null?!0:Number(n.slice(5))!==e}needsSampleRead(){return this.sample&&this.hasOutConsumers()}maybePublishOut(n,e,t){if(this.outPublisher||this.bindOutPublisher(),!this.hasOutConsumers())return;const r=Math.max(16,this.outInterval||80);if(n-this.lastOutAt<r)return;this.lastOutAt=n;const s=this.buildOutput(e,t,this.needsSampleRead()),u=this.outPublisher;if(u){for(const[a,d]of Object.entries(s))if(d!==void 0&&!this.shouldSkipParamOutWrite(a))try{u[a].set(d)}catch{}}this.dispatchEvent(new CustomEvent("out",{detail:s,bubbles:!0,composed:!0}))}revokeBlobUrls(){for(const n of this.lastBlobUrls)try{URL.revokeObjectURL(n)}catch{}this.lastBlobUrls=[]}scheduleRevokePreviousBlobs(n){const e=n.filter(r=>r.startsWith("blob:"));if(e.length===0)return;this.pendingRevokeUrls.push(...e);const t=e;window.setTimeout(()=>{for(const r of t){try{URL.revokeObjectURL(r)}catch{}const s=this.pendingRevokeUrls.indexOf(r);s>=0&&this.pendingRevokeUrls.splice(s,1)}},1500)}publisherHasFieldListener(n,e){return!!n?._proxies_?.get(e)?.hasListener?.()}hasExtractConsumers(){if(this.extractEventListeners>0)return!0;const n=this.extractPublisher;if(!n)return!1;for(const e of vs)if(this.publisherHasFieldListener(n,e))return!0;return!1}syncManualRoisFromPublishers(){const n=e=>{if(e?.get)try{const t=e.get()??{};"rois"in t&&(this.manualRois=Pn(t.rois))}catch{}};n(this.formPublisher),this.extractPublisher&&this.extractPublisher!==this.formPublisher&&n(this.extractPublisher)}resolveExtractInterval(){return this.extractInterval>0?Math.max(16,this.extractInterval):Math.max(16,this.outInterval||100)}async readRegion(n){return!this.runtime||!this.ready?null:await this.buildExtractItem(n,"manual",void 0)}async extractNow(){const n=(performance.now()-this.startTime)/1e3;return this.runExtract(n)}async maybeExtract(n,e){!this.extract||!this.ready||!this.runtime||(this.extractPublisher||this.bindExtractPublisher(),this.hasExtractConsumers()&&(n-this.lastExtractAt<this.resolveExtractInterval()||this.extractRunning||(this.lastExtractAt=n,await this.runExtract(e))))}async runExtract(n){const e={frame:this.frame,time:this.round3(n),items:[]};if(!this.runtime||!this.ready)return e;this.extractRunning=!0;try{this.syncManualRoisFromPublishers();const{width:t,height:r}=this.runtime.size,s=this.manualRois.map(S=>({...S,source:"manual"})),u=Fr(this.extractMask);if(u){const S=this.runtime.readBufferRect(u,0,0,t,r);if(S){const w=es(S.data,S.width,S.height,{threshold:this.extractThreshold,maxCount:Math.max(0,Math.floor(this.extractMax)),minDistance:Math.max(8,Math.floor(Math.min(this.extractPatch/3,16)))}),C=w[0]?.score||1;for(let D=0;D<w.length;D++){const N=w[D];s.push({id:`detect-${D}`,x:(N.x+.5)/t,y:(N.y+.5)/r,patch:this.extractPatch,source:"detect",score:C>0?N.score/C:N.score})}}}const a=[];let d=0;const y=Fr(this.extractSource)??"image";for(const S of s){const w=S.source==="detect"?"detect":"manual";if(w==="detect"){if(d>=Math.max(0,Math.floor(this.extractMax)))continue;d++}const C=_n(S,t,r,this.extractPatch,Tn);if(!C)continue;const D=y==="image"?this.runtime.readRect(C.x,C.y,C.w,C.h):this.runtime.readBufferRect(y,C.x,C.y,C.w,C.h);if(!D)continue;const N=new Uint8Array(D.data),ee=An(N),J={id:S.id||`${w}-${C.x}-${C.y}`,x:this.round3(D.x/t),y:this.round3(D.y/r),w:this.round3(D.width/t),h:this.round3(D.height/r),meanR:this.round3(ee.r),meanG:this.round3(ee.g),meanB:this.round3(ee.b),meanA:this.round3(ee.a),meanLuma:this.round3(ee.luma),source:w};typeof S.score=="number"&&(J.score=this.round3(S.score)),a.push({item:J,rgba:N,width:D.width,height:D.height})}if(this.extractBitmaps){const S=this.rebuildToken;for(const w of a){if(S!==this.rebuildToken||!this.isConnected){for(const D of a)D.item.blobUrl&&It([D.item.blobUrl]);return e}const C=await Cn(w.rgba,w.width,w.height);if(S!==this.rebuildToken||!this.isConnected){C&&It([C]);for(const D of a)D.item.blobUrl&&It([D.item.blobUrl]);return e}C&&Rn(w.item,C)}}if(!this.isConnected){for(const S of a)S.item.blobUrl&&It([S.item.blobUrl]);return e}const T=a.map(S=>S.item),M={frame:this.frame,time:this.round3(n),items:T};return this.publishExtract(M),M}finally{this.extractRunning=!1}}async buildExtractItem(n,e,t){if(!this.runtime)return null;const{width:r,height:s}=this.runtime.size,u=_n(n,r,s,this.extractPatch,Tn);if(!u)return null;const a=Fr(this.extractSource)??"image",d=a==="image"?this.runtime.readRect(u.x,u.y,u.w,u.h):this.runtime.readBufferRect(a,u.x,u.y,u.w,u.h);if(!d)return null;const y=An(d.data),T={id:n.id||`${e}-${u.x}-${u.y}`,x:this.round3(d.x/r),y:this.round3(d.y/s),w:this.round3(d.width/r),h:this.round3(d.height/s),meanR:this.round3(y.r),meanG:this.round3(y.g),meanB:this.round3(y.b),meanA:this.round3(y.a),meanLuma:this.round3(y.luma),source:e};if(typeof t=="number"&&(T.score=this.round3(t)),this.extractBitmaps){const M=this.rebuildToken,S=await Cn(d.data,d.width,d.height);if(M!==this.rebuildToken||!this.isConnected)return S&&It([S]),null;S&&Rn(T,S)}return T}publishExtract(n){this.scheduleRevokePreviousBlobs(this.lastBlobUrls),this.lastBlobUrls=[];for(const t of n.items)t.blobUrl&&this.lastBlobUrls.push(t.blobUrl);this.extractSeq++,this.extractPublisher||this.bindExtractPublisher();const e=this.extractPublisher;if(e)try{const t=e.get?.()??{};e.set({...t,rois:Array.isArray(t.rois)?t.rois:this.manualRois,extracts:n.items,extractCount:n.items.length,extractSeq:this.extractSeq})}catch{try{e.extracts.set(n.items),e.extractCount.set(n.items.length),e.extractSeq.set(this.extractSeq)}catch{}}this.dispatchEvent(new CustomEvent("extract",{detail:n,bubbles:!0,composed:!0}))}advanceMouseFollow(n){if(!this.mouse||this.mouseMode!=="target"||!this.mouseHasPointer)return;const e=Math.max(0,this.mouseSpeed),t=e<=0||n<=0?1:1-Math.exp(-e*n);this.mouseFollow[0]+=(this.mouseTarget[0]-this.mouseFollow[0])*t,this.mouseFollow[1]+=(this.mouseTarget[1]-this.mouseFollow[1])*t,this.mouseVec[0]=this.mouseFollow[0],this.mouseVec[1]=this.mouseFollow[1]}advanceHover(n){if(Ht(this.hoverParam)===null)return;const e=Math.max(0,this.hoverSpeed),t=e<=0||n<=0?1:1-Math.exp(-e*n),r=this.hoverMix+(this.hoverGoal-this.hoverMix)*t;this.hoverMix=Math.abs(r-this.hoverGoal)<.002?this.hoverGoal:r}localPointer(n){const e=this.getBoundingClientRect(),t=Math.min(window.devicePixelRatio||1,this.dprMax),r=(n.clientX-e.left)*t,s=(e.height-(n.clientY-e.top))*t;return{x:r,y:s}}setPointerTarget(n,e,t=!1){this.mouseTarget[0]=n,this.mouseTarget[1]=e,(!this.mouseHasPointer||t||this.mouseMode==="direct")&&(this.mouseHasPointer=!0,this.mouseFollow[0]=n,this.mouseFollow[1]=e,this.mouseVec[0]=n,this.mouseVec[1]=e)}render(){return Qr`
|
|
73
73
|
<canvas part="canvas"></canvas>
|
|
74
|
-
${this.errorMessage?
|
|
75
|
-
`}};V.styles=
|
|
74
|
+
${this.errorMessage?Qr`<div class="err" part="error">${this.errorMessage}</div>`:null}
|
|
75
|
+
`}};V.styles=On`
|
|
76
76
|
:host {
|
|
77
77
|
display: block;
|
|
78
78
|
position: relative;
|
|
@@ -102,4 +102,4 @@ void main() {
|
|
|
102
102
|
white-space: pre-wrap;
|
|
103
103
|
overflow: auto;
|
|
104
104
|
}
|
|
105
|
-
`,
|
|
105
|
+
`,X([Y()],V.prototype,"image",2),X([Y({attribute:"buffer-a"})],V.prototype,"bufferA",2),X([Y({attribute:"buffer-b"})],V.prototype,"bufferB",2),X([Y({attribute:"buffer-c"})],V.prototype,"bufferC",2),X([Y({attribute:"buffer-d"})],V.prototype,"bufferD",2),X([Y()],V.prototype,"common",2),X([Y()],V.prototype,"channel0",2),X([Y()],V.prototype,"channel1",2),X([Y()],V.prototype,"channel2",2),X([Y()],V.prototype,"channel3",2),X([Y({attribute:"image-ch0"})],V.prototype,"imageCh0",2),X([Y({attribute:"image-ch1"})],V.prototype,"imageCh1",2),X([Y({attribute:"image-ch2"})],V.prototype,"imageCh2",2),X([Y({attribute:"image-ch3"})],V.prototype,"imageCh3",2),X([Y({attribute:"buffer-a-ch0"})],V.prototype,"bufferACh0",2),X([Y({attribute:"buffer-a-ch1"})],V.prototype,"bufferACh1",2),X([Y({attribute:"buffer-a-ch2"})],V.prototype,"bufferACh2",2),X([Y({attribute:"buffer-a-ch3"})],V.prototype,"bufferACh3",2),X([Y({attribute:"buffer-b-ch0"})],V.prototype,"bufferBCh0",2),X([Y({attribute:"buffer-b-ch1"})],V.prototype,"bufferBCh1",2),X([Y({attribute:"buffer-b-ch2"})],V.prototype,"bufferBCh2",2),X([Y({attribute:"buffer-b-ch3"})],V.prototype,"bufferBCh3",2),X([Y({attribute:"buffer-c-ch0"})],V.prototype,"bufferCCh0",2),X([Y({attribute:"buffer-c-ch1"})],V.prototype,"bufferCCh1",2),X([Y({attribute:"buffer-c-ch2"})],V.prototype,"bufferCCh2",2),X([Y({attribute:"buffer-c-ch3"})],V.prototype,"bufferCCh3",2),X([Y({attribute:"buffer-d-ch0"})],V.prototype,"bufferDCh0",2),X([Y({attribute:"buffer-d-ch1"})],V.prototype,"bufferDCh1",2),X([Y({attribute:"buffer-d-ch2"})],V.prototype,"bufferDCh2",2),X([Y({attribute:"buffer-d-ch3"})],V.prototype,"bufferDCh3",2),X([Y({type:Boolean,reflect:!0})],V.prototype,"play",2),X([Y({type:Boolean,attribute:"play-on-hover"})],V.prototype,"playOnHover",2),X([Y({type:Boolean})],V.prototype,"mouse",2),X([Y({type:String,attribute:"mouse-mode"})],V.prototype,"mouseMode",2),X([Y({type:Number,attribute:"mouse-speed"})],V.prototype,"mouseSpeed",2),X([Y({attribute:"hover-param"})],V.prototype,"hoverParam",2),X([Y({type:Number,attribute:"hover-speed"})],V.prototype,"hoverSpeed",2),X([Y({type:Boolean,attribute:"release-offscreen"})],V.prototype,"releaseOffscreen",2),X([Y({type:Number,attribute:"dpr-max"})],V.prototype,"dprMax",2),X([Y({type:Number,attribute:"param0"})],V.prototype,"param0",2),X([Y({type:Number,attribute:"param1"})],V.prototype,"param1",2),X([Y({type:Number,attribute:"param2"})],V.prototype,"param2",2),X([Y({type:Number,attribute:"param3"})],V.prototype,"param3",2),X([Y({type:String})],V.prototype,"dataProvider",2),X([Y({type:String,attribute:"out-data-provider"})],V.prototype,"outDataProvider",2),X([Y({type:Boolean})],V.prototype,"sample",2),X([Y({type:Number,attribute:"out-interval"})],V.prototype,"outInterval",2),X([Y({type:Boolean})],V.prototype,"extract",2),X([Y({type:Number,attribute:"extract-interval"})],V.prototype,"extractInterval",2),X([Y({type:String,attribute:"extract-source"})],V.prototype,"extractSource",2),X([Y({type:String,attribute:"extract-mask"})],V.prototype,"extractMask",2),X([Y({type:Number,attribute:"extract-threshold"})],V.prototype,"extractThreshold",2),X([Y({type:Number,attribute:"extract-max"})],V.prototype,"extractMax",2),X([Y({type:Number,attribute:"extract-patch"})],V.prototype,"extractPatch",2),X([Y({type:Boolean,attribute:"extract-bitmaps"})],V.prototype,"extractBitmaps",2),X([Y({type:String,attribute:"extract-data-provider"})],V.prototype,"extractDataProvider",2),X([Y({type:String,attribute:"aspect-ratio"})],V.prototype,"aspectRatio",2),X([ai()],V.prototype,"errorMessage",2),V=X([ni(hs)],V)})();
|