@cimulate/copilot-widget 1.48.2 → 1.48.3
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/CHANGELOG.md +4 -0
- package/dist/messaging.es.js +2 -2
- package/dist/messaging.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
`@cimulate/copilot-widget` follows [Semantic Versioning](https://semver.org/). Each entry is a released `package.json` version (deployed on merge to `master`), newest first.
|
|
4
4
|
|
|
5
|
+
## 1.48.3 — 2026-10-08
|
|
6
|
+
|
|
7
|
+
- Reworded the auto-sent shopper message after a successful express payment from "I completed express payment." to "I completed the payment using Express Checkout." for a more natural chat bubble. The order-lookup phrasing the agent routes on is unchanged.
|
|
8
|
+
|
|
5
9
|
## 1.48.2 — 2026-10-08
|
|
6
10
|
|
|
7
11
|
- Messaging mode accepts `messagingConfig.initialPageContext` to seed PDP or SRP page context once at mount (same shape as `eventHandlers.pageContext.set`). Seeding is gated on `enablePageContext`.
|
package/dist/messaging.es.js
CHANGED
|
@@ -32236,7 +32236,7 @@ const o1 = (e) => {
|
|
|
32236
32236
|
globalClassName: n,
|
|
32237
32237
|
onOrderComplete: (u) => {
|
|
32238
32238
|
i(
|
|
32239
|
-
u ? `I completed
|
|
32239
|
+
u ? `I completed the payment using Express Checkout. Show my order confirmation for order ${u}.` : "I completed the payment using Express Checkout. Show my order confirmation."
|
|
32240
32240
|
);
|
|
32241
32241
|
}
|
|
32242
32242
|
}
|
|
@@ -33073,7 +33073,7 @@ const o1 = (e) => {
|
|
|
33073
33073
|
), W = me(
|
|
33074
33074
|
(he) => {
|
|
33075
33075
|
s(
|
|
33076
|
-
he ? `I completed
|
|
33076
|
+
he ? `I completed the payment using Express Checkout. Show my order confirmation for order ${he}.` : "I completed the payment using Express Checkout. Show my order confirmation."
|
|
33077
33077
|
);
|
|
33078
33078
|
},
|
|
33079
33079
|
[s]
|
package/dist/messaging.umd.js
CHANGED
|
@@ -49,7 +49,7 @@ Error generating stack: `+x.message+`
|
|
|
49
49
|
`))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");o.move(a+" ");let d=n.containerPhrasing(e,z({before:"# ",after:`
|
|
50
50
|
`},o.current()));return/^[\t ]/.test(d)&&(d=Au(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}cw.peek=dU;function cw(e){return e.value||""}function dU(){return"<"}dw.peek=fU;function dw(e,t,n,r){const i=Bm(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,z({before:d,after:"]"},c.current()))),d+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,z({before:d,after:">"},c.current()))),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,z({before:d,after:e.title?" ":")"},c.current())))),l(),e.title&&(l=n.enter(`title${o}`),d+=c.move(" "+i),d+=c.move(n.safe(e.title,z({before:d,after:i},c.current()))),d+=c.move(i),l()),d+=c.move(")"),a(),d}function fU(){return"!"}fw.peek=hU;function fw(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(e.alt,z({before:c,after:"]"},l.current()));c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),z({before:c,after:"]"},l.current()));return a(),n.stack=h,o(),i==="full"||!d||d!==p?c+=l.move(p+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function hU(){return"!"}hw.peek=pU;function hw(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return i+r+i}function pU(){return"`"}function pw(e,t){const n=Kh(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}mw.peek=mU;function mw(e,t,n,r){const i=Bm(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(pw(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,z({before:p,after:">"},a.current()))),p+=a.move(">"),l(),n.stack=h,p}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,z({before:d,after:"]("},a.current()))),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,z({before:d,after:">"},a.current()))),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,z({before:d,after:e.title?" ":")"},a.current())))),c(),e.title&&(c=n.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(n.safe(e.title,z({before:d,after:i},a.current()))),d+=a.move(i),c()),d+=a.move(")"),l(),d}function mU(e,t,n){return pw(e,n)?"<":"["}gw.peek=gU;function gw(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(e,z({before:c,after:"]"},l.current()));c+=l.move(d+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),z({before:c,after:"]"},l.current()));return a(),n.stack=h,o(),i==="full"||!d||d!==p?c+=l.move(p+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function gU(){return"["}function Um(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function yU(e){const t=Um(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function EU(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function yw(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function bU(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?EU(n):Um(n);const l=e.ordered?a==="."?")":".":yU(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),yw(n)===a&&h){let p=-1;for(;++p<e.children.length;){const g=e.children[p];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),d}function _U(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function vU(e,t,n,r){const i=_U(n);let o=n.bulletCurrent||Um(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(o+" ".repeat(a-o.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,l.current()),h);return c(),d;function h(p,g,m){return g?(m?"":" ".repeat(a))+p:(m?o:o+" ".repeat(a-o.length))+p}}function TU(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const wU=uc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xU(e,t,n,r){return(e.children.some(function(a){return wU(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function SU(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ew.peek=AU;function Ew(e,t,n,r){const i=SU(n),o=n.enter("strong"),a=n.createTracker(r),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,z({after:i,before:l},a.current())));const d=c.charCodeAt(0),h=Kc(r.before.charCodeAt(r.before.length-1),d,i);h.inside&&(c=Au(d)+c.slice(1));const p=c.charCodeAt(c.length-1),g=Kc(r.after.charCodeAt(0),p,i);g.inside&&(c=c.slice(0,-1)+Au(p));const m=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},l+c+m}function AU(e,t,n){return n.options.strong||"*"}function CU(e,t,n,r){return n.safe(e.value,r)}function kU(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function OU(e,t,n){const r=(yw(n)+(n.options.ruleSpaces?" ":"")).repeat(kU(n));return n.options.ruleSpaces?r.slice(0,-1):r}const bw={blockquote:J7,break:uw,code:iU,definition:oU,emphasis:lw,hardBreak:uw,heading:cU,html:cw,image:dw,imageReference:fw,inlineCode:hw,link:mw,linkReference:gw,list:bU,listItem:vU,paragraph:TU,root:xU,strong:Ew,text:CU,thematicBreak:OU};function NU(){return{enter:{table:IU,tableData:_w,tableHeader:_w,tableRow:RU},exit:{codeText:LU,table:PU,tableData:jm,tableHeader:jm,tableRow:jm}}}function IU(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function PU(e){this.exit(e),this.data.inTable=void 0}function RU(e){this.enter({type:"tableRow",children:[]},e)}function jm(e){this.exit(e)}function _w(e){this.enter({type:"tableCell",children:[]},e)}function LU(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,DU));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function DU(e,t){return t==="|"?t:e}function MU(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
51
51
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:l}};function a(m,E,S,T){return d(h(m,S,T),m.align)}function l(m,E,S,T){const v=p(m,S,T),w=d([v]);return w.slice(0,w.indexOf(`
|
|
52
|
-
`))}function c(m,E,S,T){const v=S.enter("tableCell"),w=S.enter("phrasing"),C=S.containerPhrasing(m,pe(z({},T),{before:o,after:o}));return w(),v(),C}function d(m,E){return K7(m,{align:E,alignDelimiters:r,padding:n,stringLength:i})}function h(m,E,S){const T=m.children;let v=-1;const w=[],C=E.enter("table");for(;++v<T.length;)w[v]=p(T[v],E,S);return C(),w}function p(m,E,S){const T=m.children;let v=-1;const w=[],C=E.enter("tableRow");for(;++v<T.length;)w[v]=c(T[v],m,E,S);return C(),w}function g(m,E,S){let T=bw.inlineCode(m,E,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function FU(){return{exit:{taskListCheckValueChecked:vw,taskListCheckValueUnchecked:vw,paragraph:UU}}}function BU(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:jU}}}function vw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function UU(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const l=i[o];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function jU(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(a);let c=bw.listItem(e,t,n,z(z({},r),l.current()));return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(h){return h+a}}function HU(){return[b7(),j7(),V7(),NU(),FU()]}function $U(e){return{extensions:[_7(),H7(e),q7(),MU(e),BU()]}}const zU={tokenize:XU,partial:!0},Tw={tokenize:KU,partial:!0},ww={tokenize:QU,partial:!0},xw={tokenize:JU,partial:!0},VU={tokenize:ZU,partial:!0},Sw={name:"wwwAutolink",tokenize:YU,previous:Cw},Aw={name:"protocolAutolink",tokenize:GU,previous:kw},hi={name:"emailAutolink",tokenize:WU,previous:Ow},ei={};function qU(){return{text:ei}}let $s=48;for(;$s<123;)ei[$s]=hi,$s++,$s===58?$s=65:$s===91&&($s=97);ei[43]=hi,ei[45]=hi,ei[46]=hi,ei[95]=hi,ei[72]=[hi,Aw],ei[104]=[hi,Aw],ei[87]=[hi,Sw],ei[119]=[hi,Sw];function WU(e,t,n){const r=this;let i,o;return a;function a(p){return!Hm(p)||!Ow.call(r,r.previous)||$m(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(p))}function l(p){return Hm(p)?(e.consume(p),l):p===64?(e.consume(p),c):n(p)}function c(p){return p===46?e.check(VU,h,d)(p):p===45||p===95||wn(p)?(o=!0,e.consume(p),c):h(p)}function d(p){return e.consume(p),i=!0,c}function h(p){return o&&i&&Pn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function YU(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Cw.call(r,r.previous)||$m(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(zU,e.attempt(Tw,e.attempt(ww,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function GU(e,t,n){const r=this;let i="",o=!1;return a;function a(p){return(p===72||p===104)&&kw.call(r,r.previous)&&!$m(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),l):n(p)}function l(p){if(Pn(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),l;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(p),c}return n(p)}function c(p){return p===47?(e.consume(p),o?d:(o=!0,c)):n(p)}function d(p){return p===null||ec(p)||Tt(p)||As(p)||tc(p)?n(p):e.attempt(Tw,e.attempt(ww,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function XU(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function KU(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(xw,c,l)(d):d===null||Tt(d)||As(d)||d!==45&&tc(d)?c(d):(o=!0,e.consume(d),a)}function l(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function c(d){return i||r||!o?n(d):t(d)}}function QU(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(xw,t,o)(a):a===null||Tt(a)||As(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function JU(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),o):l===93?(e.consume(l),i):l===60||l===null||Tt(l)||As(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||Tt(l)||As(l)?t(l):r(l)}function o(l){return Pn(l)?a(l):n(l)}function a(l){return l===59?(e.consume(l),r):Pn(l)?(e.consume(l),a):n(l)}}function ZU(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return wn(o)?n(o):t(o)}}function Cw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function kw(e){return!Pn(e)}function Ow(e){return!(e===47||Hm(e))}function Hm(e){return e===43||e===45||e===46||e===95||wn(e)}function $m(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ej={tokenize:uj,partial:!0};function tj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sj,continuation:{tokenize:oj},exit:aj}},text:{91:{name:"gfmFootnoteCall",tokenize:ij},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nj,resolveTo:rj}}}}function nj(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const d=xr(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function rj(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function ij(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!a||p===null||p===91||Tt(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return i.includes(xr(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Tt(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function sj(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,l;return c;function c(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(E)}function h(E){if(a>999||E===93&&!l||E===null||E===91||Tt(E))return n(E);if(E===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=xr(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Tt(E)||(l=!0),a++,e.consume(E),E===92?p:h}function p(E){return E===91||E===92||E===93?(e.consume(E),a++,h):h(E)}function g(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),i.includes(o)||i.push(o),ft(e,m,"gfmFootnoteDefinitionWhitespace")):n(E)}function m(E){return t(E)}}function oj(e,t,n){return e.check(Ja,t,e.attempt(ej,t,n))}function aj(e){e.exit("gfmFootnoteDefinition")}function uj(e,t,n){const r=this;return ft(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function lj(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},p={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",h,l],["enter",a[d][1],l],["exit",a[d][1],l],["enter",p,l]],m=l.parser.constructs.insideSpan.null;m&&er(g,g.length,0,nc(m,a.slice(d+1,c),l)),er(g,g.length,0,[["exit",p,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",h,l]]),er(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function o(a,l,c){const d=this.previous,h=this.events;let p=0;return g;function g(E){return d===126&&h[h.length-1][1].type!=="characterEscape"?c(E):(a.enter("strikethroughSequenceTemporary"),m(E))}function m(E){const S=wo(d);if(E===126)return p>1?c(E):(a.consume(E),p++,m);if(p<2&&!n)return c(E);const T=a.exit("strikethroughSequenceTemporary"),v=wo(E);return T._open=!v||v===2&&!!S,T._close=!S||S===2&&!!v,l(E)}}}class cj{constructor(){this.map=[]}add(t,n,r){dj(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function dj(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function fj(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function hj(){return{flow:{null:{name:"table",tokenize:pj,resolveAll:mj}}}}function pj(e,t,n){const r=this;let i=0,o=0,a;return l;function l($){let te=r.events.length-1;for(;te>-1;){const G=r.events[te][1].type;if(G==="lineEnding"||G==="linePrefix")te--;else break}const Q=te>-1?r.events[te][1].type:null,q=Q==="tableHead"||Q==="tableRow"?P:c;return q===P&&r.parser.lazy[r.now().line]?n($):q($)}function c($){return e.enter("tableHead"),e.enter("tableRow"),d($)}function d($){return $===124||(a=!0,o+=1),h($)}function h($){return $===null?n($):Ke($)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),m):n($):at($)?ft(e,h,"whitespace")($):(o+=1,a&&(a=!1,i+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),p($)))}function p($){return $===null||$===124||Tt($)?(e.exit("data"),h($)):(e.consume($),$===92?g:p)}function g($){return $===92||$===124?(e.consume($),p):p($)}function m($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),a=!1,at($)?ft(e,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?T($):$===124?(a=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),S):k($)}function S($){return at($)?ft(e,T,"whitespace")($):T($)}function T($){return $===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),v):$===45?(o+=1,v($)):$===null||Ke($)?R($):k($)}function v($){return $===45?(e.enter("tableDelimiterFiller"),w($)):k($)}function w($){return $===45?(e.consume($),w):$===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C($))}function C($){return at($)?ft(e,R,"whitespace")($):R($)}function R($){return $===124?E($):$===null||Ke($)?!a||i!==o?k($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):k($)}function k($){return n($)}function P($){return e.enter("tableRow"),I($)}function I($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),I):$===null||Ke($)?(e.exit("tableRow"),t($)):at($)?ft(e,I,"whitespace")($):(e.enter("data"),U($))}function U($){return $===null||$===124||Tt($)?(e.exit("data"),I($)):(e.consume($),$===92?ee:U)}function ee($){return $===92||$===124?(e.consume($),U):U($)}}function mj(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,h,p;const g=new cj;for(;++n<e.length;){const m=e[n],E=m[1];m[0]==="enter"?E.type==="tableHead"?(l=!1,c!==0&&(Nw(g,t,c,d,h),h=void 0,c=0),d={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},g.add(n,0,[["enter",d,t]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},g.add(n,0,[["enter",h,t]])),i=E.type==="tableDelimiterRow"?2:h?3:1):i&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],p=Qc(g,t,o,i,void 0,p),o=[0,0,0,0]),a[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],p=Qc(g,t,o,i,void 0,p)),o=a,a=[o[1],n,0,0])):E.type==="tableHead"?(l=!0,c=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(c=n,o[1]!==0?(a[0]=a[1],p=Qc(g,t,o,i,n,p)):a[1]!==0&&(p=Qc(g,t,a,i,n,p)),i=0):i&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&Nw(g,t,c,d,h),g.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=fj(t.events,n))}return e}function Qc(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(o.end=Object.assign({},Go(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=Go(t.events,n[1]);if(o={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Go(t.events,n[2]),h=Go(t.events,n[3]),p={type:l,start:Object.assign({},d),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const g=t.events[n[2]],m=t.events[n[3]];if(g[1].end=Object.assign({},m[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,S=n[3]-n[2]-1;e.add(E,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},Go(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Nw(e,t,n,r,i){const o=[],a=Go(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Go(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gj={name:"tasklistCheck",tokenize:Ej};function yj(){return{text:{91:gj}}}function Ej(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return Tt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ke(c)?t(c):at(c)?e.check({tokenize:bj},t,n)(c):n(c)}}function bj(e,t,n){return ft(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function _j(e){return sb([qU(),tj(),lj(e),hj(),yj()])}const vj={};function Tj(e){const t=this,n=e||vj,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(_j(n)),o.push(HU()),a.push($U(n))}const wj=()=>A.jsx("span",{className:`${D}-blinking-cursor`,children:A.jsx("svg",{"aria-hidden":"true",height:"16px",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:A.jsx("circle",{r:"0.45rem",cx:"0.5rem",cy:"0.55rem",fill:"black"})})}),Xo=({globalClassName:e,openLinksInNewTab:t,showIsLoading:n,text:r,onLinkClick:i})=>A.jsx(Kb,{remarkPlugins:[Tj],rehypePlugins:[Q_],components:{h1:({children:o})=>A.jsx("h1",{className:H(e,`${D}-header h1`),children:o}),h2:({children:o})=>A.jsx("h2",{className:H(e,`${D}-header h2`),children:o}),h3:({children:o})=>A.jsx("h3",{className:H(e,`${D}-header h3`),children:o}),ul:({children:o})=>A.jsx("ul",{className:H(e,`${D}-ul`),children:o}),ol:({children:o})=>A.jsx("ol",{className:H(e,`${D}-ol`),children:o}),li:({children:o})=>A.jsx("li",{className:H(e,`${D}-li`),children:o}),a:({href:o,children:a})=>A.jsx(iv,{globalClassName:e,openLinksInNewTab:t,href:o,onClick:i,children:a}),table:({children:o})=>A.jsx("div",{className:H(e,`${D}-table-container`),children:A.jsx("table",{className:H(e,`${D}-table`),children:o})}),thead:({children:o})=>A.jsx("thead",{className:H(e,`${D}-thead`),children:o}),tbody:({children:o})=>A.jsx("tbody",{className:H(e,`${D}-tbody`),children:o}),tr:({children:o})=>A.jsx("tr",{className:H(e,`${D}-tr`),children:o}),th:({children:o})=>A.jsx("th",{className:H(e,`${D}-th`),children:o}),td:({children:o})=>A.jsx("td",{className:H(e,`${D}-td`),children:o}),span:({className:o,children:a})=>o===`${D}-blinking-cursor`?A.jsx(wj,{}):A.jsx("span",{children:a})},children:r+(n?`<span className='${D}-blinking-cursor'></span>`:"")});function xj(){const{messages:e}=Vt();return L.useMemo(()=>N3(e,"cart"),[e])}const qi=()=>L.useContext(dE),zs=()=>{const{sendMessage:e,loading:t,isConnected:n}=Vt(),{mode:r,status:i}=Hr();return L.useMemo(()=>({sendMessage:e,isLoading:t,isConnected:n,componentType:i.type,mode:r}),[e,t,n,i.type,r])};function Sj(e){return e.includes("-")&&e===e.toLowerCase()}function Wi({tagName:e,props:t,label:n}){const r=L.useRef(null),i=L.useRef(null),o=L.useRef(e),a=L.useRef(null);return L.useEffect(()=>{const l=r.current;if(!l)return;if(o.current!==e&&(o.current=e,i.current=null),!Sj(e)){a.current!==e&&(a.current=e,_t(!0,"error",`[CimulateOverrides] ${n||"Override"} rejected: "${e}" is not a valid custom element name (must contain a hyphen and be lowercase, e.g. "product-card").`)),i.current=null,l.replaceChildren();return}const c=i.current;if(c&&c.isConnected)try{c.props=t;return}catch(d){_t(!0,"error",`[CimulateOverrides] ${n||"Override"} threw an error during props update:`,d),i.current=null,l.replaceChildren();return}try{const d=document.createElement(e);d.props=t,l.replaceChildren(d);const h=d.localName;i.current=typeof customElements!="undefined"&&customElements.get(h)?d:null}catch(d){_t(!0,"error",`[CimulateOverrides] ${n||"Override"} threw an error:`,d),i.current=null,l.replaceChildren()}},[e,t,n]),L.useEffect(()=>{const l=r.current;return()=>{i.current=null,l==null||l.replaceChildren()}},[]),A.jsx("div",{ref:r,"data-override":n||"custom"})}class Iw extends L.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){_t(!0,"error",`Override "${this.props.overrideName}" threw during render:`,t,n.componentStack)}render(){return this.state.hasError?null:this.props.children}}function Aj(e){return dt({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Image_Off"},child:[{tag:"path",attr:{d:"M19.937,14.218l0,-8.654c0,-0.829 -0.672,-1.5 -1.5,-1.5l-10.628,-0c-0.276,-0 -0.5,-0.225 -0.5,-0.5c0,-0.276 0.224,-0.5 0.5,-0.5l10.628,-0c1.38,-0 2.5,1.118 2.5,2.5l0,10.624c0,0.276 -0.224,0.5 -0.5,0.501c-0.276,-0 -0.5,-0.225 -0.5,-0.5l0,-0.556l-4.583,-4.584c-0.456,-0.456 0.251,-1.163 0.707,-0.707c0.162,0.162 2.37,2.37 3.876,3.876Zm-0.121,6.304c-0.395,0.262 -0.869,0.415 -1.379,0.415l-12.874,-0c-1.381,-0 -2.5,-1.119 -2.5,-2.5l0,-12.873c0,-0.51 0.153,-0.984 0.414,-1.38l-0.263,-0.263c-0.456,-0.456 0.251,-1.163 0.707,-0.707c0.088,0.088 0.176,0.176 0.263,0.263c0.245,0.245 16.095,16.094 16.339,16.338l0.263,0.263c0.455,0.456 -0.252,1.163 -0.707,0.707c-0.088,-0.087 -0.175,-0.175 -0.263,-0.263Zm-11.104,-11.103l-2.001,-2.001c-0.094,0.196 -0.146,0.415 -0.146,0.647c-0,0.829 0.672,1.5 1.5,1.5c0.232,-0 0.451,-0.052 0.647,-0.146Zm-2.733,-2.733l-1.77,-1.77c-0.093,0.196 -0.146,0.416 -0.146,0.648l0,10.717l1.926,-1.926c0.587,-0.586 1.536,-0.586 2.122,-0l0.555,0.554c0.195,0.196 0.511,0.196 0.706,0l2.415,-2.415l-2.343,-2.343c-0.395,0.262 -0.869,0.414 -1.379,0.414c-1.38,-0 -2.5,-1.119 -2.5,-2.5c-0,-0.509 0.152,-0.983 0.414,-1.379Zm-1.916,11.009l0,0.741c0,0.829 0.671,1.5 1.5,1.5l12.874,0c0.232,0 0.451,-0.052 0.647,-0.145c-0.165,-0.165 -3.264,-3.263 -6.59,-6.59l-2.414,2.415c-0.585,0.586 -1.537,0.586 -2.122,0l-0.554,-0.554c-0.195,-0.196 -0.512,-0.196 -0.708,0l-2.633,2.633Z"},child:[]}]}]})(e)}const Cj=({imageUrl:e,globalClassName:t,isCartMgmtSupported:n,productPageUrl:r,openLinksInNewTab:i,ariaLabel:o,name:a,showInWidgetDetails:l})=>{const{loading:c}=Vt(),{onNavigate:d}=it();return A.jsx("div",{className:H(t,`${D}-msg-product-card__image-wrapper`),children:e?n?A.jsx("button",{type:"button",className:H(t,`${D}-msg-product-card__image-button`),onClick:l,disabled:c,"aria-label":o,children:A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"})}):r?A.jsx("a",{href:r,target:i?"_blank":"_self",rel:"noopener","aria-label":o,onClick:h=>Xc({event:h,href:r,openLinksInNewTab:i,isCartMgmtSupported:n,onNavigate:d}),children:A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"})}):A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"}):A.jsx("div",{className:H(t,`${D}-msg-product-card__image-placeholder`),"aria-label":a?`No image for ${a}`:"No product image",role:"img",children:A.jsx(Aj,{"aria-hidden":"true"})})})},kj=({name:e,globalClassName:t,isCartMgmtSupported:n,productPageUrl:r,openLinksInNewTab:i,ariaLabel:o,showInWidgetDetails:a})=>{const{loading:l}=Vt(),{onNavigate:c}=it();return n?A.jsx("button",{type:"button",disabled:l,onClick:a,className:H(t,`${D}-msg-product-card__title-link`),"aria-label":o,children:e}):r?A.jsx("a",{href:r,target:i?"_blank":"_self",rel:"noopener",className:H(t,`${D}-msg-product-card__title-link`),"aria-label":o,onClick:d=>Xc({event:d,href:r,openLinksInNewTab:i,isCartMgmtSupported:n,onNavigate:c}),children:e}):A.jsx("p",{className:H(t,`${D}-msg-product-card__title`),children:e})},Oj=({product:e,globalClassName:t,openLinksInNewTab:n,isCartMgmtSupported:r=!1,rawProduct:i})=>{const{showProductDescription:o,onNavigate:a}=it(),{overrides:l,isInitialized:c}=qi(),{sendMessage:d,loading:h}=Vt(),p=zs(),g=c?l.ProductTile:void 0;if(g){const Q={name:"ProductTile",payload:i!=null?i:{},api:p};return A.jsx(Wi,{tagName:g,props:Q,label:"ProductTile"})}const{id:m,name:E,imageUrl:S,description:T,productPageUrl:v,price:w,priceBreakdown:C,discountPrice:R,listPrice:k,currencyCode:P}=e,I=R!=null?R:w,U=ZB({priceBreakdown:C,currencyCode:P}),ee=()=>{if(h)return;const Q=E||"this product",q=m?` [SKU: ${m}]`:"";d(`Show me details for ${Q}${q}`)},$=Q=>Vi({event:Q,openLinksInNewTab:n,onNavigate:a}),te=r?`View details for ${E}`:`Go to product page for ${E}`;return A.jsxs("div",{className:H(t,`${D}-msg-product-card`),children:[A.jsx(Cj,{imageUrl:S||"",globalClassName:t,isCartMgmtSupported:r,productPageUrl:v,openLinksInNewTab:n,ariaLabel:te,name:E,showInWidgetDetails:ee}),A.jsxs("div",{className:H(t,`${D}-msg-product-card__content`),children:[A.jsxs("div",{className:H(t,`${D}-msg-product-card__content-header`),children:[A.jsx(kj,{name:E||m,globalClassName:t,isCartMgmtSupported:r,productPageUrl:v,openLinksInNewTab:n,ariaLabel:te,showInWidgetDetails:ee}),o&&T&&A.jsx("div",{className:H(t,`${D}-msg-product-card__description`),title:T,children:A.jsx(Xo,{globalClassName:t,text:T,openLinksInNewTab:n,onLinkClick:$})})]}),A.jsx("div",{className:H(t,`${D}-msg-product-card__price-row`),children:U?A.jsx("span",{className:H(t,`${D}-msg-product-card__price`),"aria-label":`Price from ${U.low} to ${U.high}`,children:U.range}):A.jsx(Pm,{globalClassName:t,retailPrice:k,discountPrice:I,currencyCode:P})})]})]})},Nj=e=>{var n,r,i;const t=Im(e.data.promotions,(n=e.data.extendedData)==null?void 0:n.productPromotions);return{id:e.id,name:e.data.name,label:e.caption,description:e.data.description,imageUrl:e.data.imageUrl,productPageUrl:e.data.productPageUrl,price:e.data.price,discountPrice:t!=null?t:e.data.discountPrice,listPrice:(r=e.data.listPrice)!=null?r:t===void 0?void 0:e.data.price,priceBreakdown:(i=e.data.priceBreakdown)!=null?i:void 0,currencyCode:e.data.currencyCode}},Ij=({title:e,products:t,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:o=!1})=>{const{showProductCaptions:a}=it(),{overrides:l,isInitialized:c}=qi(),d=zs(),h=c?l.ProductCarousel:void 0;if(h){const p={name:"ProductCarousel",payload:{title:e,products:t},api:d};return A.jsx(Wi,{tagName:h,props:p,label:"ProductCarousel"})}return A.jsxs("div",{style:{marginBottom:"1rem"},children:[e&&A.jsx("p",{className:H(n,`${D}-product-carousel-title`),children:e}),A.jsx(_B,{globalClassName:n,spacing:i?"0.5rem":"6px",ariaLabel:e||"Product recommendations",children:t.map(p=>A.jsxs("div",{className:H(n,`${D}-product-carousel-item`),children:[A.jsx(Oj,{product:Nj(p),rawProduct:p,globalClassName:n,openLinksInNewTab:r,isCartMgmtSupported:o}),a&&A.jsx("p",{className:H(n,`${D}-product-carousel-caption`),title:p.caption,children:p.caption})]},p.id))})]})},zm=44,Pj=400,Rj=e=>{const t=typeof e=="number"?e:Number(e);return!Number.isFinite(t)||t<=0?zm:Math.min(Math.max(Math.round(t),zm),Pj)},Lj=e=>{try{return new URL(e,window.location.href).origin}catch(t){return null}},Dj="parentOrigin",Mj=(e,t)=>{if(!t)return e;try{const n=new URL(e,window.location.href);return n.searchParams.set(Dj,t),n.toString()}catch(n){return e}},Fj=(e,t,n)=>{if(!e||!t)return null;try{const r=new URL(e,window.location.href);return r.origin!==window.location.origin||!/\/Payments-Express\/?$/.test(r.pathname)?null:(r.pathname=r.pathname.replace(/\/Payments-Express\/?$/,"/Payments-ExpressProduct"),r.searchParams.set("pid",t),r.searchParams.set("quantity",String(n)),r.toString())}catch(r){return null}},Bj="Payment failed. Please try again or choose another method.",Uj="Payment was canceled.",Pw=(e,t)=>typeof e!="string"?t:e.trim()||t,Rw=({expressPaymentUrl:e,globalClassName:t,onOrderComplete:n})=>{const r=L.useRef(null),[i,o]=L.useState(!1),[a,l]=L.useState(zm),[c,d]=L.useState(null),h=typeof window!="undefined"?window.location.origin:"",p=Mj(e,h),g=Lj(e);return L.useEffect(()=>{const m=E=>{var T,v,w,C,R;if(g&&E.origin!==g||r.current&&E.source!==r.current.contentWindow)return;const S=E.data;if(!(!S||typeof S.type!="string"))switch(S.type){case"express.payment.available":o(!0),l(Rj((T=S.payload)==null?void 0:T.height));break;case"express.payment.unavailable":o(!1);break;case"express.payment.success":d(null),n==null||n((w=(v=S.payload)==null?void 0:v.orderId)!=null?w:null);break;case"express.payment.failure":d({text:Pw((C=S.payload)==null?void 0:C.error,Bj),persist:!0});break;case"express.payment.cancel":{const k=Pw((R=S.payload)==null?void 0:R.cancel,Uj);d(P=>P!=null&&P.persist?P:{text:k,persist:!1});break}}};return window.addEventListener("message",m),()=>window.removeEventListener("message",m)},[g,n]),A.jsxs(A.Fragment,{children:[c&&A.jsxs("div",{className:H(t,`${D}-cart-express-error`),role:"alert","data-testid":"express-payment-error",children:[A.jsx(kI,{"aria-hidden":"true"}),A.jsx("span",{children:c.text}),A.jsx("button",{type:"button",className:H(t,`${D}-cart-express-error-dismiss`),onClick:()=>d(null),"aria-label":"Dismiss","data-testid":"express-payment-error-dismiss",children:A.jsx(PI,{"aria-hidden":"true"})})]}),A.jsx("div",{className:H(t,`${D}-cart-express`,{[`${D}-cart-express-ready`]:i}),style:i?{height:a}:void 0,"data-testid":"express-payment","aria-hidden":!i,children:A.jsx("iframe",{ref:r,className:H(t,`${D}-cart-express-frame`),src:p,title:"Express payment",allow:"payment *",scrolling:"no"})})]})},Jc=({code:e,globalClassName:t,inactive:n})=>A.jsxs("span",{className:H(t,`${D}-cart-chip`,{inactive:n}),title:n?"Not applied":void 0,children:[A.jsx(AE,{"aria-hidden":"true"}),A.jsx("span",{children:e})]}),Vn=({label:e,badge:t,value:n,currencyCode:r,globalClassName:i,emphasized:o,isDiscount:a,fallback:l,loading:c})=>{let d;if(typeof n=="number")d=fi(a?-Math.abs(n):n,r);else if(l)d=l;else return null;return A.jsxs("div",{className:H(i,`${D}-cart-total-row`,{emphasized:o}),children:[A.jsxs("span",{className:H(i,`${D}-cart-total-label`),children:[e,t&&A.jsx("span",{className:H(i,`${D}-cart-total-badge`),children:t})]}),A.jsx("span",{className:H(i,`${D}-cart-total-value`),children:c?A.jsx("span",{className:H(i,`${D}-cart-total-shimmer`)}):d})]})};function Lw(e){var o;const n=((o=e.variants)!=null?o:[]).filter(a=>a.value).map(a=>`${a.lbl}: ${a.value}`).join(", "),r=n?` (${n})`:"",i=e.productId?` [SKU: ${e.productId}]`:"";return`${e.name}${r}${i}`}function Dw(e){var r;const n=((r=e.variants)!=null?r:[]).filter(i=>i.value).map(i=>i.value).join(", ");return n?`${e.name} (${n})`:e.name}function Vm(e){return typeof e=="string"?e:e&&typeof e.code=="string"?e.code:null}function qm(e){return(e!=null?e:[]).map(Vm).filter(t=>t!==null)}function Mw(e){return e&&typeof e=="object"&&typeof e.status=="string"?e.status:void 0}function jj(e,t){var i;const n=new Map;for(const o of t!=null?t:[]){const a=Vm(o),l=Mw(o);a!==null&&l!==void 0&&n.set(a.toLowerCase(),l)}const r=[];for(const o of e!=null?e:[]){const a=Vm(o);if(a===null)continue;const l=(i=Mw(o))!=null?i:n.get(a.toLowerCase());r.push({code:a,applied:l==null||l==="applied"})}return r}function Fw(e,t,n){const r=new Set((e!=null?e:[]).flatMap(i=>qm(i.coupons)).map(i=>i.toLowerCase()));return jj(t,n).filter(i=>!r.has(i.code.toLowerCase()))}const Bw=e=>{const{sendMessage:t}=Vt();return{removeItem:o=>{e||t(`Remove ${Lw(o)} from my cart`,{displayContent:`Remove ${Dw(o)} from cart`,cartMutation:!0})},changeItemQuantity:(o,a)=>{e||a<1||t(`Update ${Lw(o)} quantity to ${a}`,{displayContent:`Update ${Dw(o)} to qty ${a}`,cartMutation:!0})},applyCoupon:o=>{const a=o.trim();!a||e||t(`Apply coupon code ${a}`,{cartMutation:!0})}}},Hj=e=>{const t=z({},e);return delete t.checkoutButtonUrl,delete t.expressPaymentUrl,t},$j=({quantity:e,disabled:t,globalClassName:n,onChange:r})=>{const[i,o]=L.useState(e.toString());L.useEffect(()=>{o(e.toString())},[e]);const a=d=>{if(t)return;const h=d.target.value;/^\d*$/.test(h)&&o(h)},l=()=>{const d=parseInt(i,10);!t&&!isNaN(d)&&d>0&&d!==e?r(d):o(e.toString())},c=d=>{d.key==="Enter"&&(d.preventDefault(),l())};return A.jsx("div",{className:H(n,`${D}-cart-qty-input-wrapper`),children:A.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:H(n,`${D}-cart-qty-input`),value:i,disabled:t,onChange:a,onBlur:l,onKeyDown:c,"aria-label":"Quantity"})})},zj=({item:e,currencyCode:t,disabled:n,globalClassName:r,onRemove:i,onQuantityChange:o})=>{var c,d;const a=typeof e.originalSubtotal=="number"&&typeof e.itemSubtotal=="number"&&e.originalSubtotal>e.itemSubtotal,l=qm(e.coupons);return A.jsxs("li",{className:H(r,`${D}-cart-item`),children:[e.imageUrl&&A.jsx("div",{className:H(r,`${D}-cart-item-image`),children:A.jsx("img",{src:e.imageUrl,alt:e.name||"Product image",loading:"lazy"})}),A.jsxs("div",{className:H(r,`${D}-cart-item-details`),children:[A.jsx("p",{className:H(r,`${D}-cart-item-name`),children:e.name}),A.jsxs("div",{className:H(r,`${D}-cart-item-attrs`),children:[((c=e.variants)!=null?c:[]).map(h=>A.jsxs("p",{className:H(r,`${D}-cart-item-attr`),children:[h.lbl,": ",h.value]},`${h.type}-${h.value}`)),((d=e.promotions)!=null?d:[]).map(h=>A.jsxs("p",{className:H(r,`${D}-cart-item-attr`),children:["Promotion: ",h]},h))]}),l.length>0&&A.jsx("div",{className:H(r,`${D}-cart-chips`),children:l.map(h=>A.jsx(Jc,{code:h,globalClassName:r},h))}),A.jsxs("span",{className:H(r,`${D}-cart-item-price`),children:[a&&A.jsx("span",{className:H(r,`${D}-cart-item-original-price`),children:fi(e.originalSubtotal,t)}),A.jsx("span",{className:H(r,`${D}-cart-item-final-price`),children:fi(e.itemSubtotal,t)})]}),A.jsxs("div",{className:H(r,`${D}-cart-item-footer`),children:[A.jsx("span",{className:H(r,`${D}-cart-qty-heading`),children:"Quantity"}),A.jsx($j,{quantity:e.quantity,disabled:n,globalClassName:r,onChange:h=>o(e,h)}),A.jsx("button",{type:"button",className:H(r,`${D}-cart-item-remove`),disabled:n,onClick:()=>i(e),children:"Remove"})]})]})]})},Uw=({expressPaymentUrl:e,checkoutButtonUrl:t,globalClassName:n,openLinksInNewTab:r})=>{const{sendMessage:i}=Vt(),{onNavigate:o}=it(),a=c=>Vi({event:c,href:t!=null?t:void 0,openLinksInNewTab:r,onNavigate:o}),l=c=>{i(c?`I completed express payment. Show my order confirmation for order ${c}.`:"I completed express payment. Show my order confirmation.")};return A.jsxs(A.Fragment,{children:[e&&A.jsx(Rw,{expressPaymentUrl:e,globalClassName:n,onOrderComplete:l}),t&&A.jsxs("a",{className:H(n,`${D}-cart-checkout-button`),href:t,target:r?"_blank":"_self",rel:"noopener noreferrer",onClick:a,children:[A.jsx(CI,{"aria-hidden":"true"}),A.jsx("span",{children:"Checkout"})]})]})},Vj=({cartOverrideTag:e,cart:t,productsToHighlight:n,readOnly:r,globalClassName:i,openLinksInNewTab:o})=>{const{loading:a,isConnected:l}=Vt(),{mode:c,status:d}=Hr(),h=a||!!r,{removeItem:p,changeItemQuantity:g,applyCoupon:m}=Bw(h),E=v=>t.items.find(w=>w.itemId===v),S={isConnected:l,isLoading:a,componentType:d.type,mode:c,cart:{setQuantity:(v,w)=>{var P,I;const C=E(v);if(!C)return;const R=Math.max(1,(P=C.minQuantity)!=null?P:1),k=(I=C.maxQuantity)!=null?I:1/0;g(C,Math.min(k,Math.max(R,Math.floor(w))))},remove:v=>{const w=E(v);w&&p(w)},applyCoupon:m}},T={name:"Cart",payload:{cart:Hj(t),productsToHighlight:n,readOnly:r},api:S};return A.jsxs("div",{className:H(i,`${D}-cart`),children:[A.jsx(Iw,{overrideName:"Cart",children:A.jsx(Wi,{tagName:e,props:T,label:"Cart"})}),A.jsx(Uw,{expressPaymentUrl:t.expressPaymentUrl,checkoutButtonUrl:t.checkoutButtonUrl,globalClassName:i,openLinksInNewTab:o})]})},qj=({cart:e,productsToHighlight:t,readOnly:n,globalClassName:r,openLinksInNewTab:i})=>{const{loading:o}=Vt(),{onNavigate:a}=it(),[l,c]=L.useState(!1),[d,h]=L.useState(""),{overrides:p,isInitialized:g}=qi(),m=g?p.Cart:void 0,E=o||!!n,{removeItem:S,changeItemQuantity:T,applyCoupon:v}=Bw(E),w=O=>Vi({event:O,openLinksInNewTab:i,onNavigate:a});if(m)return A.jsx(Vj,{cartOverrideTag:m,cart:e,productsToHighlight:t,readOnly:n,globalClassName:r,openLinksInNewTab:i});const{items:C=[],currencyCode:R="USD",subtotal:k,total:P,taxes:I,shippingCost:U,shippingDiscount:ee,shippingPromotions:$=[],promotionsDiscount:te,promotions:Q=[],couponsDiscount:q,bodyMessage:G,footerMessage:Y,checkoutButtonUrl:ce,expressPaymentUrl:ne}=e,J=Fw(C,e.couponsApplied,e.coupons),ae=()=>{const O=d.trim();!O||E||(v(O),h(""))};return A.jsxs("div",{className:H(r,`${D}-cart`,E&&`${D}-cart-busy`),children:[A.jsxs("div",{className:H(r,`${D}-cart-box`),children:[G&&A.jsxs("button",{type:"button",className:H(r,`${D}-cart-summary`),"aria-expanded":l,onClick:()=>c(O=>!O),children:[A.jsx("span",{className:H(r,`${D}-cart-summary-text`),children:A.jsx(Xo,{text:G,globalClassName:r,openLinksInNewTab:i,showIsLoading:!1,onLinkClick:w})}),A.jsx("span",{className:H(r,`${D}-cart-summary-toggle`),"aria-hidden":"true",children:l?A.jsx(xE,{}):A.jsx(SE,{})})]}),l&&A.jsxs("div",{className:H(r,`${D}-cart-expanded`),children:[A.jsxs("div",{className:H(r,`${D}-cart-items-section`),children:[A.jsx("ul",{className:H(r,`${D}-cart-items`),children:C.map(O=>A.jsx(zj,{item:O,currencyCode:R,disabled:E,globalClassName:r,onRemove:S,onQuantityChange:T},O.itemId))}),J.length>0&&A.jsx("div",{className:H(r,`${D}-cart-chips`,`${D}-cart-applied-coupons`),children:J.map(O=>A.jsx(Jc,{code:O.code,inactive:!O.applied,globalClassName:r},O.code))})]}),A.jsxs("div",{className:H(r,`${D}-cart-totals`),children:[A.jsx(Vn,{label:"Subtotal",value:k,currencyCode:R,globalClassName:r,loading:!1}),A.jsx(Vn,{label:"Coupon",value:q,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Promotions",badge:Q[0],value:te,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Shipping",value:U,currencyCode:R,globalClassName:r,fallback:"TBD",loading:!1}),A.jsx(Vn,{label:"Shipping Discount",badge:$[0],value:ee,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Tax",value:I,currencyCode:R,globalClassName:r,fallback:"TBD",loading:!1}),A.jsx(Vn,{label:"Total",value:P,currencyCode:R,globalClassName:r,emphasized:!0,loading:!1})]})]})]}),A.jsxs("div",{className:H(r,`${D}-cart-coupon`),children:[A.jsxs("div",{className:H(r,`${D}-cart-coupon-field`),children:[A.jsx("span",{className:H(r,`${D}-cart-coupon-icon`),"aria-hidden":"true",children:A.jsx(AE,{})}),A.jsx("input",{type:"text",className:H(r,`${D}-cart-coupon-input`),placeholder:"Enter coupon code","aria-label":"Enter coupon code",value:d,disabled:E,onChange:O=>h(O.target.value),onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),ae())}})]}),A.jsx("button",{type:"button",className:H(r,`${D}-cart-coupon-submit`),"aria-label":"Apply coupon",disabled:E||!d.trim(),onClick:ae,children:A.jsx(NI,{"aria-hidden":"true"})})]}),A.jsx(Uw,{expressPaymentUrl:ne,checkoutButtonUrl:ce,globalClassName:r,openLinksInNewTab:i}),A.jsx("p",{className:H(r,`${D}-cart-footer`),children:Y||"Shipping and taxes calculated at checkout."})]})},Wj=({item:e,currencyCode:t,globalClassName:n})=>{var o,a;const r=typeof e.originalSubtotal=="number"&&typeof e.itemSubtotal=="number"&&e.originalSubtotal>e.itemSubtotal,i=qm(e.coupons);return A.jsxs("li",{className:H(n,`${D}-cart-item`),children:[e.imageUrl&&A.jsx("div",{className:H(n,`${D}-cart-item-image`),children:A.jsx("img",{src:e.imageUrl,alt:e.name||"Product image",loading:"lazy"})}),A.jsxs("div",{className:H(n,`${D}-cart-item-details`),children:[A.jsx("p",{className:H(n,`${D}-cart-item-name`),children:e.name}),A.jsxs("div",{className:H(n,`${D}-cart-item-attrs`),children:[((o=e.variants)!=null?o:[]).map(l=>A.jsxs("p",{className:H(n,`${D}-cart-item-attr`),children:[l.lbl,": ",l.value]},`${l.type}-${l.value}`)),((a=e.promotions)!=null?a:[]).map(l=>A.jsxs("p",{className:H(n,`${D}-cart-item-attr`),children:["Promotion: ",l]},l))]}),i.length>0&&A.jsx("div",{className:H(n,`${D}-cart-chips`),children:i.map(l=>A.jsx(Jc,{code:l,globalClassName:n},l))}),A.jsxs("span",{className:H(n,`${D}-cart-item-price`),children:[r&&A.jsx("span",{className:H(n,`${D}-cart-item-original-price`),children:fi(e.originalSubtotal,t)}),A.jsx("span",{className:H(n,`${D}-cart-item-final-price`),children:fi(e.itemSubtotal,t)})]}),A.jsx("div",{className:H(n,`${D}-cart-item-footer`),children:A.jsxs("span",{className:H(n,`${D}-cart-item-qty`),children:["Qty: ",e.quantity]})})]})]})},Yj=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})},Gj=({order:e,globalClassName:t,openLinksInNewTab:n})=>{const{onNavigate:r}=it(),[i,o]=L.useState(!0),a=I=>Vi({event:I,openLinksInNewTab:n,onNavigate:r}),{id:l,orderedOn:c,items:d=[],currencyCode:h="USD",subtotal:p,total:g,taxes:m,shippingCost:E,shippingDiscount:S,shippingPromotions:T=[],promotionsDiscount:v,promotions:w=[],couponsDiscount:C,bodyMessage:R,footerMessage:k}=e,P=Fw(d,e.couponsApplied);return A.jsxs("div",{className:H(t,`${D}-cart`),children:[A.jsxs("div",{className:H(t,`${D}-cart-banner`),children:[A.jsx("span",{className:H(t,`${D}-cart-banner-icon`),"aria-hidden":"true",children:A.jsx(II,{})}),A.jsx("p",{className:H(t,`${D}-cart-banner-text`),children:"Your order is confirmed!"})]}),A.jsxs("div",{className:H(t,`${D}-order-confirmation-meta`),children:[A.jsxs("span",{children:["Order No: ",l]}),A.jsxs("span",{children:["Ordered On: ",Yj(c)]})]}),A.jsxs("div",{className:H(t,`${D}-cart-box`),children:[R&&A.jsxs("button",{type:"button",className:H(t,`${D}-cart-summary`),"aria-expanded":i,onClick:()=>o(I=>!I),children:[A.jsx("span",{className:H(t,`${D}-cart-summary-text`),children:A.jsx(Xo,{text:R,globalClassName:t,showIsLoading:!1,openLinksInNewTab:n,onLinkClick:a})}),A.jsx("span",{className:H(t,`${D}-cart-summary-toggle`),"aria-hidden":"true",children:i?A.jsx(xE,{}):A.jsx(SE,{})})]}),i&&A.jsxs("div",{className:H(t,`${D}-cart-expanded`),children:[A.jsx("ul",{className:H(t,`${D}-cart-items`),children:d.map(I=>A.jsx(Wj,{item:I,currencyCode:h,globalClassName:t},I.itemId))}),P.length>0&&A.jsx("div",{className:H(t,`${D}-cart-chips`,`${D}-cart-applied-coupons`),children:P.map(I=>A.jsx(Jc,{code:I.code,globalClassName:t},I.code))}),A.jsxs("div",{className:H(t,`${D}-cart-totals`),children:[A.jsx(Vn,{label:"Subtotal",value:p,currencyCode:h,globalClassName:t}),A.jsx(Vn,{label:"Coupon",value:C,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Promotions",badge:w[0],value:v,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Shipping",value:E,currencyCode:h,globalClassName:t,fallback:"TBD"}),A.jsx(Vn,{label:"Shipping Discount",badge:T[0],value:S,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Tax",value:m,currencyCode:h,globalClassName:t,fallback:"TBD"}),A.jsx(Vn,{label:"Total",value:g,currencyCode:h,globalClassName:t,emphasized:!0})]})]})]}),A.jsx("p",{className:H(t,`${D}-cart-footer`),children:k||"Shipping and taxes calculated at checkout."})]})},Xj=({image:e,alt:t,globalClassName:n})=>{const[r,i]=L.useState(e.src),[o,a]=L.useState(!1),l=()=>{e.fallbackSrc&&r!==e.fallbackSrc&&i(e.fallbackSrc)};return A.jsx("img",{className:H(n,`${D}-pdp-gallery__image`,{[`${D}-pdp-gallery__image--loaded`]:o}),src:r,alt:t,loading:"lazy",onLoad:()=>a(!0),onError:l})},Kj=({images:e,altText:t,globalClassName:n})=>{if(e.length===0)return null;const r=e.length>1;return A.jsxs(wm,{className:H(n,`${D}-pdp-gallery`),slidesPerPage:1,slidesPerMove:1,slideCount:e.length,loop:!0,"aria-label":t||"Product images",children:[A.jsx(_m,{className:H(n,`${D}-pdp-gallery__item-group`),children:e.map((i,o)=>A.jsx(bm,{index:o,className:H(n,`${D}-pdp-gallery__item`),children:A.jsx(Xj,{image:i,alt:t?`${t} (${o+1})`:`Product image ${o+1}`,globalClassName:n})},i.src))}),r&&A.jsxs(gm,{className:H(n,`${D}-pdp-gallery__control`),children:[A.jsx(Tm,{className:H(n,`${D}-pdp-gallery__prev-trigger`),"aria-label":"Previous image",children:A.jsx(OT,{size:"16px"})}),A.jsx(vm,{className:H(n,`${D}-pdp-gallery__next-trigger`),"aria-label":"Next image",children:A.jsx(NT,{size:"16px"})})]}),r&&A.jsx(Em,{className:H(n,`${D}-pdp-gallery__indicator-group`),children:Array.from({length:e.length},(i,o)=>A.jsx(ym,{index:o,className:H(n,`${D}-pdp-gallery__indicator`),"aria-label":`Go to image ${o+1}`},o))})]})},Qj="color",Zc=e=>(e!=null?e:"").toLowerCase()===Qj,Jj=e=>e.replace(/(^|\/)large\//,"$1medium/"),jw=(e,t)=>!e.vattr||!t?!1:e.vattr.some(n=>Zc(n.id)&&n.vals.includes(t)),Hw=(e,t)=>{const n=Jj(t),r=Cl(e,n);return n===t?{src:r}:{src:r,fallbackSrc:Cl(e,t)}},Zj=["hi-res","large","medium","small"],$w=(e,t)=>{var n;return((n=e.viewType)!=null?n:"").toLowerCase()===t},eH=e=>Zj.find(t=>e.some(n=>$w(n,t))),tH=(e,t,n)=>{var i;const r=[...t?e.filter(o=>jw(o,t)):[],...e.filter(o=>!o.vattr),...e];for(const o of r){const a=((i=o.imgs)!=null?i:[]).filter(l=>{var c;return((c=l.url)!=null?c:"").trim().length>0}).map(l=>Hw(n,l.url));if(a.length>0)return a}return[]},nH=(e,t)=>{var i;const n=(i=e.imgGroups)!=null?i:[],r=eH(n);if(r){const o=n.filter(l=>$w(l,r)),a=tH(o,t,e.baseUrl);if(a.length>0)return a}return e.imageUrl?[Hw(e.baseUrl,e.imageUrl)]:[]},rH=(e,t)=>{var i,o,a;const n=((i=e.imgGroups)!=null?i:[]).find(l=>l.viewType==="swatch"&&jw(l,t)),r=(a=(o=n==null?void 0:n.imgs)==null?void 0:o[0])==null?void 0:a.url;return r?Cl(e.baseUrl,r):""},iH=e=>{const t=e.vattr,n=e.vmat;if(!t||t.length===0||!n||n.length===0)return e;const r=new Set(t.map(d=>d.id)),i=[...new Set(n.flatMap(d=>Object.keys(d.vars)))];if(i.every(d=>r.has(d)))return e;const o={},a=new Set;for(const d of i){if(r.has(d)){o[d]=d,a.add(d);continue}const h=new Set(n.map(g=>g.vars[d]).filter(Boolean));if(h.size===0)continue;const p=t.filter(g=>!a.has(g.id)&&g.opts.length>0&&[...h].every(m=>g.opts.some(E=>E.val===m)));p.length===1&&(o[d]=p[0].id,a.add(p[0].id))}const l=i.filter(d=>!r.has(d)).length;return Object.keys(o).filter(d=>o[d]!==d).length<l?e:pe(z({},e),{vmat:n.map(d=>pe(z({},d),{vars:Object.fromEntries(Object.entries(d.vars).map(([h,p])=>{var g;return[(g=o[h])!=null?g:h,p]}))}))})},ed=(e,t,n,r={})=>!e||e.length===0||!t||!n?!1:e.some(i=>{var o;return((o=i.vars)==null?void 0:o[t])!==n||i.ord===!1?!1:Object.entries(r).every(([a,l])=>{var c;return a===t||((c=i.vars)==null?void 0:c[a])===l})}),sH=(e,t)=>{const n=Object.keys(t);return n.length===0?!0:!e||e.length===0?!1:e.some(r=>r.ord!==!1&&n.every(i=>{var o;return((o=r.vars)==null?void 0:o[i])===t[i]}))},oH=(e,t,n,r,i)=>{if(!e||e.length===0)return pe(z({},i),{[n]:r});const o=e.find(l=>{var c;return((c=l.vars)==null?void 0:c[n])===r&&l.ord!==!1&&Object.keys(l.vars).length>=t.length&&Object.entries(i).every(([d,h])=>{var p;return d===n||((p=l.vars)==null?void 0:p[d])===h})});if(o)return z({},o.vars);const a=e.find(l=>{var c;return((c=l.vars)==null?void 0:c[n])===r&&l.ord!==!1&&Object.keys(l.vars).length>=t.length});return a?z({},a.vars):pe(z({},i),{[n]:r})},zw=(e,t)=>{var i,o,a,l;if(!(Array.isArray(e.vattr)&&e.vattr.length>0))return(i=e.id)!=null?i:null;if(!e.vmat||e.vmat.length===0)return(o=e.id)!=null?o:null;const r=e.vmat.find(c=>c.ord!==!1&&Object.entries(t).every(([d,h])=>{var p;return((p=c.vars)==null?void 0:p[d])===h}));return(l=(a=r==null?void 0:r.pid)!=null?a:e.id)!=null?l:null},aH=(e,t)=>{var o;const n=Im(e.promotions,(o=e.extendedData)==null?void 0:o.productPromotions),r=typeof n=="number"?pe(z({},e.pr),{prom:n}):e.pr;if(!e.vmat||e.vmat.length===0||Object.keys(t).length===0)return r;const i=e.vmat.find(a=>a.ord!==!1&&Object.entries(t).every(([l,c])=>{var d;return((d=a.vars)==null?void 0:d[l])===c}));return i!=null&&i.pr?i.pr:r},Vw=e=>{var n;const t={};for(const r of(n=e.vattr)!=null?n:[]){const i=r.opts.find(a=>ed(e.vmat,r.id,a.val)),o=i!=null?i:r.opts[0];o&&(t[r.id]=o.val)}return t},uH=300,lH=e=>{const{overrides:t,isInitialized:n}=qi(),r=zs(),i=n?t.ProductDetailCard:void 0;if(i){const o={name:"ProductDetailCard",payload:e.product,api:r};return A.jsx(Wi,{tagName:i,props:o,label:"ProductDetailCard"})}return A.jsx(cH,z({},e))},cH=({product:e,globalClassName:t,openLinksInNewTab:n,isCartMgmtSupported:r=!1})=>{var Ie,De,ut,It,gt,xt,St,Qt;const{addToCart:i,sendMessage:o,loading:a}=Vt(),{onNavigate:l}=it(),c=L.useMemo(()=>iH(e.data),[e.data]),d=(Ie=c.vattr)!=null?Ie:[],[h,p]=L.useState(()=>Vw(c));L.useEffect(()=>{p(Vw(c))},[c,e.id]);const g=sH(c.vmat,h),m=(ut=(De=c.quantity)==null?void 0:De.minQuantity)!=null?ut:1,E=(gt=(It=c.quantity)==null?void 0:It.maxQuantity)!=null?gt:Number.POSITIVE_INFINITY,S=(St=(xt=c.quantity)==null?void 0:xt.increment)!=null?St:1,[T,v]=L.useState(m),[w,C]=L.useState(!1),R=L.useRef(!1);L.useEffect(()=>{w&&(a?R.current=!0:R.current&&(R.current=!1,C(!1)))},[w,a]);const k=d.find(je=>Zc(je.id)),P=d.filter(je=>!Zc(je.id)),I=k?h[k.id]:void 0,U=L.useMemo(()=>nH(c,I),[c,I]),ee=L.useMemo(()=>aH(c,h),[c,h]),$=zw(c,h),[te,Q]=L.useState(T),q=L.useRef($),G=q.current===$?te:T;L.useEffect(()=>{if(q.current!==$){q.current=$,Q(T);return}const je=window.setTimeout(()=>Q(T),uH);return()=>window.clearTimeout(je)},[T,$]);const Y=T===te,ce=L.useMemo(()=>g&&(q.current!==$||Y)?Fj(c.expressPaymentUrl,$,G):null,[c.expressPaymentUrl,$,G,g,Y]),ne=L.useCallback(je=>{o(je?`I completed express payment. Show my order confirmation for order ${je}.`:"I completed express payment. Show my order confirmation.")},[o]),J=je=>Vi({event:je,openLinksInNewTab:n,onNavigate:l}),ae=(je,Ve)=>()=>{p(Pe=>{const Ye=!ed(c.vmat,je,Ve,Pe);return Zc(je)||Ye?oH(c.vmat,d,je,Ve,Pe):pe(z({},Pe),{[je]:Ve})})},O=()=>{if(a)return;const je=zw(c,h);if(!je)return;const Ve=d.map(Pe=>{const Ye=Pe.opts.find(Pt=>Pt.val===h[Pe.id]);return Ye?{label:Pe.lbl||Pe.id,value:Ye.name||Ye.val}:null}).filter(Pe=>Pe!==null);C(!0),i({productName:c.name,sku:je,quantity:T,variants:Ve})},B=!g||T-S<m,re=!g||T+S>E,M=je=>{var Pe;const Ve=h[je.id];return(Pe=je.opts.find(Ye=>Ye.val===Ve))==null?void 0:Pe.name},we=()=>v(je=>Math.max(m,je-S)),Ue=()=>v(je=>Math.min(E,je+S)),Le=je=>A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{id:`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__variant-name`),children:je.lbl||je.id}),M(je)&&A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:M(je)})]}),A.jsx("div",{role:"radiogroup","aria-labelledby":`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__chips`),children:je.opts.map(Ve=>{const Pe=ed(c.vmat,je.id,Ve.val,h),Ye=h[je.id]===Ve.val;return A.jsxs("label",{className:H(`${D}-msg-pdp__chip`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("span",{children:Ve.name||Ve.val})]},Ve.val)})})]},je.id),ke=je=>A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{id:`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__variant-name`),children:je.lbl||"Color"}),M(je)&&A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:M(je)})]}),A.jsx("div",{role:"radiogroup","aria-labelledby":`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__swatches`),children:je.opts.map(Ve=>{const Pe=ed(c.vmat,je.id,Ve.val,h),Ye=h[je.id]===Ve.val,Pt=rH(c,Ve.val);return Pt?A.jsxs("label",{className:H(`${D}-msg-pdp__swatch`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-label":Ve.name||Ve.val,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("img",{className:H(t,`${D}-msg-pdp__swatch-image`),src:Pt,alt:Ve.name||Ve.val,loading:"lazy"})]},Ve.val):A.jsxs("label",{className:H(`${D}-msg-pdp__chip`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("span",{children:Ve.name||Ve.val})]},Ve.val)})})]});return A.jsx("div",{className:H(t,`${D}-msg-pdp`),children:A.jsxs("div",{className:H(t,`${D}-msg-pdp__card`),children:[A.jsx("div",{className:H(t,`${D}-msg-pdp__gallery`),children:A.jsx(Kj,{images:U,altText:c.name,globalClassName:t})}),A.jsxs("div",{className:H(t,`${D}-msg-pdp__content`),children:[c.slugUrl&&!r?A.jsx("a",{href:c.slugUrl,target:n?"_blank":"_self",rel:"noopener noreferrer",className:H(t,`${D}-msg-pdp__title-link`),"aria-label":`Go to product page for ${c.name}`,onClick:je=>Xc({event:je,href:c.slugUrl,openLinksInNewTab:n,isCartMgmtSupported:r,onNavigate:l}),children:c.name}):A.jsx("p",{className:H(t,`${D}-msg-pdp__title`),children:c.name}),A.jsx("div",{"aria-live":"polite","aria-atomic":"true",children:A.jsx(Pm,{globalClassName:t,className:`${D}-msg-pdp__price`,retailPrice:ee==null?void 0:ee.orig,discountPrice:(Qt=ee==null?void 0:ee.prom)!=null?Qt:ee==null?void 0:ee.cur,currencyCode:c.ccy,fontSize:"14px"})}),c.dscr&&A.jsx("div",{className:H(t,`${D}-msg-pdp__description`),children:A.jsx(Xo,{globalClassName:t,text:c.dscr,openLinksInNewTab:n,onLinkClick:J})}),k&&ke(k),P.map(Le),r&&A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-name`),children:"Quantity"}),A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:T})]}),A.jsxs("div",{className:H(t,`${D}-msg-pdp__stepper`),children:[A.jsx(wr,{className:`${D}-msg-pdp__stepper-btn`,ariaLabel:"Decrease quantity",icon:A.jsx(_I,{}),disabled:B,onClick:we}),A.jsx("span",{className:H(t,`${D}-msg-pdp__quantity`),children:T}),A.jsx(wr,{className:`${D}-msg-pdp__stepper-btn`,ariaLabel:"Increase quantity",icon:A.jsx(vI,{}),disabled:re,onClick:Ue})]})]}),r&&A.jsxs("div",{className:H(t,`${D}-msg-pdp__actions`),children:[ce&&A.jsx(Rw,{expressPaymentUrl:ce,globalClassName:t,onOrderComplete:ne},ce),A.jsx(Uh,{className:`${D}-msg-pdp__add-to-cart`,disabled:!g||a||w,onClick:O,children:w?"Adding...":"Add to cart"})]})]})]})})},dH=({products:e,table:t,globalClassName:n,openLinksInNewTab:r})=>{const{isCartMgmtSupported:i,onNavigate:o}=it(),{overrides:a,isInitialized:l}=qi(),c=zs(),d=l?a.ProductComparison:void 0;if(d){const g={name:"ProductComparison",payload:{products:e,table:t},api:c};return A.jsx(Wi,{tagName:d,props:g,label:"ProductComparison"})}if(!e.length)return null;const h=`auto repeat(${e.length}, 1fr)`,p=`${90+e.length*140}px`;return A.jsx("div",{className:H(n,`${D}-product-comparison`),children:A.jsxs("div",{className:`${D}-product-comparison__grid`,style:{gridTemplateColumns:h,minWidth:p},children:[A.jsxs("div",{className:`${D}-product-comparison__header`,children:[A.jsx("div",{className:`${D}-product-comparison__header-spacer`}),e.map(g=>{var S,T,v,w,C,R,k;const m=g.imageUrl?Cl(g.baseUrl,g.imageUrl):void 0,E=Im(g.promotions,(S=g.extendedData)==null?void 0:S.productPromotions);return A.jsxs("div",{className:H(n,`${D}-product-comparison__product-col`),children:[m&&A.jsx("img",{className:H(n,`${D}-product-comparison__image`),src:m,alt:g.name||"Product image",loading:"eager"}),g.slugUrl&&!i?A.jsx("a",{href:g.slugUrl,target:r?"_blank":"_self",rel:"noopener",className:H(n,`${D}-product-comparison__name`,`${D}-product-comparison__name-link`),"aria-label":`Go to product page for ${g.name}`,onClick:P=>Xc({event:P,href:g.slugUrl,openLinksInNewTab:r,isCartMgmtSupported:i,onNavigate:o}),children:g.name}):A.jsx("span",{className:H(n,`${D}-product-comparison__name`),children:g.name}),A.jsx(Pm,{globalClassName:n,retailPrice:(w=(T=g.pr)==null?void 0:T.orig)!=null?w:(v=g.pr)==null?void 0:v.cur,discountPrice:(k=E!=null?E:(C=g.pr)==null?void 0:C.prom)!=null?k:(R=g.pr)==null?void 0:R.cur,currencyCode:g.ccy,fontSize:"0.875rem"})]},g.id)})]}),A.jsx("div",{className:`${D}-product-comparison__table`,children:t.map(g=>A.jsxs("div",{className:`${D}-product-comparison__row`,children:[A.jsx("div",{className:H(n,`${D}-product-comparison__row-label`),children:g.row_name}),e.map((m,E)=>A.jsx("div",{className:H(n,`${D}-product-comparison__row-value`),children:g.values[E]},`${g.row_name}-${m.id}`))]},g.row_name))})]})})},fH=({suggestions:e,disabled:t,globalClassName:n,isWidgetStandalone:r,onSuggestionClick:i})=>{const{overrides:o,isInitialized:a}=qi(),l=zs(),c=a?o.Suggestions:void 0;if(c){const d={name:"Suggestions",payload:{suggestions:e},api:l};return A.jsx(Wi,{tagName:c,props:d,label:"Suggestions"})}return A.jsx("div",{style:{marginTop:"0.5rem"},children:A.jsx(t7,{disabled:t,suggestions:e,globalClassName:n,isWidgetStandalone:r,onSuggestionClick:i})})},qw=({content:e,messageId:t,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i})=>{const{loading:o}=Vt(),a=Gc(),l=xj(),{isCartMgmtSupported:c,logger:d,onNavigate:h}=it(),{overrides:p,isInitialized:g}=qi(),m=zs(),E=L.useMemo(()=>e.response.flatMap(dh),[e.response]),S=T=>Vi({event:T,openLinksInNewTab:r,onNavigate:h});return A.jsx(A.Fragment,{children:E.map((T,v)=>{var w,C,R,k,P,I,U,ee,$,te,Q,q,G,Y,ce,ne,J,ae,O,B,re,M,we,Ue,Le,ke;switch(T.type){case"markdown":{const Ie=(C=(w=T.data)==null?void 0:w.content)!=null?C:"";return T.index===Pi&&k1(Ie)?null:A.jsx(Xo,{text:Ie,globalClassName:n,openLinksInNewTab:r,showIsLoading:!1,onLinkClick:S},`${T.type}-${(R=T.index)!=null?R:v}`)}case"product_carousel":return A.jsx(Ij,{title:(P=(k=T.data)==null?void 0:k.title)!=null?P:"",products:(U=(I=T.data)==null?void 0:I.products)!=null?U:[],globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:c},`${T.type}-${(ee=T.index)!=null?ee:v}`);case"product_tile":return A.jsx(lH,{product:T.data,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:c},`${T.type}-${($=T.index)!=null?$:v}`);case"product_comparison":return A.jsx(dH,{products:(Q=(te=T.data)==null?void 0:te.products)!=null?Q:[],table:(G=(q=T.data)==null?void 0:q.table)!=null?G:[],globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i},`${T.type}-${(Y=T.index)!=null?Y:v}`);case"cart":{const Ie=(J=(ne=(ce=T.data)==null?void 0:ce.cart)==null?void 0:ne.cartSummary)==null?void 0:J.cartDetails;return Ie?A.jsx(qj,{cart:Ie,productsToHighlight:T.data.products_to_highlight,readOnly:!l||t!==l,globalClassName:n,openLinksInNewTab:r},`${T.type}-${(ae=T.index)!=null?ae:v}`):null}case"order_confirmation":{const Ie=T.data,De=(re=(O=Ie==null?void 0:Ie.order)==null?void 0:O.orderDetails)!=null?re:(B=Ie==null?void 0:Ie.data)==null?void 0:B.orderConfirmation;return De?A.jsx(Gj,{order:De,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i},`${T.type}-${(M=T.index)!=null?M:v}`):null}case"tool_results":{const Ie=T.data,De=T.output_name,ut=g&&De&&Object.prototype.hasOwnProperty.call(p,De)?p[De]:void 0,It=typeof ut=="string"?ut:void 0;if(!It||!De)return d!=null&&d.isDevelopment&&(De?d.warn(`🦜 tool_results "${De}" rendered nothing — no override registered for that key. Register one in the overrides map: { "${De}": "<your-tag-name>" }.`,{registeredKeys:Object.keys(p),payload:Ie}):d.warn("🦜 tool_results block has no output_name — nothing to route on",{payload:Ie})),null;const gt={name:De,payload:Ie,api:m};return A.jsx(Iw,{overrideName:De,children:A.jsx(Wi,{tagName:It,props:gt,label:`toolResult:${De}`})},`${T.type}-${De}-${(we=T.index)!=null?we:v}`)}case"suggestions":return A.jsx(fH,{disabled:o,suggestions:(Le=(Ue=T.data)==null?void 0:Ue.display_text)!=null?Le:[],globalClassName:n,isWidgetStandalone:i,onSuggestionClick:a},`${T.type}-${(ke=T.index)!=null?ke:v}`);default:return null}})})};class Ww extends L.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){_t(!0,"error","Message content threw during render:",t,n.componentStack)}render(){return this.state.hasError?A.jsx("p",{className:H(this.props.globalClassName,`${D}-reset-message`),children:"Oops, I had trouble displaying this response."}):this.props.children}}const hH=({message:e,globalClassName:t,isWidgetStandalone:n})=>{const{logger:r}=it();return TN(e.content)?(r==null||r.debug("Omitting structured user message from transcript",e.content),null):A.jsx("div",{className:H(t,`${D}-message`,n?"standalone":"embedded"),children:A.jsx("div",{className:H(t,`${D}-user-message`,n?"standalone":"embedded"),children:A.jsxs("div",{className:H(t,`${D}-user-message-row`,n?"standalone":"embedded"),children:[A.jsx("span",{className:H(t,`${D}-message-icon user-message-icon`,n?"standalone":"embedded"),children:A.jsx(OI,{})}),A.jsxs("div",{className:H(t,`${D}-user-message-body`,n?"standalone":"embedded"),children:[e.attachmentImageUrl&&A.jsx("img",{src:e.attachmentImageUrl,alt:e.content||"Attachment",className:H(t,`${D}-user-message-image`)}),e.content&&A.jsx("p",{className:H(t,`${D}-user-message-text`,n?"standalone":"embedded"),children:e.content})]})]})})})};function pH(e){switch(e==null?void 0:e.toLowerCase()){case"chatbot":return"chatbot";case"agent":return"human-agent";default:return null}}const mH=({message:e,globalClassName:t,openLinksInNewTab:n,isWidgetStandalone:r})=>{var d;const{logger:i,onNavigate:o}=it(),a=h=>Vi({event:h,openLinksInNewTab:n,onNavigate:o}),l=L.useMemo(()=>{if(typeof e.content!="string")return null;const h=Ba(e.content);if(h)return h;const p=Ul(e.content);return p?{response:[p]}:null},[e.content]),c=L.useMemo(()=>{var g;const h="Oops, I had trouble with your request.";if(typeof e.content!="string")return i==null||i.warn("Message content is not richtext format. Showing fallback text.",e.content),h;const p=e.content.trim();try{const m=JSON.parse(p);if(typeof m=="object"&&m!==null)return i==null||i.debug("Detected JSON object instead of array of responses in message content",e.content),(g=ch(m))!=null?g:h}catch(m){if(p.startsWith("{")||p.startsWith("["))return i==null||i.warn("Failed to parse JSON-like message content. Showing fallback text.",e.content),h}return e.content||h},[i,e.content]);switch(e.role){case"user":return A.jsx(hH,{message:e,globalClassName:t,isWidgetStandalone:r});case"agent":return A.jsx("div",{className:H(t,`${D}-message-group`,pH((d=e.sender)==null?void 0:d.role),r?"standalone":"embedded"),children:A.jsx("div",{className:`${D}-message-group-child`,children:l?A.jsx(Ww,{globalClassName:t,children:A.jsx(qw,{content:l,messageId:e.id,globalClassName:t,openLinksInNewTab:n,isWidgetStandalone:r})}):A.jsx(Xo,{text:c,globalClassName:t,openLinksInNewTab:n,showIsLoading:!1,onLinkClick:a})})});case"system":return A.jsx("div",{className:H(t,`${D}-message`,r?"standalone":"embedded"),children:A.jsx("p",{className:H(t,`${D}-reset-message`),children:e.content})})}},gH=({message:e,onRetry:t,globalClassName:n,isWidgetStandalone:r})=>A.jsxs("div",{className:H(n,`${D}-send-error`,r?"standalone":"embedded"),role:"alert",children:[A.jsx("span",{className:H(n,`${D}-send-error-text`),children:e}),A.jsxs("button",{type:"button",className:H(n,`${D}-retry-button`),onClick:t,children:[A.jsx(DI,{"aria-hidden":"true"})," Retry"]})]}),yH=({globalClassName:e,onClick:t})=>A.jsx("div",{className:H(e,`${D}-jump-to-latest`),children:A.jsx("button",{type:"button",className:H(e,`${D}-jump-to-latest-button`),"aria-label":"Jump to latest message",title:"Jump to latest message",onClick:t,children:A.jsx("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",children:A.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})})}),EH=`${D}-message-container`,bH=24,_H=100,td=e=>{const t=e==null?void 0:e.closest(`.${EH}`);return t instanceof HTMLElement?t:null},Yw=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=bH,vH=()=>typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,TH=(e,t)=>!(e!=null&&e.anchorMessageId)||!t.some(n=>n.id===e.anchorMessageId)?null:e,wH=({autoScroll:e,messages:t,streamingBlocks:n,sendError:r,error:i,isOpen:o,scrollSnapshotRef:a})=>{var ee,$,te;const l=L.useRef(null),c=L.useRef(null),d=L.useRef(!0),h=L.useRef(!1),p=L.useRef(null),g=L.useRef(!1),m=L.useRef(($=(ee=t[t.length-1])==null?void 0:ee.id)!=null?$:null),E=L.useRef(null),S=L.useRef(!1),T=L.useRef(t);if(T.current=t,!S.current){S.current=!0;const Q=a?TH(a.current,t):null;Q&&(d.current=Q.shouldStickToBottom,g.current=Q.hasSentLiveMessage,Q.shouldStickToBottom||(E.current=Q.scrollTop))}const v=L.useRef(e);v.current=e;const w=L.useRef(!1);w.current=n.length>0;const C=L.useRef(!1);C.current=((te=t[t.length-1])==null?void 0:te.restored)===!0;const[R,k]=L.useState(!1),P=L.useCallback((Q="smooth")=>{var Y;const q=(Y=c.current)!=null?Y:td(l.current);if(!q)return;const G=Q==="smooth"&&vH()?"auto":Q;d.current=!0,G==="smooth"&&(h.current=!0),q.scrollTo({top:q.scrollHeight,behavior:G})},[]),I=L.useCallback(()=>{const Q=c.current;if(!Q||Q.clientHeight===0){Q||k(!1);return}k(!Yw(Q))},[]),U=L.useCallback(()=>{const Q=c.current;if(!Q){d.current=!0,k(!1);return}Q.clientHeight!==0&&(d.current=Yw(Q),I())},[I]);return L.useLayoutEffect(()=>{const Q=E.current;if(Q==null)return;const q=td(l.current);c.current=q,q&&(q.scrollTop=Q,d.current=!1,k(!0))},[]),L.useLayoutEffect(()=>{const Q=l.current;return()=>{var Y,ce,ne,J;if(!a)return;const q=(Y=c.current)!=null?Y:td(Q),G=T.current;a.current={scrollTop:(ce=q==null?void 0:q.scrollTop)!=null?ce:0,shouldStickToBottom:d.current,hasSentLiveMessage:g.current,anchorMessageId:(J=(ne=G[G.length-1])==null?void 0:ne.id)!=null?J:null}}},[a]),L.useEffect(()=>{const Q=td(l.current);if(c.current=Q,I(),!Q)return;const q=()=>{p.current&&(clearTimeout(p.current),p.current=null)},G=()=>{q(),h.current=!1,U()},Y=()=>{if(!h.current){U();return}q(),p.current=setTimeout(G,_H)},ce=()=>{q(),h.current=!1};Q.addEventListener("scroll",Y,{passive:!0}),Q.addEventListener("scrollend",G),Q.addEventListener("wheel",ce,{passive:!0}),Q.addEventListener("touchstart",ce,{passive:!0});const ne=()=>{if(h.current)return;const O=g.current,B=!O,re=d.current,M=C.current,we=v.current,Ue=w.current;if(re&&(we||M||B)){P(Ue&&O?"smooth":"auto");return}U()},J=new ResizeObserver(ne);J.observe(Q),l.current&&J.observe(l.current);const ae=new MutationObserver(ne);return ae.observe(Q,{childList:!0,subtree:!0}),()=>{q(),Q.removeEventListener("scroll",Y),Q.removeEventListener("scrollend",G),Q.removeEventListener("wheel",ce),Q.removeEventListener("touchstart",ce),J.disconnect(),ae.disconnect()}},[P,I,U]),L.useEffect(()=>{E.current==null&&P("auto")},[P]),L.useEffect(()=>{o&&E.current==null&&P("auto")},[o,P]),L.useEffect(()=>{var B;const Q=t[t.length-1],q=(B=Q==null?void 0:Q.id)!=null?B:null,G=q!==m.current;m.current=q;const Y=(Q==null?void 0:Q.restored)===!0,ce=(Q==null?void 0:Q.role)==="user"&&!Y;ce&&(g.current=!0);const ne=d.current,J=t.length>0,ae=!g.current&&J;if(ne&&(e||Y||ae)){P(Y||ae?"auto":"smooth");return}if(G&&ce){P("smooth");return}U()},[t,e,P,U]),L.useEffect(()=>{if(e&&d.current){P(g.current?"smooth":"auto");return}U()},[n,r,i,e,P,U]),{endRef:l,showJumpToLatest:R,scrollToLatest:P}},xH=4e3,Gw=e=>(typeof e=="string"?e:"").replace(/<[^>]*>/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[`*_~#>|]+/g," ").replace(/\s+/g," ").trim().slice(0,xH),Cu="Assistant response available",SH=e=>{if(typeof e!="object"||e===null)return"";const t=e;if(t.type!=="product_carousel"||typeof t.data!="object"||t.data===null)return"";const n=t.data.products;if(!Array.isArray(n))return"";if(n.length===0)return"No products found.";const r=n.map(l=>{if(typeof l!="object"||l===null||Array.isArray(l))return"";const c=l,d=typeof c.data=="object"&&c.data!==null&&!Array.isArray(c.data)?c.data:null,h=typeof(d==null?void 0:d.name)=="string"?d.name.trim():"",p=typeof c.id=="string"?c.id.trim():"";return h||p}).filter(Boolean),i=n.length===1?"1 product found.":`${n.length} products found.`;if(r.length===0)return i;const o=n.length===1?"Product title":"Product titles",a=`${i} ${o}: ${r.join("; ")}`;return/[.!?]$/.test(a)?a:`${a}.`},AH=e=>{var o,a;if(typeof e!="string")return Cu;const t=Ba(e),n=t?null:Ul(e),r=(o=t==null?void 0:t.response)!=null?o:n?[n]:null;if(r)return r.map(c=>c.type==="markdown"?Gw(c.data.content):SH(c)).filter(Boolean).join(" ").trim()||Cu;const i=e.trim();try{const l=JSON.parse(i);if(typeof l=="object"&&l!==null)return(a=ch(l))!=null?a:Cu}catch(l){if(i.startsWith("{")||i.startsWith("["))return Cu}return Gw(e)||Cu},CH=({message:e,announcementKey:t})=>{const[n,r]=L.useState("");return L.useEffect(()=>{if(r(""),!e)return;const i=setTimeout(()=>r(e),100),o=setTimeout(()=>r(""),1e4);return()=>{clearTimeout(i),clearTimeout(o)}},[e,t]),A.jsx("span",{className:`${D}-visually-hidden`,role:"status","aria-atomic":"true",children:n})},kH=()=>{const{messages:e}=Vt(),t=[...e].reverse().find(n=>n.role==="agent"&&!n.restored);return A.jsx(CH,{message:t?AH(t.content):"",announcementKey:t==null?void 0:t.id})},OH="You are offline or we couldn't reach the assistant. Check connection and try again.",Wm=({isWidgetStandalone:e,isOpen:t,scrollSnapshotRef:n})=>{var G,Y;const{globalClassName:r,openLinksInNewTab:i,logger:o,autoScroll:a}=it(),{messages:l,streamingBlocks:c,isAgentTyping:d,loading:h,progressMessage:p,connectionStatus:g,error:m,sendError:E,retryLastMessage:S,retryConnection:T}=Vt(),{endRef:v,showJumpToLatest:w,scrollToLatest:C}=wH({autoScroll:a,messages:l,streamingBlocks:c,sendError:E,error:m,isOpen:t,scrollSnapshotRef:n}),R=l.length>0,k=c.some(I3),P=l[l.length-1],I=P?C1(P.content,"suggestions"):!1,U=R&&(h||d)&&!k&&!I,ee=g==="reconnecting"&&!U,$=g==="error";let te=null;$?te={message:m!=null?m:OH,kind:"connection",onRetry:T}:E&&(te={message:E.message,kind:"send",onRetry:S});const Q=(G=te==null?void 0:te.message)!=null?G:null,q=(Y=te==null?void 0:te.kind)!=null?Y:null;return L.useEffect(()=>{Q&&(o==null||o.error("Error message shown to user",{message:Q,kind:q}))},[Q,q,o]),A.jsxs(A.Fragment,{children:[A.jsx(kH,{}),h&&!R&&A.jsx(o7,{globalClassName:r,isWidgetStandalone:e}),l.map(ce=>A.jsx(mH,{message:ce,globalClassName:r,openLinksInNewTab:i,isWidgetStandalone:e},ce.id)),te&&A.jsx(gH,{message:te.message,onRetry:te.onRetry,globalClassName:r,isWidgetStandalone:e}),k&&A.jsxs("div",{className:H(r,`${D}-message-group`,e?"standalone":"embedded"),children:[A.jsx(Ww,{globalClassName:r,children:A.jsx(qw,{content:{response:c},globalClassName:r,openLinksInNewTab:i,isWidgetStandalone:e})}),(h||d)&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e})]}),U&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e,loadingText:p}),ee&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e,loadingText:"Reconnecting..."}),w&&A.jsx(yH,{globalClassName:r,onClick:()=>C()}),A.jsx("div",{ref:v,"aria-hidden":"true"})]})},NH=()=>A.jsxs("svg",{"aria-hidden":"true",className:`${D}-progress-step-check`,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),A.jsx("path",{d:"M5 8.5L7 10.5L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),IH=()=>A.jsx("svg",{"aria-hidden":"true",className:`${D}-progress-step-starburst`,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:A.jsx("path",{d:"M8 1v3M8 12v3M1 8h3M12 8h3M3.05 3.05l2.12 2.12M10.83 10.83l2.12 2.12M3.05 12.95l2.12-2.12M10.83 5.17l2.12-2.12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),PH=(e,t)=>e===0?[]:e<0?t:t.slice(-e),Ym=({progressStepsLimit:e,steps:t,globalClassName:n})=>{const{progressStepsLimit:r}=it(),i=e!=null?e:r,{overrides:o,isInitialized:a}=qi(),l=zs();if(t.length===0||i===0)return null;const c=PH(i,t),d=a?o.ProgressSteps:void 0;if(d){const h={name:"ProgressSteps",payload:{steps:c},api:l};return A.jsx(Wi,{tagName:d,props:h,label:"ProgressSteps"})}return A.jsx("div",{className:H(n,`${D}-progress-steps-panel`),children:A.jsx("div",{className:`${D}-progress-steps`,children:A.jsx("ul",{className:`${D}-progress-steps-list`,children:c.map((h,p)=>{const g=p<c.length-1,m=p===c.length-1;return A.jsxs("li",{className:H(`${D}-progress-step`,m&&"active"),"aria-label":`${h} (${g?"completed":"in progress"})`,children:[m&&A.jsx("span",{className:`${D}-progress-step-arc`}),A.jsx("span",{className:`${D}-progress-step-text`,children:h}),A.jsx("span",{className:H(`${D}-progress-step-icon`,g?"done":"active"),children:g?A.jsx(NH,{}):A.jsx(IH,{})})]},`${p}-${h}`)})})})})},Xw=()=>{const{globalClassName:e,themeVariables:t,messageAlignment:n,enableDownloadTranscript:r}=it(),{isAgentTyping:i,resetConversation:o,endConversation:a,progressSteps:l,downloadTranscript:c}=Vt(),d=Gc(),h=Rm(),p=i,g=m=>m.file?h(m):d(m.text);return A.jsxs("div",{className:H(e,`${D}-container`,`${D}-embedded-chat`),style:t,children:[A.jsx("div",{className:H(e,`${D}-message-container`,`container-${n}`,"embedded"),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:!1})}),A.jsx(Ym,{steps:l,globalClassName:e}),A.jsx(Rp,{componentType:"chat",className:"embedded-chat",isLoading:p,onSubmit:g}),A.jsx("div",{className:H(`${D}-embedded-chat-menu`),children:A.jsxs(nB,{componentType:"chat",children:[A.jsx(ew,{componentType:"chat"}),A.jsx(av,{componentType:"chat",onClearChat:o}),A.jsx(lv,{componentType:"chat",onEndConversation:a}),r&&A.jsx(uv,{componentType:"chat",onDownloadTranscript:c})]})})]})},Kw=e=>{var c;const{children:t,disabled:n}=e,[r,i]=L.useState((c=e.container)==null?void 0:c.current),o=L.useSyncExternalStore(LH,()=>!1,()=>!0),{getRootNode:a}=zc();if(L.useEffect(()=>{i(()=>{var d;return(d=e.container)==null?void 0:d.current})},[e.container]),o||n)return A.jsx(A.Fragment,{children:t});const l=r!=null?r:RH(a);return A.jsx(A.Fragment,{children:L.Children.map(t,d=>bo.createPortal(d,l))})},RH=e=>{const t=e==null?void 0:e(),n=t.getRootNode();return Ls(n)?n:Yr(t).body},LH=()=>()=>{},Qw=({scrollSnapshotRef:e})=>{const{globalClassName:t,themeVariables:n,messageAlignment:r}=it(),{mode:i,status:o,dialogPosition:a,isDialogFullHeight:l,dialogWidth:c}=Hr(),{loading:d,isAgentTyping:h,resetConversation:p,endConversation:g,progressSteps:m,downloadTranscript:E}=Vt(),S=Gc(),T=Rm(),{isOpen:v}=o||{},w=!!o.isOpen,C=i==="standalone",R=h||d,k=()=>{oi(!1),Fh()},P=I=>I.file?T(I):S(I.text);return w?A.jsx(YT,{lazyMount:!0,unmountOnExit:!0,modal:!1,closeOnEscape:!1,closeOnInteractOutside:!1,open:w,initialFocusEl:Mh,children:A.jsx(Kw,{children:A.jsx(Am,{className:H(t,`${D}-container`,`${D}-dialog`,a,l&&"full-height"),style:z(z({},n),c&&{width:c}),children:A.jsxs(xm,{className:H(t,`${D}-dialog-content`,{standalone:C,embedded:!C}),children:[A.jsx(JT,{componentType:"dialog",onClearChat:p,onEndConversation:g,onClose:k,onDownloadTranscript:E}),A.jsx(Sm,{className:H(t,`${D}-message-container`,`container-${r}`,{standalone:C,embedded:!C}),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:C,isOpen:v,scrollSnapshotRef:e})}),A.jsx(Ym,{steps:m,globalClassName:t}),A.jsx(Rp,{componentType:"dialog",isLoading:R,onSubmit:P})]})})})}):null},Jw=({scrollSnapshotRef:e})=>{const{globalClassName:t,themeVariables:n,messageAlignment:r}=it(),{mode:i,status:o,isModalFullscreen:a}=Hr(),{loading:l,isAgentTyping:c,resetConversation:d,endConversation:h,progressSteps:p,downloadTranscript:g}=Vt(),m=Gc(),E=Rm(),{isOpen:S}=o||{},T=!!o.isOpen,v=i==="standalone",w=c||l,C=({open:P})=>{if(P){oi(!0);return}R()},R=()=>{oi(!1),Fh()},k=P=>P.file?E(P):m(P.text);return T?A.jsx(YT,{lazyMount:!0,unmountOnExit:!0,open:T,onOpenChange:C,initialFocusEl:Mh,children:A.jsx(Kw,{children:A.jsxs("div",{className:H(t,`${D}-modal-container`),style:n,children:[A.jsx($T,{className:H(t,`${D}-modal-backdrop`)}),A.jsx(Am,{className:H(t,`${D}-container`,`${D}-modal`,{fullscreen:a,standalone:v,embedded:!v}),children:A.jsxs(xm,{className:H(t,`${D}-modal-content`,{standalone:v,embedded:!v}),children:[A.jsx(JT,{componentType:"modal",onClearChat:d,onEndConversation:h,onClose:R,onDownloadTranscript:g}),A.jsx(Sm,{className:H(t,`${D}-message-container`,`container-${r}`,{standalone:v,embedded:!v}),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:v,isOpen:S,scrollSnapshotRef:e})}),A.jsx(Ym,{steps:p,globalClassName:t}),A.jsx(Rp,{componentType:"modal",isLoading:w,onSubmit:k})]})})]})})}):null},DH=()=>{const e=Hr(),t=L.useRef(null),{status:{type:n,isMinimized:r}}=e||{status:{}};return r?A.jsx(SI,{}):n==="dialog"?A.jsx(Qw,{scrollSnapshotRef:t}):n==="modal"?A.jsx(Jw,{scrollSnapshotRef:t}):A.jsx(Xw,{})},MH=()=>{const{setIsOpen:e,setIsInline:t,setElementId:n,setEntryType:r,setParams:i}=YB();L.useEffect(()=>{const o=a=>{const{property:l,value:c}=a.detail||{};!l||c===void 0||(l==="isOpen"&&e(c),l==="isInline"&&t(c),l==="elementId"&&n(c),l==="entryType"&&r(c),l==="params"&&i(c))};return jB(o),()=>{HB(o)}},[e,t,n,r,i])},Zw=(e,t,n)=>{n!==void 0?e(t,n):e(t)};function FH({isReady:e,hasError:t,transmit:n}){const r=L.useRef([]),i=L.useRef(e);i.current=e;const o=L.useRef(n);o.current=n;const a=L.useCallback((l,c)=>{i.current?Zw(o.current,l,c):r.current.push({prompt:l,options:c})},[]);return L.useEffect(()=>{if(e&&r.current.length){const l=r.current;r.current=[],l.forEach(({prompt:c,options:d})=>Zw(o.current,c,d))}},[e]),L.useEffect(()=>{t&&(r.current=[])},[t]),a}const ex={copilot:"Ask Copilot",messaging:"Ask a question"},BH=({onSubmit:e,disabled:t=!1})=>{const{globalClassName:n,mode:r}=it(),{placeholder:i,isResponseLoading:o}=Wc(),a=i||ex[r],[l,c]=L.useState(""),d=t||o,h=p=>{const g=l.trim();g&&(p.preventDefault(),e(g),c(""))};return A.jsxs("form",{className:H(n,`${D}-prompts-input-container`),name:`${D}-prompts-form`,onSubmit:h,children:[A.jsx("label",{htmlFor:`${D}-prompts-input`,"aria-label":a,children:A.jsx(mm,{className:H(n,`${D}-prompts-input-icon`)})}),A.jsx("input",{id:`${D}-prompts-input`,className:H(n,`${D}-prompts-input`),name:`${D}-prompts-input`,placeholder:a,type:"text",disabled:d,value:l,onChange:p=>c(p.target.value)}),A.jsx(wr,{className:H(n,`${D}-prompts-input-submit-button`),type:"submit",ariaLabel:"Submit Prompt",icon:A.jsx(Bh,{}),disabled:d})]})},UH=()=>{const{globalClassName:e,mode:t}=it(),{placeholder:n}=Wc(),r=n||ex[t];return A.jsxs("div",{className:H(e,`${D}-prompts-header`),children:[A.jsx(mm,{className:H(e,`${D}-prompts-input-icon`),"aria-hidden":"true"}),A.jsx("span",{className:H(e,`${D}-prompts-header-text`),children:r})]})},tx=({label:e,disabled:t=!1,onClick:n})=>{var l;const{globalClassName:r,suggestionButtonConfig:i}=it(),o=i==null?void 0:i.icon,a=(l=i==null?void 0:i.iconPosition)!=null?l:"left";return A.jsxs("button",{className:H(r,`${D}-prompts-button`,{"has-icon":!!o,"icon-right":!!o&&a==="right"}),disabled:t,onClick:n,children:[o&&A.jsx(ZT,{icon:o,className:`${D}-suggestion-button-icon`}),A.jsx("span",{children:e})]})},jH="Ask me something else",HH=({label:e,disabled:t=!1})=>A.jsx(tx,{label:e||jH,disabled:t,onClick:()=>oi(!0)}),$H=({onPromptClick:e,disabled:t=!1})=>{const{globalClassName:n}=it(),{staticQuestions:r,askElseButtonLabel:i,disableAskElseButton:o}=Wc();if(!(r!=null&&r.length))return null;const a=l=>()=>{const c=l.trim();c&&e(c)};return A.jsxs("div",{className:H(n,`${D}-prompts-button-group`),children:[r.map(l=>A.jsx(tx,{label:l,disabled:t,onClick:a(l)},l)),!o&&A.jsx(HH,{label:i,disabled:t})]})},zH=()=>{const{globalClassName:e,themeVariables:t,enablePageContext:n}=it(),{isOpen:r,elementId:i,promptsDisplay:o}=Wc(),{isConnected:a,sessionExpired:l,sendMessage:c,connectionStatus:d}=Vt(),{productId:h}=Nm(),p=o!=="buttons",g=o!=="input",[m,E]=L.useState(null),S=d==="error",T=d==="connecting",v=V1(a,l),w=FH({isReady:v,hasError:S,transmit:c});L.useEffect(()=>{if(!i||m)return;const R=document.getElementById(i);R&&E(R)},[i,m]);const C=L.useCallback(R=>{if(oi(!0),n){w(R);return}const{prompt:k,display:P}=Th(R,h);if(P&&P.length>0){w(k,{displayContent:P});return}w(k)},[w,h,n]);return!r||!m?null:bo.createPortal(A.jsxs("div",{className:H(e,`${D}-prompts-extension-container`),style:t,children:[p&&A.jsx(BH,{onSubmit:C,disabled:S}),!p&&A.jsx(UH,{}),g&&A.jsx($H,{onPromptClick:C,disabled:S}),!S&&T&&A.jsx("p",{className:H(e,`${D}-prompts-connecting-message`),children:"Connecting to agent..."}),S&&A.jsx("p",{className:H(e,`${D}-prompts-error-message`),children:"Oops, an error occurred with our agent."})]}),m)},VH=()=>(MH(),A.jsx(zH,{})),nx=e=>A.jsxs(fE,pe(z({},e),{children:[A.jsx(DH,{}),A.jsx(VH,{})]}));function rx(e,t){return Ne(this,null,function*(){return G1().sendMessage(e,t)})}const qH={components:{setEntryType:Sl,toggleWidgetOpen:oi,toggleWidgetMinimized:fo,toggleModalFullscreen:Ff,setWidgetType:Al,setWidgetDialogPosition:Bf,loadPromptsComponent:VB,togglePromptsExtensionOpen:QT},session:{resetConversation:qB,endConversation:WB,sendMessage:rx},pageContext:{set:jf,get:Uf,clear:vy}};var nd={},ix;function WH(){if(ix)return nd;ix=1;var e=yE();return nd.createRoot=e.createRoot,nd.hydrateRoot=e.hydrateRoot,nd}var YH=WH();const sx=new WeakMap,ox=(e,t,n,r)=>{var o;(o=sx.get(e))==null||o.unmount();const i=YH.createRoot(e);sx.set(e,i),i.render(A.jsx(nx,pe(z({},t),{overridesUrl:n,inlineOverrides:r,mode:"messaging"})))},GH=o=>{var a=o,{elementId:e,timeout:t=5e3,overridesUrl:n,inlineOverrides:r}=a,i=bn(a,["elementId","timeout","overridesUrl","inlineOverrides"]);let l;const c=(h,p)=>{for(const g of h)if(g.type==="childList"&&g.addedNodes.length)for(const m of g.addedNodes)m.nodeType===Node.ELEMENT_NODE&&m.id===e&&(_t(!0,"log","Target element found, rendering Messaging Widget"),p.disconnect(),clearTimeout(l),ox(m,i,n,r))},d=new MutationObserver(c);return d.observe(document.body,{childList:!0,subtree:!0}),l=setTimeout(()=>{d.disconnect(),_t(!0,"error",`Element with id: ${e} not found within ${t} milliseconds, stopping observation`)},t),d},XH=o=>{var a=o,{timeout:e,elementId:t,overridesUrl:n,overrides:r}=a,i=bn(a,["timeout","elementId","overridesUrl","overrides"]);if(!i.messagingConfig){_t(!0,"error","Messaging Widget requires messagingConfig");return}if(!i.messagingConfig.scrt2Url||!i.messagingConfig.orgId||!i.messagingConfig.esDeveloperName){_t(!0,"error","Messaging Widget requires messagingConfig.scrt2Url, messagingConfig.orgId, and messagingConfig.esDeveloperName");return}const l=document.getElementById(t);if(!l){_t(!0,"warn","Container element not found for id:",t),_t(!0,"warn","Beginning observation for element"),GH(z({elementId:t,timeout:e,overridesUrl:n,inlineOverrides:r},i));return}ox(l,i,n,r)};function KH(){return Ne(this,null,function*(){return G1().getAuthLinkKey()})}class QH extends HTMLElement{constructor(){super(...arguments);Ze(this,"_props",null)}set props(n){this._props=n,this.render()}get props(){return this._props}connectedCallback(){this.render()}render(){}}const JH={namespace:"sf.instrumentation",name:"PayloadDiags",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{PayloadDiags:{fields:{extras:{rule:"repeated",id:1,type:"string"}}}}}}}}}},ZH={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{IdleDetectorReport:{fields:{listenerCount:{id:3,type:"uint32"},busyTasks:{rule:"repeated",id:5,type:"string"},busyDurations:{rule:"repeated",id:6,type:"double"},pollableCount:{id:4,type:"uint32"},pollCounts:{rule:"repeated",id:8,type:"double"},logThreshold:{id:2,type:"double"},maxDuration:{id:1,type:"double"},pollables:{rule:"repeated",id:7,type:"string"}}}}}}}}}},e$={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{reserved:[[6,6],[7,7],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22]],fields:{cancelable:{id:5,type:"bool"},ctrlKey:{id:9,type:"bool"},type:{id:25,type:"string"},button:{id:3,type:"uint32"},offsetX:{id:30,type:"double"},eventPhase:{id:12,type:"uint32"},shiftKey:{id:23,type:"bool"},offsetY:{id:31,type:"double"},composed:{id:8,type:"bool"},altKey:{id:1,type:"bool"},isTrusted:{id:13,type:"bool"},buttons:{id:4,type:"uint32"},movementY:{id:29,type:"double"},clientY:{id:27,type:"double"},clientX:{id:26,type:"double"},movementX:{id:28,type:"double"},defaultPrevented:{id:10,type:"bool"},metaKey:{id:14,type:"bool"},timeStamp:{id:24,type:"double"},bubbles:{id:2,type:"bool"},detail:{id:11,type:"int64"},pageY:{id:33,type:"double"},pageX:{id:32,type:"double"},screenX:{id:34,type:"double"},screenY:{id:35,type:"double"}}},Event:{fields:{type:{id:1,type:"string"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent","baseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{id:7,type:"MouseEvent"},auto:{id:3,type:"bool"},parentComponent:{id:2,type:"string"},baseEvent:{id:10,type:"Event"},ownerComponent:{id:1,type:"string"},userPayload:{id:5,type:"Payload"},simplePath:{id:9,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},t$={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},n$={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{stopReason:{id:6,type:"string"},externalParentId:{id:17,type:"string"},isRoot:{id:8,type:"bool"},isExternal:{id:16,type:"bool"},isSampled:{id:11,type:"bool"},preRootId:{id:9,type:"string"},parentId:{id:13,type:"string"},duration:{id:3,type:"double"},timerOverridden:{id:12,type:"uint32"},isRerooted:{id:15,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},traceIdSource:{id:14,type:"string"},id:{id:1,type:"string"},userPayload:{id:4,type:"Payload"},errorCount:{id:10,type:"uint32"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},r$={pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{rule:"repeated",id:2,type:"LogMessage"},schemaName:{id:1,type:"string"}}},Metrics:{fields:{globalMetricTags:{rule:"repeated",id:4,type:"MetricTag"},bucketHistograms:{rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{id:6,type:"string"},generatedTimestamp:{id:2,type:"double"},bundleCount:{id:3,type:"uint32"},upCounterCount:{id:4,type:"uint32"},valueRecorderCount:{id:5,type:"uint32"},key:{id:1,type:"string"},bucketHistogramCount:{id:7,type:"uint32"}}},LogMessage:{fields:{data:{id:2,type:"bytes"},rootId:{id:4,type:"string"},csId:{id:12,type:"string"},recCsId:{id:13,type:"string"},pagePayload:{id:7,type:"Payload"},connectionType:{id:9,type:"string"},appPayload:{id:10,type:"Payload"},tenantClass:{id:15,type:"string"},loggerAppName:{id:8,type:"string"},sseq:{id:11,type:"uint32"},recRootId:{id:14,type:"string"},loggerName:{id:6,type:"string"},age:{id:3,type:"double"},seq:{id:5,type:"uint32"},timestamp:{id:1,type:"double"}}},CoreEnvelope:{fields:{diagnostics:{id:1,type:"CoreEnvelopeDiagnostics"},bundles:{rule:"repeated",id:2,type:"MessageBundle"},metrics:{id:3,type:"Metrics"},staticAttributes:{id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{id:1,type:"string"},value:{id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:7,type:"string"},ownerAppName:{id:8,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},buckets:{rule:"repeated",id:5,type:"uint32"},name:{id:1,type:"string"},tags:{rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},name:{id:1,type:"string"},tags:{rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{id:2,type:"string"},appName:{id:1,type:"string"},deviceModel:{id:5,type:"string"},sdkVersion:{id:6,type:"string"},deviceId:{id:4,type:"string"},appExperience:{id:3,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},name:{id:1,type:"string"},value:{id:4,type:"uint32"},tags:{rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},ax={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},i$={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{id:6,type:"string"},stack:{id:3,type:"string"},name:{id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{id:4,type:"Payload"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}};class ku{constructor(){this.notImplemented="Method not implemented.";const t=typeof performance!="undefined";t?performance.timeOrigin?this._timeOrigin=performance.timeOrigin:this._timeOrigin=Date.now():this._timeOrigin=Date.now();const n=this._timeOrigin;t&&typeof performance.now=="function"?(this.perfNow=performance.now.bind(performance),this.time=()=>{const r=this.perfNow();return{tsNow:n+r,perfNow:r,timeOrigin:n}}):(this.perfNow=()=>Date.now()-n,this.time=()=>{const r=this.perfNow();return{tsNow:Date.now(),perfNow:r,timeOrigin:n}})}get isProduction(){return ku._isProduction}markProduction(t){ku._isProduction=t!=null?t:!0}_checkArgument(t,n){if(typeof n=="string")return typeof t===n;if(typeof n=="function")return t instanceof n;if(Array.isArray(n))return n.some(r=>this._checkArgument(t,r));throw new Error(`Invalid argKind ${n}`)}requireArgument(t,n,r){let i=t==null||t==="";const o=r!==void 0;if(!i&&o&&(i=!this._checkArgument(t,r)),i)throw new Error(`${n} argument is required${o?" and must be of a supported type.":"."}`)}requireArgumentIfDefined(t,n,r){if(t===void 0)return!1;if(t===null||t===""||!this._checkArgument(t,r))throw new Error(`${n} argument, if defined, must be of a supported type.`);return!0}checkForDenyListedValues(t,n,r){if(r.some(i=>t===i))throw new Error(`The value ${t} isn't allowed for ${n} argument.`)}checkForReservedCharacters(t,n,r){if(t&&r.some(i=>t.indexOf(i)>=0))throw new Error(`The argument ${n} isn't allowed to contain characters from ['${r.join(", ")}']. Received: ${t}.`)}generateUniqueId(t=16){const n=[],r="0123456789abcdef";if(!(t===void 0||t>0))throw new Error('If specified, the argument "length" must be a positive integer');for(let i=0;i<t;i++){const o=Math.floor(Math.random()*16);n.push(r[o])}return n.join("")}getXpath(t){function n(o){const a=o.localName;for(;o.nextElementSibling;)if(o=o.nextElementSibling,o.localName===a)return!0;return!1}function r(o,a){return o?r(o.previousElementSibling,a||o.localName)+(o.localName===a?1:0):1}function i(o){if(!o||o.nodeType!==1)return[""];const a=r(o)>1||n(o)?`${o.localName.toLowerCase()}[${r(o)}]`:o.localName.toLowerCase();return[...i(o.parentNode),a]}return i(t).join("/")}getAge(t){return t-this._timeOrigin}_getNavigatorSafe(){try{return typeof navigator!="undefined"?navigator:void 0}catch(t){return}}_hasEffectiveConnectionType(t){if(typeof t!="object"||t===null||!("connection"in t))return!1;const n=t.connection;return typeof n=="object"&&n!==null&&"effectiveType"in n&&typeof n.effectiveType=="string"}getConnectionType(){const t=this._getNavigatorSafe();return this._hasEffectiveConnectionType(t)?t.connection.effectiveType:void 0}clone(t){return JSON.parse(JSON.stringify(t))}definedValueOrDefault(t,n){return t!==void 0?t:n}getGlobal(){if(typeof globalThis=="object")return globalThis;if(typeof self=="object")return self;throw new Error("Unable to locate globalThis or self")}getIsBeaconSupported(){const t=this.getGlobal(),n=this._getNavigatorSafe();return typeof(n==null?void 0:n.sendBeacon)=="function"&&typeof t.Blob=="function"}estimateObjectSize(t){const n=new Set,r=[t];let i=0;for(;r.length;){const o=r.pop();if(typeof o=="boolean")i+=4;else if(typeof o=="string")i+=o.length*2;else if(typeof o=="number")i+=8;else if(o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Uint16Array||o instanceof Uint32Array||o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array||o instanceof Float32Array||o instanceof Float64Array)i+=o.byteLength;else if(typeof o=="object"){const a=o;if(!n.has(a)){n.add(a);for(const l in a)r.push(a[l])}}}return i}noProdThrow(t){if(!le.isProduction)throw t}isAllowedOrigin(t,n){return Array.isArray(n)&&n.some(r=>r==="*"||t===r||r instanceof RegExp&&r.test(t))}roundNumber(t,n){const r=Math.pow(10,n);return Math.round(t*r)/r}roundNumbersInObject(t,n){t&&Object.entries(t).forEach(([r,i])=>{typeof i=="number"&&(t[r]=this.roundNumber(i,n))})}tryGetAbsoluteUrl(t){var n,r;return t!=null&&t.startsWith("//")&&typeof window=="object"?((n=window.location.protocol)!==null&&n!==void 0?n:"")+t:t!=null&&t.startsWith("/")&&typeof window=="object"?((r=window.location.origin)!==null&&r!==void 0?r:"")+t:t}validateParentActivityType(t,n){const r=t!=null?t:!1;if(!n)return;const i=n.isExternal();if(r===i)return n;{const o=r?"external":"internal",a=i?"external":"internal";throw new Error(`Parent activity type mismatch: ${o} activity cannot have ${a} parent.`)}}}ku._isProduction=!0;const Gm=new ku,Xm=Gm.getGlobal();Gm.markProduction(Xm==null?void 0:Xm.__O11Y_IS_PROD__);const le=Object.freeze(Gm);class Km{constructor(t,n,r,i,o,a,l){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._value=0,this._createdOn=o===void 0?le.time().tsNow:o,a!==void 0&&(this._lastUpdatedOn=a),l!==void 0&&(this._value=l)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(t=1){if(typeof t=="number"&&t>0){this._value+=Math.round(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}const s$="co11y";class o${constructor(){this._upCounters=new Map,this._ownerAppName=s$}_addOrUpdateCounter(t,n,r){if(!t)return;const i={status:r},o=`${this._ownerAppName}:${n}:${t}${JSON.stringify(i)}`;let a=this._upCounters.get(o);a||(a=new Km(t,n,this._ownerAppName,i),this._upCounters.set(o,a)),a.increment()}success(t,n){this._addOrUpdateCounter(t,n,"success")}exception(t,n){this._addOrUpdateCounter(t,n,"error")}getBucketHistograms(){return[]}getUpCounters(){return Array.from(this._upCounters.values()).filter(t=>t.getLastUpdatedOn())}getValueRecorders(){return[]}setOwnerAppName(t){this._ownerAppName=t}}const Ko=new o$;class a${constructor(t){if(this._lazyMap=new Map,t!==void 0){if(typeof t=="number"&&t>0){this._maxSize=Math.ceil(t);return}throw new Error("maxSize must be a positive number")}}get maxSize(){return this._maxSize}get size(){return this._lazyMap.size}push(t,n){let r=this._lazyMap.get(t);if(!r){if(this.maxSize!==void 0&&this.size===this.maxSize)return!1;r=new Array,this._lazyMap.set(t,r)}return r.push(n),!0}getMessages(t,n){const r=this._lazyMap.get(t);return n&&this._lazyMap.has(t)&&this._lazyMap.set(t,[]),r||[]}getAllMessages(t){const n=new Map;for(const[r,i]of this._lazyMap.entries())i.length&&n.set(r,this.getMessages(r,t));return n}extractMessages(t){return this.getMessages(t,!0)}extractAllMessages(){return this.getAllMessages(!0)}get totalItemCount(){let t=0;for(const n of this._lazyMap.values())t+=n.length;return t}}class u${getSchemaId(t){return`${t.namespace}.${t.name}`}isInternal(t){return(t==null?void 0:t.namespace)==="sf.instrumentation"}makePayload(t,n,r=!0){if(!r||t!==void 0&&n!==void 0)return{schema:t,payload:n}}checkSchema(t){return le.requireArgument(t,"schema","object"),le.requireArgument(t.namespace,"schema.namespace","string"),le.requireArgument(t.name,"schema.name","string"),le.requireArgument(t.pbjsSchema,"schema.pbjsSchema","object"),this._getTokens(t)}_getTokens(t){const n=t.namespace.split(".");if(n.length!==2)throw new Error(`Schema "${this.getSchemaId(t)}" must have a namespace of the form "domain.feature".`);return{domain:n[0],feature:n[1],message:t.name}}_getAnyNestedObject(t,n){return n.reduce((r,i)=>{const o=r.nested;if(o){const a=o[i];if(a)return a}throw new Error(`Cannot locate ${n.join(".")} in schema with ID ${this.getSchemaId(t)}`)},t.pbjsSchema)}getTypes(t){const n=this.checkSchema(t),i=this._getAnyNestedObject(t,[n.domain,n.feature]).nested;if(!i)throw new Error(`Cannot parse schema with ID ${this.getSchemaId(t)}`);return i}getType(t,n){le.requireArgument(n,"messageName","string");const i=this.getTypes(t)[n];if(!i)throw new Error(`Cannot locate message ${n} in schema with ID ${this.getSchemaId(t)}`);return i}getOptions(t,n,r){r&&le.requireArgument(n,"messageName","string");const i=this.checkSchema(t);if(!n)return this._getAnyNestedObject(t,[i.domain,i.feature]).options;const o=this.getType(t,n);if(!r)return o.options;const a=o.fields[r];if(!a){const l=this.getSchemaId(t);throw new Error(`Cannot locate field ${r} in message ${n} in schema with ID ${l}`)}return a.options}getExtraFields(t,n){const{message:r}=this._getTokens(t),o=this.getTypes(t)[r].fields,a=new Set(Object.keys(o));return n!=null?Object.keys(n).filter(c=>!a.has(c)):[]}}const Nt=new u$,Qm=1e4,ux=1e4,lx=0,l$=2147483647,c$=-2147483648,d$=4294967295,f$=9223372036854776e3,h$=-9223372036854776e3,p$=18446744073709552e3;class cx{constructor(t,n,r,i){this.errorCode=t,this.fields=n,this.expected=r,this.received=i}asMessage(t){const n=this.fields[0]+this.fields.slice(1).reduce((i,o)=>Number(o)>=0?`${i}[${o}]`:`${i}.${o}`,"");let r;switch(this.errorCode){case 1:r="Repeated field must be an array";break;case 2:r=`Expected type ${this.expected} but received type ${this.received}`;break;case 3:r="Value must be finite";break;case 4:r="Value is out of range for its type";break;case 5:r="Bytes array is malformed";break;case 6:r="Exceeded app limit for maximum string length";break;case 7:r="Exceeded app limit for item count";break;case 12:r="Value must be an integer";break;case 13:r="Values like null or undefined are not allowed for items in repeated fields";break;default:r=`Unknown error code: ${this.errorCode}`;break}return`Schema ${t} on field "${n}": ${r}`}}class m${validate(t,n,r=!1){const i=Nt.checkSchema(t);le.requireArgument(n,"data","object");const o=Nt.getSchemaId(t),a=new Array,l=Nt.getTypes(t);if(this._validateFields(a,[],n,l[i.message],l,o),a.length&&!r)throw new Error(a[0].asMessage(o));return a}_validateFields(t,n,r,i,o,a){const l=i.oneofs||{},c=i.fields||{};for(const d in r){const h=r[d];if(h!=null){const p=(g,m,E)=>this._matchFieldTypes(t,[...n,d],h,g,o,a,d,m,E);l[d]?p(c[l[d].oneof[0]].type):c[d]&&p(c[d].type,c[d].rule==="repeated")}}}_matchFieldTypes(t,n,r,i,o,a,l,c,d){let h;if(c)Array.isArray(r)?(r.length>ux&&(h=7),r.forEach((p,g)=>{this._matchFieldTypes(t,[...n,g.toString()],p,i,o,a,l,void 0,!0)})):h=1;else if(r==null||r===void 0)d&&(h=13);else{let p,g;switch(i){case"string":g="string",r.length>Qm&&(h=6);break;case"bytes":g="object",r instanceof Uint8Array||(h=5);break;case"bool":g="boolean";break;case"uint32":g="number",p={min:lx,max:d$,isInt:!0,isItem:d};break;case"int32":case"sint32":case"fixed32":case"sfixed32":g="number",p={min:c$,max:l$,isInt:!0,isItem:d};break;case"uint64":g="number",p={min:lx,max:p$,isInt:!0,isItem:d};break;case"fixed64":case"sfixed64":case"int64":case"sint64":g="number",p={min:h$,max:f$,isInt:!0,isItem:d};break;case"double":case"float":g="number",p={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:d};break;default:new Set(Object.keys(o)).has(i)&&(this._validateFields(t,n,r,o[i],o,a),g="object");break}typeof r!==g?t.push(new cx(2,n,i,typeof r)):p&&(p.isInt&&!Number.isFinite(r)?h=3:p.isInt&&!Number.isInteger(r)?h=12:!(!p.isInt&&Number.isNaN(r))&&!(r>=p.min&&r<=p.max)&&(h=4))}h&&t.push(new cx(h,n))}}const dx=new m$;class g${_getMetricTags(t){const n=t.getTags();if(n)return Object.entries(n).map(r=>({name:r[0],value:r[1].toString()}))}getUpCounters(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),value:r.getData(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getValueRecorders(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),values:r.getData(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getBucketHistograms(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),values:r.getData(),buckets:r.getBuckets(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getMetricsTags(t){const n={};return t.forEach(r=>{n[r.name]=r.value}),n}}const pi=Object.freeze(new g$);class y${checkInputs(t,n){Nt.checkSchema(t),le.requireArgument(n,"data","object");let r,i;n.userPayload!==void 0&&Nt.isInternal(t)&&(i=n.userPayload,r=dx.validate(i.schema,i.payload,!0),this._processValidationResults(Nt.getSchemaId(i.schema),i.payload,r),n.userPayload=void 0),r=dx.validate(t,n,!0),this._processValidationResults(Nt.getSchemaId(t),n,r),i!==void 0&&(n.userPayload=i)}getExtraFields(t,n){le.requireArgument(n,"data","object");const r=[],i=n.userPayload;return i!==void 0&&Nt.isInternal(t)&&r.push(...Nt.getExtraFields(i.schema,i.payload)),r.push(...Nt.getExtraFields(t,n)),r}getPayloadFromProvider(t,n){const r=(t==null?void 0:t.getPayload(n))||void 0;return r&&this.checkInputs(r.schema,r.payload),r}_processValidationResults(t,n,r){for(let i=0;i<r.length;i+=1){const o=r[i];if(o.errorCode==6||o.errorCode==7){const a=o.fields.length-1,l=this._traverseFields(n,o.fields.slice(0,a)),c=o.fields[a];o.errorCode==6?l[c]=l[c].substring(0,Qm):l[c].splice(ux)}else throw new Error(o.asMessage(t))}}_traverseFields(t,n){return n.length?this._traverseFields(t[n[0]],n.slice(1)):t}}const rd=Object.freeze(new y$),fx="o11y";class hx{constructor(t){this._errorCounter=t,this._safeCatchMode=!1}_callCo11y(t,n){n?Ko.exception(t==null?void 0:t.op,fx):Ko.success(t==null?void 0:t.op,fx)}tryCatch(t,n){let r;try{t()}catch(i){r=!0,this._prodSafeCatch(i)}finally{this._callCo11y(n,r)}}tryCatchReturn(t,n,r){let i;try{return le.requireArgument(n,"noopValue"),t()}catch(o){return i=!0,this._prodSafeCatch(o),n}finally{this._callCo11y(r,i)}}_prodSafeCatch(t){let n;try{if(n=!le.isProduction,n)throw t;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(t instanceof Error)){const r=t&&t.message||(typeof t.toString=="function"?t.toString():"");t=new Error(r)}this._safeCatchMode=!1}catch(r){if(n)throw r;if(r&&console&&typeof console.error=="function")try{console.error(r)}catch(i){}this._safeCatchMode=!1}}}const E$=Symbol("o11y.stampTenantClass");class b${get isBusy(){return this._isOk?this._busyCount>0:void 0}constructor(t,n,r,i){this.name=t,this._doneCallback=r,this._overDoneCallback=i,this._busyCount=0,this._isOk=!0,this._busyCount=n}add(){this._isOk&&(this._busyCount+=1)}done(){this._isOk&&(this._busyCount>0?(this._busyCount-=1,this._busyCount||this._doneCallback()):(this._isOk=!1,this._overDoneCallback()))}}const _$=300;class v${constructor(t){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=_$,this._endedTasks=new Array,this._pollableReport=new Array,le.requireArgumentIfDefined(t==null?void 0:t.logThreshold,"options.logThreshold","number")&&(this._logThreshold=t.logThreshold),le.requireArgumentIfDefined(t==null?void 0:t.reportListener,"options.reportListener","function")&&(this._reportListener=t.reportListener),le.requireArgumentIfDefined(t==null?void 0:t.errorListener,"options.errorListener","function")&&(this._errorListener=t.errorListener)}requestIdleDetectedCallback(t){le.requireArgument(t,"callback","function"),this._listeners.size===0&&(this._firstCallbackTime=le.time().perfNow),this._listeners.add(t),this._checkIfLoaded()}_reportTaskEnded(t){if(this._listeners.size){const n=Object.assign({},this._taskers.get(t));this._endedTasks.push(n)}}declareNotifierTaskSingle(t){le.requireArgument(t,"name","string");const n=this._addTasker(t,1);return{get isBusy(){return n.isBusy},done:()=>{n.done(),this._taskers.delete(n)}}}declareNotifierTaskMulti(t,n=0){if(le.requireArgument(t,"name","string"),n!==void 0&&(le.requireArgument(n,"existingBusyCount","number"),!Number.isInteger(n)||n<0))throw new Error("existingBusyCount accepts only non-negative integers");const r=this._addTasker(t,n);return{get isBusy(){return r.isBusy},add:()=>{if(!r.isBusy){const o=this._taskers.get(r);o.start=le.time().perfNow,o.end=void 0}r.add()},done:r.done.bind(r)}}declarePollableTaskMulti(t,n){le.requireArgument(t,"name","string"),le.requireArgument(n,"isBusyChecker","function"),this._busyCheckers.set(n,t)}_addTasker(t,n){const r=new b$(t,n,()=>{this._taskers.get(r).end=le.time().perfNow,this._reportTaskEnded(r),this._checkIfLoaded()},()=>{var i;(i=this._errorListener)===null||i===void 0||i.call(this,`Overdone: ${r.name}`),le.noProdThrow(`Tasker '${r.name}' is done too many times.`)});return this._taskers.set(r,{name:t,start:n>0?le.time().perfNow:void 0,end:void 0}),r}_areAllNotifiersIdle(){return!Array.from(this._taskers.keys()).some(t=>t.isBusy)}_getFirstBusyPollable(){const t=Array.from(this._busyCheckers).find(n=>{var r;const i=n[0],o=n[1];try{return i()}catch(a){return(r=this._errorListener)===null||r===void 0||r.call(this,a,`BusyChecker ${o}`),le.noProdThrow(a),!1}});return t?t[1]:void 0}_checkIfLoaded(){this._listeners.size&&(this._timerCheckQueued&&clearTimeout(this._timerCheckQueued),this._areAllNotifiersIdle()&&(this._timerCheckQueued=setTimeout(()=>{this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},40)},0)))}_doubleCheck(){if(this._timerCheckQueued=void 0,this._areAllNotifiersIdle()){const t=this._getFirstBusyPollable();if(t!==void 0)this._addToPollableReport(t),this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},15);else{const n=le.time().perfNow-this._firstCallbackTime,r=Array.from(this._listeners.values());this._listeners.clear(),this._firstCallbackTime=void 0;const i=this._endedTasks.splice(0),o=this._pollableReport.splice(0);this._notify(r,n,i,o)}}}_addToPollableReport(t){const n=this._pollableReport.length?this._pollableReport[this._pollableReport.length-1]:void 0;(n==null?void 0:n.name)===t?n.count+=1:this._pollableReport.push({name:t,count:1})}_notify(t,n,r,i){var o;if(n>=this._logThreshold&&this._reportListener){const l=this._getReport(n,t.length,r,i);this._reportListener(l)}t.reverse();const a=le.time().tsNow;for(const[l,c]of t.entries())try{c(a)}catch(d){(o=this._errorListener)===null||o===void 0||o.call(this,d,`Listener #${t.length-1-l}`),le.noProdThrow(d)}}getReport(){const t=le.time().perfNow,n=this._firstCallbackTime>0?t-this._firstCallbackTime:void 0,r=Array.from(this._taskers.entries()).filter(i=>i[0].isBusy).map(i=>({name:i[1].name,start:i[1].start,end:t}));return this._getReport(n,this._listeners.size,this._endedTasks.concat(r),this._pollableReport)}_getReport(t,n,r,i){const o=r.map(a=>({name:a.name,duration:a.end-a.start})).sort((a,l)=>l.duration-a.duration);return{logThreshold:this._logThreshold,maxDuration:t,listenerCount:n,pollableCount:this._busyCheckers.size,busyTasks:o.map(a=>a.name),busyDurations:o.map(a=>a.duration),pollables:i.map(a=>a.name),pollCounts:i.map(a=>a.count)}}}const T$={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{ResourceTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"}}}}}}}}}},w$={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{NavigationTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{redirectCount:{id:37,type:"uint32"},encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},unloadEventEnd:{id:40,type:"double"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},unloadEventStart:{id:39,type:"double"},domContentLoadedEventStart:{id:32,type:"double"},type:{id:38,type:"string"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},domContentLoadedEventEnd:{id:33,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domInteractive:{id:34,type:"double"},domComplete:{id:31,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},logEvent:{id:41,type:"string"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},loadEventStart:{id:35,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"},loadEventEnd:{id:36,type:"double"}}}}}}}}}};class x${constructor(t){this._fuzzyKeyRange=t,this._map=new Map,le.requireArgument(t,"_fuzzyKeyRange","number")}add(t,n,r){const i=this._map.get(t);i?i.push({fuzzyKey:n,value:r}):this._map.set(t,[{fuzzyKey:n,value:r}])}pop(t,n){const r=this._map.get(t);if((r==null?void 0:r.length)>=1){let i=Number.POSITIVE_INFINITY,o=-1;for(let a=0;a<r.length;a++){const{fuzzyKey:l}=r[a],c=Math.abs(l-n);c<=this._fuzzyKeyRange&&c<i&&(i=c,o=a)}if(o>=0){const{value:a}=r.splice(o,1)[0];return r.length===0&&this._map.delete(t),a}}}clear(){this._map.clear()}}const S$=["fetch","xmlhttprequest"];class A${constructor(t,n,r,i,o){if(this._instr=t,this._skipUrls=r,this._logPerformanceActivityName=i,this._boundObserverCallback=this._logPerformanceEntries.bind(this),this._boundNavigationTimingEventCallback=a=>{this._logNavigationEntries(a)},this._setTimeoutNavigationCallback=a=>{setTimeout(()=>{this._boundNavigationTimingEventCallback(a)},0)},this._visibilityChangeNavigationCallback=a=>{document.visibilityState==="hidden"&&this._boundNavigationTimingEventCallback(a)},this._isStarted=!1,this._processedNavigationTiming=!1,le.requireArgument(t,"_instr","object"),le.requireArgument(n,"fuzzyMapRange","number"),le.requireArgumentIfDefined(r,"_skipUrls",Array),le.requireArgumentIfDefined(i,"_logPerformanceActivityName","string"),le.requireArgumentIfDefined(o,"logLevel","string"),this._hasPerf=typeof performance!="undefined"&&typeof PerformanceObserver=="function",this._hasWindow=typeof window!="undefined",!o||o.toLowerCase()==="full")this._logLevel=1;else if((o==null?void 0:o.toLowerCase())==="basic")this._logLevel=0;else throw new Error(`Invalid log level: ${o}`);this._fuzzyMapper=new x$(n)}get isStarted(){return this._isStarted}get logLevel(){return this._logLevel}start(){this._hasPerf&&(this._isStarted||(this._isStarted=!0,this._resourceObserver=new PerformanceObserver(this._boundObserverCallback),this._resourceObserver.observe({type:"resource",buffered:!0}),this._addNavigationListeners()))}stop(){this._resourceObserver&&(this._resourceObserver.disconnect(),this._resourceObserver=void 0),this._removeNavigationListeners(),this._fuzzyMapper.clear(),this._isStarted=!1}_addNavigationListeners(){this._hasWindow&&(window.addEventListener("load",this._setTimeoutNavigationCallback),window.addEventListener("pagehide",this._boundNavigationTimingEventCallback),document.addEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}_removeNavigationListeners(){this._hasWindow&&(window.removeEventListener("load",this._setTimeoutNavigationCallback),window.removeEventListener("pagehide",this._boundNavigationTimingEventCallback),document.removeEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}addEntry(t,n,r){this._fuzzyMapper.add(t,n,r)}_resourceEntryToResourceTiming(t){var n,r;const i={name:t.name,startTime:t.startTime,duration:t.duration,initiatorType:t.initiatorType,nextHopProtocol:t.nextHopProtocol,renderBlockingStatus:t.renderBlockingStatus,workerStart:t.workerStart,redirectStart:t.redirectStart,redirectEnd:t.redirectEnd,fetchStart:t.fetchStart,domainLookupStart:t.domainLookupStart,domainLookupEnd:t.domainLookupEnd,connectStart:t.connectStart,secureConnectionStart:t.secureConnectionStart,connectEnd:t.connectEnd,requestStart:t.requestStart,responseStart:t.responseStart,firstInterimResponseStart:t.firstInterimResponseStart,responseEnd:t.responseEnd,transferSize:t.transferSize,encodedBodySize:t.encodedBodySize,decodedBodySize:t.decodedBodySize,responseStatus:t.responseStatus},o=t.serverTiming;return Array.isArray(o)&&(i.dbDuration=(n=o.find(a=>a.name==="db"))===null||n===void 0?void 0:n.duration,i.srvDuration=(r=o.find(a=>a.name==="Total"))===null||r===void 0?void 0:r.duration),i}_shouldInclude(t){var n;return((n=this._skipUrls)===null||n===void 0?void 0:n.some(i=>i instanceof RegExp?i.test(t.name):t.name===i))?!1:this._logLevel===1?!0:S$.indexOf(t.initiatorType)>=0||t.entryType==="navigation"}_calculateXhrDelay(t,n){if(n){if(t.initiatorType==="fetch"){if(t.responseStart===0)return-1;if(n.activityDuration!==void 0){const r=t.responseStart-t.startTime;return n.activityDuration-r}return}if(n.activityDuration!==void 0)return n.activityDuration-t.duration}}_logActivity(t,n,r,i){const o={id:r},a={perfStartOverride:n.startTime,perfStopOverride:n.startTime+n.duration,errorCount:i};this._instr.startActivity(this._logPerformanceActivityName,o).stop(t,n,a)}_logNavigationEntries(t){if(!this._processedNavigationTiming)for(const n of performance.getEntriesByType("navigation")){const r=n;if(this._shouldInclude(r)){this._processedNavigationTiming=!0;const i=this._resourceEntryToResourceTiming(r),o={domComplete:r.domComplete,domContentLoadedEventStart:r.domContentLoadedEventStart,domContentLoadedEventEnd:r.domContentLoadedEventEnd,domInteractive:r.domInteractive,loadEventStart:r.loadEventStart,loadEventEnd:r.loadEventEnd,redirectCount:r.redirectCount,type:r.type,unloadEventStart:r.unloadEventStart,unloadEventEnd:r.unloadEventEnd,logEvent:t.type};this._logActivity(w$,Object.assign(i,o))}break}}_logPerformanceEntries(t){for(const n of t.getEntriesByType("resource")){const r=n,i=this._fuzzyMapper.pop(r.name,r.startTime);if(this._shouldInclude(r)){const o=this._resourceEntryToResourceTiming(r);Object.assign(o,{srvReqId:i==null?void 0:i.requestId,xhrDelay:this._calculateXhrDelay(r,i)}),o.responseStatus===void 0&&(o.responseStatus=i==null?void 0:i.responseStatus),this._logActivity(T$,o,i==null?void 0:i.activityId,i==null?void 0:i.errorCount)}}}}const C$=32,k$=16,px=16,O$="traceparent",N$="b3",mx="X-B3-TraceId",gx="X-B3-SpanId",yx="X-B3-Sampled",Ex="X-B3-ParentSpanId",bx="X-SFDC-Request-Id",I$="baggage",P$="fetch",R$="xhr_send",L$="perf-timing",D$=50,M$=[I$,mx,gx,Ex,yx],Vs=new WeakMap;class Oe{constructor(t,n){this._instr=t,this._idleDetector=n,le.requireArgument(t,"_instr","object"),le.requireArgument(n,"_idleDetector","object")}static _getB3CompactFormat(t,n,r,i){let o=`${t}-${n}`;return(r!==void 0||i!==void 0)&&(o+=r?"-1":"-0",i!==void 0&&(o+=`-${i}`)),o}static _getW3CompactFormat(t,n,r){return`00-${t}-${n}-${r?"01":"00"}`}static _conformTextAsId(t,n){t=t.toLowerCase();const r=t.length;for(let i=0;i<r;i+=1){const o=t[i];if(!(o>="a"&&o<="f")&&!(o>="0"&&o<="9"))throw new Error(`The text '${t}' has an invalid character at index #${i}`)}return r>n?t.substr(r-n):r<n?t.padStart(n,"0"):t}static setHeaders(t){if(t===void 0){Oe._userHeaders={};return}Object.entries(t).forEach(([n])=>{M$.includes(n)||delete t[n]}),Oe._userHeaders=t}static getHeaders(t,n,r,i){le.requireArgument(n,"spanId","string");const o=i==null?void 0:i.useB3Headers,a={};if(t===void 0)return a;t=this._conformTextAsId(t,(i==null?void 0:i.traceIdEffectiveLength)!==void 0?i.traceIdEffectiveLength:o?k$:C$),n=this._conformTextAsId(n,px);const l=i&&i.parentSpanId!==void 0&&this._conformTextAsId(i.parentSpanId,px)||void 0;return o?(i==null?void 0:i.useCompactHeader)?a[N$]=this._getB3CompactFormat(t,n,r,l):(a[mx]=t,a[gx]=n,l!==void 0&&(a[Ex]=l),r!==void 0&&(a[yx]=r?"1":"0")):a[O$]=this._getW3CompactFormat(t,n,r),a}_disableNetworkInstrumentation(){Oe._isNetworkInstrumentationEnabled&&(Oe._originalFetch&&(Oe._global.fetch=Oe._originalFetch,Oe._originalFetch=void 0),Oe._originalXhr&&(Oe._global.XMLHttpRequest=Oe._originalXhr,Oe._originalXhr=void 0),Oe._originalXhrOpen&&(Oe._global.XMLHttpRequest.prototype.open=Oe._originalXhrOpen,Oe._originalXhrOpen=void 0),Oe._originalXhrSetRequestHeader&&(Oe._global.XMLHttpRequest.prototype.setRequestHeader=Oe._originalXhrSetRequestHeader,Oe._originalXhrSetRequestHeader=void 0),Oe._originalXhrSend&&(Oe._global.XMLHttpRequest.prototype.send=Oe._originalXhrSend,Oe._originalXhrSend=void 0),Oe._performanceObservability&&(Oe._performanceObservability.stop(),Oe._performanceObservability=void 0),Oe._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(t,n,r,i,o,a,l,c,d,h){typeof Oe._global.fetch=="function"&&(this._overrideFetch(t,n,r,i,o,a,d),Oe._isNetworkInstrumentationEnabled=!0),typeof Oe._global.XMLHttpRequest=="function"&&(this._overrideXhr(t,n,r,i,o,a,d),Oe._isNetworkInstrumentationEnabled=!0),l&&(Oe._performanceObservability=new A$(t,h,d,c,l===!0?"full":l),Oe._performanceObservability.start(),Oe._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(t,n,r,i,o){let a;if(t)a=t.getTraceHeaders(r)||{};else{const l=n.internalInstrumentationContext;l!=null&&l.rootId?a=Oe.getHeaders(l.rootId,le.generateUniqueId(),l.isRootActivitySampled,r):a={}}if(typeof(r==null?void 0:r.headerProcessor)=="function")a=r.headerProcessor({method:i,url:o,defaultHeaders:a});else if(typeof window=="object"){let l;try{l=new URL(o)}catch(c){}l&&l.host!==window.location.host&&(a=void 0)}return Oe._userHeaders&&Object.keys(Oe._userHeaders).length>0&&(a=z({},a),Object.entries(Oe._userHeaders).forEach(([l,c])=>{a[l]=c}),Oe._userHeaders=void 0),a||{}}static _extractHeader(t,n,r){if((r==null?void 0:r.headers)instanceof Headers)return r.headers.get(t);if(Array.isArray(r==null?void 0:r.headers)){const i=r.headers.find(o=>o[0]===t);return i==null?void 0:i[1]}if(typeof(r==null?void 0:r.headers)=="object")return r.headers[t];if(n instanceof Request)return n.headers.get(t)}_overrideFetch(t,n,r,i,o,a,l){Oe._originalFetch=Oe._global.fetch;const c=(d,h,...p)=>Ne(this,null,function*(){var g;let m,E,S,T,v,w=!1,C;try{a==null||a.add(),T=h==null?void 0:h.method;const R=h==null?void 0:h.o11y,k=R==null?void 0:R.skipInstr;if(w=k||Oe._shouldSkipUrl(l,d),!w)m=t.startActivity(r||P$);else if(k){Oe._reqIndex+=1;try{if(d instanceof URL)d.searchParams.append("o11y",Oe._reqIndex.toString());else if(typeof d=="string"){const P=new URL(d),I=`o11y=${Oe._reqIndex}`;P.search+=P.search.startsWith("?")?`&${I}`:I,d=P.toString()}}catch(P){}}if(h==null||delete h.o11y,E=d==null?void 0:d.toString(),S=le.tryGetAbsoluteUrl(E),i){d instanceof Request&&(T||(T=d.method),E=d.url,S=le.tryGetAbsoluteUrl(E));const P=Oe._getTraceHeaders(m,t,o,T,S);!this._applyTraceHeaders(d,h,P)&&h===void 0&&(h={headers:P})}return v=le.perfNow(),C=yield Oe._originalFetch.call(Oe._global,d,h,...p),C}catch(R){throw n&&!w&&(m?m.error(R):t.error(R)),R}finally{try{const R=Oe._endActivity(m,E,T);if(!((g=Oe._performanceObservability)===null||g===void 0)&&g.isStarted){const P={requestId:Oe._extractHeader(bx,d,h),activityDuration:R,activityId:m==null?void 0:m.getId(),errorCount:m==null?void 0:m.getErrorCount(),responseStatus:C==null?void 0:C.status};Oe._performanceObservability.addEntry(S,v,P)}}finally{a==null||a.done()}}});Oe._global.fetch=c}static _endActivity(t,n,r){var i;if(t)return!((i=Oe._performanceObservability)===null||i===void 0)&&i.isStarted?t.discard():t.stop(t$,{mtd:r,url:n}),t.getStopPerfTime()-t.getStartPerfTime()}_overrideXhr(t,n,r,i,o,a,l){Oe._originalXhr=Oe._global.XMLHttpRequest,Oe._originalXhrOpen=Oe._originalXhr.prototype.open,Oe._originalXhrSetRequestHeader=Oe._originalXhr.prototype.setRequestHeader,Oe._originalXhrSend=Oe._originalXhr.prototype.send;function c(h,p){var g;const m=Vs.get(h);if(m){const E=m.activity,S=Oe._endActivity(E,m.url,m.method);!p&&(!((g=Oe._performanceObservability)===null||g===void 0)&&g.isStarted)&&Oe._performanceObservability.addEntry(m.absoluteUrl,m.sendTime,{requestId:m.requestId,activityDuration:S,activityId:E==null?void 0:E.getId(),errorCount:E==null?void 0:E.getErrorCount(),responseStatus:h.status})}}Oe._originalXhr.prototype.open=function(h,p,g,m,E){const S={method:h,url:p==null?void 0:p.toString()};Vs.set(this,S),S.absoluteUrl=le.tryGetAbsoluteUrl(S.url),S.suspendInstrumentation=Oe._shouldSkipUrl(l,S.absoluteUrl),Oe._originalXhrOpen.apply(this,arguments)},Oe._originalXhr.prototype.setRequestHeader=function(h,p){var g;if(((g=h==null?void 0:h.toLowerCase)===null||g===void 0?void 0:g.call(h))===bx.toLowerCase()){const m=Vs.get(this);m&&(m.requestId=p)}Oe._originalXhrSetRequestHeader.apply(this,arguments)},Oe._originalXhr.prototype.send=function(...h){let p;const g=this;let m=Vs.get(g);m||(m={},Vs.set(g,m));try{if(a==null||a.add(),m.suspendInstrumentation||(m.activity=p=t.startActivity(r||R$)),i){const E=Oe._getTraceHeaders(p,t,o,m.method,m.absoluteUrl);Object.entries(E).forEach(S=>{g.setRequestHeader(S[0],S[1])})}m.sendTime=le.perfNow(),Oe._originalXhrSend.call(this,...h)}catch(E){throw n&&!(m!=null&&m.suspendInstrumentation)&&(p?p.error(E):t.error(E)),c(g,!0),a==null||a.done(),E}};const d=new Proxy(Oe._originalXhr,{construct(h){const p=new h;return p.addEventListener("load",()=>{c(p),a==null||a.done()}),p.addEventListener("error",g=>{const m=Vs.get(p)||{};try{if(n&&!(m!=null&&m.suspendInstrumentation)){const E=new Error("XHR Network-Level Error"),S=m==null?void 0:m.activity;S?S.error(E):t.error(E)}c(p)}finally{a==null||a.done()}}),p.addEventListener("abort",()=>{var g;const m=Vs.get(p)||{};(g=m==null?void 0:m.activity)===null||g===void 0||g.discard(),a==null||a.done()}),p}});Oe._global.XMLHttpRequest=d}networkInstrumentation(t){var n;if(le.requireArgument(t,"options",["boolean","object"]),this._disableNetworkInstrumentation(),t){const r=typeof t=="object"?t:{};let i;le.definedValueOrDefault(r.useTasker,!0)&&(i=(n=this._idleDetector)===null||n===void 0?void 0:n.declareNotifierTaskMulti("o11y network")),this._enableNetworkInstrumentation(le.definedValueOrDefault(r.instrumentation,this._instr),le.definedValueOrDefault(r.logErrors,!0),r.activityName,le.definedValueOrDefault(r.useTracing,!0),r.tracingHeadersOptions,i,le.definedValueOrDefault(r.logPerformance,!0),le.definedValueOrDefault(r.logPerformanceActivityName,L$),le.definedValueOrDefault(r.skipUrls,[]),le.definedValueOrDefault(r.fuzzyMapRange,D$))}}resetRequestCounter(){Oe._reqIndex=0}_applyTraceHeaders(t,n,r){if((n==null?void 0:n.headers)!==void 0){if(n.headers instanceof Headers&&typeof n.headers.set=="function")return Object.entries(r).forEach(([i,o])=>{n.headers.set(i,o)}),!0;if(Array.isArray(n.headers))return Object.entries(r).forEach(i=>{n.headers.push(i)}),!0;if(typeof n.headers=="object")return n.headers=Object.assign(n.headers,r),!0}else{if(t instanceof Request&&t.headers instanceof Headers)return Object.entries(r).forEach(([i,o])=>{t.headers.set(i,o)}),!0;if(n)return n.headers=Object.assign({},r),!0}return!1}static _shouldSkipUrl(t,n){var r;let i=n;return n instanceof URL?i=(r=n.toString)===null||r===void 0?void 0:r.call(n):n instanceof Request&&(i=n.url),t==null?void 0:t.some(o=>o instanceof RegExp?o.test(i):i===o)}}Oe._global=le.getGlobal(),Oe._isNetworkInstrumentationEnabled=!1,Oe._reqIndex=0;var Or;(function(e){e[e.none=0]="none",e[e.start=1]="start",e[e.stop=2]="stop",e[e.both=3]="both"})(Or||(Or={}));const F$="timedout",B$="terminated",Jm="discarded",id={timedout:F$,terminated:B$,discarded:Jm};class Qo{constructor(t,n,r,i,o,a,l,c,d,h,p){var g,m;this._name=t,this._rootId=n,this._onStopped=r,this._onError=i,this._isSampled=l,this._noRerooting=d,this._isExternal=h,this._parentActivity=p,this._isRoot=!1,this._errorCount=0,this._timerOverridden=Or.none;const{tsNow:E,perfNow:S}=le.time();if(Qo._count+=1,this._id=a||le.generateUniqueId(),this._usePerf=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.measure=="function",this._usePerf){this._perfName=`${this._name}__${Qo._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(T){this._usePerf=!1}}this._startTimestamp=E,this._startPerfTime=S,this._overrideTimer(c),o>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||id.timedout,this.stop()},o)),this._safety=new hx,this._externalParentActivity=!((g=this._parentActivity)===null||g===void 0)&&g.isExternal()?this._parentActivity:(m=this._parentActivity)===null||m===void 0?void 0:m.getExternalParentActivity()}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}getParentActivity(){return this._parentActivity}isExternal(){var t;return(t=this._isExternal)!==null&&t!==void 0?t:!1}getExternalParentActivity(){return this._externalParentActivity}error(t,n,r){this._safety.tryCatch(()=>{this._errorCount+=1,typeof t=="string"&&(t=new Error(t)),this._onError(t,this._getDetail(n,r))},{op:"activity.error"})}stop(t,n,r){this._safety.tryCatch(()=>{if(le.requireArgumentIfDefined(t,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(n,"userData","object"),r){const i=r.perfStartOverride,o=le.requireArgumentIfDefined(i,"options.perfStartOverride","number"),a=r.perfStopOverride,l=le.requireArgumentIfDefined(a,"options.perfStopOverride","number"),c=r.errorCount;if(le.requireArgumentIfDefined(c,"options.errorCount","number")&&(this._errorCount=c),o&&i<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(l&&(a<0||a<(o?i:this._startPerfTime)||a>le.time().perfNow+100))throw new Error("perfStopOverride, if defined, must be >= 0 and >= startTime and <= now")}this._stopInternal(t,n,r)},{op:"activity.stop"})}_overrideTimer(t,n){t!==void 0&&(this._startTimestamp=Math.round(this._startTimestamp-(this._startPerfTime-t)),this._startPerfTime=t,this._setTimerOverride(Or.start)),n!==void 0&&(this._stopPerfTime=n,this._setTimerOverride(Or.stop))}_setTimerOverride(t){this._timerOverridden===Or.both||this._timerOverridden===t||t===Or.none||(this._timerOverridden=this._timerOverridden===Or.none?t:Or.both)}_stopInternal(t,n,r){const i=le.perfNow();if(this._usePerf)try{this._stopReason!==id.discarded&&performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(a){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;r&&this._overrideTimer(r.perfStartOverride,r.perfStopOverride),this._stopPerfTime=this._timerOverridden===Or.none||this._timerOverridden===Or.start?i:this._stopPerfTime;const o=this._getDetail(t,n);this._onStopped(o)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||id.discarded,this.stop()},{op:"activity.discard"})}terminate(t,n,r){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||id.terminated,this.stop(t,n,r)},{op:"activity.terminate"})}getIsSampled(){return this._isSampled||!1}_getDetail(t,n){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:t,userData:n,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled(),timerOverridden:this._timerOverridden,noRerooting:this._noRerooting,isExternal:this._isExternal,parentActivity:this._parentActivity,externalParentActivity:this._externalParentActivity}}getTraceHeaders(t){const n=this.id,r=this._isRoot?this.id:this._rootId;return Oe.getHeaders(r,n,this.getIsSampled(),t)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}Qo._count=0;const U$=new Array(16).fill(0).join("");class j${getId(){return U$}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(t){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const H$=Object.freeze(new j$);class $${getInstrumentedEventData(t,n,r,i){var o;const a={ownerComponent:r.tagName,parentComponent:((o=r.parentElement)===null||o===void 0?void 0:o.tagName)||void 0,simplePath:le.getXpath(r)};switch(t){case 0:a.baseEvent=n;break;case 1:a.mouseEvent=n;break}return i&&(a.userPayload=Nt.makePayload(i.schema,i.payload,!0)),a}getEventData(t){return{type:t.type}}getMouseEventData(t){return{altKey:t.altKey,bubbles:t.bubbles,button:t.button,buttons:t.buttons,cancelable:t.cancelable,clientX:t.clientX,clientY:t.clientY,composed:t.composed,defaultPrevented:t.defaultPrevented,detail:t.detail,eventPhase:t.eventPhase,isTrusted:t.isTrusted,timeStamp:t.timeStamp,type:t.type,ctrlKey:t.ctrlKey,metaKey:t.metaKey,movementX:t.movementX,movementY:t.movementY,offsetX:t.offsetX,offsetY:t.offsetY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY,shiftKey:t.shiftKey}}}const Zm=new $$;class _x{constructor(t,n,r,i,o,a,l,c){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._buckets=o,this._values=new Array,this._createdOn=a===void 0?le.time().tsNow:a,l!==void 0&&(this._lastUpdatedOn=l),c!==void 0&&(this._values=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}getBuckets(){return this.buckets}get buckets(){return this._buckets.slice(0,this._buckets.length)}get values(){return this._values.slice(0,this._values.length)}record(t){if(typeof t=="number"){this._values.push(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("BucketHistogram can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class vx{constructor(t,n,r,i,o,a,l){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._values=new Array,this._createdOn=o===void 0?le.time().tsNow:o,a!==void 0&&(this._lastUpdatedOn=a),l!==void 0&&(this._values=l)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(t){if(typeof t=="number"){this._values.push(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class eg{constructor(t){if(this._map=new Map,typeof t=="number"&&t>0){this._maxSize=Math.ceil(t);return}throw new Error("maxSize must be a positive number")}get maxSize(){return this._maxSize}get(t){return this._map.get(t)}has(t){return this._map.has(t)}set(t,n){return this.has(t)||this._map.size<this.maxSize?(this._map.set(t,n),!0):!1}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const Tx=1e3,wx=500,xx=500;var Jo;(function(e){e[e.Counter=0]="Counter",e[e.Percentile=1]="Percentile",e[e.BucketHistogram=2]="BucketHistogram"})(Jo||(Jo={}));class Sx{constructor(t,n){this._ownerName=t,this._getOwnerAppName=n,this._upCounters=new eg(Tx),this._valueRecorders=new eg(wx),this._bucketHistograms=new eg(xx)}incrementCounter(t,n,r=!1,i={}){this._tagError(i,r),this._upCounter(t,i).increment(n)}trackValue(t,n,r=!1,i={}){this._tagError(i,r),this._valueRecorder(t,i).record(n)}bucketValue(t,n,r,i=!1,o={}){this._tagError(o,i),this._bucketHistogram(t,o,r).record(n)}_bucketHistogram(t,n,r){const{key:i,sortedTags:o}=this._getKeyAndSortedTags(t,n,Jo.BucketHistogram);let a=this._bucketHistograms.get(i);if(!a&&(a=new _x(t,this._ownerName,this._getOwnerAppName(),o,r),!this._bucketHistograms.set(i,a)))throw new Error(`Max size of ${xx} exceeded for BucketHistograms`);return a}_upCounter(t,n){const{key:r,sortedTags:i}=this._getKeyAndSortedTags(t,n,Jo.Counter);let o=this._upCounters.get(r);if(!o&&(o=new Km(t,this._ownerName,this._getOwnerAppName(),i),!this._upCounters.set(r,o)))throw new Error(`Max size of ${Tx} exceeded for UpCounters`);return o}_valueRecorder(t,n){const{key:r,sortedTags:i}=this._getKeyAndSortedTags(t,n,Jo.Percentile);let o=this._valueRecorders.get(r);if(!o&&(o=new vx(t,this._ownerName,this._getOwnerAppName(),i),!this._valueRecorders.set(r,o)))throw new Error(`Max size of ${wx} exceeded for ValueRecorders`);return o}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}getBucketHistograms(){return this._bucketHistograms.getElements()}_tagError(t,n){t.status=n===!0?"error":"success"}_getKeyAndSortedTags(t,n,r){const i=Object.keys(n).sort().reduce((a,l)=>(a[l]=n[l],a),{});return{key:`${Jo[r]}:${t}${JSON.stringify(i)}`,sortedTags:i}}}class z${constructor(){this.isMock=!0}}const V$=void 0,sd=["`"],Ax={internalError:"o11y-error"},tg=Object.freeze(Array.from(Object.values(Ax))),ng=new WeakMap;class Ou{constructor(t,n){this._nextGen=t,this._name=n,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const i of sd)if(this._name.indexOf(i)>=0)throw new Error(`Name cannot include the reserved character "${i}"`);this._safety=new hx({increment:i=>this._incrementError(i)}),this._metrics=this._initMetrics();const r=Nt.getOptions(ax,"Simple","text");this._simpleTextMaxLength=r?r["(meta.max_length)"]:Qm}_initMetrics(){return new Sx(this.name,()=>this._nextGen.appName||Ou.defaultAppName)}_incrementError(t=1){this._metrics.incrementCounter(Ax.internalError,t,!0)}get name(){return this._name}[E$](t,n,r){const i=this[t];if(typeof i=="function"){ng.set(this,r);try{i.apply(this,n)}finally{ng.delete(this)}}}_wrapUserPayload(t,n,r=!1){let i;return typeof t=="string"?(i=ax,t?n={text:t.substring(0,this._simpleTextMaxLength)}:n=void 0):i=t,Nt.makePayload(i,n,r)}_getEffectiveRootId(t){var n,r;return(r=(n=t==null?void 0:t.instrumentationContext)===null||n===void 0?void 0:n.rootId)!==null&&r!==void 0?r:this._nextGen.getDefaultInstrumentationContext().rootId}get internalInstrumentationContext(){return this._nextGen.getDefaultInstrumentationContext()}log(t,n,r){this._safety.tryCatch(()=>{const i=le.time().tsNow;le.requireArgument(t,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(n,"userData","object"),le.requireArgumentIfDefined(r,"options","object");const o=this._wrapUserPayload(t,n);o!=null&&o.payload&&this._logInternal(this.name,o.schema,o.payload,i,this._getEffectiveRootId(r))},{op:"log"})}_logInternal(t,n,r,i,o){const a=ng.get(this),l=this._nextGen.addLog(t,n,r,i,o,a);if(!le.isProduction){const c=rd.getExtraFields(n,r);!le.isProduction&&c.length>0&&this.error("Extra fields",JH,{extras:c})}return l}error(t,n,r,i){return this._safety.tryCatch(()=>{le.requireArgumentIfDefined(n,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(r,"userData","object"),le.requireArgumentIfDefined(i,"options","object");const o=this._getEffectiveRootId(i);this._errorInternal(t,n,r,void 0,o)},{op:"error"})}_errorInternal(t,n,r,i,o){const a=le.time().tsNow;let l;if(t instanceof Error)l=t;else{let h;t==null||typeof t.toString!="function"?h="UNKNOWN":h=t.toString(),l=new Error(h)}const c=this._wrapUserPayload(n,r,!0),d={name:l.name,message:l.message,stack:l.stack,userPayload:c,activityId:i};return this._logInternal(this.name,i$,d,a,o)}startActivity(t,n){return this._safety.tryCatchReturn(()=>{var r;le.requireArgument(t,"name"),le.requireArgumentIfDefined(n,"options","object");const i=le.validateParentActivityType(n==null?void 0:n.isExternal,n==null?void 0:n.parentActivity);let o,a=(n==null?void 0:n.perfStartOverride)!==void 0;const l=(r=n==null?void 0:n.instrumentationContext)===null||r===void 0?void 0:r.rootId;l?(a=!0,o={rootId:l,isRootActivitySampled:n.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:n.instrumentationContext.isRootActivityExternalSampled}):o=this._nextGen.getDefaultInstrumentationContext();const c=n!=null&&n.isExternal?o.isRootActivityExternalSampled:o.isRootActivitySampled;return new Qo(t,o.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,V$,n==null?void 0:n.id,c,n==null?void 0:n.perfStartOverride,a,n==null?void 0:n.isExternal,i)},H$,{op:"startActivity"})}getRootActivityHistoryEntryByTime(t){let n;return this._safety.tryCatch(()=>{n=this._nextGen.getRootActivityHistoryEntryByTime(t)},{op:"getRootActivityHistoryEntryByTime"}),n}_getActivityData(t){var n,r;const i=this._wrapUserPayload(t.userSchemaOrText,t.userData,!0);return{id:t.id,name:t.name,duration:t.stopPerfTime-t.startPerfTime,stopReason:t.stopReason,userPayload:i,errorCount:t.errorCount,isSampled:t.isSampled,timerOverridden:t.timerOverridden,isRerooted:t.isRerooted,isExternal:t.isExternal,parentId:(n=t.parentActivity)===null||n===void 0?void 0:n.getId(),externalParentId:(r=t.externalParentActivity)===null||r===void 0?void 0:r.getId()}}_handleActivityStop(t){if(t.stopReason===Jm)return;if(!t.isRoot&&!t.noRerooting){const r=this._nextGen.getRootActivityHistoryEntryByTime(t.startPerfTime);(!r&&t.rootId!==void 0||r&&t.rootId!==r.id)&&(t.rootId=r==null?void 0:r.id,t.isSampled=(r==null?void 0:r.isSampled)||!1,t.isRerooted=!0)}const n=this._getActivityData(t);this._logActivity(n,t.startTimestamp,t.rootId)}_logActivity(t,n,r){this._logInternal(this.name,n$,t,n,r)}_handleActivityError(t,n){this._errorInternal(t,n.userSchemaOrText,n.userData,n.id,n.rootId)}domEvent(t,n,r,i,o){this._safety.tryCatch(()=>{var a;const l=le.time().tsNow;le.requireArgument(t,"event",[Event,z$]),le.requireArgument(n,"handledBy",[HTMLElement,"object"]);let c;n instanceof HTMLElement?c=n:(n=n,((a=n.template)===null||a===void 0?void 0:a.host)instanceof HTMLElement?c=n.template.host:le.requireArgument(void 0,"handledBy"));const d=this._wrapUserPayload(r,i,!0),h=this._getEffectiveRootId(o);if(t.type==="click"){const p=t,g=this._nextGen.getClickTracker();g&&g.markEventHandled(p);const m=o==null?void 0:o.captureMouseData,E=Zm.getInstrumentedEventData(m?1:0,m?Zm.getMouseEventData(p):Zm.getEventData(p),c,d);E.auto=o==null?void 0:o._auto,this._logInternal(this.name,e$,E,l,h)}else throw new Error(le.notImplemented)},{op:"domEvent"})}_siftTags(t){const n=Object.assign({},t);return Object.entries(n).forEach(([r,i])=>{if(i===null)n[r]="null";else if(i==="")n[r]="empty";else if(Number.isNaN(i))n[r]="NaN";else{const o=typeof i;["number","string","boolean"].indexOf(o)===-1&&(n[r]=o)}}),n}incrementCounter(t,n=1,r=!1,i={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"increment","number"),le.requireArgument(r,"hasError","boolean"),le.requireArgument(i,"tags","object"),this._metrics.incrementCounter(t,n,r,this._siftTags(i))},{op:"incrementCounter"})}trackValue(t,n,r=!1,i={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"value","number"),le.requireArgument(r,"hasError","boolean"),le.requireArgument(i,"tags","object"),this._metrics.trackValue(t,n,r,this._siftTags(i))},{op:"trackValue"})}bucketValue(t,n,r=[],i=!1,o={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"value","number"),le.requireArgument(r,"buckets",Array),Object.entries(r).forEach(([a,l])=>{le.requireArgument(l,`Bucket value for '${a}'`,"number")}),le.requireArgument(i,"hasError","boolean"),le.requireArgument(o,"tags","object"),this._metrics.bucketValue(t,n,r,i,this._siftTags(o))},{op:"bucketValue"})}getUpCounters(){return this._metrics.getUpCounters().filter(t=>t.getLastUpdatedOn())}getValueRecorders(){return this._metrics.getValueRecorders().filter(t=>t.getLastUpdatedOn())}getBucketHistograms(){return this._metrics.getBucketHistograms().filter(t=>t.getLastUpdatedOn())}registerForLogPrompt(t){le.requireArgument(t,"listener","function"),this._nextGen.registerForLogPrompt(t)}_getAsaOptions(t){return t?Object.assign({instrumentationContext:t==null?void 0:t.instrumentationContext},t.startOptions):void 0}activity(t,n,r){var i,o,a,l;const c=this._getAsaOptions(r),d=this.startActivity(t,c);try{return n(d)}catch(h){throw d.error(h,(i=r==null?void 0:r.errorPayload)===null||i===void 0?void 0:i.schema,(o=r==null?void 0:r.errorPayload)===null||o===void 0?void 0:o.payload),h}finally{d.stop((a=r==null?void 0:r.stopPayload)===null||a===void 0?void 0:a.schema,(l=r==null?void 0:r.stopPayload)===null||l===void 0?void 0:l.payload,r==null?void 0:r.stopOptions)}}activityAsync(t,n,r){return Ne(this,null,function*(){var i,o,a,l;const c=this._getAsaOptions(r),d=this.startActivity(t,c);try{return yield n(d)}catch(h){throw d.error(h,(i=r==null?void 0:r.errorPayload)===null||i===void 0?void 0:i.schema,(o=r==null?void 0:r.errorPayload)===null||o===void 0?void 0:o.payload),h}finally{d.stop((a=r==null?void 0:r.stopPayload)===null||a===void 0?void 0:a.schema,(l=r==null?void 0:r.stopPayload)===null||l===void 0?void 0:l.payload,r==null?void 0:r.stopOptions)}})}invokeNetworkCallWithHeaders(t,n,r){return Oe.setHeaders(r),t(...n)}}Ou.defaultAppName="APP_NOT_REGISTERED";const q$=.1,W$=20;class Y${constructor(t){if(this._historyMap=new Map,this._historyList=new Array,le.requireArgumentIfDefined(t,"limit","number")){if(t=Math.ceil(t),t<=0)throw new Error("Limit must be a positive number")}else t=W$;this._graceCount=Math.max(1,Math.floor(t*q$)),this._realLimit=1+t+this._graceCount}add(t){if(this._historyMap.has(t.id))throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${t.id}`);this._historyMap.set(t.id,t),this._historyList.push(t),this._historyList.length===this._realLimit&&this._historyList.splice(1,this._graceCount).forEach(r=>this._historyMap.delete(r.id))}get count(){return this._historyList.length}findById(t){return this._historyMap.get(t)}findByTime(t){let n,r=Number.MAX_VALUE;for(const i of this._historyList){const o=t-i.startPerfTime;o>=0&&(i.stopPerfTime===void 0||t<i.stopPerfTime)&&o<r&&(n=i,r=o)}return n}}class G$ extends Qo{constructor(t,n,r,i,o,a,l,c){super(t,void 0,n,r,void 0,i||le.generateUniqueId(l!=null?l:32),o,a),this._isRoot=!0,this._isExternalSampled=c}get isExternalSampled(){var t;return(t=this._isExternalSampled)!==null&&t!==void 0?t:!1}set isExternalSampled(t){this._isExternalSampled=t}get preRootId(){return this._preRootId}set preRootId(t){this._preRootId=t}_getDetail(t,n){const r=super._getDetail(t,n);return r.isRoot=!0,r.preRootId=this.preRootId,r}}const X$=new Array(32).fill(0).join("");class K${getId(){return X$}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(t){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Q$=Object.freeze(new K$);class J$ extends Ou{constructor(t,n,r){super(t,n),this._allowMulti=r,this._rootActivityHistory=new Y$,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(t,n,r,i,o){return this._safety.tryCatchReturn(()=>{if(le.requireArgument(t,"name"),(i==null?void 0:i.id)!==void 0)throw new Error("Cannot specify id for root activity, use rootId argument instead");const a=new G$(t,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,n,r,i==null?void 0:i.perfStartOverride,this._nextGen.preferredRootIdLength,o);if(!this._allowMulti){const l={id:a.getId(),name:t,startPerfTime:a.getStartPerfTime(),isSampled:a.getIsSampled()};if(this._rootActivityHistory.add(l),this._singleRootActivity&&!this._singleRootActivity.isStopped){const c=this._singleRootActivity.getId();this._singleRootActivity.terminate(),a.preRootId=c}this._singleRootActivity=a}return a},Q$,{op:"startRootActivity"})}_handleRootActivityStop(t){const n=this._rootActivityHistory.findById(t.id);if(n&&(n.stopPerfTime=t.stopPerfTime,n.startPerfTime=t.startPerfTime),t.stopReason===Jm)return;const r=this._getActivityData(t);this._logActivity(r,t.startTimestamp),this._singleRootActivity=void 0}_getActivityData(t){const n=super._getActivityData(t);return n.isRoot=t.isRoot,n.preRootId=t.preRootId,n}getSingleRootActivityId(){var t;return(t=this._singleRootActivity)===null||t===void 0?void 0:t.getId()}isSingleRootActivitySampled(){var t;return(t=this._singleRootActivity)===null||t===void 0?void 0:t.getIsSampled()}isSingleRootActivityExternalSampled(){var t,n;return(n=(t=this._singleRootActivity)===null||t===void 0?void 0:t.isExternalSampled)!==null&&n!==void 0?n:!1}_initMetrics(){return new Sx(this.name,()=>this.name)}getRootActivityHistoryEntry(t){return this._rootActivityHistory.findByTime(t)}}const Z$=5;class ez{constructor(t,n){this._instr=t,this._doc=n,this._isActive=!1,this._boundClickListener=this._clickListener.bind(this),le.requireArgument(t,"_instr"),le.requireArgument(n,"_doc")}activate(){this._isActive||(this._doc.addEventListener("click",this._boundClickListener,!0),this._isActive=!0)}deactivate(){this._isActive&&(this._doc.removeEventListener("click",this._boundClickListener,!0),this._isActive=!1)}markEventHandled(t){this._ignoredEvent=t}_clickListener(t){var n;let r=(n=t.composedPath)===null||n===void 0?void 0:n.call(t);(!r||!r.length)&&(r=t.path);const i=this._getClickableElement(r);i&&setTimeout(()=>{t!==this._ignoredEvent&&this._instr.domEvent(t,i,void 0,void 0,{_auto:!0})})}_getClickableElement(t){var n,r;const i=t?Math.min(t.length,Z$):0;for(let o=0;o<i;o+=1){const a=t[o],l=(n=a.tagName)===null||n===void 0?void 0:n.toLowerCase();if(l==="a"||l==="button")return a;if(l==="input"){const c=a;if(((r=c.type)===null||r===void 0?void 0:r.toLowerCase())==="button")return c}}}}const Cx="o11y:receiver";var rg;(function(e){e[e.Unknown=0]="Unknown",e[e.Opening=1]="Opening"})(rg||(rg={}));class tz{constructor(t,n,r){this._logCallback=t,this._metricsCallback=n,this._commErrorCallback=r,this._senders=new Map,le.requireArgument(this._logCallback,"_logCallback","function"),le.requireArgument(this._metricsCallback,"_metricsCallback","function"),le.requireArgument(this._commErrorCallback,"_commErrorCallback","function")}openComms(t){if(le.requireArgument(t,"sender","object"),!this._senders.has(t)){const n=new MessageChannel,r={state:rg.Opening,port:n.port1};this._senders.set(t,r),r.port.onmessage=this._messagePortEventHandler.bind(this),r.port.onmessageerror=this._messagePortErrorHandler.bind(this),t.postMessage({from:Cx,type:kx},"*",[n.port2])}}closeComms(t){const n=this._senders.get(t);n&&(n.port.onmessage=void 0,n.port.onmessageerror=void 0,this._senders.delete(t))}_messagePortEventHandler(t){t.data.type===Ox?this._logCallback(t.data.data):t.data.type===Nx&&this._metricsCallback(t.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const kx="handshake",Ox="log",Nx="metrics";class nz{constructor(t,n){this._self=t,this._allowedOrigins=n,this._messageEventHandlerFunc=this._messageEventHandler.bind(this),this._handshakeComplete=!1,this._logBuffer=[],this._metricsBuffer=[],le.requireArgument(this._self,"_self","object"),le.requireArgumentIfDefined(n,"allowedOrigins",Array),this._self.addEventListener("message",this._messageEventHandlerFunc)}_messageEventHandler(t){t.data.from===Cx&&t.data.type===kx&&t.ports[0]instanceof MessagePort&&le.isAllowedOrigin(t.origin,this._allowedOrigins)&&(this._handshakeComplete=!0,this._self.removeEventListener("message",this._messageEventHandlerFunc),this._otherPort=t.ports[0],this._emptyBuffers())}sendLog(t){this._handshakeComplete?this._otherPort.postMessage({type:Ox,data:t}):this._logBuffer.push(t)}sendMetrics(t){this._handshakeComplete?this._otherPort.postMessage({type:Nx,data:t}):this._metricsBuffer.push(t)}_emptyBuffers(){this._logBuffer.forEach(t=>this.sendLog(t)),this._metricsBuffer.forEach(t=>this.sendMetrics(t)),this._logBuffer=void 0,this._metricsBuffer=void 0}}class rz{constructor(){this._upCounters=[],this._valueRecorders=[],this._bucketHistograms=[]}add(t){var n,r,i;!((n=t.upCounters)===null||n===void 0)&&n.length&&this._upCounters.push(...t.upCounters.map(o=>new Km(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.createdTimestamp,o.lastUpdatedTimestamp,o.value))),!((r=t.valueRecorders)===null||r===void 0)&&r.length&&this._valueRecorders.push(...t.valueRecorders.map(o=>new vx(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.createdTimestamp,o.lastUpdatedTimestamp,o.values))),!((i=t.bucketHistograms)===null||i===void 0)&&i.length&&this._bucketHistograms.push(...t.bucketHistograms.map(o=>new _x(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.buckets,o.createdTimestamp,o.lastUpdatedTimestamp,o.values)))}getUpCounters(){return this._upCounters=this._upCounters.filter(t=>t.getLastUpdatedOn()!==void 0),this._upCounters}getValueRecorders(){return this._valueRecorders=this._valueRecorders.filter(t=>t.getLastUpdatedOn()!==void 0),this._valueRecorders}getBucketHistograms(){return this._bucketHistograms=this._bucketHistograms.filter(t=>t.getLastUpdatedOn()!==void 0),this._bucketHistograms}}const iz=1e3;class sz{constructor(t,n){this._connector=t,this._pollInterval=iz,le.requireArgument(t,"_connector","object"),le.requireArgumentIfDefined(n,"_pollInterval","number")&&n>0&&(this._pollInterval=n)}collect(t,n,r){const i={schema:t,data:n,logMeta:r};this._connector.sendLog(i)}receiveMetricsExtractors(t){this._metricsExtractors=t,this._collectAndSendMetrics(),setInterval(this._collectAndSendMetrics.bind(this),this._pollInterval)}_collectAndSendMetrics(){const t={upCounters:pi.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:pi.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:pi.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(t.upCounters.length||t.valueRecorders.length||t.bucketHistograms.length)&&this._connector.sendMetrics(t)}}const Ix=80,oz=32,Px="_CUT",az=Ix-Px.length;function od(){}class ad{get preferredRootIdLength(){return this._preferredRootIdLength}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(t){this._pagePayloadProvider=t}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(t){this._appPayloadProvider=t}constructor(t){this._idleDetector=t,this._logCollectors=new Set,this._instruments=new Map,this._seqBySchema=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[],this._logCollectionListeners=new Set,this._opMode="default",this._isSender=!1,this._isReceiver=!1,this._decimalPoints=2}registerApp(t,n){var r,i;if(le.requireArgument(t,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(t))throw new Error(`The instrumentation name ${t} is already taken`);if(Ko.setOwnerAppName(t),this._initOpMode(n==null?void 0:n.operationMode),this._isSender=this._opMode==="sender",this._isReceiver=this._opMode==="receiver",(n==null?void 0:n.decimalPoints)!==void 0&&(this._decimalPoints=n.decimalPoints),this._preferredRootIdLength=(r=n==null?void 0:n.preferredRootIdLength)!==null&&r!==void 0?r:oz,this._clientSessionId=((i=n==null?void 0:n.clientSessionId)===null||i===void 0?void 0:i.toString())||le.generateUniqueId(),this._appInstr=new J$(this,t,n==null?void 0:n.allowMultipleRootActivities),this._instruments.set(t,this._appInstr),this._isSender){const l=new sz(new nz(window,n==null?void 0:n.allowedReceiverOrigins),n==null?void 0:n.senderMetricsPollingInterval);this.registerLogCollector(l),this.registerMetricsCollector(l)}else this._isReceiver&&(this._metricsStore=new rz,this._receiverConnector=new tz(l=>{l.logMeta.receiverClientSessionId=this._clientSessionId,l.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(l.schema,l.data,l.logMeta)},l=>{this._metricsStore.add(l)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(n==null?void 0:n.enableBuffering);const a=new Oe(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),bucketValue:this._appInstr.bucketValue.bind(this._appInstr),networkInstrumentation:a.networkInstrumentation.bind(a),registerForLogPrompt:this._appInstr.registerForLogPrompt.bind(this._appInstr),activity:this._appInstr.activity.bind(this._appInstr),activityAsync:this._appInstr.activityAsync.bind(this._appInstr),invokeNetworkCallWithHeaders:this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this._isSender?od:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?od:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this),promptLogCollection:this.promptLogCollection.bind(this),getClientSessionId:this.getClientSessionId.bind(this),getOperationMode:this.getOperationMode.bind(this),startReceiving:this._isReceiver?this._receiverConnector.openComms.bind(this._receiverConnector):od,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):od}}getInstrumentation(t){le.requireArgument(t,"name","string"),t.length>Ix&&(t=t.substring(0,az)+Px);let n=this._instruments.get(t);if(!n)n=new Ou(this,t),this._instruments.set(t,n);else if(n===this._appInstr)throw new Error(`The instrumentation name ${t} is being used by the app.`);return n}get appName(){var t;return(t=this._appInstr)===null||t===void 0?void 0:t.name}getRootActivityHistoryEntryByTime(t){var n;return(n=this._appInstr)===null||n===void 0?void 0:n.getRootActivityHistoryEntry(t)}addLog(t,n,r,i,o,a){var l,c,d;rd.checkInputs(n,r),this._sequence+=1;const h=Nt.isInternal(n),p=h&&(r!=null&&r.userPayload)?r.userPayload.schema:n,g=Nt.getSchemaId(p);let m=this._seqBySchema.get(g)||0;m+=1,this._seqBySchema.set(g,m);const E={timestamp:i,rootId:o,sequence:this._sequence,schemaSequence:m,loggerName:t,pagePayload:void 0,appPayload:void 0,loggerAppName:this.appName,connectionType:le.getConnectionType(),clientSessionId:this._clientSessionId,age:le.getAge(i),tenantClass:a||void 0},S={schema:n,data:r,logMeta:E};if(E.pagePayload=rd.getPayloadFromProvider(this.pagePayloadProvider,S),E.appPayload=rd.getPayloadFromProvider(this.appPayloadProvider,S),this._isSender||(r=le.clone(r)),typeof this._decimalPoints=="number"&&(le.roundNumbersInObject(r,this._decimalPoints),h&&le.roundNumbersInObject((l=r.userPayload)===null||l===void 0?void 0:l.payload,this._decimalPoints),le.roundNumbersInObject((c=E.pagePayload)===null||c===void 0?void 0:c.payload,this._decimalPoints),le.roundNumbersInObject((d=E.appPayload)===null||d===void 0?void 0:d.payload,this._decimalPoints)),this._isBufferingEnabled){const T={schema:n,data:r,logMeta:E};this._buffer.push(T)}return this._multiplex(n,r,E),this._sequence}_multiplex(t,n,r){const i=Array.from(this._logCollectors).filter(o=>{var a;return!this._forceDisabledLogCollectors.has(o)&&!(!((a=o.getIsCollectDisabled)===null||a===void 0)&&a.call(o))});if(i.length>0)for(const o of i){let a=this._logCollectorFailures.get(o)||0;try{o.collect(t,n,r),a>0&&this._logCollectorFailures.set(o,a-1)}catch(l){a+=1,a>=ad._collectorFailureLimit?(this._forceDisabledLogCollectors.add(o),this._appInstr&&(typeof l=="string"||l instanceof Error)&&this._appInstr.error(l)):this._logCollectorFailures.set(o,a)}}}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getDefaultInstrumentationContext(){var t,n,r;return{rootId:(t=this._appInstr)===null||t===void 0?void 0:t.getSingleRootActivityId(),isRootActivitySampled:(n=this._appInstr)===null||n===void 0?void 0:n.isSingleRootActivitySampled(),isRootActivityExternalSampled:(r=this._appInstr)===null||r===void 0?void 0:r.isSingleRootActivityExternalSampled()}}activateClickTracker(){typeof document!="undefined"&&(this._autoClickTracker||(this._autoClickTracker=new ez(this._appInstr,document)),this._autoClickTracker.activate())}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(t,n){if(le.requireArgument(t,"collector"),!this._logCollectors.has(t)&&(this._logCollectors.add(t),this._logCollectorFailures.set(t,0),(!t.getIsCollectDisabled||!t.getIsCollectDisabled())&&(n!=null&&n.retroactive)))for(const r of this._buffer)t.collect(r.schema,r.data,r.logMeta)}registerMetricsCollector(t){if(le.requireArgument(t,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=t,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this._getAllUpCounters.bind(this),getAllValueRecorders:this._getAllValueRecorders.bind(this),getAllBucketHistograms:this._getAllBucketHistograms.bind(this)})}_getAllUpCounters(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getUpCounters())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getUpCounters()).flat()).concat(Ko.getUpCounters())}_getAllValueRecorders(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getValueRecorders())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getValueRecorders()).flat()).concat(Ko.getValueRecorders())}_getAllBucketHistograms(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getBucketHistograms())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getBucketHistograms()).flat()).concat(Ko.getBucketHistograms())}registerForLogPrompt(t){this._logCollectionListeners.add(t)}promptLogCollection(t){for(const n of this._logCollectionListeners.keys())try{n(t)}catch(r){if(!le.isProduction)throw r}}getClientSessionId(){return this._clientSessionId}_initOpMode(t){if(typeof t=="function"&&(t=t()),(t===void 0||typeof window!="object")&&(t="default"),["default","receiver","sender"].indexOf(t)>=0)this._opMode=t;else throw new Error(`Invalid operation mode: ${t}`)}getOperationMode(){return this._opMode}}ad._collectorFailureLimit=5;class uz{get _lazyNextGen(){return this._nextgen||(this._nextgen=new ad(this._idleDetector)),this._nextgen}constructor(t){this._idleDetector=t,le.requireArgument(t,"_idleDetector")}registerInstrumentedApp(t,n){const r=this._lazyNextGen.registerApp(t,n);return n&&(le.markProduction(n.isProduction),this._nextgen.appPayloadProvider=n.appPayloadProvider,this._nextgen.pagePayloadProvider=n.pagePayloadProvider),r}getInstrumentation(t){return this._lazyNextGen.getInstrumentation(t)}}const lz=le.time.bind(le),cz="sfcore.customCmp.CustomComponentLog",dz={Error:"Crimson",Activity:"CadetBlue",InstrumentedEvent:"DarkOliveGreen",O11ySample:"BlueViolet"},fz={Error:"white",Activity:"white",InstrumentedEvent:"white",O11ySample:"white"},Rx="black",Lx="Gainsboro";class hz{constructor(t){this._simpleFilters=new Set,this._regexFilters=[],t&&this._log("ConsoleCollector",t)}collect(t,n,r){const i=Nt.getSchemaId(t);if(!this._shouldLog(i))return;if(i===cz){this._logCustom(n);return}let o,a,l;Nt.isInternal(t)?(o=t.name,a=fz[t.name]||Rx,l=dz[t.name]||Lx):o=i,this._log(o,n,r,a,l)}_shouldLog(t){return this._simpleFilters.size==0&&this._regexFilters.length==0?!0:this._simpleFilters.has(t)||this._regexFilters.some(n=>n.test(t))}addFilter(t){t instanceof RegExp?this._regexFilters.push(t):this._simpleFilters.add(t)}removeFilter(t){if(t instanceof RegExp){const n=this._regexFilters.findIndex(r=>r.source===t.source);n>=0&&this._regexFilters.splice(n,1)}else this._simpleFilters.delete(t)}clearFilters(){this._simpleFilters.clear(),this._regexFilters.splice(0,this._regexFilters.length)}getFilters(){return Array.from(this._simpleFilters).concat(this._regexFilters).sort()}_log(t,n,r,i=Rx,o=Lx){const a=`color:${i};background-color:${o}`;console.log(`%cO11Y%c ${t}`,"color:white;background-color:#FF6600;font-weight:bold",a,n||"",r||"")}_logCustom(t){console.log("%clightning/logger","color:white;background-color:#00a1e0;font-weight:bold",t||"")}}const pz="260.0.0",Dx=new v$({logThreshold:300,reportListener:e=>{Zo==null||Zo.log(ZH,e)},errorListener:(e,t)=>{Zo==null||Zo.error(e,t)}}),ud=new uz(Dx),mz=ud.registerInstrumentedApp.bind(ud),Mx=ud.getInstrumentation.bind(ud),Zo=Mx("IdleDetector"),gz=Object.freeze(Object.defineProperty({__proto__:null,ConsoleCollector:hz,_version:pz,getInstrumentation:Mx,idleDetector:Dx,registerInstrumentedApp:mz,time:lz},Symbol.toStringTag,{value:"Module"})),yz="264.105.0",Ez="o11y";class ea{constructor(){this._envelope={diagnostics:{key:Ez,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:yz},bundles:[],metrics:{bucketHistograms:[],upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(t){return this._envelope.staticAttributes=t,this}withLogs(t,n){let r=this._envelope.bundles.find(i=>i.schemaName===t);if(r)for(const i of n)r.messages.push(i);else r={schemaName:t,messages:n},this._envelope.bundles.push(r);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static getUpCounters(t,n=!0){return pi.getUpCounters(t,n)}static getValueRecorders(t,n=!0){return pi.getValueRecorders(t,n)}static getBucketHistograms(t,n=!0){return pi.getBucketHistograms(t,n)}withUpCounters(t){for(const n of t)this._envelope.metrics.upCounters.push(n);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(t){for(const n of t)this._envelope.metrics.valueRecorders.push(n);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}withBucketHistograms(t){for(const n of t)this._envelope.metrics.bucketHistograms.push(n);return this._envelope.diagnostics.bucketHistogramCount=this._envelope.metrics.bucketHistograms.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=le.time().tsNow,this._envelope}static buildFrom(t){const n=new ea;return t.staticAttributes&&n.withStaticAttributes(t.staticAttributes),t.messages&&t.messages.forEach((r,i)=>{n.withLogs(Nt.getSchemaId(i),r)}),t.upCounters&&n.withUpCounters(t.upCounters),t.valueRecorders&&n.withValueRecorders(t.valueRecorders),t.bucketHistograms&&n.withBucketHistograms(t.bucketHistograms),n.build()}}var ig;(function(e){var t,n;t={1:[function(r,i,o){i.exports=function(a,l){for(var c=Array(arguments.length-1),d=0,h=2,p=!0;h<arguments.length;)c[d++]=arguments[h++];return new Promise(function(g,m){c[d]=function(E){if(p)if(p=!1,E)m(E);else{for(var S=Array(arguments.length-1),T=0;T<S.length;)S[T++]=arguments[T];g.apply(null,S)}};try{a.apply(l||null,c)}catch(E){p&&(p=!1,m(E))}})}},{}],2:[function(r,i,o){o.length=function(h){var p=h.length;if(!p)return 0;for(var g=0;1<--p%4&&(h[0|p]||"")=="=";)++g;return Math.ceil(3*h.length)/4-g};for(var a=Array(64),l=Array(123),c=0;c<64;)l[a[c]=c<26?c+65:c<52?c+71:c<62?c-4:c-59|43]=c++;o.encode=function(h,p,g){for(var m,E=null,S=[],T=0,v=0;p<g;){var w=h[p++];switch(v){case 0:S[T++]=a[w>>2],m=(3&w)<<4,v=1;break;case 1:S[T++]=a[m|w>>4],m=(15&w)<<2,v=2;break;case 2:S[T++]=a[m|w>>6],S[T++]=a[63&w],v=0}8191<T&&((E=E||[]).push(String.fromCharCode.apply(String,S)),T=0)}return v&&(S[T++]=a[m],S[T++]=61,v===1&&(S[T++]=61)),E?(T&&E.push(String.fromCharCode.apply(String,S.slice(0,T))),E.join("")):String.fromCharCode.apply(String,S.slice(0,T))};var d="invalid encoding";o.decode=function(h,p,g){for(var m,E=g,S=0,T=0;T<h.length;){var v=h.charCodeAt(T++);if(v==61&&1<S)break;if((v=l[v])===e)throw Error(d);switch(S){case 0:m=v,S=1;break;case 1:p[g++]=m<<2|(48&v)>>4,m=v,S=2;break;case 2:p[g++]=(15&m)<<4|(60&v)>>2,m=v,S=3;break;case 3:p[g++]=(3&m)<<6|v,S=0}}if(S===1)throw Error(d);return g-E},o.test=function(h){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(h)}},{}],3:[function(r,i,o){i.exports=l;var a=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function l(c,d){typeof c=="string"&&(d=c,c=e);var h=[];function p(m){if(typeof m!="string"){var E=g();if(l.verbose&&console.log("codegen: "+E),E="return "+E,m){for(var S=Object.keys(m),T=Array(S.length+1),v=Array(S.length),w=0;w<S.length;)T[w]=S[w],v[w]=m[S[w++]];return T[w]=E,Function.apply(null,T).apply(null,v)}return Function(E)()}for(var C=Array(arguments.length-1),R=0;R<C.length;)C[R]=arguments[++R];if(R=0,m=m.replace(/%([%dfijs])/g,function(k,P){var I=C[R++];switch(P){case"d":case"f":return""+ +(""+I);case"i":return""+Math.floor(I);case"j":return JSON.stringify(I);case"s":return""+I}return"%"}),R!==C.length)throw Error("parameter count mismatch");return h.push(m),p}function g(m){return"function "+(function(E){return!E||!(E=(""+E).replace(/[^\w$]/g,""))?"":(/^\d/.test(E)&&(E="_"+E),a.test(E)?E+"_":E)})(m||d)+"("+(c&&c.join(",")||"")+`){
|
|
52
|
+
`))}function c(m,E,S,T){const v=S.enter("tableCell"),w=S.enter("phrasing"),C=S.containerPhrasing(m,pe(z({},T),{before:o,after:o}));return w(),v(),C}function d(m,E){return K7(m,{align:E,alignDelimiters:r,padding:n,stringLength:i})}function h(m,E,S){const T=m.children;let v=-1;const w=[],C=E.enter("table");for(;++v<T.length;)w[v]=p(T[v],E,S);return C(),w}function p(m,E,S){const T=m.children;let v=-1;const w=[],C=E.enter("tableRow");for(;++v<T.length;)w[v]=c(T[v],m,E,S);return C(),w}function g(m,E,S){let T=bw.inlineCode(m,E,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function FU(){return{exit:{taskListCheckValueChecked:vw,taskListCheckValueUnchecked:vw,paragraph:UU}}}function BU(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:jU}}}function vw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function UU(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const l=i[o];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function jU(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(a);let c=bw.listItem(e,t,n,z(z({},r),l.current()));return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(h){return h+a}}function HU(){return[b7(),j7(),V7(),NU(),FU()]}function $U(e){return{extensions:[_7(),H7(e),q7(),MU(e),BU()]}}const zU={tokenize:XU,partial:!0},Tw={tokenize:KU,partial:!0},ww={tokenize:QU,partial:!0},xw={tokenize:JU,partial:!0},VU={tokenize:ZU,partial:!0},Sw={name:"wwwAutolink",tokenize:YU,previous:Cw},Aw={name:"protocolAutolink",tokenize:GU,previous:kw},hi={name:"emailAutolink",tokenize:WU,previous:Ow},ei={};function qU(){return{text:ei}}let $s=48;for(;$s<123;)ei[$s]=hi,$s++,$s===58?$s=65:$s===91&&($s=97);ei[43]=hi,ei[45]=hi,ei[46]=hi,ei[95]=hi,ei[72]=[hi,Aw],ei[104]=[hi,Aw],ei[87]=[hi,Sw],ei[119]=[hi,Sw];function WU(e,t,n){const r=this;let i,o;return a;function a(p){return!Hm(p)||!Ow.call(r,r.previous)||$m(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(p))}function l(p){return Hm(p)?(e.consume(p),l):p===64?(e.consume(p),c):n(p)}function c(p){return p===46?e.check(VU,h,d)(p):p===45||p===95||wn(p)?(o=!0,e.consume(p),c):h(p)}function d(p){return e.consume(p),i=!0,c}function h(p){return o&&i&&Pn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function YU(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Cw.call(r,r.previous)||$m(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(zU,e.attempt(Tw,e.attempt(ww,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function GU(e,t,n){const r=this;let i="",o=!1;return a;function a(p){return(p===72||p===104)&&kw.call(r,r.previous)&&!$m(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),l):n(p)}function l(p){if(Pn(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),l;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(p),c}return n(p)}function c(p){return p===47?(e.consume(p),o?d:(o=!0,c)):n(p)}function d(p){return p===null||ec(p)||Tt(p)||As(p)||tc(p)?n(p):e.attempt(Tw,e.attempt(ww,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function XU(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function KU(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(xw,c,l)(d):d===null||Tt(d)||As(d)||d!==45&&tc(d)?c(d):(o=!0,e.consume(d),a)}function l(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function c(d){return i||r||!o?n(d):t(d)}}function QU(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(xw,t,o)(a):a===null||Tt(a)||As(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function JU(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),o):l===93?(e.consume(l),i):l===60||l===null||Tt(l)||As(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||Tt(l)||As(l)?t(l):r(l)}function o(l){return Pn(l)?a(l):n(l)}function a(l){return l===59?(e.consume(l),r):Pn(l)?(e.consume(l),a):n(l)}}function ZU(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return wn(o)?n(o):t(o)}}function Cw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function kw(e){return!Pn(e)}function Ow(e){return!(e===47||Hm(e))}function Hm(e){return e===43||e===45||e===46||e===95||wn(e)}function $m(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ej={tokenize:uj,partial:!0};function tj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sj,continuation:{tokenize:oj},exit:aj}},text:{91:{name:"gfmFootnoteCall",tokenize:ij},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nj,resolveTo:rj}}}}function nj(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const d=xr(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function rj(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function ij(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(p){if(o>999||p===93&&!a||p===null||p===91||Tt(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return i.includes(xr(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Tt(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}}function sj(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,l;return c;function c(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(E)}function h(E){if(a>999||E===93&&!l||E===null||E===91||Tt(E))return n(E);if(E===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=xr(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Tt(E)||(l=!0),a++,e.consume(E),E===92?p:h}function p(E){return E===91||E===92||E===93?(e.consume(E),a++,h):h(E)}function g(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),i.includes(o)||i.push(o),ft(e,m,"gfmFootnoteDefinitionWhitespace")):n(E)}function m(E){return t(E)}}function oj(e,t,n){return e.check(Ja,t,e.attempt(ej,t,n))}function aj(e){e.exit("gfmFootnoteDefinition")}function uj(e,t,n){const r=this;return ft(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function lj(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},p={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",h,l],["enter",a[d][1],l],["exit",a[d][1],l],["enter",p,l]],m=l.parser.constructs.insideSpan.null;m&&er(g,g.length,0,nc(m,a.slice(d+1,c),l)),er(g,g.length,0,[["exit",p,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",h,l]]),er(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function o(a,l,c){const d=this.previous,h=this.events;let p=0;return g;function g(E){return d===126&&h[h.length-1][1].type!=="characterEscape"?c(E):(a.enter("strikethroughSequenceTemporary"),m(E))}function m(E){const S=wo(d);if(E===126)return p>1?c(E):(a.consume(E),p++,m);if(p<2&&!n)return c(E);const T=a.exit("strikethroughSequenceTemporary"),v=wo(E);return T._open=!v||v===2&&!!S,T._close=!S||S===2&&!!v,l(E)}}}class cj{constructor(){this.map=[]}add(t,n,r){dj(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function dj(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function fj(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function hj(){return{flow:{null:{name:"table",tokenize:pj,resolveAll:mj}}}}function pj(e,t,n){const r=this;let i=0,o=0,a;return l;function l($){let te=r.events.length-1;for(;te>-1;){const G=r.events[te][1].type;if(G==="lineEnding"||G==="linePrefix")te--;else break}const Q=te>-1?r.events[te][1].type:null,q=Q==="tableHead"||Q==="tableRow"?P:c;return q===P&&r.parser.lazy[r.now().line]?n($):q($)}function c($){return e.enter("tableHead"),e.enter("tableRow"),d($)}function d($){return $===124||(a=!0,o+=1),h($)}function h($){return $===null?n($):Ke($)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),m):n($):at($)?ft(e,h,"whitespace")($):(o+=1,a&&(a=!1,i+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),p($)))}function p($){return $===null||$===124||Tt($)?(e.exit("data"),h($)):(e.consume($),$===92?g:p)}function g($){return $===92||$===124?(e.consume($),p):p($)}function m($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),a=!1,at($)?ft(e,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):E($))}function E($){return $===45||$===58?T($):$===124?(a=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),S):k($)}function S($){return at($)?ft(e,T,"whitespace")($):T($)}function T($){return $===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),v):$===45?(o+=1,v($)):$===null||Ke($)?R($):k($)}function v($){return $===45?(e.enter("tableDelimiterFiller"),w($)):k($)}function w($){return $===45?(e.consume($),w):$===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C($))}function C($){return at($)?ft(e,R,"whitespace")($):R($)}function R($){return $===124?E($):$===null||Ke($)?!a||i!==o?k($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):k($)}function k($){return n($)}function P($){return e.enter("tableRow"),I($)}function I($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),I):$===null||Ke($)?(e.exit("tableRow"),t($)):at($)?ft(e,I,"whitespace")($):(e.enter("data"),U($))}function U($){return $===null||$===124||Tt($)?(e.exit("data"),I($)):(e.consume($),$===92?ee:U)}function ee($){return $===92||$===124?(e.consume($),U):U($)}}function mj(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,h,p;const g=new cj;for(;++n<e.length;){const m=e[n],E=m[1];m[0]==="enter"?E.type==="tableHead"?(l=!1,c!==0&&(Nw(g,t,c,d,h),h=void 0,c=0),d={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},g.add(n,0,[["enter",d,t]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},g.add(n,0,[["enter",h,t]])),i=E.type==="tableDelimiterRow"?2:h?3:1):i&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],p=Qc(g,t,o,i,void 0,p),o=[0,0,0,0]),a[2]=n)):E.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],p=Qc(g,t,o,i,void 0,p)),o=a,a=[o[1],n,0,0])):E.type==="tableHead"?(l=!0,c=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(c=n,o[1]!==0?(a[0]=a[1],p=Qc(g,t,o,i,n,p)):a[1]!==0&&(p=Qc(g,t,a,i,n,p)),i=0):i&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&Nw(g,t,c,d,h),g.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=fj(t.events,n))}return e}function Qc(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(o.end=Object.assign({},Go(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=Go(t.events,n[1]);if(o={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Go(t.events,n[2]),h=Go(t.events,n[3]),p={type:l,start:Object.assign({},d),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const g=t.events[n[2]],m=t.events[n[3]];if(g[1].end=Object.assign({},m[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,S=n[3]-n[2]-1;e.add(E,S,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},Go(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Nw(e,t,n,r,i){const o=[],a=Go(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Go(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gj={name:"tasklistCheck",tokenize:Ej};function yj(){return{text:{91:gj}}}function Ej(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return Tt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ke(c)?t(c):at(c)?e.check({tokenize:bj},t,n)(c):n(c)}}function bj(e,t,n){return ft(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function _j(e){return sb([qU(),tj(),lj(e),hj(),yj()])}const vj={};function Tj(e){const t=this,n=e||vj,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(_j(n)),o.push(HU()),a.push($U(n))}const wj=()=>A.jsx("span",{className:`${D}-blinking-cursor`,children:A.jsx("svg",{"aria-hidden":"true",height:"16px",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:A.jsx("circle",{r:"0.45rem",cx:"0.5rem",cy:"0.55rem",fill:"black"})})}),Xo=({globalClassName:e,openLinksInNewTab:t,showIsLoading:n,text:r,onLinkClick:i})=>A.jsx(Kb,{remarkPlugins:[Tj],rehypePlugins:[Q_],components:{h1:({children:o})=>A.jsx("h1",{className:H(e,`${D}-header h1`),children:o}),h2:({children:o})=>A.jsx("h2",{className:H(e,`${D}-header h2`),children:o}),h3:({children:o})=>A.jsx("h3",{className:H(e,`${D}-header h3`),children:o}),ul:({children:o})=>A.jsx("ul",{className:H(e,`${D}-ul`),children:o}),ol:({children:o})=>A.jsx("ol",{className:H(e,`${D}-ol`),children:o}),li:({children:o})=>A.jsx("li",{className:H(e,`${D}-li`),children:o}),a:({href:o,children:a})=>A.jsx(iv,{globalClassName:e,openLinksInNewTab:t,href:o,onClick:i,children:a}),table:({children:o})=>A.jsx("div",{className:H(e,`${D}-table-container`),children:A.jsx("table",{className:H(e,`${D}-table`),children:o})}),thead:({children:o})=>A.jsx("thead",{className:H(e,`${D}-thead`),children:o}),tbody:({children:o})=>A.jsx("tbody",{className:H(e,`${D}-tbody`),children:o}),tr:({children:o})=>A.jsx("tr",{className:H(e,`${D}-tr`),children:o}),th:({children:o})=>A.jsx("th",{className:H(e,`${D}-th`),children:o}),td:({children:o})=>A.jsx("td",{className:H(e,`${D}-td`),children:o}),span:({className:o,children:a})=>o===`${D}-blinking-cursor`?A.jsx(wj,{}):A.jsx("span",{children:a})},children:r+(n?`<span className='${D}-blinking-cursor'></span>`:"")});function xj(){const{messages:e}=Vt();return L.useMemo(()=>N3(e,"cart"),[e])}const qi=()=>L.useContext(dE),zs=()=>{const{sendMessage:e,loading:t,isConnected:n}=Vt(),{mode:r,status:i}=Hr();return L.useMemo(()=>({sendMessage:e,isLoading:t,isConnected:n,componentType:i.type,mode:r}),[e,t,n,i.type,r])};function Sj(e){return e.includes("-")&&e===e.toLowerCase()}function Wi({tagName:e,props:t,label:n}){const r=L.useRef(null),i=L.useRef(null),o=L.useRef(e),a=L.useRef(null);return L.useEffect(()=>{const l=r.current;if(!l)return;if(o.current!==e&&(o.current=e,i.current=null),!Sj(e)){a.current!==e&&(a.current=e,_t(!0,"error",`[CimulateOverrides] ${n||"Override"} rejected: "${e}" is not a valid custom element name (must contain a hyphen and be lowercase, e.g. "product-card").`)),i.current=null,l.replaceChildren();return}const c=i.current;if(c&&c.isConnected)try{c.props=t;return}catch(d){_t(!0,"error",`[CimulateOverrides] ${n||"Override"} threw an error during props update:`,d),i.current=null,l.replaceChildren();return}try{const d=document.createElement(e);d.props=t,l.replaceChildren(d);const h=d.localName;i.current=typeof customElements!="undefined"&&customElements.get(h)?d:null}catch(d){_t(!0,"error",`[CimulateOverrides] ${n||"Override"} threw an error:`,d),i.current=null,l.replaceChildren()}},[e,t,n]),L.useEffect(()=>{const l=r.current;return()=>{i.current=null,l==null||l.replaceChildren()}},[]),A.jsx("div",{ref:r,"data-override":n||"custom"})}class Iw extends L.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){_t(!0,"error",`Override "${this.props.overrideName}" threw during render:`,t,n.componentStack)}render(){return this.state.hasError?null:this.props.children}}function Aj(e){return dt({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Image_Off"},child:[{tag:"path",attr:{d:"M19.937,14.218l0,-8.654c0,-0.829 -0.672,-1.5 -1.5,-1.5l-10.628,-0c-0.276,-0 -0.5,-0.225 -0.5,-0.5c0,-0.276 0.224,-0.5 0.5,-0.5l10.628,-0c1.38,-0 2.5,1.118 2.5,2.5l0,10.624c0,0.276 -0.224,0.5 -0.5,0.501c-0.276,-0 -0.5,-0.225 -0.5,-0.5l0,-0.556l-4.583,-4.584c-0.456,-0.456 0.251,-1.163 0.707,-0.707c0.162,0.162 2.37,2.37 3.876,3.876Zm-0.121,6.304c-0.395,0.262 -0.869,0.415 -1.379,0.415l-12.874,-0c-1.381,-0 -2.5,-1.119 -2.5,-2.5l0,-12.873c0,-0.51 0.153,-0.984 0.414,-1.38l-0.263,-0.263c-0.456,-0.456 0.251,-1.163 0.707,-0.707c0.088,0.088 0.176,0.176 0.263,0.263c0.245,0.245 16.095,16.094 16.339,16.338l0.263,0.263c0.455,0.456 -0.252,1.163 -0.707,0.707c-0.088,-0.087 -0.175,-0.175 -0.263,-0.263Zm-11.104,-11.103l-2.001,-2.001c-0.094,0.196 -0.146,0.415 -0.146,0.647c-0,0.829 0.672,1.5 1.5,1.5c0.232,-0 0.451,-0.052 0.647,-0.146Zm-2.733,-2.733l-1.77,-1.77c-0.093,0.196 -0.146,0.416 -0.146,0.648l0,10.717l1.926,-1.926c0.587,-0.586 1.536,-0.586 2.122,-0l0.555,0.554c0.195,0.196 0.511,0.196 0.706,0l2.415,-2.415l-2.343,-2.343c-0.395,0.262 -0.869,0.414 -1.379,0.414c-1.38,-0 -2.5,-1.119 -2.5,-2.5c-0,-0.509 0.152,-0.983 0.414,-1.379Zm-1.916,11.009l0,0.741c0,0.829 0.671,1.5 1.5,1.5l12.874,0c0.232,0 0.451,-0.052 0.647,-0.145c-0.165,-0.165 -3.264,-3.263 -6.59,-6.59l-2.414,2.415c-0.585,0.586 -1.537,0.586 -2.122,0l-0.554,-0.554c-0.195,-0.196 -0.512,-0.196 -0.708,0l-2.633,2.633Z"},child:[]}]}]})(e)}const Cj=({imageUrl:e,globalClassName:t,isCartMgmtSupported:n,productPageUrl:r,openLinksInNewTab:i,ariaLabel:o,name:a,showInWidgetDetails:l})=>{const{loading:c}=Vt(),{onNavigate:d}=it();return A.jsx("div",{className:H(t,`${D}-msg-product-card__image-wrapper`),children:e?n?A.jsx("button",{type:"button",className:H(t,`${D}-msg-product-card__image-button`),onClick:l,disabled:c,"aria-label":o,children:A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"})}):r?A.jsx("a",{href:r,target:i?"_blank":"_self",rel:"noopener","aria-label":o,onClick:h=>Xc({event:h,href:r,openLinksInNewTab:i,isCartMgmtSupported:n,onNavigate:d}),children:A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"})}):A.jsx("img",{className:H(t,`${D}-msg-product-card__image`),src:e,alt:a||"Product image",loading:"lazy"}):A.jsx("div",{className:H(t,`${D}-msg-product-card__image-placeholder`),"aria-label":a?`No image for ${a}`:"No product image",role:"img",children:A.jsx(Aj,{"aria-hidden":"true"})})})},kj=({name:e,globalClassName:t,isCartMgmtSupported:n,productPageUrl:r,openLinksInNewTab:i,ariaLabel:o,showInWidgetDetails:a})=>{const{loading:l}=Vt(),{onNavigate:c}=it();return n?A.jsx("button",{type:"button",disabled:l,onClick:a,className:H(t,`${D}-msg-product-card__title-link`),"aria-label":o,children:e}):r?A.jsx("a",{href:r,target:i?"_blank":"_self",rel:"noopener",className:H(t,`${D}-msg-product-card__title-link`),"aria-label":o,onClick:d=>Xc({event:d,href:r,openLinksInNewTab:i,isCartMgmtSupported:n,onNavigate:c}),children:e}):A.jsx("p",{className:H(t,`${D}-msg-product-card__title`),children:e})},Oj=({product:e,globalClassName:t,openLinksInNewTab:n,isCartMgmtSupported:r=!1,rawProduct:i})=>{const{showProductDescription:o,onNavigate:a}=it(),{overrides:l,isInitialized:c}=qi(),{sendMessage:d,loading:h}=Vt(),p=zs(),g=c?l.ProductTile:void 0;if(g){const Q={name:"ProductTile",payload:i!=null?i:{},api:p};return A.jsx(Wi,{tagName:g,props:Q,label:"ProductTile"})}const{id:m,name:E,imageUrl:S,description:T,productPageUrl:v,price:w,priceBreakdown:C,discountPrice:R,listPrice:k,currencyCode:P}=e,I=R!=null?R:w,U=ZB({priceBreakdown:C,currencyCode:P}),ee=()=>{if(h)return;const Q=E||"this product",q=m?` [SKU: ${m}]`:"";d(`Show me details for ${Q}${q}`)},$=Q=>Vi({event:Q,openLinksInNewTab:n,onNavigate:a}),te=r?`View details for ${E}`:`Go to product page for ${E}`;return A.jsxs("div",{className:H(t,`${D}-msg-product-card`),children:[A.jsx(Cj,{imageUrl:S||"",globalClassName:t,isCartMgmtSupported:r,productPageUrl:v,openLinksInNewTab:n,ariaLabel:te,name:E,showInWidgetDetails:ee}),A.jsxs("div",{className:H(t,`${D}-msg-product-card__content`),children:[A.jsxs("div",{className:H(t,`${D}-msg-product-card__content-header`),children:[A.jsx(kj,{name:E||m,globalClassName:t,isCartMgmtSupported:r,productPageUrl:v,openLinksInNewTab:n,ariaLabel:te,showInWidgetDetails:ee}),o&&T&&A.jsx("div",{className:H(t,`${D}-msg-product-card__description`),title:T,children:A.jsx(Xo,{globalClassName:t,text:T,openLinksInNewTab:n,onLinkClick:$})})]}),A.jsx("div",{className:H(t,`${D}-msg-product-card__price-row`),children:U?A.jsx("span",{className:H(t,`${D}-msg-product-card__price`),"aria-label":`Price from ${U.low} to ${U.high}`,children:U.range}):A.jsx(Pm,{globalClassName:t,retailPrice:k,discountPrice:I,currencyCode:P})})]})]})},Nj=e=>{var n,r,i;const t=Im(e.data.promotions,(n=e.data.extendedData)==null?void 0:n.productPromotions);return{id:e.id,name:e.data.name,label:e.caption,description:e.data.description,imageUrl:e.data.imageUrl,productPageUrl:e.data.productPageUrl,price:e.data.price,discountPrice:t!=null?t:e.data.discountPrice,listPrice:(r=e.data.listPrice)!=null?r:t===void 0?void 0:e.data.price,priceBreakdown:(i=e.data.priceBreakdown)!=null?i:void 0,currencyCode:e.data.currencyCode}},Ij=({title:e,products:t,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:o=!1})=>{const{showProductCaptions:a}=it(),{overrides:l,isInitialized:c}=qi(),d=zs(),h=c?l.ProductCarousel:void 0;if(h){const p={name:"ProductCarousel",payload:{title:e,products:t},api:d};return A.jsx(Wi,{tagName:h,props:p,label:"ProductCarousel"})}return A.jsxs("div",{style:{marginBottom:"1rem"},children:[e&&A.jsx("p",{className:H(n,`${D}-product-carousel-title`),children:e}),A.jsx(_B,{globalClassName:n,spacing:i?"0.5rem":"6px",ariaLabel:e||"Product recommendations",children:t.map(p=>A.jsxs("div",{className:H(n,`${D}-product-carousel-item`),children:[A.jsx(Oj,{product:Nj(p),rawProduct:p,globalClassName:n,openLinksInNewTab:r,isCartMgmtSupported:o}),a&&A.jsx("p",{className:H(n,`${D}-product-carousel-caption`),title:p.caption,children:p.caption})]},p.id))})]})},zm=44,Pj=400,Rj=e=>{const t=typeof e=="number"?e:Number(e);return!Number.isFinite(t)||t<=0?zm:Math.min(Math.max(Math.round(t),zm),Pj)},Lj=e=>{try{return new URL(e,window.location.href).origin}catch(t){return null}},Dj="parentOrigin",Mj=(e,t)=>{if(!t)return e;try{const n=new URL(e,window.location.href);return n.searchParams.set(Dj,t),n.toString()}catch(n){return e}},Fj=(e,t,n)=>{if(!e||!t)return null;try{const r=new URL(e,window.location.href);return r.origin!==window.location.origin||!/\/Payments-Express\/?$/.test(r.pathname)?null:(r.pathname=r.pathname.replace(/\/Payments-Express\/?$/,"/Payments-ExpressProduct"),r.searchParams.set("pid",t),r.searchParams.set("quantity",String(n)),r.toString())}catch(r){return null}},Bj="Payment failed. Please try again or choose another method.",Uj="Payment was canceled.",Pw=(e,t)=>typeof e!="string"?t:e.trim()||t,Rw=({expressPaymentUrl:e,globalClassName:t,onOrderComplete:n})=>{const r=L.useRef(null),[i,o]=L.useState(!1),[a,l]=L.useState(zm),[c,d]=L.useState(null),h=typeof window!="undefined"?window.location.origin:"",p=Mj(e,h),g=Lj(e);return L.useEffect(()=>{const m=E=>{var T,v,w,C,R;if(g&&E.origin!==g||r.current&&E.source!==r.current.contentWindow)return;const S=E.data;if(!(!S||typeof S.type!="string"))switch(S.type){case"express.payment.available":o(!0),l(Rj((T=S.payload)==null?void 0:T.height));break;case"express.payment.unavailable":o(!1);break;case"express.payment.success":d(null),n==null||n((w=(v=S.payload)==null?void 0:v.orderId)!=null?w:null);break;case"express.payment.failure":d({text:Pw((C=S.payload)==null?void 0:C.error,Bj),persist:!0});break;case"express.payment.cancel":{const k=Pw((R=S.payload)==null?void 0:R.cancel,Uj);d(P=>P!=null&&P.persist?P:{text:k,persist:!1});break}}};return window.addEventListener("message",m),()=>window.removeEventListener("message",m)},[g,n]),A.jsxs(A.Fragment,{children:[c&&A.jsxs("div",{className:H(t,`${D}-cart-express-error`),role:"alert","data-testid":"express-payment-error",children:[A.jsx(kI,{"aria-hidden":"true"}),A.jsx("span",{children:c.text}),A.jsx("button",{type:"button",className:H(t,`${D}-cart-express-error-dismiss`),onClick:()=>d(null),"aria-label":"Dismiss","data-testid":"express-payment-error-dismiss",children:A.jsx(PI,{"aria-hidden":"true"})})]}),A.jsx("div",{className:H(t,`${D}-cart-express`,{[`${D}-cart-express-ready`]:i}),style:i?{height:a}:void 0,"data-testid":"express-payment","aria-hidden":!i,children:A.jsx("iframe",{ref:r,className:H(t,`${D}-cart-express-frame`),src:p,title:"Express payment",allow:"payment *",scrolling:"no"})})]})},Jc=({code:e,globalClassName:t,inactive:n})=>A.jsxs("span",{className:H(t,`${D}-cart-chip`,{inactive:n}),title:n?"Not applied":void 0,children:[A.jsx(AE,{"aria-hidden":"true"}),A.jsx("span",{children:e})]}),Vn=({label:e,badge:t,value:n,currencyCode:r,globalClassName:i,emphasized:o,isDiscount:a,fallback:l,loading:c})=>{let d;if(typeof n=="number")d=fi(a?-Math.abs(n):n,r);else if(l)d=l;else return null;return A.jsxs("div",{className:H(i,`${D}-cart-total-row`,{emphasized:o}),children:[A.jsxs("span",{className:H(i,`${D}-cart-total-label`),children:[e,t&&A.jsx("span",{className:H(i,`${D}-cart-total-badge`),children:t})]}),A.jsx("span",{className:H(i,`${D}-cart-total-value`),children:c?A.jsx("span",{className:H(i,`${D}-cart-total-shimmer`)}):d})]})};function Lw(e){var o;const n=((o=e.variants)!=null?o:[]).filter(a=>a.value).map(a=>`${a.lbl}: ${a.value}`).join(", "),r=n?` (${n})`:"",i=e.productId?` [SKU: ${e.productId}]`:"";return`${e.name}${r}${i}`}function Dw(e){var r;const n=((r=e.variants)!=null?r:[]).filter(i=>i.value).map(i=>i.value).join(", ");return n?`${e.name} (${n})`:e.name}function Vm(e){return typeof e=="string"?e:e&&typeof e.code=="string"?e.code:null}function qm(e){return(e!=null?e:[]).map(Vm).filter(t=>t!==null)}function Mw(e){return e&&typeof e=="object"&&typeof e.status=="string"?e.status:void 0}function jj(e,t){var i;const n=new Map;for(const o of t!=null?t:[]){const a=Vm(o),l=Mw(o);a!==null&&l!==void 0&&n.set(a.toLowerCase(),l)}const r=[];for(const o of e!=null?e:[]){const a=Vm(o);if(a===null)continue;const l=(i=Mw(o))!=null?i:n.get(a.toLowerCase());r.push({code:a,applied:l==null||l==="applied"})}return r}function Fw(e,t,n){const r=new Set((e!=null?e:[]).flatMap(i=>qm(i.coupons)).map(i=>i.toLowerCase()));return jj(t,n).filter(i=>!r.has(i.code.toLowerCase()))}const Bw=e=>{const{sendMessage:t}=Vt();return{removeItem:o=>{e||t(`Remove ${Lw(o)} from my cart`,{displayContent:`Remove ${Dw(o)} from cart`,cartMutation:!0})},changeItemQuantity:(o,a)=>{e||a<1||t(`Update ${Lw(o)} quantity to ${a}`,{displayContent:`Update ${Dw(o)} to qty ${a}`,cartMutation:!0})},applyCoupon:o=>{const a=o.trim();!a||e||t(`Apply coupon code ${a}`,{cartMutation:!0})}}},Hj=e=>{const t=z({},e);return delete t.checkoutButtonUrl,delete t.expressPaymentUrl,t},$j=({quantity:e,disabled:t,globalClassName:n,onChange:r})=>{const[i,o]=L.useState(e.toString());L.useEffect(()=>{o(e.toString())},[e]);const a=d=>{if(t)return;const h=d.target.value;/^\d*$/.test(h)&&o(h)},l=()=>{const d=parseInt(i,10);!t&&!isNaN(d)&&d>0&&d!==e?r(d):o(e.toString())},c=d=>{d.key==="Enter"&&(d.preventDefault(),l())};return A.jsx("div",{className:H(n,`${D}-cart-qty-input-wrapper`),children:A.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:H(n,`${D}-cart-qty-input`),value:i,disabled:t,onChange:a,onBlur:l,onKeyDown:c,"aria-label":"Quantity"})})},zj=({item:e,currencyCode:t,disabled:n,globalClassName:r,onRemove:i,onQuantityChange:o})=>{var c,d;const a=typeof e.originalSubtotal=="number"&&typeof e.itemSubtotal=="number"&&e.originalSubtotal>e.itemSubtotal,l=qm(e.coupons);return A.jsxs("li",{className:H(r,`${D}-cart-item`),children:[e.imageUrl&&A.jsx("div",{className:H(r,`${D}-cart-item-image`),children:A.jsx("img",{src:e.imageUrl,alt:e.name||"Product image",loading:"lazy"})}),A.jsxs("div",{className:H(r,`${D}-cart-item-details`),children:[A.jsx("p",{className:H(r,`${D}-cart-item-name`),children:e.name}),A.jsxs("div",{className:H(r,`${D}-cart-item-attrs`),children:[((c=e.variants)!=null?c:[]).map(h=>A.jsxs("p",{className:H(r,`${D}-cart-item-attr`),children:[h.lbl,": ",h.value]},`${h.type}-${h.value}`)),((d=e.promotions)!=null?d:[]).map(h=>A.jsxs("p",{className:H(r,`${D}-cart-item-attr`),children:["Promotion: ",h]},h))]}),l.length>0&&A.jsx("div",{className:H(r,`${D}-cart-chips`),children:l.map(h=>A.jsx(Jc,{code:h,globalClassName:r},h))}),A.jsxs("span",{className:H(r,`${D}-cart-item-price`),children:[a&&A.jsx("span",{className:H(r,`${D}-cart-item-original-price`),children:fi(e.originalSubtotal,t)}),A.jsx("span",{className:H(r,`${D}-cart-item-final-price`),children:fi(e.itemSubtotal,t)})]}),A.jsxs("div",{className:H(r,`${D}-cart-item-footer`),children:[A.jsx("span",{className:H(r,`${D}-cart-qty-heading`),children:"Quantity"}),A.jsx($j,{quantity:e.quantity,disabled:n,globalClassName:r,onChange:h=>o(e,h)}),A.jsx("button",{type:"button",className:H(r,`${D}-cart-item-remove`),disabled:n,onClick:()=>i(e),children:"Remove"})]})]})]})},Uw=({expressPaymentUrl:e,checkoutButtonUrl:t,globalClassName:n,openLinksInNewTab:r})=>{const{sendMessage:i}=Vt(),{onNavigate:o}=it(),a=c=>Vi({event:c,href:t!=null?t:void 0,openLinksInNewTab:r,onNavigate:o}),l=c=>{i(c?`I completed the payment using Express Checkout. Show my order confirmation for order ${c}.`:"I completed the payment using Express Checkout. Show my order confirmation.")};return A.jsxs(A.Fragment,{children:[e&&A.jsx(Rw,{expressPaymentUrl:e,globalClassName:n,onOrderComplete:l}),t&&A.jsxs("a",{className:H(n,`${D}-cart-checkout-button`),href:t,target:r?"_blank":"_self",rel:"noopener noreferrer",onClick:a,children:[A.jsx(CI,{"aria-hidden":"true"}),A.jsx("span",{children:"Checkout"})]})]})},Vj=({cartOverrideTag:e,cart:t,productsToHighlight:n,readOnly:r,globalClassName:i,openLinksInNewTab:o})=>{const{loading:a,isConnected:l}=Vt(),{mode:c,status:d}=Hr(),h=a||!!r,{removeItem:p,changeItemQuantity:g,applyCoupon:m}=Bw(h),E=v=>t.items.find(w=>w.itemId===v),S={isConnected:l,isLoading:a,componentType:d.type,mode:c,cart:{setQuantity:(v,w)=>{var P,I;const C=E(v);if(!C)return;const R=Math.max(1,(P=C.minQuantity)!=null?P:1),k=(I=C.maxQuantity)!=null?I:1/0;g(C,Math.min(k,Math.max(R,Math.floor(w))))},remove:v=>{const w=E(v);w&&p(w)},applyCoupon:m}},T={name:"Cart",payload:{cart:Hj(t),productsToHighlight:n,readOnly:r},api:S};return A.jsxs("div",{className:H(i,`${D}-cart`),children:[A.jsx(Iw,{overrideName:"Cart",children:A.jsx(Wi,{tagName:e,props:T,label:"Cart"})}),A.jsx(Uw,{expressPaymentUrl:t.expressPaymentUrl,checkoutButtonUrl:t.checkoutButtonUrl,globalClassName:i,openLinksInNewTab:o})]})},qj=({cart:e,productsToHighlight:t,readOnly:n,globalClassName:r,openLinksInNewTab:i})=>{const{loading:o}=Vt(),{onNavigate:a}=it(),[l,c]=L.useState(!1),[d,h]=L.useState(""),{overrides:p,isInitialized:g}=qi(),m=g?p.Cart:void 0,E=o||!!n,{removeItem:S,changeItemQuantity:T,applyCoupon:v}=Bw(E),w=O=>Vi({event:O,openLinksInNewTab:i,onNavigate:a});if(m)return A.jsx(Vj,{cartOverrideTag:m,cart:e,productsToHighlight:t,readOnly:n,globalClassName:r,openLinksInNewTab:i});const{items:C=[],currencyCode:R="USD",subtotal:k,total:P,taxes:I,shippingCost:U,shippingDiscount:ee,shippingPromotions:$=[],promotionsDiscount:te,promotions:Q=[],couponsDiscount:q,bodyMessage:G,footerMessage:Y,checkoutButtonUrl:ce,expressPaymentUrl:ne}=e,J=Fw(C,e.couponsApplied,e.coupons),ae=()=>{const O=d.trim();!O||E||(v(O),h(""))};return A.jsxs("div",{className:H(r,`${D}-cart`,E&&`${D}-cart-busy`),children:[A.jsxs("div",{className:H(r,`${D}-cart-box`),children:[G&&A.jsxs("button",{type:"button",className:H(r,`${D}-cart-summary`),"aria-expanded":l,onClick:()=>c(O=>!O),children:[A.jsx("span",{className:H(r,`${D}-cart-summary-text`),children:A.jsx(Xo,{text:G,globalClassName:r,openLinksInNewTab:i,showIsLoading:!1,onLinkClick:w})}),A.jsx("span",{className:H(r,`${D}-cart-summary-toggle`),"aria-hidden":"true",children:l?A.jsx(xE,{}):A.jsx(SE,{})})]}),l&&A.jsxs("div",{className:H(r,`${D}-cart-expanded`),children:[A.jsxs("div",{className:H(r,`${D}-cart-items-section`),children:[A.jsx("ul",{className:H(r,`${D}-cart-items`),children:C.map(O=>A.jsx(zj,{item:O,currencyCode:R,disabled:E,globalClassName:r,onRemove:S,onQuantityChange:T},O.itemId))}),J.length>0&&A.jsx("div",{className:H(r,`${D}-cart-chips`,`${D}-cart-applied-coupons`),children:J.map(O=>A.jsx(Jc,{code:O.code,inactive:!O.applied,globalClassName:r},O.code))})]}),A.jsxs("div",{className:H(r,`${D}-cart-totals`),children:[A.jsx(Vn,{label:"Subtotal",value:k,currencyCode:R,globalClassName:r,loading:!1}),A.jsx(Vn,{label:"Coupon",value:q,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Promotions",badge:Q[0],value:te,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Shipping",value:U,currencyCode:R,globalClassName:r,fallback:"TBD",loading:!1}),A.jsx(Vn,{label:"Shipping Discount",badge:$[0],value:ee,currencyCode:R,globalClassName:r,isDiscount:!0,loading:!1}),A.jsx(Vn,{label:"Tax",value:I,currencyCode:R,globalClassName:r,fallback:"TBD",loading:!1}),A.jsx(Vn,{label:"Total",value:P,currencyCode:R,globalClassName:r,emphasized:!0,loading:!1})]})]})]}),A.jsxs("div",{className:H(r,`${D}-cart-coupon`),children:[A.jsxs("div",{className:H(r,`${D}-cart-coupon-field`),children:[A.jsx("span",{className:H(r,`${D}-cart-coupon-icon`),"aria-hidden":"true",children:A.jsx(AE,{})}),A.jsx("input",{type:"text",className:H(r,`${D}-cart-coupon-input`),placeholder:"Enter coupon code","aria-label":"Enter coupon code",value:d,disabled:E,onChange:O=>h(O.target.value),onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),ae())}})]}),A.jsx("button",{type:"button",className:H(r,`${D}-cart-coupon-submit`),"aria-label":"Apply coupon",disabled:E||!d.trim(),onClick:ae,children:A.jsx(NI,{"aria-hidden":"true"})})]}),A.jsx(Uw,{expressPaymentUrl:ne,checkoutButtonUrl:ce,globalClassName:r,openLinksInNewTab:i}),A.jsx("p",{className:H(r,`${D}-cart-footer`),children:Y||"Shipping and taxes calculated at checkout."})]})},Wj=({item:e,currencyCode:t,globalClassName:n})=>{var o,a;const r=typeof e.originalSubtotal=="number"&&typeof e.itemSubtotal=="number"&&e.originalSubtotal>e.itemSubtotal,i=qm(e.coupons);return A.jsxs("li",{className:H(n,`${D}-cart-item`),children:[e.imageUrl&&A.jsx("div",{className:H(n,`${D}-cart-item-image`),children:A.jsx("img",{src:e.imageUrl,alt:e.name||"Product image",loading:"lazy"})}),A.jsxs("div",{className:H(n,`${D}-cart-item-details`),children:[A.jsx("p",{className:H(n,`${D}-cart-item-name`),children:e.name}),A.jsxs("div",{className:H(n,`${D}-cart-item-attrs`),children:[((o=e.variants)!=null?o:[]).map(l=>A.jsxs("p",{className:H(n,`${D}-cart-item-attr`),children:[l.lbl,": ",l.value]},`${l.type}-${l.value}`)),((a=e.promotions)!=null?a:[]).map(l=>A.jsxs("p",{className:H(n,`${D}-cart-item-attr`),children:["Promotion: ",l]},l))]}),i.length>0&&A.jsx("div",{className:H(n,`${D}-cart-chips`),children:i.map(l=>A.jsx(Jc,{code:l,globalClassName:n},l))}),A.jsxs("span",{className:H(n,`${D}-cart-item-price`),children:[r&&A.jsx("span",{className:H(n,`${D}-cart-item-original-price`),children:fi(e.originalSubtotal,t)}),A.jsx("span",{className:H(n,`${D}-cart-item-final-price`),children:fi(e.itemSubtotal,t)})]}),A.jsx("div",{className:H(n,`${D}-cart-item-footer`),children:A.jsxs("span",{className:H(n,`${D}-cart-item-qty`),children:["Qty: ",e.quantity]})})]})]})},Yj=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})},Gj=({order:e,globalClassName:t,openLinksInNewTab:n})=>{const{onNavigate:r}=it(),[i,o]=L.useState(!0),a=I=>Vi({event:I,openLinksInNewTab:n,onNavigate:r}),{id:l,orderedOn:c,items:d=[],currencyCode:h="USD",subtotal:p,total:g,taxes:m,shippingCost:E,shippingDiscount:S,shippingPromotions:T=[],promotionsDiscount:v,promotions:w=[],couponsDiscount:C,bodyMessage:R,footerMessage:k}=e,P=Fw(d,e.couponsApplied);return A.jsxs("div",{className:H(t,`${D}-cart`),children:[A.jsxs("div",{className:H(t,`${D}-cart-banner`),children:[A.jsx("span",{className:H(t,`${D}-cart-banner-icon`),"aria-hidden":"true",children:A.jsx(II,{})}),A.jsx("p",{className:H(t,`${D}-cart-banner-text`),children:"Your order is confirmed!"})]}),A.jsxs("div",{className:H(t,`${D}-order-confirmation-meta`),children:[A.jsxs("span",{children:["Order No: ",l]}),A.jsxs("span",{children:["Ordered On: ",Yj(c)]})]}),A.jsxs("div",{className:H(t,`${D}-cart-box`),children:[R&&A.jsxs("button",{type:"button",className:H(t,`${D}-cart-summary`),"aria-expanded":i,onClick:()=>o(I=>!I),children:[A.jsx("span",{className:H(t,`${D}-cart-summary-text`),children:A.jsx(Xo,{text:R,globalClassName:t,showIsLoading:!1,openLinksInNewTab:n,onLinkClick:a})}),A.jsx("span",{className:H(t,`${D}-cart-summary-toggle`),"aria-hidden":"true",children:i?A.jsx(xE,{}):A.jsx(SE,{})})]}),i&&A.jsxs("div",{className:H(t,`${D}-cart-expanded`),children:[A.jsx("ul",{className:H(t,`${D}-cart-items`),children:d.map(I=>A.jsx(Wj,{item:I,currencyCode:h,globalClassName:t},I.itemId))}),P.length>0&&A.jsx("div",{className:H(t,`${D}-cart-chips`,`${D}-cart-applied-coupons`),children:P.map(I=>A.jsx(Jc,{code:I.code,globalClassName:t},I.code))}),A.jsxs("div",{className:H(t,`${D}-cart-totals`),children:[A.jsx(Vn,{label:"Subtotal",value:p,currencyCode:h,globalClassName:t}),A.jsx(Vn,{label:"Coupon",value:C,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Promotions",badge:w[0],value:v,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Shipping",value:E,currencyCode:h,globalClassName:t,fallback:"TBD"}),A.jsx(Vn,{label:"Shipping Discount",badge:T[0],value:S,currencyCode:h,globalClassName:t,isDiscount:!0}),A.jsx(Vn,{label:"Tax",value:m,currencyCode:h,globalClassName:t,fallback:"TBD"}),A.jsx(Vn,{label:"Total",value:g,currencyCode:h,globalClassName:t,emphasized:!0})]})]})]}),A.jsx("p",{className:H(t,`${D}-cart-footer`),children:k||"Shipping and taxes calculated at checkout."})]})},Xj=({image:e,alt:t,globalClassName:n})=>{const[r,i]=L.useState(e.src),[o,a]=L.useState(!1),l=()=>{e.fallbackSrc&&r!==e.fallbackSrc&&i(e.fallbackSrc)};return A.jsx("img",{className:H(n,`${D}-pdp-gallery__image`,{[`${D}-pdp-gallery__image--loaded`]:o}),src:r,alt:t,loading:"lazy",onLoad:()=>a(!0),onError:l})},Kj=({images:e,altText:t,globalClassName:n})=>{if(e.length===0)return null;const r=e.length>1;return A.jsxs(wm,{className:H(n,`${D}-pdp-gallery`),slidesPerPage:1,slidesPerMove:1,slideCount:e.length,loop:!0,"aria-label":t||"Product images",children:[A.jsx(_m,{className:H(n,`${D}-pdp-gallery__item-group`),children:e.map((i,o)=>A.jsx(bm,{index:o,className:H(n,`${D}-pdp-gallery__item`),children:A.jsx(Xj,{image:i,alt:t?`${t} (${o+1})`:`Product image ${o+1}`,globalClassName:n})},i.src))}),r&&A.jsxs(gm,{className:H(n,`${D}-pdp-gallery__control`),children:[A.jsx(Tm,{className:H(n,`${D}-pdp-gallery__prev-trigger`),"aria-label":"Previous image",children:A.jsx(OT,{size:"16px"})}),A.jsx(vm,{className:H(n,`${D}-pdp-gallery__next-trigger`),"aria-label":"Next image",children:A.jsx(NT,{size:"16px"})})]}),r&&A.jsx(Em,{className:H(n,`${D}-pdp-gallery__indicator-group`),children:Array.from({length:e.length},(i,o)=>A.jsx(ym,{index:o,className:H(n,`${D}-pdp-gallery__indicator`),"aria-label":`Go to image ${o+1}`},o))})]})},Qj="color",Zc=e=>(e!=null?e:"").toLowerCase()===Qj,Jj=e=>e.replace(/(^|\/)large\//,"$1medium/"),jw=(e,t)=>!e.vattr||!t?!1:e.vattr.some(n=>Zc(n.id)&&n.vals.includes(t)),Hw=(e,t)=>{const n=Jj(t),r=Cl(e,n);return n===t?{src:r}:{src:r,fallbackSrc:Cl(e,t)}},Zj=["hi-res","large","medium","small"],$w=(e,t)=>{var n;return((n=e.viewType)!=null?n:"").toLowerCase()===t},eH=e=>Zj.find(t=>e.some(n=>$w(n,t))),tH=(e,t,n)=>{var i;const r=[...t?e.filter(o=>jw(o,t)):[],...e.filter(o=>!o.vattr),...e];for(const o of r){const a=((i=o.imgs)!=null?i:[]).filter(l=>{var c;return((c=l.url)!=null?c:"").trim().length>0}).map(l=>Hw(n,l.url));if(a.length>0)return a}return[]},nH=(e,t)=>{var i;const n=(i=e.imgGroups)!=null?i:[],r=eH(n);if(r){const o=n.filter(l=>$w(l,r)),a=tH(o,t,e.baseUrl);if(a.length>0)return a}return e.imageUrl?[Hw(e.baseUrl,e.imageUrl)]:[]},rH=(e,t)=>{var i,o,a;const n=((i=e.imgGroups)!=null?i:[]).find(l=>l.viewType==="swatch"&&jw(l,t)),r=(a=(o=n==null?void 0:n.imgs)==null?void 0:o[0])==null?void 0:a.url;return r?Cl(e.baseUrl,r):""},iH=e=>{const t=e.vattr,n=e.vmat;if(!t||t.length===0||!n||n.length===0)return e;const r=new Set(t.map(d=>d.id)),i=[...new Set(n.flatMap(d=>Object.keys(d.vars)))];if(i.every(d=>r.has(d)))return e;const o={},a=new Set;for(const d of i){if(r.has(d)){o[d]=d,a.add(d);continue}const h=new Set(n.map(g=>g.vars[d]).filter(Boolean));if(h.size===0)continue;const p=t.filter(g=>!a.has(g.id)&&g.opts.length>0&&[...h].every(m=>g.opts.some(E=>E.val===m)));p.length===1&&(o[d]=p[0].id,a.add(p[0].id))}const l=i.filter(d=>!r.has(d)).length;return Object.keys(o).filter(d=>o[d]!==d).length<l?e:pe(z({},e),{vmat:n.map(d=>pe(z({},d),{vars:Object.fromEntries(Object.entries(d.vars).map(([h,p])=>{var g;return[(g=o[h])!=null?g:h,p]}))}))})},ed=(e,t,n,r={})=>!e||e.length===0||!t||!n?!1:e.some(i=>{var o;return((o=i.vars)==null?void 0:o[t])!==n||i.ord===!1?!1:Object.entries(r).every(([a,l])=>{var c;return a===t||((c=i.vars)==null?void 0:c[a])===l})}),sH=(e,t)=>{const n=Object.keys(t);return n.length===0?!0:!e||e.length===0?!1:e.some(r=>r.ord!==!1&&n.every(i=>{var o;return((o=r.vars)==null?void 0:o[i])===t[i]}))},oH=(e,t,n,r,i)=>{if(!e||e.length===0)return pe(z({},i),{[n]:r});const o=e.find(l=>{var c;return((c=l.vars)==null?void 0:c[n])===r&&l.ord!==!1&&Object.keys(l.vars).length>=t.length&&Object.entries(i).every(([d,h])=>{var p;return d===n||((p=l.vars)==null?void 0:p[d])===h})});if(o)return z({},o.vars);const a=e.find(l=>{var c;return((c=l.vars)==null?void 0:c[n])===r&&l.ord!==!1&&Object.keys(l.vars).length>=t.length});return a?z({},a.vars):pe(z({},i),{[n]:r})},zw=(e,t)=>{var i,o,a,l;if(!(Array.isArray(e.vattr)&&e.vattr.length>0))return(i=e.id)!=null?i:null;if(!e.vmat||e.vmat.length===0)return(o=e.id)!=null?o:null;const r=e.vmat.find(c=>c.ord!==!1&&Object.entries(t).every(([d,h])=>{var p;return((p=c.vars)==null?void 0:p[d])===h}));return(l=(a=r==null?void 0:r.pid)!=null?a:e.id)!=null?l:null},aH=(e,t)=>{var o;const n=Im(e.promotions,(o=e.extendedData)==null?void 0:o.productPromotions),r=typeof n=="number"?pe(z({},e.pr),{prom:n}):e.pr;if(!e.vmat||e.vmat.length===0||Object.keys(t).length===0)return r;const i=e.vmat.find(a=>a.ord!==!1&&Object.entries(t).every(([l,c])=>{var d;return((d=a.vars)==null?void 0:d[l])===c}));return i!=null&&i.pr?i.pr:r},Vw=e=>{var n;const t={};for(const r of(n=e.vattr)!=null?n:[]){const i=r.opts.find(a=>ed(e.vmat,r.id,a.val)),o=i!=null?i:r.opts[0];o&&(t[r.id]=o.val)}return t},uH=300,lH=e=>{const{overrides:t,isInitialized:n}=qi(),r=zs(),i=n?t.ProductDetailCard:void 0;if(i){const o={name:"ProductDetailCard",payload:e.product,api:r};return A.jsx(Wi,{tagName:i,props:o,label:"ProductDetailCard"})}return A.jsx(cH,z({},e))},cH=({product:e,globalClassName:t,openLinksInNewTab:n,isCartMgmtSupported:r=!1})=>{var Ie,De,ut,It,gt,xt,St,Qt;const{addToCart:i,sendMessage:o,loading:a}=Vt(),{onNavigate:l}=it(),c=L.useMemo(()=>iH(e.data),[e.data]),d=(Ie=c.vattr)!=null?Ie:[],[h,p]=L.useState(()=>Vw(c));L.useEffect(()=>{p(Vw(c))},[c,e.id]);const g=sH(c.vmat,h),m=(ut=(De=c.quantity)==null?void 0:De.minQuantity)!=null?ut:1,E=(gt=(It=c.quantity)==null?void 0:It.maxQuantity)!=null?gt:Number.POSITIVE_INFINITY,S=(St=(xt=c.quantity)==null?void 0:xt.increment)!=null?St:1,[T,v]=L.useState(m),[w,C]=L.useState(!1),R=L.useRef(!1);L.useEffect(()=>{w&&(a?R.current=!0:R.current&&(R.current=!1,C(!1)))},[w,a]);const k=d.find(je=>Zc(je.id)),P=d.filter(je=>!Zc(je.id)),I=k?h[k.id]:void 0,U=L.useMemo(()=>nH(c,I),[c,I]),ee=L.useMemo(()=>aH(c,h),[c,h]),$=zw(c,h),[te,Q]=L.useState(T),q=L.useRef($),G=q.current===$?te:T;L.useEffect(()=>{if(q.current!==$){q.current=$,Q(T);return}const je=window.setTimeout(()=>Q(T),uH);return()=>window.clearTimeout(je)},[T,$]);const Y=T===te,ce=L.useMemo(()=>g&&(q.current!==$||Y)?Fj(c.expressPaymentUrl,$,G):null,[c.expressPaymentUrl,$,G,g,Y]),ne=L.useCallback(je=>{o(je?`I completed the payment using Express Checkout. Show my order confirmation for order ${je}.`:"I completed the payment using Express Checkout. Show my order confirmation.")},[o]),J=je=>Vi({event:je,openLinksInNewTab:n,onNavigate:l}),ae=(je,Ve)=>()=>{p(Pe=>{const Ye=!ed(c.vmat,je,Ve,Pe);return Zc(je)||Ye?oH(c.vmat,d,je,Ve,Pe):pe(z({},Pe),{[je]:Ve})})},O=()=>{if(a)return;const je=zw(c,h);if(!je)return;const Ve=d.map(Pe=>{const Ye=Pe.opts.find(Pt=>Pt.val===h[Pe.id]);return Ye?{label:Pe.lbl||Pe.id,value:Ye.name||Ye.val}:null}).filter(Pe=>Pe!==null);C(!0),i({productName:c.name,sku:je,quantity:T,variants:Ve})},B=!g||T-S<m,re=!g||T+S>E,M=je=>{var Pe;const Ve=h[je.id];return(Pe=je.opts.find(Ye=>Ye.val===Ve))==null?void 0:Pe.name},we=()=>v(je=>Math.max(m,je-S)),Ue=()=>v(je=>Math.min(E,je+S)),Le=je=>A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{id:`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__variant-name`),children:je.lbl||je.id}),M(je)&&A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:M(je)})]}),A.jsx("div",{role:"radiogroup","aria-labelledby":`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__chips`),children:je.opts.map(Ve=>{const Pe=ed(c.vmat,je.id,Ve.val,h),Ye=h[je.id]===Ve.val;return A.jsxs("label",{className:H(`${D}-msg-pdp__chip`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("span",{children:Ve.name||Ve.val})]},Ve.val)})})]},je.id),ke=je=>A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{id:`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__variant-name`),children:je.lbl||"Color"}),M(je)&&A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:M(je)})]}),A.jsx("div",{role:"radiogroup","aria-labelledby":`variant-label-${je.id}`,className:H(t,`${D}-msg-pdp__swatches`),children:je.opts.map(Ve=>{const Pe=ed(c.vmat,je.id,Ve.val,h),Ye=h[je.id]===Ve.val,Pt=rH(c,Ve.val);return Pt?A.jsxs("label",{className:H(`${D}-msg-pdp__swatch`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-label":Ve.name||Ve.val,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("img",{className:H(t,`${D}-msg-pdp__swatch-image`),src:Pt,alt:Ve.name||Ve.val,loading:"lazy"})]},Ve.val):A.jsxs("label",{className:H(`${D}-msg-pdp__chip`,{selected:Ye,unavailable:!Pe}),children:[A.jsx("input",{type:"radio",name:`variant-${je.id}`,value:Ve.val,checked:Ye,"aria-description":Pe?void 0:"unavailable",onChange:ae(je.id,Ve.val),className:`${D}-msg-pdp__radio-input`}),A.jsx("span",{children:Ve.name||Ve.val})]},Ve.val)})})]});return A.jsx("div",{className:H(t,`${D}-msg-pdp`),children:A.jsxs("div",{className:H(t,`${D}-msg-pdp__card`),children:[A.jsx("div",{className:H(t,`${D}-msg-pdp__gallery`),children:A.jsx(Kj,{images:U,altText:c.name,globalClassName:t})}),A.jsxs("div",{className:H(t,`${D}-msg-pdp__content`),children:[c.slugUrl&&!r?A.jsx("a",{href:c.slugUrl,target:n?"_blank":"_self",rel:"noopener noreferrer",className:H(t,`${D}-msg-pdp__title-link`),"aria-label":`Go to product page for ${c.name}`,onClick:je=>Xc({event:je,href:c.slugUrl,openLinksInNewTab:n,isCartMgmtSupported:r,onNavigate:l}),children:c.name}):A.jsx("p",{className:H(t,`${D}-msg-pdp__title`),children:c.name}),A.jsx("div",{"aria-live":"polite","aria-atomic":"true",children:A.jsx(Pm,{globalClassName:t,className:`${D}-msg-pdp__price`,retailPrice:ee==null?void 0:ee.orig,discountPrice:(Qt=ee==null?void 0:ee.prom)!=null?Qt:ee==null?void 0:ee.cur,currencyCode:c.ccy,fontSize:"14px"})}),c.dscr&&A.jsx("div",{className:H(t,`${D}-msg-pdp__description`),children:A.jsx(Xo,{globalClassName:t,text:c.dscr,openLinksInNewTab:n,onLinkClick:J})}),k&&ke(k),P.map(Le),r&&A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant`),children:[A.jsxs("div",{className:H(t,`${D}-msg-pdp__variant-label`),children:[A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-name`),children:"Quantity"}),A.jsx("span",{className:H(t,`${D}-msg-pdp__variant-value`),children:T})]}),A.jsxs("div",{className:H(t,`${D}-msg-pdp__stepper`),children:[A.jsx(wr,{className:`${D}-msg-pdp__stepper-btn`,ariaLabel:"Decrease quantity",icon:A.jsx(_I,{}),disabled:B,onClick:we}),A.jsx("span",{className:H(t,`${D}-msg-pdp__quantity`),children:T}),A.jsx(wr,{className:`${D}-msg-pdp__stepper-btn`,ariaLabel:"Increase quantity",icon:A.jsx(vI,{}),disabled:re,onClick:Ue})]})]}),r&&A.jsxs("div",{className:H(t,`${D}-msg-pdp__actions`),children:[ce&&A.jsx(Rw,{expressPaymentUrl:ce,globalClassName:t,onOrderComplete:ne},ce),A.jsx(Uh,{className:`${D}-msg-pdp__add-to-cart`,disabled:!g||a||w,onClick:O,children:w?"Adding...":"Add to cart"})]})]})]})})},dH=({products:e,table:t,globalClassName:n,openLinksInNewTab:r})=>{const{isCartMgmtSupported:i,onNavigate:o}=it(),{overrides:a,isInitialized:l}=qi(),c=zs(),d=l?a.ProductComparison:void 0;if(d){const g={name:"ProductComparison",payload:{products:e,table:t},api:c};return A.jsx(Wi,{tagName:d,props:g,label:"ProductComparison"})}if(!e.length)return null;const h=`auto repeat(${e.length}, 1fr)`,p=`${90+e.length*140}px`;return A.jsx("div",{className:H(n,`${D}-product-comparison`),children:A.jsxs("div",{className:`${D}-product-comparison__grid`,style:{gridTemplateColumns:h,minWidth:p},children:[A.jsxs("div",{className:`${D}-product-comparison__header`,children:[A.jsx("div",{className:`${D}-product-comparison__header-spacer`}),e.map(g=>{var S,T,v,w,C,R,k;const m=g.imageUrl?Cl(g.baseUrl,g.imageUrl):void 0,E=Im(g.promotions,(S=g.extendedData)==null?void 0:S.productPromotions);return A.jsxs("div",{className:H(n,`${D}-product-comparison__product-col`),children:[m&&A.jsx("img",{className:H(n,`${D}-product-comparison__image`),src:m,alt:g.name||"Product image",loading:"eager"}),g.slugUrl&&!i?A.jsx("a",{href:g.slugUrl,target:r?"_blank":"_self",rel:"noopener",className:H(n,`${D}-product-comparison__name`,`${D}-product-comparison__name-link`),"aria-label":`Go to product page for ${g.name}`,onClick:P=>Xc({event:P,href:g.slugUrl,openLinksInNewTab:r,isCartMgmtSupported:i,onNavigate:o}),children:g.name}):A.jsx("span",{className:H(n,`${D}-product-comparison__name`),children:g.name}),A.jsx(Pm,{globalClassName:n,retailPrice:(w=(T=g.pr)==null?void 0:T.orig)!=null?w:(v=g.pr)==null?void 0:v.cur,discountPrice:(k=E!=null?E:(C=g.pr)==null?void 0:C.prom)!=null?k:(R=g.pr)==null?void 0:R.cur,currencyCode:g.ccy,fontSize:"0.875rem"})]},g.id)})]}),A.jsx("div",{className:`${D}-product-comparison__table`,children:t.map(g=>A.jsxs("div",{className:`${D}-product-comparison__row`,children:[A.jsx("div",{className:H(n,`${D}-product-comparison__row-label`),children:g.row_name}),e.map((m,E)=>A.jsx("div",{className:H(n,`${D}-product-comparison__row-value`),children:g.values[E]},`${g.row_name}-${m.id}`))]},g.row_name))})]})})},fH=({suggestions:e,disabled:t,globalClassName:n,isWidgetStandalone:r,onSuggestionClick:i})=>{const{overrides:o,isInitialized:a}=qi(),l=zs(),c=a?o.Suggestions:void 0;if(c){const d={name:"Suggestions",payload:{suggestions:e},api:l};return A.jsx(Wi,{tagName:c,props:d,label:"Suggestions"})}return A.jsx("div",{style:{marginTop:"0.5rem"},children:A.jsx(t7,{disabled:t,suggestions:e,globalClassName:n,isWidgetStandalone:r,onSuggestionClick:i})})},qw=({content:e,messageId:t,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i})=>{const{loading:o}=Vt(),a=Gc(),l=xj(),{isCartMgmtSupported:c,logger:d,onNavigate:h}=it(),{overrides:p,isInitialized:g}=qi(),m=zs(),E=L.useMemo(()=>e.response.flatMap(dh),[e.response]),S=T=>Vi({event:T,openLinksInNewTab:r,onNavigate:h});return A.jsx(A.Fragment,{children:E.map((T,v)=>{var w,C,R,k,P,I,U,ee,$,te,Q,q,G,Y,ce,ne,J,ae,O,B,re,M,we,Ue,Le,ke;switch(T.type){case"markdown":{const Ie=(C=(w=T.data)==null?void 0:w.content)!=null?C:"";return T.index===Pi&&k1(Ie)?null:A.jsx(Xo,{text:Ie,globalClassName:n,openLinksInNewTab:r,showIsLoading:!1,onLinkClick:S},`${T.type}-${(R=T.index)!=null?R:v}`)}case"product_carousel":return A.jsx(Ij,{title:(P=(k=T.data)==null?void 0:k.title)!=null?P:"",products:(U=(I=T.data)==null?void 0:I.products)!=null?U:[],globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:c},`${T.type}-${(ee=T.index)!=null?ee:v}`);case"product_tile":return A.jsx(lH,{product:T.data,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i,isCartMgmtSupported:c},`${T.type}-${($=T.index)!=null?$:v}`);case"product_comparison":return A.jsx(dH,{products:(Q=(te=T.data)==null?void 0:te.products)!=null?Q:[],table:(G=(q=T.data)==null?void 0:q.table)!=null?G:[],globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i},`${T.type}-${(Y=T.index)!=null?Y:v}`);case"cart":{const Ie=(J=(ne=(ce=T.data)==null?void 0:ce.cart)==null?void 0:ne.cartSummary)==null?void 0:J.cartDetails;return Ie?A.jsx(qj,{cart:Ie,productsToHighlight:T.data.products_to_highlight,readOnly:!l||t!==l,globalClassName:n,openLinksInNewTab:r},`${T.type}-${(ae=T.index)!=null?ae:v}`):null}case"order_confirmation":{const Ie=T.data,De=(re=(O=Ie==null?void 0:Ie.order)==null?void 0:O.orderDetails)!=null?re:(B=Ie==null?void 0:Ie.data)==null?void 0:B.orderConfirmation;return De?A.jsx(Gj,{order:De,globalClassName:n,openLinksInNewTab:r,isWidgetStandalone:i},`${T.type}-${(M=T.index)!=null?M:v}`):null}case"tool_results":{const Ie=T.data,De=T.output_name,ut=g&&De&&Object.prototype.hasOwnProperty.call(p,De)?p[De]:void 0,It=typeof ut=="string"?ut:void 0;if(!It||!De)return d!=null&&d.isDevelopment&&(De?d.warn(`🦜 tool_results "${De}" rendered nothing — no override registered for that key. Register one in the overrides map: { "${De}": "<your-tag-name>" }.`,{registeredKeys:Object.keys(p),payload:Ie}):d.warn("🦜 tool_results block has no output_name — nothing to route on",{payload:Ie})),null;const gt={name:De,payload:Ie,api:m};return A.jsx(Iw,{overrideName:De,children:A.jsx(Wi,{tagName:It,props:gt,label:`toolResult:${De}`})},`${T.type}-${De}-${(we=T.index)!=null?we:v}`)}case"suggestions":return A.jsx(fH,{disabled:o,suggestions:(Le=(Ue=T.data)==null?void 0:Ue.display_text)!=null?Le:[],globalClassName:n,isWidgetStandalone:i,onSuggestionClick:a},`${T.type}-${(ke=T.index)!=null?ke:v}`);default:return null}})})};class Ww extends L.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){_t(!0,"error","Message content threw during render:",t,n.componentStack)}render(){return this.state.hasError?A.jsx("p",{className:H(this.props.globalClassName,`${D}-reset-message`),children:"Oops, I had trouble displaying this response."}):this.props.children}}const hH=({message:e,globalClassName:t,isWidgetStandalone:n})=>{const{logger:r}=it();return TN(e.content)?(r==null||r.debug("Omitting structured user message from transcript",e.content),null):A.jsx("div",{className:H(t,`${D}-message`,n?"standalone":"embedded"),children:A.jsx("div",{className:H(t,`${D}-user-message`,n?"standalone":"embedded"),children:A.jsxs("div",{className:H(t,`${D}-user-message-row`,n?"standalone":"embedded"),children:[A.jsx("span",{className:H(t,`${D}-message-icon user-message-icon`,n?"standalone":"embedded"),children:A.jsx(OI,{})}),A.jsxs("div",{className:H(t,`${D}-user-message-body`,n?"standalone":"embedded"),children:[e.attachmentImageUrl&&A.jsx("img",{src:e.attachmentImageUrl,alt:e.content||"Attachment",className:H(t,`${D}-user-message-image`)}),e.content&&A.jsx("p",{className:H(t,`${D}-user-message-text`,n?"standalone":"embedded"),children:e.content})]})]})})})};function pH(e){switch(e==null?void 0:e.toLowerCase()){case"chatbot":return"chatbot";case"agent":return"human-agent";default:return null}}const mH=({message:e,globalClassName:t,openLinksInNewTab:n,isWidgetStandalone:r})=>{var d;const{logger:i,onNavigate:o}=it(),a=h=>Vi({event:h,openLinksInNewTab:n,onNavigate:o}),l=L.useMemo(()=>{if(typeof e.content!="string")return null;const h=Ba(e.content);if(h)return h;const p=Ul(e.content);return p?{response:[p]}:null},[e.content]),c=L.useMemo(()=>{var g;const h="Oops, I had trouble with your request.";if(typeof e.content!="string")return i==null||i.warn("Message content is not richtext format. Showing fallback text.",e.content),h;const p=e.content.trim();try{const m=JSON.parse(p);if(typeof m=="object"&&m!==null)return i==null||i.debug("Detected JSON object instead of array of responses in message content",e.content),(g=ch(m))!=null?g:h}catch(m){if(p.startsWith("{")||p.startsWith("["))return i==null||i.warn("Failed to parse JSON-like message content. Showing fallback text.",e.content),h}return e.content||h},[i,e.content]);switch(e.role){case"user":return A.jsx(hH,{message:e,globalClassName:t,isWidgetStandalone:r});case"agent":return A.jsx("div",{className:H(t,`${D}-message-group`,pH((d=e.sender)==null?void 0:d.role),r?"standalone":"embedded"),children:A.jsx("div",{className:`${D}-message-group-child`,children:l?A.jsx(Ww,{globalClassName:t,children:A.jsx(qw,{content:l,messageId:e.id,globalClassName:t,openLinksInNewTab:n,isWidgetStandalone:r})}):A.jsx(Xo,{text:c,globalClassName:t,openLinksInNewTab:n,showIsLoading:!1,onLinkClick:a})})});case"system":return A.jsx("div",{className:H(t,`${D}-message`,r?"standalone":"embedded"),children:A.jsx("p",{className:H(t,`${D}-reset-message`),children:e.content})})}},gH=({message:e,onRetry:t,globalClassName:n,isWidgetStandalone:r})=>A.jsxs("div",{className:H(n,`${D}-send-error`,r?"standalone":"embedded"),role:"alert",children:[A.jsx("span",{className:H(n,`${D}-send-error-text`),children:e}),A.jsxs("button",{type:"button",className:H(n,`${D}-retry-button`),onClick:t,children:[A.jsx(DI,{"aria-hidden":"true"})," Retry"]})]}),yH=({globalClassName:e,onClick:t})=>A.jsx("div",{className:H(e,`${D}-jump-to-latest`),children:A.jsx("button",{type:"button",className:H(e,`${D}-jump-to-latest-button`),"aria-label":"Jump to latest message",title:"Jump to latest message",onClick:t,children:A.jsx("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",children:A.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})})})}),EH=`${D}-message-container`,bH=24,_H=100,td=e=>{const t=e==null?void 0:e.closest(`.${EH}`);return t instanceof HTMLElement?t:null},Yw=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=bH,vH=()=>typeof window!="undefined"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,TH=(e,t)=>!(e!=null&&e.anchorMessageId)||!t.some(n=>n.id===e.anchorMessageId)?null:e,wH=({autoScroll:e,messages:t,streamingBlocks:n,sendError:r,error:i,isOpen:o,scrollSnapshotRef:a})=>{var ee,$,te;const l=L.useRef(null),c=L.useRef(null),d=L.useRef(!0),h=L.useRef(!1),p=L.useRef(null),g=L.useRef(!1),m=L.useRef(($=(ee=t[t.length-1])==null?void 0:ee.id)!=null?$:null),E=L.useRef(null),S=L.useRef(!1),T=L.useRef(t);if(T.current=t,!S.current){S.current=!0;const Q=a?TH(a.current,t):null;Q&&(d.current=Q.shouldStickToBottom,g.current=Q.hasSentLiveMessage,Q.shouldStickToBottom||(E.current=Q.scrollTop))}const v=L.useRef(e);v.current=e;const w=L.useRef(!1);w.current=n.length>0;const C=L.useRef(!1);C.current=((te=t[t.length-1])==null?void 0:te.restored)===!0;const[R,k]=L.useState(!1),P=L.useCallback((Q="smooth")=>{var Y;const q=(Y=c.current)!=null?Y:td(l.current);if(!q)return;const G=Q==="smooth"&&vH()?"auto":Q;d.current=!0,G==="smooth"&&(h.current=!0),q.scrollTo({top:q.scrollHeight,behavior:G})},[]),I=L.useCallback(()=>{const Q=c.current;if(!Q||Q.clientHeight===0){Q||k(!1);return}k(!Yw(Q))},[]),U=L.useCallback(()=>{const Q=c.current;if(!Q){d.current=!0,k(!1);return}Q.clientHeight!==0&&(d.current=Yw(Q),I())},[I]);return L.useLayoutEffect(()=>{const Q=E.current;if(Q==null)return;const q=td(l.current);c.current=q,q&&(q.scrollTop=Q,d.current=!1,k(!0))},[]),L.useLayoutEffect(()=>{const Q=l.current;return()=>{var Y,ce,ne,J;if(!a)return;const q=(Y=c.current)!=null?Y:td(Q),G=T.current;a.current={scrollTop:(ce=q==null?void 0:q.scrollTop)!=null?ce:0,shouldStickToBottom:d.current,hasSentLiveMessage:g.current,anchorMessageId:(J=(ne=G[G.length-1])==null?void 0:ne.id)!=null?J:null}}},[a]),L.useEffect(()=>{const Q=td(l.current);if(c.current=Q,I(),!Q)return;const q=()=>{p.current&&(clearTimeout(p.current),p.current=null)},G=()=>{q(),h.current=!1,U()},Y=()=>{if(!h.current){U();return}q(),p.current=setTimeout(G,_H)},ce=()=>{q(),h.current=!1};Q.addEventListener("scroll",Y,{passive:!0}),Q.addEventListener("scrollend",G),Q.addEventListener("wheel",ce,{passive:!0}),Q.addEventListener("touchstart",ce,{passive:!0});const ne=()=>{if(h.current)return;const O=g.current,B=!O,re=d.current,M=C.current,we=v.current,Ue=w.current;if(re&&(we||M||B)){P(Ue&&O?"smooth":"auto");return}U()},J=new ResizeObserver(ne);J.observe(Q),l.current&&J.observe(l.current);const ae=new MutationObserver(ne);return ae.observe(Q,{childList:!0,subtree:!0}),()=>{q(),Q.removeEventListener("scroll",Y),Q.removeEventListener("scrollend",G),Q.removeEventListener("wheel",ce),Q.removeEventListener("touchstart",ce),J.disconnect(),ae.disconnect()}},[P,I,U]),L.useEffect(()=>{E.current==null&&P("auto")},[P]),L.useEffect(()=>{o&&E.current==null&&P("auto")},[o,P]),L.useEffect(()=>{var B;const Q=t[t.length-1],q=(B=Q==null?void 0:Q.id)!=null?B:null,G=q!==m.current;m.current=q;const Y=(Q==null?void 0:Q.restored)===!0,ce=(Q==null?void 0:Q.role)==="user"&&!Y;ce&&(g.current=!0);const ne=d.current,J=t.length>0,ae=!g.current&&J;if(ne&&(e||Y||ae)){P(Y||ae?"auto":"smooth");return}if(G&&ce){P("smooth");return}U()},[t,e,P,U]),L.useEffect(()=>{if(e&&d.current){P(g.current?"smooth":"auto");return}U()},[n,r,i,e,P,U]),{endRef:l,showJumpToLatest:R,scrollToLatest:P}},xH=4e3,Gw=e=>(typeof e=="string"?e:"").replace(/<[^>]*>/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[`*_~#>|]+/g," ").replace(/\s+/g," ").trim().slice(0,xH),Cu="Assistant response available",SH=e=>{if(typeof e!="object"||e===null)return"";const t=e;if(t.type!=="product_carousel"||typeof t.data!="object"||t.data===null)return"";const n=t.data.products;if(!Array.isArray(n))return"";if(n.length===0)return"No products found.";const r=n.map(l=>{if(typeof l!="object"||l===null||Array.isArray(l))return"";const c=l,d=typeof c.data=="object"&&c.data!==null&&!Array.isArray(c.data)?c.data:null,h=typeof(d==null?void 0:d.name)=="string"?d.name.trim():"",p=typeof c.id=="string"?c.id.trim():"";return h||p}).filter(Boolean),i=n.length===1?"1 product found.":`${n.length} products found.`;if(r.length===0)return i;const o=n.length===1?"Product title":"Product titles",a=`${i} ${o}: ${r.join("; ")}`;return/[.!?]$/.test(a)?a:`${a}.`},AH=e=>{var o,a;if(typeof e!="string")return Cu;const t=Ba(e),n=t?null:Ul(e),r=(o=t==null?void 0:t.response)!=null?o:n?[n]:null;if(r)return r.map(c=>c.type==="markdown"?Gw(c.data.content):SH(c)).filter(Boolean).join(" ").trim()||Cu;const i=e.trim();try{const l=JSON.parse(i);if(typeof l=="object"&&l!==null)return(a=ch(l))!=null?a:Cu}catch(l){if(i.startsWith("{")||i.startsWith("["))return Cu}return Gw(e)||Cu},CH=({message:e,announcementKey:t})=>{const[n,r]=L.useState("");return L.useEffect(()=>{if(r(""),!e)return;const i=setTimeout(()=>r(e),100),o=setTimeout(()=>r(""),1e4);return()=>{clearTimeout(i),clearTimeout(o)}},[e,t]),A.jsx("span",{className:`${D}-visually-hidden`,role:"status","aria-atomic":"true",children:n})},kH=()=>{const{messages:e}=Vt(),t=[...e].reverse().find(n=>n.role==="agent"&&!n.restored);return A.jsx(CH,{message:t?AH(t.content):"",announcementKey:t==null?void 0:t.id})},OH="You are offline or we couldn't reach the assistant. Check connection and try again.",Wm=({isWidgetStandalone:e,isOpen:t,scrollSnapshotRef:n})=>{var G,Y;const{globalClassName:r,openLinksInNewTab:i,logger:o,autoScroll:a}=it(),{messages:l,streamingBlocks:c,isAgentTyping:d,loading:h,progressMessage:p,connectionStatus:g,error:m,sendError:E,retryLastMessage:S,retryConnection:T}=Vt(),{endRef:v,showJumpToLatest:w,scrollToLatest:C}=wH({autoScroll:a,messages:l,streamingBlocks:c,sendError:E,error:m,isOpen:t,scrollSnapshotRef:n}),R=l.length>0,k=c.some(I3),P=l[l.length-1],I=P?C1(P.content,"suggestions"):!1,U=R&&(h||d)&&!k&&!I,ee=g==="reconnecting"&&!U,$=g==="error";let te=null;$?te={message:m!=null?m:OH,kind:"connection",onRetry:T}:E&&(te={message:E.message,kind:"send",onRetry:S});const Q=(G=te==null?void 0:te.message)!=null?G:null,q=(Y=te==null?void 0:te.kind)!=null?Y:null;return L.useEffect(()=>{Q&&(o==null||o.error("Error message shown to user",{message:Q,kind:q}))},[Q,q,o]),A.jsxs(A.Fragment,{children:[A.jsx(kH,{}),h&&!R&&A.jsx(o7,{globalClassName:r,isWidgetStandalone:e}),l.map(ce=>A.jsx(mH,{message:ce,globalClassName:r,openLinksInNewTab:i,isWidgetStandalone:e},ce.id)),te&&A.jsx(gH,{message:te.message,onRetry:te.onRetry,globalClassName:r,isWidgetStandalone:e}),k&&A.jsxs("div",{className:H(r,`${D}-message-group`,e?"standalone":"embedded"),children:[A.jsx(Ww,{globalClassName:r,children:A.jsx(qw,{content:{response:c},globalClassName:r,openLinksInNewTab:i,isWidgetStandalone:e})}),(h||d)&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e})]}),U&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e,loadingText:p}),ee&&A.jsx(Lm,{globalClassName:r,isWidgetStandalone:e,loadingText:"Reconnecting..."}),w&&A.jsx(yH,{globalClassName:r,onClick:()=>C()}),A.jsx("div",{ref:v,"aria-hidden":"true"})]})},NH=()=>A.jsxs("svg",{"aria-hidden":"true",className:`${D}-progress-step-check`,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),A.jsx("path",{d:"M5 8.5L7 10.5L11 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),IH=()=>A.jsx("svg",{"aria-hidden":"true",className:`${D}-progress-step-starburst`,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:A.jsx("path",{d:"M8 1v3M8 12v3M1 8h3M12 8h3M3.05 3.05l2.12 2.12M10.83 10.83l2.12 2.12M3.05 12.95l2.12-2.12M10.83 5.17l2.12-2.12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),PH=(e,t)=>e===0?[]:e<0?t:t.slice(-e),Ym=({progressStepsLimit:e,steps:t,globalClassName:n})=>{const{progressStepsLimit:r}=it(),i=e!=null?e:r,{overrides:o,isInitialized:a}=qi(),l=zs();if(t.length===0||i===0)return null;const c=PH(i,t),d=a?o.ProgressSteps:void 0;if(d){const h={name:"ProgressSteps",payload:{steps:c},api:l};return A.jsx(Wi,{tagName:d,props:h,label:"ProgressSteps"})}return A.jsx("div",{className:H(n,`${D}-progress-steps-panel`),children:A.jsx("div",{className:`${D}-progress-steps`,children:A.jsx("ul",{className:`${D}-progress-steps-list`,children:c.map((h,p)=>{const g=p<c.length-1,m=p===c.length-1;return A.jsxs("li",{className:H(`${D}-progress-step`,m&&"active"),"aria-label":`${h} (${g?"completed":"in progress"})`,children:[m&&A.jsx("span",{className:`${D}-progress-step-arc`}),A.jsx("span",{className:`${D}-progress-step-text`,children:h}),A.jsx("span",{className:H(`${D}-progress-step-icon`,g?"done":"active"),children:g?A.jsx(NH,{}):A.jsx(IH,{})})]},`${p}-${h}`)})})})})},Xw=()=>{const{globalClassName:e,themeVariables:t,messageAlignment:n,enableDownloadTranscript:r}=it(),{isAgentTyping:i,resetConversation:o,endConversation:a,progressSteps:l,downloadTranscript:c}=Vt(),d=Gc(),h=Rm(),p=i,g=m=>m.file?h(m):d(m.text);return A.jsxs("div",{className:H(e,`${D}-container`,`${D}-embedded-chat`),style:t,children:[A.jsx("div",{className:H(e,`${D}-message-container`,`container-${n}`,"embedded"),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:!1})}),A.jsx(Ym,{steps:l,globalClassName:e}),A.jsx(Rp,{componentType:"chat",className:"embedded-chat",isLoading:p,onSubmit:g}),A.jsx("div",{className:H(`${D}-embedded-chat-menu`),children:A.jsxs(nB,{componentType:"chat",children:[A.jsx(ew,{componentType:"chat"}),A.jsx(av,{componentType:"chat",onClearChat:o}),A.jsx(lv,{componentType:"chat",onEndConversation:a}),r&&A.jsx(uv,{componentType:"chat",onDownloadTranscript:c})]})})]})},Kw=e=>{var c;const{children:t,disabled:n}=e,[r,i]=L.useState((c=e.container)==null?void 0:c.current),o=L.useSyncExternalStore(LH,()=>!1,()=>!0),{getRootNode:a}=zc();if(L.useEffect(()=>{i(()=>{var d;return(d=e.container)==null?void 0:d.current})},[e.container]),o||n)return A.jsx(A.Fragment,{children:t});const l=r!=null?r:RH(a);return A.jsx(A.Fragment,{children:L.Children.map(t,d=>bo.createPortal(d,l))})},RH=e=>{const t=e==null?void 0:e(),n=t.getRootNode();return Ls(n)?n:Yr(t).body},LH=()=>()=>{},Qw=({scrollSnapshotRef:e})=>{const{globalClassName:t,themeVariables:n,messageAlignment:r}=it(),{mode:i,status:o,dialogPosition:a,isDialogFullHeight:l,dialogWidth:c}=Hr(),{loading:d,isAgentTyping:h,resetConversation:p,endConversation:g,progressSteps:m,downloadTranscript:E}=Vt(),S=Gc(),T=Rm(),{isOpen:v}=o||{},w=!!o.isOpen,C=i==="standalone",R=h||d,k=()=>{oi(!1),Fh()},P=I=>I.file?T(I):S(I.text);return w?A.jsx(YT,{lazyMount:!0,unmountOnExit:!0,modal:!1,closeOnEscape:!1,closeOnInteractOutside:!1,open:w,initialFocusEl:Mh,children:A.jsx(Kw,{children:A.jsx(Am,{className:H(t,`${D}-container`,`${D}-dialog`,a,l&&"full-height"),style:z(z({},n),c&&{width:c}),children:A.jsxs(xm,{className:H(t,`${D}-dialog-content`,{standalone:C,embedded:!C}),children:[A.jsx(JT,{componentType:"dialog",onClearChat:p,onEndConversation:g,onClose:k,onDownloadTranscript:E}),A.jsx(Sm,{className:H(t,`${D}-message-container`,`container-${r}`,{standalone:C,embedded:!C}),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:C,isOpen:v,scrollSnapshotRef:e})}),A.jsx(Ym,{steps:m,globalClassName:t}),A.jsx(Rp,{componentType:"dialog",isLoading:R,onSubmit:P})]})})})}):null},Jw=({scrollSnapshotRef:e})=>{const{globalClassName:t,themeVariables:n,messageAlignment:r}=it(),{mode:i,status:o,isModalFullscreen:a}=Hr(),{loading:l,isAgentTyping:c,resetConversation:d,endConversation:h,progressSteps:p,downloadTranscript:g}=Vt(),m=Gc(),E=Rm(),{isOpen:S}=o||{},T=!!o.isOpen,v=i==="standalone",w=c||l,C=({open:P})=>{if(P){oi(!0);return}R()},R=()=>{oi(!1),Fh()},k=P=>P.file?E(P):m(P.text);return T?A.jsx(YT,{lazyMount:!0,unmountOnExit:!0,open:T,onOpenChange:C,initialFocusEl:Mh,children:A.jsx(Kw,{children:A.jsxs("div",{className:H(t,`${D}-modal-container`),style:n,children:[A.jsx($T,{className:H(t,`${D}-modal-backdrop`)}),A.jsx(Am,{className:H(t,`${D}-container`,`${D}-modal`,{fullscreen:a,standalone:v,embedded:!v}),children:A.jsxs(xm,{className:H(t,`${D}-modal-content`,{standalone:v,embedded:!v}),children:[A.jsx(JT,{componentType:"modal",onClearChat:d,onEndConversation:h,onClose:R,onDownloadTranscript:g}),A.jsx(Sm,{className:H(t,`${D}-message-container`,`container-${r}`,{standalone:v,embedded:!v}),role:"region","aria-label":"Conversation",children:A.jsx(Wm,{isWidgetStandalone:v,isOpen:S,scrollSnapshotRef:e})}),A.jsx(Ym,{steps:p,globalClassName:t}),A.jsx(Rp,{componentType:"modal",isLoading:w,onSubmit:k})]})})]})})}):null},DH=()=>{const e=Hr(),t=L.useRef(null),{status:{type:n,isMinimized:r}}=e||{status:{}};return r?A.jsx(SI,{}):n==="dialog"?A.jsx(Qw,{scrollSnapshotRef:t}):n==="modal"?A.jsx(Jw,{scrollSnapshotRef:t}):A.jsx(Xw,{})},MH=()=>{const{setIsOpen:e,setIsInline:t,setElementId:n,setEntryType:r,setParams:i}=YB();L.useEffect(()=>{const o=a=>{const{property:l,value:c}=a.detail||{};!l||c===void 0||(l==="isOpen"&&e(c),l==="isInline"&&t(c),l==="elementId"&&n(c),l==="entryType"&&r(c),l==="params"&&i(c))};return jB(o),()=>{HB(o)}},[e,t,n,r,i])},Zw=(e,t,n)=>{n!==void 0?e(t,n):e(t)};function FH({isReady:e,hasError:t,transmit:n}){const r=L.useRef([]),i=L.useRef(e);i.current=e;const o=L.useRef(n);o.current=n;const a=L.useCallback((l,c)=>{i.current?Zw(o.current,l,c):r.current.push({prompt:l,options:c})},[]);return L.useEffect(()=>{if(e&&r.current.length){const l=r.current;r.current=[],l.forEach(({prompt:c,options:d})=>Zw(o.current,c,d))}},[e]),L.useEffect(()=>{t&&(r.current=[])},[t]),a}const ex={copilot:"Ask Copilot",messaging:"Ask a question"},BH=({onSubmit:e,disabled:t=!1})=>{const{globalClassName:n,mode:r}=it(),{placeholder:i,isResponseLoading:o}=Wc(),a=i||ex[r],[l,c]=L.useState(""),d=t||o,h=p=>{const g=l.trim();g&&(p.preventDefault(),e(g),c(""))};return A.jsxs("form",{className:H(n,`${D}-prompts-input-container`),name:`${D}-prompts-form`,onSubmit:h,children:[A.jsx("label",{htmlFor:`${D}-prompts-input`,"aria-label":a,children:A.jsx(mm,{className:H(n,`${D}-prompts-input-icon`)})}),A.jsx("input",{id:`${D}-prompts-input`,className:H(n,`${D}-prompts-input`),name:`${D}-prompts-input`,placeholder:a,type:"text",disabled:d,value:l,onChange:p=>c(p.target.value)}),A.jsx(wr,{className:H(n,`${D}-prompts-input-submit-button`),type:"submit",ariaLabel:"Submit Prompt",icon:A.jsx(Bh,{}),disabled:d})]})},UH=()=>{const{globalClassName:e,mode:t}=it(),{placeholder:n}=Wc(),r=n||ex[t];return A.jsxs("div",{className:H(e,`${D}-prompts-header`),children:[A.jsx(mm,{className:H(e,`${D}-prompts-input-icon`),"aria-hidden":"true"}),A.jsx("span",{className:H(e,`${D}-prompts-header-text`),children:r})]})},tx=({label:e,disabled:t=!1,onClick:n})=>{var l;const{globalClassName:r,suggestionButtonConfig:i}=it(),o=i==null?void 0:i.icon,a=(l=i==null?void 0:i.iconPosition)!=null?l:"left";return A.jsxs("button",{className:H(r,`${D}-prompts-button`,{"has-icon":!!o,"icon-right":!!o&&a==="right"}),disabled:t,onClick:n,children:[o&&A.jsx(ZT,{icon:o,className:`${D}-suggestion-button-icon`}),A.jsx("span",{children:e})]})},jH="Ask me something else",HH=({label:e,disabled:t=!1})=>A.jsx(tx,{label:e||jH,disabled:t,onClick:()=>oi(!0)}),$H=({onPromptClick:e,disabled:t=!1})=>{const{globalClassName:n}=it(),{staticQuestions:r,askElseButtonLabel:i,disableAskElseButton:o}=Wc();if(!(r!=null&&r.length))return null;const a=l=>()=>{const c=l.trim();c&&e(c)};return A.jsxs("div",{className:H(n,`${D}-prompts-button-group`),children:[r.map(l=>A.jsx(tx,{label:l,disabled:t,onClick:a(l)},l)),!o&&A.jsx(HH,{label:i,disabled:t})]})},zH=()=>{const{globalClassName:e,themeVariables:t,enablePageContext:n}=it(),{isOpen:r,elementId:i,promptsDisplay:o}=Wc(),{isConnected:a,sessionExpired:l,sendMessage:c,connectionStatus:d}=Vt(),{productId:h}=Nm(),p=o!=="buttons",g=o!=="input",[m,E]=L.useState(null),S=d==="error",T=d==="connecting",v=V1(a,l),w=FH({isReady:v,hasError:S,transmit:c});L.useEffect(()=>{if(!i||m)return;const R=document.getElementById(i);R&&E(R)},[i,m]);const C=L.useCallback(R=>{if(oi(!0),n){w(R);return}const{prompt:k,display:P}=Th(R,h);if(P&&P.length>0){w(k,{displayContent:P});return}w(k)},[w,h,n]);return!r||!m?null:bo.createPortal(A.jsxs("div",{className:H(e,`${D}-prompts-extension-container`),style:t,children:[p&&A.jsx(BH,{onSubmit:C,disabled:S}),!p&&A.jsx(UH,{}),g&&A.jsx($H,{onPromptClick:C,disabled:S}),!S&&T&&A.jsx("p",{className:H(e,`${D}-prompts-connecting-message`),children:"Connecting to agent..."}),S&&A.jsx("p",{className:H(e,`${D}-prompts-error-message`),children:"Oops, an error occurred with our agent."})]}),m)},VH=()=>(MH(),A.jsx(zH,{})),nx=e=>A.jsxs(fE,pe(z({},e),{children:[A.jsx(DH,{}),A.jsx(VH,{})]}));function rx(e,t){return Ne(this,null,function*(){return G1().sendMessage(e,t)})}const qH={components:{setEntryType:Sl,toggleWidgetOpen:oi,toggleWidgetMinimized:fo,toggleModalFullscreen:Ff,setWidgetType:Al,setWidgetDialogPosition:Bf,loadPromptsComponent:VB,togglePromptsExtensionOpen:QT},session:{resetConversation:qB,endConversation:WB,sendMessage:rx},pageContext:{set:jf,get:Uf,clear:vy}};var nd={},ix;function WH(){if(ix)return nd;ix=1;var e=yE();return nd.createRoot=e.createRoot,nd.hydrateRoot=e.hydrateRoot,nd}var YH=WH();const sx=new WeakMap,ox=(e,t,n,r)=>{var o;(o=sx.get(e))==null||o.unmount();const i=YH.createRoot(e);sx.set(e,i),i.render(A.jsx(nx,pe(z({},t),{overridesUrl:n,inlineOverrides:r,mode:"messaging"})))},GH=o=>{var a=o,{elementId:e,timeout:t=5e3,overridesUrl:n,inlineOverrides:r}=a,i=bn(a,["elementId","timeout","overridesUrl","inlineOverrides"]);let l;const c=(h,p)=>{for(const g of h)if(g.type==="childList"&&g.addedNodes.length)for(const m of g.addedNodes)m.nodeType===Node.ELEMENT_NODE&&m.id===e&&(_t(!0,"log","Target element found, rendering Messaging Widget"),p.disconnect(),clearTimeout(l),ox(m,i,n,r))},d=new MutationObserver(c);return d.observe(document.body,{childList:!0,subtree:!0}),l=setTimeout(()=>{d.disconnect(),_t(!0,"error",`Element with id: ${e} not found within ${t} milliseconds, stopping observation`)},t),d},XH=o=>{var a=o,{timeout:e,elementId:t,overridesUrl:n,overrides:r}=a,i=bn(a,["timeout","elementId","overridesUrl","overrides"]);if(!i.messagingConfig){_t(!0,"error","Messaging Widget requires messagingConfig");return}if(!i.messagingConfig.scrt2Url||!i.messagingConfig.orgId||!i.messagingConfig.esDeveloperName){_t(!0,"error","Messaging Widget requires messagingConfig.scrt2Url, messagingConfig.orgId, and messagingConfig.esDeveloperName");return}const l=document.getElementById(t);if(!l){_t(!0,"warn","Container element not found for id:",t),_t(!0,"warn","Beginning observation for element"),GH(z({elementId:t,timeout:e,overridesUrl:n,inlineOverrides:r},i));return}ox(l,i,n,r)};function KH(){return Ne(this,null,function*(){return G1().getAuthLinkKey()})}class QH extends HTMLElement{constructor(){super(...arguments);Ze(this,"_props",null)}set props(n){this._props=n,this.render()}get props(){return this._props}connectedCallback(){this.render()}render(){}}const JH={namespace:"sf.instrumentation",name:"PayloadDiags",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{PayloadDiags:{fields:{extras:{rule:"repeated",id:1,type:"string"}}}}}}}}}},ZH={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{IdleDetectorReport:{fields:{listenerCount:{id:3,type:"uint32"},busyTasks:{rule:"repeated",id:5,type:"string"},busyDurations:{rule:"repeated",id:6,type:"double"},pollableCount:{id:4,type:"uint32"},pollCounts:{rule:"repeated",id:8,type:"double"},logThreshold:{id:2,type:"double"},maxDuration:{id:1,type:"double"},pollables:{rule:"repeated",id:7,type:"string"}}}}}}}}}},e$={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{reserved:[[6,6],[7,7],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22]],fields:{cancelable:{id:5,type:"bool"},ctrlKey:{id:9,type:"bool"},type:{id:25,type:"string"},button:{id:3,type:"uint32"},offsetX:{id:30,type:"double"},eventPhase:{id:12,type:"uint32"},shiftKey:{id:23,type:"bool"},offsetY:{id:31,type:"double"},composed:{id:8,type:"bool"},altKey:{id:1,type:"bool"},isTrusted:{id:13,type:"bool"},buttons:{id:4,type:"uint32"},movementY:{id:29,type:"double"},clientY:{id:27,type:"double"},clientX:{id:26,type:"double"},movementX:{id:28,type:"double"},defaultPrevented:{id:10,type:"bool"},metaKey:{id:14,type:"bool"},timeStamp:{id:24,type:"double"},bubbles:{id:2,type:"bool"},detail:{id:11,type:"int64"},pageY:{id:33,type:"double"},pageX:{id:32,type:"double"},screenX:{id:34,type:"double"},screenY:{id:35,type:"double"}}},Event:{fields:{type:{id:1,type:"string"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent","baseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{id:7,type:"MouseEvent"},auto:{id:3,type:"bool"},parentComponent:{id:2,type:"string"},baseEvent:{id:10,type:"Event"},ownerComponent:{id:1,type:"string"},userPayload:{id:5,type:"Payload"},simplePath:{id:9,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},t$={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},n$={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{stopReason:{id:6,type:"string"},externalParentId:{id:17,type:"string"},isRoot:{id:8,type:"bool"},isExternal:{id:16,type:"bool"},isSampled:{id:11,type:"bool"},preRootId:{id:9,type:"string"},parentId:{id:13,type:"string"},duration:{id:3,type:"double"},timerOverridden:{id:12,type:"uint32"},isRerooted:{id:15,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},traceIdSource:{id:14,type:"string"},id:{id:1,type:"string"},userPayload:{id:4,type:"Payload"},errorCount:{id:10,type:"uint32"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},r$={pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{rule:"repeated",id:2,type:"LogMessage"},schemaName:{id:1,type:"string"}}},Metrics:{fields:{globalMetricTags:{rule:"repeated",id:4,type:"MetricTag"},bucketHistograms:{rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{id:6,type:"string"},generatedTimestamp:{id:2,type:"double"},bundleCount:{id:3,type:"uint32"},upCounterCount:{id:4,type:"uint32"},valueRecorderCount:{id:5,type:"uint32"},key:{id:1,type:"string"},bucketHistogramCount:{id:7,type:"uint32"}}},LogMessage:{fields:{data:{id:2,type:"bytes"},rootId:{id:4,type:"string"},csId:{id:12,type:"string"},recCsId:{id:13,type:"string"},pagePayload:{id:7,type:"Payload"},connectionType:{id:9,type:"string"},appPayload:{id:10,type:"Payload"},tenantClass:{id:15,type:"string"},loggerAppName:{id:8,type:"string"},sseq:{id:11,type:"uint32"},recRootId:{id:14,type:"string"},loggerName:{id:6,type:"string"},age:{id:3,type:"double"},seq:{id:5,type:"uint32"},timestamp:{id:1,type:"double"}}},CoreEnvelope:{fields:{diagnostics:{id:1,type:"CoreEnvelopeDiagnostics"},bundles:{rule:"repeated",id:2,type:"MessageBundle"},metrics:{id:3,type:"Metrics"},staticAttributes:{id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{id:1,type:"string"},value:{id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:7,type:"string"},ownerAppName:{id:8,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},buckets:{rule:"repeated",id:5,type:"uint32"},name:{id:1,type:"string"},tags:{rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},name:{id:1,type:"string"},tags:{rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{id:2,type:"string"},appName:{id:1,type:"string"},deviceModel:{id:5,type:"string"},sdkVersion:{id:6,type:"string"},deviceId:{id:4,type:"string"},appExperience:{id:3,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},name:{id:1,type:"string"},value:{id:4,type:"uint32"},tags:{rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},ax={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},i$={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{id:6,type:"string"},stack:{id:3,type:"string"},name:{id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{id:4,type:"Payload"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}};class ku{constructor(){this.notImplemented="Method not implemented.";const t=typeof performance!="undefined";t?performance.timeOrigin?this._timeOrigin=performance.timeOrigin:this._timeOrigin=Date.now():this._timeOrigin=Date.now();const n=this._timeOrigin;t&&typeof performance.now=="function"?(this.perfNow=performance.now.bind(performance),this.time=()=>{const r=this.perfNow();return{tsNow:n+r,perfNow:r,timeOrigin:n}}):(this.perfNow=()=>Date.now()-n,this.time=()=>{const r=this.perfNow();return{tsNow:Date.now(),perfNow:r,timeOrigin:n}})}get isProduction(){return ku._isProduction}markProduction(t){ku._isProduction=t!=null?t:!0}_checkArgument(t,n){if(typeof n=="string")return typeof t===n;if(typeof n=="function")return t instanceof n;if(Array.isArray(n))return n.some(r=>this._checkArgument(t,r));throw new Error(`Invalid argKind ${n}`)}requireArgument(t,n,r){let i=t==null||t==="";const o=r!==void 0;if(!i&&o&&(i=!this._checkArgument(t,r)),i)throw new Error(`${n} argument is required${o?" and must be of a supported type.":"."}`)}requireArgumentIfDefined(t,n,r){if(t===void 0)return!1;if(t===null||t===""||!this._checkArgument(t,r))throw new Error(`${n} argument, if defined, must be of a supported type.`);return!0}checkForDenyListedValues(t,n,r){if(r.some(i=>t===i))throw new Error(`The value ${t} isn't allowed for ${n} argument.`)}checkForReservedCharacters(t,n,r){if(t&&r.some(i=>t.indexOf(i)>=0))throw new Error(`The argument ${n} isn't allowed to contain characters from ['${r.join(", ")}']. Received: ${t}.`)}generateUniqueId(t=16){const n=[],r="0123456789abcdef";if(!(t===void 0||t>0))throw new Error('If specified, the argument "length" must be a positive integer');for(let i=0;i<t;i++){const o=Math.floor(Math.random()*16);n.push(r[o])}return n.join("")}getXpath(t){function n(o){const a=o.localName;for(;o.nextElementSibling;)if(o=o.nextElementSibling,o.localName===a)return!0;return!1}function r(o,a){return o?r(o.previousElementSibling,a||o.localName)+(o.localName===a?1:0):1}function i(o){if(!o||o.nodeType!==1)return[""];const a=r(o)>1||n(o)?`${o.localName.toLowerCase()}[${r(o)}]`:o.localName.toLowerCase();return[...i(o.parentNode),a]}return i(t).join("/")}getAge(t){return t-this._timeOrigin}_getNavigatorSafe(){try{return typeof navigator!="undefined"?navigator:void 0}catch(t){return}}_hasEffectiveConnectionType(t){if(typeof t!="object"||t===null||!("connection"in t))return!1;const n=t.connection;return typeof n=="object"&&n!==null&&"effectiveType"in n&&typeof n.effectiveType=="string"}getConnectionType(){const t=this._getNavigatorSafe();return this._hasEffectiveConnectionType(t)?t.connection.effectiveType:void 0}clone(t){return JSON.parse(JSON.stringify(t))}definedValueOrDefault(t,n){return t!==void 0?t:n}getGlobal(){if(typeof globalThis=="object")return globalThis;if(typeof self=="object")return self;throw new Error("Unable to locate globalThis or self")}getIsBeaconSupported(){const t=this.getGlobal(),n=this._getNavigatorSafe();return typeof(n==null?void 0:n.sendBeacon)=="function"&&typeof t.Blob=="function"}estimateObjectSize(t){const n=new Set,r=[t];let i=0;for(;r.length;){const o=r.pop();if(typeof o=="boolean")i+=4;else if(typeof o=="string")i+=o.length*2;else if(typeof o=="number")i+=8;else if(o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Uint16Array||o instanceof Uint32Array||o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array||o instanceof Float32Array||o instanceof Float64Array)i+=o.byteLength;else if(typeof o=="object"){const a=o;if(!n.has(a)){n.add(a);for(const l in a)r.push(a[l])}}}return i}noProdThrow(t){if(!le.isProduction)throw t}isAllowedOrigin(t,n){return Array.isArray(n)&&n.some(r=>r==="*"||t===r||r instanceof RegExp&&r.test(t))}roundNumber(t,n){const r=Math.pow(10,n);return Math.round(t*r)/r}roundNumbersInObject(t,n){t&&Object.entries(t).forEach(([r,i])=>{typeof i=="number"&&(t[r]=this.roundNumber(i,n))})}tryGetAbsoluteUrl(t){var n,r;return t!=null&&t.startsWith("//")&&typeof window=="object"?((n=window.location.protocol)!==null&&n!==void 0?n:"")+t:t!=null&&t.startsWith("/")&&typeof window=="object"?((r=window.location.origin)!==null&&r!==void 0?r:"")+t:t}validateParentActivityType(t,n){const r=t!=null?t:!1;if(!n)return;const i=n.isExternal();if(r===i)return n;{const o=r?"external":"internal",a=i?"external":"internal";throw new Error(`Parent activity type mismatch: ${o} activity cannot have ${a} parent.`)}}}ku._isProduction=!0;const Gm=new ku,Xm=Gm.getGlobal();Gm.markProduction(Xm==null?void 0:Xm.__O11Y_IS_PROD__);const le=Object.freeze(Gm);class Km{constructor(t,n,r,i,o,a,l){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._value=0,this._createdOn=o===void 0?le.time().tsNow:o,a!==void 0&&(this._lastUpdatedOn=a),l!==void 0&&(this._value=l)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(t=1){if(typeof t=="number"&&t>0){this._value+=Math.round(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}const s$="co11y";class o${constructor(){this._upCounters=new Map,this._ownerAppName=s$}_addOrUpdateCounter(t,n,r){if(!t)return;const i={status:r},o=`${this._ownerAppName}:${n}:${t}${JSON.stringify(i)}`;let a=this._upCounters.get(o);a||(a=new Km(t,n,this._ownerAppName,i),this._upCounters.set(o,a)),a.increment()}success(t,n){this._addOrUpdateCounter(t,n,"success")}exception(t,n){this._addOrUpdateCounter(t,n,"error")}getBucketHistograms(){return[]}getUpCounters(){return Array.from(this._upCounters.values()).filter(t=>t.getLastUpdatedOn())}getValueRecorders(){return[]}setOwnerAppName(t){this._ownerAppName=t}}const Ko=new o$;class a${constructor(t){if(this._lazyMap=new Map,t!==void 0){if(typeof t=="number"&&t>0){this._maxSize=Math.ceil(t);return}throw new Error("maxSize must be a positive number")}}get maxSize(){return this._maxSize}get size(){return this._lazyMap.size}push(t,n){let r=this._lazyMap.get(t);if(!r){if(this.maxSize!==void 0&&this.size===this.maxSize)return!1;r=new Array,this._lazyMap.set(t,r)}return r.push(n),!0}getMessages(t,n){const r=this._lazyMap.get(t);return n&&this._lazyMap.has(t)&&this._lazyMap.set(t,[]),r||[]}getAllMessages(t){const n=new Map;for(const[r,i]of this._lazyMap.entries())i.length&&n.set(r,this.getMessages(r,t));return n}extractMessages(t){return this.getMessages(t,!0)}extractAllMessages(){return this.getAllMessages(!0)}get totalItemCount(){let t=0;for(const n of this._lazyMap.values())t+=n.length;return t}}class u${getSchemaId(t){return`${t.namespace}.${t.name}`}isInternal(t){return(t==null?void 0:t.namespace)==="sf.instrumentation"}makePayload(t,n,r=!0){if(!r||t!==void 0&&n!==void 0)return{schema:t,payload:n}}checkSchema(t){return le.requireArgument(t,"schema","object"),le.requireArgument(t.namespace,"schema.namespace","string"),le.requireArgument(t.name,"schema.name","string"),le.requireArgument(t.pbjsSchema,"schema.pbjsSchema","object"),this._getTokens(t)}_getTokens(t){const n=t.namespace.split(".");if(n.length!==2)throw new Error(`Schema "${this.getSchemaId(t)}" must have a namespace of the form "domain.feature".`);return{domain:n[0],feature:n[1],message:t.name}}_getAnyNestedObject(t,n){return n.reduce((r,i)=>{const o=r.nested;if(o){const a=o[i];if(a)return a}throw new Error(`Cannot locate ${n.join(".")} in schema with ID ${this.getSchemaId(t)}`)},t.pbjsSchema)}getTypes(t){const n=this.checkSchema(t),i=this._getAnyNestedObject(t,[n.domain,n.feature]).nested;if(!i)throw new Error(`Cannot parse schema with ID ${this.getSchemaId(t)}`);return i}getType(t,n){le.requireArgument(n,"messageName","string");const i=this.getTypes(t)[n];if(!i)throw new Error(`Cannot locate message ${n} in schema with ID ${this.getSchemaId(t)}`);return i}getOptions(t,n,r){r&&le.requireArgument(n,"messageName","string");const i=this.checkSchema(t);if(!n)return this._getAnyNestedObject(t,[i.domain,i.feature]).options;const o=this.getType(t,n);if(!r)return o.options;const a=o.fields[r];if(!a){const l=this.getSchemaId(t);throw new Error(`Cannot locate field ${r} in message ${n} in schema with ID ${l}`)}return a.options}getExtraFields(t,n){const{message:r}=this._getTokens(t),o=this.getTypes(t)[r].fields,a=new Set(Object.keys(o));return n!=null?Object.keys(n).filter(c=>!a.has(c)):[]}}const Nt=new u$,Qm=1e4,ux=1e4,lx=0,l$=2147483647,c$=-2147483648,d$=4294967295,f$=9223372036854776e3,h$=-9223372036854776e3,p$=18446744073709552e3;class cx{constructor(t,n,r,i){this.errorCode=t,this.fields=n,this.expected=r,this.received=i}asMessage(t){const n=this.fields[0]+this.fields.slice(1).reduce((i,o)=>Number(o)>=0?`${i}[${o}]`:`${i}.${o}`,"");let r;switch(this.errorCode){case 1:r="Repeated field must be an array";break;case 2:r=`Expected type ${this.expected} but received type ${this.received}`;break;case 3:r="Value must be finite";break;case 4:r="Value is out of range for its type";break;case 5:r="Bytes array is malformed";break;case 6:r="Exceeded app limit for maximum string length";break;case 7:r="Exceeded app limit for item count";break;case 12:r="Value must be an integer";break;case 13:r="Values like null or undefined are not allowed for items in repeated fields";break;default:r=`Unknown error code: ${this.errorCode}`;break}return`Schema ${t} on field "${n}": ${r}`}}class m${validate(t,n,r=!1){const i=Nt.checkSchema(t);le.requireArgument(n,"data","object");const o=Nt.getSchemaId(t),a=new Array,l=Nt.getTypes(t);if(this._validateFields(a,[],n,l[i.message],l,o),a.length&&!r)throw new Error(a[0].asMessage(o));return a}_validateFields(t,n,r,i,o,a){const l=i.oneofs||{},c=i.fields||{};for(const d in r){const h=r[d];if(h!=null){const p=(g,m,E)=>this._matchFieldTypes(t,[...n,d],h,g,o,a,d,m,E);l[d]?p(c[l[d].oneof[0]].type):c[d]&&p(c[d].type,c[d].rule==="repeated")}}}_matchFieldTypes(t,n,r,i,o,a,l,c,d){let h;if(c)Array.isArray(r)?(r.length>ux&&(h=7),r.forEach((p,g)=>{this._matchFieldTypes(t,[...n,g.toString()],p,i,o,a,l,void 0,!0)})):h=1;else if(r==null||r===void 0)d&&(h=13);else{let p,g;switch(i){case"string":g="string",r.length>Qm&&(h=6);break;case"bytes":g="object",r instanceof Uint8Array||(h=5);break;case"bool":g="boolean";break;case"uint32":g="number",p={min:lx,max:d$,isInt:!0,isItem:d};break;case"int32":case"sint32":case"fixed32":case"sfixed32":g="number",p={min:c$,max:l$,isInt:!0,isItem:d};break;case"uint64":g="number",p={min:lx,max:p$,isInt:!0,isItem:d};break;case"fixed64":case"sfixed64":case"int64":case"sint64":g="number",p={min:h$,max:f$,isInt:!0,isItem:d};break;case"double":case"float":g="number",p={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:d};break;default:new Set(Object.keys(o)).has(i)&&(this._validateFields(t,n,r,o[i],o,a),g="object");break}typeof r!==g?t.push(new cx(2,n,i,typeof r)):p&&(p.isInt&&!Number.isFinite(r)?h=3:p.isInt&&!Number.isInteger(r)?h=12:!(!p.isInt&&Number.isNaN(r))&&!(r>=p.min&&r<=p.max)&&(h=4))}h&&t.push(new cx(h,n))}}const dx=new m$;class g${_getMetricTags(t){const n=t.getTags();if(n)return Object.entries(n).map(r=>({name:r[0],value:r[1].toString()}))}getUpCounters(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),value:r.getData(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getValueRecorders(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),values:r.getData(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getBucketHistograms(t,n=!0){return t.map(r=>{const i={name:r.getName(),createdTimestamp:r.getCreatedOn(),lastUpdatedTimestamp:r.getLastUpdatedOn(),values:r.getData(),buckets:r.getBuckets(),ownerName:r.getOwnerName(),ownerAppName:r.getOwnerAppName(),tags:this._getMetricTags(r)};return n&&r.reset(),i})}getMetricsTags(t){const n={};return t.forEach(r=>{n[r.name]=r.value}),n}}const pi=Object.freeze(new g$);class y${checkInputs(t,n){Nt.checkSchema(t),le.requireArgument(n,"data","object");let r,i;n.userPayload!==void 0&&Nt.isInternal(t)&&(i=n.userPayload,r=dx.validate(i.schema,i.payload,!0),this._processValidationResults(Nt.getSchemaId(i.schema),i.payload,r),n.userPayload=void 0),r=dx.validate(t,n,!0),this._processValidationResults(Nt.getSchemaId(t),n,r),i!==void 0&&(n.userPayload=i)}getExtraFields(t,n){le.requireArgument(n,"data","object");const r=[],i=n.userPayload;return i!==void 0&&Nt.isInternal(t)&&r.push(...Nt.getExtraFields(i.schema,i.payload)),r.push(...Nt.getExtraFields(t,n)),r}getPayloadFromProvider(t,n){const r=(t==null?void 0:t.getPayload(n))||void 0;return r&&this.checkInputs(r.schema,r.payload),r}_processValidationResults(t,n,r){for(let i=0;i<r.length;i+=1){const o=r[i];if(o.errorCode==6||o.errorCode==7){const a=o.fields.length-1,l=this._traverseFields(n,o.fields.slice(0,a)),c=o.fields[a];o.errorCode==6?l[c]=l[c].substring(0,Qm):l[c].splice(ux)}else throw new Error(o.asMessage(t))}}_traverseFields(t,n){return n.length?this._traverseFields(t[n[0]],n.slice(1)):t}}const rd=Object.freeze(new y$),fx="o11y";class hx{constructor(t){this._errorCounter=t,this._safeCatchMode=!1}_callCo11y(t,n){n?Ko.exception(t==null?void 0:t.op,fx):Ko.success(t==null?void 0:t.op,fx)}tryCatch(t,n){let r;try{t()}catch(i){r=!0,this._prodSafeCatch(i)}finally{this._callCo11y(n,r)}}tryCatchReturn(t,n,r){let i;try{return le.requireArgument(n,"noopValue"),t()}catch(o){return i=!0,this._prodSafeCatch(o),n}finally{this._callCo11y(r,i)}}_prodSafeCatch(t){let n;try{if(n=!le.isProduction,n)throw t;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(t instanceof Error)){const r=t&&t.message||(typeof t.toString=="function"?t.toString():"");t=new Error(r)}this._safeCatchMode=!1}catch(r){if(n)throw r;if(r&&console&&typeof console.error=="function")try{console.error(r)}catch(i){}this._safeCatchMode=!1}}}const E$=Symbol("o11y.stampTenantClass");class b${get isBusy(){return this._isOk?this._busyCount>0:void 0}constructor(t,n,r,i){this.name=t,this._doneCallback=r,this._overDoneCallback=i,this._busyCount=0,this._isOk=!0,this._busyCount=n}add(){this._isOk&&(this._busyCount+=1)}done(){this._isOk&&(this._busyCount>0?(this._busyCount-=1,this._busyCount||this._doneCallback()):(this._isOk=!1,this._overDoneCallback()))}}const _$=300;class v${constructor(t){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=_$,this._endedTasks=new Array,this._pollableReport=new Array,le.requireArgumentIfDefined(t==null?void 0:t.logThreshold,"options.logThreshold","number")&&(this._logThreshold=t.logThreshold),le.requireArgumentIfDefined(t==null?void 0:t.reportListener,"options.reportListener","function")&&(this._reportListener=t.reportListener),le.requireArgumentIfDefined(t==null?void 0:t.errorListener,"options.errorListener","function")&&(this._errorListener=t.errorListener)}requestIdleDetectedCallback(t){le.requireArgument(t,"callback","function"),this._listeners.size===0&&(this._firstCallbackTime=le.time().perfNow),this._listeners.add(t),this._checkIfLoaded()}_reportTaskEnded(t){if(this._listeners.size){const n=Object.assign({},this._taskers.get(t));this._endedTasks.push(n)}}declareNotifierTaskSingle(t){le.requireArgument(t,"name","string");const n=this._addTasker(t,1);return{get isBusy(){return n.isBusy},done:()=>{n.done(),this._taskers.delete(n)}}}declareNotifierTaskMulti(t,n=0){if(le.requireArgument(t,"name","string"),n!==void 0&&(le.requireArgument(n,"existingBusyCount","number"),!Number.isInteger(n)||n<0))throw new Error("existingBusyCount accepts only non-negative integers");const r=this._addTasker(t,n);return{get isBusy(){return r.isBusy},add:()=>{if(!r.isBusy){const o=this._taskers.get(r);o.start=le.time().perfNow,o.end=void 0}r.add()},done:r.done.bind(r)}}declarePollableTaskMulti(t,n){le.requireArgument(t,"name","string"),le.requireArgument(n,"isBusyChecker","function"),this._busyCheckers.set(n,t)}_addTasker(t,n){const r=new b$(t,n,()=>{this._taskers.get(r).end=le.time().perfNow,this._reportTaskEnded(r),this._checkIfLoaded()},()=>{var i;(i=this._errorListener)===null||i===void 0||i.call(this,`Overdone: ${r.name}`),le.noProdThrow(`Tasker '${r.name}' is done too many times.`)});return this._taskers.set(r,{name:t,start:n>0?le.time().perfNow:void 0,end:void 0}),r}_areAllNotifiersIdle(){return!Array.from(this._taskers.keys()).some(t=>t.isBusy)}_getFirstBusyPollable(){const t=Array.from(this._busyCheckers).find(n=>{var r;const i=n[0],o=n[1];try{return i()}catch(a){return(r=this._errorListener)===null||r===void 0||r.call(this,a,`BusyChecker ${o}`),le.noProdThrow(a),!1}});return t?t[1]:void 0}_checkIfLoaded(){this._listeners.size&&(this._timerCheckQueued&&clearTimeout(this._timerCheckQueued),this._areAllNotifiersIdle()&&(this._timerCheckQueued=setTimeout(()=>{this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},40)},0)))}_doubleCheck(){if(this._timerCheckQueued=void 0,this._areAllNotifiersIdle()){const t=this._getFirstBusyPollable();if(t!==void 0)this._addToPollableReport(t),this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},15);else{const n=le.time().perfNow-this._firstCallbackTime,r=Array.from(this._listeners.values());this._listeners.clear(),this._firstCallbackTime=void 0;const i=this._endedTasks.splice(0),o=this._pollableReport.splice(0);this._notify(r,n,i,o)}}}_addToPollableReport(t){const n=this._pollableReport.length?this._pollableReport[this._pollableReport.length-1]:void 0;(n==null?void 0:n.name)===t?n.count+=1:this._pollableReport.push({name:t,count:1})}_notify(t,n,r,i){var o;if(n>=this._logThreshold&&this._reportListener){const l=this._getReport(n,t.length,r,i);this._reportListener(l)}t.reverse();const a=le.time().tsNow;for(const[l,c]of t.entries())try{c(a)}catch(d){(o=this._errorListener)===null||o===void 0||o.call(this,d,`Listener #${t.length-1-l}`),le.noProdThrow(d)}}getReport(){const t=le.time().perfNow,n=this._firstCallbackTime>0?t-this._firstCallbackTime:void 0,r=Array.from(this._taskers.entries()).filter(i=>i[0].isBusy).map(i=>({name:i[1].name,start:i[1].start,end:t}));return this._getReport(n,this._listeners.size,this._endedTasks.concat(r),this._pollableReport)}_getReport(t,n,r,i){const o=r.map(a=>({name:a.name,duration:a.end-a.start})).sort((a,l)=>l.duration-a.duration);return{logThreshold:this._logThreshold,maxDuration:t,listenerCount:n,pollableCount:this._busyCheckers.size,busyTasks:o.map(a=>a.name),busyDurations:o.map(a=>a.duration),pollables:i.map(a=>a.name),pollCounts:i.map(a=>a.count)}}}const T$={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{ResourceTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"}}}}}}}}}},w$={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{NavigationTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{redirectCount:{id:37,type:"uint32"},encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},unloadEventEnd:{id:40,type:"double"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},unloadEventStart:{id:39,type:"double"},domContentLoadedEventStart:{id:32,type:"double"},type:{id:38,type:"string"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},domContentLoadedEventEnd:{id:33,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domInteractive:{id:34,type:"double"},domComplete:{id:31,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},logEvent:{id:41,type:"string"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},loadEventStart:{id:35,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"},loadEventEnd:{id:36,type:"double"}}}}}}}}}};class x${constructor(t){this._fuzzyKeyRange=t,this._map=new Map,le.requireArgument(t,"_fuzzyKeyRange","number")}add(t,n,r){const i=this._map.get(t);i?i.push({fuzzyKey:n,value:r}):this._map.set(t,[{fuzzyKey:n,value:r}])}pop(t,n){const r=this._map.get(t);if((r==null?void 0:r.length)>=1){let i=Number.POSITIVE_INFINITY,o=-1;for(let a=0;a<r.length;a++){const{fuzzyKey:l}=r[a],c=Math.abs(l-n);c<=this._fuzzyKeyRange&&c<i&&(i=c,o=a)}if(o>=0){const{value:a}=r.splice(o,1)[0];return r.length===0&&this._map.delete(t),a}}}clear(){this._map.clear()}}const S$=["fetch","xmlhttprequest"];class A${constructor(t,n,r,i,o){if(this._instr=t,this._skipUrls=r,this._logPerformanceActivityName=i,this._boundObserverCallback=this._logPerformanceEntries.bind(this),this._boundNavigationTimingEventCallback=a=>{this._logNavigationEntries(a)},this._setTimeoutNavigationCallback=a=>{setTimeout(()=>{this._boundNavigationTimingEventCallback(a)},0)},this._visibilityChangeNavigationCallback=a=>{document.visibilityState==="hidden"&&this._boundNavigationTimingEventCallback(a)},this._isStarted=!1,this._processedNavigationTiming=!1,le.requireArgument(t,"_instr","object"),le.requireArgument(n,"fuzzyMapRange","number"),le.requireArgumentIfDefined(r,"_skipUrls",Array),le.requireArgumentIfDefined(i,"_logPerformanceActivityName","string"),le.requireArgumentIfDefined(o,"logLevel","string"),this._hasPerf=typeof performance!="undefined"&&typeof PerformanceObserver=="function",this._hasWindow=typeof window!="undefined",!o||o.toLowerCase()==="full")this._logLevel=1;else if((o==null?void 0:o.toLowerCase())==="basic")this._logLevel=0;else throw new Error(`Invalid log level: ${o}`);this._fuzzyMapper=new x$(n)}get isStarted(){return this._isStarted}get logLevel(){return this._logLevel}start(){this._hasPerf&&(this._isStarted||(this._isStarted=!0,this._resourceObserver=new PerformanceObserver(this._boundObserverCallback),this._resourceObserver.observe({type:"resource",buffered:!0}),this._addNavigationListeners()))}stop(){this._resourceObserver&&(this._resourceObserver.disconnect(),this._resourceObserver=void 0),this._removeNavigationListeners(),this._fuzzyMapper.clear(),this._isStarted=!1}_addNavigationListeners(){this._hasWindow&&(window.addEventListener("load",this._setTimeoutNavigationCallback),window.addEventListener("pagehide",this._boundNavigationTimingEventCallback),document.addEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}_removeNavigationListeners(){this._hasWindow&&(window.removeEventListener("load",this._setTimeoutNavigationCallback),window.removeEventListener("pagehide",this._boundNavigationTimingEventCallback),document.removeEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}addEntry(t,n,r){this._fuzzyMapper.add(t,n,r)}_resourceEntryToResourceTiming(t){var n,r;const i={name:t.name,startTime:t.startTime,duration:t.duration,initiatorType:t.initiatorType,nextHopProtocol:t.nextHopProtocol,renderBlockingStatus:t.renderBlockingStatus,workerStart:t.workerStart,redirectStart:t.redirectStart,redirectEnd:t.redirectEnd,fetchStart:t.fetchStart,domainLookupStart:t.domainLookupStart,domainLookupEnd:t.domainLookupEnd,connectStart:t.connectStart,secureConnectionStart:t.secureConnectionStart,connectEnd:t.connectEnd,requestStart:t.requestStart,responseStart:t.responseStart,firstInterimResponseStart:t.firstInterimResponseStart,responseEnd:t.responseEnd,transferSize:t.transferSize,encodedBodySize:t.encodedBodySize,decodedBodySize:t.decodedBodySize,responseStatus:t.responseStatus},o=t.serverTiming;return Array.isArray(o)&&(i.dbDuration=(n=o.find(a=>a.name==="db"))===null||n===void 0?void 0:n.duration,i.srvDuration=(r=o.find(a=>a.name==="Total"))===null||r===void 0?void 0:r.duration),i}_shouldInclude(t){var n;return((n=this._skipUrls)===null||n===void 0?void 0:n.some(i=>i instanceof RegExp?i.test(t.name):t.name===i))?!1:this._logLevel===1?!0:S$.indexOf(t.initiatorType)>=0||t.entryType==="navigation"}_calculateXhrDelay(t,n){if(n){if(t.initiatorType==="fetch"){if(t.responseStart===0)return-1;if(n.activityDuration!==void 0){const r=t.responseStart-t.startTime;return n.activityDuration-r}return}if(n.activityDuration!==void 0)return n.activityDuration-t.duration}}_logActivity(t,n,r,i){const o={id:r},a={perfStartOverride:n.startTime,perfStopOverride:n.startTime+n.duration,errorCount:i};this._instr.startActivity(this._logPerformanceActivityName,o).stop(t,n,a)}_logNavigationEntries(t){if(!this._processedNavigationTiming)for(const n of performance.getEntriesByType("navigation")){const r=n;if(this._shouldInclude(r)){this._processedNavigationTiming=!0;const i=this._resourceEntryToResourceTiming(r),o={domComplete:r.domComplete,domContentLoadedEventStart:r.domContentLoadedEventStart,domContentLoadedEventEnd:r.domContentLoadedEventEnd,domInteractive:r.domInteractive,loadEventStart:r.loadEventStart,loadEventEnd:r.loadEventEnd,redirectCount:r.redirectCount,type:r.type,unloadEventStart:r.unloadEventStart,unloadEventEnd:r.unloadEventEnd,logEvent:t.type};this._logActivity(w$,Object.assign(i,o))}break}}_logPerformanceEntries(t){for(const n of t.getEntriesByType("resource")){const r=n,i=this._fuzzyMapper.pop(r.name,r.startTime);if(this._shouldInclude(r)){const o=this._resourceEntryToResourceTiming(r);Object.assign(o,{srvReqId:i==null?void 0:i.requestId,xhrDelay:this._calculateXhrDelay(r,i)}),o.responseStatus===void 0&&(o.responseStatus=i==null?void 0:i.responseStatus),this._logActivity(T$,o,i==null?void 0:i.activityId,i==null?void 0:i.errorCount)}}}}const C$=32,k$=16,px=16,O$="traceparent",N$="b3",mx="X-B3-TraceId",gx="X-B3-SpanId",yx="X-B3-Sampled",Ex="X-B3-ParentSpanId",bx="X-SFDC-Request-Id",I$="baggage",P$="fetch",R$="xhr_send",L$="perf-timing",D$=50,M$=[I$,mx,gx,Ex,yx],Vs=new WeakMap;class Oe{constructor(t,n){this._instr=t,this._idleDetector=n,le.requireArgument(t,"_instr","object"),le.requireArgument(n,"_idleDetector","object")}static _getB3CompactFormat(t,n,r,i){let o=`${t}-${n}`;return(r!==void 0||i!==void 0)&&(o+=r?"-1":"-0",i!==void 0&&(o+=`-${i}`)),o}static _getW3CompactFormat(t,n,r){return`00-${t}-${n}-${r?"01":"00"}`}static _conformTextAsId(t,n){t=t.toLowerCase();const r=t.length;for(let i=0;i<r;i+=1){const o=t[i];if(!(o>="a"&&o<="f")&&!(o>="0"&&o<="9"))throw new Error(`The text '${t}' has an invalid character at index #${i}`)}return r>n?t.substr(r-n):r<n?t.padStart(n,"0"):t}static setHeaders(t){if(t===void 0){Oe._userHeaders={};return}Object.entries(t).forEach(([n])=>{M$.includes(n)||delete t[n]}),Oe._userHeaders=t}static getHeaders(t,n,r,i){le.requireArgument(n,"spanId","string");const o=i==null?void 0:i.useB3Headers,a={};if(t===void 0)return a;t=this._conformTextAsId(t,(i==null?void 0:i.traceIdEffectiveLength)!==void 0?i.traceIdEffectiveLength:o?k$:C$),n=this._conformTextAsId(n,px);const l=i&&i.parentSpanId!==void 0&&this._conformTextAsId(i.parentSpanId,px)||void 0;return o?(i==null?void 0:i.useCompactHeader)?a[N$]=this._getB3CompactFormat(t,n,r,l):(a[mx]=t,a[gx]=n,l!==void 0&&(a[Ex]=l),r!==void 0&&(a[yx]=r?"1":"0")):a[O$]=this._getW3CompactFormat(t,n,r),a}_disableNetworkInstrumentation(){Oe._isNetworkInstrumentationEnabled&&(Oe._originalFetch&&(Oe._global.fetch=Oe._originalFetch,Oe._originalFetch=void 0),Oe._originalXhr&&(Oe._global.XMLHttpRequest=Oe._originalXhr,Oe._originalXhr=void 0),Oe._originalXhrOpen&&(Oe._global.XMLHttpRequest.prototype.open=Oe._originalXhrOpen,Oe._originalXhrOpen=void 0),Oe._originalXhrSetRequestHeader&&(Oe._global.XMLHttpRequest.prototype.setRequestHeader=Oe._originalXhrSetRequestHeader,Oe._originalXhrSetRequestHeader=void 0),Oe._originalXhrSend&&(Oe._global.XMLHttpRequest.prototype.send=Oe._originalXhrSend,Oe._originalXhrSend=void 0),Oe._performanceObservability&&(Oe._performanceObservability.stop(),Oe._performanceObservability=void 0),Oe._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(t,n,r,i,o,a,l,c,d,h){typeof Oe._global.fetch=="function"&&(this._overrideFetch(t,n,r,i,o,a,d),Oe._isNetworkInstrumentationEnabled=!0),typeof Oe._global.XMLHttpRequest=="function"&&(this._overrideXhr(t,n,r,i,o,a,d),Oe._isNetworkInstrumentationEnabled=!0),l&&(Oe._performanceObservability=new A$(t,h,d,c,l===!0?"full":l),Oe._performanceObservability.start(),Oe._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(t,n,r,i,o){let a;if(t)a=t.getTraceHeaders(r)||{};else{const l=n.internalInstrumentationContext;l!=null&&l.rootId?a=Oe.getHeaders(l.rootId,le.generateUniqueId(),l.isRootActivitySampled,r):a={}}if(typeof(r==null?void 0:r.headerProcessor)=="function")a=r.headerProcessor({method:i,url:o,defaultHeaders:a});else if(typeof window=="object"){let l;try{l=new URL(o)}catch(c){}l&&l.host!==window.location.host&&(a=void 0)}return Oe._userHeaders&&Object.keys(Oe._userHeaders).length>0&&(a=z({},a),Object.entries(Oe._userHeaders).forEach(([l,c])=>{a[l]=c}),Oe._userHeaders=void 0),a||{}}static _extractHeader(t,n,r){if((r==null?void 0:r.headers)instanceof Headers)return r.headers.get(t);if(Array.isArray(r==null?void 0:r.headers)){const i=r.headers.find(o=>o[0]===t);return i==null?void 0:i[1]}if(typeof(r==null?void 0:r.headers)=="object")return r.headers[t];if(n instanceof Request)return n.headers.get(t)}_overrideFetch(t,n,r,i,o,a,l){Oe._originalFetch=Oe._global.fetch;const c=(d,h,...p)=>Ne(this,null,function*(){var g;let m,E,S,T,v,w=!1,C;try{a==null||a.add(),T=h==null?void 0:h.method;const R=h==null?void 0:h.o11y,k=R==null?void 0:R.skipInstr;if(w=k||Oe._shouldSkipUrl(l,d),!w)m=t.startActivity(r||P$);else if(k){Oe._reqIndex+=1;try{if(d instanceof URL)d.searchParams.append("o11y",Oe._reqIndex.toString());else if(typeof d=="string"){const P=new URL(d),I=`o11y=${Oe._reqIndex}`;P.search+=P.search.startsWith("?")?`&${I}`:I,d=P.toString()}}catch(P){}}if(h==null||delete h.o11y,E=d==null?void 0:d.toString(),S=le.tryGetAbsoluteUrl(E),i){d instanceof Request&&(T||(T=d.method),E=d.url,S=le.tryGetAbsoluteUrl(E));const P=Oe._getTraceHeaders(m,t,o,T,S);!this._applyTraceHeaders(d,h,P)&&h===void 0&&(h={headers:P})}return v=le.perfNow(),C=yield Oe._originalFetch.call(Oe._global,d,h,...p),C}catch(R){throw n&&!w&&(m?m.error(R):t.error(R)),R}finally{try{const R=Oe._endActivity(m,E,T);if(!((g=Oe._performanceObservability)===null||g===void 0)&&g.isStarted){const P={requestId:Oe._extractHeader(bx,d,h),activityDuration:R,activityId:m==null?void 0:m.getId(),errorCount:m==null?void 0:m.getErrorCount(),responseStatus:C==null?void 0:C.status};Oe._performanceObservability.addEntry(S,v,P)}}finally{a==null||a.done()}}});Oe._global.fetch=c}static _endActivity(t,n,r){var i;if(t)return!((i=Oe._performanceObservability)===null||i===void 0)&&i.isStarted?t.discard():t.stop(t$,{mtd:r,url:n}),t.getStopPerfTime()-t.getStartPerfTime()}_overrideXhr(t,n,r,i,o,a,l){Oe._originalXhr=Oe._global.XMLHttpRequest,Oe._originalXhrOpen=Oe._originalXhr.prototype.open,Oe._originalXhrSetRequestHeader=Oe._originalXhr.prototype.setRequestHeader,Oe._originalXhrSend=Oe._originalXhr.prototype.send;function c(h,p){var g;const m=Vs.get(h);if(m){const E=m.activity,S=Oe._endActivity(E,m.url,m.method);!p&&(!((g=Oe._performanceObservability)===null||g===void 0)&&g.isStarted)&&Oe._performanceObservability.addEntry(m.absoluteUrl,m.sendTime,{requestId:m.requestId,activityDuration:S,activityId:E==null?void 0:E.getId(),errorCount:E==null?void 0:E.getErrorCount(),responseStatus:h.status})}}Oe._originalXhr.prototype.open=function(h,p,g,m,E){const S={method:h,url:p==null?void 0:p.toString()};Vs.set(this,S),S.absoluteUrl=le.tryGetAbsoluteUrl(S.url),S.suspendInstrumentation=Oe._shouldSkipUrl(l,S.absoluteUrl),Oe._originalXhrOpen.apply(this,arguments)},Oe._originalXhr.prototype.setRequestHeader=function(h,p){var g;if(((g=h==null?void 0:h.toLowerCase)===null||g===void 0?void 0:g.call(h))===bx.toLowerCase()){const m=Vs.get(this);m&&(m.requestId=p)}Oe._originalXhrSetRequestHeader.apply(this,arguments)},Oe._originalXhr.prototype.send=function(...h){let p;const g=this;let m=Vs.get(g);m||(m={},Vs.set(g,m));try{if(a==null||a.add(),m.suspendInstrumentation||(m.activity=p=t.startActivity(r||R$)),i){const E=Oe._getTraceHeaders(p,t,o,m.method,m.absoluteUrl);Object.entries(E).forEach(S=>{g.setRequestHeader(S[0],S[1])})}m.sendTime=le.perfNow(),Oe._originalXhrSend.call(this,...h)}catch(E){throw n&&!(m!=null&&m.suspendInstrumentation)&&(p?p.error(E):t.error(E)),c(g,!0),a==null||a.done(),E}};const d=new Proxy(Oe._originalXhr,{construct(h){const p=new h;return p.addEventListener("load",()=>{c(p),a==null||a.done()}),p.addEventListener("error",g=>{const m=Vs.get(p)||{};try{if(n&&!(m!=null&&m.suspendInstrumentation)){const E=new Error("XHR Network-Level Error"),S=m==null?void 0:m.activity;S?S.error(E):t.error(E)}c(p)}finally{a==null||a.done()}}),p.addEventListener("abort",()=>{var g;const m=Vs.get(p)||{};(g=m==null?void 0:m.activity)===null||g===void 0||g.discard(),a==null||a.done()}),p}});Oe._global.XMLHttpRequest=d}networkInstrumentation(t){var n;if(le.requireArgument(t,"options",["boolean","object"]),this._disableNetworkInstrumentation(),t){const r=typeof t=="object"?t:{};let i;le.definedValueOrDefault(r.useTasker,!0)&&(i=(n=this._idleDetector)===null||n===void 0?void 0:n.declareNotifierTaskMulti("o11y network")),this._enableNetworkInstrumentation(le.definedValueOrDefault(r.instrumentation,this._instr),le.definedValueOrDefault(r.logErrors,!0),r.activityName,le.definedValueOrDefault(r.useTracing,!0),r.tracingHeadersOptions,i,le.definedValueOrDefault(r.logPerformance,!0),le.definedValueOrDefault(r.logPerformanceActivityName,L$),le.definedValueOrDefault(r.skipUrls,[]),le.definedValueOrDefault(r.fuzzyMapRange,D$))}}resetRequestCounter(){Oe._reqIndex=0}_applyTraceHeaders(t,n,r){if((n==null?void 0:n.headers)!==void 0){if(n.headers instanceof Headers&&typeof n.headers.set=="function")return Object.entries(r).forEach(([i,o])=>{n.headers.set(i,o)}),!0;if(Array.isArray(n.headers))return Object.entries(r).forEach(i=>{n.headers.push(i)}),!0;if(typeof n.headers=="object")return n.headers=Object.assign(n.headers,r),!0}else{if(t instanceof Request&&t.headers instanceof Headers)return Object.entries(r).forEach(([i,o])=>{t.headers.set(i,o)}),!0;if(n)return n.headers=Object.assign({},r),!0}return!1}static _shouldSkipUrl(t,n){var r;let i=n;return n instanceof URL?i=(r=n.toString)===null||r===void 0?void 0:r.call(n):n instanceof Request&&(i=n.url),t==null?void 0:t.some(o=>o instanceof RegExp?o.test(i):i===o)}}Oe._global=le.getGlobal(),Oe._isNetworkInstrumentationEnabled=!1,Oe._reqIndex=0;var Or;(function(e){e[e.none=0]="none",e[e.start=1]="start",e[e.stop=2]="stop",e[e.both=3]="both"})(Or||(Or={}));const F$="timedout",B$="terminated",Jm="discarded",id={timedout:F$,terminated:B$,discarded:Jm};class Qo{constructor(t,n,r,i,o,a,l,c,d,h,p){var g,m;this._name=t,this._rootId=n,this._onStopped=r,this._onError=i,this._isSampled=l,this._noRerooting=d,this._isExternal=h,this._parentActivity=p,this._isRoot=!1,this._errorCount=0,this._timerOverridden=Or.none;const{tsNow:E,perfNow:S}=le.time();if(Qo._count+=1,this._id=a||le.generateUniqueId(),this._usePerf=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.measure=="function",this._usePerf){this._perfName=`${this._name}__${Qo._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(T){this._usePerf=!1}}this._startTimestamp=E,this._startPerfTime=S,this._overrideTimer(c),o>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||id.timedout,this.stop()},o)),this._safety=new hx,this._externalParentActivity=!((g=this._parentActivity)===null||g===void 0)&&g.isExternal()?this._parentActivity:(m=this._parentActivity)===null||m===void 0?void 0:m.getExternalParentActivity()}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}getParentActivity(){return this._parentActivity}isExternal(){var t;return(t=this._isExternal)!==null&&t!==void 0?t:!1}getExternalParentActivity(){return this._externalParentActivity}error(t,n,r){this._safety.tryCatch(()=>{this._errorCount+=1,typeof t=="string"&&(t=new Error(t)),this._onError(t,this._getDetail(n,r))},{op:"activity.error"})}stop(t,n,r){this._safety.tryCatch(()=>{if(le.requireArgumentIfDefined(t,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(n,"userData","object"),r){const i=r.perfStartOverride,o=le.requireArgumentIfDefined(i,"options.perfStartOverride","number"),a=r.perfStopOverride,l=le.requireArgumentIfDefined(a,"options.perfStopOverride","number"),c=r.errorCount;if(le.requireArgumentIfDefined(c,"options.errorCount","number")&&(this._errorCount=c),o&&i<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(l&&(a<0||a<(o?i:this._startPerfTime)||a>le.time().perfNow+100))throw new Error("perfStopOverride, if defined, must be >= 0 and >= startTime and <= now")}this._stopInternal(t,n,r)},{op:"activity.stop"})}_overrideTimer(t,n){t!==void 0&&(this._startTimestamp=Math.round(this._startTimestamp-(this._startPerfTime-t)),this._startPerfTime=t,this._setTimerOverride(Or.start)),n!==void 0&&(this._stopPerfTime=n,this._setTimerOverride(Or.stop))}_setTimerOverride(t){this._timerOverridden===Or.both||this._timerOverridden===t||t===Or.none||(this._timerOverridden=this._timerOverridden===Or.none?t:Or.both)}_stopInternal(t,n,r){const i=le.perfNow();if(this._usePerf)try{this._stopReason!==id.discarded&&performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(a){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;r&&this._overrideTimer(r.perfStartOverride,r.perfStopOverride),this._stopPerfTime=this._timerOverridden===Or.none||this._timerOverridden===Or.start?i:this._stopPerfTime;const o=this._getDetail(t,n);this._onStopped(o)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||id.discarded,this.stop()},{op:"activity.discard"})}terminate(t,n,r){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||id.terminated,this.stop(t,n,r)},{op:"activity.terminate"})}getIsSampled(){return this._isSampled||!1}_getDetail(t,n){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:t,userData:n,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled(),timerOverridden:this._timerOverridden,noRerooting:this._noRerooting,isExternal:this._isExternal,parentActivity:this._parentActivity,externalParentActivity:this._externalParentActivity}}getTraceHeaders(t){const n=this.id,r=this._isRoot?this.id:this._rootId;return Oe.getHeaders(r,n,this.getIsSampled(),t)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}Qo._count=0;const U$=new Array(16).fill(0).join("");class j${getId(){return U$}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(t){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const H$=Object.freeze(new j$);class $${getInstrumentedEventData(t,n,r,i){var o;const a={ownerComponent:r.tagName,parentComponent:((o=r.parentElement)===null||o===void 0?void 0:o.tagName)||void 0,simplePath:le.getXpath(r)};switch(t){case 0:a.baseEvent=n;break;case 1:a.mouseEvent=n;break}return i&&(a.userPayload=Nt.makePayload(i.schema,i.payload,!0)),a}getEventData(t){return{type:t.type}}getMouseEventData(t){return{altKey:t.altKey,bubbles:t.bubbles,button:t.button,buttons:t.buttons,cancelable:t.cancelable,clientX:t.clientX,clientY:t.clientY,composed:t.composed,defaultPrevented:t.defaultPrevented,detail:t.detail,eventPhase:t.eventPhase,isTrusted:t.isTrusted,timeStamp:t.timeStamp,type:t.type,ctrlKey:t.ctrlKey,metaKey:t.metaKey,movementX:t.movementX,movementY:t.movementY,offsetX:t.offsetX,offsetY:t.offsetY,pageX:t.pageX,pageY:t.pageY,screenX:t.screenX,screenY:t.screenY,shiftKey:t.shiftKey}}}const Zm=new $$;class _x{constructor(t,n,r,i,o,a,l,c){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._buckets=o,this._values=new Array,this._createdOn=a===void 0?le.time().tsNow:a,l!==void 0&&(this._lastUpdatedOn=l),c!==void 0&&(this._values=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}getBuckets(){return this.buckets}get buckets(){return this._buckets.slice(0,this._buckets.length)}get values(){return this._values.slice(0,this._values.length)}record(t){if(typeof t=="number"){this._values.push(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("BucketHistogram can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class vx{constructor(t,n,r,i,o,a,l){this._name=t,this._ownerName=n,this._ownerAppName=r,this._tags=i,this._values=new Array,this._createdOn=o===void 0?le.time().tsNow:o,a!==void 0&&(this._lastUpdatedOn=a),l!==void 0&&(this._values=l)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(t){if(typeof t=="number"){this._values.push(t),this._lastUpdatedOn=le.time().tsNow;return}throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class eg{constructor(t){if(this._map=new Map,typeof t=="number"&&t>0){this._maxSize=Math.ceil(t);return}throw new Error("maxSize must be a positive number")}get maxSize(){return this._maxSize}get(t){return this._map.get(t)}has(t){return this._map.has(t)}set(t,n){return this.has(t)||this._map.size<this.maxSize?(this._map.set(t,n),!0):!1}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const Tx=1e3,wx=500,xx=500;var Jo;(function(e){e[e.Counter=0]="Counter",e[e.Percentile=1]="Percentile",e[e.BucketHistogram=2]="BucketHistogram"})(Jo||(Jo={}));class Sx{constructor(t,n){this._ownerName=t,this._getOwnerAppName=n,this._upCounters=new eg(Tx),this._valueRecorders=new eg(wx),this._bucketHistograms=new eg(xx)}incrementCounter(t,n,r=!1,i={}){this._tagError(i,r),this._upCounter(t,i).increment(n)}trackValue(t,n,r=!1,i={}){this._tagError(i,r),this._valueRecorder(t,i).record(n)}bucketValue(t,n,r,i=!1,o={}){this._tagError(o,i),this._bucketHistogram(t,o,r).record(n)}_bucketHistogram(t,n,r){const{key:i,sortedTags:o}=this._getKeyAndSortedTags(t,n,Jo.BucketHistogram);let a=this._bucketHistograms.get(i);if(!a&&(a=new _x(t,this._ownerName,this._getOwnerAppName(),o,r),!this._bucketHistograms.set(i,a)))throw new Error(`Max size of ${xx} exceeded for BucketHistograms`);return a}_upCounter(t,n){const{key:r,sortedTags:i}=this._getKeyAndSortedTags(t,n,Jo.Counter);let o=this._upCounters.get(r);if(!o&&(o=new Km(t,this._ownerName,this._getOwnerAppName(),i),!this._upCounters.set(r,o)))throw new Error(`Max size of ${Tx} exceeded for UpCounters`);return o}_valueRecorder(t,n){const{key:r,sortedTags:i}=this._getKeyAndSortedTags(t,n,Jo.Percentile);let o=this._valueRecorders.get(r);if(!o&&(o=new vx(t,this._ownerName,this._getOwnerAppName(),i),!this._valueRecorders.set(r,o)))throw new Error(`Max size of ${wx} exceeded for ValueRecorders`);return o}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}getBucketHistograms(){return this._bucketHistograms.getElements()}_tagError(t,n){t.status=n===!0?"error":"success"}_getKeyAndSortedTags(t,n,r){const i=Object.keys(n).sort().reduce((a,l)=>(a[l]=n[l],a),{});return{key:`${Jo[r]}:${t}${JSON.stringify(i)}`,sortedTags:i}}}class z${constructor(){this.isMock=!0}}const V$=void 0,sd=["`"],Ax={internalError:"o11y-error"},tg=Object.freeze(Array.from(Object.values(Ax))),ng=new WeakMap;class Ou{constructor(t,n){this._nextGen=t,this._name=n,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const i of sd)if(this._name.indexOf(i)>=0)throw new Error(`Name cannot include the reserved character "${i}"`);this._safety=new hx({increment:i=>this._incrementError(i)}),this._metrics=this._initMetrics();const r=Nt.getOptions(ax,"Simple","text");this._simpleTextMaxLength=r?r["(meta.max_length)"]:Qm}_initMetrics(){return new Sx(this.name,()=>this._nextGen.appName||Ou.defaultAppName)}_incrementError(t=1){this._metrics.incrementCounter(Ax.internalError,t,!0)}get name(){return this._name}[E$](t,n,r){const i=this[t];if(typeof i=="function"){ng.set(this,r);try{i.apply(this,n)}finally{ng.delete(this)}}}_wrapUserPayload(t,n,r=!1){let i;return typeof t=="string"?(i=ax,t?n={text:t.substring(0,this._simpleTextMaxLength)}:n=void 0):i=t,Nt.makePayload(i,n,r)}_getEffectiveRootId(t){var n,r;return(r=(n=t==null?void 0:t.instrumentationContext)===null||n===void 0?void 0:n.rootId)!==null&&r!==void 0?r:this._nextGen.getDefaultInstrumentationContext().rootId}get internalInstrumentationContext(){return this._nextGen.getDefaultInstrumentationContext()}log(t,n,r){this._safety.tryCatch(()=>{const i=le.time().tsNow;le.requireArgument(t,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(n,"userData","object"),le.requireArgumentIfDefined(r,"options","object");const o=this._wrapUserPayload(t,n);o!=null&&o.payload&&this._logInternal(this.name,o.schema,o.payload,i,this._getEffectiveRootId(r))},{op:"log"})}_logInternal(t,n,r,i,o){const a=ng.get(this),l=this._nextGen.addLog(t,n,r,i,o,a);if(!le.isProduction){const c=rd.getExtraFields(n,r);!le.isProduction&&c.length>0&&this.error("Extra fields",JH,{extras:c})}return l}error(t,n,r,i){return this._safety.tryCatch(()=>{le.requireArgumentIfDefined(n,"userSchemaOrText",["object","string"]),le.requireArgumentIfDefined(r,"userData","object"),le.requireArgumentIfDefined(i,"options","object");const o=this._getEffectiveRootId(i);this._errorInternal(t,n,r,void 0,o)},{op:"error"})}_errorInternal(t,n,r,i,o){const a=le.time().tsNow;let l;if(t instanceof Error)l=t;else{let h;t==null||typeof t.toString!="function"?h="UNKNOWN":h=t.toString(),l=new Error(h)}const c=this._wrapUserPayload(n,r,!0),d={name:l.name,message:l.message,stack:l.stack,userPayload:c,activityId:i};return this._logInternal(this.name,i$,d,a,o)}startActivity(t,n){return this._safety.tryCatchReturn(()=>{var r;le.requireArgument(t,"name"),le.requireArgumentIfDefined(n,"options","object");const i=le.validateParentActivityType(n==null?void 0:n.isExternal,n==null?void 0:n.parentActivity);let o,a=(n==null?void 0:n.perfStartOverride)!==void 0;const l=(r=n==null?void 0:n.instrumentationContext)===null||r===void 0?void 0:r.rootId;l?(a=!0,o={rootId:l,isRootActivitySampled:n.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:n.instrumentationContext.isRootActivityExternalSampled}):o=this._nextGen.getDefaultInstrumentationContext();const c=n!=null&&n.isExternal?o.isRootActivityExternalSampled:o.isRootActivitySampled;return new Qo(t,o.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,V$,n==null?void 0:n.id,c,n==null?void 0:n.perfStartOverride,a,n==null?void 0:n.isExternal,i)},H$,{op:"startActivity"})}getRootActivityHistoryEntryByTime(t){let n;return this._safety.tryCatch(()=>{n=this._nextGen.getRootActivityHistoryEntryByTime(t)},{op:"getRootActivityHistoryEntryByTime"}),n}_getActivityData(t){var n,r;const i=this._wrapUserPayload(t.userSchemaOrText,t.userData,!0);return{id:t.id,name:t.name,duration:t.stopPerfTime-t.startPerfTime,stopReason:t.stopReason,userPayload:i,errorCount:t.errorCount,isSampled:t.isSampled,timerOverridden:t.timerOverridden,isRerooted:t.isRerooted,isExternal:t.isExternal,parentId:(n=t.parentActivity)===null||n===void 0?void 0:n.getId(),externalParentId:(r=t.externalParentActivity)===null||r===void 0?void 0:r.getId()}}_handleActivityStop(t){if(t.stopReason===Jm)return;if(!t.isRoot&&!t.noRerooting){const r=this._nextGen.getRootActivityHistoryEntryByTime(t.startPerfTime);(!r&&t.rootId!==void 0||r&&t.rootId!==r.id)&&(t.rootId=r==null?void 0:r.id,t.isSampled=(r==null?void 0:r.isSampled)||!1,t.isRerooted=!0)}const n=this._getActivityData(t);this._logActivity(n,t.startTimestamp,t.rootId)}_logActivity(t,n,r){this._logInternal(this.name,n$,t,n,r)}_handleActivityError(t,n){this._errorInternal(t,n.userSchemaOrText,n.userData,n.id,n.rootId)}domEvent(t,n,r,i,o){this._safety.tryCatch(()=>{var a;const l=le.time().tsNow;le.requireArgument(t,"event",[Event,z$]),le.requireArgument(n,"handledBy",[HTMLElement,"object"]);let c;n instanceof HTMLElement?c=n:(n=n,((a=n.template)===null||a===void 0?void 0:a.host)instanceof HTMLElement?c=n.template.host:le.requireArgument(void 0,"handledBy"));const d=this._wrapUserPayload(r,i,!0),h=this._getEffectiveRootId(o);if(t.type==="click"){const p=t,g=this._nextGen.getClickTracker();g&&g.markEventHandled(p);const m=o==null?void 0:o.captureMouseData,E=Zm.getInstrumentedEventData(m?1:0,m?Zm.getMouseEventData(p):Zm.getEventData(p),c,d);E.auto=o==null?void 0:o._auto,this._logInternal(this.name,e$,E,l,h)}else throw new Error(le.notImplemented)},{op:"domEvent"})}_siftTags(t){const n=Object.assign({},t);return Object.entries(n).forEach(([r,i])=>{if(i===null)n[r]="null";else if(i==="")n[r]="empty";else if(Number.isNaN(i))n[r]="NaN";else{const o=typeof i;["number","string","boolean"].indexOf(o)===-1&&(n[r]=o)}}),n}incrementCounter(t,n=1,r=!1,i={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"increment","number"),le.requireArgument(r,"hasError","boolean"),le.requireArgument(i,"tags","object"),this._metrics.incrementCounter(t,n,r,this._siftTags(i))},{op:"incrementCounter"})}trackValue(t,n,r=!1,i={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"value","number"),le.requireArgument(r,"hasError","boolean"),le.requireArgument(i,"tags","object"),this._metrics.trackValue(t,n,r,this._siftTags(i))},{op:"trackValue"})}bucketValue(t,n,r=[],i=!1,o={}){this._safety.tryCatch(()=>{le.requireArgument(t,"operation","string"),le.checkForDenyListedValues(t,"operation",tg),le.checkForReservedCharacters(t,"operation",sd),le.requireArgument(n,"value","number"),le.requireArgument(r,"buckets",Array),Object.entries(r).forEach(([a,l])=>{le.requireArgument(l,`Bucket value for '${a}'`,"number")}),le.requireArgument(i,"hasError","boolean"),le.requireArgument(o,"tags","object"),this._metrics.bucketValue(t,n,r,i,this._siftTags(o))},{op:"bucketValue"})}getUpCounters(){return this._metrics.getUpCounters().filter(t=>t.getLastUpdatedOn())}getValueRecorders(){return this._metrics.getValueRecorders().filter(t=>t.getLastUpdatedOn())}getBucketHistograms(){return this._metrics.getBucketHistograms().filter(t=>t.getLastUpdatedOn())}registerForLogPrompt(t){le.requireArgument(t,"listener","function"),this._nextGen.registerForLogPrompt(t)}_getAsaOptions(t){return t?Object.assign({instrumentationContext:t==null?void 0:t.instrumentationContext},t.startOptions):void 0}activity(t,n,r){var i,o,a,l;const c=this._getAsaOptions(r),d=this.startActivity(t,c);try{return n(d)}catch(h){throw d.error(h,(i=r==null?void 0:r.errorPayload)===null||i===void 0?void 0:i.schema,(o=r==null?void 0:r.errorPayload)===null||o===void 0?void 0:o.payload),h}finally{d.stop((a=r==null?void 0:r.stopPayload)===null||a===void 0?void 0:a.schema,(l=r==null?void 0:r.stopPayload)===null||l===void 0?void 0:l.payload,r==null?void 0:r.stopOptions)}}activityAsync(t,n,r){return Ne(this,null,function*(){var i,o,a,l;const c=this._getAsaOptions(r),d=this.startActivity(t,c);try{return yield n(d)}catch(h){throw d.error(h,(i=r==null?void 0:r.errorPayload)===null||i===void 0?void 0:i.schema,(o=r==null?void 0:r.errorPayload)===null||o===void 0?void 0:o.payload),h}finally{d.stop((a=r==null?void 0:r.stopPayload)===null||a===void 0?void 0:a.schema,(l=r==null?void 0:r.stopPayload)===null||l===void 0?void 0:l.payload,r==null?void 0:r.stopOptions)}})}invokeNetworkCallWithHeaders(t,n,r){return Oe.setHeaders(r),t(...n)}}Ou.defaultAppName="APP_NOT_REGISTERED";const q$=.1,W$=20;class Y${constructor(t){if(this._historyMap=new Map,this._historyList=new Array,le.requireArgumentIfDefined(t,"limit","number")){if(t=Math.ceil(t),t<=0)throw new Error("Limit must be a positive number")}else t=W$;this._graceCount=Math.max(1,Math.floor(t*q$)),this._realLimit=1+t+this._graceCount}add(t){if(this._historyMap.has(t.id))throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${t.id}`);this._historyMap.set(t.id,t),this._historyList.push(t),this._historyList.length===this._realLimit&&this._historyList.splice(1,this._graceCount).forEach(r=>this._historyMap.delete(r.id))}get count(){return this._historyList.length}findById(t){return this._historyMap.get(t)}findByTime(t){let n,r=Number.MAX_VALUE;for(const i of this._historyList){const o=t-i.startPerfTime;o>=0&&(i.stopPerfTime===void 0||t<i.stopPerfTime)&&o<r&&(n=i,r=o)}return n}}class G$ extends Qo{constructor(t,n,r,i,o,a,l,c){super(t,void 0,n,r,void 0,i||le.generateUniqueId(l!=null?l:32),o,a),this._isRoot=!0,this._isExternalSampled=c}get isExternalSampled(){var t;return(t=this._isExternalSampled)!==null&&t!==void 0?t:!1}set isExternalSampled(t){this._isExternalSampled=t}get preRootId(){return this._preRootId}set preRootId(t){this._preRootId=t}_getDetail(t,n){const r=super._getDetail(t,n);return r.isRoot=!0,r.preRootId=this.preRootId,r}}const X$=new Array(32).fill(0).join("");class K${getId(){return X$}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(t){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Q$=Object.freeze(new K$);class J$ extends Ou{constructor(t,n,r){super(t,n),this._allowMulti=r,this._rootActivityHistory=new Y$,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(t,n,r,i,o){return this._safety.tryCatchReturn(()=>{if(le.requireArgument(t,"name"),(i==null?void 0:i.id)!==void 0)throw new Error("Cannot specify id for root activity, use rootId argument instead");const a=new G$(t,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,n,r,i==null?void 0:i.perfStartOverride,this._nextGen.preferredRootIdLength,o);if(!this._allowMulti){const l={id:a.getId(),name:t,startPerfTime:a.getStartPerfTime(),isSampled:a.getIsSampled()};if(this._rootActivityHistory.add(l),this._singleRootActivity&&!this._singleRootActivity.isStopped){const c=this._singleRootActivity.getId();this._singleRootActivity.terminate(),a.preRootId=c}this._singleRootActivity=a}return a},Q$,{op:"startRootActivity"})}_handleRootActivityStop(t){const n=this._rootActivityHistory.findById(t.id);if(n&&(n.stopPerfTime=t.stopPerfTime,n.startPerfTime=t.startPerfTime),t.stopReason===Jm)return;const r=this._getActivityData(t);this._logActivity(r,t.startTimestamp),this._singleRootActivity=void 0}_getActivityData(t){const n=super._getActivityData(t);return n.isRoot=t.isRoot,n.preRootId=t.preRootId,n}getSingleRootActivityId(){var t;return(t=this._singleRootActivity)===null||t===void 0?void 0:t.getId()}isSingleRootActivitySampled(){var t;return(t=this._singleRootActivity)===null||t===void 0?void 0:t.getIsSampled()}isSingleRootActivityExternalSampled(){var t,n;return(n=(t=this._singleRootActivity)===null||t===void 0?void 0:t.isExternalSampled)!==null&&n!==void 0?n:!1}_initMetrics(){return new Sx(this.name,()=>this.name)}getRootActivityHistoryEntry(t){return this._rootActivityHistory.findByTime(t)}}const Z$=5;class ez{constructor(t,n){this._instr=t,this._doc=n,this._isActive=!1,this._boundClickListener=this._clickListener.bind(this),le.requireArgument(t,"_instr"),le.requireArgument(n,"_doc")}activate(){this._isActive||(this._doc.addEventListener("click",this._boundClickListener,!0),this._isActive=!0)}deactivate(){this._isActive&&(this._doc.removeEventListener("click",this._boundClickListener,!0),this._isActive=!1)}markEventHandled(t){this._ignoredEvent=t}_clickListener(t){var n;let r=(n=t.composedPath)===null||n===void 0?void 0:n.call(t);(!r||!r.length)&&(r=t.path);const i=this._getClickableElement(r);i&&setTimeout(()=>{t!==this._ignoredEvent&&this._instr.domEvent(t,i,void 0,void 0,{_auto:!0})})}_getClickableElement(t){var n,r;const i=t?Math.min(t.length,Z$):0;for(let o=0;o<i;o+=1){const a=t[o],l=(n=a.tagName)===null||n===void 0?void 0:n.toLowerCase();if(l==="a"||l==="button")return a;if(l==="input"){const c=a;if(((r=c.type)===null||r===void 0?void 0:r.toLowerCase())==="button")return c}}}}const Cx="o11y:receiver";var rg;(function(e){e[e.Unknown=0]="Unknown",e[e.Opening=1]="Opening"})(rg||(rg={}));class tz{constructor(t,n,r){this._logCallback=t,this._metricsCallback=n,this._commErrorCallback=r,this._senders=new Map,le.requireArgument(this._logCallback,"_logCallback","function"),le.requireArgument(this._metricsCallback,"_metricsCallback","function"),le.requireArgument(this._commErrorCallback,"_commErrorCallback","function")}openComms(t){if(le.requireArgument(t,"sender","object"),!this._senders.has(t)){const n=new MessageChannel,r={state:rg.Opening,port:n.port1};this._senders.set(t,r),r.port.onmessage=this._messagePortEventHandler.bind(this),r.port.onmessageerror=this._messagePortErrorHandler.bind(this),t.postMessage({from:Cx,type:kx},"*",[n.port2])}}closeComms(t){const n=this._senders.get(t);n&&(n.port.onmessage=void 0,n.port.onmessageerror=void 0,this._senders.delete(t))}_messagePortEventHandler(t){t.data.type===Ox?this._logCallback(t.data.data):t.data.type===Nx&&this._metricsCallback(t.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const kx="handshake",Ox="log",Nx="metrics";class nz{constructor(t,n){this._self=t,this._allowedOrigins=n,this._messageEventHandlerFunc=this._messageEventHandler.bind(this),this._handshakeComplete=!1,this._logBuffer=[],this._metricsBuffer=[],le.requireArgument(this._self,"_self","object"),le.requireArgumentIfDefined(n,"allowedOrigins",Array),this._self.addEventListener("message",this._messageEventHandlerFunc)}_messageEventHandler(t){t.data.from===Cx&&t.data.type===kx&&t.ports[0]instanceof MessagePort&&le.isAllowedOrigin(t.origin,this._allowedOrigins)&&(this._handshakeComplete=!0,this._self.removeEventListener("message",this._messageEventHandlerFunc),this._otherPort=t.ports[0],this._emptyBuffers())}sendLog(t){this._handshakeComplete?this._otherPort.postMessage({type:Ox,data:t}):this._logBuffer.push(t)}sendMetrics(t){this._handshakeComplete?this._otherPort.postMessage({type:Nx,data:t}):this._metricsBuffer.push(t)}_emptyBuffers(){this._logBuffer.forEach(t=>this.sendLog(t)),this._metricsBuffer.forEach(t=>this.sendMetrics(t)),this._logBuffer=void 0,this._metricsBuffer=void 0}}class rz{constructor(){this._upCounters=[],this._valueRecorders=[],this._bucketHistograms=[]}add(t){var n,r,i;!((n=t.upCounters)===null||n===void 0)&&n.length&&this._upCounters.push(...t.upCounters.map(o=>new Km(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.createdTimestamp,o.lastUpdatedTimestamp,o.value))),!((r=t.valueRecorders)===null||r===void 0)&&r.length&&this._valueRecorders.push(...t.valueRecorders.map(o=>new vx(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.createdTimestamp,o.lastUpdatedTimestamp,o.values))),!((i=t.bucketHistograms)===null||i===void 0)&&i.length&&this._bucketHistograms.push(...t.bucketHistograms.map(o=>new _x(o.name,o.ownerName,o.ownerAppName,pi.getMetricsTags(o.tags),o.buckets,o.createdTimestamp,o.lastUpdatedTimestamp,o.values)))}getUpCounters(){return this._upCounters=this._upCounters.filter(t=>t.getLastUpdatedOn()!==void 0),this._upCounters}getValueRecorders(){return this._valueRecorders=this._valueRecorders.filter(t=>t.getLastUpdatedOn()!==void 0),this._valueRecorders}getBucketHistograms(){return this._bucketHistograms=this._bucketHistograms.filter(t=>t.getLastUpdatedOn()!==void 0),this._bucketHistograms}}const iz=1e3;class sz{constructor(t,n){this._connector=t,this._pollInterval=iz,le.requireArgument(t,"_connector","object"),le.requireArgumentIfDefined(n,"_pollInterval","number")&&n>0&&(this._pollInterval=n)}collect(t,n,r){const i={schema:t,data:n,logMeta:r};this._connector.sendLog(i)}receiveMetricsExtractors(t){this._metricsExtractors=t,this._collectAndSendMetrics(),setInterval(this._collectAndSendMetrics.bind(this),this._pollInterval)}_collectAndSendMetrics(){const t={upCounters:pi.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:pi.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:pi.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(t.upCounters.length||t.valueRecorders.length||t.bucketHistograms.length)&&this._connector.sendMetrics(t)}}const Ix=80,oz=32,Px="_CUT",az=Ix-Px.length;function od(){}class ad{get preferredRootIdLength(){return this._preferredRootIdLength}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(t){this._pagePayloadProvider=t}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(t){this._appPayloadProvider=t}constructor(t){this._idleDetector=t,this._logCollectors=new Set,this._instruments=new Map,this._seqBySchema=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[],this._logCollectionListeners=new Set,this._opMode="default",this._isSender=!1,this._isReceiver=!1,this._decimalPoints=2}registerApp(t,n){var r,i;if(le.requireArgument(t,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(t))throw new Error(`The instrumentation name ${t} is already taken`);if(Ko.setOwnerAppName(t),this._initOpMode(n==null?void 0:n.operationMode),this._isSender=this._opMode==="sender",this._isReceiver=this._opMode==="receiver",(n==null?void 0:n.decimalPoints)!==void 0&&(this._decimalPoints=n.decimalPoints),this._preferredRootIdLength=(r=n==null?void 0:n.preferredRootIdLength)!==null&&r!==void 0?r:oz,this._clientSessionId=((i=n==null?void 0:n.clientSessionId)===null||i===void 0?void 0:i.toString())||le.generateUniqueId(),this._appInstr=new J$(this,t,n==null?void 0:n.allowMultipleRootActivities),this._instruments.set(t,this._appInstr),this._isSender){const l=new sz(new nz(window,n==null?void 0:n.allowedReceiverOrigins),n==null?void 0:n.senderMetricsPollingInterval);this.registerLogCollector(l),this.registerMetricsCollector(l)}else this._isReceiver&&(this._metricsStore=new rz,this._receiverConnector=new tz(l=>{l.logMeta.receiverClientSessionId=this._clientSessionId,l.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(l.schema,l.data,l.logMeta)},l=>{this._metricsStore.add(l)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(n==null?void 0:n.enableBuffering);const a=new Oe(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),bucketValue:this._appInstr.bucketValue.bind(this._appInstr),networkInstrumentation:a.networkInstrumentation.bind(a),registerForLogPrompt:this._appInstr.registerForLogPrompt.bind(this._appInstr),activity:this._appInstr.activity.bind(this._appInstr),activityAsync:this._appInstr.activityAsync.bind(this._appInstr),invokeNetworkCallWithHeaders:this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this._isSender?od:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?od:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this),promptLogCollection:this.promptLogCollection.bind(this),getClientSessionId:this.getClientSessionId.bind(this),getOperationMode:this.getOperationMode.bind(this),startReceiving:this._isReceiver?this._receiverConnector.openComms.bind(this._receiverConnector):od,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):od}}getInstrumentation(t){le.requireArgument(t,"name","string"),t.length>Ix&&(t=t.substring(0,az)+Px);let n=this._instruments.get(t);if(!n)n=new Ou(this,t),this._instruments.set(t,n);else if(n===this._appInstr)throw new Error(`The instrumentation name ${t} is being used by the app.`);return n}get appName(){var t;return(t=this._appInstr)===null||t===void 0?void 0:t.name}getRootActivityHistoryEntryByTime(t){var n;return(n=this._appInstr)===null||n===void 0?void 0:n.getRootActivityHistoryEntry(t)}addLog(t,n,r,i,o,a){var l,c,d;rd.checkInputs(n,r),this._sequence+=1;const h=Nt.isInternal(n),p=h&&(r!=null&&r.userPayload)?r.userPayload.schema:n,g=Nt.getSchemaId(p);let m=this._seqBySchema.get(g)||0;m+=1,this._seqBySchema.set(g,m);const E={timestamp:i,rootId:o,sequence:this._sequence,schemaSequence:m,loggerName:t,pagePayload:void 0,appPayload:void 0,loggerAppName:this.appName,connectionType:le.getConnectionType(),clientSessionId:this._clientSessionId,age:le.getAge(i),tenantClass:a||void 0},S={schema:n,data:r,logMeta:E};if(E.pagePayload=rd.getPayloadFromProvider(this.pagePayloadProvider,S),E.appPayload=rd.getPayloadFromProvider(this.appPayloadProvider,S),this._isSender||(r=le.clone(r)),typeof this._decimalPoints=="number"&&(le.roundNumbersInObject(r,this._decimalPoints),h&&le.roundNumbersInObject((l=r.userPayload)===null||l===void 0?void 0:l.payload,this._decimalPoints),le.roundNumbersInObject((c=E.pagePayload)===null||c===void 0?void 0:c.payload,this._decimalPoints),le.roundNumbersInObject((d=E.appPayload)===null||d===void 0?void 0:d.payload,this._decimalPoints)),this._isBufferingEnabled){const T={schema:n,data:r,logMeta:E};this._buffer.push(T)}return this._multiplex(n,r,E),this._sequence}_multiplex(t,n,r){const i=Array.from(this._logCollectors).filter(o=>{var a;return!this._forceDisabledLogCollectors.has(o)&&!(!((a=o.getIsCollectDisabled)===null||a===void 0)&&a.call(o))});if(i.length>0)for(const o of i){let a=this._logCollectorFailures.get(o)||0;try{o.collect(t,n,r),a>0&&this._logCollectorFailures.set(o,a-1)}catch(l){a+=1,a>=ad._collectorFailureLimit?(this._forceDisabledLogCollectors.add(o),this._appInstr&&(typeof l=="string"||l instanceof Error)&&this._appInstr.error(l)):this._logCollectorFailures.set(o,a)}}}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getDefaultInstrumentationContext(){var t,n,r;return{rootId:(t=this._appInstr)===null||t===void 0?void 0:t.getSingleRootActivityId(),isRootActivitySampled:(n=this._appInstr)===null||n===void 0?void 0:n.isSingleRootActivitySampled(),isRootActivityExternalSampled:(r=this._appInstr)===null||r===void 0?void 0:r.isSingleRootActivityExternalSampled()}}activateClickTracker(){typeof document!="undefined"&&(this._autoClickTracker||(this._autoClickTracker=new ez(this._appInstr,document)),this._autoClickTracker.activate())}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(t,n){if(le.requireArgument(t,"collector"),!this._logCollectors.has(t)&&(this._logCollectors.add(t),this._logCollectorFailures.set(t,0),(!t.getIsCollectDisabled||!t.getIsCollectDisabled())&&(n!=null&&n.retroactive)))for(const r of this._buffer)t.collect(r.schema,r.data,r.logMeta)}registerMetricsCollector(t){if(le.requireArgument(t,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=t,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this._getAllUpCounters.bind(this),getAllValueRecorders:this._getAllValueRecorders.bind(this),getAllBucketHistograms:this._getAllBucketHistograms.bind(this)})}_getAllUpCounters(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getUpCounters())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getUpCounters()).flat()).concat(Ko.getUpCounters())}_getAllValueRecorders(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getValueRecorders())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getValueRecorders()).flat()).concat(Ko.getValueRecorders())}_getAllBucketHistograms(){var t;return(((t=this._metricsStore)===null||t===void 0?void 0:t.getBucketHistograms())||[]).concat(Array.from(this._instruments.values()).map(n=>n.getBucketHistograms()).flat()).concat(Ko.getBucketHistograms())}registerForLogPrompt(t){this._logCollectionListeners.add(t)}promptLogCollection(t){for(const n of this._logCollectionListeners.keys())try{n(t)}catch(r){if(!le.isProduction)throw r}}getClientSessionId(){return this._clientSessionId}_initOpMode(t){if(typeof t=="function"&&(t=t()),(t===void 0||typeof window!="object")&&(t="default"),["default","receiver","sender"].indexOf(t)>=0)this._opMode=t;else throw new Error(`Invalid operation mode: ${t}`)}getOperationMode(){return this._opMode}}ad._collectorFailureLimit=5;class uz{get _lazyNextGen(){return this._nextgen||(this._nextgen=new ad(this._idleDetector)),this._nextgen}constructor(t){this._idleDetector=t,le.requireArgument(t,"_idleDetector")}registerInstrumentedApp(t,n){const r=this._lazyNextGen.registerApp(t,n);return n&&(le.markProduction(n.isProduction),this._nextgen.appPayloadProvider=n.appPayloadProvider,this._nextgen.pagePayloadProvider=n.pagePayloadProvider),r}getInstrumentation(t){return this._lazyNextGen.getInstrumentation(t)}}const lz=le.time.bind(le),cz="sfcore.customCmp.CustomComponentLog",dz={Error:"Crimson",Activity:"CadetBlue",InstrumentedEvent:"DarkOliveGreen",O11ySample:"BlueViolet"},fz={Error:"white",Activity:"white",InstrumentedEvent:"white",O11ySample:"white"},Rx="black",Lx="Gainsboro";class hz{constructor(t){this._simpleFilters=new Set,this._regexFilters=[],t&&this._log("ConsoleCollector",t)}collect(t,n,r){const i=Nt.getSchemaId(t);if(!this._shouldLog(i))return;if(i===cz){this._logCustom(n);return}let o,a,l;Nt.isInternal(t)?(o=t.name,a=fz[t.name]||Rx,l=dz[t.name]||Lx):o=i,this._log(o,n,r,a,l)}_shouldLog(t){return this._simpleFilters.size==0&&this._regexFilters.length==0?!0:this._simpleFilters.has(t)||this._regexFilters.some(n=>n.test(t))}addFilter(t){t instanceof RegExp?this._regexFilters.push(t):this._simpleFilters.add(t)}removeFilter(t){if(t instanceof RegExp){const n=this._regexFilters.findIndex(r=>r.source===t.source);n>=0&&this._regexFilters.splice(n,1)}else this._simpleFilters.delete(t)}clearFilters(){this._simpleFilters.clear(),this._regexFilters.splice(0,this._regexFilters.length)}getFilters(){return Array.from(this._simpleFilters).concat(this._regexFilters).sort()}_log(t,n,r,i=Rx,o=Lx){const a=`color:${i};background-color:${o}`;console.log(`%cO11Y%c ${t}`,"color:white;background-color:#FF6600;font-weight:bold",a,n||"",r||"")}_logCustom(t){console.log("%clightning/logger","color:white;background-color:#00a1e0;font-weight:bold",t||"")}}const pz="260.0.0",Dx=new v$({logThreshold:300,reportListener:e=>{Zo==null||Zo.log(ZH,e)},errorListener:(e,t)=>{Zo==null||Zo.error(e,t)}}),ud=new uz(Dx),mz=ud.registerInstrumentedApp.bind(ud),Mx=ud.getInstrumentation.bind(ud),Zo=Mx("IdleDetector"),gz=Object.freeze(Object.defineProperty({__proto__:null,ConsoleCollector:hz,_version:pz,getInstrumentation:Mx,idleDetector:Dx,registerInstrumentedApp:mz,time:lz},Symbol.toStringTag,{value:"Module"})),yz="264.105.0",Ez="o11y";class ea{constructor(){this._envelope={diagnostics:{key:Ez,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:yz},bundles:[],metrics:{bucketHistograms:[],upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(t){return this._envelope.staticAttributes=t,this}withLogs(t,n){let r=this._envelope.bundles.find(i=>i.schemaName===t);if(r)for(const i of n)r.messages.push(i);else r={schemaName:t,messages:n},this._envelope.bundles.push(r);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static getUpCounters(t,n=!0){return pi.getUpCounters(t,n)}static getValueRecorders(t,n=!0){return pi.getValueRecorders(t,n)}static getBucketHistograms(t,n=!0){return pi.getBucketHistograms(t,n)}withUpCounters(t){for(const n of t)this._envelope.metrics.upCounters.push(n);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(t){for(const n of t)this._envelope.metrics.valueRecorders.push(n);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}withBucketHistograms(t){for(const n of t)this._envelope.metrics.bucketHistograms.push(n);return this._envelope.diagnostics.bucketHistogramCount=this._envelope.metrics.bucketHistograms.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=le.time().tsNow,this._envelope}static buildFrom(t){const n=new ea;return t.staticAttributes&&n.withStaticAttributes(t.staticAttributes),t.messages&&t.messages.forEach((r,i)=>{n.withLogs(Nt.getSchemaId(i),r)}),t.upCounters&&n.withUpCounters(t.upCounters),t.valueRecorders&&n.withValueRecorders(t.valueRecorders),t.bucketHistograms&&n.withBucketHistograms(t.bucketHistograms),n.build()}}var ig;(function(e){var t,n;t={1:[function(r,i,o){i.exports=function(a,l){for(var c=Array(arguments.length-1),d=0,h=2,p=!0;h<arguments.length;)c[d++]=arguments[h++];return new Promise(function(g,m){c[d]=function(E){if(p)if(p=!1,E)m(E);else{for(var S=Array(arguments.length-1),T=0;T<S.length;)S[T++]=arguments[T];g.apply(null,S)}};try{a.apply(l||null,c)}catch(E){p&&(p=!1,m(E))}})}},{}],2:[function(r,i,o){o.length=function(h){var p=h.length;if(!p)return 0;for(var g=0;1<--p%4&&(h[0|p]||"")=="=";)++g;return Math.ceil(3*h.length)/4-g};for(var a=Array(64),l=Array(123),c=0;c<64;)l[a[c]=c<26?c+65:c<52?c+71:c<62?c-4:c-59|43]=c++;o.encode=function(h,p,g){for(var m,E=null,S=[],T=0,v=0;p<g;){var w=h[p++];switch(v){case 0:S[T++]=a[w>>2],m=(3&w)<<4,v=1;break;case 1:S[T++]=a[m|w>>4],m=(15&w)<<2,v=2;break;case 2:S[T++]=a[m|w>>6],S[T++]=a[63&w],v=0}8191<T&&((E=E||[]).push(String.fromCharCode.apply(String,S)),T=0)}return v&&(S[T++]=a[m],S[T++]=61,v===1&&(S[T++]=61)),E?(T&&E.push(String.fromCharCode.apply(String,S.slice(0,T))),E.join("")):String.fromCharCode.apply(String,S.slice(0,T))};var d="invalid encoding";o.decode=function(h,p,g){for(var m,E=g,S=0,T=0;T<h.length;){var v=h.charCodeAt(T++);if(v==61&&1<S)break;if((v=l[v])===e)throw Error(d);switch(S){case 0:m=v,S=1;break;case 1:p[g++]=m<<2|(48&v)>>4,m=v,S=2;break;case 2:p[g++]=(15&m)<<4|(60&v)>>2,m=v,S=3;break;case 3:p[g++]=(3&m)<<6|v,S=0}}if(S===1)throw Error(d);return g-E},o.test=function(h){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(h)}},{}],3:[function(r,i,o){i.exports=l;var a=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function l(c,d){typeof c=="string"&&(d=c,c=e);var h=[];function p(m){if(typeof m!="string"){var E=g();if(l.verbose&&console.log("codegen: "+E),E="return "+E,m){for(var S=Object.keys(m),T=Array(S.length+1),v=Array(S.length),w=0;w<S.length;)T[w]=S[w],v[w]=m[S[w++]];return T[w]=E,Function.apply(null,T).apply(null,v)}return Function(E)()}for(var C=Array(arguments.length-1),R=0;R<C.length;)C[R]=arguments[++R];if(R=0,m=m.replace(/%([%dfijs])/g,function(k,P){var I=C[R++];switch(P){case"d":case"f":return""+ +(""+I);case"i":return""+Math.floor(I);case"j":return JSON.stringify(I);case"s":return""+I}return"%"}),R!==C.length)throw Error("parameter count mismatch");return h.push(m),p}function g(m){return"function "+(function(E){return!E||!(E=(""+E).replace(/[^\w$]/g,""))?"":(/^\d/.test(E)&&(E="_"+E),a.test(E)?E+"_":E)})(m||d)+"("+(c&&c.join(",")||"")+`){
|
|
53
53
|
`+h.join(`
|
|
54
54
|
`)+`
|
|
55
55
|
}`}return p.toString=g,p}l.verbose=!1},{}],4:[function(r,i,o){function a(){this.t={}}(i.exports=a).prototype.on=function(l,c,d){return(this.t[l]||(this.t[l]=[])).push({fn:c,ctx:d||this}),this},a.prototype.off=function(l,c){if(l===e)this.t={};else if(c===e)this.t[l]=[];else for(var d=this.t[l],h=0;h<d.length;)d[h].fn===c?d.splice(h,1):++h;return this},a.prototype.emit=function(l){var c=this.t[l];if(c){for(var d=[],h=1;h<arguments.length;)d.push(arguments[h++]);for(h=0;h<c.length;)c[h].fn.apply(c[h++].ctx,d)}return this}},{}],5:[function(r,i,o){i.exports=c;var a=r(1),l=r(7)("fs");function c(d,h,p){return h=typeof h=="function"?(p=h,{}):h||{},p?!h.xhr&&l&&l.readFile?l.readFile(d,function(g,m){return g&&typeof XMLHttpRequest!="undefined"?c.xhr(d,h,p):g?p(g):p(null,h.binary?m:m.toString("utf8"))}):c.xhr(d,h,p):a(c,this,d,h)}c.xhr=function(d,h,p){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState!==4)return e;if(g.status!==0&&g.status!==200)return p(Error("status "+g.status));if(h.binary){if(!(m=g.response))for(var m=[],E=0;E<g.responseText.length;++E)m.push(255&g.responseText.charCodeAt(E));return p(null,typeof Uint8Array!="undefined"?new Uint8Array(m):m)}return p(null,g.responseText)},h.binary&&("overrideMimeType"in g&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.responseType="arraybuffer"),g.open("GET",d),g.send()}},{1:1,7:7}],6:[function(r,i,o){function a(p){function g(q,G,Y,ce){var ne=G<0?1:0;q((G=ne?-G:G)===0?0<1/G?0:2147483648:isNaN(G)?2143289344:34028234663852886e22<G?(ne<<31|2139095040)>>>0:G<11754943508222875e-54?(ne<<31|Math.round(G/1401298464324817e-60))>>>0:(ne<<31|127+(q=Math.floor(Math.log(G)/Math.LN2))<<23|8388607&Math.round(G*Math.pow(2,-q)*8388608))>>>0,Y,ce)}function m(q,G,Y){return q=q(G,Y),G=2*(q>>31)+1,Y=q>>>23&255,q&=8388607,Y==255?q?NaN:1/0*G:Y==0?1401298464324817e-60*G*q:G*Math.pow(2,Y-150)*(8388608+q)}function E(q,G,Y){w[0]=q,G[Y]=C[0],G[Y+1]=C[1],G[Y+2]=C[2],G[Y+3]=C[3]}function S(q,G,Y){w[0]=q,G[Y]=C[3],G[Y+1]=C[2],G[Y+2]=C[1],G[Y+3]=C[0]}function T(q,G){return C[0]=q[G],C[1]=q[G+1],C[2]=q[G+2],C[3]=q[G+3],w[0]}function v(q,G){return C[3]=q[G],C[2]=q[G+1],C[1]=q[G+2],C[0]=q[G+3],w[0]}var w,C,R,k,P;function I(q,G,Y,ce,ne,J){var ae,O=ce<0?1:0;(ce=O?-ce:ce)===0?(q(0,ne,J+G),q(0<1/ce?0:2147483648,ne,J+Y)):isNaN(ce)?(q(0,ne,J+G),q(2146959360,ne,J+Y)):17976931348623157e292<ce?(q(0,ne,J+G),q((O<<31|2146435072)>>>0,ne,J+Y)):ce<22250738585072014e-324?(q((ae=ce/5e-324)>>>0,ne,J+G),q((O<<31|ae/4294967296)>>>0,ne,J+Y)):(q(4503599627370496*(ae=ce*Math.pow(2,-(ce=(ce=Math.floor(Math.log(ce)/Math.LN2))===1024?1023:ce)))>>>0,ne,J+G),q((O<<31|ce+1023<<20|1048576*ae&1048575)>>>0,ne,J+Y))}function U(q,G,Y,ce,ne){return G=q(ce,ne+G),q=q(ce,ne+Y),ce=2*(q>>31)+1,ne=q>>>20&2047,Y=4294967296*(1048575&q)+G,ne==2047?Y?NaN:1/0*ce:ne==0?5e-324*ce*Y:ce*Math.pow(2,ne-1075)*(Y+4503599627370496)}function ee(q,G,Y){R[0]=q,G[Y]=k[0],G[Y+1]=k[1],G[Y+2]=k[2],G[Y+3]=k[3],G[Y+4]=k[4],G[Y+5]=k[5],G[Y+6]=k[6],G[Y+7]=k[7]}function $(q,G,Y){R[0]=q,G[Y]=k[7],G[Y+1]=k[6],G[Y+2]=k[5],G[Y+3]=k[4],G[Y+4]=k[3],G[Y+5]=k[2],G[Y+6]=k[1],G[Y+7]=k[0]}function te(q,G){return k[0]=q[G],k[1]=q[G+1],k[2]=q[G+2],k[3]=q[G+3],k[4]=q[G+4],k[5]=q[G+5],k[6]=q[G+6],k[7]=q[G+7],R[0]}function Q(q,G){return k[7]=q[G],k[6]=q[G+1],k[5]=q[G+2],k[4]=q[G+3],k[3]=q[G+4],k[2]=q[G+5],k[1]=q[G+6],k[0]=q[G+7],R[0]}return typeof Float32Array!="undefined"?(w=new Float32Array([-0]),C=new Uint8Array(w.buffer),P=C[3]===128,p.writeFloatLE=P?E:S,p.writeFloatBE=P?S:E,p.readFloatLE=P?T:v,p.readFloatBE=P?v:T):(p.writeFloatLE=g.bind(null,l),p.writeFloatBE=g.bind(null,c),p.readFloatLE=m.bind(null,d),p.readFloatBE=m.bind(null,h)),typeof Float64Array!="undefined"?(R=new Float64Array([-0]),k=new Uint8Array(R.buffer),P=k[7]===128,p.writeDoubleLE=P?ee:$,p.writeDoubleBE=P?$:ee,p.readDoubleLE=P?te:Q,p.readDoubleBE=P?Q:te):(p.writeDoubleLE=I.bind(null,l,0,4),p.writeDoubleBE=I.bind(null,c,4,0),p.readDoubleLE=U.bind(null,d,0,4),p.readDoubleBE=U.bind(null,h,4,0)),p}function l(p,g,m){g[m]=255&p,g[m+1]=p>>>8&255,g[m+2]=p>>>16&255,g[m+3]=p>>>24}function c(p,g,m){g[m]=p>>>24,g[m+1]=p>>>16&255,g[m+2]=p>>>8&255,g[m+3]=255&p}function d(p,g){return(p[g]|p[g+1]<<8|p[g+2]<<16|p[g+3]<<24)>>>0}function h(p,g){return(p[g]<<24|p[g+1]<<16|p[g+2]<<8|p[g+3])>>>0}i.exports=a(a)},{}],7:[function(r,i,o){i.exports=function(a){try{var l;return typeof r!="function"?null:(l=r(a))&&(l.length||Object.keys(l).length)?l:null}catch(c){return null}}},{}],8:[function(r,i,o){var a=o.isAbsolute=function(c){return/^(?:\/|\w+:)/.test(c)},l=o.normalize=function(p){var d=(p=p.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),h=a(p),p="";h&&(p=d.shift()+"/");for(var g=0;g<d.length;)d[g]===".."?0<g&&d[g-1]!==".."?d.splice(--g,2):h?d.splice(g,1):++g:d[g]==="."?d.splice(g,1):++g;return p+d.join("/")};o.resolve=function(c,d,h){return h||(d=l(d)),!a(d)&&(c=(c=h?c:l(c)).replace(/(?:\/|^)[^/]+$/,"")).length?l(c+"/"+d):d}},{}],9:[function(r,i,o){i.exports=function(a,l,c){var d=c||8192,h=d>>>1,p=null,g=d;return function(m){return m<1||h<m?a(m):(d<g+m&&(p=a(d),g=0),m=l.call(p,g,g+=m),7&g&&(g=1+(7|g)),m)}}},{}],10:[function(r,i,o){o.length=function(a){for(var l,c=0,d=0;d<a.length;++d)(l=a.charCodeAt(d))<128?c+=1:l<2048?c+=2:(64512&l)==55296&&(64512&a.charCodeAt(d+1))==56320?(++d,c+=4):c+=3;return c},o.read=function(a,l,c){if(c-l<1)return"";for(var d="",h=l;h<c;){var p,g=a[h++];g<=127?d+=String.fromCharCode(g):192<=g&&g<224?d+=128<=(p=(31&g)<<6|63&a[h++])?String.fromCharCode(p):"�":224<=g&&g<240?d+=2048<=(p=(15&g)<<12|(63&a[h++])<<6|63&a[h++])?String.fromCharCode(p):"�":240<=g&&((g=(7&g)<<18|(63&a[h++])<<12|(63&a[h++])<<6|63&a[h++])<65536||1114111<g?d+="�":d=d+String.fromCharCode(55296+((g-=65536)>>10))+String.fromCharCode(56320+(1023&g)))}return d},o.write=function(a,l,c){for(var d,h,p=c,g=0;g<a.length;++g)(d=a.charCodeAt(g))<128?l[c++]=d:(d<2048?l[c++]=d>>6|192:((64512&d)==55296&&(64512&(h=a.charCodeAt(g+1)))==56320?(++g,l[c++]=(d=65536+((1023&d)<<10)+(1023&h))>>18|240,l[c++]=d>>12&63|128):l[c++]=d>>12|224,l[c++]=d>>6&63|128),l[c++]=63&d|128);return c-p}},{}],11:[function(r,i,o){var a=r(14),l=r(33);function c(h,p,g,m){var E=!1;if(p.resolvedType)if(p.resolvedType instanceof a){h("switch(d%s){",m);for(var S=p.resolvedType.values,T=Object.keys(S),v=0;v<T.length;++v)S[T[v]]!==p.typeDefault||E||(h("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',m,m,m),p.repeated||h("break"),E=!0),h("case%j:",T[v])("case %i:",S[T[v]])("m%s=%j",m,S[T[v]])("break");h("}")}else h('if(typeof d%s!=="object")',m)("throw TypeError(%j)",p.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",m,g,m);else{var w=!1;switch(p.type){case"double":case"float":h("m%s=Number(d%s)",m,m);break;case"uint32":case"fixed32":h("m%s=d%s>>>0",m,m);break;case"int32":case"sint32":case"sfixed32":h("m%s=d%s|0",m,m);break;case"uint64":w=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":h("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",m,m,w)('else if(typeof d%s==="string")',m)("m%s=parseInt(d%s,10)",m,m)('else if(typeof d%s==="number")',m)("m%s=d%s",m,m)('else if(typeof d%s==="object")',m)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",m,m,m,w?"true":"");break;case"bytes":h('if(typeof d%s==="string")',m)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",m,m,m)("else if(d%s.length >= 0)",m)("m%s=d%s",m,m);break;case"string":h("m%s=String(d%s)",m,m);break;case"bool":h("m%s=Boolean(d%s)",m,m)}}return h}function d(h,p,g,m){if(p.resolvedType)p.resolvedType instanceof a?h("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",m,g,m,m,g,m,m):h("d%s=types[%i].toObject(m%s,o)",m,g,m);else{var E=!1;switch(p.type){case"double":case"float":h("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",m,m,m,m);break;case"uint64":E=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":h('if(typeof m%s==="number")',m)("d%s=o.longs===String?String(m%s):m%s",m,m,m)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",m,m,m,m,E?"true":"",m);break;case"bytes":h("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",m,m,m,m,m);break;default:h("d%s=m%s",m,m)}}return h}o.fromObject=function(h){var p=h.fieldsArray,g=l.codegen(["d","n"],h.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!p.length)return g("return new this.ctor");g("var m=new this.ctor");for(var m=0;m<p.length;++m){var E=p[m].resolve(),S=l.safeProp(E.name);E.map?(g("if(d%s){",S)('if(typeof d%s!=="object")',S)("throw TypeError(%j)",E.fullName+": object expected")("m%s={}",S)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",S),g('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",S),c(g,E,m,S+"[ks[i]]")("}")("}")):E.repeated?(g("if(d%s){",S)("if(!Array.isArray(d%s))",S)("throw TypeError(%j)",E.fullName+": array expected")("m%s=[]",S)("for(var i=0;i<d%s.length;++i){",S),c(g,E,m,S+"[i]")("}")("}")):(E.resolvedType instanceof a||g("if(d%s!=null){",S),c(g,E,m,S),E.resolvedType instanceof a||g("}"))}return g("return m")},o.toObject=function(h){var p=h.fieldsArray.slice().sort(l.compareFieldsById);if(!p.length)return l.codegen()("return {}");for(var g=l.codegen(["m","o"],h.name+"$toObject")("if(!o)")("o={}")("var d={}"),m=[],E=[],S=[],T=0;T<p.length;++T)p[T].partOf||(p[T].resolve().repeated?m:p[T].map?E:S).push(p[T]);if(m.length){for(g("if(o.arrays||o.defaults){"),T=0;T<m.length;++T)g("d%s=[]",l.safeProp(m[T].name));g("}")}if(E.length){for(g("if(o.objects||o.defaults){"),T=0;T<E.length;++T)g("d%s={}",l.safeProp(E[T].name));g("}")}if(S.length){for(g("if(o.defaults){"),T=0;T<S.length;++T){var v,w=S[T],C=l.safeProp(w.name);w.resolvedType instanceof a?g("d%s=o.enums===String?%j:%j",C,w.resolvedType.valuesById[w.typeDefault],w.typeDefault):w.long?g("if(util.Long){")("var n=new util.Long(%i,%i,%j)",w.typeDefault.low,w.typeDefault.high,w.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",C)("}else")("d%s=o.longs===String?%j:%i",C,w.typeDefault.toString(),w.typeDefault.toNumber()):w.bytes?(v=Array.prototype.slice.call(w.typeDefault),g("if(o.bytes===String)d%s=%j",C,String.fromCharCode.apply(String,w.typeDefault))("else{")("d%s=%j",C,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",C,C)("}")):g("d%s=%j",C,w.typeDefault)}g("}")}for(var R=!1,T=0;T<p.length;++T){var w=p[T],k=h.i.indexOf(w),C=l.safeProp(w.name);w.map?(R||(R=!0,g("var ks2")),g("if(m%s&&(ks2=Object.keys(m%s)).length){",C,C)("d%s={}",C)("for(var j=0;j<ks2.length;++j){"),g('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",C),d(g,w,k,C+"[ks2[j]]")("}")):w.repeated?(g("if(m%s&&m%s.length){",C,C)("d%s=[]",C)("for(var j=0;j<m%s.length;++j){",C),d(g,w,k,C+"[j]")("}")):(g("if(m%s!=null&&m.hasOwnProperty(%j)){",C,w.name),d(g,w,k,C),w.partOf&&g("if(o.oneofs)")("d%s=%j",l.safeProp(w.partOf.name),w.name)),g("}")}return g("return d")}},{14:14,33:33}],12:[function(r,i,o){i.exports=function(d){for(var h=c.codegen(["r","l","e","n"],d.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(d.fieldsArray.filter(function(T){return T.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),p=0;p<d.fieldsArray.length;++p){var g=d.i[p].resolve(),m=g.resolvedType instanceof a?"int32":g.type,E="m"+c.safeProp(g.name);h("case %i: {",g.id),g.map?(h("if(%s===util.emptyObject)",E)("%s={}",E)("var c2 = r.uint32()+r.pos"),l.defaults[g.keyType]!==e?h("k=%j",l.defaults[g.keyType]):h("k=null"),l.defaults[m]!==e?h("value=%j",l.defaults[m]):h("value=null"),h("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",g.keyType)("case 2:"),l.basic[m]===e?h("value=types[%i].decode(r,r.uint32(),undefined,n+1)",p):h("value=r.%s()",m),h("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),l.long[g.keyType]!==e?h('%s[typeof k==="object"?util.longToHash(k):k]=value',E):(g.keyType==="string"&&h('if(k==="__proto__")')("util.makeProp(%s,k)",E),h("%s[k]=value",E))):g.repeated?(h("if(!(%s&&%s.length))",E,E)("%s=[]",E),l.packed[m]!==e&&h("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",E,m)("}else"),l.basic[m]===e?h(g.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",E,p):h("%s.push(r.%s())",E,m)):l.basic[m]===e?h(g.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",E,p):h("%s=r.%s()",E,m),h("break")("}")}for(h("default:")("r.skipType(t&7,n)")("break")("}")("}"),p=0;p<d.i.length;++p){var S=d.i[p];S.required&&h("if(!m.hasOwnProperty(%j))",S.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+S.name+"'")}return h("return m")};var a=r(14),l=r(32),c=r(33)},{14:14,32:32,33:33}],13:[function(r,i,o){i.exports=function(h){for(var p,g=c.codegen(["m","w"],h.name+"$encode")("if(!w)")("w=Writer.create()"),m=h.fieldsArray.slice().sort(c.compareFieldsById),E=0;E<m.length;++E){var S=m[E].resolve(),T=h.i.indexOf(S),v=S.resolvedType instanceof a?"int32":S.type,w=l.basic[v];p="m"+c.safeProp(S.name),S.map?(g("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",p,S.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",p)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(S.id<<3|2)>>>0,8|l.mapKey[S.keyType],S.keyType),w===e?g("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",T,p):g(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|w,v,p),g("}")("}")):S.repeated?(g("if(%s!=null&&%s.length){",p,p),S.packed&&l.packed[v]!==e?g("w.uint32(%i).fork()",(S.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",p)("w.%s(%s[i])",v,p)("w.ldelim()"):(g("for(var i=0;i<%s.length;++i)",p),w===e?d(g,S,T,p+"[i]"):g("w.uint32(%i).%s(%s[i])",(S.id<<3|w)>>>0,v,p)),g("}")):(S.optional&&g("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",p,S.name),w===e?d(g,S,T,p):g("w.uint32(%i).%s(%s)",(S.id<<3|w)>>>0,v,p))}return g("return w")};var a=r(14),l=r(32),c=r(33);function d(h,p,g,m){p.delimited?h("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",g,m,(p.id<<3|3)>>>0,(p.id<<3|4)>>>0):h("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",g,m,(p.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(r,i,o){i.exports=d;var a=r(22),l=(((d.prototype=Object.create(a.prototype)).constructor=d).className="Enum",r(21)),c=r(33);function d(h,p,g,m,E,S){if(a.call(this,h,g),p&&typeof p!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=m,this.comments=E||{},this.valuesOptions=S,this.n={},this.reserved=e,p)for(var T=Object.keys(p),v=0;v<T.length;++v)T[v]!=="__proto__"&&typeof p[T[v]]=="number"&&(this.valuesById[this.values[T[v]]=p[T[v]]]=T[v])}d.prototype.r=function(h){return h=this.e||h,a.prototype.r.call(this,h),Object.keys(this.values).forEach(p=>{var g=Object.assign({},this.o);this.n[p]=Object.assign(g,this.valuesOptions&&this.valuesOptions[p]&&this.valuesOptions[p].features)}),this},d.fromJSON=function(h,p){return h=new d(h,p.values,p.options,p.comment,p.comments),h.reserved=p.reserved,p.edition&&(h.e=p.edition),h.u="proto3",h},d.prototype.toJSON=function(h){return h=!!h&&!!h.keepComments,c.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"comment",h?this.comment:e,"comments",h?this.comments:e])},d.prototype.add=function(h,p,g,m){if(!c.isString(h))throw TypeError("name must be a string");if(!c.isInteger(p))throw TypeError("id must be an integer");if(h!=="__proto__"){if(this.values[h]!==e)throw Error("duplicate name '"+h+"' in "+this);if(this.isReservedId(p))throw Error("id "+p+" is reserved in "+this);if(this.isReservedName(h))throw Error("name '"+h+"' is reserved in "+this);if(this.valuesById[p]!==e){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+p+" in "+this);this.values[h]=p}else this.valuesById[this.values[h]=p]=h;m&&(this.valuesOptions===e&&(this.valuesOptions={}),this.valuesOptions[h]=m||null),this.comments[h]=g||null}return this},d.prototype.remove=function(h){if(!c.isString(h))throw TypeError("name must be a string");var p=this.values[h];if(p==null)throw Error("name '"+h+"' does not exist in "+this);return delete this.valuesById[p],delete this.values[h],delete this.comments[h],this.valuesOptions&&delete this.valuesOptions[h],this},d.prototype.isReservedId=function(h){return l.isReservedId(this.reserved,h)},d.prototype.isReservedName=function(h){return l.isReservedName(this.reserved,h)}},{21:21,22:22,33:33}],15:[function(r,i,o){i.exports=g;var a,l=r(22),c=(((g.prototype=Object.create(l.prototype)).constructor=g).className="Field",r(14)),d=r(32),h=r(33),p=/^required|optional|repeated$/;function g(m,E,S,T,v,w,C){if(h.isObject(T)?(C=v,w=T,T=v=e):h.isObject(v)&&(C=w,w=v,v=e),l.call(this,m,w),!h.isInteger(E)||E<0)throw TypeError("id must be a non-negative integer");if(!h.isString(S))throw TypeError("type must be a string");if(T!==e&&!p.test(T=T.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(v!==e&&!h.isString(v))throw TypeError("extend must be a string");this.rule=(T=T==="proto3_optional"?"optional":T)&&T!=="optional"?T:e,this.type=S,this.id=E,this.extend=v||e,this.repeated=T==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!h.Long&&d.long[S]!==e,this.bytes=S==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=C}g.fromJSON=function(m,E){return m=new g(m,E.id,E.type,E.rule,E.extend,E.options,E.comment),E.edition&&(m.e=E.edition),m.u="proto3",m},Object.defineProperty(g.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(g.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(g.prototype,"delimited",{get:function(){return this.resolvedType instanceof a&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(g.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(g.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),g.prototype.setOption=function(m,E,S){return l.prototype.setOption.call(this,m,E,S)},g.prototype.toJSON=function(m){return m=!!m&&!!m.keepComments,h.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||e,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",m?this.comment:e])},g.prototype.resolve=function(){var m;return this.resolved?this:((this.typeDefault=d.defaults[this.type])===e?(this.resolvedType=(this.declaringField||this).parent.lookupTypeOrEnum(this.type),this.resolvedType instanceof a?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof c&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===e||!this.resolvedType||this.resolvedType instanceof c||delete this.options.packed,Object.keys(this.options).length||(this.options=e)),this.long?(this.typeDefault=h.Long.fromNumber(this.typeDefault,(this.type[0]||"")=="u"),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&typeof this.typeDefault=="string"&&(h.base64.test(this.typeDefault)?h.base64.decode(this.typeDefault,m=h.newBuffer(h.base64.length(this.typeDefault)),0):h.utf8.write(this.typeDefault,m=h.newBuffer(h.utf8.length(this.typeDefault)),0),this.typeDefault=m),this.map?this.defaultValue=h.emptyObject:this.repeated?this.defaultValue=h.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof a&&(this.parent.ctor.prototype[this.name]=this.defaultValue),l.prototype.resolve.call(this))},g.prototype.f=function(m){var E;return m!=="proto2"&&m!=="proto3"?{}:(m={},this.rule==="required"&&(m.field_presence="LEGACY_REQUIRED"),this.parent&&d.defaults[this.type]===e&&(E=this.parent.get(this.type.split(".").pop()))&&E instanceof a&&E.group&&(m.message_encoding="DELIMITED"),this.getOption("packed")===!0?m.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(m.repeated_field_encoding="EXPANDED"),m)},g.prototype.r=function(m){return l.prototype.r.call(this,this.e||m)},g.d=function(m,E,S,T){return typeof E=="function"?E=h.decorateType(E).name:E&&typeof E=="object"&&(E=h.decorateEnum(E).name),function(v,w){h.decorateType(v.constructor).add(new g(w,m,E,S,{default:T}))}},g.c=function(m){a=m}},{14:14,22:22,32:32,33:33}],16:[function(r,i,o){var a=i.exports=r(17);a.build="light",a.load=function(l,c,d){return(c=typeof c=="function"?(d=c,new a.Root):c||new a.Root).load(l,d)},a.loadSync=function(l,c){return(c=c||new a.Root).loadSync(l)},a.encoder=r(13),a.decoder=r(12),a.verifier=r(37),a.converter=r(11),a.ReflectionObject=r(22),a.Namespace=r(21),a.Root=r(26),a.Enum=r(14),a.Type=r(31),a.Field=r(15),a.OneOf=r(23),a.MapField=r(18),a.Service=r(30),a.Method=r(20),a.Message=r(19),a.wrappers=r(38),a.types=r(32),a.util=r(33),a.ReflectionObject.c(a.Root),a.Namespace.c(a.Type,a.Service,a.Enum),a.Root.c(a.Type),a.Field.c(a.Type)},{11:11,12:12,13:13,14:14,15:15,17:17,18:18,19:19,20:20,21:21,22:22,23:23,26:26,30:30,31:31,32:32,33:33,37:37,38:38}],17:[function(r,i,o){var a=o;function l(){a.util.c(),a.Writer.c(a.BufferWriter),a.Reader.c(a.BufferReader)}a.build="minimal",a.Writer=r(39),a.BufferWriter=r(40),a.Reader=r(24),a.BufferReader=r(25),a.util=r(35),a.rpc=r(28),a.roots=r(27),a.configure=l,l()},{24:24,25:25,27:27,28:28,35:35,39:39,40:40}],18:[function(r,i,o){i.exports=d;var a=r(15),l=(((d.prototype=Object.create(a.prototype)).constructor=d).className="MapField",r(32)),c=r(33);function d(h,p,g,m,E,S){if(a.call(this,h,p,m,e,e,E,S),!c.isString(g))throw TypeError("keyType must be a string");this.keyType=g,this.resolvedKeyType=null,this.map=!0}d.fromJSON=function(h,p){return new d(h,p.id,p.keyType,p.type,p.options,p.comment)},d.prototype.toJSON=function(h){return h=!!h&&!!h.keepComments,c.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",h?this.comment:e])},d.prototype.resolve=function(){if(this.resolved)return this;if(l.mapKey[this.keyType]===e)throw Error("invalid key type: "+this.keyType);return a.prototype.resolve.call(this)},d.d=function(h,p,g){return typeof g=="function"?g=c.decorateType(g).name:g&&typeof g=="object"&&(g=c.decorateEnum(g).name),function(m,E){c.decorateType(m.constructor).add(new d(E,h,p,g))}}},{15:15,32:32,33:33}],19:[function(r,i,o){i.exports=l;var a=r(35);function l(c){if(c)for(var d=Object.keys(c),h=0;h<d.length;++h){var p=d[h];p!=="__proto__"&&(this[p]=c[p])}}l.create=function(c){return this.$type.create(c)},l.encode=function(c,d){return this.$type.encode(c,d)},l.encodeDelimited=function(c,d){return this.$type.encodeDelimited(c,d)},l.decode=function(c){return this.$type.decode(c)},l.decodeDelimited=function(c){return this.$type.decodeDelimited(c)},l.verify=function(c){return this.$type.verify(c)},l.fromObject=function(c){return this.$type.fromObject(c)},l.toObject=function(c,d){return this.$type.toObject(c,d)},l.prototype.toJSON=function(){return this.$type.toObject(this,a.toJSONOptions)}},{35:35}],20:[function(r,i,o){i.exports=c;var a=r(22),l=(((c.prototype=Object.create(a.prototype)).constructor=c).className="Method",r(33));function c(d,h,p,g,m,E,S,T,v){if(l.isObject(m)?(S=m,m=E=e):l.isObject(E)&&(S=E,E=e),h!==e&&!l.isString(h))throw TypeError("type must be a string");if(!l.isString(p))throw TypeError("requestType must be a string");if(!l.isString(g))throw TypeError("responseType must be a string");a.call(this,d,S),this.type=h||"rpc",this.requestType=p,this.requestStream=!!m||e,this.responseType=g,this.responseStream=!!E||e,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=T,this.parsedOptions=v}c.fromJSON=function(d,h){return new c(d,h.type,h.requestType,h.responseType,h.requestStream,h.responseStream,h.options,h.comment,h.parsedOptions)},c.prototype.toJSON=function(d){return d=!!d&&!!d.keepComments,l.toObject(["type",this.type!=="rpc"&&this.type||e,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",d?this.comment:e,"parsedOptions",this.parsedOptions])},c.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),a.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(r,i,o){i.exports=E;var a,l,c,d=r(22),h=(((E.prototype=Object.create(d.prototype)).constructor=E).className="Namespace",r(15)),p=r(33),g=r(23);function m(T,v){if(!T||!T.length)return e;for(var w={},C=0;C<T.length;++C)w[T[C].name]=T[C].toJSON(v);return w}function E(T,v){d.call(this,T,v),this.nested=e,this.a=null,this.l=Object.create(null),this.p=!0,this.b=!0}function S(T){T.a=null,T.l=Object.create(null);for(var v=T;v=v.parent;)v.l=Object.create(null);return T}E.fromJSON=function(T,v){return new E(T,v.options).addJSON(v.nested)},E.arrayToJSON=m,E.isReservedId=function(T,v){if(T){for(var w=0;w<T.length;++w)if(typeof T[w]!="string"&&T[w][0]<=v&&T[w][1]>v)return!0}return!1},E.isReservedName=function(T,v){if(T){for(var w=0;w<T.length;++w)if(T[w]===v)return!0}return!1},Object.defineProperty(E.prototype,"nestedArray",{get:function(){return this.a||(this.a=p.toArray(this.nested))}}),E.prototype.toJSON=function(T){return p.toObject(["options",this.options,"nested",m(this.nestedArray,T)])},E.prototype.addJSON=function(T){if(T)for(var v,w=Object.keys(T),C=0;C<w.length;++C)v=T[w[C]],this.add((v.fields!==e?a:v.values!==e?c:v.methods!==e?l:v.id!==e?h:E).fromJSON(w[C],v));return this},E.prototype.get=function(T){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,T)?this.nested[T]:null},E.prototype.getEnum=function(T){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,T)&&this.nested[T]instanceof c)return this.nested[T].values;throw Error("no such enum: "+T)},E.prototype.add=function(T){if(!(T instanceof h&&T.extend!==e||T instanceof a||T instanceof g||T instanceof c||T instanceof l||T instanceof E))throw TypeError("object must be a valid nested object");if(T.name==="__proto__")return this;if(this.nested){var v=this.get(T.name);if(v){if(!(v instanceof E&&T instanceof E)||v instanceof a||v instanceof l)throw Error("duplicate name '"+T.name+"' in "+this);for(var w=v.nestedArray,C=0;C<w.length;++C)T.add(w[C]);this.remove(v),this.nested||(this.nested={}),T.setOptions(v.options,!0)}}else this.nested={};this.nested[T.name]=T,this instanceof a||this instanceof l||this instanceof c||this instanceof h||T.e||(T.e=T.u),this.p=!0,this.b=!0;for(var R=this;R=R.parent;)R.p=!0,R.b=!0;return T.onAdd(this),S(this)},E.prototype.remove=function(T){if(!(T instanceof d))throw TypeError("object must be a ReflectionObject");if(T.parent!==this)throw Error(T+" is not a member of "+this);return delete this.nested[T.name],Object.keys(this.nested).length||(this.nested=e),T.onRemove(this),S(this)},E.prototype.define=function(T,v){if(p.isString(T))T=T.split(".");else if(!Array.isArray(T))throw TypeError("illegal path");if(T&&T.length&&T[0]==="")throw Error("path must be relative");for(var w=this;0<T.length;){var C=T.shift();if(w.nested&&w.nested[C]){if(!((w=w.nested[C])instanceof E))throw Error("path conflicts with non-namespace objects")}else w.add(w=new E(C))}return v&&w.addJSON(v),w},E.prototype.resolveAll=function(){if(this.b){this.v(this.e);var T=this.nestedArray,v=0;for(this.resolve();v<T.length;)T[v]instanceof E?T[v++].resolveAll():T[v++].resolve();this.b=!1}return this},E.prototype.v=function(T){return this.p&&(this.p=!1,T=this.e||T,d.prototype.v.call(this,T),this.nestedArray.forEach(v=>{v.v(T)})),this},E.prototype.lookup=function(T,v,w){if(typeof v=="boolean"?(w=v,v=e):v&&!Array.isArray(v)&&(v=[v]),p.isString(T)&&T.length){if(T===".")return this.root;T=T.split(".")}else if(!T.length)return this;var C=T.join(".");if(T[0]==="")return this.root.lookup(T.slice(1),v);var R=this.root.y&&this.root.y["."+C];if(R&&(!v||~v.indexOf(R.constructor))||(R=this.w(T,C))&&(!v||~v.indexOf(R.constructor)))return R;if(!w)for(var k=this;k.parent;){if((R=k.parent.w(T,C))&&(!v||~v.indexOf(R.constructor)))return R;k=k.parent}return null},E.prototype.w=function(T,v){if(Object.prototype.hasOwnProperty.call(this.l,v))return this.l[v];var w=this.get(T[0]),C=null;if(w)T.length===1?C=w:w instanceof E&&(T=T.slice(1),C=w.w(T,T.join(".")));else for(var R=0;R<this.nestedArray.length;++R)this.a[R]instanceof E&&(w=this.a[R].w(T,v))&&(C=w);return this.l[v]=C},E.prototype.lookupType=function(T){var v=this.lookup(T,[a]);if(v)return v;throw Error("no such type: "+T)},E.prototype.lookupEnum=function(T){var v=this.lookup(T,[c]);if(v)return v;throw Error("no such Enum '"+T+"' in "+this)},E.prototype.lookupTypeOrEnum=function(T){var v=this.lookup(T,[a,c]);if(v)return v;throw Error("no such Type or Enum '"+T+"' in "+this)},E.prototype.lookupService=function(T){var v=this.lookup(T,[l]);if(v)return v;throw Error("no such Service '"+T+"' in "+this)},E.c=function(T,v,w){a=T,l=v,c=w}},{15:15,22:22,23:23,33:33}],22:[function(r,i,o){(i.exports=g).className="ReflectionObject";const a=r(23);var l,c=r(33),d={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},h={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},p={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function g(m,E){if(!c.isString(m))throw TypeError("name must be a string");if(E&&!c.isObject(E))throw TypeError("options must be an object");this.options=E,this.parsedOptions=null,this.name=m,this.e=null,this.u="proto2",this.o={},this.g=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(g.prototype,{root:{get:function(){for(var m=this;m.parent!==null;)m=m.parent;return m}},fullName:{get:function(){for(var m=[this.name],E=this.parent;E;)m.unshift(E.name),E=E.parent;return m.join(".")}}}),g.prototype.toJSON=function(){throw Error()},g.prototype.onAdd=function(m){this.parent&&this.parent!==m&&this.parent.remove(this),this.parent=m,this.resolved=!1,m=m.root,m instanceof l&&m.j(this)},g.prototype.onRemove=function(m){m=m.root,m instanceof l&&m.O(this),this.parent=null,this.resolved=!1},g.prototype.resolve=function(){return this.resolved||this.root instanceof l&&(this.resolved=!0),this},g.prototype.v=function(m){return this.r(this.e||m)},g.prototype.r=function(m){if(!this.g){var E={};if(!m)throw Error("Unknown edition for "+this.fullName);var S=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(m));if(this.e){if(m==="proto2")E=Object.assign({},h);else if(m==="proto3")E=Object.assign({},p);else{if(m!=="2023")throw Error("Unknown edition: "+m);E=Object.assign({},d)}this.o=Object.assign(E,S||{})}else{if(this.partOf instanceof a)m=Object.assign({},this.partOf.o),this.o=Object.assign(m,S||{});else if(!this.declaringField){if(!this.parent)throw Error("Unable to find a parent for "+this.fullName);E=Object.assign({},this.parent.o),this.o=Object.assign(E,S||{})}this.extensionField&&(this.extensionField.o=this.o)}this.g=!0}},g.prototype.f=function(){return{}},g.prototype.getOption=function(m){return this.options?this.options[m]:e},g.prototype.setOption=function(m,E,S){return m!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(m)?c.setProperty(this.options,m,E,S):S&&this.options[m]!==e||(this.getOption(m)!==E&&(this.resolved=!1),this.options[m]=E)),this},g.prototype.setParsedOption=function(m,E,S){var T,v,w;return m!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),T=this.parsedOptions,S?(v=T.find(function(C){return Object.prototype.hasOwnProperty.call(C,m)}))?(w=v[m],c.setProperty(w,S,E)):((v={})[m]=c.setProperty({},S,E),T.push(v)):((w={})[m]=E,T.push(w))),this},g.prototype.setOptions=function(m,E){if(m)for(var S=Object.keys(m),T=0;T<S.length;++T)this.setOption(S[T],m[S[T]],E);return this},g.prototype.toString=function(){var m=this.constructor.className,E=this.fullName;return E.length?m+" "+E:m},g.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:e},g.c=function(m){l=m}},{23:23,33:33}],23:[function(r,i,o){i.exports=d;var a=r(22),l=(((d.prototype=Object.create(a.prototype)).constructor=d).className="OneOf",r(15)),c=r(33);function d(p,g,m,E){if(Array.isArray(g)||(m=g,g=e),a.call(this,p,m),g!==e&&!Array.isArray(g))throw TypeError("fieldNames must be an Array");this.oneof=g||[],this.fieldsArray=[],this.comment=E}function h(p){if(p.parent)for(var g=0;g<p.fieldsArray.length;++g)p.fieldsArray[g].parent||p.parent.add(p.fieldsArray[g])}d.fromJSON=function(p,g){return new d(p,g.oneof,g.options,g.comment)},d.prototype.toJSON=function(p){return p=!!p&&!!p.keepComments,c.toObject(["options",this.options,"oneof",this.oneof,"comment",p?this.comment:e])},d.prototype.add=function(p){if(p instanceof l)return p.parent&&p.parent!==this.parent&&p.parent.remove(p),this.oneof.push(p.name),this.fieldsArray.push(p),h(p.partOf=this),this;throw TypeError("field must be a Field")},d.prototype.remove=function(p){if(!(p instanceof l))throw TypeError("field must be a Field");var g=this.fieldsArray.indexOf(p);if(g<0)throw Error(p+" is not a member of "+this);return this.fieldsArray.splice(g,1),-1<(g=this.oneof.indexOf(p.name))&&this.oneof.splice(g,1),p.partOf=null,this},d.prototype.onAdd=function(p){a.prototype.onAdd.call(this,p);for(var g=0;g<this.oneof.length;++g){var m=p.get(this.oneof[g]);m&&!m.partOf&&(m.partOf=this).fieldsArray.push(m)}h(this)},d.prototype.onRemove=function(p){for(var g,m=0;m<this.fieldsArray.length;++m)(g=this.fieldsArray[m]).parent&&g.parent.remove(g);a.prototype.onRemove.call(this,p)},Object.defineProperty(d.prototype,"isProto3Optional",{get:function(){var p;return this.fieldsArray!=null&&this.fieldsArray.length===1&&(p=this.fieldsArray[0]).options!=null&&p.options.proto3_optional===!0}}),d.d=function(){for(var p=Array(arguments.length),g=0;g<arguments.length;)p[g]=arguments[g++];return function(m,E){c.decorateType(m.constructor).add(new d(E,p)),Object.defineProperty(m,E,{get:c.oneOfGetter(p),set:c.oneOfSetter(p)})}}},{15:15,22:22,33:33}],24:[function(r,i,o){i.exports=p;var a,l=r(35),c=l.LongBits,d=l.utf8;function h(w,C){return RangeError("index out of range: "+w.pos+" + "+(C||1)+" > "+w.len)}function p(w){this.buf=w,this.pos=0,this.len=w.length}function g(){return l.Buffer?function(w){return(p.create=function(C){return l.Buffer.isBuffer(C)?new a(C):E(C)})(w)}:E}var m,E=typeof Uint8Array!="undefined"?function(w){if(w instanceof Uint8Array||Array.isArray(w))return new p(w);throw Error("illegal buffer")}:function(w){if(Array.isArray(w))return new p(w);throw Error("illegal buffer")};function S(){var w=new c(0,0),C=0;if(!(4<this.len-this.pos)){for(;C<3;++C){if(this.pos>=this.len)throw h(this);if(w.lo=(w.lo|(127&this.buf[this.pos])<<7*C)>>>0,this.buf[this.pos++]<128)return w}return w.lo=(w.lo|(127&this.buf[this.pos++])<<7*C)>>>0,w}for(;C<4;++C)if(w.lo=(w.lo|(127&this.buf[this.pos])<<7*C)>>>0,this.buf[this.pos++]<128)return w;if(w.lo=(w.lo|(127&this.buf[this.pos])<<28)>>>0,w.hi=(w.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return w;if(C=0,4<this.len-this.pos){for(;C<5;++C)if(w.hi=(w.hi|(127&this.buf[this.pos])<<7*C+3)>>>0,this.buf[this.pos++]<128)return w}else for(;C<5;++C){if(this.pos>=this.len)throw h(this);if(w.hi=(w.hi|(127&this.buf[this.pos])<<7*C+3)>>>0,this.buf[this.pos++]<128)return w}throw Error("invalid varint encoding")}function T(w,C){return(w[C-4]|w[C-3]<<8|w[C-2]<<16|w[C-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw h(this,8);return new c(T(this.buf,this.pos+=4),T(this.buf,this.pos+=4))}p.create=g(),p.prototype.k=l.Array.prototype.subarray||l.Array.prototype.slice,p.prototype.uint32=(m=4294967295,function(){if(m=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(m=(m|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(m=(m|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return m;throw this.pos=this.len,h(this,10)}),p.prototype.int32=function(){return 0|this.uint32()},p.prototype.sint32=function(){var w=this.uint32();return w>>>1^-(1&w)|0},p.prototype.bool=function(){return this.uint32()!==0},p.prototype.fixed32=function(){if(this.pos+4>this.len)throw h(this,4);return T(this.buf,this.pos+=4)},p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw h(this,4);return 0|T(this.buf,this.pos+=4)},p.prototype.float=function(){if(this.pos+4>this.len)throw h(this,4);var w=l.float.readFloatLE(this.buf,this.pos);return this.pos+=4,w},p.prototype.double=function(){if(this.pos+8>this.len)throw h(this,4);var w=l.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,w},p.prototype.bytes=function(){var w=this.uint32(),C=this.pos,R=this.pos+w;if(R>this.len)throw h(this,w);return this.pos+=w,Array.isArray(this.buf)?this.buf.slice(C,R):C===R?(w=l.Buffer)?w.alloc(0):new this.buf.constructor(0):this.k.call(this.buf,C,R)},p.prototype.string=function(){var w=this.bytes();return d.read(w,0,w.length)},p.prototype.skip=function(w){if(typeof w=="number"){if(this.pos+w>this.len)throw h(this,w);this.pos+=w}else do if(this.pos>=this.len)throw h(this);while(128&this.buf[this.pos++]);return this},p.recursionLimit=l.recursionLimit,p.prototype.skipType=function(w,C){if(p.recursionLimit<(C=C===e?0:C))throw Error("maximum nesting depth exceeded");switch(w){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(w=7&this.uint32())!=4;)this.skipType(w,C+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+w+" at offset "+this.pos)}return this},p.c=function(w){a=w,p.create=g(),a.c();var C=l.Long?"toLong":"toNumber";l.merge(p.prototype,{int64:function(){return S.call(this)[C](!1)},uint64:function(){return S.call(this)[C](!0)},sint64:function(){return S.call(this).zzDecode()[C](!1)},fixed64:function(){return v.call(this)[C](!0)},sfixed64:function(){return v.call(this)[C](!1)}})}},{35:35}],25:[function(r,i,o){i.exports=c;var a=r(24),l=((c.prototype=Object.create(a.prototype)).constructor=c,r(35));function c(d){a.call(this,d)}c.c=function(){l.Buffer&&(c.prototype.k=l.Buffer.prototype.slice)},c.prototype.string=function(){var d=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+d,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+d,this.len))},c.c()},{24:24,35:35}],26:[function(r,i,o){i.exports=E;var a,l,c,d=r(21),h=(((E.prototype=Object.create(d.prototype)).constructor=E).className="Root",r(15)),p=r(14),g=r(23),m=r(33);function E(w){d.call(this,"",w),this.deferred=[],this.files=[],this.e="proto2",this.y={}}function S(){}E.fromJSON=function(w,C){return C=C||new E,w.options&&C.setOptions(w.options),C.addJSON(w.nested).resolveAll()},E.prototype.resolvePath=m.path.resolve,E.prototype.fetch=m.fetch,E.prototype.load=function w(C,R,k){typeof R=="function"&&(k=R,R=e);var P=this;if(!k)return m.asPromise(w,P,C,R);var I=k===S;function U(Y,ce){if(k){if(I)throw Y;ce&&ce.resolveAll();var ne=k;k=null,ne(Y,ce)}}function ee(Y){var ce=Y.lastIndexOf("google/protobuf/");return-1<ce&&(Y=Y.substring(ce),Y in c)?Y:null}function $(Y,ce){try{if(m.isString(ce)&&(ce[0]||"")=="{"&&(ce=JSON.parse(ce)),m.isString(ce)){l.filename=Y;var ne,J=l(ce,P,R),ae=0;if(J.imports)for(;ae<J.imports.length;++ae)(ne=ee(J.imports[ae])||P.resolvePath(Y,J.imports[ae]))&&te(ne);if(J.weakImports)for(ae=0;ae<J.weakImports.length;++ae)(ne=ee(J.weakImports[ae])||P.resolvePath(Y,J.weakImports[ae]))&&te(ne,!0)}else P.setOptions(ce.options).addJSON(ce.nested)}catch(O){U(O)}I||Q||U(null,P)}function te(Y,ce){if(Y=ee(Y)||Y,!~P.files.indexOf(Y))if(P.files.push(Y),Y in c)I?$(Y,c[Y]):(++Q,setTimeout(function(){--Q,$(Y,c[Y])}));else if(I){var ne;try{ne=m.fs.readFileSync(Y).toString("utf8")}catch(J){return void(ce||U(J))}$(Y,ne)}else++Q,P.fetch(Y,function(J,ae){--Q,k&&(J?ce?Q||U(null,P):U(J):$(Y,ae))})}var Q=0;m.isString(C)&&(C=[C]);for(var q,G=0;G<C.length;++G)(q=P.resolvePath("",C[G]))&&te(q);return I?P.resolveAll():Q||U(null,P),P},E.prototype.loadSync=function(w,C){if(m.isNode)return this.load(w,C,S);throw Error("not supported")},E.prototype.resolveAll=function(){if(!this.b)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(w){return"'extend "+w.extend+"' in "+w.parent.fullName}).join(", "));return d.prototype.resolveAll.call(this)};var T=/^[A-Z]/;function v(w,C){var R,k=C.parent.lookup(C.extend);if(k)return R=new h(C.fullName,C.id,C.type,C.rule,e,C.options),k.get(R.name)||((R.declaringField=C).extensionField=R,k.add(R)),1}E.prototype.j=function(w){if(w instanceof h)w.extend===e||w.extensionField||v(0,w)||this.deferred.push(w);else if(w instanceof p)T.test(w.name)&&(w.parent[w.name]=w.values);else if(!(w instanceof g)){if(w instanceof a)for(var C=0;C<this.deferred.length;)v(0,this.deferred[C])?this.deferred.splice(C,1):++C;for(var R=0;R<w.nestedArray.length;++R)this.j(w.a[R]);T.test(w.name)&&(w.parent[w.name]=w)}(w instanceof a||w instanceof p||w instanceof h)&&(this.y[w.fullName]=w)},E.prototype.O=function(w){var C;if(w instanceof h)w.extend!==e&&(w.extensionField?(w.extensionField.parent.remove(w.extensionField),w.extensionField=null):-1<(C=this.deferred.indexOf(w))&&this.deferred.splice(C,1));else if(w instanceof p)T.test(w.name)&&delete w.parent[w.name];else if(w instanceof d){for(var R=0;R<w.nestedArray.length;++R)this.O(w.a[R]);T.test(w.name)&&delete w.parent[w.name]}delete this.y[w.fullName]},E.c=function(w,C,R){a=w,l=C,c=R}},{14:14,15:15,21:21,23:23,33:33}],27:[function(r,i,o){i.exports={}},{}],28:[function(r,i,o){o.Service=r(29)},{29:29}],29:[function(r,i,o){i.exports=l;var a=r(35);function l(c,d,h){if(typeof c!="function")throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=c,this.requestDelimited=!!d,this.responseDelimited=!!h}((l.prototype=Object.create(a.EventEmitter.prototype)).constructor=l).prototype.rpcCall=function c(d,h,p,g,m){if(!g)throw TypeError("request must be specified");var E=this;if(!m)return a.asPromise(c,E,d,h,p,g);if(!E.rpcImpl)return setTimeout(function(){m(Error("already ended"))},0),e;try{return E.rpcImpl(d,h[E.requestDelimited?"encodeDelimited":"encode"](g).finish(),function(S,T){if(S)return E.emit("error",S,d),m(S);if(T===null)return E.end(!0),e;if(!(T instanceof p))try{T=p[E.responseDelimited?"decodeDelimited":"decode"](T)}catch(v){return E.emit("error",v,d),m(v)}return E.emit("data",T,d),m(null,T)})}catch(S){return E.emit("error",S,d),setTimeout(function(){m(S)},0),e}},l.prototype.end=function(c){return this.rpcImpl&&(c||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(r,i,o){i.exports=p;var a=r(21),l=(((p.prototype=Object.create(a.prototype)).constructor=p).className="Service",r(20)),c=r(33),d=r(28),h=c.patterns.reservedRe;function p(m,E){a.call(this,m,E),this.methods={},this._=null}function g(m){return m._=null,m}p.fromJSON=function(m,E){var S=new p(m,E.options);if(E.methods)for(var T=Object.keys(E.methods),v=0;v<T.length;++v)S.add(l.fromJSON(T[v],E.methods[T[v]]));return E.nested&&S.addJSON(E.nested),E.edition&&(S.e=E.edition),S.comment=E.comment,S.u="proto3",S},p.prototype.toJSON=function(m){var E=a.prototype.toJSON.call(this,m),S=!!m&&!!m.keepComments;return c.toObject(["edition",this.h(),"options",E&&E.options||e,"methods",a.arrayToJSON(this.methodsArray,m)||{},"nested",E&&E.nested||e,"comment",S?this.comment:e])},Object.defineProperty(p.prototype,"methodsArray",{get:function(){return this._||(this._=c.toArray(this.methods))}}),p.prototype.get=function(m){return Object.prototype.hasOwnProperty.call(this.methods,m)?this.methods[m]:a.prototype.get.call(this,m)},p.prototype.resolveAll=function(){if(this.b){a.prototype.resolve.call(this);for(var m=this.methodsArray,E=0;E<m.length;++E)m[E].resolve()}return this},p.prototype.v=function(m){return this.p&&(m=this.e||m,a.prototype.v.call(this,m),this.methodsArray.forEach(E=>{E.v(m)})),this},p.prototype.add=function(m){if(this.get(m.name))throw Error("duplicate name '"+m.name+"' in "+this);return m instanceof l?m.name==="__proto__"?this:g((this.methods[m.name]=m).parent=this):a.prototype.add.call(this,m)},p.prototype.remove=function(m){if(m instanceof l){if(this.methods[m.name]!==m)throw Error(m+" is not a member of "+this);return delete this.methods[m.name],m.parent=null,g(this)}return a.prototype.remove.call(this,m)},p.prototype.create=function(m,E,S){for(var T,v=new d.Service(m,E,S),w=0;w<this.methodsArray.length;++w){var C=c.lcFirst((T=this._[w]).resolve().name).replace(/[^$\w_]/g,"");v[C]=c.codegen(["r","c"],h.test(C)?C+"_":C)("return this.rpcCall(m,q,s,r,c)")({m:T,q:T.resolvedRequestType.ctor,s:T.resolvedResponseType.ctor})}return v}},{20:20,21:21,28:28,33:33}],31:[function(r,i,o){i.exports=k;var a=r(21),l=(((k.prototype=Object.create(a.prototype)).constructor=k).className="Type",r(14)),c=r(23),d=r(15),h=r(18),p=r(30),g=r(19),m=r(24),E=r(39),S=r(33),T=r(13),v=r(12),w=r(37),C=r(11),R=r(38);function k(I,U){I=I.replace(/\W/g,""),a.call(this,I,U),this.fields={},this.oneofs=e,this.extensions=e,this.reserved=e,this.group=e,this.A=null,this.i=null,this.T=null,this.x=null}function P(I){return I.A=I.i=I.T=null,delete I.encode,delete I.decode,delete I.verify,I}Object.defineProperties(k.prototype,{fieldsById:{get:function(){if(!this.A){this.A={};for(var I=Object.keys(this.fields),U=0;U<I.length;++U){var ee=this.fields[I[U]],$=ee.id;if(this.A[$])throw Error("duplicate id "+$+" in "+this);this.A[$]=ee}}return this.A}},fieldsArray:{get:function(){return this.i||(this.i=S.toArray(this.fields))}},oneofsArray:{get:function(){return this.T||(this.T=S.toArray(this.oneofs))}},ctor:{get:function(){return this.x||(this.ctor=k.generateConstructor(this)())},set:function(I){for(var U=I.prototype,ee=(U instanceof g||((I.prototype=new g).constructor=I,S.merge(I.prototype,U)),I.$type=I.prototype.$type=this,S.merge(I,g,!0),this.x=I,0);ee<this.fieldsArray.length;++ee)this.i[ee].resolve();for(var $={},ee=0;ee<this.oneofsArray.length;++ee)$[this.T[ee].resolve().name]={get:S.oneOfGetter(this.T[ee].oneof),set:S.oneOfSetter(this.T[ee].oneof)};ee&&Object.defineProperties(I.prototype,$)}}}),k.generateConstructor=function(I){for(var U,ee=S.codegen(["p"],I.name),$=0;$<I.fieldsArray.length;++$)(U=I.i[$]).map?ee("this%s={}",S.safeProp(U.name)):U.repeated&&ee("this%s=[]",S.safeProp(U.name));return ee('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")},k.fromJSON=function(I,U){for(var ee=new k(I,U.options),$=(ee.extensions=U.extensions,ee.reserved=U.reserved,Object.keys(U.fields)),te=0;te<$.length;++te)ee.add((U.fields[$[te]].keyType!==void 0?h:d).fromJSON($[te],U.fields[$[te]]));if(U.oneofs)for($=Object.keys(U.oneofs),te=0;te<$.length;++te)ee.add(c.fromJSON($[te],U.oneofs[$[te]]));if(U.nested)for($=Object.keys(U.nested),te=0;te<$.length;++te){var Q=U.nested[$[te]];ee.add((Q.id!==e?d:Q.fields!==e?k:Q.values!==e?l:Q.methods!==e?p:a).fromJSON($[te],Q))}return U.extensions&&U.extensions.length&&(ee.extensions=U.extensions),U.reserved&&U.reserved.length&&(ee.reserved=U.reserved),U.group&&(ee.group=!0),U.comment&&(ee.comment=U.comment),U.edition&&(ee.e=U.edition),ee.u="proto3",ee},k.prototype.toJSON=function(I){var U=a.prototype.toJSON.call(this,I),ee=!!I&&!!I.keepComments;return S.toObject(["edition",this.h(),"options",U&&U.options||e,"oneofs",a.arrayToJSON(this.oneofsArray,I),"fields",a.arrayToJSON(this.fieldsArray.filter(function($){return!$.declaringField}),I)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:e,"reserved",this.reserved&&this.reserved.length?this.reserved:e,"group",this.group||e,"nested",U&&U.nested||e,"comment",ee?this.comment:e])},k.prototype.resolveAll=function(){if(this.b){a.prototype.resolveAll.call(this);for(var I=this.oneofsArray,U=0;U<I.length;)I[U++].resolve();for(var ee=this.fieldsArray,U=0;U<ee.length;)ee[U++].resolve()}return this},k.prototype.v=function(I){return this.p&&(I=this.e||I,a.prototype.v.call(this,I),this.oneofsArray.forEach(U=>{U.r(I)}),this.fieldsArray.forEach(U=>{U.r(I)})),this},k.prototype.get=function(I){return Object.prototype.hasOwnProperty.call(this.fields,I)?this.fields[I]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,I)?this.oneofs[I]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,I)?this.nested[I]:null},k.prototype.add=function(I){if(this.get(I.name))throw Error("duplicate name '"+I.name+"' in "+this);if(I instanceof d&&I.extend===e){if((this.A||this.fieldsById)[I.id])throw Error("duplicate id "+I.id+" in "+this);if(this.isReservedId(I.id))throw Error("id "+I.id+" is reserved in "+this);if(this.isReservedName(I.name))throw Error("name '"+I.name+"' is reserved in "+this);return I.name==="__proto__"?this:(I.parent&&I.parent.remove(I),(this.fields[I.name]=I).message=this,I.onAdd(this),P(this))}return I instanceof c?I.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[I.name]=I).onAdd(this),P(this)):a.prototype.add.call(this,I)},k.prototype.remove=function(I){if(I instanceof d&&I.extend===e){if(this.fields&&this.fields[I.name]===I)return delete this.fields[I.name],I.parent=null,I.onRemove(this),P(this);throw Error(I+" is not a member of "+this)}if(I instanceof c){if(this.oneofs&&this.oneofs[I.name]===I)return delete this.oneofs[I.name],I.parent=null,I.onRemove(this),P(this);throw Error(I+" is not a member of "+this)}return a.prototype.remove.call(this,I)},k.prototype.isReservedId=function(I){return a.isReservedId(this.reserved,I)},k.prototype.isReservedName=function(I){return a.isReservedName(this.reserved,I)},k.prototype.create=function(I){return new this.ctor(I)},k.prototype.setup=function(){for(var $=this.fullName,I=[],U=0;U<this.fieldsArray.length;++U)I.push(this.i[U].resolve().resolvedType);this.encode=T(this)({Writer:E,types:I,util:S}),this.decode=v(this)({Reader:m,types:I,util:S}),this.verify=w(this)({types:I,util:S}),this.fromObject=C.fromObject(this)({types:I,util:S}),this.toObject=C.toObject(this)({types:I,util:S});var ee,$=R[$];return $&&((ee=Object.create(this)).fromObject=this.fromObject,this.fromObject=$.fromObject.bind(ee),ee.toObject=this.toObject,this.toObject=$.toObject.bind(ee)),this},k.prototype.encode=function(I,U){return this.setup().encode(I,U)},k.prototype.encodeDelimited=function(I,U){return this.encode(I,U&&U.len?U.fork():U).ldelim()},k.prototype.decode=function(I,U,ee,$){return this.setup().decode(I,U,ee,$)},k.prototype.decodeDelimited=function(I){return I instanceof m||(I=m.create(I)),this.decode(I,I.uint32())},k.prototype.verify=function(I,U){return this.setup().verify(I,U)},k.prototype.fromObject=function(I,U){return this.setup().fromObject(I,U)},k.prototype.toObject=function(I,U){return this.setup().toObject(I,U)},k.d=function(I){return function(U){S.decorateType(U,I)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,37:37,38:38,39:39}],32:[function(a,i,o){var a=a(33),l=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function c(d,h){var p=0,g=Object.create(null);for(h|=0;p<d.length;)g[l[p+h]]=d[p++];return g}o.basic=c([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),o.defaults=c([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",a.emptyArray,null]),o.long=c([0,0,0,1,1],7),o.mapKey=c([0,0,0,5,5,0,0,0,1,1,0,2],2),o.packed=c([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(r,i,o){var a,l,c=i.exports=r(35),d=r(27),h=(c.codegen=r(3),c.fetch=r(5),c.path=r(8),c.patterns=r(36),c.patterns.reservedRe),p=c.patterns.unsafePropertyRe,g=(c.fs=c.inquire("fs"),c.toArray=function(E){if(E){for(var S=Object.keys(E),T=Array(S.length),v=0;v<S.length;)T[v]=E[S[v++]];return T}return[]},c.toObject=function(E){for(var S={},T=0;T<E.length;){var v=E[T++],w=E[T++];w!==e&&(S[v]=w)}return S},c.isReserved=function(E){return h.test(E)},c.safeProp=function(E){return!/^[$\w_]+$/.test(E)||h.test(E)?"["+JSON.stringify(E)+"]":"."+E},c.ucFirst=function(E){return(E[0]||"").toUpperCase()+E.substring(1)},/_([a-z])/g),m=(c.camelCase=function(E){return E.substring(0,1)+E.substring(1).replace(g,function(S,T){return T.toUpperCase()})},c.compareFieldsById=function(E,S){return E.id-S.id},c.decorateType=function(E,S){return E.$type?(S&&E.$type.name!==S&&(c.decorateRoot.remove(E.$type),E.$type.name=S,c.decorateRoot.add(E.$type)),E.$type):(S=new(a=a||r(31))(S||E.name),c.decorateRoot.add(S),S.ctor=E,Object.defineProperty(E,"$type",{value:S,enumerable:!1}),Object.defineProperty(E.prototype,"$type",{value:S,enumerable:!1}),S)},0);c.decorateEnum=function(E){var S;return E.$type||(S=new(l=l||r(14))("Enum"+m++,E),c.decorateRoot.add(S),Object.defineProperty(E,"$type",{value:S,enumerable:!1}),S)},c.setProperty=function(E,S,T,v){if(typeof E!="object")throw TypeError("dst must be an object");if(S)return(function w(C,R,k){var P=R.shift();if(!p.test(P))if(0<R.length)C[P]=w(C[P]||{},R,k);else{if((R=C[P])&&v)return C;R&&(k=[].concat(R).concat(k)),C[P]=k}return C})(E,S=S.split("."),T);throw TypeError("path must be specified")},Object.defineProperty(c,"decorateRoot",{get:function(){return d.decorated||(d.decorated=new(r(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,36:36,5:5,8:8}],34:[function(r,i,o){i.exports=l;var a=r(35);function l(h,p){this.lo=h>>>0,this.hi=p>>>0}var c=l.zero=new l(0,0),d=(c.toNumber=function(){return 0},c.zzEncode=c.zzDecode=function(){return this},c.length=function(){return 1},l.zeroHash="\0\0\0\0\0\0\0\0",l.fromNumber=function(h){var p,g;return h===0?c:(g=(h=(p=h<0)?-h:h)>>>0,h=(h-g)/4294967296>>>0,p&&(h=~h>>>0,g=~g>>>0,4294967295<++g&&(g=0,4294967295<++h&&(h=0))),new l(g,h))},l.from=function(h){if(typeof h=="number")return l.fromNumber(h);if(a.isString(h)){if(!a.Long)return l.fromNumber(parseInt(h,10));h=a.Long.fromString(h)}return h.low||h.high?new l(h.low>>>0,h.high>>>0):c},l.prototype.toNumber=function(h){var p;return!h&&this.hi>>>31?(h=1+~this.lo>>>0,p=~this.hi>>>0,-(h+4294967296*(p=h?p:p+1>>>0))):this.lo+4294967296*this.hi},l.prototype.toLong=function(h){return a.Long?new a.Long(0|this.lo,0|this.hi,!!h):{low:0|this.lo,high:0|this.hi,unsigned:!!h}},String.prototype.charCodeAt);l.fromHash=function(h){return h==="\0\0\0\0\0\0\0\0"?c:new l((d.call(h,0)|d.call(h,1)<<8|d.call(h,2)<<16|d.call(h,3)<<24)>>>0,(d.call(h,4)|d.call(h,5)<<8|d.call(h,6)<<16|d.call(h,7)<<24)>>>0)},l.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},l.prototype.zzEncode=function(){var h=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^h)>>>0,this.lo=(this.lo<<1^h)>>>0,this},l.prototype.zzDecode=function(){var h=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^h)>>>0,this.hi=(this.hi>>>1^h)>>>0,this},l.prototype.length=function(){var h=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,g=this.hi>>>24;return g==0?p==0?h<16384?h<128?1:2:h<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:g<128?9:10}},{35:35}],35:[function(r,i,o){var a=o;function l(d,h,p){for(var g=Object.keys(h),m=0;m<g.length;++m)d[g[m]]!==e&&p||g[m]!=="__proto__"&&(d[g[m]]=h[g[m]]);return d}function c(d){function h(p,g){if(!(this instanceof h))return new h(p,g);Object.defineProperty(this,"message",{get:function(){return p}}),Error.captureStackTrace?Error.captureStackTrace(this,h):Object.defineProperty(this,"stack",{value:Error().stack||""}),g&&l(this,g)}return h.prototype=Object.create(Error.prototype,{constructor:{value:h,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return d},set:e,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),h}a.asPromise=r(1),a.base64=r(2),a.EventEmitter=r(4),a.float=r(6),a.inquire=r(7),a.utf8=r(10),a.pool=r(9),a.LongBits=r(34),a.isNode=!!(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node),a.global=a.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||this,a.emptyArray=Object.freeze?Object.freeze([]):[],a.emptyObject=Object.freeze?Object.freeze({}):{},a.isInteger=Number.isInteger||function(d){return typeof d=="number"&&isFinite(d)&&Math.floor(d)===d},a.isString=function(d){return typeof d=="string"||d instanceof String},a.isObject=function(d){return d&&typeof d=="object"},a.isset=a.isSet=function(d,h){var p=d[h];return p!=null&&d.hasOwnProperty(h)&&(typeof p!="object"||0<(Array.isArray(p)?p:Object.keys(p)).length)},a.Buffer=null,a.S=null,a.L=null,a.newBuffer=function(d){return typeof d=="number"?a.Buffer?a.L(d):new a.Array(d):a.Buffer?a.S(d):typeof Uint8Array=="undefined"?d:new Uint8Array(d)},a.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,a.Long=a.global.dcodeIO&&a.global.dcodeIO.Long||a.global.Long||a.inquire("long"),a.key2Re=/^true|false|0|1$/,a.key32Re=/^-?(?:0|[1-9][0-9]*)$/,a.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,a.longToHash=function(d){return d?a.LongBits.from(d).toHash():a.LongBits.zeroHash},a.longFromHash=function(d,h){return d=a.LongBits.fromHash(d),a.Long?a.Long.fromBits(d.lo,d.hi,h):d.toNumber(!!h)},a.merge=l,a.recursionLimit=100,a.makeProp=function(d,h){Object.defineProperty(d,h,{enumerable:!0,configurable:!0,writable:!0})},a.lcFirst=function(d){return(d[0]||"").toLowerCase()+d.substring(1)},a.newError=c,a.ProtocolError=c("ProtocolError"),a.oneOfGetter=function(d){for(var h={},p=0;p<d.length;++p)h[d[p]]=1;return function(){for(var g=Object.keys(this),m=g.length-1;-1<m;--m)if(h[g[m]]===1&&this[g[m]]!==e&&this[g[m]]!==null)return g[m]}},a.oneOfSetter=function(d){return function(h){for(var p=0;p<d.length;++p)d[p]!==h&&delete this[d[p]]}},a.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},a.c=function(){var d=a.Buffer;d?(a.S=d.from!==Uint8Array.from&&d.from||function(h,p){return new d(h,p)},a.L=d.allocUnsafe||function(h){return new d(h)}):a.S=a.L=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(r,i,o){o.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,o.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,o.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/,o.unsafePropertyRe=/^(?:__proto__|prototype|constructor)$/},{}],37:[function(r,i,o){i.exports=function(h){var p=l.codegen(["m","n"],h.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),g=h.oneofsArray,m={};g.length&&p("var p={}");for(var E=0;E<h.fieldsArray.length;++E){var S,T=h.i[E].resolve(),v="m"+l.safeProp(T.name);T.optional&&p("if(%s!=null&&m.hasOwnProperty(%j)){",v,T.name),T.map?(p("if(!util.isObject(%s))",v)("return%j",c(T,"object"))("var k=Object.keys(%s)",v)("for(var i=0;i<k.length;++i){"),(function(w,C,R){switch(C.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":w("if(!util.key32Re.test(%s))",R)("return%j",c(C,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":w("if(!util.key64Re.test(%s))",R)("return%j",c(C,"integer|Long key"));break;case"bool":w("if(!util.key2Re.test(%s))",R)("return%j",c(C,"boolean key"))}})(p,T,"k[i]"),d(p,T,E,v+"[k[i]]")("}")):T.repeated?(p("if(!Array.isArray(%s))",v)("return%j",c(T,"array"))("for(var i=0;i<%s.length;++i){",v),d(p,T,E,v+"[i]")("}")):(T.partOf&&(S=l.safeProp(T.partOf.name),m[T.partOf.name]===1&&p("if(p%s===1)",S)("return%j",T.partOf.name+": multiple values"),m[T.partOf.name]=1,p("p%s=1",S)),d(p,T,E,v)),T.optional&&p("}")}return p("return null")};var a=r(14),l=r(33);function c(h,p){return h.name+": "+p+(h.repeated&&p!=="array"?"[]":h.map&&p!=="object"?"{k:"+h.keyType+"}":"")+" expected"}function d(h,p,g,m){if(p.resolvedType)if(p.resolvedType instanceof a){h("switch(%s){",m)("default:")("return%j",c(p,"enum value"));for(var E=Object.keys(p.resolvedType.values),S=0;S<E.length;++S)h("case %i:",p.resolvedType.values[E[S]]);h("break")("}")}else h("{")("var e=types[%i].verify(%s,n+1);",g,m)("if(e)")("return%j+e",p.name+".")("}");else switch(p.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":h("if(!util.isInteger(%s))",m)("return%j",c(p,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":h("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",m,m,m,m)("return%j",c(p,"integer|Long"));break;case"float":case"double":h('if(typeof %s!=="number")',m)("return%j",c(p,"number"));break;case"bool":h('if(typeof %s!=="boolean")',m)("return%j",c(p,"boolean"));break;case"string":h("if(!util.isString(%s))",m)("return%j",c(p,"string"));break;case"bytes":h('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',m,m,m)("return%j",c(p,"buffer"))}return h}},{14:14,33:33}],38:[function(r,i,o){var a=r(19);o[".google.protobuf.Any"]={fromObject:function(l,c){if(l&&l["@type"]){var d,h=l["@type"].substring(1+l["@type"].lastIndexOf("/")),h=this.lookup(h);if(h)return~(d=(l["@type"][0]||"")=="."?l["@type"].slice(1):l["@type"]).indexOf("/")||(d="/"+d),this.create({type_url:d,value:h.encode(h.fromObject(l,c===e?1:c+1)).finish()})}return this.fromObject(l,c)},toObject:function(l,c){var d,h,p="",g="";return c&&c.json&&l.type_url&&l.value&&(g=l.type_url.substring(1+l.type_url.lastIndexOf("/")),p=l.type_url.substring(0,1+l.type_url.lastIndexOf("/")),(d=this.lookup(g))&&(l=d.decode(l.value))),!(l instanceof this.ctor)&&l instanceof a?(d=l.$type.toObject(l,c),h=l.$type.fullName[0]==="."?l.$type.fullName.slice(1):l.$type.fullName,d["@type"]=g=(p=p===""?"type.googleapis.com/":p)+h,d):this.toObject(l,c)}}},{19:19}],39:[function(r,i,o){i.exports=E;var a,l=r(35),c=l.LongBits,d=l.base64,h=l.utf8;function p(k,P,I){this.fn=k,this.len=P,this.next=e,this.val=I}function g(){}function m(k){this.head=k.head,this.tail=k.tail,this.len=k.len,this.next=k.states}function E(){this.len=0,this.head=new p(g,0,0),this.tail=this.head,this.states=null}function S(){return l.Buffer?function(){return(E.create=function(){return new a})()}:function(){return new E}}function T(k,P,I){P[I]=255&k}function v(k,P){this.len=k,this.next=e,this.val=P}function w(k,P,I){for(;k.hi;)P[I++]=127&k.lo|128,k.lo=(k.lo>>>7|k.hi<<25)>>>0,k.hi>>>=7;for(;127<k.lo;)P[I++]=127&k.lo|128,k.lo=k.lo>>>7;P[I++]=k.lo}function C(k,P,I){P[I]=255&k,P[I+1]=k>>>8&255,P[I+2]=k>>>16&255,P[I+3]=k>>>24}E.create=S(),E.alloc=function(k){return new l.Array(k)},l.Array!==Array&&(E.alloc=l.pool(E.alloc,l.Array.prototype.subarray)),E.prototype.N=function(k,P,I){return this.tail=this.tail.next=new p(k,P,I),this.len+=P,this},(v.prototype=Object.create(p.prototype)).fn=function(k,P,I){for(;127<k;)P[I++]=127&k|128,k>>>=7;P[I]=k},E.prototype.uint32=function(k){return this.len+=(this.tail=this.tail.next=new v((k>>>=0)<128?1:k<16384?2:k<2097152?3:k<268435456?4:5,k)).len,this},E.prototype.int32=function(k){return k<0?this.N(w,10,c.fromNumber(k)):this.uint32(k)},E.prototype.sint32=function(k){return this.uint32((k<<1^k>>31)>>>0)},E.prototype.int64=E.prototype.uint64=function(k){return k=c.from(k),this.N(w,k.length(),k)},E.prototype.sint64=function(k){return k=c.from(k).zzEncode(),this.N(w,k.length(),k)},E.prototype.bool=function(k){return this.N(T,1,k?1:0)},E.prototype.sfixed32=E.prototype.fixed32=function(k){return this.N(C,4,k>>>0)},E.prototype.sfixed64=E.prototype.fixed64=function(k){return k=c.from(k),this.N(C,4,k.lo).N(C,4,k.hi)},E.prototype.float=function(k){return this.N(l.float.writeFloatLE,4,k)},E.prototype.double=function(k){return this.N(l.float.writeDoubleLE,8,k)};var R=l.Array.prototype.set?function(k,P,I){P.set(k,I)}:function(k,P,I){for(var U=0;U<k.length;++U)P[I+U]=k[U]};E.prototype.bytes=function(k){var P,I=k.length>>>0;return I?(l.isString(k)&&(P=E.alloc(I=d.length(k)),d.decode(k,P,0),k=P),this.uint32(I).N(R,I,k)):this.N(T,1,0)},E.prototype.string=function(k){var P=h.length(k);return P?this.uint32(P).N(h.write,P,k):this.N(T,1,0)},E.prototype.fork=function(){return this.states=new m(this),this.head=this.tail=new p(g,0,0),this.len=0,this},E.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new p(g,0,0),this.len=0),this},E.prototype.ldelim=function(){var k=this.head,P=this.tail,I=this.len;return this.reset().uint32(I),I&&(this.tail.next=k.next,this.tail=P,this.len+=I),this},E.prototype.finish=function(){for(var k=this.head.next,P=this.constructor.alloc(this.len),I=0;k;)k.fn(k.val,P,I),I+=k.len,k=k.next;return P},E.c=function(k){a=k,E.create=S(),a.c()}},{35:35}],40:[function(r,i,o){i.exports=c;var a=r(39),l=((c.prototype=Object.create(a.prototype)).constructor=c,r(35));function c(){a.call(this)}function d(h,p,g){h.length<40?l.utf8.write(h,p,g):p.utf8Write?p.utf8Write(h,g):p.write(h,g)}c.c=function(){c.alloc=l.L,c.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&l.Buffer.prototype.set.name==="set"?function(h,p,g){p.set(h,g)}:function(h,p,g){if(h.copy)h.copy(p,g,0,h.length);else for(var m=0;m<h.length;)p[g++]=h[m++]}},c.prototype.bytes=function(h){var p=(h=l.isString(h)?l.S(h,"base64"):h).length>>>0;return this.uint32(p),p&&this.N(c.writeBytesBuffer,p,h),this},c.prototype.string=function(h){var p=l.Buffer.byteLength(h);return this.uint32(p),p&&this.N(d,p,h),this},c.c()},{35:35,39:39}]},n={},ig=(function r(i){var o=n[i];return o||t[i][0].call(o=n[i]={exports:{}},r,o,o.exports),o.exports})([16][0])})();class bz{constructor(){this._typeStore=new Map}getSchemaType(t){le.requireArgument(t,"schema");const n=Nt.getSchemaId(t);let r=this._typeStore.get(n);return r||(r=ig.Root.fromJSON(t.pbjsSchema).lookupType(n),this._typeStore.set(n,r)),r}validate(t,n){le.requireArgument(t,"schema"),le.requireArgument(n,"data");const r=this.getSchemaType(t),i=r.verify(n);if(i)throw new Error(`Data is invalid for ${r.fullName}: ${i}`);return r}encode(t,n){const r=this.validate(t,n),i=r.fromObject(n);return r.encode(i).finish()}encodePayload(t){if(t!=null&&t.schema&&t.payload)return{schemaName:Nt.getSchemaId(t.schema),payload:this.encode(t.schema,t.payload)}}getLogMessage(t,n,r){return{timestamp:r.timestamp,data:this.encode(t,n),age:r.age,rootId:r.rootId,seq:r.sequence,sseq:r.schemaSequence,loggerName:r.loggerName,pagePayload:this.encodePayload(r.pagePayload),loggerAppName:r.loggerAppName,connectionType:r.connectionType,appPayload:this.encodePayload(r.appPayload),csId:r.clientSessionId,recCsId:r.receiverClientSessionId,recRootId:r.receiverRootId,tenantClass:r.tenantClass}}processRawLogMessage(t,n){const r=n.data?Object.assign({},n.data):{};return Nt.isInternal(t)&&r.userPayload&&(r.userPayload=this.encodePayload(r.userPayload)),Object.assign({},n,{data:this.encode(t,r),pagePayload:this.encodePayload(n.pagePayload),appPayload:this.encodePayload(n.appPayload)})}}const Nu=new bz,Fx=ig.Root.fromJSON(r$.pbjsSchema).lookupType("CoreEnvelope");function Bx(e){const t=Object.assign({},e,{messages:new Map});return e.messages.forEach(function(n,r){t.messages.set(r,n.map(i=>Nu.processRawLogMessage(r,i)))}),t}function sg(e){return ea.buildFrom(e)}function og(e){const t=Fx.verify(e);if(t)throw new Error(`Invalid CoreEnvelope: ${t}`);return Fx.encode(e).finish()}function _z(e){const t=Bx(e),n=sg(t);return og(n)}var mi;(function(e){e[e.fetchBinary=0]="fetchBinary",e[e.fetchFile=1]="fetchFile",e[e.noUpload=2]="noUpload"})(mi||(mi={}));const Ux="telemetry",vz=1e4,jx=1e4,Tz=10,wz=10,Hx=mi.fetchBinary;class xz{constructor(t,n,r,i){this._messagesLimit=Tz,this._metricsLimit=wz,this._formDataKey=Ux,this._uploadInterval=jx,this._messageSize=0,this.uploadEndpoint=t,this.uploadMode=n==null?Hx:n,r&&(this._staticAttributes={appName:r.appName,appVersion:r.appVersion,appExperience:r.appExperience,deviceId:r.deviceId,deviceModel:r.deviceModel,sdkVersion:r.sdkVersion});let o=vz;if(i){const a=i.maxUniqueSchemas;if(a!==void 0){if(typeof a!="number"||!(a>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");o=a}const l=i.messagesLimit;if(l!==void 0){if(typeof l!="number"||!(l>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=l}const c=i.metricsLimit;if(c!==void 0){if(typeof c!="number"||!(c>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=c}le.requireArgumentIfDefined(i.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=i.formDataKeyName),le.requireArgumentIfDefined(i.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=i.uploadFailedListener),le.requireArgumentIfDefined(i.apiKey,"options.apiKey","string")&&(this._apiKey=i.apiKey)}this._messageBuffers=new a$(o),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(t){if(t===void 0&&(t=jx),typeof t!="number"||!(t>0))throw new Error("uploadInterval, if defined, must be > 0");t!==this._uploadInterval&&(this._uploadInterval=t,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(t){le.requireArgumentIfDefined(t,"uploadEndpoint","string"),this._uploadEndpoint=t}get uploadOptionsCallback(){return this._uploadOptionsCallback}set uploadOptionsCallback(t){le.requireArgumentIfDefined(t,"uploadOptionsCallback","function"),this._uploadOptionsCallback=t}get uploadMode(){return this._uploadMode}set uploadMode(t){if(le.requireArgumentIfDefined(t,"uploadMode","number"),t===void 0&&(t=Hx),!(t in mi))throw new Error(`Unsupported upload mode: ${t}`);this._uploadMode=t}getByteSize(t){return t>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:t>=.5?this._emptySize+this._messageSize+this.metricsCount*8:this._emptySize+this._messageSize}_stopTimer(){this._intervalHandle!==void 0&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval(()=>{this.hasData&&this._upload()},this._uploadInterval)}collect(t,n,r){return Ne(this,null,function*(){Nt.isInternal(t)&&n.userPayload&&(n.userPayload=Nu.encodePayload(n.userPayload));const i=Nu.getLogMessage(t,n,r);if(!this._messageBuffers.push(t,i))throw new Error(`Buffer is full. Refusing schemaId ${Nt.getSchemaId(t)}`);if(this._messageSize+=le.estimateObjectSize(i),this._shouldUpload())return this._upload()})}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}_upload(t){return Ne(this,null,function*(){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===mi.noUpload)return;const n=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(n,t)})}_uploadContents(t,n){return Ne(this,null,function*(){let r=this._getRequestInit(t);const i={envelopeContents:t};try{if(this._apiKey&&(r.headers["x-o11y-api-key"]=this._apiKey),this._uploadOptionsCallback){const o=this._uploadOptionsCallback()||{};if(o){if(o.headers&&r.headers)if(o.headers instanceof Headers)for(const a in r.headers)Object.prototype.hasOwnProperty.call(r.headers,a)&&o.headers.set(a,r.headers[a]);else{if(Array.isArray(o.headers))throw new Error("Headers as array is not supported.");Object.assign(o.headers,r.headers)}o.method=r.method,o.body=r.body,r=o}}if(i.response=yield fetch(this._uploadEndpoint,r),!i.response.ok)throw new Error("HTTP Not OK");return i}catch(o){if(i.error=o,!n&&this._uploadFailedListener)try{this._uploadFailedListener(i)}catch(a){}throw i}})}_getRequestInit(t){const n=sg(t),r=og(n);let i;switch(this._uploadMode){case mi.fetchBinary:i={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:r};break;case void 0:case mi.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const o=new FormData;o.append(this._formDataKey||Ux,new Blob([r])),i={method:"POST",body:o};break;case mi.noUpload:default:throw new Error("Invalid uploadMode")}return i}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===mi.noUpload)throw new Error("Upload mode is unset")}upload(t){return Ne(this,null,function*(){return this._checkUploadState(),le.requireArgumentIfDefined(t,"contents","object")?this._uploadContents(t,!0):this.hasData?this._upload(!0):void 0})}get hasData(){return this.messagesCount>0||this.metricsCount>0}get messagesCount(){return this._messageBuffers.totalItemCount}get metricsCount(){let t=0;return this._metricsExtractors&&(t+=this._metricsExtractors.getAllUpCounters().length||0,t+=this._metricsExtractors.getAllValueRecorders().length||0,t+=this._metricsExtractors.getAllBucketHistograms().length||0),t}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(t){const n={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(t)};return this._metricsExtractors&&(n.upCounters=ea.getUpCounters(this._metricsExtractors.getAllUpCounters(),t),n.valueRecorders=ea.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),t),n.bucketHistograms=ea.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),t)),t&&(this._messageSize=0),n}_buildProtoEncodedCoreEnvelope(t){const n=this._getContentsOfCoreEnvelope(t),r=sg(n);return og(r)}receiveMetricsExtractors(t){this._metricsExtractors=t}}const Sz=3e4;class Az{constructor(){if(typeof __nimbus=="undefined")throw new Error("Nimbus is unavailable");if(!__nimbus.plugins||!__nimbus.plugins.observability)throw new Error("Observability plugin not found in Nimbus plugins");this._observability=__nimbus.plugins.observability,setInterval(()=>{this._collectMetrics()},Sz)}collect(t,n,r){Nt.isInternal(t)&&n.userPayload&&(n.userPayload=Nu.encodePayload(n.userPayload));const i=Nu.getLogMessage(t,n,r),o={timestamp:r.timestamp,rootId:r.rootId,sequence:r.sequence,schemaSequence:r.schemaSequence,loggerName:r.loggerName,pagePayload:i.pagePayload,loggerAppName:r.loggerAppName,connectionType:r.connectionType,appPayload:i.appPayload,clientSessionId:r.clientSessionId,age:r.age,receiverClientSessionId:r.receiverClientSessionId,receiverRootId:r.receiverRootId};this._observability.log(Nt.getSchemaId(t),i.data,o)}receiveMetricsExtractors(t){this._metricsExtractors=t}notifyIdleDetected(t){this._observability.idleDetected(t)}_collectMetrics(){if(this._metricsExtractors){const t=this._metricsExtractors.getAllUpCounters(),n=this._metricsExtractors.getAllValueRecorders(),r=this._metricsExtractors.getAllBucketHistograms(),i=[],o=[],a=[];for(const l of n){const c={name:l.getName(),createdTimestamp:l.getCreatedOn(),lastUpdatedTimestamp:l.getLastUpdatedOn(),values:l.getData(),ownerName:l.getOwnerName(),ownerAppName:l.getOwnerAppName(),tags:this._getMetricTags(l)};i.push(c),l.reset()}for(const l of t){const c={name:l.getName(),createdTimestamp:l.getCreatedOn(),lastUpdatedTimestamp:l.getLastUpdatedOn(),value:l.getData(),ownerName:l.getOwnerName(),ownerAppName:l.getOwnerAppName(),tags:this._getMetricTags(l)};o.push(c),l.reset()}for(const l of r){const c={name:l.getName(),createdTimestamp:l.getCreatedOn(),lastUpdatedTimestamp:l.getLastUpdatedOn(),values:l.getData(),buckets:l.getBuckets(),ownerName:l.getOwnerName(),ownerAppName:l.getOwnerAppName(),tags:this._getMetricTags(l)};a.push(c),l.reset()}if(i.length>0||o.length>0){const l={upCounters:o,valueRecorders:i,bucketHistograms:a};this._observability.logMetrics(l)}}}_getMetricTags(t){const n=t.getTags();return n?Object.entries(n).map(r=>({name:r[0],value:r[1].toString()})):[]}}const Cz=Object.freeze(Object.defineProperty({__proto__:null,CoreCollector:xz,HybridCollector:Az,encodeCoreEnvelopeContentsRaw:_z,processRawContents:Bx},Symbol.toStringTag,{value:"Module"})),kz=Object.freeze(Object.defineProperty({__proto__:null,currentStateSchema:{namespace:"sf.embeddedMessaging",name:"CurrentState",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{CurrentState:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:9,type:"string"},jwtClaims:{id:7,type:"string"},stateMessage:{id:3,type:"string"},participantType:{options:{proto3_optional:!0},id:10,type:"string"},hostUrl:{id:8,type:"string"},convType:{id:6,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:5,type:"string"}}}}}}}}}},failureEventSchema:{namespace:"sf.embeddedMessaging",name:"FailureEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{FailureEvent:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:10,type:"string"},errCode:{id:5,type:"uint32"},jwtClaims:{id:8,type:"string"},participantType:{options:{proto3_optional:!0},id:11,type:"string"},hostUrl:{id:9,type:"string"},convType:{id:7,type:"string"},errMessage:{id:3,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:6,type:"string"}}}}}}}}}},interactionEventSchema:{namespace:"sf.embeddedMessaging",name:"InteractionEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{InteractionEvent:{oneofs:{_participantType:{oneof:["participantType"]}},fields:{convId:{id:5,type:"string"},op:{id:4,type:"string"},method:{id:2,type:"string"},feature:{id:3,type:"string"},fileSize:{id:6,type:"uint32"},clientName:{id:11,type:"string"},jwtClaims:{id:9,type:"string"},participantType:{options:{proto3_optional:!0},id:12,type:"string"},fileMimeType:{id:7,type:"string"},hostUrl:{id:10,type:"string"},convType:{id:8,type:"string"},configDev:{id:1,type:"string"}}}}}}}}}}},Symbol.toStringTag,{value:"Module"}));Be.AgentForceWidget=nx,Be.AgentforceWidgetProvider=fE,Be.CART_UPDATE_EVENT=vl,Be.CIMULATE_WIDGET_READY_EVENT=gy,Be.MessagingDialog=Qw,Be.MessagingEmbed=Xw,Be.MessagingModal=Jw,Be.MessagingProvider=K1,Be.OverrideElement=QH,Be.addCartUpdateListener=bC,Be.clearPageContext=vy,Be.eventHandlers=qH,Be.getAuthLinkKey=KH,Be.getPageContext=Uf,Be.injectMessagingWidget=XH,Be.removeCartUpdateListener=_C,Be.sendMessage=rx,Be.setPageContext=jf,Be.useMessaging=Vt,Object.defineProperty(Be,Symbol.toStringTag,{value:"Module"})}));
|